[seed: 2/7] Add os.fdatasync and os.fpathconf



commit 44c2e67f287118ea4e5ef2de5125902369290368
Author: Robert Carr <racarr mireia (none)>
Date:   Wed Apr 15 01:46:28 2009 -0400

    Add os.fdatasync and os.fpathconf
---
 modules/os/os.c |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/modules/os/os.c b/modules/os/os.c
index e58d7e9..0aa1366 100644
--- a/modules/os/os.c
+++ b/modules/os/os.c
@@ -646,6 +646,45 @@ seed_os_fchown (SeedContext ctx,
   
   return seed_value_from_int (ctx, fchown (fd, uid, gid), exception);
 }
+
+SeedValue
+seed_os_fdatasync (SeedContext ctx,
+		   SeedObject function,
+		   SeedObject this_object,
+		   size_t argument_count,
+		   const SeedValue arguments[], 
+		   SeedException * exception)
+{
+  gint fd;
+
+  if (argument_count != 1)
+    {
+      EXPECTED_EXCEPTION ("os.fdatasync", "1 argument");
+    }
+  fd = seed_value_to_int (ctx, arguments[0], exception);
+  
+  return seed_value_from_int (ctx, fdatasync (fd), exception);
+}
+
+SeedValue
+seed_os_fpathconf (SeedContext ctx,
+		   SeedObject function,
+		   SeedObject this_object,
+		   size_t argument_count,
+		   const SeedValue arguments[], 
+		   SeedException * exception)
+{
+  gint fd, name;
+
+  if (argument_count != 2)
+    {
+      EXPECTED_EXCEPTION ("os.fpathconf", "2 arguments");
+    }
+  fd = seed_value_to_int (ctx, arguments[0], exception);
+  name = seed_value_to_int (ctx, arguments[1], exception);
+  
+  return seed_value_from_long (ctx, fpathconf (fd, name), exception);
+}
   
 seed_static_function os_funcs[] = {
   {"chdir", seed_os_chdir, 0},
@@ -676,7 +715,9 @@ seed_static_function os_funcs[] = {
   {"dup", seed_os_dup, 0},
   {"dup2", seed_os_dup2, 0},
   {"fchmod", seed_os_fchmod, 0},
-  {"fchown", seed_os_fchown, 0}
+  {"fchown", seed_os_fchown, 0},
+  {"fdatasync", seed_os_fdatasync, 0},
+  {"fpathconf", seed_os_fpathconf, 0}
 };
 
 #define OS_DEFINE_ENUM(name, value) \



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