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