2002-07-15 Dick Porter * 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 * io.c (convert_from_flags): Fixed misunderstanding wrt fcntl flags. Fixes bug 27633. 2002-07-12 Dick Porter * wapi-private.h: * handles.c: * daemon.c: Use size of sockaddr_un.sun_path from config.h 2002-07-12 Dick Porter * 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 * 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 * 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 * daemon.c (process_process_fork): Fix argument handling, due to buggy understanding of g_strsplit() behaviour. 2002-07-03 Dick Porter * 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 * wapi-private.h (_WAPI_HANDLE_VERSION): New protocol version 2002-07-02 Dick Porter * 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 * 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 * 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 * 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 for pointing out the bogosity. 2002-06-10 Jaroslaw Kowalski * sockets.c, daemon-messages.c: Prevent SIGPIPE from being raised when writing to a closed socket. 2002-06-08 Jeffrey Stedfast * 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 * 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 * atomic.h: inline asm fixes from Dennis Haney (davh@davh.dk). Fri May 31 16:21:54 CEST 2002 Paolo Molaro * 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 * daemon-messages.c: work-around MSG_NOSIGNAL missing on some platforms. 2002-05-15 Dick Porter * wait.c: Fix a deadlock in WaitForMultipleObjects 2002-05-14 Dick Porter * io.c: Fix a cut&paste error, found by Jaroslaw Kowalski 2002-05-10 Dan Lewis * io.c: Nasty typo. 2002-05-09 Dick Porter * 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 * 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 * 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 * io.c: CreateFile sets win32 last error. 2002-05-05 Dick Porter * 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 * 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 * 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 * io.c: unitialized pointer in GetCurrentDirectory. Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro * 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 * timed-thread.c: avoid race condition when setting the thread to detached. 2002-04-16 Gonzalo Paniagua Javier * 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 * atomic.h: Explanatory comment about lack of 80386 support 2002-04-15 Dick Porter * 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 * 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 * 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 * sockets.h: * sockets.c: * io.c: * handles.h: * handles.c: Warning cleanups 2002-03-27 Dan Lewis * 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 * 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 * threads.c: use a gc-safe hash table to store tls pointers. 2002-03-22 Dick Porter * 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 * 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 * io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory, RemoveDirectory, GetFileAttributes, GetFileAttributesEx 2002-03-19 Dietmar Maurer * threads.c (Sleep): bug fix: 1ms == 1000000ns 2002-03-19 Dan Lewis * 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 * threads.c, timed-thread.c, wait.c: Boehm-GC anable. 2002-02-20 Dick Porter * io-layer.h: Always build without cygwin support on windows Mon Feb 18 15:50:59 CET 2002 Paolo Molaro * sockets.c: #undef DEBUG. 2002-02-14 Jeffrey Stedfast * io-layer.h: conditionally include sys/filio.h and sys/sockio.h for FIONBIO, FIONREAD, and SIOCATMARK. 2002-02-14 Jeffrey Stedfast * sockets.c: conditionally include sys/filio.h and sys/sockio.h for FIONBIO, FIONREAD, and SIOCATMARK. 2002-02-13 Dick Porter * sockets.c: Implement shutdown and select 2002-02-13 Jeffrey Stedfast * 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 * 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 * 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 * 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 * 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 * 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 * 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 * events.c: Implement events 2001-11-15 Dick Porter * mutexes.c: Implement mutexes * threads.c: * semaphores.c: * misc.c: Factor out some common code 2001-11-13 Dick Porter * 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 * critical-sections.c: Implement critical sections 2001-11-12 Dick Porter * 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 * Makefile.am: Rename some automake variables (from Nick Drochak ) 2001-11-10 Dick Porter * Makefile.am (libwapiincludedir): Fix include destination * .cvsignore: Ignore generated files 2001-11-10 Dietmar Maurer * pthread-compat.c: added some include files to make it compile on linux. 2001-11-08 Dick Porter * Initial checkin. This is a library emulating the win32 threading and IO API.