4
** Any required functions for process exiting.
5
** Written by Kiem-Phong Vo
9
int _AST_already_has_them;
16
int atexit(void (*exitf)(void))
27
#else /* !_lib_onexit */
29
typedef struct _exit_s
30
{ struct _exit_s* next;
31
void (*exitf)_ARG_((void));
36
atexit(void (*exitf)(void))
46
if(!(e = (Exit_t*)malloc(sizeof(Exit_t))) )
55
vtmtxunlock(_Sfmutex);
61
/* since exit() calls _cleanup(), we only need to redefine _cleanup() */
69
for(e = Exit; e; e = e->next)
77
/* in this case, we have to redefine exit() itself */
86
for(e = Exit; e; e = e->next)
91
#endif /* _exit_cleanup */
93
#endif /* _lib_onexit */
95
#endif /* !_lib_atexit */
98
int _Sf_no_need_for_waitpid;
101
/* we need to supply our own waitpid here so that sfpclose() can wait
102
** for the right process to die.
104
typedef struct _wait_
111
static Waitpid_t* Wait;
114
waitpid(int pid, int* status, int options)
116
waitpid(pid, status, options)
126
/* we don't know options */
132
for(w = Wait, last = NIL(Waitpid_t*); w; last = w, w = w->next)
133
{ if(pid > 0 && pid != w->pid)
137
last->next = w->next;
144
vtmtxunlock(_Sfmutex);
148
while((id = wait(&ps)) >= 0)
149
{ if(pid <= 0 || id == pid)
153
vtmtxunlock(_Sfmutex);
157
if(!(w = (Waitpid_t*)malloc(sizeof(Waitpid_t))) )
166
vtmtxunlock(_Sfmutex);
170
#endif /*_lib_waitpid*/
172
#endif /*!PACKAGE_ast*/