summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/miscfuncs.cc
Commit message (Collapse)AuthorAgeFilesLines
* Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen2016-06-231-3/+0
| | | | | | | | | | | | | | Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause. Everything else stays under GPLv3+. New Linking Exception exempts resulting executables from LGPLv3 section 4. Add CONTRIBUTORS file to keep track of licensing. Remove 'Copyright Red Hat Inc' comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement getentropy for CygwinCorinna Vinschen2016-03-181-0/+19
| | | | | | | | | | | | | | * miscfuncs.cc (getentropy): Move fhandler_dev_random::crypt_gen_random here and rename to getentropy. Fix type and return values to match getentropy requirements. * miscfuncs.h (getentropy): Add prototype. * fhandler.h (fhandler_dev_random::crypt_gen_random): Remove prototype. * fhandler_random.cc (fhandler_dev_random::crypt_gen_random): Drop. (fhandler_dev_random::write): Use getentropy instead. (fhandler_dev_random::read): Ditto. * fhandler_socket.cc (fhandler_socket::af_local_set_secret): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Always allocate main thread stack from pthread stack area on x86_64.Corinna Vinschen2015-12-071-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | * dcrt0.cc: Semi-revert commit 12743c2d5d2721f3a80b4d7671a349be03c1f520. (dll_crt0_0): Drop setting wow64_needs_stack_adjustment on 64 bit. (_dll_crt0): Split out 64 bit code again and always create new main thread stack, unless forked off from the non main thread in the parent. Call create_new_main_thread_stack with parent stack commitsize if started from the parent's main thread. Only call child_info_fork::alloc_stack for the latter case on 64 bit. Slightly rearrange moving rsp and rbp to new stack and document how. Revert 32 bit wow64 handling to its former self. * miscfunc.cc (create_new_main_thread_stack): Take a commitsize parameter and use it if it's not 0. Don't set _main_tls here, it's done in the caller _dll_crt0 anyway. Return stackbase - 16 bytes, rather than stacklimit (which was very wrong anyway). * miscfuncs.h (create_new_main_thread_stack): Accommodate declaration to aforementioned change. * wincap.h (wincaps::has_3264_stack_broken): Remove element. * wincap.cc: Ditto, throughout. * wow64.cc: Semi-revert to pre-12743c2d5d2721f3a80b4d7671a349be03c1f520 but keep architecture-agnostic type changes intact. Fix formatting. * wow64.h: Revert to pre-12743c2d5d2721f3a80b4d7671a349be03c1f520. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Always move 64 bit main thread stack to defined pthread stack areaCorinna Vinschen2015-12-031-0/+41
| | | | | | | | | | | x86_64 only: * dcrt0.cc (_dll_crt0): Always move stack to pthread stack area. Explain why. * miscfuncs.cc (create_new_main_thread_stack): New function to create OS-like stack for main thread in pthread stack area. * miscfuncs.cc (create_new_main_thread_stack): Declare. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* miscfuncs.cc: Fix typos in commentCorinna Vinschen2015-12-021-2/+2
|
* miscfuncs.cc: Fix comment preceeding x86_64 memset and friends.Corinna Vinschen2015-08-101-4/+5
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Cygwin: Fix x86_64 memcpy/memset for n > 2GBCorinna Vinschen2015-07-291-19/+173
| | | | | | | | | | | | | | | | https://cygwin.com/ml/cygwin/2015-07/msg00344.html: RtlFillMemory and RtlCopyMemory only work for size values up to 2GB. Fix this problem by using NetBSD code for memset and memcpy. Add entry points for memmove, wmemset, wmemmove, wmemcpy. Thanks to Roman Petrovski <RPetrovski@illumina.com> for pointing this out. * miscfuncs.cc (memset): x86_64 only: Implement in assembler. (memmove,memcpy): x86_64 only: Ditto. (wmemmove,wmemcpy): x86_64 only: Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Implement correct RLIMIT_STACK handlingCorinna Vinschen2015-07-051-35/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * miscfuncs.cc (struct pthread_wrapper_arg): Add member guardsize. (pthread_wrapper): Set thread stack guarantee according to guardsize. Tweak assembler code so that $rax/$eax is not required by GCC to prepare the wrapper_arg value. (CygwinCreateThread): Fix deadzone handling. Drop setting a "POSIX" guardpage (aka page w/ PAGE_NOACCESS). Always use Windows guard pages instead. On post-XP systems (providing SetThreadStackGuarantee) always set up stack Windows like with reserved/commited areas and movable guard pages. Only on XP set up stack fully commited if the guardpage size is not the default system guardpage size. Fill out pthread_wrapper_arg::guardsize. Improve comments. * resource.cc: Implement RSTACK_LIMIT Linux-like. (DEFAULT_STACKSIZE): New macro. (DEFAULT_STACKGUARD): Ditto. (rlimit_stack_guard): New muto. (rlimit_stack): New global variable holding current RSTACK_LIMIT values. (__set_rlimit_stack): Set rlimit_stack under lock. (__get_rlimit_stack): Initialize rlimit_stack from executable header and return rlimit_stack values under lock. (get_rlimit_stack): Filtering function to return useful default stacksize from rlimit_stack.rlim_cur value. (getrlimit): Call __get_rlimit_stack in RLIMIT_STACK case. (setrlimit): Call __set_rlimit_stack in RLIMIT_STACK case. * thread.cc (pthread::create): Fetch default stacksize calling get_rlimit_stack. (pthread_attr::pthread_attr): Fetch default guardsize calling wincap.def_guard_page_size. (pthread_attr_getstacksize): Fetch default stacksize calling get_rlimit_stack. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Remove. (PTHREAD_DEFAULT_GUARDSIZE): Remove. (get_rlimit_stack): Declare. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* * gendef: Export _sigbe on 64 bit as well.Corinna Vinschen2015-01-161-1/+14
| | | | | | | | | | | | * malloc_wrapper.cc (free): In malloc_printf, call caller_return_address instead of __builtin_return_address. (malloc): Ditto. (realloc): Ditto. (calloc): Ditto. * miscfuncs.cc (__caller_return_address): New function. * miscfuncs.h (caller_return_address): New macro calling __caller_return_address. (__caller_return_address): Add prototype.
* * cygheap.cc (init_cygheap::find_tls): Add comment.Corinna Vinschen2014-11-281-13/+11
| | | | | | | | | | | | | | | | * cygtls.cc (well_known_dlls): Rephrase comment. (bloda_detect): New function. (_cygtls::call2): Call init_thread and bloda_detect for non-pthread threads only. (_cygtls::remove): Move remove_tls and remove_wq calls up to run first. * miscfuncs.cc (struct pthread_wrapper_arg): Rename from struct thread_wrapper_arg. (pthread_wrapper): Rename from thread_wrapper and drop "static". Fix comment. Drop call to _cygtls::remove. Call api_fatal rather than ExitThread. Explain why. * miscfuncs.h (pthread_wrapper): Declare pthread_wrapper. * thread.cc (pthread::exit): Add a FIXME comment. Call _cygtls::remove before calling ExitThread.
* * init.cc (dll_entry): Revert previous patch. This requires anotherCorinna Vinschen2014-11-211-1/+1
| | | | | | | | | solution. * miscfuncs.cc (thread_wrapper): Ditto. * sigproc.cc (exit_thread): Disable sending a signal for synchronization with process exit. Explain why. Keep code in for later inspection, should the problem show up again. (sig_send): Use "tls", rather than "tid" as name for _cygtls arg.
* * init.cc (dll_entry): Call _my_tls.remove with INFINITE wait periodCorinna Vinschen2014-11-201-1/+1
| | | | | to avoid SEGVs and subsequent hangs in _cygtls::find_tls. * miscfuncs.cc (thread_wrapper): Ditto.
* * Throughout, use __try/__except/__endtry blocks, rather than myfaultCorinna Vinschen2014-08-221-31/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | handler. * cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs has been moved from _local_storage to _cygtls. * cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage of counters. Change type of counters to uint32_t for clarity. Remove _cygtls as friend class. (struct _local_storage): Move pathbufs from here... (struct _cygtls): ...to here, allowing to access it from _sigbe. (class san): Only define on 32 bit. Remove errno, _c_cnt and _w_cnt members. (san::setup): Drop parameter. Don't initialize removed members. (san::leave): Don't set removed members. (class myfault): Only define on 32 bit. (myfault::faulted): Only keep implementation not taking any parameter. Drop argument in call to sebastian.setup. (__try/__leave/__except/__endtry): Implement to support real SEH. For now stick to SJLJ on 32 bit. * dcrt0.cc (dll_crt0_0): Drop 64 bit call to exception::install_myfault_handler. * exception.h (exception_handler): Define with EXCEPTION_DISPOSITION as return type. (PDISPATCHER_CONTEXT): Define as void * on 32 bit. Define as pointer to _DISPATCHER_CONTEXT on 64 bit. (class exception): Define separately for 32 and 64 bit. (exception::myfault): Add handler for myfault SEH handling on 64 bit. (exception::exception): Fix mangled method name to account for change in type of last parameter. (exception::install_myfault_handler): Remove. * exceptions.cc (exception::myfault_handle): Remove. (exception::myfault): New SEH handler for 64 bit. * gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when returning to the caller. * ntdll.h: Move a comment to a better place. (struct _SCOPE_TABLE): Define on 64 bit. * thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround. * tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs. (tls_pathbuf::destroy): Change type of loop variables to uint32_t. * tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to uint32_t. Accommodate new place of pathbufs. * tlsoffsets.h: Regenerate. * tlsoffsets64.h: Regenerate.
* * miscfuncs.cc (__import_address): Cover the first dereference to impCorinna Vinschen2014-08-211-2/+2
| | | | under the fault handler.
* * miscfuncs.cc (strlwr): Rename from cygwin_strlwr. Drop __stdcallCorinna Vinschen2014-08-181-4/+4
| | | | | | | decoration. (strupr): Rename from cygwin_strupr. Drop __stdcall decoration. * string.h (strlwr): Remove override macro. Simply declare. (strupr): Ditto.
* * miscfuncs.cc (check_iovec): Allow 0 as valid iovcnt value.Corinna Vinschen2014-04-231-1/+1
|
* * ldap.cc (rediscover_thread): Give argument a useful name.Corinna Vinschen2014-02-111-1/+1
| | | | | | | * miscfuncs.cc (NT_readline::init): It's a really bad idea trying to print a pointer to a PUNICODE_STRING as PUNICODE_STRING. Fix it. * uinfo.cc (cygheap_domain_info::init): Print status codes as hex values in debug output.
* * miscfuncs.h (class NT_readline): New class to implement line-wiseCorinna Vinschen2014-02-081-1/+77
| | | | | | | reading from file using native NT functions. * miscfuncs.cc (NT_readline::init): New method. * mount.cc (mount_info::from_fstab): Utilize NT_readline to read fstab files.
* Throughout, keep function definitions and declarations in sync withCorinna Vinschen2013-11-251-1/+1
| | | | newlib in terms of C99 "restrict" keyword.
* Throughout, drop unnecessary explicit includes of windows header filesCorinna Vinschen2013-11-241-3/+0
| | | | | | | | | | | | included by default. * winlean.h: Add long comment to explain why we have to define certain symbols. (_NORMALIZE_): Define. (_WINNLS_): Drop definition and subsequent undef. (_WINNETWK_): Ditto. (_WINSVC_): Ditto. 2013-11-23 Eric Blake <eblake@redhat.com>
* * miscfuncs.cc (yield): Revert (after researching) to calling SleepEx with 0.Christopher Faylor2013-06-081-15/+11
| | | | We don't want to actually sleep when calling this function.
* revert accidentally checked in filesChristopher Faylor2013-06-081-2/+4
|
* * cygwait.cc (cygwait): Remove lock around sig retrieval since this code isChristopher Faylor2013-06-081-4/+2
| | | | | | essentially guarded by thread-specific signal_arrived. * exceptions.cc (_cygtls::handle_SIGCONT): Simplify. Eliminate lock/unlock since code is guarded by signal_arrived.
* * exceptions.cc (_cygtls::handle_SIGCONT): Simplify loop waiting forCorinna Vinschen2013-06-061-6/+12
| | | | | | | sig_handle_tty_stop to wake up. Make sure to unlock before calling yield to avoid starvation of sig_handle_tty_stop. Add comments. * miscfuncs.cc (yield): Explain why yield should never be called under _cygtls::lock conditions. Call SleepEx with 1ms timeout. Explain why.
* * globals.cc (__isthreaded): New global variable. Explain what it'sCorinna Vinschen2013-05-211-0/+3
| | | | | used for. * miscfuncs.cc (thread_wrapper): Set __isthreaded to 1 here.
* Throughout, (mainly in fhandler*) fix remaining gcc 4.7 mismatchYaakov Selkowitz2013-05-011-1/+1
| | | | | | | | | warnings between regparm definitions and declarations. * smallprint.cc (__small_vswprintf): Conditionalize declaration and setting of l_opt for only x86_64. * spawn.cc (child_info_spawn::worker): Remove unused 'pid' variable. * thread.cc (verifyable_object_isvalid): Temporarily define as non-inline with gcc 4.7+, regardless of target.
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-15/+132
|
* * miscfuncs.cc (__import_address): On second thought, the chance that thisChristopher Faylor2013-01-231-1/+1
| | | | pointer could be NULL is very low so don't bother checking for it.
* * miscfuncs.cc (__import_address): Avoid NULL explicitly.Christopher Faylor2013-01-231-1/+1
|
* * miscfuncs.cc (__import_address): Avoid treating random instructions as importChristopher Faylor2013-01-231-0/+5
| | | | | jump. * malloc_wrapper.cc (malloc_init): Remove comment about 64-bit.
* Throughout, change __attribute__ ((regparm (N))) to just __regN. Throughout,Christopher Faylor2013-01-211-3/+3
| | | | | | | | | | | | | | | | | | | (mainly in fhandler*) start fixing gcc 4.7.2 mismatch between regparm definitions and declarations. * gendef: Define some functions to take @ declaration to accommodate _regN defines which use __stdcall. * gentls_offsets: Define __regN macros as empty. * autoload.cc (wsock_init): Remove unneeded regparm attribute. * winsup.h (__reg1): Define. (__reg2): Define. (__reg3): Define. * advapi32.cc (DuplicateTokenEx): Coerce some initializers to avoid warnings from gcc 4.7.2. * exceptions.cc (status_info): Declare struct to use NTSTATUS. (cygwin_exception::dump_exception): Coerce e->ExceptionCode to NTSTATUS. * fhandler_clipboard.cc (cygnativeformat): Redefine as UINT to avoid gcc 4.7.2 warnings. (fhandler_dev_clipboard::read): Ditto.
* * malloc_wrapper.cc: Change 'use_internal_malloc' to 'use_internal' throughout.Christopher Faylor2013-01-201-2/+11
| | | | | | | | | | | | (export_malloc_called): Delete. (internal_malloc_determined): New variable. (malloc_init): Control calculation of internal/external malloc based on 'internal_malloc_determined'. Use import_address() to determine if malloc in user_data is ours or not. * miscfuncs.cc (thread_wrapper): Make static. (__import_address): Define new function. * miscfuncs.h (import_address): New define. (__import_address): Declare new function.
* Revert the reversion and go with implementation described in cgf-000017, withChristopher Faylor2012-12-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | some modifications. * init.cc (dll_entry): Revert previous change. * miscfuncs.cc: Include sigproc.h for exit_thread declaration. * winsup.h (ExitThread): Define as 'exit_thread' to ensure no accidental use. * sigproc.cc (exit_thread): New function. (wait_sig): Handle __SIGTHREADEXIT case. Don't just block rather than returning from this function. * sigproc.h (__SIGTHREADEXIT): New enum. (exit_thread): Declare. * sync.cc (muto::release): Accept a tls command-line argument. * sync.h (muto::release): Accept a tls command-line parameter. Default to &_my_tls. * cygerrno.h (__set_errno): Define as extern so that no function code is ever emitted. * cygserver_ipc.h (cygserver_ipc.h): Ditto. * miscfuncs.h (transform_chars): Ditto. * path.h (has_attribute): Ditto. * security.h (privilege_luid): Ditto. * winsup.h (flush_file_buffers): Ditto.
* * DevNotes: Add entry cgf-000018.Christopher Faylor2012-12-211-2/+1
| | | | | | | | | | | | | | * init.cc (dll_entry): Grab process lock before exiting to ensure that thread doesn't exit before parent if parent is exiting. * _cygtls.cc (_cygtls::call2): Revert previous 2012-12-21 change. * miscfuncs.cc (thread_wrapper): Ditto. * thread.cc (pthread::exit): Ditto. * sigproc.cc (exit_thread): Ditto. (wait_sig): Ditto. * sync.cc (muto::release): Ditto. * sync.h (muto::release): Ditto. * sigproc.h (__SIGTHREADEXIT): Delete enum. (exit_thread): Delete declaration.
* * DevNotes: Add entry cgf-000017.Christopher Faylor2012-12-211-1/+2
| | | | | | | | | | | | | | | | | | * _cygtls.cc (_cygtls::call2): Use new exit_thread function in place of ExitThread. * miscfuncs.cc (thread_wrapper): Ditto. * thread.cc (pthread::exit): Ditto. (pthread_mutex::unlock): Set tid to NULL rather than 0. (pthread_spinlock::unlock): Ditto. * pinfo.cc (commune_process): Actually call lock_process constructor. * sigproc.cc (exit_thread): New function. (wait_sig): Handle __SIGTHREADEXIT case. Don't just block rather than returning from this function. * sigproc.h (__SIGTHREADEXIT): New enum. (exit_thread): Declare. * sync.cc (muto::release): Accept a tls command-line argument. * sync.h (muto::release): Accept a tls command-line parameter. Default to &_my_tls.
* whitespace cleanupChristopher Faylor2012-08-161-27/+27
|
* * miscfuncs.cc (WritePipeOverlapped): Define second parameter LPCVOID,Corinna Vinschen2012-06-271-1/+1
| | | | | rather than PCVOID. * miscfuncs.h (WritePipeOverlapped): Ditto.
* * miscfuncs.cc: Revert change from 2012-02-13 which used theCorinna Vinschen2012-02-151-128/+157
| | | | | | | Windows-provided stack rather than an own stack created in CygwinCreateThread. (struct thread_wrapper_arg): Rename commitsize to stacklimit. (CygwinCreateThread): Rename commitsize to real_stacklimit.
* * miscfuncs.cc (struct thread_wrapper_arg): Convert char * to PBYTE.Corinna Vinschen2012-02-131-161/+132
| | | | | | | | | | | Change related casts throughout. (thread_wrapper): Only do the thread change if the application provided the stack. Otherwise, just use the Windows-provided stack. Set up POSIX guardpage here, if necessary. Move related comment from CygwinCreateThread here. (CygwinCreateThread): Never allocate and set up own stack here. Just compute stack size to reserve and use value in CreateThread call if stack hasn't been provided by the application.
* * Makefile.in (clean): Remove non-existant regexp dir.Corinna Vinschen2012-02-131-23/+44
| | | | | | | | | | | | | | | | | * collate.h: New header. (__collate_range_cmp): Declare. (__collate_load_error): Define. * glob.cc: Pull in latest version from FreeBSD. Simplify and reduce Cygwin-specific changes. * regex/regcomp.c: Include collate.h on Cygwin as well. (__collate_range_cmp): Move from here... * nlsfuncs.cc (__collate_range_cmp): ...to here. * miscfuncs.cc (thread_wrapper): Fix typo in comment. (CygwinCreateThread): Take dead zone of Windows stack into account. Change the way how the stack is commited and how to handle guardpages. Explain how and why. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Change definition. Explain why.
* * miscfuncs.cc (DEFAULT_STACKSIZE): Remove.Corinna Vinschen2012-02-111-21/+14
| | | | | | | | | | | | (CygwinCreateThread): Simplify code by assuming that now stack-related input values are undefined. Set stack protection to PAGE_READWRITE, as is default on Windows. Add lengthy comment to explain POSIX guardpage. * thread.cc (pthread_attr::pthread_attr): Initialize stacksize as PTHREAD_DEFAULT_STACKSIZE. Initialize guardsize as PTHREAD_DEFAULT_GUARDSIZE. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Define. Add comment to explain. (PTHREAD_DEFAULT_GUARDSIZE): Define.
* * miscfuncs.cc (DEFAULT_STACKSIZE): Set to 1 Megs. Drop comment aboutCorinna Vinschen2012-02-101-2/+1
| | | | | | | | | | | | RLIMIT_STACK. * registry.cc (get_registry_hive_path): Expect the user hive path to be never longer than MAX_PATH. Don't prepend native NT path prefix here. Add comment. (load_registry_hive): Prepend native NT path prefix here. Additionally try to load user's classes hive. * uinfo.cc (cygheap_user::env_userprofile): Reduce size of userprofile_env_buf to MAX_PATH. Add comment.
* * miscfuncs.cc (thread_wrapper): Make sure stack is 16 byte alignedCorinna Vinschen2012-01-091-1/+5
| | | | to make gcc-3 compiled pthread applications happy.
* Clean up whitespace.Christopher Faylor2011-12-171-10/+10
|
* * fhandler.h (fhandler_pipe::create): Rename from the misnamedChristopher Faylor2011-11-231-2/+2
| | | | | | | | | | | | | | | | "create_selectable". Change return to DWORD. (fhandler_pty_common::pipesize): New constant. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect create_selectable name change. * miscfuncs.cc (CreatePipeOverlapped): Ditto. * pipe.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create): Rename from the misnamed "create_selectable". Return DWORD. Only set pipe size to default when it is passed in as zero. * fhandler_tty.cc (fhandler_pty_master::setup): Ditto. Use fhandler_pty_common::pipesize rather than a raw constant. * tty.cc (tty::not_allocated): Ditto. * sigproc.cc (sigproc_init): Use create_selectable to create the signal pipe to get a more appropriate message based pipe.
* * fhandler.h (fhandler_pipe::create_selectable): Remove optional argument, takeChristopher Faylor2011-10-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an options argument for CreateNamedPipe/CreateFile. Change handle arguments to expect pointers. (fhandler_fifo::fifo_state): Delete. (fhandler_fifo::dummy_client): Ditto. (fhandler_fifo::open_nonserver): Ditto. (fhandler_fifo::wait_state): Ditto. (fhandler_fifo::raw_write): Ditto. (fhandler_fifo::read_ready): New field. (fhandler_fifo::write_ready): Ditto. (fhandler_fifo::wait): Modify argument. (fhandler_fifo::fifo_name): Add a new argument. (fhandler_fifo::fixup_after_fork): New function. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove initialization of expunged elements. Initialize new handles to NULL. (fhandler_fifo::open_nonserver): Delete. (fnevent): New macro for creating a named event. (fnpipe): New macro for creating a unique named pipe name. (create_pipe): New macro for simplification of named pipe creation. (fhandler_fifo::fifo_name): Use new argument when creating a shared name. (fhandler_fifo::open): Rewrite. Use events to synchronize. (pure_debug_printf): New macro, active only when DEBUGGING. (fhandler_fifo::wait): Rewrite to wait for new fifo events which are supplied as a parameter. (fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect client-side disconnect. (fhandler_fifo::raw_write): Delete. (fhandler_fifo::close): Remove accommodations for expunged fields. Close event handles. (fhandler_fifo::dup): Remove accommodations for expunged fields. Duplicate event handles. (fhandler_fifo::fixup_after_fork): New function. Perform fixups on event handles. (fhandler_fifo::set_close_on_exec): Remove accommodations for expunged fields. Set inheritance for new handle fields. * miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in fhandler_pipe::create_selectable. * tty.cc (tty::not_allocated): Ditto. * pipe.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create_selectable): Accept an extra open_mode argument. Pass arguments by reference and allow opening one end of the pipe at a time. * sys/strace.h (debug_only_printf): Define new macro which calls debug_printf only when DEBUGGING is defined.
* * miscfuncs.cc (CreatePipeOverlapped): New function.Corinna Vinschen2011-08-131-0/+51
| | | | | | | | | | | (ReadPipeOverlapped): Ditto. (WritePipeOverlapped): Ditto. * miscfuncs.h: Declare new functions. * pinfo.cc (commune_process): Call WritePipeOverlapped instead of WriteFile. Set timeout to 1 sec. (_pinfo::commune_request): Call ReadPipeOverlapped instead of ReadFile. Set timeout to 0.5 secs. * sigproc.cc (sig_send): Create pipe using CreatePipeOverlapped.
* * miscfuncs.cc (create_pipe): Delete obsolete function.Christopher Faylor2011-08-121-14/+0
| | | | | * miscfuncs.h (create_pipe): Delete define. * pipe.c (fhandler_pipe::create_selectable): Delete obsolete comment.
* * miscfuncs.cc (yield): Drop thread priority only once.Corinna Vinschen2011-07-071-3/+3
|
* * exceptions.cc (CALL_HANDLER_RETRY_INNER): Rename to reflect differentChristopher Faylor2011-07-061-2/+12
| | | | | | | | | functionality. (CALL_HANDLER_RETRY_OUTER): New define. (setup_handler): Add outer loop to signal handler to try harder to deliver the signal. * miscfuncs.cc (yield): Drop priority and use SleepEx() to force thread rescheduling rather than relying on SwitchToThread().