libposix: drafted Child structure

This commit is contained in:
Giacomo Tesio 2017-05-24 00:04:30 +02:00
parent 6b70ea29e2
commit 3307c1e7e2
4 changed files with 17 additions and 0 deletions

View File

@ -22,6 +22,7 @@
extern int *__libposix_errors_codes;
extern WaitList **__libposix_wait_list;
extern Child **__libposix_child_list;
static int __initialized;
static void
@ -43,6 +44,7 @@ libposix_init(int argc, char *argv[], PosixInit init)
extern int *__libposix_sigchld_target_pid;
WaitList *wait_list;
Child *child_list;
int status;
int error_codes[ERRNO_LAST-ERRNO_FIRST];
unsigned char signals_to_code[256];
@ -60,6 +62,10 @@ libposix_init(int argc, char *argv[], PosixInit init)
wait_list = nil;
__libposix_wait_list = &wait_list;
/* initialize child_list; used when SIGCHLD is enabled */
child_list = nil;
__libposix_wait_list = &child_list;
/* initialize signal handling */
memset(signals_to_code, 0, sizeof(signals_to_code));
memset(code_to_signal, 0, sizeof(code_to_signal));

View File

@ -23,6 +23,13 @@ struct WaitList
WaitList *next;
};
typedef struct Child Child;
struct Child
{
int pid;
Child *next;
};
extern void __libposix_files_check_conf(void);
extern void __libposix_errors_check_conf(void);
extern void __libposix_processes_check_conf(void);

View File

@ -23,6 +23,8 @@
extern char **environ;
WaitList **__libposix_wait_list;
Child **__libposix_child_list;
static PosixExitStatusTranslator __libposix_exit_status_translator;
static int __libposix_wnohang;
@ -45,6 +47,7 @@ __libposix_setup_new_process(void)
{
/* reset wait list for the child */
*__libposix_wait_list = nil;
*__libposix_child_list = nil;
}
void

View File

@ -24,6 +24,7 @@
/* rendezvous points */
extern unsigned char *__signals_to_code_map;
extern unsigned char *__code_to_signal_map;
extern Child *__libposix_child_list;
/* pointer to the pid to forward notes to */
int *__libposix_sigchld_target_pid;