for TARGET_J2EE only:
[mono.git] / mcs / class / Mono.Posix / Mono.Unix / FileHandleOperations.cs
index e6caf6777fa56eb00c353fdd30dff8e1cacdaf8c..89cdb2ce5edffef557c6dcab251ce85b6f5a1c6a 100644 (file)
@@ -39,8 +39,8 @@ namespace Mono.Unix {
 
                public static void AdviseFileAccessPattern (int fd, FileAccessPattern pattern, long offset, long len)
                {
-                       int r = Syscall.posix_fadvise (fd, offset, len,
-                               (PosixFadviseAdvice) pattern);
+                       int r = Native.Syscall.posix_fadvise (fd, offset, len,
+                               (Native.PosixFadviseAdvice) pattern);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
@@ -51,8 +51,10 @@ namespace Mono.Unix {
 
                public static void AdviseFileAccessPattern (FileStream file, FileAccessPattern pattern, long offset, long len)
                {
-                       int r = Syscall.posix_fadvise (file.Handle.ToInt32(), offset, len,
-                               (PosixFadviseAdvice) pattern);
+                       if (file == null)
+                               throw new ArgumentNullException ("file");
+                       int r = Native.Syscall.posix_fadvise (file.Handle.ToInt32(), offset, len,
+                               (Native.PosixFadviseAdvice) pattern);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }
 
@@ -63,8 +65,10 @@ namespace Mono.Unix {
 
                public static void AdviseFileAccessPattern (UnixStream stream, FileAccessPattern pattern, long offset, long len)
                {
-                       int r = Syscall.posix_fadvise (stream.Handle, offset, len,
-                               (PosixFadviseAdvice) pattern);
+                       if (stream == null)
+                               throw new ArgumentNullException ("stream");
+                       int r = Native.Syscall.posix_fadvise (stream.Handle, offset, len,
+                               (Native.PosixFadviseAdvice) pattern);
                        UnixMarshal.ThrowExceptionForLastErrorIf (r);
                }