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