merge from trunk revisions 58933, 58935, 58936
[mono.git] / mcs / class / Mono.Posix / Mono.Unix / ChangeLog
1 2005-11-08  Jonathan Pryor <jonpryor@vt.edu>
2
3         * Catalog.cs: Exception safety improvements (don't let memory leak!); check
4           for errors with bindtextdomain(3) et. al.
5
6 2005-11-08  Jonathan Pryor <jonpryor@vt.edu>
7
8         * UnixPipes.cs: Provide Equals, GetHashCode, and operator==/operator!= to
9           conform with FxCop guidelines for structures.
10
11 2005-11-03  Jonathan Pryor <jonpryor@vt.edu>
12
13         * FileTypes.cs, UnixFileSystemInfo.cs: s/FIFO/Fifo/ to follow .NET
14           naming conventions (as reported by FxCop).
15
16 2005-11-01  Jonathan Pryor <jonpryor@vt.edu>
17
18         * UnixDirectoryInfo.cs, UnixDriveInfo.cs, UnixEnvironment.cs, 
19           UnixFileSystemInfo.cs, UnixGroupInfo.cs, UnixProcess.cs, UnixUserInfoc.cs:
20           Obsolete statements now specify in what way the return type will change.
21         * IncludeAttribute.cs: Obsoleted.  It's an error to use it now.
22
23 2005-11-01  Jonathan Pryor <jonpryor@vt.edu>
24
25         * FileAccessPattern.cs: Change enumeration names to match Robert Love's more
26           sensible names from his FileAdvise class used in Beagle
27           (UseSoon --> PreLoad, WillNotUse --> FlushCache).
28         * FileHandleOperations.cs: Added; contains AdviseFileAccessPattern()
29           (moved from UnixFile.cs).
30         * UnixDirectory.cs: Obsolete the class; use UnixDirectoryInfo instead.
31         * UnixDirectoryInfo.cs: Add GetCurrentDirectory(), SetCurrentDirectory().
32         * UnixFile.cs: Obsolete the class; use UnixFileInfo, FileHandleOperations,
33           or UnixPipes instead.
34         * UnixFileSystemInfo.cs: Add ToStat() method.
35         * UnixGroup.cs: Obsolete the class; use UnixGroupInfo instead.
36         * UnixGroupInfo.cs: Obsolete & Replace constructor, add GetMemberNames(),
37           GetLocalGroups().
38         * UnixPipes.cs: Added (type moved from UnixFile.cs).
39         * UnixStream.cs: AdviseFileAccessPattern() uses FileHandleOperations now.
40         * UnixSymbolicLinkInfo.cs: Implement TryReadLink() to avoid constant buffer
41           re-sizing.  Stevens states that the file size of the symlink is the number
42           of bytes needed to hold the symlink, so this should be faster.
43         * UnixUser.cs: Obsolete the class; use UnixUserInfo instead.
44         * UnixUserInfo.cs: Obsolete & Replace constructor; add useful static members
45           from UnixUser such as GetLoginName(), GetLocalUsers(), etc.
46
47 2005-10-27  Jonathan Pryor <jonpryor@vt.edu>
48
49         * UnixEnvironment.cs: Add RealUser, RealGroup, EffectiveUser, EffectiveGroup
50           properties; [Obsolete] necessary methods and provide replacements.
51         * UnixStream.cs: Add OwnerUser(Id), OwnerGroup(Id) properties; 
52           improve Stat handling.
53
54 2005-10-26  Jonathan Pryor <jonpryor@vt.edu>
55
56         * UnixEncoding.cs: Change EscapeByte to 0x0000, as suggested by Michal
57           Moskal.
58         * UnixPath.cs: Remove '\0' from InvalidPathChars, since U+0000 is now used
59           as the path escape character for marshaling purposes.
60
61 2005-10-26  Jonathan Pryor <jonpryor@vt.edu>
62
63         * UnixMarshal.cs: Obsolete heap-related methods to have a Heap suffix
64           (AllocHeap, FreeHeap, etc.), and change StringToAlloc() to be
65           StringToHeap().  This creates a stronger name association between related
66           methods.
67
68 2005-10-26  Jonathan Pryor <jonpryor@vt.edu>
69
70         * UnixIOException.cs: Add (string) and (string, Exception) constructors to
71           silence FxCop; re-work logic so we lookup the error string at construction
72           time and use this as the message for the base class.
73
74 2005-10-25  Jonathan Pryor <jonpryor@vt.edu>
75
76         * Stdlib.cs, Syscall.cs: Filenames need to be marshaled through the 
77           FileNameMarshaler, which will encode/decode filenames with UnixEncoding.
78         * UnixEncoding.cs: Added (copied from
79           ../../corlib/System.Text/UTF8Encoding.cs); a hack to permit handling of 
80           arbitrarily encoded filenames.  It attempts to decode a byte[] array as 
81           UTF-8, and if the decode fails it prefixes each byte with 
82           UnixEncoding.EscapeByte (\uFFFF).
83         * UnixMarshal.cs: Use UnixEncoding as the default encoding, and special-case
84           UnixEncoding to use Stdlib.strlen() for native string lengths.
85
86 2005-10-21  Jonathan Pryor <jonpryor@vt.edu>
87
88         * FileAccessPattern.cs: Added
89         * UnixFile.cs, UnixStream.cs: Deprecate all the Advise* methods (lots!)
90           and replace with 6 methods which take a FileAccessPattern enum.
91
92 2005-10-19  Jonathan Pryor <jonpryor@vt.edu>
93
94         * FileAccessPermissions.cs, FileSpecialAttributes.cs, FileTypes.cs: Added.
95         * UnixFileSystemInfo.cs, UnixStream.cs: Replace the old Permission property
96           with 4 new properties: Protection (for the Native.FilePermissions value),
97           FileAccessPermissions (for rwxrwxrwx info), FileSpecialAttributes (for
98           set-user-id, set-group-id, sticky), and FileTypes (directory, socket...).
99           The new enumeration types have nicer CLS-compliant names.
100
101 2005-10-17  Jonathan Pryor <jonpryor@vt.edu>
102
103         * UnixMarshal.cs: Fix GetIntXxBufferLength to require fewer
104           Marshal.ReadIntXx() calls; Fix PtrToString so that
105           ``"foo" == PtrToString (StringToAlloc("foo",enc),enc)'' is true for
106           "random" encodings.
107
108 2005-10-17  Jonathan Pryor <jonpryor@vt.edu>
109
110         * UnixFileSystemInfo.cs: Add OwnerUserId and OwnerGroupId properties.
111
112 2005-10-17  Jonathan Pryor <jonpryor@vt.edu>
113
114         * UnixDriveInfo.cs, UnixEnvironment.cs, UnixFile.cs, UnixFileSystemInfo.cs, 
115           UnixGroup.cs, UnixStream.cs, UnixUser.cs: Don't use SetLastError(), since
116           it's use is (1) incorrect, and (2) will be going away with the move to
117           Mono.Unix.Native.Syscall.  Instead use the Native.Syscall.* APIs which 
118           set errno sanely.
119
120 2005-10-17  Jonathan Pryor <jonpryor@vt.edu>
121
122         * UnixGroup.cs, UnixGroupInfo.cs, UnixFile.cs, UnixFileSystemInfo.cs,
123           UnixStream.cs, UnixSymbolicLinkInfo.cs, UnixUser.cs, UnixUserInfo.cs:
124           Start migrating uid/gid to long (from uint) for CLS compliance.
125           (Full migration must wait 'til after the next release as this would
126           require changes to existing members.)
127         * UnixEnvironment.cs: Above, and add RealUserId/RealGroupId and
128           EffectiveUserId/EffectiveGroupId.
129
130 2005-10-14  Jonathan Pryor <jonpryor@vt.edu>
131
132         * Catalog.cs: Create a constructor and mark it [Obsolete].  It will be made
133           private after the next release.
134         * UnixFile.cs, UnixStream.cs: Deal with Mono.Unix.Native type name changes.
135         * UnixFileSystemInfo.cs: [Obsolete] more members; Deal with Mono.Unix.Native 
136           type name changes.
137         * Syscall.cs: Create maps for PathConf, SysConf, ConfStr again; fpathconf(),
138           pathconf(), and sysconf() should call Native.Syscall since the
139           MonoPosixHelper.so helpers have changed.
140
141 2005-10-13  Jonathan Pryor <jonpryor@vt.edu>
142
143         * UnixMarshal.cs: More/better StringToAlloc/PtrToString which take a
144           System.Text.Encoding instance for proper string marshaling.  
145           - PtrToString(string,Encoding) is particularly tricky due to variable
146             length encodings.
147           - Fix StringToAlloc so that it works properly with UTF-16 encodings 
148             (we need a terminating null 16-bit word, not a null byte).
149           - StringToAlloc overload for doing substrings.
150
151 2005-10-12  Jonathan Pryor <jonpryor@vt.edu>
152
153         * UnixStream.cs: Check for EROFS and EINVAL in Flush().  Snorp was getting
154           an exception when he created a UnixStream around a socket, because
155           sockets can't be flushed.  It should be acceptable to create a UnixStream
156           around a socket, so don't throw an exception in this scenario.
157
158 2005-10-06  Jonathan Pryor <jonpryor@vt.edu>
159
160         * UnixDirectory.cs, UnixDirectoryInfo.cs UnixFile.cs, UnixFileSystemInfo.cs, 
161           UnixGroupInfo.cs, UnixIOException.cs, UnixStream.cs, UnixUserInfo.cs:
162           API Review: Obsolete appropriate members and add appropriate overloads for
163           pending move to Mono.Unix.Native types.
164         * UnixMarshal.cs: API Review; add StringToAlloc().
165
166 2005-09-26  Jonathan Pryor <jonpryor@vt.edu>
167
168         * UnixFileSystemInfo.cs: Exists shouldn't use access(2), as (1) Exists isn't
169           virtual, and (2) access(2) errors if you try to access(2) a symlink which
170           points nowhere.  Use (l)stat(2) instead, via GetFileStatus(), as this lets
171           UnixSymbolicLinkInfo behave properly.
172         * UnixSymbolicLinkInfo.cs: The Contents property should return null if the
173           symlink target doesn't exist.
174
175 2005-09-20  Jonathan Pryor <jonpryor@vt.edu>
176
177         * Syscall.cs: Add [Map] to AccessMode and MmapProt, as the Mono.Unix.Native
178           replacements go by different names (AccessModes, MmapProts), but we need
179           to continue generating the mapping code for these types (backward compat).
180
181 2005-09-20  Jonathan Pryor <jonpryor@vt.edu>
182
183         * CdeclFunction.cs: [Obsolete]d by Mono.Unix.Native.CdeclFunction.
184         * make-map.cs: Remove.
185         * Stdlib.cs: [Obsolete] the types; use the Mono.Unix.Native.* types instead.
186         * StdioFileStream.cs: Add GC.KeepAlive statements to prevent premature GC's
187           (FxCop suggestion).
188         * Syscall.cs: Remove [Map] attribute from all types; [CLSCompliant(false)]
189           work; [Obsolete] all types and suggest using the Mono.Unix.Native.*
190           replacements; remove [IncludeAttribute] -- superseded by
191                 Mono.Unix.Native/Syscall.cs's [HeaderAttribte] for CLS compliance.
192         * UnixConvert.cs: [Obsolete]d by Mono.Unix.Native.NativeConvert.
193         * UnixDirectory.cs, UnixDriveInfo.cs, UnixEnvironment.cs, 
194           UnixGroup.cs, UnixGroupInfo.cs, 
195           UnixSymbolicLinkInfo.cs, UnixUser.cs, UnixUserInfo.cs:
196           Add [CLSCompliant(false)] as necessary.
197         * UnixFile.cs, UnixDirectory.cs, UnixFileInfo.cs, UnixFileSystemInfo.cs: 
198           [CLSCompliant(false)], addition of method overloads for [Obsolete]d types, 
199           warn about changing return types.
200         * UnixProcess.cs, UnixStream.cs: Add [CLSCompliant(false)] as necessary, 
201           and warn about changing property types.
202
203 2005-09-02  Jonathan Pryor <jonpryor@vt.edu>
204
205         * Stdlib.cs: Cache delegates passed to Stdlib.signal() so that they survive
206           garbage collections.  Delegates can be removed by calling Stdlib.signal()
207           again with one of the Stdlib.SIG_* values (or the original return value of
208           Stdlib.signal()).
209         * UnixUser.cs, UnixGroup.cs, UnixEnvironment.cs: Clarify "Id" (int) vs. 
210           "Name" (string) differences by always using a Id or Name suffix.
211
212 2005-07-01  Daniel Drake  <dsd@gentoo.org>
213
214         * Syscall.cs: The entire extended attribute API now goes through MPH, to
215           be shared between both Linux's and FreeBSD's similar EA implementations.
216
217 2005-06-29  Miguel de Icaza  <miguel@ximian.com>
218
219         * StdioFileStream.cs: Only flush if we do not own the handle, as
220         fclose does a flush internally.
221
222 2005-06-29  Jonathan Pryor <jonpryor@vt.edu>
223
224         * UnixEnvironment: Add User, Login properties.
225         * Syscall.cs: Add locking around cuserid, crypt, encrypt, getlogin.
226
227 2005-06-29  Jonathan Pryor <jonpryor@vt.edu>
228
229         * Syscall.cs: SyslogFacility shouldn't be [Flags] either.  Sigh.
230           Thanks to Vorobiev Maksim for pointing this out.
231         * make-map.cs: Don't generate conversion code for [Obsolete] enum members.
232           This assumes that (1) the enum member's value is invalid, or (2) a
233           corrected member with the same value exists.  This fix allows us to
234           obsolete invalid members (instead of removing them) without screwing up
235           the generated code -- consider LOG_USRE, the mis-spelling of LOG_USER.
236           Since SyslogFacility was (incorrectly) a [Flags] enum, since both LOG_USER
237           and LOG_USRE had the same value, we'd get a EINVAL error trying to convert
238           a valid value, since LOG_USRE would exist, would be checked for, and the
239           check would succeed (since it had the same value as LOG_USER).
240           This change allows us to be slightly more permissive with versioning.
241
242 2005-06-28  Jonathan Pryor <jonpryor@vt.edu>
243
244         * Syscall.cs: correct value of LOG_CRON (it shouldn't be identical to
245           LOG_UUCP).  SyslogLevel shouldn't have [Flags].  Move LOG_USER to be
246           before LOG_USRE so that the generated map code doesn't return EINVAL when
247           LOG_USER is specified.
248
249 2005-06-15  Jonathan Pryor <jonpryor@vt.edu>
250
251         * Syscall.cs: s/LOG_USRE/LOG_USER/.  Fixes #75274.  
252           Thanks to Martin Honermeyer.
253
254 2005-06-09  Jonathan Pryor <jonpryor@vt.edu>
255
256         * make-map.cs: Look for [Obsolete] members, and mark the UnixConvert
257           conversion functions with the same [Obsolete] message.  This should permit
258           more graceful deprecation of enumerations in the future (rather than just
259           API breaks).
260
261 2005-06-08  Jonathan Pryor <jonpryor@vt.edu>
262
263         * Syscall.cs: Add execvp(2).  (This should have been added with the other
264           exec(2) additions...).
265
266 2005-06-08  Jonathan Pryor <jonpryor@vt.edu>
267
268         * Syscall.cs: Update comment with correct exception type.
269         * UnixConvert.cs: Rename ToFilePermissions(string) to
270           FromOctalPermissionString; Add ToOctalPermissionString,
271           FromUnixPermissionString, ToUnixPermissionString.
272         * UnixMarshal.cs: Remove ErrorMarshal.HaveStrerror_r and
273           UnixMarshal.IsErrorDescriptionThreadSafe.  strerror(3) is now thread-safe
274           (from managed code, at least).  Update comment.
275
276 2005-06-07  Jonathan Pryor <jonpryor@vt.edu>
277
278         * UnixFileSystemInfo.cs: Don't use lstat(2), use stat(2).  This fits with
279           expectations better -- if you create a UnixFileInfo() on a symlink, you
280           want to get the target's information, not the symlink's info.  Add
281           GetFileStatus so UnixSymbolicLinkInfo can override this behavior.
282         * UnixSymbolicLinkInfo.cs: Implement GetFileStatus() (which calls lstat(2)).
283
284 2005-06-07  Jonathan Pryor <jonpryor@vt.edu>
285
286         * Syscall.cs: Document naming conventions.
287
288 2005-06-05  Jonathan Pryor <jonpryor@vt.edu>
289
290         * make-map.cs: Change automatic "ifdef HAVE_<header>" support prefix to
291           "ah:" from ">".  I hadn't known about ">", and "ah:" is (somewhat) more
292           obvious.
293         * Syscall.cs: Change IncludeAttribute to put all headers/defines one/line.
294           It's easier to read this way.  Add "ah:sys/xattr.h" to the headers.
295
296 2005-06-03  Jonathan Pryor <jonpryor@vt.edu>
297
298         * Stdlib.cs: Add sanity checking to snprintf(3) to avoid buffer overflows.
299
300 2005-06-02  Jonathan Pryor <jonpryor@vt.edu>
301
302         * StdioFileStream.cs: Remove FilePosition property & replace with
303           SaveFilePosition/RestoreFilePosition methods.  Since FilePosition has a
304           finalizer, it's not right to have implicitly created instances.
305         * Stdlib.cs: 
306           - FilePosition: GC.SuppressFinalize() should be last in Dispose() 
307             (following .NET guidelines).
308           - Syscall: Add locking around functions most likely to be thread unsafe.
309             This should provide some level of thread-safety to managed code.
310         * Syscall.cs: Add locking around functions most likely to be thread unsafe;
311           add mkstemp(3) export.
312         * UnixEnvironment.cs: GetUserShells should be atomic (from managed code).
313         * UnixGroup.cs: GetLocalGroups should be atomic (from managed code).
314         * UnixGroupInfo.cs: Add ToGroup() method to retrieve underlying Group info.
315         * UnixUser.cs: GetLocalUsers should be atomic (from managed code).
316         * UnixUserInfo.cs: Add ToPasswd () method to retrieve underlying Passwd info.
317         * UnixDriveInfo.cs: GetDrives should be atomic (from managed code).
318
319 2005-05-31  Jonathan Pryor <jonpryor@vt.edu>
320
321         * Stdlib.cs: Add comment for atexit(3) so I don't try to add it.
322         * Syscall.cs: Add fcntl(2) overload which takes DirectoryNotifyFlags (so
323           that *something* accepts a DirectoryNotifyFlags); Fix IncludeAttribute
324                 header files (">sys/poll.h" doesn't exist); 
325           Add additional <sys/mman.h> functions mmap, munmap, msync, mlock, munlock,
326           mlockall, munlockall, mremap, mincore, remap_file_pages.
327         * UnixConvert.cs: Add conversion functions for MmapFlags, MmapProt, MsyncFlags,
328           MlockallFlags, MremapFlags.
329
330 2005-05-31  Jonathan Pryor <jonpryor@vt.edu>
331
332         * Syscall.cs, UnixConvert.cs: Rename LockFlags to LockfCommand.  This is a more 
333           consistent naming, and it's more correct (they weren't flags in the first place).
334
335 2005-05-18  Jonathan Pryor <jonpryor@vt.edu>
336
337         * Stdlib.cs: Correct Mono_Posix_Stdlib_InvokeSignalHandler export.
338
339 2005-05-18  Jonathan Pryor <jonpryor@vt.edu>
340
341         * make-map.cs: Process the Mono.Posix namespace as well as Mono.Unix; add
342           mapping for Boolean => int for native type conversion.
343
344 2005-05-18  Jonathan Pryor <jonpryor@vt.edu>
345
346         * make-map.cs: Add a MphPrototypeFileGenerator, which looks for DllImport
347           methods across all types and generates a C header file declaration for
348           those methods.  This allows us to ensure consistency between
349           Mono.Posix.dll and MonoPosixHelper.so.  Rename WrapperFileGenerator to
350                 ConvertFileGenerator (it generates UnixConvert).
351         * MapAttribute.cs, IncludeAttribute.cs: Make these internal -- there's no
352           reason for external users to even know these exist.
353         * StdioFileStream.cs: Move GC.SuppressFinalize call to be last Dispose()
354           call.  This follows current design guidelines, and allows an exception to
355           be thrown from Dispose() without un-registering the finalizer.
356         * Syscall.cs: Change method declarations to match MonoPosixHelper, etc.
357            - posix_fallocate(P) takes a size_t
358            - mis-spelled settimeofday(2), sethostname(2)
359            - exec(2) can be public; it's safe to call
360            - change lseek(2) so int's are passed to MonoPosixHelper.so, not shorts
361            - We can't allow two incompatible prototypes to exist (since C allows
362              only one prototype, and we're cross-checking prototypes now).  Change
363              utime(2) so only one prototype is needed.
364         * UnixMarshal.cs: ErrorMarshal.ErrorTranslator and ErrorMarshal.Translate
365           shouldn't be public; make them internal.
366         * UnixStream.cs: Remove `unsafe` code block when a "safe" alternative works;
367           Close() should also call GC.SuppressFinalize.
368
369 2005-05-12  Jonathan Pryor <jonpryor@vt.edu>
370
371         * Syscall.cs: The Statvfs structure should contain a MountFlags enumeration,
372           not a ulong (we can "safely" do this since POSIX defines some values for
373           f_flag, so we should be kind and expose them).
374         * UnixConvert.cs: Add MountFlags conversion functions.
375
376 2005-05-02  Joe Shaw  <joeshaw@novell.com>
377
378         * UnixListener.cs (Init): Remove the call to Cleanup() and the
379         method itself, which was not supposed to be here.  We try to
380         connect to the socket if it exists instead of deleting it
381         undconditionally.
382
383 2005-04-30  Ben Maurer  <bmaurer@ximian.com>
384
385         * Stdlib.cs: Comment out usage of `UnmanagedFunctionPointer'. It
386         isn't supported in the runtime -- it throws an assert -- so better
387         not to use it at all for now.
388
389 2005-04-29  Jonathan Pryor <jonpryor@vt.edu>
390
391         * UnixConvert.cs: Fix time_t -> DateTime conversions.  time_t should be
392           assumed to be in the local time zone, so don't mess with UTC shifts.
393           This allows Mono.Unix to produce sane output (e.g. identical to ls(1) or
394           stat(1), instead of several hours different).
395
396 2005-04-29  Jonathan Pryor <jonpryor@vt.edu>
397
398         * Stdlib.cs: Make FilePosition slightly more useful by providing a
399           ToString() override which dumps the fpos_t structure contents into a 
400           hex string.  Add Equals(), GetHashCode(), operator==, and operator!=
401           so FilePosition behaves like a value type.
402
403 2005-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
404
405         * UnixClient.cs:
406         * UnixListener.cs: TcpListener/TcpClient clones from Jow Shaw.
407
408 2005-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
409
410         * Mono.Posix.dll.sources: added UnixListener and UnixClient from Joe
411         Shaw.
412
413 2005-04-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
414
415         * UnixEndPoint.cs: fix from Mono.Posix.
416
417 2005-04-20  Jonathan Pryor <jonpryor@vt.edu>
418
419         * Syscall.cs: Make all fork(2) and exec(2) functions `private`.  It
420           currently isn't safe to call these under *any* circumstances.  See also
421           68141, and this pertinent quote from Butenhof's 
422           "Programming with POSIX Threads", p197, s6.1:
423           
424               "When a threaded process calls fork to create a child process,
425               Pthreads specifies that only the thread calling fork exists in the
426               child. ... Pthreads does not 'terminate' the other threads in a forked
427               process...They simply cease to exist.  ... This is not a problem if
428               the child process is about to call exec to run a new program, but if
429               you use fork to clone a threaded program, beware that you may lose
430               access to memory, especially heap memory stored only as
431               thread-specific data values."
432           
433           Since P/Invoke currently requires using thread local storage, once you
434           fork(2) you won't be able to invoke exec(2) from managed code (since that
435           would require a P/Invoke transition to call exec(2), which would require
436           TLS, which doesn't exist in the new process).
437          
438           This can only be fixed by removing the TLS dependency on P/Invoke, which
439           isn't a priority (and may not be possible).
440          
441           The workaround is to create a C function which does your fork(2)/exec(2)
442           (and any other functions such as daemon(3)) on your behalf, and P/Invoke
443           to call this C function.
444
445 2005-04-18  Jonathan Pryor <jonpryor@vt.edu>
446
447         * Syscall.cs: Update comment specifying which functions belong in Syscall.
448         * UnixConvert.cs: Add XattrFlags conversion functions.
449         * UnixMarshal.cs: Remove warning about self-assignment.
450
451 2005-04-16  Daniel Drake <dsd@gentoo.org>
452
453         * Syscall.cs: Add bindings for extended attribute manipulation
454
455 2005-04-05  Miguel de Icaza  <miguel@novell.com>
456
457         * Syscall.cs: Set entry point for sys_syslog to be syslog.
458         Include the syslog.h header in the generated map so that we
459         actually do the mapping.
460
461 2005-03-28  Jonathan Pryor <jonpryor@vt.edu>
462
463         * UnixConvert.cs: Add ToFopenMode() methods, which convert FileMode/FileAccess
464           into an fopen(3) mode string.  ToOpenFlags() should throw
465           ArgumentOutOfRangeException for argument violations.
466         * StdioFileStream.cs: Add constructor overloads accepting filename and
467           FileMode/FileAccess overloads; Compatibility fixes with regression tests;
468           remove IDisposable implementation since System.IO.Stream already
469           implements it (which calls Close() for us).
470
471 2005-03-17  Jonathan Pryor <jonpryor@vt.edu>
472
473         * Stdlib.cs: Move Errno-related functionality into Stdlib from Syscall,
474           since (1) errno is part of C89, and (2) StdioFileStream will need it, and
475           StdioFileStream shouldn't use Syscall.  Add [UnmanagedFunctionPointer]
476                 attribute to SignalHandler for .NET 2.0 (since signal handlers use C
477                 calling convention, not Stdcall).
478         * Syscall.cs: Move Errno-related functionality into Stdlib.
479         * UnixMarshal.cs: Use ERANGE not EPERM when figuring out appropriate
480           translator, since ERANGE is part of C99 and EPERM isn't.  Use Stdlib
481           instead of Syscall for Errno-related functionality.
482
483 2005-02-02  Jonathan Pryor <jonpryor@vt.edu>
484
485         * UnixFile.cs: Cope with changes in UnixStream.
486         * UnixStream.cs: Change FileDescriptor property to Handle for consistency.
487         * StdioFileStream.cs: Change FileStream property to Handle for consistency.
488
489 2005-02-02  Jonathan Pryor <jonpryor@vt.edu>
490
491         * Syscall.cs: Remove public sys_ methods.  Some were public by mistake, and
492           others so that users could manually marshal strings if desired.  Manually
493           marshaling strings shouldn't be necessary, though, so remove them too.
494
495 2005-02-02  Jonathan Pryor <jonpryor@vt.edu>
496
497         * StdioFileStream.cs: Fix Length property to actually return the size of the
498           file, not the # of bytes from the current position to EOF.  Oops.
499
500 2005-01-31  Jonathan Pryor <jonpryor@vt.edu>
501
502         * Stdlib.cs: Import "msvcrt", not "libc".  These members are part of the
503           ANSI C standard, and thus should be present on Windows via msvcrt.dll
504           (except snprintf, until they catch up to C99).  Change the calling
505           convention of all functions to Cdecl, as the .NET default is Stdcall.
506           Changing the calling convention isn't needed in Syscall, as it can only be
507           run on Unix platforms anyway, where the default is Cdecl.
508         * Syscall.cs: Add LIBC member that points to the real "libc"; we can't use
509           the imported definition from Stdlib as "msvcrt" doesn't exist on Unix.
510
511 2005-01-29  Jonathan Pryor <jonpryor@vt.edu>
512
513         * Stdlib.cs: sys_* functions shouldn't be public.
514
515 2005-01-13  Jonathan Pryor <jonpryor@vt.edu>
516
517         * make-map.cs: libMonoPosixHelper exports Mono_Posix prefixes, not Mono_Unix
518           prefixes, so change the type and namespace to generate compatible code.
519         * Syscall.cs: Change OpenFlags values so they match the Linux values.
520
521 2005-01-13  Jonathan Pryor <jonpryor@vt.edu>
522
523         * Stdlib.cs: Use Stdlib.LIBC instead of "libc".
524         * StdioFileStream.cs: Add FilePosition property (not that I expect anyone to
525           use it) and Rewind() method.
526
527 2005-01-05  Jonathan Pryor <jonpryor@vt.edu>
528
529         * StdioFileStream.cs: Added; System.IO.Stream wrapper for C FILE struct.
530         * Stdlib.cs: Correct visibility of ftell().
531
532 2005-01-05  Jonathan Pryor <jonpryor@vt.edu>
533
534         * Stdlib.cs: Re-order declarations to match the order used in the 
535           C99 Standard Annex B; Complete <stdio.h> exports (except for those not
536           worth supporting); Add non-"unsafe" versions of fread(3), fwrite(3) and
537           add some rudimentary buffer-overflow checking; Add <stdlib.h> exports such
538           as getenv(3), exit(3), rand(3), EXIT_SUCCESS, RAND_MAX, etc.
539
540 2005-01-03  Jonathan Pryor <jonpryor@vt.edu>
541
542         * Syscall.cs: Update endfsent() and setfsent() declarations, as these must
543           now be implemented in MonoPosixHelper.
544
545 2005-01-01  Jonathan Pryor <jonpryor@vt.edu>
546
547         * Stdlib.cs, Syscall.cs: Minimize duplicate declarations of
548           "MonoPosixHelper" for use in DllImport statements.
549
550 2005-01-01  Jonathan Pryor <jonpryor@vt.edu>
551
552         * Stdlib.cs: Don't use C# v2 features; fixes build under CSC.EXE.
553
554 2004-12-30  Jonathan Pryor <jonpryor@vt.edu>
555
556         * Stdlib.cs: On miguel's suggestion, rename Sighandler_t to SignalHandler.
557
558 2004-12-30  Jonathan Pryor <jonpryor@vt.edu>
559
560         * Stdlib.cs: Implement all C89 <stdio.h> functions except for the scanf(3)
561           family.  These are too dangerous to expose.
562
563 2004-12-30  Jonathan Pryor <jonpryor@vt.edu>
564
565         * CdeclFunctions.cs: Remove warning about unused variable.
566         * Stdlib.cs: Make signal(2) sane and (hopefully) complete.
567         * Syscall.cs: Fix cuserid Obsolete message to reference correct class name.
568         * UnixProcess.cs: Remove warning about unused variable.
569         * UnixMarshal.cs: Remove warnings about unused variables.
570
571 2004-12-29  Jonathan Pryor <jonpryor@vt.edu>
572
573         * UnixPath.cs: Add ReadSymbolicLink(), which takes an intelligent approach
574           to reading symlinks (since their contents may be any size, we grow the
575           buffer dynamically to fit them all, instead of assuming a maximum size).
576         * UnixSymbolicLinkInfo.cs: Remove MaxContentsSize.
577
578 2004-12-29  Jonathan Pryor <jonpryor@vt.edu>
579
580         * UnixPath.cs: Add check for when symlink points to a full path name.
581
582 2004-12-29  Jonathan Pryor <jonpryor@vt.edu>
583
584         * Syscall.cs: Fix Object.Equals implementations.
585         * UnixPath.cs: New & improved, with Testing!  GetRealPath() is changed so
586           that it doesn't walk the entire path looking for symlinks, it just reads 
587           the leaf.  GetCompletRealPath() walks the entire path resolving symlinks.
588           GetCanonicalPath() added, which "cleans up" a path (removing extraneous
589           "." and ".." entries).
590         * UnixSymbolicLinkInfo.cs: Rename ContentsLength -> MaxContentsSize.
591
592 2004-12-28  Jonathan Pryor <jonpryor@vt.edu>
593
594         * UnixFileSystemInfo.cs: Add a link(2) wrapper, CreateLink().  Strictly
595           speaking it's only "safe" to do this on files, but an exception will be 
596           returned if the user tries to hard link directories (because of EPERM), 
597           unless the user is root, in which case it should be allowed anyway...
598
599 2004-12-28  Jonathan Pryor <jonpryor@vt.edu>
600
601         * CdeclFunctions.cs: Correct the comments for AMD64
602         * UnixDirectoryInfo.cs: override Name; add Parent & Root properties; 
603           Correct Path usage (s/Path/FullPath/g).
604         * UnixDriveInfo.cs: Added.  Based on .NET 2.0 System.IO.DriveInfo docs,
605           provides statvfs(2) and getfsfile(3) information about a mounted volume.
606           GetDrives() wraps getfsent(3), thus parsing /etc/fstab.
607         * UnixFile.cs: Use UnixConver.ToOpenFlags, deleting the local version.
608         * UnixFileInfo.cs: Use UnixConver.ToOpenFlags, deleting the local version;
609           override Name; add DirectoryName and Directory properties; 
610         * UnixFileSystemInfo.cs: Make more .NET-like, using FullPath and
611           OriginalPath protected members, abstract Name property; Add
612           CreateSymbolicLink; Remove ReadLink (it's now 
613           UnixSymbolicLinkInfo.Contents); Use lstat(2) for Create(string), so we
614           properly detect Symbolic Links.
615         * UnixPath.cs: Added; Path manipulation utility functions.
616         * UnixSymbolicLinkInfo.cs: 
617           - Seal the class; 
618           - override new abstract member Name; 
619           - rename ReadLink to ContentsPath (and Contents) properties 
620             (why "Contents"?  Because readlink(2) says "readlink places the 
621             contents of the symbolic link in the buffer...")
622           - Add CreateSymbolicLinkTo(), which creates a symlink to the specified
623             "normal" file
624
625 2004-12-28  Jonathan Pryor <jonpryor@vt.edu>
626
627         * Stdlib.cs: Add syslog(3) to XPrintfFunctions; Add additional printf(3) 
628           and fprintf(3) overload which properly escape the format string 
629           (by using "%s" as the format for the user-supplied message).
630         * Syscall.cs: Add #regions for enummerations, structures, classes; Wrap
631           syslog(3) and related enumerations; fix operator!= on Dirent, Group; 
632           wrap {f}statvfs(2); wrap <fstab.h> entries (getfsent(3), etc.).
633         * UnixConvert.cs: Add Syslog-releated enumeration translation functions;
634           Move ToOpenFlags here from UnixFile and UnixFileInfo.
635         * UnixMarshal.cs: Missing P/Invoke methods throw
636           EntryPointNotFoundException, not MissingMethodException; add
637           EscapeFormatString, which escapes printf-style format strings so that they
638           can be safely handed off to native code (avoiding stack overflow, etc);
639           make CreateExceptionForError internal.
640
641 2004-12-15  Jonathan Pryor <jonpryor@vt.edu>
642
643         * Stdlib.cs: Add more <stdio.h> wrappers, such as fread(3) and fwrite(3).
644           These will be useful in implementing System.IO.Stream subclass for
645           reading/writing to a FILE*.  Fix a typo in the realloc(3) DllImport.
646         * Syscall.cs: Fix the sys_kill and sys_crypt declarations.
647         * CdeclFunction.cs: Document calling convention problems on AMD64.
648
649 2004-11-18  Jonathan Pryor <jonpryor@vt.edu>
650
651         * CdeclFunction.cs: Added.
652         * Stdlib.cs: Re-add printf(3) and fprintf(3).  They may not be portable (the
653           jury is still out on that; the AMD64 SysV ABI looks like it should be
654           portable to AMD64 to my eyes), but they will work on *some* platforms, so
655           we should permit it.  The new implementation takes a page out of
656           cocoa-sharp: use System.Reflection.Emit to generate a P/Invoke method at
657           runtime to invoke printf(3) or fprintf(3).  This way, we can export a
658           params signature to C# code, permitting natural usage such as:
659               Stdlib.printf ("Hello, %s world! (%i)\n", "silly", 42);
660         * Syscall.cs: Mark which headers are complete, which functions still need
661           wrapping (for headers which have anything done to them), add #region
662           blocks for each header;
663           export mkfifo(3), fexecve(), getppid(2), setlogin(); fix sleep(3) export.
664         * UnixEnvironment.cs: Export a friendly getppid(2) wrapper.
665           GetParentProcessId isn't in UnixProcess as there's no way (that I know of)
666           to get the Parent's Parent, so it can't be a class member, and exposing it
667           as a static member of UnixProcess doesn't make sense to me, as it isn't
668           general.  Added GetUserShells().
669         * UnixProcess.cs: Change constructor to internal, so it can be used from
670           UnixEnvironment.
671
672 2004-11-16  Jonathan Pryor <jonpryor@vt.edu>
673
674         * Stdlib.cs: Remove printf(3) and fprintf(3).  These are vararg/CDECL 
675           functions, and it's not portable to call them in this manner.
676           (It's not portable because some architectures, such as AMD64, use a
677           "cookie" as part of the vararg calling sequence to help reduce buffer
678           overflow exploits.  Trying to call vararg functions as if they were an
679           overloaded function will not properly set this hardware cookie, resulting
680           in a hardware exception.  Talk to lupus for more information.)
681
682 2004-11-16  Jonathan Pryor <jonpryor@vt.edu>
683
684         * Syscall.cs, UnixConvert.cs: Remove mount- and umount-related
685           functionality.  Mount/umount is inherently non-portable (see the C code
686           for mount/umount), and trying to provide a consistent interface is
687           impossible.  If you need mount/umount support, use the command-line
688           programs mount(1) and umount(1).
689
690 2004-11-16  Jonathan Pryor <jonpryor@vt.edu>
691
692         + Lots o' Renames, as the namespace changed.
693         * PosixConvert.cs: Moved to UnixConvert.cs:
694         * PosixDirectory.cs: Moved to UnixDirectory.cs:
695         * PosixEnvironment.cs: Moved to UnixEnvironment.cs:
696         * PosixDirectoryInfo.cs: Moved to UnixDirectoryInfo.cs:
697         * PosixFile.cs: Moved to UnixFile.cs:
698         * PosixFileInfo.cs: Moved to UnixFileInfo.cs:
699         * PosixFileSystemInfo.cs: Moved to UnixFileSystemInfo.cs:
700         * PosixGroup.cs: Moved to UnixGroup.cs:
701         * PosixGroupInfo.cs: Moved to UnixGroupInfo.cs:
702         * PosixIOException.cs: Moved to UnixIOException.cs:
703         * PosixMarshal.cs: Moved to UnixMarshal.cs:
704         * PosixProcess.cs: Moved to UnixProcess.cs:
705         * PosixStream.cs: Moved to UnixStream.cs:
706         * PosixSymbolicLinkInfo.cs: Moved to UnixSymbolicLinkInfo.cs:
707         * PosixUser.cs: Moved to UnixUser.cs:
708         * PosixUserInfo.cs: Moved to UnixUserInfo.cs:
709         * Catalog.cs, IncludeAttribute.cs, MapAttribute.cs, PeerCred.cs, Stdlib.cs,
710           Syscall.cs, UnixConvert.cs, UnixDirectory.cs, UnixDirectoryInfo.cs,
711           UnixEndPoint.cs, UnixEnvironment.cs, UnixFile.cs, UnixFileInfo.cs,
712           UnixFileSystemInfo.cs, UnixGroup.cs, UnixGroupInfo.cs, UnixIOException.cs,
713           UnixMarshal.cs, UnixProcess.cs, UnixStream.cs, UnixSymbolicLinkInfo.cs,
714           UnixUser.cs, UnixUserInfo.cs: Deal with renamed classes/members.
715
716 2004-11-15  Jonathan Pryor <jonpryor@vt.edu>
717
718         * PosixUserInfo.cs: Make the PosixUserInfo(Passwd) constructor public;
719           override Object.GetHashCode and Object.Equals.
720         * PosixGroupInfo.cs: Make the PosixGroupInfo(Group) constructor public;
721           override Object.GetHashCode and Object.Equals.
722         * PosixIOException.cs: Use PosixMarshal.GetErrorDescription instead of
723           calling Syscall.strerror_r directly
724         * PosixMarshal.cs: Add GetErrorDescription.  Strerror_r() isn't portable, so
725           GetErrorDescription() first tries strerror_r(), and if it fails falls back
726           to strerror(3).
727         * Syscall.cs: 
728           - Seal the Dirent class.  It has no virtual members, so there's no point 
729       in it being non-sealed.  Override Object.GetHashCode and Object.Equals.
730           - Seal the Group class.  It has no virtual members, so there's no point 
731       in it being non-sealed.  Override Object.GetHashCode and Object.Equals.
732             Provide operator== and operator!=.
733           - Seal the Passwd class.  It has no virtual members, so there's no point 
734       in it being non-sealed.  Override Object.GetHashCode and Object.Equals.
735             Provide operator== and operator!=.
736           - Remove strerror_r() convenience overload.  This is now
737             PosixMarshal.GetErrorDescription().
738
739 2004-11-12  Jonathan Pryor <jonpryor@vt.edu>
740
741         * Syscall.cs: Export time-related functions (gettimeofday, settimeofday,
742           utime, utimes), mknod.
743
744 2004-11-07  Atsushi Enomoto  <atsushi@ximian.com>
745
746         * PosixEnvironment.cs : csc build fix. see bug #69195.
747         * PosixStream.cs : csc build fix. see bug #69196.
748
749 2004-11-05  Jonathan Pryor  <jonpryor@vt.edu>
750
751         * PosixConvert.cs: New file; conversion functions for Mono.Posix types.
752         * PosixDirectory.cs: New file; Friendly wrapper over directory information.
753         * PosixDirectoryInfo.cs: New file; Friendly wrapper over directory information.
754         * PosixEnvironment.cs: New file; Friendly wrapper over environment information.
755         * PosixFile.cs: New file; Friendly wrapper over file information.
756         * PosixFileInfo.cs: New file; Friendly wrapper over file information.
757         * PosixFileSystemInfo.cs: New file; Friendly wrapper over `stat'.
758         * PosixGroup.cs: New file; User Group-related functionality
759         * PosixGroupInfo.cs: New file; User Group-related functionality
760         * PosixIOException.cs: New file; Exception for POSIX-generated exceptions.
761         * PosixMarshal.cs: New file; utility functions for marshaling, etc.
762         * PosixProcess.cs: New file; Friendly wrapper over process information.
763         * PosixStream.cs: New file; Friendly wrapper over file descriptors.
764         * PosixSymbolicLinkInfo.cs: New file; Friendly wrapper over symbolic links.
765         * PosixUser.cs: New file; Friendly wrapper over user information.
766         * PosixUserInfo.cs: New file; Friendly wrapper over user information.
767         * Stdlib.cs: New file; C standard library exports.
768         * Syscall.cs: Effective re-write.  
769           - Organize exports by header file
770           - add additional enumerations (Error for the E* error values, etc.)
771           - always explicitly specify enumeration underlying type
772           - Use a new wrapping infrastructure so that ABI-stable types are exported
773                 - For example, size_t is exported as ulong, not IntPtr.
774           - Wrap more functions, and wrap them better (such as getpwnam).
775           - This release is NOT backward compatible.  Many names are the same, and
776             hopefully they're still compatible, but no effort was made to maintain
777             compatibility.  For example, FileMode was removed and replaced with
778             FilePermissions, to avoid a name conflict with System.IO.FileMode.
779                 - Change umount() to use MonoPosixHelper: portability fix for Mac OS X.
780         * make-map.cs: Another effective re-write, to clean up the code, produce
781           better output, and produce more output.  For example, most of
782           PosixConvert can be auto-generated, so it is (modulo version delays and
783           bootstrap issues).  `map.c' is now conditional on all macros, and has
784           error checking for invalid/unsupported values.
785
786 2004-09-18  Jackson Harper  <jackson@ximian.com>
787
788         * Syscall.cs: Add support for poll ().
789
790 2004-09-18  Jackson Harper  <jackson@ximian.com>
791
792         * make-map.cs: Use field value not name for #defines.
793                 
794 2004-09-14  Loren Bandiera <lorenb@mmgsecurity.com>
795
796         * Syscall.cs: Added method for getpwnam which uses Passwd
797         struct.
798         * macros.c: Helper function for getpwnam
799         (In committing, Josh Tauberer also added getpwuid.)
800
801 2004-07-09  Dick Porter  <dick@ximian.com>
802
803         * PeerCred.cs: Get the unix socket peer credentials.
804
805 2004-05-26  Miguel de Icaza  <miguel@ximian.com>
806
807         * Syscall.cs: Do not let the runtime handle strings, as we do not
808         own those strings, we must transform the char * into a string
809         ourselves. 
810
811 2004-05-03  Miguel de Icaza  <miguel@ximian.com>
812
813         * Syscall.cs: Add symlink
814
815 2004-04-19  Miguel de Icaza  <miguel@ximian.com>
816
817         * Syscall.cs: Use hex values for FileMode, since C# does not have
818         an octal integer mode.
819
820 2004-03-30  Joshua Tauberer <tauberer@for.net>
821
822         * Added readlink, strerror, opendir, readdir, closedir
823         * Added Mono.Posix.Stat.UnixToDateTime(long unixtime) --> DateTime
824
825 2004-03-11  Joshua Tauberer <tauberer@for.net>
826
827         * Syscall.cs: Removed argument to getgid that shouldn't be there.
828                 Added getusername, getgroupname which wrap getpwuid, getgrgid
829                 without dealing with pointers to structures.
830                 Removed duplicate FileMode enum nested in Syscall class.
831                 Added stat and lstat, which use StatMode enumeration
832                 (like FileMode but nicer and complete) and Stat struct.
833         * macros.c: Helper functions for getpwuid, getgrgid, stat, lstat.
834
835 2004-01-07  Gonzalo Paniagua Javier <gonzalo@ximian.com>
836
837         * Syscall.cs: moved the assembly attribute to a proper place
838         and added 'signal.h'
839         * make-map.cs: use reflection to invoke the properties, as it
840         fails under MS runtime.
841         
842
843 2004-01-05  Gonzalo Paniagua Javier <gonzalo@ximian.com>
844
845         * Syscall.cs: moved assembly attribute and added unsafe block to fix
846         the build on windows.
847
848 2003-11-11  Wojciech Polak <polak@gnu.org
849
850         * Syscall.cs: Applied patch from Wojciech Polak <polak@gnu.org> to
851         support IsAtty.
852
853 2003-05-16  Dick Porter  <dick@ximian.com>
854
855         * UnixEndPoint.cs: New property to get and set the filename, like
856         the IPEndPoint has for the IP address.  Also implement ToString().
857
858 Tue Apr 29 16:53:56 CEST 2003 Paolo Molaro <lupus@ximian.com>
859
860         * Syscall.cs: remove the unsafe mess.
861
862 2003-02-05  Gonzalo Paniagua Javier <gonzalo@ximian.com>
863
864         * Check in.
865         * UnixEndPoint.cs: first file.
866