511bba1af58ffba0aa70e45edd4494f9abfc0a70
[mono.git] / mono / io-layer / ChangeLog
1 2007-04-26  Dick Porter  <dick@ximian.com>
2
3         * shared.c (_wapi_shm_semaphores_init): Need to check
4         MONO_DISABLE_SHM in this entry point, as it's called before
5         _wapi_shm_attach().  Fixes bug 81436.
6
7 2007-04-24  Dick Porter  <dick@ximian.com>
8
9         * sockets.c (_wapi_recvfrom, socket_close): Force recvfrom() to
10         error if the socket is closed while the receive is blocking.
11         Fixes bug 75705.
12
13 2007-04-13  Dick Porter  <dick@ximian.com>
14
15         * shared.h:
16         * shared.c: Complete the reimplementation of disabling of shared
17         memory, by not allocating sysv semaphores when shm disabling has
18         been requested (either at compile time or run time.)
19
20         * processes.c (CreateProcess): Don't synchronize locking across
21         processes when forking, when shared memory has been disabled.
22
23 2007-04-06  Andreas Faerber  <andreas.faerber@web.de>
24
25         * wapi_glob.h:
26         * wapi_glob.c: remove reference to sys/cdefs.h, use glib instead.
27         Fixes: 81326
28
29 2007-04-05  Dick Porter  <dick@ximian.com>
30
31         * io.c:
32         * io-portability.c (_wapi_io_scandir): Moved from io.c, and
33         changed to use a cut-down version of glob(3) that has been
34         extended to match with case-insensitivity if needed.
35
36         * wapi_glob.h:
37         * wapi_glob.c: Cut down implementation of glob(3), based on
38         OpenBSD.
39
40 2007-03-22  Dick Porter  <dick@ximian.com>
41
42         * sockets.c (_wapi_connect): Do additional checks when connect(2)
43         fails, because some systems don't let it be restarted.  Patch
44         based on one submitted by Robert S Wojciechowski <robertw@ssgx.com>,
45         fixes bug 81010.
46
47 2007-03-09  Jonathan Chambers  <joncham@gmail.com>
48
49         * io-layer.h:  Remove UNICODE and _UNICODE defines as 
50         these are done by configure.in now.
51         
52         Code is contributed under MIT/X11 license.
53         
54 Thu Mar 8 19:42:17 CET 2007 Paolo Molaro <lupus@ximian.com>
55
56         * shared.c: partial support for MONO_DISABLE_SHM env var.
57
58 2007-03-05  Wade Berrier  <wberrier@novell.com>
59
60         * atomic.h: atomic fixes from Michael Matz for for s390 
61         and s390x ( bnc #237611 and bxc #80892 )
62
63 2007-03-05  Miguel de Icaza  <miguel@novell.com>
64
65         * io.c (CreateFile): Use FILE_ATTRIBUTE_TEMPORARY to mean 0600
66         permissions.  For 80688
67
68         (MoveFile): Use errno_copy here, just to avoid a potential
69         errno-changing code in the future from g_free. 
70         
71         Also, ignore EXDEV errors as they are handled immediately after
72         (avoid printing out an error). 
73
74         Fixes: 80655
75
76 Mon Feb 12 15:50:24 CET 2007 Paolo Molaro <lupus@ximian.com>
77
78         * shared.c: exit if semaphores can't be created (bug #80616).
79
80 2007-02-01  Geoff Norton  <gnorton@customerdna.com>
81
82         * collection.c: NetBSD doesn't define PTHREAD_STACK_MIN.
83
84 2007-01-26  Dick Porter  <dick@ximian.com>
85
86         * socket-private.h: 
87         * sockets.c (_wapi_getsockopt): Windows seems to not reset
88         SO_ERROR values when they're read, contrary to the documentation.
89         Fixes the new issues raised in bug 79878 (example in C showing
90         winsock behaviour attached to that bug.)
91
92 2007-01-15 Mark Mason <mason@broadcom.com
93
94         * atomic.h: add locking primitives for MIPS.
95         
96 2007-01-11  Dick Porter  <dick@ximian.com>
97
98         * sockets.c (_wapi_connect): Don't do the SO_BROADCAST setting
99         here, do it in managed code instead.
100         (_wapi_getsockopt): SO_RCVTIMEO and SO_SNDTIMEO use struct
101         timeval, which has a microsecond field, not milliseconds.
102         (_wapi_setsockopt): ditto.
103         (_wapi_setsockopt): Halve the SO_SNDBUF and SO_RCVBUF values on
104         Linux, as the kernel doubles whatever we set.
105         (_wapi_socket): Save socket domain, type and protocol so it can be
106         duplicated later.
107         (socket_disconnect): Implement socket disconnect (closing the
108         socket, but keeping the file descriptor.)
109         (wapi_disconnectex): A basic implementation of DisconnectEx().
110         (wapi_transmitfile): A very basic implementation of
111         TransmitFile().
112         (WSAIoctl): Implement the SIO_GET_EXTENSION_FUNCTION_POINTER
113         ioctl.
114
115         * socket-private.h (struct _WapiHandle_socket): Record socket
116         domain, type and protocol info so it can be duplicated later.
117
118         * sockets.h (WSAID_DISCONNECTEX,WSAID_TRANSMITFILE): Structures
119         and defines needed to look up the DisconnectEx() and
120         TransmitFile() functions by GUID.
121
122         * error.c (errno_to_WSA): Change ETIMEDOUT mapping to
123         WSAETIMEDOUT; add EDESTADDRREQ.
124
125         * io-layer.h: Need mswsock.h on windows now.
126
127 2007-01-04  Miguel de Icaza  <miguel@novell.com>
128
129         * io-portability.c (find_file): Fix a coverity warning (scanning
130         being unassigned).   
131
132 2006-12-31  Miguel de Icaza  <miguel@novell.com>
133
134         * io-portability.c (find_file): Do not abort if an empty filename
135         has been passed.  This fixes the case where MONO_IOMAP=all would
136         assert if Directory.Exists ("") was called.
137
138 Mon Dec 18 14:54:37 CET 2006 Paolo Molaro <lupus@ximian.com>
139
140         * processes.c: moved a free on the error path.
141
142 Thu Dec 14 21:42:39 CET 2006 Paolo Molaro <lupus@ximian.com>
143
144         * processes.c: fixed a few memory leaks when executing
145         processes.
146
147 Mon Nov 27 13:12:17 GMT 2006 Paolo Molaro <lupus@ximian.com>
148
149         * atomic.h: fix arm compare and exchange (bug #78500).
150
151 2006-11-23  Dick Porter  <dick@ximian.com>
152
153         * process-private.h (struct _WapiHandle_process): Add 'waited'
154         parameter
155
156         * processes.c (process_wait): Check the 'waited' parameter not the
157         signalled state when testing if a process has already been waited
158         for, as the child process itself may set signalled when exiting.
159         Fixes bug 79885.
160
161         * wapi-private.h (_WAPI_HANDLE_VERSION): Bump shared data version
162
163         * shared.c: Now the shared data version has been incremented we
164         can set the counter semaphore initial value correctly
165
166 2006-11-22  Dick Porter  <dick@ximian.com>
167
168         * processes.c (process_wait): Cope when the background process
169         reaper gets the process we were waiting for.  Special case for
170         waiting for our own process to exit.  Fixes bug 77736.
171
172 2006-11-17  Dick Porter  <dick@ximian.com>
173
174         * processes.c: Fix const correctness and typos that caused memory
175         corruption. 
176         
177 2006-11-17  Miguel de Icaza  <miguel@novell.com>
178
179         * processes.c (ShellExecuteEx): Check error after CreateProcess,
180         thanks to Dick for pointing this out. 
181
182 2006-11-16  Miguel de Icaza  <miguel@novell.com>
183
184         * processes.c (ShellExecuteEx): If we fail to create a process in
185         ShellExecute, then try to use the xdg-open command, and if that
186         fails, try to use the gnome-open command, 
187
188         Refactor the code so that we do not have to duplicate all this
189         code, but instead use a ucs2-aware version of the code to do
190         concatenations.
191
192 2006-11-13  Dick Porter  <dick@ximian.com>
193
194         * io.c (_wapi_stat_to_file_attributes): If the file is a symlink
195         add the FILE_ATTRIBUTE_REPARSE_POINT flag.  This is an attempt to
196         follow the specs for the windows symlink support, but will
197         probably have to be reworked when I have test data from a vista
198         machine.  Fixes bug 79887.
199
200 2006-11-11  Miguel de Icaza  <miguel@novell.com>
201
202         * handles.c (CloseHandle): Cope here with the new value
203         INVALID_HANDLE_VALUE set on handles.  
204
205         * processes.c (CreateProcess): Initialize the value of hThread to
206         be INVALID_HANDLE_VALUE on failure, not to be NULL.  Improvement
207         for #75733
208
209 2006-11-09  Dick Porter  <dick@ximian.com>
210
211         * sockets.c (_wapi_select): Do some sanity checking on the
212         fd_sets, to avoid file descriptors > FD_SETSIZE.
213         (_wapi_FD_CLR, _wapi_FD_ISSET, _wapi_FD_SET): Avoid file
214         descriptors > FD_SETSIZE.
215
216 2006-10-27  Dick Porter  <dick@ximian.com>
217
218         * io.c (GetFileAttributes): Force symlinks to directories to be
219         returned as a regular file.  Fixes bug 79733.
220
221 2006-10-18  Miguel de Icaza  <miguel@novell.com>
222
223         * io-portability.c (find_in_dir): First string dup, then closedir.
224
225 2006-10-12  Dick Porter  <dick@ximian.com>
226
227         * processes.c (_wapi_process_reap): Unref a process handle if we
228         reaped it, found by Zoltan.  Fixes bug 79286.
229         (process_wait): Don't wait again if we've already waited for a
230         process.
231
232 2006-10-11  Sergey Tikhonov <tsv@solvo.ru>
233
234         * atomic.h: Fix atomic decrement.
235
236         * mini/cpu-alpha.md: Use native long shift insts
237
238         * mono/mono/mini/tramp-alpha.c: Implemented
239         mono_arch_patch_delegate_trampoline method
240
241         * Started work on using global registers
242         
243         * Use byte/word memory load/store insts if cpu supports it
244         
245         * Code clean up
246
247         
248 2006-10-09  Zoltan Varga  <vargaz@gmail.com>
249
250         * handles.c (timedwait_signal_poll_cond): Add an alertable parameter, and if it
251         is FALSE, avoid busy waiting.
252
253         * wait.c: Add an alertable parameter to the wait routines.
254
255 2006-10-06  Miguel de Icaza  <miguel@novell.com>
256
257         * io-portability.c (find_file): Rename from
258         MONO_IO_PORTABILITY_HELP to MONO_IOMAP.
259
260 2006-10-03  Dick Porter  <dick@ximian.com>
261
262         * io-portability.h: 
263         * io-portability.c: Optional portability helpers and wrapped
264         system calls to try to cope with windows filenames in
265         applications.
266
267         * io.c: Use the wrapped system calls
268
269 2006-09-01  Zoltan Varga  <vargaz@gmail.com>
270
271         * critical-sections.h critical-sections.c: Make Enter/LeaveCriticalSection a macro
272         since they are perf critical.
273
274         * atomic.h: Applied patch from Jakub Boqusz <qboosh@pld-linux.org>.
275         Add atomic ops implementation for alpha.
276
277 2006-08-11  Dick Porter  <dick@ximian.com>
278
279         * processes.c (_wapi_process_reap): Avoid a deadlock by setting
280         process termination details in an outer loop, not the
281         _wapi_search_handle() one.
282
283 2006-08-10  Dick Porter  <dick@ximian.com>
284
285         * threads.c (_wapi_thread_queue_apc)
286         (_wapi_thread_dispatch_apc_queue): Use a process-local mutex here
287         instead of the cross process semaphore.  We already check that
288         access to the APC queue is within the owning process so there's no
289         need to protect from other processes.  Avoids a global deadlock
290         when a thread is aborted while it holds the handle semaphore
291         locked.
292         (_wapi_thread_apc_pending): Hide an annoying message which can
293         happen if a thread handle has been blown away at process shutdown
294         while it is in an alertable wait.
295
296         Both problems seen while shutting down monodevelop.
297
298 2006-07-25  Dick Porter  <dick@ximian.com>
299
300         * shared.c (_wapi_shm_file): Remove '/' characters from the uname
301         results.  Fixes bug 78917.
302
303 2006-07-20  Dick Porter  <dick@ximian.com>
304
305         * threads.c (_wapi_thread_set_termination_details): Improve the
306         test for already-disposed thread handles, and hold the lock around
307         the mutex abandoning.
308
309 2006-07-17  Dick Porter  <dick@ximian.com>
310
311         * processes.c (CreateProcess): Don't change directory unless a new
312         one has been specified.  Fixes bug 78751.
313
314 2006-07-06  Dick Porter  <dick@ximian.com>
315
316         * io.c (_wapi_stat_to_file_attributes): Do a better job at
317         figuring out the file attributes
318         (_wapi_set_last_path_error_from_errno): New helper function to
319         turn errno into w32 error codes that handles the differences
320         between file and directory errors
321         (file_setendoffile): Try turning off the extra write used to
322         extend files, because we probably don't need it on any modern
323         platform.  If it is needed though, we also need to lseek the file
324         position back again
325         (CreateFile): Treat character-special devices as a console handle,
326         because they can't be seeked
327         (CopyFile): If fail_if_exists is set, then the destination needs
328         to be opened with O_EXCL
329         (CopyFile): If fail_if_exists is not set and the destination
330         already exists, then we should set the ERROR_ALREADY_EXISTS error
331         even though we return success
332         (stdhandle_create): STD_INPUT_HANDLES cannot be written to
333         (GetStdHandle): Rework without using mono_once, so console handles
334         can be properly closed and reopened.
335         (mono_io_scandir): Only override errno with EACCES when the
336         directory actually exists
337         (FindFirstFile): Set ERROR_FILE_NOT_FOUND when no files are
338         returned
339         (FindClose): Cope with NULL handles
340         (CreateDirectory): When the target already exists, just return an
341         error.  It's the caller's job to figure out what to do.
342         (SetCurrentDirectory): Cope with a NULL path
343         (RemoveDirectory, GetFileAttributes, GetFileAttributesEx,
344         SetFileAttributes, FindFirstFile, DeleteFile, MoveFile, CopyFile,
345         CreateFile): Set path error correctly
346
347         * handles.c (CloseHandle): Kludge to try and cope with passing a
348         NULL handle
349
350         * error.h: Add NO_ERROR as an alternative to ERROR_SUCCESS
351
352         * uglify.h: Added some more typedefs
353
354 2006-07-05  Dick Porter  <dick@ximian.com>
355
356         * io.c (GetFileAttributes, GetFileAttributesEx): Cope with
357         dangling symlinks.  Fixes bug 78664.
358
359 2006-06-23  Dick Porter  <dick@ximian.com>
360
361         * handles.c (handle_cleanup): 
362         * threads.c: Clean up threads properly when we're forcibly
363         removing the handle entries from the shared file in
364         handle_cleanup().  Fixes bug 78241, for real this time.
365
366 2006-06-15 Neale Ferguson <neale@sinenomine.net>
367
368         * atomic.h: More tinkering with InterlockedExchange/InterlockedCompareExchange
369         for s390/s390x.
370
371 2006-06-14 Neale Ferguson <neale@sinenomine.net>
372
373         * atomic.h: Fix atomic exchange pointer operations for s390x - these
374         were broken as they used 32-bit instructions rather than their 64-bit
375         versions.
376
377 2006-06-14  Dick Porter  <dick@ximian.com>
378
379         * processes.c: Don't run the atexit handlers when bailing out
380         of a fork/exec.
381
382 2006-06-14  Dick Porter  <dick@ximian.com>
383
384         * wait.c: Fix stupid typo shown up by gcc 4.1.1, = not ==
385
386         * handles-private.h: 
387         * shared.c: 
388         * io.c: 
389         * processes.c: 
390         * mono-spinlock.h: 
391         * handles.c: 
392         * collection.c: Fix a bunch of signed/unsigned warnings from gcc
393         4.1.1
394
395 2006-06-09 Neale Ferguson <neale@sinenomine.net>
396
397         * atomic.h: Fix atomic operations for s390x (not really broken 
398         but changed to use full 64-bit opcodes).
399
400 2006-05-24  Dick Porter  <dick@ximian.com>
401
402         * processes.c (process_set_current): Don't take an extra reference
403         if we have to create our own process handle.  Fixes bug 78241
404         again.
405
406         * threads.c (_wapi_thread_signal_self): Renamed from
407         _wapi_thread_abandon_mutexes, also sets the thread state to
408         signalled and drops a reference.  Called by the runtime when the
409         main thread cleans itself up.
410
411         * handles.c (handle_cleanup): As a last resort, unref every shared
412         handle as the process is now exiting.
413
414 2006-05-16  Dick Porter  <dick@ximian.com>
415
416         * processes.c (process_set_termination_details): Unref the handle
417         when we've stored the exit details.  Fixes the rest of 78241.
418
419 2006-05-12  Dick Porter  <dick@ximian.com>
420
421         * threads.c: Implement pseudo handles, making GetCurrentThread()
422         match MS behaviour.  Notice when attached threads exit, and unref
423         the handle.  Fix usage of GetCurrentThread() in other places.
424
425         * handles.c (DuplicateHandle): Implement a basic form of
426         DuplicateHandle().
427
428         * wait.c: Fix usage of GetCurrentThread() throughout, and cope
429         with pseudo handles.
430
431 2006-04-26  Miguel de Icaza  <miguel@novell.com>
432
433         * io.c (file_close): Oops, do not use DeleteFile which expects
434         unicode, instead use unlink directly
435
436         Add support for the new FileOptions bits on .NET 2.0.
437
438         It might be good if Dick reviews these changes.
439         
440         * io.c (file_close): If DeleteOnClose is set, then delete the file
441         before freeing it.
442         (CreateFile): Do not support encryption per user. 
443         
444         If posix_fadvise exists, pass hints on sequential scan and random
445         access.   Did not figure out what WRITE_THROUGH maps to.
446
447 2006-04-26  Dick Porter  <dick@ximian.com>
448
449         * sockets.c (WSAIoctl): Check the output buffer is valid before
450         writing to it.
451
452         * handles.c (_wapi_search_handle): Set shared pointer if we find a
453         shared handle that has been already opened.
454
455 2006-04-21  Dick Porter  <dick@ximian.com>
456
457         * threads.c (GetCurrentThread): Reference the handle if we return
458         an already-known thread.
459
460 2006-04-07  Dick Porter  <dick@ximian.com>
461
462         * processes.c: Fix build for older glib.
463
464 2006-04-06  Dick Porter  <dick@ximian.com>
465         
466         * processes.c (CreateProcess): Add a reference to the child
467         process' handle, so it won't be destroyed if this process closes
468         its copy of the handle.  Fixes bug 77393.
469         
470         * processes.c (process_set_current): Fall through to creating a
471         new one if the handle lookup fails.
472
473         * processes.c (_wapi_process_signal_self):
474         * handles.c (handle_cleanup): The process is exiting, so set the
475         handle state for this process to signalled.  This should let other
476         non-related processes wait for this handle.
477         
478         * handles.c (_wapi_search_handle): Don't search shared handles in
479         all cases.
480
481         * collection.c (collection_thread): No need to do a collection
482         scan straight away, do the waiting first.
483
484 2006-04-06  Dick Porter  <dick@ximian.com>
485
486         * shared.c: Fix parameters in semctl () call.
487
488 2006-03-28  Zoltan Varga  <vargaz@gmail.com>
489
490         * atomic.h atomic.c: Applied patch from David S. Miller 
491         <davem@davemloft.net>: Reimplement Interlocked* primitives on sparc 
492         using CAS/CASx when __GNUC__, else we will fall back to the generic 
493         pthread version.
494
495 2006-03-27  Dick Porter  <dick@ximian.com>
496
497         * shared.c (_wapi_shm_file_open): Break out of a loop if the
498         shared file is smaller than expected.  (We loop a few times in
499         case another process is in the middle of creating the file.)
500
501 2006-03-22  Dick Porter  <dick@ximian.com>
502
503         * handles.c:
504         * wapi-private.h:
505         * shared.h:
506         * shared.c: Delete the semaphores and shared files when the last
507         process has finished with them
508
509 2006-03-15  Dick Porter  <dick@ximian.com>
510
511         * events.c: 
512         * io.c: 
513         * mutexes.c: 
514         * processes.c: 
515         * semaphores.c: 
516         * sockets.c: 
517         * threads.c: Explicitly initialise the handle ops struct
518
519 2006-03-14  Dick Porter  <dick@ximian.com>
520
521         * handles-private.h: 
522         * wapi-private.h: 
523         * wait.c: 
524         * handles.c: Add a 'prewait' stage to the handle waiting, to give
525         waiting threads a chance to check for bogus states before
526         blocking.
527
528         * mutexes.c (namedmutex_prewait): Use the prewait stage to check
529         for named mutexes that have been abandoned in a locked state (eg
530         if a process exited abnormally while owning the mutex) and
531         override it if needed.
532
533 2006-03-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
534
535         * wait.c: speed up WaitFor* when the timeout is 0.
536
537 2006-03-03  Dick Porter  <dick@ximian.com>
538
539         * processes.c (ShellExecuteEx): Cope when some of the parameters
540         are NULL.
541
542 2006-02-27  Dick Porter  <dick@ximian.com>
543
544         * mutexes.c: 
545         * mono-mutex.c: 
546         * threads.c: Comparing pthread_t with == is not portable, so use
547         pthread_equal().
548
549 Thu Feb 23 18:47:20 GMT 2006 Paolo Molaro <lupus@ximian.com>
550
551         * *.h, *.h: patch from Dick to make Linuxthreads systems work again.
552
553 2006-02-22  Dick Porter  <dick@ximian.com>
554
555         * thread-private.h: 
556         * threads.c: There's no need to use the timed-thread support code
557         any more, as we aren't using the timed join.  This greatly
558         simplifies thread setup, and fixes a memory leak (bug 77521).
559
560         Don't bother to store thread IDs in a hash table, use TLS instead.
561         The one case that needs to look up the handle of a different
562         thread (OpenThread()) can do the extra work itself.  Fixes bug
563         77536.
564
565         * handles.c (_wapi_search_handle): Add a reference when returning
566         a private handle (shared handles are already reffed.)
567         
568 2006-02-17  Dick Porter  <dick@ximian.com>
569
570         * handles-private.h: 
571         * handles.c: Check handle values passed to array lookups.  Fixes
572         bug 77572.
573
574 2006-02-09  Dick Porter  <dick@ximian.com>
575
576         * threads.c: Cope with the problems caused by attaching already
577         existing threads - they don't get the infrastructure to clean up
578         after themselves, especially the ID to handle hash.  This fixes
579         bug 77468.
580
581 2006-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
582
583         * shared.c: use MONO_SHARED_HOSTNAME as a substitute for gethostname()
584         when creating the shared files in the .wapi directory. Fixes bug #77371.
585
586 2006-02-02  Martin Baulig  <martin@ximian.com>
587
588         * threads.c: Removed the `WITH_INCLUDED_LIBGC' section; it has
589         never been used so far. 
590
591         * timed-thread.h (TimedThread): Removed the `stack_ptr' field; it
592         has only been used by the removed code.
593
594 2006-01-03  Neale Ferguson <neale@sinenomine.net>
595
596         * atomic.h: Correct s390x definitions and eliminate compiler warnings.
597
598 2006-01-03  Sebastien Pouliot  <sebastien@ximian.com>
599
600         * io.c: Patch _wapi_stat_to_file_attributes against bug #76966, where
601         sockets could be considered as directory.
602
603 2005-12-23  Dick Porter  <dick@ximian.com>
604
605
606         * semaphores.h: 
607         * semaphores.c: Implement OpenSemaphore
608
609         * mutexes.c: 
610         * mutexes.h: Implement OpenMutex
611
612         * wapi-private.h: 
613         * handles.c: 
614         * events.c: 
615         * events.h: 
616         * event-private.h: Implement named events.  Implement OpenEvent.
617
618 2005-12-15  Dick Porter  <dick@ximian.com>
619
620         * processes.c (CreateProcess): The pipe-based cross-process
621         exclusion technique was trying to write NULL buffers when appname
622         was NULL (eg when coming from ShellExecuteEx,) which usually
623         succeeded even though EFAULT was returned - but sometimes it
624         failed.  This meant that the child process could block forever on
625         the pipe read.  Replace it with the simpler shared handle
626         semaphore protection used everywhere else.  This showed up with
627         the test case in bug 76684.
628
629 Tue Dec 13 11:41:49 GMT 2005 Paolo Molaro <lupus@ximian.com>
630
631         * shared.c: fallback to private mmap when shared mmap doesn't work
632         (like on jffs).
633
634 2005-12-06  Dick Porter  <dick@ximian.com>
635
636         * wapi-private.h: 
637         * handles.c: 
638         * semaphore-private.h: 
639         * semaphores.c: Implement named semaphores
640
641 2005-11-24  Dick Porter  <dick@ximian.com>
642
643         * processes.c (GetProcessId): Implement GetProcessId()
644
645 2005-11-17  Dick Porter  <dick@ximian.com>
646
647         * processes.h: 
648         * processes.c: Implement ShellExecuteEx as a wrapper around
649         CreateProcess.
650
651 2005-11-11  Dick Porter  <dick@ximian.com>
652
653         * threads.c: Give mutex abandoning its own exported function, so
654         it can be called when the runtime is cleaning up.
655
656         * handles.c (_wapi_search_handle_namespace): Do a handle
657         collection befre starting to check namespace strings, so that any
658         stale cruft gets removed.
659
660 2005-11-11  Dick Porter  <dick@ximian.com>
661
662         * threads.c: Move thread handles back into the shared space.
663
664         * handles.c (_wapi_handle_unref): Add support for shared handles
665         with close() handlers
666
667 2005-11-04  Dick Porter  <dick@ximian.com>
668
669         * sockets.c (ioctlsocket): Use select instead of if to avoid a
670         type promotion problem on 64bit freebsd.  Based on patch by Lou
671         Kamenov <kamenovl@gmail.com>, fixes bug 76447.
672
673 2005-11-04  Dick Porter  <dick@ximian.com>
674
675         * io.c (file_write): Only do the file locking if
676         MONO_STRICT_IO_EMULATION is set.
677
678 2005-10-21  Dick Porter  <dick@ximian.com>
679
680         * processes.c: 
681         * handles.c (_wapi_lookup_handle): Cope when the shared part of a
682         handle has been deleted.
683         (_wapi_handle_unref): And when the deleted shared part is pointed
684         to as a handle is deleted
685
686 2005-10-20  Dick Porter  <dick@ximian.com>
687
688         * processes.c (process_set_current): If the expected process
689         handle slot doesn't contain the correct pid, create a new handle.
690
691         * handles.c (_wapi_search_handle): When the search doesn't find
692         anything, return failure instead of the last handle we looked at.
693         (_wapi_handle_ref, _wapi_handle_unref): Don't try to ref or unref
694         unused handles (makes tracking refcounting bugs easier.)
695
696 2005-10-19  Dick Porter  <dick@ximian.com>
697
698         * handles.c:
699         * handles-private.h:
700         * wapi-private.h: 
701         * processes.c: 
702         * mutexes.c:
703         * collection.c (_wapi_handle_collect): Remove the shared handle
704         indirection layer, and use locking instead.  Delete other
705         complexity that is no longer needed.  Refcount shared handles and
706         delete them when needed, but keep the timestamps so that orphaned
707         handles will be cleaned up eventually.
708
709         * shared.c (_wapi_shm_file): Add processor, OS and struct size
710         info to the shared file names, to cope with dual-boot and 32/64bit
711         size issues.  Fixes bug 75839.
712
713         * wait.c (WaitForMultipleObjectsEx): No need to distinguish
714         between shared handles and private, as the wait functions cope
715         with both together now.
716
717 2005-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
718
719         * io.c: removed NO_SIGPIPE macro.
720         * sockets.c: no need for MSG_NOSIGNAL or ignoring SIGPIPE.
721
722 2005-10-11  Dick Porter  <dick@ximian.com>
723
724         * sockets.c (_wapi_getsockopt): Translate SO_ERROR results into
725         w32 error codes.
726
727         * error.c (errno_to_WSA): Don't return a bogus error if someone
728         asks to translate errno 0.
729
730 2005-10-11  Dick Porter  <dick@ximian.com>
731
732         * handles.c: Fix several race conditions
733
734 2005-10-11 Miguel de Icaza <miguel@novell.com>
735
736         * io.c: no need to block SIGPIPE anymore, as it is ignored.
737
738 2005-10-05  Dick Porter  <dick@ximian.com>
739
740         * threads.c (_wapi_thread_own_mutex, _wapi_thread_disown_mutex):
741         Keep a reference to mutexes owned by threads, so they won't be
742         destroyed prematurely.  Fixes dotmsnclient crash.
743
744 2005-09-26  Sebastien Pouliot  <sebastien@ximian.com>
745
746         * io.c: Apply patch from #76192 (Can't write files past 2gb on AMD64 
747         (x86_64)) for Brion on IRC (Dick approved it).
748
749 2005-09-23  Dick Porter  <dick@ximian.com>
750
751         * processes.c: Don't wait for processes that have already been
752         signalled; also fix typo.
753
754         * handles.c: Improve locking inside new handle and handle
755         searching functions.
756
757 2005-09-20  Dick Porter  <dick@ximian.com>
758
759         * collection.c: 
760         * processes.c: Periodically waitpid for known process IDs.  Fixes
761         bug 74870.
762
763 2005-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
764
765         * io.c:
766         (CreateFile): if the file is a named pipe, treat the handle as a pipe,
767         not as a file. Fixes bug #76075.
768
769 2005-08-27  Zoltan Varga  <vargaz@gmail.com>
770
771         * atomic.h: Add support for intel icc.
772
773 2005-08-25  Zoltan Varga  <vargaz@gmail.com>
774
775         * io-layer.h: Include winbase.h not WinBase.h.
776
777 2005-08-19  Dick Porter  <dick@ximian.com>
778
779         * threads.c, threads.h, thread-private.h: Use a gsize to store the
780         thread ID, so it can hold a 64 bit value if needed.
781
782 2005-07-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
783
784         * error.c: map ENOENT to WSAECONNREFUSED. It might happen when
785         connecting to unix sockets. Closes bug #75632.
786
787 2005-07-05  Dick Porter  <dick@ximian.com>
788
789         * io.c: Make sure SIGPIPE is ignored when calling write(2).
790         Prevents the runtime exiting when writing to a closed pipe,
791         fixing bug 75468.
792
793 2005-06-30  Dick Porter  <dick@ximian.com>
794
795         * shared.c (_wapi_shm_semaphores_init): Add some helpful error
796         messages when semget () fails due to lack of resources.
797
798 2005-06-21  Dick Porter  <dick@ximian.com>
799
800         * mutex-private.h:
801         * thread-private.h:
802         * mutexes.c: 
803         * threads.c: Keep a list of owned mutexes in each thread handle,
804         so that it is easier to abandon them when the thread exits.
805         Removes a bottleneck when multiple threads are finishing in
806         parallel.
807
808 2005-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
809
810         * io.c: (GetLogicalDrives) when a bogus line is read, don't leak memory.
811         When the buffer has not enough space, close the file before returning.
812
813 2005-06-09  Duncan Mak  <duncan@novell.com>
814
815         * *.h: Added G_BEGIN_DECLS and G_END_DECLS where appropriate to
816         all public headers. Fixes #74919.
817
818 2005-05-30  Zoltan Varga  <vargaz@freemail.hu>
819
820         * atomic.h: Add IA64 atomic ops.
821
822 2005-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
823
824         * processes.c: make ExitCode be valid even if the user didn't call
825         WaitForExit() and is just polling on HasExited.
826
827 2005-05-17  Dick Porter  <dick@ximian.com>
828
829         * io.c (file_getfilesize): Clear the error value, so that files
830         with sizes with the low bits 0xFFFFFFFF can be distinguished from
831         a genuine error.
832
833 2005-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
834
835         * shared.c: forgot to ignore a warning.
836
837 2005-05-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
838
839         * shared.c: don't display warnings after reboots.
840
841 2005-05-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
842
843         * sockets.c: on windows, getsockopt/setsockopt for send/receive timeout
844         use an integer in milliseconds. We were using a struct timeval.
845
846 2005-05-06  Dick Porter  <dick@ximian.com>
847
848         * handles-private.h: 
849         * mutexes.c: 
850         * wapi-private.h: 
851         * shared.h:
852         * shared.c: 
853         * wait.c: 
854         * handles.c: 
855         * collection.h: Use SysV semaphores for managing access to the
856         shared memory - in return for the ludicrous api we get
857         synchronisation primitives that can be cleaned up by the kernel
858         even when a process quits unexpectedly.  This removes the
859         timestamp issues.
860
861 2005-05-05  Lluis Sanchez Gual  <lluis@novell.com>
862
863         * handles.c: Always use polling in the waits, since
864         mono_cond_timedwait can't be interruped by the thread abort signal.
865
866 2005-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
867
868         * events.c: calling Set on AutoResetEvent several times has the same
869         effect as calling it only once if no thread is waiting for it.
870
871 2005-04-29  Dick Porter  <dick@ximian.com>
872
873         * processes.c (EnumProcesses): Use a GArray instead of a GPtrArray
874         now it's storing pids not handles, also fixes memory leak caused
875         by unclear glib documentation.
876
877         * sockets.c (WSACleanup): Remove unused variable
878
879 2005-04-29  Dick Porter  <dick@ximian.com>
880
881         * handles.c (_wapi_handle_check_share_by_pid): For systems that
882         don't have file descriptor info in /proc check that the original
883         opener of a file is still there, if a share violation would
884         otherwise happen.
885
886 2005-04-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
887
888         * handles.c:
889         * handles-private.h: added _wapi_handle_forecch that loops through all
890         the handles and call a callback function when a handle of the given
891         type is found.
892
893         * sockets.c: no need to keep open sockets in an array, as we have them 
894         in the handles structure.
895
896         Fixes bug #74755.
897
898 2005-04-28  Dick Porter  <dick@ximian.com>
899
900         * processes.c: Cope with handles that are only around for as long
901         as the search is running.  If we're searching for process handles,
902         check to see if the process is still running and signal it if not.
903
904         * handles.c (_wapi_search_handle): Search in the shared space as
905         well.  Fixed bug 74752.
906
907         * mutexes.c:
908         * handles.c (_wapi_handle_new_from_offset):
909         _wapi_handle_new_for_existing_ns () was doing exactly the same as
910         this, so deleted it.
911
912 2005-04-26  Dick Porter  <dick@ximian.com>
913
914         * handles.c: Fix stupid thinko where if a new shared handle is
915         created but a collection was needed to free some space, it
916         returned an error anyway.  Should fix the messages shown in bug
917         74659.
918
919 2005-04-25  Dick Porter  <dick@ximian.com>
920
921         * handles.c (_wapi_handle_check_share): Only consider mono
922         processes when looking to see if a file is still being held open,
923         while checking share permissions.
924
925 2005-04-25  Dick Porter  <dick@ximian.com>
926
927         * sockets.c: 
928         * io.c: 
929         * wapi-private.h (struct _WapiHandleOps): 
930         * handles.c (_wapi_handle_unref): When destroying handles, save
931         the handle data and call the close function only after the array
932         slot has been cleared.  This prevents race conditions with file
933         descriptors, fixing bug 74713.
934
935         * mutexes.c: Delete the handle close functions, they didn't do
936         anything anyway
937
938         * error.c (_wapi_get_win32_file_error): Add a mapping for EINTR so
939         the "Unknown error" g_warning doesn't get displayed.
940
941 2005-04-25  Dick Porter  <dick@ximian.com>
942
943         * wapi-private.h: 
944         * threads.c: Make thread handles process-private for now to take
945         some of the space pressure off the shared memory, while I work on
946         a real fix.
947
948 2005-04-21  Dick Porter  <dick@ximian.com>
949
950         * handles.c (_wapi_handle_check_share): Make sure there is a "fd"
951         dir in /proc before blowing away handle info.  Fixes bug 74649.
952
953 2005-04-21  Dick Porter  <dick@ximian.com>
954
955         * wait.c (WaitForMultipleObjectsEx): Implement special waits
956
957         * handles.c (_wapi_handle_wait_signal_poll_share): Don't return a
958         timeout, just wait briefly for the private signals and let the
959         waiting thread test again.  This prevents us missing shared
960         signals.
961
962 2005-04-21  Dick Porter  <dick@ximian.com>
963
964         * collection.h (_WAPI_HANDLE_COLLECTION_EXPIRED_INTERVAL): Reduce
965         the time before a slot is considered too old and deleted.  This is
966         a workaround while I come up with a proper fix.
967
968 2005-04-21  Dick Porter  <dick@ximian.com>
969
970         * mutexes.c: 
971         * processes.c: 
972         * threads.c: 
973         * handles.c (_wapi_handle_new): Turn assertions into errors.
974
975         * collection.c (_wapi_handle_collect): Use symbols not magic
976         numbers for timeout values
977
978 2005-04-19  Dick Porter  <dick@ximian.com>
979
980         * mutexes.c: 
981         * wait.c: 
982         * handles.c (_wapi_handle_count_signalled_handles)
983         * handles-private.h (_wapi_handle_shared_lock_handle): Use new
984         shared handle locks in critical sections.
985
986         * handles.c (_wapi_handle_new_for_existing_ns): Reuse old handles
987         if there is already one there.
988         
989         * handles.c (_wapi_handle_ref): It was possible for a process to
990         exit before getting around to updating shared handle timestamps,
991         so do it here too.
992
993 Tue Apr 19 16:25:47 CEST 2005 Paolo Molaro <lupus@ximian.com>
994
995         * threads.c: fix lookup of the thread id in the has table:
996         always use the id value, not the pointer to the id.
997
998 2005-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
999
1000         * handles.c: fix handle returned in _wapi_handle_search_handle. Dick
1001         pointed it out.
1002
1003 2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1004
1005         * io-layer/sockets.c: FIONBIO with a TRUE argument means we want
1006         non-blocking IO, not the other way around.
1007
1008 2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1009
1010         * handles.c:
1011         * io.c:
1012         * handles-private.h: GetFileType wasn't checking if we have memory
1013         allocated for the handle before dereferencing it. Fixes a FileStream
1014         nunit test.
1015
1016 2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1017
1018         * handles.c:
1019         * processes.c:
1020         * handles-private.h: we were calling g_renew to expand the handle array,
1021         but that might move the memory and we might have pthread conditions or
1022         mutexes in the original memory area that are being used. Now instead of
1023         expanding an existing array, we just create new ones and keep a list of
1024         them. Access to _wapi_private_handles had to be modified accordingly.
1025
1026 2005-04-15  Dick Porter  <dick@ximian.com>
1027
1028         * collection.c: FreeBSD needs more than PTHREAD_STACK_MIN
1029
1030 2005-04-14  Raja R Harinath  <rharinath@novell.com>
1031
1032         * wapi-private.h: Remove reference to 'daemon-private.h'.
1033
1034 Wed Apr 13 13:12:33 EDT 2005 Paolo Molaro <lupus@ximian.com>
1035
1036         * atomic.h: applied patch from mass@akuma.org (David Waite)
1037         to fix InterlockedExchangeAdd.
1038         Fixed a few other functions, including InterlockedCompareExchange()
1039         which was miscompiled by gcc with optimizations enabled.
1040
1041 2005-04-13  Dick Porter  <dick@ximian.com>
1042
1043         * io.c (share_check): 
1044         * handles.c (_wapi_handle_check_share): Refine the file check so
1045         that sharing violations within the same process don't cause
1046         assertion failures.
1047
1048 2005-04-13  Dick Porter  <dick@ximian.com>
1049
1050         * io.c (FindFirstFile): Fix bugs introduced with the merge (bug
1051         74586)
1052
1053 2005-04-12  Dick Porter  <dick@ximian.com>
1054         
1055         The daemon-less io-layer.  Extensive lowlevel changes in
1056         handles.c, requiring some corresponding changes in other files
1057         calling these functions.  Private_foo structures have been
1058         eliminated.
1059
1060         File descriptor handling differences account for most of the
1061         changes in io.c and sockets.c.
1062
1063         Other highlights:
1064         
1065         * mutexes.c: Named mutexes are now a distinct type.
1066         * atomic.h: Fix a PPC uninitialised variable warning.
1067         * wait.c: Check conditions before waiting on a condition variable.
1068         * processes.c: Handle process fork and wait without a daemon
1069         (though this has the limitation of only being able to wait for
1070         child processes.)
1071
1072 2005-04-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1073
1074         * io-private.h:
1075         * threads.c:
1076         * threads.h:
1077         * io.c:
1078         * sockets.c:
1079         * sockets.h: removed dead code that deals with async IO.
1080
1081 2005-03-30  Zoltan Varga  <vargaz@freemail.hu>
1082
1083         * atomic.c (InterlockedIncrement): Fix fallback implementation of
1084         InterlockedIncrement and InterlockedDecrement. Fixes #74228.
1085
1086 2005-03-29  Sebastien Pouliot  <sebastien@ximian.com>
1087
1088         * io-layer.h: Add required header files for compiling with VS.NET.
1089
1090 2005-03-17 Miguel de Icaza <miguel@novell.com>
1091
1092         * io.c: don't fail on NFS when there are no more locks available.
1093
1094 2005-03-09  Dick Porter  <dick@ximian.com>
1095
1096         * error.c (_wapi_get_win32_file_error): ENFILE and EMFILE should
1097         map to ERROR_TOO_MANY_OPEN_FILES, not ERROR_NO_MORE_FILES.  Fixes
1098         bug 72671.
1099
1100 2005-03-09  Dick Porter  <dick@ximian.com>
1101
1102         * daemon.c (process_process_fork): Initialise the handle data
1103         before using it in the error case.  This is probably the error
1104         we're working around in the previous change.  Spotted by Taru Jain
1105         <tjain@novell.com> and Hemanth Yamijala <YHemanth@novell.com>.
1106
1107 2005-03-07  Dick Porter  <dick@ximian.com>
1108
1109         * daemon.c: It looks like g_shell_parse_argv() can return
1110         argv[0]=NULL somehow, yet still not give an error.  Make sure we
1111         don't pass NULL to strrchr(), working around a segfault that
1112         showed up on ZLM testing.
1113
1114 2005-03-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1115
1116         * sockets.c: translate EINPROGRESS to EWOULDBLOCK in connect. This is
1117         the expected error code showed by the test case in bug #73053.
1118
1119 2005-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1120
1121         * io.c: another leftover.
1122
1123 Fri Feb 18 17:37:29 CET 2005 Paolo Molaro <lupus@ximian.com>
1124
1125         * io.c: fixed logic in checking errno in rev 40815.
1126
1127 Fri Feb 18 16:00:29 CET 2005 Paolo Molaro <lupus@ximian.com>
1128
1129         * threads.c: we don't depend on the GC checking tls
1130         slots anymore.
1131         * processes.c: remove unused ref to GC headers.
1132
1133 Thu Feb 17 19:57:11 CET 2005 Paolo Molaro <lupus@ximian.com>
1134
1135         * io.c: remove _wapi_thread_cur_apc_pending () checks
1136         when the siscall should return immediatly and handle
1137         the case when a syscall is interrupted without
1138         erroring out, but returning a 0 read/write if possible.
1139         Still the cases of read from file need to be handled.
1140
1141 Tue Feb 8 18:28:11 CET 2005 Paolo Molaro <lupus@ximian.com>
1142
1143         * threads.c: make people test with 1 MB stack per thread.
1144
1145 2005-01-17  Dick Porter  <dick@ximian.com>
1146
1147         * timefuncs.h: Make WapiFileTime endian-aware, as it's often
1148         cast to and from 64bit ints.  Fixes bug 71213.
1149
1150 2005-01-11  Dick Porter  <dick@ximian.com>
1151
1152         * error.c (errno_to_WSA): Add EADDRNOTAVAIL error code
1153         translation.
1154
1155 Mon Jan 10 16:15:19 EST 2005 Neale Ferguson <nealeferguson@earthlink.net>
1156
1157         * atomic.h: Fix functions on s390.
1158
1159 Mon Jan 10 20:30:19 CET 2005 Paolo Molaro <lupus@ximian.com>
1160
1161         * atomic.h: fix some functions on ppc (tests/interlocked.cs).
1162
1163 2005-01-10  Dick Porter  <dick@ximian.com>
1164
1165         * misc.c (_wapi_calc_timeout): Guard against overflow when
1166         calculating timeouts.  This makes waiting with a large
1167         (Int32.MaxValue) timeout not return immediately.
1168
1169 2004-12-23  Ben Maurer  <bmaurer@ximian.com>
1170
1171         * io.c (io_ops): make this `const' so it is shareable (well, only
1172         really shareable if it is statically linked...)
1173
1174 Mon Dec 20 11:58:33 CET 2004 Paolo Molaro <lupus@ximian.com>
1175
1176         * threads.c, threads.h: add accessor to get the pthread_key_t for
1177         a tls id.
1178
1179 2004-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1180
1181         * io.c: check for the existence of 'dest' and set ERROR_ALREADY_EXISTS
1182         if it exists and is not the same as 'src'.
1183
1184 2004-12-01 Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
1185
1186         * atomic.h : Fix InterlockedCompareExchange for s390/s390x.
1187
1188 2004-12-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1189
1190         * processes.c: unquote the cmd path, allow for ' or " when quoting and
1191         pass the quoted program name to the daemon, otherwise the call to
1192         g_shell_unquote in the daemon will break things up.
1193
1194 2004-10-14  Dick Porter  <dick@ximian.com>
1195
1196         * sockets.c (_wapi_accept): Revert the previous change.  We now
1197         set the accepted socket to have the same blocking status as the
1198         listening socket in managed code.  This follows MS behaviour.
1199         
1200 2004-10-14  Dick Porter  <dick@ximian.com>
1201
1202         * sockets.c (_wapi_accept): On Darwin, make sure a newly
1203         accept()ed socket is blocking.  Fixes bug 67355, patch by
1204         grompf@sublimeintervention.com.
1205
1206 2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1207
1208         * system.c: check the number of online processors instead of the
1209         existing ones. Sanitize return value if it's an error.
1210
1211 2004-10-03 Ben Maurer  <bmaurer@ximian.com>
1212
1213         * system.c: Add support for getting the # of cpus.
1214
1215 2004-09-28  Dick Porter  <dick@ximian.com>
1216
1217         * io.c (pipe_close_private): Fix one small typo in the last change
1218         that totally hosed process creation with redirected pipes.
1219
1220 2004-09-24  Dick Porter  <dick@ximian.com>
1221
1222         * wapi-private.h: 
1223         * sockets.c: 
1224         * socket-private.h: 
1225         * io.c: 
1226         * io-private.h: 
1227         * handles-private.h: Cope when a file descriptor is reused while
1228         the handle that thought it owned it is still referenced, instead
1229         of asserting.  Probably fixes bug 66479, though we've been unable
1230         to reproduce it.
1231
1232 2004-09-09  Dick Porter  <dick@ximian.com>
1233
1234         * error.c:
1235         * io.c: Set error codes everywhere.
1236
1237 2004-09-06  Dick Porter  <dick@ximian.com>
1238
1239         * handles.c (_wapi_handle_unref): Reset the private record's type
1240         (CloseHandle): Check for a fd mapping failure, and return FALSE.
1241         (_wapi_handle_process_fork): Fix long-standing bug in checking
1242         handle return values.  Also do the required bookkeeping with the
1243         new process's handles.
1244
1245         * daemon.c: When creating a new process's handles, check whether
1246         the shared space needs to be increased
1247
1248 2004-09-05  Zoltan Varga  <vargaz@freemail.hu>
1249
1250         * shared.c (_wapi_shm_file): Fix leaking of filename.
1251
1252 2004-08-19  Dick Porter  <dick@ximian.com>
1253
1254         * handles.c (_wapi_handle_count_signalled_handles): Fix thinko
1255         introduced with the fd offset stuff: unlock handles properly when
1256         backing off.  Fixes the monologue hang at exit.
1257
1258 2004-08-18  Dick Porter  <dick@ximian.com>
1259
1260         * sockets.c: 
1261         * io.c: Check that new fds fit in the table, return error if not
1262
1263         * daemon.c (_wapi_daemon_main): 
1264         * handles.c (shared_init): Have all processes agree on a size for
1265         the fd table.
1266
1267 2004-08-17  Dick Porter  <dick@ximian.com>
1268
1269         * daemon.c (process_new): 
1270         * handles.c (_wapi_handle_new_internal): Cope when the space
1271         reserved for file descriptors is larger than the shared segment
1272         size.  Fixes the crash reported when running mono under gdb on
1273         macosx.
1274
1275 2004-08-16  Dick Porter  <dick@ximian.com>
1276
1277         * sockets.c:
1278         * io.c:
1279         * handles-private.h (_wapi_handle_fd_offset_to_handle): Improve
1280         error checking with passed-in file descriptors.
1281
1282 2004-08-11  Dick Porter  <dick@ximian.com>
1283
1284         * sockets.c: 
1285         * io.c: Returned handle values are the file descriptor the handle
1286         encapsulates
1287
1288         * handles.c: 
1289         * handles-private.h: 
1290         * daemon.c: Reserve the range of handles that can have the same
1291         values as file descriptors.  These won't be used, but the values
1292         will be used as file, console, pipe or socket handles.  The fd to
1293         handle mapping is done internally and is invisible to users.
1294         Fixes bug 61828.
1295
1296         * wapi-private.h (_WAPI_HANDLE_VERSION): Increment, because we now
1297         reserve a chunk of handle space.
1298
1299 2004-08-04  Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
1300
1301         * atomic.h: add support for 64-bit S/390
1302
1303 2004-07-22  Dick Porter  <dick@ximian.com>
1304
1305         * timed-thread.c: 
1306         * threads.c: Move the destruction of the internal thread data to
1307         after the thread has been joined.  Fixes bug 61418.
1308
1309 2004-07-14  Dick Porter  <dick@ximian.com>
1310
1311         * wait.c (test_and_own): When not waiting for all handles to
1312         become signalled, only own and return the lowest.  All the
1313         documentation suggests that the old way was correct, but
1314         experimentation shows it actually works like this.  Patch by
1315         Sébastien Robitaille
1316         (sebastien.robitaille@croesus.com), fixes bug 61511.
1317
1318 2004-07-09  Ben Maurer  <bmaurer@ximian.com>
1319
1320         * threads.c: register roots for gc
1321
1322 2004-07-08  Dick Porter  <dick@ximian.com>
1323
1324         * io.c (file_seek): If there is a high 32bit offset part, make
1325         sure the low part isn't sign-extended.  Set error codes when
1326         returning failure.  Fixes bug 61131.
1327
1328 2004-07-06  Dick Porter  <dick@ximian.com>
1329
1330         * io.c (file_setfiletime): Check for underflow when converting to
1331         time_t values.  Set error codes when returning failure.  Fixes bug
1332         60970.
1333
1334 2004-07-05  Dick Porter  <dick@ximian.com>
1335
1336         * mutexes.c (mutex_ops_init): Make the named mutex mutex sharable.
1337
1338         * daemon.c (unref_handle): Only destroy a handle if all processes
1339         have released it, not just the current one.  Fixes bug 60887.
1340
1341 2004-06-30  Zoltan Varga  <vargaz@freemail.hu>
1342
1343         * mono-mutex.h atomic.h: Add G_GNUC_UNUSED to static inline functions
1344         to prevent warnings.
1345
1346 2004-06-24  Dick Porter  <dick@ximian.com>
1347
1348         * mutexes.c: Indicate when a named mutex was reused
1349
1350 2004-06-24  Dick Porter  <dick@ximian.com>
1351
1352         * threads.c (SuspendThread): 
1353         * timed-thread.c (_wapi_timed_thread_suspend): Wrap sem_wait in a
1354         while loop.  See bug 58161.
1355
1356 Wed Jun 23 23:29:04 CEST 2004 Paolo Molaro <lupus@ximian.com>
1357
1358         * io.c: don't use sharemode for on-disk file permissions: it's used
1359         for shared access to the open file.
1360
1361 2004-06-22  Dick Porter  <dick@ximian.com>
1362
1363         * events.c (CreateEvent): When creating an auto-reset event that
1364         is initially owned, make sure the set count starts at 1.
1365
1366 2004-06-18  Dick Porter  <dick@ximian.com>
1367
1368         * event-private.h:
1369         * events.c: Auto-reset events need to release one thread for each
1370         time SetEvent() is called.  Fixes bug 41292.
1371
1372         * threads.h:
1373         * mutex-private.h:
1374         * mutexes.c: Scan for mutexes that are still locked by a thread
1375         when it exits.  Fixes the MS demo app linked by bug 41292.
1376
1377         * wait.c (test_and_own): Make sure a handle is signalled before it
1378         is owned.
1379
1380 2004-06-16  Dick Porter  <dick@ximian.com>
1381
1382         * timed-thread.c: Call the thread cleanup exit routine before taking
1383         the join mutex, because this could deadlock if another thread tries
1384         to join in the meantime.  This fixes the hang-at-exit problem seen
1385         on macos.
1386
1387 2004-06-03  Lluis Sanchez Gual  <lluis@ximian.com>
1388
1389         * threads.c: Implemented SleepEx.
1390         * threads.h: Fixed SleepEx signature.
1391
1392 2004-06-03  Miguel de Icaza  <miguel@ximian.com>
1393
1394         * threads.c: When running under valgrind, do not allocate too much
1395         stack, as Valgrind default is 1 meg.
1396
1397 2004-05-27  Dick Porter  <dick@ximian.com>
1398
1399         * io.h:
1400         * io.c: Implemented LockFile() and UnlockFile()
1401
1402 2004-05-21  Dick Porter  <dick@ximian.com>
1403
1404         * io.c (CreateFile): Check for existing share modes when opening
1405         a file.
1406
1407         * handles.c: 
1408         * handles-private.h: 
1409         * daemon-messages.h: 
1410         * daemon.c: Maintain a hash of file share modes, keying on device
1411         and inode (to cope with symlinks.)
1412
1413 2004-05-20  Lluis Sanchez Gual  <lluis@ximian.com>
1414
1415         * daemon-messages.c: Retry if the communication with the daemon is
1416           interrupted by a signal.
1417         * io.c, sockets.c: Check for EINTR in every syscall that can be interrumped. 
1418           Only return an error in this case if there is something in the apc queue
1419           (which means that it is an interruption requested by the "user").
1420         * processes.c: Use WaitForSingleObjectEx. No need to pass "alertable" as
1421           true since the wait is small.
1422         * shared.c: Retry write calls when interrumped by a signal.
1423         * timed-thread.h, timed-thread.c: added _wapi_thread_apc_pending, which
1424           returns TRUE if there are pending asynchronous calls (APC) for the
1425           provided thread. Also added _wapi_thread_dispatch_apc_queue which calls
1426           the enqueued APCs. Defined a new struct ApcInfo that holds information
1427           about an enqueued APC.
1428         * thread-private.h, threads.c: Implemented QueueUserAPC (which does the same
1429           as in win32),_wapi_thread_apc_pending and _wapi_thread_dispatch_apc_queue. 
1430           These last two methods call the corresponding apc methods in 
1431           thread-private using the provided thread handle.
1432         * threads.h: Added QueueUserAPC.
1433         * uglify.h: Added WapiApcProc (needed by QueueUserAPC).
1434         * wait.c, wait.h: Changed WaitForSingleObject to WaitForSingleObjectEx, and
1435           WaitForMultipleObjects to WaitForMultipleObjectsEx. Implemented support
1436           for APCs in those two methods and also in SleepEx.
1437
1438 2004-05-17  Dick Porter  <dick@ximian.com>
1439
1440         * io.c (CopyFile): Speed up.  Fixes bug 57859.
1441
1442 2004-05-13  Dick Porter  <dick@ximian.com>
1443         * mono-mutex.c (mono_mutex_unlock): Return EPERM when the current
1444         thread doesn't own the mutex, rather than assert()ing.
1445
1446 2004-05-11  Dick Porter  <dick@ximian.com>
1447
1448         * shared.c (_wapi_shm_attach): Cope when a previous daemon startup
1449         attempt failed, leaving shared files that look like a daemon is
1450         still starting.
1451
1452 2004-05-10  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1453
1454         * io.c:
1455         (SetFileAttributes): don't the the exec bit if the corresponding read
1456         bit is not set.
1457
1458 2004-05-10  Zoltan Varga  <vargaz@freemail.hu>
1459
1460         * io.c (FindFirstFile): Fix invalid free.
1461
1462 2004-05-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1463
1464         * io.c: translate from GFileError to errno codes and don't free
1465         variables right after calling mono_io_scandir, as we may overwrite
1466         errno value.
1467
1468 2004-05-08  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1469
1470         * io.c: g_dir_open return ENOENT for directories on which we don't have
1471         read/execute permission, while returning EPERM for anything below those.
1472         So, change ENOENT by EPERM if the directory exists.
1473
1474 2004-05-07  Dick Porter  <dick@ximian.com>
1475
1476         * io.c (SetFileAttributes): Don't have failed chmod()s cause a
1477         "file not found" error.  Fixes bug 54032.
1478         
1479 2004-05-07  Dick Porter  <dick@ximian.com>
1480
1481         * io.c (FindFirstFile): Comment out a windows-compatibility check
1482         that breaks when directories have metachars in their names.
1483         Workaround for bug 58116.
1484
1485 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1486
1487         * io.c: fixed for FindFirstFile for empty directories. Closes
1488         bug #58147.
1489
1490 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1491
1492         * processes.c: set the start time for the current process. Fixes bug
1493         #58109.
1494
1495 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1496
1497         * io-private.h: 'namelist' is now a gchar ** in _WapiHandlePrivate_find.
1498         * io.c: implemented scandir using glib functions.
1499
1500 2004-05-04  Dick Porter  <dick@ximian.com>
1501
1502         * daemon.c (read_message): Return FALSE on error so the GSource
1503         callback itself can return FALSE.  Cures the infinite loop poll()
1504         warning on MacosX.
1505         * shared.c: Fix some daemon startup race conditions.
1506
1507 2004-04-29  Miguel de Icaza  <miguel@ximian.com>
1508
1509         * io.c (CopyFile): Use 32k buffers to copy the file instead of 2k,
1510         use the stack, do not use dynamic memory.
1511
1512 2004-04-29  Zoltan Varga  <vargaz@freemail.hu>
1513
1514         * io.c: Add scandir implementation for platforms which do not have
1515         it, like solaris.
1516
1517 2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1518
1519         * io.[ch]: implemented GetLogicalDriveStrings.
1520
1521 2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1522
1523         * io.c:
1524         * sockets.c: use the field name from configure when accessing sigval
1525         pointer field. Makes this work on the Mac.
1526
1527 2004-04-28  Bernie Solomon  <bernard@ugsolutions.com>
1528
1529         * atomic.c: (InterlockedExchange) fix typo for
1530         mutex name
1531
1532 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1533
1534         * io.c:
1535         * sockets.c: added check for sys/aio.h.
1536
1537 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1538
1539         * error.[ch]: added _wapi_get_win32_file_error...
1540         * io.c: ... which was _wapi_get_win32_error here.
1541         * sockets.c: rename the function calls here too.
1542
1543 2004-04-28  Dick Porter  <dick@ximian.com>
1544
1545         * daemon-messages.c: Avoid a deadlock when a thread is killed while
1546         waiting for the daemon by using a recursive mutex.  Helps bug 56699.
1547
1548 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1549
1550         * io.c: fixed leak in async_notifier().
1551
1552         * sockets.[ch]: added AIO support for sockets and fixed WSAIoctl
1553         declaration.
1554
1555         * threads.c: removed old comment.
1556
1557 2004-04-26  David Waite  <mass@akuma.org>
1558
1559         * daemon-messages.h:
1560         * daemon-private.h
1561         * error.h:
1562         * io.h:
1563         * processes.h:
1564         * shared.h:
1565         * thread-private.h:
1566         * wapi-private.h: remove comma from end of enumeration declarations
1567         * status.h: cast unsigned int types to int for enum assignment
1568
1569 2004-04-26 David Waite <mass@akuma.org>
1570
1571         * io.c:
1572         * timefuncs.c: declare 64-bit constants as long long types (i.e.
1573         10ULL)
1574
1575 2004-04-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1576
1577         * socket-wrappers.h: _wapi_socket == WSASocket now. Added
1578         WSA_FLAG_OVERLAPPED.
1579
1580         * sockets.c: new unused parameters for _wapi_socket.
1581
1582 2004-04-22  Miguel de Icaza  <miguel@ximian.com>
1583
1584         * timed-thread.c: Replace sem_init with MONO_SEM_INIT to handle
1585         the fact that MacOS X is a piece of junk (sem_init is *defined* in
1586         the libc, but they return `not implemented'). 
1587
1588 2004-04-22  Dick Porter  <dick@ximian.com>
1589
1590         * handles.c: 
1591         * handles-private.h: Reference the handle when it is locked, so
1592         that another thread can't blow it away while we're waiting for it
1593         to become signalled.
1594         
1595         * wait.c: 
1596         * timed-thread.c: 
1597         * threads.c: 
1598         * sockets.c: 
1599         * semaphores.c: 
1600         * mutexes.c: 
1601         * mono-mutex.c: 
1602         * io.c: 
1603         * handles.c: 
1604         * handles-private.h: 
1605         * events.c: 
1606         * error.c: 
1607         * daemon-messages.c: 
1608         * critical-sections.c: 
1609         * atomic.c: Added pthreads cleanup handlers and error asserts
1610
1611         * shared.c: 
1612         * handles.c: Fixed the gcc "variable might be used uninitialised"
1613         warnings.  They can't happen, but gcc doesn't know that
1614         g_assert()s don't return.
1615
1616         Fixed the declaration of _wapi_handle_process_kill() so that it
1617         expects the correct type for the pid.
1618         
1619         * threads.c: Removed the TLS_PTHREAD_MUTEX style locking that
1620         hasn't been used in ages and just made the code more complex.
1621
1622 2004-04-17  Zoltan Varga  <vargaz@freemail.hu>
1623
1624         * processes.c: Include <signal.h> for SIGKILL and SIGILL + fix some
1625         warnings. Fixes #57168.
1626
1627 2004-04-16  Dick Porter  <dick@ximian.com>
1628
1629         * threads.c (Sleep): Using div(3) with a negative (when signed)
1630         numerator causes the quotient to be 0 and the remainder to be the
1631         numerator.  This feeds a small negative value to nanosleep(3),
1632         which will return immediately and cause a busy wait.  Fixes bug
1633         56351.
1634
1635 2004-04-15  Dick Porter  <dick@ximian.com>
1636
1637         * io-private.h:
1638         * io.c: Rewrite FindFirstFile and FindNextFile using scandir(3)
1639         and fnmatch(3) instead of glob(3).  glob() can't cope with being
1640         given filenames containing metachars.  This fixes bug 40557.
1641
1642 2004-04-14  Bernie Solomon  <bernard@ugsolutions.com>
1643
1644         * security.c: #warning is a GCC-ism
1645
1646 2004-04-13  Sebastien Pouliot  <sebastien@ximian.com>
1647
1648         * security.c: Removed GetUserName as glib g_get_user_name does a
1649         better (portability) job. Added ImpersonateLoggedOnUser and
1650         RevertToSelf.
1651
1652 2004-04-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1653
1654         * mono-mutex.h: move pthread_mutex_timedlock declaration to...
1655         * mono-mutex.c: ...here. It was causing a warning that prevented
1656         libgdiplus compilation.
1657
1658 2004-04-04  Miguel de Icaza  <miguel@ximian.com>
1659
1660         * security.c (GetUserName): Make it work on MacOS X
1661
1662 2004-04-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1663
1664         * security.c: use getpwuid_r if available. This one is thread-safe.
1665
1666 2004-04-02  Sebastien Pouliot  <sebastien@ximian.com>
1667
1668         * Makefile.am: Added security.c|h.
1669         * security.c: New file for security related functions. Added function
1670         GetUserName to fix #56144.
1671         * security.h: New. Header file for security.c
1672         * wapi.h: Added include for security.h
1673
1674 2004-03-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1675
1676         * daemon-messages.h: added kill structs.
1677
1678         * daemon.c: implemented process_process_kill.
1679         * handles-private.h:  define process_process_kill.
1680         * handles.c: implemented _wapi_handle_process_kill.
1681         * processes.[ch]: implemented TerminateProcess.
1682
1683 2004-03-25  Bernie Solomon  <bernard@ugsolutions.com>
1684
1685         * daemon.c (rem_fd): On solaris you seem to get an
1686         error even after removing the input source so don't
1687         try and rem_fd it twice.
1688
1689 2004-03-25  Lluis Sanchez Gual  <lluis@ximian.com>
1690
1691         * daemon.c: in process_post_mortem, If the child terminated due to the 
1692         receipt of a signal, the exit status must be based on WTERMSIG, since 
1693         WEXITSTATUS returns 0 in this case.
1694
1695 2004-03-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1696
1697         * daemon.c: turned a warning into a DEBUG statement. Now we may hit it.
1698
1699 2004-03-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1700
1701         * daemon.c: only call getdtablesize () once.
1702         * processes.c: wait 500 ms to check if execve failed and throw the same
1703         exception as MS on failure. Fixes bug #32809.
1704
1705 2004-03-17  Bernie Solomon  <bernard@ugsolutions.com>
1706
1707         * io.c (async_notifier): use "union sigval" rather
1708         than sigval_t as Solaris doesn't have sigval_t
1709         (which isn't in IEEE 1003.1 either).
1710
1711 2004-03-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1712
1713         * io.c: added debug stuff and removed a few redundant lines in
1714         file_write.
1715
1716 2004-03-15  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1717
1718         * io-private.h: added new fields for file structure. Declare
1719         _wapi_io_add_callback.
1720
1721         * io.c: added _wapi_get_win32_error, support aio_read/write in
1722         file_read/write. Implemented _wapi_io_add_callback, which is where
1723         BindHandle ends up.
1724         
1725         * io.h: added new fields for WapiOverlapped and typedef for the
1726         callback.
1727
1728         * processes.c: fixed off-by-one bug when handling environment variables 
1729         passed in.
1730
1731         * threads.[ch]: implemented BindIoCompletionCallback.
1732
1733         * uglify.h: added typedef for LPOVERLAPPED_COMPLETION_ROUTINE.
1734
1735 2004-03-14  Zoltan Varga  <vargaz@freemail.hu>
1736
1737         * socket-wrappers.h: Remove extra semicolon.
1738
1739 2004-03-03  Dave Camp  <dave@ximian.com>
1740
1741         * daemon.c: (add_fd), (fd_activity), (_wapi_daemon_main):
1742         Use a new main context.
1743
1744 2004-03-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1745
1746         * io.c:
1747         (GetFileAttributes): set the error depending on errno instead of
1748         setting ERROR_FILE_NOT_FOUND always. See bug #55160.
1749
1750 2004-03-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1751
1752         * io.c:
1753         (CopyFile): free the buffer on error.
1754         * sockets.c:
1755         (WSAIoctl): free the buffer on error.
1756
1757 2004-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1758
1759         * error.c: fixed mapping for EPROTONOSUPPORT and ESOCKTNOSUPPORT.
1760
1761         * sockets.[ch]: retry creating the socket for AF_INET, SOCK_RAW
1762         using IP protocol with IP over IP. Implemented WSAIoctl UNIX-style.
1763
1764 2004-01-27  Bernie Solomon  <bernard@ugsolutions.com>
1765
1766         * shared.c (_wapi_shm_file): add hostname
1767         to shared data file names to handle NFS mounted
1768         .wapi directories.
1769
1770 Mon Jan 26 16:15:03 CET 2004 Paolo Molaro <lupus@ximian.com>
1771
1772         * sockets.h: remove obsolete soklen_t typedef.
1773
1774 Fri Jan 23 21:07:02 CET 2004 Paolo Molaro <lupus@ximian.com>
1775
1776         * socket-wrappers.h, sockets.h, sockets.c, Makefile.am: move socket
1777         wrappers to its own non-installed header file.
1778
1779 2004-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1780
1781         * io.c:
1782         (FindFirstFile): unlock the handle if FindNextFile fails.
1783         (FindNextFile): g_free a couple of pointers before retrying.
1784
1785         * wait.c:
1786         (WaitForMultipleObjects): if only one handle provided, use
1787         WaitForSingleObject.
1788
1789 2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>
1790
1791         * handles-private.h: (_wapi_handle_type) check
1792         for segment in range before using it
1793
1794 2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>
1795
1796         * thread-private.h: _wapi_thread_ops is now const
1797         must match .c file.
1798
1799 Mon Dec 22 18:29:03 CET 2003 Paolo Molaro <lupus@ximian.com>
1800
1801         * threads.c, timed-thread.c, timed-thread.h: use mach
1802         semaphores on Darwin (MacOSX) since the posix ones
1803         are mostly broken there (threads are not created suspended
1804         and they can start executing before they are fully initialized
1805         like in tests/thread-static.cs).
1806
1807 Mon Dec 22 17:18:45 CET 2003 Paolo Molaro <lupus@ximian.com>
1808
1809         * atomic.h: ppc fixes.
1810
1811 2003-12-19  Bernie Solomon  <bernard@ugsolutions.com>
1812
1813         * handles.c: remove my bad use of MONO_ZERO_ARRAY_LENGTH
1814         in HDRSIZE 
1815
1816 2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>
1817
1818         * shared.c: (_wapi_shm_open) make scratch file
1819         not have to immediately regrow to avoid remaps
1820         (HPUX can't cope with these).
1821         (_wapi_shm_attach) use actual size of file
1822         to set scratch data_len for the creating process.
1823
1824         * handles.c: (_wapi_handle_new_internal) make
1825         sure mutex & cond var are initialized even for
1826         non process shared ones. 
1827         (_wapi_handle_unref) always call destroy 
1828         routines on mutex & cond var
1829
1830 2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>
1831
1832         * daemon.c: change channel data structure so
1833         input sources are removed from glib event loop
1834         properly. xsp works better on Solaris and 
1835         fixes #51278
1836
1837 2003-12-12  Bernie Solomon  <bernard@ugsolutions.com>
1838
1839         * wapi-private.h: Replace G_GNUC_PRETTY_FUNCTION
1840         definition with file & line number for non-GCC
1841         compiles.
1842
1843 2003-12-08  Bernie Solomon  <bernard@ugsolutions.com>
1844
1845         * Makefile.am: make sure hppa_atomic.s is in distribution
1846
1847 2003-12-01  Dick Porter  <dick@ximian.com>
1848
1849         * wapi-private.h: 
1850         * mutexes.c (CreateMutex): 
1851         * mutex-private.h (struct _WapiHandle_mutex): 
1852         * handles.c: Look up certain handle types by name, in a shared
1853         namespace.  Currently only mutex handles have this implemented.
1854         Fixes bug 51089.
1855
1856         * semaphores.c (CreateSemaphore): 
1857         * events.c (CreateEvent): Fix signature
1858
1859 2003-11-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1860
1861         * io.c: don't call g_free before testing errno as it may modify it.
1862         If the path exists, return an error if it's not a directory. Fixes
1863         bug #50753.
1864
1865 2003-11-20  Dick Porter  <dick@ximian.com>
1866
1867         * io.c: Missed a little-endian UTF16 conversion.  Patch from
1868         Jeroen Zwartepoorte (Jeroen@xs4all.nl), fixes bug 51065.
1869
1870 2003-10-29  Dick Porter  <dick@ximian.com>
1871
1872         * io.c (MoveFile): If the move crosses filesystems, try and fall
1873         back to copy and delete.  Patch from Jörg Rosenkranz
1874         (JoergR@voelcker.com), fixes bug 50298.
1875
1876 2003-10-28  Dick Porter  <dick@ximian.com>
1877
1878         * io.c: Use the new encoding conversion to cope with non-utf8
1879         locales in filenames.
1880
1881         * processes.c: Ditto for process arguments.
1882
1883 Tue Oct 21 12:01:14 CEST 2003 Paolo Molaro <lupus@ximian.com>
1884
1885         * atomic.h: some ppc inline asm fixes (incorrect use of labels, 
1886         incorrect register constraints, incorrect clobber lists).
1887
1888 2003-10-13  Bernie Solomon  <bernard@ugsolutions.com>
1889
1890         * Makefile.am hppa_atomic.s: add HP 64bit
1891         implementation of atomic ops
1892
1893 2003-10-13  Zoltan Varga  <vargaz@freemail.hu>
1894
1895         * threads.c (CreateThread): Wrap pthread_attr_setstacksize call in
1896         a conditional for platforms that don't have it.
1897
1898 2003-10-09  Bernie Solomon  <bernard@ugsolutions.com>
1899
1900         * threads.c: (CreateThread) use stacksize argument
1901         if non-zero - change default for 64 bits to 4Mb
1902
1903 2003-09-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1904
1905         * sockets.c: set last error when socket creation fails. This shed some
1906         light on bug #49015.
1907
1908 2003-09-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1909
1910         * processes.c: fixed bug #48973: we only change \ by / for the argument
1911         to be used as command.
1912         When getting the program name from the args, don't let the space between
1913         them in the args.
1914
1915 2003-09-24  Bernie Solomon <bernard@ugsolutions.com>
1916
1917         * atomic.h atomic.c: fix sparc so lock is
1918         global, increment does so and it compiles under Sun compiler.
1919
1920 2003-09-22  Bernie Solomon <bernard@ugsolutions.com>
1921
1922         * handles.c: include <string.h> directly as may
1923         not be nested in <sys/un.h> like Linux
1924
1925 2003-09-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1926
1927         * io.c:
1928         (DeleteFile): call SetLastError on failure. Fix by
1929         richard.torkar@htu.se (Richard Torkar). Closes bug #48222.
1930
1931 2003-09-15  Lluis Sanchez Gual  <lluis@ximian.com>
1932
1933         * daemon.c: In compare_process(), discard handles already signalled.
1934
1935 2003-09-02  Dick Porter  <dick@ximian.com>
1936
1937         * io.c: Work around glib brain-dead assumptions about utf8-encoded
1938         filenames.  Fixes bug 30781.
1939
1940 2003-08-28  Dick Porter  <dick@ximian.com>
1941
1942         * critical-sections.c:  Patch from Bernie Solomon
1943         <bernard@ugsolutions.com> to emit a warning if locking a critical
1944         section fails.
1945
1946 2003-07-23  Dick Porter  <dick@ximian.com>
1947
1948         * shared.c:
1949         * daemon.c (maybe_exit): Avoid the race condition when the daemon is
1950         closing but another client comes along when the shared data is still
1951         visible.  Should fix bugs 33671 and 35213.
1952
1953 2003-07-23  Dick Porter  <dick@ximian.com>
1954
1955         * handles.c:  Initialise handle mutex and cond.  Fix by
1956         Bernie Solomon <bernard@ugsolutions.com>
1957
1958 2003-07-15  Dick Porter  <dick@ximian.com>
1959
1960         * timed-thread.c (timed_thread_start_routine): Fix virtual memory
1961         leak when threads quit.  Fixes bug 44067.
1962
1963 Wed Jun 18 19:08:40 CEST 2003 Paolo Molaro <lupus@ximian.com>
1964
1965         * io.c: never add write permission for group or others in
1966         SetFileAttributes ().
1967
1968 2003-06-17  Dick Porter  <dick@ximian.com>
1969
1970         * io.c (SetFileAttributes): Implement the ReadOnly attribute, and
1971         ignore the unsupported ones ("fixes" bug 44977).
1972
1973 2003-06-17  Lluis Sanchez Gual  <lluis@ximian.com>
1974
1975         * misc.c: fix bug in _wapi_calc_timeout. It gave wrong values for
1976           high ms values (there was an overflow).
1977
1978 2003-06-17  Zoltan Varga  <vargaz@freemail.hu>
1979
1980         * system.h (struct _WapiSystemInfo ): Fix warnings when using gcc-3.3.
1981
1982 2003-06-11  Dick Porter  <dick@ximian.com>
1983
1984         * shared.c: Fix shared directory creation.  Patch from
1985         Pablo Baena <pbaena@uol.com.ar>
1986
1987 2003-06-10  Dick Porter  <dick@ximian.com>
1988
1989         * atomic.c: Delete the useless compile warning
1990
1991 2003-06-09  Dick Porter  <dick@ximian.com>
1992
1993         * daemon.c: Lookup env as a string array.  Fixes bug 44289.  Also
1994         make setting the process handle value in the environment actually
1995         work.
1996
1997         * processes.c: Pretty up the process name, if it happens to be
1998         "mono" such as when another mono process forks "mono foo.exe"
1999
2000 2003-06-05  Dick Porter  <dick@ximian.com>
2001
2002         * processes.c (process_set_current): Don't do an expensive handle
2003         search at application startup, check the environment to see if the
2004         process handle has already been created.
2005
2006         * io.c: Don't do an expensive handle search when creating stdin,
2007         stdout and stderr handles, just create them all the first time one
2008         is requested.
2009
2010         * wapi-private.h:
2011         * shared.c:
2012         * shared.h:
2013         * handles.c:
2014         * handles-private.h:
2015         * daemon-messages.h:
2016         * daemon-private.h:
2017         * daemon.c: Support for "unlimited" number of handles and scratch
2018         data.
2019
2020         Speed up application startup by passing process handle in the
2021         environment, rather than let the app scan all handles (which gets
2022         really slow when there are more than a few thousand to check.)
2023
2024         Initialise some structs passed to syscalls, noticed by valgrind.
2025         
2026
2027 2003-05-20  Dick Porter  <dick@ximian.com>
2028
2029         * io.c (FindFirstFile): Include . files in the glob.  Fixes bug
2030         43229.
2031
2032 2003-05-19  Dick Porter  <dick@ximian.com>
2033
2034         * threads.c: Set the new thread's stack size to 2M.  Fix needed
2035         for BSD, reported by Martin Dvorak <md@9ll.cz>
2036
2037 2003-05-16  Dick Porter  <dick@ximian.com>
2038
2039         * io.h:
2040         * io.c: Implement GetTempPath()
2041
2042 2003-05-16  Dick Porter  <dick@ximian.com>
2043
2044         * processes.c (CreateProcess): Set some error codes
2045
2046 2003-05-12  Dick Porter  <dick@ximian.com>
2047
2048         * misc.c (_wapi_calc_timeout): Cope with overflowing tv_nsec.
2049         Patch from Martin Dvorak <mdvorak@ninell.cz>.
2050
2051 2003-05-10  Dick Porter  <dick@ximian.com>
2052
2053         * io.c (CopyFile): Copy file mode as well as file data.  Based on
2054         suggestion by Giuseppe Greco <giuseppe.greco@agamura.com>, bug
2055         42706.
2056
2057 2003-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2058
2059         * handles.c: don't call GC_gcollect when creating new handles.
2060
2061 2003-05-05  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2062
2063         * handles.c: added some debugging code. Call GC_gcollect
2064         before creating a new handle. It makes Lupus' test run smoother and
2065         faster (from 62 to 83 request per second). Notice that calling
2066         GC_finalizer_notifier if needed (GC_should_invoke_finalizer ()) does
2067         not improve nor degrade the performance, so i don't do it.
2068
2069 2003-05-02  Dick Porter  <dick@ximian.com>
2070
2071         * sockets.c: Rearrange closesocket() and socket_close_private(),
2072         and remember to unref the handle, so we don't leak socket handles.
2073         Fix from Pelle Johnsen <pelle.johnsen@mail.dk>
2074
2075 2003-04-11  Dick Porter  <dick@ximian.com>
2076
2077         * atomic.h: ARM atomic operations by Malte Hildingson
2078         <tds00mahi@tellus.thn.htu.se>
2079
2080 Tue Apr 8 11:37:29 CEST 2003 Paolo Molaro <lupus@ximian.com>
2081
2082         * atomic.h: fix macosx build by "Urs C. Muff" <umuff@quark.com>.
2083
2084 2003-04-03  Martin Baulig  <martin@ximian.com>
2085
2086         The following change is conditional to `WITH_INCLUDED_LIBGC'
2087         which is not yet enabled by default.
2088
2089         * threads.c (SuspendThread, ResumeThread): Fully implemented this.
2090         (gc_init): New static function; install a signal handler for
2091         SIGPWR which is used to suspend threads.  [FIXME: it SIGPWR
2092         doesn't exist on all Unix systems, we need to find another
2093         signal].
2094         (mono_wapi_push_thread_stack): New public function.  Tells the
2095         garbage collector about the current stack pointer of a suspended
2096         thread.
2097
2098 2003-04-03  Martin Baulig  <martin@ximian.com>
2099
2100         * timed-thread.h (TimedThread): Added `suspended_sem',
2101         `suspend_count' and `stack_ptr'.
2102
2103 2003-03-28  Dick Porter  <dick@ximian.com>
2104
2105         * atomic.h: PPC support gratiously donated to the public domain
2106         by John Duncan <jddst19@mac.com>
2107
2108 2003-03-20  Dick Porter  <dick@ximian.com>
2109
2110         * sockets.c (_wapi_connect): If connect() fails with EACCES, try
2111         setting SO_BROADCAST and connecting again.  Fixes bug 39178.
2112
2113 2003-03-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2114
2115         * processes.c: included Jerome Laban's patch and call SetLastError when
2116         the executable is not found.
2117
2118 2003-03-03  Dick Porter  <dick@ximian.com>
2119
2120         * io.c (CreateFile): Try opening directories readonly, so that
2121         timestamps can be adjusted.  Patch by Elan Feingold
2122         <efeingold@mn.rr.com>.
2123
2124 2003-02-25  Dick Porter  <dick@ximian.com>
2125
2126         * shared.c (_wapi_shm_attach): Return a failure code on system
2127         call errors, rather than exiting.
2128
2129 2003-02-21  Dick Porter  <dick@ximian.com>
2130
2131         * processes.c (GetCurrentProcessId): Use the current process
2132         handle to return the process ID, as getpid() is unreliable
2133         (linuxthreads gives each thread a different pid).  Fixes bug
2134         37550.
2135
2136 2003-02-21  Dick Porter  <dick@ximian.com>
2137
2138         * io.c (FindNextFile): Skip over dangling symlinks.  Fixes bug
2139         34076.
2140
2141 2003-02-11  Dick Porter  <dick@ximian.com>
2142
2143         * timefuncs.h: 
2144         * timefuncs.c: Added GetTickCount()
2145
2146 2003-02-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2147
2148         * error.c: added WSA_EHOSTUNREACH mapping.
2149
2150 2003-01-26  Miguel de Icaza  <miguel@ximian.com>
2151
2152         * io.c (SetFileAttributes): This routine is not currently
2153         implemented for the general case, but I added a special case to
2154         set the executable bit on Linux.
2155
2156 Wed Jan 15 15:55:40 CET 2003 Paolo Molaro <lupus@ximian.com>
2157
2158         * sockets.h, daemon.c, io.c: compilation fixes on MacOSX.
2159
2160 2003-01-08  Dick Porter  <dick@ximian.com>
2161
2162         * sockets.c: Fixed setting blocking mode to true (fixes bug 36388)
2163
2164 2002-12-11  Juli Mallett  <jmallett@FreeBSD.org>
2165
2166         * daemon.c, handles-private.h, handles.c, wapi-private.h:
2167         Check for an implementation which says it supports
2168         _POSIX_THREAD_PROCESS_SHARED, rather than just one that
2169         defines the symbol.  Defined but with a value of -1 still
2170         means that it is unsupported.
2171
2172 2002-12-08  Martin Baulig  <martin@ximian.com>
2173
2174         * handles.c (_wapi_handle_new): Create new non-shared handles with
2175         an initial refcount of 1, not 0.
2176
2177 2002-11-22  Dietmar Maurer  <dietmar@ximian.com>
2178
2179         * threads.c (TlsGetValue): removed unnecessary mutex
2180
2181 2002-11-20  Dick Porter  <dick@ximian.com>
2182
2183         * timed-thread.c (_wapi_timed_thread_attach): Attached threads
2184         need to store their data structure too.
2185
2186         * threads.c: Make sure the threading data is initialised wherever
2187         it is needed
2188
2189 2002-11-15  Dick Porter  <dick@ximian.com>
2190
2191         * timed-thread.c: Removed unneeded parameters in
2192         _wapi_timed_thread_attach().
2193
2194         * threads.c: Renamed AttachThread() to make it not look like
2195         external API.  Removed unneeded parameters.
2196
2197 2002-11-11  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2198
2199         * error.[ch]: added errno_to_WSA (). It displays a warning and return
2200         WSASYSCALLFAILURE if there is no error mapping for the given errno,
2201
2202         * sockets.c: use errno_to_WSA and fixed display of warning for h_errno.
2203
2204 2002-10-31  Dick Porter  <dick@ximian.com>
2205
2206         * io.h: 
2207         * io.c: Define and use INVALID_FILE_ATTRIBUTES
2208
2209 2002-10-07  Dick Porter  <dick@ximian.com>
2210
2211         * timefuncs.c:
2212         * daemon.c: Use a more accurate time source for process start and
2213         end times.
2214
2215 2002-10-03  Dick Porter  <dick@ximian.com>
2216
2217         * daemon.c:
2218         * handles.c:
2219         * threads.c:  Fixes for freebsd.  Make sure that mutex and condition
2220         creation and deletion happen in the process that owns them, when
2221         POSIX shared thread objects aren't supported.  This breaks on
2222         freebsd, as pthread_t is a pointer to data.
2223
2224 2002-10-02  Dick Porter  <dick@ximian.com>
2225
2226         * shared.c: Use mmap() instead of sysv shm for the shared data.
2227
2228         * wapi-private.h (_WAPI_HANDLE_VERSION): Reset back to 0, for the
2229         new system
2230
2231         * daemon-private.h: 
2232         * daemon.c: mmap()ed regions survive fork, so just pass the
2233         pointer to _wapi_daemon_main instead of mapping it again.
2234
2235 2002-10-01  Dick Porter  <dick@ximian.com>
2236
2237         * timed-thread.c: Kludge for CREATE_SUSPENDED thread creation.
2238         Unfortunately libgc uses the same thread suspend technique that I
2239         want to, and the two don't mix: libgc will deadlock when it tries
2240         to stop the world if a thread has already been suspended by
2241         someone else.  Just do the simple suspended create rather than the
2242         general purpose thread suspension for now.
2243
2244         * threads.c: Pass create flags to the timed_thread create call, to
2245         implement suspended thread creation.  ResumeThread() partially
2246         implemented, to cope with the case where a newly created but
2247         suspended thread is launched.
2248
2249 2002-09-30  Dick Porter  <dick@ximian.com>
2250
2251         * sockets.c (ioctlsocket): Set non-blocking mode in a better way,
2252         with fcntl.
2253
2254 2002-09-27  Dick Porter  <dick@ximian.com>
2255
2256         * semaphores.c: Only include semaphore.h if it's present. Patch
2257         for BSD from jmmv@hispabsd.org (Julio Merino).
2258
2259 2002-09-27  Dick Porter  <dick@ximian.com>
2260
2261         * processes.c: Pass environment and working directory to the
2262         daemon when forking.  Don't let argv[0] be duplicated when looking
2263         for the program name.  Implement EnumProcessModules (simple
2264         version for now, lsof-style later if needed), GetModuleBaseName,
2265         {Get,Set}ProcessWorkingSetSize (just faked, because the vm hints
2266         aren't available on Linux).
2267
2268         * process-private.h: Store the process name, and the working set
2269         min and max
2270
2271         * handles.c:
2272         * handles-private.h: New functions to store and retrieve an array
2273         of strings in the scratch space
2274
2275         * daemon.c: Don't miss deleting some handles when a client exits
2276         (we used to rely on the client doing the final cleanup, but
2277         obviously if the client is no longer there the daemon has to do
2278         it).
2279
2280         Process forking now sets the environment and the working
2281         directory.
2282
2283         * io.c: Don't confuse fd 0 with an unassigned handle struct
2284
2285         * atomic.h: Add a google cache alternative to the msdn URL
2286
2287 2002-09-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2288
2289         * sockets.c:
2290         (_wapi_recvfrom): added ECONNRESET to the switch.
2291
2292 2002-09-24  Mark Crichton  <crichton@gimp.org>
2293
2294         * atomic.h: Yea.  On linux, sparc isn't sparc, it's __sparc__.
2295         Added to ifdef.
2296
2297 2002-09-19  Mark Crichton  <crichton@gimp.org>
2298
2299         * daemon.c, shared.c: Added NEED_LINK_UNLINK for systems that
2300         dont have Linux's abstract filesystem for sockets.
2301
2302 2002-09-19  Mark Crichton  <crichton@gimp.org>
2303
2304         * atomic.h: Added SPARC atomic asm code.
2305         * daemon.c, handles-private.h, handles.c, wapi-private.h:
2306         undefined _POSIX_THREAD_PROCESS_SHARED.  This actually exists on
2307         Solaris 9, however, the code paths don't seem to work.  More testing
2308         on the shared case is *really* needed.
2309
2310 2002-09-03  Dick Porter  <dick@ximian.com>
2311
2312         * threads.h: 
2313         * threads.c: Removed PosixKillThread(), because it's not in the
2314         w32 api
2315
2316 2002-08-20  Dick Porter  <dick@ximian.com>
2317
2318         * handles.c (_wapi_handle_scratch_store): Made stored byte lengths
2319         multiples of 4 bytes, to keep header structures aligned.  Needed
2320         for sparc, at least. (Patch from crichton@gimp.org)
2321
2322         * handles.c: Removed 'disable_shm' variable (we've defaulted to
2323         building with shm enabled for months now)
2324
2325 2002-08-19  Dick Porter  <dick@ximian.com>
2326
2327         * daemon.c: Rewrote the poll() loop to use GIOChannels instead,
2328         for legacy NeXT-based systems.
2329
2330 2002-08-12  Dick Porter  <dick@ximian.com>
2331
2332         * atomic.h: Rename some parameters to avoid c++ keywords (Patch
2333         from Joseph Wenninger <kde@jowenn.at>)
2334
2335 2002-08-05  Dietmar Maurer  <dietmar@ximian.com>
2336
2337         * threads.c: use fast spinlocks by default
2338
2339 2002-08-02  Dick Porter  <dick@ximian.com>
2340
2341         * io.c (GetStdHandle): Add a handle reference when returning a
2342         duplicate console handle.  This fixes the unref_handle errors in
2343         NUnit.
2344
2345 2002-08-01  Dietmar Maurer  <dietmar@ximian.com>
2346
2347         * threads.c (TLS_PTHREAD_MUTEX): define this because else some
2348         tests does not work
2349
2350 2002-08-01  Dick Porter  <dick@ximian.com>
2351
2352         * threads.c: Use atomic spinlocks in TLS functions
2353
2354         * mono-spinlock.h:
2355         * Makefile.am: Added mono-spinlock.h
2356
2357 2002-07-21  Jeffrey Stedfast  <fejj@ximian.com>
2358
2359         * daemon-messages.c: #include <sys/types.h> and <sys/sockets.h> -
2360         these are needed for sendmsg() and also for struct msghdr (at
2361         least on Solaris). Solaris still won't build because struct msghdr
2362         doesn't have msg_flags, msg_control, or msg_controllen members.
2363         (CMSG_SPACE): Define for systems that don't have it.
2364         (CMSG_LEN): Same.
2365
2366 2002-07-20  Dick Porter  <dick@ximian.com>
2367
2368         * wapi-private.h:
2369         * io-private.h:
2370         * io.h:
2371         * io.c:
2372         * handles.c: Implemented pipe handles
2373         
2374         * handles.c:
2375         * daemon.c: Fixed bug in handle closing.
2376
2377         * shared.c:
2378         * daemon.c: Forked processes now close all open file descriptors.
2379
2380 Fri Jul 19 19:05:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
2381
2382         * sockets.h, io-layer.h, critical-sections.h: don't include config.h
2383         in header files.
2384
2385 2002-07-19  Martin Baulig  <martin@gnome.org>
2386
2387         * threads.c (ExitThread): Call exit() if no threads has been
2388         created yet.
2389
2390 2002-07-17  Dick Porter  <dick@ximian.com>
2391
2392         * daemon-messages.c: Freebsd fixes from Andreas Kohn
2393         <andreas.kohn@gmx.net>
2394
2395 2002-07-15  Dick Porter  <dick@ximian.com>
2396
2397         * io.c: Removed bogus console_flush() method, that was just cut
2398         and pasted from file_flush when I separated the two handle types.
2399
2400 2002-07-12  Dick Porter  <dick@ximian.com>
2401
2402         * io.c (convert_from_flags): Fixed misunderstanding wrt fcntl
2403         flags.  Fixes bug 27633.
2404
2405 2002-07-12  Dick Porter  <dick@ximian.com>
2406
2407         * wapi-private.h:
2408         * handles.c:
2409         * daemon.c: Use size of sockaddr_un.sun_path from config.h
2410
2411 2002-07-12  Dick Porter  <dick@ximian.com>
2412
2413         * processes.c (CreateProcess): Send stdin, stdout and stderr
2414         handles if the startup info doesnt specify new ones
2415
2416         * io.c (GetStdHandle): Return the same handle when the same
2417         standard handle is requested
2418
2419         * handles.c: Pass file descriptors when forking
2420
2421         * daemon.c: Use supplied file descriptors when forking a new
2422         process
2423
2424         * daemon-messages.h: 
2425         * daemon-messages.c: Pass stdin, stdout and stderr file
2426         descriptors to the daemon (used when forking)
2427
2428 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
2429
2430         * daemon.c (_wapi_daemon_main): Use sizeof
2431         (main_socket_address.sun_path) instead of hardcoded 108 value.
2432
2433         * handles.c (shared_init): Use sizeof
2434         (shared_socket_address.sun_path) instead of hardcoded 108 value.
2435
2436 2002-07-10  Dennis Haney  <davh@davh.dk>
2437
2438         * shared.c:
2439         * handles.c:
2440         * daemon.c: Lots of documentation, some added error checking, and
2441         code readability improvements.
2442
2443         * daemon-messages.h: Add the Error request type to improve error
2444         checking.
2445
2446         * daemon-messages.c: Do a bit more error checking on send() and
2447         recv(), and log errors with a higher severity level.
2448
2449 2002-07-04  Dick Porter  <dick@ximian.com>
2450
2451         * daemon.c (process_process_fork): Fix argument handling, due to
2452         buggy understanding of g_strsplit() behaviour.
2453
2454 2002-07-03  Dick Porter  <dick@ximian.com>
2455
2456         * threads.h:
2457         * threads.c: Implement OpenThread().  Define access-control values
2458         for thread handles.
2459
2460         * wapi.h:
2461         * processes.h:
2462         * access.h:
2463         * Makefile.am: Added access.h, to hold shared access-control
2464         definitions
2465
2466 2002-07-02  Dick Porter  <dick@ximian.com>
2467
2468         * wapi-private.h (_WAPI_HANDLE_VERSION): New protocol version
2469         
2470 2002-07-02  Dick Porter  <dick@ximian.com>
2471
2472         * handles.c (shared_init): Make a second attempt to contact the
2473         daemon if the shared memory attach succeeds, but the connect()
2474         fails. (This copes with the daemon crashing without cleaning up
2475         the shared memory.)
2476
2477         * Makefile.am: 
2478         * daemon-private.h:
2479         * daemon.c:
2480         * shared.c (_wapi_shm_attach): Don't exec() anything when we fork
2481         the daemon, it's now built into the library.
2482
2483 2002-06-25  Dick Porter  <dick@ximian.com>
2484
2485         * handles.c:
2486         * handles-private.h:
2487         * daemon-messages.h:
2488         * daemon.c: Process forking and handle data management
2489
2490         * processes.h:
2491         * process-private.h:
2492         * processes.c: Process forking and other support functions
2493
2494 2002-06-25  Dick Porter  <dick@ximian.com>
2495
2496         * versioninfo.h: PE resource decoding
2497
2498         * unicode.c (_wapi_unicode_to_utf8): g_utf16_to_utf8 doesnt need
2499         to be told the string length
2500
2501         * io.c: Removed the ACTUALLY_DO_UNICODE option.  Fixed some leaks.
2502         Moved _wapi_time_t_to_filetime and the WapiFileTime typedef to
2503         timefuncs.c
2504
2505 2002-06-12  Dick Porter  <dick@ximian.com>
2506
2507         * daemon.c: 
2508         * daemon-messages.c: Handle SIGPIPE in a non-stupid way in the
2509         daemon, if MSG_NOSIGNAL isn't available.  Thanks to Jaroslaw
2510         Kowalski <jarek@atm.com.pl> for pointing out the bogosity.
2511
2512 2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>
2513
2514         * sockets.c, daemon-messages.c: Prevent SIGPIPE from being raised
2515         when writing to a closed socket.
2516
2517 2002-06-08  Jeffrey Stedfast  <fejj@ximian.com>
2518
2519         * mono-mutex.c (mono_once): New convenience function for my
2520         previous fix.
2521
2522         * handles.c:
2523         * error.c: 
2524         * critical-sections.c: 
2525         * threads.c: 
2526         * sockets.c: 
2527         * semaphores.c: 
2528         * processes.c: 
2529         * mutexes.c: 
2530         * io.c: 
2531         * events.c: 
2532         * atomic.c: Use mono_once() rather than pthread_once().
2533
2534 2002-06-06  Jeffrey Stedfast  <fejj@ximian.com>
2535
2536         * handles.c (_wapi_handle_new): pthread_once() is not atomic, so
2537         if multiple threads all try to call _wapi_handle_new() before the
2538         shared data has been initialized, it is possible that we could get
2539         into a condition where shared_init() is being executed and later
2540         threads will pass by pthread_once() due to the fact that it has
2541         already been called and so therefor will attempt to use the shared
2542         data before it has been completely initialized. If we instead use
2543         a standard mutex locking mechanism around shared_init(), we can
2544         avoid the situation entirely. By wrapping the mutex locking in a
2545         check to see if we've already initialized the data, we can even
2546         avoid wasting resources by having to lock/unlock the mutex in any
2547         later calls (the only time we'd have to worry about
2548         locking/unlocking is the initial race to call shared_init() at
2549         startup).
2550
2551 Sat Jun 1 13:27:11 CEST 2002 Paolo Molaro <lupus@ximian.com>
2552
2553         * atomic.h: inline asm fixes from Dennis Haney (davh@davh.dk).
2554
2555 Fri May 31 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
2556
2557         * daemon.c, handles.c: rename "sun" local var since it's apparently
2558         a #define on Solaris.
2559
2560 Fri May 31 15:40:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
2561
2562         * daemon-messages.c: work-around MSG_NOSIGNAL missing on some
2563         platforms.
2564
2565 2002-05-15  Dick Porter  <dick@ximian.com>
2566
2567         * wait.c: Fix a deadlock in WaitForMultipleObjects
2568
2569 2002-05-14  Dick Porter  <dick@ximian.com>
2570
2571         * io.c: Fix a cut&paste error, found by
2572         Jaroslaw Kowalski <jarek@atm.com.pl>
2573
2574 2002-05-10  Dan Lewis  <dihlewis@yahoo.co.uk>
2575
2576         * io.c: Nasty typo.
2577
2578 2002-05-09  Dick Porter  <dick@ximian.com>
2579
2580         * threads.c: 
2581         * semaphores.c: 
2582         * processes.c: 
2583         * mutexes.c: 
2584         * handles-private.h: 
2585         * events.c: 
2586         * Makefile.am: Remove now-unused file wait-private.h
2587
2588 2002-05-08  Dick Porter  <dick@ximian.com>
2589
2590         * shared.c: Better error messages, and report when daemon
2591         connection fails rather than blocking forever.  Do some more
2592         shared memory sanity checking.
2593
2594         * handles.c: Better error messages when connecting to shared
2595         memory and the handle daemon.  Fall back to non-shared handles if
2596         an error occurs.  Set the default back to 'shared handles'.  Fix a
2597         crashing bug in scratch space allocation that mangled the block
2598         headers.
2599
2600 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
2601
2602         * handles.c (shared_init): Disable SHM for now, people have too
2603         many problems with this, and the diagnostics are not helping.
2604
2605 2002-05-06  Dan Lewis  <dihlewis@yahoo.co.uk>
2606
2607         * io.c: CreateFile sets win32 last error.
2608
2609 2002-05-05  Dick Porter  <dick@ximian.com>
2610
2611         * wapi-private.h: 
2612         * handles-private.h:
2613         * io.c: 
2614         * io-private.h:
2615         * mutexes.c: 
2616         * mutex-private.h: 
2617         * processes.c: 
2618         * process-private.h: 
2619         * semaphores.c: 
2620         * semaphore-private.h: 
2621         * sockets.c: 
2622         * socket-private.h: 
2623         * events.c: 
2624         * event-private.h: Simplify the WapiHandleOps struct: take out all
2625         the file-specific entries, leaving just the items that operate on
2626         handles themselves.  Split the close operation into shared and
2627         private parts: shared close is called by the daemon.
2628
2629         * handles.c: As above, but also pass handle allocation, ref and
2630         unref operations to the daemon.  Populate the handle_ops array at
2631         compile time, because the daemon needs to call ops on handles too.
2632         Don't bother to track open handle counts any more, the daemon does
2633         that.
2634         
2635         * threads.c: 
2636         * thread-private.h: As above, but also make the thread data
2637         handle-private.
2638
2639         * shared.c: Fork a handle daemon if the calling process created
2640         the shared memory segment.
2641
2642         * daemon.c:
2643         * daemon-messages.c:
2644         * daemon-messages.h:
2645         * Makefile.am: Build a daemon to manage handle allocation and
2646         destruction without needing to lock the shared memory
2647
2648 2002-04-30  Jeffrey Stedfast  <fejj@ximian.com>
2649
2650         * atomic.c: Changed to use a normal mutex rather than a spinlock
2651         since a lot of platforms seem to not have them :\
2652
2653 2002-04-30  Dick Porter  <dick@ximian.com>
2654
2655         * Completely rewrote the handle waiting code: removed the helper
2656         thread and its attendant complexity.  All handle waiting is now
2657         abstracted into the WaitForSingleObject() and
2658         WaitForMultipleObjects() functions.
2659
2660         * Implemented inter-process sharing of handles using sysv shared
2661         memory.  This makes handles even more opaque, with a handle now
2662         just an index into an array.
2663         
2664 2002-04-25  Dan Lewis  <dihlewis@yahoo.co.uk>
2665
2666         * io.c: unitialized pointer in GetCurrentDirectory.
2667
2668 Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
2669
2670         * threads.c: destroy the mutex at thread destruction
2671         (if/when thread destruction code will be actually called).
2672         When protecting a tls data pointer from the gc, use also the 
2673         thread id in the key.
2674         
2675 Wed Apr 17 18:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
2676
2677         * timed-thread.c: avoid race condition when setting the thread to
2678         detached.
2679
2680 2002-04-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2681
2682         * jit.h: to more #include lines to avoid breaking compilation
2683         under windows when upgrading mingw and w32api to version
2684         1.3 (thanks Dick!).
2685
2686 2002-04-16  Dick Porter  <dick@ximian.com>
2687
2688         * atomic.h: Explanatory comment about lack of 80386 support
2689
2690 2002-04-15  Dick Porter  <dick@ximian.com>
2691
2692         * atomic.h: use xaddl for InterlockedIncrement() and
2693         InterlockedDecrement().  Use cmpxchgl in a loop for
2694         InterlockedExchange() and InterlockedExchangePointer().
2695
2696 Mon Apr 15 13:31:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
2697
2698         * unicode.c: fix unicode_len() to not access uninitialized memory
2699         (and updated to conform to mono code style).
2700
2701 Fri Mar 29 17:15:11 CET 2002 Paolo Molaro <lupus@ximian.com>
2702
2703         * io.c: EEXISTS is ignored for directory creation.
2704         * mono-mutex.h: remove silly "pragma }" that emacs users insert
2705         because they use a broken editor:-)
2706
2707 2002-03-28  Dick Porter  <dick@ximian.com>
2708
2709         * sockets.h: 
2710         * sockets.c: 
2711         * io.c: 
2712         * handles.h: 
2713         * handles.c: Warning cleanups
2714
2715 2002-03-27  Dan Lewis <dihlewis@yahoo.co.uk>
2716
2717         * unicode.h, unicode.c: changed to gunichar2
2718         * io.h, io.c: changed strings to gunichar2*, added
2719         SetFileAttributes(), GetCurrentDirectory(), SetCurrentDirectory(),
2720         some fixes to FindFirstFile() and friends.
2721
2722 2002-03-26  Dick Porter  <dick@ximian.com>
2723
2724         * types.h: Implement the large integer struct
2725
2726         * timefuncs.h:
2727         * timefuncs.c: Dummy functions that don't yet implement
2728         QueryPerformanceCounter() and QueryPerformanceFrequency()
2729
2730         * threads.h:
2731         * threads.c: Implement SleepEx()
2732
2733         * system.h:
2734         * system.c: Beginnings of GetSystemInfo()
2735
2736         * mono-mutex.c (pthread_mutex_timedlock): Fix a ms/ns conversion
2737         thinko
2738
2739         * context.h:
2740         * context.c: Dummy function that doesnt yet implement
2741         GetThreadContext()
2742
2743         * atomic.h: 
2744         * atomic.c: Interlocked functions
2745
2746 Mon Mar 25 13:01:40 CET 2002 Paolo Molaro <lupus@ximian.com>
2747
2748         * threads.c: use a gc-safe hash table to store tls pointers.
2749
2750 2002-03-22  Dick Porter  <dick@ximian.com>
2751
2752         * threads.c: Fix a race condition where a thread can start and
2753         exit before the handle has been properly initialised (no reason
2754         why the handle couldn't be initialised beforehand, so do so)
2755
2756         Fix a ms to ns conversion magnitude thinko.
2757
2758 2002-03-21  Dick Porter  <dick@ximian.com>
2759
2760         * semaphores.c: Fix a problem when waiting for one or more
2761         semaphores, and another semaphore is Released (all waiting
2762         semaphores assumed they were signalled)
2763
2764 2002-03-29  Dan Lewis <dihlewis@yahoo.co.uk>
2765
2766         * io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory,
2767         RemoveDirectory, GetFileAttributes, GetFileAttributesEx
2768
2769 2002-03-19  Dietmar Maurer  <dietmar@ximian.com>
2770
2771         * threads.c (Sleep): bug fix: 1ms == 1000000ns
2772
2773 2002-03-19  Dan Lewis <dihlewis@yahoo.co.uk>
2774
2775         * io.h, io.c, events.c, mutexes.c, semaphores.c, sockets.c,
2776         threads.c, io.c: added flush method to handles.
2777
2778         * io.c: FlushFileBuffers() and FindFirstFile() functions.
2779
2780 Thu Mar 7 17:21:52 CET 2002 Paolo Molaro <lupus@ximian.com>
2781
2782         * threads.c, timed-thread.c, wait.c: Boehm-GC anable.
2783
2784 2002-02-20  Dick Porter  <dick@ximian.com>
2785
2786         * io-layer.h: Always build without cygwin support on windows
2787
2788 Mon Feb 18 15:50:59 CET 2002 Paolo Molaro <lupus@ximian.com>
2789
2790         * sockets.c: #undef DEBUG.
2791
2792 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
2793
2794         * io-layer.h: conditionally include sys/filio.h and sys/sockio.h
2795         for FIONBIO, FIONREAD, and SIOCATMARK.
2796
2797 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
2798
2799         * sockets.c: conditionally include sys/filio.h and sys/sockio.h
2800         for FIONBIO, FIONREAD, and SIOCATMARK.
2801
2802 2002-02-13  Dick Porter  <dick@ximian.com>
2803
2804         * sockets.c: Implement shutdown and select
2805
2806 2002-02-13  Jeffrey Stedfast  <fejj@ximian.com>
2807
2808         * mono-mutex.[c,h]: New source files that thinly wrap all pthread
2809         functions that take pthread_mutex_t and/or pthread_mutexattr_t
2810         arguments for the sake of portability. Implements recursive
2811         mutexes and pthread_mutex_timedlock.
2812
2813         * critical-sections.c:
2814         * events.c:
2815         * handles.c:
2816         * mutexes.c:
2817         * semaphores.c:
2818         * threads.c:
2819         * timed-thread.c:
2820         * wait.c: Use the mono-mutex wrapper portability functions/macros.
2821
2822         * pthread-compat.[c,h]: Replaced by mono-mutex.[c,h]
2823
2824 2002-01-23  Dick Porter  <dick@ximian.com>
2825
2826         * sockets.c: Networking support, mostly wrapping BSD socket APIs
2827         with handle code, and translating errno into w32 error codes.
2828
2829         * macros.h: Some w32 macros used with the socket support
2830
2831         * error.c: Implemented GetLastError() and SetLastError()
2832
2833         * Makefile.am: Added sockets, with kludge to override some symbols
2834
2835 2001-12-17  Dietmar Maurer  <dietmar@ximian.com>
2836
2837         * unicode.c (_wapi_unicode_to_utf8): byteswap UTF16 strings before
2838         passing them to iconv
2839         (_wapi_unicode_to_utf8): only swap bytes on LE systems, remove bug
2840         from previous commit.
2841
2842 2001-12-11  Dick Porter  <dick@ximian.com>
2843
2844         * io.c: Implement DeleteFile(), GetFileTime(), SetFileTime() and
2845         FileTimeToSystemTime().
2846
2847         * unicode.c (unicode_len): Nasty way of finding length of unicode
2848         string with embedded NULLs (counts until two NULLs together).
2849
2850         * mutexes.c (mutex_close): 
2851         * events.c (event_close): Release the internal pthreads resources
2852
2853 2001-11-26  Dick Porter  <dick@ximian.com>
2854
2855         * critical-sections.c:
2856         * events.c:
2857         * handles.c:
2858         * io.c:
2859         * mutexes.c:
2860         * semaphores.c:
2861         * threads.c:
2862         * timed-thread.c:
2863         * wait.c: turn off DEBUG messages
2864
2865 2001-11-22  Dick Porter  <dick@ximian.com>
2866
2867         * handles.c (SignalObjectAndWait): Implement
2868
2869         * wait.c (WaitForSingleObject): Fix case where timeout == 0
2870
2871         * threads.c:
2872         * semaphores.c:
2873         * mutexes.c:
2874         * io.c:
2875         * events.c: Support for SignalObjectAndWait
2876         
2877 2001-11-21  Dick Porter  <dick@ximian.com>
2878
2879         * events.c:
2880         * handles.c:
2881         * mutexes.c:
2882         * semaphores.c:
2883         * threads.c:
2884         * wait.c: Reliable method of returning which handle was signalled
2885         on return from WaitForMultipleObjects().
2886
2887 2001-11-21  Dick Porter  <dick@ximian.com>
2888
2889         * events.c: Implement events
2890
2891 2001-11-15  Dick Porter  <dick@ximian.com>
2892
2893         * mutexes.c: Implement mutexes
2894
2895         * threads.c: 
2896         * semaphores.c: 
2897         * misc.c: Factor out some common code
2898
2899 2001-11-13  Dick Porter  <dick@ximian.com>
2900
2901         * threads.c: Implement TLS.  Implement GetCurrentThreadId(), and
2902         GetCurrentThread() by maintaining a hash of thread handles.
2903
2904         * threads.h: Define thread and process creation flags
2905
2906 2001-11-12  Dick Porter  <dick@ximian.com>
2907
2908         * critical-sections.c: Implement critical sections
2909
2910 2001-11-12  Dick Porter  <dick@ximian.com>
2911
2912         * semaphores.c: Implement semaphores
2913
2914         * wait.c (wait_for_item): Maintain a wait count rather than count
2915         signalled booleans.
2916
2917         * threads.c (thread_wait_multiple): Don't lock the wait item, that
2918         will block other wait threads
2919
2920 2001-11-11  Dick Porter  <dick@ximian.com>
2921
2922         * Makefile.am: Rename some automake variables
2923         (from Nick Drochak <ndrochak@gol.com>)
2924
2925 2001-11-10  Dick Porter  <dick@ximian.com>
2926
2927         * Makefile.am (libwapiincludedir): Fix include destination
2928
2929         * .cvsignore: Ignore generated files
2930
2931 2001-11-10  Dietmar Maurer  <dietmar@ximian.com>
2932
2933         * pthread-compat.c: added some include files to make it compile on
2934         linux.
2935
2936 2001-11-08  Dick Porter  <dick@ximian.com>
2937
2938         * Initial checkin.
2939
2940         This is a library emulating the win32 threading and IO API.