aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h35
1 files changed, 20 insertions, 15 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 4fc5d183f..cec31a7f4 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -269,17 +269,6 @@ char *xrealloc_getcwd_or_warn(char *cwd);
269char *xmalloc_readlink_or_warn(const char *path); 269char *xmalloc_readlink_or_warn(const char *path);
270char *xmalloc_realpath(const char *path); 270char *xmalloc_realpath(const char *path);
271 271
272/* Unlike waitpid, waits ONLY for one process,
273 * It's safe to pass negative 'pids' from failed [v]fork -
274 * wait4pid will return -1 and ECHILD in errno.
275 * IOW: rc = wait4pid(spawn(argv));
276 * if (rc < 0) bb_perror_msg("%s", argv[0]);
277 * if (rc > 0) bb_error_msg("exit code: %d", rc);
278 */
279extern int wait4pid(int pid);
280extern int wait_pid(int *wstat, int pid);
281extern int wait_nohang(int *wstat);
282//TODO: signal(sid, f) is the same? then why?
283extern void sig_catch(int,void (*)(int)); 272extern void sig_catch(int,void (*)(int));
284//#define sig_ignore(s) (sig_catch((s), SIG_IGN)) 273//#define sig_ignore(s) (sig_catch((s), SIG_IGN))
285//#define sig_uncatch(s) (sig_catch((s), SIG_DFL)) 274//#define sig_uncatch(s) (sig_catch((s), SIG_DFL))
@@ -288,10 +277,6 @@ extern void sig_unblock(int);
288/* UNUSED: extern void sig_blocknone(void); */ 277/* UNUSED: extern void sig_blocknone(void); */
289extern void sig_pause(void); 278extern void sig_pause(void);
290 279
291#define wait_crashed(w) ((w) & 127)
292#define wait_exitcode(w) ((w) >> 8)
293#define wait_stopsig(w) ((w) >> 8)
294#define wait_stopped(w) (((w) & 127) == 127)
295 280
296 281
297void xsetgid(gid_t gid); 282void xsetgid(gid_t gid);
@@ -528,6 +513,25 @@ int bb_execvp(const char *file, char *const argv[]);
528/* NOMMU friendy fork+exec */ 513/* NOMMU friendy fork+exec */
529pid_t spawn(char **argv); 514pid_t spawn(char **argv);
530pid_t xspawn(char **argv); 515pid_t xspawn(char **argv);
516
517/* Unlike waitpid, waits ONLY for one process,
518 * It's safe to pass negative 'pids' from failed [v]fork -
519 * wait4pid will return -1 and ECHILD in errno.
520 * IOW: rc = wait4pid(spawn(argv));
521 * if (rc < 0) bb_perror_msg("%s", argv[0]);
522 * if (rc > 0) bb_error_msg("exit code: %d", rc);
523 */
524int wait_pid(int *wstat, int pid);
525int wait_nohang(int *wstat);
526int wait4pid(int pid);
527//TODO: signal(sid, f) is the same? then why?
528#define wait_crashed(w) ((w) & 127)
529#define wait_exitcode(w) ((w) >> 8)
530#define wait_stopsig(w) ((w) >> 8)
531#define wait_stopped(w) (((w) & 127) == 127)
532/* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */
533int spawn_and_wait(char **argv);
534
531/* Helpers for daemonization. 535/* Helpers for daemonization.
532 * 536 *
533 * bb_daemonize(flags) = daemonize, does not compile on NOMMU 537 * bb_daemonize(flags) = daemonize, does not compile on NOMMU
@@ -573,6 +577,7 @@ void bb_daemonize_or_rexec(int flags, char **argv);
573void bb_sanitize_stdio(void); 577void bb_sanitize_stdio(void);
574 578
575 579
580// TODO: always error out?
576enum { BB_GETOPT_ERROR = 0x80000000 }; 581enum { BB_GETOPT_ERROR = 0x80000000 };
577extern const char *opt_complementary; 582extern const char *opt_complementary;
578#if ENABLE_GETOPT_LONG 583#if ENABLE_GETOPT_LONG