2010-07-04 Gonzalo Paniagua Javier <gonzalo@novell.com>
[mono.git] / mono / io-layer / ChangeLog
1 2010-07-04 Gonzalo Paniagua Javier <gonzalo@novell.com>
2
3         * io.c: don't strip out directory paths in the pattern.
4
5 2010-06-29  Geoff Norton  <gnorton@novell.com>
6
7         * atomics.h: Implement armv6+ variants of our atomics.
8
9 2010-06-25  Zoltan Varga  <vargaz@gmail.com>
10
11         * Makefile: Don't build an sgen aware version, it is no longer needed.
12
13         * wait.c handles.c wthreads.c: Call the mono_gc_ wrapper functions of some pthread
14         apis. This breaks the compile time dependency between io-layer and the GC.
15
16 2010-06-23  Miguel de Icaza  <miguel@novell.com>
17
18         * Makefile.am: Add support for building a sgen-aware versions of
19         the library: libwapisgen.la libmonoruntimesgen-static it shares
20         all the components of the default, but use a differen set of
21         CFLAGS to enable SGEN instead.
22
23 2010-06-01  Geoff Norton  <gnorton@novell.com>
24
25         * sockets.c: Don't call poll directly, use mono_poll.
26
27 2010-04-29  Geoff Norton  <gnorton@novell.com>
28
29         * mono-spinlock.h: Remove
30         * wthreads.c: Don't spinlock here, use a mutex instead
31
32 2010-04-26  Geoff Norton  <gnorton@novell.com>
33
34         * processes.c: Fix this for 64-bit darwin.
35
36 2010-04-20  Jonathan Pryor  <jpryor@novell.com>
37
38         * collection.c: Cleanup platform checks around
39           pthread_attr_setstacksize(), and instead always use
40           MAX(65536, PTHREAD_STACK_MIN) as the stack size.
41         * mono-mutex.c: Remove near duplicate pthread_mutex_timedlock()
42           declarations, and merge via a CONST_NEEDED intermediate #define.
43
44 2010-04-19  Jonathan Pryor  <jpryor@novell.com>
45
46         * collection.c, mono-mutex.c: Add Android support.
47
48 2010-04-14  Zoltan Varga  <vargaz@gmail.com>
49
50         * collection.c (_wapi_collection_init): Set stack size on openbsd similarly to
51         the other BSDs.
52
53 2010-04-10  Andreas Färber  <andreas.faerber@web.de>
54
55         * processes.c (EnumProcesses, load_modules): Add implementations
56         for Haiku. Fixes build on Haiku.
57         (OpenProcess, EnumProcessModules, get_process_name_from_proc):
58         Tweak implementations for Haiku.
59         * process-private.h: Fix _WAPI_PROCESS_UNHANDLED_PID_MASK for
60         32-bit pids (Haiku).
61         * ChangeLog: Fix UTF-8 encoding
62
63         Code is contributed under MIT/X11 license.
64
65 2010-04-09  Zoltan Varga  <vargaz@gmail.com>
66
67         * processes.c: Applied more openbsd changes from Robert Nagy <robert@openbsd.org>.
68
69 2009-04-06 Rodrigo Kumpera  <rkumpera@novell.com>
70
71         * wthreads.c (TlsSetValue): Don't take locks here. We trust pthread_setspecific
72         return value to tell if we tried to store to an invalid slot.
73
74 2010-04-04  Zoltan Varga  <vargaz@gmail.com>
75
76         * processes.c: Applied more openbsd changes from Robert Nagy <robert@openbsd.org>.
77
78 2010-04-03  Zoltan Varga  <vargaz@gmail.com>
79
80         * processes.c: Applied more openbsd changes from Robert Nagy <robert@openbsd.org>.
81
82 2010-04-03  Zoltan Varga  <vargaz@gmail.com>
83
84         * processes.c: Applied some openbsd changes from Robert Nagy <robert@openbsd.org>.
85
86 2010-03-26  Zoltan Varga  <vargaz@gmail.com>
87
88         * sockets.c: Apply some openbsd changes from openbsd ports.
89
90 2010-03-26  Zoltan Varga  <vargaz@gmail.com>
91
92         * shared.c: Disable shared supported by default, it can be enabled by setting
93         the MONO_ENABLE_SHM env variable.
94
95 2009-03-22 Rodrigo Kumpera  <rkumpera@novell.com>
96
97         * threads.h: Add wapi_self_interrupt.
98
99         * wthreads.c: Add wapi_self_interrupt which puts the current
100         thread in interrupted state.
101
102         * wthreads.c (wapi_thread_clear_wait_handle): Previous handle
103         can possibly be NULL if an async interrupt cleared it.
104
105         This is safe because it is only async cleared if running inside a
106         handler block.
107
108 2010-03-06 Gonzalo Paniagua Javier <gonzalo@novell.com>
109
110         * processes.c: made ShellExecuteEx actually work when the file name to
111         execute is quoted. Display a message intead of blindly ignoring the
112         result of g_shell_parse_argv(). Fixes bug #385497.
113
114 2010-03-05  Zoltan Varga  <vargaz@gmail.com>
115
116         * shared.c (shm_semaphores_init): Applied patch from Cal Page
117         (age.cal@gmail.com). Fix support for USE_SHM.
118
119 2010-02-25  Geoff Norton  <gnorton@novell.com>
120
121         * wait.c: If any of our handles are shared, we need to do
122         a polling wait so we're notified of the signal change.
123
124 Wed Feb 24 16:01:37 CET 2010 Paolo Molaro <lupus@ximian.com>
125
126         * Makefile.am: don't install the headers anymore, they are private.
127
128 2010-02-20  Zoltan Varga  <vargaz@gmail.com>
129
130         * versioninfo.c (VerLanguageName): Remove code duplication a bit.
131
132 2009-12-02  Miguel de Icaza  <miguel@novell.com>
133
134         * processes.c (EnumProcesses): Add support for OSX, patch from Tom
135         Philpot <tom.philpot@logos.com>
136
137 2009-11-30  Carlos Alberto Cortez <calberto.cortez@gmail.com>
138
139         * io.cs: In CopyFile check if the destination already exists before
140         trying to open it, and if it is the same as the source, report an error,
141         just as .net does. We do the check here to take advantage of the IOMAP
142         capability.
143         Fixes #510230.
144
145 2009-11-13 Jonathan Chambers <joncham@gmail.com>
146
147         * mono-mutex.h: Implementation for Windows platform.
148         
149         Code contributed under MIT/X11 license.
150
151 2009-11-13  Zoltan Varga  <vargaz@gmail.com>
152
153         * processes.c: Include mono-path.h.
154
155 2009-11-12  Geoff Norton  <gnorton@novell.com>
156
157         * processes.c: match_procname_to_modulename should resolve
158         symlinks when checking if two process modules match.
159
160 2009-11-04 Jonathan Chambers <joncham@gmail.com>
161
162         * mono-mutex.h: Add skeleton implementation for Windows platform.
163         
164         Code contributed under MIT/X11 license.
165
166 2009-10-21 Gonzalo Paniagua Javier <gonzalo@novell.com>
167
168         * sockets.[ch]: fix function definition.
169
170 2009-10-21 Gonzalo Paniagua Javier <gonzalo@novell.com>
171
172         * sockets.[ch]: added TransmitFile implementation.
173
174 2009-10-04  Zoltan Varga  <vargaz@gmail.com>
175
176         * processes.c: Implement get_process_name_from_proc () on solaris.
177
178 2009-09-24  Zoltan Varga  <vargaz@gmail.com>
179
180         * processes.c (load_modules): Applied patch from Thomas Philpot
181         (tom.philpot@logos.com). Fixes #533893.
182
183 2009-09-15  Jeffrey Stedfast  <fejj@novell.com>
184
185         * io.c (CreateFile): In the directory fallback case, use
186         _wapi_open() again so that IOMAP magic happens.
187         (CopyFile): Need to consistently use _wapi_open() here too.
188         (ReplaceFile): Use _wapi_open() here too and get rid of the
189         fallback code that tried re-opening the file w/o O_TRUNC since
190         there's no reason to do that.
191
192 2009-09-05  Zoltan Varga  <vargaz@gmail.com>
193
194         * handles.c (_wapi_handle_real_new): Call _wapi_process_reap () when running
195         out of shared handes. Fixes #536776.
196
197         * processes.c (CreateProcess): Return false and set the error to
198         ERROR_OUTOFMEMORY when a process handle cannot be created.
199         (ShellExecuteEx): Propagate an ERROR_OUTOFMEMORY error code. Fixes part of
200         #536776.
201
202 2009-09-01  Zoltan Varga  <vargaz@gmail.com>
203
204         * processes.c (EnumProcessModules): Applied patch from Romain Tartière
205         (romain@blogreen.org). Fix this on freebsd/OSX. Fixes #533893.
206
207 2009-08-18  Christian Hergert  <chris@dronelabs.com>
208
209         * wthreads.c: Roll back change for thread-id as it "embraces
210         and extends" the api by passing word-size for thread id on
211         s390 and amd64.
212
213 2009-08-18  Christian Hergert  <chris@dronelabs.com>
214
215         * security.c:
216         * processes.c:
217         * wthreads.c: Be explicit when we are changing word sizes.
218
219 2009-08-18  Christian Hergert  <chris@dronelabs.com>
220
221         * processes.c: Fix method declaration warnings.
222         * sockets.c: getsockopt() wants socklen_t for size.
223
224 2009-08-04  Miguel de Icaza  <miguel@novell.com>
225
226         * posix.c (_wapi_stdhandle_create): Split this into a new file to
227         more easily support non-Posix platforms.
228
229 2009-07-20  Geoff Norton  <gnorton@novell.com>
230
231         * thread-private.h: Use the new mono-semaphore.h.
232
233 2009-06-25 Gonzalo Paniagua Javier <gonzalo@novell.com>
234
235         * sockets.c: add the error number to the message so we can figure out
236         when this happens.
237
238 2009-06-25 Gonzalo Paniagua Javier <gonzalo@novell.com>
239
240         * wait.c: add missing 'break'.
241
242 2009-06-20  Zoltan Varga  <vargaz@gmail.com>
243
244         * atomic.h: Fix ilp32 support on ppc.
245
246 2009-05-28  Mark Probst  <mark.probst@gmail.com>
247
248         * collection.c (_wapi_collection_init): If pthread_create() fails,
249         try again with larger and then with no stack size set.  Fixes
250         #470336.
251
252 2009-05-26  Zoltan Varga  <vargaz@gmail.com>
253
254         * shared.c (_wapi_shm_file): Avoid creating a .wapi directory here, create
255         it in _wapi_shm_file_open (), since platforms using posix shm don't need it.
256
257 2009-05-22  Miguel de Icaza  <miguel@novell.com>
258
259         * wapi_glob.c: Do not need sys/param.h anymore, we now use the
260         POSIX PATH_MAX instead of BSD's MAXPATHLEN
261
262         * handles.c: Do not pull a reference to sockets if they are
263         disabled.
264
265         * sockets.c: Allow for ports to define their own ioctlsocket. 
266
267         * wthreads.c: Remove obsolete code that I recently introudced (the
268         hook for mono_register_thread_attr.
269
270 2009-05-22  Miguel de Icaza  <miguel@novell.com>
271
272         * versioninfo.c: One missing signature, fixed.
273
274 2009-05-21  Miguel de Icaza  <miguel@novell.com>
275
276         * daemon.c: Remove more DEBUG ifdef mess.
277
278         * shared.c (_wapi_shm_attach): Implemention for DISABLE_SHARED_HANDLES 
279
280 2009-05-20  Miguel de Icaza  <miguel@novell.com>
281
282         * sockets.c (ioctlsocket): Move support for MacOS semantics to the
283         ioctlsocket from the ifdef that was previously on metadata/
284
285         * wapi_glob.c (_wapi_glob): Use PATH_MAX from limits.h instead of
286         the BSD name from sys/param.h (MAXPATHLEN)
287
288         Do not include pwd.h as it is not used.
289
290         * thread-private.h: Use indent ifdef style for clarity
291
292         * sockets-wrappers.h: sys/socket.h conditional
293
294         * daemon-messages.h: sys/uio.h conditional.
295
296         * sockets.c: sys/ioctl.h conditional
297
298         * wthreads.c: work around for platforms with no thread fetching
299         information. 
300
301         * versioninfo.c: Use the portable mono_map_ interface instead of
302         using mmap directly and change the style to the Mono style.
303
304         Remove more DEBUG/ifdefs combos
305
306         * shared.c: Split the code to make DISABLE_SHARED remove all the
307         code that does not use the shared handles.   Before it merely
308         removed some of it, with this we avoid hacks on platforms that can
309         not implement it.
310
311         Split the code to reduce the amount of ifdefs.
312
313         Remove #ifdef DEBUG from the source and use a macro instead.
314
315 2009-05-20  Miguel de Icaza  <miguel@novell.com>
316
317         * locking.c: Split locking code into a separate file.
318
319 2009-05-18  Miguel de Icaza  <miguel@novell.com>
320
321         * daemon.c: Move the compile check of MONO_SIZEOF_SUNPATH to the
322         file that uses it.
323
324         * Rename `threads.c' to `wthreads.c' as broken build systems are
325         not able to cope with two files with the same name across multiple
326         directories. 
327
328 2009-05-15  Geoff Norton  <gnorton@novell.com>
329
330         * handles.c: Don't start the collection thread if we've disabled
331         shared handles.
332
333 2009-05-12  Zoltan Varga  <vargaz@gmail.com>
334
335         * collection.c (collection_thread): Get rid of all the ifdefs and
336         gcc attributes, simply return NULL.
337
338 2009-05-11  Zoltan Varga  <vargaz@gmail.com>
339
340         * shared.c: Applied patch from Koushik K. Dutta (koush@koushikdutta.com).
341         Fix the build on android.
342
343 2009-05-09  Miguel de Icaza  <miguel@novell.com>
344
345         * messages.c: Split the scan into common and uncommon messages to
346         allow the messages that are not produced by Mono to be removed on
347         embedded scenarios.
348         
349         * messages.c (message_string): instead of having a gigantic switch
350         table, use a sorted structure in memory and do a binary search on
351         it.
352
353         This reduces the runtime size by 49k and the debugging symbols by
354         400k.
355
356 2009-04-29 Gonzalo Paniagua Javier <gonzalo@novell.com>
357
358         * sockets.c: don't display a warning when connect() fails because the
359         socket was closed in another thread.
360
361 2009-04-23 Rodrigo Kumpera  <rkumpera@novell.com>
362
363         * shared.c: Fix a bunch of memleaks.
364
365 2009-03-27  Zoltan Varga  <vargaz@gmail.com>
366
367         * threads.h: Add a comment to CreateThread.
368
369 2009-03-20  Zoltan Varga  <vargaz@gmail.com>
370
371         * threads.c handles.c wait.c: Change location of gc_wrapper.h.
372
373 2009-02-22  Robert Jordan  <robertj@gmx.net>
374
375         * sockets.c: implement WSASend/WSARecv using sendmsg/recvmsg.
376         Fixes #470021.
377
378         Code is contributed under MIT/X11 license.
379
380 2009-02-20 Gonzalo Paniagua Javier <gonzalo@novell.com>
381
382         * events.c: fix event_signal and namedevent_signal to actually signal
383         the handle.
384
385 2009-02-12 Gonzalo Paniagua Javier <gonzalo@novell.com>
386
387         * io.c: EXDEV when moving directories fails now without creating a
388         file in the destination.
389         Fixes bug #326983.
390
391 2009-02-09  Zoltan Varga  <vargaz@gmail.com>
392
393         * wait.c (WaitForMultipleObjectsEx): Initialize poll variable.
394
395 2009-02-05  Miguel De Icaza  <miguel@novell.com>
396
397         * sockets.c (_wapi_setsockopt): SO_REUSEPORT is needed also on
398         MacOS X.  Fixes bug #471292
399
400 2009-01-29  Zoltan Varga  <vargaz@gmail.com>
401
402         * shared.c: Fall back to file based shared storage if shm_open () fails
403         because /dev/shm is not mounted.
404         
405         * shared.c: Add an alternative implementation using shared memory instead of
406         files. This fixes problems where the mono process would spin up the disk
407         every x secs on laptops. Fixes #434566, #415373 and #321949.
408
409 2009-01-16  Miguel de Icaza  <miguel@novell.com>
410
411         * sockets.c (WSASend): Fix memory leak, and optimize for the case
412         with 1 segment. 
413
414         This should really use writev or sendmsg to use the kernel
415         scatter/gather facility instead of emulating it by copying buffers.
416
417 2009-01-26  Rodrigo Kumpera  <rkumpera@novell.com>
418
419         * critical-sections.h (Enter/LeaveCriticalSection): Show
420         helpfull warning messages before crashing.
421
422 2009-01-26  Rodrigo Kumpera  <rkumpera@novell.com>
423
424         * handles-private.h (_wapi_handle_set_signal_state): Show
425         helpfull warning messages before crashing.
426
427 2009-01-26  Jeffrey Stedfast  <fejj@novell.com>
428
429         * mono-mutex.[c,h]: Removed GPLv2 copyright notice which should
430         not have been there.
431
432 2009-01-20  Rodrigo Kumpera  <rkumpera@novell.com>
433
434         * threads.c: Add wapi_current_thread_desc that produces
435         a string representation of the current thread state.
436
437         * threads.h: Export wapi_current_thread_desc.
438
439 2009-01-18  Zoltan Varga  <vargaz@gmail.com>
440
441         * io.c (GetDiskFreeSpaceEx): Applied patch from Koushik Dutta
442         (koush@koushikdutta.com). Disable this on android.
443
444 2009-01-16  Rodrigo Kumpera  <rkumpera@novell.com>
445
446         * handles.c (_wapi_handle_timedwait_signal_handle): Don't use the
447         set_wait_handle/clear_wait_handle machinery for alertable waits in
448         case of non-alertable waits.
449
450         Non-alertable waits must continue and wait on the cond as this will
451         release the lock. Otherwise this will cause a deadlock as anyone trying
452         to pulse the cond will block trying to acquire the said lock because
453         the thread in non-alertable wait will be busy looping in WaitForSingleObjectEx
454         or similar function, never releasing the lock.
455
456         Thou this fixes quite a few of the hangs introduced by non-pooling alertable
457         waits, the long term plan is to verify if all non-alertable waits really need
458         to be as such.
459
460 2009-01-14  Zoltan Varga  <vargaz@gmail.com>
461
462         * handles-private.h (_wapi_handle_set_signal_state): Set the signalled state
463         of the handle while locking the global signal cond mutex.
464
465         * wait.c (WaitForMultipleObjectsEx): Check the signalled state of handles
466         inside the critical section before waiting, otherwise we could go to waiting
467         even when the handles are already signalled.
468
469 2009-01-13  Zoltan Varga  <vargaz@gmail.com>
470
471         Reapply r122913, this time handling processes by falling back to polling.
472         
473         * handles.c: Rework the way the global signal stuff is handled: instead of
474         allocating a separate mutex/condvar pair for it, allocate a normal handle.
475         This way, it can reuse the alertable waiting code, allowing 
476         WaitForMultipleObject to work without polling.
477
478 2009-01-09  Miguel de Icaza  <miguel@novell.com>
479
480         Incorporate a few patches from Paolo, slightly modified:        
481
482         * handles.c (_wapi_handle_check_share): On non-Linux systems, do
483         not even compile in the code that scans for /proc/fd, and go
484         directly to the fallback function.
485
486 2009-01-09  Paolo Molaro (lupus@ximian.com)
487
488         * handles.c: Do not include some header files in platforms that
489         lack it.
490
491 2009-01-09  Miguel de Icaza  <miguel@novell.com>
492
493         * messages.c: Eliminate a warning.
494         
495 2009-01-09  Paolo Molaro (lupus@ximian.com)
496
497         * error.c: On some platforms that do not define these variables,
498         do not use them.
499
500         * security.c, io-private.h: Only include some headers if they
501         exist on the system
502
503         * sockets.c, sockets.h: do not import on this header files that
504         are only consumed internally in sockets.c.
505
506 2009-01-09  Zoltan Varga  <vargaz@gmail.com>
507
508         * threads.c (_wapi_thread_apc_pending): Check for thread->wait_handle ==
509         INTERRUPTION_REQUESTED_HANDLE too.
510         (wapi_interrupt_thread): Rework the comments, the thread is no longer
511         required to call QueueUserAPC to make the wait functions return.
512
513         * threads.c handles.c threads-internal.h: Implement alertable waits without
514         polling.
515
516 2009-01-08  Geoff Norton  <gnorton@novell.com>
517
518         * processes.c: Fix the osx version check to properly detect 10.5 v 10.4
519
520 2009-01-08  Christian Prochnow  <cproch@seculogix.de>
521
522         * types.h: added WapiULargeInteger.
523
524         * uglify.h: added ULARGE_INTEGER, PULARGE_INTEGER.
525
526         * io.h: added WapiDriveType, added method declarations
527         for GetDiskFreeSpaceEx and GetDriveType
528
529         * io.c: added GetDiskFreeSpaceEx() to query disk size
530         and free space via statvfs or statfs system call.
531         added GetDriveType to query drive type via /etc/mtab or /etc/mnttab.
532
533 2009-01-07  Geoff Norton  <gnorton@novell.com>
534
535         * processes.c: Properly implement support for Process.Modules on OSX.
536         Fixes OSX on nunit 2.4
537
538 2009-01-07 Rodrigo Kumpera  <rkumpera@novell.com>
539
540         * io.c (GetCurrentDirectory): Avoid calling g_get_current_dir straight
541         away as it doesn't handle ENAMETOOLONG correctly. As a bonus we avoid
542         allocating memory in the common path.
543
544 2009-01-07  Geoff Norton  <gnorton@novell.com>
545
546         * processes.c: Only use open -W on OSX 10.5+.  Patch from
547         Miguel
548
549 2008-12-19  Bill Holmes  <billholmes54@gmail.com>
550
551         * processes.c (get_module_name) : adjust size for unicode characters.
552
553         Code is contributed under MIT/X11 license.
554
555 2008-11-21  Zoltan Varga  <vargaz@gmail.com>
556
557         * atomic.h: Applied patch from Mihai Chelaru <kefren@ngnetworks.ro>. Add
558         netbsd support.
559
560 2008-11-18  Mark Probst  <mark.probst@gmail.com>
561
562         * atomic.h: InterlockedExchangePointer and
563         InterlockedCompareExchangePointer for PPC64.
564
565         Code submitted by andreas.faerber@web.de at
566         https://bugzilla.novell.com/show_bug.cgi?id=324134 under the
567         X11/MIT license.
568
569 2008-11-13  Bill Holmes  <billholmes54@gmail.com>
570
571         * wait.h : Adding method declaration for WaitForInputIdle.
572
573         * wait.c : Adding implementation for WaitForInputIdle.
574
575         Code is contributed under MIT/X11 license.
576
577 Fri Oct 17 15:23:00 CEST 2008 Paolo Molaro <lupus@ximian.com>
578
579         * processes.c: patch from Geoff Norton (gnorton@novell.com) to
580         strdup the open program on OSX (bug #431811).
581
582 2008-10-10 Gonzalo Paniagua Javier <gonzalo@novell.com>
583
584         * versioninfo.c: remove the use of g_strdown.
585
586 2008-09-25  Dick Porter  <dick@ximian.com>
587
588         * wait.c: Make sure we keep references to handles we're waiting
589         for.  Fixes bug 424851.
590
591 2008-07-29  Dick Porter  <dick@ximian.com>
592
593         * processes.c (get_module_name): Make a last-ditch effort to
594         figure out the process name.  Fixes bug 413723, patch by Casey
595         Marshall <casey.s.marshall@gmail.com>
596
597 2008-07-28  Dick Porter  <dick@ximian.com>
598
599         * handles.c (_wapi_handle_count_signalled_handles): Remove an
600         unmatched _wapi_handle_ref().  Fixes bug 410743.
601
602 2008-07-15  Rodrigo Kumpera  <rkumpera@novell.com>
603
604         * versioninfo.c (map_pe_file): Fix memory leak.
605
606 2008-07-01  Zoltan Varga  <vargaz@gmail.com>
607
608         * process-private.h (_WAPI_PROCESS_UNHANDLED_PID_MASK): Fix the amd64 build.
609
610 2008-06-27  Dick Porter  <dick@ximian.com>
611
612         * processes.c: Implement a form of process pseudo-handle to allow
613         non-mono processes to be manipulated.  Fixes bug 313231.
614
615         * wait.c: Check for process pseudo-handles and fail if an attempt
616         is made to wait on one.
617
618 2008-06-19  Dick Porter  <dick@ximian.com>
619
620         * sockets.c: Implement WSASend() and WSAReceive().
621
622 2008-06-02  Dick Porter  <dick@ximian.com>
623
624         * wapi.h: 
625         * Makefile.am: 
626         * messages.h: 
627         * messages.c: Implement FormatMessage, fixes bug 321827.
628
629 2008-05-29  Dick Porter  <dick@ximian.com>
630
631         * sockets.c (socket_close): Clear any saved errors
632         (_wapi_connect): Don't save EWOULDBLOCK errors here, as that
633         breaks async connects.  (Bug 377589 test case broken by the
634         previous fix to bug 356552)
635
636 2008-05-25  Zoltan Varga  <vargaz@gmail.com>
637
638         * thread-private.h (struct _WapiHandle_thread): Remove 'owner_pid' field. Reorder
639         fields so this struct (which is the biggest of the handle structs) takes less
640         space.
641
642         * threads.c (QueueUserAPC): Make this function signal safe by adding some
643         restrictions on its usage.
644
645 2008-05-14  Zoltan Varga  <vargaz@gmail.com>
646
647         * mono-mutex.h: Get rid of the #ifdef __cplusplus defines, use G_BEGIN_DECLS
648         /G_END_DECLS.
649
650 2008-05-07  Dick Porter  <dick@ximian.com>
651
652         * io.c (FindNextFile): Handle symlinks correctly.  Fixes bug
653         385765.
654
655 2008-04-25  Zoltan Varga  <vargaz@gmail.com>
656
657         * handles.c (_wapi_handle_check_share): Fix a crash introduced by the lazy
658         creation of wapi handle slots.
659
660 2008-04-24  Zoltan Varga  <vargaz@gmail.com>
661
662         * handles.c (shared_init): Align _wapi_fd_reserve to a multiple of 
663         _WAPI_HANDLE_INITIAL_COUNT to avoid a problem when allocating handles.
664
665 2008-04-23  Zoltan Varga  <vargaz@gmail.com>
666
667         * handles.c: Initialize the handle array entries on demand to save memory.
668
669         * wapi-private.h (_WAPI_HANDLE_INITIAL_COUNT): Decrease this to 256 to save
670         memory.
671
672         * handles-private.h (_WAPI_PRIVATE_MAX_SLOTS): Increase this to 1024*16 to
673         compensate for the decrease in _WAPI_HANDLE_INITIAL_COUNT.
674         
675         * threads.c: Use #ifdef instead of #if for checking for valgrind/memcheck.h.
676
677 2008-04-22  Dick Porter  <dick@ximian.com>
678
679         * wapi_glob.c (globextend): Comment out the code using ARG_MAX, as
680         that is broken on the latest opensuse.
681
682 2008-04-21  Dick Porter  <dick@ximian.com>
683
684         * io.c (DeleteFile): Disable for now the bug fix for 323389, it's
685         breaking too much other stuff.
686
687 2008-04-20  Geoff Norton  <gnorton@novell.com>
688
689         * processes.c: Fix the _NSGetEnviron define to prevent an impropoer
690         pointer dereference.
691
692 2008-04-18  Miguel de Icaza  <miguel@novell.com>
693
694         * Applied patch from Dick Porter from bug #380649
695
696 2008-04-17  Dick Porter  <dick@ximian.com>
697
698         * io.c (DeleteFile): Check file shares before deleting a file.
699         Fixes bug 323389.
700
701 2008-04-17  Dick Porter  <dick@ximian.com>
702
703         * io.c (DeleteFile): Return ERROR_ACCESS_DENIED if the file is
704         readonly.  Fixes bug 378229.
705
706 2008-04-11  Geoff Norton  <gnorton@novell.com>
707
708         * processes.c: The global extern environ doesn't exist on Mac.  We
709         need to call NSGetEnviron instead.
710
711 2008-04-08  Dick Porter  <dick@ximian.com>
712
713         * processes.c (CreateProcess): Improve the managed binary support,
714         so it works when the executable is passed in as the appname.
715         Fixes bug 377815.
716
717 2008-04-04  Dick Porter  <dick@ximian.com>
718
719         * io.c (MoveFile): Check file shares before moving a file.  Fixes
720         bug 377049.
721
722 2008-04-04  Dick Porter  <dick@ximian.com>
723
724         * error.c (errno_to_WSA): handle ENODEV.  Fixes the reopened part
725         of bug 324035.
726
727 2008-04-04  Dick Porter  <dick@ximian.com>
728
729         * processes.c (GetModuleInformation): 
730         * versioninfo.h: 
731         * versioninfo.c: 64bit fixes
732
733 2008-04-03  Dick Porter  <dick@ximian.com>
734
735         * io-portability.c (_wapi_basename, _wapi_dirname): Only turn \
736         into / when MONO_IOMAP is in effect.  Fixes bug 346123.
737
738 2008-04-03  Dick Porter  <dick@ximian.com>
739
740         * timefuncs.c (GetTickCount): Use mono_msec_ticks(), see bug
741         347476.
742
743 2008-04-01  Dick Porter  <dick@ximian.com>
744
745         * versioninfo.c (get_string_block): Refine the fix for bug 354856
746         (r93661) so that it also fixes the new part of bug 374600.
747
748 2008-03-28  Dick Porter  <dick@ximian.com>
749
750         * processes.c (GetExitCodeProcess): Check if a process has exited
751         and recorded it's exit code, before seeing if the process is
752         signalled.  Fixes bug 325463.
753
754 2008-03-27  Dick Porter  <dick@ximian.com>
755
756         * processes.c (match_procname_to_modulename): Check the whole
757         process name first, in case it is recorded as an absolute path.
758         Fixes bug 360348.
759
760 2008-03-27  Dick Porter  <dick@ximian.com>
761
762         * processes.c (ShellExecuteEx): Grotty kludge to work around
763         unpleasant feature in g_shell_parse_argv() where it treats '#'
764         embedded in a filename as a comment marker, and throws away the
765         rest of the line.  When we're directly opening URLs quote the
766         filename, to avoid this.  Fixes bug 371567.
767
768 2008-03-25  Dick Porter  <dick@ximian.com>
769
770         * wapi-private.h (_WAPI_HANDLE_VERSION): Increment file layout
771         version
772
773         * threads.c: Make thread handles private to the process that owns
774         them.
775
776 2008-03-22  Kornél Pál  <kornelpal@gmail.com>
777
778         * io-layer.h: Windows: Rename GetProcessId to __GetProcessId for targets not
779         supporting it. This fixes MSVC build with new Windows SDKs that declare
780         GetProcessId unconditionally.
781
782 2008-03-20  Kornél Pál  <kornelpal@gmail.com>
783
784         * io-layer.h: Removed Windows version macros.
785
786 Thu Mar 13 16:24:53 CET 2008 Paolo Molaro <lupus@ximian.com>
787
788         * processes.c: properly check for executable files (fixes bug #368829).
789
790 2008-02-05  Dick Porter  <dick@ximian.com>
791
792         * versioninfo.c (VerLanguageName): Implement VerLanguageName.
793
794 2008-01-31  Bill Holmes  <billholmes54@gmail.com>
795         * processes.c (match_procname_to_modulename) : Added to check if the last 
796           part of module name is equal to the process name.
797
798         * processes.c (EnumProcessModules) : Changed the first entry in the returned 
799           modules array (the process module) to be populated from the entry found
800           in /proc/<PID>/maps.
801
802         * processes.c (get_module_name & GetModuleInformation) : In the case where 
803           the module passed in is NULL, search the /proc/<PID>/maps for a name that
804           matches the process name to populate the return information.
805
806         Fixes #357062
807
808 2008-01-29  Zoltan Varga  <vargaz@gmail.com>
809
810         * security.c (RevertToSelf): Make this return TRUE if impersonating is not
811         supported.
812
813         * sockets.c (_wapi_connect): Add a workaround to a solaris x86 problem where
814         getsockopt (SO_ERROR) doesn't return an error code after connect () fails. Fixes
815         #356552.
816
817 2008-01-23  Dick Porter  <dick@ximian.com>
818
819         * versioninfo.c (get_string_block): When stepping over the
820         StringTable block, do not read an extra block at the end.  Fixes
821         the new part of bug 354856.
822
823 2008-01-19  Dick Porter  <dick@ximian.com>
824
825         * versioninfo.c (get_stringtable_block): Cope when the StringTable
826         block is first in the resources data, and we just need to step
827         over it.  Fixes bug 354856.
828
829 2008-01-16  Dick Porter  <dick@ximian.com>
830
831         * threads.c (_wapi_thread_set_termination_details): Move the
832         thread abandonment to outside the shared handle lock.  Fixes bug
833         349680.
834
835 2008-01-16  Dick Porter  <dick@ximian.com>
836
837         * versioninfo.c (VerQueryValue): Include trailing null in returned
838         string length, for MS compatibility.
839
840 2008-01-09  Dick Porter  <dick@ximian.com>
841
842         * versioninfo.c (get_ptr_from_rva, scan_resource_dir): Make it
843         work on big-endian systems.
844         (scan_resource_dir): Copy the resource directory entry and
845         byteswap if necessary so it works big-endian.  This fixes bug
846         345972 for real this time.
847         (VerQueryValue): String values set the length to the number of
848         unicode chars, but the data length reported was already correct so
849         don't halve it again.  Fixes the previous fix for bug 345972.
850         (GetFileVersionInfo): On big-endian systems, scan the resource
851         data and turn all unicode strings into UTF-16BE.  FileVersionInfo
852         now works big-endian.
853
854 2008-01-04  Dick Porter  <dick@ximian.com>
855
856         * versioninfo.c (VerQueryValue): Returned buffer length counts
857         chars not bytes for string data.  Fixes bug 345972 again.
858         (get_enclosing_section_header): Make sure values read are treated
859         as LE.  Fixes crash on ppc reported in bug 345972.
860
861 2007-12-17  Mark Probst  <mark.probst@gmail.com>
862
863         * threads.c: Guard against a race condition involving
864         thread_hash_key that can occur during shutdown.
865
866 2007-12-08  Zoltan Varga  <vargaz@gmail.com>
867
868         * processes.c: Include sys/mkdev.h if exists. Fixes solaris x86 build.
869
870 2007-12-06  Dick Porter  <dick@ximian.com>
871
872         * versioninfo.c: Resource language values must be compared in a
873         'case'-insensitive manner.  Fixes bug 345972.
874
875 2007-12-05  Dick Porter  <dick@ximian.com>
876
877         * io.c (CreateFile): Create files with mode 0666 (&~umask) by
878         default.  Fixes bugs 325299 and 337040.
879
880 2007-11-22  Dick Porter  <dick@ximian.com>
881
882         * critical-sections.h (EnterCriticalSection): Reinstate the
883         asserts in the devel branch, so any problems aren't obscured.
884
885 2007-11-22  Dick Porter  <dick@ximian.com>
886
887         * versioninfo.c (find_pe_file_resources): Make it work on 64bit
888         systems.  Fixes bug 343353.
889
890 2007-11-21  Dick Porter  <dick@ximian.com>
891
892         * processes.c (load_modules): Rewrite based on the libgc
893         /proc/<pid>/maps parsing to avoid using glib functions only
894         available since 2004.
895         (load_modules): Check for duplicates before adding a module to the
896         list.
897
898 2007-11-15  Dick Porter  <dick@ximian.com>
899
900         * processes.c (load_modules): Don't bother if we don't have
901         g_strsplit_set() and g_strv_length().  Allows building against old
902         glib versions.
903         (EnumProcessModules): Don't miss the first module returned by
904         load_modules().
905
906 2007-11-15  Dick Porter  <dick@ximian.com>
907
908         * processes.c: Implement process module support by reading from
909         /proc if it's available.
910
911         * versioninfo.h: 
912         * versioninfo.c: New functions to implement PE file version info
913         support.
914
915 2007-11-08  Dick Porter  <dick@ximian.com>
916
917         * critical-sections.h (EnterCriticalSection): Disable the critical
918         section asserts for the release branch
919
920 2007-11-05  Kornél Pál  <kornelpal@gmail.com>
921
922         * io-layer.h: Added includes for run-time GetProcessId API detection for
923         Windows.
924
925 2007-10-26  Dick Porter  <dick@ximian.com>
926
927         * shared.c (_wapi_shm_file_open): Set the umask when opening
928         shared files, so restrictive defaults don't prevent subsequent
929         processes re-opening them.
930
931 2007-10-18  Zoltan Varga  <vargaz@gmail.com>
932
933         * atomic.h (InterlockedCompareExchange): Fix the ia64 version so it works for
934         negative values too. Hopefully fixes #332700.
935
936 2007-09-26  Dick Porter  <dick@ximian.com>
937
938         * io-portability.c (_wapi_io_scandir): Only update the error
939         status of glob() when performing a secondary glob() if the first
940         returned an error.  Fixes bug 325107.
941
942 2007-09-12  Marek Habersack  <mhabersack@novell.com>
943
944         * io-portability.c: options_init moved to
945         utils/mono-io-portability.c
946         Do not initialize portability helpers here, it's done in
947         mono_runtime_init.
948         find_file and find_in_dir moved to utils/mono-io-portability.c
949
950 2007-09-09  Robert Jordan  <robertj@gmx.net>
951
952         * sockets.c (_wapi_setsockopt): Add support for FreeBSD multicast
953         sockets. Fixes #81891.
954         Code is contributed under MIT/X11 license.
955
956 2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>
957
958         * processes.h, processes.c : ok, they are simple string.
959
960 2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>
961
962         * processes.h : sigh, I really hate fixing them on windows :(
963
964 2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>
965
966         * processes.c : fix build again.
967
968 2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>
969
970         * processes.h : removed extra parameters from CreateProcessWithLogonW.
971
972 2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>
973
974         * processes.c, processes.h: added CreateProcessWithLogonW(). For now
975           it just calls CreateProcess().
976         * io-layer.h : CreateProcessWithLogonW() requires WINVER 0x0500
977           on Windows.
978
979 2007-08-23  Robert Jordan  <robertj@gmx.net>
980
981         * processes.[c|h]: Implement Get|SetPriorityClass ().
982         Code is contributed under MIT/X11 license.
983
984 Tue Aug 21 20:08:09 CEST 2007 Paolo Molaro <lupus@ximian.com>
985
986         * io.c: made convert_arg_to_utf8() and write_file() static.
987         Worked around gcc's incorrect warning.
988
989 2007-08-20  William Holmes  <billholmes54@gmail.com>
990
991         *io.c: Added implementation for ReplaceFile.
992         *io.h: Added deceleration for ReplaceFile method.
993
994         Code is contributed under MIT/X11 license.
995
996 2007-08-20  Wade Berrier  <wberrier@novell.com>
997
998         * processes.c: include sys/resource.h for rusage to fix 
999         mac 10.3 build
1000
1001 Mon Aug 20 12:36:42 CEST 2007 Paolo Molaro <lupus@ximian.com>
1002
1003         * processes.c: implemented query for user/system times using
1004         getrusage ().
1005
1006 2007-08-10  Dick Porter  <dick@ximian.com>
1007
1008         * sockets.c (_wapi_getsockopt, _wapi_setsockopt): Check the option
1009         level as well as the name when mangling some of the values.  Fixes
1010         bug 82000.
1011
1012 2007-08-02  Dick Porter  <dick@ximian.com>
1013
1014         * sockets.c: Changes in error handling, and move the SO_REUSEADDR
1015         setting from metadata/socket-io.c.
1016
1017 2007-08-01  Dick Porter  <dick@ximian.com>
1018
1019         * io-portability.c (_wapi_io_scandir): Special-case patterns
1020         ending in '.*' so that files with no extension are also matched.
1021         Fixes bug 82212.
1022
1023         * wapi_glob.h: 
1024         * wapi_glob.c: Reinstate WAPI_GLOB_APPEND, and add
1025         WAPI_GLOB_UNIQUE to avoid matching the same entry twice when
1026         appending.
1027
1028 2007-07-26  Dick Porter  <dick@ximian.com>
1029
1030         * handles-private.h: 
1031         * thread-private.h: 
1032         * handles.h: 
1033         * critical-sections.c: 
1034         * handles.c: 
1035         * critical-section-private.h:
1036         * error.h: 
1037         * threads.c: 
1038         * error.c: Clean up TLS and pthreads structures.  Finishes off bug
1039         78739.
1040
1041         * collection.c (collection_thread): Exit the collection thread if
1042         the io-layer has been cleaned up.
1043
1044         * mono-mutex.h (mono_mutexattr_destroy): Add this define too
1045
1046 Mon Jul 23 10:40:35 CEST 2007 Paolo Molaro <lupus@ximian.com>
1047
1048         * timefuncs.c: make TickCount measure from boot time if it's
1049         available.
1050
1051 2007-07-19  Juraj Skripsky  <js@hotfeet.ch>
1052
1053         * io.c (MoveFile): Fix a leak. 
1054
1055 Fri Jul 13 12:46:15 CEST 2007 Paolo Molaro <lupus@ximian.com>
1056
1057         * handles-private.h, handles.c, thread-private.h, threads.c,
1058         uglify.h, wait.c: temporarily revert the alertable wait changes
1059         (r79386) until the deadlock issues are fixed.
1060
1061 2007-06-22  Dick Porter  <dick@ximian.com>
1062
1063         * shared.c: The non-shared mutexes weren't being initialised properly
1064         on macos.  Fixes bug 81929.
1065
1066 2007-06-13  Randolph Chung  <tausq@debian.org>
1067
1068         * atomic.h: Enable for all hppa targets.
1069         * Makefile.am: rename hppa_atomic.s to hppa_atomic.S so the preprocessor
1070         can handle the file.
1071         * hppa_atomic.s: Renamed to ...
1072         * hppa_atomic.S: ... and updated to work on both HPUX and Linux.
1073
1074 2007-06-13  Dick Porter  <dick@ximian.com>
1075
1076         * handles.c (timedwait_signal_wait_cond): Alertable waits on
1077         private handles are now interrupted by signalling the same
1078         condition that would end the wait if the handle became signalled,
1079         rather than polling.  (Shared handles still have to poll.)
1080
1081         * threads.c (_wapi_thread_queue_apc): Interrupt the thread if it's
1082         waiting on a handle
1083
1084         * handles-private.h (_wapi_handle_current_thread_set_waiting_on):
1085         Helper functions to inform the APC queuing functions when threads
1086         are waiting for handles, and to interrupt the wait.
1087
1088         * wait.c (WaitForMultipleObjectsEx): Need to tell the handle
1089         waiting functions if any of the handles in question are shared
1090
1091 2007-06-06  Miguel de Icaza  <miguel@novell.com>
1092
1093         * processes.c (is_managed_binary): Fix for OSX.
1094
1095 2007-06-06  Wade Berrier  <wberrier@novell.com>
1096
1097         * atomic.h (InterlockedExchangePointer): cast to pointer to to silence
1098         compiler warnings (autobuild fails the build on this type of warning)
1099
1100 2007-05-21  Dick Porter  <dick@ximian.com>
1101
1102         * io-portability.c (_wapi_g_dir_open): Don't propagate any errors
1103         from the second call to g_dir_open, preserve the original error if
1104         the second call still fails but clear the error if it succeeds.
1105
1106 2007-05-10  Dick Porter  <dick@ximian.com>
1107
1108         * sockets.c (_wapi_recvfrom): Refine the fix to bug 75705 so EINTR
1109         isn't returned if the remote end shuts down cleanly.  Fixes zmd
1110         and the second example in bug 75705.
1111
1112 2007-04-26  Dick Porter  <dick@ximian.com>
1113
1114         * shared.c (_wapi_shm_semaphores_init): Need to check
1115         MONO_DISABLE_SHM in this entry point, as it's called before
1116         _wapi_shm_attach().  Fixes bug 81436.
1117
1118 2007-04-24  Dick Porter  <dick@ximian.com>
1119
1120         * sockets.c (_wapi_recvfrom, socket_close): Force recvfrom() to
1121         error if the socket is closed while the receive is blocking.
1122         Fixes bug 75705.
1123
1124 2007-04-13  Dick Porter  <dick@ximian.com>
1125
1126         * shared.h:
1127         * shared.c: Complete the reimplementation of disabling of shared
1128         memory, by not allocating sysv semaphores when shm disabling has
1129         been requested (either at compile time or run time.)
1130
1131         * processes.c (CreateProcess): Don't synchronize locking across
1132         processes when forking, when shared memory has been disabled.
1133
1134 2007-04-06  Andreas Faerber  <andreas.faerber@web.de>
1135
1136         * wapi_glob.h:
1137         * wapi_glob.c: remove reference to sys/cdefs.h, use glib instead.
1138         Fixes: 81326
1139
1140 2007-04-05  Dick Porter  <dick@ximian.com>
1141
1142         * io.c:
1143         * io-portability.c (_wapi_io_scandir): Moved from io.c, and
1144         changed to use a cut-down version of glob(3) that has been
1145         extended to match with case-insensitivity if needed.
1146
1147         * wapi_glob.h:
1148         * wapi_glob.c: Cut down implementation of glob(3), based on
1149         OpenBSD.
1150
1151 2007-03-22  Dick Porter  <dick@ximian.com>
1152
1153         * sockets.c (_wapi_connect): Do additional checks when connect(2)
1154         fails, because some systems don't let it be restarted.  Patch
1155         based on one submitted by Robert S Wojciechowski <robertw@ssgx.com>,
1156         fixes bug 81010.
1157
1158 2007-03-09  Jonathan Chambers  <joncham@gmail.com>
1159
1160         * io-layer.h:  Remove UNICODE and _UNICODE defines as 
1161         these are done by configure.in now.
1162         
1163         Code is contributed under MIT/X11 license.
1164         
1165 Thu Mar 8 19:42:17 CET 2007 Paolo Molaro <lupus@ximian.com>
1166
1167         * shared.c: partial support for MONO_DISABLE_SHM env var.
1168
1169 2007-03-05  Wade Berrier  <wberrier@novell.com>
1170
1171         * atomic.h: atomic fixes from Michael Matz for for s390 
1172         and s390x ( bnc #237611 and bxc #80892 )
1173
1174 2007-03-05  Miguel de Icaza  <miguel@novell.com>
1175
1176         * io.c (CreateFile): Use FILE_ATTRIBUTE_TEMPORARY to mean 0600
1177         permissions.  For 80688
1178
1179         (MoveFile): Use errno_copy here, just to avoid a potential
1180         errno-changing code in the future from g_free. 
1181         
1182         Also, ignore EXDEV errors as they are handled immediately after
1183         (avoid printing out an error). 
1184
1185         Fixes: 80655
1186
1187 Mon Feb 12 15:50:24 CET 2007 Paolo Molaro <lupus@ximian.com>
1188
1189         * shared.c: exit if semaphores can't be created (bug #80616).
1190
1191 2007-02-01  Geoff Norton  <gnorton@customerdna.com>
1192
1193         * collection.c: NetBSD doesn't define PTHREAD_STACK_MIN.
1194
1195 2007-01-26  Dick Porter  <dick@ximian.com>
1196
1197         * socket-private.h: 
1198         * sockets.c (_wapi_getsockopt): Windows seems to not reset
1199         SO_ERROR values when they're read, contrary to the documentation.
1200         Fixes the new issues raised in bug 79878 (example in C showing
1201         winsock behaviour attached to that bug.)
1202
1203 2007-01-15 Mark Mason <mason@broadcom.com
1204
1205         * atomic.h: add locking primitives for MIPS.
1206         
1207 2007-01-11  Dick Porter  <dick@ximian.com>
1208
1209         * sockets.c (_wapi_connect): Don't do the SO_BROADCAST setting
1210         here, do it in managed code instead.
1211         (_wapi_getsockopt): SO_RCVTIMEO and SO_SNDTIMEO use struct
1212         timeval, which has a microsecond field, not milliseconds.
1213         (_wapi_setsockopt): ditto.
1214         (_wapi_setsockopt): Halve the SO_SNDBUF and SO_RCVBUF values on
1215         Linux, as the kernel doubles whatever we set.
1216         (_wapi_socket): Save socket domain, type and protocol so it can be
1217         duplicated later.
1218         (socket_disconnect): Implement socket disconnect (closing the
1219         socket, but keeping the file descriptor.)
1220         (wapi_disconnectex): A basic implementation of DisconnectEx().
1221         (wapi_transmitfile): A very basic implementation of
1222         TransmitFile().
1223         (WSAIoctl): Implement the SIO_GET_EXTENSION_FUNCTION_POINTER
1224         ioctl.
1225
1226         * socket-private.h (struct _WapiHandle_socket): Record socket
1227         domain, type and protocol info so it can be duplicated later.
1228
1229         * sockets.h (WSAID_DISCONNECTEX,WSAID_TRANSMITFILE): Structures
1230         and defines needed to look up the DisconnectEx() and
1231         TransmitFile() functions by GUID.
1232
1233         * error.c (errno_to_WSA): Change ETIMEDOUT mapping to
1234         WSAETIMEDOUT; add EDESTADDRREQ.
1235
1236         * io-layer.h: Need mswsock.h on windows now.
1237
1238 2007-01-04  Miguel de Icaza  <miguel@novell.com>
1239
1240         * io-portability.c (find_file): Fix a coverity warning (scanning
1241         being unassigned).   
1242
1243 2006-12-31  Miguel de Icaza  <miguel@novell.com>
1244
1245         * io-portability.c (find_file): Do not abort if an empty filename
1246         has been passed.  This fixes the case where MONO_IOMAP=all would
1247         assert if Directory.Exists ("") was called.
1248
1249 Mon Dec 18 14:54:37 CET 2006 Paolo Molaro <lupus@ximian.com>
1250
1251         * processes.c: moved a free on the error path.
1252
1253 Thu Dec 14 21:42:39 CET 2006 Paolo Molaro <lupus@ximian.com>
1254
1255         * processes.c: fixed a few memory leaks when executing
1256         processes.
1257
1258 Mon Nov 27 13:12:17 GMT 2006 Paolo Molaro <lupus@ximian.com>
1259
1260         * atomic.h: fix arm compare and exchange (bug #78500).
1261
1262 2006-11-23  Dick Porter  <dick@ximian.com>
1263
1264         * process-private.h (struct _WapiHandle_process): Add 'waited'
1265         parameter
1266
1267         * processes.c (process_wait): Check the 'waited' parameter not the
1268         signalled state when testing if a process has already been waited
1269         for, as the child process itself may set signalled when exiting.
1270         Fixes bug 79885.
1271
1272         * wapi-private.h (_WAPI_HANDLE_VERSION): Bump shared data version
1273
1274         * shared.c: Now the shared data version has been incremented we
1275         can set the counter semaphore initial value correctly
1276
1277 2006-11-22  Dick Porter  <dick@ximian.com>
1278
1279         * processes.c (process_wait): Cope when the background process
1280         reaper gets the process we were waiting for.  Special case for
1281         waiting for our own process to exit.  Fixes bug 77736.
1282
1283 2006-11-17  Dick Porter  <dick@ximian.com>
1284
1285         * processes.c: Fix const correctness and typos that caused memory
1286         corruption. 
1287         
1288 2006-11-17  Miguel de Icaza  <miguel@novell.com>
1289
1290         * processes.c (ShellExecuteEx): Check error after CreateProcess,
1291         thanks to Dick for pointing this out. 
1292
1293 2006-11-16  Miguel de Icaza  <miguel@novell.com>
1294
1295         * processes.c (ShellExecuteEx): If we fail to create a process in
1296         ShellExecute, then try to use the xdg-open command, and if that
1297         fails, try to use the gnome-open command, 
1298
1299         Refactor the code so that we do not have to duplicate all this
1300         code, but instead use a ucs2-aware version of the code to do
1301         concatenations.
1302
1303 2006-11-13  Dick Porter  <dick@ximian.com>
1304
1305         * io.c (_wapi_stat_to_file_attributes): If the file is a symlink
1306         add the FILE_ATTRIBUTE_REPARSE_POINT flag.  This is an attempt to
1307         follow the specs for the windows symlink support, but will
1308         probably have to be reworked when I have test data from a vista
1309         machine.  Fixes bug 79887.
1310
1311 2006-11-11  Miguel de Icaza  <miguel@novell.com>
1312
1313         * handles.c (CloseHandle): Cope here with the new value
1314         INVALID_HANDLE_VALUE set on handles.  
1315
1316         * processes.c (CreateProcess): Initialize the value of hThread to
1317         be INVALID_HANDLE_VALUE on failure, not to be NULL.  Improvement
1318         for #75733
1319
1320 2006-11-09  Dick Porter  <dick@ximian.com>
1321
1322         * sockets.c (_wapi_select): Do some sanity checking on the
1323         fd_sets, to avoid file descriptors > FD_SETSIZE.
1324         (_wapi_FD_CLR, _wapi_FD_ISSET, _wapi_FD_SET): Avoid file
1325         descriptors > FD_SETSIZE.
1326
1327 2006-10-27  Dick Porter  <dick@ximian.com>
1328
1329         * io.c (GetFileAttributes): Force symlinks to directories to be
1330         returned as a regular file.  Fixes bug 79733.
1331
1332 2006-10-18  Miguel de Icaza  <miguel@novell.com>
1333
1334         * io-portability.c (find_in_dir): First string dup, then closedir.
1335
1336 2006-10-12  Dick Porter  <dick@ximian.com>
1337
1338         * processes.c (_wapi_process_reap): Unref a process handle if we
1339         reaped it, found by Zoltan.  Fixes bug 79286.
1340         (process_wait): Don't wait again if we've already waited for a
1341         process.
1342
1343 2006-10-11  Sergey Tikhonov <tsv@solvo.ru>
1344
1345         * atomic.h: Fix atomic decrement.
1346
1347         * mini/cpu-alpha.md: Use native long shift insts
1348
1349         * mono/mono/mini/tramp-alpha.c: Implemented
1350         mono_arch_patch_delegate_trampoline method
1351
1352         * Started work on using global registers
1353         
1354         * Use byte/word memory load/store insts if cpu supports it
1355         
1356         * Code clean up
1357
1358         
1359 2006-10-09  Zoltan Varga  <vargaz@gmail.com>
1360
1361         * handles.c (timedwait_signal_poll_cond): Add an alertable parameter, and if it
1362         is FALSE, avoid busy waiting.
1363
1364         * wait.c: Add an alertable parameter to the wait routines.
1365
1366 2006-10-06  Miguel de Icaza  <miguel@novell.com>
1367
1368         * io-portability.c (find_file): Rename from
1369         MONO_IO_PORTABILITY_HELP to MONO_IOMAP.
1370
1371 2006-10-03  Dick Porter  <dick@ximian.com>
1372
1373         * io-portability.h: 
1374         * io-portability.c: Optional portability helpers and wrapped
1375         system calls to try to cope with windows filenames in
1376         applications.
1377
1378         * io.c: Use the wrapped system calls
1379
1380 2006-09-01  Zoltan Varga  <vargaz@gmail.com>
1381
1382         * critical-sections.h critical-sections.c: Make Enter/LeaveCriticalSection a macro
1383         since they are perf critical.
1384
1385         * atomic.h: Applied patch from Jakub Boqusz <qboosh@pld-linux.org>.
1386         Add atomic ops implementation for alpha.
1387
1388 2006-08-11  Dick Porter  <dick@ximian.com>
1389
1390         * processes.c (_wapi_process_reap): Avoid a deadlock by setting
1391         process termination details in an outer loop, not the
1392         _wapi_search_handle() one.
1393
1394 2006-08-10  Dick Porter  <dick@ximian.com>
1395
1396         * threads.c (_wapi_thread_queue_apc)
1397         (_wapi_thread_dispatch_apc_queue): Use a process-local mutex here
1398         instead of the cross process semaphore.  We already check that
1399         access to the APC queue is within the owning process so there's no
1400         need to protect from other processes.  Avoids a global deadlock
1401         when a thread is aborted while it holds the handle semaphore
1402         locked.
1403         (_wapi_thread_apc_pending): Hide an annoying message which can
1404         happen if a thread handle has been blown away at process shutdown
1405         while it is in an alertable wait.
1406
1407         Both problems seen while shutting down monodevelop.
1408
1409 2006-07-25  Dick Porter  <dick@ximian.com>
1410
1411         * shared.c (_wapi_shm_file): Remove '/' characters from the uname
1412         results.  Fixes bug 78917.
1413
1414 2006-07-20  Dick Porter  <dick@ximian.com>
1415
1416         * threads.c (_wapi_thread_set_termination_details): Improve the
1417         test for already-disposed thread handles, and hold the lock around
1418         the mutex abandoning.
1419
1420 2006-07-17  Dick Porter  <dick@ximian.com>
1421
1422         * processes.c (CreateProcess): Don't change directory unless a new
1423         one has been specified.  Fixes bug 78751.
1424
1425 2006-07-06  Dick Porter  <dick@ximian.com>
1426
1427         * io.c (_wapi_stat_to_file_attributes): Do a better job at
1428         figuring out the file attributes
1429         (_wapi_set_last_path_error_from_errno): New helper function to
1430         turn errno into w32 error codes that handles the differences
1431         between file and directory errors
1432         (file_setendoffile): Try turning off the extra write used to
1433         extend files, because we probably don't need it on any modern
1434         platform.  If it is needed though, we also need to lseek the file
1435         position back again
1436         (CreateFile): Treat character-special devices as a console handle,
1437         because they can't be seeked
1438         (CopyFile): If fail_if_exists is set, then the destination needs
1439         to be opened with O_EXCL
1440         (CopyFile): If fail_if_exists is not set and the destination
1441         already exists, then we should set the ERROR_ALREADY_EXISTS error
1442         even though we return success
1443         (stdhandle_create): STD_INPUT_HANDLES cannot be written to
1444         (GetStdHandle): Rework without using mono_once, so console handles
1445         can be properly closed and reopened.
1446         (mono_io_scandir): Only override errno with EACCES when the
1447         directory actually exists
1448         (FindFirstFile): Set ERROR_FILE_NOT_FOUND when no files are
1449         returned
1450         (FindClose): Cope with NULL handles
1451         (CreateDirectory): When the target already exists, just return an
1452         error.  It's the caller's job to figure out what to do.
1453         (SetCurrentDirectory): Cope with a NULL path
1454         (RemoveDirectory, GetFileAttributes, GetFileAttributesEx,
1455         SetFileAttributes, FindFirstFile, DeleteFile, MoveFile, CopyFile,
1456         CreateFile): Set path error correctly
1457
1458         * handles.c (CloseHandle): Kludge to try and cope with passing a
1459         NULL handle
1460
1461         * error.h: Add NO_ERROR as an alternative to ERROR_SUCCESS
1462
1463         * uglify.h: Added some more typedefs
1464
1465 2006-07-05  Dick Porter  <dick@ximian.com>
1466
1467         * io.c (GetFileAttributes, GetFileAttributesEx): Cope with
1468         dangling symlinks.  Fixes bug 78664.
1469
1470 2006-06-23  Dick Porter  <dick@ximian.com>
1471
1472         * handles.c (handle_cleanup): 
1473         * threads.c: Clean up threads properly when we're forcibly
1474         removing the handle entries from the shared file in
1475         handle_cleanup().  Fixes bug 78241, for real this time.
1476
1477 2006-06-15 Neale Ferguson <neale@sinenomine.net>
1478
1479         * atomic.h: More tinkering with InterlockedExchange/InterlockedCompareExchange
1480         for s390/s390x.
1481
1482 2006-06-14 Neale Ferguson <neale@sinenomine.net>
1483
1484         * atomic.h: Fix atomic exchange pointer operations for s390x - these
1485         were broken as they used 32-bit instructions rather than their 64-bit
1486         versions.
1487
1488 2006-06-14  Dick Porter  <dick@ximian.com>
1489
1490         * processes.c: Don't run the atexit handlers when bailing out
1491         of a fork/exec.
1492
1493 2006-06-14  Dick Porter  <dick@ximian.com>
1494
1495         * wait.c: Fix stupid typo shown up by gcc 4.1.1, = not ==
1496
1497         * handles-private.h: 
1498         * shared.c: 
1499         * io.c: 
1500         * processes.c: 
1501         * mono-spinlock.h: 
1502         * handles.c: 
1503         * collection.c: Fix a bunch of signed/unsigned warnings from gcc
1504         4.1.1
1505
1506 2006-06-09 Neale Ferguson <neale@sinenomine.net>
1507
1508         * atomic.h: Fix atomic operations for s390x (not really broken 
1509         but changed to use full 64-bit opcodes).
1510
1511 2006-05-24  Dick Porter  <dick@ximian.com>
1512
1513         * processes.c (process_set_current): Don't take an extra reference
1514         if we have to create our own process handle.  Fixes bug 78241
1515         again.
1516
1517         * threads.c (_wapi_thread_signal_self): Renamed from
1518         _wapi_thread_abandon_mutexes, also sets the thread state to
1519         signalled and drops a reference.  Called by the runtime when the
1520         main thread cleans itself up.
1521
1522         * handles.c (handle_cleanup): As a last resort, unref every shared
1523         handle as the process is now exiting.
1524
1525 2006-05-16  Dick Porter  <dick@ximian.com>
1526
1527         * processes.c (process_set_termination_details): Unref the handle
1528         when we've stored the exit details.  Fixes the rest of 78241.
1529
1530 2006-05-12  Dick Porter  <dick@ximian.com>
1531
1532         * threads.c: Implement pseudo handles, making GetCurrentThread()
1533         match MS behaviour.  Notice when attached threads exit, and unref
1534         the handle.  Fix usage of GetCurrentThread() in other places.
1535
1536         * handles.c (DuplicateHandle): Implement a basic form of
1537         DuplicateHandle().
1538
1539         * wait.c: Fix usage of GetCurrentThread() throughout, and cope
1540         with pseudo handles.
1541
1542 2006-04-26  Miguel de Icaza  <miguel@novell.com>
1543
1544         * io.c (file_close): Oops, do not use DeleteFile which expects
1545         unicode, instead use unlink directly
1546
1547         Add support for the new FileOptions bits on .NET 2.0.
1548
1549         It might be good if Dick reviews these changes.
1550         
1551         * io.c (file_close): If DeleteOnClose is set, then delete the file
1552         before freeing it.
1553         (CreateFile): Do not support encryption per user. 
1554         
1555         If posix_fadvise exists, pass hints on sequential scan and random
1556         access.   Did not figure out what WRITE_THROUGH maps to.
1557
1558 2006-04-26  Dick Porter  <dick@ximian.com>
1559
1560         * sockets.c (WSAIoctl): Check the output buffer is valid before
1561         writing to it.
1562
1563         * handles.c (_wapi_search_handle): Set shared pointer if we find a
1564         shared handle that has been already opened.
1565
1566 2006-04-21  Dick Porter  <dick@ximian.com>
1567
1568         * threads.c (GetCurrentThread): Reference the handle if we return
1569         an already-known thread.
1570
1571 2006-04-07  Dick Porter  <dick@ximian.com>
1572
1573         * processes.c: Fix build for older glib.
1574
1575 2006-04-06  Dick Porter  <dick@ximian.com>
1576         
1577         * processes.c (CreateProcess): Add a reference to the child
1578         process' handle, so it won't be destroyed if this process closes
1579         its copy of the handle.  Fixes bug 77393.
1580         
1581         * processes.c (process_set_current): Fall through to creating a
1582         new one if the handle lookup fails.
1583
1584         * processes.c (_wapi_process_signal_self):
1585         * handles.c (handle_cleanup): The process is exiting, so set the
1586         handle state for this process to signalled.  This should let other
1587         non-related processes wait for this handle.
1588         
1589         * handles.c (_wapi_search_handle): Don't search shared handles in
1590         all cases.
1591
1592         * collection.c (collection_thread): No need to do a collection
1593         scan straight away, do the waiting first.
1594
1595 2006-04-06  Dick Porter  <dick@ximian.com>
1596
1597         * shared.c: Fix parameters in semctl () call.
1598
1599 2006-03-28  Zoltan Varga  <vargaz@gmail.com>
1600
1601         * atomic.h atomic.c: Applied patch from David S. Miller 
1602         <davem@davemloft.net>: Reimplement Interlocked* primitives on sparc 
1603         using CAS/CASx when __GNUC__, else we will fall back to the generic 
1604         pthread version.
1605
1606 2006-03-27  Dick Porter  <dick@ximian.com>
1607
1608         * shared.c (_wapi_shm_file_open): Break out of a loop if the
1609         shared file is smaller than expected.  (We loop a few times in
1610         case another process is in the middle of creating the file.)
1611
1612 2006-03-22  Dick Porter  <dick@ximian.com>
1613
1614         * handles.c:
1615         * wapi-private.h:
1616         * shared.h:
1617         * shared.c: Delete the semaphores and shared files when the last
1618         process has finished with them
1619
1620 2006-03-15  Dick Porter  <dick@ximian.com>
1621
1622         * events.c: 
1623         * io.c: 
1624         * mutexes.c: 
1625         * processes.c: 
1626         * semaphores.c: 
1627         * sockets.c: 
1628         * threads.c: Explicitly initialise the handle ops struct
1629
1630 2006-03-14  Dick Porter  <dick@ximian.com>
1631
1632         * handles-private.h: 
1633         * wapi-private.h: 
1634         * wait.c: 
1635         * handles.c: Add a 'prewait' stage to the handle waiting, to give
1636         waiting threads a chance to check for bogus states before
1637         blocking.
1638
1639         * mutexes.c (namedmutex_prewait): Use the prewait stage to check
1640         for named mutexes that have been abandoned in a locked state (eg
1641         if a process exited abnormally while owning the mutex) and
1642         override it if needed.
1643
1644 2006-03-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1645
1646         * wait.c: speed up WaitFor* when the timeout is 0.
1647
1648 2006-03-03  Dick Porter  <dick@ximian.com>
1649
1650         * processes.c (ShellExecuteEx): Cope when some of the parameters
1651         are NULL.
1652
1653 2006-02-27  Dick Porter  <dick@ximian.com>
1654
1655         * mutexes.c: 
1656         * mono-mutex.c: 
1657         * threads.c: Comparing pthread_t with == is not portable, so use
1658         pthread_equal().
1659
1660 Thu Feb 23 18:47:20 GMT 2006 Paolo Molaro <lupus@ximian.com>
1661
1662         * *.h, *.h: patch from Dick to make Linuxthreads systems work again.
1663
1664 2006-02-22  Dick Porter  <dick@ximian.com>
1665
1666         * thread-private.h: 
1667         * threads.c: There's no need to use the timed-thread support code
1668         any more, as we aren't using the timed join.  This greatly
1669         simplifies thread setup, and fixes a memory leak (bug 77521).
1670
1671         Don't bother to store thread IDs in a hash table, use TLS instead.
1672         The one case that needs to look up the handle of a different
1673         thread (OpenThread()) can do the extra work itself.  Fixes bug
1674         77536.
1675
1676         * handles.c (_wapi_search_handle): Add a reference when returning
1677         a private handle (shared handles are already reffed.)
1678         
1679 2006-02-17  Dick Porter  <dick@ximian.com>
1680
1681         * handles-private.h: 
1682         * handles.c: Check handle values passed to array lookups.  Fixes
1683         bug 77572.
1684
1685 2006-02-09  Dick Porter  <dick@ximian.com>
1686
1687         * threads.c: Cope with the problems caused by attaching already
1688         existing threads - they don't get the infrastructure to clean up
1689         after themselves, especially the ID to handle hash.  This fixes
1690         bug 77468.
1691
1692 2006-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1693
1694         * shared.c: use MONO_SHARED_HOSTNAME as a substitute for gethostname()
1695         when creating the shared files in the .wapi directory. Fixes bug #77371.
1696
1697 2006-02-02  Martin Baulig  <martin@ximian.com>
1698
1699         * threads.c: Removed the `WITH_INCLUDED_LIBGC' section; it has
1700         never been used so far. 
1701
1702         * timed-thread.h (TimedThread): Removed the `stack_ptr' field; it
1703         has only been used by the removed code.
1704
1705 2006-01-03  Neale Ferguson <neale@sinenomine.net>
1706
1707         * atomic.h: Correct s390x definitions and eliminate compiler warnings.
1708
1709 2006-01-03  Sebastien Pouliot  <sebastien@ximian.com>
1710
1711         * io.c: Patch _wapi_stat_to_file_attributes against bug #76966, where
1712         sockets could be considered as directory.
1713
1714 2005-12-23  Dick Porter  <dick@ximian.com>
1715
1716
1717         * semaphores.h: 
1718         * semaphores.c: Implement OpenSemaphore
1719
1720         * mutexes.c: 
1721         * mutexes.h: Implement OpenMutex
1722
1723         * wapi-private.h: 
1724         * handles.c: 
1725         * events.c: 
1726         * events.h: 
1727         * event-private.h: Implement named events.  Implement OpenEvent.
1728
1729 2005-12-15  Dick Porter  <dick@ximian.com>
1730
1731         * processes.c (CreateProcess): The pipe-based cross-process
1732         exclusion technique was trying to write NULL buffers when appname
1733         was NULL (eg when coming from ShellExecuteEx,) which usually
1734         succeeded even though EFAULT was returned - but sometimes it
1735         failed.  This meant that the child process could block forever on
1736         the pipe read.  Replace it with the simpler shared handle
1737         semaphore protection used everywhere else.  This showed up with
1738         the test case in bug 76684.
1739
1740 Tue Dec 13 11:41:49 GMT 2005 Paolo Molaro <lupus@ximian.com>
1741
1742         * shared.c: fallback to private mmap when shared mmap doesn't work
1743         (like on jffs).
1744
1745 2005-12-06  Dick Porter  <dick@ximian.com>
1746
1747         * wapi-private.h: 
1748         * handles.c: 
1749         * semaphore-private.h: 
1750         * semaphores.c: Implement named semaphores
1751
1752 2005-11-24  Dick Porter  <dick@ximian.com>
1753
1754         * processes.c (GetProcessId): Implement GetProcessId()
1755
1756 2005-11-17  Dick Porter  <dick@ximian.com>
1757
1758         * processes.h: 
1759         * processes.c: Implement ShellExecuteEx as a wrapper around
1760         CreateProcess.
1761
1762 2005-11-11  Dick Porter  <dick@ximian.com>
1763
1764         * threads.c: Give mutex abandoning its own exported function, so
1765         it can be called when the runtime is cleaning up.
1766
1767         * handles.c (_wapi_search_handle_namespace): Do a handle
1768         collection befre starting to check namespace strings, so that any
1769         stale cruft gets removed.
1770
1771 2005-11-11  Dick Porter  <dick@ximian.com>
1772
1773         * threads.c: Move thread handles back into the shared space.
1774
1775         * handles.c (_wapi_handle_unref): Add support for shared handles
1776         with close() handlers
1777
1778 2005-11-04  Dick Porter  <dick@ximian.com>
1779
1780         * sockets.c (ioctlsocket): Use select instead of if to avoid a
1781         type promotion problem on 64bit freebsd.  Based on patch by Lou
1782         Kamenov <kamenovl@gmail.com>, fixes bug 76447.
1783
1784 2005-11-04  Dick Porter  <dick@ximian.com>
1785
1786         * io.c (file_write): Only do the file locking if
1787         MONO_STRICT_IO_EMULATION is set.
1788
1789 2005-10-21  Dick Porter  <dick@ximian.com>
1790
1791         * processes.c: 
1792         * handles.c (_wapi_lookup_handle): Cope when the shared part of a
1793         handle has been deleted.
1794         (_wapi_handle_unref): And when the deleted shared part is pointed
1795         to as a handle is deleted
1796
1797 2005-10-20  Dick Porter  <dick@ximian.com>
1798
1799         * processes.c (process_set_current): If the expected process
1800         handle slot doesn't contain the correct pid, create a new handle.
1801
1802         * handles.c (_wapi_search_handle): When the search doesn't find
1803         anything, return failure instead of the last handle we looked at.
1804         (_wapi_handle_ref, _wapi_handle_unref): Don't try to ref or unref
1805         unused handles (makes tracking refcounting bugs easier.)
1806
1807 2005-10-19  Dick Porter  <dick@ximian.com>
1808
1809         * handles.c:
1810         * handles-private.h:
1811         * wapi-private.h: 
1812         * processes.c: 
1813         * mutexes.c:
1814         * collection.c (_wapi_handle_collect): Remove the shared handle
1815         indirection layer, and use locking instead.  Delete other
1816         complexity that is no longer needed.  Refcount shared handles and
1817         delete them when needed, but keep the timestamps so that orphaned
1818         handles will be cleaned up eventually.
1819
1820         * shared.c (_wapi_shm_file): Add processor, OS and struct size
1821         info to the shared file names, to cope with dual-boot and 32/64bit
1822         size issues.  Fixes bug 75839.
1823
1824         * wait.c (WaitForMultipleObjectsEx): No need to distinguish
1825         between shared handles and private, as the wait functions cope
1826         with both together now.
1827
1828 2005-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1829
1830         * io.c: removed NO_SIGPIPE macro.
1831         * sockets.c: no need for MSG_NOSIGNAL or ignoring SIGPIPE.
1832
1833 2005-10-11  Dick Porter  <dick@ximian.com>
1834
1835         * sockets.c (_wapi_getsockopt): Translate SO_ERROR results into
1836         w32 error codes.
1837
1838         * error.c (errno_to_WSA): Don't return a bogus error if someone
1839         asks to translate errno 0.
1840
1841 2005-10-11  Dick Porter  <dick@ximian.com>
1842
1843         * handles.c: Fix several race conditions
1844
1845 2005-10-11 Miguel de Icaza <miguel@novell.com>
1846
1847         * io.c: no need to block SIGPIPE anymore, as it is ignored.
1848
1849 2005-10-05  Dick Porter  <dick@ximian.com>
1850
1851         * threads.c (_wapi_thread_own_mutex, _wapi_thread_disown_mutex):
1852         Keep a reference to mutexes owned by threads, so they won't be
1853         destroyed prematurely.  Fixes dotmsnclient crash.
1854
1855 2005-09-26  Sebastien Pouliot  <sebastien@ximian.com>
1856
1857         * io.c: Apply patch from #76192 (Can't write files past 2gb on AMD64 
1858         (x86_64)) for Brion on IRC (Dick approved it).
1859
1860 2005-09-23  Dick Porter  <dick@ximian.com>
1861
1862         * processes.c: Don't wait for processes that have already been
1863         signalled; also fix typo.
1864
1865         * handles.c: Improve locking inside new handle and handle
1866         searching functions.
1867
1868 2005-09-20  Dick Porter  <dick@ximian.com>
1869
1870         * collection.c: 
1871         * processes.c: Periodically waitpid for known process IDs.  Fixes
1872         bug 74870.
1873
1874 2005-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1875
1876         * io.c:
1877         (CreateFile): if the file is a named pipe, treat the handle as a pipe,
1878         not as a file. Fixes bug #76075.
1879
1880 2005-08-27  Zoltan Varga  <vargaz@gmail.com>
1881
1882         * atomic.h: Add support for intel icc.
1883
1884 2005-08-25  Zoltan Varga  <vargaz@gmail.com>
1885
1886         * io-layer.h: Include winbase.h not WinBase.h.
1887
1888 2005-08-19  Dick Porter  <dick@ximian.com>
1889
1890         * threads.c, threads.h, thread-private.h: Use a gsize to store the
1891         thread ID, so it can hold a 64 bit value if needed.
1892
1893 2005-07-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1894
1895         * error.c: map ENOENT to WSAECONNREFUSED. It might happen when
1896         connecting to unix sockets. Closes bug #75632.
1897
1898 2005-07-05  Dick Porter  <dick@ximian.com>
1899
1900         * io.c: Make sure SIGPIPE is ignored when calling write(2).
1901         Prevents the runtime exiting when writing to a closed pipe,
1902         fixing bug 75468.
1903
1904 2005-06-30  Dick Porter  <dick@ximian.com>
1905
1906         * shared.c (_wapi_shm_semaphores_init): Add some helpful error
1907         messages when semget () fails due to lack of resources.
1908
1909 2005-06-21  Dick Porter  <dick@ximian.com>
1910
1911         * mutex-private.h:
1912         * thread-private.h:
1913         * mutexes.c: 
1914         * threads.c: Keep a list of owned mutexes in each thread handle,
1915         so that it is easier to abandon them when the thread exits.
1916         Removes a bottleneck when multiple threads are finishing in
1917         parallel.
1918
1919 2005-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1920
1921         * io.c: (GetLogicalDrives) when a bogus line is read, don't leak memory.
1922         When the buffer has not enough space, close the file before returning.
1923
1924 2005-06-09  Duncan Mak  <duncan@novell.com>
1925
1926         * *.h: Added G_BEGIN_DECLS and G_END_DECLS where appropriate to
1927         all public headers. Fixes #74919.
1928
1929 2005-05-30  Zoltan Varga  <vargaz@freemail.hu>
1930
1931         * atomic.h: Add IA64 atomic ops.
1932
1933 2005-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1934
1935         * processes.c: make ExitCode be valid even if the user didn't call
1936         WaitForExit() and is just polling on HasExited.
1937
1938 2005-05-17  Dick Porter  <dick@ximian.com>
1939
1940         * io.c (file_getfilesize): Clear the error value, so that files
1941         with sizes with the low bits 0xFFFFFFFF can be distinguished from
1942         a genuine error.
1943
1944 2005-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1945
1946         * shared.c: forgot to ignore a warning.
1947
1948 2005-05-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1949
1950         * shared.c: don't display warnings after reboots.
1951
1952 2005-05-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1953
1954         * sockets.c: on windows, getsockopt/setsockopt for send/receive timeout
1955         use an integer in milliseconds. We were using a struct timeval.
1956
1957 2005-05-06  Dick Porter  <dick@ximian.com>
1958
1959         * handles-private.h: 
1960         * mutexes.c: 
1961         * wapi-private.h: 
1962         * shared.h:
1963         * shared.c: 
1964         * wait.c: 
1965         * handles.c: 
1966         * collection.h: Use SysV semaphores for managing access to the
1967         shared memory - in return for the ludicrous api we get
1968         synchronisation primitives that can be cleaned up by the kernel
1969         even when a process quits unexpectedly.  This removes the
1970         timestamp issues.
1971
1972 2005-05-05  Lluis Sanchez Gual  <lluis@novell.com>
1973
1974         * handles.c: Always use polling in the waits, since
1975         mono_cond_timedwait can't be interruped by the thread abort signal.
1976
1977 2005-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1978
1979         * events.c: calling Set on AutoResetEvent several times has the same
1980         effect as calling it only once if no thread is waiting for it.
1981
1982 2005-04-29  Dick Porter  <dick@ximian.com>
1983
1984         * processes.c (EnumProcesses): Use a GArray instead of a GPtrArray
1985         now it's storing pids not handles, also fixes memory leak caused
1986         by unclear glib documentation.
1987
1988         * sockets.c (WSACleanup): Remove unused variable
1989
1990 2005-04-29  Dick Porter  <dick@ximian.com>
1991
1992         * handles.c (_wapi_handle_check_share_by_pid): For systems that
1993         don't have file descriptor info in /proc check that the original
1994         opener of a file is still there, if a share violation would
1995         otherwise happen.
1996
1997 2005-04-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
1998
1999         * handles.c:
2000         * handles-private.h: added _wapi_handle_forecch that loops through all
2001         the handles and call a callback function when a handle of the given
2002         type is found.
2003
2004         * sockets.c: no need to keep open sockets in an array, as we have them 
2005         in the handles structure.
2006
2007         Fixes bug #74755.
2008
2009 2005-04-28  Dick Porter  <dick@ximian.com>
2010
2011         * processes.c: Cope with handles that are only around for as long
2012         as the search is running.  If we're searching for process handles,
2013         check to see if the process is still running and signal it if not.
2014
2015         * handles.c (_wapi_search_handle): Search in the shared space as
2016         well.  Fixed bug 74752.
2017
2018         * mutexes.c:
2019         * handles.c (_wapi_handle_new_from_offset):
2020         _wapi_handle_new_for_existing_ns () was doing exactly the same as
2021         this, so deleted it.
2022
2023 2005-04-26  Dick Porter  <dick@ximian.com>
2024
2025         * handles.c: Fix stupid thinko where if a new shared handle is
2026         created but a collection was needed to free some space, it
2027         returned an error anyway.  Should fix the messages shown in bug
2028         74659.
2029
2030 2005-04-25  Dick Porter  <dick@ximian.com>
2031
2032         * handles.c (_wapi_handle_check_share): Only consider mono
2033         processes when looking to see if a file is still being held open,
2034         while checking share permissions.
2035
2036 2005-04-25  Dick Porter  <dick@ximian.com>
2037
2038         * sockets.c: 
2039         * io.c: 
2040         * wapi-private.h (struct _WapiHandleOps): 
2041         * handles.c (_wapi_handle_unref): When destroying handles, save
2042         the handle data and call the close function only after the array
2043         slot has been cleared.  This prevents race conditions with file
2044         descriptors, fixing bug 74713.
2045
2046         * mutexes.c: Delete the handle close functions, they didn't do
2047         anything anyway
2048
2049         * error.c (_wapi_get_win32_file_error): Add a mapping for EINTR so
2050         the "Unknown error" g_warning doesn't get displayed.
2051
2052 2005-04-25  Dick Porter  <dick@ximian.com>
2053
2054         * wapi-private.h: 
2055         * threads.c: Make thread handles process-private for now to take
2056         some of the space pressure off the shared memory, while I work on
2057         a real fix.
2058
2059 2005-04-21  Dick Porter  <dick@ximian.com>
2060
2061         * handles.c (_wapi_handle_check_share): Make sure there is a "fd"
2062         dir in /proc before blowing away handle info.  Fixes bug 74649.
2063
2064 2005-04-21  Dick Porter  <dick@ximian.com>
2065
2066         * wait.c (WaitForMultipleObjectsEx): Implement special waits
2067
2068         * handles.c (_wapi_handle_wait_signal_poll_share): Don't return a
2069         timeout, just wait briefly for the private signals and let the
2070         waiting thread test again.  This prevents us missing shared
2071         signals.
2072
2073 2005-04-21  Dick Porter  <dick@ximian.com>
2074
2075         * collection.h (_WAPI_HANDLE_COLLECTION_EXPIRED_INTERVAL): Reduce
2076         the time before a slot is considered too old and deleted.  This is
2077         a workaround while I come up with a proper fix.
2078
2079 2005-04-21  Dick Porter  <dick@ximian.com>
2080
2081         * mutexes.c: 
2082         * processes.c: 
2083         * threads.c: 
2084         * handles.c (_wapi_handle_new): Turn assertions into errors.
2085
2086         * collection.c (_wapi_handle_collect): Use symbols not magic
2087         numbers for timeout values
2088
2089 2005-04-19  Dick Porter  <dick@ximian.com>
2090
2091         * mutexes.c: 
2092         * wait.c: 
2093         * handles.c (_wapi_handle_count_signalled_handles)
2094         * handles-private.h (_wapi_handle_shared_lock_handle): Use new
2095         shared handle locks in critical sections.
2096
2097         * handles.c (_wapi_handle_new_for_existing_ns): Reuse old handles
2098         if there is already one there.
2099         
2100         * handles.c (_wapi_handle_ref): It was possible for a process to
2101         exit before getting around to updating shared handle timestamps,
2102         so do it here too.
2103
2104 Tue Apr 19 16:25:47 CEST 2005 Paolo Molaro <lupus@ximian.com>
2105
2106         * threads.c: fix lookup of the thread id in the has table:
2107         always use the id value, not the pointer to the id.
2108
2109 2005-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2110
2111         * handles.c: fix handle returned in _wapi_handle_search_handle. Dick
2112         pointed it out.
2113
2114 2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2115
2116         * io-layer/sockets.c: FIONBIO with a TRUE argument means we want
2117         non-blocking IO, not the other way around.
2118
2119 2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2120
2121         * handles.c:
2122         * io.c:
2123         * handles-private.h: GetFileType wasn't checking if we have memory
2124         allocated for the handle before dereferencing it. Fixes a FileStream
2125         nunit test.
2126
2127 2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2128
2129         * handles.c:
2130         * processes.c:
2131         * handles-private.h: we were calling g_renew to expand the handle array,
2132         but that might move the memory and we might have pthread conditions or
2133         mutexes in the original memory area that are being used. Now instead of
2134         expanding an existing array, we just create new ones and keep a list of
2135         them. Access to _wapi_private_handles had to be modified accordingly.
2136
2137 2005-04-15  Dick Porter  <dick@ximian.com>
2138
2139         * collection.c: FreeBSD needs more than PTHREAD_STACK_MIN
2140
2141 2005-04-14  Raja R Harinath  <rharinath@novell.com>
2142
2143         * wapi-private.h: Remove reference to 'daemon-private.h'.
2144
2145 Wed Apr 13 13:12:33 EDT 2005 Paolo Molaro <lupus@ximian.com>
2146
2147         * atomic.h: applied patch from mass@akuma.org (David Waite)
2148         to fix InterlockedExchangeAdd.
2149         Fixed a few other functions, including InterlockedCompareExchange()
2150         which was miscompiled by gcc with optimizations enabled.
2151
2152 2005-04-13  Dick Porter  <dick@ximian.com>
2153
2154         * io.c (share_check): 
2155         * handles.c (_wapi_handle_check_share): Refine the file check so
2156         that sharing violations within the same process don't cause
2157         assertion failures.
2158
2159 2005-04-13  Dick Porter  <dick@ximian.com>
2160
2161         * io.c (FindFirstFile): Fix bugs introduced with the merge (bug
2162         74586)
2163
2164 2005-04-12  Dick Porter  <dick@ximian.com>
2165         
2166         The daemon-less io-layer.  Extensive lowlevel changes in
2167         handles.c, requiring some corresponding changes in other files
2168         calling these functions.  Private_foo structures have been
2169         eliminated.
2170
2171         File descriptor handling differences account for most of the
2172         changes in io.c and sockets.c.
2173
2174         Other highlights:
2175         
2176         * mutexes.c: Named mutexes are now a distinct type.
2177         * atomic.h: Fix a PPC uninitialised variable warning.
2178         * wait.c: Check conditions before waiting on a condition variable.
2179         * processes.c: Handle process fork and wait without a daemon
2180         (though this has the limitation of only being able to wait for
2181         child processes.)
2182
2183 2005-04-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2184
2185         * io-private.h:
2186         * threads.c:
2187         * threads.h:
2188         * io.c:
2189         * sockets.c:
2190         * sockets.h: removed dead code that deals with async IO.
2191
2192 2005-03-30  Zoltan Varga  <vargaz@freemail.hu>
2193
2194         * atomic.c (InterlockedIncrement): Fix fallback implementation of
2195         InterlockedIncrement and InterlockedDecrement. Fixes #74228.
2196
2197 2005-03-29  Sebastien Pouliot  <sebastien@ximian.com>
2198
2199         * io-layer.h: Add required header files for compiling with VS.NET.
2200
2201 2005-03-17 Miguel de Icaza <miguel@novell.com>
2202
2203         * io.c: don't fail on NFS when there are no more locks available.
2204
2205 2005-03-09  Dick Porter  <dick@ximian.com>
2206
2207         * error.c (_wapi_get_win32_file_error): ENFILE and EMFILE should
2208         map to ERROR_TOO_MANY_OPEN_FILES, not ERROR_NO_MORE_FILES.  Fixes
2209         bug 72671.
2210
2211 2005-03-09  Dick Porter  <dick@ximian.com>
2212
2213         * daemon.c (process_process_fork): Initialise the handle data
2214         before using it in the error case.  This is probably the error
2215         we're working around in the previous change.  Spotted by Taru Jain
2216         <tjain@novell.com> and Hemanth Yamijala <YHemanth@novell.com>.
2217
2218 2005-03-07  Dick Porter  <dick@ximian.com>
2219
2220         * daemon.c: It looks like g_shell_parse_argv() can return
2221         argv[0]=NULL somehow, yet still not give an error.  Make sure we
2222         don't pass NULL to strrchr(), working around a segfault that
2223         showed up on ZLM testing.
2224
2225 2005-03-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2226
2227         * sockets.c: translate EINPROGRESS to EWOULDBLOCK in connect. This is
2228         the expected error code showed by the test case in bug #73053.
2229
2230 2005-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2231
2232         * io.c: another leftover.
2233
2234 Fri Feb 18 17:37:29 CET 2005 Paolo Molaro <lupus@ximian.com>
2235
2236         * io.c: fixed logic in checking errno in rev 40815.
2237
2238 Fri Feb 18 16:00:29 CET 2005 Paolo Molaro <lupus@ximian.com>
2239
2240         * threads.c: we don't depend on the GC checking tls
2241         slots anymore.
2242         * processes.c: remove unused ref to GC headers.
2243
2244 Thu Feb 17 19:57:11 CET 2005 Paolo Molaro <lupus@ximian.com>
2245
2246         * io.c: remove _wapi_thread_cur_apc_pending () checks
2247         when the siscall should return immediatly and handle
2248         the case when a syscall is interrupted without
2249         erroring out, but returning a 0 read/write if possible.
2250         Still the cases of read from file need to be handled.
2251
2252 Tue Feb 8 18:28:11 CET 2005 Paolo Molaro <lupus@ximian.com>
2253
2254         * threads.c: make people test with 1 MB stack per thread.
2255
2256 2005-01-17  Dick Porter  <dick@ximian.com>
2257
2258         * timefuncs.h: Make WapiFileTime endian-aware, as it's often
2259         cast to and from 64bit ints.  Fixes bug 71213.
2260
2261 2005-01-11  Dick Porter  <dick@ximian.com>
2262
2263         * error.c (errno_to_WSA): Add EADDRNOTAVAIL error code
2264         translation.
2265
2266 Mon Jan 10 16:15:19 EST 2005 Neale Ferguson <nealeferguson@earthlink.net>
2267
2268         * atomic.h: Fix functions on s390.
2269
2270 Mon Jan 10 20:30:19 CET 2005 Paolo Molaro <lupus@ximian.com>
2271
2272         * atomic.h: fix some functions on ppc (tests/interlocked.cs).
2273
2274 2005-01-10  Dick Porter  <dick@ximian.com>
2275
2276         * misc.c (_wapi_calc_timeout): Guard against overflow when
2277         calculating timeouts.  This makes waiting with a large
2278         (Int32.MaxValue) timeout not return immediately.
2279
2280 2004-12-23  Ben Maurer  <bmaurer@ximian.com>
2281
2282         * io.c (io_ops): make this `const' so it is shareable (well, only
2283         really shareable if it is statically linked...)
2284
2285 Mon Dec 20 11:58:33 CET 2004 Paolo Molaro <lupus@ximian.com>
2286
2287         * threads.c, threads.h: add accessor to get the pthread_key_t for
2288         a tls id.
2289
2290 2004-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2291
2292         * io.c: check for the existence of 'dest' and set ERROR_ALREADY_EXISTS
2293         if it exists and is not the same as 'src'.
2294
2295 2004-12-01 Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
2296
2297         * atomic.h : Fix InterlockedCompareExchange for s390/s390x.
2298
2299 2004-12-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2300
2301         * processes.c: unquote the cmd path, allow for ' or " when quoting and
2302         pass the quoted program name to the daemon, otherwise the call to
2303         g_shell_unquote in the daemon will break things up.
2304
2305 2004-10-14  Dick Porter  <dick@ximian.com>
2306
2307         * sockets.c (_wapi_accept): Revert the previous change.  We now
2308         set the accepted socket to have the same blocking status as the
2309         listening socket in managed code.  This follows MS behaviour.
2310         
2311 2004-10-14  Dick Porter  <dick@ximian.com>
2312
2313         * sockets.c (_wapi_accept): On Darwin, make sure a newly
2314         accept()ed socket is blocking.  Fixes bug 67355, patch by
2315         grompf@sublimeintervention.com.
2316
2317 2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
2318
2319         * system.c: check the number of online processors instead of the
2320         existing ones. Sanitize return value if it's an error.
2321
2322 2004-10-03 Ben Maurer  <bmaurer@ximian.com>
2323
2324         * system.c: Add support for getting the # of cpus.
2325
2326 2004-09-28  Dick Porter  <dick@ximian.com>
2327
2328         * io.c (pipe_close_private): Fix one small typo in the last change
2329         that totally hosed process creation with redirected pipes.
2330
2331 2004-09-24  Dick Porter  <dick@ximian.com>
2332
2333         * wapi-private.h: 
2334         * sockets.c: 
2335         * socket-private.h: 
2336         * io.c: 
2337         * io-private.h: 
2338         * handles-private.h: Cope when a file descriptor is reused while
2339         the handle that thought it owned it is still referenced, instead
2340         of asserting.  Probably fixes bug 66479, though we've been unable
2341         to reproduce it.
2342
2343 2004-09-09  Dick Porter  <dick@ximian.com>
2344
2345         * error.c:
2346         * io.c: Set error codes everywhere.
2347
2348 2004-09-06  Dick Porter  <dick@ximian.com>
2349
2350         * handles.c (_wapi_handle_unref): Reset the private record's type
2351         (CloseHandle): Check for a fd mapping failure, and return FALSE.
2352         (_wapi_handle_process_fork): Fix long-standing bug in checking
2353         handle return values.  Also do the required bookkeeping with the
2354         new process's handles.
2355
2356         * daemon.c: When creating a new process's handles, check whether
2357         the shared space needs to be increased
2358
2359 2004-09-05  Zoltan Varga  <vargaz@freemail.hu>
2360
2361         * shared.c (_wapi_shm_file): Fix leaking of filename.
2362
2363 2004-08-19  Dick Porter  <dick@ximian.com>
2364
2365         * handles.c (_wapi_handle_count_signalled_handles): Fix thinko
2366         introduced with the fd offset stuff: unlock handles properly when
2367         backing off.  Fixes the monologue hang at exit.
2368
2369 2004-08-18  Dick Porter  <dick@ximian.com>
2370
2371         * sockets.c: 
2372         * io.c: Check that new fds fit in the table, return error if not
2373
2374         * daemon.c (_wapi_daemon_main): 
2375         * handles.c (shared_init): Have all processes agree on a size for
2376         the fd table.
2377
2378 2004-08-17  Dick Porter  <dick@ximian.com>
2379
2380         * daemon.c (process_new): 
2381         * handles.c (_wapi_handle_new_internal): Cope when the space
2382         reserved for file descriptors is larger than the shared segment
2383         size.  Fixes the crash reported when running mono under gdb on
2384         macosx.
2385
2386 2004-08-16  Dick Porter  <dick@ximian.com>
2387
2388         * sockets.c:
2389         * io.c:
2390         * handles-private.h (_wapi_handle_fd_offset_to_handle): Improve
2391         error checking with passed-in file descriptors.
2392
2393 2004-08-11  Dick Porter  <dick@ximian.com>
2394
2395         * sockets.c: 
2396         * io.c: Returned handle values are the file descriptor the handle
2397         encapsulates
2398
2399         * handles.c: 
2400         * handles-private.h: 
2401         * daemon.c: Reserve the range of handles that can have the same
2402         values as file descriptors.  These won't be used, but the values
2403         will be used as file, console, pipe or socket handles.  The fd to
2404         handle mapping is done internally and is invisible to users.
2405         Fixes bug 61828.
2406
2407         * wapi-private.h (_WAPI_HANDLE_VERSION): Increment, because we now
2408         reserve a chunk of handle space.
2409
2410 2004-08-04  Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
2411
2412         * atomic.h: add support for 64-bit S/390
2413
2414 2004-07-22  Dick Porter  <dick@ximian.com>
2415
2416         * timed-thread.c: 
2417         * threads.c: Move the destruction of the internal thread data to
2418         after the thread has been joined.  Fixes bug 61418.
2419
2420 2004-07-14  Dick Porter  <dick@ximian.com>
2421
2422         * wait.c (test_and_own): When not waiting for all handles to
2423         become signalled, only own and return the lowest.  All the
2424         documentation suggests that the old way was correct, but
2425         experimentation shows it actually works like this.  Patch by
2426         Sébastien Robitaille
2427         (sebastien.robitaille@croesus.com), fixes bug 61511.
2428
2429 2004-07-09  Ben Maurer  <bmaurer@ximian.com>
2430
2431         * threads.c: register roots for gc
2432
2433 2004-07-08  Dick Porter  <dick@ximian.com>
2434
2435         * io.c (file_seek): If there is a high 32bit offset part, make
2436         sure the low part isn't sign-extended.  Set error codes when
2437         returning failure.  Fixes bug 61131.
2438
2439 2004-07-06  Dick Porter  <dick@ximian.com>
2440
2441         * io.c (file_setfiletime): Check for underflow when converting to
2442         time_t values.  Set error codes when returning failure.  Fixes bug
2443         60970.
2444
2445 2004-07-05  Dick Porter  <dick@ximian.com>
2446
2447         * mutexes.c (mutex_ops_init): Make the named mutex mutex sharable.
2448
2449         * daemon.c (unref_handle): Only destroy a handle if all processes
2450         have released it, not just the current one.  Fixes bug 60887.
2451
2452 2004-06-30  Zoltan Varga  <vargaz@freemail.hu>
2453
2454         * mono-mutex.h atomic.h: Add G_GNUC_UNUSED to static inline functions
2455         to prevent warnings.
2456
2457 2004-06-24  Dick Porter  <dick@ximian.com>
2458
2459         * mutexes.c: Indicate when a named mutex was reused
2460
2461 2004-06-24  Dick Porter  <dick@ximian.com>
2462
2463         * threads.c (SuspendThread): 
2464         * timed-thread.c (_wapi_timed_thread_suspend): Wrap sem_wait in a
2465         while loop.  See bug 58161.
2466
2467 Wed Jun 23 23:29:04 CEST 2004 Paolo Molaro <lupus@ximian.com>
2468
2469         * io.c: don't use sharemode for on-disk file permissions: it's used
2470         for shared access to the open file.
2471
2472 2004-06-22  Dick Porter  <dick@ximian.com>
2473
2474         * events.c (CreateEvent): When creating an auto-reset event that
2475         is initially owned, make sure the set count starts at 1.
2476
2477 2004-06-18  Dick Porter  <dick@ximian.com>
2478
2479         * event-private.h:
2480         * events.c: Auto-reset events need to release one thread for each
2481         time SetEvent() is called.  Fixes bug 41292.
2482
2483         * threads.h:
2484         * mutex-private.h:
2485         * mutexes.c: Scan for mutexes that are still locked by a thread
2486         when it exits.  Fixes the MS demo app linked by bug 41292.
2487
2488         * wait.c (test_and_own): Make sure a handle is signalled before it
2489         is owned.
2490
2491 2004-06-16  Dick Porter  <dick@ximian.com>
2492
2493         * timed-thread.c: Call the thread cleanup exit routine before taking
2494         the join mutex, because this could deadlock if another thread tries
2495         to join in the meantime.  This fixes the hang-at-exit problem seen
2496         on macos.
2497
2498 2004-06-03  Lluis Sanchez Gual  <lluis@ximian.com>
2499
2500         * threads.c: Implemented SleepEx.
2501         * threads.h: Fixed SleepEx signature.
2502
2503 2004-06-03  Miguel de Icaza  <miguel@ximian.com>
2504
2505         * threads.c: When running under valgrind, do not allocate too much
2506         stack, as Valgrind default is 1 meg.
2507
2508 2004-05-27  Dick Porter  <dick@ximian.com>
2509
2510         * io.h:
2511         * io.c: Implemented LockFile() and UnlockFile()
2512
2513 2004-05-21  Dick Porter  <dick@ximian.com>
2514
2515         * io.c (CreateFile): Check for existing share modes when opening
2516         a file.
2517
2518         * handles.c: 
2519         * handles-private.h: 
2520         * daemon-messages.h: 
2521         * daemon.c: Maintain a hash of file share modes, keying on device
2522         and inode (to cope with symlinks.)
2523
2524 2004-05-20  Lluis Sanchez Gual  <lluis@ximian.com>
2525
2526         * daemon-messages.c: Retry if the communication with the daemon is
2527           interrupted by a signal.
2528         * io.c, sockets.c: Check for EINTR in every syscall that can be interrumped. 
2529           Only return an error in this case if there is something in the apc queue
2530           (which means that it is an interruption requested by the "user").
2531         * processes.c: Use WaitForSingleObjectEx. No need to pass "alertable" as
2532           true since the wait is small.
2533         * shared.c: Retry write calls when interrumped by a signal.
2534         * timed-thread.h, timed-thread.c: added _wapi_thread_apc_pending, which
2535           returns TRUE if there are pending asynchronous calls (APC) for the
2536           provided thread. Also added _wapi_thread_dispatch_apc_queue which calls
2537           the enqueued APCs. Defined a new struct ApcInfo that holds information
2538           about an enqueued APC.
2539         * thread-private.h, threads.c: Implemented QueueUserAPC (which does the same
2540           as in win32),_wapi_thread_apc_pending and _wapi_thread_dispatch_apc_queue. 
2541           These last two methods call the corresponding apc methods in 
2542           thread-private using the provided thread handle.
2543         * threads.h: Added QueueUserAPC.
2544         * uglify.h: Added WapiApcProc (needed by QueueUserAPC).
2545         * wait.c, wait.h: Changed WaitForSingleObject to WaitForSingleObjectEx, and
2546           WaitForMultipleObjects to WaitForMultipleObjectsEx. Implemented support
2547           for APCs in those two methods and also in SleepEx.
2548
2549 2004-05-17  Dick Porter  <dick@ximian.com>
2550
2551         * io.c (CopyFile): Speed up.  Fixes bug 57859.
2552
2553 2004-05-13  Dick Porter  <dick@ximian.com>
2554         * mono-mutex.c (mono_mutex_unlock): Return EPERM when the current
2555         thread doesn't own the mutex, rather than assert()ing.
2556
2557 2004-05-11  Dick Porter  <dick@ximian.com>
2558
2559         * shared.c (_wapi_shm_attach): Cope when a previous daemon startup
2560         attempt failed, leaving shared files that look like a daemon is
2561         still starting.
2562
2563 2004-05-10  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2564
2565         * io.c:
2566         (SetFileAttributes): don't the the exec bit if the corresponding read
2567         bit is not set.
2568
2569 2004-05-10  Zoltan Varga  <vargaz@freemail.hu>
2570
2571         * io.c (FindFirstFile): Fix invalid free.
2572
2573 2004-05-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2574
2575         * io.c: translate from GFileError to errno codes and don't free
2576         variables right after calling mono_io_scandir, as we may overwrite
2577         errno value.
2578
2579 2004-05-08  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2580
2581         * io.c: g_dir_open return ENOENT for directories on which we don't have
2582         read/execute permission, while returning EPERM for anything below those.
2583         So, change ENOENT by EPERM if the directory exists.
2584
2585 2004-05-07  Dick Porter  <dick@ximian.com>
2586
2587         * io.c (SetFileAttributes): Don't have failed chmod()s cause a
2588         "file not found" error.  Fixes bug 54032.
2589         
2590 2004-05-07  Dick Porter  <dick@ximian.com>
2591
2592         * io.c (FindFirstFile): Comment out a windows-compatibility check
2593         that breaks when directories have metachars in their names.
2594         Workaround for bug 58116.
2595
2596 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2597
2598         * io.c: fixed for FindFirstFile for empty directories. Closes
2599         bug #58147.
2600
2601 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2602
2603         * processes.c: set the start time for the current process. Fixes bug
2604         #58109.
2605
2606 2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2607
2608         * io-private.h: 'namelist' is now a gchar ** in _WapiHandlePrivate_find.
2609         * io.c: implemented scandir using glib functions.
2610
2611 2004-05-04  Dick Porter  <dick@ximian.com>
2612
2613         * daemon.c (read_message): Return FALSE on error so the GSource
2614         callback itself can return FALSE.  Cures the infinite loop poll()
2615         warning on MacosX.
2616         * shared.c: Fix some daemon startup race conditions.
2617
2618 2004-04-29  Miguel de Icaza  <miguel@ximian.com>
2619
2620         * io.c (CopyFile): Use 32k buffers to copy the file instead of 2k,
2621         use the stack, do not use dynamic memory.
2622
2623 2004-04-29  Zoltan Varga  <vargaz@freemail.hu>
2624
2625         * io.c: Add scandir implementation for platforms which do not have
2626         it, like solaris.
2627
2628 2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2629
2630         * io.[ch]: implemented GetLogicalDriveStrings.
2631
2632 2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2633
2634         * io.c:
2635         * sockets.c: use the field name from configure when accessing sigval
2636         pointer field. Makes this work on the Mac.
2637
2638 2004-04-28  Bernie Solomon  <bernard@ugsolutions.com>
2639
2640         * atomic.c: (InterlockedExchange) fix typo for
2641         mutex name
2642
2643 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2644
2645         * io.c:
2646         * sockets.c: added check for sys/aio.h.
2647
2648 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2649
2650         * error.[ch]: added _wapi_get_win32_file_error...
2651         * io.c: ... which was _wapi_get_win32_error here.
2652         * sockets.c: rename the function calls here too.
2653
2654 2004-04-28  Dick Porter  <dick@ximian.com>
2655
2656         * daemon-messages.c: Avoid a deadlock when a thread is killed while
2657         waiting for the daemon by using a recursive mutex.  Helps bug 56699.
2658
2659 2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2660
2661         * io.c: fixed leak in async_notifier().
2662
2663         * sockets.[ch]: added AIO support for sockets and fixed WSAIoctl
2664         declaration.
2665
2666         * threads.c: removed old comment.
2667
2668 2004-04-26  David Waite  <mass@akuma.org>
2669
2670         * daemon-messages.h:
2671         * daemon-private.h
2672         * error.h:
2673         * io.h:
2674         * processes.h:
2675         * shared.h:
2676         * thread-private.h:
2677         * wapi-private.h: remove comma from end of enumeration declarations
2678         * status.h: cast unsigned int types to int for enum assignment
2679
2680 2004-04-26 David Waite <mass@akuma.org>
2681
2682         * io.c:
2683         * timefuncs.c: declare 64-bit constants as long long types (i.e.
2684         10ULL)
2685
2686 2004-04-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2687
2688         * socket-wrappers.h: _wapi_socket == WSASocket now. Added
2689         WSA_FLAG_OVERLAPPED.
2690
2691         * sockets.c: new unused parameters for _wapi_socket.
2692
2693 2004-04-22  Miguel de Icaza  <miguel@ximian.com>
2694
2695         * timed-thread.c: Replace sem_init with MONO_SEM_INIT to handle
2696         the fact that MacOS X is a piece of junk (sem_init is *defined* in
2697         the libc, but they return `not implemented'). 
2698
2699 2004-04-22  Dick Porter  <dick@ximian.com>
2700
2701         * handles.c: 
2702         * handles-private.h: Reference the handle when it is locked, so
2703         that another thread can't blow it away while we're waiting for it
2704         to become signalled.
2705         
2706         * wait.c: 
2707         * timed-thread.c: 
2708         * threads.c: 
2709         * sockets.c: 
2710         * semaphores.c: 
2711         * mutexes.c: 
2712         * mono-mutex.c: 
2713         * io.c: 
2714         * handles.c: 
2715         * handles-private.h: 
2716         * events.c: 
2717         * error.c: 
2718         * daemon-messages.c: 
2719         * critical-sections.c: 
2720         * atomic.c: Added pthreads cleanup handlers and error asserts
2721
2722         * shared.c: 
2723         * handles.c: Fixed the gcc "variable might be used uninitialised"
2724         warnings.  They can't happen, but gcc doesn't know that
2725         g_assert()s don't return.
2726
2727         Fixed the declaration of _wapi_handle_process_kill() so that it
2728         expects the correct type for the pid.
2729         
2730         * threads.c: Removed the TLS_PTHREAD_MUTEX style locking that
2731         hasn't been used in ages and just made the code more complex.
2732
2733 2004-04-17  Zoltan Varga  <vargaz@freemail.hu>
2734
2735         * processes.c: Include <signal.h> for SIGKILL and SIGILL + fix some
2736         warnings. Fixes #57168.
2737
2738 2004-04-16  Dick Porter  <dick@ximian.com>
2739
2740         * threads.c (Sleep): Using div(3) with a negative (when signed)
2741         numerator causes the quotient to be 0 and the remainder to be the
2742         numerator.  This feeds a small negative value to nanosleep(3),
2743         which will return immediately and cause a busy wait.  Fixes bug
2744         56351.
2745
2746 2004-04-15  Dick Porter  <dick@ximian.com>
2747
2748         * io-private.h:
2749         * io.c: Rewrite FindFirstFile and FindNextFile using scandir(3)
2750         and fnmatch(3) instead of glob(3).  glob() can't cope with being
2751         given filenames containing metachars.  This fixes bug 40557.
2752
2753 2004-04-14  Bernie Solomon  <bernard@ugsolutions.com>
2754
2755         * security.c: #warning is a GCC-ism
2756
2757 2004-04-13  Sebastien Pouliot  <sebastien@ximian.com>
2758
2759         * security.c: Removed GetUserName as glib g_get_user_name does a
2760         better (portability) job. Added ImpersonateLoggedOnUser and
2761         RevertToSelf.
2762
2763 2004-04-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2764
2765         * mono-mutex.h: move pthread_mutex_timedlock declaration to...
2766         * mono-mutex.c: ...here. It was causing a warning that prevented
2767         libgdiplus compilation.
2768
2769 2004-04-04  Miguel de Icaza  <miguel@ximian.com>
2770
2771         * security.c (GetUserName): Make it work on MacOS X
2772
2773 2004-04-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2774
2775         * security.c: use getpwuid_r if available. This one is thread-safe.
2776
2777 2004-04-02  Sebastien Pouliot  <sebastien@ximian.com>
2778
2779         * Makefile.am: Added security.c|h.
2780         * security.c: New file for security related functions. Added function
2781         GetUserName to fix #56144.
2782         * security.h: New. Header file for security.c
2783         * wapi.h: Added include for security.h
2784
2785 2004-03-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2786
2787         * daemon-messages.h: added kill structs.
2788
2789         * daemon.c: implemented process_process_kill.
2790         * handles-private.h:  define process_process_kill.
2791         * handles.c: implemented _wapi_handle_process_kill.
2792         * processes.[ch]: implemented TerminateProcess.
2793
2794 2004-03-25  Bernie Solomon  <bernard@ugsolutions.com>
2795
2796         * daemon.c (rem_fd): On solaris you seem to get an
2797         error even after removing the input source so don't
2798         try and rem_fd it twice.
2799
2800 2004-03-25  Lluis Sanchez Gual  <lluis@ximian.com>
2801
2802         * daemon.c: in process_post_mortem, If the child terminated due to the 
2803         receipt of a signal, the exit status must be based on WTERMSIG, since 
2804         WEXITSTATUS returns 0 in this case.
2805
2806 2004-03-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2807
2808         * daemon.c: turned a warning into a DEBUG statement. Now we may hit it.
2809
2810 2004-03-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2811
2812         * daemon.c: only call getdtablesize () once.
2813         * processes.c: wait 500 ms to check if execve failed and throw the same
2814         exception as MS on failure. Fixes bug #32809.
2815
2816 2004-03-17  Bernie Solomon  <bernard@ugsolutions.com>
2817
2818         * io.c (async_notifier): use "union sigval" rather
2819         than sigval_t as Solaris doesn't have sigval_t
2820         (which isn't in IEEE 1003.1 either).
2821
2822 2004-03-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2823
2824         * io.c: added debug stuff and removed a few redundant lines in
2825         file_write.
2826
2827 2004-03-15  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2828
2829         * io-private.h: added new fields for file structure. Declare
2830         _wapi_io_add_callback.
2831
2832         * io.c: added _wapi_get_win32_error, support aio_read/write in
2833         file_read/write. Implemented _wapi_io_add_callback, which is where
2834         BindHandle ends up.
2835         
2836         * io.h: added new fields for WapiOverlapped and typedef for the
2837         callback.
2838
2839         * processes.c: fixed off-by-one bug when handling environment variables 
2840         passed in.
2841
2842         * threads.[ch]: implemented BindIoCompletionCallback.
2843
2844         * uglify.h: added typedef for LPOVERLAPPED_COMPLETION_ROUTINE.
2845
2846 2004-03-14  Zoltan Varga  <vargaz@freemail.hu>
2847
2848         * socket-wrappers.h: Remove extra semicolon.
2849
2850 2004-03-03  Dave Camp  <dave@ximian.com>
2851
2852         * daemon.c: (add_fd), (fd_activity), (_wapi_daemon_main):
2853         Use a new main context.
2854
2855 2004-03-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2856
2857         * io.c:
2858         (GetFileAttributes): set the error depending on errno instead of
2859         setting ERROR_FILE_NOT_FOUND always. See bug #55160.
2860
2861 2004-03-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2862
2863         * io.c:
2864         (CopyFile): free the buffer on error.
2865         * sockets.c:
2866         (WSAIoctl): free the buffer on error.
2867
2868 2004-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2869
2870         * error.c: fixed mapping for EPROTONOSUPPORT and ESOCKTNOSUPPORT.
2871
2872         * sockets.[ch]: retry creating the socket for AF_INET, SOCK_RAW
2873         using IP protocol with IP over IP. Implemented WSAIoctl UNIX-style.
2874
2875 2004-01-27  Bernie Solomon  <bernard@ugsolutions.com>
2876
2877         * shared.c (_wapi_shm_file): add hostname
2878         to shared data file names to handle NFS mounted
2879         .wapi directories.
2880
2881 Mon Jan 26 16:15:03 CET 2004 Paolo Molaro <lupus@ximian.com>
2882
2883         * sockets.h: remove obsolete soklen_t typedef.
2884
2885 Fri Jan 23 21:07:02 CET 2004 Paolo Molaro <lupus@ximian.com>
2886
2887         * socket-wrappers.h, sockets.h, sockets.c, Makefile.am: move socket
2888         wrappers to its own non-installed header file.
2889
2890 2004-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2891
2892         * io.c:
2893         (FindFirstFile): unlock the handle if FindNextFile fails.
2894         (FindNextFile): g_free a couple of pointers before retrying.
2895
2896         * wait.c:
2897         (WaitForMultipleObjects): if only one handle provided, use
2898         WaitForSingleObject.
2899
2900 2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>
2901
2902         * handles-private.h: (_wapi_handle_type) check
2903         for segment in range before using it
2904
2905 2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>
2906
2907         * thread-private.h: _wapi_thread_ops is now const
2908         must match .c file.
2909
2910 Mon Dec 22 18:29:03 CET 2003 Paolo Molaro <lupus@ximian.com>
2911
2912         * threads.c, timed-thread.c, timed-thread.h: use mach
2913         semaphores on Darwin (MacOSX) since the posix ones
2914         are mostly broken there (threads are not created suspended
2915         and they can start executing before they are fully initialized
2916         like in tests/thread-static.cs).
2917
2918 Mon Dec 22 17:18:45 CET 2003 Paolo Molaro <lupus@ximian.com>
2919
2920         * atomic.h: ppc fixes.
2921
2922 2003-12-19  Bernie Solomon  <bernard@ugsolutions.com>
2923
2924         * handles.c: remove my bad use of MONO_ZERO_ARRAY_LENGTH
2925         in HDRSIZE 
2926
2927 2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>
2928
2929         * shared.c: (_wapi_shm_open) make scratch file
2930         not have to immediately regrow to avoid remaps
2931         (HPUX can't cope with these).
2932         (_wapi_shm_attach) use actual size of file
2933         to set scratch data_len for the creating process.
2934
2935         * handles.c: (_wapi_handle_new_internal) make
2936         sure mutex & cond var are initialized even for
2937         non process shared ones. 
2938         (_wapi_handle_unref) always call destroy 
2939         routines on mutex & cond var
2940
2941 2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>
2942
2943         * daemon.c: change channel data structure so
2944         input sources are removed from glib event loop
2945         properly. xsp works better on Solaris and 
2946         fixes #51278
2947
2948 2003-12-12  Bernie Solomon  <bernard@ugsolutions.com>
2949
2950         * wapi-private.h: Replace G_GNUC_PRETTY_FUNCTION
2951         definition with file & line number for non-GCC
2952         compiles.
2953
2954 2003-12-08  Bernie Solomon  <bernard@ugsolutions.com>
2955
2956         * Makefile.am: make sure hppa_atomic.s is in distribution
2957
2958 2003-12-01  Dick Porter  <dick@ximian.com>
2959
2960         * wapi-private.h: 
2961         * mutexes.c (CreateMutex): 
2962         * mutex-private.h (struct _WapiHandle_mutex): 
2963         * handles.c: Look up certain handle types by name, in a shared
2964         namespace.  Currently only mutex handles have this implemented.
2965         Fixes bug 51089.
2966
2967         * semaphores.c (CreateSemaphore): 
2968         * events.c (CreateEvent): Fix signature
2969
2970 2003-11-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
2971
2972         * io.c: don't call g_free before testing errno as it may modify it.
2973         If the path exists, return an error if it's not a directory. Fixes
2974         bug #50753.
2975
2976 2003-11-20  Dick Porter  <dick@ximian.com>
2977
2978         * io.c: Missed a little-endian UTF16 conversion.  Patch from
2979         Jeroen Zwartepoorte (Jeroen@xs4all.nl), fixes bug 51065.
2980
2981 2003-10-29  Dick Porter  <dick@ximian.com>
2982
2983         * io.c (MoveFile): If the move crosses filesystems, try and fall
2984         back to copy and delete.  Patch from Jörg Rosenkranz
2985         (JoergR@voelcker.com), fixes bug 50298.
2986
2987 2003-10-28  Dick Porter  <dick@ximian.com>
2988
2989         * io.c: Use the new encoding conversion to cope with non-utf8
2990         locales in filenames.
2991
2992         * processes.c: Ditto for process arguments.
2993
2994 Tue Oct 21 12:01:14 CEST 2003 Paolo Molaro <lupus@ximian.com>
2995
2996         * atomic.h: some ppc inline asm fixes (incorrect use of labels, 
2997         incorrect register constraints, incorrect clobber lists).
2998
2999 2003-10-13  Bernie Solomon  <bernard@ugsolutions.com>
3000
3001         * Makefile.am hppa_atomic.s: add HP 64bit
3002         implementation of atomic ops
3003
3004 2003-10-13  Zoltan Varga  <vargaz@freemail.hu>
3005
3006         * threads.c (CreateThread): Wrap pthread_attr_setstacksize call in
3007         a conditional for platforms that don't have it.
3008
3009 2003-10-09  Bernie Solomon  <bernard@ugsolutions.com>
3010
3011         * threads.c: (CreateThread) use stacksize argument
3012         if non-zero - change default for 64 bits to 4Mb
3013
3014 2003-09-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3015
3016         * sockets.c: set last error when socket creation fails. This shed some
3017         light on bug #49015.
3018
3019 2003-09-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3020
3021         * processes.c: fixed bug #48973: we only change \ by / for the argument
3022         to be used as command.
3023         When getting the program name from the args, don't let the space between
3024         them in the args.
3025
3026 2003-09-24  Bernie Solomon <bernard@ugsolutions.com>
3027
3028         * atomic.h atomic.c: fix sparc so lock is
3029         global, increment does so and it compiles under Sun compiler.
3030
3031 2003-09-22  Bernie Solomon <bernard@ugsolutions.com>
3032
3033         * handles.c: include <string.h> directly as may
3034         not be nested in <sys/un.h> like Linux
3035
3036 2003-09-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3037
3038         * io.c:
3039         (DeleteFile): call SetLastError on failure. Fix by
3040         richard.torkar@htu.se (Richard Torkar). Closes bug #48222.
3041
3042 2003-09-15  Lluis Sanchez Gual  <lluis@ximian.com>
3043
3044         * daemon.c: In compare_process(), discard handles already signalled.
3045
3046 2003-09-02  Dick Porter  <dick@ximian.com>
3047
3048         * io.c: Work around glib brain-dead assumptions about utf8-encoded
3049         filenames.  Fixes bug 30781.
3050
3051 2003-08-28  Dick Porter  <dick@ximian.com>
3052
3053         * critical-sections.c:  Patch from Bernie Solomon
3054         <bernard@ugsolutions.com> to emit a warning if locking a critical
3055         section fails.
3056
3057 2003-07-23  Dick Porter  <dick@ximian.com>
3058
3059         * shared.c:
3060         * daemon.c (maybe_exit): Avoid the race condition when the daemon is
3061         closing but another client comes along when the shared data is still
3062         visible.  Should fix bugs 33671 and 35213.
3063
3064 2003-07-23  Dick Porter  <dick@ximian.com>
3065
3066         * handles.c:  Initialise handle mutex and cond.  Fix by
3067         Bernie Solomon <bernard@ugsolutions.com>
3068
3069 2003-07-15  Dick Porter  <dick@ximian.com>
3070
3071         * timed-thread.c (timed_thread_start_routine): Fix virtual memory
3072         leak when threads quit.  Fixes bug 44067.
3073
3074 Wed Jun 18 19:08:40 CEST 2003 Paolo Molaro <lupus@ximian.com>
3075
3076         * io.c: never add write permission for group or others in
3077         SetFileAttributes ().
3078
3079 2003-06-17  Dick Porter  <dick@ximian.com>
3080
3081         * io.c (SetFileAttributes): Implement the ReadOnly attribute, and
3082         ignore the unsupported ones ("fixes" bug 44977).
3083
3084 2003-06-17  Lluis Sanchez Gual  <lluis@ximian.com>
3085
3086         * misc.c: fix bug in _wapi_calc_timeout. It gave wrong values for
3087           high ms values (there was an overflow).
3088
3089 2003-06-17  Zoltan Varga  <vargaz@freemail.hu>
3090
3091         * system.h (struct _WapiSystemInfo ): Fix warnings when using gcc-3.3.
3092
3093 2003-06-11  Dick Porter  <dick@ximian.com>
3094
3095         * shared.c: Fix shared directory creation.  Patch from
3096         Pablo Baena <pbaena@uol.com.ar>
3097
3098 2003-06-10  Dick Porter  <dick@ximian.com>
3099
3100         * atomic.c: Delete the useless compile warning
3101
3102 2003-06-09  Dick Porter  <dick@ximian.com>
3103
3104         * daemon.c: Lookup env as a string array.  Fixes bug 44289.  Also
3105         make setting the process handle value in the environment actually
3106         work.
3107
3108         * processes.c: Pretty up the process name, if it happens to be
3109         "mono" such as when another mono process forks "mono foo.exe"
3110
3111 2003-06-05  Dick Porter  <dick@ximian.com>
3112
3113         * processes.c (process_set_current): Don't do an expensive handle
3114         search at application startup, check the environment to see if the
3115         process handle has already been created.
3116
3117         * io.c: Don't do an expensive handle search when creating stdin,
3118         stdout and stderr handles, just create them all the first time one
3119         is requested.
3120
3121         * wapi-private.h:
3122         * shared.c:
3123         * shared.h:
3124         * handles.c:
3125         * handles-private.h:
3126         * daemon-messages.h:
3127         * daemon-private.h:
3128         * daemon.c: Support for "unlimited" number of handles and scratch
3129         data.
3130
3131         Speed up application startup by passing process handle in the
3132         environment, rather than let the app scan all handles (which gets
3133         really slow when there are more than a few thousand to check.)
3134
3135         Initialise some structs passed to syscalls, noticed by valgrind.
3136         
3137
3138 2003-05-20  Dick Porter  <dick@ximian.com>
3139
3140         * io.c (FindFirstFile): Include . files in the glob.  Fixes bug
3141         43229.
3142
3143 2003-05-19  Dick Porter  <dick@ximian.com>
3144
3145         * threads.c: Set the new thread's stack size to 2M.  Fix needed
3146         for BSD, reported by Martin Dvorak <md@9ll.cz>
3147
3148 2003-05-16  Dick Porter  <dick@ximian.com>
3149
3150         * io.h:
3151         * io.c: Implement GetTempPath()
3152
3153 2003-05-16  Dick Porter  <dick@ximian.com>
3154
3155         * processes.c (CreateProcess): Set some error codes
3156
3157 2003-05-12  Dick Porter  <dick@ximian.com>
3158
3159         * misc.c (_wapi_calc_timeout): Cope with overflowing tv_nsec.
3160         Patch from Martin Dvorak <mdvorak@ninell.cz>.
3161
3162 2003-05-10  Dick Porter  <dick@ximian.com>
3163
3164         * io.c (CopyFile): Copy file mode as well as file data.  Based on
3165         suggestion by Giuseppe Greco <giuseppe.greco@agamura.com>, bug
3166         42706.
3167
3168 2003-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3169
3170         * handles.c: don't call GC_gcollect when creating new handles.
3171
3172 2003-05-05  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3173
3174         * handles.c: added some debugging code. Call GC_gcollect
3175         before creating a new handle. It makes Lupus' test run smoother and
3176         faster (from 62 to 83 request per second). Notice that calling
3177         GC_finalizer_notifier if needed (GC_should_invoke_finalizer ()) does
3178         not improve nor degrade the performance, so i don't do it.
3179
3180 2003-05-02  Dick Porter  <dick@ximian.com>
3181
3182         * sockets.c: Rearrange closesocket() and socket_close_private(),
3183         and remember to unref the handle, so we don't leak socket handles.
3184         Fix from Pelle Johnsen <pelle.johnsen@mail.dk>
3185
3186 2003-04-11  Dick Porter  <dick@ximian.com>
3187
3188         * atomic.h: ARM atomic operations by Malte Hildingson
3189         <tds00mahi@tellus.thn.htu.se>
3190
3191 Tue Apr 8 11:37:29 CEST 2003 Paolo Molaro <lupus@ximian.com>
3192
3193         * atomic.h: fix macosx build by "Urs C. Muff" <umuff@quark.com>.
3194
3195 2003-04-03  Martin Baulig  <martin@ximian.com>
3196
3197         The following change is conditional to `WITH_INCLUDED_LIBGC'
3198         which is not yet enabled by default.
3199
3200         * threads.c (SuspendThread, ResumeThread): Fully implemented this.
3201         (gc_init): New static function; install a signal handler for
3202         SIGPWR which is used to suspend threads.  [FIXME: it SIGPWR
3203         doesn't exist on all Unix systems, we need to find another
3204         signal].
3205         (mono_wapi_push_thread_stack): New public function.  Tells the
3206         garbage collector about the current stack pointer of a suspended
3207         thread.
3208
3209 2003-04-03  Martin Baulig  <martin@ximian.com>
3210
3211         * timed-thread.h (TimedThread): Added `suspended_sem',
3212         `suspend_count' and `stack_ptr'.
3213
3214 2003-03-28  Dick Porter  <dick@ximian.com>
3215
3216         * atomic.h: PPC support gratiously donated to the public domain
3217         by John Duncan <jddst19@mac.com>
3218
3219 2003-03-20  Dick Porter  <dick@ximian.com>
3220
3221         * sockets.c (_wapi_connect): If connect() fails with EACCES, try
3222         setting SO_BROADCAST and connecting again.  Fixes bug 39178.
3223
3224 2003-03-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3225
3226         * processes.c: included Jerome Laban's patch and call SetLastError when
3227         the executable is not found.
3228
3229 2003-03-03  Dick Porter  <dick@ximian.com>
3230
3231         * io.c (CreateFile): Try opening directories readonly, so that
3232         timestamps can be adjusted.  Patch by Elan Feingold
3233         <efeingold@mn.rr.com>.
3234
3235 2003-02-25  Dick Porter  <dick@ximian.com>
3236
3237         * shared.c (_wapi_shm_attach): Return a failure code on system
3238         call errors, rather than exiting.
3239
3240 2003-02-21  Dick Porter  <dick@ximian.com>
3241
3242         * processes.c (GetCurrentProcessId): Use the current process
3243         handle to return the process ID, as getpid() is unreliable
3244         (linuxthreads gives each thread a different pid).  Fixes bug
3245         37550.
3246
3247 2003-02-21  Dick Porter  <dick@ximian.com>
3248
3249         * io.c (FindNextFile): Skip over dangling symlinks.  Fixes bug
3250         34076.
3251
3252 2003-02-11  Dick Porter  <dick@ximian.com>
3253
3254         * timefuncs.h: 
3255         * timefuncs.c: Added GetTickCount()
3256
3257 2003-02-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3258
3259         * error.c: added WSA_EHOSTUNREACH mapping.
3260
3261 2003-01-26  Miguel de Icaza  <miguel@ximian.com>
3262
3263         * io.c (SetFileAttributes): This routine is not currently
3264         implemented for the general case, but I added a special case to
3265         set the executable bit on Linux.
3266
3267 Wed Jan 15 15:55:40 CET 2003 Paolo Molaro <lupus@ximian.com>
3268
3269         * sockets.h, daemon.c, io.c: compilation fixes on MacOSX.
3270
3271 2003-01-08  Dick Porter  <dick@ximian.com>
3272
3273         * sockets.c: Fixed setting blocking mode to true (fixes bug 36388)
3274
3275 2002-12-11  Juli Mallett  <jmallett@FreeBSD.org>
3276
3277         * daemon.c, handles-private.h, handles.c, wapi-private.h:
3278         Check for an implementation which says it supports
3279         _POSIX_THREAD_PROCESS_SHARED, rather than just one that
3280         defines the symbol.  Defined but with a value of -1 still
3281         means that it is unsupported.
3282
3283 2002-12-08  Martin Baulig  <martin@ximian.com>
3284
3285         * handles.c (_wapi_handle_new): Create new non-shared handles with
3286         an initial refcount of 1, not 0.
3287
3288 2002-11-22  Dietmar Maurer  <dietmar@ximian.com>
3289
3290         * threads.c (TlsGetValue): removed unnecessary mutex
3291
3292 2002-11-20  Dick Porter  <dick@ximian.com>
3293
3294         * timed-thread.c (_wapi_timed_thread_attach): Attached threads
3295         need to store their data structure too.
3296
3297         * threads.c: Make sure the threading data is initialised wherever
3298         it is needed
3299
3300 2002-11-15  Dick Porter  <dick@ximian.com>
3301
3302         * timed-thread.c: Removed unneeded parameters in
3303         _wapi_timed_thread_attach().
3304
3305         * threads.c: Renamed AttachThread() to make it not look like
3306         external API.  Removed unneeded parameters.
3307
3308 2002-11-11  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3309
3310         * error.[ch]: added errno_to_WSA (). It displays a warning and return
3311         WSASYSCALLFAILURE if there is no error mapping for the given errno,
3312
3313         * sockets.c: use errno_to_WSA and fixed display of warning for h_errno.
3314
3315 2002-10-31  Dick Porter  <dick@ximian.com>
3316
3317         * io.h: 
3318         * io.c: Define and use INVALID_FILE_ATTRIBUTES
3319
3320 2002-10-07  Dick Porter  <dick@ximian.com>
3321
3322         * timefuncs.c:
3323         * daemon.c: Use a more accurate time source for process start and
3324         end times.
3325
3326 2002-10-03  Dick Porter  <dick@ximian.com>
3327
3328         * daemon.c:
3329         * handles.c:
3330         * threads.c:  Fixes for freebsd.  Make sure that mutex and condition
3331         creation and deletion happen in the process that owns them, when
3332         POSIX shared thread objects aren't supported.  This breaks on
3333         freebsd, as pthread_t is a pointer to data.
3334
3335 2002-10-02  Dick Porter  <dick@ximian.com>
3336
3337         * shared.c: Use mmap() instead of sysv shm for the shared data.
3338
3339         * wapi-private.h (_WAPI_HANDLE_VERSION): Reset back to 0, for the
3340         new system
3341
3342         * daemon-private.h: 
3343         * daemon.c: mmap()ed regions survive fork, so just pass the
3344         pointer to _wapi_daemon_main instead of mapping it again.
3345
3346 2002-10-01  Dick Porter  <dick@ximian.com>
3347
3348         * timed-thread.c: Kludge for CREATE_SUSPENDED thread creation.
3349         Unfortunately libgc uses the same thread suspend technique that I
3350         want to, and the two don't mix: libgc will deadlock when it tries
3351         to stop the world if a thread has already been suspended by
3352         someone else.  Just do the simple suspended create rather than the
3353         general purpose thread suspension for now.
3354
3355         * threads.c: Pass create flags to the timed_thread create call, to
3356         implement suspended thread creation.  ResumeThread() partially
3357         implemented, to cope with the case where a newly created but
3358         suspended thread is launched.
3359
3360 2002-09-30  Dick Porter  <dick@ximian.com>
3361
3362         * sockets.c (ioctlsocket): Set non-blocking mode in a better way,
3363         with fcntl.
3364
3365 2002-09-27  Dick Porter  <dick@ximian.com>
3366
3367         * semaphores.c: Only include semaphore.h if it's present. Patch
3368         for BSD from jmmv@hispabsd.org (Julio Merino).
3369
3370 2002-09-27  Dick Porter  <dick@ximian.com>
3371
3372         * processes.c: Pass environment and working directory to the
3373         daemon when forking.  Don't let argv[0] be duplicated when looking
3374         for the program name.  Implement EnumProcessModules (simple
3375         version for now, lsof-style later if needed), GetModuleBaseName,
3376         {Get,Set}ProcessWorkingSetSize (just faked, because the vm hints
3377         aren't available on Linux).
3378
3379         * process-private.h: Store the process name, and the working set
3380         min and max
3381
3382         * handles.c:
3383         * handles-private.h: New functions to store and retrieve an array
3384         of strings in the scratch space
3385
3386         * daemon.c: Don't miss deleting some handles when a client exits
3387         (we used to rely on the client doing the final cleanup, but
3388         obviously if the client is no longer there the daemon has to do
3389         it).
3390
3391         Process forking now sets the environment and the working
3392         directory.
3393
3394         * io.c: Don't confuse fd 0 with an unassigned handle struct
3395
3396         * atomic.h: Add a google cache alternative to the msdn URL
3397
3398 2002-09-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3399
3400         * sockets.c:
3401         (_wapi_recvfrom): added ECONNRESET to the switch.
3402
3403 2002-09-24  Mark Crichton  <crichton@gimp.org>
3404
3405         * atomic.h: Yea.  On linux, sparc isn't sparc, it's __sparc__.
3406         Added to ifdef.
3407
3408 2002-09-19  Mark Crichton  <crichton@gimp.org>
3409
3410         * daemon.c, shared.c: Added NEED_LINK_UNLINK for systems that
3411         dont have Linux's abstract filesystem for sockets.
3412
3413 2002-09-19  Mark Crichton  <crichton@gimp.org>
3414
3415         * atomic.h: Added SPARC atomic asm code.
3416         * daemon.c, handles-private.h, handles.c, wapi-private.h:
3417         undefined _POSIX_THREAD_PROCESS_SHARED.  This actually exists on
3418         Solaris 9, however, the code paths don't seem to work.  More testing
3419         on the shared case is *really* needed.
3420
3421 2002-09-03  Dick Porter  <dick@ximian.com>
3422
3423         * threads.h: 
3424         * threads.c: Removed PosixKillThread(), because it's not in the
3425         w32 api
3426
3427 2002-08-20  Dick Porter  <dick@ximian.com>
3428
3429         * handles.c (_wapi_handle_scratch_store): Made stored byte lengths
3430         multiples of 4 bytes, to keep header structures aligned.  Needed
3431         for sparc, at least. (Patch from crichton@gimp.org)
3432
3433         * handles.c: Removed 'disable_shm' variable (we've defaulted to
3434         building with shm enabled for months now)
3435
3436 2002-08-19  Dick Porter  <dick@ximian.com>
3437
3438         * daemon.c: Rewrote the poll() loop to use GIOChannels instead,
3439         for legacy NeXT-based systems.
3440
3441 2002-08-12  Dick Porter  <dick@ximian.com>
3442
3443         * atomic.h: Rename some parameters to avoid c++ keywords (Patch
3444         from Joseph Wenninger <kde@jowenn.at>)
3445
3446 2002-08-05  Dietmar Maurer  <dietmar@ximian.com>
3447
3448         * threads.c: use fast spinlocks by default
3449
3450 2002-08-02  Dick Porter  <dick@ximian.com>
3451
3452         * io.c (GetStdHandle): Add a handle reference when returning a
3453         duplicate console handle.  This fixes the unref_handle errors in
3454         NUnit.
3455
3456 2002-08-01  Dietmar Maurer  <dietmar@ximian.com>
3457
3458         * threads.c (TLS_PTHREAD_MUTEX): define this because else some
3459         tests does not work
3460
3461 2002-08-01  Dick Porter  <dick@ximian.com>
3462
3463         * threads.c: Use atomic spinlocks in TLS functions
3464
3465         * mono-spinlock.h:
3466         * Makefile.am: Added mono-spinlock.h
3467
3468 2002-07-21  Jeffrey Stedfast  <fejj@ximian.com>
3469
3470         * daemon-messages.c: #include <sys/types.h> and <sys/sockets.h> -
3471         these are needed for sendmsg() and also for struct msghdr (at
3472         least on Solaris). Solaris still won't build because struct msghdr
3473         doesn't have msg_flags, msg_control, or msg_controllen members.
3474         (CMSG_SPACE): Define for systems that don't have it.
3475         (CMSG_LEN): Same.
3476
3477 2002-07-20  Dick Porter  <dick@ximian.com>
3478
3479         * wapi-private.h:
3480         * io-private.h:
3481         * io.h:
3482         * io.c:
3483         * handles.c: Implemented pipe handles
3484         
3485         * handles.c:
3486         * daemon.c: Fixed bug in handle closing.
3487
3488         * shared.c:
3489         * daemon.c: Forked processes now close all open file descriptors.
3490
3491 Fri Jul 19 19:05:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
3492
3493         * sockets.h, io-layer.h, critical-sections.h: don't include config.h
3494         in header files.
3495
3496 2002-07-19  Martin Baulig  <martin@gnome.org>
3497
3498         * threads.c (ExitThread): Call exit() if no threads has been
3499         created yet.
3500
3501 2002-07-17  Dick Porter  <dick@ximian.com>
3502
3503         * daemon-messages.c: Freebsd fixes from Andreas Kohn
3504         <andreas.kohn@gmx.net>
3505
3506 2002-07-15  Dick Porter  <dick@ximian.com>
3507
3508         * io.c: Removed bogus console_flush() method, that was just cut
3509         and pasted from file_flush when I separated the two handle types.
3510
3511 2002-07-12  Dick Porter  <dick@ximian.com>
3512
3513         * io.c (convert_from_flags): Fixed misunderstanding wrt fcntl
3514         flags.  Fixes bug 27633.
3515
3516 2002-07-12  Dick Porter  <dick@ximian.com>
3517
3518         * wapi-private.h:
3519         * handles.c:
3520         * daemon.c: Use size of sockaddr_un.sun_path from config.h
3521
3522 2002-07-12  Dick Porter  <dick@ximian.com>
3523
3524         * processes.c (CreateProcess): Send stdin, stdout and stderr
3525         handles if the startup info doesnt specify new ones
3526
3527         * io.c (GetStdHandle): Return the same handle when the same
3528         standard handle is requested
3529
3530         * handles.c: Pass file descriptors when forking
3531
3532         * daemon.c: Use supplied file descriptors when forking a new
3533         process
3534
3535         * daemon-messages.h: 
3536         * daemon-messages.c: Pass stdin, stdout and stderr file
3537         descriptors to the daemon (used when forking)
3538
3539 2002-07-11  Miguel de Icaza  <miguel@ximian.com>
3540
3541         * daemon.c (_wapi_daemon_main): Use sizeof
3542         (main_socket_address.sun_path) instead of hardcoded 108 value.
3543
3544         * handles.c (shared_init): Use sizeof
3545         (shared_socket_address.sun_path) instead of hardcoded 108 value.
3546
3547 2002-07-10  Dennis Haney  <davh@davh.dk>
3548
3549         * shared.c:
3550         * handles.c:
3551         * daemon.c: Lots of documentation, some added error checking, and
3552         code readability improvements.
3553
3554         * daemon-messages.h: Add the Error request type to improve error
3555         checking.
3556
3557         * daemon-messages.c: Do a bit more error checking on send() and
3558         recv(), and log errors with a higher severity level.
3559
3560 2002-07-04  Dick Porter  <dick@ximian.com>
3561
3562         * daemon.c (process_process_fork): Fix argument handling, due to
3563         buggy understanding of g_strsplit() behaviour.
3564
3565 2002-07-03  Dick Porter  <dick@ximian.com>
3566
3567         * threads.h:
3568         * threads.c: Implement OpenThread().  Define access-control values
3569         for thread handles.
3570
3571         * wapi.h:
3572         * processes.h:
3573         * access.h:
3574         * Makefile.am: Added access.h, to hold shared access-control
3575         definitions
3576
3577 2002-07-02  Dick Porter  <dick@ximian.com>
3578
3579         * wapi-private.h (_WAPI_HANDLE_VERSION): New protocol version
3580         
3581 2002-07-02  Dick Porter  <dick@ximian.com>
3582
3583         * handles.c (shared_init): Make a second attempt to contact the
3584         daemon if the shared memory attach succeeds, but the connect()
3585         fails. (This copes with the daemon crashing without cleaning up
3586         the shared memory.)
3587
3588         * Makefile.am: 
3589         * daemon-private.h:
3590         * daemon.c:
3591         * shared.c (_wapi_shm_attach): Don't exec() anything when we fork
3592         the daemon, it's now built into the library.
3593
3594 2002-06-25  Dick Porter  <dick@ximian.com>
3595
3596         * handles.c:
3597         * handles-private.h:
3598         * daemon-messages.h:
3599         * daemon.c: Process forking and handle data management
3600
3601         * processes.h:
3602         * process-private.h:
3603         * processes.c: Process forking and other support functions
3604
3605 2002-06-25  Dick Porter  <dick@ximian.com>
3606
3607         * versioninfo.h: PE resource decoding
3608
3609         * unicode.c (_wapi_unicode_to_utf8): g_utf16_to_utf8 doesnt need
3610         to be told the string length
3611
3612         * io.c: Removed the ACTUALLY_DO_UNICODE option.  Fixed some leaks.
3613         Moved _wapi_time_t_to_filetime and the WapiFileTime typedef to
3614         timefuncs.c
3615
3616 2002-06-12  Dick Porter  <dick@ximian.com>
3617
3618         * daemon.c: 
3619         * daemon-messages.c: Handle SIGPIPE in a non-stupid way in the
3620         daemon, if MSG_NOSIGNAL isn't available.  Thanks to Jaroslaw
3621         Kowalski <jarek@atm.com.pl> for pointing out the bogosity.
3622
3623 2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>
3624
3625         * sockets.c, daemon-messages.c: Prevent SIGPIPE from being raised
3626         when writing to a closed socket.
3627
3628 2002-06-08  Jeffrey Stedfast  <fejj@ximian.com>
3629
3630         * mono-mutex.c (mono_once): New convenience function for my
3631         previous fix.
3632
3633         * handles.c:
3634         * error.c: 
3635         * critical-sections.c: 
3636         * threads.c: 
3637         * sockets.c: 
3638         * semaphores.c: 
3639         * processes.c: 
3640         * mutexes.c: 
3641         * io.c: 
3642         * events.c: 
3643         * atomic.c: Use mono_once() rather than pthread_once().
3644
3645 2002-06-06  Jeffrey Stedfast  <fejj@ximian.com>
3646
3647         * handles.c (_wapi_handle_new): pthread_once() is not atomic, so
3648         if multiple threads all try to call _wapi_handle_new() before the
3649         shared data has been initialized, it is possible that we could get
3650         into a condition where shared_init() is being executed and later
3651         threads will pass by pthread_once() due to the fact that it has
3652         already been called and so therefor will attempt to use the shared
3653         data before it has been completely initialized. If we instead use
3654         a standard mutex locking mechanism around shared_init(), we can
3655         avoid the situation entirely. By wrapping the mutex locking in a
3656         check to see if we've already initialized the data, we can even
3657         avoid wasting resources by having to lock/unlock the mutex in any
3658         later calls (the only time we'd have to worry about
3659         locking/unlocking is the initial race to call shared_init() at
3660         startup).
3661
3662 Sat Jun 1 13:27:11 CEST 2002 Paolo Molaro <lupus@ximian.com>
3663
3664         * atomic.h: inline asm fixes from Dennis Haney (davh@davh.dk).
3665
3666 Fri May 31 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
3667
3668         * daemon.c, handles.c: rename "sun" local var since it's apparently
3669         a #define on Solaris.
3670
3671 Fri May 31 15:40:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
3672
3673         * daemon-messages.c: work-around MSG_NOSIGNAL missing on some
3674         platforms.
3675
3676 2002-05-15  Dick Porter  <dick@ximian.com>
3677
3678         * wait.c: Fix a deadlock in WaitForMultipleObjects
3679
3680 2002-05-14  Dick Porter  <dick@ximian.com>
3681
3682         * io.c: Fix a cut&paste error, found by
3683         Jaroslaw Kowalski <jarek@atm.com.pl>
3684
3685 2002-05-10  Dan Lewis  <dihlewis@yahoo.co.uk>
3686
3687         * io.c: Nasty typo.
3688
3689 2002-05-09  Dick Porter  <dick@ximian.com>
3690
3691         * threads.c: 
3692         * semaphores.c: 
3693         * processes.c: 
3694         * mutexes.c: 
3695         * handles-private.h: 
3696         * events.c: 
3697         * Makefile.am: Remove now-unused file wait-private.h
3698
3699 2002-05-08  Dick Porter  <dick@ximian.com>
3700
3701         * shared.c: Better error messages, and report when daemon
3702         connection fails rather than blocking forever.  Do some more
3703         shared memory sanity checking.
3704
3705         * handles.c: Better error messages when connecting to shared
3706         memory and the handle daemon.  Fall back to non-shared handles if
3707         an error occurs.  Set the default back to 'shared handles'.  Fix a
3708         crashing bug in scratch space allocation that mangled the block
3709         headers.
3710
3711 2002-05-07  Miguel de Icaza  <miguel@ximian.com>
3712
3713         * handles.c (shared_init): Disable SHM for now, people have too
3714         many problems with this, and the diagnostics are not helping.
3715
3716 2002-05-06  Dan Lewis  <dihlewis@yahoo.co.uk>
3717
3718         * io.c: CreateFile sets win32 last error.
3719
3720 2002-05-05  Dick Porter  <dick@ximian.com>
3721
3722         * wapi-private.h: 
3723         * handles-private.h:
3724         * io.c: 
3725         * io-private.h:
3726         * mutexes.c: 
3727         * mutex-private.h: 
3728         * processes.c: 
3729         * process-private.h: 
3730         * semaphores.c: 
3731         * semaphore-private.h: 
3732         * sockets.c: 
3733         * socket-private.h: 
3734         * events.c: 
3735         * event-private.h: Simplify the WapiHandleOps struct: take out all
3736         the file-specific entries, leaving just the items that operate on
3737         handles themselves.  Split the close operation into shared and
3738         private parts: shared close is called by the daemon.
3739
3740         * handles.c: As above, but also pass handle allocation, ref and
3741         unref operations to the daemon.  Populate the handle_ops array at
3742         compile time, because the daemon needs to call ops on handles too.
3743         Don't bother to track open handle counts any more, the daemon does
3744         that.
3745         
3746         * threads.c: 
3747         * thread-private.h: As above, but also make the thread data
3748         handle-private.
3749
3750         * shared.c: Fork a handle daemon if the calling process created
3751         the shared memory segment.
3752
3753         * daemon.c:
3754         * daemon-messages.c:
3755         * daemon-messages.h:
3756         * Makefile.am: Build a daemon to manage handle allocation and
3757         destruction without needing to lock the shared memory
3758
3759 2002-04-30  Jeffrey Stedfast  <fejj@ximian.com>
3760
3761         * atomic.c: Changed to use a normal mutex rather than a spinlock
3762         since a lot of platforms seem to not have them :\
3763
3764 2002-04-30  Dick Porter  <dick@ximian.com>
3765
3766         * Completely rewrote the handle waiting code: removed the helper
3767         thread and its attendant complexity.  All handle waiting is now
3768         abstracted into the WaitForSingleObject() and
3769         WaitForMultipleObjects() functions.
3770
3771         * Implemented inter-process sharing of handles using sysv shared
3772         memory.  This makes handles even more opaque, with a handle now
3773         just an index into an array.
3774         
3775 2002-04-25  Dan Lewis  <dihlewis@yahoo.co.uk>
3776
3777         * io.c: unitialized pointer in GetCurrentDirectory.
3778
3779 Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
3780
3781         * threads.c: destroy the mutex at thread destruction
3782         (if/when thread destruction code will be actually called).
3783         When protecting a tls data pointer from the gc, use also the 
3784         thread id in the key.
3785         
3786 Wed Apr 17 18:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
3787
3788         * timed-thread.c: avoid race condition when setting the thread to
3789         detached.
3790
3791 2002-04-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>
3792
3793         * jit.h: to more #include lines to avoid breaking compilation
3794         under windows when upgrading mingw and w32api to version
3795         1.3 (thanks Dick!).
3796
3797 2002-04-16  Dick Porter  <dick@ximian.com>
3798
3799         * atomic.h: Explanatory comment about lack of 80386 support
3800
3801 2002-04-15  Dick Porter  <dick@ximian.com>
3802
3803         * atomic.h: use xaddl for InterlockedIncrement() and
3804         InterlockedDecrement().  Use cmpxchgl in a loop for
3805         InterlockedExchange() and InterlockedExchangePointer().
3806
3807 Mon Apr 15 13:31:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
3808
3809         * unicode.c: fix unicode_len() to not access uninitialized memory
3810         (and updated to conform to mono code style).
3811
3812 Fri Mar 29 17:15:11 CET 2002 Paolo Molaro <lupus@ximian.com>
3813
3814         * io.c: EEXISTS is ignored for directory creation.
3815         * mono-mutex.h: remove silly "pragma }" that emacs users insert
3816         because they use a broken editor:-)
3817
3818 2002-03-28  Dick Porter  <dick@ximian.com>
3819
3820         * sockets.h: 
3821         * sockets.c: 
3822         * io.c: 
3823         * handles.h: 
3824         * handles.c: Warning cleanups
3825
3826 2002-03-27  Dan Lewis <dihlewis@yahoo.co.uk>
3827
3828         * unicode.h, unicode.c: changed to gunichar2
3829         * io.h, io.c: changed strings to gunichar2*, added
3830         SetFileAttributes(), GetCurrentDirectory(), SetCurrentDirectory(),
3831         some fixes to FindFirstFile() and friends.
3832
3833 2002-03-26  Dick Porter  <dick@ximian.com>
3834
3835         * types.h: Implement the large integer struct
3836
3837         * timefuncs.h:
3838         * timefuncs.c: Dummy functions that don't yet implement
3839         QueryPerformanceCounter() and QueryPerformanceFrequency()
3840
3841         * threads.h:
3842         * threads.c: Implement SleepEx()
3843
3844         * system.h:
3845         * system.c: Beginnings of GetSystemInfo()
3846
3847         * mono-mutex.c (pthread_mutex_timedlock): Fix a ms/ns conversion
3848         thinko
3849
3850         * context.h:
3851         * context.c: Dummy function that doesnt yet implement
3852         GetThreadContext()
3853
3854         * atomic.h: 
3855         * atomic.c: Interlocked functions
3856
3857 Mon Mar 25 13:01:40 CET 2002 Paolo Molaro <lupus@ximian.com>
3858
3859         * threads.c: use a gc-safe hash table to store tls pointers.
3860
3861 2002-03-22  Dick Porter  <dick@ximian.com>
3862
3863         * threads.c: Fix a race condition where a thread can start and
3864         exit before the handle has been properly initialised (no reason
3865         why the handle couldn't be initialised beforehand, so do so)
3866
3867         Fix a ms to ns conversion magnitude thinko.
3868
3869 2002-03-21  Dick Porter  <dick@ximian.com>
3870
3871         * semaphores.c: Fix a problem when waiting for one or more
3872         semaphores, and another semaphore is Released (all waiting
3873         semaphores assumed they were signalled)
3874
3875 2002-03-29  Dan Lewis <dihlewis@yahoo.co.uk>
3876
3877         * io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory,
3878         RemoveDirectory, GetFileAttributes, GetFileAttributesEx
3879
3880 2002-03-19  Dietmar Maurer  <dietmar@ximian.com>
3881
3882         * threads.c (Sleep): bug fix: 1ms == 1000000ns
3883
3884 2002-03-19  Dan Lewis <dihlewis@yahoo.co.uk>
3885
3886         * io.h, io.c, events.c, mutexes.c, semaphores.c, sockets.c,
3887         threads.c, io.c: added flush method to handles.
3888
3889         * io.c: FlushFileBuffers() and FindFirstFile() functions.
3890
3891 Thu Mar 7 17:21:52 CET 2002 Paolo Molaro <lupus@ximian.com>
3892
3893         * threads.c, timed-thread.c, wait.c: Boehm-GC anable.
3894
3895 2002-02-20  Dick Porter  <dick@ximian.com>
3896
3897         * io-layer.h: Always build without cygwin support on windows
3898
3899 Mon Feb 18 15:50:59 CET 2002 Paolo Molaro <lupus@ximian.com>
3900
3901         * sockets.c: #undef DEBUG.
3902
3903 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
3904
3905         * io-layer.h: conditionally include sys/filio.h and sys/sockio.h
3906         for FIONBIO, FIONREAD, and SIOCATMARK.
3907
3908 2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>
3909
3910         * sockets.c: conditionally include sys/filio.h and sys/sockio.h
3911         for FIONBIO, FIONREAD, and SIOCATMARK.
3912
3913 2002-02-13  Dick Porter  <dick@ximian.com>
3914
3915         * sockets.c: Implement shutdown and select
3916
3917 2002-02-13  Jeffrey Stedfast  <fejj@ximian.com>
3918
3919         * mono-mutex.[c,h]: New source files that thinly wrap all pthread
3920         functions that take pthread_mutex_t and/or pthread_mutexattr_t
3921         arguments for the sake of portability. Implements recursive
3922         mutexes and pthread_mutex_timedlock.
3923
3924         * critical-sections.c:
3925         * events.c:
3926         * handles.c:
3927         * mutexes.c:
3928         * semaphores.c:
3929         * threads.c:
3930         * timed-thread.c:
3931         * wait.c: Use the mono-mutex wrapper portability functions/macros.
3932
3933         * pthread-compat.[c,h]: Replaced by mono-mutex.[c,h]
3934
3935 2002-01-23  Dick Porter  <dick@ximian.com>
3936
3937         * sockets.c: Networking support, mostly wrapping BSD socket APIs
3938         with handle code, and translating errno into w32 error codes.
3939
3940         * macros.h: Some w32 macros used with the socket support
3941
3942         * error.c: Implemented GetLastError() and SetLastError()
3943
3944         * Makefile.am: Added sockets, with kludge to override some symbols
3945
3946 2001-12-17  Dietmar Maurer  <dietmar@ximian.com>
3947
3948         * unicode.c (_wapi_unicode_to_utf8): byteswap UTF16 strings before
3949         passing them to iconv
3950         (_wapi_unicode_to_utf8): only swap bytes on LE systems, remove bug
3951         from previous commit.
3952
3953 2001-12-11  Dick Porter  <dick@ximian.com>
3954
3955         * io.c: Implement DeleteFile(), GetFileTime(), SetFileTime() and
3956         FileTimeToSystemTime().
3957
3958         * unicode.c (unicode_len): Nasty way of finding length of unicode
3959         string with embedded NULLs (counts until two NULLs together).
3960
3961         * mutexes.c (mutex_close): 
3962         * events.c (event_close): Release the internal pthreads resources
3963
3964 2001-11-26  Dick Porter  <dick@ximian.com>
3965
3966         * critical-sections.c:
3967         * events.c:
3968         * handles.c:
3969         * io.c:
3970         * mutexes.c:
3971         * semaphores.c:
3972         * threads.c:
3973         * timed-thread.c:
3974         * wait.c: turn off DEBUG messages
3975
3976 2001-11-22  Dick Porter  <dick@ximian.com>
3977
3978         * handles.c (SignalObjectAndWait): Implement
3979
3980         * wait.c (WaitForSingleObject): Fix case where timeout == 0
3981
3982         * threads.c:
3983         * semaphores.c:
3984         * mutexes.c:
3985         * io.c:
3986         * events.c: Support for SignalObjectAndWait
3987         
3988 2001-11-21  Dick Porter  <dick@ximian.com>
3989
3990         * events.c:
3991         * handles.c:
3992         * mutexes.c:
3993         * semaphores.c:
3994         * threads.c:
3995         * wait.c: Reliable method of returning which handle was signalled
3996         on return from WaitForMultipleObjects().
3997
3998 2001-11-21  Dick Porter  <dick@ximian.com>
3999
4000         * events.c: Implement events
4001
4002 2001-11-15  Dick Porter  <dick@ximian.com>
4003
4004         * mutexes.c: Implement mutexes
4005
4006         * threads.c: 
4007         * semaphores.c: 
4008         * misc.c: Factor out some common code
4009
4010 2001-11-13  Dick Porter  <dick@ximian.com>
4011
4012         * threads.c: Implement TLS.  Implement GetCurrentThreadId(), and
4013         GetCurrentThread() by maintaining a hash of thread handles.
4014
4015         * threads.h: Define thread and process creation flags
4016
4017 2001-11-12  Dick Porter  <dick@ximian.com>
4018
4019         * critical-sections.c: Implement critical sections
4020
4021 2001-11-12  Dick Porter  <dick@ximian.com>
4022
4023         * semaphores.c: Implement semaphores
4024
4025         * wait.c (wait_for_item): Maintain a wait count rather than count
4026         signalled booleans.
4027
4028         * threads.c (thread_wait_multiple): Don't lock the wait item, that
4029         will block other wait threads
4030
4031 2001-11-11  Dick Porter  <dick@ximian.com>
4032
4033         * Makefile.am: Rename some automake variables
4034         (from Nick Drochak <ndrochak@gol.com>)
4035
4036 2001-11-10  Dick Porter  <dick@ximian.com>
4037
4038         * Makefile.am (libwapiincludedir): Fix include destination
4039
4040         * .cvsignore: Ignore generated files
4041
4042 2001-11-10  Dietmar Maurer  <dietmar@ximian.com>
4043
4044         * pthread-compat.c: added some include files to make it compile on
4045         linux.
4046
4047 2001-11-08  Dick Porter  <dick@ximian.com>
4048
4049         * Initial checkin.
4050
4051         This is a library emulating the win32 threading and IO API.