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
- The difference between n++ and ++n at the end of a while loop? (ANSI C)
- How many spaces for tab character(\t)?
- Working on code to calculate cosine with factorial sum
- What is the behavior of integer division?
- max value of integer
- Convert an int to ASCII character
- need help understanding the movzbl call in this function
- How to extract C source code from .so file?
- What does “control reaches end of non-void function” mean?
- connect Error: “No route to host”
- C error: undefined reference to function, but it IS defined
- What is the printf format specifier for bool?
- lvalue required as left operand of assignment
- how to convert negative hexadecimal to decimal
- Why am I getting “undefined reference to sqrt” error even though I inclu de math.h header?
- How to initialize a struct in accordance with C programming language standards
- Expression preceding parentheses?
- When and why to use malloc?
- C compile error: Id returned 1 exit status
- How do I concatenate const/literal strings in C?
- Efficient way to find task_struct by pid
- Why am I getting this memory access error ‘double free or corruption’?
- size of struct in C
- “No such file or directory” error in CodeBlocks
- Sleep/Wait command in Batch
- What is the C equivalent to the C++ cin statement?
- Assembly x86 – “leave” Instruction
- Java Wait for thread to finish
- Trim a string in C [duplicate]
- Casting a pointer to an int
- How to repeat a char using printf?
- C Unknown type name ‘my_structure’
- Source file not compiled Dev C++
- PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)
- How to concatenate string and int in C?
- execvp: bad address error
- How detect malloc failure?
- What do \t and \b do?
- How do I write stderr to a file while using “tee” with a pipe?
- write() to stdout and printf output not interleaved?
- Can I nohup/screen an already-started process?
- In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain?
- How can I rename a Unix user?