mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
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:
@@ -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
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user