// 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
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);
}
- [CLSCompliant (false)]
- [Obsolete ("Use Create(Mono.Unix.Native.FilePermissions)")]
- public UnixStream Create (FilePermissions mode)
- {
- int fd = Syscall.creat (FullPath, mode);
- if (fd < 0)
- UnixMarshal.ThrowExceptionForLastError ();
- base.Refresh ();
- return new UnixStream (fd);
- }
-
[CLSCompliant (false)]
public UnixStream Create (Native.FilePermissions mode)
{
return new UnixStream (fd);
}
- [CLSCompliant (false)]
- [Obsolete ("Use Open(Mono.Unix.Native.OpenFlags)")]
- public UnixStream Open (OpenFlags flags)
+ public UnixStream Create (FileAccessPermissions mode)
{
- int fd = Syscall.open (FullPath, flags);
- if (fd < 0)
- UnixMarshal.ThrowExceptionForLastError ();
- return new UnixStream (fd);
+ 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);
}
- [CLSCompliant (false)]
- [Obsolete ("Use Open(Mono.Unix.Native.OpenFlags,Mono.Unix.Native.FilePermissions)")]
- public UnixStream Open (OpenFlags flags, FilePermissions mode)
- {
- int fd = Syscall.open (FullPath, flags, mode);
- if (fd < 0)
- UnixMarshal.ThrowExceptionForLastError ();
- return new UnixStream (fd);
- }
-
[CLSCompliant (false)]
public UnixStream Open (Native.OpenFlags flags, Native.FilePermissions mode)
{
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);
- }
-
- [CLSCompliant (false)]
- [Obsolete ("Use Open (System.IO.FileMode,System.IO.FileAccess,Mono.Unix.Native.FilePermissions)")]
- public UnixStream Open (FileMode mode, FileAccess access, FilePermissions perms)
- {
- OpenFlags flags = UnixConvert.ToOpenFlags (mode, access);
- int fd = Syscall.open (FullPath, flags, perms);
- if (fd < 0)
- UnixMarshal.ThrowExceptionForLastError ();
- return new UnixStream (fd);
+ Native.OpenFlags flags = Native.NativeConvert.ToOpenFlags (mode, access);
+ return Open (flags);
}
[CLSCompliant (false)]