2005-04-21 Gonzalo Paniagua Javier * UnixClient.cs: * UnixListener.cs: TcpListener/TcpClient clones from Jow Shaw. 2005-04-21 Gonzalo Paniagua Javier * Mono.Posix.dll.sources: added UnixListener and UnixClient from Joe Shaw. 2005-04-21 Gonzalo Paniagua Javier * UnixEndPoint.cs: fix from Mono.Posix. 2005-04-20 Jonathan Pryor * Syscall.cs: Make all fork(2) and exec(2) functions `private`. It currently isn't safe to call these under *any* circumstances. See also 68141, and this pertinent quote from Butenhof's "Programming with POSIX Threads", p197, s6.1: "When a threaded process calls fork to create a child process, Pthreads specifies that only the thread calling fork exists in the child. ... Pthreads does not 'terminate' the other threads in a forked process...They simply cease to exist. ... This is not a problem if the child process is about to call exec to run a new program, but if you use fork to clone a threaded program, beware that you may lose access to memory, especially heap memory stored only as thread-specific data values." Since P/Invoke currently requires using thread local storage, once you fork(2) you won't be able to invoke exec(2) from managed code (since that would require a P/Invoke transition to call exec(2), which would require TLS, which doesn't exist in the new process). This can only be fixed by removing the TLS dependency on P/Invoke, which isn't a priority (and may not be possible). The workaround is to create a C function which does your fork(2)/exec(2) (and any other functions such as daemon(3)) on your behalf, and P/Invoke to call this C function. 2005-04-18 Jonathan Pryor * Syscall.cs: Update comment specifying which functions belong in Syscall. * UnixConvert.cs: Add XattrFlags conversion functions. * UnixMarshal.cs: Remove warning about self-assignment. 2005-04-16 Daniel Drake * Syscall.cs: Add bindings for extended attribute manipulation 2005-04-05 Miguel de Icaza * Syscall.cs: Set entry point for sys_syslog to be syslog. Include the syslog.h header in the generated map so that we actually do the mapping. 2005-03-28 Jonathan Pryor * UnixConvert.cs: Add ToFopenMode() methods, which convert FileMode/FileAccess into an fopen(3) mode string. ToOpenFlags() should throw ArgumentOutOfRangeException for argument violations. * StdioFileStream.cs: Add constructor overloads accepting filename and FileMode/FileAccess overloads; Compatibility fixes with regression tests; remove IDisposable implementation since System.IO.Stream already implements it (which calls Close() for us). 2005-03-17 Jonathan Pryor * Stdlib.cs: Move Errno-related functionality into Stdlib from Syscall, since (1) errno is part of C89, and (2) StdioFileStream will need it, and StdioFileStream shouldn't use Syscall. Add [UnmanagedFunctionPointer] attribute to SignalHandler for .NET 2.0 (since signal handlers use C calling convention, not Stdcall). * Syscall.cs: Move Errno-related functionality into Stdlib. * UnixMarshal.cs: Use ERANGE not EPERM when figuring out appropriate translator, since ERANGE is part of C99 and EPERM isn't. Use Stdlib instead of Syscall for Errno-related functionality. 2005-02-02 Jonathan Pryor * UnixFile.cs: Cope with changes in UnixStream. * UnixStream.cs: Change FileDescriptor property to Handle for consistency. * StdioFileStream.cs: Change FileStream property to Handle for consistency. 2005-02-02 Jonathan Pryor * Syscall.cs: Remove public sys_ methods. Some were public by mistake, and others so that users could manually marshal strings if desired. Manually marshaling strings shouldn't be necessary, though, so remove them too. 2005-02-02 Jonathan Pryor * StdioFileStream.cs: Fix Length property to actually return the size of the file, not the # of bytes from the current position to EOF. Oops. 2005-01-31 Jonathan Pryor * Stdlib.cs: Import "msvcrt", not "libc". These members are part of the ANSI C standard, and thus should be present on Windows via msvcrt.dll (except snprintf, until they catch up to C99). Change the calling convention of all functions to Cdecl, as the .NET default is Stdcall. Changing the calling convention isn't needed in Syscall, as it can only be run on Unix platforms anyway, where the default is Cdecl. * Syscall.cs: Add LIBC member that points to the real "libc"; we can't use the imported definition from Stdlib as "msvcrt" doesn't exist on Unix. 2005-01-29 Jonathan Pryor * Stdlib.cs: sys_* functions shouldn't be public. 2005-01-13 Jonathan Pryor * make-map.cs: libMonoPosixHelper exports Mono_Posix prefixes, not Mono_Unix prefixes, so change the type and namespace to generate compatible code. * Syscall.cs: Change OpenFlags values so they match the Linux values. 2005-01-13 Jonathan Pryor * Stdlib.cs: Use Stdlib.LIBC instead of "libc". * StdioFileStream.cs: Add FilePosition property (not that I expect anyone to use it) and Rewind() method. 2005-01-05 Jonathan Pryor * StdioFileStream.cs: Added; System.IO.Stream wrapper for C FILE struct. * Stdlib.cs: Correct visibility of ftell(). 2005-01-05 Jonathan Pryor * Stdlib.cs: Re-order declarations to match the order used in the C99 Standard Annex B; Complete exports (except for those not worth supporting); Add non-"unsafe" versions of fread(3), fwrite(3) and add some rudimentary buffer-overflow checking; Add exports such as getenv(3), exit(3), rand(3), EXIT_SUCCESS, RAND_MAX, etc. 2005-01-03 Jonathan Pryor * Syscall.cs: Update endfsent() and setfsent() declarations, as these must now be implemented in MonoPosixHelper. 2005-01-01 Jonathan Pryor * Stdlib.cs, Syscall.cs: Minimize duplicate declarations of "MonoPosixHelper" for use in DllImport statements. 2005-01-01 Jonathan Pryor * Stdlib.cs: Don't use C# v2 features; fixes build under CSC.EXE. 2004-12-30 Jonathan Pryor * Stdlib.cs: On miguel's suggestion, rename Sighandler_t to SignalHandler. 2004-12-30 Jonathan Pryor * Stdlib.cs: Implement all C89 functions except for the scanf(3) family. These are too dangerous to expose. 2004-12-30 Jonathan Pryor * CdeclFunctions.cs: Remove warning about unused variable. * Stdlib.cs: Make signal(2) sane and (hopefully) complete. * Syscall.cs: Fix cuserid Obsolete message to reference correct class name. * UnixProcess.cs: Remove warning about unused variable. * UnixMarshal.cs: Remove warnings about unused variables. 2004-12-29 Jonathan Pryor * UnixPath.cs: Add ReadSymbolicLink(), which takes an intelligent approach to reading symlinks (since their contents may be any size, we grow the buffer dynamically to fit them all, instead of assuming a maximum size). * UnixSymbolicLinkInfo.cs: Remove MaxContentsSize. 2004-12-29 Jonathan Pryor * UnixPath.cs: Add check for when symlink points to a full path name. 2004-12-29 Jonathan Pryor * Syscall.cs: Fix Object.Equals implementations. * UnixPath.cs: New & improved, with Testing! GetRealPath() is changed so that it doesn't walk the entire path looking for symlinks, it just reads the leaf. GetCompletRealPath() walks the entire path resolving symlinks. GetCanonicalPath() added, which "cleans up" a path (removing extraneous "." and ".." entries). * UnixSymbolicLinkInfo.cs: Rename ContentsLength -> MaxContentsSize. 2004-12-28 Jonathan Pryor * UnixFileSystemInfo.cs: Add a link(2) wrapper, CreateLink(). Strictly speaking it's only "safe" to do this on files, but an exception will be returned if the user tries to hard link directories (because of EPERM), unless the user is root, in which case it should be allowed anyway... 2004-12-28 Jonathan Pryor * CdeclFunctions.cs: Correct the comments for AMD64 * UnixDirectoryInfo.cs: override Name; add Parent & Root properties; Correct Path usage (s/Path/FullPath/g). * UnixDriveInfo.cs: Added. Based on .NET 2.0 System.IO.DriveInfo docs, provides statvfs(2) and getfsfile(3) information about a mounted volume. GetDrives() wraps getfsent(3), thus parsing /etc/fstab. * UnixFile.cs: Use UnixConver.ToOpenFlags, deleting the local version. * UnixFileInfo.cs: Use UnixConver.ToOpenFlags, deleting the local version; override Name; add DirectoryName and Directory properties; * UnixFileSystemInfo.cs: Make more .NET-like, using FullPath and OriginalPath protected members, abstract Name property; Add CreateSymbolicLink; Remove ReadLink (it's now UnixSymbolicLinkInfo.Contents); Use lstat(2) for Create(string), so we properly detect Symbolic Links. * UnixPath.cs: Added; Path manipulation utility functions. * UnixSymbolicLinkInfo.cs: - Seal the class; - override new abstract member Name; - rename ReadLink to ContentsPath (and Contents) properties (why "Contents"? Because readlink(2) says "readlink places the contents of the symbolic link in the buffer...") - Add CreateSymbolicLinkTo(), which creates a symlink to the specified "normal" file 2004-12-28 Jonathan Pryor * Stdlib.cs: Add syslog(3) to XPrintfFunctions; Add additional printf(3) and fprintf(3) overload which properly escape the format string (by using "%s" as the format for the user-supplied message). * Syscall.cs: Add #regions for enummerations, structures, classes; Wrap syslog(3) and related enumerations; fix operator!= on Dirent, Group; wrap {f}statvfs(2); wrap entries (getfsent(3), etc.). * UnixConvert.cs: Add Syslog-releated enumeration translation functions; Move ToOpenFlags here from UnixFile and UnixFileInfo. * UnixMarshal.cs: Missing P/Invoke methods throw EntryPointNotFoundException, not MissingMethodException; add EscapeFormatString, which escapes printf-style format strings so that they can be safely handed off to native code (avoiding stack overflow, etc); make CreateExceptionForError internal. 2004-12-15 Jonathan Pryor * Stdlib.cs: Add more wrappers, such as fread(3) and fwrite(3). These will be useful in implementing System.IO.Stream subclass for reading/writing to a FILE*. Fix a typo in the realloc(3) DllImport. * Syscall.cs: Fix the sys_kill and sys_crypt declarations. * CdeclFunction.cs: Document calling convention problems on AMD64. 2004-11-18 Jonathan Pryor * CdeclFunction.cs: Added. * Stdlib.cs: Re-add printf(3) and fprintf(3). They may not be portable (the jury is still out on that; the AMD64 SysV ABI looks like it should be portable to AMD64 to my eyes), but they will work on *some* platforms, so we should permit it. The new implementation takes a page out of cocoa-sharp: use System.Reflection.Emit to generate a P/Invoke method at runtime to invoke printf(3) or fprintf(3). This way, we can export a params signature to C# code, permitting natural usage such as: Stdlib.printf ("Hello, %s world! (%i)\n", "silly", 42); * Syscall.cs: Mark which headers are complete, which functions still need wrapping (for headers which have anything done to them), add #region blocks for each header; export mkfifo(3), fexecve(), getppid(2), setlogin(); fix sleep(3) export. * UnixEnvironment.cs: Export a friendly getppid(2) wrapper. GetParentProcessId isn't in UnixProcess as there's no way (that I know of) to get the Parent's Parent, so it can't be a class member, and exposing it as a static member of UnixProcess doesn't make sense to me, as it isn't general. Added GetUserShells(). * UnixProcess.cs: Change constructor to internal, so it can be used from UnixEnvironment. 2004-11-16 Jonathan Pryor * Stdlib.cs: Remove printf(3) and fprintf(3). These are vararg/CDECL functions, and it's not portable to call them in this manner. (It's not portable because some architectures, such as AMD64, use a "cookie" as part of the vararg calling sequence to help reduce buffer overflow exploits. Trying to call vararg functions as if they were an overloaded function will not properly set this hardware cookie, resulting in a hardware exception. Talk to lupus for more information.) 2004-11-16 Jonathan Pryor * Syscall.cs, UnixConvert.cs: Remove mount- and umount-related functionality. Mount/umount is inherently non-portable (see the C code for mount/umount), and trying to provide a consistent interface is impossible. If you need mount/umount support, use the command-line programs mount(1) and umount(1). 2004-11-16 Jonathan Pryor + Lots o' Renames, as the namespace changed. * PosixConvert.cs: Moved to UnixConvert.cs: * PosixDirectory.cs: Moved to UnixDirectory.cs: * PosixEnvironment.cs: Moved to UnixEnvironment.cs: * PosixDirectoryInfo.cs: Moved to UnixDirectoryInfo.cs: * PosixFile.cs: Moved to UnixFile.cs: * PosixFileInfo.cs: Moved to UnixFileInfo.cs: * PosixFileSystemInfo.cs: Moved to UnixFileSystemInfo.cs: * PosixGroup.cs: Moved to UnixGroup.cs: * PosixGroupInfo.cs: Moved to UnixGroupInfo.cs: * PosixIOException.cs: Moved to UnixIOException.cs: * PosixMarshal.cs: Moved to UnixMarshal.cs: * PosixProcess.cs: Moved to UnixProcess.cs: * PosixStream.cs: Moved to UnixStream.cs: * PosixSymbolicLinkInfo.cs: Moved to UnixSymbolicLinkInfo.cs: * PosixUser.cs: Moved to UnixUser.cs: * PosixUserInfo.cs: Moved to UnixUserInfo.cs: * Catalog.cs, IncludeAttribute.cs, MapAttribute.cs, PeerCred.cs, Stdlib.cs, Syscall.cs, UnixConvert.cs, UnixDirectory.cs, UnixDirectoryInfo.cs, UnixEndPoint.cs, UnixEnvironment.cs, UnixFile.cs, UnixFileInfo.cs, UnixFileSystemInfo.cs, UnixGroup.cs, UnixGroupInfo.cs, UnixIOException.cs, UnixMarshal.cs, UnixProcess.cs, UnixStream.cs, UnixSymbolicLinkInfo.cs, UnixUser.cs, UnixUserInfo.cs: Deal with renamed classes/members. 2004-11-15 Jonathan Pryor * PosixUserInfo.cs: Make the PosixUserInfo(Passwd) constructor public; override Object.GetHashCode and Object.Equals. * PosixGroupInfo.cs: Make the PosixGroupInfo(Group) constructor public; override Object.GetHashCode and Object.Equals. * PosixIOException.cs: Use PosixMarshal.GetErrorDescription instead of calling Syscall.strerror_r directly * PosixMarshal.cs: Add GetErrorDescription. Strerror_r() isn't portable, so GetErrorDescription() first tries strerror_r(), and if it fails falls back to strerror(3). * Syscall.cs: - Seal the Dirent class. It has no virtual members, so there's no point in it being non-sealed. Override Object.GetHashCode and Object.Equals. - Seal the Group class. It has no virtual members, so there's no point in it being non-sealed. Override Object.GetHashCode and Object.Equals. Provide operator== and operator!=. - Seal the Passwd class. It has no virtual members, so there's no point in it being non-sealed. Override Object.GetHashCode and Object.Equals. Provide operator== and operator!=. - Remove strerror_r() convenience overload. This is now PosixMarshal.GetErrorDescription(). 2004-11-12 Jonathan Pryor * Syscall.cs: Export time-related functions (gettimeofday, settimeofday, utime, utimes), mknod. 2004-11-07 Atsushi Enomoto * PosixEnvironment.cs : csc build fix. see bug #69195. * PosixStream.cs : csc build fix. see bug #69196. 2004-11-05 Jonathan Pryor * PosixConvert.cs: New file; conversion functions for Mono.Posix types. * PosixDirectory.cs: New file; Friendly wrapper over directory information. * PosixDirectoryInfo.cs: New file; Friendly wrapper over directory information. * PosixEnvironment.cs: New file; Friendly wrapper over environment information. * PosixFile.cs: New file; Friendly wrapper over file information. * PosixFileInfo.cs: New file; Friendly wrapper over file information. * PosixFileSystemInfo.cs: New file; Friendly wrapper over `stat'. * PosixGroup.cs: New file; User Group-related functionality * PosixGroupInfo.cs: New file; User Group-related functionality * PosixIOException.cs: New file; Exception for POSIX-generated exceptions. * PosixMarshal.cs: New file; utility functions for marshaling, etc. * PosixProcess.cs: New file; Friendly wrapper over process information. * PosixStream.cs: New file; Friendly wrapper over file descriptors. * PosixSymbolicLinkInfo.cs: New file; Friendly wrapper over symbolic links. * PosixUser.cs: New file; Friendly wrapper over user information. * PosixUserInfo.cs: New file; Friendly wrapper over user information. * Stdlib.cs: New file; C standard library exports. * Syscall.cs: Effective re-write. - Organize exports by header file - add additional enumerations (Error for the E* error values, etc.) - always explicitly specify enumeration underlying type - Use a new wrapping infrastructure so that ABI-stable types are exported - For example, size_t is exported as ulong, not IntPtr. - Wrap more functions, and wrap them better (such as getpwnam). - This release is NOT backward compatible. Many names are the same, and hopefully they're still compatible, but no effort was made to maintain compatibility. For example, FileMode was removed and replaced with FilePermissions, to avoid a name conflict with System.IO.FileMode. - Change umount() to use MonoPosixHelper: portability fix for Mac OS X. * make-map.cs: Another effective re-write, to clean up the code, produce better output, and produce more output. For example, most of PosixConvert can be auto-generated, so it is (modulo version delays and bootstrap issues). `map.c' is now conditional on all macros, and has error checking for invalid/unsupported values. 2004-09-18 Jackson Harper * Syscall.cs: Add support for poll (). 2004-09-18 Jackson Harper * make-map.cs: Use field value not name for #defines. 2004-09-14 Loren Bandiera * Syscall.cs: Added method for getpwnam which uses Passwd struct. * macros.c: Helper function for getpwnam (In committing, Josh Tauberer also added getpwuid.) 2004-07-09 Dick Porter * PeerCred.cs: Get the unix socket peer credentials. 2004-05-26 Miguel de Icaza * Syscall.cs: Do not let the runtime handle strings, as we do not own those strings, we must transform the char * into a string ourselves. 2004-05-03 Miguel de Icaza * Syscall.cs: Add symlink 2004-04-19 Miguel de Icaza * Syscall.cs: Use hex values for FileMode, since C# does not have an octal integer mode. 2004-03-30 Joshua Tauberer * Added readlink, strerror, opendir, readdir, closedir * Added Mono.Posix.Stat.UnixToDateTime(long unixtime) --> DateTime 2004-03-11 Joshua Tauberer * Syscall.cs: Removed argument to getgid that shouldn't be there. Added getusername, getgroupname which wrap getpwuid, getgrgid without dealing with pointers to structures. Removed duplicate FileMode enum nested in Syscall class. Added stat and lstat, which use StatMode enumeration (like FileMode but nicer and complete) and Stat struct. * macros.c: Helper functions for getpwuid, getgrgid, stat, lstat. 2004-01-07 Gonzalo Paniagua Javier * Syscall.cs: moved the assembly attribute to a proper place and added 'signal.h' * make-map.cs: use reflection to invoke the properties, as it fails under MS runtime. 2004-01-05 Gonzalo Paniagua Javier * Syscall.cs: moved assembly attribute and added unsafe block to fix the build on windows. 2003-11-11 Wojciech Polak to support IsAtty. 2003-05-16 Dick Porter * UnixEndPoint.cs: New property to get and set the filename, like the IPEndPoint has for the IP address. Also implement ToString(). Tue Apr 29 16:53:56 CEST 2003 Paolo Molaro * Syscall.cs: remove the unsafe mess. 2003-02-05 Gonzalo Paniagua Javier * Check in. * UnixEndPoint.cs: first file.