More Solaris/BSD fixes. This now allows shared handles to work on BSD
[mono.git] / mono / io-layer / ChangeLog
1 2002-09-19  Mark Crichton  <crichton@gimp.org>
2
3         * daemon.c, shared.c: Added NEED_LINK_UNLINK for systems that
4         dont have Linux's abstract filesystem for sockets.
5
6 2002-09-19  Mark Crichton  <crichton@gimp.org>
7
8         * atomic.h: Added SPARC atomic asm code.
9         * daemon.c, handles-private.h, handles.c, wapi-private.h:
10         undefined _POSIX_THREAD_PROCESS_SHARED.  This actually exists on
11         Solaris 9, however, the code paths don't seem to work.  More testing
12         on the shared case is *really* needed.
13
14 2002-09-03  Dick Porter  <dick@ximian.com>
15
16         * threads.h: 
17         * threads.c: Removed PosixKillThread(), because it's not in the
18         w32 api
19
20 2002-08-20  Dick Porter  <dick@ximian.com>
21
22         * handles.c (_wapi_handle_scratch_store): Made stored byte lengths
23         multiples of 4 bytes, to keep header structures aligned.  Needed
24         for sparc, at least. (Patch from crichton@gimp.org)
25
26         * handles.c: Removed 'disable_shm' variable (we've defaulted to
27         building with shm enabled for months now)
28
29 2002-08-19  Dick Porter  <dick@ximian.com>
30
31         * daemon.c: Rewrote the poll() loop to use GIOChannels instead,
32         for legacy NeXT-based systems.
33
34 2002-08-12  Dick Porter  <dick@ximian.com>
35
36         * atomic.h: Rename some parameters to avoid c++ keywords (Patch
37         from Joseph Wenninger <kde@jowenn.at>)
38
39 2002-08-05  Dietmar Maurer  <dietmar@ximian.com>
40
41         * threads.c: use fast spinlocks by default
42
43 2002-08-02  Dick Porter  <dick@ximian.com>
44
45         * io.c (GetStdHandle): Add a handle reference when returning a
46         duplicate console handle.  This fixes the unref_handle errors in
47         NUnit.
48
49 2002-08-01  Dietmar Maurer  <dietmar@ximian.com>
50
51         * threads.c (TLS_PTHREAD_MUTEX): define this because else some
52         tests does not work
53
54 2002-08-01  Dick Porter  <dick@ximian.com>
55
56         * threads.c: Use atomic spinlocks in TLS functions
57
58         * mono-spinlock.h:
59         * Makefile.am: Added mono-spinlock.h
60
61 2002-07-21  Jeffrey Stedfast  <fejj@ximian.com>
62
63         * daemon-messages.c: #include <sys/types.h> and <sys/sockets.h> -
64         these are needed for sendmsg() and also for struct msghdr (at
65         least on Solaris). Solaris still won't build because struct msghdr
66         doesn't have msg_flags, msg_control, or msg_controllen members.
67         (CMSG_SPACE): Define for systems that don't have it.
68         (CMSG_LEN): Same.
69
70 2002-07-20  Dick Porter  <dick@ximian.com>
71
72         * wapi-private.h:
73         * io-private.h:
74         * io.h:
75         * io.c:
76         * handles.c: Implemented pipe handles
77         
78         * handles.c:
79         * daemon.c: Fixed bug in handle closing.
80
81         * shared.c:
82         * daemon.c: Forked processes now close all open file descriptors.
83
84 Fri Jul 19 19:05:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
85
86         * sockets.h, io-layer.h, critical-sections.h: don't include config.h
87         in header files.
88
89 2002-07-19  Martin Baulig  <martin@gnome.org>
90
91         * threads.c (ExitThread): Call exit() if no threads has been
92         created yet.
93
94 2002-07-17  Dick Porter  <dick@ximian.com>
95
96         * daemon-messages.c: Freebsd fixes from Andreas Kohn
97         <andreas.kohn@gmx.net>
98
99 2002-07-15  Dick Porter  <dick@ximian.com>
100
101         * io.c: Removed bogus console_flush() method, that was just cut
102         and pasted from file_flush when I separated the two handle types.
103
104 2002-07-12  Dick Porter  <dick@ximian.com>
105
106         * io.c (convert_from_flags): Fixed misunderstanding wrt fcntl
107         flags.  Fixes bug 27633.
108
109 2002-07-12  Dick Porter  <dick@ximian.com>
110
111         * wapi-private.h:
112         * handles.c:
113         * daemon.c: Use size of sockaddr_un.sun_path from config.h
114
115 2002-07-12  Dick Porter  <dick@ximian.com>
116
117         * processes.c (CreateProcess): Send stdin, stdout and stderr
118         handles if the startup info doesnt specify new ones
119
120         * io.c (GetStdHandle): Return the same handle when the same
121         standard handle is requested
122
123         * handles.c: Pass file descriptors when forking
124
125         * daemon.c: Use supplied file descriptors when forking a new
126         process
127
128         * daemon-messages.h: 
129         * daemon-messages.c: Pass stdin, stdout and stderr file
130         descriptors to the daemon (used when forking)
131
132 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
133
134         * daemon.c (_wapi_daemon_main): Use sizeof
135         (main_socket_address.sun_path) instead of hardcoded 108 value.
136
137         * handles.c (shared_init): Use sizeof
138         (shared_socket_address.sun_path) instead of hardcoded 108 value.
139
140 2002-07-10  Dennis Haney  <davh@davh.dk>
141
142         * shared.c:
143         * handles.c:
144         * daemon.c: Lots of documentation, some added error checking, and
145         code readability improvements.
146
147         * daemon-messages.h: Add the Error request type to improve error
148         checking.
149
150         * daemon-messages.c: Do a bit more error checking on send() and
151         recv(), and log errors with a higher severity level.
152
153 2002-07-04  Dick Porter  <dick@ximian.com>
154
155         * daemon.c (process_process_fork): Fix argument handling, due to
156         buggy understanding of g_strsplit() behaviour.
157
158 2002-07-03  Dick Porter  <dick@ximian.com>
159
160         * threads.h:
161         * threads.c: Implement OpenThread().  Define access-control values
162         for thread handles.
163
164         * wapi.h:
165         * processes.h:
166         * access.h:
167         * Makefile.am: Added access.h, to hold shared access-control
168         definitions
169
170 2002-07-02  Dick Porter  <dick@ximian.com>
171
172         * wapi-private.h (_WAPI_HANDLE_VERSION): New protocol version
173         
174 2002-07-02  Dick Porter  <dick@ximian.com>
175
176         * handles.c (shared_init): Make a second attempt to contact the
177         daemon if the shared memory attach succeeds, but the connect()
178         fails. (This copes with the daemon crashing without cleaning up
179         the shared memory.)
180
181         * Makefile.am: 
182         * daemon-private.h:
183         * daemon.c:
184         * shared.c (_wapi_shm_attach): Don't exec() anything when we fork
185         the daemon, it's now built into the library.
186
187 2002-06-25  Dick Porter  <dick@ximian.com>
188
189         * handles.c:
190         * handles-private.h:
191         * daemon-messages.h:
192         * daemon.c: Process forking and handle data management
193
194         * processes.h:
195         * process-private.h:
196         * processes.c: Process forking and other support functions
197
198 2002-06-25  Dick Porter  <dick@ximian.com>
199
200         * versioninfo.h: PE resource decoding
201
202         * unicode.c (_wapi_unicode_to_utf8): g_utf16_to_utf8 doesnt need
203         to be told the string length
204
205         * io.c: Removed the ACTUALLY_DO_UNICODE option.  Fixed some leaks.
206         Moved _wapi_time_t_to_filetime and the WapiFileTime typedef to
207         timefuncs.c
208
209 2002-06-12  Dick Porter  <dick@ximian.com>
210
211         * daemon.c: 
212         * daemon-messages.c: Handle SIGPIPE in a non-stupid way in the
213         daemon, if MSG_NOSIGNAL isn't available.  Thanks to Jaroslaw
214         Kowalski <jarek@atm.com.pl> for pointing out the bogosity.
215
216 2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>
217
218         * sockets.c, daemon-messages.c: Prevent SIGPIPE from being raised
219         when writing to a closed socket.
220
221 2002-06-08  Jeffrey Stedfast  <fejj@ximian.com>
222
223         * mono-mutex.c (mono_once): New convenience function for my
224         previous fix.
225
226         * handles.c:
227         * error.c: 
228         * critical-sections.c: 
229         * threads.c: 
230         * sockets.c: 
231         * semaphores.c: 
232         * processes.c: 
233         * mutexes.c: 
234         * io.c: 
235         * events.c: 
236         * atomic.c: Use mono_once() rather than pthread_once().
237
238 2002-06-06  Jeffrey Stedfast  <fejj@ximian.com>
239
240         * handles.c (_wapi_handle_new): pthread_once() is not atomic, so
241         if multiple threads all try to call _wapi_handle_new() before the
242         shared data has been initialized, it is possible that we could get
243         into a condition where shared_init() is being executed and later
244         threads will pass by pthread_once() due to the fact that it has
245         already been called and so therefor will attempt to use the shared
246         data before it has been completely initialized. If we instead use
247         a standard mutex locking mechanism around shared_init(), we can
248         avoid the situation entirely. By wrapping the mutex locking in a
249         check to see if we've already initialized the data, we can even
250         avoid wasting resources by having to lock/unlock the mutex in any
251         later calls (the only time we'd have to worry about
252         locking/unlocking is the initial race to call shared_init() at
253         startup).
254
255 Sat Jun 1 13:27:11 CEST 2002 Paolo Molaro <lupus@ximian.com>
256
257         * atomic.h: inline asm fixes from Dennis Haney (davh@davh.dk).
258
259 Fri May 31 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
260
261         * daemon.c, handles.c: rename "sun" local var since it's apparently
262         a #define on Solaris.
263
264 Fri May 31 15:40:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
265
266         * daemon-messages.c: work-around MSG_NOSIGNAL missing on some
267         platforms.
268
269 2002-05-15  Dick Porter  <dick@ximian.com>
270
271         * wait.c: Fix a deadlock in WaitForMultipleObjects
272
273 2002-05-14  Dick Porter  <dick@ximian.com>
274
275         * io.c: Fix a cut&paste error, found by
276         Jaroslaw Kowalski <jarek@atm.com.pl>
277
278 2002-05-10  Dan Lewis  <dihlewis@yahoo.co.uk>
279
280         * io.c: Nasty typo.
281
282 2002-05-09  Dick Porter  <dick@ximian.com>
283
284         * threads.c: 
285         * semaphores.c: 
286         * processes.c: 
287         * mutexes.c: 
288         * handles-private.h: 
289         * events.c: 
290         * Makefile.am: Remove now-unused file wait-private.h
291
292 2002-05-08  Dick Porter  <dick@ximian.com>
293
294         * shared.c: Better error messages, and report when daemon
295         connection fails rather than blocking forever.  Do some more
296         shared memory sanity checking.
297
298         * handles.c: Better error messages when connecting to shared
299         memory and the handle daemon.  Fall back to non-shared handles if
300         an error occurs.  Set the default back to 'shared handles'.  Fix a
301         crashing bug in scratch space allocation that mangled the block
302         headers.
303
304 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
305
306         * handles.c (shared_init): Disable SHM for now, people have too
307         many problems with this, and the diagnostics are not helping.
308
309 2002-05-06  Dan Lewis  <dihlewis@yahoo.co.uk>
310
311         * io.c: CreateFile sets win32 last error.
312
313 2002-05-05  Dick Porter  <dick@ximian.com>
314
315         * wapi-private.h: 
316         * handles-private.h:
317         * io.c: 
318         * io-private.h:
319         * mutexes.c: 
320         * mutex-private.h: 
321         * processes.c: 
322         * process-private.h: 
323         * semaphores.c: 
324         * semaphore-private.h: 
325         * sockets.c: 
326         * socket-private.h: 
327         * events.c: 
328         * event-private.h: Simplify the WapiHandleOps struct: take out all
329         the file-specific entries, leaving just the items that operate on
330         handles themselves.  Split the close operation into shared and
331         private parts: shared close is called by the daemon.
332
333         * handles.c: As above, but also pass handle allocation, ref and
334         unref operations to the daemon.  Populate the handle_ops array at
335         compile time, because the daemon needs to call ops on handles too.
336         Don't bother to track open handle counts any more, the daemon does
337         that.
338         
339         * threads.c: 
340         * thread-private.h: As above, but also make the thread data
341         handle-private.
342
343         * shared.c: Fork a handle daemon if the calling process created
344         the shared memory segment.
345
346         * daemon.c:
347         * daemon-messages.c:
348         * daemon-messages.h:
349         * Makefile.am: Build a daemon to manage handle allocation and
350         destruction without needing to lock the shared memory
351
352 2002-04-30  Jeffrey Stedfast  <fejj@ximian.com>
353
354         * atomic.c: Changed to use a normal mutex rather than a spinlock
355         since a lot of platforms seem to not have them :\
356
357 2002-04-30  Dick Porter  <dick@ximian.com>
358
359         * Completely rewrote the handle waiting code: removed the helper
360         thread and its attendant complexity.  All handle waiting is now
361         abstracted into the WaitForSingleObject() and
362         WaitForMultipleObjects() functions.
363
364         * Implemented inter-process sharing of handles using sysv shared
365         memory.  This makes handles even more opaque, with a handle now
366         just an index into an array.
367         
368 2002-04-25  Dan Lewis  <dihlewis@yahoo.co.uk>
369
370         * io.c: unitialized pointer in GetCurrentDirectory.
371
372 Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
373
374         * threads.c: destroy the mutex at thread destruction
375         (if/when thread destruction code will be actually called).
376         When protecting a tls data pointer from the gc, use also the 
377         thread id in the key.
378         
379 Wed Apr 17 18:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
380
381         * timed-thread.c: avoid race condition when setting the thread to
382         detached.
383
384 2002-04-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
385
386         * jit.h: to more #include lines to avoid breaking compilation
387         under windows when upgrading mingw and w32api to version
388         1.3 (thanks Dick!).
389
390 2002-04-16  Dick Porter  <dick@ximian.com>
391
392         * atomic.h: Explanatory comment about lack of 80386 support
393
394 2002-04-15  Dick Porter  <dick@ximian.com>
395
396         * atomic.h: use xaddl for InterlockedIncrement() and
397         InterlockedDecrement().  Use cmpxchgl in a loop for
398         InterlockedExchange() and InterlockedExchangePointer().
399
400 Mon Apr 15 13:31:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
401
402         * unicode.c: fix unicode_len() to not access uninitialized memory
403         (and updated to conform to mono code style).
404
405 Fri Mar 29 17:15:11 CET 2002 Paolo Molaro <lupus@ximian.com>
406
407         * io.c: EEXISTS is ignored for directory creation.
408         * mono-mutex.h: remove silly "pragma }" that emacs users insert
409         because they use a broken editor:-)
410
411 2002-03-28  Dick Porter  <dick@ximian.com>
412
413         * sockets.h: 
414         * sockets.c: 
415         * io.c: 
416         * handles.h: 
417         * handles.c: Warning cleanups
418
419 2002-03-27  Dan Lewis <dihlewis@yahoo.co.uk>
420
421         * unicode.h, unicode.c: changed to gunichar2
422         * io.h, io.c: changed strings to gunichar2*, added
423         SetFileAttributes(), GetCurrentDirectory(), SetCurrentDirectory(),
424         some fixes to FindFirstFile() and friends.
425
426 2002-03-26  Dick Porter  <dick@ximian.com>
427
428         * types.h: Implement the large integer struct
429
430         * timefuncs.h:
431         * timefuncs.c: Dummy functions that don't yet implement
432         QueryPerformanceCounter() and QueryPerformanceFrequency()
433
434         * threads.h:
435         * threads.c: Implement SleepEx()
436
437         * system.h:
438         * system.c: Beginnings of GetSystemInfo()
439
440         * mono-mutex.c (pthread_mutex_timedlock): Fix a ms/ns conversion
441         thinko
442
443         * context.h:
444         * context.c: Dummy function that doesnt yet implement
445         GetThreadContext()
446
447         * atomic.h: 
448         * atomic.c: Interlocked functions
449
450 Mon Mar 25 13:01:40 CET 2002 Paolo Molaro <lupus@ximian.com>
451
452         * threads.c: use a gc-safe hash table to store tls pointers.
453
454 2002-03-22  Dick Porter  <dick@ximian.com>
455
456         * threads.c: Fix a race condition where a thread can start and
457         exit before the handle has been properly initialised (no reason
458         why the handle couldn't be initialised beforehand, so do so)
459
460         Fix a ms to ns conversion magnitude thinko.
461
462 2002-03-21  Dick Porter  <dick@ximian.com>
463
464         * semaphores.c: Fix a problem when waiting for one or more
465         semaphores, and another semaphore is Released (all waiting
466         semaphores assumed they were signalled)
467
468 2002-03-29  Dan Lewis <dihlewis@yahoo.co.uk>
469
470         * io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory,
471         RemoveDirectory, GetFileAttributes, GetFileAttributesEx
472
473 2002-03-19  Dietmar Maurer  <dietmar@ximian.com>
474
475         * threads.c (Sleep): bug fix: 1ms == 1000000ns
476
477 2002-03-19  Dan Lewis <dihlewis@yahoo.co.uk>
478
479         * io.h, io.c, events.c, mutexes.c, semaphores.c, sockets.c,
480         threads.c, io.c: added flush method to handles.
481
482         * io.c: FlushFileBuffers() and FindFirstFile() functions.
483
484 Thu Mar 7 17:21:52 CET 2002 Paolo Molaro <lupus@ximian.com>
485
486         * threads.c, timed-thread.c, wait.c: Boehm-GC anable.
487
488 2002-02-20  Dick Porter  <dick@ximian.com>
489
490         * io-layer.h: Always build without cygwin support on windows
491
492 Mon Feb 18 15:50:59 CET 2002 Paolo Molaro <lupus@ximian.com>
493
494         * sockets.c: #undef DEBUG.
495
496 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
497
498         * io-layer.h: conditionally include sys/filio.h and sys/sockio.h
499         for FIONBIO, FIONREAD, and SIOCATMARK.
500
501 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
502
503         * sockets.c: conditionally include sys/filio.h and sys/sockio.h
504         for FIONBIO, FIONREAD, and SIOCATMARK.
505
506 2002-02-13  Dick Porter  <dick@ximian.com>
507
508         * sockets.c: Implement shutdown and select
509
510 2002-02-13  Jeffrey Stedfast  <fejj@ximian.com>
511
512         * mono-mutex.[c,h]: New source files that thinly wrap all pthread
513         functions that take pthread_mutex_t and/or pthread_mutexattr_t
514         arguments for the sake of portability. Implements recursive
515         mutexes and pthread_mutex_timedlock.
516
517         * critical-sections.c:
518         * events.c:
519         * handles.c:
520         * mutexes.c:
521         * semaphores.c:
522         * threads.c:
523         * timed-thread.c:
524         * wait.c: Use the mono-mutex wrapper portability functions/macros.
525
526         * pthread-compat.[c,h]: Replaced by mono-mutex.[c,h]
527
528 2002-01-23  Dick Porter  <dick@ximian.com>
529
530         * sockets.c: Networking support, mostly wrapping BSD socket APIs
531         with handle code, and translating errno into w32 error codes.
532
533         * macros.h: Some w32 macros used with the socket support
534
535         * error.c: Implemented GetLastError() and SetLastError()
536
537         * Makefile.am: Added sockets, with kludge to override some symbols
538
539 2001-12-17  Dietmar Maurer  <dietmar@ximian.com>
540
541         * unicode.c (_wapi_unicode_to_utf8): byteswap UTF16 strings before
542         passing them to iconv
543         (_wapi_unicode_to_utf8): only swap bytes on LE systems, remove bug
544         from previous commit.
545
546 2001-12-11  Dick Porter  <dick@ximian.com>
547
548         * io.c: Implement DeleteFile(), GetFileTime(), SetFileTime() and
549         FileTimeToSystemTime().
550
551         * unicode.c (unicode_len): Nasty way of finding length of unicode
552         string with embedded NULLs (counts until two NULLs together).
553
554         * mutexes.c (mutex_close): 
555         * events.c (event_close): Release the internal pthreads resources
556
557 2001-11-26  Dick Porter  <dick@ximian.com>
558
559         * critical-sections.c:
560         * events.c:
561         * handles.c:
562         * io.c:
563         * mutexes.c:
564         * semaphores.c:
565         * threads.c:
566         * timed-thread.c:
567         * wait.c: turn off DEBUG messages
568
569 2001-11-22  Dick Porter  <dick@ximian.com>
570
571         * handles.c (SignalObjectAndWait): Implement
572
573         * wait.c (WaitForSingleObject): Fix case where timeout == 0
574
575         * threads.c:
576         * semaphores.c:
577         * mutexes.c:
578         * io.c:
579         * events.c: Support for SignalObjectAndWait
580         
581 2001-11-21  Dick Porter  <dick@ximian.com>
582
583         * events.c:
584         * handles.c:
585         * mutexes.c:
586         * semaphores.c:
587         * threads.c:
588         * wait.c: Reliable method of returning which handle was signalled
589         on return from WaitForMultipleObjects().
590
591 2001-11-21  Dick Porter  <dick@ximian.com>
592
593         * events.c: Implement events
594
595 2001-11-15  Dick Porter  <dick@ximian.com>
596
597         * mutexes.c: Implement mutexes
598
599         * threads.c: 
600         * semaphores.c: 
601         * misc.c: Factor out some common code
602
603 2001-11-13  Dick Porter  <dick@ximian.com>
604
605         * threads.c: Implement TLS.  Implement GetCurrentThreadId(), and
606         GetCurrentThread() by maintaining a hash of thread handles.
607
608         * threads.h: Define thread and process creation flags
609
610 2001-11-12  Dick Porter  <dick@ximian.com>
611
612         * critical-sections.c: Implement critical sections
613
614 2001-11-12  Dick Porter  <dick@ximian.com>
615
616         * semaphores.c: Implement semaphores
617
618         * wait.c (wait_for_item): Maintain a wait count rather than count
619         signalled booleans.
620
621         * threads.c (thread_wait_multiple): Don't lock the wait item, that
622         will block other wait threads
623
624 2001-11-11  Dick Porter  <dick@ximian.com>
625
626         * Makefile.am: Rename some automake variables
627         (from Nick Drochak <ndrochak@gol.com>)
628
629 2001-11-10  Dick Porter  <dick@ximian.com>
630
631         * Makefile.am (libwapiincludedir): Fix include destination
632
633         * .cvsignore: Ignore generated files
634
635 2001-11-10  Dietmar Maurer  <dietmar@ximian.com>
636
637         * pthread-compat.c: added some include files to make it compile on
638         linux.
639
640 2001-11-08  Dick Porter  <dick@ximian.com>
641
642         * Initial checkin.
643
644         This is a library emulating the win32 threading and IO API.
645
646