If you call wait(NULL)
(wait(2)), you only wait for any child to terminate. With wait(&status)
you wait for a child to terminate but you want to know some information about it’s termination.
You can know if the child terminate normally with WIFEXITED(status)
for example.
status
contains information about processes that you can check with some already defined MACRO.
Related Posts:
- What does WEXITSTATUS(status) return?
- What does it mean to write to stdout in C?
- How to get the current directory in a C program?
- What do the dup() and dup2() systems really do?
- Reasoning behind C sockets sockaddr and sockaddr_storage
- How to pretty print XML from the command line?
- What is newline character — ‘\n’
- Why does ENOENT mean “No such file or directory”?
- What are file descriptors, explained in simple terms?
- How to kill a process running on particular port in Linux?
- Display exact matches only with grep
- What are .a and .so files?
- How can I check if a directory exists in a Bash shell script?
- Connect: Socket operation on non-socket
- Connect: Socket operation on non-socket
- How to split a delimited string into an array in awk?
- how to use wait in C
- What is the difference between read and pread in unix?
- Display exact matches only with grep
- How does wait(NULL) exactly work?
- What does ^M character mean in Vim?
- What is a bus error? Is it different from a segmentation fault?
- What do ‘real’, ‘user’ and ‘sys’ mean in the output of time(1)?
- mkdir’s “-p” option
- Shell script “for” loop syntax
- What is a bus error? Is it different from a segmentation fault?
- What can cause a “Resource temporarily unavailable” on sock send() command
- When could or should I use chmod g+s on a file or directory?
- waitpid, wnohang, wuntraced. How do I use these
- How to Sum a column in AWK?
- Equivalent of *Nix ‘which’ command in PowerShell?
- What is the difference between SIGSTOP and SIGTSTP?
- How to colorize diff on the command line
- How to colorize diff on the command line
- How to read a file into a variable in shell?
- How to make parent wait for all child processes to finish?
- Why should we check WIFEXITED after wait in order to kill child processes in Linux system call?
- Is there any simple way to benchmark Python script?
- gpg decryption fails with no secret key error
- What is the difference between tar and zip?
- Display current path in terminal only
- Which of sprintf/snprintf is more secure?
- C fopen vs open
- What is `S_ISREG()`, and what does it do?
- Reaching EOF with fgets
- What generates the “text file busy” message in Unix?
- getline() vs. fgets(): Control memory allocation
- How can I send an email through the UNIX mailx command?
- Rename multiple files based on pattern in Unix
- Example of realpath function in C
- What is the difference between a symbolic link and a hard link?
- SCP Permission denied (publickey). on EC2 only when using -r flag on directories
- binary operator expected error when checking if a file with full pathname exists
- What is special about /dev/tty?
- How do I do ‘mount –bind’ in /etc/fstab?
- How to read backward from the end of file in less or more?
- Getting the last match in a file using grep
- How big can a 64 bit unsigned integer be?
- The difference between n++ and ++n at the end of a while loop? (ANSI C)
- What is a segmentation fault?
- How many spaces for tab character(\t)?
- Implementing Taylor Series for sine and cosine in C
- Working on code to calculate cosine with factorial sum
- How to use execvp()
- How to use execvp() to execute a command
- How does strtok() split the string into tokens in C?
- warning: implicit declaration of function
- warning: implicit declaration of function
- Should a 502 HTTP status code be used if a proxy receives no response at all?
- What is *(uint32_t*)?
- What does (~0L) mean?
- pthread_join() and pthread_exit()
- JavaScript sleep/wait before continuing [duplicate]
- How do I pause my shell script for a second before continuing?
- What is size_t in C?
- What is the difference between float and double?
- what is Segmentation fault (core dumped)? [duplicate]
- What causes a segmentation fault (core dump) to occur in C?
- uint8_t vs unsigned char
- How to use symbols of extended ASCII table in C?
- Two questions about basic C programs
- What is the difference between ++i and i++?
- Using boolean values in C
- What does “collect2: error: ld returned 1 exit status” mean?
- How to convert an int to string in C?
- typedef struct vs struct definitions [duplicate]
- How to print in C
- What is the effect of extern “C” in C++?
- Why should we typedef a struct so often in C?
- Why are #ifndef and #define used in C++ header files?
- Arrow operator (->) usage in C
- strdup() – what does it do in C?
- strdup() – what does it do in C?
- What is a string of hexadecimal digits?
- Why should we typedef a struct so often in C?
- What exactly is the difference between “pass by reference” in C and in C++?
- What is the difference between ++i and i++?
- What can be the reasons of connection refused errors?
- What does “collect2: error: ld returned 1 exit status” mean?
- How to convert an int to string in C?