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