[seed: 1/7] Add os.fchown



commit 88ca63c2208ebada1399b63536067428a047114c
Author: Robert Carr <racarr mireia (none)>
Date:   Wed Apr 15 01:39:47 2009 -0400

    Add os.fchown
---
 libseed/seed-importer.c |    2 +-
 modules/os/os.c         |   26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index d7c3492..057e51f 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -47,7 +47,7 @@ GHashTable *file_imports;
  *        native module and return the module object.
  *      - If it is a file and does not end in G_MODULE_SUFFIX, evaluate it as a
  *        JavaScript file in a NEW global context, and return the global object
- *        for that context.
+ *        for that context. 
  */
 
 /* 
diff --git a/modules/os/os.c b/modules/os/os.c
index 0a89da4..e58d7e9 100644
--- a/modules/os/os.c
+++ b/modules/os/os.c
@@ -623,6 +623,29 @@ seed_os_fchmod (SeedContext ctx,
   
   return seed_value_from_int (ctx, fchmod (fd, mode), exception);
 }
+
+SeedValue
+seed_os_fchown (SeedContext ctx,
+		SeedObject function,
+		SeedObject this_object,
+		size_t argument_count,
+		const SeedValue arguments[], 
+		SeedException * exception)
+{
+  gint fd;
+  gid_t gid;
+  uid_t uid;
+
+  if (argument_count != 3)
+    {
+      EXPECTED_EXCEPTION ("os.fchown", "3 arguments");
+    }
+  fd = seed_value_to_int (ctx, arguments[0], exception);
+  uid = seed_value_to_long (ctx, arguments[1], exception);
+  gid = seed_value_to_long (ctx, arguments[2], exception);
+  
+  return seed_value_from_int (ctx, fchown (fd, uid, gid), exception);
+}
   
 seed_static_function os_funcs[] = {
   {"chdir", seed_os_chdir, 0},
@@ -652,7 +675,8 @@ seed_static_function os_funcs[] = {
   {"close", seed_os_close, 0},
   {"dup", seed_os_dup, 0},
   {"dup2", seed_os_dup2, 0},
-  {"fchmod", seed_os_fchmod, 0}
+  {"fchmod", seed_os_fchmod, 0},
+  {"fchown", seed_os_fchown, 0}
 };
 
 #define OS_DEFINE_ENUM(name, value) \



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