2010-07-15  Zoltan Varga  <vargaz@gmail.com>

	* wthreads.c (CreateThread): Avoid an assert if the stack size specified by the
	caller is smaller than the system minimum.

2010-06-29  Geoff Norton  <gnorton@novell.com>

	* atomics.h: Implement armv6+ variants of our atomics.

2010-06-25  Zoltan Varga  <vargaz@gmail.com>

	* Makefile: Don't build an sgen aware version, it is no longer needed.

	* wait.c handles.c wthreads.c: Call the mono_gc_ wrapper functions of some pthread
	apis. This breaks the compile time dependency between io-layer and the GC.

2010-06-23  Miguel de Icaza  <miguel@novell.com>

	* Makefile.am: Add support for building a sgen-aware versions of
	the library: libwapisgen.la libmonoruntimesgen-static it shares
	all the components of the default, but use a differen set of
	CFLAGS to enable SGEN instead.

2010-06-01  Geoff Norton  <gnorton@novell.com>

	* sockets.c: Don't call poll directly, use mono_poll.

2010-04-29  Geoff Norton  <gnorton@novell.com>

	* mono-spinlock.h: Remove
	* wthreads.c: Don't spinlock here, use a mutex instead

2010-04-26  Geoff Norton  <gnorton@novell.com>

	* processes.c: Fix this for 64-bit darwin.

2010-04-20  Jonathan Pryor  <jpryor@novell.com>

	* collection.c: Cleanup platform checks around
	  pthread_attr_setstacksize(), and instead always use
	  MAX(65536, PTHREAD_STACK_MIN) as the stack size.
	* mono-mutex.c: Remove near duplicate pthread_mutex_timedlock()
	  declarations, and merge via a CONST_NEEDED intermediate #define.

2010-04-19  Jonathan Pryor  <jpryor@novell.com>

	* collection.c, mono-mutex.c: Add Android support.

2010-04-14  Zoltan Varga  <vargaz@gmail.com>

	* collection.c (_wapi_collection_init): Set stack size on openbsd similarly to
	the other BSDs.

2010-04-10  Andreas Färber  <andreas.faerber@web.de>

	* processes.c (EnumProcesses, load_modules): Add implementations
	for Haiku. Fixes build on Haiku.
	(OpenProcess, EnumProcessModules, get_process_name_from_proc):
	Tweak implementations for Haiku.
	* process-private.h: Fix _WAPI_PROCESS_UNHANDLED_PID_MASK for
	32-bit pids (Haiku).
	* ChangeLog: Fix UTF-8 encoding

	Code is contributed under MIT/X11 license.

2010-04-09  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Applied more openbsd changes from Robert Nagy <robert@openbsd.org>.

2009-04-06 Rodrigo Kumpera  <rkumpera@novell.com>

	* wthreads.c (TlsSetValue): Don't take locks here. We trust pthread_setspecific
	return value to tell if we tried to store to an invalid slot.

2010-04-04  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Applied more openbsd changes from Robert Nagy <robert@openbsd.org>.

2010-04-03  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Applied more openbsd changes from Robert Nagy <robert@openbsd.org>.

2010-04-03  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Applied some openbsd changes from Robert Nagy <robert@openbsd.org>.

2010-03-26  Zoltan Varga  <vargaz@gmail.com>

	* sockets.c: Apply some openbsd changes from openbsd ports.

2010-03-26  Zoltan Varga  <vargaz@gmail.com>

	* shared.c: Disable shared supported by default, it can be enabled by setting
	the MONO_ENABLE_SHM env variable.

2009-03-22 Rodrigo Kumpera  <rkumpera@novell.com>

	* threads.h: Add wapi_self_interrupt.

	* wthreads.c: Add wapi_self_interrupt which puts the current
	thread in interrupted state.

	* wthreads.c (wapi_thread_clear_wait_handle): Previous handle
	can possibly be NULL if an async interrupt cleared it.

	This is safe because it is only async cleared if running inside a
	handler block.

2010-03-06 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* processes.c: made ShellExecuteEx actually work when the file name to
	execute is quoted. Display a message intead of blindly ignoring the
	result of g_shell_parse_argv(). Fixes bug #385497.

2010-03-05  Zoltan Varga  <vargaz@gmail.com>

	* shared.c (shm_semaphores_init): Applied patch from Cal Page
	(age.cal@gmail.com). Fix support for USE_SHM.

2010-02-25  Geoff Norton  <gnorton@novell.com>

	* wait.c: If any of our handles are shared, we need to do
	a polling wait so we're notified of the signal change.

Wed Feb 24 16:01:37 CET 2010 Paolo Molaro <lupus@ximian.com>

	* Makefile.am: don't install the headers anymore, they are private.

2010-02-20  Zoltan Varga  <vargaz@gmail.com>

	* versioninfo.c (VerLanguageName): Remove code duplication a bit.

2009-12-02  Miguel de Icaza  <miguel@novell.com>

	* processes.c (EnumProcesses): Add support for OSX, patch from Tom
	Philpot <tom.philpot@logos.com>

2009-11-30  Carlos Alberto Cortez <calberto.cortez@gmail.com>

	* io.cs: In CopyFile check if the destination already exists before
	trying to open it, and if it is the same as the source, report an error,
	just as .net does. We do the check here to take advantage of the IOMAP
	capability.
	Fixes #510230.

2009-11-13 Jonathan Chambers <joncham@gmail.com>

	* mono-mutex.h: Implementation for Windows platform.
	
	Code contributed under MIT/X11 license.

2009-11-13  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Include mono-path.h.

2009-11-12  Geoff Norton  <gnorton@novell.com>

	* processes.c: match_procname_to_modulename should resolve
	symlinks when checking if two process modules match.

2009-11-04 Jonathan Chambers <joncham@gmail.com>

	* mono-mutex.h: Add skeleton implementation for Windows platform.
	
	Code contributed under MIT/X11 license.

2009-10-21 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* sockets.[ch]: fix function definition.

2009-10-21 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* sockets.[ch]: added TransmitFile implementation.

2009-10-04  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Implement get_process_name_from_proc () on solaris.

2009-09-24  Zoltan Varga  <vargaz@gmail.com>

	* processes.c (load_modules): Applied patch from Thomas Philpot
	(tom.philpot@logos.com). Fixes #533893.

2009-09-15  Jeffrey Stedfast  <fejj@novell.com>

	* io.c (CreateFile): In the directory fallback case, use
	_wapi_open() again so that IOMAP magic happens.
	(CopyFile): Need to consistently use _wapi_open() here too.
	(ReplaceFile): Use _wapi_open() here too and get rid of the
	fallback code that tried re-opening the file w/o O_TRUNC since
	there's no reason to do that.

2009-09-05  Zoltan Varga  <vargaz@gmail.com>

	* handles.c (_wapi_handle_real_new): Call _wapi_process_reap () when running
	out of shared handes. Fixes #536776.

	* processes.c (CreateProcess): Return false and set the error to
	ERROR_OUTOFMEMORY when a process handle cannot be created.
	(ShellExecuteEx): Propagate an ERROR_OUTOFMEMORY error code. Fixes part of
	#536776.

2009-09-01  Zoltan Varga  <vargaz@gmail.com>

	* processes.c (EnumProcessModules): Applied patch from Romain Tartière
	(romain@blogreen.org). Fix this on freebsd/OSX. Fixes #533893.

2009-08-18  Christian Hergert  <chris@dronelabs.com>

	* wthreads.c: Roll back change for thread-id as it "embraces
	and extends" the api by passing word-size for thread id on
	s390 and amd64.

2009-08-18  Christian Hergert  <chris@dronelabs.com>

	* security.c:
	* processes.c:
	* wthreads.c: Be explicit when we are changing word sizes.

2009-08-18  Christian Hergert  <chris@dronelabs.com>

	* processes.c: Fix method declaration warnings.
	* sockets.c: getsockopt() wants socklen_t for size.

2009-08-04  Miguel de Icaza  <miguel@novell.com>

	* posix.c (_wapi_stdhandle_create): Split this into a new file to
	more easily support non-Posix platforms.

2009-07-20  Geoff Norton  <gnorton@novell.com>

	* thread-private.h: Use the new mono-semaphore.h.

2009-06-25 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* sockets.c: add the error number to the message so we can figure out
	when this happens.

2009-06-25 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* wait.c: add missing 'break'.

2009-06-20  Zoltan Varga  <vargaz@gmail.com>

	* atomic.h: Fix ilp32 support on ppc.

2009-05-28  Mark Probst  <mark.probst@gmail.com>

	* collection.c (_wapi_collection_init): If pthread_create() fails,
	try again with larger and then with no stack size set.  Fixes
	#470336.

2009-05-26  Zoltan Varga  <vargaz@gmail.com>

	* shared.c (_wapi_shm_file): Avoid creating a .wapi directory here, create
	it in _wapi_shm_file_open (), since platforms using posix shm don't need it.

2009-05-22  Miguel de Icaza  <miguel@novell.com>

	* wapi_glob.c: Do not need sys/param.h anymore, we now use the
	POSIX PATH_MAX instead of BSD's MAXPATHLEN

	* handles.c: Do not pull a reference to sockets if they are
	disabled.

	* sockets.c: Allow for ports to define their own ioctlsocket. 

	* wthreads.c: Remove obsolete code that I recently introudced (the
	hook for mono_register_thread_attr.

2009-05-22  Miguel de Icaza  <miguel@novell.com>

	* versioninfo.c: One missing signature, fixed.

2009-05-21  Miguel de Icaza  <miguel@novell.com>

	* daemon.c: Remove more DEBUG ifdef mess.

	* shared.c (_wapi_shm_attach): Implemention for DISABLE_SHARED_HANDLES 

2009-05-20  Miguel de Icaza  <miguel@novell.com>

	* sockets.c (ioctlsocket): Move support for MacOS semantics to the
	ioctlsocket from the ifdef that was previously on metadata/

	* wapi_glob.c (_wapi_glob): Use PATH_MAX from limits.h instead of
	the BSD name from sys/param.h (MAXPATHLEN)

	Do not include pwd.h as it is not used.

	* thread-private.h: Use indent ifdef style for clarity

	* sockets-wrappers.h: sys/socket.h conditional

	* daemon-messages.h: sys/uio.h conditional.

	* sockets.c: sys/ioctl.h conditional

	* wthreads.c: work around for platforms with no thread fetching
	information. 

	* versioninfo.c: Use the portable mono_map_ interface instead of
	using mmap directly and change the style to the Mono style.

	Remove more DEBUG/ifdefs combos

	* shared.c: Split the code to make DISABLE_SHARED remove all the
	code that does not use the shared handles.   Before it merely
	removed some of it, with this we avoid hacks on platforms that can
	not implement it.

	Split the code to reduce the amount of ifdefs.

	Remove #ifdef DEBUG from the source and use a macro instead.

2009-05-20  Miguel de Icaza  <miguel@novell.com>

	* locking.c: Split locking code into a separate file.

2009-05-18  Miguel de Icaza  <miguel@novell.com>

	* daemon.c: Move the compile check of MONO_SIZEOF_SUNPATH to the
	file that uses it.

	* Rename `threads.c' to `wthreads.c' as broken build systems are
	not able to cope with two files with the same name across multiple
	directories. 

2009-05-15  Geoff Norton  <gnorton@novell.com>

	* handles.c: Don't start the collection thread if we've disabled
	shared handles.

2009-05-12  Zoltan Varga  <vargaz@gmail.com>

	* collection.c (collection_thread): Get rid of all the ifdefs and
	gcc attributes, simply return NULL.

2009-05-11  Zoltan Varga  <vargaz@gmail.com>

	* shared.c: Applied patch from Koushik K. Dutta (koush@koushikdutta.com).
	Fix the build on android.

2009-05-09  Miguel de Icaza  <miguel@novell.com>

	* messages.c: Split the scan into common and uncommon messages to
	allow the messages that are not produced by Mono to be removed on
	embedded scenarios.
	
	* messages.c (message_string): instead of having a gigantic switch
	table, use a sorted structure in memory and do a binary search on
	it.

	This reduces the runtime size by 49k and the debugging symbols by
	400k.

2009-04-29 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* sockets.c: don't display a warning when connect() fails because the
	socket was closed in another thread.

2009-04-23 Rodrigo Kumpera  <rkumpera@novell.com>

	* shared.c: Fix a bunch of memleaks.

2009-03-27  Zoltan Varga  <vargaz@gmail.com>

	* threads.h: Add a comment to CreateThread.

2009-03-20  Zoltan Varga  <vargaz@gmail.com>

	* threads.c handles.c wait.c: Change location of gc_wrapper.h.

2009-02-22  Robert Jordan  <robertj@gmx.net>

	* sockets.c: implement WSASend/WSARecv using sendmsg/recvmsg.
	Fixes #470021.

	Code is contributed under MIT/X11 license.

2009-02-20 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* events.c: fix event_signal and namedevent_signal to actually signal
	the handle.

2009-02-12 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* io.c: EXDEV when moving directories fails now without creating a
	file in the destination.
	Fixes bug #326983.

2009-02-09  Zoltan Varga  <vargaz@gmail.com>

	* wait.c (WaitForMultipleObjectsEx): Initialize poll variable.

2009-02-05  Miguel De Icaza  <miguel@novell.com>

	* sockets.c (_wapi_setsockopt): SO_REUSEPORT is needed also on
	MacOS X.  Fixes bug #471292

2009-01-29  Zoltan Varga  <vargaz@gmail.com>

	* shared.c: Fall back to file based shared storage if shm_open () fails
	because /dev/shm is not mounted.
	
	* shared.c: Add an alternative implementation using shared memory instead of
	files. This fixes problems where the mono process would spin up the disk
	every x secs on laptops. Fixes #434566, #415373 and #321949.

2009-01-16  Miguel de Icaza  <miguel@novell.com>

	* sockets.c (WSASend): Fix memory leak, and optimize for the case
	with 1 segment. 

	This should really use writev or sendmsg to use the kernel
	scatter/gather facility instead of emulating it by copying buffers.

2009-01-26  Rodrigo Kumpera  <rkumpera@novell.com>

	* critical-sections.h (Enter/LeaveCriticalSection): Show
	helpfull warning messages before crashing.

2009-01-26  Rodrigo Kumpera  <rkumpera@novell.com>

	* handles-private.h (_wapi_handle_set_signal_state): Show
	helpfull warning messages before crashing.

2009-01-26  Jeffrey Stedfast  <fejj@novell.com>

	* mono-mutex.[c,h]: Removed GPLv2 copyright notice which should
	not have been there.

2009-01-20  Rodrigo Kumpera  <rkumpera@novell.com>

	* threads.c: Add wapi_current_thread_desc that produces
	a string representation of the current thread state.

	* threads.h: Export wapi_current_thread_desc.

2009-01-18  Zoltan Varga  <vargaz@gmail.com>

	* io.c (GetDiskFreeSpaceEx): Applied patch from Koushik Dutta
	(koush@koushikdutta.com). Disable this on android.

2009-01-16  Rodrigo Kumpera  <rkumpera@novell.com>

	* handles.c (_wapi_handle_timedwait_signal_handle): Don't use the
	set_wait_handle/clear_wait_handle machinery for alertable waits in
	case of non-alertable waits.

	Non-alertable waits must continue and wait on the cond as this will
	release the lock. Otherwise this will cause a deadlock as anyone trying
	to pulse the cond will block trying to acquire the said lock because
	the thread in non-alertable wait will be busy looping in WaitForSingleObjectEx
	or similar function, never releasing the lock.

	Thou this fixes quite a few of the hangs introduced by non-pooling alertable
	waits, the long term plan is to verify if all non-alertable waits really need
	to be as such.

2009-01-14  Zoltan Varga  <vargaz@gmail.com>

	* handles-private.h (_wapi_handle_set_signal_state): Set the signalled state
	of the handle while locking the global signal cond mutex.

	* wait.c (WaitForMultipleObjectsEx): Check the signalled state of handles
	inside the critical section before waiting, otherwise we could go to waiting
	even when the handles are already signalled.

2009-01-13  Zoltan Varga  <vargaz@gmail.com>

	Reapply r122913, this time handling processes by falling back to polling.
	
	* handles.c: Rework the way the global signal stuff is handled: instead of
	allocating a separate mutex/condvar pair for it, allocate a normal handle.
	This way, it can reuse the alertable waiting code, allowing 
	WaitForMultipleObject to work without polling.

2009-01-09  Miguel de Icaza  <miguel@novell.com>

	Incorporate a few patches from Paolo, slightly modified:	

	* handles.c (_wapi_handle_check_share): On non-Linux systems, do
	not even compile in the code that scans for /proc/fd, and go
	directly to the fallback function.

2009-01-09  Paolo Molaro (lupus@ximian.com)

	* handles.c: Do not include some header files in platforms that
	lack it.

2009-01-09  Miguel de Icaza  <miguel@novell.com>

	* messages.c: Eliminate a warning.
	
2009-01-09  Paolo Molaro (lupus@ximian.com)

	* error.c: On some platforms that do not define these variables,
	do not use them.

	* security.c, io-private.h: Only include some headers if they
	exist on the system

	* sockets.c, sockets.h: do not import on this header files that
	are only consumed internally in sockets.c.

2009-01-09  Zoltan Varga  <vargaz@gmail.com>

	* threads.c (_wapi_thread_apc_pending): Check for thread->wait_handle ==
	INTERRUPTION_REQUESTED_HANDLE too.
	(wapi_interrupt_thread): Rework the comments, the thread is no longer
	required to call QueueUserAPC to make the wait functions return.

	* threads.c handles.c threads-internal.h: Implement alertable waits without
	polling.

2009-01-08  Geoff Norton  <gnorton@novell.com>

	* processes.c: Fix the osx version check to properly detect 10.5 v 10.4

2009-01-08  Christian Prochnow  <cproch@seculogix.de>

	* types.h: added WapiULargeInteger.

	* uglify.h: added ULARGE_INTEGER, PULARGE_INTEGER.

	* io.h: added WapiDriveType, added method declarations
	for GetDiskFreeSpaceEx and GetDriveType

	* io.c: added GetDiskFreeSpaceEx() to query disk size
	and free space via statvfs or statfs system call.
	added GetDriveType to query drive type via /etc/mtab or /etc/mnttab.

2009-01-07  Geoff Norton  <gnorton@novell.com>

	* processes.c: Properly implement support for Process.Modules on OSX.
	Fixes OSX on nunit 2.4

2009-01-07 Rodrigo Kumpera  <rkumpera@novell.com>

	* io.c (GetCurrentDirectory): Avoid calling g_get_current_dir straight
	away as it doesn't handle ENAMETOOLONG correctly. As a bonus we avoid
	allocating memory in the common path.

2009-01-07  Geoff Norton  <gnorton@novell.com>

        * processes.c: Only use open -W on OSX 10.5+.  Patch from
        Miguel

2008-12-19  Bill Holmes  <billholmes54@gmail.com>

	* processes.c (get_module_name) : adjust size for unicode characters.

	Code is contributed under MIT/X11 license.

2008-11-21  Zoltan Varga  <vargaz@gmail.com>

	* atomic.h: Applied patch from Mihai Chelaru <kefren@ngnetworks.ro>. Add
	netbsd support.

2008-11-18  Mark Probst  <mark.probst@gmail.com>

	* atomic.h: InterlockedExchangePointer and
	InterlockedCompareExchangePointer for PPC64.

	Code submitted by andreas.faerber@web.de at
	https://bugzilla.novell.com/show_bug.cgi?id=324134 under the
	X11/MIT license.

2008-11-13  Bill Holmes  <billholmes54@gmail.com>

	* wait.h : Adding method declaration for WaitForInputIdle.

	* wait.c : Adding implementation for WaitForInputIdle.

	Code is contributed under MIT/X11 license.

Fri Oct 17 15:23:00 CEST 2008 Paolo Molaro <lupus@ximian.com>

	* processes.c: patch from Geoff Norton (gnorton@novell.com) to
	strdup the open program on OSX (bug #431811).

2008-10-10 Gonzalo Paniagua Javier <gonzalo@novell.com>

	* versioninfo.c: remove the use of g_strdown.

2008-09-25  Dick Porter  <dick@ximian.com>

	* wait.c: Make sure we keep references to handles we're waiting
	for.  Fixes bug 424851.

2008-07-29  Dick Porter  <dick@ximian.com>

	* processes.c (get_module_name): Make a last-ditch effort to
	figure out the process name.  Fixes bug 413723, patch by Casey
	Marshall <casey.s.marshall@gmail.com>

2008-07-28  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_count_signalled_handles): Remove an
	unmatched _wapi_handle_ref().  Fixes bug 410743.

2008-07-15  Rodrigo Kumpera  <rkumpera@novell.com>

	* versioninfo.c (map_pe_file): Fix memory leak.

2008-07-01  Zoltan Varga  <vargaz@gmail.com>

	* process-private.h (_WAPI_PROCESS_UNHANDLED_PID_MASK): Fix the amd64 build.

2008-06-27  Dick Porter  <dick@ximian.com>

	* processes.c: Implement a form of process pseudo-handle to allow
	non-mono processes to be manipulated.  Fixes bug 313231.

	* wait.c: Check for process pseudo-handles and fail if an attempt
	is made to wait on one.

2008-06-19  Dick Porter  <dick@ximian.com>

	* sockets.c: Implement WSASend() and WSAReceive().

2008-06-02  Dick Porter  <dick@ximian.com>

	* wapi.h: 
	* Makefile.am: 
	* messages.h: 
	* messages.c: Implement FormatMessage, fixes bug 321827.

2008-05-29  Dick Porter  <dick@ximian.com>

	* sockets.c (socket_close): Clear any saved errors
	(_wapi_connect): Don't save EWOULDBLOCK errors here, as that
	breaks async connects.  (Bug 377589 test case broken by the
	previous fix to bug 356552)

2008-05-25  Zoltan Varga  <vargaz@gmail.com>

	* thread-private.h (struct _WapiHandle_thread): Remove 'owner_pid' field. Reorder
	fields so this struct (which is the biggest of the handle structs) takes less
	space.

	* threads.c (QueueUserAPC): Make this function signal safe by adding some
	restrictions on its usage.

2008-05-14  Zoltan Varga  <vargaz@gmail.com>

	* mono-mutex.h: Get rid of the #ifdef __cplusplus defines, use G_BEGIN_DECLS
	/G_END_DECLS.

2008-05-07  Dick Porter  <dick@ximian.com>

	* io.c (FindNextFile): Handle symlinks correctly.  Fixes bug
	385765.

2008-04-25  Zoltan Varga  <vargaz@gmail.com>

	* handles.c (_wapi_handle_check_share): Fix a crash introduced by the lazy
	creation of wapi handle slots.

2008-04-24  Zoltan Varga  <vargaz@gmail.com>

	* handles.c (shared_init): Align _wapi_fd_reserve to a multiple of 
	_WAPI_HANDLE_INITIAL_COUNT to avoid a problem when allocating handles.

2008-04-23  Zoltan Varga  <vargaz@gmail.com>

	* handles.c: Initialize the handle array entries on demand to save memory.

	* wapi-private.h (_WAPI_HANDLE_INITIAL_COUNT): Decrease this to 256 to save
	memory.

	* handles-private.h (_WAPI_PRIVATE_MAX_SLOTS): Increase this to 1024*16 to
	compensate for the decrease in _WAPI_HANDLE_INITIAL_COUNT.
	
	* threads.c: Use #ifdef instead of #if for checking for valgrind/memcheck.h.

2008-04-22  Dick Porter  <dick@ximian.com>

	* wapi_glob.c (globextend): Comment out the code using ARG_MAX, as
	that is broken on the latest opensuse.

2008-04-21  Dick Porter  <dick@ximian.com>

	* io.c (DeleteFile): Disable for now the bug fix for 323389, it's
	breaking too much other stuff.

2008-04-20  Geoff Norton  <gnorton@novell.com>

	* processes.c: Fix the _NSGetEnviron define to prevent an impropoer
	pointer dereference.

2008-04-18  Miguel de Icaza  <miguel@novell.com>

	* Applied patch from Dick Porter from bug #380649

2008-04-17  Dick Porter  <dick@ximian.com>

	* io.c (DeleteFile): Check file shares before deleting a file.
	Fixes bug 323389.

2008-04-17  Dick Porter  <dick@ximian.com>

	* io.c (DeleteFile): Return ERROR_ACCESS_DENIED if the file is
	readonly.  Fixes bug 378229.

2008-04-11  Geoff Norton  <gnorton@novell.com>

	* processes.c: The global extern environ doesn't exist on Mac.  We
	need to call NSGetEnviron instead.

2008-04-08  Dick Porter  <dick@ximian.com>

	* processes.c (CreateProcess): Improve the managed binary support,
	so it works when the executable is passed in as the appname.
	Fixes bug 377815.

2008-04-04  Dick Porter  <dick@ximian.com>

	* io.c (MoveFile): Check file shares before moving a file.  Fixes
	bug 377049.

2008-04-04  Dick Porter  <dick@ximian.com>

	* error.c (errno_to_WSA): handle ENODEV.  Fixes the reopened part
	of bug 324035.

2008-04-04  Dick Porter  <dick@ximian.com>

	* processes.c (GetModuleInformation): 
	* versioninfo.h: 
	* versioninfo.c: 64bit fixes

2008-04-03  Dick Porter  <dick@ximian.com>

	* io-portability.c (_wapi_basename, _wapi_dirname): Only turn \
	into / when MONO_IOMAP is in effect.  Fixes bug 346123.

2008-04-03  Dick Porter  <dick@ximian.com>

	* timefuncs.c (GetTickCount): Use mono_msec_ticks(), see bug
	347476.

2008-04-01  Dick Porter  <dick@ximian.com>

	* versioninfo.c (get_string_block): Refine the fix for bug 354856
	(r93661) so that it also fixes the new part of bug 374600.

2008-03-28  Dick Porter  <dick@ximian.com>

	* processes.c (GetExitCodeProcess): Check if a process has exited
	and recorded it's exit code, before seeing if the process is
	signalled.  Fixes bug 325463.

2008-03-27  Dick Porter  <dick@ximian.com>

	* processes.c (match_procname_to_modulename): Check the whole
	process name first, in case it is recorded as an absolute path.
	Fixes bug 360348.

2008-03-27  Dick Porter  <dick@ximian.com>

	* processes.c (ShellExecuteEx): Grotty kludge to work around
	unpleasant feature in g_shell_parse_argv() where it treats '#'
	embedded in a filename as a comment marker, and throws away the
	rest of the line.  When we're directly opening URLs quote the
	filename, to avoid this.  Fixes bug 371567.

2008-03-25  Dick Porter  <dick@ximian.com>

	* wapi-private.h (_WAPI_HANDLE_VERSION): Increment file layout
	version

	* threads.c: Make thread handles private to the process that owns
	them.

2008-03-22  Kornél Pál  <kornelpal@gmail.com>

	* io-layer.h: Windows: Rename GetProcessId to __GetProcessId for targets not
	supporting it. This fixes MSVC build with new Windows SDKs that declare
	GetProcessId unconditionally.

2008-03-20  Kornél Pál  <kornelpal@gmail.com>

	* io-layer.h: Removed Windows version macros.

Thu Mar 13 16:24:53 CET 2008 Paolo Molaro <lupus@ximian.com>

	* processes.c: properly check for executable files (fixes bug #368829).

2008-02-05  Dick Porter  <dick@ximian.com>

	* versioninfo.c (VerLanguageName): Implement VerLanguageName.

2008-01-31  Bill Holmes  <billholmes54@gmail.com>
	* processes.c (match_procname_to_modulename) : Added to check if the last 
	  part of module name is equal to the process name.

	* processes.c (EnumProcessModules) : Changed the first entry in the returned 
	  modules array (the process module) to be populated from the entry found
	  in /proc/<PID>/maps.

	* processes.c (get_module_name & GetModuleInformation) : In the case where 
	  the module passed in is NULL, search the /proc/<PID>/maps for a name that
	  matches the process name to populate the return information.

	Fixes #357062

2008-01-29  Zoltan Varga  <vargaz@gmail.com>

	* security.c (RevertToSelf): Make this return TRUE if impersonating is not
	supported.

	* sockets.c (_wapi_connect): Add a workaround to a solaris x86 problem where
	getsockopt (SO_ERROR) doesn't return an error code after connect () fails. Fixes
	#356552.

2008-01-23  Dick Porter  <dick@ximian.com>

	* versioninfo.c (get_string_block): When stepping over the
	StringTable block, do not read an extra block at the end.  Fixes
	the new part of bug 354856.

2008-01-19  Dick Porter  <dick@ximian.com>

	* versioninfo.c (get_stringtable_block): Cope when the StringTable
	block is first in the resources data, and we just need to step
	over it.  Fixes bug 354856.

2008-01-16  Dick Porter  <dick@ximian.com>

	* threads.c (_wapi_thread_set_termination_details): Move the
	thread abandonment to outside the shared handle lock.  Fixes bug
	349680.

2008-01-16  Dick Porter  <dick@ximian.com>

	* versioninfo.c (VerQueryValue): Include trailing null in returned
	string length, for MS compatibility.

2008-01-09  Dick Porter  <dick@ximian.com>

	* versioninfo.c (get_ptr_from_rva, scan_resource_dir): Make it
	work on big-endian systems.
	(scan_resource_dir): Copy the resource directory entry and
	byteswap if necessary so it works big-endian.  This fixes bug
	345972 for real this time.
	(VerQueryValue): String values set the length to the number of
	unicode chars, but the data length reported was already correct so
	don't halve it again.  Fixes the previous fix for bug 345972.
	(GetFileVersionInfo): On big-endian systems, scan the resource
	data and turn all unicode strings into UTF-16BE.  FileVersionInfo
	now works big-endian.

2008-01-04  Dick Porter  <dick@ximian.com>

	* versioninfo.c (VerQueryValue): Returned buffer length counts
	chars not bytes for string data.  Fixes bug 345972 again.
	(get_enclosing_section_header): Make sure values read are treated
	as LE.  Fixes crash on ppc reported in bug 345972.

2007-12-17  Mark Probst  <mark.probst@gmail.com>

	* threads.c: Guard against a race condition involving
	thread_hash_key that can occur during shutdown.

2007-12-08  Zoltan Varga  <vargaz@gmail.com>

	* processes.c: Include sys/mkdev.h if exists. Fixes solaris x86 build.

2007-12-06  Dick Porter  <dick@ximian.com>

	* versioninfo.c: Resource language values must be compared in a
	'case'-insensitive manner.  Fixes bug 345972.

2007-12-05  Dick Porter  <dick@ximian.com>

	* io.c (CreateFile): Create files with mode 0666 (&~umask) by
	default.  Fixes bugs 325299 and 337040.

2007-11-22  Dick Porter  <dick@ximian.com>

	* critical-sections.h (EnterCriticalSection): Reinstate the
	asserts in the devel branch, so any problems aren't obscured.

2007-11-22  Dick Porter  <dick@ximian.com>

	* versioninfo.c (find_pe_file_resources): Make it work on 64bit
	systems.  Fixes bug 343353.

2007-11-21  Dick Porter  <dick@ximian.com>

	* processes.c (load_modules): Rewrite based on the libgc
	/proc/<pid>/maps parsing to avoid using glib functions only
	available since 2004.
	(load_modules): Check for duplicates before adding a module to the
	list.

2007-11-15  Dick Porter  <dick@ximian.com>

	* processes.c (load_modules): Don't bother if we don't have
	g_strsplit_set() and g_strv_length().  Allows building against old
	glib versions.
	(EnumProcessModules): Don't miss the first module returned by
	load_modules().

2007-11-15  Dick Porter  <dick@ximian.com>

	* processes.c: Implement process module support by reading from
	/proc if it's available.

	* versioninfo.h: 
	* versioninfo.c: New functions to implement PE file version info
	support.

2007-11-08  Dick Porter  <dick@ximian.com>

	* critical-sections.h (EnterCriticalSection): Disable the critical
	section asserts for the release branch

2007-11-05  Kornél Pál  <kornelpal@gmail.com>

	* io-layer.h: Added includes for run-time GetProcessId API detection for
	Windows.

2007-10-26  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_file_open): Set the umask when opening
	shared files, so restrictive defaults don't prevent subsequent
	processes re-opening them.

2007-10-18  Zoltan Varga  <vargaz@gmail.com>

	* atomic.h (InterlockedCompareExchange): Fix the ia64 version so it works for
	negative values too. Hopefully fixes #332700.

2007-09-26  Dick Porter  <dick@ximian.com>

	* io-portability.c (_wapi_io_scandir): Only update the error
	status of glob() when performing a secondary glob() if the first
	returned an error.  Fixes bug 325107.

2007-09-12  Marek Habersack  <mhabersack@novell.com>

	* io-portability.c: options_init moved to
	utils/mono-io-portability.c
	Do not initialize portability helpers here, it's done in
	mono_runtime_init.
	find_file and find_in_dir moved to utils/mono-io-portability.c

2007-09-09  Robert Jordan  <robertj@gmx.net>

	* sockets.c (_wapi_setsockopt): Add support for FreeBSD multicast
	sockets. Fixes #81891.
	Code is contributed under MIT/X11 license.

2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>

	* processes.h, processes.c : ok, they are simple string.

2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>

	* processes.h : sigh, I really hate fixing them on windows :(

2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>

	* processes.c : fix build again.

2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>

	* processes.h : removed extra parameters from CreateProcessWithLogonW.

2007-09-03  Atsushi Enomoto  <atsushi@ximian.com>

	* processes.c, processes.h: added CreateProcessWithLogonW(). For now
	  it just calls CreateProcess().
	* io-layer.h : CreateProcessWithLogonW() requires WINVER 0x0500
	  on Windows.

2007-08-23  Robert Jordan  <robertj@gmx.net>

	* processes.[c|h]: Implement Get|SetPriorityClass ().
	Code is contributed under MIT/X11 license.

Tue Aug 21 20:08:09 CEST 2007 Paolo Molaro <lupus@ximian.com>

	* io.c: made convert_arg_to_utf8() and write_file() static.
	Worked around gcc's incorrect warning.

2007-08-20  William Holmes  <billholmes54@gmail.com>

	*io.c: Added implementation for ReplaceFile.
	*io.h: Added deceleration for ReplaceFile method.

	Code is contributed under MIT/X11 license.

2007-08-20  Wade Berrier  <wberrier@novell.com>

	* processes.c: include sys/resource.h for rusage to fix 
	mac 10.3 build

Mon Aug 20 12:36:42 CEST 2007 Paolo Molaro <lupus@ximian.com>

	* processes.c: implemented query for user/system times using
	getrusage ().

2007-08-10  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_getsockopt, _wapi_setsockopt): Check the option
	level as well as the name when mangling some of the values.  Fixes
	bug 82000.

2007-08-02  Dick Porter  <dick@ximian.com>

	* sockets.c: Changes in error handling, and move the SO_REUSEADDR
	setting from metadata/socket-io.c.

2007-08-01  Dick Porter  <dick@ximian.com>

	* io-portability.c (_wapi_io_scandir): Special-case patterns
	ending in '.*' so that files with no extension are also matched.
	Fixes bug 82212.

	* wapi_glob.h: 
	* wapi_glob.c: Reinstate WAPI_GLOB_APPEND, and add
	WAPI_GLOB_UNIQUE to avoid matching the same entry twice when
	appending.

2007-07-26  Dick Porter  <dick@ximian.com>

	* handles-private.h: 
	* thread-private.h: 
	* handles.h: 
	* critical-sections.c: 
	* handles.c: 
	* critical-section-private.h:
	* error.h: 
	* threads.c: 
	* error.c: Clean up TLS and pthreads structures.  Finishes off bug
	78739.

	* collection.c (collection_thread): Exit the collection thread if
	the io-layer has been cleaned up.

	* mono-mutex.h (mono_mutexattr_destroy): Add this define too

Mon Jul 23 10:40:35 CEST 2007 Paolo Molaro <lupus@ximian.com>

	* timefuncs.c: make TickCount measure from boot time if it's
	available.

2007-07-19  Juraj Skripsky  <js@hotfeet.ch>

	* io.c (MoveFile): Fix a leak. 

Fri Jul 13 12:46:15 CEST 2007 Paolo Molaro <lupus@ximian.com>

	* handles-private.h, handles.c, thread-private.h, threads.c,
	uglify.h, wait.c: temporarily revert the alertable wait changes
	(r79386) until the deadlock issues are fixed.

2007-06-22  Dick Porter  <dick@ximian.com>

	* shared.c: The non-shared mutexes weren't being initialised properly
	on macos.  Fixes bug 81929.

2007-06-13  Randolph Chung  <tausq@debian.org>

	* atomic.h: Enable for all hppa targets.
	* Makefile.am: rename hppa_atomic.s to hppa_atomic.S so the preprocessor
	can handle the file.
	* hppa_atomic.s: Renamed to ...
	* hppa_atomic.S: ... and updated to work on both HPUX and Linux.

2007-06-13  Dick Porter  <dick@ximian.com>

	* handles.c (timedwait_signal_wait_cond): Alertable waits on
	private handles are now interrupted by signalling the same
	condition that would end the wait if the handle became signalled,
	rather than polling.  (Shared handles still have to poll.)

	* threads.c (_wapi_thread_queue_apc): Interrupt the thread if it's
	waiting on a handle

	* handles-private.h (_wapi_handle_current_thread_set_waiting_on):
	Helper functions to inform the APC queuing functions when threads
	are waiting for handles, and to interrupt the wait.

	* wait.c (WaitForMultipleObjectsEx): Need to tell the handle
	waiting functions if any of the handles in question are shared

2007-06-06  Miguel de Icaza  <miguel@novell.com>

	* processes.c (is_managed_binary): Fix for OSX.

2007-06-06  Wade Berrier  <wberrier@novell.com>

	* atomic.h (InterlockedExchangePointer): cast to pointer to to silence
	compiler warnings (autobuild fails the build on this type of warning)

2007-05-21  Dick Porter  <dick@ximian.com>

	* io-portability.c (_wapi_g_dir_open): Don't propagate any errors
	from the second call to g_dir_open, preserve the original error if
	the second call still fails but clear the error if it succeeds.

2007-05-10  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_recvfrom): Refine the fix to bug 75705 so EINTR
	isn't returned if the remote end shuts down cleanly.  Fixes zmd
	and the second example in bug 75705.

2007-04-26  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_semaphores_init): Need to check
	MONO_DISABLE_SHM in this entry point, as it's called before
	_wapi_shm_attach().  Fixes bug 81436.

2007-04-24  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_recvfrom, socket_close): Force recvfrom() to
	error if the socket is closed while the receive is blocking.
	Fixes bug 75705.

2007-04-13  Dick Porter  <dick@ximian.com>

	* shared.h:
	* shared.c: Complete the reimplementation of disabling of shared
	memory, by not allocating sysv semaphores when shm disabling has
	been requested (either at compile time or run time.)

	* processes.c (CreateProcess): Don't synchronize locking across
	processes when forking, when shared memory has been disabled.

2007-04-06  Andreas Faerber  <andreas.faerber@web.de>

	* wapi_glob.h:
	* wapi_glob.c: remove reference to sys/cdefs.h, use glib instead.
	Fixes: 81326

2007-04-05  Dick Porter  <dick@ximian.com>

	* io.c:
	* io-portability.c (_wapi_io_scandir): Moved from io.c, and
	changed to use a cut-down version of glob(3) that has been
	extended to match with case-insensitivity if needed.

	* wapi_glob.h:
	* wapi_glob.c: Cut down implementation of glob(3), based on
	OpenBSD.

2007-03-22  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_connect): Do additional checks when connect(2)
	fails, because some systems don't let it be restarted.  Patch
	based on one submitted by Robert S Wojciechowski <robertw@ssgx.com>,
	fixes bug 81010.

2007-03-09  Jonathan Chambers  <joncham@gmail.com>

	* io-layer.h:  Remove UNICODE and _UNICODE defines as 
        these are done by configure.in now.
	
	Code is contributed under MIT/X11 license.
        
Thu Mar 8 19:42:17 CET 2007 Paolo Molaro <lupus@ximian.com>

	* shared.c: partial support for MONO_DISABLE_SHM env var.

2007-03-05  Wade Berrier  <wberrier@novell.com>

	* atomic.h: atomic fixes from Michael Matz for for s390 
	and s390x ( bnc #237611 and bxc #80892 )

2007-03-05  Miguel de Icaza  <miguel@novell.com>

	* io.c (CreateFile): Use FILE_ATTRIBUTE_TEMPORARY to mean 0600
	permissions.  For 80688

	(MoveFile): Use errno_copy here, just to avoid a potential
	errno-changing code in the future from g_free. 
	
	Also, ignore EXDEV errors as they are handled immediately after
	(avoid printing out an error). 

	Fixes: 80655

Mon Feb 12 15:50:24 CET 2007 Paolo Molaro <lupus@ximian.com>

	* shared.c: exit if semaphores can't be created (bug #80616).

2007-02-01  Geoff Norton  <gnorton@customerdna.com>

	* collection.c: NetBSD doesn't define PTHREAD_STACK_MIN.

2007-01-26  Dick Porter  <dick@ximian.com>

	* socket-private.h: 
	* sockets.c (_wapi_getsockopt): Windows seems to not reset
	SO_ERROR values when they're read, contrary to the documentation.
	Fixes the new issues raised in bug 79878 (example in C showing
	winsock behaviour attached to that bug.)

2007-01-15 Mark Mason <mason@broadcom.com

	* atomic.h: add locking primitives for MIPS.
	
2007-01-11  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_connect): Don't do the SO_BROADCAST setting
	here, do it in managed code instead.
	(_wapi_getsockopt): SO_RCVTIMEO and SO_SNDTIMEO use struct
	timeval, which has a microsecond field, not milliseconds.
	(_wapi_setsockopt): ditto.
	(_wapi_setsockopt): Halve the SO_SNDBUF and SO_RCVBUF values on
	Linux, as the kernel doubles whatever we set.
	(_wapi_socket): Save socket domain, type and protocol so it can be
	duplicated later.
	(socket_disconnect): Implement socket disconnect (closing the
	socket, but keeping the file descriptor.)
	(wapi_disconnectex): A basic implementation of DisconnectEx().
	(wapi_transmitfile): A very basic implementation of
	TransmitFile().
	(WSAIoctl): Implement the SIO_GET_EXTENSION_FUNCTION_POINTER
	ioctl.

	* socket-private.h (struct _WapiHandle_socket): Record socket
	domain, type and protocol info so it can be duplicated later.

	* sockets.h (WSAID_DISCONNECTEX,WSAID_TRANSMITFILE): Structures
	and defines needed to look up the DisconnectEx() and
	TransmitFile() functions by GUID.

	* error.c (errno_to_WSA): Change ETIMEDOUT mapping to
	WSAETIMEDOUT; add EDESTADDRREQ.

	* io-layer.h: Need mswsock.h on windows now.

2007-01-04  Miguel de Icaza  <miguel@novell.com>

	* io-portability.c (find_file): Fix a coverity warning (scanning
	being unassigned).   

2006-12-31  Miguel de Icaza  <miguel@novell.com>

	* io-portability.c (find_file): Do not abort if an empty filename
	has been passed.  This fixes the case where MONO_IOMAP=all would
	assert if Directory.Exists ("") was called.

Mon Dec 18 14:54:37 CET 2006 Paolo Molaro <lupus@ximian.com>

	* processes.c: moved a free on the error path.

Thu Dec 14 21:42:39 CET 2006 Paolo Molaro <lupus@ximian.com>

	* processes.c: fixed a few memory leaks when executing
	processes.

Mon Nov 27 13:12:17 GMT 2006 Paolo Molaro <lupus@ximian.com>

	* atomic.h: fix arm compare and exchange (bug #78500).

2006-11-23  Dick Porter  <dick@ximian.com>

	* process-private.h (struct _WapiHandle_process): Add 'waited'
	parameter

	* processes.c (process_wait): Check the 'waited' parameter not the
	signalled state when testing if a process has already been waited
	for, as the child process itself may set signalled when exiting.
	Fixes bug 79885.

	* wapi-private.h (_WAPI_HANDLE_VERSION): Bump shared data version

	* shared.c: Now the shared data version has been incremented we
	can set the counter semaphore initial value correctly

2006-11-22  Dick Porter  <dick@ximian.com>

	* processes.c (process_wait): Cope when the background process
	reaper gets the process we were waiting for.  Special case for
	waiting for our own process to exit.  Fixes bug 77736.

2006-11-17  Dick Porter  <dick@ximian.com>

	* processes.c: Fix const correctness and typos that caused memory
	corruption. 
	
2006-11-17  Miguel de Icaza  <miguel@novell.com>

	* processes.c (ShellExecuteEx): Check error after CreateProcess,
	thanks to Dick for pointing this out. 

2006-11-16  Miguel de Icaza  <miguel@novell.com>

	* processes.c (ShellExecuteEx): If we fail to create a process in
	ShellExecute, then try to use the xdg-open command, and if that
	fails, try to use the gnome-open command, 

	Refactor the code so that we do not have to duplicate all this
	code, but instead use a ucs2-aware version of the code to do
	concatenations.

2006-11-13  Dick Porter  <dick@ximian.com>

	* io.c (_wapi_stat_to_file_attributes): If the file is a symlink
	add the FILE_ATTRIBUTE_REPARSE_POINT flag.  This is an attempt to
	follow the specs for the windows symlink support, but will
	probably have to be reworked when I have test data from a vista
	machine.  Fixes bug 79887.

2006-11-11  Miguel de Icaza  <miguel@novell.com>

	* handles.c (CloseHandle): Cope here with the new value
	INVALID_HANDLE_VALUE set on handles.  

	* processes.c (CreateProcess): Initialize the value of hThread to
	be INVALID_HANDLE_VALUE on failure, not to be NULL.  Improvement
	for #75733

2006-11-09  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_select): Do some sanity checking on the
	fd_sets, to avoid file descriptors > FD_SETSIZE.
	(_wapi_FD_CLR, _wapi_FD_ISSET, _wapi_FD_SET): Avoid file
	descriptors > FD_SETSIZE.

2006-10-27  Dick Porter  <dick@ximian.com>

	* io.c (GetFileAttributes): Force symlinks to directories to be
	returned as a regular file.  Fixes bug 79733.

2006-10-18  Miguel de Icaza  <miguel@novell.com>

	* io-portability.c (find_in_dir): First string dup, then closedir.

2006-10-12  Dick Porter  <dick@ximian.com>

	* processes.c (_wapi_process_reap): Unref a process handle if we
	reaped it, found by Zoltan.  Fixes bug 79286.
	(process_wait): Don't wait again if we've already waited for a
	process.

2006-10-11  Sergey Tikhonov <tsv@solvo.ru>

	* atomic.h: Fix atomic decrement.

	* mini/cpu-alpha.md: Use native long shift insts

	* mono/mono/mini/tramp-alpha.c: Implemented
	mono_arch_patch_delegate_trampoline method

	* Started work on using global registers
	
	* Use byte/word memory load/store insts if cpu supports it
	
	* Code clean up

	
2006-10-09  Zoltan Varga  <vargaz@gmail.com>

	* handles.c (timedwait_signal_poll_cond): Add an alertable parameter, and if it
	is FALSE, avoid busy waiting.

	* wait.c: Add an alertable parameter to the wait routines.

2006-10-06  Miguel de Icaza  <miguel@novell.com>

	* io-portability.c (find_file): Rename from
	MONO_IO_PORTABILITY_HELP to MONO_IOMAP.

2006-10-03  Dick Porter  <dick@ximian.com>

	* io-portability.h: 
	* io-portability.c: Optional portability helpers and wrapped
	system calls to try to cope with windows filenames in
	applications.

	* io.c: Use the wrapped system calls

2006-09-01  Zoltan Varga  <vargaz@gmail.com>

	* critical-sections.h critical-sections.c: Make Enter/LeaveCriticalSection a macro
	since they are perf critical.

	* atomic.h: Applied patch from Jakub Boqusz <qboosh@pld-linux.org>.
	Add atomic ops implementation for alpha.

2006-08-11  Dick Porter  <dick@ximian.com>

	* processes.c (_wapi_process_reap): Avoid a deadlock by setting
	process termination details in an outer loop, not the
	_wapi_search_handle() one.

2006-08-10  Dick Porter  <dick@ximian.com>

	* threads.c (_wapi_thread_queue_apc)
	(_wapi_thread_dispatch_apc_queue): Use a process-local mutex here
	instead of the cross process semaphore.  We already check that
	access to the APC queue is within the owning process so there's no
	need to protect from other processes.  Avoids a global deadlock
	when a thread is aborted while it holds the handle semaphore
	locked.
	(_wapi_thread_apc_pending): Hide an annoying message which can
	happen if a thread handle has been blown away at process shutdown
	while it is in an alertable wait.

	Both problems seen while shutting down monodevelop.

2006-07-25  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_file): Remove '/' characters from the uname
	results.  Fixes bug 78917.

2006-07-20  Dick Porter  <dick@ximian.com>

	* threads.c (_wapi_thread_set_termination_details): Improve the
	test for already-disposed thread handles, and hold the lock around
	the mutex abandoning.

2006-07-17  Dick Porter  <dick@ximian.com>

	* processes.c (CreateProcess): Don't change directory unless a new
	one has been specified.  Fixes bug 78751.

2006-07-06  Dick Porter  <dick@ximian.com>

	* io.c (_wapi_stat_to_file_attributes): Do a better job at
	figuring out the file attributes
	(_wapi_set_last_path_error_from_errno): New helper function to
	turn errno into w32 error codes that handles the differences
	between file and directory errors
	(file_setendoffile): Try turning off the extra write used to
	extend files, because we probably don't need it on any modern
	platform.  If it is needed though, we also need to lseek the file
	position back again
	(CreateFile): Treat character-special devices as a console handle,
	because they can't be seeked
	(CopyFile): If fail_if_exists is set, then the destination needs
	to be opened with O_EXCL
	(CopyFile): If fail_if_exists is not set and the destination
	already exists, then we should set the ERROR_ALREADY_EXISTS error
	even though we return success
	(stdhandle_create): STD_INPUT_HANDLES cannot be written to
	(GetStdHandle): Rework without using mono_once, so console handles
	can be properly closed and reopened.
	(mono_io_scandir): Only override errno with EACCES when the
	directory actually exists
	(FindFirstFile): Set ERROR_FILE_NOT_FOUND when no files are
	returned
	(FindClose): Cope with NULL handles
	(CreateDirectory): When the target already exists, just return an
	error.  It's the caller's job to figure out what to do.
	(SetCurrentDirectory): Cope with a NULL path
	(RemoveDirectory, GetFileAttributes, GetFileAttributesEx,
	SetFileAttributes, FindFirstFile, DeleteFile, MoveFile, CopyFile,
	CreateFile): Set path error correctly

	* handles.c (CloseHandle): Kludge to try and cope with passing a
	NULL handle

	* error.h: Add NO_ERROR as an alternative to ERROR_SUCCESS

	* uglify.h: Added some more typedefs

2006-07-05  Dick Porter  <dick@ximian.com>

	* io.c (GetFileAttributes, GetFileAttributesEx): Cope with
	dangling symlinks.  Fixes bug 78664.

2006-06-23  Dick Porter  <dick@ximian.com>

	* handles.c (handle_cleanup): 
	* threads.c: Clean up threads properly when we're forcibly
	removing the handle entries from the shared file in
	handle_cleanup().  Fixes bug 78241, for real this time.

2006-06-15 Neale Ferguson <neale@sinenomine.net>

	* atomic.h: More tinkering with InterlockedExchange/InterlockedCompareExchange
	for s390/s390x.

2006-06-14 Neale Ferguson <neale@sinenomine.net>

	* atomic.h: Fix atomic exchange pointer operations for s390x - these
	were broken as they used 32-bit instructions rather than their 64-bit
	versions.

2006-06-14  Dick Porter  <dick@ximian.com>

	* processes.c: Don't run the atexit handlers when bailing out
	of a fork/exec.

2006-06-14  Dick Porter  <dick@ximian.com>

	* wait.c: Fix stupid typo shown up by gcc 4.1.1, = not ==

	* handles-private.h: 
	* shared.c: 
	* io.c: 
	* processes.c: 
	* mono-spinlock.h: 
	* handles.c: 
	* collection.c: Fix a bunch of signed/unsigned warnings from gcc
	4.1.1

2006-06-09 Neale Ferguson <neale@sinenomine.net>

	* atomic.h: Fix atomic operations for s390x (not really broken 
	but changed to use full 64-bit opcodes).

2006-05-24  Dick Porter  <dick@ximian.com>

	* processes.c (process_set_current): Don't take an extra reference
	if we have to create our own process handle.  Fixes bug 78241
	again.

	* threads.c (_wapi_thread_signal_self): Renamed from
	_wapi_thread_abandon_mutexes, also sets the thread state to
	signalled and drops a reference.  Called by the runtime when the
	main thread cleans itself up.

	* handles.c (handle_cleanup): As a last resort, unref every shared
	handle as the process is now exiting.

2006-05-16  Dick Porter  <dick@ximian.com>

	* processes.c (process_set_termination_details): Unref the handle
	when we've stored the exit details.  Fixes the rest of 78241.

2006-05-12  Dick Porter  <dick@ximian.com>

	* threads.c: Implement pseudo handles, making GetCurrentThread()
	match MS behaviour.  Notice when attached threads exit, and unref
	the handle.  Fix usage of GetCurrentThread() in other places.

	* handles.c (DuplicateHandle): Implement a basic form of
	DuplicateHandle().

	* wait.c: Fix usage of GetCurrentThread() throughout, and cope
	with pseudo handles.

2006-04-26  Miguel de Icaza  <miguel@novell.com>

	* io.c (file_close): Oops, do not use DeleteFile which expects
	unicode, instead use unlink directly

	Add support for the new FileOptions bits on .NET 2.0.

	It might be good if Dick reviews these changes.
	
	* io.c (file_close): If DeleteOnClose is set, then delete the file
	before freeing it.
	(CreateFile): Do not support encryption per user. 
	
	If posix_fadvise exists, pass hints on sequential scan and random
	access.   Did not figure out what WRITE_THROUGH maps to.

2006-04-26  Dick Porter  <dick@ximian.com>

	* sockets.c (WSAIoctl): Check the output buffer is valid before
	writing to it.

	* handles.c (_wapi_search_handle): Set shared pointer if we find a
	shared handle that has been already opened.

2006-04-21  Dick Porter  <dick@ximian.com>

	* threads.c (GetCurrentThread): Reference the handle if we return
	an already-known thread.

2006-04-07  Dick Porter  <dick@ximian.com>

	* processes.c: Fix build for older glib.

2006-04-06  Dick Porter  <dick@ximian.com>
	
	* processes.c (CreateProcess): Add a reference to the child
	process' handle, so it won't be destroyed if this process closes
	its copy of the handle.  Fixes bug 77393.
	
	* processes.c (process_set_current): Fall through to creating a
	new one if the handle lookup fails.

	* processes.c (_wapi_process_signal_self):
	* handles.c (handle_cleanup): The process is exiting, so set the
	handle state for this process to signalled.  This should let other
	non-related processes wait for this handle.
	
	* handles.c (_wapi_search_handle): Don't search shared handles in
	all cases.

	* collection.c (collection_thread): No need to do a collection
	scan straight away, do the waiting first.

2006-04-06  Dick Porter  <dick@ximian.com>

	* shared.c: Fix parameters in semctl () call.

2006-03-28  Zoltan Varga  <vargaz@gmail.com>

	* atomic.h atomic.c: Applied patch from David S. Miller 
	<davem@davemloft.net>: Reimplement Interlocked* primitives on sparc 
	using CAS/CASx when __GNUC__, else we will fall back to the generic 
	pthread version.

2006-03-27  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_file_open): Break out of a loop if the
	shared file is smaller than expected.  (We loop a few times in
	case another process is in the middle of creating the file.)

2006-03-22  Dick Porter  <dick@ximian.com>

	* handles.c:
	* wapi-private.h:
	* shared.h:
	* shared.c: Delete the semaphores and shared files when the last
	process has finished with them

2006-03-15  Dick Porter  <dick@ximian.com>

	* events.c: 
	* io.c: 
	* mutexes.c: 
	* processes.c: 
	* semaphores.c: 
	* sockets.c: 
	* threads.c: Explicitly initialise the handle ops struct

2006-03-14  Dick Porter  <dick@ximian.com>

	* handles-private.h: 
	* wapi-private.h: 
	* wait.c: 
	* handles.c: Add a 'prewait' stage to the handle waiting, to give
	waiting threads a chance to check for bogus states before
	blocking.

	* mutexes.c (namedmutex_prewait): Use the prewait stage to check
	for named mutexes that have been abandoned in a locked state (eg
	if a process exited abnormally while owning the mutex) and
	override it if needed.

2006-03-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* wait.c: speed up WaitFor* when the timeout is 0.

2006-03-03  Dick Porter  <dick@ximian.com>

	* processes.c (ShellExecuteEx): Cope when some of the parameters
	are NULL.

2006-02-27  Dick Porter  <dick@ximian.com>

	* mutexes.c: 
	* mono-mutex.c: 
	* threads.c: Comparing pthread_t with == is not portable, so use
	pthread_equal().

Thu Feb 23 18:47:20 GMT 2006 Paolo Molaro <lupus@ximian.com>

	* *.h, *.h: patch from Dick to make Linuxthreads systems work again.

2006-02-22  Dick Porter  <dick@ximian.com>

	* thread-private.h: 
	* threads.c: There's no need to use the timed-thread support code
	any more, as we aren't using the timed join.  This greatly
	simplifies thread setup, and fixes a memory leak (bug 77521).

	Don't bother to store thread IDs in a hash table, use TLS instead.
	The one case that needs to look up the handle of a different
	thread (OpenThread()) can do the extra work itself.  Fixes bug
	77536.

	* handles.c (_wapi_search_handle): Add a reference when returning
	a private handle (shared handles are already reffed.)
	
2006-02-17  Dick Porter  <dick@ximian.com>

	* handles-private.h: 
	* handles.c: Check handle values passed to array lookups.  Fixes
	bug 77572.

2006-02-09  Dick Porter  <dick@ximian.com>

	* threads.c: Cope with the problems caused by attaching already
	existing threads - they don't get the infrastructure to clean up
	after themselves, especially the ID to handle hash.  This fixes
	bug 77468.

2006-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* shared.c: use MONO_SHARED_HOSTNAME as a substitute for gethostname()
	when creating the shared files in the .wapi directory. Fixes bug #77371.

2006-02-02  Martin Baulig  <martin@ximian.com>

	* threads.c: Removed the `WITH_INCLUDED_LIBGC' section; it has
	never been used so far.	

	* timed-thread.h (TimedThread): Removed the `stack_ptr' field; it
	has only been used by the removed code.

2006-01-03  Neale Ferguson <neale@sinenomine.net>

	* atomic.h: Correct s390x definitions and eliminate compiler warnings.

2006-01-03  Sebastien Pouliot  <sebastien@ximian.com>

	* io.c: Patch _wapi_stat_to_file_attributes against bug #76966, where
	sockets could be considered as directory.

2005-12-23  Dick Porter  <dick@ximian.com>


	* semaphores.h: 
	* semaphores.c: Implement OpenSemaphore

	* mutexes.c: 
	* mutexes.h: Implement OpenMutex

	* wapi-private.h: 
	* handles.c: 
	* events.c: 
	* events.h: 
	* event-private.h: Implement named events.  Implement OpenEvent.

2005-12-15  Dick Porter  <dick@ximian.com>

	* processes.c (CreateProcess): The pipe-based cross-process
	exclusion technique was trying to write NULL buffers when appname
	was NULL (eg when coming from ShellExecuteEx,) which usually
	succeeded even though EFAULT was returned - but sometimes it
	failed.  This meant that the child process could block forever on
	the pipe read.  Replace it with the simpler shared handle
	semaphore protection used everywhere else.  This showed up with
	the test case in bug 76684.

Tue Dec 13 11:41:49 GMT 2005 Paolo Molaro <lupus@ximian.com>

	* shared.c: fallback to private mmap when shared mmap doesn't work
	(like on jffs).

2005-12-06  Dick Porter  <dick@ximian.com>

	* wapi-private.h: 
	* handles.c: 
	* semaphore-private.h: 
	* semaphores.c: Implement named semaphores

2005-11-24  Dick Porter  <dick@ximian.com>

	* processes.c (GetProcessId): Implement GetProcessId()

2005-11-17  Dick Porter  <dick@ximian.com>

	* processes.h: 
	* processes.c: Implement ShellExecuteEx as a wrapper around
	CreateProcess.

2005-11-11  Dick Porter  <dick@ximian.com>

	* threads.c: Give mutex abandoning its own exported function, so
	it can be called when the runtime is cleaning up.

	* handles.c (_wapi_search_handle_namespace): Do a handle
	collection befre starting to check namespace strings, so that any
	stale cruft gets removed.

2005-11-11  Dick Porter  <dick@ximian.com>

	* threads.c: Move thread handles back into the shared space.

	* handles.c (_wapi_handle_unref): Add support for shared handles
	with close() handlers

2005-11-04  Dick Porter  <dick@ximian.com>

	* sockets.c (ioctlsocket): Use select instead of if to avoid a
	type promotion problem on 64bit freebsd.  Based on patch by Lou
	Kamenov <kamenovl@gmail.com>, fixes bug 76447.

2005-11-04  Dick Porter  <dick@ximian.com>

	* io.c (file_write): Only do the file locking if
	MONO_STRICT_IO_EMULATION is set.

2005-10-21  Dick Porter  <dick@ximian.com>

	* processes.c: 
	* handles.c (_wapi_lookup_handle): Cope when the shared part of a
	handle has been deleted.
	(_wapi_handle_unref): And when the deleted shared part is pointed
	to as a handle is deleted

2005-10-20  Dick Porter  <dick@ximian.com>

	* processes.c (process_set_current): If the expected process
	handle slot doesn't contain the correct pid, create a new handle.

	* handles.c (_wapi_search_handle): When the search doesn't find
	anything, return failure instead of the last handle we looked at.
	(_wapi_handle_ref, _wapi_handle_unref): Don't try to ref or unref
	unused handles (makes tracking refcounting bugs easier.)

2005-10-19  Dick Porter  <dick@ximian.com>

	* handles.c:
	* handles-private.h:
	* wapi-private.h: 
	* processes.c: 
	* mutexes.c:
	* collection.c (_wapi_handle_collect): Remove the shared handle
	indirection layer, and use locking instead.  Delete other
	complexity that is no longer needed.  Refcount shared handles and
	delete them when needed, but keep the timestamps so that orphaned
	handles will be cleaned up eventually.

	* shared.c (_wapi_shm_file): Add processor, OS and struct size
	info to the shared file names, to cope with dual-boot and 32/64bit
	size issues.  Fixes bug 75839.

	* wait.c (WaitForMultipleObjectsEx): No need to distinguish
	between shared handles and private, as the wait functions cope
	with both together now.

2005-10-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: removed NO_SIGPIPE macro.
	* sockets.c: no need for MSG_NOSIGNAL or ignoring SIGPIPE.

2005-10-11  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_getsockopt): Translate SO_ERROR results into
	w32 error codes.

	* error.c (errno_to_WSA): Don't return a bogus error if someone
	asks to translate errno 0.

2005-10-11  Dick Porter  <dick@ximian.com>

	* handles.c: Fix several race conditions

2005-10-11 Miguel de Icaza <miguel@novell.com>

	* io.c: no need to block SIGPIPE anymore, as it is ignored.

2005-10-05  Dick Porter  <dick@ximian.com>

	* threads.c (_wapi_thread_own_mutex, _wapi_thread_disown_mutex):
	Keep a reference to mutexes owned by threads, so they won't be
	destroyed prematurely.  Fixes dotmsnclient crash.

2005-09-26  Sebastien Pouliot  <sebastien@ximian.com>

	* io.c: Apply patch from #76192 (Can't write files past 2gb on AMD64 
	(x86_64)) for Brion on IRC (Dick approved it).

2005-09-23  Dick Porter  <dick@ximian.com>

	* processes.c: Don't wait for processes that have already been
	signalled; also fix typo.

	* handles.c: Improve locking inside new handle and handle
	searching functions.

2005-09-20  Dick Porter  <dick@ximian.com>

	* collection.c: 
	* processes.c: Periodically waitpid for known process IDs.  Fixes
	bug 74870.

2005-09-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	(CreateFile): if the file is a named pipe, treat the handle as a pipe,
	not as a file. Fixes bug #76075.

2005-08-27  Zoltan Varga  <vargaz@gmail.com>

	* atomic.h: Add support for intel icc.

2005-08-25  Zoltan Varga  <vargaz@gmail.com>

	* io-layer.h: Include winbase.h not WinBase.h.

2005-08-19  Dick Porter  <dick@ximian.com>

	* threads.c, threads.h, thread-private.h: Use a gsize to store the
	thread ID, so it can hold a 64 bit value if needed.

2005-07-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* error.c: map ENOENT to WSAECONNREFUSED. It might happen when
	connecting to unix sockets. Closes bug #75632.

2005-07-05  Dick Porter  <dick@ximian.com>

	* io.c: Make sure SIGPIPE is ignored when calling write(2).
	Prevents the runtime exiting when writing to a closed pipe,
	fixing bug 75468.

2005-06-30  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_semaphores_init): Add some helpful error
	messages when semget () fails due to lack of resources.

2005-06-21  Dick Porter  <dick@ximian.com>

	* mutex-private.h:
	* thread-private.h:
	* mutexes.c: 
	* threads.c: Keep a list of owned mutexes in each thread handle,
	so that it is easier to abandon them when the thread exits.
	Removes a bottleneck when multiple threads are finishing in
	parallel.

2005-06-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: (GetLogicalDrives) when a bogus line is read, don't leak memory.
	When the buffer has not enough space, close the file before returning.

2005-06-09  Duncan Mak  <duncan@novell.com>

	* *.h: Added G_BEGIN_DECLS and G_END_DECLS where appropriate to
	all public headers. Fixes #74919.

2005-05-30  Zoltan Varga  <vargaz@freemail.hu>

	* atomic.h: Add IA64 atomic ops.

2005-05-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* processes.c: make ExitCode be valid even if the user didn't call
	WaitForExit() and is just polling on HasExited.

2005-05-17  Dick Porter  <dick@ximian.com>

	* io.c (file_getfilesize): Clear the error value, so that files
	with sizes with the low bits 0xFFFFFFFF can be distinguished from
	a genuine error.

2005-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* shared.c: forgot to ignore a warning.

2005-05-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* shared.c: don't display warnings after reboots.

2005-05-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* sockets.c: on windows, getsockopt/setsockopt for send/receive timeout
	use an integer in milliseconds. We were using a struct timeval.

2005-05-06  Dick Porter  <dick@ximian.com>

	* handles-private.h: 
	* mutexes.c: 
	* wapi-private.h: 
	* shared.h:
	* shared.c: 
	* wait.c: 
	* handles.c: 
	* collection.h: Use SysV semaphores for managing access to the
	shared memory - in return for the ludicrous api we get
	synchronisation primitives that can be cleaned up by the kernel
	even when a process quits unexpectedly.  This removes the
	timestamp issues.

2005-05-05  Lluis Sanchez Gual  <lluis@novell.com>

	* handles.c: Always use polling in the waits, since
	mono_cond_timedwait can't be interruped by the thread abort signal.

2005-04-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* events.c: calling Set on AutoResetEvent several times has the same
	effect as calling it only once if no thread is waiting for it.

2005-04-29  Dick Porter  <dick@ximian.com>

	* processes.c (EnumProcesses): Use a GArray instead of a GPtrArray
	now it's storing pids not handles, also fixes memory leak caused
	by unclear glib documentation.

	* sockets.c (WSACleanup): Remove unused variable

2005-04-29  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_check_share_by_pid): For systems that
	don't have file descriptor info in /proc check that the original
	opener of a file is still there, if a share violation would
	otherwise happen.

2005-04-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* handles.c:
	* handles-private.h: added _wapi_handle_forecch that loops through all
	the handles and call a callback function when a handle of the given
	type is found.

	* sockets.c: no need to keep open sockets in an array, as we have them 
	in the handles structure.

	Fixes bug #74755.

2005-04-28  Dick Porter  <dick@ximian.com>

	* processes.c: Cope with handles that are only around for as long
	as the search is running.  If we're searching for process handles,
	check to see if the process is still running and signal it if not.

	* handles.c (_wapi_search_handle): Search in the shared space as
	well.  Fixed bug 74752.

	* mutexes.c:
	* handles.c (_wapi_handle_new_from_offset):
	_wapi_handle_new_for_existing_ns () was doing exactly the same as
	this, so deleted it.

2005-04-26  Dick Porter  <dick@ximian.com>

	* handles.c: Fix stupid thinko where if a new shared handle is
	created but a collection was needed to free some space, it
	returned an error anyway.  Should fix the messages shown in bug
	74659.

2005-04-25  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_check_share): Only consider mono
	processes when looking to see if a file is still being held open,
	while checking share permissions.

2005-04-25  Dick Porter  <dick@ximian.com>

	* sockets.c: 
	* io.c: 
	* wapi-private.h (struct _WapiHandleOps): 
	* handles.c (_wapi_handle_unref): When destroying handles, save
	the handle data and call the close function only after the array
	slot has been cleared.  This prevents race conditions with file
	descriptors, fixing bug 74713.

	* mutexes.c: Delete the handle close functions, they didn't do
	anything anyway

	* error.c (_wapi_get_win32_file_error): Add a mapping for EINTR so
	the "Unknown error" g_warning doesn't get displayed.

2005-04-25  Dick Porter  <dick@ximian.com>

	* wapi-private.h: 
	* threads.c: Make thread handles process-private for now to take
	some of the space pressure off the shared memory, while I work on
	a real fix.

2005-04-21  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_check_share): Make sure there is a "fd"
	dir in /proc before blowing away handle info.  Fixes bug 74649.

2005-04-21  Dick Porter  <dick@ximian.com>

	* wait.c (WaitForMultipleObjectsEx): Implement special waits

	* handles.c (_wapi_handle_wait_signal_poll_share): Don't return a
	timeout, just wait briefly for the private signals and let the
	waiting thread test again.  This prevents us missing shared
	signals.

2005-04-21  Dick Porter  <dick@ximian.com>

	* collection.h (_WAPI_HANDLE_COLLECTION_EXPIRED_INTERVAL): Reduce
	the time before a slot is considered too old and deleted.  This is
	a workaround while I come up with a proper fix.

2005-04-21  Dick Porter  <dick@ximian.com>

	* mutexes.c: 
	* processes.c: 
	* threads.c: 
	* handles.c (_wapi_handle_new): Turn assertions into errors.

	* collection.c (_wapi_handle_collect): Use symbols not magic
	numbers for timeout values

2005-04-19  Dick Porter  <dick@ximian.com>

	* mutexes.c: 
	* wait.c: 
	* handles.c (_wapi_handle_count_signalled_handles)
	* handles-private.h (_wapi_handle_shared_lock_handle): Use new
	shared handle locks in critical sections.

	* handles.c (_wapi_handle_new_for_existing_ns): Reuse old handles
	if there is already one there.
	
	* handles.c (_wapi_handle_ref): It was possible for a process to
	exit before getting around to updating shared handle timestamps,
	so do it here too.

Tue Apr 19 16:25:47 CEST 2005 Paolo Molaro <lupus@ximian.com>

	* threads.c: fix lookup of the thread id in the has table:
	always use the id value, not the pointer to the id.

2005-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* handles.c: fix handle returned in _wapi_handle_search_handle. Dick
	pointed it out.

2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io-layer/sockets.c: FIONBIO with a TRUE argument means we want
	non-blocking IO, not the other way around.

2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* handles.c:
	* io.c:
	* handles-private.h: GetFileType wasn't checking if we have memory
	allocated for the handle before dereferencing it. Fixes a FileStream
	nunit test.

2005-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* handles.c:
	* processes.c:
	* handles-private.h: we were calling g_renew to expand the handle array,
	but that might move the memory and we might have pthread conditions or
	mutexes in the original memory area that are being used. Now instead of
	expanding an existing array, we just create new ones and keep a list of
	them. Access to _wapi_private_handles had to be modified accordingly.

2005-04-15  Dick Porter  <dick@ximian.com>

	* collection.c: FreeBSD needs more than PTHREAD_STACK_MIN

2005-04-14  Raja R Harinath  <rharinath@novell.com>

	* wapi-private.h: Remove reference to 'daemon-private.h'.

Wed Apr 13 13:12:33 EDT 2005 Paolo Molaro <lupus@ximian.com>

	* atomic.h: applied patch from mass@akuma.org (David Waite)
	to fix InterlockedExchangeAdd.
	Fixed a few other functions, including InterlockedCompareExchange()
	which was miscompiled by gcc with optimizations enabled.

2005-04-13  Dick Porter  <dick@ximian.com>

	* io.c (share_check): 
	* handles.c (_wapi_handle_check_share): Refine the file check so
	that sharing violations within the same process don't cause
	assertion failures.

2005-04-13  Dick Porter  <dick@ximian.com>

	* io.c (FindFirstFile): Fix bugs introduced with the merge (bug
	74586)

2005-04-12  Dick Porter  <dick@ximian.com>
	
	The daemon-less io-layer.  Extensive lowlevel changes in
	handles.c, requiring some corresponding changes in other files
	calling these functions.  Private_foo structures have been
	eliminated.

	File descriptor handling differences account for most of the
	changes in io.c and sockets.c.

	Other highlights:
	
	* mutexes.c: Named mutexes are now a distinct type.
	* atomic.h: Fix a PPC uninitialised variable warning.
	* wait.c: Check conditions before waiting on a condition variable.
	* processes.c: Handle process fork and wait without a daemon
	(though this has the limitation of only being able to wait for
	child processes.)

2005-04-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io-private.h:
	* threads.c:
	* threads.h:
	* io.c:
	* sockets.c:
	* sockets.h: removed dead code that deals with async IO.

2005-03-30  Zoltan Varga  <vargaz@freemail.hu>

	* atomic.c (InterlockedIncrement): Fix fallback implementation of
	InterlockedIncrement and InterlockedDecrement. Fixes #74228.

2005-03-29  Sebastien Pouliot  <sebastien@ximian.com>

	* io-layer.h: Add required header files for compiling with VS.NET.

2005-03-17 Miguel de Icaza <miguel@novell.com>

	* io.c: don't fail on NFS when there are no more locks available.

2005-03-09  Dick Porter  <dick@ximian.com>

	* error.c (_wapi_get_win32_file_error): ENFILE and EMFILE should
	map to ERROR_TOO_MANY_OPEN_FILES, not ERROR_NO_MORE_FILES.  Fixes
	bug 72671.

2005-03-09  Dick Porter  <dick@ximian.com>

	* daemon.c (process_process_fork): Initialise the handle data
	before using it in the error case.  This is probably the error
	we're working around in the previous change.  Spotted by Taru Jain
	<tjain@novell.com> and Hemanth Yamijala <YHemanth@novell.com>.

2005-03-07  Dick Porter  <dick@ximian.com>

	* daemon.c: It looks like g_shell_parse_argv() can return
	argv[0]=NULL somehow, yet still not give an error.  Make sure we
	don't pass NULL to strrchr(), working around a segfault that
	showed up on ZLM testing.

2005-03-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* sockets.c: translate EINPROGRESS to EWOULDBLOCK in connect. This is
	the expected error code showed by the test case in bug #73053.

2005-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: another leftover.

Fri Feb 18 17:37:29 CET 2005 Paolo Molaro <lupus@ximian.com>

	* io.c: fixed logic in checking errno in rev 40815.

Fri Feb 18 16:00:29 CET 2005 Paolo Molaro <lupus@ximian.com>

	* threads.c: we don't depend on the GC checking tls
	slots anymore.
	* processes.c: remove unused ref to GC headers.

Thu Feb 17 19:57:11 CET 2005 Paolo Molaro <lupus@ximian.com>

	* io.c: remove _wapi_thread_cur_apc_pending () checks
	when the siscall should return immediatly and handle
	the case when a syscall is interrupted without
	erroring out, but returning a 0 read/write if possible.
	Still the cases of read from file need to be handled.

Tue Feb 8 18:28:11 CET 2005 Paolo Molaro <lupus@ximian.com>

	* threads.c: make people test with 1 MB stack per thread.

2005-01-17  Dick Porter  <dick@ximian.com>

	* timefuncs.h: Make WapiFileTime endian-aware, as it's often
	cast to and from 64bit ints.  Fixes bug 71213.

2005-01-11  Dick Porter  <dick@ximian.com>

	* error.c (errno_to_WSA): Add EADDRNOTAVAIL error code
	translation.

Mon Jan 10 16:15:19 EST 2005 Neale Ferguson <nealeferguson@earthlink.net>

	* atomic.h: Fix functions on s390.

Mon Jan 10 20:30:19 CET 2005 Paolo Molaro <lupus@ximian.com>

	* atomic.h: fix some functions on ppc (tests/interlocked.cs).

2005-01-10  Dick Porter  <dick@ximian.com>

	* misc.c (_wapi_calc_timeout): Guard against overflow when
	calculating timeouts.  This makes waiting with a large
	(Int32.MaxValue) timeout not return immediately.

2004-12-23  Ben Maurer  <bmaurer@ximian.com>

	* io.c (io_ops): make this `const' so it is shareable (well, only
	really shareable if it is statically linked...)

Mon Dec 20 11:58:33 CET 2004 Paolo Molaro <lupus@ximian.com>

	* threads.c, threads.h: add accessor to get the pthread_key_t for
	a tls id.

2004-12-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: check for the existence of 'dest' and set ERROR_ALREADY_EXISTS
	if it exists and is not the same as 'src'.

2004-12-01 Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>

	* atomic.h : Fix InterlockedCompareExchange for s390/s390x.

2004-12-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* processes.c: unquote the cmd path, allow for ' or " when quoting and
	pass the quoted program name to the daemon, otherwise the call to
	g_shell_unquote in the daemon will break things up.

2004-10-14  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_accept): Revert the previous change.  We now
	set the accepted socket to have the same blocking status as the
	listening socket in managed code.  This follows MS behaviour.
	
2004-10-14  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_accept): On Darwin, make sure a newly
	accept()ed socket is blocking.  Fixes bug 67355, patch by
	grompf@sublimeintervention.com.

2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* system.c: check the number of online processors instead of the
	existing ones. Sanitize return value if it's an error.

2004-10-03 Ben Maurer  <bmaurer@ximian.com>

	* system.c: Add support for getting the # of cpus.

2004-09-28  Dick Porter  <dick@ximian.com>

	* io.c (pipe_close_private): Fix one small typo in the last change
	that totally hosed process creation with redirected pipes.

2004-09-24  Dick Porter  <dick@ximian.com>

	* wapi-private.h: 
	* sockets.c: 
	* socket-private.h: 
	* io.c: 
	* io-private.h: 
	* handles-private.h: Cope when a file descriptor is reused while
	the handle that thought it owned it is still referenced, instead
	of asserting.  Probably fixes bug 66479, though we've been unable
	to reproduce it.

2004-09-09  Dick Porter  <dick@ximian.com>

	* error.c:
	* io.c: Set error codes everywhere.

2004-09-06  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_unref): Reset the private record's type
	(CloseHandle): Check for a fd mapping failure, and return FALSE.
	(_wapi_handle_process_fork): Fix long-standing bug in checking
	handle return values.  Also do the required bookkeeping with the
	new process's handles.

	* daemon.c: When creating a new process's handles, check whether
	the shared space needs to be increased

2004-09-05  Zoltan Varga  <vargaz@freemail.hu>

	* shared.c (_wapi_shm_file): Fix leaking of filename.

2004-08-19  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_count_signalled_handles): Fix thinko
	introduced with the fd offset stuff: unlock handles properly when
	backing off.  Fixes the monologue hang at exit.

2004-08-18  Dick Porter  <dick@ximian.com>

	* sockets.c: 
	* io.c: Check that new fds fit in the table, return error if not

	* daemon.c (_wapi_daemon_main): 
	* handles.c (shared_init): Have all processes agree on a size for
	the fd table.

2004-08-17  Dick Porter  <dick@ximian.com>

	* daemon.c (process_new): 
	* handles.c (_wapi_handle_new_internal): Cope when the space
	reserved for file descriptors is larger than the shared segment
	size.  Fixes the crash reported when running mono under gdb on
	macosx.

2004-08-16  Dick Porter  <dick@ximian.com>

	* sockets.c:
	* io.c:
	* handles-private.h (_wapi_handle_fd_offset_to_handle): Improve
	error checking with passed-in file descriptors.

2004-08-11  Dick Porter  <dick@ximian.com>

	* sockets.c: 
	* io.c: Returned handle values are the file descriptor the handle
	encapsulates

	* handles.c: 
	* handles-private.h: 
	* daemon.c: Reserve the range of handles that can have the same
	values as file descriptors.  These won't be used, but the values
	will be used as file, console, pipe or socket handles.  The fd to
	handle mapping is done internally and is invisible to users.
	Fixes bug 61828.

	* wapi-private.h (_WAPI_HANDLE_VERSION): Increment, because we now
	reserve a chunk of handle space.

2004-08-04  Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>

	* atomic.h: add support for 64-bit S/390

2004-07-22  Dick Porter  <dick@ximian.com>

	* timed-thread.c: 
	* threads.c: Move the destruction of the internal thread data to
	after the thread has been joined.  Fixes bug 61418.

2004-07-14  Dick Porter  <dick@ximian.com>

	* wait.c (test_and_own): When not waiting for all handles to
	become signalled, only own and return the lowest.  All the
	documentation suggests that the old way was correct, but
	experimentation shows it actually works like this.  Patch by
	Sébastien Robitaille
	(sebastien.robitaille@croesus.com), fixes bug 61511.

2004-07-09  Ben Maurer  <bmaurer@ximian.com>

	* threads.c: register roots for gc

2004-07-08  Dick Porter  <dick@ximian.com>

	* io.c (file_seek): If there is a high 32bit offset part, make
	sure the low part isn't sign-extended.  Set error codes when
	returning failure.  Fixes bug 61131.

2004-07-06  Dick Porter  <dick@ximian.com>

	* io.c (file_setfiletime): Check for underflow when converting to
	time_t values.  Set error codes when returning failure.  Fixes bug
	60970.

2004-07-05  Dick Porter  <dick@ximian.com>

	* mutexes.c (mutex_ops_init): Make the named mutex mutex sharable.

	* daemon.c (unref_handle): Only destroy a handle if all processes
	have released it, not just the current one.  Fixes bug 60887.

2004-06-30  Zoltan Varga  <vargaz@freemail.hu>

	* mono-mutex.h atomic.h: Add G_GNUC_UNUSED to static inline functions
	to prevent warnings.

2004-06-24  Dick Porter  <dick@ximian.com>

	* mutexes.c: Indicate when a named mutex was reused

2004-06-24  Dick Porter  <dick@ximian.com>

	* threads.c (SuspendThread): 
	* timed-thread.c (_wapi_timed_thread_suspend): Wrap sem_wait in a
	while loop.  See bug 58161.

Wed Jun 23 23:29:04 CEST 2004 Paolo Molaro <lupus@ximian.com>

	* io.c: don't use sharemode for on-disk file permissions: it's used
	for shared access to the open file.

2004-06-22  Dick Porter  <dick@ximian.com>

	* events.c (CreateEvent): When creating an auto-reset event that
	is initially owned, make sure the set count starts at 1.

2004-06-18  Dick Porter  <dick@ximian.com>

	* event-private.h:
	* events.c: Auto-reset events need to release one thread for each
	time SetEvent() is called.  Fixes bug 41292.

	* threads.h:
	* mutex-private.h:
	* mutexes.c: Scan for mutexes that are still locked by a thread
	when it exits.  Fixes the MS demo app linked by bug 41292.

	* wait.c (test_and_own): Make sure a handle is signalled before it
	is owned.

2004-06-16  Dick Porter  <dick@ximian.com>

	* timed-thread.c: Call the thread cleanup exit routine before taking
	the join mutex, because this could deadlock if another thread tries
	to join in the meantime.  This fixes the hang-at-exit problem seen
	on macos.

2004-06-03  Lluis Sanchez Gual  <lluis@ximian.com>

	* threads.c: Implemented SleepEx.
	* threads.h: Fixed SleepEx signature.

2004-06-03  Miguel de Icaza  <miguel@ximian.com>

	* threads.c: When running under valgrind, do not allocate too much
	stack, as Valgrind default is 1 meg.

2004-05-27  Dick Porter  <dick@ximian.com>

	* io.h:
	* io.c: Implemented LockFile() and UnlockFile()

2004-05-21  Dick Porter  <dick@ximian.com>

	* io.c (CreateFile): Check for existing share modes when opening
	a file.

	* handles.c: 
	* handles-private.h: 
	* daemon-messages.h: 
	* daemon.c: Maintain a hash of file share modes, keying on device
	and inode (to cope with symlinks.)

2004-05-20  Lluis Sanchez Gual  <lluis@ximian.com>

	* daemon-messages.c: Retry if the communication with the daemon is
	  interrupted by a signal.
	* io.c, sockets.c: Check for EINTR in every syscall that can be interrumped. 
	  Only return an error in this case if there is something in the apc queue
	  (which means that it is an interruption requested by the "user").
	* processes.c: Use WaitForSingleObjectEx. No need to pass "alertable" as
	  true since the wait is small.
	* shared.c: Retry write calls when interrumped by a signal.
	* timed-thread.h, timed-thread.c: added _wapi_thread_apc_pending, which
	  returns TRUE if there are pending asynchronous calls (APC) for the
	  provided thread. Also added _wapi_thread_dispatch_apc_queue which calls
	  the enqueued APCs. Defined a new struct ApcInfo that holds information
	  about an enqueued APC.
	* thread-private.h, threads.c: Implemented QueueUserAPC (which does the same
	  as in win32),_wapi_thread_apc_pending and _wapi_thread_dispatch_apc_queue. 
	  These last two methods call the corresponding apc methods in 
	  thread-private using the provided thread handle.
	* threads.h: Added QueueUserAPC.
	* uglify.h: Added WapiApcProc (needed by QueueUserAPC).
	* wait.c, wait.h: Changed WaitForSingleObject to WaitForSingleObjectEx, and
	  WaitForMultipleObjects to WaitForMultipleObjectsEx. Implemented support
	  for APCs in those two methods and also in SleepEx.

2004-05-17  Dick Porter  <dick@ximian.com>

	* io.c (CopyFile): Speed up.  Fixes bug 57859.

2004-05-13  Dick Porter  <dick@ximian.com>
	* mono-mutex.c (mono_mutex_unlock): Return EPERM when the current
	thread doesn't own the mutex, rather than assert()ing.

2004-05-11  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_attach): Cope when a previous daemon startup
	attempt failed, leaving shared files that look like a daemon is
	still starting.

2004-05-10  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	(SetFileAttributes): don't the the exec bit if the corresponding read
	bit is not set.

2004-05-10  Zoltan Varga  <vargaz@freemail.hu>

	* io.c (FindFirstFile): Fix invalid free.

2004-05-09  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: translate from GFileError to errno codes and don't free
	variables right after calling mono_io_scandir, as we may overwrite
	errno value.

2004-05-08  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: g_dir_open return ENOENT for directories on which we don't have
	read/execute permission, while returning EPERM for anything below those.
	So, change ENOENT by EPERM if the directory exists.

2004-05-07  Dick Porter  <dick@ximian.com>

	* io.c (SetFileAttributes): Don't have failed chmod()s cause a
	"file not found" error.  Fixes bug 54032.
	
2004-05-07  Dick Porter  <dick@ximian.com>

	* io.c (FindFirstFile): Comment out a windows-compatibility check
	that breaks when directories have metachars in their names.
	Workaround for bug 58116.

2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: fixed for FindFirstFile for empty directories. Closes
	bug #58147.

2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* processes.c: set the start time for the current process. Fixes bug
	#58109.

2004-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io-private.h: 'namelist' is now a gchar ** in _WapiHandlePrivate_find.
	* io.c: implemented scandir using glib functions.

2004-05-04  Dick Porter  <dick@ximian.com>

	* daemon.c (read_message): Return FALSE on error so the GSource
	callback itself can return FALSE.  Cures the infinite loop poll()
	warning on MacosX.
	* shared.c: Fix some daemon startup race conditions.

2004-04-29  Miguel de Icaza  <miguel@ximian.com>

	* io.c (CopyFile): Use 32k buffers to copy the file instead of 2k,
	use the stack, do not use dynamic memory.

2004-04-29  Zoltan Varga  <vargaz@freemail.hu>

	* io.c: Add scandir implementation for platforms which do not have
	it, like solaris.

2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.[ch]: implemented GetLogicalDriveStrings.

2004-04-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	* sockets.c: use the field name from configure when accessing sigval
	pointer field. Makes this work on the Mac.

2004-04-28  Bernie Solomon  <bernard@ugsolutions.com>

	* atomic.c: (InterlockedExchange) fix typo for
	mutex name

2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	* sockets.c: added check for sys/aio.h.

2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* error.[ch]: added _wapi_get_win32_file_error...
	* io.c: ... which was _wapi_get_win32_error here.
	* sockets.c: rename the function calls here too.

2004-04-28  Dick Porter  <dick@ximian.com>

	* daemon-messages.c: Avoid a deadlock when a thread is killed while
	waiting for the daemon by using a recursive mutex.  Helps bug 56699.

2004-04-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: fixed leak in async_notifier().

	* sockets.[ch]: added AIO support for sockets and fixed WSAIoctl
	declaration.

	* threads.c: removed old comment.

2004-04-26  David Waite  <mass@akuma.org>

	* daemon-messages.h:
	* daemon-private.h
	* error.h:
	* io.h:
	* processes.h:
	* shared.h:
	* thread-private.h:
	* wapi-private.h: remove comma from end of enumeration declarations
	* status.h: cast unsigned int types to int for enum assignment

2004-04-26 David Waite <mass@akuma.org>

	* io.c:
	* timefuncs.c: declare 64-bit constants as long long types (i.e.
	10ULL)

2004-04-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* socket-wrappers.h: _wapi_socket == WSASocket now. Added
	WSA_FLAG_OVERLAPPED.

	* sockets.c: new unused parameters for _wapi_socket.

2004-04-22  Miguel de Icaza  <miguel@ximian.com>

	* timed-thread.c: Replace sem_init with MONO_SEM_INIT to handle
	the fact that MacOS X is a piece of junk (sem_init is *defined* in
	the libc, but they return `not implemented'). 

2004-04-22  Dick Porter  <dick@ximian.com>

	* handles.c: 
	* handles-private.h: Reference the handle when it is locked, so
	that another thread can't blow it away while we're waiting for it
	to become signalled.
	
	* wait.c: 
	* timed-thread.c: 
	* threads.c: 
	* sockets.c: 
	* semaphores.c: 
	* mutexes.c: 
	* mono-mutex.c: 
	* io.c: 
	* handles.c: 
	* handles-private.h: 
	* events.c: 
	* error.c: 
	* daemon-messages.c: 
	* critical-sections.c: 
	* atomic.c: Added pthreads cleanup handlers and error asserts

	* shared.c: 
	* handles.c: Fixed the gcc "variable might be used uninitialised"
	warnings.  They can't happen, but gcc doesn't know that
	g_assert()s don't return.

	Fixed the declaration of _wapi_handle_process_kill() so that it
	expects the correct type for the pid.
	
	* threads.c: Removed the TLS_PTHREAD_MUTEX style locking that
	hasn't been used in ages and just made the code more complex.

2004-04-17  Zoltan Varga  <vargaz@freemail.hu>

	* processes.c: Include <signal.h> for SIGKILL and SIGILL + fix some
	warnings. Fixes #57168.

2004-04-16  Dick Porter  <dick@ximian.com>

	* threads.c (Sleep): Using div(3) with a negative (when signed)
	numerator causes the quotient to be 0 and the remainder to be the
	numerator.  This feeds a small negative value to nanosleep(3),
	which will return immediately and cause a busy wait.  Fixes bug
	56351.

2004-04-15  Dick Porter  <dick@ximian.com>

	* io-private.h:
	* io.c: Rewrite FindFirstFile and FindNextFile using scandir(3)
	and fnmatch(3) instead of glob(3).  glob() can't cope with being
	given filenames containing metachars.  This fixes bug 40557.

2004-04-14  Bernie Solomon  <bernard@ugsolutions.com>

	* security.c: #warning is a GCC-ism

2004-04-13  Sebastien Pouliot  <sebastien@ximian.com>

	* security.c: Removed GetUserName as glib g_get_user_name does a
	better (portability) job. Added ImpersonateLoggedOnUser and
	RevertToSelf.

2004-04-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* mono-mutex.h: move pthread_mutex_timedlock declaration to...
	* mono-mutex.c: ...here. It was causing a warning that prevented
	libgdiplus compilation.

2004-04-04  Miguel de Icaza  <miguel@ximian.com>

	* security.c (GetUserName): Make it work on MacOS X

2004-04-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* security.c: use getpwuid_r if available. This one is thread-safe.

2004-04-02  Sebastien Pouliot  <sebastien@ximian.com>

	* Makefile.am: Added security.c|h.
	* security.c: New file for security related functions. Added function
	GetUserName to fix #56144.
	* security.h: New. Header file for security.c
	* wapi.h: Added include for security.h

2004-03-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* daemon-messages.h: added kill structs.

	* daemon.c: implemented process_process_kill.
	* handles-private.h:  define process_process_kill.
	* handles.c: implemented _wapi_handle_process_kill.
	* processes.[ch]: implemented TerminateProcess.

2004-03-25  Bernie Solomon  <bernard@ugsolutions.com>

	* daemon.c (rem_fd): On solaris you seem to get an
	error even after removing the input source so don't
	try and rem_fd it twice.

2004-03-25  Lluis Sanchez Gual  <lluis@ximian.com>

	* daemon.c: in process_post_mortem, If the child terminated due to the 
	receipt of a signal, the exit status must be based on WTERMSIG, since 
	WEXITSTATUS returns 0 in this case.

2004-03-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* daemon.c: turned a warning into a DEBUG statement. Now we may hit it.

2004-03-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* daemon.c: only call getdtablesize () once.
	* processes.c: wait 500 ms to check if execve failed and throw the same
	exception as MS on failure. Fixes bug #32809.

2004-03-17  Bernie Solomon  <bernard@ugsolutions.com>

	* io.c (async_notifier): use "union sigval" rather
	than sigval_t as Solaris doesn't have sigval_t
	(which isn't in IEEE 1003.1 either).

2004-03-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: added debug stuff and removed a few redundant lines in
	file_write.

2004-03-15  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io-private.h: added new fields for file structure. Declare
	_wapi_io_add_callback.

	* io.c: added _wapi_get_win32_error, support aio_read/write in
	file_read/write. Implemented _wapi_io_add_callback, which is where
	BindHandle ends up.
	
	* io.h: added new fields for WapiOverlapped and typedef for the
	callback.

	* processes.c: fixed off-by-one bug when handling environment variables 
	passed in.

	* threads.[ch]: implemented BindIoCompletionCallback.

	* uglify.h: added typedef for LPOVERLAPPED_COMPLETION_ROUTINE.

2004-03-14  Zoltan Varga  <vargaz@freemail.hu>

	* socket-wrappers.h: Remove extra semicolon.

2004-03-03  Dave Camp  <dave@ximian.com>

	* daemon.c: (add_fd), (fd_activity), (_wapi_daemon_main):
	Use a new main context.

2004-03-04  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	(GetFileAttributes): set the error depending on errno instead of
	setting ERROR_FILE_NOT_FOUND always. See bug #55160.

2004-03-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	(CopyFile): free the buffer on error.
	* sockets.c:
	(WSAIoctl): free the buffer on error.

2004-02-19  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* error.c: fixed mapping for EPROTONOSUPPORT and ESOCKTNOSUPPORT.

	* sockets.[ch]: retry creating the socket for AF_INET, SOCK_RAW
	using IP protocol with IP over IP. Implemented WSAIoctl UNIX-style.

2004-01-27  Bernie Solomon  <bernard@ugsolutions.com>

	* shared.c (_wapi_shm_file): add hostname
	to shared data file names to handle NFS mounted
	.wapi directories.

Mon Jan 26 16:15:03 CET 2004 Paolo Molaro <lupus@ximian.com>

	* sockets.h: remove obsolete soklen_t typedef.

Fri Jan 23 21:07:02 CET 2004 Paolo Molaro <lupus@ximian.com>

	* socket-wrappers.h, sockets.h, sockets.c, Makefile.am: move socket
	wrappers to its own non-installed header file.

2004-01-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	(FindFirstFile): unlock the handle if FindNextFile fails.
	(FindNextFile): g_free a couple of pointers before retrying.

	* wait.c:
	(WaitForMultipleObjects): if only one handle provided, use
	WaitForSingleObject.

2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>

	* handles-private.h: (_wapi_handle_type) check
	for segment in range before using it

2003-12-22  Bernie Solomon  <bernard@ugsolutions.com>

	* thread-private.h: _wapi_thread_ops is now const
	must match .c file.

Mon Dec 22 18:29:03 CET 2003 Paolo Molaro <lupus@ximian.com>

	* threads.c, timed-thread.c, timed-thread.h: use mach
	semaphores on Darwin (MacOSX) since the posix ones
	are mostly broken there (threads are not created suspended
	and they can start executing before they are fully initialized
	like in tests/thread-static.cs).

Mon Dec 22 17:18:45 CET 2003 Paolo Molaro <lupus@ximian.com>

	* atomic.h: ppc fixes.

2003-12-19  Bernie Solomon  <bernard@ugsolutions.com>

	* handles.c: remove my bad use of MONO_ZERO_ARRAY_LENGTH
	in HDRSIZE 

2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>

	* shared.c: (_wapi_shm_open) make scratch file
	not have to immediately regrow to avoid remaps
	(HPUX can't cope with these).
	(_wapi_shm_attach) use actual size of file
	to set scratch data_len for the creating process.

	* handles.c: (_wapi_handle_new_internal) make
	sure mutex & cond var are initialized even for
	non process shared ones. 
	(_wapi_handle_unref) always call destroy 
	routines on mutex & cond var

2003-12-15  Bernie Solomon  <bernard@ugsolutions.com>

	* daemon.c: change channel data structure so
	input sources are removed from glib event loop
	properly. xsp works better on Solaris and 
	fixes #51278

2003-12-12  Bernie Solomon  <bernard@ugsolutions.com>

	* wapi-private.h: Replace G_GNUC_PRETTY_FUNCTION
	definition with file & line number for non-GCC
	compiles.

2003-12-08  Bernie Solomon  <bernard@ugsolutions.com>

	* Makefile.am: make sure hppa_atomic.s is in distribution

2003-12-01  Dick Porter  <dick@ximian.com>

	* wapi-private.h: 
	* mutexes.c (CreateMutex): 
	* mutex-private.h (struct _WapiHandle_mutex): 
	* handles.c: Look up certain handle types by name, in a shared
	namespace.  Currently only mutex handles have this implemented.
	Fixes bug 51089.

	* semaphores.c (CreateSemaphore): 
	* events.c (CreateEvent): Fix signature

2003-11-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c: don't call g_free before testing errno as it may modify it.
	If the path exists, return an error if it's not a directory. Fixes
	bug #50753.

2003-11-20  Dick Porter  <dick@ximian.com>

	* io.c: Missed a little-endian UTF16 conversion.  Patch from
	Jeroen Zwartepoorte (Jeroen@xs4all.nl), fixes bug 51065.

2003-10-29  Dick Porter  <dick@ximian.com>

	* io.c (MoveFile): If the move crosses filesystems, try and fall
	back to copy and delete.  Patch from Jörg Rosenkranz
	(JoergR@voelcker.com), fixes bug 50298.

2003-10-28  Dick Porter  <dick@ximian.com>

	* io.c: Use the new encoding conversion to cope with non-utf8
	locales in filenames.

	* processes.c: Ditto for process arguments.

Tue Oct 21 12:01:14 CEST 2003 Paolo Molaro <lupus@ximian.com>

	* atomic.h: some ppc inline asm fixes (incorrect use of labels, 
	incorrect register constraints, incorrect clobber lists).

2003-10-13  Bernie Solomon  <bernard@ugsolutions.com>

	* Makefile.am hppa_atomic.s: add HP 64bit
	implementation of atomic ops

2003-10-13  Zoltan Varga  <vargaz@freemail.hu>

	* threads.c (CreateThread): Wrap pthread_attr_setstacksize call in
	a conditional for platforms that don't have it.

2003-10-09  Bernie Solomon  <bernard@ugsolutions.com>

	* threads.c: (CreateThread) use stacksize argument
	if non-zero - change default for 64 bits to 4Mb

2003-09-29  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* sockets.c: set last error when socket creation fails. This shed some
	light on bug #49015.

2003-09-28  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* processes.c: fixed bug #48973: we only change \ by / for the argument
	to be used as command.
	When getting the program name from the args, don't let the space between
	them in the args.

2003-09-24  Bernie Solomon <bernard@ugsolutions.com>

	* atomic.h atomic.c: fix sparc so lock is
	global, increment does so and it compiles under Sun compiler.

2003-09-22  Bernie Solomon <bernard@ugsolutions.com>

	* handles.c: include <string.h> directly as may
	not be nested in <sys/un.h> like Linux

2003-09-22  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* io.c:
	(DeleteFile): call SetLastError on failure. Fix by
	richard.torkar@htu.se (Richard Torkar). Closes bug #48222.

2003-09-15  Lluis Sanchez Gual  <lluis@ximian.com>

	* daemon.c: In compare_process(), discard handles already signalled.

2003-09-02  Dick Porter  <dick@ximian.com>

	* io.c: Work around glib brain-dead assumptions about utf8-encoded
	filenames.  Fixes bug 30781.

2003-08-28  Dick Porter  <dick@ximian.com>

	* critical-sections.c:  Patch from Bernie Solomon
	<bernard@ugsolutions.com> to emit a warning if locking a critical
	section fails.

2003-07-23  Dick Porter  <dick@ximian.com>

	* shared.c:
	* daemon.c (maybe_exit): Avoid the race condition when the daemon is
	closing but another client comes along when the shared data is still
	visible.  Should fix bugs 33671 and 35213.

2003-07-23  Dick Porter  <dick@ximian.com>

	* handles.c:  Initialise handle mutex and cond.  Fix by
	Bernie Solomon <bernard@ugsolutions.com>

2003-07-15  Dick Porter  <dick@ximian.com>

	* timed-thread.c (timed_thread_start_routine): Fix virtual memory
	leak when threads quit.  Fixes bug 44067.

Wed Jun 18 19:08:40 CEST 2003 Paolo Molaro <lupus@ximian.com>

	* io.c: never add write permission for group or others in
	SetFileAttributes ().

2003-06-17  Dick Porter  <dick@ximian.com>

	* io.c (SetFileAttributes): Implement the ReadOnly attribute, and
	ignore the unsupported ones ("fixes" bug 44977).

2003-06-17  Lluis Sanchez Gual  <lluis@ximian.com>

	* misc.c: fix bug in _wapi_calc_timeout. It gave wrong values for
	  high ms values (there was an overflow).

2003-06-17  Zoltan Varga  <vargaz@freemail.hu>

	* system.h (struct _WapiSystemInfo ): Fix warnings when using gcc-3.3.

2003-06-11  Dick Porter  <dick@ximian.com>

	* shared.c: Fix shared directory creation.  Patch from
	Pablo Baena <pbaena@uol.com.ar>

2003-06-10  Dick Porter  <dick@ximian.com>

	* atomic.c: Delete the useless compile warning

2003-06-09  Dick Porter  <dick@ximian.com>

	* daemon.c: Lookup env as a string array.  Fixes bug 44289.  Also
	make setting the process handle value in the environment actually
	work.

	* processes.c: Pretty up the process name, if it happens to be
	"mono" such as when another mono process forks "mono foo.exe"

2003-06-05  Dick Porter  <dick@ximian.com>

	* processes.c (process_set_current): Don't do an expensive handle
	search at application startup, check the environment to see if the
	process handle has already been created.

	* io.c: Don't do an expensive handle search when creating stdin,
	stdout and stderr handles, just create them all the first time one
	is requested.

	* wapi-private.h:
	* shared.c:
	* shared.h:
	* handles.c:
	* handles-private.h:
	* daemon-messages.h:
	* daemon-private.h:
	* daemon.c: Support for "unlimited" number of handles and scratch
	data.

	Speed up application startup by passing process handle in the
	environment, rather than let the app scan all handles (which gets
	really slow when there are more than a few thousand to check.)

	Initialise some structs passed to syscalls, noticed by valgrind.
	

2003-05-20  Dick Porter  <dick@ximian.com>

	* io.c (FindFirstFile): Include . files in the glob.  Fixes bug
	43229.

2003-05-19  Dick Porter  <dick@ximian.com>

	* threads.c: Set the new thread's stack size to 2M.  Fix needed
	for BSD, reported by Martin Dvorak <md@9ll.cz>

2003-05-16  Dick Porter  <dick@ximian.com>

	* io.h:
	* io.c: Implement GetTempPath()

2003-05-16  Dick Porter  <dick@ximian.com>

	* processes.c (CreateProcess): Set some error codes

2003-05-12  Dick Porter  <dick@ximian.com>

	* misc.c (_wapi_calc_timeout): Cope with overflowing tv_nsec.
	Patch from Martin Dvorak <mdvorak@ninell.cz>.

2003-05-10  Dick Porter  <dick@ximian.com>

	* io.c (CopyFile): Copy file mode as well as file data.  Based on
	suggestion by Giuseppe Greco <giuseppe.greco@agamura.com>, bug
	42706.

2003-05-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* handles.c: don't call GC_gcollect when creating new handles.

2003-05-05  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* handles.c: added some debugging code. Call GC_gcollect
	before creating a new handle. It makes Lupus' test run smoother and
	faster (from 62 to 83 request per second). Notice that calling
	GC_finalizer_notifier if needed (GC_should_invoke_finalizer ()) does
	not improve nor degrade the performance, so i don't do it.

2003-05-02  Dick Porter  <dick@ximian.com>

	* sockets.c: Rearrange closesocket() and socket_close_private(),
	and remember to unref the handle, so we don't leak socket handles.
	Fix from Pelle Johnsen <pelle.johnsen@mail.dk>

2003-04-11  Dick Porter  <dick@ximian.com>

	* atomic.h: ARM atomic operations by Malte Hildingson
	<tds00mahi@tellus.thn.htu.se>

Tue Apr 8 11:37:29 CEST 2003 Paolo Molaro <lupus@ximian.com>

	* atomic.h: fix macosx build by "Urs C. Muff" <umuff@quark.com>.

2003-04-03  Martin Baulig  <martin@ximian.com>

	The following change is conditional to `WITH_INCLUDED_LIBGC'
	which is not yet enabled by default.

	* threads.c (SuspendThread, ResumeThread): Fully implemented this.
	(gc_init): New static function; install a signal handler for
	SIGPWR which is used to suspend threads.  [FIXME: it SIGPWR
	doesn't exist on all Unix systems, we need to find another
	signal].
	(mono_wapi_push_thread_stack): New public function.  Tells the
	garbage collector about the current stack pointer of a suspended
	thread.

2003-04-03  Martin Baulig  <martin@ximian.com>

	* timed-thread.h (TimedThread): Added `suspended_sem',
	`suspend_count' and `stack_ptr'.

2003-03-28  Dick Porter  <dick@ximian.com>

	* atomic.h: PPC support gratiously donated to the public domain
	by John Duncan <jddst19@mac.com>

2003-03-20  Dick Porter  <dick@ximian.com>

	* sockets.c (_wapi_connect): If connect() fails with EACCES, try
	setting SO_BROADCAST and connecting again.  Fixes bug 39178.

2003-03-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* processes.c: included Jerome Laban's patch and call SetLastError when
	the executable is not found.

2003-03-03  Dick Porter  <dick@ximian.com>

	* io.c (CreateFile): Try opening directories readonly, so that
	timestamps can be adjusted.  Patch by Elan Feingold
	<efeingold@mn.rr.com>.

2003-02-25  Dick Porter  <dick@ximian.com>

	* shared.c (_wapi_shm_attach): Return a failure code on system
	call errors, rather than exiting.

2003-02-21  Dick Porter  <dick@ximian.com>

	* processes.c (GetCurrentProcessId): Use the current process
	handle to return the process ID, as getpid() is unreliable
	(linuxthreads gives each thread a different pid).  Fixes bug
	37550.

2003-02-21  Dick Porter  <dick@ximian.com>

	* io.c (FindNextFile): Skip over dangling symlinks.  Fixes bug
	34076.

2003-02-11  Dick Porter  <dick@ximian.com>

	* timefuncs.h: 
	* timefuncs.c: Added GetTickCount()

2003-02-06  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* error.c: added WSA_EHOSTUNREACH mapping.

2003-01-26  Miguel de Icaza  <miguel@ximian.com>

	* io.c (SetFileAttributes): This routine is not currently
	implemented for the general case, but I added a special case to
	set the executable bit on Linux.

Wed Jan 15 15:55:40 CET 2003 Paolo Molaro <lupus@ximian.com>

	* sockets.h, daemon.c, io.c: compilation fixes on MacOSX.

2003-01-08  Dick Porter  <dick@ximian.com>

	* sockets.c: Fixed setting blocking mode to true (fixes bug 36388)

2002-12-11  Juli Mallett  <jmallett@FreeBSD.org>

	* daemon.c, handles-private.h, handles.c, wapi-private.h:
	Check for an implementation which says it supports
	_POSIX_THREAD_PROCESS_SHARED, rather than just one that
	defines the symbol.  Defined but with a value of -1 still
	means that it is unsupported.

2002-12-08  Martin Baulig  <martin@ximian.com>

	* handles.c (_wapi_handle_new): Create new non-shared handles with
	an initial refcount of 1, not 0.

2002-11-22  Dietmar Maurer  <dietmar@ximian.com>

	* threads.c (TlsGetValue): removed unnecessary mutex

2002-11-20  Dick Porter  <dick@ximian.com>

	* timed-thread.c (_wapi_timed_thread_attach): Attached threads
	need to store their data structure too.

	* threads.c: Make sure the threading data is initialised wherever
	it is needed

2002-11-15  Dick Porter  <dick@ximian.com>

	* timed-thread.c: Removed unneeded parameters in
	_wapi_timed_thread_attach().

	* threads.c: Renamed AttachThread() to make it not look like
	external API.  Removed unneeded parameters.

2002-11-11  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* error.[ch]: added errno_to_WSA (). It displays a warning and return
	WSASYSCALLFAILURE if there is no error mapping for the given errno,

	* sockets.c: use errno_to_WSA and fixed display of warning for h_errno.

2002-10-31  Dick Porter  <dick@ximian.com>

	* io.h: 
	* io.c: Define and use INVALID_FILE_ATTRIBUTES

2002-10-07  Dick Porter  <dick@ximian.com>

	* timefuncs.c:
	* daemon.c: Use a more accurate time source for process start and
	end times.

2002-10-03  Dick Porter  <dick@ximian.com>

	* daemon.c:
	* handles.c:
	* threads.c:  Fixes for freebsd.  Make sure that mutex and condition
	creation and deletion happen in the process that owns them, when
	POSIX shared thread objects aren't supported.  This breaks on
	freebsd, as pthread_t is a pointer to data.

2002-10-02  Dick Porter  <dick@ximian.com>

	* shared.c: Use mmap() instead of sysv shm for the shared data.

	* wapi-private.h (_WAPI_HANDLE_VERSION): Reset back to 0, for the
	new system

	* daemon-private.h: 
	* daemon.c: mmap()ed regions survive fork, so just pass the
	pointer to _wapi_daemon_main instead of mapping it again.

2002-10-01  Dick Porter  <dick@ximian.com>

	* timed-thread.c: Kludge for CREATE_SUSPENDED thread creation.
	Unfortunately libgc uses the same thread suspend technique that I
	want to, and the two don't mix: libgc will deadlock when it tries
	to stop the world if a thread has already been suspended by
	someone else.  Just do the simple suspended create rather than the
	general purpose thread suspension for now.

	* threads.c: Pass create flags to the timed_thread create call, to
	implement suspended thread creation.  ResumeThread() partially
	implemented, to cope with the case where a newly created but
	suspended thread is launched.

2002-09-30  Dick Porter  <dick@ximian.com>

	* sockets.c (ioctlsocket): Set non-blocking mode in a better way,
	with fcntl.

2002-09-27  Dick Porter  <dick@ximian.com>

	* semaphores.c: Only include semaphore.h if it's present. Patch
	for BSD from jmmv@hispabsd.org (Julio Merino).

2002-09-27  Dick Porter  <dick@ximian.com>

	* processes.c: Pass environment and working directory to the
	daemon when forking.  Don't let argv[0] be duplicated when looking
	for the program name.  Implement EnumProcessModules (simple
	version for now, lsof-style later if needed), GetModuleBaseName,
	{Get,Set}ProcessWorkingSetSize (just faked, because the vm hints
	aren't available on Linux).

	* process-private.h: Store the process name, and the working set
	min and max

	* handles.c:
	* handles-private.h: New functions to store and retrieve an array
	of strings in the scratch space

	* daemon.c: Don't miss deleting some handles when a client exits
	(we used to rely on the client doing the final cleanup, but
	obviously if the client is no longer there the daemon has to do
	it).

	Process forking now sets the environment and the working
	directory.

	* io.c: Don't confuse fd 0 with an unassigned handle struct

	* atomic.h: Add a google cache alternative to the msdn URL

2002-09-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* sockets.c:
	(_wapi_recvfrom): added ECONNRESET to the switch.

2002-09-24  Mark Crichton  <crichton@gimp.org>

	* atomic.h: Yea.  On linux, sparc isn't sparc, it's __sparc__.
	Added to ifdef.

2002-09-19  Mark Crichton  <crichton@gimp.org>

	* daemon.c, shared.c: Added NEED_LINK_UNLINK for systems that
	dont have Linux's abstract filesystem for sockets.

2002-09-19  Mark Crichton  <crichton@gimp.org>

	* atomic.h: Added SPARC atomic asm code.
	* daemon.c, handles-private.h, handles.c, wapi-private.h:
	undefined _POSIX_THREAD_PROCESS_SHARED.  This actually exists on
	Solaris 9, however, the code paths don't seem to work.  More testing
	on the shared case is *really* needed.

2002-09-03  Dick Porter  <dick@ximian.com>

	* threads.h: 
	* threads.c: Removed PosixKillThread(), because it's not in the
	w32 api

2002-08-20  Dick Porter  <dick@ximian.com>

	* handles.c (_wapi_handle_scratch_store): Made stored byte lengths
	multiples of 4 bytes, to keep header structures aligned.  Needed
	for sparc, at least. (Patch from crichton@gimp.org)

	* handles.c: Removed 'disable_shm' variable (we've defaulted to
	building with shm enabled for months now)

2002-08-19  Dick Porter  <dick@ximian.com>

	* daemon.c: Rewrote the poll() loop to use GIOChannels instead,
	for legacy NeXT-based systems.

2002-08-12  Dick Porter  <dick@ximian.com>

	* atomic.h: Rename some parameters to avoid c++ keywords (Patch
	from Joseph Wenninger <kde@jowenn.at>)

2002-08-05  Dietmar Maurer  <dietmar@ximian.com>

	* threads.c: use fast spinlocks by default

2002-08-02  Dick Porter  <dick@ximian.com>

	* io.c (GetStdHandle): Add a handle reference when returning a
	duplicate console handle.  This fixes the unref_handle errors in
	NUnit.

2002-08-01  Dietmar Maurer  <dietmar@ximian.com>

	* threads.c (TLS_PTHREAD_MUTEX): define this because else some
	tests does not work

2002-08-01  Dick Porter  <dick@ximian.com>

	* threads.c: Use atomic spinlocks in TLS functions

	* mono-spinlock.h:
	* Makefile.am: Added mono-spinlock.h

2002-07-21  Jeffrey Stedfast  <fejj@ximian.com>

	* daemon-messages.c: #include <sys/types.h> and <sys/sockets.h> -
	these are needed for sendmsg() and also for struct msghdr (at
	least on Solaris). Solaris still won't build because struct msghdr
	doesn't have msg_flags, msg_control, or msg_controllen members.
	(CMSG_SPACE): Define for systems that don't have it.
	(CMSG_LEN): Same.

2002-07-20  Dick Porter  <dick@ximian.com>

	* wapi-private.h:
	* io-private.h:
	* io.h:
	* io.c:
	* handles.c: Implemented pipe handles
	
	* handles.c:
	* daemon.c: Fixed bug in handle closing.

	* shared.c:
	* daemon.c: Forked processes now close all open file descriptors.

Fri Jul 19 19:05:19 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* sockets.h, io-layer.h, critical-sections.h: don't include config.h
	in header files.

2002-07-19  Martin Baulig  <martin@gnome.org>

	* threads.c (ExitThread): Call exit() if no threads has been
	created yet.

2002-07-17  Dick Porter  <dick@ximian.com>

	* daemon-messages.c: Freebsd fixes from Andreas Kohn
	<andreas.kohn@gmx.net>

2002-07-15  Dick Porter  <dick@ximian.com>

	* io.c: Removed bogus console_flush() method, that was just cut
	and pasted from file_flush when I separated the two handle types.

2002-07-12  Dick Porter  <dick@ximian.com>

	* io.c (convert_from_flags): Fixed misunderstanding wrt fcntl
	flags.  Fixes bug 27633.

2002-07-12  Dick Porter  <dick@ximian.com>

	* wapi-private.h:
	* handles.c:
	* daemon.c: Use size of sockaddr_un.sun_path from config.h

2002-07-12  Dick Porter  <dick@ximian.com>

	* processes.c (CreateProcess): Send stdin, stdout and stderr
	handles if the startup info doesnt specify new ones

	* io.c (GetStdHandle): Return the same handle when the same
	standard handle is requested

	* handles.c: Pass file descriptors when forking

	* daemon.c: Use supplied file descriptors when forking a new
	process

	* daemon-messages.h: 
	* daemon-messages.c: Pass stdin, stdout and stderr file
	descriptors to the daemon (used when forking)

2002-07-11  Miguel de Icaza  <miguel@ximian.com>

	* daemon.c (_wapi_daemon_main): Use sizeof
	(main_socket_address.sun_path) instead of hardcoded 108 value.

	* handles.c (shared_init): Use sizeof
	(shared_socket_address.sun_path) instead of hardcoded 108 value.

2002-07-10  Dennis Haney  <davh@davh.dk>

	* shared.c:
	* handles.c:
	* daemon.c: Lots of documentation, some added error checking, and
	code readability improvements.

	* daemon-messages.h: Add the Error request type to improve error
	checking.

	* daemon-messages.c: Do a bit more error checking on send() and
	recv(), and log errors with a higher severity level.

2002-07-04  Dick Porter  <dick@ximian.com>

	* daemon.c (process_process_fork): Fix argument handling, due to
	buggy understanding of g_strsplit() behaviour.

2002-07-03  Dick Porter  <dick@ximian.com>

	* threads.h:
	* threads.c: Implement OpenThread().  Define access-control values
	for thread handles.

	* wapi.h:
	* processes.h:
	* access.h:
	* Makefile.am: Added access.h, to hold shared access-control
	definitions

2002-07-02  Dick Porter  <dick@ximian.com>

	* wapi-private.h (_WAPI_HANDLE_VERSION): New protocol version
	
2002-07-02  Dick Porter  <dick@ximian.com>

	* handles.c (shared_init): Make a second attempt to contact the
	daemon if the shared memory attach succeeds, but the connect()
	fails. (This copes with the daemon crashing without cleaning up
	the shared memory.)

	* Makefile.am: 
	* daemon-private.h:
	* daemon.c:
	* shared.c (_wapi_shm_attach): Don't exec() anything when we fork
	the daemon, it's now built into the library.

2002-06-25  Dick Porter  <dick@ximian.com>

	* handles.c:
	* handles-private.h:
	* daemon-messages.h:
	* daemon.c: Process forking and handle data management

	* processes.h:
	* process-private.h:
	* processes.c: Process forking and other support functions

2002-06-25  Dick Porter  <dick@ximian.com>

	* versioninfo.h: PE resource decoding

	* unicode.c (_wapi_unicode_to_utf8): g_utf16_to_utf8 doesnt need
	to be told the string length

	* io.c: Removed the ACTUALLY_DO_UNICODE option.  Fixed some leaks.
	Moved _wapi_time_t_to_filetime and the WapiFileTime typedef to
	timefuncs.c

2002-06-12  Dick Porter  <dick@ximian.com>

	* daemon.c: 
	* daemon-messages.c: Handle SIGPIPE in a non-stupid way in the
	daemon, if MSG_NOSIGNAL isn't available.  Thanks to Jaroslaw
	Kowalski <jarek@atm.com.pl> for pointing out the bogosity.

2002-06-10  Jaroslaw Kowalski <jarek@atm.com.pl>

	* sockets.c, daemon-messages.c: Prevent SIGPIPE from being raised
	when writing to a closed socket.

2002-06-08  Jeffrey Stedfast  <fejj@ximian.com>

	* mono-mutex.c (mono_once): New convenience function for my
	previous fix.

	* handles.c:
	* error.c: 
	* critical-sections.c: 
	* threads.c: 
	* sockets.c: 
	* semaphores.c: 
	* processes.c: 
	* mutexes.c: 
	* io.c: 
	* events.c: 
	* atomic.c: Use mono_once() rather than pthread_once().

2002-06-06  Jeffrey Stedfast  <fejj@ximian.com>

	* handles.c (_wapi_handle_new): pthread_once() is not atomic, so
	if multiple threads all try to call _wapi_handle_new() before the
	shared data has been initialized, it is possible that we could get
	into a condition where shared_init() is being executed and later
	threads will pass by pthread_once() due to the fact that it has
	already been called and so therefor will attempt to use the shared
	data before it has been completely initialized. If we instead use
	a standard mutex locking mechanism around shared_init(), we can
	avoid the situation entirely. By wrapping the mutex locking in a
	check to see if we've already initialized the data, we can even
	avoid wasting resources by having to lock/unlock the mutex in any
	later calls (the only time we'd have to worry about
	locking/unlocking is the initial race to call shared_init() at
	startup).

Sat Jun 1 13:27:11 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* atomic.h: inline asm fixes from Dennis Haney (davh@davh.dk).

Fri May 31 16:21:54 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* daemon.c, handles.c: rename "sun" local var since it's apparently
	a #define on Solaris.

Fri May 31 15:40:14 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* daemon-messages.c: work-around MSG_NOSIGNAL missing on some
	platforms.

2002-05-15  Dick Porter  <dick@ximian.com>

	* wait.c: Fix a deadlock in WaitForMultipleObjects

2002-05-14  Dick Porter  <dick@ximian.com>

	* io.c: Fix a cut&paste error, found by
	Jaroslaw Kowalski <jarek@atm.com.pl>

2002-05-10  Dan Lewis  <dihlewis@yahoo.co.uk>

	* io.c:	Nasty typo.

2002-05-09  Dick Porter  <dick@ximian.com>

	* threads.c: 
	* semaphores.c: 
	* processes.c: 
	* mutexes.c: 
	* handles-private.h: 
	* events.c: 
	* Makefile.am: Remove now-unused file wait-private.h

2002-05-08  Dick Porter  <dick@ximian.com>

	* shared.c: Better error messages, and report when daemon
	connection fails rather than blocking forever.  Do some more
	shared memory sanity checking.

	* handles.c: Better error messages when connecting to shared
	memory and the handle daemon.  Fall back to non-shared handles if
	an error occurs.  Set the default back to 'shared handles'.  Fix a
	crashing bug in scratch space allocation that mangled the block
	headers.

2002-05-07  Miguel de Icaza  <miguel@ximian.com>

	* handles.c (shared_init): Disable SHM for now, people have too
	many problems with this, and the diagnostics are not helping.

2002-05-06  Dan Lewis  <dihlewis@yahoo.co.uk>

	* io.c: CreateFile sets win32 last error.

2002-05-05  Dick Porter  <dick@ximian.com>

	* wapi-private.h: 
	* handles-private.h:
	* io.c: 
	* io-private.h:
	* mutexes.c: 
	* mutex-private.h: 
	* processes.c: 
	* process-private.h: 
	* semaphores.c: 
	* semaphore-private.h: 
	* sockets.c: 
	* socket-private.h: 
	* events.c: 
	* event-private.h: Simplify the WapiHandleOps struct: take out all
	the file-specific entries, leaving just the items that operate on
	handles themselves.  Split the close operation into shared and
	private parts: shared close is called by the daemon.

	* handles.c: As above, but also pass handle allocation, ref and
	unref operations to the daemon.  Populate the handle_ops array at
	compile time, because the daemon needs to call ops on handles too.
	Don't bother to track open handle counts any more, the daemon does
	that.
	
	* threads.c: 
	* thread-private.h: As above, but also make the thread data
	handle-private.

	* shared.c: Fork a handle daemon if the calling process created
	the shared memory segment.

	* daemon.c:
	* daemon-messages.c:
	* daemon-messages.h:
	* Makefile.am: Build a daemon to manage handle allocation and
	destruction without needing to lock the shared memory

2002-04-30  Jeffrey Stedfast  <fejj@ximian.com>

	* atomic.c: Changed to use a normal mutex rather than a spinlock
	since a lot of platforms seem to not have them :\

2002-04-30  Dick Porter  <dick@ximian.com>

	* Completely rewrote the handle waiting code: removed the helper
	thread and its attendant complexity.  All handle waiting is now
	abstracted into the WaitForSingleObject() and
	WaitForMultipleObjects() functions.

	* Implemented inter-process sharing of handles using sysv shared
	memory.  This makes handles even more opaque, with a handle now
	just an index into an array.
	
2002-04-25  Dan Lewis  <dihlewis@yahoo.co.uk>

	* io.c: unitialized pointer in GetCurrentDirectory.

Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* threads.c: destroy the mutex at thread destruction
	(if/when thread destruction code will be actually called).
	When protecting a tls data pointer from the gc, use also the 
	thread id in the key.
	
Wed Apr 17 18:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* timed-thread.c: avoid race condition when setting the thread to
	detached.

2002-04-16  Gonzalo Paniagua Javier <gonzalo@ximian.com>

	* jit.h: to more #include lines to avoid breaking compilation
	under windows when upgrading mingw and w32api to version
	1.3 (thanks Dick!).

2002-04-16  Dick Porter  <dick@ximian.com>

	* atomic.h: Explanatory comment about lack of 80386 support

2002-04-15  Dick Porter  <dick@ximian.com>

	* atomic.h: use xaddl for InterlockedIncrement() and
	InterlockedDecrement().  Use cmpxchgl in a loop for
	InterlockedExchange() and InterlockedExchangePointer().

Mon Apr 15 13:31:22 CEST 2002 Paolo Molaro <lupus@ximian.com>

	* unicode.c: fix unicode_len() to not access uninitialized memory
	(and updated to conform to mono code style).

Fri Mar 29 17:15:11 CET 2002 Paolo Molaro <lupus@ximian.com>

	* io.c: EEXISTS is ignored for directory creation.
	* mono-mutex.h: remove silly "pragma }" that emacs users insert
	because they use a broken editor:-)

2002-03-28  Dick Porter  <dick@ximian.com>

	* sockets.h: 
	* sockets.c: 
	* io.c: 
	* handles.h: 
	* handles.c: Warning cleanups

2002-03-27  Dan Lewis <dihlewis@yahoo.co.uk>

	* unicode.h, unicode.c: changed to gunichar2
	* io.h, io.c: changed strings to gunichar2*, added
	SetFileAttributes(), GetCurrentDirectory(), SetCurrentDirectory(),
	some fixes to FindFirstFile() and friends.

2002-03-26  Dick Porter  <dick@ximian.com>

	* types.h: Implement the large integer struct

	* timefuncs.h:
	* timefuncs.c: Dummy functions that don't yet implement
	QueryPerformanceCounter() and QueryPerformanceFrequency()

	* threads.h:
	* threads.c: Implement SleepEx()

	* system.h:
	* system.c: Beginnings of GetSystemInfo()

	* mono-mutex.c (pthread_mutex_timedlock): Fix a ms/ns conversion
	thinko

	* context.h:
	* context.c: Dummy function that doesnt yet implement
	GetThreadContext()

	* atomic.h: 
	* atomic.c: Interlocked functions

Mon Mar 25 13:01:40 CET 2002 Paolo Molaro <lupus@ximian.com>

	* threads.c: use a gc-safe hash table to store tls pointers.

2002-03-22  Dick Porter  <dick@ximian.com>

	* threads.c: Fix a race condition where a thread can start and
	exit before the handle has been properly initialised (no reason
	why the handle couldn't be initialised beforehand, so do so)

	Fix a ms to ns conversion magnitude thinko.

2002-03-21  Dick Porter  <dick@ximian.com>

	* semaphores.c: Fix a problem when waiting for one or more
	semaphores, and another semaphore is Released (all waiting
	semaphores assumed they were signalled)

2002-03-29  Dan Lewis <dihlewis@yahoo.co.uk>

	* io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory,
	RemoveDirectory, GetFileAttributes, GetFileAttributesEx

2002-03-19  Dietmar Maurer  <dietmar@ximian.com>

	* threads.c (Sleep): bug fix: 1ms == 1000000ns

2002-03-19  Dan Lewis <dihlewis@yahoo.co.uk>

	* io.h, io.c, events.c, mutexes.c, semaphores.c, sockets.c,
	threads.c, io.c: added flush method to handles.

	* io.c: FlushFileBuffers() and FindFirstFile() functions.

Thu Mar 7 17:21:52 CET 2002 Paolo Molaro <lupus@ximian.com>

	* threads.c, timed-thread.c, wait.c: Boehm-GC anable.

2002-02-20  Dick Porter  <dick@ximian.com>

	* io-layer.h: Always build without cygwin support on windows

Mon Feb 18 15:50:59 CET 2002 Paolo Molaro <lupus@ximian.com>

	* sockets.c: #undef DEBUG.

2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>

	* io-layer.h: conditionally include sys/filio.h and sys/sockio.h
	for FIONBIO, FIONREAD, and SIOCATMARK.

2002-02-14  Jeffrey Stedfast  <fejj@ximian.com>

	* sockets.c: conditionally include sys/filio.h and sys/sockio.h
	for FIONBIO, FIONREAD, and SIOCATMARK.

2002-02-13  Dick Porter  <dick@ximian.com>

	* sockets.c: Implement shutdown and select

2002-02-13  Jeffrey Stedfast  <fejj@ximian.com>

	* mono-mutex.[c,h]: New source files that thinly wrap all pthread
	functions that take pthread_mutex_t and/or pthread_mutexattr_t
	arguments for the sake of portability. Implements recursive
	mutexes and pthread_mutex_timedlock.

	* critical-sections.c:
	* events.c:
	* handles.c:
	* mutexes.c:
	* semaphores.c:
	* threads.c:
	* timed-thread.c:
	* wait.c: Use the mono-mutex wrapper portability functions/macros.

	* pthread-compat.[c,h]: Replaced by mono-mutex.[c,h]

2002-01-23  Dick Porter  <dick@ximian.com>

	* sockets.c: Networking support, mostly wrapping BSD socket APIs
	with handle code, and translating errno into w32 error codes.

	* macros.h: Some w32 macros used with the socket support

	* error.c: Implemented GetLastError() and SetLastError()

	* Makefile.am: Added sockets, with kludge to override some symbols

2001-12-17  Dietmar Maurer  <dietmar@ximian.com>

	* unicode.c (_wapi_unicode_to_utf8): byteswap UTF16 strings before
	passing them to iconv
	(_wapi_unicode_to_utf8): only swap bytes on LE systems, remove bug
	from previous commit.

2001-12-11  Dick Porter  <dick@ximian.com>

	* io.c: Implement DeleteFile(), GetFileTime(), SetFileTime() and
	FileTimeToSystemTime().

	* unicode.c (unicode_len): Nasty way of finding length of unicode
	string with embedded NULLs (counts until two NULLs together).

	* mutexes.c (mutex_close): 
	* events.c (event_close): Release the internal pthreads resources

2001-11-26  Dick Porter  <dick@ximian.com>

	* critical-sections.c:
	* events.c:
	* handles.c:
	* io.c:
	* mutexes.c:
	* semaphores.c:
	* threads.c:
	* timed-thread.c:
	* wait.c: turn off DEBUG messages

2001-11-22  Dick Porter  <dick@ximian.com>

	* handles.c (SignalObjectAndWait): Implement

	* wait.c (WaitForSingleObject): Fix case where timeout == 0

	* threads.c:
	* semaphores.c:
	* mutexes.c:
	* io.c:
	* events.c: Support for SignalObjectAndWait
	
2001-11-21  Dick Porter  <dick@ximian.com>

	* events.c:
	* handles.c:
	* mutexes.c:
	* semaphores.c:
	* threads.c:
	* wait.c: Reliable method of returning which handle was signalled
	on return from WaitForMultipleObjects().

2001-11-21  Dick Porter  <dick@ximian.com>

	* events.c: Implement events

2001-11-15  Dick Porter  <dick@ximian.com>

	* mutexes.c: Implement mutexes

	* threads.c: 
	* semaphores.c: 
	* misc.c: Factor out some common code

2001-11-13  Dick Porter  <dick@ximian.com>

	* threads.c: Implement TLS.  Implement GetCurrentThreadId(), and
	GetCurrentThread() by maintaining a hash of thread handles.

	* threads.h: Define thread and process creation flags

2001-11-12  Dick Porter  <dick@ximian.com>

	* critical-sections.c: Implement critical sections

2001-11-12  Dick Porter  <dick@ximian.com>

	* semaphores.c: Implement semaphores

	* wait.c (wait_for_item): Maintain a wait count rather than count
	signalled booleans.

	* threads.c (thread_wait_multiple): Don't lock the wait item, that
	will block other wait threads

2001-11-11  Dick Porter  <dick@ximian.com>

	* Makefile.am: Rename some automake variables
	(from Nick Drochak <ndrochak@gol.com>)

2001-11-10  Dick Porter  <dick@ximian.com>

	* Makefile.am (libwapiincludedir): Fix include destination

	* .cvsignore: Ignore generated files

2001-11-10  Dietmar Maurer  <dietmar@ximian.com>

	* pthread-compat.c: added some include files to make it compile on
	linux.

2001-11-08  Dick Porter  <dick@ximian.com>

	* Initial checkin.

	This is a library emulating the win32 threading and IO API.
