2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mono / io-layer / ChangeLog
1 2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2
3         * system.c: check the number of online processors instead of the
4         existing ones. Sanitize return value if it's an error.
5
6 2004-10-03 Ben Maurer  <bmaurer@ximian.com>
7
8         * system.c: Add support for getting the # of cpus.
9
10 2004-09-28  Dick Porter  <dick@ximian.com>
11
12         * io.c (pipe_close_private): Fix one small typo in the last change
13         that totally hosed process creation with redirected pipes.
14
15 2004-09-24  Dick Porter  <dick@ximian.com>
16
17         * wapi-private.h: 
18         * sockets.c: 
19         * socket-private.h: 
20         * io.c: 
21         * io-private.h: 
22         * handles-private.h: Cope when a file descriptor is reused while
23         the handle that thought it owned it is still referenced, instead
24         of asserting.  Probably fixes bug 66479, though we've been unable
25         to reproduce it.
26
27 2004-09-09  Dick Porter  <dick@ximian.com>
28
29         * error.c:
30         * io.c: Set error codes everywhere.
31
32 2004-09-06  Dick Porter  <dick@ximian.com>
33
34         * handles.c (_wapi_handle_unref): Reset the private record's type
35         (CloseHandle): Check for a fd mapping failure, and return FALSE.
36         (_wapi_handle_process_fork): Fix long-standing bug in checking
37         handle return values.  Also do the required bookkeeping with the
38         new process's handles.
39
40         * daemon.c: When creating a new process's handles, check whether
41         the shared space needs to be increased
42
43 2004-09-05  Zoltan Varga  <vargaz@freemail.hu>
44
45         * shared.c (_wapi_shm_file): Fix leaking of filename.
46
47 2004-08-19  Dick Porter  <dick@ximian.com>
48
49         * handles.c (_wapi_handle_count_signalled_handles): Fix thinko
50         introduced with the fd offset stuff: unlock handles properly when
51         backing off.  Fixes the monologue hang at exit.
52
53 2004-08-18  Dick Porter  <dick@ximian.com>
54
55         * sockets.c: 
56         * io.c: Check that new fds fit in the table, return error if not
57
58         * daemon.c (_wapi_daemon_main): 
59         * handles.c (shared_init): Have all processes agree on a size for
60         the fd table.
61
62 2004-08-17  Dick Porter  <dick@ximian.com>
63
64         * daemon.c (process_new): 
65         * handles.c (_wapi_handle_new_internal): Cope when the space
66         reserved for file descriptors is larger than the shared segment
67         size.  Fixes the crash reported when running mono under gdb on
68         macosx.
69
70 2004-08-16  Dick Porter  <dick@ximian.com>
71
72         * sockets.c:
73         * io.c:
74         * handles-private.h (_wapi_handle_fd_offset_to_handle): Improve
75         error checking with passed-in file descriptors.
76
77 2004-08-11  Dick Porter  <dick@ximian.com>
78
79         * sockets.c: 
80         * io.c: Returned handle values are the file descriptor the handle
81         encapsulates
82
83         * handles.c: 
84         * handles-private.h: 
85         * daemon.c: Reserve the range of handles that can have the same
86         values as file descriptors.  These won't be used, but the values
87         will be used as file, console, pipe or socket handles.  The fd to
88         handle mapping is done internally and is invisible to users.
89         Fixes bug 61828.
90
91         * wapi-private.h (_WAPI_HANDLE_VERSION): Increment, because we now
92         reserve a chunk of handle space.
93
94 2004-08-04  Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
95
96         * atomic.h: add support for 64-bit S/390
97
98 2004-07-22  Dick Porter  <dick@ximian.com>
99
100         * timed-thread.c: 
101         * threads.c: Move the destruction of the internal thread data to
102         after the thread has been joined.  Fixes bug 61418.
103
104 2004-07-14  Dick Porter  <dick@ximian.com>
105
106         * wait.c (test_and_own): When not waiting for all handles to
107         become signalled, only own and return the lowest.  All the
108         documentation suggests that the old way was correct, but
109         experimentation shows it actually works like this.  Patch by
110         Sébastien Robitaille
111         (sebastien.robitaille@croesus.com), fixes bug 61511.
112
113 2004-07-09  Ben Maurer  <bmaurer@ximian.com>
114
115         * threads.c: register roots for gc
116
117 2004-07-08  Dick Porter  <dick@ximian.com>
118
119         * io.c (file_seek): If there is a high 32bit offset part, make
120         sure the low part isn't sign-extended.  Set error codes when
121         returning failure.  Fixes bug 61131.
122
123 2004-07-06  Dick Porter  <dick@ximian.com>
124
125         * io.c (file_setfiletime): Check for underflow when converting to
126         time_t values.  Set error codes when returning failure.  Fixes bug
127         60970.
128
129 2004-07-05  Dick Porter  <dick@ximian.com>
130
131         * mutexes.c (mutex_ops_init): Make the named mutex mutex sharable.
132
133         * daemon.c (unref_handle): Only destroy a handle if all processes
134         have released it, not just the current one.  Fixes bug 60887.
135
136 2004-06-30  Zoltan Varga  <vargaz@freemail.hu>
137
138         * mono-mutex.h atomic.h: Add G_GNUC_UNUSED to static inline functions
139         to prevent warnings.
140
141 2004-06-24  Dick Porter  <dick@ximian.com>
142
143         * mutexes.c: Indicate when a named mutex was reused
144
145 2004-06-24  Dick Porter  <dick@ximian.com>
146
147         * threads.c (SuspendThread): 
148         * timed-thread.c (_wapi_timed_thread_suspend): Wrap sem_wait in a
149         while loop.  See bug 58161.
150
151 Wed Jun 23 23:29:04 CEST 2004 Paolo Molaro <lupus@ximian.com>
152
153         * io.c: don't use sharemode for on-disk file permissions: it's used
154         for shared access to the open file.
155
156 2004-06-22  Dick Porter  <dick@ximian.com>
157
158         * events.c (CreateEvent): When creating an auto-reset event that
159         is initially owned, make sure the set count starts at 1.
160
161 2004-06-18  Dick Porter  <dick@ximian.com>
162
163         * event-private.h:
164         * events.c: Auto-reset events need to release one thread for each
165         time SetEvent() is called.  Fixes bug 41292.
166
167         * threads.h:
168         * mutex-private.h:
169         * mutexes.c: Scan for mutexes that are still locked by a thread
170         when it exits.  Fixes the MS demo app linked by bug 41292.
171
172         * wait.c (test_and_own): Make sure a handle is signalled before it
173         is owned.
174
175 2004-06-16  Dick Porter  <dick@ximian.com>
176
177         * timed-thread.c: Call the thread cleanup exit routine before taking
178         the join mutex, because this could deadlock if another thread tries
179         to join in the meantime.  This fixes the hang-at-exit problem seen
180         on macos.
181
182 2004-06-03  Lluis Sanchez Gual  <lluis@ximian.com>
183
184         * threads.c: Implemented SleepEx.
185         * threads.h: Fixed SleepEx signature.
186
187 2004-06-03  Miguel de Icaza  <miguel@ximian.com>
188
189         * threads.c: When running under valgrind, do not allocate too much
190         stack, as Valgrind default is 1 meg.
191
192 2004-05-27  Dick Porter  <dick@ximian.com>
193
194         * io.h:
195         * io.c: Implemented LockFile() and UnlockFile()
196
197 2004-05-21  Dick Porter  <dick@ximian.com>
198
199         * io.c (CreateFile): Check for existing share modes when opening
200         a file.
201
202         * handles.c: 
203         * handles-private.h: 
204         * daemon-messages.h: 
205         * daemon.c: Maintain a hash of file share modes, keying on device
206         and inode (to cope with symlinks.)
207
208 2004-05-20  Lluis Sanchez Gual  <lluis@ximian.com>
209
210         * daemon-messages.c: Retry if the communication with the daemon is
211           interrupted by a signal.
212         * io.c, sockets.c: Check for EINTR in every syscall that can be interrumped. 
213           Only return an error in this case if there is something in the apc queue
214           (which means that it is an interruption requested by the "user").
215         * processes.c: Use WaitForSingleObjectEx. No need to pass "alertable" as
216           true since the wait is small.
217         * shared.c: Retry write calls when interrumped by a signal.
218         * timed-thread.h, timed-thread.c: added _wapi_thread_apc_pending, which
219           returns TRUE if there are pending asynchronous calls (APC) for the
220           provided thread. Also added _wapi_thread_dispatch_apc_queue which calls
221           the enqueued APCs. Defined a new struct ApcInfo that holds information
222           about an enqueued APC.
223         * thread-private.h, threads.c: Implemented QueueUserAPC (which does the same
224           as in win32),_wapi_thread_apc_pending and _wapi_thread_dispatch_apc_queue. 
225           These last two methods call the corresponding apc methods in 
226           thread-private using the provided thread handle.
227         * threads.h: Added QueueUserAPC.
228         * uglify.h: Added WapiApcProc (needed by QueueUserAPC).
229         * wait.c, wait.h: Changed WaitForSingleObject to WaitForSingleObjectEx, and
230           WaitForMultipleObjects to WaitForMultipleObjectsEx. Implemented support
231           for APCs in those two methods and also in SleepEx.
232
233 2004-05-17  Dick Porter  <dick@ximian.com>
234
235         * io.c (CopyFile): Speed up.  Fixes bug 57859.
236
237 2004-05-13  Dick Porter  <dick@ximian.com>
238         * mono-mutex.c (mono_mutex_unlock): Return EPERM when the current
239         thread doesn't own the mutex, rather than assert()ing.
240
241 2004-05-11  Dick Porter  <dick@ximian.com>
242
243         * shared.c (_wapi_shm_attach): Cope when a previous daemon startup
244         attempt failed, leaving shared files that look like a daemon is
245         still starting.
246
247 2004-05-10  Gonzalo Paniagua Javier <gonzalo@ximian.com>
248
249         * io.c:
250         (SetFileAttributes): don't the the exec bit if the corresponding read
251         bit is not set.
252
253 2004-05-10  Zoltan Varga  <vargaz@freemail.hu>
254
255         * io.c (FindFirstFile): Fix invalid free.
256
257 2004-05-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
258
259         * io.c: translate from GFileError to errno codes and don't free
260         variables right after calling mono_io_scandir, as we may overwrite
261         errno value.
262
263 2004-05-08  Gonzalo Paniagua Javier <gonzalo@ximian.com>
264
265         * io.c: g_dir_open return ENOENT for directories on which we don't have
266         read/execute permission, while returning EPERM for anything below those.
267         So, change ENOENT by EPERM if the directory exists.
268
269 2004-05-07  Dick Porter  <dick@ximian.com>
270
271         * io.c (SetFileAttributes): Don't have failed chmod()s cause a
272         "file not found" error.  Fixes bug 54032.
273         
274 2004-05-07  Dick Porter  <dick@ximian.com>
275
276         * io.c (FindFirstFile): Comment out a windows-compatibility check
277         that breaks when directories have metachars in their names.
278         Workaround for bug 58116.
279
280 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
281
282         * io.c: fixed for FindFirstFile for empty directories. Closes
283         bug #58147.
284
285 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
286
287         * processes.c: set the start time for the current process. Fixes bug
288         #58109.
289
290 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
291
292         * io-private.h: 'namelist' is now a gchar ** in _WapiHandlePrivate_find.
293         * io.c: implemented scandir using glib functions.
294
295 2004-05-04  Dick Porter  <dick@ximian.com>
296
297         * daemon.c (read_message): Return FALSE on error so the GSource
298         callback itself can return FALSE.  Cures the infinite loop poll()
299         warning on MacosX.
300         * shared.c: Fix some daemon startup race conditions.
301
302 2004-04-29  Miguel de Icaza  <miguel@ximian.com>
303
304         * io.c (CopyFile): Use 32k buffers to copy the file instead of 2k,
305         use the stack, do not use dynamic memory.
306
307 2004-04-29  Zoltan Varga  <vargaz@freemail.hu>
308
309         * io.c: Add scandir implementation for platforms which do not have
310         it, like solaris.
311
312 2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
313
314         * io.[ch]: implemented GetLogicalDriveStrings.
315
316 2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
317
318         * io.c:
319         * sockets.c: use the field name from configure when accessing sigval
320         pointer field. Makes this work on the Mac.
321
322 2004-04-28  Bernie Solomon  <bernard@ugsolutions.com>
323
324         * atomic.c: (InterlockedExchange) fix typo for
325         mutex name
326
327 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
328
329         * io.c:
330         * sockets.c: added check for sys/aio.h.
331
332 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
333
334         * error.[ch]: added _wapi_get_win32_file_error...
335         * io.c: ... which was _wapi_get_win32_error here.
336         * sockets.c: rename the function calls here too.
337
338 2004-04-28  Dick Porter  <dick@ximian.com>
339
340         * daemon-messages.c: Avoid a deadlock when a thread is killed while
341         waiting for the daemon by using a recursive mutex.  Helps bug 56699.
342
343 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
344
345         * io.c: fixed leak in async_notifier().
346
347         * sockets.[ch]: added AIO support for sockets and fixed WSAIoctl
348         declaration.
349
350         * threads.c: removed old comment.
351
352 2004-04-26  David Waite  <mass@akuma.org>
353
354         * daemon-messages.h:
355         * daemon-private.h
356         * error.h:
357         * io.h:
358         * processes.h:
359         * shared.h:
360         * thread-private.h:
361         * wapi-private.h: remove comma from end of enumeration declarations
362         * status.h: cast unsigned int types to int for enum assignment
363
364 2004-04-26 David Waite <mass@akuma.org>
365
366         * io.c:
367         * timefuncs.c: declare 64-bit constants as long long types (i.e.
368         10ULL)
369
370 2004-04-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
371
372         * socket-wrappers.h: _wapi_socket == WSASocket now. Added
373         WSA_FLAG_OVERLAPPED.
374
375         * sockets.c: new unused parameters for _wapi_socket.
376
377 2004-04-22  Miguel de Icaza  <miguel@ximian.com>
378
379         * timed-thread.c: Replace sem_init with MONO_SEM_INIT to handle
380         the fact that MacOS X is a piece of junk (sem_init is *defined* in
381         the libc, but they return `not implemented'). 
382
383 2004-04-22  Dick Porter  <dick@ximian.com>
384
385         * handles.c: 
386         * handles-private.h: Reference the handle when it is locked, so
387         that another thread can't blow it away while we're waiting for it
388         to become signalled.
389         
390         * wait.c: 
391         * timed-thread.c: 
392         * threads.c: 
393         * sockets.c: 
394         * semaphores.c: 
395         * mutexes.c: 
396         * mono-mutex.c: 
397         * io.c: 
398         * handles.c: 
399         * handles-private.h: 
400         * events.c: 
401         * error.c: 
402         * daemon-messages.c: 
403         * critical-sections.c: 
404         * atomic.c: Added pthreads cleanup handlers and error asserts
405
406         * shared.c: 
407         * handles.c: Fixed the gcc "variable might be used uninitialised"
408         warnings.  They can't happen, but gcc doesn't know that
409         g_assert()s don't return.
410
411         Fixed the declaration of _wapi_handle_process_kill() so that it
412         expects the correct type for the pid.
413         
414         * threads.c: Removed the TLS_PTHREAD_MUTEX style locking that
415         hasn't been used in ages and just made the code more complex.
416
417 2004-04-17  Zoltan Varga  <vargaz@freemail.hu>
418
419         * processes.c: Include <signal.h> for SIGKILL and SIGILL + fix some
420         warnings. Fixes #57168.
421
422 2004-04-16  Dick Porter  <dick@ximian.com>
423
424         * threads.c (Sleep): Using div(3) with a negative (when signed)
425         numerator causes the quotient to be 0 and the remainder to be the
426         numerator.  This feeds a small negative value to nanosleep(3),
427         which will return immediately and cause a busy wait.  Fixes bug
428         56351.
429
430 2004-04-15  Dick Porter  <dick@ximian.com>
431
432         * io-private.h:
433         * io.c: Rewrite FindFirstFile and FindNextFile using scandir(3)
434         and fnmatch(3) instead of glob(3).  glob() can't cope with being
435         given filenames containing metachars.  This fixes bug 40557.
436
437 2004-04-14  Bernie Solomon  <bernard@ugsolutions.com>
438
439         * security.c: #warning is a GCC-ism
440
441 2004-04-13  Sebastien Pouliot  <sebastien@ximian.com>
442
443         * security.c: Removed GetUserName as glib g_get_user_name does a
444         better (portability) job. Added ImpersonateLoggedOnUser and
445         RevertToSelf.
446
447 2004-04-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
448
449         * mono-mutex.h: move pthread_mutex_timedlock declaration to...
450         * mono-mutex.c: ...here. It was causing a warning that prevented
451         libgdiplus compilation.
452
453 2004-04-04  Miguel de Icaza  <miguel@ximian.com>
454
455         * security.c (GetUserName): Make it work on MacOS X
456
457 2004-04-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
458
459         * security.c: use getpwuid_r if available. This one is thread-safe.
460
461 2004-04-02  Sebastien Pouliot  <sebastien@ximian.com>
462
463         * Makefile.am: Added security.c|h.
464         * security.c: New file for security related functions. Added function
465         GetUserName to fix #56144.
466         * security.h: New. Header file for security.c
467         * wapi.h: Added include for security.h
468
469 2004-03-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
470
471         * daemon-messages.h: added kill structs.
472
473         * daemon.c: implemented process_process_kill.
474         * handles-private.h:  define process_process_kill.
475         * handles.c: implemented _wapi_handle_process_kill.
476         * processes.[ch]: implemented TerminateProcess.
477
478 2004-03-25  Bernie Solomon  <bernard@ugsolutions.com>
479
480         * daemon.c (rem_fd): On solaris you seem to get an
481         error even after removing the input source so don't
482         try and rem_fd it twice.
483
484 2004-03-25  Lluis Sanchez Gual  <lluis@ximian.com>
485
486         * daemon.c: in process_post_mortem, If the child terminated due to the 
487         receipt of a signal, the exit status must be based on WTERMSIG, since 
488         WEXITSTATUS returns 0 in this case.
489
490 2004-03-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
491
492         * daemon.c: turned a warning into a DEBUG statement. Now we may hit it.
493
494 2004-03-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
495
496         * daemon.c: only call getdtablesize () once.
497         * processes.c: wait 500 ms to check if execve failed and throw the same
498         exception as MS on failure. Fixes bug #32809.
499
500 2004-03-17  Bernie Solomon  <bernard@ugsolutions.com>
501
502         * io.c (async_notifier): use "union sigval" rather
503         than sigval_t as Solaris doesn't have sigval_t
504         (which isn't in IEEE 1003.1 either).
505
506 2004-03-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
507
508         * io.c: added debug stuff and removed a few redundant lines in
509         file_write.
510
511 2004-03-15  Gonzalo Paniagua Javier <gonzalo@ximian.com>
512
513         * io-private.h: added new fields for file structure. Declare
514         _wapi_io_add_callback.
515
516         * io.c: added _wapi_get_win32_error, support aio_read/write in
517         file_read/write. Implemented _wapi_io_add_callback, which is where
518         BindHandle ends up.
519         
520         * io.h: added new fields for WapiOverlapped and typedef for the
521         callback.
522
523         * processes.c: fixed off-by-one bug when handling environment variables 
524         passed in.
525
526         * threads.[ch]: implemented BindIoCompletionCallback.
527
528         * uglify.h: added typedef for LPOVERLAPPED_COMPLETION_ROUTINE.
529
530 2004-03-14  Zoltan Varga  <vargaz@freemail.hu>
531
532         * socket-wrappers.h: Remove extra semicolon.
533
534 2004-03-03  Dave Camp  <dave@ximian.com>
535
536         * daemon.c: (add_fd), (fd_activity), (_wapi_daemon_main):
537         Use a new main context.
538
539 2004-03-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
540
541         * io.c:
542         (GetFileAttributes): set the error depending on errno instead of
543         setting ERROR_FILE_NOT_FOUND always. See bug #55160.
544
545 2004-03-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
546
547         * io.c:
548         (CopyFile): free the buffer on error.
549         * sockets.c:
550         (WSAIoctl): free the buffer on error.
551
552 2004-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
553
554         * error.c: fixed mapping for EPROTONOSUPPORT and ESOCKTNOSUPPORT.
555
556         * sockets.[ch]: retry creating the socket for AF_INET, SOCK_RAW
557         using IP protocol with IP over IP. Implemented WSAIoctl UNIX-style.
558
559 2004-01-27  Bernie Solomon  <bernard@ugsolutions.com>
560
561         * shared.c (_wapi_shm_file): add hostname
562         to shared data file names to handle NFS mounted
563         .wapi directories.
564
565 Mon Jan 26 16:15:03 CET 2004 Paolo Molaro <lupus@ximian.com>
566
567         * sockets.h: remove obsolete soklen_t typedef.
568
569 Fri Jan 23 21:07:02 CET 2004 Paolo Molaro <lupus@ximian.com>
570
571         * socket-wrappers.h, sockets.h, sockets.c, Makefile.am: move socket
572         wrappers to its own non-installed header file.
573
574 2004-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
575
576         * io.c:
577         (FindFirstFile): unlock the handle if FindNextFile fails.
578         (FindNextFile): g_free a couple of pointers before retrying.
579
580         * wait.c:
581         (WaitForMultipleObjects): if only one handle provided, use
582         WaitForSingleObject.
583
584 2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>
585
586         * handles-private.h: (_wapi_handle_type) check
587         for segment in range before using it
588
589 2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>
590
591         * thread-private.h: _wapi_thread_ops is now const
592         must match .c file.
593
594 Mon Dec 22 18:29:03 CET 2003 Paolo Molaro <lupus@ximian.com>
595
596         * threads.c, timed-thread.c, timed-thread.h: use mach
597         semaphores on Darwin (MacOSX) since the posix ones
598         are mostly broken there (threads are not created suspended
599         and they can start executing before they are fully initialized
600         like in tests/thread-static.cs).
601
602 Mon Dec 22 17:18:45 CET 2003 Paolo Molaro <lupus@ximian.com>
603
604         * atomic.h: ppc fixes.
605
606 2003-12-19  Bernie Solomon  <bernard@ugsolutions.com>
607
608         * handles.c: remove my bad use of MONO_ZERO_ARRAY_LENGTH
609         in HDRSIZE 
610
611 2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>
612
613         * shared.c: (_wapi_shm_open) make scratch file
614         not have to immediately regrow to avoid remaps
615         (HPUX can't cope with these).
616         (_wapi_shm_attach) use actual size of file
617         to set scratch data_len for the creating process.
618
619         * handles.c: (_wapi_handle_new_internal) make
620         sure mutex & cond var are initialized even for
621         non process shared ones. 
622         (_wapi_handle_unref) always call destroy 
623         routines on mutex & cond var
624
625 2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>
626
627         * daemon.c: change channel data structure so
628         input sources are removed from glib event loop
629         properly. xsp works better on Solaris and 
630         fixes #51278
631
632 2003-12-12  Bernie Solomon  <bernard@ugsolutions.com>
633
634         * wapi-private.h: Replace G_GNUC_PRETTY_FUNCTION
635         definition with file & line number for non-GCC
636         compiles.
637
638 2003-12-08  Bernie Solomon  <bernard@ugsolutions.com>
639
640         * Makefile.am: make sure hppa_atomic.s is in distribution
641
642 2003-12-01  Dick Porter  <dick@ximian.com>
643
644         * wapi-private.h: 
645         * mutexes.c (CreateMutex): 
646         * mutex-private.h (struct _WapiHandle_mutex): 
647         * handles.c: Look up certain handle types by name, in a shared
648         namespace.  Currently only mutex handles have this implemented.
649         Fixes bug 51089.
650
651         * semaphores.c (CreateSemaphore): 
652         * events.c (CreateEvent): Fix signature
653
654 2003-11-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
655
656         * io.c: don't call g_free before testing errno as it may modify it.
657         If the path exists, return an error if it's not a directory. Fixes
658         bug #50753.
659
660 2003-11-20  Dick Porter  <dick@ximian.com>
661
662         * io.c: Missed a little-endian UTF16 conversion.  Patch from
663         Jeroen Zwartepoorte (Jeroen@xs4all.nl), fixes bug 51065.
664
665 2003-10-29  Dick Porter  <dick@ximian.com>
666
667         * io.c (MoveFile): If the move crosses filesystems, try and fall
668         back to copy and delete.  Patch from Jörg Rosenkranz
669         (JoergR@voelcker.com), fixes bug 50298.
670
671 2003-10-28  Dick Porter  <dick@ximian.com>
672
673         * io.c: Use the new encoding conversion to cope with non-utf8
674         locales in filenames.
675
676         * processes.c: Ditto for process arguments.
677
678 Tue Oct 21 12:01:14 CEST 2003 Paolo Molaro <lupus@ximian.com>
679
680         * atomic.h: some ppc inline asm fixes (incorrect use of labels, 
681         incorrect register constraints, incorrect clobber lists).
682
683 2003-10-13  Bernie Solomon  <bernard@ugsolutions.com>
684
685         * Makefile.am hppa_atomic.s: add HP 64bit
686         implementation of atomic ops
687
688 2003-10-13  Zoltan Varga  <vargaz@freemail.hu>
689
690         * threads.c (CreateThread): Wrap pthread_attr_setstacksize call in
691         a conditional for platforms that don't have it.
692
693 2003-10-09  Bernie Solomon  <bernard@ugsolutions.com>
694
695         * threads.c: (CreateThread) use stacksize argument
696         if non-zero - change default for 64 bits to 4Mb
697
698 2003-09-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
699
700         * sockets.c: set last error when socket creation fails. This shed some
701         light on bug #49015.
702
703 2003-09-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
704
705         * processes.c: fixed bug #48973: we only change \ by / for the argument
706         to be used as command.
707         When getting the program name from the args, don't let the space between
708         them in the args.
709
710 2003-09-24  Bernie Solomon <bernard@ugsolutions.com>
711
712         * atomic.h atomic.c: fix sparc so lock is
713         global, increment does so and it compiles under Sun compiler.
714
715 2003-09-22  Bernie Solomon <bernard@ugsolutions.com>
716
717         * handles.c: include <string.h> directly as may
718         not be nested in <sys/un.h> like Linux
719
720 2003-09-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
721
722         * io.c:
723         (DeleteFile): call SetLastError on failure. Fix by
724         richard.torkar@htu.se (Richard Torkar). Closes bug #48222.
725
726 2003-09-15  Lluis Sanchez Gual  <lluis@ximian.com>
727
728         * daemon.c: In compare_process(), discard handles already signalled.
729
730 2003-09-02  Dick Porter  <dick@ximian.com>
731
732         * io.c: Work around glib brain-dead assumptions about utf8-encoded
733         filenames.  Fixes bug 30781.
734
735 2003-08-28  Dick Porter  <dick@ximian.com>
736
737         * critical-sections.c:  Patch from Bernie Solomon
738         <bernard@ugsolutions.com> to emit a warning if locking a critical
739         section fails.
740
741 2003-07-23  Dick Porter  <dick@ximian.com>
742
743         * shared.c:
744         * daemon.c (maybe_exit): Avoid the race condition when the daemon is
745         closing but another client comes along when the shared data is still
746         visible.  Should fix bugs 33671 and 35213.
747
748 2003-07-23  Dick Porter  <dick@ximian.com>
749
750         * handles.c:  Initialise handle mutex and cond.  Fix by
751         Bernie Solomon <bernard@ugsolutions.com>
752
753 2003-07-15  Dick Porter  <dick@ximian.com>
754
755         * timed-thread.c (timed_thread_start_routine): Fix virtual memory
756         leak when threads quit.  Fixes bug 44067.
757
758 Wed Jun 18 19:08:40 CEST 2003 Paolo Molaro <lupus@ximian.com>
759
760         * io.c: never add write permission for group or others in
761         SetFileAttributes ().
762
763 2003-06-17  Dick Porter  <dick@ximian.com>
764
765         * io.c (SetFileAttributes): Implement the ReadOnly attribute, and
766         ignore the unsupported ones ("fixes" bug 44977).
767
768 2003-06-17  Lluis Sanchez Gual  <lluis@ximian.com>
769
770         * misc.c: fix bug in _wapi_calc_timeout. It gave wrong values for
771           high ms values (there was an overflow).
772
773 2003-06-17  Zoltan Varga  <vargaz@freemail.hu>
774
775         * system.h (struct _WapiSystemInfo ): Fix warnings when using gcc-3.3.
776
777 2003-06-11  Dick Porter  <dick@ximian.com>
778
779         * shared.c: Fix shared directory creation.  Patch from
780         Pablo Baena <pbaena@uol.com.ar>
781
782 2003-06-10  Dick Porter  <dick@ximian.com>
783
784         * atomic.c: Delete the useless compile warning
785
786 2003-06-09  Dick Porter  <dick@ximian.com>
787
788         * daemon.c: Lookup env as a string array.  Fixes bug 44289.  Also
789         make setting the process handle value in the environment actually
790         work.
791
792         * processes.c: Pretty up the process name, if it happens to be
793         "mono" such as when another mono process forks "mono foo.exe"
794
795 2003-06-05  Dick Porter  <dick@ximian.com>
796
797         * processes.c (process_set_current): Don't do an expensive handle
798         search at application startup, check the environment to see if the
799         process handle has already been created.
800
801         * io.c: Don't do an expensive handle search when creating stdin,
802         stdout and stderr handles, just create them all the first time one
803         is requested.
804
805         * wapi-private.h:
806         * shared.c:
807         * shared.h:
808         * handles.c:
809         * handles-private.h:
810         * daemon-messages.h:
811         * daemon-private.h:
812         * daemon.c: Support for "unlimited" number of handles and scratch
813         data.
814
815         Speed up application startup by passing process handle in the
816         environment, rather than let the app scan all handles (which gets
817         really slow when there are more than a few thousand to check.)
818
819         Initialise some structs passed to syscalls, noticed by valgrind.
820         
821
822 2003-05-20  Dick Porter  <dick@ximian.com>
823
824         * io.c (FindFirstFile): Include . files in the glob.  Fixes bug
825         43229.
826
827 2003-05-19  Dick Porter  <dick@ximian.com>
828
829         * threads.c: Set the new thread's stack size to 2M.  Fix needed
830         for BSD, reported by Martin Dvorak <md@9ll.cz>
831
832 2003-05-16  Dick Porter  <dick@ximian.com>
833
834         * io.h:
835         * io.c: Implement GetTempPath()
836
837 2003-05-16  Dick Porter  <dick@ximian.com>
838
839         * processes.c (CreateProcess): Set some error codes
840
841 2003-05-12  Dick Porter  <dick@ximian.com>
842
843         * misc.c (_wapi_calc_timeout): Cope with overflowing tv_nsec.
844         Patch from Martin Dvorak <mdvorak@ninell.cz>.
845
846 2003-05-10  Dick Porter  <dick@ximian.com>
847
848         * io.c (CopyFile): Copy file mode as well as file data.  Based on
849         suggestion by Giuseppe Greco <giuseppe.greco@agamura.com>, bug
850         42706.
851
852 2003-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
853
854         * handles.c: don't call GC_gcollect when creating new handles.
855
856 2003-05-05  Gonzalo Paniagua Javier <gonzalo@ximian.com>
857
858         * handles.c: added some debugging code. Call GC_gcollect
859         before creating a new handle. It makes Lupus' test run smoother and
860         faster (from 62 to 83 request per second). Notice that calling
861         GC_finalizer_notifier if needed (GC_should_invoke_finalizer ()) does
862         not improve nor degrade the performance, so i don't do it.
863
864 2003-05-02  Dick Porter  <dick@ximian.com>
865
866         * sockets.c: Rearrange closesocket() and socket_close_private(),
867         and remember to unref the handle, so we don't leak socket handles.
868         Fix from Pelle Johnsen <pelle.johnsen@mail.dk>
869
870 2003-04-11  Dick Porter  <dick@ximian.com>
871
872         * atomic.h: ARM atomic operations by Malte Hildingson
873         <tds00mahi@tellus.thn.htu.se>
874
875 Tue Apr 8 11:37:29 CEST 2003 Paolo Molaro <lupus@ximian.com>
876
877         * atomic.h: fix macosx build by "Urs C. Muff" <umuff@quark.com>.
878
879 2003-04-03  Martin Baulig  <martin@ximian.com>
880
881         The following change is conditional to `WITH_INCLUDED_LIBGC'
882         which is not yet enabled by default.
883
884         * threads.c (SuspendThread, ResumeThread): Fully implemented this.
885         (gc_init): New static function; install a signal handler for
886         SIGPWR which is used to suspend threads.  [FIXME: it SIGPWR
887         doesn't exist on all Unix systems, we need to find another
888         signal].
889         (mono_wapi_push_thread_stack): New public function.  Tells the
890         garbage collector about the current stack pointer of a suspended
891         thread.
892
893 2003-04-03  Martin Baulig  <martin@ximian.com>
894
895         * timed-thread.h (TimedThread): Added `suspended_sem',
896         `suspend_count' and `stack_ptr'.
897
898 2003-03-28  Dick Porter  <dick@ximian.com>
899
900         * atomic.h: PPC support gratiously donated to the public domain
901         by John Duncan <jddst19@mac.com>
902
903 2003-03-20  Dick Porter  <dick@ximian.com>
904
905         * sockets.c (_wapi_connect): If connect() fails with EACCES, try
906         setting SO_BROADCAST and connecting again.  Fixes bug 39178.
907
908 2003-03-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
909
910         * processes.c: included Jerome Laban's patch and call SetLastError when
911         the executable is not found.
912
913 2003-03-03  Dick Porter  <dick@ximian.com>
914
915         * io.c (CreateFile): Try opening directories readonly, so that
916         timestamps can be adjusted.  Patch by Elan Feingold
917         <efeingold@mn.rr.com>.
918
919 2003-02-25  Dick Porter  <dick@ximian.com>
920
921         * shared.c (_wapi_shm_attach): Return a failure code on system
922         call errors, rather than exiting.
923
924 2003-02-21  Dick Porter  <dick@ximian.com>
925
926         * processes.c (GetCurrentProcessId): Use the current process
927         handle to return the process ID, as getpid() is unreliable
928         (linuxthreads gives each thread a different pid).  Fixes bug
929         37550.
930
931 2003-02-21  Dick Porter  <dick@ximian.com>
932
933         * io.c (FindNextFile): Skip over dangling symlinks.  Fixes bug
934         34076.
935
936 2003-02-11  Dick Porter  <dick@ximian.com>
937
938         * timefuncs.h: 
939         * timefuncs.c: Added GetTickCount()
940
941 2003-02-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
942
943         * error.c: added WSA_EHOSTUNREACH mapping.
944
945 2003-01-26  Miguel de Icaza  <miguel@ximian.com>
946
947         * io.c (SetFileAttributes): This routine is not currently
948         implemented for the general case, but I added a special case to
949         set the executable bit on Linux.
950
951 Wed Jan 15 15:55:40 CET 2003 Paolo Molaro <lupus@ximian.com>
952
953         * sockets.h, daemon.c, io.c: compilation fixes on MacOSX.
954
955 2003-01-08  Dick Porter  <dick@ximian.com>
956
957         * sockets.c: Fixed setting blocking mode to true (fixes bug 36388)
958
959 2002-12-11  Juli Mallett  <jmallett@FreeBSD.org>
960
961         * daemon.c, handles-private.h, handles.c, wapi-private.h:
962         Check for an implementation which says it supports
963         _POSIX_THREAD_PROCESS_SHARED, rather than just one that
964         defines the symbol.  Defined but with a value of -1 still
965         means that it is unsupported.
966
967 2002-12-08  Martin Baulig  <martin@ximian.com>
968
969         * handles.c (_wapi_handle_new): Create new non-shared handles with
970         an initial refcount of 1, not 0.
971
972 2002-11-22  Dietmar Maurer  <dietmar@ximian.com>
973
974         * threads.c (TlsGetValue): removed unnecessary mutex
975
976 2002-11-20  Dick Porter  <dick@ximian.com>
977
978         * timed-thread.c (_wapi_timed_thread_attach): Attached threads
979         need to store their data structure too.
980
981         * threads.c: Make sure the threading data is initialised wherever
982         it is needed
983
984 2002-11-15  Dick Porter  <dick@ximian.com>
985
986         * timed-thread.c: Removed unneeded parameters in
987         _wapi_timed_thread_attach().
988
989         * threads.c: Renamed AttachThread() to make it not look like
990         external API.  Removed unneeded parameters.
991
992 2002-11-11  Gonzalo Paniagua Javier <gonzalo@ximian.com>
993
994         * error.[ch]: added errno_to_WSA (). It displays a warning and return
995         WSASYSCALLFAILURE if there is no error mapping for the given errno,
996
997         * sockets.c: use errno_to_WSA and fixed display of warning for h_errno.
998
999 2002-10-31  Dick Porter  <dick@ximian.com>
1000
1001         * io.h: 
1002         * io.c: Define and use INVALID_FILE_ATTRIBUTES
1003
1004 2002-10-07  Dick Porter  <dick@ximian.com>
1005
1006         * timefuncs.c:
1007         * daemon.c: Use a more accurate time source for process start and
1008         end times.
1009
1010 2002-10-03  Dick Porter  <dick@ximian.com>
1011
1012         * daemon.c:
1013         * handles.c:
1014         * threads.c:  Fixes for freebsd.  Make sure that mutex and condition
1015         creation and deletion happen in the process that owns them, when
1016         POSIX shared thread objects aren't supported.  This breaks on
1017         freebsd, as pthread_t is a pointer to data.
1018
1019 2002-10-02  Dick Porter  <dick@ximian.com>
1020
1021         * shared.c: Use mmap() instead of sysv shm for the shared data.
1022
1023         * wapi-private.h (_WAPI_HANDLE_VERSION): Reset back to 0, for the
1024         new system
1025
1026         * daemon-private.h: 
1027         * daemon.c: mmap()ed regions survive fork, so just pass the
1028         pointer to _wapi_daemon_main instead of mapping it again.
1029
1030 2002-10-01  Dick Porter  <dick@ximian.com>
1031
1032         * timed-thread.c: Kludge for CREATE_SUSPENDED thread creation.
1033         Unfortunately libgc uses the same thread suspend technique that I
1034         want to, and the two don't mix: libgc will deadlock when it tries
1035         to stop the world if a thread has already been suspended by
1036         someone else.  Just do the simple suspended create rather than the
1037         general purpose thread suspension for now.
1038
1039         * threads.c: Pass create flags to the timed_thread create call, to
1040         implement suspended thread creation.  ResumeThread() partially
1041         implemented, to cope with the case where a newly created but
1042         suspended thread is launched.
1043
1044 2002-09-30  Dick Porter  <dick@ximian.com>
1045
1046         * sockets.c (ioctlsocket): Set non-blocking mode in a better way,
1047         with fcntl.
1048
1049 2002-09-27  Dick Porter  <dick@ximian.com>
1050
1051         * semaphores.c: Only include semaphore.h if it's present. Patch
1052         for BSD from jmmv@hispabsd.org (Julio Merino).
1053
1054 2002-09-27  Dick Porter  <dick@ximian.com>
1055
1056         * processes.c: Pass environment and working directory to the
1057         daemon when forking.  Don't let argv[0] be duplicated when looking
1058         for the program name.  Implement EnumProcessModules (simple
1059         version for now, lsof-style later if needed), GetModuleBaseName,
1060         {Get,Set}ProcessWorkingSetSize (just faked, because the vm hints
1061         aren't available on Linux).
1062
1063         * process-private.h: Store the process name, and the working set
1064         min and max
1065
1066         * handles.c:
1067         * handles-private.h: New functions to store and retrieve an array
1068         of strings in the scratch space
1069
1070         * daemon.c: Don't miss deleting some handles when a client exits
1071         (we used to rely on the client doing the final cleanup, but
1072         obviously if the client is no longer there the daemon has to do
1073         it).
1074
1075         Process forking now sets the environment and the working
1076         directory.
1077
1078         * io.c: Don't confuse fd 0 with an unassigned handle struct
1079
1080         * atomic.h: Add a google cache alternative to the msdn URL
1081
1082 2002-09-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1083
1084         * sockets.c:
1085         (_wapi_recvfrom): added ECONNRESET to the switch.
1086
1087 2002-09-24  Mark Crichton  <crichton@gimp.org>
1088
1089         * atomic.h: Yea.  On linux, sparc isn't sparc, it's __sparc__.
1090         Added to ifdef.
1091
1092 2002-09-19  Mark Crichton  <crichton@gimp.org>
1093
1094         * daemon.c, shared.c: Added NEED_LINK_UNLINK for systems that
1095         dont have Linux's abstract filesystem for sockets.
1096
1097 2002-09-19  Mark Crichton  <crichton@gimp.org>
1098
1099         * atomic.h: Added SPARC atomic asm code.
1100         * daemon.c, handles-private.h, handles.c, wapi-private.h:
1101         undefined _POSIX_THREAD_PROCESS_SHARED.  This actually exists on
1102         Solaris 9, however, the code paths don't seem to work.  More testing
1103         on the shared case is *really* needed.
1104
1105 2002-09-03  Dick Porter  <dick@ximian.com>
1106
1107         * threads.h: 
1108         * threads.c: Removed PosixKillThread(), because it's not in the
1109         w32 api
1110
1111 2002-08-20  Dick Porter  <dick@ximian.com>
1112
1113         * handles.c (_wapi_handle_scratch_store): Made stored byte lengths
1114         multiples of 4 bytes, to keep header structures aligned.  Needed
1115         for sparc, at least. (Patch from crichton@gimp.org)
1116
1117         * handles.c: Removed 'disable_shm' variable (we've defaulted to
1118         building with shm enabled for months now)
1119
1120 2002-08-19  Dick Porter  <dick@ximian.com>
1121
1122         * daemon.c: Rewrote the poll() loop to use GIOChannels instead,
1123         for legacy NeXT-based systems.
1124
1125 2002-08-12  Dick Porter  <dick@ximian.com>
1126
1127         * atomic.h: Rename some parameters to avoid c++ keywords (Patch
1128         from Joseph Wenninger <kde@jowenn.at>)
1129
1130 2002-08-05  Dietmar Maurer  <dietmar@ximian.com>
1131
1132         * threads.c: use fast spinlocks by default
1133
1134 2002-08-02  Dick Porter  <dick@ximian.com>
1135
1136         * io.c (GetStdHandle): Add a handle reference when returning a
1137         duplicate console handle.  This fixes the unref_handle errors in
1138         NUnit.
1139
1140 2002-08-01  Dietmar Maurer  <dietmar@ximian.com>
1141
1142         * threads.c (TLS_PTHREAD_MUTEX): define this because else some
1143         tests does not work
1144
1145 2002-08-01  Dick Porter  <dick@ximian.com>
1146
1147         * threads.c: Use atomic spinlocks in TLS functions
1148
1149         * mono-spinlock.h:
1150         * Makefile.am: Added mono-spinlock.h
1151
1152 2002-07-21  Jeffrey Stedfast  <fejj@ximian.com>
1153
1154         * daemon-messages.c: #include <sys/types.h> and <sys/sockets.h> -
1155         these are needed for sendmsg() and also for struct msghdr (at
1156         least on Solaris). Solaris still won't build because struct msghdr
1157         doesn't have msg_flags, msg_control, or msg_controllen members.
1158         (CMSG_SPACE): Define for systems that don't have it.
1159         (CMSG_LEN): Same.
1160
1161 2002-07-20  Dick Porter  <dick@ximian.com>
1162
1163         * wapi-private.h:
1164         * io-private.h:
1165         * io.h:
1166         * io.c:
1167         * handles.c: Implemented pipe handles
1168         
1169         * handles.c:
1170         * daemon.c: Fixed bug in handle closing.
1171
1172         * shared.c:
1173         * daemon.c: Forked processes now close all open file descriptors.
1174
1175 Fri Jul 19 19:05:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
1176
1177         * sockets.h, io-layer.h, critical-sections.h: don't include config.h
1178         in header files.
1179
1180 2002-07-19  Martin Baulig  <martin@gnome.org>
1181
1182         * threads.c (ExitThread): Call exit() if no threads has been
1183         created yet.
1184
1185 2002-07-17  Dick Porter  <dick@ximian.com>
1186
1187         * daemon-messages.c: Freebsd fixes from Andreas Kohn
1188         <andreas.kohn@gmx.net>
1189
1190 2002-07-15  Dick Porter  <dick@ximian.com>
1191
1192         * io.c: Removed bogus console_flush() method, that was just cut
1193         and pasted from file_flush when I separated the two handle types.
1194
1195 2002-07-12  Dick Porter  <dick@ximian.com>
1196
1197         * io.c (convert_from_flags): Fixed misunderstanding wrt fcntl
1198         flags.  Fixes bug 27633.
1199
1200 2002-07-12  Dick Porter  <dick@ximian.com>
1201
1202         * wapi-private.h:
1203         * handles.c:
1204         * daemon.c: Use size of sockaddr_un.sun_path from config.h
1205
1206 2002-07-12  Dick Porter  <dick@ximian.com>
1207
1208         * processes.c (CreateProcess): Send stdin, stdout and stderr
1209         handles if the startup info doesnt specify new ones
1210
1211         * io.c (GetStdHandle): Return the same handle when the same
1212         standard handle is requested
1213
1214         * handles.c: Pass file descriptors when forking
1215
1216         * daemon.c: Use supplied file descriptors when forking a new
1217         process
1218
1219         * daemon-messages.h: 
1220         * daemon-messages.c: Pass stdin, stdout and stderr file
1221         descriptors to the daemon (used when forking)
1222
1223 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
1224
1225         * daemon.c (_wapi_daemon_main): Use sizeof
1226         (main_socket_address.sun_path) instead of hardcoded 108 value.
1227
1228         * handles.c (shared_init): Use sizeof
1229         (shared_socket_address.sun_path) instead of hardcoded 108 value.
1230
1231 2002-07-10  Dennis Haney  <davh@davh.dk>
1232
1233         * shared.c:
1234         * handles.c:
1235         * daemon.c: Lots of documentation, some added error checking, and
1236         code readability improvements.
1237
1238         * daemon-messages.h: Add the Error request type to improve error
1239         checking.
1240
1241         * daemon-messages.c: Do a bit more error checking on send() and
1242         recv(), and log errors with a higher severity level.
1243
1244 2002-07-04  Dick Porter  <dick@ximian.com>
1245
1246         * daemon.c (process_process_fork): Fix argument handling, due to
1247         buggy understanding of g_strsplit() behaviour.
1248
1249 2002-07-03  Dick Porter  <dick@ximian.com>
1250
1251         * threads.h:
1252         * threads.c: Implement OpenThread().  Define access-control values
1253         for thread handles.
1254
1255         * wapi.h:
1256         * processes.h:
1257         * access.h:
1258         * Makefile.am: Added access.h, to hold shared access-control
1259         definitions
1260
1261 2002-07-02  Dick Porter  <dick@ximian.com>
1262
1263         * wapi-private.h (_WAPI_HANDLE_VERSION): New protocol version
1264         
1265 2002-07-02  Dick Porter  <dick@ximian.com>
1266
1267         * handles.c (shared_init): Make a second attempt to contact the
1268         daemon if the shared memory attach succeeds, but the connect()
1269         fails. (This copes with the daemon crashing without cleaning up
1270         the shared memory.)
1271
1272         * Makefile.am: 
1273         * daemon-private.h:
1274         * daemon.c:
1275         * shared.c (_wapi_shm_attach): Don't exec() anything when we fork
1276         the daemon, it's now built into the library.
1277
1278 2002-06-25  Dick Porter  <dick@ximian.com>
1279
1280         * handles.c:
1281         * handles-private.h:
1282         * daemon-messages.h:
1283         * daemon.c: Process forking and handle data management
1284
1285         * processes.h:
1286         * process-private.h:
1287         * processes.c: Process forking and other support functions
1288
1289 2002-06-25  Dick Porter  <dick@ximian.com>
1290
1291         * versioninfo.h: PE resource decoding
1292
1293         * unicode.c (_wapi_unicode_to_utf8): g_utf16_to_utf8 doesnt need
1294         to be told the string length
1295
1296         * io.c: Removed the ACTUALLY_DO_UNICODE option.  Fixed some leaks.
1297         Moved _wapi_time_t_to_filetime and the WapiFileTime typedef to
1298         timefuncs.c
1299
1300 2002-06-12  Dick Porter  <dick@ximian.com>
1301
1302         * daemon.c: 
1303         * daemon-messages.c: Handle SIGPIPE in a non-stupid way in the
1304         daemon, if MSG_NOSIGNAL isn't available.  Thanks to Jaroslaw
1305         Kowalski <jarek@atm.com.pl> for pointing out the bogosity.
1306
1307 2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>
1308
1309         * sockets.c, daemon-messages.c: Prevent SIGPIPE from being raised
1310         when writing to a closed socket.
1311
1312 2002-06-08  Jeffrey Stedfast  <fejj@ximian.com>
1313
1314         * mono-mutex.c (mono_once): New convenience function for my
1315         previous fix.
1316
1317         * handles.c:
1318         * error.c: 
1319         * critical-sections.c: 
1320         * threads.c: 
1321         * sockets.c: 
1322         * semaphores.c: 
1323         * processes.c: 
1324         * mutexes.c: 
1325         * io.c: 
1326         * events.c: 
1327         * atomic.c: Use mono_once() rather than pthread_once().
1328
1329 2002-06-06  Jeffrey Stedfast  <fejj@ximian.com>
1330
1331         * handles.c (_wapi_handle_new): pthread_once() is not atomic, so
1332         if multiple threads all try to call _wapi_handle_new() before the
1333         shared data has been initialized, it is possible that we could get
1334         into a condition where shared_init() is being executed and later
1335         threads will pass by pthread_once() due to the fact that it has
1336         already been called and so therefor will attempt to use the shared
1337         data before it has been completely initialized. If we instead use
1338         a standard mutex locking mechanism around shared_init(), we can
1339         avoid the situation entirely. By wrapping the mutex locking in a
1340         check to see if we've already initialized the data, we can even
1341         avoid wasting resources by having to lock/unlock the mutex in any
1342         later calls (the only time we'd have to worry about
1343         locking/unlocking is the initial race to call shared_init() at
1344         startup).
1345
1346 Sat Jun 1 13:27:11 CEST 2002 Paolo Molaro <lupus@ximian.com>
1347
1348         * atomic.h: inline asm fixes from Dennis Haney (davh@davh.dk).
1349
1350 Fri May 31 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
1351
1352         * daemon.c, handles.c: rename "sun" local var since it's apparently
1353         a #define on Solaris.
1354
1355 Fri May 31 15:40:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
1356
1357         * daemon-messages.c: work-around MSG_NOSIGNAL missing on some
1358         platforms.
1359
1360 2002-05-15  Dick Porter  <dick@ximian.com>
1361
1362         * wait.c: Fix a deadlock in WaitForMultipleObjects
1363
1364 2002-05-14  Dick Porter  <dick@ximian.com>
1365
1366         * io.c: Fix a cut&paste error, found by
1367         Jaroslaw Kowalski <jarek@atm.com.pl>
1368
1369 2002-05-10  Dan Lewis  <dihlewis@yahoo.co.uk>
1370
1371         * io.c: Nasty typo.
1372
1373 2002-05-09  Dick Porter  <dick@ximian.com>
1374
1375         * threads.c: 
1376         * semaphores.c: 
1377         * processes.c: 
1378         * mutexes.c: 
1379         * handles-private.h: 
1380         * events.c: 
1381         * Makefile.am: Remove now-unused file wait-private.h
1382
1383 2002-05-08  Dick Porter  <dick@ximian.com>
1384
1385         * shared.c: Better error messages, and report when daemon
1386         connection fails rather than blocking forever.  Do some more
1387         shared memory sanity checking.
1388
1389         * handles.c: Better error messages when connecting to shared
1390         memory and the handle daemon.  Fall back to non-shared handles if
1391         an error occurs.  Set the default back to 'shared handles'.  Fix a
1392         crashing bug in scratch space allocation that mangled the block
1393         headers.
1394
1395 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
1396
1397         * handles.c (shared_init): Disable SHM for now, people have too
1398         many problems with this, and the diagnostics are not helping.
1399
1400 2002-05-06  Dan Lewis  <dihlewis@yahoo.co.uk>
1401
1402         * io.c: CreateFile sets win32 last error.
1403
1404 2002-05-05  Dick Porter  <dick@ximian.com>
1405
1406         * wapi-private.h: 
1407         * handles-private.h:
1408         * io.c: 
1409         * io-private.h:
1410         * mutexes.c: 
1411         * mutex-private.h: 
1412         * processes.c: 
1413         * process-private.h: 
1414         * semaphores.c: 
1415         * semaphore-private.h: 
1416         * sockets.c: 
1417         * socket-private.h: 
1418         * events.c: 
1419         * event-private.h: Simplify the WapiHandleOps struct: take out all
1420         the file-specific entries, leaving just the items that operate on
1421         handles themselves.  Split the close operation into shared and
1422         private parts: shared close is called by the daemon.
1423
1424         * handles.c: As above, but also pass handle allocation, ref and
1425         unref operations to the daemon.  Populate the handle_ops array at
1426         compile time, because the daemon needs to call ops on handles too.
1427         Don't bother to track open handle counts any more, the daemon does
1428         that.
1429         
1430         * threads.c: 
1431         * thread-private.h: As above, but also make the thread data
1432         handle-private.
1433
1434         * shared.c: Fork a handle daemon if the calling process created
1435         the shared memory segment.
1436
1437         * daemon.c:
1438         * daemon-messages.c:
1439         * daemon-messages.h:
1440         * Makefile.am: Build a daemon to manage handle allocation and
1441         destruction without needing to lock the shared memory
1442
1443 2002-04-30  Jeffrey Stedfast  <fejj@ximian.com>
1444
1445         * atomic.c: Changed to use a normal mutex rather than a spinlock
1446         since a lot of platforms seem to not have them :\
1447
1448 2002-04-30  Dick Porter  <dick@ximian.com>
1449
1450         * Completely rewrote the handle waiting code: removed the helper
1451         thread and its attendant complexity.  All handle waiting is now
1452         abstracted into the WaitForSingleObject() and
1453         WaitForMultipleObjects() functions.
1454
1455         * Implemented inter-process sharing of handles using sysv shared
1456         memory.  This makes handles even more opaque, with a handle now
1457         just an index into an array.
1458         
1459 2002-04-25  Dan Lewis  <dihlewis@yahoo.co.uk>
1460
1461         * io.c: unitialized pointer in GetCurrentDirectory.
1462
1463 Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
1464
1465         * threads.c: destroy the mutex at thread destruction
1466         (if/when thread destruction code will be actually called).
1467         When protecting a tls data pointer from the gc, use also the 
1468         thread id in the key.
1469         
1470 Wed Apr 17 18:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
1471
1472         * timed-thread.c: avoid race condition when setting the thread to
1473         detached.
1474
1475 2002-04-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
1476
1477         * jit.h: to more #include lines to avoid breaking compilation
1478         under windows when upgrading mingw and w32api to version
1479         1.3 (thanks Dick!).
1480
1481 2002-04-16  Dick Porter  <dick@ximian.com>
1482
1483         * atomic.h: Explanatory comment about lack of 80386 support
1484
1485 2002-04-15  Dick Porter  <dick@ximian.com>
1486
1487         * atomic.h: use xaddl for InterlockedIncrement() and
1488         InterlockedDecrement().  Use cmpxchgl in a loop for
1489         InterlockedExchange() and InterlockedExchangePointer().
1490
1491 Mon Apr 15 13:31:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
1492
1493         * unicode.c: fix unicode_len() to not access uninitialized memory
1494         (and updated to conform to mono code style).
1495
1496 Fri Mar 29 17:15:11 CET 2002 Paolo Molaro <lupus@ximian.com>
1497
1498         * io.c: EEXISTS is ignored for directory creation.
1499         * mono-mutex.h: remove silly "pragma }" that emacs users insert
1500         because they use a broken editor:-)
1501
1502 2002-03-28  Dick Porter  <dick@ximian.com>
1503
1504         * sockets.h: 
1505         * sockets.c: 
1506         * io.c: 
1507         * handles.h: 
1508         * handles.c: Warning cleanups
1509
1510 2002-03-27  Dan Lewis <dihlewis@yahoo.co.uk>
1511
1512         * unicode.h, unicode.c: changed to gunichar2
1513         * io.h, io.c: changed strings to gunichar2*, added
1514         SetFileAttributes(), GetCurrentDirectory(), SetCurrentDirectory(),
1515         some fixes to FindFirstFile() and friends.
1516
1517 2002-03-26  Dick Porter  <dick@ximian.com>
1518
1519         * types.h: Implement the large integer struct
1520
1521         * timefuncs.h:
1522         * timefuncs.c: Dummy functions that don't yet implement
1523         QueryPerformanceCounter() and QueryPerformanceFrequency()
1524
1525         * threads.h:
1526         * threads.c: Implement SleepEx()
1527
1528         * system.h:
1529         * system.c: Beginnings of GetSystemInfo()
1530
1531         * mono-mutex.c (pthread_mutex_timedlock): Fix a ms/ns conversion
1532         thinko
1533
1534         * context.h:
1535         * context.c: Dummy function that doesnt yet implement
1536         GetThreadContext()
1537
1538         * atomic.h: 
1539         * atomic.c: Interlocked functions
1540
1541 Mon Mar 25 13:01:40 CET 2002 Paolo Molaro <lupus@ximian.com>
1542
1543         * threads.c: use a gc-safe hash table to store tls pointers.
1544
1545 2002-03-22  Dick Porter  <dick@ximian.com>
1546
1547         * threads.c: Fix a race condition where a thread can start and
1548         exit before the handle has been properly initialised (no reason
1549         why the handle couldn't be initialised beforehand, so do so)
1550
1551         Fix a ms to ns conversion magnitude thinko.
1552
1553 2002-03-21  Dick Porter  <dick@ximian.com>
1554
1555         * semaphores.c: Fix a problem when waiting for one or more
1556         semaphores, and another semaphore is Released (all waiting
1557         semaphores assumed they were signalled)
1558
1559 2002-03-29  Dan Lewis <dihlewis@yahoo.co.uk>
1560
1561         * io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory,
1562         RemoveDirectory, GetFileAttributes, GetFileAttributesEx
1563
1564 2002-03-19  Dietmar Maurer  <dietmar@ximian.com>
1565
1566         * threads.c (Sleep): bug fix: 1ms == 1000000ns
1567
1568 2002-03-19  Dan Lewis <dihlewis@yahoo.co.uk>
1569
1570         * io.h, io.c, events.c, mutexes.c, semaphores.c, sockets.c,
1571         threads.c, io.c: added flush method to handles.
1572
1573         * io.c: FlushFileBuffers() and FindFirstFile() functions.
1574
1575 Thu Mar 7 17:21:52 CET 2002 Paolo Molaro <lupus@ximian.com>
1576
1577         * threads.c, timed-thread.c, wait.c: Boehm-GC anable.
1578
1579 2002-02-20  Dick Porter  <dick@ximian.com>
1580
1581         * io-layer.h: Always build without cygwin support on windows
1582
1583 Mon Feb 18 15:50:59 CET 2002 Paolo Molaro <lupus@ximian.com>
1584
1585         * sockets.c: #undef DEBUG.
1586
1587 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
1588
1589         * io-layer.h: conditionally include sys/filio.h and sys/sockio.h
1590         for FIONBIO, FIONREAD, and SIOCATMARK.
1591
1592 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
1593
1594         * sockets.c: conditionally include sys/filio.h and sys/sockio.h
1595         for FIONBIO, FIONREAD, and SIOCATMARK.
1596
1597 2002-02-13  Dick Porter  <dick@ximian.com>
1598
1599         * sockets.c: Implement shutdown and select
1600
1601 2002-02-13  Jeffrey Stedfast  <fejj@ximian.com>
1602
1603         * mono-mutex.[c,h]: New source files that thinly wrap all pthread
1604         functions that take pthread_mutex_t and/or pthread_mutexattr_t
1605         arguments for the sake of portability. Implements recursive
1606         mutexes and pthread_mutex_timedlock.
1607
1608         * critical-sections.c:
1609         * events.c:
1610         * handles.c:
1611         * mutexes.c:
1612         * semaphores.c:
1613         * threads.c:
1614         * timed-thread.c:
1615         * wait.c: Use the mono-mutex wrapper portability functions/macros.
1616
1617         * pthread-compat.[c,h]: Replaced by mono-mutex.[c,h]
1618
1619 2002-01-23  Dick Porter  <dick@ximian.com>
1620
1621         * sockets.c: Networking support, mostly wrapping BSD socket APIs
1622         with handle code, and translating errno into w32 error codes.
1623
1624         * macros.h: Some w32 macros used with the socket support
1625
1626         * error.c: Implemented GetLastError() and SetLastError()
1627
1628         * Makefile.am: Added sockets, with kludge to override some symbols
1629
1630 2001-12-17  Dietmar Maurer  <dietmar@ximian.com>
1631
1632         * unicode.c (_wapi_unicode_to_utf8): byteswap UTF16 strings before
1633         passing them to iconv
1634         (_wapi_unicode_to_utf8): only swap bytes on LE systems, remove bug
1635         from previous commit.
1636
1637 2001-12-11  Dick Porter  <dick@ximian.com>
1638
1639         * io.c: Implement DeleteFile(), GetFileTime(), SetFileTime() and
1640         FileTimeToSystemTime().
1641
1642         * unicode.c (unicode_len): Nasty way of finding length of unicode
1643         string with embedded NULLs (counts until two NULLs together).
1644
1645         * mutexes.c (mutex_close): 
1646         * events.c (event_close): Release the internal pthreads resources
1647
1648 2001-11-26  Dick Porter  <dick@ximian.com>
1649
1650         * critical-sections.c:
1651         * events.c:
1652         * handles.c:
1653         * io.c:
1654         * mutexes.c:
1655         * semaphores.c:
1656         * threads.c:
1657         * timed-thread.c:
1658         * wait.c: turn off DEBUG messages
1659
1660 2001-11-22  Dick Porter  <dick@ximian.com>
1661
1662         * handles.c (SignalObjectAndWait): Implement
1663
1664         * wait.c (WaitForSingleObject): Fix case where timeout == 0
1665
1666         * threads.c:
1667         * semaphores.c:
1668         * mutexes.c:
1669         * io.c:
1670         * events.c: Support for SignalObjectAndWait
1671         
1672 2001-11-21  Dick Porter  <dick@ximian.com>
1673
1674         * events.c:
1675         * handles.c:
1676         * mutexes.c:
1677         * semaphores.c:
1678         * threads.c:
1679         * wait.c: Reliable method of returning which handle was signalled
1680         on return from WaitForMultipleObjects().
1681
1682 2001-11-21  Dick Porter  <dick@ximian.com>
1683
1684         * events.c: Implement events
1685
1686 2001-11-15  Dick Porter  <dick@ximian.com>
1687
1688         * mutexes.c: Implement mutexes
1689
1690         * threads.c: 
1691         * semaphores.c: 
1692         * misc.c: Factor out some common code
1693
1694 2001-11-13  Dick Porter  <dick@ximian.com>
1695
1696         * threads.c: Implement TLS.  Implement GetCurrentThreadId(), and
1697         GetCurrentThread() by maintaining a hash of thread handles.
1698
1699         * threads.h: Define thread and process creation flags
1700
1701 2001-11-12  Dick Porter  <dick@ximian.com>
1702
1703         * critical-sections.c: Implement critical sections
1704
1705 2001-11-12  Dick Porter  <dick@ximian.com>
1706
1707         * semaphores.c: Implement semaphores
1708
1709         * wait.c (wait_for_item): Maintain a wait count rather than count
1710         signalled booleans.
1711
1712         * threads.c (thread_wait_multiple): Don't lock the wait item, that
1713         will block other wait threads
1714
1715 2001-11-11  Dick Porter  <dick@ximian.com>
1716
1717         * Makefile.am: Rename some automake variables
1718         (from Nick Drochak <ndrochak@gol.com>)
1719
1720 2001-11-10  Dick Porter  <dick@ximian.com>
1721
1722         * Makefile.am (libwapiincludedir): Fix include destination
1723
1724         * .cvsignore: Ignore generated files
1725
1726 2001-11-10  Dietmar Maurer  <dietmar@ximian.com>
1727
1728         * pthread-compat.c: added some include files to make it compile on
1729         linux.
1730
1731 2001-11-08  Dick Porter  <dick@ximian.com>
1732
1733         * Initial checkin.
1734
1735         This is a library emulating the win32 threading and IO API.