Use SIGCHLD with waitpid(); implemented wait() and waitid()

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5515 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-13 18:53:00 +00:00
parent 5ddbdd9ee9
commit b8e53dad52
18 changed files with 772 additions and 76 deletions
+3 -2
View File
@@ -1,7 +1,7 @@
/********************************************************************************
* include/nuttx/sched.h
*
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -204,6 +204,7 @@ struct _TCB
pid_t pid; /* This is the ID of the thread */
#ifdef CONFIG_SCHED_HAVE_PARENT
pid_t parent; /* This is the ID of the parent thread */
uint16_t nchildren; /* This is the number active children */
#endif
start_t start; /* Thread start function */
entry_t entry; /* Entry Point into the thread */
@@ -226,7 +227,7 @@ struct _TCB
# endif
#endif
#ifdef CONFIG_SCHED_WAITPID
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)
sem_t exitsem; /* Support for waitpid */
int *stat_loc; /* Location to return exit status */
#endif
+3 -1
View File
@@ -154,7 +154,9 @@ typedef uint16_t dev_t;
typedef uint16_t ino_t;
/* pid_t is used for process IDs and process group IDs */
/* pid_t is used for process IDs and process group IDs. It must be signed because
* negative PID values are used to represent invalid PIDs.
*/
typedef int pid_t;
+5 -5
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/wait.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,7 @@
#define WTERMSIG(s) (false) /* Return signal number that caused process to terminate */
/* The following symbolic constants are possible values for the options
* argument to waitpi(1) (1) and/or waitid() (2),
* argument to waitpid() (1) and/or waitid() (2),
*/
#define WCONTINUED (1 << 0) /* Status for child that has been continued (1)(2) */
@@ -104,9 +104,9 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN pid_t wait(int *stat_loc);
EXTERN int waitid(idtype_t idtype, id_t id, siginfo_t *siginfo, int options);
EXTERN pid_t waitpid(pid_t pid, int *stat_loc, int options);
EXTERN pid_t wait(FAR int *stat_loc);
EXTERN int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options);
EXTERN pid_t waitpid(pid_t pid, FAR int *stat_loc, int options);
#undef EXTERN
#if defined(__cplusplus)