[haiku-commits] r34091 - in haiku/trunk: headers/compatibility/bsd/sys src/libs/bsd

  • From: bga@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 17 Nov 2009 16:53:17 +0100 (CET)

Author: bga
Date: 2009-11-17 16:53:17 +0100 (Tue, 17 Nov 2009)
New Revision: 34091
Changeset: http://dev.haiku-os.org/changeset/34091/haiku

Added:
   haiku/trunk/headers/compatibility/bsd/sys/wait.h
   haiku/trunk/src/libs/bsd/wait.c
Modified:
   haiku/trunk/src/libs/bsd/Jamfile
Log:
- 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.



Added: haiku/trunk/headers/compatibility/bsd/sys/wait.h
===================================================================
--- haiku/trunk/headers/compatibility/bsd/sys/wait.h                            
(rev 0)
+++ haiku/trunk/headers/compatibility/bsd/sys/wait.h    2009-11-17 15:53:17 UTC 
(rev 34091)
@@ -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 <sys/wait.h>
+
+#include <sys/resource.h>
+
+#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_ */

Modified: haiku/trunk/src/libs/bsd/Jamfile
===================================================================
--- haiku/trunk/src/libs/bsd/Jamfile    2009-11-17 14:56:51 UTC (rev 34090)
+++ haiku/trunk/src/libs/bsd/Jamfile    2009-11-17 15:53:17 UTC (rev 34091)
@@ -18,4 +18,5 @@
        unvis.c
        usershell.c
        vis.c
+       wait.c
 ;

Added: haiku/trunk/src/libs/bsd/wait.c
===================================================================
--- haiku/trunk/src/libs/bsd/wait.c                             (rev 0)
+++ haiku/trunk/src/libs/bsd/wait.c     2009-11-17 15:53:17 UTC (rev 34091)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2009, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Bruno Albuquerque, bga@xxxxxxxxxxxxx
+ */
+
+
+#include <sys/wait.h>
+
+
+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;
+}
+


Other related posts: