#include "awk.h"Go to the source code of this file.
Functions | |
| static NODE * | do_fork (NODE *tree) |
| static NODE * | do_waitpid (NODE *tree) |
| NODE * | dlload (NODE *tree, void *dl) |
|
||||||||||||
|
Definition at line 98 of file fork.c. References AWKNUM, do_fork(), do_waitpid(), and tmp_number. 00101 { 00102 make_builtin("fork", do_fork, 0); 00103 make_builtin("waitpid", do_waitpid, 1); 00104 return tmp_number((AWKNUM) 0); 00105 }
|
|
|
Definition at line 31 of file fork.c. References assoc_lookup(), AWKNUM, do_lint, FALSE, fork(), getpid(), getppid(), lintwarn, PROCINFO_node, tmp_number, tmp_string(), and update_ERRNO(). Referenced by dlload(). 00033 { 00034 int ret = -1; 00035 NODE **aptr; 00036 00037 if (do_lint && tree->param_cnt > 0) 00038 lintwarn("fork: called with too many arguments"); 00039 00040 ret = fork(); 00041 00042 if (ret < 0) 00043 update_ERRNO(); 00044 else if (ret == 0) { 00045 /* update PROCINFO in the child */ 00046 00047 aptr = assoc_lookup(PROCINFO_node, tmp_string("pid", 3), FALSE); 00048 (*aptr)->numbr = (AWKNUM) getpid(); 00049 00050 aptr = assoc_lookup(PROCINFO_node, tmp_string("ppid", 4), FALSE); 00051 (*aptr)->numbr = (AWKNUM) getppid(); 00052 } 00053 00054 /* Set the return value */ 00055 set_value(tmp_number((AWKNUM) ret)); 00056 00057 /* Just to make the interpreter happy */ 00058 return tmp_number((AWKNUM) 0); 00059 }
|
|
|
Definition at line 65 of file fork.c. References AWKNUM, do_lint, force_number, lintwarn, NULL, tmp_number, and update_ERRNO(). Referenced by dlload(). 00067 { 00068 NODE *pidnode; 00069 int ret = -1; 00070 double pidval; 00071 pid_t pid; 00072 int options = 0; 00073 00074 if (do_lint && tree->param_cnt > 1) 00075 lintwarn("waitpid: called with too many arguments"); 00076 00077 pidnode = get_argument(tree, 0); 00078 if (pidnode != NULL) { 00079 pidval = force_number(pidnode); 00080 pid = (int) pidval; 00081 options = WNOHANG|WUNTRACED; 00082 ret = waitpid(pid, NULL, options); 00083 if (ret < 0) 00084 update_ERRNO(); 00085 } else if (do_lint) 00086 lintwarn("wait: called with no arguments"); 00087 00088 /* Set the return value */ 00089 set_value(tmp_number((AWKNUM) ret)); 00090 00091 /* Just to make the interpreter happy */ 00092 return tmp_number((AWKNUM) 0); 00093 }
|