2010-01-15 Zoltan Varga <vargaz@gmail.com>
[mono.git] / support / unistd.c
index 0de6f228534c9f1c6dd109eed39a71623c217681..209c0c1c450c1bae02b7fec90dbdcae168d1d94c 100644 (file)
@@ -4,7 +4,7 @@
  * Authors:
  *   Jonathan Pryor (jonpryor@vt.edu)
  *
- * Copyright (C) 2004 Jonathan Pryor
+ * Copyright (C) 2004-2006 Jonathan Pryor
  */
 
 #ifndef _GNU_SOURCE
@@ -90,25 +90,28 @@ Mono_Posix_Syscall_getcwd (char *buf, mph_size_t size)
 }
 
 gint64
-Mono_Posix_Syscall_fpathconf (int filedes, int name)
+Mono_Posix_Syscall_fpathconf (int filedes, int name, int defaultError)
 {
-       if (Mono_Posix_FromPathConf (name, &name) == -1)
+       errno = defaultError;
+       if (Mono_Posix_FromPathconfName (name, &name) == -1)
                return -1;
        return fpathconf (filedes, name);
 }
 
 gint64
-Mono_Posix_Syscall_pathconf (const char *path, int name)
+Mono_Posix_Syscall_pathconf (const char *path, int name, int defaultError)
 {
-       if (Mono_Posix_FromPathConf (name, &name) == -1)
+       errno = defaultError;
+       if (Mono_Posix_FromPathconfName (name, &name) == -1)
                return -1;
        return pathconf (path, name);
 }
 
 gint64
-Mono_Posix_Syscall_sysconf (int name)
+Mono_Posix_Syscall_sysconf (int name, int defaultError)
 {
-       if (Mono_Posix_FromSysConf (name, &name) == -1)
+       errno = defaultError;
+       if (Mono_Posix_FromSysconfName (name, &name) == -1)
                return -1;
        return sysconf (name);
 }
@@ -117,7 +120,7 @@ mph_size_t
 Mono_Posix_Syscall_confstr (int name, char *buf, mph_size_t len)
 {
        mph_return_if_size_t_overflow (len);
-       if (Mono_Posix_FromConfStr (name, &name) == -1)
+       if (Mono_Posix_FromConfstrName (name, &name) == -1)
                return -1;
        return confstr (name, buf, (size_t) len);
 }
@@ -224,14 +227,37 @@ Mono_Posix_Syscall_lockf (int fd, int cmd, mph_off_t len)
        return lockf (fd, cmd, (off_t) len);
 }
 
-void
+int
 Mono_Posix_Syscall_swab (void *from, void *to, mph_ssize_t n)
 {
        if (mph_have_long_overflow (n))
-               return;
+               return -1;
        swab (from, to, (ssize_t) n);
+       return 0;
+}
+
+int
+Mono_Posix_Syscall_setusershell (void)
+{
+       setusershell ();
+       return 0;
 }
 
+int
+Mono_Posix_Syscall_endusershell (void)
+{
+       endusershell ();
+       return 0;
+}
+
+int
+Mono_Posix_Syscall_sync (void)
+{
+       sync ();
+       return 0;
+}
+
+
 G_END_DECLS
 
 /*