[Mono-devel-list] Mono.Posix OEE 0.4

Jonathan Pryor jonpryor at vt.edu
Wed Oct 6 22:07:05 EDT 2004

Mono.Posix Over-Engineered Edition 0.4.

Major Changes since 0.3:
	- After discussion on #mono, I've dropped the "one header, one 
	  class" approach, for a bifurcated approach.
	  - POSIX functions (i.e. most things from section 2 & 3 of the
	    man pages) are in Syscall, including some BSD- and GNU 
	  - C Standard Library functions (malloc(3), free(3), fopen(3), 
	    etc.) are in Stdlib.
	- PosixDirectory wrapper, with a GetEntries method which returns
	  all files in a specified directory.
	  - Or use the overload, which allows you to supply a regular
	    expression to determine which file names to return.  Yay!

About the package

It has a makefile.  Unpack the archive, and build:

        $ tar xzf Mono-Posix-jp-0.4.tar.gz
        $ cd Mono.Posix-jp-0.4
        $ make

This will create a lot of .cs file, Mono.Posix.dll,
libMonoPosixHelper.so, and lots of test programs.

Main.exe is a badly cobbled test program, which calls stat(2) on all
command line arguments, printing out their information, and tries to
write "hello\n" to the file hello.txt using a PosixStream.

mls.exe is a "managed ls" -- it's there to test readdir(3) and co.

lsui.exe "lists user information" -- dumps out the passwd structure for
a user provided as a command-line argument.

lsgi.exe "lists group information" -- dumps out the group structure for
a group provided as a command-line argument.

I wrote this on Fedora Core 2, so if it doesn't compile on your system,
please let me know so I know what portability issues to fix.  Thanks to
Charlie Ford for letting me know about problems compiling on Red Hat 9. 
These should be corrected.


Remember that Mono.Posix-OEE uses the same names as the current
Mono.Posix.  Consequently, you'll have to set LD_LIBRARY_PATH (or
equivalent) to find the newer library, and you'll have to explicitly
link against OOE's Mono.Posix.dll.

About the Implementation

As mentioned previously, most functions are placed in Syscall, while C
standard library functions are in Stdlib.  If you don't like this
convention, *please* suggest a better one.  (One header : One class
wasn't liked by many, and Miguel doesn't seem to like everything in
Syscall, so I'm flying by ear here...)

Open Questions (more to follow, I'm sure):

I need some 64-bit OS advice.  Is it safe to assume (as I currently do)
that a 64-bit OS will provide the -64 API call?  I don't believe this is
actually safe, as open(2) and open64() should do the same thing on
64-bit platforms, so there isn't any need for open64() (except for

 - Jon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mono.Posix-jp-0.4.tar.gz
Type: application/x-compressed-tar
Size: 31589 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041006/58131188/attachment.bin 

More information about the Mono-devel-list mailing list