2004-07-08 Dick Porter * 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 * 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 * 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-24 Dick Porter * mutexes.c: Indicate when a named mutex was reused 2004-06-24 Dick Porter * 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 * 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 * 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 * 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 * 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 * threads.c: Implemented SleepEx. * threads.h: Fixed SleepEx signature. 2004-06-03 Miguel de Icaza * threads.c: When running under valgrind, do not allocate too much stack, as Valgrind default is 1 meg. 2004-05-27 Dick Porter * io.h: * io.c: Implemented LockFile() and UnlockFile() 2004-05-21 Dick Porter * 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 * 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 * io.c (CopyFile): Speed up. Fixes bug 57859. 2004-05-13 Dick Porter * 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 * 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 * io.c: (SetFileAttributes): don't the the exec bit if the corresponding read bit is not set. 2004-05-10 Zoltan Varga * io.c (FindFirstFile): Fix invalid free. 2004-05-09 Gonzalo Paniagua Javier * 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 * 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 * io.c (SetFileAttributes): Don't have failed chmod()s cause a "file not found" error. Fixes bug 54032. 2004-05-07 Dick Porter * 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 * io.c: fixed for FindFirstFile for empty directories. Closes bug #58147. 2004-05-06 Gonzalo Paniagua Javier * processes.c: set the start time for the current process. Fixes bug #58109. 2004-05-06 Gonzalo Paniagua Javier * io-private.h: 'namelist' is now a gchar ** in _WapiHandlePrivate_find. * io.c: implemented scandir using glib functions. 2004-05-04 Dick Porter * 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 * 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 * io.c: Add scandir implementation for platforms which do not have it, like solaris. 2004-04-29 Gonzalo Paniagua Javier * io.[ch]: implemented GetLogicalDriveStrings. 2004-04-29 Gonzalo Paniagua Javier * 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 * atomic.c: (InterlockedExchange) fix typo for mutex name 2004-04-28 Gonzalo Paniagua Javier * io.c: * sockets.c: added check for sys/aio.h. 2004-04-28 Gonzalo Paniagua Javier * 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 * 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 * 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 * 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 * io.c: * timefuncs.c: declare 64-bit constants as long long types (i.e. 10ULL) 2004-04-24 Gonzalo Paniagua Javier * 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 * 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 * 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 * processes.c: Include for SIGKILL and SIGILL + fix some warnings. Fixes #57168. 2004-04-16 Dick Porter * 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 * 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 * security.c: #warning is a GCC-ism 2004-04-13 Sebastien Pouliot * 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 * 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 * security.c (GetUserName): Make it work on MacOS X 2004-04-02 Gonzalo Paniagua Javier * security.c: use getpwuid_r if available. This one is thread-safe. 2004-04-02 Sebastien Pouliot * 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 * 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 * 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 * 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 * daemon.c: turned a warning into a DEBUG statement. Now we may hit it. 2004-03-19 Gonzalo Paniagua Javier * 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 * 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 * io.c: added debug stuff and removed a few redundant lines in file_write. 2004-03-15 Gonzalo Paniagua Javier * 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 * socket-wrappers.h: Remove extra semicolon. 2004-03-03 Dave Camp * daemon.c: (add_fd), (fd_activity), (_wapi_daemon_main): Use a new main context. 2004-03-04 Gonzalo Paniagua Javier * 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 * io.c: (CopyFile): free the buffer on error. * sockets.c: (WSAIoctl): free the buffer on error. 2004-02-19 Gonzalo Paniagua Javier * 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 * 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 * sockets.h: remove obsolete soklen_t typedef. Fri Jan 23 21:07:02 CET 2004 Paolo Molaro * 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 * 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 * handles-private.h: (_wapi_handle_type) check for segment in range before using it 2003-12-22 Bernie Solomon * thread-private.h: _wapi_thread_ops is now const must match .c file. Mon Dec 22 18:29:03 CET 2003 Paolo Molaro * 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 * atomic.h: ppc fixes. 2003-12-19 Bernie Solomon * handles.c: remove my bad use of MONO_ZERO_ARRAY_LENGTH in HDRSIZE 2003-12-15 Bernie Solomon * 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 * 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 * wapi-private.h: Replace G_GNUC_PRETTY_FUNCTION definition with file & line number for non-GCC compiles. 2003-12-08 Bernie Solomon * Makefile.am: make sure hppa_atomic.s is in distribution 2003-12-01 Dick Porter * 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 * 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 * io.c: Missed a little-endian UTF16 conversion. Patch from Jeroen Zwartepoorte (Jeroen@xs4all.nl), fixes bug 51065. 2003-10-29 Dick Porter * 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 * 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 * atomic.h: some ppc inline asm fixes (incorrect use of labels, incorrect register constraints, incorrect clobber lists). 2003-10-13 Bernie Solomon * Makefile.am hppa_atomic.s: add HP 64bit implementation of atomic ops 2003-10-13 Zoltan Varga * threads.c (CreateThread): Wrap pthread_attr_setstacksize call in a conditional for platforms that don't have it. 2003-10-09 Bernie Solomon * threads.c: (CreateThread) use stacksize argument if non-zero - change default for 64 bits to 4Mb 2003-09-29 Gonzalo Paniagua Javier * sockets.c: set last error when socket creation fails. This shed some light on bug #49015. 2003-09-28 Gonzalo Paniagua Javier * 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 * atomic.h atomic.c: fix sparc so lock is global, increment does so and it compiles under Sun compiler. 2003-09-22 Bernie Solomon * handles.c: include directly as may not be nested in like Linux 2003-09-22 Gonzalo Paniagua Javier * io.c: (DeleteFile): call SetLastError on failure. Fix by richard.torkar@htu.se (Richard Torkar). Closes bug #48222. 2003-09-15 Lluis Sanchez Gual * daemon.c: In compare_process(), discard handles already signalled. 2003-09-02 Dick Porter * io.c: Work around glib brain-dead assumptions about utf8-encoded filenames. Fixes bug 30781. 2003-08-28 Dick Porter * critical-sections.c: Patch from Bernie Solomon to emit a warning if locking a critical section fails. 2003-07-23 Dick Porter * 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 * handles.c: Initialise handle mutex and cond. Fix by Bernie Solomon 2003-07-15 Dick Porter * 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 * io.c: never add write permission for group or others in SetFileAttributes (). 2003-06-17 Dick Porter * io.c (SetFileAttributes): Implement the ReadOnly attribute, and ignore the unsupported ones ("fixes" bug 44977). 2003-06-17 Lluis Sanchez Gual * 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 * system.h (struct _WapiSystemInfo ): Fix warnings when using gcc-3.3. 2003-06-11 Dick Porter * shared.c: Fix shared directory creation. Patch from Pablo Baena 2003-06-10 Dick Porter * atomic.c: Delete the useless compile warning 2003-06-09 Dick Porter * 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 * 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 * io.c (FindFirstFile): Include . files in the glob. Fixes bug 43229. 2003-05-19 Dick Porter * threads.c: Set the new thread's stack size to 2M. Fix needed for BSD, reported by Martin Dvorak 2003-05-16 Dick Porter * io.h: * io.c: Implement GetTempPath() 2003-05-16 Dick Porter * processes.c (CreateProcess): Set some error codes 2003-05-12 Dick Porter * misc.c (_wapi_calc_timeout): Cope with overflowing tv_nsec. Patch from Martin Dvorak . 2003-05-10 Dick Porter * io.c (CopyFile): Copy file mode as well as file data. Based on suggestion by Giuseppe Greco , bug 42706. 2003-05-06 Gonzalo Paniagua Javier * handles.c: don't call GC_gcollect when creating new handles. 2003-05-05 Gonzalo Paniagua Javier * 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 * 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 2003-04-11 Dick Porter * atomic.h: ARM atomic operations by Malte Hildingson Tue Apr 8 11:37:29 CEST 2003 Paolo Molaro * atomic.h: fix macosx build by "Urs C. Muff" . 2003-04-03 Martin Baulig 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 * timed-thread.h (TimedThread): Added `suspended_sem', `suspend_count' and `stack_ptr'. 2003-03-28 Dick Porter * atomic.h: PPC support gratiously donated to the public domain by John Duncan 2003-03-20 Dick Porter * 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 * processes.c: included Jerome Laban's patch and call SetLastError when the executable is not found. 2003-03-03 Dick Porter * io.c (CreateFile): Try opening directories readonly, so that timestamps can be adjusted. Patch by Elan Feingold . 2003-02-25 Dick Porter * shared.c (_wapi_shm_attach): Return a failure code on system call errors, rather than exiting. 2003-02-21 Dick Porter * 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 * io.c (FindNextFile): Skip over dangling symlinks. Fixes bug 34076. 2003-02-11 Dick Porter * timefuncs.h: * timefuncs.c: Added GetTickCount() 2003-02-06 Gonzalo Paniagua Javier * error.c: added WSA_EHOSTUNREACH mapping. 2003-01-26 Miguel de Icaza * 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 * sockets.h, daemon.c, io.c: compilation fixes on MacOSX. 2003-01-08 Dick Porter * sockets.c: Fixed setting blocking mode to true (fixes bug 36388) 2002-12-11 Juli Mallett * 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 * handles.c (_wapi_handle_new): Create new non-shared handles with an initial refcount of 1, not 0. 2002-11-22 Dietmar Maurer * threads.c (TlsGetValue): removed unnecessary mutex 2002-11-20 Dick Porter * 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 * 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 * 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 * io.h: * io.c: Define and use INVALID_FILE_ATTRIBUTES 2002-10-07 Dick Porter * timefuncs.c: * daemon.c: Use a more accurate time source for process start and end times. 2002-10-03 Dick Porter * 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 * 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 * 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 * sockets.c (ioctlsocket): Set non-blocking mode in a better way, with fcntl. 2002-09-27 Dick Porter * semaphores.c: Only include semaphore.h if it's present. Patch for BSD from jmmv@hispabsd.org (Julio Merino). 2002-09-27 Dick Porter * 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 * sockets.c: (_wapi_recvfrom): added ECONNRESET to the switch. 2002-09-24 Mark Crichton * atomic.h: Yea. On linux, sparc isn't sparc, it's __sparc__. Added to ifdef. 2002-09-19 Mark Crichton * daemon.c, shared.c: Added NEED_LINK_UNLINK for systems that dont have Linux's abstract filesystem for sockets. 2002-09-19 Mark Crichton * 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 * threads.h: * threads.c: Removed PosixKillThread(), because it's not in the w32 api 2002-08-20 Dick Porter * 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 * daemon.c: Rewrote the poll() loop to use GIOChannels instead, for legacy NeXT-based systems. 2002-08-12 Dick Porter * atomic.h: Rename some parameters to avoid c++ keywords (Patch from Joseph Wenninger ) 2002-08-05 Dietmar Maurer * threads.c: use fast spinlocks by default 2002-08-02 Dick Porter * 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 * threads.c (TLS_PTHREAD_MUTEX): define this because else some tests does not work 2002-08-01 Dick Porter * threads.c: Use atomic spinlocks in TLS functions * mono-spinlock.h: * Makefile.am: Added mono-spinlock.h 2002-07-21 Jeffrey Stedfast * daemon-messages.c: #include and - 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 * 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 * sockets.h, io-layer.h, critical-sections.h: don't include config.h in header files. 2002-07-19 Martin Baulig * threads.c (ExitThread): Call exit() if no threads has been created yet. 2002-07-17 Dick Porter * daemon-messages.c: Freebsd fixes from Andreas Kohn 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.