[Mono-bugs] [Bug 51849][Nor] New - Mono.POSIX implementation strategy.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 7 Jan 2004 23:49:34 -0500 (EST)

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by miguel@ximian.com.


--- shadow/51849	2004-01-07 23:49:34.000000000 -0500
+++ shadow/51849.tmp.17996	2004-01-07 23:49:34.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 51849
+Product: Mono/Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
+Priority: Normal
+Component: Mono.POSIX
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: miguel@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Mono.POSIX implementation strategy.
+The Mono.POSIX assembly is a project to create a binding to
+	the various low-level calls in Unix which are not available
+	thought he regular assemblies in .NET.
+	The work should be done in two steps: one step is doing the
+	low-level binding for the system call, and another possibly is
+	to expose .NET-level objects like Streams for common patterns:
+	for example Streams for socketpairs. 
+One issue is that structure layout and C-level definitions are not the same
+across operating systems or ports.  Even across Linux on the sam version
+will differ given the architecture.
+To solve this problem, we should define our own set of definitions in C#
+that mimic the Posix ones, and then with a tool generate the glue to the OS.
+For example:
+[Name ("stat")]
+struct Stat {
+     int  st_ino;
+     long st_ize;
+     [PosixType ("time_t")]
+     IntPtr st_atime;
+[DllImport ("mono_posix")]
+int mono_stat (string file, out struct Stat);
+A small tool would generate the C code:
+struct CSharp_Stat {
+    int st_ino;
+    long st_size;
+    void *st_atime;
+wrap_stat (CSharp_Stat output, struct stat input){
+     output->st_ino = input->st_ino;
+     output->st_atime = input->st_atime;
+     etc.
+int mono_stat (string file, Csharp_Stat *output)
+     struct stat o;
+     stat (file, &o);
+     return mono_map_errno (wrap_stat (output, &o));
+The same applies to constant definitions.
+Some things can be done automatically, some others are better done manually.
+------- Additional Comments From miguel@ximian.com  2004-01-07 23:49 -------
+This has been now implemented.