* Makefile: Build the make-map.exe in Mono.Unix.Native; add /nowarn:0618 to
[mono.git] / mcs / class / Mono.Posix / Mono.Unix / Syscall.cs
index f3ae00d9bf0d0247540f512b166cf482f4cc4b3e..8981f510ca5326b5d2ee0e976927d70774c3a7c8 100644 (file)
 //    Methods that require tuning are bound as `private sys_NAME' methods
 //    and then a `NAME' method is exposed.
 //
+// Deprecated Warning:
+//
+//    This class is deprecated, and exists only for backward compatibility
+//    with development versions of Mono 1.1.x.  It will be removed with 
+//    Mono 1.2.  Migrate to the Mono.Unix.Native types, or use the Unix*
+//    wrapper classes instead.
+//
+//    The [Map] attributes have been removed.  However, since the type names
+//    are identical to those in Mono.Unix.Native, the MonoPosixHelper methods
+//    will continue to exist and function correctly.
+//
 
 //
 // Permission is hereby granted, free of charge, to any person obtaining
@@ -59,32 +70,13 @@ using System.Runtime.InteropServices;
 using System.Text;
 using Mono.Unix;
 
-[assembly:Mono.Unix.IncludeAttribute (
-       new string [] {
-               "sys/types.h", 
-               "sys/stat.h", 
-               "ah:sys/poll.h", 
-               "ah:sys/wait.h",
-               "ah:sys/statvfs.h",
-               "ah:sys/xattr.h",
-               "unistd.h", 
-               "fcntl.h", 
-               "signal.h", 
-               "ah:poll.h", 
-               "ah:grp.h", 
-               "errno.h", 
-               "ah:syslog.h",
-       }, 
-       new string [] {
-               "_GNU_SOURCE", 
-               "_XOPEN_SOURCE",
-       })]
-
 namespace Mono.Unix {
 
        #region Enumerations
 
-       [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SyslogOptions")]
        public enum SyslogOptions {
                LOG_PID    = 0x01,  // log the pid with each message
                LOG_CONS   = 0x02,  // log on the console if errors in sending
@@ -94,7 +86,8 @@ namespace Mono.Unix {
                LOG_PERROR = 0x20   // log to stderr as well
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SyslogFacility")]
        public enum SyslogFacility {
                LOG_KERN      = 0 << 3,
                LOG_USER      = 1 << 3,
@@ -120,7 +113,8 @@ namespace Mono.Unix {
                LOG_LOCAL7    = 23 << 3,
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SyslogLevel")]
        public enum SyslogLevel {
                LOG_EMERG   = 0,  // system is unusable
                LOG_ALERT   = 1,  // action must be taken immediately
@@ -132,7 +126,9 @@ namespace Mono.Unix {
                LOG_DEBUG   = 7   // debug-level messages
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.OpenFlags")]
        public enum OpenFlags : int {
                //
                // One of these
@@ -170,7 +166,9 @@ namespace Mono.Unix {
        }
        
        // mode_t
-       [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.FilePermissions")]
        public enum FilePermissions : uint {
                S_ISUID     = 0x0800, // Set user ID on execution
                S_ISGID     = 0x0400, // Set gorup ID on execution
@@ -204,7 +202,8 @@ namespace Mono.Unix {
                S_IFSOCK    = 0xC000, // Socket
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.FcntlCommand")]
        public enum FcntlCommand : int {
                // Form /usr/include/bits/fcntl.h
                F_DUPFD    =    0, // Duplicate file descriptor.
@@ -224,14 +223,16 @@ namespace Mono.Unix {
                F_NOTIFY   = 1026, // Required notifications on a directory
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.LockType")]
        public enum LockType : short {
                F_RDLCK = 0, // Read lock.
                F_WRLCK = 1, // Write lock.
                F_UNLCK = 2, // Remove lock.
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SeekFlags")]
        public enum SeekFlags : short {
                // values liberally copied from /usr/include/unistd.h
                SEEK_SET = 0, // Seek from beginning of file.
@@ -243,7 +244,9 @@ namespace Mono.Unix {
                L_XTND   = SEEK_END, // BSD alias for SEEK_END
        }
        
-       [Map, Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.DirectoryNotifyFlags")]
        public enum DirectoryNotifyFlags : int {
                // from /usr/include/bits/fcntl.h
                DN_ACCESS    = 0x00000001, // File accessed.
@@ -255,7 +258,8 @@ namespace Mono.Unix {
                DN_MULTISHOT = unchecked ((int)0x80000000), // Don't remove notifier
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PosixFadviseAdvice")]
        public enum PosixFadviseAdvice : int {
                POSIX_FADV_NORMAL     = 0,  // No further special treatment.
                POSIX_FADV_RANDOM     = 1,  // Expect random page references.
@@ -265,7 +269,8 @@ namespace Mono.Unix {
                POSIX_FADV_NOREUSE    = 5,  // Data will be accessed once.
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PosixMadviseAdvice")]
        public enum PosixMadviseAdvice : int {
                POSIX_MADV_NORMAL     = 0,  // No further special treatment.
                POSIX_MADV_RANDOM     = 1,  // Expect random page references.
@@ -274,7 +279,8 @@ namespace Mono.Unix {
                POSIX_MADV_DONTNEED   = 4,  // Don't need these pages.
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Signum")]
        public enum Signum : int {
                SIGHUP    =  1, // Hangup (POSIX).
                SIGINT    =  2, // Interrupt (ANSI).
@@ -313,13 +319,17 @@ namespace Mono.Unix {
                SIGUNUSED = 31
        }
 
-       [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.WaitOptions")]
        public enum WaitOptions : int {
                WNOHANG   = 1,  // Don't block waiting
                WUNTRACED = 2,  // Report status of stopped children
        }
 
-  [Flags][Map]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.AccessModes")]
        public enum AccessMode : int {
                R_OK = 1,
                W_OK = 2,
@@ -327,7 +337,8 @@ namespace Mono.Unix {
                F_OK = 8,
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PathConf")]
        public enum PathConf : int {
                _PC_LINK_MAX,
                _PC_MAX_CANON,
@@ -352,7 +363,8 @@ namespace Mono.Unix {
                _PC_2_SYMLINKS
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.SysConf")]
        public enum SysConf : int {
                _SC_ARG_MAX,
                _SC_CHILD_MAX,
@@ -560,7 +572,8 @@ namespace Mono.Unix {
                _SC_LEVEL4_CACHE_LINESIZE
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.ConfStr")]
        public enum ConfStr : int {
                _CS_PATH,                       /* The default search path.  */
                _CS_V6_WIDTH_RESTRICTED_ENVS,
@@ -608,7 +621,8 @@ namespace Mono.Unix {
                _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
        }
 
-       [Map]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.LockfCommand")]
        public enum LockfCommand : int {
                F_ULOCK = 0, // Unlock a previously locked region.
                F_LOCK  = 1, // Lock a region for exclusive use.
@@ -616,7 +630,9 @@ namespace Mono.Unix {
                F_TEST  = 3, // Test a region for other process locks.
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.PollEvents")]
        public enum PollEvents : short {
                POLLIN      = 0x0001, // There is data to read
                POLLPRI     = 0x0002, // There is urgent data to read
@@ -631,14 +647,18 @@ namespace Mono.Unix {
                POLLWRBAND  = 0x0200, // Priority data may be written
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.XattrFlags")]
        public enum XattrFlags : int {
                XATTR_AUTO = 0,
                XATTR_CREATE = 1,
                XATTR_REPLACE = 2,
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MountFlags")]
        public enum MountFlags : ulong {
                ST_RDONLY      =    1,  // Mount read-only
                ST_NOSUID      =    2,  // Ignore suid and sgid bits
@@ -652,7 +672,9 @@ namespace Mono.Unix {
                ST_NODIRATIME  = 2048,  // Do not update directory access times
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MmapFlags")]
        public enum MmapFlags : int {
                MAP_SHARED      = 0x01,     // Share changes.
                MAP_PRIVATE     = 0x02,     // Changes are private.
@@ -672,7 +694,9 @@ namespace Mono.Unix {
                MAP_NONBLOCK    = 0x10000,  // Do not block on IO.
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MmapProts")]
        public enum MmapProt : int {
                PROT_READ       = 0x1,  // Page can be read.
                PROT_WRITE      = 0x2,  // Page can be written.
@@ -684,20 +708,26 @@ namespace Mono.Unix {
                                              //   growsup vma (mprotect only).
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MsyncFlags")]
        public enum MsyncFlags : int {
                MS_ASYNC      = 0x1,  // Sync memory asynchronously.
                MS_SYNC       = 0x4,  // Synchronous memory sync.
                MS_INVALIDATE = 0x2,  // Invalidate the caches.
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MlockallFlags")]
        public enum MlockallFlags : int {
                MCL_CURRENT     = 0x1,  // Lock all currently mapped pages.
                MCL_FUTURE  = 0x2,      // Lock all additions to address
        }
 
-       [Map][Flags]
+       [Flags]
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.MremapFlags")]
        public enum MremapFlags : ulong {
                MREMAP_MAYMOVE = 0x1,
        }
@@ -706,6 +736,8 @@ namespace Mono.Unix {
 
        #region Structures
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Flock")]
        public struct Flock {
                public LockType         l_type;    // Type of lock: F_RDLCK, F_WRLCK, F_UNLCK
                public SeekFlags        l_whence;  // How to interpret l_start
@@ -714,6 +746,8 @@ namespace Mono.Unix {
                public /* pid_t */ int  l_pid;     // PID of process blocking our lock (F_GETLK only)
        }
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Pollfd")]
        [StructLayout(LayoutKind.Sequential)]
        public struct Pollfd {
                public int fd;
@@ -721,14 +755,22 @@ namespace Mono.Unix {
                public PollEvents revents;
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Stat")]
        public struct Stat {
+               [CLSCompliant (false)]
                public  /* dev_t */     ulong   st_dev;     // device
+               [CLSCompliant (false)]
                public  /* ino_t */     ulong   st_ino;     // inode
+               [CLSCompliant (false)]
                public  FilePermissions         st_mode;    // protection
                private uint                    _padding_;  // padding for structure alignment
+               [CLSCompliant (false)]
                public  /* nlink_t */   ulong   st_nlink;   // number of hard links
+               [CLSCompliant (false)]
                public  /* uid_t */     uint    st_uid;     // user ID of owner
+               [CLSCompliant (false)]
                public  /* gid_t */     uint    st_gid;     // group ID of owner
+               [CLSCompliant (false)]
                public  /* dev_t */     ulong   st_rdev;    // device type (if inode device)
                public  /* off_t */     long    st_size;    // total size, in bytes
                public  /* blksize_t */ long    st_blksize; // blocksize for filesystem I/O
@@ -738,6 +780,8 @@ namespace Mono.Unix {
                public  /* time_t */    long    st_ctime;   // time of last status change
        }
 
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Statvfs")]
        public struct Statvfs {
                public                  ulong f_bsize;    // file system block size
                public                  ulong f_frsize;   // fragment size
@@ -752,16 +796,19 @@ namespace Mono.Unix {
                public                  ulong f_namemax;  // maximum filename length
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Timeval")]
        public struct Timeval {
                public  /* time_t */      long    tv_sec;   // seconds
                public  /* suseconds_t */ long    tv_usec;  // microseconds
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Timezone")]
        public struct Timezone {
                public  int tz_minuteswest; // minutes W of Greenwich
                private int tz_dsttime;     // type of dst correction (OBSOLETE)
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Utimbuf")]
        public struct Utimbuf {
                public  /* time_t */      long    actime;   // access time
                public  /* time_t */      long    modtime;  // modification time
@@ -771,10 +818,13 @@ namespace Mono.Unix {
 
        #region Classes
 
+       [Obsolete ("Use Mono.Unix.Native.Dirent")]
        public sealed class Dirent
        {
+               [CLSCompliant (false)]
                public /* ino_t */ ulong  d_ino;
                public /* off_t */ long   d_off;
+               [CLSCompliant (false)]
                public ushort             d_reclen;
                public byte               d_type;
                public string             d_name;
@@ -812,6 +862,7 @@ namespace Mono.Unix {
                }
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Fstab")]
        public sealed class Fstab
        {
                public string fs_spec;
@@ -856,10 +907,12 @@ namespace Mono.Unix {
                }
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Group")]
        public sealed class Group
        {
                public string           gr_name;
                public string           gr_passwd;
+               [CLSCompliant (false)]
                public /* gid_t */ uint gr_gid;
                public string[]         gr_mem;
 
@@ -926,11 +979,14 @@ namespace Mono.Unix {
                }
        }
 
+       [Obsolete ("Use Mono.Unix.Native.Passwd")]
        public sealed class Passwd
        {
                public string           pw_name;
                public string           pw_passwd;
+               [CLSCompliant (false)]
                public /* uid_t */ uint pw_uid;
+               [CLSCompliant (false)]
                public /* gid_t */ uint pw_gid;
                public string           pw_gecos;
                public string           pw_dir;
@@ -1067,6 +1123,8 @@ namespace Mono.Unix {
        //      EntryPointNotFoundException.  This is also consistent with a missing 
        //      P/Invoke into libc.so.
        //
+       [CLSCompliant (false)]
+       [Obsolete ("Use Mono.Unix.Native.Syscall")]
        public sealed class Syscall : Stdlib
        {
                new internal const string LIBC  = "libc";
@@ -2338,6 +2396,12 @@ namespace Mono.Unix {
 
                // TODO: times(2)
 
+               //
+               // <sys/utsname.h>
+               //
+
+               // TODO: uname(2)
+
                #region <sys/wait.h> Declarations
                //
                // <sys/wait.h>