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; +} +