// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
//
-// (C) 2004 Jonathan Pryor
+// (C) 2004-2006 Jonathan Pryor
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
{
}
- internal UnixFileInfo (string path, Stat stat)
+ internal UnixFileInfo (string path, Native.Stat stat)
: base (path, stat)
{
}
public override void Delete ()
{
- int r = Syscall.unlink (FullPath);
+ int r = Native.Syscall.unlink (FullPath);
UnixMarshal.ThrowExceptionForLastErrorIf (r);
base.Refresh ();
}
public UnixStream Create ()
{
- FilePermissions mode = // 0644
- FilePermissions.S_IRUSR | FilePermissions.S_IWUSR |
- FilePermissions.S_IRGRP | FilePermissions.S_IROTH;
+ Native.FilePermissions mode = // 0644
+ Native.FilePermissions.S_IRUSR | Native.FilePermissions.S_IWUSR |
+ Native.FilePermissions.S_IRGRP | Native.FilePermissions.S_IROTH;
return Create (mode);
}
- public UnixStream Create (FilePermissions mode)
+ [CLSCompliant (false)]
+ public UnixStream Create (Native.FilePermissions mode)
{
- int fd = Syscall.creat (FullPath, mode);
+ int fd = Native.Syscall.creat (FullPath, mode);
if (fd < 0)
UnixMarshal.ThrowExceptionForLastError ();
base.Refresh ();
return new UnixStream (fd);
}
- public UnixStream Open (OpenFlags flags)
+ public UnixStream Create (FileAccessPermissions mode)
{
- int fd = Syscall.open (FullPath, flags);
+ return Create ((Native.FilePermissions) mode);
+ }
+
+ [CLSCompliant (false)]
+ public UnixStream Open (Native.OpenFlags flags)
+ {
+ if ((flags & Native.OpenFlags.O_CREAT) != 0)
+ throw new ArgumentException (
+ "Cannot specify OpenFlags.O_CREAT without providing " +
+ "FilePermissions. Use the Open(OpenFlags, FilePermissions) " +
+ "method instead");
+ int fd = Native.Syscall.open (FullPath, flags);
if (fd < 0)
UnixMarshal.ThrowExceptionForLastError ();
return new UnixStream (fd);
}
- public UnixStream Open (OpenFlags flags, FilePermissions mode)
+ [CLSCompliant (false)]
+ public UnixStream Open (Native.OpenFlags flags, Native.FilePermissions mode)
{
- int fd = Syscall.open (FullPath, flags, mode);
+ int fd = Native.Syscall.open (FullPath, flags, mode);
if (fd < 0)
UnixMarshal.ThrowExceptionForLastError ();
return new UnixStream (fd);
public UnixStream Open (FileMode mode)
{
- OpenFlags flags = UnixConvert.ToOpenFlags (mode, FileAccess.ReadWrite);
- int fd = Syscall.open (FullPath, flags);
- if (fd < 0)
- UnixMarshal.ThrowExceptionForLastError ();
- return new UnixStream (fd);
+ Native.OpenFlags flags = Native.NativeConvert.ToOpenFlags (mode, FileAccess.ReadWrite);
+ return Open (flags);
}
public UnixStream Open (FileMode mode, FileAccess access)
{
- OpenFlags flags = UnixConvert.ToOpenFlags (mode, access);
- int fd = Syscall.open (FullPath, flags);
- if (fd < 0)
- UnixMarshal.ThrowExceptionForLastError ();
- return new UnixStream (fd);
+ Native.OpenFlags flags = Native.NativeConvert.ToOpenFlags (mode, access);
+ return Open (flags);
}
- public UnixStream Open (FileMode mode, FileAccess access, FilePermissions perms)
+ [CLSCompliant (false)]
+ public UnixStream Open (FileMode mode, FileAccess access, Native.FilePermissions perms)
{
- OpenFlags flags = UnixConvert.ToOpenFlags (mode, access);
- int fd = Syscall.open (FullPath, flags, perms);
+ Native.OpenFlags flags = Native.NativeConvert.ToOpenFlags (mode, access);
+ int fd = Native.Syscall.open (FullPath, flags, perms);
if (fd < 0)
UnixMarshal.ThrowExceptionForLastError ();
return new UnixStream (fd);