[seed] Add getpid and getppid



commit bdaad2fb565c0cc576560b3539b4c7e33d348904
Author: Robert Carr <racarr mireia (none)>
Date:   Mon Apr 13 21:01:37 2009 -0400

    Add getpid and getppid
---
 modules/os/os.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/modules/os/os.c b/modules/os/os.c
index c91fa80..782a2c5 100644
--- a/modules/os/os.c
+++ b/modules/os/os.c
@@ -261,6 +261,38 @@ seed_os_getpgrp (SeedContext ctx,
   return seed_value_from_long (ctx, (glong) getpgrp(), exception);
 }
 
+SeedValue
+seed_os_getpid (SeedContext ctx,
+		SeedObject function,
+		SeedObject this_object,
+		size_t argument_count,
+		const SeedValue arguments[], 
+		SeedException * exception)
+{
+  if (argument_count != 0)
+    {
+      EXPECTED_EXCEPTION("os.getpid", "no arguments");
+    }
+  
+  return seed_value_from_long (ctx, (glong) getpid(), exception);
+}
+
+SeedValue
+seed_os_getppid (SeedContext ctx,
+		SeedObject function,
+		SeedObject this_object,
+		size_t argument_count,
+		const SeedValue arguments[], 
+		SeedException * exception)
+{
+  if (argument_count != 0)
+    {
+      EXPECTED_EXCEPTION("os.getpid", "no arguments");
+    }
+  
+  return seed_value_from_long (ctx, (glong) getppid(), exception);
+}
+
 seed_static_function os_funcs[] = {
   {"chdir", seed_os_chdir, 0},
   {"fchdir", seed_os_fchdir, 0},
@@ -272,7 +304,9 @@ seed_static_function os_funcs[] = {
   {"getuid", seed_os_getuid, 0},
   {"getlogin", seed_os_getlogin, 0},
   {"getpgid", seed_os_getpgid, 0},
-  {"getpgrp", seed_os_getpgrp, 0}
+  {"getpgrp", seed_os_getpgrp, 0},
+  {"getpid", seed_os_getpid, 0},
+  {"getppid", seed_os_getppid, 0}
 };
 
 SeedObject



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]