[Mono-dev] [PATCH] Mono.Unix.Native.MountFlags

Joe Dluzen jdluzen at gmail.com
Sat Jan 5 01:31:06 EST 2008


Hi all,

I was working on a program to mount and unmount various drives/etc
when I found that Mono.Unix.Native.MountFlags had no option for
ST_NOEXEC. (I was attempting to mount a DVD in my drive, and saw in
/proc/mounts that it had an option for noexec.) Looking in
sys/mount.h, I found the appropriate values and created the diff below
(which includes additional values that were missing):

Index: Mono.Unix.Native/Syscall.cs
===================================================================
--- Mono.Unix.Native/Syscall.cs	(revision 92223)
+++ Mono.Unix.Native/Syscall.cs	(working copy)
@@ -646,13 +646,16 @@
 		ST_RDONLY      =    1,  // Mount read-only
 		ST_NOSUID      =    2,  // Ignore suid and sgid bits
 		ST_NODEV       =    4,  // Disallow access to device special files
+		ST_NOEXEC      =    8,  // Disallow program execution
 		ST_SYNCHRONOUS =   16,  // Writes are synced at once
+		ST_REMOUNT     =   32,  // Alter flags of a mounted FS
 		ST_MANDLOCK    =   64,  // Allow mandatory locks on an FS
 		ST_WRITE       =  128,  // Write on file/directory/symlink
 		ST_APPEND      =  256,  // Append-only file
 		ST_IMMUTABLE   =  512,  // Immutable file
 		ST_NOATIME     = 1024,  // Do not update access times
 		ST_NODIRATIME  = 2048,  // Do not update directory access times
+		ST_BIND        = 4096,  // Bind directory at different place
 	}

 	[Map][Flags]


Please note that this is my first patch... ever. Also note that this
was found on Ubuntu 7.10, so I do not know if these were purposefully
omitted due to non-portability, as the actual mount() call was, or
something else.

Thanks,
Joe



More information about the Mono-devel-list mailing list