From ada17216f977d9c02262744ea553da5675340865 Mon Sep 17 00:00:00 2001 From: "Bruno G. Albuquerque" Date: Tue, 17 Nov 2009 15:53:17 +0000 Subject: [PATCH] - Added wait3() and wait4() to the bsd compatibility library. - Untested, but should work (will test it when I get home later today). - This is my first attempt at adding something for compatibility reasons. Let me know if something in wrong. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34091 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/compatibility/bsd/sys/wait.h | 25 +++++++++++++++++++++++++ src/libs/bsd/Jamfile | 1 + src/libs/bsd/wait.c | 26 ++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 headers/compatibility/bsd/sys/wait.h create mode 100644 src/libs/bsd/wait.c diff --git a/headers/compatibility/bsd/sys/wait.h b/headers/compatibility/bsd/sys/wait.h new file mode 100644 index 0000000000..6c67ba85fb --- /dev/null +++ b/headers/compatibility/bsd/sys/wait.h @@ -0,0 +1,25 @@ +/* + * Copyright 2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _BSD_SYS_WAIT_H_ +#define _BSD_SYS_WAIT_H_ + + +#include_next + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +pid_t wait3(int *status, int options, struct rusage *rusage); + +pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage); + +#ifdef __cplusplus +} +#endif + +#endif /* _BSD_SYS_WAIT_H_ */ diff --git a/src/libs/bsd/Jamfile b/src/libs/bsd/Jamfile index 4505ad6739..f35d5b4367 100644 --- a/src/libs/bsd/Jamfile +++ b/src/libs/bsd/Jamfile @@ -18,4 +18,5 @@ SharedLibrary libbsd.so : unvis.c usershell.c vis.c + wait.c ; diff --git a/src/libs/bsd/wait.c b/src/libs/bsd/wait.c new file mode 100644 index 0000000000..fe1a31518d --- /dev/null +++ b/src/libs/bsd/wait.c @@ -0,0 +1,26 @@ +/* + * Copyright 2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Bruno Albuquerque, bga@bug-br.org.br + */ + + +#include + + +pid_t +wait3(int *status, int options, struct rusage *rusage) { + return wait4(-1, status, options, rusage); +} + + +pid_t +wait4(pid_t pid, int *status, int options, struct rusage *rusage) { + pid_t waitPid = waitpid(pid, status, options); + getrusage(RUSAGE_CHILDREN, rusage); + + return waitPid; +} +