diff options
Diffstat (limited to 'winsup/cygwin/ChangeLog')
-rw-r--r-- | winsup/cygwin/ChangeLog | 8521 |
1 files changed, 4730 insertions, 3791 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 59a42075d..eaf19dff0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4328 +1,5267 @@ -Mon Oct 8 7:41:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * cygserver.cc (server_request::process): Rename client_request_shm_get to - client_request_shm. - * cygserver_process.cc (process_cache::add): Rename to add_task. - Use process_cleanup instead of process_request. - (process_cache::remove_process): New method. - (process::process): Initialize new members. - (process::~process): New member. - (process::cleanup): New method. - (process::add_cleanup_routine): New method. - (process_request::process): Rename to process_cleanup. - Call the process object's cleanup method and then delete it. - (process_process_param::request_loop): Remove the signalling process. - * cygserver_shm.cc: Globally rename client_request_shm_get to client_request_shm. - (client_request_shm_get::serve): Handle attach request counting. - * cygserver_shm.h: Globally rename client_request_shm_get to client_request_shm. - (class shm_cleanup): New class. - * shm.cc: Globally rename client_request_shm_get to client_request_shm. - (client_request_shm::client_request_shm): New constructor for attach requests. - (shmat): Use it. - * include/cygwin/cygserver_process.h (class process_request): Rename to - process_cleanup. - (class cleanup_routine): New class. - (class process): New members and methods to allow calling back when the process - terminates. - -Thu Oct 4 14:12:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * cygserver.cc (request_loop): Make static. - (main): Use new cache constructor syntax. - Start cache worker threads. - Cleanup the cache at shutdown. - * cygserver_process.cc: Run indent. - (process_cache::process_cache): Add a trigger to use when adding a process. - (process_cache::process): Move process_entry to process. - Insert at the end of the list. - Trigger the request loop when new process's inserted. - (process_cache::process_requests): Do it. - (process_cache::add): New method. - (process_cache::handle_snapshot): New method. - (process::process): Merge in the process_entry fields. - (process::handle): Make a stub function. - (process::exit_code): New method. - (process_request::process): New method. - (process_process_param::request_loop): New method. - * cygserver_shm.cc: New header dependency - threaded_queue.h. - * threaded_queue.cc (threaded_queue::cleanup): Clearer messages. - (queue_process_param::stop): Short spinlock on interruptible threads. - * threaded_queue.h (class threaded_queue): New constructor. - * include/cygwin/cygserver_process.h (process_request): New class. - (process_entry): Remove. - (process): Merge in process_entry. - (process_cache): Inherit from threaded_queue. - -Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * cygserver.cc (class server_process_param): Use new constructor syntax. - * cygserver_process.cc (process_cache::~process_cache): New function. - * threaded_queue.cc: Define condition debug_printf. - Run indent. - (threaded_queue::cleanup): Move queue_process_param guts to a method. - (threaded_queue::process_requests): Ditto. - (queue_process_param::queue_process_param): New method. - (queue_process_param::~queue_process_param): Ditto. - (queue_process_param::start): Ditto. - (queue_process_param::stop): Ditto. - * threaded_queue.h (class queue_process_param): Add support for - interruptible request loops. - * cygwin/include/cygwin/cygserver_process.h (class process_cache): Add - destructor. +2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com> + + GNUify non-GNU formatted functions calls throughout. + +2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (with_strerr): Remove macro. + (server_shmmgr::segment_t::~segment_t): Remove calls to with_strerr. + (server_shmmgr::segment_t::attach): Ditto. + (server_shmmgr::new_segment): Ditto. + * shm.cc (with_strerr): Remove macro. + (client_shmmgr::shmdt): Remove calls to with_strerr. + (client_shmmgr::attach): Ditto. + +2002-09-21 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/sys/ipc.h: Move to "include/cygwin/ipc.h". + * include/sys/msg.h: Move to "include/cygwin/msg.h". + * include/sys/sem.h: Move to "include/cygwin/sem.h". + * include/sys/shm.h: Move to "include/cygwin/shm.h". + * include/cygwin/ipc.h: New file. + * include/cygwin/msg.h: Ditto. + * include/cygwin/sem.h: Ditto. + * include/cygwin/shm.h: Ditto. + * cygserver_shm.h: Update includes. + * msg.cc: Ditto. + * sem.cc: Ditto. + +2002-09-21 Conrad Scott <conrad.scott@dsl.pipex.com> + + * safe_memory.h (safe_delete): Make a templated function. + * cygserver.cc (~server_request): Update use of safe_delete. + (main): Ditto. + * cygserver_client.cc (client_request::handle_request): Ditto. + (client_request::make_request): Ditto. + * cygserver_process.cc (~process_cleanup): Ditto. + (process::remove): Ditto. + (process::cleanup): Ditto. + (process_cache::process): Ditto. + * cygserver_shm.cc (server_shmmgr::segment_t::detach): Ditto. + (server_shmmgr::delete_segment): Ditto. + * shm.cc (client_shmmgr::shmdt): Ditto. + * threaded_queue.cc (~threaded_queue): Ditto. + (threaded_queue::worker_loop): Ditto. + +2002-08-29 Conrad Scott <conrad.scott@dsl.pipex.com> + + * safe_memory.h: Replace #include <new> with an explicit + definition of the placement new operator. + (safe_delete): Remove unnecessary ## operator. + +2002-07-28 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (class server_shmmgr): Remove `cleanup_t' + friend declaration. + (cleanup_t::cleanup_t): Use the segment's shmid as the key rather + than the segment pointer itself. + (cleanup_t::segptr): Remove method. + (cleanup_t::shmid): New method. + (cleanup_t::cleanup): Update for new key value. + (server_shmmgr::find (segment_t *)): Remove method. + * include/cygwin/cygserver_process.h (cleanup_routine::key): Make + method const. + +2002-07-27 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver_process.h + (cleanup_routine::_key): New field. + (cleanup_routine::cleanup_routine): Initialise new field with new + argument. + (cleanup_routine::operator==): New method. + (cleanup_routine::key): New method. + (cleanup_routine::cleanup): Make argument non-const. + (process::is_active): New method. + (process::remove): Ditto. + (process::check_exit_code): Rename method. + * cygserver_process.cc (process::add): Reorganize code. + (process::remove): New method. + (process::check_exit_code): Rename method. + (process::cleanup): Use new `process::is_active' method. + (process_cache::process): Ditto. + (process_cache::sync_wait_array): Ditto. + (process_cache::check_and_remove_process): Ditto. + * cygserver_shm.cc (server_shmmgr): Make `cleanup_t' a friend. + (segment_t::detach): Make argument non-const. Remove cleanup + object from client if appropriate. + (cleanup_t::_segptr): Remove field. + (cleanup_t::cleanup_t): Initialise parent explicitly. Remove + field. + (cleanup_t::segptr): New method. + (cleanup_t::cleanup): Add error checking and reporting. + (server_shmmgr::shmdt): Make argument non-const. + (server_shmmgr::find (segment_t *)): New method. -Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-07-27 Conrad Scott <conrad.scott@dsl.pipex.com> - * cygserver_client.cc: New flag allow_daemon to disable the daemon completely. - (cygserver_request): Check it. - (cygserver_init): Ditto. - * environ.cc (parse_thing): Add (no)daemon option. + * cygserver.cc (client_request_shutdown::client_request_shutdown): + Comment out verbose tracing statement. + * cygserver_client.cc + (client_request_get_version::client_request_get_version): Ditto. + (client_request_attach_tty::client_request_attach_tty): Ditto. + * cygserver_shm.cc (client_request_shm::client_request_shm): + Ditto. -Tue Oct 2 23:00:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-07-27 Conrad Scott <conrad.scott@dsl.pipex.com> - * shm.cc: Update to handle include changes from HEAD. + * cygserver_transport_pipes.cc (transport_layer_pipes::listen): + Set `_is_listening_endpoint' appropriately. -Tue Oct 2 16:06:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-07-27 Conrad Scott <conrad.scott@dsl.pipex.com> - * Makefile.in: Remove cygserver_shm.o from cygwin1.dll. - Rename cygserver_shm_outside.o to cygserver_shm.o. - * cygserver.cc (server_request::process): Use the new client_request - constructor. - * cygserver_client.cc: Remove the #ifdef's stubs for the server method - within cygwin. - (client_request_attach_tty::client_request_attach_tty): Use the new - client_request constructor. - (client_request_shutdown::client_request_shutdown): Ditto. - (client_request::client_request): Ditto. - * cygserver_shm.cc (client_request_shm_get::serve): Remove the - #ifdef'd stub for in-cygwin builds. - (client_request_shm_get::client_request_shm_get): Use the new - client_request constructor, and remove the in-cygwin variants. - * cygserver_shm.h (class client_request_shm_get): #ifndef test the - serve method - it's only used in cygserver. - * shm.cc (client_request_shm_get::client_request_shm_get): New function. - * include/cygwin/cygserver.h (request_header): New constructor. - (class client_request): Use it. - New constructor accepting the header size. - #ifndef test the server method - it's only used within cygserver. - (client_request_get_version): #ifdef test the server method. - (client_request_shutdown): Ditto. - (client_request_attach_tty): Ditto. - -Tue Oct 2 9:57:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * Makefile.in: add threaded_queue.o to cygserver.exe. - * cygserver.cc: Include threaded_queue.h - (class server_request): Inherit from queue_request. - (class server_process_param): Inherit from queue_process_param. - (class server_request_queue): Inherit from threaded_queue. - (request_loop): Adjust for new types. - (server_request_queue::process_requests): Remove guts to - threaded_queue::process_requests. - (server_request::server_request): Adjust for new types. - (worker_function): Delete. - (server_request_queue::create_workers): Delete. - (server_request_queue::cleanup): Delete. - (server_request_queue::add): Move guts to threaded_queue::add. - * threaded_queue.cc: New file. - * threaded_queue.h: New file. - -Mon Oct 1 12:38:00 2001 Robert Collins <rbtcollins@hotmail.com> + * include/cygwin/cygserver_transport.h + (transport_layer_base::listen): Change return type. + (transport_layer_base::connect): Ditto. + * include/cygwin/cygserver_transport_pipes.h + (transport_layer_pipes::listen): Change return type. + (transport_layer_pipes::connect): Ditto. + (transport_layer_pipes::_sec_none_nih): Remove unused field. + (transport_layer_pipes::_is_listening_endpoint): New field. + * cygserver_transport_pipes.cc: Synchronize with sockets code. + (transport_layer_pipes::transport_layer_pipes): Initialise new + field. Separate out asserts. + (transport_layer_pipes::listen): Change return type. Add asserts. + (transport_layer_pipes::accept): Add asserts. + (transport_layer_pipes::read): Change conditional to an assert. + Add assert. + (transport_layer_pipes::write): Ditto. + (transport_layer_pipes::connect): Change return type. Change + conditional to an assert. Add asserts. Rationalize error code + slightly. + (transport_layer_pipes::impersonate_client): Add asserts. + * include/cygwin/cygserver_transport_sockets.h + (transport_layer_sockets::listen): Change return type. + (transport_layer_sockets::connect): Ditto. + (transport_layer_sockets::_addr): Change type of field. + (transport_layer_sockets::_addr_len): Ditto. + (transport_layer_sockets::_is_accepted_endpoint): New field. + (transport_layer_sockets::_is_listening_endpoint): Ditto. + * cygserver_transport_sockets.cc + (MAX_CONNECT_RETRY): New constant. + (transport_layer_sockets::transport_layer_sockets): Initialise new + fields. Only initialise the socket address where necessary. + (transport_layer_sockets::listen): Change return type. Rewrite. + (transport_layer_sockets::accept): Add asserts. Add tracing + statements. Use a local variable to hold the accepted address. + (transport_layer_sockets::close): Add tracing statements. Unlink + the UNIX domain socket file as appropriate. Close the socket + cleanly. + (transport_layer_sockets::read): Rewrite method. + (transport_layer_sockets::write): Ditto. + (transport_layer_sockets::connect): Change return type. Rewrite. + * cygserver.cc (server_submission_loop::request_loop): Run the + listening thread at high priority with special handling for + shutdown. + (main): Print the request error code rather than errno in shutdown + request code. Install signal handlers with sigaction(2) to avoid + setting SA_RESTART. Check value of the listen method call, now it + has one. + * cygserver_client.cc (client_request::make_request): Check new + return value on connect method call. + +2002-07-27 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver_transport_pipes.h + (cygserver_transport_pipes::_sd): Rename field. + (cygserver_transport_pipes::_sec_none_nih): Ditto. + (cygserver_transport_pipes::_sec_all_nih): Ditto. + (cygserver_transport_pipes::_pipe_name): Ditto. + (cygserver_transport_pipes::_hPipe): Ditto. + (cygserver_transport_pipes::_is_accepted_endpoint): Ditto. + * cygserver_transport_pipes.cc + (transport_layer_pipes::transport_layer_pipes): Rename fields. + (transport_layer_pipes::init_security): Ditto. + (transport_layer_pipes::listen): Ditto. + (transport_layer_pipes::accept): Ditto. + (transport_layer_pipes::close): Ditto. + (transport_layer_pipes::read): Ditto. + (transport_layer_pipes::write): Ditto. + (transport_layer_pipes::connect): Ditto. + (transport_layer_pipes::impersonate_client): Ditto. + (transport_layer_pipes::revert_to_self): Ditto. + * include/cygwin/cygserver_transport_sockets.h + (cygserver_transport_sockets::_fd): Rename field. + (cygserver_transport_sockets::_addr): Ditto. + (cygserver_transport_sockets::_addr_len): Ditto. + * cygserver_transport_sockets.cc + (transport_layer_sockets::transport_layer_sockets): Rename fields. + (transport_layer_sockets::listen): Ditto. + (transport_layer_sockets::accept): Ditto. + (transport_layer_sockets::close): Ditto. + (transport_layer_sockets::read): Ditto. + (transport_layer_sockets::write): Ditto. + (transport_layer_sockets::connect): Ditto. + +2002-07-27 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (with_strerr): Fix use of %p format. + * shm.cc (client_shmmgr::shmat): Ditto. + (client_shmmgr::shmctl): Ditto. + (client_shmmgr::shmdt): Ditto. + (client_shmmgr::attach): Ditto. + +2002-07-14 Christopher Faylor <cgf@redhat.com> + + * woutsup.h (system_printf): Remove extraneous semicolon from macro + definition. - * cygserver.cc (client_request::serve): New function. - * cygserver_process.cc: Inlude <pthread.h> for pthread_once. - (process_cache::process_cache): Initialise a crtiical section for write access. - (process_cache::process): Use the critical section. Also add missing entries to - the cache. - (do_process_init): New function to initalise class process static variables. - (process::process): Ensure that the process access critical section is initialised. - (process::handle): Close the handle of old process's when they have terminated - and we are returning the handle for a process with the same pid. - * cygserver_shm.cc: Run indent. - Include cygserver_process.h to allow process cache functionality. - (client_request_shm_get::serve): New parameter for process cache support. - Use the process cache, not OpenProcess to get a handle to the originating process. - Fix a handle leak with token_handle. - * cygserver_shm.h (class client_request_shm_get): Update ::serve for process cache support. - * cygserver_transport_pipes.cc: Redefine debug_printf to be conditional on DEBUG. - * include/cygwin/cygserver.h: Do not implement client_request::serve in the header. - * include/cygwin/cygserver_process.h (class process_cache): Add a write access critical section to prevent races when requests from a multithreaded application arrive. +2002-07-14 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_transport_pipes.cc + (transport_layer_pipes::connect): Use ProtectHandle in DLL code. + (transport_layer_pipes::close): Use ForceCloseHandle in DLL code. + +2002-07-13 Nicholas Wourms <nwourms@netscape.com> + + * threaded_queue.h (class queue_submission_loop): Correct friend + declaration for GCC 3.1.1. + * include/cygwin/cygserver_process.h (class process): Ditto. + (class process_cache): Ditto. + +2002-07-12 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (server_shmmgr::shmdt): Only call + delete_segment if the segment exists [sic]. + +2002-07-12 Conrad Scott <conrad.scott@dsl.pipex.com> + + * safe_memory.h: Include <new> rather than <new.h> for gcc 3. + +2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + + * safe_memory.h: New file extracted from "woutsup.h". + * woutsup.h: Move the "safe" new/delete macros into the new + "safe_memory.h" header file and include that here. + * cygserver_client.cc: Explicitly include "safe_memory.h" for + client-side code. + (client_request::make_request): Use the "safe" new/delete macros + unconditionally, i.e. use them on the client side as well as on + the server side. + * cygserver_transport.cc: Explicitly include "safe_memory.h" for + client-side code. + (create_server_transport): Use the "safe" new/delete macros + unconditionally, i.e. use them on the client side as well as on + the server side. + * shm.cc: Include "safe_memory.h". + (client_shmmgr::instance): Use the "safe" new/delete macros. + (client_shmmgr::shmdt): Ditto. + (client_shmmgr::new_segment): Ditto. + +2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_process (process::process): Add the client's cygpid + and winpid to all tracing statements as appropriate. + (process::exit_code): Ditto. + (process_cache::check_and_remove_process): Ditto. + * cygserver_shm.cc (server_shmmgr::shmat): Ditto. + (server_shmmgr::shmdt): Ditto. + (server_shmmgr::shmctl): Add a process object argument and remove + the explicit cygpid argument. Add the client's cygpid and winpid + to all tracing statements as appropriate. + (server_shmmgr::shmget): Ditto. + (client_request_shm::serve): Update for the new signature of the + shmctl and shmget methods. + +2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc (client_request_shutdown::serve): Don't set the + shutdown flag directly, but send a SIGINT, as the signal handler + sets the flag and the signal breaks the pause(2) in the main loop. + (print_usage): Add new options. + (main): Add new --cleanup-threads and --request-threads options to + set the number of threads used by the daemon. Use pause(2) rather + the win32 Sleep in the main loop. + * shm.cc (shmat): Add sigframe. + (shmctl): Ditto. + (shmdt): Ditto. + (shmget): Ditto. + +2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc: Automatically detach processes from any + segments they are attached to at exit. + (class server_shmmgr::attach_t): New class. + (server_shmmgr::segment_t::IS_DELETED): Rename and make private. + (server_shmmgr::segment_t::_sequence): Make private. + (server_shmmgr::segment_t::_flg): Ditto. + (server_shmmgr::segment_t::_hFileMap): Ditto. + (server_shmmgr::segment_t::_attach_head): New private field. + (server_shmmgr::segment_t::segment_t): Initialise new fields. + Make non-inline. + (server_shmmgr::segment_t::~segment_t): New method. + (server_shmmgr::segment_t::is_deleted): Ditto. + (server_shmmgr::segment_t::is_pending_delete): Ditto. + (server_shmmgr::segment_t::mark_deleted): Ditto. + (server_shmmgr::segment_t::attach): Ditto. + (server_shmmgr::segment_t::detach): Ditto. + (server_shmmgr::segment_t::find): Ditto. + (class server_shmmgr::cleanup_t): New class. + (server_shmmgr::_shm_atts): New private field. + (server_shmmgr::shmat): Add a process object argument to replace + the removed process_cache, cygpid and winpid arguments. Remove + the process_cache manipulations. Move body of code to the + segment_t::attach method. Increment _shm_atts when required. + Update tracing statements. + (server_shmmgr::shmdt): Add a process object argument to replace + the removed cygpid argument. Move body of code to the + segment_t::detach method. Decrement _shm_atts when required. + Update tracing statements. + (server_shmmgr::shmget): Use the new segment_t::is_deleted method. + (server_shmmgr::server_shmmgr): Initialise the new _shm_atts + field. + (server_shmmgr::delete_segment): Remove the CloseHandle code, as + this is now done in the segment_t destructor. + (client_request_shm::serve): Look up the client's process object + and pass to the server_shmmgr::shmat and server_shmmgr::shmdt + methods rather than passing the cache, winpid and cygpid. + * cygserver_process.h: Add a cygpid to the process object to make + it more useful and then pass process objects rather than winpids + where possible. + (cleanup_routine::cleanup): Change argument to be a pointer to a + process object. + (class process): Re-order fields for no discernible reason. + (process::_cygpid): New field. + (process::process): Add a cygpid argument. + (process::winpid): New method. + (process::cygpid): Ditto. + (process::add): Make public, as it always should have been. + (process_cache::process): Add a cygpid argument. + * cygserver_process.cc (process::process): Add a cygpid argument + and use it to initialise the `_cygpid' field. Re-order + initialisers to match new field order. + (process::cleanup): Pass `this' rather than just the winpid to + cleanup_routine::cleanup. + (process_cache::process): Add a cygpid argument and pass it to the + process object constructor. + * include/sys/shm.h (shmatt_t): Make unsigned as per SUSv3. + (shm_info::shm_atts): New field. + +2002-07-11 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (class server_shmmgr::segment_t): Add `_' + prefix to the names of all fields. + +2002-07-10 Conrad Scott <conrad.scott@dsl.pipex.com> + + * msg.cc: New file of stub functions, no functionality. + * sem.cc: Ditto. + * shm.cc (client_shmmgr::shmctl): Add support for an out shm_info + buffer for the SHM_INFO command. + (client_shmmgr::shmget): Use %X to print keys. + * include/sys/ipc.h: Comment all fields and values. + (IPC_PRIVATE): Change to be non-negative. + * include/sys/msg.h: New file with SUSv3 and ipcs(8) interfaces. + * include/sys/sem.h: Ditto. + * include/sys/shm.h: Comment all fields and values. + (struct shm_info): New struct. + * cygserver_shm.h (client_request_shm::shminfo): Rename. + (client_request_shm::shm_info): New method. + (client_request_shm::_parameters.out.hFileMap): Move into union. + (client_request_shm::_parameters.out.shminfo): Rename. + (client_request_shm::_parameters.out.shm_info): New field. + * cygserver_shm.cc (server_shmmgr::_shm_ids): Rename. + (server_shmmgr::_shm_tot): New field. + (server_shmmgr::shmctl): Rename `out_shminfo' argument. Add + `out_shm_info' argument. Fill in the `out_shm_info' argument in + the SHM_INFO command. + (server_shmmgr::shmget): Check `shmflg' against the mode of + existing segments as per Stevens 1990, p. 123. + (server_shmmgr::server_shmmgr): Initialise the new `_shm_tot' + field. + (server_shmmgr::new_segment): Set ENOMEM if CreateFileMapping + fails. Pass `size' to new_segment. + (server_shmmgr::new_segment): Add size argument and use it to + check against and update the new `_shm_tot' field. + (server_shmmgr::delete_segment): Update the new `_shm_tot' field. + * Makefile.in (DLL_OFILES): Add new DLL object files. + +2002-07-09 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_transport_pipes.cc: The main change is to make the + client try harder to connect to the server if it's previously + connected, and so has good grounds for believing that the server + is running. + (MAX_WAIT_NAMED_PIPE_RETRY): Change to be an enumerator. + (WAIT_NAMED_PIPE_TIMEOUT): Ditto. + (transport_layer_pipes::accept): Use interlocked operators on + `pipe_instance'. + (transport_layer_pipes::close): Rearrange so that FlushFileBuffers + and DisconnectNamedPipe are only called for accepted endpoints. + Use interlocked operators on `pipe_instance'. + (transport_layer_pipes::read): Use set_errno where required. + (transport_layer_pipes::write): Ditto. + (transport_layer_pipes::connect): Add local static variable + `assume_cygserver'. Set it if a connection is made to cygserver, + clear it if a connection is not made even after retrying. If set, + ignore all errors from CreateFile and retry the connection. Catch + the situation where WaitNamedPipe fails to wait [sic] and add a + `Sleep (0)' so that the server gets a chance to run. + +2002-07-03 Conrad Scott <conrad.scott@dsl.pipex.com> + + * dcrt0.cc: Only check for cygserver if and when required. + (dll_crt0_1): Remove call to `cygserver_init ()'. + * fhandler_tty.cc (fhandler_tty_slave::open): Change the cygserver + logic to allow for the fact that `cygserver_init ()' may not yet + have been called. + (fhandler_tty_slave::cygserver_attach_tty): Tweak the cygserver + request logic to conform to the practice elsewhere in the code. + * tty.cc (tty::common_init): Add an explicit call to + `cygserver_init ()' if it hasn't already been called. + * include/cygwin/cygserver.h (CYGSERVER_UNAVAIL): Rename from + `CYGSERVER_DEAD'. + (client_request_get_version::check_version): Make available in + cygserver as well the DLL. + (check_cygserver_available): Ditto. Remove `check_version_too' + argument. + (cygserver_init): Ditto. And likewise. + * cygserver_client.cc (client_request_get_version::check_version): + Make available in cygserver as well the DLL. + (client_request::make_request): This may now be called without + `cygserver_init ()' having been called first. Detect this and + call it as required. Add tracing. + (check_cygserver_available): Make available in cygserver as well + the DLL. Remove `check_version_too' argument and always check the + version information. And since this is called from within + `cygserver_init ()', force `cygserver_running' before calling + `client_request::make_request ()'. + (cygserver_init): Make available in cygserver as well the DLL. + Remove `check_version_too' argument. + +2002-07-03 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc: Implement the ipcs(8) interfaces, IPC_INFO, + SHM_STAT and SHM_INFO. + (server_shmmgr::segment_t::sequence): New static field. + (server_shmmgr::segment_t::key): Remove field, use the new + ds.shm_perm.key field instead. + (server_shmmgr::segment_t::shmid): Remove field. + (server_shmmgr::segment_t::intid): New field. + (server_shmmgr::segment_t::segment_t): Use the `key' argument to + initialise `ds.shm_perm.key'. Change from using `shmid' to + `intid'. + (server_shmmgr::_shmseg_cnt): Renamed from `_shmid_cnt'. + (server_shmmgr::_intid_max): Renamed from `_shmid_max. + (server_shmmgr::shmat): Move the out arguments to the start of the + argument list. Rename the `pid' argument as `cygpid'. Add + tracing. Pass an intid to `find ()', not a shmid. + (server_shmmgr::shmctl): Add separate out arguments. Rename the + `pid' argument as `cygpid'. Add support for the ipcs(8) + interfaces. Add tracing. Pass an intid to `find ()', not a + shmid. + (server_shmmgr::shmdt): Rename the `pid' argument as `cygpid'. + Add tracing. Pass an intid to `find ()', not a shmid. + (server_shmmgr::shmget): Add a separate out arguments. Rename the + `pid' argument as `cygpid'. Add tracing. + (server_shmmgr::server_shmmgr): Update for new field names. + (server_shmmgr::find_by_key): Update for the new `ds.shm_perm.key' + field. + (server_shmmgr::find): Update to use the new `segment_t::intid' + field. + (server_shmmgr::new_segment): Rename the `pid' argument as + `cygpid'. Check that the requested size is within bounds. Handle + new error result from `new_segment (key, HANDLE)'. + (server_shmmgr::new_segment): Work with intids, not shmids. Check + that the new intid is within bounds. Update for new field names. + (server_shmmgr::delete_segment): Pass an intid to `find ()', not a + shmid. Update for new field names. + (client_request_shm::serve): Check that the incoming message + length is the size of the `_parameters.in' struct, not of the + whole in/out parameter union. Likewise, set the outgoing message + length to the size of the `_parameters.out' struct. Update for + the new server_shmmgr interfaces. + * include/sys/ipc.h (ipc_perm::key): New field. + * include/sys/shm.h (SHM_INFO): New constant. + * cygserver_ipc.h (IPCMNI): New constant. + (ipc_int2ext): Add `sequence' argument and munge this into the + external ipc id. + (ipc_ext2int_subsys): Unmunge the sequence number from the + external ipc id. + (ipc_ext2int): Ditto. + (ipc_inc_id): Remove. + (ipc_dec_id): Remove. + * cygserver_shm.h (SHMMAX): New constant. + (SHMMIN): Ditto. + (SHMMNI): Ditto. + (SHMSEG): Ditto. + (SHMALL): Ditto. + (client_request_shm::_parameters): Re-arrange as a union of two + separate structs, one for in arguments, the other for out. + (client_request_shm::shmid): Update for the new parameter layout. + (client_request_shm::ds): Ditto. + (client_request_shm::info): New method. + * shm.cc (client_shmmgr::_shmat_cnt): New static field. + (client_shmmgr::shmat): Add locking. Add tracing. + (client_shmmgr::shmctl): Update for ipcs(8) commands. Add + tracing. Add more argument checking. + (client_shmmgr::shmdt): Add locking. Add tracing. Update the new + `_shmat_cnt' field. + (client_shmmgr::shmget): Add tracing. + (client_shmmgr::fixup_shms_after_fork): Add tracing. Add + consistency checking. + (client_shmmgr::attach): Add more tracing. + (client_shmmgr::new_segment): Update the new `_shmat_cnt' field. + (client_request_shm::client_request_shm): Update for the new + parameter layout. Set the outgoing message length to the size of + the `_parameters.in' struct, not of the whole in/out parameter + union. + +2002-07-02 Conrad Scott <conrad.scott@dsl.pipex.com> + + * shm.cc: Remove the use of a static client_shmmgr object. + (client_shmmgr::_instance): New static variable. + (client_shmmgr::instance): Allocate a new shmmgr on the heap, + rather than using a local static object. + +2002-07-01 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_transport.cc (create_server_transport): Fix + cut-and-paste error. + +2002-06-30 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_client.cc (client_request::handle_request): Don't + bother with the client request activity marker when compiled with + debugging output. + +2002-06-30 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_transport_pipes.cc + (MAX_WAIT_NAMED_PIPE_RETRY): New constant. + (WAIT_NAMED_PIPE_TIMEOUT): Ditto. + (transport_layer_pipes::close): The `pipe' field is now either + NULL or a valid handle, and it should never have the value + `INVALID_HANDLE_VALUE'. + (transport_layer_pipes::read): Ditto. + (transport_layer_pipes::write): Ditto. + (transport_layer_pipes::connect): Ditto. + (transport_layer_pipes::impersonate_client): Ditto. + (transport_layer_pipes::connect): Ditto. New, but still bogus, + retry logic. + +2002-06-30 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (server_shmmgr::server_shmmgr): All fields have + to be initialized now that the singleton is no longer static. + +2002-06-30 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc (server_shmmgr::_instance): New static field. + (server_shmmgr::_instance_once): Ditto. + (server_shmmgr::initialise_instance): New static method. + (server_shmmgr::instance): Use a pthread_once_t rather than + relying on a local static variable. + +2002-06-30 Conrad Scott <conrad.scott@dsl.pipex.com> + + * woutsup.h: Remove all uses of the C++ new and delete operators + throughout cygserver until they are fully thread-safe. + (safe_new0): New macro to replace the C++ new operator. + (safe_new): Ditto. + (safe_delete): New macro to replace the C++ delete operator. + * cygserver_client.cc (client_request::handle_request): Replace + all uses of the C++ new and delete operators with the new macros + from "woutsup.h". + (client_request::make_request): Ditto. + * cygserver_process.cc (~process_cleanup): Ditto. + (process::cleanup): Ditto. + (process_cache::process): Ditto. + (process_cache::check_and_remove_process): Ditto. + * cygserver_shm.cc (server_shmmgr::new_segment): Ditto. + (server_shmmgr::delete_segment): Ditto. + * cygserver_transport.cc (create_server_transport): Ditto. + * cygserver_transport_pipes.cc + (transport_layer_pipes::accept): Ditto. + * cygserver_transport_sockets.cc + (transport_layer_sockets::accept): Ditto. + * threaded_queue.cc (~threaded_queue): Ditto. + (threaded_queue::worker_loop): Ditto. + (threaded_queue::stop): Replace sleep(3) with win32 Sleep. + * cygserver.cc (~server_request): Replace all uses of the C++ new + and delete operators with the new macros from "woutsup.h". + (server_submission_loop::request_loop): Ditto. + (main): Ditto. Replace sleep(3) with win32 Sleep. Replace + iostreams with FILEs. + (print_usage): Replace iostreams with FILEs. + (print_version): Ditto. + +2002-06-30 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_transport_sockets.cc + (transport_layer_sockets::accept): Rename local variable + `accept_fd' to avoid shadowing the `fd' field. + +2002-06-29 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygwin_ipc.h: Moved (back) to "include/sys/ipc.h". + * cygwin_shm.h: Moved (back) to "include/sys/shm.h". + * include/sys/ipc.h: New file. + * include/sys/shm.h: New file. + * cygserver_shm.h: Update for new header file locations. + * ipc.cc: Ditto. -Sun Sep 30 23:41:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-06-28 Conrad Scott <conrad.scott@dsl.pipex.com> - * Makefile.in: Add cygserver_process.o to cygserver.exe. - * cygserver.cc: Include signal.h and cygwin_version.h. - Define debug_printf as a macro. - Define DEBUG to a value. - (client_request_attach_tty::serve): Add beginning of process cache support. - Change from #ifdef DEBUG to work with new DEBUG style. - (client_request_get_version::serve): Add beginning of process cache support. - (class server_request): New prototype for support of process cache. - (class queue_process_param): New class to allow request loop threading. - (class server_request_queue): Add beginning of process cache support. - Allow request loop threading. - (request_loop): Thread function for request loops. - (server_request_queue::process_requests): Initiator for threaded request loops. - (client_request_shutdown::serve): Add beginning of process cache support. - (server_request::server_request): Ditto. - (server_request::process): Use debug_printf. Add beginning of process cache support. - (server_request_queue::cleanup): Kill off any request loop threads. - (server_request_queue::add): Add beginning of process cache support. - (handle_signal): Trigger a shutdown. - (main): Print out some useful info at startup - version, date time. - Add process cache support. - Spawn a separate thread for the transport request loop, thus allowing concurrent - support for multiple transports. - * cygserver_client.cc (client_request_get_version::serve): Add process cache support. - (client_request_attach_tty::serve): Add process cache support. - (client_request_shutdown::serve): Add process cache support. - * cygsserver_process.cc: New file with the process cache support. - * cygserver_shm.cc: Redefine debug_printf to allow conditional output. - * cygwin.din: Export shmdt(). - * shm.cc: Run indent. - Update FIXME's. - (shmdt): New function. - * include/cygwin/cygserver.h (class client_request): Add process cache support. + * cygserver_client.cc (client_request::make_request): Comment out + a verbose tracing statement. + * cygserver_process.cc (process_cache::sync_wait_array): Fix + broken assert. + * include/cygwin/cygserver.h (class client_request): Remove excess + use of `class' qualifier in declarations. (class client_request_get_version): Ditto. (class client_request_shutdown): Ditto. (class client_request_attach_tty): Ditto. - * include/cygwin/cygserver_process.h: New header for process cache support. -Sun Sep 30 8:52:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-06-28 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_ipc.h: New file. + * cygserver_shm.h: Re-written from scratch. + * cygserver_shm.cc: Ditto. + * shm.cc: Ditto. + +2002-06-28 Conrad Scott <conrad.scott@dsl.pipex.com> + + * threaded_queue.h (class queue_request): Re-write. + (threaded_queue_thread_function): Remove. + (class queue_process_param): Remove. + (class threaded_queue): Re-write. + (class queue_submission_loop): New version of the old + `queue_process_param' class. + (TInterlockedExchangePointer): New templated function. + (TInterlockedCompareExchangePointer): Ditto. + * threaded_queue.cc (worker_function): Remove. + (class threaded_queue): Re-write. + (class queue_process_param): Remove. + (class queue_submission_loop): New version of the old + `queue_process_param' class. + * include/cygwin/cygserver_process.h (process_cleanup): Re-write. + (class process_process_param): Remove. + (class cleanup_routine): Re-write. + (class process): Re-write. + (class process_cache): Re-write. + * cygserver_process.cc (process_cleanup): Re-write. + (class process_process_param): Remove. + (class cleanup_routine): Re-write. + (class process): Re-write. + (class process_cache): Re-write. + * cygserver.cc (request_count): Remove unused variable. + (class server_request): Move methods inline. + (class server_process_param): Remove. + (class server_request_queue): Remove. + (request_queue): Move into `main ()' and change type to + `threaded_queue'. + (request_loop): Remove. + (class server_submission_loop): New version of the old + `server_process_param' class. + (shutdown_server): New variable. + (client_request_shutdown::serve): Set `shutdown_server' to trigger + shutdown. + (handle_signal): Ditto. + (main): Install signal handler for SIGINT rather than SIGQUIT. + Use new interfaces for the `request_queue' and the `cache'. + Create a `server_submission_loop' and add to the `request_queue'. + Add check for the `shutdown_server' variable to the main loop. + * cygserver_shm.cc (client_request_shm::serve): Release the + process object after use. + +2002-06-27 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_client.cc (client_request::handle_request): Correct + tracing statement. + * cygserver_transport_pipes.cc: Remove local definition of + FILE_FLAG_FIRST_PIPE_INSTANCE constant. + * cygwin_ipc.h: Update copyright notice. + * cygwin_shm.h: Ditto. + * woutsup.h: Add definition of _WIN32_WINNT. + +2002-06-24 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_client (client_request::make_request): Replace my + inappropriate use of set_errno () with error_code () throughout. + +2002-06-24 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver.h: Add forward declarations of class + transport_layer_base and class process_cache to reduce + dependencies between header files. + * include/cygwin/cygserver_process.h: Add include of + "threaded_queue.h". + * cygserver.cc: Remove unnecessary cygserver header files. + * cygserver_client.cc: Ditto. + * cygserver_process.cc: Ditto. + * cygserver_shm.cc: Ditto. + * cygserver_shm.h: Ditto. + * cygserver_transport_pipes.cc: Ditto. + * dcrt0.cc: Ditto. + * fhandler_tty.cc: Ditto. + * tty.cc: Ditto. - * include/cygwin/cygserver_transport.h: Add copyright header. - * include/cygwin/cygserver_transport_pipes.h: Ditto. +2002-06-24 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.h: Replace <sys/shm.h> with "cygwin_shm.h" after + merge from HEAD. + * cygwin_ipc.h: Update with changes to include/sys/ipc.h lost in + merge from HEAD. + * cygwin_shm.h: Ditto. + +2002-06-21 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc: The tests for a duplicate server instance are now + the responsibility of the transport layer. + (request_loop): Use new `recoverable' flag in call to + `cygserver_transport::accept ()' and shutdown on an unrecoverable + error. + (main): Never call `cygserver_init ()'. Fake `cygserver_running' + just for sending a shutdown request. + * cygserver_client.cc (client_request::send): Comment out + message-size tracing statements as verbose. + (client_request::handle): Ditto. + (client_request_get_version::check_version): #ifdef as DLL-only. + (check_cygserver_available): Ditto. + (cygserver_init): Ditto. + * include/cygwin/cygserver.h + (client_request_get_version::check_version): #ifdef as DLL-only. + (check_cygserver_available): Ditto. + (cygserver_init): Ditto. + * include/cygwin/cygserver_transport.h + (transport_layer_base::impersonate_client): #ifdef as + cygserver-only. + (transport_layer_base::revert_to_self): Ditto. + (transport_layer_base::listen): Ditto. + (transport_layer_base::accept): Ditto. Add a `recoverable' out + flag for error handling. * include/cygwin/cygserver_transport_sockets.h: Ditto. + * include/cygwin/cygserver_transport_pipes.h: Ditto. + (transport_layer_pipes): Change type of the `pipe_name' field. + Remove the `inited' field, as unnecessary. Add new + `is_accepted_endpoint' field. + * include/cygwin/cygserver_transport.cc + (transport_layer_base::impersonate_client): #ifdef as + cygserver-only. + (transport_layer_base::revert_to_self): Ditto. + * include/cygwin/cygserver_transport_sockets.cc + (transport_layer_sockets::listen): #ifdef as cygserver-only. + (transport_layer_sockets::accept): #ifdef as cygserver-only. + Analyse any errno from `accept ()' and set `recoverable' as + appropriate. + * cygserver_transport_pipes.cc: Add local #define of + `FILE_FLAG_FIRST_PIPE_INSTANCE'. + (pipe_instance_lock_once): New variable. + (pipe_instance_lock): Ditto. + (pipe_instance): Ditto. + (initialise_pipe_instance_lock): New function. + (transport_layer_pipes::transport_layer_pipes): Change + initialization of `pipe_name'. Initialize `is_accepted_endpoint' + as appropriate. Remove use of `inited'. + (transport_layer_pipes::impersonate_client): #ifdef as + cygserver-only. + (transport_layer_pipes::revert_to_self): Ditto. + (transport_layer_pipes::listen): Ditto. + (transport_layer_pipes::accept): Ditto. Keep track of how often + many named pipes have been created, in the `pipe_instance' + variable, and pass the `FILE_FLAG_FIRST_PIPE_INSTANCE' flag on the + open of the first instance. Analyse the error code from + `CreateNamedPipe ()' and set the `recoverable' flag as + appropriate. + (transport_layer_pipes::close): Update the `pipe_instance' count. -Sat Sep 29 20:40:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-06-18 Conrad Scott <conrad.scott@dsl.pipex.com> - * Makefile.in: Add cygserver_transport_sockets.o to DLL_OFILES. - Add cygserver_transport_sockets_outside.o to cygserver.exe. - * cygserver.cc: Include new include files. + * woutsup.h (cygserver_running): Add declaration. + (api_fatal): Eliminate. + * include/cygwin/cygserver.h + (client_request_get_version::check_version): Change return type to + bool. + (check_cygserver_available): New function. + (cygserver_init): Add check_version_too argument. + * cygserver_client.cc (allow_daemon): Make a bool. + (client_request_get_version::make_request): See errno on error. + Remove special case for CYGSERVER_REQUEST_GET_VERSION; this is now + handled in cygserver_init(). + (client_request_get_version::check_version): Use syscall_printf() + instead of api_fatal(). Return true if cygserver version is + compatible. + (check_cygserver_available): New function; code moved here from + cygserver_init(). + (cygserver_init): Move some code into check_cygserver_available(). + * cygserver.cc (__set_errno): Copy from debug.cc so that + set_errno() can be used when __OUTSIDE_CYGWIN__. + (main): Call cygserver_init() to set up cygserver_running and add + checks against this to (try and) prevent multiple copies of + cygserver running simultaneously. Remember to delete all + transport connections so that (one day) the transport classes can + tidy up on cygserver shutdown. + +2002-06-17 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc (main): Adjust tracing output for a cleaner display + when compiled without --enable-debugging. + * threaded_queue.cc (threaded_queue::cleanup): Ditto. + (queue_process_param::stop): Ditto. + * include/cygwin/cygserver.h + (client_request::make_request): Make non-virtual. + (client_request::send): Make virtual and protected, not private. + (client_request_attach_tty::send): New virtual method. + * cygserver_client.cc: Use the `msglen()' accessor rather than + `_header.msglen' throughout. + (client_request_attach_tty::send): New method. + (client_request::make_request): Remove the explicit close of + `transport' as it is closed on deletion. + +2002-06-17 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver.h: Change the client_request classes to + give greater encapsulation and to allow variable length requests + and replies. + (enum cygserver_request_code): Now client_request::request_code_t. + (class request_header): Now client_request::header_t. Make a + union of the request_code and the error_code. The `cb' field, + which was the buffer length, is now the `size_t msglen' field. + (struct request_get_version): Now + client_request_get_version::request_get_version. + (struct request_shutdown): Remove unused type. + (struct request_attach_tty): Now + client_request_attach_tty::request_attach_tty. + (client_request::_buf): Make field const. + (client_request::_buflen): New const private field. + (client_request::request_code): New accessor. + (client_request::error_code): Ditto. + (client_request::msglen): Ditto. + (client_request::handle_request): New static method. + (client_request::make_request): New virtual method. + (client_request::handle): New method. + (client_request::send): Make private. + (client_request_get_version::check_version): New method. + (client_request_get_version::serve): Make private. + (client_request_get_version::version): Ditto. + (client_request_shutdown::serve): Ditto. + (client_request_attach_tty::req): Ditto. + (client_request_attach_tty::serve): Ditto. + (client_request_attach_tty::from_master): Make method const. + (client_request_attach_tty::from_master): Ditto. + * cygserver_client.cc + (client_request_get_version::client_request_get_version): Track + changes to the client_request classes. + (client_request_attach_tty::client_request_attach_tty): Ditto. + (client_request_get_version::check_version): New method to + encapsulate code from cygserver_init(). + (client_request_shutdown::client_request_shutdown): Move into + "cygserver.cc". + (client_request::send): Track changes to the client_request + classes. Add more error checking. + (client_request::handle_request): New static method containing the + first half of the old server_request::process() code. + (client_request::make_request): New method to replace the old + cygserver_request() function. + (client_request::handle): New method containing the second half of + the old server_request::process() code. + (cygserver_init): Track changes to the client_request classes. In + particular, some code moved into the + client_request_get_version::check_version() method. + * cygserver.cc (client_request_attach_tty::serve): Track changes + to the client_request classes. In particular, only return a reply + body if some handles are successfully duplicated for the client. + And remove goto's. + (client_request_get_version::serve): Track changes to the + client_request classes. + (client_request_shutdown::serve): Ditto. + (class client_request_invalid): Dead, and so young too. + (server_request::request_buffer): Remove unnecessary field. + (client_request_shutdown::client_request_shutdown): Moved here + from "cygserver_client.cc". + (server_request::process): Implementation moved into the new + client_request::handle_request() and client_request::handle() + methods. + * cygserver_shm.h (class client_request_shm): Put client- and + server-specific interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__ + guards. + (client_request_shm::serve): Make private. + * cygserver_shm.cc + (client_request_shm::client_request_shm): Track changes to the + client_request classes. + (client_request_shm::serve): Ditto + * shm.cc (client_request_shm::client_request_shm): Ditto. Use + alloc_sd() rather than set_security_attribute() to get access to + the SECURITY_DESCRIPTOR length, so that we can use it to set the + request body length. + (shmat): Track changes to the client_request classes. In + particular, allocate client_request objects on the stack rather + than on the heap, and use the client_request::make_request() + method rather than the old cygserver_request() function. + (shmdt): Ditto. + (shmctl): Ditto. + (shmget): Ditto. + * fhandler_tty.cc (fhandler_tty_slave::cygserver_attach_tty): Ditto. + +2002-06-17 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver_transport.h + (cygserver_transport::read): Change buffer type to void *. + (cygserver_transport::write): Ditto. + * include/cygwin/cygserver_transport_sockets.h + (cygserver_transport_sockets::read): Ditto. + (cygserver_transport_sockets::write): Ditto. + * include/cygwin/cygserver_transport_pipes.h + (cygserver_transport_pipes::read): Ditto. + (cygserver_transport_pipes::write): Ditto. + * cygserver_transport_sockets.cc + (cygserver_transport_sockets::read): Ditto. + (cygserver_transport_sockets::write): Ditto. + * cygserver_transport_pipes.cc + (cygserver_transport_pipes::read): Ditto. Set errno on error, to + match behaviour of cygserver_transport_sockets class. + (cygserver_transport_pipes::write): Ditto. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc (version): New static variable. + (server_request_queue::add_connection): Remove my gratuitous use + of studly caps. + (setup_privileges): Declare static. + (handle_signal): Ditto. + (longopts): Make a local variable of main(). + (opts): Ditto. + (print_usage): New function. + (print_version): Ditto (tip of the hat to Joshua Daniel Franklin + for inspiration here). + (main): More argument checking. Add --help and --version options. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver.h (client_request::serve): Make pure + virtual. + * cygserver.cc (client_request::serve): Remove definition of pure + virtual method. + (class client_request_invalid): New class. + (server_request::process): Use new client_request_invalid + class. And remove goto's. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc (class server_request): Add virtual destructor. + (server_request_queue::addConnection): New method to replace bad + virtual add() method. + (request_loop): Replace call to queue->add() with call to + queue->addConnection(). + (server_request::server_request): Use field initialization. + (server_request::~server_request): New virtual destructor. + (server_request::process): Remove close and delete of + transport_layer_base object. It is deleted by the server_request's + own destructor and closed by its own destructor. + * include/cygwin/cygserver.h + (client_request::operator request_header): Remove unused method. * cygserver_client.cc: Ditto. - * cygserver_shm.h: No need to include <sys/socket.h> now. - * cygerver_transport.cc: Include new include files. - (transport_layer_base::transport_layer_base): Strip back to a stub. - (transport_layer_base::listen): Ditto. + * include/cygwin/cygserver_process.h + (class cleanup_routine): Add virtual destructor. + (cleanup_routine::cleanup): Make pure virtual. + (class process_cache): Make destructor non-virtual. + (process_cache::add): Ditto. + * cygserver_process.cc + (cleanup_routine::~cleanup_routine): New virtual destructor. + * include/cygwin/cygserver_transport.h + (class transport_layer_base): Add virtual destructor. + * cygserver_transport.cc + (transport_layer_base::~transport_layer_base): New virtual + destructor. + * include/cygwin/cygserver_transport_pipes.h + (class transport_layer_pipes): Add virtual destructor. + * cygserver_transport_pipes.cc + (transport_layer_pipes::~transport_layer_pipes): New virtual + destructor. + (transport_layer_pipes::close): Null out handle after closing. + * include/cygwin/cygserver_transport_sockets.h + (class transport_layer_sockets): Add virtual destructor. + * cygserver_transport_sockets.cc + (transport_layer_sockets::~transport_layer_sockets): New virtual + destructor. + (transport_layer_sockets::close): Null out fd after closing. + * threaded_queue.h (class queue_request): Add virtual destructor. + (queue_request::process): Make pure virtual. + * threaded_queue.cc (~queue_request): New virtual destructor. + (queue_request::process): Remove definition of pure virtual + method. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver.h (client_request::send): Make + non-virtual. + (class client_request_attach_tty): Put client- and server-specific + interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__ guards. + * cygserver_client.cc: Ditto. + (cygserver_init): Fix error handling. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc: Throughout the code, check and correct level of + the XXX_printf() functions used. Comment out several of the + debug_printf() calls with "// verbose:". Reformat and correct + typos of some of the XXX_printf() formats. + * cygserver_process.cc: Ditto. + * cygserver_shm.cc: Ditto. + * cygserver_transport_pipes.cc: Ditto. + * cygserver_transport_sockets.cc: Ditto. + * shm.cc (hi_ulong): New function to allow printing of a 64-bit + key with current small_printf implementation. + (lo_ulong): Ditto. + (client_request_shm::client_request_shm): Use hi_ulong() and + lo_ulong() in call to debug_printf(). + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver_shm.cc: Remove #define __INSIDE_CYGWIN__ from around + <sys/shm.h> as it no longer contains any internal code. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/sys/ipc.h (IPC_PRIVATE): Add cast to key_t. + (IPC_INFO): New flag for ipcs(8). + (IPC_RMID IPC_SET IPC_STAT): Renumber. + * include/sys/shm.h (SHM_RDONLY SHM_RND): Renumber with distinct + values [sic]. + (class _shmattach): Internal type moved to "cygserver_shm.h". + (class shmnode): Ditto. + (class shmid_ds): Ditto. + (struct shmid_ds): Add spare fields. + (struct shminfo): New type for IPC_INFO interface. + * cygserver_shm.h: Remove obsolete #if 0 ... #endif block. + (class shm_cleanup): Remove unused class. + (struct _shmattach): Internal type moved from <sys/shm.h>. + (struct shmnode): Ditto. + (struct int_shmid_ds): Ditto. Renamed to avoid name clash with + public interface struct shmid_ds. Use the shmid_bs structure as a + field. + * cygserver_shm.cc: Remove obsolete #if 0 ... #endif block. + (client_request_shm::serve): Update for redefinition of + int_shmid_ds structure. + * shm.cc (build_inprocess_shmds): Ditto. + (fixup_shms_after_fork): Ditto. + (shmctl): Ditto. + (shmget): Ditto. Remove obsolete #if 0 ... #endif code. + +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * include/cygwin/cygserver_transport.h + (transport_layer_base::transport_layer_base): Remove since it is + now redundant. + (transport_layer_base::listen): Make a pure virtual method. + (transport_layer_base::accept): Ditto. + (transport_layer_base::close): Ditto. + (transport_layer_base::read): Ditto. + (transport_layer_base::write): Ditto. + (transport_layer_base::connect): Ditto. + * cygserver_transport.cc + (transport_layer_base::transport_layer_base): Remove since it is + now redundant. + (transport_layer_base::listen): Remove since it is now a pure + virtual method. (transport_layer_base::accept): Ditto. (transport_layer_base::close): Ditto. (transport_layer_base::read): Ditto. (transport_layer_base::write): Ditto. (transport_layer_base::connect): Ditto. - * cygserver_transport_pipes.cc: Include new header - "cygwin/cygserver_transport_pipes.h". - * cygserver_transport_sockets.cc: New file. - * dcrt0.cc: No need to include <sys/socket.h> now. - * fhandler_tty.cc: Ditto. - * tty.cc: Ditto. - * include/cygwin/cygserver_transport.h: Strip the base class to a stub. - Remove the cygserver_transport_pipes class. - * include/cygwin/cygserver_transport_pipes.h: New file. - * include/cygwin/cygserver_transport_sockets.h: New file. - -Tue Sep 25 16:22:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * autoload.cc: Add dynamic load statement for 'ImpersonateNamedPipeClient'. - * Makefile.in: Add new object files, and build instructions for cygserver.exe. - * cygwin.din: Export ftok, shmat, shmctl and shmget. - * dcrt0.cc: Additional includes for cygserver support. - (dll_crt0_1): Initialise the cygserver client. - * fhandler.h (fhandler_tty): New method cygserver_attach_tty. - * fhandler_tty.cc: Additional includes for cygserver support. - (fhandler_tty_slave::open): Attempt to use the cygserver when obtaining - handles from the parent process. On failure or 9x use the current method. - (fhandler_tty_slave::cygserver_attach_tty): New function. - * fork.cc (fork_child): Fixup shm memory mapped areas. - * pinfo.h: Declare fixup_shms_after_fork(). - * security.h: Declare alloc_sd(). - * tty.cc: Additonal includes to support cygserver. - (tty::common_init): Don't allow others to open us if the cygserver is running. - * winsup.h: Declare cygserver_running. - * cygserver.cc: New file. - * cygserver_client.cc: New file. - * cygserver_shm.cc: New file. - * cygserver_shm.h: New file. - * cygserver_transport.cc: New file. - * cygserver_transport_pipes.cc: New file. - * ipc.cc: New file. - * shm.cc: New file. - * include/cygwin/cygserver.h: New file. - * include/cygwin/cygserver_transport.h: New file. - * include/sys/ipc.h: New file. - * include/sys/shm.h: New file. - -Mon Oct 1 16:52:23 2001 Christopher Faylor <cgf@cygnus.com> - - * dtable.h (dtable::build_fhandler): Make path_conv parameter - non-optional. - (dtable::init_std_file_from_handle): Eliminate name parameter. - * dtable.cc (stdio_init): Don't pass bogus name to - init_std_file_from_handle. The function will figure out the name - itself. - (dtable::init_std_file_from_handle): Eliminate name parameter. Assume - that we're always called with an appropriate fd. Pass name as NULL if - we can't simply figure it out from context. - (cygwin_attach_handle_to_fd): Pass path_conv argument to - build_fhandler. - (dtable::build_fhandler): Make path_conv argument mandatory. Eliminate - specific call to get_device_number. With unknown device names, set - name from handle context for parsing by path_conv. - (dtable::build_fhandler): Pass path_conv argument to build_fhandler. - * path.h (path_conv::set_isdisk): Set disk device type. - (path_conv::is_device): Don't consider FH_DISK a "device". - * syscalls.cc (_open): Pass path_conv argument by reference. - (stat_worker): Ditto. - (_rename): Use path_conv operators. Add bounds to DeleteFile/MoveFile - for loop. - -Mon Oct 1 14:25:00 2001 Charles Wilson <cwilson@ece.gatech.edu> - - * cygwin.din: export strtoll and strtoull -Sun Sep 30 22:51:41 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-16 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygserver.cc (check_and_dup_handle): Only use security code if + running on NT, i.e. if wincap.has_security(). + (client_request_attach_tty::serve): Add check for has_security(). + * cygserver_process.cc (process_cache::process): Use DWORD winpid + throughout to avoid win32 vs. cygwin pid confusion. + (process::process): Ditto. + * cygserver_shm.cc (client_request_shm::serve): Only use security + code if running on NT, i.e. if wincap.has_security(). + * cygserver_shm.h (client_request_shm::parameters.in): Replace the + ambiguous pid field with cygpid and winpid fields. + (client_request_shm::client_request_shm): Reduce to only two + client-side constructors: one for SHM_CREATE, another for all the + other requests. + * shm.cc (client_request_shm::client_request_shm): + Ditto. Initialize cygpid and winpid fields here. On NT initialize + sd_buf here using set_security_attribute() to make use of the euid + and egid. + (shmat): Use new client_request_shm constructor. + (shmdt): Ditto. + (shmctl): Ditto. + (shmget): Ditto. Remove security code, now performed in the + relevant client_request_shm constructor. + * include/cygwin/cygserver_process.h: (class cleanup_routine): + Change winpid type to DWORD. + (class process): Ditto. + +2002-06-15 Conrad Scott <conrad.scott@dsl.pipex.com> + + * woutsup.h: New file. + * cygserver.cc: Use "woutsup.h" and new XXX_printf macros. + (getfunc): New function, copied verbatim from "strace.cc". + (__cygserver__printf): New function. + * cygserver_client.cc: Use "woutsup.h" and new XXX_printf macros. + * cygserver_process.cc: Ditto. + * cygserver_shm.cc: Ditto. + * cygserver_transport.cc: Ditto. + * cygserver_transport_pipes.cc: Ditto. + * cygserver_transport_sockets.cc: Ditto. + * threaded_queue.cc: Ditto. + * shm.cc: Remove trailing \n from XXX_printf format strings. + * Makefile.in: Remove special __OUTSIDE_CYGWIN__ case for + cygserver_shm.cc. + +2002-09-21 Christopher Faylor <cgf@redhat.com> + + * init.cc (dll_entry): Temporarily disable thread detach code. + +2002-09-21 Christopher Faylor <cgf@redhat.com> + + * fhandler.cc (fhandler_base::dup): Don't set handle on failure. + Caller has already taken care of that. + * fhandler_console.cc (fhandler_console::open): Initialize handles to + NULL. + (fhandler_console::close): Ditto. + +2002-09-21 Christopher Faylor <cgf@redhat.com> + + GNUify non-GNU formatted functions calls throughout. + +2002-09-21 Conrad Scott <conrad.scott@dsl.pipex.com> + + * cygwin_ipc.h: Move to "include/cygwin/ipc.h". + * cygwin_shm.h: Move to "include/cygwin/shm.h". + * include/cygwin/ipc.h: New file. + * include/cygwin/shm.h: New file. + * ipc.c:c Update <cygwin/ipc.h> include. + * cygserver_shm.cc: Update <cygwin/shm.h> include. + * shm.cc: Ditto. + +2002-09-21 Robert Collins <rbtcollins@hotmail.com> + + * pthread.cc: Use class::call for converted pthread and semaphore + calls. + * thread.cc: Convert various __pthread_call and __sem_call to + pthread::call and sem::call throughout. + * pthread.h (__pthread_cancel): Convert to pthread::cancel. + (__pthread_join): Convert to pthread::join. + (__pthread_detach): Convert to pthread::detach. + (__pthread_create): Convert to pthread::create. + (__pthread_once): Convert to pthread::once. + (__pthread_atfork): Convert to pthread::atfork. + (__pthread_suspend): Convert to pthread::suspend. + (__pthread_continue): Convert to pthread::resume. + (__sem_init): Convert to semaphore::init. + (__sem_destroy): Convert to semaphore::destroy. + (__sem_wait): Convert to semaphore::wait. + (__sem_trywait): Convert to semaphore::trywait. + (__sem_post): Convert to semaphore::post. + +2002-09-21 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc: Finish the removal of the separate pthread_key + destructor list. + Remove all pthread_key_destructor and pthread_key_destructor_list + references throughout. + (pthread::exit): Call the new pthread_key interface to activate + destructors. + (pthread_key::keys): Change into a list. + (pthread_key::saveAKey): New method, used via forEach. + (pthread_key::restoreAKey): Ditto. + (pthread_key::destroyAKey): Ditto. + (pthread_key::fixup_before_fork): Use the List::forEach functionality. + (pthread_key::fixup_after_fork): Ditto. + (pthread_key::runAllDestructors): New method implementation. + (pthread_key::pthread_key): Use List::Insert rather than custom list + code. + (pthread_key::~pthread_key): Use List::Remove for the same reason. + * thread.h: Remove all pthread_key_destructor and + pthread_key_destructor_list references throughout. + (List): Move the interface above pthread_key in the header. + Use atomic operations during insert and delete. + (List::forEach): A generic interface for doing something on each node. + (pthread_key::runAllDestructors): New method, run all destructors. + (pthread_key::fork_buf): Make private. + (pthread_key::run_destructor): Ditto. + (pthread_key::saveAKey): New method for clearer source. + (pthread_key::restoreAKey): Ditto. + (pthread_key::destroyAKey): Ditto. + (MTinterface::destructors): Remove. + +2002-09-21 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc: Partial refactoring of pthread_key destructor + handling. Loosely based on Thomas Pfaff's work. + (pthread_key_destructor_list::Insert): Remove. + (pthread_key_destructor_list::Pop): Remove. + (pthread_key_destructor_list::IterateNull): Call the key's + run_destructor method. + (pthread_key::pthread_key): Initialize new member. + (pthread_key::get): Mark as const for correctness. + (pthread_key::run_destructor): Implement. + * thread.h (pthread_key::get): Mark as const for correctness. + (pthread_key::run_destructor): Declare. + (List): New template class that implements a generic list. + (pthread_key_destructor_list): Inherit from List, and remove + now duplicate functions. + +2002-09-21 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc: Change verifyable_object_isvalid calls with + PTHREAD_CONDATTR_MAGIC, PTHREAD_MUTEXATTR_MAGIC, PTHREAD_COND_MAGIC, + SEM_MAGIC to objecttype::isGoodObject() calls throughout. + (pthread_condattr::isGoodObject): Implement. + (pthread_mutex::isGoodInitializer): Implement. + (pthread_mutex::isGoodInitializerOrObject): Minor bugfix in the + check for verifyable_object_isvalid result. + (pthread_mutexattr::isGoodObject): Implement. + (pthread_cond::isGoodObject): Ditto. + (pthread_cond::isGoodInitializer): Ditto. + (pthread_cond::isGoodInitializerOrObject): Ditto. + (semaphore::isGoodObject): Ditto. + * thread.h (pthread_mutex::isGoodInitializer): Declare. + (pthread_condattr::isGoodObject): Ditto. + (pthread_cond::isGoodObject): Const correctness. + (pthread_cond::isGoodInitializer): Declare. + (pthread_cond::isGoodInitializerOrObject): Ditto. + (semaphore::isGoodObject): Const correctness. + +2002-09-21 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc: Change verifyable_object_isvalid calls with + PTHREAD_MUTEX_MAGIC and PTHREAD_KEY_MAGIC and PTHREAD_ATTR_MAGIC to + ::isGoodObject() calls throughout. + (MTinterface::Init): Remove dead code. + (pthread_attr::isGoodObject): Implement. + (pthread_key::isGoodObject): Implement. + (pthread_mutex::isGoodObject): Implement. + (pthread_mutex::isGoodInitializerOrObject): Implement. + (pthread::isGoodObject): Update signature. + * thread.h (pthread_key::isGoodObject): Declare. + (pthread_attr::isGoodObject): Ditto. + (pthread_mutex::isGoodObject): Ditto. + (pthread_mutex::isGoodInitializerOrObject): Ditto. + (pthread::isGoodObject): Change to a const parameter for const + correctness. + (pthread_mutexattr::isGoodObject): Declare. + (pthread_condattr::isGoodObject): Ditto. + (pthread_cond::isGoodObject): Ditto. + (semaphore::isGoodObject): Ditto. + +2002-09-19 Christopher Faylor <cgf@redhat.com> + + Cleanup calls to CreateFile throughout. + * dcrt0.cc (__api_fatal): Correctly check for failing return from CreateFile. + * assert.cc (__assert): Don't check return value from CreateFile for NULL. + * fhandler_console.cc (set_console_state_for_spawn): Ditto. + * fork.cc (fork_parent): Ditto. - Add "path.h" include throughout, where needed. Use new path_conv - methods and operators to simplify testing for directory and attributes, - throughout. - * path.h (path_conv::exists): New method. - (path_conv::has_attribute): Ditto. - (path_conv::isdir): Ditto. - (path_conv::DWORD &): New operator. - (path_conv::int &): Ditto. - * dir.cc (rmdir): Eliminate a goto. - * dtable.cc (dtable::build_fhandler): Accept opt and suffix info for - path_conv.check. Return fh == NULL on path_conv error. Pass unit to - set_name as appropriate. - (dtable::reset_unix_path_name): New method. - * dtable.h (dtable): Declare new method. Reflect arg changes to - build_fhandler. - * fhandler.cc (fhandler_disk_dummy_name): Eliminate. - (fhandler_base::set_name): Expect paths to be NULL. Build - unix_path_name from win32_path_name when it is a device. - (fhandler_base::reset_unix_path_name): New method. - (fhandler_base::raw_read): Report EISDIR when ERROR_INVALID_FUNCTION - or ERROR_INVALID_PARAMETER and reading a directory. - (fhandler_disk_file::fstat): Don't call stat_dev since we should now - never be calling fhandler_disk_file methods with devices. - (fhandler_base::fhandler_base): Clear {unix,win32}_path_name. - (fhandler_base::~fhandler_base): Always free {unix,win32}_path_name. - (fhandler_disk_file::fhandler_disk_file): Remove set_no_free_names - kludge. - (fhandler_disk_file::open): Ditto. - * fhandler.h (fhandler_base::no_free_names): Eliminate. - (fhandler_base::set_no_free_names): Ditto. - * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Don't set - unix_path_name here. - * path.cc (fchdir): Lock fd table throughout. Use new - dtable::reset_unix_path_name method to reset path. - * syscalls.cc (stat_worker): Reorganize to always call fstat method. - Pass path_conv method to fhandler_*::open. - (chroot): Elminate a goto. - -Sun Sep 30 17:37:43 2001 Christopher Faylor <cgf@cygnus.com> - - * environ.cc (winenv): Allocate exact amount of space needed for forced - windows environment variable rather than just using MAX_PATH. - -Sun Sep 30 17:10:18 2001 Christopher Faylor <cgf@cygnus.com> - - * Makefile.in: Depend on stamp to ensure rebuilding. Remove stamp file - when we've just built the DLL. - -Mon Oct 1 00:34:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.cc (pthread_cond_dowait): Hopefully eliminate a race on multiple thread - wakeups. - -Sat Sep 29 18:26:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * pthread.cc (pthread_cond_timedwait): Deleted - exported from thread.cc. - (pthread_cond_wait): Deleted - exported from thread.cc. - * thread.cc (pthread_cond::BroadCast): Update to use the new syntax for - verifyable_object_isvalid (). - (pthread_cond::Signal): Ditto. Also attempt to fix the lost signal race - with pthread_cond::TimedWait(). - (check_valid_pointer): Change definiton to void const *. - (verifyable_object_isvalid): Add new parameter to allow identification of - static initializers, and return a enum rather than magic numbers. - (__pthread_create): Ditto. - (__pthread_cleanup): Ditto. - (__pthread_attr_init): Ditto. - (__pthread_attr_getinheritsched): Ditto. - (__pthread_attr_getschedparam): Ditto. - (__pthread_attr_getschedpolicy): Ditto. - (__pthread_attr_getscope): Ditto. - (__pthread_attr_setdetachstate): Ditto. - (__pthread_attr_getdetachstate): Ditto. - (__pthread_attr_setinheritsched): Ditto. - (__pthread_attr_setschedparam): Ditto. - (__pthread_attr_setschedpolicy): Ditto. - (__pthread_attr_setscope): Ditto. - (__pthread_attr_setstacksize): Ditto. - (__pthread_attr_getstacksize): Ditto. - (__pthread_attr_destroy): Ditto. - (__pthread_join): Ditto. - (__pthread_detach): Ditto. - (__pthread_suspend): Ditto. - (__pthread_continue): Ditto. - (__pthread_getschedparam): Ditto. - (__pthread_getsequence_np): Ditto. - (__pthread_key_create): Ditto. - (__pthread_key_delete): Ditto. - (__pthread_setschedparam): Ditto. - (__pthread_setspecific): Ditto. - (__pthread_getspecific): Ditto. - (__pthread_cond_destroy): Ditto. - (__pthread_cond_init): Ditto. - (__pthread_cond_broadcast): Ditto. - (__pthread_cond_signal): Ditto. - (__pthread_condattr_init): Ditto. - (__pthread_condattr_getpshared): Ditto. - (__pthread_condattr_setpshared): Ditto. - (__pthread_condattr_destroy): Ditto. - (__pthread_kill): Ditto. - (__pthread_mutex_init): Ditto. - (__pthread_mutex_getprioceiling): Ditto. - (__pthread_mutex_lock): Ditto. - (__pthread_mutex_trylock): Ditto. - (__pthread_mutex_unlock): Ditto. - (__pthread_mutex_destroy): Ditto. - (__pthread_mutex_setprioceiling): Ditto. - (__pthread_mutexattr_getprotocol): Ditto. - (__pthread_mutexattr_getpshared): Ditto. - (__pthread_mutexattr_gettype): Ditto. - (__pthread_mutexattr_init): Ditto. - (__pthread_mutexattr_destroy): Ditto. - (__pthread_mutexattr_setprotocol): Ditto. - (__pthread_mutexattr_setprioceiling): Ditto. - (__pthread_mutexattr_getprioceiling): Ditto. - (__pthread_mutexattr_setpshared): Ditto. - (__pthread_mutexattr_settype): Ditto. - (__sem_init): Ditto. - (__sem_destroy): Ditto. - (__sem_wait): Ditto. - (__sem_trywait): Ditto. - (__sem_post): Ditto. - (__pthread_cond_dowait): New function, contains core logic from - __pthread_cond_wait and __pthread_cond_timedwait. Decrement (*cond)->waiting - before reentering the cond access mutex to allow detection of lost signals. - (__pthread_cond_timedwait): Rename to pthread_cond_timedwait, and call - __pthread_cond_dowait after calculating the wait length. - (__pthread_cond_wait): Rename to pthread_cond_wait, and call - __pthread_cond_dowait. - * thread.h: New enum for use with verifyable_object_isvalid. - Remove the extern exporting of __pthread_cond_timedwait and __pthread_cond_wait. - -Fri Sep 28 21:18:50 2001 Christopher Faylor <cgf@cygnus.com> - - * pipe.cc (fhandler_pipe::fixup_after_fork): New method. - * fhandler.h (fhandler_pipe::fixup_after_fork): Declare new method. - -Fri Sep 28 03:23:04 2001 Christopher Faylor <cgf@cygnus.com> - - * passwd.cc (read_etc_passwd): Bother with unlocking when not - in cygwin initialization. - * grp.cc (read_etc_group): Ditto. - -Fri Sep 28 02:57:03 2001 Christopher Faylor <cgf@cygnus.com> - - * passwd.cc (read_etc_passwd): Don't bother with locking when - in cygwin initialization since there is only one thread. - * grp.cc (read_etc_group): Ditto. - -Fri Sep 28 01:50:09 2001 Christopher Faylor <cgf@cygnus.com> - - * pipe.cc (fhandler_pipe::hit_eof): Return correct value when there is - no EOF event available. - -Sat Sep 28 00:34:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * mmap.cc (mmap): Move setting the access after evaluating fd. - Remove useless comment. Explain copy-on-write problem of 9x - more detailed. Don't set access to FILE_MAP_COPY on 9x only - when anonymous mapping is requested. - (fhandler_disk_file::mmap): Remove useless device check. - Add debug output. - -Fri Sep 27 07:35:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * Makefile.in: Only stamp winver_stamp on success. - -Wed Sep 26 16:02:35 2001 Christopher Faylor <cgf@cygnus.com> - - * select.cc (peek_pipe): REALLY only grab mutex when we actually got - something from the pipe. - -Tue Sep 25 21:25:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.cc (pthread_cond::BroadCast): Use address with verifyable_object_isvalid(). - (pthread_cond::Signal): Ditto. - (__pthread_create): Ditto. - (__pthread_cleanup): Ditto. - (__pthread_attr_init): Ditto. - (__pthread_attr_getinheritsched): Ditto. - (__pthread_attr_getschedparam): Ditto. - (__pthread_attr_getschedpolicy): Ditto. - (__pthread_attr_getscope): Ditto. - (__pthread_attr_setdetachstate): Ditto. - (__pthread_attr_getdetachstate): Ditto. - (__pthread_attr_setinheritsched): Ditto. - (__pthread_attr_setschedparam): Ditto. - (__pthread_attr_setschedpolicy): Ditto. - (__pthread_attr_setscope): Ditto. - (__pthread_attr_setstacksize): Ditto. - (__pthread_attr_getstacksize): Ditto. - (__pthread_attr_destroy): Ditto. +2002-09-18 Christopher Faylor <cgf@redhat.com> + + * cygthread.cc (cygthread::initialized): Avoid copying on fork or some + threads may not end up in the pool. + (cygthread::new): Avoid race when checking for initialized. Add + debugging code. + +2002-09-18 Pierre Humblet <pierre.humblet@ieee.org> + + * fhandler.cc (fhandler_base::raw_read): Add case for + ERROR_INVALID_HANDLE due to Win95 directories. + (fhandler_base::open): Handle errors due to Win95 directories. + (fhandler_base::close): Add get_nohandle () test. + (fhandler_base::set_close_on_exec): Ditto. + (fhandler_base::fork_fixup): Ditto. + (fhandler_base::lock): Change error code to Posix EINVAL. + (fhandler_base::dup): If get_nohandle (), set new value to + INVALID_HANDLE_VALUE instead of NULL. + * fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name + if get_nohandle (). Remove extraneous element from strpbrk. + (fhandler_disk_file::open): Remove test for Win95 directory. + + * fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle (). + * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto. + * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. + (fhandler_dev_zero::close): Delete. + * fhandler.h (class fhandler_dev_zero): Ditto. + +2002-09-17 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc (pthread_key::set): Preserve GetLastError(). Reported + by Thomas Pffaf. + +2002-09-17 Robert Collins <rbtcollins@hotmail.com> + + This work inspires by Thomas Pfaff's pthread_fork patch (1). + * fork.cc (fork_child): Remove MTinterface fixup call, it's + adsorbed by pthread::atforkchild. + Rename __pthread_atforkchild to pthread::atforkchild to give + access to private members. + (fork_parent): Rename __pthread_atforkparent to + pthread::atforkparent to give it access to private members. + Ditto for __pthread_atforkprepare. + * thread.cc: Fix some formatting problems throughout. + (MTinterface::fixup_before_fork): Implement. + (MTinterface::fixup_after_fork): Fix pthread_keys. + (pthread_key::keys): Implement. + (pthread_key::fixup_before_fork): Ditto. + (pthread_key::fixup_after_fork): Ditto. + (pthread_key::pthread_key): Add to pthread_key::keys. + (pthread_key::~pthread_key): Remove from pthread_key::keys. + (pthread_key::saveKeyToBuffer): Implement. + (pthread_key::recreateKeyFromBuffer): Ditto. + (pthread::atforkprepare): Prepare all MT classes for fork. + (pthread::atforkchild): And fix them up afterwards. + * thread.h (pthread_key): Buffer the key value during + fork in fork_buf. + List the keys needing to be fixed up in a linked list with + head pthread_key::keys. + (pthread): Move atfork cygwin internal calls into the class. + (MTInterface): Provide a fixup_before_fork for objecst that + need to save state. + (__pthread_atforkprepare): Remove. + (__pthread_atforkparent): Remove. + (__pthread_atforkchild): Remove. + +2002-09-16 Christopher Faylor <cgf@redhat.com> + + * init.cc: Cleanup slightly and remove obsolete code. + +2002-09-11 Robert Collins <rbtcollins@hotmail.com> + + * init.cc (dll_entry): On thread detach, if the thread hasn't + exit()ed, do so. + * pthread.cc (pthread_getsequence_np): Remove the + __pthread_getsequence_np wrapper. This requires errno.h. + * thread.cc (pthread::self): Instantiate a new pthread object + when called and none exists. return a NULL object if instantiation + fails. + (pthread::precreate): Factor out common code. + (pthread::postcreate): Ditto. + (pthread::create): Ditto. + (pthread::exit): Remove the TLS value when we exit to prevent + double exits. + (MTinterface::Init): Bugfix - don't mark the TLS index as created + if one was not allocated. + Apply Extract Method to move pthread specific initialisation into + pthread. + (pthread::initMainThread): Extracted method from MTinterface::Init. + (pthread::setTlsSelfPointer): Extracted method from various pthread + calls, to make reading those functions easier. + (pthread::setThreadIdtoCurrent): Ditto. + (pthread::cancel_self): Bring into the .cc file, it's only used + within the class. + (pthread::getThreadId): Ditto. + (pthread::thread_init_wrapper): Apply Extract Method to the TLS + setting logic. + (pthread::isGoodObject): Extracted method from various pthread + wrapper calls, for clarity of reading. + (pthread::getsequence_np): Converted from __pthread_getsquence_np. + (__pthread_create): Apply Extract Method to the object validation. + (__pthread_cancel): Ditto. (__pthread_join): Ditto. (__pthread_detach): Ditto. (__pthread_suspend): Ditto. (__pthread_continue): Ditto. (__pthread_getschedparam): Ditto. - (__pthread_getsequence_np): Ditto. - (__pthread_key_create): Ditto. - (__pthread_key_delete): Ditto. - (__pthread_setschedparam): Ditto. - (__pthread_setspecific): Ditto. - (__pthread_getspecific): Ditto. - (__pthread_cond_destroy): Ditto. - (__pthread_cond_init): Ditto. - (__pthread_cond_broadcast): Ditto. - (__pthread_cond_signal): Ditto. - (__pthread_cond_timedwait): Ditto. - (__pthread_cond_wait): Ditto. - (__pthread_condattr_init): Ditto. - (__pthread_condattr_getpshared): Ditto. - (__pthread_condattr_setpshared): Ditto. - (__pthread_condattr_destroy): Ditto. - (__pthread_kill): Ditto. - (__pthread_mutex_init): Ditto. - (__pthread_mutex_getprioceiling): Ditto. - (__pthread_mutex_lock): Ditto. - (__pthread_mutex_trylock): Ditto. - (__pthread_mutex_unlock): Ditto. - (__pthread_mutex_destroy): Ditto. - (__pthread_mutex_setprioceiling): Ditto. - (__pthread_mutexattr_getprotocol): Ditto. - (__pthread_mutexattr_getpshared): Ditto. - (__pthread_mutexattr_gettype): Ditto. - (__pthread_mutexattr_init): Ditto. - (__pthread_mutexattr_destroy): Ditto. - (__pthread_mutexattr_setprotocol): Ditto. - (__pthread_mutexattr_setprioceiling): Ditto. - (__pthread_mutexattr_getprioceiling): Ditto. - (__pthread_mutexattr_setpshared): Ditto. - (__pthread_mutexattr_settype): Ditto. - (__sem_init): Ditto. - (__sem_destroy): Ditto. - (__sem_wait): Ditto. - (__sem_trywait): Ditto. - (__sem_post): Ditto. - (verifyable_object_isvalid): Recieve a pointer to a pointer for verification. - (__pthread_mutexattr_getprotocol): Fix typo in magic number. - (__pthread_mutexattr_getpshared): Ditto. - (__pthread_mutexattr_gettype): Ditto. - * thread.h (verifyable_object_isvalid): Change prototype to recieve a pointer to a - pointer for verification. - * include/pthread.h: Fix typo for __cleanup_routine_type typedef. (Contrib from Net). - -Tue Sep 25 02:09:42 2001 Christopher Faylor <cgf@redhat.com> - - * select.cc (fhandler_tty_common::ready_for_read): Rewrite to correctly - call peek_pipe. - -Mon Sep 24 18:46:39 2001 Christopher Faylor <cgf@cygnus.com> - - * select.cc (peek_pipe): Only grab mutex when we actually got something - from the pipe. - -Mon Sep 24 17:41:03 2001 Christopher Faylor <cgf@redhat.com> - - * fhandler.h (fhandler_pipe::hit_eof): New method. - (writepipe_exists): New class element. - (orig_pid): Ditto. - (id): Ditto. - (is_slow): Eliminate. - * pipe.cc (fhandler_pipe::set_close_on_exec): Set inheritance on - writepipe_exists, if it exists. - (fhandler_pipe::hit_eof): New method, modelled after tty. - (fhandler_pipe::dup): Duplicate writepipe_exists, if it exists. - (make_pipe): Set up a dummy event for pipes on windows 9x. The - nonexistence of this event means that the write side of the - pipe has closed. - (_dup): Move to syscalls.cc - (_dup2): Ditto. - - * dtable.cc (dtable::build_fhandler): Fill out set_names here, if - appropriate. - * syscalls.cc (_open): Call set_names in build_fhandler. - + (__pthread_getsequence_np): Remove. + (__pthread_setschedparam): Apply Extract Method to the object + validation. + (pthreadNull::getNullpthread): New method, return the pthreadNull + object. + (pthreadNull::pthreadNull): Private constructor to prevent accidental + use. + (pthreadNull::~pthreadNull): Prevent compile warnings. + (pthreadNull::create): Override pthread behaviour. + (pthreadNull::exit): Ditto. + (pthreadNull::cancel): Ditto. + (pthreadNull::testcancel): Ditto. + (pthreadNull::setcancelstate): Ditto. + (pthreadNull::setcanceltype): Ditto. + (pthreadNull::push_cleanup_handler): Ditto. + (pthreadNull::pop_cleanup_handler): Ditto. + (pthreadNull::getsequence_np): Ditto. + (pthreadNull::_instance): Ditto. + * thread.h (pthread): Declare pre- and post-create. + Move GetThreadId to private scope and rename to getThreadId. + Move setThreadIdtoCurrent to private scope. + Make create virtual. + Make ~pthread virtual. + Declare initMainThread. + Declare isGoodObject. + Make exit virtual. + Make cancel virtual. + Make testcancel virtual. + Make setcancelstate virtual. + Make setcanceltype virtual. + Make push_cleanup_handler virtual. + Make pop_cleanup_handler virtual. + Declare getsequence_np. + Declare setTlsSelfPointer. + (pthreadNull): New null object class for pthread. + (__pthread_getsequence_np): Remove. + +2002-09-13 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (seteuid32): Treat ILLEGAL_UID invalid. + (setegid32): Treat ILLEGAL_GID invalid. + +2002-09-10 Pierre Humblet <pierre.humblet@ieee.org> + + * grp.cc (initgroups): Call groups::clear_supp to free the + supplementary group sids that may have been set by setgroups. + * security.cc (cygsidlist::free_sids): Also zero the class members. + * security.h (groups::clear_supp): New. + Rename cygsidlist_unknown to cygsidlist_empty. + +2002-09-08 Christopher Faylor <cgf@redhat.com> + + * fhandler_tty.cc (fhandler_tty_slave::open): Don't protect + input/output handles since they are not properly manipulated later. + * tty.cc (tty::make_pipes): Ditto. + +2002-09-06 Christopher Faylor <cgf@redhat.com> + + * winsup.h (_WIN32_WINNT): Protect. + +2002-09-06 Christopher Faylor <cgf@redhat.com> + + * winsup.h (_WIN32_WINNT): Define. + +2002-09-03 Corinna Vinschen <corinna@vinschen.de> + + * Makefile.in (DLL_OFILES): Drop shortcut.o. + * path.cc: Move all shortcut functions from shortcut.c to here. + (check_shortcut): Implement without using COM interface. + * path.h: Move definition of SHORTCUT_HDR_SIZE to here. + * shortcut.c: Remove. + * shortcut.h: Ditto. + +2002-09-03 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler.h (fhandler_socket::read): Remove method. + (fhandler_socket::write): Ditto. + (fhandler_socket::readv): New method. + (fhandler_socket::writev): Ditto. + (fhandler_socket::recvmsg): Add new optional argument. + (fhandler_socket::sendmsg): Ditto. + * fhandler.cc (fhandler_socket::read): Remove method. + (fhandler_socket::write): Ditto. + (fhandler_socket::readv): New method. + (fhandler_socket::writev): Ditto. + (fhandler_socket::recvmsg): Use win32's scatter/gather IO where + possible. + (fhandler_socket::sendmsg): Ditto. + * net.cc (cygwin_recvmsg): Check the msghdr's iovec fields. + (cygwin_sendmsg): Ditto. Add omitted sigframe. + +2002-09-02 Kazuhiro Fujieda <fujieda@jaist.ac.jp> + + * cygwin.din: Revert exporting new wchar functions. + * include/cygwin/version.h: Change comment for API minor 62. + +2002-09-02 Christopher Faylor <cgf@redhat.com> + + * dcrt0.cc (dll_crt0_1): Remove getpagesize() call. + * shared.cc (memory_init): Move it here. + +2002-08-31 Christopher January <chris@atomice.net> + + * fhandler_proc.cc: Add <sys/param.h> include. + (format_proc_uptime): Use KernelTime and UserTime only as they include + the other counters. + (format_proc_stat): KernelTime includes IdleTime, so subtract IdleTime + from KernelTime. Make number of 'jiffies' per second same as HZ define. + * fhandler_process.cc: Add <sys/param.h> include. + (format_process_stat): Make number of 'jiffies' per second same as + HZ define. Use KernelTime and UserTime only to calculate start_time. -Sun Sep 23 16:55:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-08-30 Christopher Faylor <cgf@redhat.com> - * syscalls.cc (_open): Set name in fhandler object after successful - creation. - (stat_dev): Set device type to block device in FH_FLOPPY case. - -Sun Sep 23 11:15:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * dtable.cc (dtable::build_fhandler): Initialize unit when using - optional path_conv argument. - -Sat Sep 22 17:33:45 2001 Christopher Faylor <cgf@cygnus.com> - Corinna Vinschen <corinna@vinschen.de> - - * dtable.cc (dtable::build_fhandler): Accept an optional path_conv - argument. If available, use this to calculate path name and device - number. - * dtable.h (dtable): Reflect above change. - * fhandler.h (fhandler_base): Declare virtual method which accepts - path_conv rather than path string as first argument. - * fhandler.cc (fhandler_base::open): Define above new method. - * syscalls.cc (_open): Set aside a path_conv variable for use in - build_fhandler and subsequent call to open. - -Sat Sep 22 12:44:57 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (setup_handler): Always relinquish lock after we've - interrupted. - * fhandler.cc: Move pipe methods to pipe.cc. - * fhandler.h (fhandler_pipe): Add new methods. - * fork.cc (sync_with_parent): Make error messages more informative. - * pipe.cc (fhandler_pipe::fhandler_pipe): Move here from fhandler.cc. - (fhandler_pipe::lseek): Ditto. - (fhandler_pipe::set_close_on_exec): New method. - (fhandler_pipe::read): Ditto. - (fhandler_pipe::close): Ditto. - (fhandler_pipe::dup): Ditto. - (make_pipe): Create the guard mutex on the read side of the pipe. - * select.cc (peek_pipe): Use guard_mutex to discover if we have the - right to read on this pipe. - (fhandler_pipe::readh_for_read): Pass the read pipe guard mutex to - peek_pipe. - * syscalls.cc (_read): Always detect signal catchers, for now. - - * debug.cc (makethread): Eliminate hack to make thread inheritable. - * sigproc.cc (subproc_init): Don't use hack to make thread inheritable. - -Thu Sep 20 16:48:44 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler.cc (fhandler_base::set_inheritance): Just use - DUPLICATE_CLOSE_SOURCE to change inheritance. Eliminate all other - logic dealing with closed handles. - * fhandler.h (fhandler_base::set_inheritance): Reflect above change. - * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Ditto. - -Thu Sep 20 13:34:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler_socket.cc (fhandler_socket::fixup_after_exec): Close - socket only when not using Winsock2. - -Thu Sep 20 13:20:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler.h (fhandler_socket::fixup_after_exec): Remove inline - implementation. - (fhandler_dev_raw::fixup_after_exec): Ditto. - * fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Don't - duplicate buffer on fork to avoid memory leak. - (fhandler_dev_raw::fixup_after_exec): New implementation equal to - former fixup_after_fork() implementation. - * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Do - nothing when not using Winsock2. - (fhandler_socket::fixup_after_exec): New implementation. - (fhandler_socket::set_close_on_exec): Never call set_inheritance(). - -Thu Sep 20 9:55:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler.cc (fhandler_base::set_inheritance): If available, - use SetHandleInformation() to set inheritance. - * wincap.cc: Set flag has_set_handle_information_on_console_handles - appropriately. - * wincap.h: Add flag has_set_handle_information_on_console_handles. + (inspired by a patch from Egor Duda) + * select.cc (fhandler_tty_slave::ready_for_read): Remove. + * fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration. + * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Set "don't + need ready for read" flag. + (fhandler_tty_slave::read): Don't do anything special with vtime when + vmin == 0. -Wed Sep 19 12:24:09 2001 Christopher Faylor <cgf@cygnus.com> +2002-08-30 Egor Duda <deo@logos-m.ru> - * lib/getopt.c (__progname): Don't declare if not compiling for cygwin. + * autoload.cc (GetConsoleWindow): Correct parameter count. -Wed Sep 19 18:07:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-08-30 Christopher January <chris@atomice.net> + Christopher Faylor <cgf@redhat.com> - * lib/getopt.c (getopt_long): Avoid compiler warning. + * tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available. + Call FindWindow in a loop. + * autoload.cc (GetConsoleWindow): Export -Wed Sep 19 11:52:42 2001 Christopher Faylor <cgf@cygnus.com> +2002-08-30 Christopher Faylor <cgf@redhat.com> - * lib/getopt.c: Use __progname==__argv[0] when not compiling for cygwin. + * miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero + length iov_len. + (check_iovec_for_write): Ditto. - * scandir.cc (scandir): Use correct default when compar == NULL. +2002-08-27 Conrad Scott <conrad.scott@dsl.pipex.com> -Wed Sep 19 17:49:00 2001 Corinna Vinschen <corinna@vinschen.de> + * fhandler.h (fhandler_base::readv): New method. + (fhandler_base::writev): Ditto. + * fhandler.cc (fhandler_base::readv): New method. + (fhandler_base::writev): Ditto. + * syscalls.cc (_read): Delegate to readv(2). + (_write): Ditto, mutatis mutandi. + (readv): Rewrite, based on the old _read code, to use the new + fhandler_base::readv method. Improve access mode handling and ensure + all calls reach the final strace statement. + (writev): Ditto, mutatis mutandi. + * include/sys/uio.h (struct iovec): Change field types to match SUSv3. + * winsup.h (check_iovec_for_read): New function. + (check_iovec_for_write): Ditto. + * miscfuncs.cc (check_iovec_for_read): Ditto. + (check_iovec_for_write): Ditto. - * fhandler_socket.cc (fhandler_socket::fhandler_socket): Revert - memory allocation to use cmalloc again. +2002-08-30 Corinna Vinschen <corinna@vinschen.de> -Tue Sep 18 21:04:26 2001 Christopher Faylor <cgf@cygnus.com> + * cygwin.din: Add more prototypes for new wchar functions in newlib. - * cygwin.din (__argv): Export. - (__argc): Ditto. - (__progname): Ditto. - * include/getopt.h (getopt_long): constify arguments. - * lib/getopt.c: Import new file from NetBSD. +2002-08-30 Corinna Vinschen <corinna@vinschen.de> -Tue Sep 18 18:21:00 2001 Corinna Vinschen <corinna@vinschen.de> + * cygwin.din: Add prototypes for new wchar functions in newlib. + * include/cygwin/version.h: Bump API minor number. - * mmap.cc (mmap): Don't reuse anonymous memory in MAP_FIXED case. +2002-08-29 Boris Schaeling <boriss@web.de> + Corinna Vinschen <corinna@vinschen.de> -Mon Sep 17 17:29:25 2001 Christopher Faylor <cgf@cygnus.com> + * poll.cc (poll): Peek sockets ready for read to see if there's + actually data. - * include/io.h: Add access declaration. +2002-08-28 Christopher Faylor <cgf@redhat.com> -Mon Sep 17 14:04:27 2001 Christopher Faylor <cgf@cygnus.com> + * cygthread.cc (hthreads): Remove unneeded global. + (cygthread::simplestub): New static member function. + (cygthread::runner): Don't set hthreads. + (cygthread::freerange): New member function. + (cygthread::operator new): Call freerange if all cygwin slots are used + up. + (cygthread::exit_thread): Don't mess with event if freerange thread. + (cygthread::detach): Ditto. + * cygthread.h (class cygthread): Declare new member functions and + variables. - * syscalls.cc (rmdir): Set cwd to some other location if attempting to - rmdir current working directory. +2002-08-28 Christopher Faylor <cgf@redhat.com> -Sun Sep 16 23:04:31 2001 Christopher Faylor <cgf@cygnus.com> + * malloc.cc: Protect some definitions to avoid a compile time warning. - * dtable.h (not_open): Assure inline. - * fhandler.h (operator []): Make const. +2002-08-27 Nicholas Wourms <nwourms@netscape.net> -Sun Sep 16 23:02:57 2001 Robert Collins <rbtcollins@hotmail.com> + * cygwin.din: Export getc_unlocked, getchar_unlocked, + putc_unlocked, putchar_unlocked functions. + * include/cygwin/version.h: Bump api minor. - * sync.cc (muto::~muto): Fix typo which stopped muto event handle from - ever being closed. +2002-08-28 Corinna Vinschen <corinna@vinschen.de> -2001-09-16 Egor Duda <deo@logos-m.ru> + * fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags + not understood by WinSock. + (fhandler_socket::sendto): Ditto. If WinSock sendto() returns + WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL + isn't set in flags. + * include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL. + * include/cygwin/version.h: Bump API minor number. - * path.cc (symlink): Check arguments for validity. - (getcwd): Ditto. - * syscalls.cc (ftruncate): Ditto. - * times.cc (times): Ditto. - * uname.cc (uname): Ditto. +2002-08-28 Corinna Vinschen <corinna@vinschen.de> + + * poll.cc (poll): Eliminate erroneous POLLERR conditional. + +2002-08-26 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler_socket.cc (fhandler_socket::check_peer_secret_event): + Fix strace message. + (fhandler_socket::connect): Remove sigframe. + (fhandler_socket::accept): Ditto. + (fhandler_socket::getsockname): Ditto. + (fhandler_socket::getpeername): Ditto. + (fhandler_socket::recvfrom): Ditto. + (fhandler_socket::recvmsg): Ditto. + (fhandler_socket::sendto): Ditto. + (fhandler_socket::sendmsg): Ditto. + (fhandler_socket::close): Ditto. + (fhandler_socket::ioctl): Ditto. + * ioctl.cc (ioctl): Add sigframe. + *net.cc (cygwin_sendto): Ditto. + (cygwin_recvfrom): Ditto. + (cygwin_recvfrom): Ditto. + (cygwin_connect): Ditto. + (cygwin_shutdown): Ditto. + (cygwin_getpeername): Ditto. + (cygwin_accept): Ditto. Improve strace message. + (cygwin_getsockname): Ditto. Ditto. + (cygwin_recvmsg): Ditto. Ditto. + (cygwin_sendmsg): Fix strace message. + +2002-08-27 Christopher Faylor <cgf@redhat.com> + + * child_info.h: Add _PROC_WHOOPS enum value. + (CURR_CHILD_INFO_MAGIC): Update. + (child_info::magic): Make 'long'. + * cygheap.h: Export _cygheap_start. + * cygheap.cc: Don't declare _cygheap_start. + * cygmagic: Use cksum to produce checksums. Append 'U' to end of + checksum. + * dcrt0.cc (initial_env): Calculate sleep ms before reusing buffer. + (_dll_crt0): Detect cygheap mismatch as indicative of different cygwin + version. Set child_proc_info to NULL when _PROC_WHOOPS. + (multiple_cygwin_problem): If child_info specific problem, then set + child_proc_info type to _PROC_WHOOPS. + * shared_info.h (CURR_MOUNT_MAGIC): Update. + (CURR_SHARED_MAGIC): Ditto. + +2002-08-25 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler.h (fhandler_socket::recvfrom): Fix prototype. + (fhandler_socket::sendto): Ditto. + * fhandler_socket.cc (fhandler_socket::recvfrom): Ditto. + (fhandler_socket::sendto): Ditto. + * include/sys/socket.h (recv): Fix prototype. + (recvfrom): Ditto. + (send): Ditto. + (sendto): Ditto. + * net.cc (cygwin_sendto): Ditto. Improve strace message + (cygwin_recvfrom): Ditto. Ditto. + (cygwin_setsockopt): Improve strace message. + (cygwin_getsockopt): Ditto. + (cygwin_connect): Ditto. + (cygwin_accept): Ditto. + (cygwin_bind): Ditto. + (cygwin_getsockname): Ditto. + (cygwin_getpeername): Ditto. + (cygwin_recv): Fix prototype. + (cygwin_send): Ditto. + (cygwin_recvmsg): Improve strace message. + (cygwin_sendmsg): Ditto. -Sat Sep 15 22:54:49 2001 Christopher Faylor <cgf@cygnus.com> +2002-08-25 Pierre Humblet <Pierre.Humblet@ieee.org> - * net.cc (dup_servent_ptr): Detect old Windows 95 misaligned structure - and realign appropriately. + * sec_acl.cc (getacl): Check ace_sid == well_known_world_sid + before owner_sid and group_sid so that well_known_world_sid + means "other" even when owner_sid and/or group_sid are Everyone. + * security.cc (get_attribute_from_acl): Created from code common + to get_nt_attribute() and get_nt_object_attribute(), with same + reordering as in getacl() above. + (get_nt_attribute): Call get_attribute_from_acl(). + (get_nt_object_attribute): Ditto. + +2002-08-26 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (cygrunk.exe): Make a -mno-cygwin program. + * cygrun.c (main): Export CYGWIN=ntsec unless otherwise set. + + * shared.cc (shared_name): Only add build date to shared name when + *testing*. + +2002-08-24 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (DLL_IMPORTS): Move libuuid.a and libshell32.a to list + rather than referring to them via -l. Add DLL imports last in link + line for new-cygwin.dll and cygrun.exe. -Sat Sep 15 00:28:40 2001 Christopher Faylor <cgf@cygnus.com> +2002-08-19 Christopher Faylor <cgf@redhat.com> - * Makefile.in: Generate libcygwin.a during the link pass rather than as - a separate dlltool step. - * dcrt0.cc (_dll_crt0): pppid_handle could be NULL. Don't close it if - so. + * pinfo.h (pinfo::remember): Arrange for destructor call if + proc_subproc returns error. + * sigproc.cc (zombies): Store 1 + total zombies since proc_subproc uses + NZOMBIES element. -Fri Sep 14 20:48:18 2001 Christopher Faylor <cgf@cygnus.com> +2002-08-19 Corinna Vinschen <corinna@vinschen.de> + + * pwdgrp.h (pwdgrp_read::pwdgrp_read): Remove. + (pwdgrp_read::~pwdgrp_read): Ditto. + (pwdgrp_read::open): Reset fh to NULL instead of INVALID_HANDLE_VALUE. + (pwdgrp_read::close): Ditto. + +2002-08-19 Christopher Faylor <cgf@redhat.com> + + * fhandler.h (fhandler_console::send_winch_maybe): New method. + * fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed + code. + (fhandler_console::send_winch_maybe): Define new method. + (fhandler_console::read): Use send_winch_maybe where appropriate. + (fhandler_console::init): Just call all tcsetattr rather than + output_tcsetattr. + * select.cc (peek_console): Reorganize so that send_winch_maybe is + called for everything but keyboard input. + +2002-08-18 Christopher Faylor <cgf@redhat.com> + + * perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields. + (vfork_save::restore_pid): New method. + (vfork_save::restore_exit): New method. + * fork.cc (vfork): Save ctty, sid, pgid and restore them when returning + to "parent". Use exitval field if exiting but never created a new + process. + * syscalls.cc (setsid): Detect when in "vfork" and force an actual fork + so that pid will be allocated (UGLY!). + (getsid): New function. + * dcrt0.cc (do_exit): Use vfork_save::restore_exit method for returning + from a vfork. + * spawn.cc (spawnve): Use vfork_save::{restore_pid,restore_exit} + methods for returning from vfork. + * cygwin.din: Export getsid. + * include/cygwin/version.h: Bump api minor number. + + * malloc.cc: #ifdef sYSTRIm for when MORECORE_CANNOT_TRIM is true. + +2002-08-18 Christopher Faylor <cgf@redhat.com> + + * cygmalloc.h (MORECORE_CANNOT_TRIM): Define. + +2002-08-18 Christopher Faylor <cgf@redhat.com> + + * sigproc.cc (sigCONT): Define. + * sigproc.h (sigCONT): Declare. + (wait_sig): Create sigCONT event here. + * exceptions.cc (sig_handle_tty_stop): Wait for sigCONT event rather + than stopping thread. + (sig_handle): Set sigCONT event as appropriate on SIGCONT rather than + calling ResumeThread. + +2002-08-17 Christopher Faylor <cgf@redhat.com> + + * malloc.cc: Update to 2.7.2. + * malloc_wrapper.cc (malloc_init): Call user level mallocs to determine + if the malloc routines have been overridden. + +2002-08-16 Christopher Faylor <cgf@redhat.com> + + * winsup.h: Remove malloc_*lock functions. + +2002-08-16 Christopher Faylor <cgf@redhat.com> + + * Makefile.in: Add support for new malloc.o and renamed + malloc_wrapper.o. Use -fomit-frame-pointer for malloc.o compilation. + * malloc_wrapper.cc: New file. Rename from malloc.cc. Add support for + more malloc functions. Eliminate export_* calls. Just use straight + malloc names. Remove unused argument from malloc lock functions. + * cygwin.din: Just export straight malloc names. Add malloc_stats, + malloc_trim, malloc_usable_size, mallopt, memalign, valloc. + * dcrt0.cc (__cygwin_user): Eliminate export_* malloc entries. + * fork.cc (fork_parent): Remove unused argument from malloc_lock + argument. + * malloc.cc: New file. Doug Lea's malloc v2.7.1. + * cygmalloc.h: New file. + * include/cygwin/version.h: Bump API_MINOR. - * dcrt0.cc (dll_crt0_1): Create vfork main storage here so that it can - be queried in waitsig later. - * sigproc.cc (wait_sig): Don't deliver a signal if in a vfork. - * sigproc.h (sigframe::init): New method. - (sigframe): Use init. - * perthread.h: Declare main_vfork. - * fork.cc (vfork): Deliver all signals on parent return from vfork. + * sync.h (muto::acquire): Use appropriate number for regparm attribute. + (muto::reset): Ditto. + (muto::release): Ditto. + +2002-08-16 Pavel Tsekov <ptsekov@gmx.net> + + * exceptions.cc (interrupt_setup): Ensure that the previous signal mask + is properly saved. + +2002-08-15 Thomas Pfaff <tpfaff@gmx.net> + + * dcrt0.cc: Modify define for CYGWIN_GUARD. + (alloc_stack_hard_way): Just use CYGWIN_GUARD in VirtualAlloc call. + +2002-08-11 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler.h (fhandler_socket::recv): Remove method. + (fhandler_socket::send): Ditto. + * fhandler_socket.cc (fhandler_socket::recv): Ditto. + (fhandler_socket::send): Ditto. + (fhandler_socket::read): Delegate to fhandler_socket::recvfrom. + (fhandler_socket::write): Delegate to fhandler_socket::sendto. + (fhandler_socket::sendto): Check for null `to' address. + * net.cc (cygwin_sendto): Check for zero request length. + (cygwin_recvfrom): Ditto. Fix signature, use void *buf. + (cygwin_recv): Delegate to cygwin_recvfrom. + (cygwin_send): Delegate to cygwin_sendto. + +2002-08-11 Christopher Faylor <cgf@redhat.com> + + * cygthread.cc (cygthread::cygthread): Close another race. + +2002-08-11 Christopher Faylor <cgf@redhat.com> + + * assert.cc (__assert): Call debugger on assertion failure if + debugging. + * dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather + than going through the overhead of invoking it. + * fork.cc (fork_child): Ditto. + * exceptions.cc (signal_fixup_after_fork): Call sigproc_init here. + * sigproc.cc (proc_can_be_signalled): Assume that the signal thread is + live. + (sig_dispatch): Ditto. + (sig_send): Ditto. + (wait_for_sigthread): Rename from "wait_for_me". Assume that + wait_sig_inited has been set and that this function is only called from + the main thread. + * sigproc.h (wait_for_sigthread): Declare new function. + +2002-08-08 Christopher Faylor <cgf@redhat.com> -Fri Sep 14 10:21:00 2001 Corinna Vinschen <corinna@vinschen.de> + * environ.cc (parse_options): Remember the "no" part of any options for + later export. - * dcrt0.cc (_dll_crt0()): Don't call wincap.init() here. +2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com> -Fri Sep 14 00:37:54 2001 Christopher Faylor <cgf@cygnus.com> + * winsup.h (__check_null_invalid_struct): Make ptr argument non-const. + (__check_null_invalid_struct_errno): Ditto. + * miscfuncs.cc (__check_null_invalid_struct): Ditto. + (__check_null_invalid_struct_errno): Ditto. + (__check_invalid_read_ptr_errno): Remove superfluous cast. + * net.cc (get): Set appropriate errno if fd is not a socket. + (cygwin_sendto): Fix parameter checking. + (cygwin_recvfrom): Ditto. + (cygwin_setsockopt): Ditto. + (cygwin_getsockopt): Ditto. + (cygwin_connect): Ditto. + (cygwin_gethostbyaddr): Ditto. + (cygwin_accept): Ditto. + (cygwin_bind): Ditto. + (cygwin_getsockname): Ditto. + (cygwin_listen): Ditto. + (cygwin_getpeername): Ditto. + (cygwin_send): Ditto. + (cygwin_shutdown): Ditto. Move sigframe to fhandler_socket. + (cygwin_recvmsg): Fix parameter checking. Add tracing. + (cygwin_sendmsg): Ditto. + * fhandler_socket.cc (fhandler_socket::shutdown): Add sigframe. + * resource.cc (setrlimit): Fix parameter checking. - * fork.cc (vfork): Avoid recursive vforks. +2002-08-08 Joe Buehler <jbuehler@hekimian.com -Fri Sep 14 00:18:52 2001 Christopher Faylor <cgf@cygnus.com> + * sec_helper.cc (sec_acl): remove extraneous arg to debug_printf. - * fhandler.h (fhandler_pipe::is_slow): Return true only if pipes are - reliable (i.e., not Win9x). - * wincap.cc: Make statics NO_COPY to avoid fork overhead. +2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com> -Thu Sep 13 23:01:00 2001 Christopher Faylor <cgf@cygnus.com> + * fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call. - * grp.cc (read_etc_group): Just reuse group_buf storage for subsequent - reread of /etc/group. - * passwd.cc (read_etc_passwd): Just reuse passwd_buf storage for - subsequent reread of /etc/passwd. +2002-08-06 Christopher Faylor <cgf@redhat.com> -Thu Sep 13 20:46:05 2001 Christopher Faylor <cgf@cygnus.com> + * cygheap.cc (_csbrk): Avoid !cygheap considerations. + (cygheap_init): Deal with unintialized cygheap issues here. + (cheap_init): Move cygheap_max setting here. - * cygheap.cc (dup_now): New function. - (cygheap_setup_for_child): Accept new argument controlling whether to - delay copying of cygheap to shared memory region. - (cygheap_setup_for_child_cleanup): Accept new arguments controlling - whether to copy cygheap at this point. - * cygheap.h: Reflect above changes. - * fork.cc (fork_parent): Break copying of cygheap into two parts when - fork_fixup is required so that the child can see the parent's changes. - (vfork): Do stack cleanup prior to forcing a fork error. - * spawn.cc (spawn_guts): Ditto. +2002-08-06 Christopher Faylor <cgf@redhat.com> + Conrad Scott <conrad.scott@dsl.pipex.com -Thu Sep 13 17:14:59 2001 Christopher Faylor <cgf@cygnus.com> + * cygheap.cc (_csbrk): Allocate some slop initially. Don't erroneously + add sbrk amount to returned value in initial case. - * cygheap.cc (ccalloc): Pass correct length to creturn so that - cygheap_max is correctly calculated. +2002-08-06 Christopher Faylor <cgf@redhat.com> -Wed Sep 12 21:06:38 2001 Christopher Faylor <cgf@cygnus.com> + * spawn.cc (spawn_guts): Don't set mount_h here. + * sigproc.cc (init_child_info): Set it here instead. + * shared.cc (cygwin_mount_h): Make NO_COPY. - * sync.cc (muto::acquire): Fix while/if typo. +2002-08-06 Christopher Faylor <cgf@redhat.com> -Wed Sep 12 23:06:00 2001 Corinna Vinschen <corinna@vinschen.de> + * cygthread.cc (cygthread::stub): Accept flag to pass info structure to + thread function. + (cygthread::operator new): Add defensive debugging output. + (cygthread::cygthread): Add debugging output. Set name after thread + has been awakened to avoid a race. + (cygthread::exit_thread): Use handle operator rather than using ev + directly. + (cygthread::exit_thread): Reorganize to provide debugging. Set __name + to NULL. + * cygthread.h (cygself): Define. + * fhandler_tty.cc (fhandler_tty_master::init): Use cygself as argument + so that invoked thread can access its own info. + (process_output): Derive cygthread info of thread from thread argument. + * sigproc.cc (sigproc_init): Use cygself as argument so that invoked + thread can access its own info. + (wait_sig): Derive cygthread info of thread from thread argument. - * wincap.cc (wincapc::init): Simplify W2K/XP case. +2002-08-06 Conrad Scott <conrad.scott@dsl.pipex.com> -Wed Sep 12 23:02:00 2001 Corinna Vinschen <corinna@vinschen.de> + * debug.h (handle_list::allocated): Remove field. + * debug.cc (newh): Don't malloc extra entries. + (add_handle): Downgrade strace message level. + (delete_handle): Remove case for `allocated' entries. - * wincap.cc (wincapc::init): Set os name to "NT" on XP, too. +2002-08-05 Christopher Faylor <cgf@redhat.com> -Wed Sep 12 19:00:00 2001 Corinna Vinschen <corinna@vinschen.de> + * cygthread.cc (cygthread::stub): Change event creation to manual + reset. Set __name after calling SetEvent to prevent races. + (cygthread::detach): Always reset event here to prevent races. - * Makefile.in: Build wincap.o. - * wincap.cc: New file. - * wincap.h: Ditto. - * autoload.cc: Add dynamic load statement for `CreateHardLinkA'. - * dcrt0.cc (os_being_run): Eliminated. - (osname): Ditto. - (iswinnt): Ditto. - (set_os_type): Ditto. - (dll_crt0_1): Call wincap.init() instead of set_os_type(). - (_dll_crt0): Ditto. - * environ.cc (set_chunksize): New function. - (parse_thing): `forkchunk' setting now invokes function `set_chunksize'. - * fork.cc (chunksize): Eliminated. Moved to be member of wincap. - * host_dependent.h: Removed. - * syscalls.cc (_link): Try using `CreateHardLinkA' first, if available. - * cygheap.cc, dcrt0.cc, delqueue.cc, dir.cc, - environ.cc, fhandler.cc, fhandler.h, fhandler_console.cc, - fhandler_mem.cc, fork.cc, mmap.cc, net.cc, pinfo.cc, pinfo.h, - security.cc, syscalls.cc, sysconf.cc, syslog.cc, thread.cc, - times.cc, tty.cc, uinfo.cc, uname.cc, winsup.h: Use new wincap - capability check throughout. - * winsup.h: Include wincap.h. Eliminate extern declarations of - `os_being_run' and `iswinnt'. Eliminate `os_type" definition. - * include/cygwin/version.h: Bump version to 1.3.4. - -Wed Sep 12 01:03:36 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (call_signal_handler_now): Add additional guard against - inappropriately calling signal handler. - * syscalls.cc (_read): Reset errno if not exiting due to signal. - -Wed Sep 12 13:03:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - it's - an NT only call. - * thread.cc (pthread_cond::TimedWait): Use critical sections for NT. - (pthread_cond::fixup_after_fork): Don't detect bad apps. - (pthread_mutex::pthread_mutex): Use critical sections for NT. - (pthread_mutex::~pthread_mutex): Ditto. - (pthread_mutex::Lock): Ditto. - (pthread_mutex::TryLock): Ditto. - (pthread_mutex::UnLock): Ditto. - (pthread_mutex::fixup_after_fork): Ditto. Also do not detect bad apps. - (__pthread_mutex_trylock): Move WIN32 specific test into the class - method. - (__pthread_mutex_destroy): Prevent dereferencing passed pointer without - valid address. - * thread.h (pthread_mutex): Use critical sections for NT. +2002-08-03 Conrad Scott <conrad.scott@dsl.pipex.com> -Tue Sep 11 21:55:37 2001 Christopher Faylor <cgf@cygnus.com> + * debug.h (WaitForMultipleObjects): Correct typo. - * sigproc.h (sigframe::unregister): Return true/false whether this - frame is capable of responding to signals. - * exceptions.cc (sigframe::call_signal_handler): Don't call signal - handler if it is not armed for this thread. +2002-08-01 Pierre Humblet <Pierre.Humblet@ieee.org> -Tue Sep 11 11:23:10 2001 Christopher Faylor <cgf@cygnus.com> + * security.cc (verify_token): Do not reject a token just because + the supplementary group list is missing Everyone or a groupsid + equal to usersid, or because the primary group is not in the token, + as long as it is equal to the usersid. + * syscalls.cc (seteuid32): Use common code for all successful returns. + * grp.cc (getgroups32): Never includes Everyone in the output. - * cygwin.din: Remove cygwin_getshared. - * shared.cc: Ditto. - * include/cygwin/version.h: Bump API minor number. +2002-08-01 Christopher Faylor <cgf@redhat.com> -Tue Sep 11 11:14:11 2001 Dmitry Timoshkov <dmitry@baikal.ru> - - * dtable.cc (dtable::build_fhandler): Fix incorrect test for socket. - -Tue Sep 11 21:22:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.cc (pthread_cond::~pthread_cond): Fix incorrect use of - InterlockExchangePointer. - (pthread_mutex::~pthread_mutex): Ditto. - (semaphore::~semaphore): Ditto. - -Tue Sep 11 18:15:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * dcrt0.cc (cygwin_finished_initializing): Copy _mtinterf on fork. - * fork.cc (fork_child): Fixup thread-related structures after fork. - * thread.cc (MTinterface::Init): Initialise the new mutex, condition - and semaphore lists. - (MTinterface::fixup_after_fork): Iterate through each list and fixup - the objects. - (pthread_cond::pthread_cond): Add this to the condition list. - (pthread_cond::~pthread_cond): Remove this from the condition list. - (pthread_cond::fixup_after_fork): Recreate as best we can the pre-fork - state. - (pthread_mutex::pthread_mutex): Add this to the mutex list. - (pthread_mutex::~pthread_mutex): Remove this from the mutex list. - (pthread_mutex::fixup_after_fork): Recreate as best we can the pre-fork - state. - (semaphore::semaphore): Store the initial value, and add this to the - semaphore list. - (semaphore::~semaphore): Remove this from the semaphore list. - (semaphore::Post): Increment the current semaphore value. - (semaphore::TryWait): Decrement the current semaphore value. - (semaphore::Wait): Ditto. - (semaphore::fixup_after_fork): Recreate the pre-fork state as best we - can. - * thread.h (pthread_mutex): New members to allow fixup_after_fork. - (pthread_cond): Ditto. - (semaphore): Ditto. - (MTinterface): New list heads for tracking conds and semaphores. - -Sun Sep 9 22:11:27 2001 Christopher Faylor <cgf@cygnus.com> - - * dtable.cc (dtable::fixup_after_fork): Use SetStdHandle appropriately - on inherited fds. - -Sun Sep 9 20:09:11 2001 Christopher Faylor <cgf@cygnus.com> - - * sigproc.cc (NZOMBIES): Reduce substantially to minimize memory use. - -Mon Sep 10 08:28:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.h (MT_Interface): Remove pshared mutex array. Add a - threadsafe list for mutex tracking (for fixup after fork). - * thread.cc (MTInterface::Init): Remove pshared mutex array. - (pthread_mutex::pthread_mutex): Remove pshared mutex functionality. - Fail with EINVAL on attempts to use pshared functionality. - (__pthread_mutex_getpshared): Remove. - (__pthread_cond_timedwait): Remove pshared mutex functionality. - (__pthread_cond_wait): Ditto. - (__pthread_mutex_init): Ditto. - (__pthread_mutex_getprioceiling): Ditto. - (__pthread_mutex_lock): Ditto. - (__pthread_mutex_trylock): Ditto. - (__pthread_mutex_unlock): Ditto. - (__pthread_mutex_destroy): Ditto. - (__pthread_mutex_setprioceiling): Ditto. - (__pthread_mutexattr_setpshared): Ditto. - -Sun Sep 9 23:09:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * pwdgrp.h (pwdgrp_check::set_last_modified): Call GetFileTime() - instead of GetFileInformationByHandle(). - -Sun Sep 9 15:59:53 2001 Christopher Faylor <cgf@cygnus.com> - - * heap.h (inheap): Rewrite macro to accomodate removal of brk macros - below. + * cygthread.cc (cygthread::exit_thread): Define new method. + * cygthread.h (cygthread::exit_thread): Declare new method. + * fhandler.h (fhandler_tty_master::hThread): Delete. + (fhandler_tty_master::output_thread): Define. + * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Adjust + constructor. + (fhandler_tty_master::init): Use cygthread rather than handle. + (process_output): Use cygthread method to exit. + (fhandler_tty_master::fixup_after_fork): Set output_thread to NULL + after fork. + (fhandler_tty_master::fixup_after_exec): Set output_thread to NULL + after spawn/exec. + * tty.cc (tty_list::terminate): Detach from output_thread using + cygthread method. + +2002-08-01 Christopher Faylor <cgf@redhat.com> + + * syscalls.cc (_link): Revert previous change and just always + dereference the oldpath. + +2002-08-01 Christopher Faylor <cgf@redhat.com> + + * syscalls.cc (link): Properly deal with a link to a symlink. + +2002-08-01 Christopher Faylor <cgf@redhat.com> + + * cygthread.cc: Remove cruft. + +2002-08-01 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (DLL_OFILES): Add cygthread.o. + * dcrt0.cc (dll_crt0_1): Eliminate various thread initialization + functions in favor of new cygthread class. + * debug.cc: Remove thread manipulation functions. + * debug.h: Ditto. + * external.cc (cygwin_internal): Use cygthread method for determining + thread name. Remove capability for setting thread name. + * fhandler_console.cc (fhandler_console::read): Use cygthread method + rather than iscygthread function. + * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Use + cygthread methods to create threads. + (fhandler_tty_common::__acquire_output_mutex): Use cygthread method to + retrieve thread name. + * select.cc (pipeinf): Use cygthread pointer rather than handle. + (start_thread_pipe): Ditto. + (pipe_cleanup): Ditto. + (serialinf): Ditto. + (start_thread_serial): Ditto. + (serial_cleanup): Ditto. + (socketinf): Ditto. + (start_thread_socket): Ditto. + (socket_cleanup): Ditto. + * sigproc.cc (hwait_sig): Ditto. + (hwait_subproc): Ditto. + (proc_terminate): Ditto. + (sigproc_terminate): Ditto. + (sigproc_init): Initialize cygthread hwait_sig pointer. + (subproc_init): Initialize cygthread hwait_subproc pointer. + (wait_sig): Rely on cygthread HANDLE operator. + * strace.cc (strace::vsprntf): Use cygthread::name rather than threadname. + * window.cc (gethwnd): Use cygthread method to initialize thread. -Sun Sep 9 15:02:44 2001 Christopher Faylor <cgf@cygnus.com> +2002-07-31 Conrad Scott <conrad.scott@dsl.pipex.com> - * cygheap.cc (cygheap_fixup_in_child): Clear cygheap->base so that heap - is not forced to start at the same place in execed process. - * heap.cc: Remove brk* macros for clarity throughout. - * heap.h: Ditto. - * shared.cc (shared_info::initialize): Move heap_chunk test into - heap_chunk_size(). - (heap_chunk_size): Check for chunk size here. Don't go to registry if - heap_chunk_in_mb is already set. + * fhandler.h (fhandler_base::get_r_no_interrupt): Make non-virtual. + * net.cc (fdsock): Call set_r_no_interrupt. - * smallprint.c (console_printf): Add Windows 95 concessions. +2002-07-30 Christopher Faylor <cgf@redhat.com> -Sun Sep 9 13:01:06 2001 Christopher Faylor <cgf@cygnus.com> + * syscalls.cc (_read): Clarify debugging output. - * child_info.h (PROC_MAGIC): Bump magic number. +2002-07-30 Christopher Faylor <cgf@redhat.com> -Sun Sep 9 18:36:00 2001 Corinna Vinschen <corinna@vinschen.de> - Christopher Faylor <cgf@cygnus.com> + * fhandler.h (fhandler_base::get_r_no_interrupt): Make virtual. - * cygheap.cc (init_cygheap::etc_changed): New method to signal - a change in /etc. - * cygheap.h (struct init_cygheap): Add member `etc_changed_h' - and method `etc_changed'. - * grp.cc (enum grp_state): Eliminate. - (class grp_check): Ditto. - (group_state): Define as `class pwdgrp_check'. - (parse_grp): Remeber path and modification time of /etc/group file. - * passwd.cc (enum_pwd_state): Eliminate. - (class pwd_check): Ditto. - (passwd_state): Define as `class pwdgrp_check'. - (read_etc_passwd): Remember path and modification time of /etc/passwd - file. - * pwdgrp.h: New file. - (enum pwdgrp_state): Substitutes `pwd_state' and `grp_state'. - (class pwdgrp_check): Substitutes `pwd_check' and `grp_check'. +2002-07-30 Christopher Faylor <cgf@redhat.com> -Sun Sep 9 14:31:00 2001 Corinna Vinschen <corinna@vinschen.de> + * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate . + and .. processing here. + (fhandler_cygdrive::readdir): Assume . and .. are already in pdrive. + (fhandler_cygdrive::seekdir): Ditto. - * include/cygwin/version.h: Bump API minor version to 45 according - to adding the gamm*_r functions. +2002-07-29 Christopher Faylor <cgf@redhat.com> -Sat Sep 8 23:32:18 2001 Christopher Faylor <cgf@cygnus.com> + * dcrt0.cc (dll_crt0_1): Move debug_fixup_after_fork_exec. + * cygheap.cc (cygheap_fixup_in_child): Call debug_fixup_after_fork_exec + immediately after cygheap has been set up. - * fork.cc (fork_parent): Stop malloc activity while fork is in control - of the heap. - * sigproc.cc (NZOMBIES): Rename from ZOMBIEMAX for clarity. - (zombies): Revert to original behavior. Allocating zombie array - resulted in performance hit. - * winsup.h: Declare malloc lock routines. +2002-07-29 Corinna Vinschen <corinna@vinschen.de> -Fri Sep 7 21:35:35 2001 Christopher Faylor <cgf@cygnus.com> + * security.cc: Change some formatting. + * include/cygwin/version.h: Bump API minor version. - * cygwin.din: Add gamm*_r function exports. +2002-07-28 Pierre Humblet <Pierre.Humblet@ieee.org> -Fri Sep 7 17:11:11 2001 Christopher Faylor <cgf@cygnus.com> + * cygheap.h (class cygheap_user): Add member groups. + * security.h (class cygsidlist): Add members type and maxcount, methods + position, addfromgr, alloc_sids and free_sids and operator+= (const + PSID psid). Modify contains () to call position () and optimize add () + to use maxcount. + (class user_groups): Create. Update declarations of verify_token and + create_token. + * security.cc (cygsidlist::alloc_sids): New. + (cygsidlist::free_sids): New. + (get_token_group_sidlist): Create from get_group_sidlist. + (get_initgroups_sidlist): Create from get_group_sidlist. + (get_group_sidlist): Suppress. + (get_setgroups_sidlist): Create. + (verify_token): Modify arguments. Add setgroups case. + (create_token): Modify arguments. Call get_initgroups_sidlist and + get_setgroups_sidlist as needed. Set SE_GROUP_LOGON_ID from auth_pos + outside of the loop. Rename the various group sid lists consistently. + * syscalls.cc (seteuid32): Modify to use cygheap->user.groups. + (setegid32): Call cygheap->user.groups.update_pgrp. + * grp.cc (setgroups): Create. + (setgroups32): Create. + * uinfo.cc (internal_getlogin): Initialize and update + user.groups.pgsid. + * cygwin.din: Add setgroups and setgroups32. - * cygheap.h (init_cygheap): Move heap pointers here. - * include/sys/cygwin.h (perprocess): Remove heap pointers. - * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff. - (_dll_crt0): Don't initialize heap pointers. - (cygwin_dll_init): Ditto. - (release_upto): Use heap pointers from cygheap. - * heap.h: Ditto. - * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch. - (fork_child): Remove obsolete sigproc_fixup_after_fork. - * shared.cc (memory_init): Reorganize so that cygheap initialization is - called prior to regular heap since regular heap uses cygheap now. - * sigproc.cc (proc_subproc): Eliminate zombies allocation. - (sigproc_init): Move zombies alloation here. Don't free up array on - fork, just reuse it. - (sigproc_fixup_after_fork): Eliminate. - * sigproc.h: Ditto. - * include/cygwin/version.h: Reflect change to perprocess structure. +2002-07-28 Christopher Faylor <cgf@redhat.com> -Fri Sep 7 10:53:34 2001 Jason Tishler <jason@tishler.net> + * fhandler_console.cc (fhandler_console::read): Use appropriate + kill_pgrp method. + * select.cc (peek_console): Ditto. + * fhandler_termios.cc (fhandler_termios::bg_check): Send "stopped" + signal to entire process group as dictated by SUSv3. + * termios.cc (tcsetattr): Detect when stopped signal sent and force a + stop before setting anything. + +2002-07-26 Christopher Faylor <cgf@redhat.com> + + * include/cygwin/version.h: Bump API version to indicate that ntsec is + on by default now. + +2002-07-26 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler_registry.cc (fhandler_registry::close): Return any error + result to the caller. + * syscalls.cc (_close): Return result of fhandler::close to the caller. + +2002-07-25 Christopher Faylor <cgf@redhat.com> - * poll.cc (poll): Change implementation to only call select() when no - invalid file descriptors are specified. + * security.cc (allow_ntsec): Default to on. + (allow_smbntsec): Default to off. -Fri Sep 7 10:27:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-24 David MacMahon <davidm@smartsc.com> - * include/limits.h: Define PIPE_BUF. - * syscalls.cc (fpathconf): Use PIPE_BUF instead of numerical constant. - (pathconf): Ditto. + * times.cc (to_time_t): Always round time_t down to nearest second. -Thu Sep 6 20:04:05 2001 Christopher Faylor <cgf@cygnus.com> +2002-07-25 Egor Duda <deo@logos-m.ru> - * fhandler_socket.cc (fhandler_socket::fhandler_socket): Ensure that - prot_info_ptr is zeroed for later use. + * Makefile.in: Check if API version is updated when exports are + changed and stop if not so. -Thu Sep 6 14:03:49 2001 Christopher Faylor <cgf@cygnus.com> +2002-07-24 Egor Duda <deo@logos-m.ru> - * cygheap.cc (cygheap_fixup_in_child): Don't consider a NULL bucket as - a candidate for deletion. It is actually the end of a linked list - chain. + * include/cygwin/version.h: Bump minor API version. - * exceptions.cc (open_stackdumpfile): Default to "unknown" program name - if myself->progname hasn't been filled out yet. +2002-07-24 Corinna Vinschen <corinna@vinschen.de> -Thu Sep 6 01:16:44 2001 Christopher Faylor <cgf@cygnus.com> + * fhandler_serial.cc: Change 'must_init_serial_line capability' + to 'supports_reading_modem_output_lines' throughout (negated meaning). + * wincap.cc: Ditto. + * wincap.h: Ditto. - Move appropriate variables to NO_COPY segment, throughout. +2002-07-23 Nicholas Wourms <nwourms@netscape.net> -Thu Sep 6 00:40:35 2001 Christopher Faylor <cgf@cygnus.com> + * cygwin.din (fcloseall): Add symbol for export. + (fcloseall_r): Ditto. - Remove initialization of static or global values to zero, throughout. - This just needlessly grows the size of the DLL. - * tty.cc (tty::alive): Make inuse handle non-inheriting on open, just - for thread safety. +2002-07-24 Christopher Faylor <cgf@redhat.com> -Wed Sep 5 23:36:03 2001 Christopher Faylor <cgf@cygnus.com> + * path.cc (path_conv::check): Always set fileattr when component == 0. + (readlink): Use path_conv method rather than field. + * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto, + throughout. + * path.h (path_conv): Make fileattr private. + * exceptions.cc (try_to_debug): Default to idle priority when looping. - * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc. - * cygheap.cc: Throughout use bucket array from cygheap. +2002-07-23 Corinna Vinschen <corinna@vinschen.de> - * sigproc.cc (proc_subproc): Dynamically allocate zombie buffer to save - DLL space. - (sigproc_fixup_after_fork): Free zombie array after a fork. - * sigproc.h (sigproc_fixup_after_fork): Declare. + * fhandler_serial.cc: Use must_init_serial_line capability throughout. + * wincap.cc: Set flag must_init_serial_line appropriately. + * wincap.h: Add flag must_init_serial_line. -2001-09-06 Egor Duda <deo@logos-m.ru> +2002-07-23 Corinna Vinschen <corinna@vinschen.de> - * dir.cc (mkdir): Expand buffer for security descriptor to 4K to avoid - stack corruption. - * fhandler.cc (fhandler_base::open): Ditto. - * path.cc (symlink): Ditto. + * security.cc (get_group_sidlist): Create group list from /etc files + even if DC is available but access fails. -Wed Sep 5 21:35:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-22 Christopher Faylor <cgf@redhat.com> - * winver.rc: Change copyright to include 2001. + * fhandler_serial.cc: Fix formatting problems introduced by below + changes. -Wed Sep 5 12:12:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-22 Jacek Trzcinski <jacek@certum.pl> - * fhandler_floppy.cc (fhandler_floppy::lseek): Remove iswinnt check. + * fhandler.h (class fhandler_serial): Add new members of the class - + rts,dtr and method ioctl(). Variables rts and dtr important for Win 9x + only. + * fhandler_serial.cc (fhandler_serial::open): Add initial setting of + dtr and rts. Important for Win 9x only. + (fhandler_serial::ioctl): New function. Implements commands TIOCMGET, + TIOCMSET and TIOCINQ. + (fhandler_serial::tcflush): Fix found error. + (fhandler_serial::tcsetattr): Add settings of rts and dtr. Important + for Win 9x only. + * termios.h: Add new defines as a support for ioctl() function on + serial device. + +2002-07-20 Christopher Faylor <cgf@redhat.com> + + * autoload.cc (LoadDLLprime): Add jmp call to allow streamlining of + later jmp rewrite. + (doit): Avoid use of cx register. Just change one word to avoid races. + +2002-07-18 Pierre Humblet <pierre.humblet@ieee.org> + + * security.cc (get_unix_group_sidlist): Create. + (get_supplementary_group_sidlist): Evolve into get_unix_group_sidlist. + (get_user_local_groups): Add check for duplicates. + (get_user_primary_group): Suppress. + (get_group_sidlist): Silently ignore PDC unavailability. + Call get_unix_group_sidlist() before get_user_local_groups(). + Remove call to get_supplementary_group_sidlist(). Never call + get_user_primary_group() as the passwd group is always included. + Add well_known_authenticated_users_sid in only one statement. + +2002-07-19 Christopher Faylor <cgf@redhat.com> + + * fhandler_serial.cc (fhandler_serial::tcflush): Fix typo. + +2002-07-15 Corinna Vinschen <corinna@vinschen.de> + + * security.cc (get_group_sidlist): Fix formatting. + +2002-07-14 Christopher Faylor <cgf@redhat.com> + + * dcrt0.cc (initial_env): Force path and CYGWIN_DEBUG contents to lower + case. + * exceptions.cc (error_start_init): Use the name derived from + GetModuleName rather than myself->progname. + +2002-07-14 Christopher Faylor <cgf@redhat.com> + + * dcrt0.cc (dll_crt0_1): Move debug_init call back to here. Avoid a + compiler warning. + * shared.cc (memory_init): Remove debug_init call. + * debug.h (handle_list): Change "clexec" to "inherited". + * debug.cc: Remove a spurious declaration. + (setclexec): Conditionalize away since it is currently unused. + (add_handle): Use inherited field rather than clexec. + (debug_fixup_after_fork_exec): Ditto. Move debugging output to + delete_handle. + (delete_handle): Add debugging output. + * fhandler.cc (fhandler_base::set_inheritance): Don't bother setting + inheritance in debugging table since the handle was never protected + anyway. + (fhandler_base::fork_fixup): Ditto. + + * exceptions.cc (debugger_command): Revert. + +2002-07-14 Conrad Scott <conrad.scott@dsl.pipex.com> + + * debug.cc (clexec): Add missing `hl = hl->next'. + +2002-07-14 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (cygrun.exe): Add a -lcygwin on the end. + +2002-07-14 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (cygserver.exe): Add -lstdc++. + (cygrun.exe): Move -lgcc last. + +2002-07-13 Christopher Faylor <cgf@redhat.com> + + * dcrt0.cc (dll_crt0_1): Delay closing of some handles until cygheap + has been set up. + (break_here): New function, for debugging. + (initial_env): Add program name to "Sleeping" message. Implement new + "CYGWIN_DEBUG" environment variable option. + * exceptions.cc (debugger_command): Add argument to dumper call. + * strace.cc (strace::hello): Use winpid if cygwin pid is unavailable. + (strace::vsprntf): Ditto. + +2002-07-13 Christopher Faylor <cgf@redhat.com> + + * debug.h (handle_list): Move here from debug.cc. Add "inherit" flag + functionality. + * cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk. + (_csbrk): Reorganize to not assume first allocation is <= 1 page. + (cygheap_setup_for_child): Mark protected handle as inheritable. + * cygheap.h (cygheap_debug): New struct. + (init_cygheap): Add new structure when debugging. + * dcrt0.cc (dll_crt0_1): Remove call to debug_init. Close ppid_handle + here, if appropriate. Don't protect subproc_ready, since it is already + protected in the parent. Call memory_init prior to ProtectHandle to + ensure that cygheap is set up. Call debug_fixup_after_fork_exec when + appropriate. + (_dll_crt0): Don't close ppid_handle here. + * debug.cc: Use cygheap debug structure rather than static elements + throughout. + (add_handle): Don't issue a warning if attempt to protect handle in + exactly the same way from exactly the same place. Add pid info to + warning output. Accept additional argument controlling whether handle + is to be inherited. Add pid to stored information. + (debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork. + Reorganize to avoid erroneously skipping handles. + (mark_closed): Add pid info to warning output. + (setclexec): Rename from setclexec_pid. + * fhandler.cc (fhandler_base::get_default_fmode): Minor reorg. + (fhandler_base::fstat): Add debugging output. + (fhandler_base::set_inheritance): Call setclexec rather than + setclexec_pid. + (fhandler_base::fork_fixup): Ditto. + * fhandler_console.cc (get_tty_stuff): Mark protected handle as + inheritable. + * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. + * tty.cc (tty::make_pipes): Ditto. + (tty::common_init): Ditto. + * fork.cc (fork_parent): Ditto. + (fork_child): Close protected handles with correct name. Remove + debug_fixup_after_fork call. + * fhandler_socket.cc (fhandler_socket::create_secret_event): Mark + protected handle as inheritable/non-inheritable, as appropriate. + * shared.cc (memory_init): Mark protected handle as inheritable. + Call debug_init here. + * sigproc.cc (wait_sig): Close protected handle with correct name. + * spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as + inheritable. + + * exceptions.cc (debugger_command): Try to run dumper.exe, if found. + + * syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup + since path is already resolved. + +2002-07-12 Christopher Faylor <cgf@redhat.com> + + * cygwin.din: Change erroneous entries. -Wed Sep 5 11:34:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-11 Pavel Tsekov <ptsekov@gmx.net> + + * fhandler_disk_file.cc (fhandler_disk_file::open): Don't + move the file pointer to the end of file if O_APPEND is + specified in the open flags. - * fhandler_socket.cc (fhandler_socket::close): Change 2MSL value - according to MSDN. +2002-07-09 Christopher Faylor <cgf@redhat.com> -Wed Sep 5 10:14:00 2001 Corinna Vinschen <corinna@vinschen.de> + * debug.cc: Avoid explicit zeroing of globals. + (lock_debug): Make locker a static member. Avoid unlocking when + already unlocked (from Conrad Scott). + (debug_init): Initialize lock_debug::locker here. + * fork.cc (fork_child): Fix up fdtab earlier to avoid some (but not + all) confusion with close-on-exec craziness. - * net.cc (cygwin_connect): Add WSAEALREADY and WSAEINVAL handling - for non-blocking sockets. +2002-07-05 Corinna Vinschen <corinna@vinschen.de> -Tue Sep 4 22:42:13 2001 Christopher Faylor <cgf@cygnus.com> + * fhandler.h (fhandler_socket::is_unconnected): Constify. + (fhandler_socket::is_connect_pending): Ditto. + (fhandler_socket::is_connected): Ditto. + (fhandler_socket::set_connect_state): New method. + (struct select_record): Add member `except_on_write'. + (select_record::select_record): Initialize all bool values to `false'. + * fhandler_socket.cc: Use set_connect_state() method throughout. + (fhandler_socket::connect): Set state always to connected if connection + isn't pending. + * net.cc (cygwin_getsockopt): Revert erroneous previous patch. + * select.cc (set_bits): Check for `except_on_write'. Set fd in + write_fds if set. Set connect state to connected if fd has been + returned by WINSOCK_SELECT. + (peek_socket): Check for `except_on_write'. + (start_thread_socket): Ditto. + (fhandler_socket::select_write): Don't set `write_ready' if connect + is pending. Set `except_on_write' if connect is pending. - * exceptions.cc (ctrl_c_handler): Only send SIGINT when we have a - controlling terminal and we are the head of the process group. +2002-07-05 Christopher Faylor <cgf@redhat.com> -Tue Sep 4 16:48:14 2001 Christopher Faylor <cgf@cygnus.com> + * ntdll.h (_SYSTEM_PROCESSOR_TIMES): Force eight byte alignment. + (_SYSTEM_TIME_OF_DAY_INFORMATION): Ditto. - * thread.cc (InterlockedExchangePointer): Don't define if it already - exists. + * path.cc (suffix_scan::has): Reorganize to eliminate double scanning + for for .exe (in the typical case). -Tue Sep 4 22:14:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-05 Corinna Vinschen <corinna@vinschen.de> - * uname.cc (uname): Eliminate os specific retrieving of x86 - processor type. + * fhandler.h (UNCONNECTED): New define. + (CONNECT_PENDING): Ditto. + (CONNECTED): Ditto. + (class fhandler_socket): Add member `had_connect_or_listen'. + Add member functions `is_unconnected', `is_connect_pending' and + `is_connected'. + * fhandler_socket.cc (fhandler_socket::connect): Set member + `had_connect_or_listen' according to return code of WinSock + call. + (fhandler_socket::listen): Ditto. + * net.cc (cygwin_getsockopt): Modify SO_ERROR return value in + case of socket with pending connect(). + * select.cc (peek_socket): Only add socket to matching fd_set + if it's not "ready". Call WINSOCK_SELECT only if at least one + socket is in one of the fd_sets. + (start_thread_socket): Only add socket to matching fd_set + if it's not "ready". + (fhandler_socket::select_write): Set write_ready to true also + if socket isn't connected or listening. -2001-09-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp> +2002-07-04 Corinna Vinschen <corinna@vinschen.de> - * fhandler_console.cc (fhandler_console::char_command): Save the cursor - position relative to the top of the window. - * fhandler_cc (fhandler_console::write): Ditto. + * fhandler_socket.cc (fhandler_socket::set_sun_path): Don't free + memory here. Allow NULL parameter. -Mon Sep 3 21:06:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-04 Corinna Vinschen <corinna@vinschen.de> - * dir.cc (opendir): Write version information to __d_dirent->d_version. + * fhandler_socket.cc (fhandler_socket::dup): Add missing copy operation + on sun_path. -Mon Sep 3 18:34:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-07-03 Christopher Faylor <cgf@redhat.com> - * cygwin.din: Add `dirfd'. - * dir.cc (dirfd): New function. - (opendir): Open a directory file descriptor and save it in - __d_dirent->d_fd. - (closedir): Close directory file descriptor. - * include/cygwin/version.h: Bump API minor version to 44. + * include/cygwin/version.h: Bump DLL minor number. -Sun Sep 2 22:09:31 2001 Christopher Faylor <cgf@cygnus.com> +2002-07-03 Christopher Faylor <cgf@redhat.com> - * child_info.h: Modify magic number. - * dcrt0.cc (_cygwin_testing): Define. - (_dll_crt0): Set _cygwin_testing if CYGWIN_TESTING environment variable - exists. Don't issue "conflicting versions" error if _cygwin_testing is - true. - * shared.cc (shared_name): Use _cygwin_testing global rather than - testing the environment. - * syscalls.cc (_write): Remove debugging info. + * include/sys/statfs.h: New header file. -Sat Sep 1 01:37:13 2001 Christopher Faylor <cgf@cygnus.com> +2002-07-03 Christopher Faylor <cgf@redhat.com> - * tty.cc (tty::create_inuse): Eliminate unneeded argument. - * tty.h: Reflect above change. - * fhandler_tty.cc: Reflect argument reduction in tty::create_inuse, - throughout. Always make inuse inheritable. + * dtable.cc (cygwin_attach_handle_to_fd): Default to implicit bin mode + if none specified. + * fhandler.cc (fhandler_base::init): Make bin argument a guarantee + rather than a suggestion. + * path.cc (path_conv::check): Load flag returned from + cygwin_conv_to_win32_path into path_flags. -Sat Sep 1 01:10:07 2001 Christopher Faylor <cgf@cygnus.com> +2002-07-03 Conrad Scott <conrad.scott@dsl.pipex.com> - * debug.cc (mark_closed): Rename from debug_mark_closed and make - static. - (setclexec_pid): New function for marking saved handle as - close-on-exec. - (delete_handle): New function. - (debug_fixup_after_fork): New function. - * debug.h: Declare new functions, remove obsolete ones. - * fork.cc (debug_fixup_after_fork): Call to cleanup close-on-exec - handles. + * tty.cc (tty::common_init): Reverse logic of cygserver check in + call to SetKernelObjectSecurity. - * fhandler.cc (fhandler_disk_file::close): Minor reorg. - (fhandler_base::set_inheritance): Set flag appropriately for debugging - when close-on-exec so forked process can delete closed handles. - * tty.h (open_output_mutex): Eliminate unneeded argument. - (open_input_mutex): Ditto. - * fhandler_tty.cc (fhandler_tty_slave::open): reflect open_*_mutex - argument changes. - * fhandler.h (fhandler_socket): Make saw_shutdown_* functions type - bool. - * tty.cc (tty::get_event): Eliminate unneeded argument. - (tty::common_init): Reflect change to get_event. Events should always - be inherited. - -Fri Aug 31 21:39:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * security.cc (create_token): Change initialization of `exp' to comply - with new LARGE_INTEGER definition in winnt.h. - -Fri Aug 31 13:58:51 2001 Christopher Faylor <cgf@cygnus.com> - - * cygwin.sc: Revert to previous NO_COPY behavior. - * winsup.h: Ditto. - * sigproc.cc: Ditto. - * autoload.cc: Ditto. - -Fri Aug 31 00:56:26 2001 Christopher Faylor <cgf@cygnus.com> - - * cygwin.sc: New file -- linker script for building cygwin DLL. - * Makefile.in: Use linker script to control location of cygheap. - * cygheap.cc (buckets): Make static. - (init_cheap): Remove special iswinnt handling. Allocate cygheap at a - fixed location. Display more info when allocation fails. - (cygheap_fixup_in_child): Try harder to move cygheap to correct - location. Display more info when allocation fails. - * fhandler.h (fhandler_socket): Add macros for tracking socket shutdown - state. - * net.cc (cygwin_shutdown): Set appropriate shutdown value for future - use. - * select.cc (select_stuff::cleanup): New method. - (cygwin_select): Call cleanup explicitly to avoid a race. - (select_stuff:~select_stuff): Call cleanup chain via cleanup method. - (fhandler_socket::select_read): Set *_ready when shutdown has been - called on the socket. - (fhandler_socket::select_write): Ditto. - (fhandler_socket::select_except): Ditto. - - * winsup.h: Move NO_COPY to "COMMON" section. - * autoload.cc (wsock_started): Avoid initializing NO_COPY value. - * sigproc.cc: Remove initialization from NO_COPY variables. - (sigproc_init): Initialize sig_loop_wait here, rather than via - initialization. - (subproc_init): Initialize proc_loop_wait here, rather than via - initialization. - -Thu Aug 30 10:19:00 2001 Christopher Faylor <cgf@cygnus.com> - - * select.cc (select_read): Add setting read_ready flag. - (select_write): Add setting write_ready flag. - -Wed Aug 29 00:40:42 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (path_conv::check): Avoid splitting off leading '/' in path - component when building a symlink. - -Wed Aug 29 0:45:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * resource.cc (getrlimit): Return actual values on RLIMIT_STACK. - -Tue Aug 28 16:37:17 2001 Christopher Faylor <cgf@cygnus.com> - - * dir.cc (rmdir): Report ENOENT when file doesn't exist rather than - ENOTDIR. - -Mon Aug 27 11:58:19 2001 Christopher Faylor <cgf@cygnus.com> - - * select.cc (cygwin_select): Ensure that arguments are zeroed on - timeout. - (select_stuff::wait): Ditto. - -2001-08-24 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * syscalls.cc (check_tty_fds): New function. Check whether there is a - fd referring to pty slave. - (setsid): Don't detach console if the process has a pty slave. - -Fri Aug 24 8:54:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (free_addr_list): Add define for symmetry. - (free_hostent_ptr): Use free_addr_list to free h_addr_list element. - -Thu Aug 23 16:00:09 2001 Jason Tishler <jason@tishler.net> - - * net.cc (dup_addr_list): New static function. - (dup_hostent_ptr): Use dup_addr_list instead of dup_char_list in order - to handle embedded null characters. - -Wed Aug 22 22:23:14 2001 Christopher Faylor <cgf@cygnus.com> - - * dtable.cc (dtable::dup2): Allow extension of fd table by dup2. - * syscalls.cc: Minor code cleanup. - (fpathconf): Check for bad fd before doing anything else. - * termios.cc (tcsetattr): Don't convert to new termios if bad fd. - (tcgetattr): Minor debugging tweak. - -Wed Aug 22 23:41:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (cygwin_inet_ntoa): Rearrange previous patch to use - thread local buffer space when compiled thread safe. - (cygwin_getprotobyname): Ditto. - (cygwin_getprotobynumber): Ditto. - (cygwin_getservbyname): Ditto. - (cygwin_getservbyport): Ditto. - (cygwin_gethostbyname): Ditto. - (cygwin_gethostbyaddr): Ditto. Move near to cygwin_gethostbyname. - * thread.h (struct _winsup_t): Add pointers for above used buffer space. - * passwd.cc (getpwduid): Remove initializing passwd. - (setpwent): Ditto. - (endpwent): Ditto. - (setpassent): Ditto. - -Wed Aug 22 13:41:09 2001 Christopher Faylor <cgf@cygnus.com> - - * smallprint.c (console_printf): New function. - * dcrt0.cc (dll_crt0_1): Use console_printf for debugging output. - * debug.cc (debug_mark_closed): New function. - (close_handle): Use debug_mark_closed. - * debug.h: Declare new functions. - * dtable.cc (dtable::build_fhandler): Remove unneeded extern. - * spawn.cc: Cosmetic changes. - * winsup.h: Define NO_COPY for C files, too. Declare a global. - -Wed Aug 22 17:31:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (free_char_list): New static function. - (dup_char_list): Ditto. - (free_protoent_ptr): Ditto. - (dup_protoent_ptr): Ditto. - (free_servent_ptr): Ditto. - (dup_servent_ptr): Ditto. - (free_hostent_ptr): Ditto. - (dup_hostent_ptr): Ditto. - (cygwin_inet_ntoa): Use local static buffer to allow propagating of - the result to child processes. - (cygwin_getprotobyname): Ditto. - (cygwin_getprotobynumber): Ditto. - (cygwin_getservbyname): Ditto. - (cygwin_getservbyport): Ditto. - (cygwin_gethostbyname): Ditto. - (cygwin_gethostbyaddr): Ditto. +2002-07-03 Thomas Pfaff <tpfaff@gmx.net> -Mon Aug 20 11:56:19 2001 Christopher Faylor <cgf@cygnus.com> + * autoload.cc (WSAEventSelect): Define new autoload function. + (WSAEnumNetworkEvents): Ditto. + * fhandler_socket.cc (fhandler_socket::accept): If socket is + in blocking mode wait for incoming connection and signal. - * cygheap.cc (init_cheap): Allocate cygheap in shared memory for Windows NT. +2002-07-02 Christopher Faylor <cgf@redhat.com> -Thu Aug 16 09:38:59 2001 Jason Tishler <jason@tishler.net> + * cygheap.cc (init_cheap): Rearrange error message. + (cygheap_fixup_in_child): Ditto. + * dtable.cc: Remove if 0'ed code. + * fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode. + * sec_helper.cc (cygsid::get_id): Use system_printf for error message. + * tty.cc (tty::common_init): Ditto. - * fhandler_socket.cc (fhandler_socket::create_secret_event): Relax - security of secret_event so AF_UNIX socket clients can connect to - servers even if running under a different user account. - (fhandler_socket::check_peer_secret_event): Ditto. +2002-07-02 Christopher Faylor <cgf@redhat.com> -Thu Aug 16 16:26:00 2001 Corinna Vinschen <corinna@vinschen.de> + * net.cc (cygwin_getpeername): Defend against NULL pointer dereference. - * resource.cc (getrlimit): Return getdtablesize () as current limit - on RLIMIT_NOFILE. - * syscalls.cc (getdtablesize): Return OPEN_MAX if current dtable size - is less than OPEN_MAX, the current dtable size otherwise. - * sysconf.cc (sysconf): Return getdtablesize () on _SC_OPEN_MAX. +2002-07-02 Egor Duda <deo@logos-m.ru> -Thu Aug 16 16:17:00 2001 Corinna Vinschen <corinna@vinschen.de> + * include/cygwin/version.h: Bump API minor version. - * resource.cc (getrlimit): Return OPEN_MAX as current limit - on RLIMIT_NOFILE. - * syscalls.cc (getdtablesize): Return OPEN_MAX. - * sysconf.cc (sysconf): Return OPEN_MAX on _SC_OPEN_MAX. - * include/limits.h (OPEN_MAX): Define as 256. +2002-07-01 Pierre Humblet <pierre.humblet@ieee.org> -Wed Aug 15 12:43:00 2001 Corinna Vinschen <corinna@vinschen.de> + * security.cc (get_logon_server): Interpret a zero length + domain as the local domain. + (get_group_sidlist): Add authenticated users SID to SYSTEM's group + list instead of SYSTEM itself. + (verify_token): Accept the primary group sid if it equals + the token user sid. - * times.cc (utimes): Revert previous change. Just open the - file using FILE_WRITE_ATTRIBUTES instead of GENERIC_WRITE - on NT/W2K. +2002-07-02 Corinna Vinschen <corinna@vinschen.de> -Wed Aug 15 12:18:00 2001 Corinna Vinschen <corinna@vinschen.de> + * cygwin.din (__fpclassifyd): Add symbol. + (__fpclassifyf): Ditto. + (__signbitd): Ditto. + (__signbitf): Ditto. - * security.cc (set_nt_attribute): Return always -1 in case of - a failure. - * times.cc (utimes): On NTFS with ntsec ON, change the file's - security descriptor temporarily to acquire write access if - opening the file failed. +2002-07-02 Corinna Vinschen <corinna@vinschen.de> -Wed Aug 15 9:42:00 2001 Corinna Vinschen <corinna@vinschen.de> + * security.h (DONT_INHERIT): Eliminate definition. + (INHERIT_ALL): Ditto. + (INHERIT_ONLY): Ditto. + * sec_acl.cc: Use appropriate defines from accctrl.h instead of the + above throughout. + * security.cc: Ditto. - * fhandler.cc (fhandler_base::is_nonblocking): New method. - (fhandler_base::set_nonblocking): Ditto. - * fhandler.h (fhandler_base): Declare new methods `is_nonblocking' and - `set_nonblocking'. - * fhandler_socket.cc (fhandler_socket::ioctl): Use `set_nonblocking'. - * fhandler_tty.cc (fhandler_pty_master::process_slave_output): - Use `is_nonblocking'. - (fhandler_tty_slave::read): Ditto. - (fhandler_tty_slave::ioctl): Use `set_nonblocking'. - (fhandler_pty_master::ioctl): Ditto. - * net.cc (cygwin_sendto): Fallback to winsock 1 functionality - in case of nonblocking IO. - (cygwin_recvfrom): Ditto. - (cygwin_recv): Ditto. - (cygwin_send): Ditto. - * syscalls.cc (_read): Use `is_nonblocking'. +2002-07-01 Pierre Humblet <pierre.humblet@ieee.org> -Tue Aug 14 11:05:26 2001 Christopher Faylor <cgf@cygnus.com> + * syscalls.c (seteuid32): Return immediately if the program is not + impersonated and both uid and gid are original. + (setegid32): Return immediately if the new gid is the current egid. - * include/cygwin/version.h: Bump API version. +2002-07-01 Christopher Faylor <cgf@redhat.com> -2001-08-14 Egor Duda <deo@logos-m.ru> + * syscalls.cc (seteuid32): Fix incorrect placement of Pierre's patch + below. - * spawn.cc (spawn_guts): Enable appropriate privilege before - loading user's registry hive. +2002-07-01 Christopher Faylor <cgf@redhat.com> -Mon Aug 13 22:34:00 2001 Corinna Vinschen <corinna@vinschen.de> + * syscalls.cc (seteuid32): Fix incorrect use of system_printf. - * fhandler.cc (fhandler_base::fcntl): Use new O_NONBLOCK_MASK define. - * fhandler.h: Move definitions of O_NOSYMLINK, O_DIROPEN and - OLD_O_NDELAY from winsup.h to here. Add O_NONBLOCK_MASK define. - * fhandler_socket.cc (fhandler_socket::close): Add hack to allow - a graceful shutdown even if shutdown() hasn't been called by the - application. Add debug output. - (fhandler_socket::ioctl): Set fhandler's NONBLOCK flag according - to FIONBIO setting. - (fhandler_socket::fcntl): Use new O_NONBLOCK_MASK define. Actually - set `request' before using it. - * fhandler_tty.cc: Use new O_NONBLOCK_MASK define throughout. - (fhandler_tty_slave::ioctl): Set fhandler's NONBLOCK flag according - to FIONBIO setting. - (fhandler_pty_master::ioctl): Ditto. - * net.cc (wsock_event::prepare): Compare WSACreateEvent return code - with `WSA_INVALID_EVENT' according to MSDN. - * syscalls.cc (_read): Use new O_NONBLOCK_MASK define. +2002-07-02 Christopher January <chris@atomice.net> -Wed Aug 8 15:24:59 2001 Christopher Faylor <cgf@cygnus.com> + * autoload.cc (GetSecurityInfo): Define new autoload function. + (RegQueryInfoKeyA): Ditto. + * fhandler.h (fhandler_virtual::fill_filebuf): Change return type to + bool. + (fhandler_proc::fill_filebuf): Ditto. + (fhandler_registry::fill_filebuf): Ditto. + (fhandler_process::fill_filebuf): Ditto. + (fhandler_registry::value_name): Add new member. + (fhandler_registry::close): Add new method. + (fhandler_process::p): Remove member. + * fhandler_proc.cc (fhandler_proc::open): Add set_nohandle after + calling superclass method. Check return value of fill_filebuf. + (fhandler_proc::fill_filebuf): Change return type to bool. Add return + statement. + * fhandler_process.cc (fhandler_process::open): Add set_nohandle after + calling superclass method. Remove references to p. Check return value + of fill_filebuf. + (fhandler_process::fill_filebuf): Change return type to bool. Don't + use dereference operator on p. Add return statement. + (fhandler_process::format_process_stat): Fix typo. + * fhandler_registry.cc: Add static open_key declaration. + (fhandler_registry::exists): Assume path is already normalised. Try + opening the path as a key in its own right first, before reverting to + enumerating subkeys and values of the parent key. + (fhandler_registry::fstat): Add additional code to return more relevant + information about the registry key/value. + (fhandler_registry::readdir): Explicitly set desired access when + opening registry key. Remove output of buf from debug_printf format + string. + (fhandler_registry::open): Use set_io_handle to store registry key + handle. Set value_name member. Move code to read a value from the + registry to fill_filebuf. Add call to fill_filebuf. + (fhandler_registry::close): New method. + (fhandler_registry::fill_filebuf): Change return type to bool. Add + code to read a value from registry. + (fhandler_registry::open_key): Make function static. Use KEY_READ as + desired access unless this is the last path component. Check the + return value of RegOpenKeyEx for an error instead of hKey. + * fhandler_virtual.cc (fhandler_virtual::lseek): Check the return value + of fill_filebuf. + (fhandler_virtual::open): Remove call to set_nohandle. + (fhandler_virtual::fill_filebuf): Change return type to bool. Add + return statement. + * security.cc (get_nt_object_attribute): New function. + (get_object_attribute): New function. + * security.h (get_object_attribute): New function declaration. + +2002-07-01 Pierre Humblet <pierre.humblet@ieee.org> + + * syscalls.c (seteuid32): Do not return an error when the token cannot + be created only because of a problem with the gid. + +2002-07-01 Christopher Faylor <cgf@redhat.com> + + * fhandler_clipboard.c (fhandler_dev_clipboard::open): Force text mode. + * fhandler_console.cc (fhandler_console::open): *Really* force binary + mode rather than make it optional. + * fhandler_proc.cc (fhandler_proc::open): Ditto. + * fhandler_process.cc (fhandler_process::open): Ditto. + * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto. + * fhandler_raw.cc (fhandler_dev_raw::open): Ditto. + * fhandler_registry.cc (fhandler_registry::open): Ditto. + * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. + * fhandler_virtual.cc (fhandler_virtual::open): Ditto. + * fhandler_windows.cc (fhandler_windows::open): Ditto. + * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. + * net.cc (fdsock): Ditto. + * path.cc (set_flags): Add more debugging. + +2002-07-01 Christopher Faylor <cgf@redhat.com> + + * debug.cc (threads): Avoid initialization. + * uinfo.cc (cygheap_user::ontherange): (from Corinna Vinschen) Actually + make below changes work. + +2002-07-01 Christopher Faylor <cgf@redhat.com> + + * uinfo.cc (cygheap_user::ontherange): Make cygwin root the last resort + for HOMEPATH/HOMEDRIVE for consistency with HOME. + +2002-07-01 Corinna Vinschen <corinna@vinschen.de> + + * shared.cc (sec_none): Move to sec_helper.cc. + (sec_none_nih): Ditto. + (sec_all): Ditto. + (sec_all_nih): Ditto. + (get_null_sd): Ditto. + (sec_acl): Ditto. + (__sec_user): Ditto. + * sec_helper.cc (sec_none): Move from shared.cc to here. + (sec_none_nih): Ditto. + (sec_all): Ditto. + (sec_all_nih): Ditto. + (get_null_sd): Ditto. + (sec_acl): Ditto. + (__sec_user): Ditto. + +2002-06-30 Christopher Faylor <cgf@redhat.com> + + * uinfo.cc (cygheap_user::ontherange): Potentially set HOME from + existing homepath and homedrive cygheap_user fields (not currently used + yet). Set HOME to / if no other alternative. + (cygheap_user::test_uid): Simplify. + +2002-06-30 Christopher Faylor <cgf@redhat.com> + + * environ.cc (parse_options): Use setenv to potentially replace CYGWIN + value on export. Fixes broken behavior since November 2000 changes. + (regopt): Return indication of whether or not something has been parsed + from the registry. + (environ_init): Only attempt to export CYGWIN variable when values were + set from the registry. It is exported automatically otherwise. + +2002-06-30 Christopher Faylor <cgf@redhat.com> + + * fhandler.h (fhandler_process::pid): New field. + (fhandler_process::fstat): Remove unneeded array. Set pid element. + (fhandler_process::open): Ditto. + (fhandler_process::fill_filebuf): Handle case where 'p' field is NULL. + +2002-06-30 Christopher Faylor <cgf@redhat.com> + + * fhandler.h (fhandler_process::p): New field. + (fhandler_process:fill_filebuf): Revert to same definition as virtual + in parent class. + (fhandler_process::open): Fill out p field rather than passing as an + argument. + (fhandler_process::fill_filebuf): Use p pointer rather than argument. + +2002-06-29 Pierre Humblet <pierre.humblet@ieee.org> + + * security.cc (extract_nt_dom_user): Check for all buffer overflows. + Call LookupAccountSid after trying to get domain & user from passwd. + (get_group_sidlist): Obtain the domain and user by calling + extract_nt_dom_user instead of LookupAccountSid. + +2002-06-29 Christopher Faylor <cgf@redhat.com> + + * uinfo.cc (cygheap_user::test_uid): Use standard issetuid test. + +2002-06-29 Christopher Faylor <cgf@redhat.com> + + * autoload.cc (NetGetDCName): Change to make this an optional load + function. + * cygheap.h (cygheap_user::logsrv): Return NULL when operation fails. + (cygheap_user::winname): Ditto. + (cygheap_user::domain): Ditto. + * uinfo.cc (cygheap_user::env_logsrv): Save results in temp variable. + (cygheap_user::env_userprofile): Ditto. - * include/wchar.h: Define __need_wint_t. +2002-06-29 Christopher Faylor <cgf@redhat.com> -Wed Aug 8 11:46:00 2001 Corinna Vinschen <corinna@vinschen.de> + * environ.cc (spenv::retrieve): Detect return of env_dontadd from + cygheap_user methods. + (build_env): Avoid incrementing environment pointer if not actually + adding to the environment. That could result in garbage in the + environment table. Be more defensive when reallocing envblock. - * security.cc (alloc_sd): Revert to setting inheritance attribute for - permissions given to directories. Never set inheritance on NULL ACE. +2002-06-29 Christopher Faylor <cgf@redhat.com> -Tue Aug 7 18:11:00 2001 Corinna Vinschen <corinna@vinschen.de> + * uinfo.cc (cygheap_user::test_uid): Return NULL or further tests are + sorta useless. + (cygheap_user::env_domain): Recalculate if name is missing. - * security.cc (alloc_sd): Don't set FILE_DELETE_CHILD for group - if S_ISVTX attribute is given. - * dir.cc (mkdir): Allow immediate setting of S_ISUID, S_ISGID and - S_ISVTX attribute. - * syscalls.cc (_open): Ditto. +2002-06-29 Christopher Faylor <cgf@redhat.com> -Tue Aug 7 16:24:00 2001 Corinna Vinschen <corinna@vinschen.de> + * environ.cc (spenv::from_cygheap): Still need to take setuid into + consideration. - * dir.cc (mkdir): Set security attributes correctly for - CreateDirectoryA () call if ntsec is on. Don't call - set_file_attributes () then. - * fhandler.cc (fhandler_base::open): Ditto for CreateFileA () call. - * path.cc (symlink): Ditto. - * security.cc (set_security_attribute): New function. - * security.h: Add declaration for `allow_ntea' and - `set_security_attribute'. +2002-06-28 Christopher Faylor <cgf@redhat.com> -Tue Aug 7 10:54:00 2001 Corinna Vinschen <corinna@vinschen.de> + * uinfo.cc (cygheap_user::env_logsrv): Return "almost_null" in case + where no domain or username is "SYSTEM". - * grp.cc (class grp_check): New class. Make `group_state' - a member of class grp_check. - (read_etc_group): Free former allocated memory on reread. - * passwd.cc (class pwd_check): New class Make `passwd_state' - a member of class pwd_check. - (read_etc_passwd): Free former allocated memory on reread. +2002-06-28 Christopher Faylor <cgf@redhat.com> -Tue Aug 7 01:13:58 2001 Christopher Faylor <cgf@cygnus.com> + * cygheap.h (cygheap_user): Reorg to accommodate environment caching. + (cygheap_user::logsrv): New method. + (cygheap_user::winname): Ditto. + (cygheap_user::domain): Ditto. + (cygheap_user::test_uid): Ditto. + * cygheap.cc (cygheap_user::set_name): Reflect name "pwinname" name + change. + * environ.cc (getwinenveq): New function. + (penv::from_cygheap): penv::from_cygheap): Change arguments. + (spenv::retrieve): Ditto for call. Use getwinenveq to retrieve info + from environment. Always return value from cygwin environment, if it + exists. + * environ.h (getwinenveq): Declare. + * uinfo.cc (cygheap_user::ontherange): Use logsrv() rather than + env_logsrv(). + (cygheap_user::test_uid): Define new method. + (cygheap_user::env_logsrv): Accept environment arguments. Use test_uid + to find info. + (cygheap_user::env_domain): Ditto. + (cygheap_user::env_userprofile): Ditto. + (cygheap_user::env_homepath): Ditto. + (cygheap_user::env_homedrive): Ditto. + (cygheap_user::env_name): Ditto. + +2002-06-27 Christopher Faylor <cgf@redhat.com> + + * cygheap.cc (cfree_and_set): New function. + (cygheap_user::set_name): Use cfree_and_set to reset members. + * cygheap.h (cygheap_user): Delete static members. + (cygheap_user::puserprof): New member. + (cfree_and_set): Declare. + * dcrt0.cc (almost_null): Define. + * environ.cc (env_dontadd): Redefine as "almost_null". + * winsup.h (almost_null): Declare. + * syscalls.cc (cfree_and_set): Remove unused variable. + * uinfo.cc (cygheap_user::homepath_env_buf): Eliminate. + (cygheap_user::homedrive_env_buf): Ditto. + (cygheap_user::userprofile_env_buf): Ditto. + (cygheap_user::ontherange): YA change to try to preserve existing + HOMEPATH and HOMEDRIVE. Return almost_null values when variables + should not actually exist. + (cygheap_user::env_logsrv): Ditto. + (cygheap_user::env_domain): Ditto. + (cygheap_user::env_userprofile): Ditto. + +2002-06-27 Corinna Vinschen <corinna@vinschen.de> + + * dcrt0.cc (dll_crt0_1): Let __progname point to the applications + basename. Move eliminating ".exe" suffix from argv[0] so that it + always also affects __progname. + +2002-06-27 Thomas Pfaff <tpfaff@gmx.net> + + * thread.cc (pthread::create): Add trace printf to get CreateThread + LastError. + +2002-06-27 Corinna Vinschen <corinna@vinschen.de> + + * mmap.cc (list::match): Check using pagesize aligned size. + +2002-06-26 Christopher Faylor <cgf@redhat.com> + + * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Force + FindFirstFile on first file of directory when asking for x:\ . + +2002-06-26 Christopher Faylor <cgf@redhat.com> + + * cygheap.cc (cygheap_user::set_name): Correct thinko in below change. + +2002-06-26 Christopher Faylor <cgf@redhat.com> + + * cygheap.cc (cygheap_user::set_name): Avoid clearing things when just + setting name to itself or during first time initialization. + + * environ.cc (check_case_init): Make case insensitive. + +2002-06-26 Corinna Vinschen <corinna@vinschen.de> + + * fhandler.h (fhandler_socket::bind): Add method definition. + (fhandler_socket::connect): Ditto. + (fhandler_socket::listen): Ditto. + (fhandler_socket::accept): Ditto. + (fhandler_socket::getsockname): Ditto. + (fhandler_socket::getpeername): Ditto. + (fhandler_socket::recvfrom): Ditto. + (fhandler_socket::recvmsg): Ditto. + (fhandler_socket::sendto): Ditto. + (fhandler_socket::sendmsg): Ditto. + (fhandler_socket::shutdown): Ditto. + * fhandler_socket.cc (get_inet_addr): Move here from net.cc. + (fhandler_socket::bind): New method. + (fhandler_socket::connect): Ditto. + (fhandler_socket::listen): Ditto. + (fhandler_socket::accept): Ditto. + (fhandler_socket::getsockname): Ditto. + (fhandler_socket::getpeername): Ditto. + (fhandler_socket::recvfrom): Ditto. + (fhandler_socket::recvmsg): Ditto. + (fhandler_socket::sendto): Ditto. + (fhandler_socket::sendmsg): Ditto. + (fhandler_socket::shutdown): Ditto. + * net.cc: Various formatting cleanups throughout. + (get_inet_addr): Move to fhandler_socket.cc. + (cygwin_bind): Move base functionality to appropriate fhandler_socket + method. + (cygwin_connect): Ditto. + (cygwin_listen): Ditto. + (cygwin_accept): Ditto. + (cygwin_getsockname): Ditto. + (cygwin_getpeername): Ditto. + (cygwin_recvfrom): Ditto. + (cygwin_recvmsg): Ditto. + (cygwin_sendto): Ditto. + (cygwin_sendmsg): Ditto. + (cygwin_shutdown): Ditto. + +2002-06-26 Corinna Vinschen <corinna@vinschen.de> + + * pwdgrp.h (pwdgrp_read::~pwdgrp_read): Avoid compiler warning. + +2002-06-26 Christopher Faylor <cgf@redhat.com> + + * dcrt0.cc (_dcrt0): Be more defensive when reserved block is used and + it's not cygwin info. + +2002-06-26 Christopher Faylor <cgf@redhat.com> + + * autoload (noload): Avoid clobbering bx register. + + * environ.cc (codepage_init): Use case insensitive match. + + * fhandler_console.cc (cp_get_internal): Delete. + (con_to_str): Use get_cp to derive code page. + (str_to_con): Ditto. + * miscfuncs.cc (get_cp): New function. + (sys_wcstombs): New function. Converted from macro. + (sys_mbstowcs): Ditto. + * winsup.h: Reflect above changes. - * fhandler_console.cc (get_tty_stuff): Don't initialize shared memory - console area if it is already initialized. +2002-06-26 Christopher Faylor <cgf@redhat.com> - * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Augment debugging - info. + * winsup.h: Minor cleanup. + * path.h (path_conv::[]): New operator. + * syscalls.cc (_link): Use path_conv operators rather than methods, + where appropriate. Minor white space cleanup. -Mon Aug 6 19:58:43 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-26 Christopher Faylor <cgf@redhat.com> - * cygheap.cc (cygheap_root::set): Avoid treating '/' specially. + * include/cygwin/version.h: Bump DLL minor number. - * fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style - flag passed in from application. - * fhandler_socket.cc (fhandler_socket::fcntl): Ditto. - * fhandler.h: Set constant for future use. - * winsup.h: Define OLD_O_NDELAY only for old programs. - * include/cygwin/version.h: Define - CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK. +2002-06-25 Thomas Pfaff <tpfaff@gmx.net> -Sat Aug 4 16:52:03 2001 Christopher Faylor <cgf@cygnus.com> + * include/pthread.h (PTHREAD_CANCELED): Define a reasonable value. + * pthread.cc (pthread_exit): Call method instead of function. + (pthread_setcancelstate): Ditto. + (pthread_setcanceltype): Ditto. + (pthread_testcancel): Ditto. + * thread.h (pthread::cancel_event): New member. + (__pthread_cancel_self): New prototype. + (pthread::exit): New Method. + (pthread::cancel): Ditto. + (pthread::testcancel): Ditto. + (pthread::cancel_self): Ditto. + (pthread::static_cancel_self): Ditto. + (pthread::setcancelstate): Ditto. + (pthread::setcanceltype): Ditto. + (__pthread_cancel): Give c++ linkage. + (__pthread_exit): Remove. + (__pthread_setcancelstate): Ditto. + (__pthread_setcanceltype): Ditto. + (__pthread_testcancel): Ditto. + * thread.cc (pthread::pthread): Inititialize cancel_event. + (pthread::~pthread): Close cancel_event if needed. + (pthread::create): Create cancel_event. + (pthread::exit): New method. Replacement for __pthread_exit. + (pthread::cancel): New method. + (pthread::testcancel): Ditto. + (pthread::static_cancel_self); New static method. + (pthread::setcancelstate): New method. Replacement for + __pthread_setcancelstate. + (pthread::setcanceltype): New method. Replacement for + __pthread_setcanceltype. + (pthread::pop_cleanup_handler): Add lock for async cancel safe + cancellation. + (pthread::thread_init_wrapper): Change __pthread_exit to + thread->exit(). + (__pthread_cancel): Call method thread->cancel(). + (__pthread_exit): Remove. + (__pthread_setcancelstate): Ditto. + (__pthread_setcanceltype): Ditto. + (__pthread_testcancel): Ditto. - Throughout, change check for running under Windows NT to 'iswinnt'. - * dcrt0.cc (set_os_type): Set 'iswinnt' appropriately. - * cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating - cygheap. - (cygheap_setup_for_child_cleanup): New function. Standard function to - call after calling CreateProcess to cleanup cygheap info passed to - child. - (cygheap_fixup_in_child): Copy cygheap from shared memory into - allocated space under Windows 9x or if can't relocate shared space - under NT. - * cygheap.h: Declare new function. - * spawn.cc (spawn_guts): Use cygheap_fixup_in_child. - * fork.cc (fork_parent): Ditto. - * winsup.h: Declare iswinnt. +2002-06-25 Christopher Faylor <cgf@redhat.com> -2001-08-04 Egor Duda <deo@logos-m.ru> + * dcrt0.cc (sm): Make NO_COPY. - * dtable.cc (dtable::release): Avoid messing with console when - closing socket. +2002-06-25 Corinna Vinschen <corinna@vinschen.de> -Fri Aug 3 14:02:00 2001 Corinna Vinschen <corinna@vinschen.de> + * syscalls.cc (chown): Convert uid to 32 bit. + (lchown): Ditto. + (fchown): Ditto. - * net.cc (cygwin_accept): Allow NULL peer and len parameters. - * include/cygwin/socket.h: Define socklen_t as int. +2002-06-24 Christopher Faylor <cgf@redhat.com> -Fri Aug 3 13:04:00 2001 Corinna Vinschen <corinna@vinschen.de> + * dtable.cc (dtable::find_unused_handle): Avoid coercion. - * path.cc (fchdir): Set the fhandler's path to absolute value to ensure - changing to the correct directory even if the fhandler originally - points to a relative path. +2002-06-24 Christopher Faylor <cgf@redhat.com> -Thu Aug 2 17:59:00 2001 Corinna Vinschen <corinna@vinschen.de> + * dtable.cc (fhandler_base::dup2): Cleanup. Ensure that lock is turned + off in error condition. - * security.cc (set_file_attribute): Clean up. Don't call - `set_nt_attribute' when ntsec isn't set. +2002-06-24 Corinna Vinschen <corinna@vinschen.de> -Sat Jul 28 22:30:55 2001 Christopher Faylor <cgf@cygnus.com> + * uinfo.cc (internal_getlogin): Set myself->uid and myself->gid instead + of user.real_uid and user.real_gid. + (uinfo_init): Evaluate orig_uid and real_uid from myself->uid. Ditto + for gid. - * dcrt0.cc (alloc_stack_hard_way): Make half-hearted attempt to deal - with growing stack under Windows 95. +2002-06-23 Pierre Humblet <pierre.humblet@ieee.org> -Fri Jul 27 12:36:07 2001 Christopher Faylor <cgf@cygnus.com> + * security.cc (get_group_sidlist): Add pw argument and use pw->pw_name + in call to get_supplementary_group_sidlist. + (create_token): Add pw argument and use it in call to + get_group_sidlist. + * security.h: Add pw argument in declaration of create_token. + * syscalls.cc (seteuid32): Add pw argument in call to create_token. - * Makefile.in: Add install-lib and install-headers. +2002-06-23 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler.cc (fhandler_base::fstat): Set S_IFIFO for pipes. + * fhandler_socket.cc (fhandler_socket.cc::fstat): Set S_IFSOCK. + +2002-06-23 Christopher Faylor <cgf@redhat.com> + + * lib/_cygwin_S_IEXEC.cc: Remove obsolete file. + +2002-06-23 Christopher Faylor <cgf@redhat.com> + + Use cygwin_{shm,ipc}.h instead of /sys/{shm,ipc}.h throughout. + * sys/ipc.h: Remove. + * sys/shm.h: Remove. + * cygwin_ipc.h: New file. + * cygwin_shm.h: New file. + +2002-06-23 Christopher Faylor <cgf@redhat.com> + + * cygwin.sc: Add recent changes from ld sources. + +2002-06-23 Conrad Scott <conrad.scott@dsl.pipex.com> + + * winsup.h: Move #ifdef EXPCGF code into "winbase.h". + * winbase.h: #ifdef EXPCGF code moved here from "winsup.h". + +2002-06-12 Thomas Pfaff <tpfaff@gmx.net> + + * thread.h (pthread::cleanup_stack): Rename cleanup_handlers to + cleanup_stack. + * thread.cc (pthread::pthread): Ditto. + (pthread::create): Fix mutex verification. + (pthread::push_cleanup_handler): Renam cleanup_handlers to + cleanup_stack. Remvoe Mutex calls, use InterlockedExchangePointer + instead. + (pthread::pop_cleanup_handler): Rename cleanup_handlers to + cleanup_stack. + (pthread::pop_all_cleanup_handlers): Ditto. + (__pthread_once): Check state first and return if already done. + (__pthread_join): Revert DEADLOCK test to __pthread_equal call. + (__pthread_detach): Unlock mutex before deletion. -Fri Jul 27 12:28:12 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-21 Christopher Faylor <cgf@redhat.com> - * cygwin.din: Export sys_errlist, sys_nerr. - * include/cygwin/version.h: Bump minor version number. + * Makefile.in (cygrun.exe): Move -lgcc where it will do some good. -Fri 27 Jul 2001 10:29:00 Corinna Vinschen <corinna@vinschen.de> +2002-06-21 Corinna Vinschen <corinna@vinschen.de> - * security.cc (get_user_primary_group): Fix compiler warning. - (alloc_sd): Add DELETE permission for user when S_IWUSR is given. + * syscalls.cc (stat64_to_stat32): Correctly evaluate st_rdev. + (fstat64): Set st_rdev to same value as st_dev. + (stat_worker): Ditto. -Thu Jul 26 16:43:39 2001 Pieter de Visser <pieterdv@knoware.nl> +2002-06-21 Corinna Vinschen <corinna@vinschen.de> - * thread.cc (__pthread_equal): Invert return value so that true is - returned when threads are equal. + * security.cc (alloc_sd): Carefully check owner_sid again after trying + SIDs from cygheap. -Thu Jul 26 15:50:38 2001 Charles Wilson <cwilson@ece.gatech.edu> - Christopher Faylor <cgf@cygnus.com> +2002-06-21 Corinna Vinschen <corinna@vinschen.de> - * cygwin.din: Export __signgam. - * include/cygwin/version.h: Bump minor version number. + * security.cc (alloc_sd): Remove unnecessary retrieval of owner name. + Check uid for current user first and use SIDs from cygheap if so. + Set errno to EINVAL if user SID isn't retrievable. Just print user SID + as debug output. + Don't bail out if group SID isn't retrievable. Change debug output + appropriately. -Thu Jul 26 15:19:50 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-21 Christopher Faylor <cgf@redhat.com> - Throughout, reorganize header file inclusion to put security.h prior to - fhandler.h. - * fhandler.h (fhandler_base::get_inheritance): New method. - * fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper - close-on-exec inheritance when creating. - (fhandler_socket::check_peer_secret_event): Create handle as - non-inheritable. + * errno.cc: Change text description for EBADF throughout. -2001-07-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp> +2002-06-20 Pierre Humblet <pierre.humblet@ieee.org> - * syscalls.cc (setsid): Detach process from its console if the current - controlling tty is the console and already closed. - * dtable.h (class dtable): Add members to count descriptors referring - to the console. - * dtable.cc (dtable::dec_console_fds): New function to detach process - from its console. - (dtable::release): Decrement the counter of console descriptors. - (dtable::build_fhandler): Increment it. - * exception.cc (ctrl_c_handler): Send SIGTERM to myself when catch - CTRL_SHUTDOWN_EVENT. + * uinfo.cc (cygheap_user::ontherange): Use env_name for NetUserGetInfo. + (cygheap_user::env_logsrv): Verify env_domain is valid. + * environ.cc: Include child_info.h and keep spenvs[] sorted. + (environ_init): Check child_proc_info instead of myself->ppid_handle. -Tue 24 Jul 2001 02:28:00 PM Trevor Forbes <t4bs@hotmail.com> +2002-06-19 Christopher Faylor <cgf@redhat.com> - * thread.cc (verifyable_object_isvalid): Don't validate - PTHREAD_MUTEX_INITIALIZER pointer as it will cause an exception - in IsBadWritePtr() when running GDB. - -Wed 25 Jul 2001 23:46:00 Corinna Vinschen <corinna@vinschen.de> + * fhandler.cc (fhandler_base::set_flags): Change priority of "linked + in" default binmode setting so that it has priority over optional + setting. - * localtime.c: Changed whole file to become C++ clean. Rename to - localtime.cc. - * localtime.cc (tzload): Preserve errno. +2002-06-19 Christopher Faylor <cgf@redhat.com> -Fri 20 Jul 2001 11:15:50 PM EDT Christopher Faylor <cgf@cygnus.com> + Use hMainProc where appropriate, throughout. + * environ.cc (spenv::retrieve): Add debugging statements. - * cygheap.cc (cygheap_fixup_in_child): Attempt Win95 workaround. - * dtable.cc (dtable::dup_worker): Add debugging output. - (dtable::vfork_child_dup): Correctly set close_on_exec. - * fhandler.cc (fhandler_base::fork_fixup): Don't mess with handle if - there is no need to get it from the parent. - * fhandler_tty.cc (fhandler_tty_common::close): Add debugging output. + * pinfo.cc (set_myself): Don't call strace.hello if already stracing. + * strace.cc (strace): Move NO_COPY keyword so that it will actually + take effect. -Fri 20 Jul 2001 09:15:00 Mark Bradshaw <bradshaw@staff.crosswalk.com> +2002-06-19 Corinna Vinschen <corinna@vinschen.de> - * dir.cc (readdir): Protect FindNextFileA against INVALID_HANDLE_VALUE. + * uinfo.cc (cygheap_user::ontherange): Call NetUserGetInfo() only with + non-NULL logserver parameter. -Wed 18 Jul 2001 01:00:47 PM EDT Christopher Faylor <cgf@cygnus.com> +2002-06-16 Christopher Faylor <cgf@redhat.com> - * cygheap.cc (_cmalloc): Use correct constants for size calculation. - * dcrt0.cc (dll_crt0_1): Move uid initialization earlier. - * fork.cc (fork_parent): Move cygheap_setup_in_child to just prior to - CreateProcess so that all contents of cygheap are copied. + * cygheap.h (cygheap_user::issetuid): New method. + * dtable.cc (dtable::vfork_child_dup): Use new method to determine if + we are in "setuid mode." + * fork.cc (fork_parent): Ditto. * spawn.cc (spawn_guts): Ditto. + * syscalls.cc (seteuid32): Ditto. + (setegid32): Ditto. + * environ.cc (spenv::retrieve): (Suggested by Pierre Humblet) Do + potential recalculation of cygheap_user stuff when in setuid mode. + Return special value when environment variable should be calculated but + not added. + (build_env): Don't add retrieved value to dstp if it is 'dont_add'. + +2002-06-16 Christopher Faylor <cgf@redhat.com> + + Changes suggested by Pierre Humblet. + * environ.cc (NL): New macro. + (conv_envvars): Use NL macro to fill in name and namelen. + (spenv::namelen): New field. + (spenvs): Use NL to fill in name and namelen. + (spenv::retrieve): Eliminate length argument. Instead, use namelen + throughout. + (build_env): Don't calculate length of initial FOO= part of + environment. Accommodate spenv::retrive argument change. -Wed 18 Jul 2001 12:54:17 Corinna Vinschen <corinna@vinschen.de> - - * security.cc (get_user_groups): Call Net function with NULL server - name under specific error conditions. - (is_group_member): Ditto. - (get_user_local_groups): Ditto. - (get_user_primary_group): Ditto. - -Wed 18 Jul 2001 11:56:00 Corinna Vinschen <corinna@vinschen.de> - - * syscalls.cc (_unlink): Explicitly check for non-existant file. - -Tue 17 Jul 2001 10:19:00 Corinna Vinschen <corinna@vinschen.de> - - * delqueue.h: Remove obsolete file. - -Mon 16 Jul 2001 10:47:17 PM EDT Christopher Faylor <cgf@cygnus.com> - - * child_info.h: Bump magic number. - (class child_info): Add an element. - * cygheap.cc (init_cheap): Allocate cygwin heap in shared memory area. - (cygheap_fixup_in_child): Map cygwin heap, passed from parent via - shared memory into correct address. - (cygheap_setup_for_child): New function. - * cygheap.h: Declare new functions. - * dcrt0.cc (dll_crt0_1): Accomodate new cygheap_fixup_in_child - arguments. Avoid protecting subproc_ready unless it is spawn/nowait. - * fork.cc (fork_parent): Use new cygheap_setup_for_child function to - setup cygwin heap info. Close passed cygheap shared memory handle. - * spawn.cc (spawn_guts): Ditto. Also, reorganize to avoid - synchronization between parent and child in non-P_OVERLAY case. - * sigproc.cc (wait_sig): Only signal subproc_ready when execing. - -Mon 16 Jul 2001 15:21:00 Corinna Vinschen <corinna@vinschen.de> - - * grp.cc: Add missing Copyright date 2001. - -Mon 16 Jul 2001 00:11:00 Corinna Vinschen <corinna@vinschen.de> - - Change well_known_admin_sid to well_known_admins_sid throughout. - * sec_acl.cc (setacl): Never set DELETE permission. Set - FILE_DELETE_CHILD only on readable and executable directories. - * sec_helper.cc: Add constructor for `well_known_null_sid'. - * security.cc (get_nt_attribute): Set S_ISVTX for directories if - FILE_WRITE_DATA and FILE_EXECUTE but not FILE_DELETE_CHILD is set. - Add evaluation of S_ISVTX, S_ISGID and S_ISUID from NULL ACE. - (alloc_sd): Never set DELETE permission. Set FILE_DELETE_CHILD - only on readable and executable directories. - Add creation of NULL ACE for S_ISVTX, S_ISGID and S_ISUID permissions. - * security.h: Add extern declaration for `well_known_null_sid'. - -Fri 13 Jul 2001 08:08:49 PM EDT Christopher Faylor <cgf@cygnus.com> - - * syscalls.cc (stat_worker): Simplify previous change. - -Fri Jul 13 13:13:09 2001 Christopher Faylor <cgf@cygnus.com> - - * syscalls.cc (_unlink): Correct (?) logic which determines when - to report an access violation and when to queue file for eventual - deletion. - (stat_worker): Check for invalid buf argument. - -Tue Jul 10 23:01:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * mmap.cc (fhandler_disk_file::mmap): Try to open file mappings - by a unified name when running under 9x/ME. If that failes, create - the file mapping using the unified name. - -Mon Jul 9 10:43:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * uinfo.cc (internal_getlogin): Add pointer check. - -Mon Jul 9 10:05:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * security.cc (alloc_sd): Don't set inheritance attribute for - permissions given to directories. - -Thu Jun 28 22:19:08 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Return 0 for success. - -Wed Jun 27 22:19:07 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (path_conv::check): Add signal protection here since - retrieving info about remote shares can take some time. - -Wed Jun 27 23:30:00 2001 Robert Collins <rbtcollins@hotmail.com> - Christopher Faylor <cgf@cygnus.com> - - Change check_null_empty_path* to check_null_empty_str* throughout. - * path.h (check_null_empty_str_errno): Convert to a function prototype. - * path.cc (check_null_empty_str): Move to miscfuncs.cc. - * miscfuncs.cc (check_null_empty_str_errno): New function. - (__check_null_invalid_struct): Ditto. - (__check_null_invalid_struct_errno): Ditto. - (check_null_empty_str): Change from VirtualQuery to IsBadWritePtr. - * thread.cc (check_valid_pointer): Ditto. - * resource.cc (getrlimit): Use check_null_invalid_struct macro for - checking validity of pointer. - (setrlimit): Ditto. - -Tue Jun 26 16:59:16 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler.cc (fhandler_disk_file::fstat): Don't rely on exactly 3 - characters being read for executable test since we could be checking - for less than that. - * syscalls.cc (stat_worker): Try opening the file the "correct" way - first so that #! processing can potentially happen. If that fails, - then use "query open" method. +2002-06-16 Christopher Faylor <cgf@redhat.com> - * spawn.cc (spawn_guts): Delay processing of signal until after we've - notified parent about reparenting. + * cygheap.h (cygheap_user::winname): New field. + * cygheap.cc (cygheap_user::set_name): Clear winname when name changes. + * uinfo.cc (cygheap_user::env_logsrv): Avoid calculating server when + Windows user == SYSTEM. + (cygheap_user::env_domain): Set winname here too. + (cygheap_user::env_userprofile): Eliminate superfluous tests. + (cygheap_user::env_name): Seed winname by calling env_domain(). -Tue Jun 26 10:47:24 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-12 Pierre Humblet <pierre.humblet@ieee.org> - * mmap.cc: Clean up *ResourceLock calls throughout. + * spawn.cc (spawn_guts): Revert removal of ciresrv.moreinfo->uid = + ILLEGAL_UID. -Tue Jun 26 22:10:00 2001 Robert Collins rbtcollins@hotmail.com +2002-06-15 Christopher Faylor <cgf@redhat.com> - * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well - as WAIT_ABANDONED. - (__pthread_cond_timedwait): Calculate a relative wait from the abstime - parameter. + * child_info.h (child_proc_info): Declare as base class. + (spawn_info): Declare as alias of child_proc_info to aid debugging. + (fork_info): Ditto. + * cygheap.cc (cygheap_fixup_in_child): Use child_proc_info global + rather than parameter. + * cygheap.h (cygheap_fixup_in_child): Reflect above change in + declaration. + * dcrt0.cc (_dll_crt0): Move 'si' definition here. Assign + child_proc_info. + (dll_crt0_1): Accommodate cygheap_fixup_in_child and *_info changes. + * environ.cc (spenv::retrieve): Make regparm. + * environ.h (environ_init): Ditto. + (win_env::add_cache): Ditto. + (build_env): Ditto. + (getwinenv): Ditto. + * fork.cc (sync_with_parent): Use fork_info global. + (fork_child): Ditto. + +2002-06-14 Christopher Faylor <cgf@redhat.com> + + * uinfo.cc (cygheap_user::ontherange): Don't set HOMEDRIVE or HOMEPATH + unless one or the other is specified. + +2002-06-14 Christopher Faylor <cgf@redhat.com> + + * cygheap.h (cygheap_user::userprofile_env_buf): New static member. + * environ.cc (build_env): Add debugging statement. + (spenvs): Switch functions for USERDOMAIN and USERNAME. + * spawn.cc (spawn_guts): Move environment initialization prior to + cygheap_setup_for_child or environment info will never be copied to + child. -Sun Jun 24 17:38:19 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-14 Christopher Faylor <cgf@redhat.com> - * exceptions.cc (interrupt_setup): Move actions from setup_handler to - here. - (setup_handler): Move actions after a successful interrupt to - interrupt_setup. - * fork.cc (vfork): Augment debugging output. - * sigproc.cc (proc_subproc): Ditto. - * spawn.cc (spawn_guts): Ditto. Correctly fill out progname when spawn - NO_WAIT. Call signal handler when a signal arrives. - * sigproc.h: Declare a function. + * cygheap.h (cygheap_user): Add static members to hold home{drive,path} + info. + * uinfo.cc (cygheap_user::ontherange): Use static class members for + local HOME* storage. + +2002-06-14 Christopher Faylor <cgf@redhat.com> + + * cygheap.cc (cygheap_user::set_logsrv): Remove. + (cygheap_user::set_domain): Ditto. + * cygheap.h (cygheap_user::set_logsrv): Remove declaration. + (cygheap_user::set_domain): Ditto. + (cygheap_user::env_domain): Declare new method. + (cygheap_user::env_name): Ditto. + * environ.cc (spenvs): Add two environment variables. + * spawn.cc (spawn_guts): Call build_env after RevertToSelf. Always set + ciresrv.mount_h. + (cygheap_user::ontherange): Recalculate homedrive/homepath if they are + empty. Use env_logsrv to get logon server. + (cygheap_user::env_logsrv): Calculate server name here rather than + relying on it having been previously calculated. + (cygheap_user::env_domain): Ditto for domain name. + (cygheap-user::env_name): New method. + +2002-06-12 Pierre Humblet <pierre.humblet@ieee.org> + + * syscalls.cc (seteuid32): Do not get or set the environment. Do not + call LookupAccountSid nor internal_getlogin. Set cygheap->user name + and sid from the passwd entry. + * uinfo.cc (uinfo_init): Only call internal_getlogin when starting from + a non Cygwin process and use the values returned in user. + (internal_getlogin): Simplify to case where starting from a non Cygwin + process. Store return values in user and return void. Do not set the + Windows default environment. + * dcrt0.cc (dll_crt0_1): Call uinfo_init only when needed. Do not set + myself->uid nor reset user.sid. + * spawn.cc (spawn_guts): Get the sid from cygheap->user. Always + RevertToSelf(). Don't set uid in impersonated case. + * cygheap.cc (cygheap_user::set_sid): Do not set orig_sig. + (cygheap_user::set_orig_sid): New. + * cygheap.h: Declare cygheap_user::set_sid. + * winsup.h: Add argument to uinfo_init(). + +2002-06-14 Corinna Vinschen <corinna@vinschen.de> + + * environ.cc (build_env): If realloc moves envblock, move s with it. + +2002-06-13 Nicholas S. Wourms <nwourms@netscape.net> + + * winver.rc: Add more words to copyright. + +2002-06-13 Corinna Vinschen <corinna@vinschen.de> + + * cygheap.cc (cygheap_user::set_name): Revert previous change. + * environ.cc (spenv::retrieve): Check return value of call to + cygheap->user.*from_cygheap(). + +2002-06-13 Corinna Vinschen <corinna@vinschen.de> + + * cygheap.cc (cygheap_user::set_name): Remove setting homedrive and + homepath to NULL. + (cygheap_user::set_logsrv): Fix free'ing of plogsrv. + * cygheap.h (cygheap_user::cygheap_user): Initialize homedrive and + homepath to NULL. + +2002-06-13 Christopher Faylor <cgf@redhat.com> + + * security.cc (get_logon_server): Use strcasematch rather than + strcasecmp. + +2002-06-12 Christopher Faylor <cgf@redhat.com> + + * path.cc (chdir): Minor cleanup. + +2002-06-12 Christopher Faylor <cgf@redhat.com> + + * environ.cc (build_env): Correctly fill out windows environment block + with win32 paths rather than posix paths. + +2002-06-12 Christopher Faylor <cgf@redhat.com> + + * cygheap.cc (cygheap_user::set_name): Set homedrive and homepath to + NULL on user name change. + (cygheap_user::set_logsrv): Allocate enough space for leading \\ so + that we can put this in the environment, if needed. + * cygheap.h (homebodies): New enum. + (cygheap_user::homedrive): New field. + (cygheap_user::homepath): Ditto. + (cygheap_user::env_logsrv): New method. + (cygheap_user::env_homepath): New method. + (cygheap_user::env_homedrive): New method. + (cygheap_user::env_userprofile): New method. + (cygheap_user::ontherange): New method. + * environ.cc (envsize): Eliminate debugging argument. + (environ_init): Assume that envc counts number of elments not total + size. + (spenv): New class. + (spenvs): New array, rename from forced_winenv_vars, using spenv. + (spenv::retrieve): New method. + (build_env): Rename from 'winenv' -- one stop shopping for building new + environment blocks for both windows and "unix". + * environ.h (build_env: Declare. + (winenv): Delete declaration. + (envsize): Ditto. + * spawn.cc (spawn_guts): Use build_env to build windows and cygwin + environment blocks. + * uinfo.cc (internal_getlogin): Eliminate environment manipulation. + Default to info from GetUserName if it exists. Move HOMEPATH and + HOMEDRIVE stuff elsewhere. Move HOME setting elsewhere. Only set HOME + environment variable in processes that are not parented by a cygwin + process. + (cygheap_user::ontherange): Define new method. + (cygheap_user::env_logsrv): Ditto. + (cygheap_user::env_homepath): Ditto. + (cygheap_user::env_homedrive): Ditto. + (cygheap_user::env_userprofile): Ditto. + +2002-06-11 Christopher Faylor <cgf@redhat.com> + + * spawn.cc (spawn_guts): More hToken removal cleanup. + +2002-06-09 Pierre Humblet <pierre.humblet@ieee.org> + + * spawn.cc (spawn_guts): Define sec_attribs and call sec_user_nih() + only once. + +2002-06-10 Christopher Faylor <cgf@redhat.com> + + * Makefile.in: Ensure that -MD gets added to CFLAGS regardless of + CFLAGS command-line setting. + + * cygwin.din: Export sexec* functions as function which returns ENOSYS + (i.e., sexec* is deprecated). + * dtable.cc (dtable::vfork_child_dup): Ensure that impersonation is + restored even on failure. + * exec.cc: Throughout, remove references to sexec* and _spawnve. + * pinfo.h: Remove _spawnve declaration. + * spawn.cc: Rename _spawnve to spawnve and use throughout. + (spawn_guts): Eliminate hToken argument and processing of same. Just + perform special actions if impersonating. + (spawnve): Rename from _spawnve. + +2002-06-10 Christopher Faylor <cgf@redhat.com> + + * include/sys/strace.h (strace): Avoid use of constructor. + +2002-06-10 Christopher Faylor <cgf@redhat.com> + + * dcrt0.cc (dll_crt0_1): Initialize wincap and check for sanity before + running global ctors. + * wincap.h (wincap): Eliminate constructor. Default is to zero memory, + anyway. + * wincap.cc (wincap): Copy this on fork to avoid initialization in + forked processes. + +2002-06-10 Corinna Vinschen <corinna@vinschen.de> + + * fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from + 2002-06-04. + * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto. + (fhandler_socket::dup): Ditto. + * net.cc (fdsock): Make sockets explicitely noninheritable on NT. + +2002-06-09 Christopher Faylor <cgf@redhat.com> + + * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly + set number of links for directory, if appropriate. + +2002-06-10 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc: Variation of a patch from Thomas Pffaf. + (__pthread_detach): Cleanup thread object if the thread has terminated. + (__pthread_join): Change order of error checks, and lock against + join/detach/exit races. + (__pthread_exit): Lock object against join/detach/exit races. + (pthread::thread_init_wrapper): Ditto. + (thread_init_wrapper): Rename to pthread::thread_init_wrapper. + (pthread::create): Check that the mutex initialized correctly. + (pthread::push_cleanup_handler): Lock against potential cancellation + race. NB: this may not be required if pthread_cleanup_push is non- + cancelable. + * thread.h (pthread::mutex): New member. + (thread_init_wrapper): Rename to pthread::thread_init_wrapper. + (pthread::thread_init_wrapper_: New static member. + +2002-06-10 Robert Collins <rbtcollins@hotmail.com> + + * cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop. + * pthread.cc: Change __pthread_self to pthread::self() thruoghout. + (_pthread_cleanup_push): New function. + (_pthread_cleanup_pop): Ditto. + * thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop + patch, this work is derived from that. + Change __pthread_self to pthread::self() thruoghout. + (__pthread_self): Rename to pthread::self. + (pthread::self): New method. + (pthread::pthread): Initialize new member. + (pthread::push_cleanup_handler): New method. + (pthread::pop_cleanup_handler): New method. + (pthread::pop_all_cleanup_handlers): New method. + (__pthread_exit): Pop all cleanup handlers. + * thread.h (pthread::push_cleanup_handler): Declare. + (pthread::pop_cleanup_handler): Ditto. + (pthread::pop_all_cleanup_handlers): Ditto. + (pthread::self): New static method. + (__pthread_exit): Give C++ linkage. + (__pthread_join): Ditto. + (__pthread_detach): Ditto. + (__pthread_self): Remove. -Fri Jun 22 16:50:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-04-24 Thomas Pfaff <tpfaff@gmx.net> - * fhandler.h class fhandler_socket): Declare new method - `set_close_on_exec'. - * fhandler_socket.cc (fhandler_socket::set_close_on_exec): - New method. + * include/pthread.h (__pthread_cleanup_handler): New structure. + (pthread_cleanup_push): Rewritten. + (pthread_cleanup_pop): Ditto. + (_pthread_cleanup_push): New prototype. + (_pthread_cleanup_pop): Ditto. -Fri Jun 22 16:12:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-04-24 Thomas Pfaff <tpfaff@gmx.net> - * fhandler_tape.cc (fhandler_dev_tape::tape_erase): Set size - parameter to value expected by GetTapeParameters(). + * thread.cc (thread_init_wrapper): Check if thread is already joined. + (__pthread_join): Set joiner first. + (__pthread_detach): Ditto. -Thu Jun 21 22:01:39 2001 Marius Gedminas <mgedmin@delfi.lt> +2002-06-10 Robert Collins <rbtcollins@hotmail.com> + + * cygserver_transport.cc (create_server_transport): Finish the split + out of sockets code from transport_layer_base. Thanks to Nicholas + Wourms and Conrad Scott for catching this. + +2002-06-08 Christopher Faylor <cgf@redhat.com> + + * pinfo.cc (pinfo_dummy): Initialize to correct size. - * fhandler_console.cc (fhandler_console::read): Detect AltGr more - robustly on WinNT. +2002-06-08 Christopher Faylor <cgf@redhat.com> -2001-06-22 Robert Collins <rbbtcollins@hotmail.com> + * path.cc: Change MOUNT_AUTO to MOUNT_CYGDRIVE throughout. + * shared_info.h (CURR_MOUNT_MAGIC): Update. - * thread.cc (__pthread_cond_timedwait): Lock the waiting mutex before - the condition protect mutex to avoid deadlocking. (Found by Greg Smith). - (__pthread_cond_wait): Ditto. +2002-06-08 Christopher Faylor <cgf@redhat.com> -2001-06-30 Egor Duda <deo@logos-m.ru> + * external.cc (cygwin_internal): Make v1 mount table access invalid. + * path.cc (mount_info::init): Remove had_to_create_mount_areas initialization. + (mount_info::from_registry): Remove v1 table import. + (mount_info::read_v1_mounts): Eliminate. + (mount_info::import_v1_mounts): Ditto. + * shared_info.h (mount_info): Ditto for both of above. + * sys/mount.h (MOUNT_DEVFS): New enum. + (MOUNT_PROC): Ditto. - * fhandler.cc (fhandler_base::open): Work around windows bug when - CreateFile() with dwDesiredAccess == 0 called on remote share returns - valid handle even if file doesn't exist. +2002-06-08 Christopher Faylor <cgf@redhat.com> -2001-06-20 Egor Duda <deo@logos-m.ru> + * include/wchar.h: Define __need_size_t. - * fhandler_socket.cc (fhandler_socket::signal_secret_event): New - function. - * fhandler.h: Declare it. - * fhandler_socket.cc (fhandler_socket::create_secret_event): Don't - signal secret event immediately. - (fhandler_socket::check_peer_secret_event): Do it after peer event - was opened. - * net.cc (cygwin_connect): Or if socket is non-blocking. - (cygwin_accept): Ditto. +2002-06-07 Christopher Faylor <cgf@redhat.com> -Mon Jun 18 17:09:25 2001 Christopher Faylor <cgf@cygnus.com> + * fhandler_socket.cc (fhandler_socket::fstat): Don't assume that socket + is unix-domain socket. - * fhandler_tty.cc (fhandler_tty_slave::init): Revert 2001-06-16 change. +2002-06-07 Christopher Faylor <cgf@redhat.com> - * fork.cc (fork_copy): Print more debugging info. - (fork_parent): Change order of arguments to accomdate buggy gcc. - (fork): Ditto. + * times.cc (hires_ms::prime): Set init flag. -Sun Jun 17 18:54:46 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-07 Conrad Scott <conrad.scott@dsl.pipex.com> - * syscalls.cc (_unlink): Reorganize to try harder to delete file with - DeleteFile and to recover more gracefully if FILE_FLAG_DELETE_ON_CLOSE - doesn't work properly. + * times.cc (hires_ms::prime): Adjust epoch of initime_us from 1601 to + 1970. -Sat Jun 16 13:06:49 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-06 Christopher Faylor <cgf@redhat.com> - * exceptions.cc (sig_handle_tty_stop): Reset PID_STOPPED if not - actually stopping. - * fhandler_console.cc (fhandler_console::fixup_after_fork): Don't set - controlling terminal if just inheriting a handle. - (fhandler_console::fixup_after_exec): Ditto. - * fhandler_tty.cc (fhandler_tty_slave::init): Ditto. - * signal.cc (kill_worker): Set appropriate errno if proc_exists - determines that process does not really exist. + * autoload.cc (timeGetDevCaps): Define new autoload function. + (timeGetTime): Ditto. + (timeBeginPeriod): Ditto. + (timeEndPeriod): Ditto. + * hires.h (hires_base): New class. Rename from hires. + (hires_us): New class. + (hires_ms): New class. + * strace.cc (strace::microseconds): Use hires_us class. + * times.cc (gettimeofday): Use hires-ms class. + (hires_us::prime): Rename from hires::prime. + (hires_us::usecs): Rename from hires:usecs. + (hires_ms::prime): New method. + (hires_ms::usecs): New method. + (hires_ms::~hires_ms): New destructor. -Fri Jun 15 14:34:19 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-06 Christopher Faylor <cgf@redhat.com> - * path.cc (path_conv::check): Deal more robustly with foo/ behavior. + * autoload.cc (noload): Correctly save argument count register. -Fri Jun 15 11:15:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler_tape.cc (fhandler_dev_tape::tape_status): Set size - parameter to value expected by GetTapeParameters(). +2002-06-05 Conrad Scott <conrad.scott@dsl.pipex.com> + + * fhandler.cc (fhandler_base::fstat): Initialise tv_nsec member of + st_atim, st_mtim, and st_ctim fields. + * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto. + * fhandler_process.cc (fhandler_process::fstat): Ditto. + * glob.c (stat32_to_STAT): Copy across the whole st_atim, st_mtime, and + st_ctim fields. + * syscalls.cc (stat64_to_stat32): Ditto. + * times.cc (to_timestruc_t): New function. + (time_as_timestruc_t): New function. + * winsup.h: Add to_timestruc_t and time_as_timestruc_t functions. + * include/cygwin/stat.h: Replace time_t with timestruc_t throughout for + all file times, removing the st_spare1, st_spare2, and st_spare3 fields + in the process. Add macros to access tv_sec fields by old names. + * include/cygwin/types.h: Typedef timespec_t and timestruc_t as struct + timespec. + +2002-06-03 Pierre Humblet <pierre.humblet@ieee.org> + + * sec_helper.cc (lookup_name): Suppress. + * security.cc (alloc_sd): Remove logsrv argument. + Remove two calls to lookup_name. + (set_security_attribute): Remove logsrv argument. + Remove logsrv argument in call to alloc_sd. + (set_nt_attribute): Remove logsrv argument. + Remove logsrv argument in call to set_security_attribute. + (set_file_attribute): Remove logsrv argument. + Remove logsrv argument in call to set_nt_attribute. + (set_file_attribute): Remove logsrv argument. + Remove logsrv argument in call to set_file_attribute. + * syscalls.cc (chown_worker): Remove logserver argument in + call to set_file_attribute. + (chmod): Ditto. + * shm.cc (shmget): Remove logsrv argument in call to alloc_sd. + * uinfo.cc (internal_getlogin): Replace calls to + lookup_name by call to LookupAccountName. + * security.h: Remove logsrv in declarations of set_file_attribute + and alloc_sd. Remove declaration of lookup_name. + +2002-06-05 Christopher Faylor <cgf@redhat.com> + + * child_info.h (CHILD_INFO_MAGIC): Oops. Revert previous change. gcc + 3.1 bug? + +2002-06-05 Christopher Faylor <cgf@redhat.com> + + * child_info.h (CHILD_INFO_MAGIC): Update. + +2002-06-05 Christopher Faylor <cgf@redhat.com> + + * strace.cc (strace::hello): Set inited, when appropriate. + +2002-06-05 Christopher Faylor <cgf@redhat.com> + + * cygwin.din: Eliminate some newlib wrappers. + * path.cc (get_devn): Only consider first 99 potential com devices. + (get_device_number): Ditto. + * times.cc (_times): Eliminate. + (_times): Rename from times(). + +2002-06-05 Christopher Faylor <cgf@redhat.com> + + * dir.cc (rmdir): Streamline. Detect attempts to remove directories + from "read-only" virtual devices. (Suggested by Pavel Tsekov) + * syscalls.cc (unlink): Detect attempts to remove directories from + "read-only" virtual devices. (From Pavel Tsekov) + +2002-06-05 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (handle_to_fn): Check error return value from NtQueryObject + first before seeing if name buffer is NULL. + + * grp.cc (read_etc_group): Fix gcc warning regarding snprintf format. + * passwd.cc (read_etc_passwd): Ditto. + +2002-04-18 Thomas Pfaff <tpfaff@gmx.net> + + * thread.h (pthread::joiner): New member. + * thread.cc (pthread::pthread): Initialize joiner to NULL + (pthread::create): Increment of thread counter moved from + __pthread_create to this location. + (__pthread_create): Increment thread counter removed. + (thread_init_wrapper): Set joiner to self when thread was created + detached. + (__pthread_exit): delete thread when it is detached and not + joined. + (__pthread_join): Check for deadlock and delete thread when it has + terminated. + (__pthread_detach): Set joiner to self when thread state + changed to detached. + +2002-06-05 Corinna Vinschen <corinna@vinschen.de> + + * grp.cc (read_etc_group): When emulating nonexisting group file on + NT systems, read primary group SID from process token. Use that info + to create correct group entry. On error or on 9x systems fallback + to emulating Administrators group as before. + * passwd.cc (read_etc_passwd): When emulating nonexisting passwd file + on NT systems, read user and primary group SID from process token. + Use that info to create correct passwd entry. On error or on 9x + systems fallback to emulating user with Administrator user id and + Administrators group as before. + +2002-06-05 Corinna Vinschen <corinna@vinschen.de> + + * grp.cc (etc_group): Removed. + (parse_grp): Make line parameter nonconst. Don't copy data into new + allocated memory. Check for CR instead of LF to accomodate new + read method. + (add_grp_line): Make line parameter nonconst. + (read_etc_group): Rearrange using new pwdgrp_read class. + * passwd.cc (parse_pwd): Don't copy data into new allocated memory. + Check for CR instead of LF to accomodate new read method. + (read_etc_passwd): Rearrange using new pwdgrp_read class. + * pwdgrp.h (pwdgrp_check::set_last_modified): Use different + parameters. + (class pwdgrp_read): New class for opening and reading passwd and + group files. + +2002-06-04 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote + shares. + * path.cc (mount_info::conv_to_win32_path): Set flags to binary when + mount entry is not found. + (mount_info::set_flags_from_win32_path): Ditto. + +2002-06-04 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (handle_to_fn): Correct placement and length of name + buffer. (Suggested by Pavel Tsekov) + +2002-06-04 Christopher Faylor <cgf@redhat.com> + + Remove fcntl.h includes throughout. + * fhandler.h: Move fcntl.h include here. + (fhandler_base::set_flags): Accept supplied_bin argument. Make + non-inlined. + * dtable.cc (dtable::init_std_file_from_handle): Just use binmode from + pc. + (reset_to_open_binmode): Use set_flags. + * cygwin.din (open): Avoid newlib wrapper. + (read): Ditto. + (unlink): Ditto. + (write): Ditto. + * fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument. + Make binmode decisions here. + (fhandler_base::open): Avoid using pc if it is NULL. Eliminate binmode + logic. Just call set_flags with binmode argument. + (fhandler_base::init): Call set_flags with binmode argument. + * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto. + * fhandler_console.cc (fhandler_console::open): Ditto. + (fhandler_console::init): Force binary on open. + * fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode + here. Let it happen in base class. + * fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open. Set + return value appropriately if unable to open. + * fhandler_proc.cc (fhandler_proc::open): Make sure flags are set + before open_status. + * fhandler_process.cc (fhandler_process::open): Ditto. + * fhandler_registry.cc (fhandler_registry::open): Ditto. + * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto. + * fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default. + * fhandler_serial.cc (fhandler_serial::init): Ditto. + * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. + (fhandler_pty_master::open): Ditto. + * fhandler_virtual.cc (fhandler_virtual::open): Ditto. + * fhandler_windows.cc (fhandler_windows::open): Ditto. + * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. + * net.cc (fdsock): Ditto. + * path.cc (path_conv::check): Avoid checking for executable extension + when directory. (Suggested by Pavel Tsekov) + (set_flags): Set PATH_TEXT explicitly, when appropriate. + (mount_info::conv_to_win32_path): Use set_flags() to set path flags. + * path.h (PATH_TEXT): New enum. + (path_conv::binmode): Return appropriate constant based on binmode. + * pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY. + * syscalls.cc (setmode_helper): Make debugging message a little + clearer. + (setmode): Set binmode via set_flags. + +2002-06-04 Corinna Vinschen <corinna@vinschen.de> + + * fhandler.h (class fhandler_socket): Add private method + fixup_after_fork (bool, HANDLE). + * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Move + functionality to new private method. Add closing parent socket + if not called from dup(). Create method new calling private method + with appropriate parameter. + (fhandler_socket::fixup_after_exec): Call private method + fixup_after_fork with appropriate parameter. + (fhandler_socket::dup): Ditto. + +2002-06-04 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_dsp.cc (fhandler_dev_dsp::open): Set errno to EACCES if + requested mode isn't supported. + +2002-06-03 Christopher Faylor <cgf@redhat.com> + + * fhandler.cc (fhandler_base::open): Don't set binmode if already set. + Don't check for file. Files should already be set. Report on binary + mode for debugging. + (fhandler_base::fhandler_base): Don't set default binmode here. That's + for later. + * fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set + binmode, ever, for console. + * fhandler_disk_file.cc (fhandler_disk_file::open): Always set the + binary mode to the value derived from mount table. + * path.cc (mount_info::conv_to_win32_path): Default to binmode if path + does not translate into anything in the mount table. + +2002-06-03 Corinna Vinschen <corinna@vinschen.de> + + * external.cc (cygwin_internal): Add CW_EXTRACT_DOMAIN_AND_USER + handling to call extract_nt_dom_user() from applications. + * include/sys/cygwin.h (cygwin_getinfo_types): Add + CW_EXTRACT_DOMAIN_AND_USER. + +2002-06-03 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (stat64_to_stat32): Transform st_dev correctly. + (fstat64): Add evaluating st_ino and st_dev. + (stat_worker): Evaluate st_dev as 32 bit value. + * include/cygwin/stat.h: Use new dev_t definition throughout. + * include/cygwin/types.h: Define __dev16_t and __dev32_t. Define + dev_t according to __CYGWIN_USE_BIG_TYPES__ setting. + * include/sys/sysmacros.h: Define major, minor and makedev + according to __CYGWIN_USE_BIG_TYPES__ setting. + +2002-06-03 Pierre Humblet <pierre.humblet@ieee.org> + + * syscalls.cc (setegid32): Verify the correctness of the gid + of the group returned by getgrgid32. + +2002-06-03 Pierre Humblet <pierre.humblet@ieee.org> + + * security.cc (lsa2wchar): Suppressed. + (get_lsa_srv_inf): Suppressed. + (get_logon_server_and_user_domain): Suppressed. + (get_logon_server): Essentially new. + (get_user_groups): Add "domain" argument. Only lookup the + designated server and use "domain" in LookupAccountName. + (is_group_member): Simplify the arguments. + (get_user_local_groups): Simplify the arguments. Do only a + local lookup. Use "BUILTIN" and local domain in LookupAccountName. + (get_user_primary_group). Only lookup the designated server. + (get_group_sidlist): Remove logonserver argument. Do not lookup + any server for the SYSTEM account. + (create_token): Delete logonserver and call to get_logon_server. + Adjust arguments of get_group_sidlist, see above. + * security.h: Delete declaration of get_logon_server_and_user_domain + and add declaration of get_logon_server. + * uinfo.cc (internal_get_login): Call get_logon_server instead of + get_logon_server_and_user_domain. + +2002-06-02 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (handle_to_fn): Use largest match for device. Correctly + (?) deal with remote drive weirdness. + +2002-06-02 Christopher Faylor <cgf@redhat.com> + + * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Check + specifically for non-existent file, first. + (fhandler_disk_file::fstat): Perform fd open on files with funny + characters. + +2002-06-02 Christopher January <chris@atomice.net> + + * fhandler_process.cc (fhandler_process::open): Set fileid. + +2002-06-02 Christopher Faylor <cgf@redhat.com> + + Remove unneeded sigproc.h includes throughout. + * fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument. + * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search + for given pid. + (fhandler_proc::readdir): Assume that pid exists if it shows up in the + winpid list. + * fhandler_process.cc (fhandler_process::open): Simplify search for + given pid. Call fill_filebuf with pinfo argument. + (fhandler_process::fill_filebuf): Pass pinfo here and assume that it + exists. + * pinfo.h (pinfo::remember): Define differently if sigproc.h is not + included. -Thu Jun 14 20:19:46 2001 Christopher Faylor <cgf@cygnus.com> +2002-06-02 Christopher Faylor <cgf@redhat.com> - * fhandler.cc (fhandler_disk_file::fstat): Properly set executable bits - for directory when !ntsec && !ntea. Also move common code prior to - call to get_attributes. + * dll_init.cc (dll_list::detach): Don't run destructor on exit. -Fri June 15 09:25:00 Robert Collins <rbtcollins@hotmail.com> +2002-06-01 Christopher Faylor <cgf@redhat.com> - * thread.cc (pthread_cond::Signal): Release the condition access - variable correctly. + * fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into + caller. + * syscalls.cc (stat_worker): Calculate dev and ino calculation here, if + zero. + * fhandler_proc.cc (fhandler_proc::fhandler_proc): Minor reorg for + debugging. + * fhandler_process.cc (fhandler_process::exists): Return 0 on + nonexistence. + (fhandler_process::fstat): Simplify pid logic. + * fhandler_tape.cc (fhandler_dev_tape::fstat): Minor reformatting. -2001-06-14 Egor Duda <deo@logos-m.ru> +2002-06-01 Christopher Faylor <cgf@redhat.com> - * fhandler.cc (fhandler_base::open): Set win32 access flags to 0, when - requested. - * fhandler.h: New status flag FH_QUERYOPEN. - (fhandler::get_query_open): New function. - (fhandler::set_query_open): Ditto. - * syscalls.cc (stat_worker): Request query-only open mode. + * path.cc (chdir): Don't allow cd'ing to a non-directory virtual path. -2001-06-12 Egor Duda <deo@logos-m.ru> +2002-05-31 Christopher Faylor <cgf@redhat.com> - * environ.cc (set_file_api_mode): New function. Move setting - of file APIs mode (OEM/ANSI) here. - (codepage_init): From here. - * winsup.h (set_file_api_mode): Declare it. - * fork.cc (fork_child): Set file APIs mode in forkee. + * fhandler_disk_file.cc (readdir): Move inode calculation into caller. + (fhandler_cygdrive::readdir): Add "." and "..". + * dir.cc (readdir): Move inode calculation here so that fhandler + readdirs can benefit. -Mon Jun 11 14:19:49 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-31 Christopher Faylor <cgf@redhat.com> - * pinfo.cc: Use autoloaded ToolHelp functions throughout for Win9x. - * autoload.cc: Autoload ToolHelp functions. + * fhandler_console.cc (fhandler_console::open): Reinstate setting of + flags. - * sigproc.cc (proc_subproc): Incorporate SIGCHLD == SIG_IGN special - handling of zombie processes. Ensure that zombie processes which are - at the end of the zombie array are properly cleaned up. + * dtable.cc (dtable::init_std_file_from_handle): Default to using + binmode derived from path_conv, when required. + * fhandler.h (fhandler_base::get_w_binary): Default to binmode if + nothing else is specified. + * fhandler.h (fhandler_base::get_r_binary): Ditto. -Mon Jun 11 11:18:56 2001 Christopher Faylor <cgf@cygnus.com> + * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_handle): Work + around g++ warning. - * path.cc (chdir): Fix call to path_conv constructor so that it REALLY - doesn't check for the null/non-empty path. + * path.cc (path_conv::check): Remove a debugging statement. -Sun Jun 10 23:34:09 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-31 Christopher Faylor <cgf@redhat.com> - * path.cc (path_conv::update_fs_info): Don't consider remote drives to - be NTFS. Set root_dir before invoking GetDriveType (from Kazuhiro - Fujieda <fujieda@jaist.ac.jp>). Eliminate extra checks for rootdir. + * fhandler_console.cc (fhandler_console::open): Always default to + binmode. + (fhandler_console::write_normal): Don't honor binmode setting. There + is already a termios setting for this. + (fhandler_console::init): Correct argument order in init call. -Sun Jun 10 20:19:47 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-31 Christopher Faylor <cgf@redhat.com> - * path.cc (chdir): Pre-check path for validity before eating trailing - space. Then, ensure that path_conv doesn't check the path for validity - again. + * fhandler.cc (fhandler_base::open): Make default open mode == binmode. + (fhandler_base::init): Set open flags based on derived binmode argument. -Sun Jun 10 12:56:00 2001 Christopher Faylor <cgf@redhat.com> +2002-05-31 Christopher Faylor <cgf@redhat.com> - * exceptions.cc (sigdelayed): Ensure that signal is cleared as - the last operation or suffer races. - * sigproc.cc (proc_subproc): Deal with zombie array overflow. + * dll_init.cc (dll_list::init): Eliminate unneeded debugging statement. -Sun Jun 10 11:56:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-31 Christopher Faylor <cgf@redhat.com> - * cygwin.din: Add fchdir symbols. - * path.cc (chdir): Guard against invalid parameter. - (fchdir): New function. - * include/cygwin/version.h: Bump API minor version to 40. - * uinfo.cc (internal_getlogin): Remove unused variable. + * fhandler_proc.cc (fhandler_proc::readdir): Set errno when no more + files. + * fhandler_process.cc (fhandler_process::readdir): Ditto. + * fhandler_registry.cc (fhandler_registry::readdir): Ditto. -Sat Jun 9 23:20:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-30 Christopher Faylor <cgf@redhat.com> - * syscalls.cc (seteuid): Set environment variables USERNAME and - USERDOMAIN before impersonation to workaround a LookupAccountSid() - misbehaviour. - * uinfo.cc (internal_getlogin): Revert most of the previous change. - Don't set environment variables USERNAME and USERDOMAIN. That's - the job of seteuid() now. Try to get logon server from Lsa - only if logon server isn't already known. + * path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES + for nonexistent virtual device path. + (chdir): Set correct errno when attempt is made to cd to nonexistent + virtual device path. -Thu Jun 7 15:54:32 2001 Robert Collins <rbtcollins@hotmail.com> +2002-05-30 Christopher Faylor <cgf@redhat.com> - * thread.cc (pthread_cond::Broadcast): Don't print error messages on - invalid mutexs - user programs are allowed to call - pthread_cond_broadcast like that. - (__pthread_cond_timedwait): Initialise themutex properly. - (__pthread_cond_wait): Initialise themutex properly. + * fhandler_disk_file.cc (fhandler_disk_file::fstat): Always call + fstat_by_name if fd is not opened to allow fstat_by_name to properly + set errno. -Tue Jun 5 19:56:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-30 Corinna Vinschen <corinna@vinschen.de> - * fhandler_console.cc (fhandler_console::dup): Allocate space for - savebuf on Cygwin heap. - (fhandler_console::char_command): Ditto. Use correct values for size. + * autoload.cc: Replace autoload statments for ZwXXX by NtXXX. + Drop ZwQuerySystemInformation since NtQuerySystemInformation was + already available. + * fhandler_proc.cc (format_proc_uptime): Replace call to + ZwQuerySystemInformation by call to NtQuerySystemInformation. + (format_proc_stat): Ditto. + * fhandler_process.cc (format_process_stat): Replace call to + ZwQueryInformationProcess by call to NtQueryInformationProcess. + (get_process_state): Ditto. + (get_mem_values): Ditto. Replace call to ZwQueryVirtualMemory by + call to NtQueryVirtualMemory. + * ntdll.h: Cleanup. Drop ZwQuerySystemInformation since + NtQuerySystemInformation was already available. Replace declarations + of ZwXXX functions by declarations of NtXXX. + * pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation + by call to NtQuerySystemInformation. -2001-06-05 Egor Duda <deo@logos-m.ru> +2002-05-29 Christopher Faylor <cgf@redhat.com> - * security.h (NTWriteEA): Change prototype. - * ntea.cc (NTReadEA): Don't check for global ntea setting, now - it's caller responsibility. - (NTWriteEA): Ditto. - * security.cc (get_file_attribute): Read attribute from EA only - if 'ntea' is enabled. - (set_file_attribute): Ditto. - * path.h: (class path_conv): Add members to store file system - information. - (path_conv::get_drive_type): New function. - * syscalls.cc (stat_worker): Use it. - * path.cc (path_conv::update_fs_info): New functions. - (path_conv::check): Get file system information from device where - file resides. On NTFS, try to read symlink contents from EA. - (get_symlink_ea): New function. - (set_symlink_ea): Ditto. - (symlink): Store symlink in extended attribute, if possible. + * fhandler.cc (binmode): Default to binmode when mode is not known. -Tue Jun 5 11:18:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-29 Christopher Faylor <cgf@redhat.com> - * fhandler.cc (fhandler_disk_file::fstat): Always reset file position - to original value after checking for executable magic. + * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate. + * external.cc (fillout_pinfo): Use it. -Mon Jun 4 16:21:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-29 Corinna Vinschen <corinna@vinschen.de> - * cygheap.h (cygheap_user::cygheap_user): Initialize token to - INVALID_HANDLE_VALUE. - * uinfo.cc (uinfo_init): Close token handle if needed. + * external.cc (fillout_pinfo): Use new version define. + * include/sys/cygwin.h (external_pinfo): Define + EXTERNAL_PINFO_VERSION_16_BIT and EXTERNAL_PINFO_VERSION_32_BIT + instead of just EXTERNAL_PINFO_VERSION. -Sun Jun 3 20:52:13 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-29 Christopher Faylor <cgf@redhat.com> - * path.cc (normalize_posix_path): Revert .. check removed by previous - changes. - * cygheap.h: Temporarily declare path_prefix_p here. - -Mon Jun 4 0:14:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (wsock_event): Add destructor. - -Sun Jun 3 09:49:55 2001 Robert Collins <rbtcollins@hotmail.com> - - * dlfcn.cc (dlclose): Do not call FreeLibrary if the symbol to close - was obtained by dlopen(NULL,...). - -Sat Jun 2 23:11:52 2001 Christopher Faylor <cgf@cygnus.com> - - * syscalls.cc (sleep): Try to be a little more accomodating of signal - arrival. Ensure that the signal handler is called. - -Sat Jun 2 14:07:28 2001 Christopher Faylor <cgf@cygnus.com> - - * cygheap.cc (cygheap_root::cygheap_root): Remove constructor. - (cygheap_root::~cygheap_root): Remove destructor. - (cygheap_root::operator =): Remove. - (cygheap_root::set): New method. - * cygheap.h (cygheap_root): Reflect above changes. Store root info in - mount-like structure. - (cygheap_root:posix_ok): New method. - (cygheap_root::ischroot_native): Ditto. - (cygheap_root::unchroot): Ditto. - (cygheap_root::exists): Ditto. - (cygheap_root::posix_length): Ditto. - (cygheap_root::posix_path): Ditto. - (cygheap_root::native_length): Ditto. - (cygheap_root::native_path): Ditto. - * dir.cc (opendir): Remove special chroot test. - * path.cc (path_prefix_p): Remove front end. - (normalize_posix_path): Reorganize chroot tests to accomodate new - convention of allowing paths using posix chroot prefix. - (path_conv::check): Pass a "already ran normalize" option to - conv_to_win32_path. Return if there is an error from this function. - (mount_info::conv_to_win32_path): Add extra argument. Don't call - normalize_posix_path if caller has already done so. Substitute chroot - setting, if any, for root translation. Add chroot checking to final - output step. - * shared_info (mount_info): Accomodate additional argument to - conv_to_win32_path. - * syscalls.cc (chroot): Store both normalized posix path and native - path in chroot. - -Fri Jun 1 10:57:19 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (chdir): Really make sure that isspace gets only an unsigned - char. - -Fri Jun 1 13:45:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * syscalls.cc (_rename): Handle the case that `foo' is renamed to - `bar' while `bar.lnk' is an existing shortcut-symlink. - -Thu May 31 15:57:57 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler.cc (fhandler_disk_file::fstat): Avoid clearing S_IFMT bits - since we've already pre-cleared everything anyway. - -Wed May 30 23:51:32 2001 Earnie Boyd <earnie_boyd@yahoo.com> - - * path.cc (chdir): Always send unsigned chars to isspace since newlib's - isspace doesn't deal well with "negative" chars. - -Wed May 30 23:51:32 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler.cc (fhandler_disk_file::open): Propagate remote status of - file garnered from path_conv. Move #! checking to fstat. - (fhandler_disk_file::fstat): Reorganize st_mode setting to eliminate - duplication. Move check for #! here from fhandler::open. - - * fhandler.h (fhandler_base::isremote): New method. - (fhandler_base::set_isremote): Ditto. - (fhandler_base::set_execable_p): Also record "don't care if executable - state". - (fhandler_base::dont_care_if_execable): New method. - * path.cc (path_conv::check): Clear new flags. Appropriately set - vol_flags, drive_type, and is_remote_drive. - * path.h: Add new flags and methods for manipulating them. - * syscalls.cc (_unlink): Use isremote() to determine if a path is - remote rather than calling GetDriveType. - (stat_worker): Ditto. - * security.cc (get_file_attribute): Or attribute with result of - NTReadEA to be consistent with get_nt_attribute. + * external.cc (fillout_pinfo): Set new version field in external_pinfo + structure. + * include/sys/cygwin.h (external_pinfo): Replace strace_file with + version field. -Tue May 29 19:02:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-29 Corinna Vinschen <corinna@vinschen.de> - * sec_helper.cc (cygsid::getfrompw): Change parameter to `const'. - (cygsid::getfromgr): Ditto. - * security.cc: Use `sys_mbstowcs' and `sys_wcstombs' throughout. - (extract_nt_dom_user): Try to get user and domain from SID in - pw->pw_gecos first. - * security.h (class cygsid): Change parameter of getfrompw() and - getfromgr() to `const'. - * uinfo.cc (internal_getlogin): Change order for evaluating user - information in winNT case. Drop usage of NetWkstaUserGetInfo(). + Change internal uid datatype from __uid16_t to __uid32_t + throughout. + * cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32, + geteuid32, setuid32, seteuid32. + * passwd.cc (getpwuid32): New function. + (getpwuid_r32): Ditto. + * syscalls.cc (seteuid32): Ditto. + (setuid32): Ditto. + * uinfo.cc (getuid32): Ditto. + (geteuid32): Ditto. + * winsup.h (uid16touid32): New macro, correct casting from __uid16_t + to __uid32_t. + (gid16togid32): Ditto fir gids. + (getuid32): Declare. + (geteuid32): Ditto. + (getpwuid32): Ditto. + * include/sys/cygwin.h (struct external_pinfo): Add members uid32 and + gid32. + +2002-05-29 Corinna Vinschen <corinna@vinschen.de> + + * include/cygwin/socket.h: Protect some symbols against multiple + definition. + * include/netinet/ip.h: Ditto. + * include/netinet/tcp.h: Ditto. -Mon May 28 21:34:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-29 Wu Yongwei <adah@netstd.com> - * shortcut.c (check_shortcut): Treat only Cygwin shortcuts as symlinks. + * include/netinet/ip.h: Replace by BSD derived version of the file. + * include/netinet/tcp.h: Ditto. + * include/netinet/udp.h: New file. + * include/cygwin/ip.h: Remove. -Fri May 25 11:07:07 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-29 Christopher Faylor <cgf@redhat.com> - * path.cc (symlink_info::check): Correctly set 'ext_tacked_on'. Use - this to determine if user specified 'foo.lnk' explicitly. Reorganize - slightly to get rid of one goto. + * dtable.cc (dtable::init_std_file_from_handle): Attempt stronger + detection of invalid handle. + (handle_to_fn): Detect pathological condition where NT resets the + buffer pointer to NULL on an invalid handle. -Fri May 25 10:15:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-28 Christopher Faylor <cgf@redhat.com> - * path.cc (symlink_info::check): Add a check to return correctly - if incoming `*.lnk' file is not a symlink. + * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly + check for whether we should be opening the file to search for #! + characters. Set path_conv structure execability, too, when + appropriate. -Thu May 24 15:46:50 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-28 Corinna Vinschen <corinna@vinschen.de> - * path.cc (slash_drive_prefix_p): Remove. - (mount_info::slash_drive_to_win32_path): Ditto. - (mount_info::conv_to_win32_path): Remove slash drive prefix check. - (mount_info::add_item): Ditto. - (mount_info::del_item): Ditto. - * shared_info.h (mount_info): Remove slash_drive_to_win32_path - declaration. + * security.cc (set_security_attribute): Call getegid32() instead of + getegid(). + * include/cygwin/grp.h: Declare getegid32(). -Thu May 24 01:17:33 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-28 Corinna Vinschen <corinna@vinschen.de> - * exceptions.cc (handle_exceptions): Bump repeat count for debugging - kick out. + Change internal gid datatype from __gid16_t to __gid32_t + throughout. + * cygwin.din: Export new symbols chown32, fchown32, getegid32, + getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32, + setgid32, setegid32, getgrent32. + * grp.cc (grp32togrp16): New static function. + (getgrgid32): New function. + (getgrnam32): Ditto. + (getgrent32): Ditto. + (getgroups32): Change name of internal function from getgroups. + (getgroups32): New function. + (initgroups32): Ditto. + * syscalls.cc (chown32): Ditto. + (lchown32): Ditto. + (fchown32): Ditto. + (setegid32): Ditto. + (setgid32): Ditto. + * uinfo.cc (getgid32): Ditto. + (getegid32): Ditto. + * include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam(). + Declare getgrgid32() and getgrnam32() instead. Declare getgid32(). + +2002-05-27 Christopher Faylor <cgf@redhat.com> + + * autoload.cc (noload): Properly mask low order word for determining + number of bytes to pop. + +2002-05-27 Christopher Faylor <cgf@redhat.com> + + * fhandler_disk_file.cc (fhandler_disk_file::fstat): Minor logic + cleanup. + +2002-05-27 Christopher Faylor <cgf@redhat.com> + + * autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro. + (LoadFuncEx2): Adapt from LoadFuncEx. Provides control of return + value for nonexistent function. + (NtQueryObject): Declare. + (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if + not available. + * debug.h (being_debugged): Just rely on IsDebuggerPresent return + value. + * dtable.cc (handle_to_fn): New function. + (dtable::init_std_file_from_handle): Attempt to derive std handle's + name via handle_to_fn. + (dtable::build_fhandler_from_name): Fill in what we can in path_conv + structure when given a handle and path doesn't exist. + * fhandler.cc (fhandler_base::open): Don't set the file pointer here. + Use pc->exists () to determine if file exists rather than calling + GetFileAttributes again. + * fhandler.h (fhandler_base::exec_state_isknown): New method. + (fhandler_base::fstat_helper): Add extra arguments to declaration. + (fhandler_base::fstat_by_handle): Declare new method. + (fhandler_base::fstat_by_name): Declare new method. + * fhandler_disk_file (num_entries): Make __stdcall. + (fhandler_base::fstat_by_handle): Define new method. + (fhandler_base::fstat_by_name): Define new method. + (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. + (fhandler_disk_file::fstat_helper): Accept extra arguments for filling + out stat structure. Move handle or name specific stuff to new methods + above. + (fhandler_disk_file::open): Use real_path->exists rather than calling + GetFileAttributes again. + * ntdll.h (FILE_NAME_INFORMATION): Define new structure. + (OBJECT_INFORMATION_CLASS): Partially define new enum. + (OBJECT_NAME_INFORMATION): Define new structure. + (NtQueryInformationFile): New declaration. + (NtQueryObject): New declaration. + * path.cc (path_conv::fillin): Define new method. + * path.h (path_conv::fillin): Declare new method. + (path_conv::drive_thpe): Rename from 'get_drive_type'. + (path_conv::volser): Declare new method. + (path_conv::volname): Declare new method. + (path_conv::root_dir): Declare new method. + * syscalls.cc (fstat64): Send real path_conv to fstat as second + argument. + +2002-05-24 Pierre Humblet <pierre.humblet@ieee.org> + + * security.cc (lsa2str): New function. + (get_priv_list): Call lsa2str instead of sys_wcstombs. + +2002-05-22 Pierre Humblet <pierre.humblet@ieee.org> + + * syscalls.cc (seteuid): Do not take allow_ntsec into account. + Attempt to use an existing or new token even when the uid + matches orig_uid, but the gid is not in the process token. + Major reorganization after several incremental changes. + (setegid): Do not take allow_ntsec into account. Minor + reorganization after several incremental changes. + +2002-05-26 Christopher Faylor <cgf@redhat.com> + + * debug.h (being_debugged): New macro. + * dtable.cc (dtable::extend): Use new macro. + * exceptions.cc (try_to_debug): Ditto. + * strace.cc (strace::hello): Only output debugging info when we think + we're being debugged. + +2002-05-25 Robert Collins <rbtcollins@hotmail.com> + + * winsup.h: Remove duplicate declarations of malloc_lock and + malloc_unlock. + +2002-05-24 Christopher Faylor <cgf@redhat.com> + + Remove unneeded sync.h, where appropriate, throughout. + Remove unneeded heap.h, where appropriate, throughout. + Remove unneeded exceptions.h, where appropriate, throughout. + Remove unneeded perprocess.h, where appropriate, throughout. + +2002-05-22 Pierre Humblet <pierre.humblet@ieee.org> + + * security.cc (create_token): Call __sec_user() instead of + sec_user() to remove dependence on allow_ntsec. Verify that + the returned sd is non-null. + +2002-05-25 Robert Collins <rbtcollins@hotmail.com> + + * gmon.c (fake_sbrk): Correctly return -1 on failed malloc's. + +2002-05-24 Christopher Faylor <cgf@redhat.com> + + * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path + along to set_name via return_and_clear_normalized_path. + (dtable::build_fhandler): New method with const char * argument. + (dtable::reset_unix_path_name): Eliminate. + (dtable::dup_worker): Use correct build_fhandler method. + * mmap.cc (mmap_record::alloc_fh): Ditto. + * dtable.h (dtable::build_fhandler): New method. + (dtable::reset_unix_path_name): Eliminate. + * fhandler.cc (fhandler_base::set_name): Assume that unix_name has + already been cmalloced. + (fhandler_base::reset_unix_path_name): Eliminate. + (fhandler_base::~fhandler_base): Coercion for cfree. + * fhandler.h (fhandler_base::unix_path_name): Make const char *. + (fhandler_base::win32_path_name): Ditto. + (fhandler_base::reset_unix_path_name): Eliminate. + * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate + const char *ness of win32_path_name. + * fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name + requirements. + * path.cc (path_conv::return_and_clear_normalized_path): New method. + (path_conv::clear_normalized_path): Eliminate. + (path_conv::~path_conv): Ditto. + (path_conv::check): Accommodate new build_fhandler method. + * path.h (path_conv::~path_conv): Eliminate. + (path_conv::clear_normalized_path): Ditto. + (path_conv::return_and_clear_normalized_path): Declare new method. + +2002-05-23 Christopher Faylor <cgf@redhat.com> + + * path.cc (path_conv::check): Make sure any trailing path component is + part of potential normalized posix path. + +2002-05-23 Christopher Faylor <cgf@redhat.com> + + * smallprint.c (__small_vsprintf): Implement '%o' after all these + years. + +2002-05-22 Christopher Faylor <cgf@redhat.com> - * fhandler.h (fhandler_dev_dsp): Add a fixup_after_exec. - * fhandler_dsp.cc (class Audio): Add TOT_BLOCK_SIZE to enum. - (operator new): New. - (bigwavebuffer): Declare using TOT_BLOCK_SIZE to avoid buffer overruns. - (Audio::Audio): Optimize slightly. - (fhandler_dev_dsp::open): Allocate s_audio using static buffer. - (fhandler_dev_dsp::fixup_after_exec): New function. Ditto. + * fhandler.h (fhandler_virtual::exists): Eliminate path argument. + (fhandler_proc::exists): Ditto. + (fhandler_registry::exists): Ditto. + (fhandler_process::exists): Ditto. + * fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name. + * fhandler_process.cc (fhandler_process::exists): Ditto. + (fstat): Ditto. + * fhandler_registry.cc (fhandler_registry::exists): Ditto. + (fhandler_registry::fstat): Ditto. + * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. + * path.cc (path_conv::check): Ditto. Add debugging. -Wed May 23 17:45:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-22 Christopher Faylor <cgf@redhat.com> - * syscalls.cc (seteuid): Restrict overriding external provided - user tokens to ntsec. Don't test external tokens for primary - group to evaluate if it should be overridden. Restrict creating - internal tokens to ntsec. + * syscalls.cc (dup): Always call dup2 for error handling. -Wed May 23 10:11:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-22 Corinna Vinschen <corinna@vinschen.de> - * syscalls.cc (chown_worker): Don't check for ENOSYS. + * include/cygwin/types.h: Revert previous patch. -Tue May 22 12:20:07 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-22 Corinna Vinschen <corinna@vinschen.de> - * signal.cc (sleep): Protect with sigframe. + * include/cygwin/types.h: Define pthread stuff only if _POSIX_THREADS + is defined. -Tue May 22 17:58:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-19 Pierre Humblet <pierre.humblet@ieee.org> - * security.cc (get_file_attribute): Don't set errno. + * security.cc (open_local_policy): Initialize lsa to + INVALID_HANDLE_VALUE instead of NULL. + (get_logon_server_and_user_domain): Test for INVALID_HANDLE_VALUE + instead of NULL. + (create_token): Both of the above. -Mon May 21 15:08:00 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-18 Christopher Faylor <cgf@redhat.com> - * configure.in: Allow --enable-newvfork to turn NEWVFORK on and off. - * configure: Regenerate. + * fhandler_disk_file.cc (fhandler_disk_file::fstat): Make handling of + nlink consistent for remote files. -Mon May 21 11:46:01 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-18 Christopher Faylor <cgf@redhat.com> - * include/cygwin/version.h: Bump minor version number. + * path.cc (path_conv::check): Always set executable bit for executable + extension. -Sun May 20 13:26:25 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-17 Christopher Faylor <cgf@redhat.com> - * fhandler_dsp.cc: Reformat to GNU standards. - (s_audio): Change to a pointer throughout. - (fhandler_dev_dsp::open): Initialize s_audio, if required. + * fhandler.cc (fhandler_base::lseek): Avoid calling SetFilePointer with + high order part of 64 bit address on OS's which do not support that + kind of operation. Otherwise Windows 95 will become confused. -Sat May 19 23:40:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-16 Pierre Humblet <pierre.humblet@ieee.org> - * autoload.cc: Add load statements for `LookupAccountNameW', - `LsaClose', `LsaEnumerateAccountRights', `LsaFreeMemory', - `LsaOpenPolicy', `LsaQueryInformationPolicy', `NetLocalGroupEnum', - `NetLocalGroupGetMembers', `NetServerEnum', `NetUserGetGroups' and - `NtCreateToken'. - * ntdll.h: Add declaration for `NtCreateToken'. - * sec_helper.cc: Add `well_known_local_sid', `well_known_dialup_sid', - `well_known_network_sid', `well_known_batch_sid', - `well_known_interactive_sid', `well_known_service_sid' and - `well_known_authenticated_users_sid'. - (cygsid::string): Define as const method. - (cygsid::get_sid): Set psid to NO_SID on error. - (cygsid::getfromstr): Ditto. - (cygsid::getfrompw): Simplify. - (cygsid::getfromgr): Check for gr == NULL. - (legal_sid_type): Move to security.h. - (set_process_privilege): Return -1 on error, otherwise 0 or 1 related - to previous privilege setting. - * security.cc (extract_nt_dom_user): Remove `static'. - (lsa2wchar): New function. - (open_local_policy): Ditto. - (close_local_policy): Ditto. + * fhandler_raw.cc (fhandler_dev_raw::open): Replace set_errno() + by __seterrno_from_win_error(). + * security.cc (open_local_policy): Ditto. (get_lsa_srv_inf): Ditto. - (get_logon_server): Ditto. - (get_logon_server_and_user_domain): Ditto. (get_user_groups): Ditto. - (is_group_member): Ditto. - (get_user_local_groups): Ditto. - (sid_in_token_groups): Ditto. (get_user_primary_group): Ditto. - (get_group_sidlist): Ditto. - (get_system_priv_list): Ditto. - (get_priv_list): Ditto. - (get_dacl): Ditto. (create_token): Ditto. - (subauth): Return immediately if SE_TCB_NAME can't be assigned. - Change all return statements in case of error to jumps to `out' - label. Add `out' label to support cleanup. - * security.h: Add extern declarations for `well_known_local_sid', - `well_known_dialup_sid', `well_known_network_sid', - `well_known_batch_sid', `well_known_interactive_sid', - `well_known_service_sid' and `well_known_authenticated_users_sid'. - Add extern declarations for functions `create_token', - `extract_nt_dom_user' and `get_logon_server_and_user_domain'. - (class cygsid): Add method `assign'. Change operator= to call new - `assign' method. Add `debug_print' method. - (class cygsidlist): New class. - (legal_sid_type): Moved from sec_helper.cc to here. - * spawn.cc (spawn_guts) Revert reversion of previous patch. - Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid' - again. - * syscalls.cc (seteuid): Rearranged. Call `create_token' now when - needed. Call `subauth' if `create_token' fails. Try setting token - owner and primary group only if token was not explicitely created - by `create_token'. - * uinfo.cc (internal_getlogin): Try harder to generate correct user - information. Especially don't trust return value of `GetUserName'. - -Sat May 19 21:16:07 2001 Christopher Faylor <cgf@cygnus.com> - - * fork.cc (fork_parent): Move atforkprepare call here. - (fork): From here. - -Sat May 19 18:35:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * autoload.cc: Add missing load statement for `CancelIo'. - -Sat May 19 01:22:43 2001 Christopher Faylor <cgf@cygnus.com> - - * grp.cc (read_etc_group): Don't copy mutex on fork. - * pwd.cc (read_etc_passwd): Ditto. - * autoload.cc (LoadDLLfuncEx): Use LoadDLLprime to initialize DLL - specific area. - -Fri May 18 10:31:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (wsock_event::wait): Explicitely cancel IO when a signal - arrived to avoid data loss. Fallback to blocking IO when canceling - fails. - -Thu May 17 15:29:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * security.cc (cygwin_set_impersonation_token): Never destroy - previous token object. - (subauth): Create token source with well defined identifier. - -Wed May 16 23:27:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * uinfo.cc (uinfo_init): Just set user token to INVALID_HANDLE_VALUE. - Token value is already invalid at that point. - -Wed May 16 21:34:00 2001 Fred Yankowski <fred@ontosys.com> - - * net.cc (errmap): Add missing mapping from WSAEINTR to EINTR. - -Wed May 16 09:20:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * sec_helper.cc (legal_sid_type): Fix conditional. Change to - inline function. - -Wed May 16 01:01:48 2001 Christopher Faylor <cgf@cygnus.com> - - * autoload.h: Eliminate. - * autoload.cc: Pull in autoload.h. Eliminate many macros. Rewrite to - avoid necessity of initialization routines. Just use a standard one. - (wsock_init): New function. Moved from net.cc. - * net.cc (wsock_init): Move to autoload.cc. - (wsadata): Make global. - * dtable.cc (dtable::build_fhandler): Use more reliable method for - checking if net stuff has been loaded. - -Tue May 15 19:52:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fork.cc (fork): Eliminate superfluous call to getuid(). - * security.h: New define `NO_SID'. Remove declarations of functions - moved to methods into class cygsid. - (class cygsid): Declare new methods `getfromstr', `get_sid', - `getfrompw', `getfromgr', `get_rid', `get_uid', `get_gid', `string' - and new constructors and operators =, == and !=. - Declare new global cygsids `well_known_XXX_sid' substituting the - corresponding `get_XXX_sid' functions. Remove declarations of - these functions. - * sec_helper.cc (well_known_admin_sid): New global variable. - (well_known_system_sid): Ditto - (well_known_creator_owner_sid): Ditto - (well_known_world_sid): Ditto - (cygsid::string): New method, substituting `convert_sid_to_string_sid'. - (cygsid::get_sid): New method, substituting `get_sid'. - (cygsid::getfromstr): New method, substituting - `convert_string_sid_to_sid'. - (cygsid::getfrompw): New method, substituting `get_pw_sid'. - (cygsid::getfromgr): New method, substituting `get_gr_sid'. - (cygsid::get_id): New method, substituting `get_id_from_sid'. - (get_admin_sid): Eliminated. - (get_system_sid): Ditto. - (get_creator_owner_sid): Ditto. - (get_world_sid): Ditto. - * grp.cc: Use new cygsid methods and well known sids throughout. - * registry.cc: Ditto. - * sec_acl.cc: Ditto. - * security.cc: Ditto. - * shared.cc: Ditto. - * syscalls.cc (seteuid): Ditto. Eliminate redundant conditional. - * uinfo.cc (internal_getlogin): Ditto. - * spawn.cc (spawn_guts) Revert previous patch. - -Tue May 15 10:20:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler_socket.cc (fhandler_socket::ioctl): Convert s_addr - field to host byte order before comparing with INADDR_LOOPBACK. - -Tue May 15 9:03:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * autoload.cc: Add autoload statements for ws2_32 functions - `WSACloseEvent', `WSACreateEvent', `WSAGetOverlappedResult', - `WSARecv', `WSARecvFrom', `WSASend', `WSASendTo' and `WSASetEvent', - `WSAWaitForMultipleEvents'. - * net.cc: Define wsock_evt. - (wsock_event): New class. - (cygwin_sendto): Use overlapped socket io if available. - (cygwin_recvfrom): Ditto. - (cygwin_recv): Ditto. - (cygwin_send): Ditto. - * security.cc (subauth): Set Win32 error to 0 to safely ask for the - error code of dynamically loaded function `LsaRegisterLogonProcess'. - -Mon May 14 15:37:29 2001 Christopher Faylor <cgf@cygnus.com> - - * errno.cc (_sys_errlist): Add missing commas. - -Mon May 14 16:13:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * security.cc (subauth): Check if Secur32.dll could be loaded. - -Sun May 13 22:49:04 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (path_conv::check): Revert allow_ntsec check so that volume - info is always retrieved and isdisk setting is properly set. - -Sun May 13 14:02:36 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler_tty.cc (fhandler_tty_common::dup): Preserve O_NOCTTY when - duping a filehandle. - -Sat May 12 18:19:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * dir.cc (rmdir): Rearrange slightly to allow removing directories - even when R/O attribute is set. - -Fri May 11 16:53:38 2001 Christopher Faylor <cgf@cygnus.com> - - * external.cc (fillout_pinfo): Use correct pids. - * path.cc (mount_info::conv_to_win32_path): Correct test for whether to - include a slash. - -Fri May 11 01:04:17 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (handle_exceptions): Don't print message when executing - from a cygwin program. - -2001-05-10 Egor Duda <deo@logos-m.ru> - Christopher Faylor <cgf@redhat.com> - - * environ.cc (winenv): Always add SYSTEMDRIVE and SYSYEMROOT to - win32-style environment if they don't already exist. - -2001-05-10 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * path.cc (mount_info::conv_to_win32_path): Treat UNC paths the same as - paths including `:' or `\'. - -Wed May 9 14:46:32 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler.h (fhandler_termios::echo_erase): Declare new method. - * fhandler_termios.cc (fhandler_termios::echo_erase): New method for - echoing erase characters. - (fhandler_termios::line_edit): Check the echo flag before echoing - control characters (from Kazuhiro Fujieda <fujieda@jaist.ac.jp>). - -Wed May 9 10:43:30 2001 Christopher Faylor <cgf@cygnus.com> - - * include/pthread.h: Remove C++ comment. - -Tue May 8 11:09:59 2001 Christopher Faylor <cgf@cygnus.com> - - * cygheap.cc (_cfree): Add regparm attribute. - (_crealloc): Ditto. - - * dcrt0.cc (dll_crt0_1): Default to always checking for executable for now. - - * dtable.cc (dtable::not_open): Move method. - * dtable.h (dtable): Here. - - * exceptions.cc (ctrl_c_handler): Don't expect process group leader to - handle a signal if it doesn't exist. - - * fhandler.h (fhandler_base): Make openflags protected. - - * localtime.c (tzsetwall): Check for __CYGWIN__ as well as __WIN32__. - - * path.cc (path_conv::check): Add some comments. Change strcat to assignment. - - * lib/_cygwin_S_IEXEC.cc (_cygwin_bob__): Eliminate. - - * fhandler_tty.cc (fhandler_console::dup): Set controlling terminal if necessary. - * fhandler_tty.cc (fhandler_tty_slave::dup): Ditto. - -Mon May 7 21:33:17 2001 Christopher Faylor <cgf@cygnus.com> - - * include/sys/file.h: Revert special X_OK usage. Just make it a - constant. - -Sun May 6 17:05:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.h (pthread_cond): New element cond_access to allow atomic - broadcasts. - * thread.cc (pthread_cond::pthread_cond): Initialise cond_access. - (pthread_cond::~pthread_cond): Destroy cond_access. - (pthread_cond::Broadcast): Use cond_access. - (pthread_cond::Signal): Use cond_access. - (pthread_cond_wait): Use cond_access. - (pthread_cond_timedwait): Use cond_access. - -Sun May 6 11:55:40 2001 Christopher Faylor <cgf@cygnus.com> - - * string.h (cygwin_strchr): Make 'static inline' so that things will - still work when optimized. - -Sat May 5 01:04:11 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (handle_exceptions): Vastly increase test for exception - loop guard variable. - -Fri May 4 22:23:33 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (stack_info): Add some controls. - (stack_info::init): Add extra arguments to control method of - initialization.. If we have a known good frame, set things up so that - this frame is not skipped the first time through. Record whether - caller cares about arguments or not. - (stack_info::walk): Don't store arguments if they're unwanted. - (stackdump): Add isexception parameter for use when called by exception - handler. - (cygwin_stackdump): Accomodate extra argument to stackdump. - (handle_exceptions): Ditto. - (sig_handle): Ditto. - (interrupt_on_return): Accomodate extra arguments to stack walk - initialization. - -Fri May 4 21:05:20 2001 Christopher Faylor <cgf@cygnus.com> - - * localtime.c: Revert exclusion of windows.h. - -Fri May 4 17:03:16 2001 Christopher Faylor <cgf@cygnus.com> - - * string.h: Fix last-minute typo. - -Fri May 4 16:49:34 2001 Christopher Faylor <cgf@cygnus.com> - - * pinfo.h: Correctly set __SIGOFFSET. - - * path.cc (hash_path_name): Avoid calling library functions for simple - copying of characters. - - * shortcut.c: Use WIN32_LEAN_AND_MEAN. - * smallprint.c: Ditto. - - * environ.cc (getwinenv): Minor clarity fix. - - * localtime.c: No need to include windows.h - - * string.h: New file. - -Fri May 4 16:37:30 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (ctrl_c_handler): Always send signal to process if it - has no tty. - -2001-05-04 Egor Duda <deo@logos-m.ru> - - * fhandler_socket.cc (set_connect_secret): Use /dev/urandom to - generate secret cookie. - -Thu May 3 16:37:55 2001 Christopher Faylor <cgf@cygnus.com> - - * include/pthread.h (pthread_cleanup_push): Eliminate space preceding - arguments. - (pthread_cleanup_pop): Ditto. - -Thu May 3 18:16:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (wsock_init): Rename `was_in_progress' to `wsock_started' - for clearness. - -Thu May 3 10:44:16 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (handle_exceptions): Break out of "loop" if the - debugger doesn't seem to be attaching to our process. - -Wed May 2 20:18:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * autoload.cc: Use new definition of LoadDLLinitfunc throughout. - Redefine wrapper for wsock32.dll and ws2_32.dll. - (std_dll_init): New function. - * autoload.h: Rename LoadDLLinitfunc to LoadDLLinitfuncdef. - Add new defines LoadDLLinitfunc and LoadDLLstdfunc. - * net.cc (wsock_init): Add guard variable handling. Take care - to call WSAStartup only once. Load WSAStartup without using - autoload wrapper to eliminate recursion. Eliminate FIONBIO - and srandom stuff. - -Tue May 1 01:26:15 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (mount_info::conv_to_win32_path): More path tweaking. - -Tue May 1 00:34:46 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (mount_info::conv_to_win32_path): Fix debugging output to - avoid a SIGSEGV. Avoid double backslashes in middle of filename. - -Mon Apr 30 21:51:14 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (mkrelpath): New function. - (mount_info::conv_to_win32_path): Eliminate now-unneeded relative path - name arg and processing. - (path_conv::check): Accomodate relative path names again. Accomodate - one extra argument in mount_info::conv_to_win32_path. Tack trailing - slash on end of relative path as a side effect, like before. - * shared_info.h (mount_info::conv_to_win32_path): Reflect new argument - ordering. - -Mon Apr 30 22:09:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * autoload.cc: Add LoadDLLinitfunc for secur32.dll. - Add LoadDLLfuncEx statements for AllocateLocallyUniqueId@4, - DuplicateTokenEx@24, LsaNtStatusToWinError@4, - LsaDeregisterLogonProcess@4, LsaFreeReturnBuffer@4, - LsaLogonUser@56, LsaLookupAuthenticationPackage@12, - LsaRegisterLogonProcess@12, - * environ.cc: Add extern declaration for `subauth_id'. - (subauth_id_init): New function for setting `subauth_id'. - (struct parse_thing): Add entry for `subauth_id'. - * fork.cc (fork_parent): Call `RevertToSelf' and - `ImpersonateLoggedOnUser' instead of `seteuid'. - * security.cc: Define global variable `subauth_id'. - (extract_nt_dom_user): New function. - (cygwin_logon_user): Call `extract_nt_dom_user' now. - (str2lsa): New static function. - (str2buf2lsa): Ditto. - (str2buf2uni): Ditto. (subauth): Ditto. - * security.h: Add prototype for `subauth'. - * spawn.cc (spawn_guts): Use cygheap->user.token only if impersonated. - Use `cygsid' type. Remove impersonation before allowing access to - workstation/desktop to everyone. Call `RevertToSelf' and - `ImpersonateLoggedOnUser' instead of `seteuid'. - * syscalls.cc (seteuid): Rearranged to allow using subauthentication - to retrieve user tokens when needed. - -Mon Apr 30 20:26:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * uinfo.cc (internal_getlogin): Formatting change. - -Mon Apr 30 19:58:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * grp.cc: Eliminate MAX_DOMAIN_NAME define. - (read_etc_group): Substitute MAX_DOMAIN_NAME by - INTERNET_MAX_HOST_NAME_LENGTH. - * passwd.cc (parse_pwd): Don't force pw_name to be lower case. - * sec_helper.cc: Substitute MAX_USER_NAME by UNLEN, - MAX_COMPUTERNAME_LENGTH by INTERNET_MAX_HOST_NAME_LENGTH throughout. - (lookup_name): Slight cleanup. - * security.cc (alloc_sd): Substitute MAX_USER_NAME by UNLEN. - * security.h: Define DEFAULT_UID as DOMAIN_USER_RID_ADMIN and - DEFAULT_GID as DOMAIN_ALIAS_RID_ADMINS. - * shared.cc (memory_init): Substitute MAX_USER_NAME by UNLEN. - * thread.h: Ditto. - * uinfo.cc (internal_getlogin): Substitute MAX_USER_NAME by UNLEN. - Substitute MAX_COMPUTERNAME_LENGTH and MAX_HOST_NAME by - INTERNET_MAX_HOST_NAME_LENGTH. - * winsup.h: Include lmcons.h. Eliminate MAX_USER_NAME and - MAX_HOST_NAME. Move DEFAULT_UID and DEFAULT_GID to security.h. - -Mon Apr 30 12:35:40 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (path_conv::check): Don't use path_flags when converting to - MS-DOS syntax unless parsing tail of path component. Stop parsing path - when we reach the 'root' of the path. Correctly copy tail to path - component. - -Sun Apr 29 22:28:06 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (INIT_EXCEPTION_HANDLER): Eliminate. - (init_exceptions): Just use init_exception_handler. - (open_stackdumpfile): New function. - (stack_info::first_time): Eliminate. - (stack_info::init): Set up fields to avoid "first_time" consideration. - (stack_info::walk): Remove "first_time" consideration. - (stackdump): Change arguments to accept initial frame pointer and open - stack file flag. - (stack): Eliminate. - (cygwin_stackdump): Use stackdump() rather than stack(). - (try_to_debug): Remove all synchronization logic. Just keep looping in - exception handler until debugger notices us. Return 1 if successfully - started debugger. - (handle_exceptions): Just return if we know that we're debugging. - Reorganize to avoid creating a stackdump file if we are starting a - debugger. Return from exception handler if debugger started - successfully. - (sig_handle): Create a stackdump only if debugger wasn't started. - * winsup.h (try_to_debug): Add an argument. - -Sun Apr 29 21:41:25 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (symlink_info::check): Remove extra arguments, move - functionality back to path_conv::check. Clear symlink bit from pflags - argument before detecting if this is a symlink. - (path_conv::check): Convert posix path here instead of - symlink_info::check. Only grab volflags when using ntsec. - (symlink_info::check_case): Just replace appropriate part of input - path. - -Sat Apr 28 19:36:13 2001 Christopher Faylor <cgf@cygnus.com> - - Throughout, change 'tty_attached' to 'real_tty_attached', for clarity. - Throughout, change 'OutputStopped' to 'output_stopped', for - consistency. - * dtable.cc (stdio_init): Set controlling tty if not set by stdio - opens. - * exceptions.cc (ctrl_c_handler): Avoid special pgid checking if no tty - is associated with the process. - (Suggested by Tim Baker <dbaker@direct.ca>) - * external.cc (fillout_pinfo): Return actual tty number for ctty. - * fhandler_console.cc (get_tty_stuff): Set ctty when shared memory is - allocated. Accept flags input from open(). - (set_console_ctty): New function. - (fhandler_console::open): Pass flags to get_tty_stuff and rely on this - function to set the ctty, if appropriate. - * fhandler_termios.cc (fhandler_termios::set_ctty): Move to tty_min - class. - * fhandler_tty.cc (fhandler_tty_slave::open): Use tc field to access - set_ctty(). - * tty.h (TTY_CONSOLE): Move to include/sys/cygwin.h. - (tty_min): Add set_ctty class here. - * include/sys/cygwin.h (TTY_CONSOLE): New home here. - - * path.cc (symlink_info): Make contents an actual buffer. Pass more - flags to case_check. - (path_conv::check): Reorganize to do parsing based on posix path rather - than native path. - (symlink_info::check): Expect posix path as input. Translate to native - path here. Accept path_conv flags. Stop parsing if not a symlink - regardless of whether previous path was a symlink. - -2001-04-27 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * thread.cc (thread_init_wrapper): Use _REENT_INIT to initialize the - reent structure of newlib. - -Fri Apr 27 14:02:24 2001 Christopher Faylor <cgf@cygnus.com> - - * sigproc.h (sig_send): Add exception parameter to sig_send. - * sigproc.cc (sig_send): Ditto. Use it when setting frame info. - * exceptions.cc (handle_exceptions): Use exception flag when calling - sig_send. - -2001-04-27 Egor Duda <deo@logos-m.ru> - - * tty.cc (tty::make_pipes): Set to_slave pipe mode to nonblocking. - * fhandler_tty.cc (fhandler_pty_master::accept_input): If pipe buffer - is full, give slave a chance to read data. - -2001-04-26 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * security.cc (alloc_sd): Add unrelated ACCESS_ALLOWED_ACE behind - the `everyone' ACE. - -Wed Apr 25 15:07:37 2001 Christopher Faylor <cgf@cygnus.com> - - * sigproc.h [sigthread]: Add exception field. - [sigframe::~sigframe]: Clear exception field. - [sigframe::set]: Set exception field from caller. - * sigproc.cc (sig_send): Set exception field when frame pointer is - passed in. - * exceptions.cc (interrupt_on_return): Always treat exception as - interruptible. - -2001-04-25 Egor Duda <deo@logos-m.ru> - - * cygwin.din: Export asctime_r, ctime_r, gmtime_r, localtime_r - * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 39 - -Wed Apr 25 10:57:36 2001 Christopher Faylor <cgf@cygnus.com> - - * include/cygwin/version.h: Bump minor version number. - * childinfo.h: Bump child structure magic number. - -2001-04-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * uinfo.cc (internal_getlogin): Return pointer to struct passwd. - (uinfo_init): Accommodate the above change. - * syscalls.cc (seteuid): Ditto. - -Tue Apr 25 11:08:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * autoload.cc: Add LoadDLLfunc statements for SetTokenInformation@16. - * cygheap.cc: Include security.h. - * grp.cc (internal_getgrent): New function. - (getgroups): Rearranged using `internal_getgrent' and the new - `cygsid' class. - * passwd.cc (internal_getpwent): New function. - * sec_acl.cc: Use new `cygsid' class throughout. - (acl_access): Use `internal_getgrent' instead of `getgrent'. - * sec_helper.cc: Use new `cygsid' class throughout. - (get_id_from_sid): Use `internal_getgrent' instead of `getgrent'. - Use `internal_getpwent' instead of `getpwent'. - * security.cc: Use new `cygsid' class throughout. - * security.h: Move `MAX_SID_LEN' from winsup.h to here. - Add extern declarations for `internal_getgrent' and `internal_getpwent'. - (class cygsid): New class. - * shared.cc (sec_user): Use new `cygsid' class. - * syscalls.cc (seteuid): Try to set owner to user and primary group to - current group in impersonation token before performing impersonation. - (setegid): Try to set primary group in process token to the new group - if ntsec is on. - * uinfo.cc (internal_getlogin): Use new `cygsid' class. - Try to set owner to user and primary group to current group in process - token if the process has been started from a non cygwin process. - (uinfo_init): Set primary group only if the process has been started - from a non cygwin process. - * winsup.h: Move define for `MAX_SID_LEN' to security.h. - -Mon Apr 16 23:20:00 2001 Andy Younger <andylyounger@hotmail.com> - - * fhandler_dsp.cc: Improved handling of 8 bit playback modes. - Put in mock support for SNDCTL_DSP_SETFRAGMENT. - -Tue Apr 24 23:51:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * passwd.cc (getpwnam_r): Add pw_passwd handling as well. - (getpwuid_r): Ditto. - -Tue Apr 24 23:43:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * passwd.cc (getpwnam_r): Use correct offsets into buffer. - Copy pw_gecos field as well. - (getpwuid_r): Ditto. - -2001-04-24 Egor Duda <deo@logos-m.ru> - - * dlmalloc.c: New file. Port of Doug Lea's malloc - * dlmalloc.h: Ditto. - * Makefile.in: Add support for MALLOC_DEBUG - * config.h.in: Ditto. - * winsup.h: Ditto. - * configure.in: Add --enable-malloc-debugging option. - * configure: Regenerate. - * debug.h: Include declarations for debugging malloc. - * tty.cc (grantpt): Fix definition. - (unlockpt): Ditto. - -Mon Apr 23 22:00:29 2001 Christopher Faylor <cgf@cygnus.com> - - Remove trailing underscore from fhandler_base and friends, throughout. - * fhandler.h (fhandler_base::set_open_status): New method. Stores - original open status. - (fhandler_base::get_open_status): New method. Retrieves original open - status. - (fhandler_base::reset_to_open_binmode): New method. - * fhandler.cc (fhandler_base::open): Save open status. - (fhandler_base::init): Ditto. - * fhandler_clipboard.cc (fhandler_clipboard::open): Ditto. - * fhandler_console.cc (fhandler_console::open): Ditto. - * fhandler_dsp.cc (fhandler_dsp::open): Ditto. - * fhandler_dev_mem.cc (fhandler_dev_mem::open): Ditto. - * fhandler_dev_random.cc (fhandler_dev_random::open): Ditto. - * fhandler_serial.cc (fhandler_serial::open): Ditto. - * fhandler_tty_slave.cc (fhandler_tty_slave::open): Ditto. - * fhandler_tty_master.cc (fhandler_tty_master::open): Ditto. - * fhandler_dev_zero.cc (fhandler_dev_zero::open): Ditto. - * syscalls.cc (setmode): Rework so that 0 mode value causes reversion - to open state. - - * fhandler_tty_slave.cc (fhandler_tty_slave::read): Use correct - multiplier when converting from deciseconds to milliseconds. - -Mon Apr 23 13:28:35 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler.h (fhandler_base::clear_r_binary): New method. - (fhandler_base::clear_w_binary): New method. - * syscalls.cc (setmode): Accept 0 as mode value. Resets text/binary - behavior for fd to default. - -Mon Apr 23 12:46:07 2001 Christopher Faylor <cgf@cygnus.com> - - * net.cc [errmap]: Add '0' condition. - (find_winsock_errno): Don't translate no error to EPERM. - -Sun Apr 22 20:48:24 2001 Christopher Faylor <cgf@cygnus.com> - * include/cygwin/version.h: Bump Cygwin version and API version. +2002-05-17 Corinna Vinschen <corinna@vinschen.de> -Mon Apr 23 9:27:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.cc (MTinterface::Init): Always initialise per process variables. - -Sun Apr 22 19:18:18 2001 Christopher Faylor <cgf@cygnus.com> - - * features.h: Reinstate as wrapper for sys/features.h. - -Mon Apr 23 0:10:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * security.cc (alloc_sd): Reformat comment. - * shared.cc: Drop function declarations already in security.h. + * times.cc (utimes): Use FILE_WRITE_ATTRIBUTES even on 9x/Me when + opening file for writing timestamp. + * wincap.cc: Remove flag has_specific_access_rights. + * wincap.h: Ditto. -Sun Apr 22 12:17:57 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-13 Pierre Humblet <pierre.humblet@ieee.org> - * shortcut.c (check_shortcut): Close input file handle before - returning. - * path.cc (check_sysfile): Ditto. - (symlink_info::check): Rely on opened file handle being closed by - symlink checking routines. Set ext_tacked_on when .lnk is detected. + * syscalls.cc (seteuid): Set default dacl in process token. + Replace in-line code by call to verify_token(). + (setegid): Reverse change from 2002-01-21. Add call to + RevertToSelf and set primary group in impersonation token. + * security.cc (create_token): Store pgrpsid in token security + descriptor, except if it already appears in my_grps. + Use sec_acl() in place of get_dacl(). + (verify_token): Create from code in seteuid(), with tighter checks. + (get_dacl): Deleted. + (get_group_sidlist): Add argument to indicate if pgrpsid is already + in the groups. + * security.h: Define verify_token(). + * autoload.cc: Load GetKernelObjectSecurity(). -Sat Apr 21 19:26:05 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-13 Mark Bradshaw <bradshaw@staff.crosswalk.com> - * thread.cc (MTinterface::Init): Remove accidentally checked in code. + * cygwin.din: Add strlcat and strlcpy. + * include/cygwin/version.h: Increment API minor version number. -Sun Apr 22 00:22:00 2001 Robert Collins <rbtcollins@hotmail.com> +2002-05-09 Pierre Humblet <pierre.humblet@ieee.org> - * passwd.cc (getpwuid): Check for thread cancellation. - (getpwuid_r): Ditto. - (getpwname): Ditto. - (getpwnam_r): Ditto. - * thread.h (pthread_mutex): New constructors for pshared operation. - (MTinterface): Associative array for pshared mutex's. - * thread.cc (MTinterface::Init): Initailize pshared mutex array. - (pthread_cond::BroadCast): Implementation notes. - (pthread_cond::TimedWait): Remove use of SignalObjectAndWait on non-NT systems. - (pthread_mutex::pthread_mutex(unsigned short)): New function. - (pthread_mutex::pthread_mutex (pthread_mutex_t *, pthread_mutexattr *)):New function. - (pthread_mutex::pthread_mutex(pthread_mutexattr *)): Fail on pshared mutex's. - (__pthread_mutex_getpshared): New function. - (__pthread_join): Check for thread cancellation. - (__pthread_cond_timedwait): Support pshared mutex's. - (__pthread_cond_wait): Ditto. - (__pthread_condattr_setpshared): Error on PROCESS_SHARED requests. - (__pthread_mutex_init): Support pshared mutex's. - (__pthread_mutex_getprioceiling): Ditto. - (__pthread_mutex_lock): Ditto. - (__pthread_mutex_trylock): Ditto. - (__pthread_mutex_unlock): Ditto. - (__pthread_mutex_destroy): Ditto. - (__pthread_mutex_setprioceiling): Ditto. - (__pthread_mutexattr_setpshared): Support PTHREAD_PROCESS_PSHARED requests. + * shared.cc (__sec_user): Split into sec_acl() and call orig_sid(). + (sec_acl): Create from part of __sec_user(), except creator/owner. + * security.h: Define sec_acl() and MAX_DACL_LEN. -Fri Apr 20 19:38:29 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-12 Christopher Faylor <cgf@redhat.com> - * cygwin.din: Add *scanf and *scan_r functions. + * fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using + O_DIROPEN when OS doesn't support it. Return proper errno in that + case. -Fri Apr 20 22:25:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-05-12 Christopher Faylor <cgf@redhat.com> - * security.cc (set_process_privileges): Swap out. - * sec_helper.cc (set_process_privilege): Rename from - `set_process_privileges'. Takes the privilege to enable or disable - as parameter now. - * security.h: Add prototype for `set_process_privileges'. + * syscalls.cc (_read): Change error to EBADF if attempt to read from a + non-readable fd. -2001-04-19 Egor Duda <deo@logos-m.ru> +2002-05-11 Christopher Faylor <cgf@redhat.com> - * path.cc (path_conv::check): Always initialize member variables. + * fhandler.h (executable_states): For now, make dont_care_if_executable + equivalent to not_executable. + * sys/mount.h: Define MOUNT_NOTEXEC. + * path.h (fs_info): New class. + (path_conv): Move fs-specific fields to new 'fs' structure. + (path_conv::update_fs_info): Move to fs_info and rename to just 'update'. + * path.cc (fs_info::update): Ditto. Return 'true' if successful. + (fillout_mntent): Add ',noexec' to list of reported options. -Fri Apr 20 12:27:49 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-11 Christopher Faylor <cgf@redhat.com> - * include/sys/file.h: More cleanup for X_OK. + * fhandler_virtual.cc (fhandler_virtual::close): Quiet a compiler + warning. -Fri Apr 20 11:48:45 2001 Christopher Faylor <cgf@cygnus.com> +2002-05-10 Christopher January <chris@atomice.net> + + * autoload.cc: Add dynamic load statements for + 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. + * fhandler.h: Change type of bufalloc and filesize members of + fhandler_virtual from int to size_t. Change type of position member + from __off32_t to __off64_t. Add new fileid member to fhandler_virtual + class. Make seekdir take an __off64_t argument. Make lseek take an + __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add + fill_filebuf method to fhandler_proc. Add fill_filebuf method to + fhandler_registry. Add fill_filebuf method to fhandler_process. Add + saved_pid and saved_p members to fhandler_process. + * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. + (proc_fhandlers array): Ditto. + (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. + (fhandler_proc::fill_filebuf): New method. + (fhandler_proc::format_proc_meminfo): Ditto. + (fhandler_proc::format_proc_stat): Ditto. + (fhandler_proc::format_proc_uptime): Ditto. + * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. + (fhandler_process::fstat): Find the _pinfo structure for the process + named in the filename. Return ENOENT if the process is no longer + around. Set the gid and uid fields of the stat structure. + (fhandler_process::open): Store pid and pointer to _pinfo structure in + saved_pid and saved_p respectively. Use fill_filebuf to flesh out file + contents. + (fhandler_proc::fill_filebuf): New method. + (format_process_stat): New function. + (format_process_status): Ditto. + (format_process_statm): Ditto. + (get_process_state): Ditto. + (get_mem_values): Ditto. + * fhandler_registry.cc (fhandler_registry::seekdir): Change argument + type from __off32_t to __off64_t. + (fhandler_registry::fill_filebuf): New method. + * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type + from __off32_t to __off64_t. + (fhandler_virtual::lseek): Ditto. + (fhandler_virtual::fill_filebuf): New method. + (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. + * wincap.cc: Set flag has_process_io_counters appropriately. + * wincap.h: Add flag has_process_io_counters. + +2002-05-09 Christopher Faylor <cgf@redhat.com> + + * syscalls.cc (_write): Change error to EBADF if attempt to write to a + non-writeable fd. + +2002-05-08 Corinna Vinschen <corinna@vinschen.de> + + * cygheap.h (class cygheap_user): Add member `orig_psid'. + Add method `orig_sid()'. + * cygheap.cc (cygheap_user::set_sid): Maintain orig_psid. + +2002-04-28 Norbert Schulze <norbert.schulze@web.de> + + * localtime.cc (tzsetwall): Use wildabbr if generated timezone name + length < 3. + +2002-05-05 Pierre Humblet <pierre.humblet@ieee.org> + + * spawn.cc (spawn_guts): Move call to set_process_privilege() + to load_registry_hive(). + * registry.cc (load_registry_hive): ditto. + * fork.cc (fork_parent): Call sec_user_nih() only once. + +2002-05-04 Christopher January <chris@atomice.net> + + * path.h (path_conv::path_conv): Initialise normalized_path to NULL. + +2002-05-03 Christopher Faylor <cgf@redhat.com> + + * net.cc (getdomainname): Change second argument of getdomainname to + size_t. + +2002-05-03 Christopher January <chris@atomice.net> + + * fhandler_proc.cc (proc_listing): Add '.' and '..' to directory + listing. + (fhandler_proc::open): Change use of mode to flags. If the file does + not exist already, fail with EROFS if O_CREAT flag is set. Change + EROFS error to EACCES error when writing to a file. Use cmalloc to + allocate memory for filebuf. + (fhandler_proc::close): Use cfree to free filebuf. + (fhandler_proc::get_proc_fhandler): Properly detect attempts to access + unknown subdir. + * fhandler_process.cc (process_listing): Add '.' and '..' to directory + listing. + (fhandler_process::open): Use cmalloc to allocate memory for filebuf. + (fhandler_process::close): Use cfree to free filebuf. + * fhandler_registry.cc (registry_listing): Add . and '..' to directory + listing. + (fhandler_registry::open): Move check for open for writing before + open_key. Use cmalloc to allocate memory for filebuf. + (fhandler_registry::close): Use cfree to free filebuf. + (fhandler_registry::telldir): Use lower 16 bits of __d_position as + position in directory. + (fhandler_registry::seekdir): Ditto. + * fhandler_virtual.cc (fhandler_virtual::write): Change EROFS error to + EACCES error. + (fhandler_virtual::open): Set the NOHANDLE flag. + (fhandler_virtual::dup): Add call to fhandler_base::dup. Allocate + child's filebuf using cmalloc. Copy filebuf from parent to child. + (fhandler_virtual::close): Use cfree to free filebuf. + (fhandler_virtual::~fhandler_virtual): Ditto. + (from Chris Faylor <cgf@redhat.com>). + (fhandler_registry::readdir): Add support for '.' and '..' files in + subdirectories of /proc/registry. + * path.cc (path_conv::check): Do not return ENOENT if a file is not + found in /proc. + +2002-05-02 Christopher Faylor <cgf@redhat.com> + + * fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather + than path_conv name. + (fhandler_proc::open): Ditto. + * fhandler_process.cc (fhandler_process::fstat): Use fhandler name + rather than path_conv name. + (fhandler_process::open): Ditto. + * fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name + rather than path_conv name. + (fhandler_registry::open): Ditto. + * path.cc (path_conv::check): Don't copy posix path when virtual. + (mount_info::conv_to_win32_path): Don't zero string when isproc. Just + derive normal windows path. + + * path.h (path_conv::clear_normalized_path): Declare new method. + * path.cc (path_conv::clear_normalized_path): Define new method. + * dtable.cc (build_fhandler_from_name): Clear normalized path when + finished to conserve space. + +2002-05-02 Christopher Faylor <cgf@redhat.com> + + * fhandler_proc.cc (fhandler_proc::fstat): Prime with information from + fhandler_base::fstat. Use defines rather than constants for permission + settings. + +2002-04-30 Eric Blake <ebb9@email.byu.edu> + + * path.cc (hash_path_name): Improve hash function strength. + +2002-05-02 Robert Collins <rbtcollins@hotmail.com> + + * thread.cc (__pthread_cond_dowait): Fix a race on signalling from a + thread woken by the same condition variable it's signalling on. Thanks + to Michael Beach for the report and test case. + +2002-05-02 Christopher Faylor <cgf@redhat.com> + + * path.h (pathconv_arg): Add PC_POSIX. + (path_conv): Add normalized_path field. + * path.cc (path_conv::~path_conv): New destructor. + (path_conv::check): Set normalized_path, where appropriate. + * dtable.cc (build_fhandler_from_name): Use normalized path from + path_conv. + * syscalls.cc (chroot): Ditto. + + * cygheap.h: Remove path_prefix_p declaration. + +2002-02-26 Christopher January <chris@atomice.net> + Christopher Faylor <cgf@redhat.com> (minor fixups) + + * Makefile.in: Add fhandler_proc.o, fhandler_registry.o, + fhandler_process.o and fhandler_virtual.o. + * dtable.cc (dtable::build_fhandler): Add entries for FH_PROC, + FH_REGISTRY and FH_PROCESS. Set unix_name to the normalized posix + path. + * fhandler.h: Add constants for FH_PROC, FH_REGISTRY and FH_PROCESS. + Add class declarations for fhandler_virtual, fhandler_proc, + fhandler_registry and fhandler_virtual. Update fhandler_union + accordingly. + * fhandler_proc.cc: New file. Add implementation for fhandler_proc. + * fhandler_virtual.cc: New file. Add implementation for + fhandler_virtual. + * fhandler_process.cc: New file. Add implementation for + fhandler_process. + * fhandler_registry.cc: New file. Add implementation for + fhandler_registry. + * path.cc (isproc): New macro. + (isvirtual_dev): Ditto. + * path.cc (path_conv::check): Add check for virtual devices. + * path.cc (mount_info::conv_to_win32_path): Convert paths in /proc to + empty Win32 paths. + * path.cc (chdir): Replace check for FH_CYGDRIVE with more generic + isvirtual_dev macro. Force setting of posix path for virtual + fhandlers. + * path.h (path_prefix_p): Declare. + + +Wed May 1 16:06:02 2002 Jason Tishler <jason@tishler.net> + + * include/cygwin/types.h: Include <sys/sysmacros.h>. + +Wed Apr 17 11:27:04 2002 Jason Tishler <jason@tishler.net> + + * security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for + the NT Domain case. + +2002-04-12 Corinna Vinschen <corinna@vinschen.de> + + * net.cc (cygwin_accept): Set socket type for accepted socket. + (socketpair): Set socket type for both sockets. + +2002-04-12 Egor Duda <deo@logos-m.ru> + + * fhandler.h (class fhandler_socket): New member to store socket type. + (fhandler_socket::get_socket_type): Access it. + (fhandler_socket::set_socket_type): Ditto. + * net.cc (cygwin_socket): Store socket type. + (cygwin_connect): Disable security checks for connectionless sockets. + (cygwin_accept): Ditto. - * include/sys/file.h: Move X_OK protection earlier. +2002-04-09 Mark Bradshaw <bradshaw@staff.crosswalk.com> - * dtable.cc (dtable::vfork_child_fixup): Avoid closing already closed - handles. + * cygwin.din: Add strptime. + * include/cygwin/version.h: Increment API version number. -Fri Apr 20 16:29:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-04-09 Corinna Vinschen <corinna@vinschen.de> - * grp.cc (getgroups): Change so that SIDs get compared instead - of strings to SIDs. + * fork.cc (fork_child): Call fixup_mmaps_after_fork() somewhat earlier. -Fri Apr 20 14:50:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-04-09 Corinna Vinschen <corinna@vinschen.de> - * Makefile.in: Add object files `sec_helper.cc' and `sec_acl.cc'. - * security.cc: Swap out several functions. - * sec_acl.cc: New file. Move Sun compatibel ACL functions from - `security.cc' to here. - * sec_helper.cc: New file. Move security helper functions from - `security.cc' to here. - * security.h: Changed to accomodate the above changes. + * fhandler.cc (fhandler_base::open): Set read-only bit in + file_attributes when adequate. -Fri Apr 20 14:12:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-03-28 Christopher Faylor <cgf@redhat.com> - * grp.cc: Replace `group_in_memory_p' by `group_state'. - Eliminate group_sem throughout. - (enum grp_state): New enumeration type. - (read_etc_group): Make race safe. - * security.cc: Eliminate group_sem throughout. + * times.cc (gettimeofday): Fix typo in previous patch. -Thu Apr 19 9:40:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-03-27 Wu Yongwei <adah@netstd.com> - * mmap.cc (mmap): Drop usage of the same memory area if the same - region of the same file is mapped twice. + * times.cc (gettimeofday): Revert to setting timezone info if tz != + NULL. -Wed Apr 18 16:53:54 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-21 Christopher Faylor <cgf@redhat.com> - Throughout, change fdtab references to cygheap->fdtab. - * child_info.h (cygheap_exec_info): Eliminate special fdtab stuff. - * spawn.cc (spawn_guts): Ditto. - * cygheap.cc (cygheap_init): Initialize fdtab, if appropriate. - * cygheap.h (CYGHEAPSIZE): Include size of init_cygheap. - (_cmalloc_entry): Include fdtab here. - * dtable.h (dtable): Declare/define new methods. - * dtable.cc (dtable::vfork_child_fixup): New method. - (dtable::fixup_after_exec): Remove unneeded extra arguments. - * dcrt0.cc (dll_crt0_1): Ditto. + * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set + st_[ug]id to value derived from get_file_attributes. - * environ.cc (getwinenv): Use case sensitive comparison. - (winenv): Make a copy of environment cache to avoid realloc problems - when duplicate environment variables exist in the environment. (From - Egor Duda) +2002-03-21 Christopher Faylor <cgf@redhat.com> - * net.cc (cygwin_socket): Revert Apr 14 change. + * spawn.cc (find_exec): Return input if file not found. - * include/sys/file.h: Protect against previous X_OK definition. +2002-03-19 Boris Schaeling <boriss@web.de> -Tue Apr 17 12:18:28 2001 Christopher Faylor <cgf@cygnus.com> + * poll.cc (poll): Add support for invalid descriptors. - * passwd.cc: Eliminate passwd_sem throughout. - * security.cc: Ditto. +2002-03-15 Robert Collins <rbtcollins@hotmail.com> -Tue Apr 17 12:18:28 2001 Robert Collins <rbtcollins@hotmail.com> + * fhandler.h (fhandler_termios::lseek): Override lseek. + * fhandler_termios.cc (fhandler_termios::lseek): Implement this. - * cygwin.din: Export New functions. - * passwd.cc (read_etc_passwd): Make race safe. - (getpwuid_r): New function. - (getpwnam_r): New function. +2002-03-15 Christopher Faylor <cgf@redhat.com> -2001-04-18 Egor Duda <deo@logos-m.ru> + * cygserver.cc: Include stdlib.h for exit declaration. + * threaded_queue.cc: Ditto. - * grp.cc (getgroups): Avoid crash if passwd field if /etc/group is - empty. +2002-03-15 Christopher Faylor <cgf@redhat.com> -Tue Apr 17 19:05:44 2001 Christopher Faylor <cgf@cygnus.com> + * pinfo.cc (pinfo::init): Use PID_ALLPIDS flag to control when a + redirected block should be marked as nonexistent. + (winpids::add): Use PID_ALLPIDS when looking for all pids. + * cygwin.h (PID_ALLPIDS): New enum element. - * path.h (path_conv::add_ext_from_sym): Declare. - * path.cc (path_conv::add_ext_from_sym): Convert to pure inline method. +2002-03-15 Corinna Vinschen <corinna@vinschen.de> -Tue Apr 17 18:50:00 2001 Corinna Vinschen <corinna@vinschen.de> + * glob.c (stat32_to_STAT): New function. + (g_lstat): Call user space functions always with 32 bit struct stat + as a workaround. + (g_stat): Ditto. + * include/glob.h (struct glob): Don't prototype function pointers + when compiling Cygwin. - * path.cc (windows_device_names): Add missing NULL element. +2002-03-14 Christopher Faylor <cgf@redhat.com> -Tue Apr 17 12:14:54 2001 Christopher Faylor <cgf@cygnus.com> + * pinfo.cc (pinfo::init): Properly handle execed process stub when + PID_NOREDIR is specified. - * path.cc (windows_device_names): Move dsp to proper location. +2002-03-13 Boris Schaeling <boriss@web.de> -Tue Apr 17 13:44:00 2001 Corinna Vinschen <corinna@vinschen.de> + * poll.cc (poll): Remove variable open_fds. Rearrange and add code to + fix settings of revents. - * path.cc (path_conv::check): Set case_clash even if pcheck_case - is set to PCHECK_ADJUST when a case clash is given for the last - component in path. - (symlink_info::case_check): Ditto. - * syscalls.cc (_rename): Avoid overwriting an already existing file - if a case clash is given even if pcheck_case is set to PCHECK_ADJUST. +2002-03-13 Corinna Vinschen <corinna@vinschen.de> -Tue Apr 17 2:07:07 2001 Christopher Faylor <cgf@cygnus.com> + * mmap.cc (mmap_record::map_map): Return -1 if VirtualProtect fails. + (list::erase): New method with no argument. Erase latest record + added. + (mmap64): Fail if map_map() fails. - * config.h.in: Turn off VFORK again. +2002-03-12 Corinna Vinschen <corinna@vinschen.de> -Mon Apr 16 23:45:24 2001 Christopher Faylor <cgf@cygnus.com> + * sysconf.cc (sysconf): Fix condition. - * path.h (cwdstuff): Move class. - * cygheap.h (cwdstuff): To here. - (init_cygheap): Add cwd field. - * child_info.h (cygheap_exec_info): Eliminate cwd stuff. - (child_info_spawn): Ditto. - * dcrt0.cc (dll_crt0_1): Remove cygcwd.fixup_after_exec call. Convert - cygcwd reference to cygheap->cwd. - * path.cc: Ditto, throughout. - (cwdstuff::copy): Eliminate. - (cwdstuff::fixup_after_exec): Ditto. - * spawn.cc (spawn_guts): Eliminate call to cygcwd.copy. +2002-03-11 Corinna Vinschen <corinna@vinschen.de> - * fhandler.h (FH_OSS_DSP): Move into "fast" device category. + * mmap.cc (msync): Check area given by addr and len for being a + contigeous mmap'd region. -Mon Apr 16 19:19:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-03-11 Corinna Vinschen <corinna@vinschen.de> - * mmap.cc: Move fh_paging_file from some functions to be - a global static variable. - (class mmap_record): Add `devtype_' member to remember - the device type of the file. Add declaration for methods - `get_device', `alloc_fh' and `free_fh'. - (mmap_record::mmap_record): Initialize `devtype_' correctly. - (mmap_record::alloc_fh): New method. - (mmap_record::free_fh): Ditto. - (munmap): Use new mmap_record::alloc_fh and mmap_record::free_fh - methods to create a correct fhandler. - (msync): Ditto. - (fixup_mmaps_after_fork): Ditto. + * fork.cc (fork_child): Call fixup_mmaps_after_fork() before + closing parent process handle. Call fixup_mmaps_after_fork() + with parent process handle as parameter. + * mmap.cc (mmap_record::access): New method. + (fixup_mmaps_after_fork): Take process handle as parameter. + In case of FILE_MAP_COPY access, copy valid memory regions to child. + * pinfo.h (fixup_mmaps_after_fork): Change prototype accordingly. -Mon Apr 16 16:01:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-03-07 Corinna Vinschen <corinna@vinschen.de> - * grp.cc (getgroups): If `allow_ntsec' is set, use the process token - information to evaluate the groups list. + * autoload.cc (NetGetDCName): Add symbol. + (NetServerEnum): Remove symbol. + * security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of + NetServerEnum() since it's faster. Don't call it at all if machine + is not a domain member. -Mon Apr 16 00:08:02 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-06 Christopher Faylor <cgf@redhat.com> - * features.h: Remove this file as it is now being supplied by newlib. + * path.cc (normalize_posix_path): Avoid runs of '.'s > 2. -Sun Apr 15 23:23:29 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-05 Christopher Faylor <cgf@redhat.com> - * autoload.cc: Add winmm functions needed by fhandler_dsp.cc. - -Sun Apr 15 22:53:52 2001 Andy Younger <andylyounger@hotmail.com> - - * fhandler_dsp.cc: New file. Implements OSS like /dev/dsp. - * include/sys/soundcard.h: New file. User land includes for OSS - /dev/dsp. - * fhandler.h: Add new class fhandler_dev_dsp and a FH_OSS_DSP - definition. - * dtable.cc (dtable::build_fhandler): Allow creation of the /dev/dsp - device. - * path.cc (windows_device_names): Add /dev/dsp into list of device - names. - * Makefile.in (DLL_OFILES): Add fhandler_dsp.o. - -Sun Apr 15 16:36:27 2001 Christopher Faylor <cgf@cygnus.com> - - * uname.c (uname): Default n in in86 to 6 if Windows returns > 6. - -Sun Apr 15 15:56:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * path.cc (add_ext_from_sym): Redefine to call `add_ext_from_sym_'. - (add_ext_from_sym_): New inline function. - -Sat Apr 14 19:23:52 2001 Christopher Faylor <cgf@cygnus.com> - - * config.h.in: Turn on VFORK by default. - -Sat Apr 14 18:04:35 2001 Christopher Faylor <cgf@cygnus.com> - - * net.cc (cygwin_socket): Set SO_LINGER to small value so closed UNIX - domain sockets will not stay around. - -Sat Apr 14 18:01:43 2001 Pierre A. Humblet <Pierre.Humblet@ieee.org> - - * select.cc (socket_cleanup): Set SO_LINGER to small value so closed - dummy sockets do not stay around. Use correct value for second argument - to shutdown. - -Sat Apr 14 17:04:00 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.h (MTinterface): Add threadcount. - * thread.cc (MTinterface::Init): Set threadcount to 1. - (__pthread_create): Increment threadcount. - (__pthread_exit): Decrement threadcount and call exit() from the last thread. - -Fri Apr 13 11:34:24 2001 Robert Collins <rbtcollins@hotmail.com> - - * fork.cc (fork_child): Call the __pthread_atforkchild function. - (fork_parent): Call the __pthread_atforkparent function. - * cygwin.din: Export pthread_atfork. - * thread.h (callback): New class. - (MTinterface): Use it. - * thread.cc (__pthread_atforkprepare): New function. - (__pthread_atforkparent): New function. - (__pthread_atforkchild): New function. - (__pthread_atfork): New function. - * pthread.cc (pthread_atfork): New function. - -Fri Apr 13 9:52:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * path.cc (add_ext_from_sym): New define evaluating `known'suffix'. - (path_conv::check): Use add_ext_from_sym throughout. - -Thu Apr 12 23:19:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * dir.cc (mkdir): Check for case clash. - * environ.cc: Add extern declaration for `pcheck_case'. - (check_case_init): New function. - (struct parse_thing): Add "check_case" option. - * errno.cc (_sys_nerrlist): Add text for ECASECLASH. - (strerror): Add case branch for ECASECLASH. - * fhandler.cc (fhandler_disk_file::open): Check for case clash. - * path.cc: Add global variable `pcheck_case'. - (struct symlink_info): Add member `case_clash' and method `case_check'. - (path_prefix_p_): Call `pathnmatch' instead of `strncasematch'. - (pathnmatch): New funtion. - (pathmatch): Ditto. - (path_conv::check): Add handling for case checking. - (symlink): Check for case clash. - (symlink_info::check): Add parameter for case checking. - Handle case checking. - (symlink_info::case_check): New method. - (chdir): Don't use unconverted path if pcheck_case==PCHECK_STRICT. - * path.h: Add extern declarations for `pathmatch' and - `pathnmatch'. - (enum case_checking): New enumeration type describing - the case checking behaviour of path conversion routines. - (class path_conv): Add member `case_clash'. - * syscalls.cc (_link): Check for case clash. - -Thu Apr 12 12:49:53 2001 Christopher Faylor <cgf@cygnus.com> - - * syscalls.cc (mkfifo): New function stub. - -2001-04-12 Robert Collins <rbtcollins@hotmail.com> - - * configure.in: Remove PTH_ALLOW. - * cygwin.din: Remove @PTH_ALLOW@ prefixes to pthread functions. Add - new pthread exports. - * pthread.cc: New wrapper functions for the above new exports. - * sched.cc (valid_sched_parameters): New function. - (sched_setparam): Use it. - (sched_set_thread_priority): New function. Used by pthread_sched*. - * thread.cc (pthread_key_destructor::InsertAfter): New function. - (pthread_key_destructor::UnlinkNext): New function. - (pthread_key_destructor::Next): New function. - (pthread_key_destructor_list::Insert): New function. - (pthread_key_destructor_list::Remove): New function. - (pthread_key_destructor_list::Pop): New function. - (pthread_key_destructor::pthread_key_destructor): New function. - (pthread_key_destructor_list::IterateNull): New function. - (MTinterface::Init): Initialise new member. - (pthread::pthread): Initialise new members. - (pthread::create): Copy new attributes. Set the new thread priority. - (pthread_attr::pthread_attr): Initialise new members. - (pthread_key::pthread_key): Setup destructor function. - (pthread_key::~pthread_key): Remove destructor function. - (pthread_mutexattr::pthread_mutexattr): New function. - (pthread_mutexattr::~pthread_mutexattr): New function. - (__pthread_once): New function. - (__pthread_cleanup): New function. - (__pthread_cancel): New function. - (__pthread_setcancelstate): New function. - (__pthread_setcanceltype): New function. - (__pthread_testcancel): New function. - (__pthread_attr_getinheritsched): New function. - (__pthread_attr_getschedparam): New function. - (__pthread_attr_getschedpolicy): New function. - (__pthread_attr_getscope): New function. - (__pthread_attr_setinheritsched): New function. - (__pthread_attr_setschedparam): New function. - (__pthread_attr_setschedpolicy): New function. - (__pthread_attr_setscope): New function. - (__pthread_exit): Call any key destructors on thread exit. - (__pthread_join): Use the embedded attr values. - (__pthread_detach): Use the embedded attr values. - (__pthread_getconcurrency): New function. - (__pthread_getschedparam): New function. - (__pthread_key_create): Pass the destructor on object creation. - (__pthread_key_delete): Correct incorrect prototype. - (__pthread_setconcurrency): New function. - (__pthread_setschedparam): New function. - (__pthread_cond_timedwait): Support static mutex initialisers. - (__pthread_cond_wait): Ditto. - (__pthread_mutex_getprioceiling): New function. - (__pthread_mutex_lock): Support static mutex initialisers. - (__pthread_mutex_trylock): Ditto. - (__pthread_mutex_unlock): Ditto. - (__pthread_mutex_destroy): Ditto. - (__pthread_mutex_setprioceiling): New function. - (__pthread_mutexattr_getprotocol): New function. - (__pthread_mutexattr_getpshared): New function. - (__pthread_mutexattr_gettype): New function. - (__pthread_mutexattr_init): New function. - (__pthread_mutexattr_destroy): New function. - (__pthread_mutexattr_setprotocol): New function. - (__pthread_mutexattr_setprioceiling): New function. - (__pthread_mutexattr_getprioceiling): New function. - (__pthread_mutexattr_setpshared): New function. - (__pthread_mutexattr_settype): New function. Remove stubs for non - MT_SAFE compilation. - * thread.h: Remove duplicate #defines. Add prototypes for new - functions in thread.cc. - (pthread_key_destructor): New class. - (pthread_key_destructor_list): New class. - (pthread_attr): Add new members. - (pthread): Remove members that are duplicated in the pthread_attr - class. - (pthread_mutex_attr): Add new members. - (pthread_once): New class. - * include/pthread.h: Add prototypes for new functions exported from - cygwin1.dll. Remove typedefs. - * include/sched.h: Add prototypes for new functions in sched.cc. - * include/cygwin/types.h: Add typedefs from pthread.h - -Tue Apr 10 22:02:53 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (struct symlink_info): Add extn and ext_tacked_on fields. - (path_conv::check): Only tack on extension if a known one didn't - already exist. - (suffix_scan::has): Return pointer to known extension. - (symlink_info::check): Record location of extension, if any. - -2001-04-09 Egor Duda <deo@logos-m.ru> - - * fhandler.h (class fhandler_socket): Add members and methods to - support secure connections on AF_UNIX sockets. - * fhandler_socket.cc (fhandler_socket::set_connect_secret): New method. - (fhandler_socket::get_connect_secret): Ditto. - (fhandler_socket::create_secret_event): Ditto. - (fhandler_socket::close_secret_event): Ditto. - (fhandler_socket::check_peer_secret_event): Ditto. - (fhandler_socket::fixup_after_fork): Duplicate secret event to child. - (fhandler_socket::dup): Copy address family. - (fhandler_socket::close): Close secret event. - * net.cc (get_inet_addr): Read secret cookie. - (cygwin_connect): Check if peer knows secret cookie value. - (cygwin_accept): Ditto. Copy address family to newly created socket. - (cygwin_bind): Generate and write secret cookie. - (wsock_init): Initialize random number generator. - -Sun Apr 8 20:40:58 2001 Christopher Faylor <cgf@cygnus.com> - - * Makefile.in: Put -lgcc last in list of libraries, since stdc++ - library needs it. - * cygwin.din: Remove obsolete "__empty" export. - * exceptions.cc (call_signal_handler_now): Force inclusion of function - even when -finline-functions is specified. - * sigproc.h: Remove obsolete call_signal_handler declaration. - -Sun Apr 8 20:36:55 2001 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> - - * fhandler_console.cc (cp_get_internal): New function. - (cp_convert): New function. - (con_to_str): New function. - (str_to_con): New function. - (fhandler_console::read): Replace OemToCharBuff with con_to_str. - (fhandler_console::write_normal): Replace CharToOemBuff with str_to_con. - -Thu Apr 5 22:41:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * syscalls.cc (stat_worker): Fix conditional which still allowed - successful stat'ing of non-existant files. - -Wed Apr 4 10:37:44 2001 Christopher Faylor <cgf@cygnus.com> - - * child_info.h: Bump magic number for fork/exec/spawn. - -Tue Apr 3 20:06:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * errno.cc (errmap): Map ERROR_FILE_INVALID to ENXIO. - -Mon Apr 2 22:48:58 2001 Christopher Faylor <cgf@cygnus.com> - - * cygrun.c (main): Fix compiler warning. - * gmon.c (_mcleanup): Ditto. - * profil.c (profile_off): Ditto. - - * net.cc (find_winsock_errno): New function. - (__set_winsock_errno): Use find_winsock_errno. - (cygwin_setsockopt): Detect SO_ERROR for debugging. - (cygwin_getsockopt): Ditto. Translate error when getsockopt returns - SO_ERROR. - * winsup.h: regparmize __set_winsock_errno. - * include/sys/strace.h: Document that strace functions can't use - regparm. - -2001-04-02 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * fhandler.cc (fhandler_disk_file::open): Avoid checking a magic - number of a directory. - -Mon Apr 2 00:24:08 2001 Christopher Faylor <cgf@cygnus.com> - - * shared_info.h (mount_info): Remove mnt_ elements. - * thread.h (struct _winsup_t): Add mnt_ elements. - * path.cc (fillout_mntent): Use mnt_ elements from reent_winsup (). - -Sun Apr 1 20:10:34 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (sigframe::call_signal_handler): Return value of - call_signal_handler_now. - * sigproc.h (sigframe): Use constructor. - * syscalls.cc (_read): Correct errno test prior to calling signal - handler. + * errno.cc: Change EPERM associated text to "Operation not permitted" + throughout. -Sun Apr 1 00:38:06 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-05 Christopher Faylor <cgf@redhat.com> - * exceptions.cc (sigframe::call_signal_handler): Move outside of "C" - block or some compilers will complain. + * fhandler_socket.cc (fhandler_socket::close): Respond to signals while + looping, waiting for socket to close. Superstitiously clear last error + when WSAEWOULDBLOCK. -Sun Apr 1 00:24:14 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-05 Robert Collins <rbtcollins@hotmail.com> - * exceptions.cc (call_signal_handler_now): Rename from - call_signal_handler to avoid C++ confusion. + * cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes): + Always init - until static members work correctly. + * shm.cc (shmget): Initialize the security descriptor - thanks Corinna! + * include/sys/ipc.h: Make the ipc control constants partitioned off from the sem + control constants. -Sun Apr 1 00:08:15 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-04 Christian Lestrade <christian.lestrade@free.fr> - * path.cc (fillout_mntent): Always remove drive root directories from - future consideration by "/cygdrive" reporting. - (cygdrive_getmnt): Avoid reporting removable drives or drives with no - media mounted. + * include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro. + * fhandler_termios.cc: Include <sys/termios.h>. + (line_edit): Recognize disabled c_cc[] chars. Ignore VDISCARD when + not in ICANON mode. -Sat Mar 31 21:56:19 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-04 Dmitry Timoshkov <dmitry@baikal.ru> - * thread.h (struct _winsup_t): Remove obsolete elements. Add - available_drives element. - * path.cc (mount_info::getmntent): Report "/cygdrive" drives when - mounted drives are exhausted. - (fillout_mntent): New function. - (mount_item::getmntent): Use fillout_mntent. - (cygdrives_mntent): New function. Returns next available "/cygdrive". - (setmntent): Initialize available "/cygdrives". - * syscalls.cc: Remove some if 0'ed code. - * times.cc (timezone): Use more descriptive variable name. + * syscalls.cc (truncate64): Use ftruncate64 directly to not lose + upper 32 bits. -Sat Mar 31 18:59:52 2001 Christopher Faylor <cgf@cygnus.com> +2002-03-04 Robert Collins <rbtcollins@hotmail.com> - * sigproc.h (class sigframe): Implement 'unregister()' method. - (sigframe::~sigframe): Use unregister method. - (sigframe::call_signal_handler): Declare new method. - * exceptions.cc (sigframe::call_signal_handler): New method. - Unregisters current sigframe before calling signal handler. - (setup_handler): Clear waiting threads prior to arming signal_arrived. - * syscalls.cc (_read): Change goto to loop. Recalculate sigframe - inside of loop so that constructor is called when appropriate. - * wait.cc (wait4): Ditto. + * cygserver_shm.cc (delete_shmnode): New function. + (client_request_shm::serve): Use it. - * signal.cc: Change "sig" to "signal" in debugging messages throughout. - * sigproc.cc: Ditto. +2002-03-04 Robert Collins <rbtcollins@hotmail.com> -Sat Mar 31 17:12:08 2001 Christopher Faylor <cgf@cygnus.com> + * cygserver_shm.cc (client_request_shm::serve): Implement SHM_DETACH. + * shm.cc (shmdt): Implement. - * fhandler_serial.cc (fhandler_serial::raw_write): Close protected - handles with ForceCloseHandle or suffer spurious warnings. +2002-03-04 Robert Collins <rbtcollins@hotmail.com> -Sat Mar 31 16:23:32 2001 Christopher Faylor <cgf@cygnus.com> + * cygserver_shm.cc: Run indent. + (deleted_head): New global for storing shm id's pending deletion. + (client_request_shm::serve): Return ENOSYS for invalid request types. + Implement SHM_DEL - delete a shm id. + * cygserver_shm.h (SHM_DEL): New type value. + * shm.cc (delete_inprocess_shmds): New function, does what it's name implies. + (shmctl): Implement shm_rmid control type. - * fhandler.cc (fhandler_base::read): Remove special handling of CTRL-Z. +2002-03-04 Robert Collins <rbtcollins@hotmail.com> -Sat Mar 31 11:09:00 2001 Corinna Vinschen <corinna@vinschen.de> + * Makefile.in (install): Remove install-bin to allow make install to work. - * fhandler.h (class fhandler_console): Add members `insert_mode'. - * fhandler_console.cc (fhandler_console::dup): Duplicate `insert_mode'. - (fhandler_console::fhandler_console): Initialize `insert_mode'. - (fhandler_console::char_command): Add terminal capabilities - "enter insert mode" = \E[4h and "exit insert mode" = \E[4l. - Care for insert mode on terminal capability "repeat char" = \E[x;yb. - (fhandler_console::write_normal): Care for insert mode before writing - to the console. - (array keytable): Add keymapping for modified cursor and control - block keys (xterm like). +2002-03-03 Robert Collins <rbtcollins@hotmail.com> -Fri Mar 30 13:02:00 2001 Corinna Vinschen <corinna@vinschen.de> + * shm.cc (shmat): Prevent a compile error. + (shmdt): Set errno as this function is incomplete. - * fhandler.h (class fhandler_console): Add members `savebufsiz' and - `savebuf' to allow save/restore of screen. - * fhandler_console.cc (fhandler_console::dup): Duplicate `savebufsiz' - and `savebuf'. - (fhandler_console::fhandler_console): Initialize `savebufsiz' and - `savebuf'. - (fhandler_console::char_command): Add terminal capabilities - "save screen content" = \E[?47h and "restore screen content" = \E[?47l. +2002-02-28 Christopher Faylor <cgf@redhat.com> -Wed Mar 28 19:28:50 2001 Christopher Faylor <cgf@cygnus.com> + * times.cc: Remove if 0'd code. Clean up slightly. - * path.cc (chdir): Eat trailing whitespace on input path. +2002-02-28 Robert Collins <rbtcollins@hotmail.com> -Tue Mar 27 22:38:42 2001 Christopher Faylor <cgf@cygnus.com> + * Merge cygwin_daemon into head minus the new shm and ipc exports. - * lib/_cygwin_S_IEXEC.c: Remove "const" from globals or they never seem - to be defined. Wrap definitions in extern "C". Include winsup.h to - assure proper definitions. +2002-02-28 Robert Collins <rbtcollins@hotmail.com> - * dcrt0.cc (dll_crt0_1): Call stdio_init after premain run so that - binmode.o, etc., will control default stdio settings. - * dtable.cc (dtable::init_std_file_from_handle): Allow __fmode to force - binmode/textmode settings. Default pipes to binmode. + * fhandler_tty.cc (fhandler_tty_slave::open): More debugging. + (fhandler_tty_slave::read): Fix printf type for the handle. + * tty.cc (tty::common_init): Add a FIXME for security. -Tue Mar 27 11:31:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-29 Robert Collins <rbtcollins@hotmail.com> - * mmap.cc (mmap): Fix conditional for previous patch. + * Makefile.in (OBJS): Remove duplicate localtime.o. -Mon Mar 26 18:48:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-17 Robert Collins <rbtcollins@hotmail.com> - * mmap.cc (mmap): Outflank copy-on-write problem on 9x by - setting access mode to FILE_MAP_READ when read access is requested. + * cygserver.cc (check_and_dup_handle): Consolidate the two variants for + simplicity. + Add Some basic debug output. + (client_request_attach_tty::serve): Use the new debug_printf for clarity. + Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen + tty's. -Sun Mar 25 20:12:21 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-16 Robert Collins <rbtcollins@hotmail.com> - * dlfcn.cc (check_access): Eliminate. - (check_path_access): Use passed in path_conv buf. - (get_full_path_of_dll): Use passed in name buf to avoid a static. Rip - out most of the path checking since LoadLibrary will do all of this - automatically. - (dlopen): Set errno when appropriate (may not be compliant?). - * environ.cc (posify): Don't pass in "native" path if it seems to - actually be posix. - -Thursday Mar 22 2001 Robert Collins <rbtcollins@hotmail.com> + * cygserver.cc (transport): Correct scope. + (client_request_attach_tty::serve): Add more debug information. + Fix erroneous use of transport instead of conn. + * cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug. + (transport_layer_pipes::read): Ditto. + (transport_layer_pipes::write): Ditto. + (transport_layer_pipes::impersonate_client): Ditto. - * fhandler.h (fhandler_dev_clipboard): Extend to support writing. - * fhandler_clipboard.cc (fhandler_dev_clipboard::fhandler_dev_clipboard): - Initialize new fields. Open clipboard here. - (fhandler_dev_clipboard::dup): New method. - (fhandler_dev_clipboard::open): Accomodate new fields. Register - clipboard here, if appropriate. - (set_clipboard): New function. Moves buffer to clipboard. - (fhandler_dev_clipboard::write): Truly implement clipboard writing. - (fhandler_dev_clipboard::read): Reimplement to allow successive reads. - (fhandler_dev_clipboard::lseek): Truly implement seeks in clipboard. - (fhandler_dev_clipboard::close): Clear out new fields. Support - sequential reads and sequential writes. Support for binary data via a - native clipboard format. +Mon Oct 8 7:41:00 2001 Robert Collins <rbtcollins@hotmail.com> -2001-03-22 Egor Duda <deo@logos-m.ru> + * cygserver.cc (server_request::process): Rename client_request_shm_get to + client_request_shm. + * cygserver_process.cc (process_cache::add): Rename to add_task. + Use process_cleanup instead of process_request. + (process_cache::remove_process): New method. + (process::process): Initialize new members. + (process::~process): New member. + (process::cleanup): New method. + (process::add_cleanup_routine): New method. + (process_request::process): Rename to process_cleanup. + Call the process object's cleanup method and then delete it. + (process_process_param::request_loop): Remove the signalling process. + * cygserver_shm.cc: Globally rename client_request_shm_get to client_request_shm. + (client_request_shm_get::serve): Handle attach request counting. + * cygserver_shm.h: Globally rename client_request_shm_get to client_request_shm. + (class shm_cleanup): New class. + * shm.cc: Globally rename client_request_shm_get to client_request_shm. + (client_request_shm::client_request_shm): New constructor for attach requests. + (shmat): Use it. + * include/cygwin/cygserver_process.h (class process_request): Rename to + process_cleanup. + (class cleanup_routine): New class. + (class process): New members and methods to allow calling back when the process + terminates. - * fhandler_console.cc (fhandler_console::set_default_attr): Update - console color attributes on tty reset. +Thu Oct 4 14:12:00 2001 Robert Collins <rbtcollins@hotmail.com> + * cygserver.cc (request_loop): Make static. + (main): Use new cache constructor syntax. + Start cache worker threads. + Cleanup the cache at shutdown. + * cygserver_process.cc: Run indent. + (process_cache::process_cache): Add a trigger to use when adding a process. + (process_cache::process): Move process_entry to process. + Insert at the end of the list. + Trigger the request loop when new process's inserted. + (process_cache::process_requests): Do it. + (process_cache::add): New method. + (process_cache::handle_snapshot): New method. + (process::process): Merge in the process_entry fields. + (process::handle): Make a stub function. + (process::exit_code): New method. + (process_request::process): New method. + (process_process_param::request_loop): New method. + * cygserver_shm.cc: New header dependency - threaded_queue.h. + * threaded_queue.cc (threaded_queue::cleanup): Clearer messages. + (queue_process_param::stop): Short spinlock on interruptible threads. + * threaded_queue.h (class threaded_queue): New constructor. + * include/cygwin/cygserver_process.h (process_request): New class. + (process_entry): Remove. + (process): Merge in process_entry. + (process_cache): Inherit from threaded_queue. -Wed Mar 21 22:12:36 2001 Christopher Faylor <cgf@cygnus.com> +Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com> - * autoload.cc (kernel32_init): New function for kernel32 autoload - initialization. - (SignalObjectAndWait): Add conditional load of this function when it is - available. + * cygserver.cc (class server_process_param): Use new constructor syntax. + * cygserver_process.cc (process_cache::~process_cache): New function. + * threaded_queue.cc: Define condition debug_printf. + Run indent. + (threaded_queue::cleanup): Move queue_process_param guts to a method. + (threaded_queue::process_requests): Ditto. + (queue_process_param::queue_process_param): New method. + (queue_process_param::~queue_process_param): Ditto. + (queue_process_param::start): Ditto. + (queue_process_param::stop): Ditto. + * threaded_queue.h (class queue_process_param): Add support for + interruptible request loops. + * cygwin/include/cygwin/cygserver_process.h (class process_cache): Add + destructor. -2001-03-21 Robert Collins <rbtcollins@hotmail.com> +Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com> - * sched.cc: New file. Implement sched*. - * include/sched.h: New file. User land includes for sched*. - * Makefile.in: Add sched.o - * cygwin.din: Add exports for sched*. + * cygserver_client.cc: New flag allow_daemon to disable the daemon completely. + (cygserver_request): Check it. + (cygserver_init): Ditto. + * environ.cc (parse_thing): Add (no)daemon option. -Tue Mar 20 14:48:46 2001 Christopher Faylor <cgf@cygnus.com> +Tue Oct 2 23:00:00 2001 Robert Collins <rbtcollins@hotmail.com> - * dtable.cc: Guard against new winsock.h/winsock2.h warnings when - mixing winsock*.h and sys/types.h. - * fhandler_socket.cc: Ditto. - * net.cc: Ditto. - * select.cc: Ditto. - * exceptions.cc: Remove unneeded define. + * shm.cc: Update to handle include changes from HEAD. -Mon Mar 19 17:43:29 2001 Christopher Faylor <cgf@cygnus.com> +Tue Oct 2 16:06:00 2001 Robert Collins <rbtcollins@hotmail.com> - * exceptions.cc (interruptible): Update debugging output. - (setup_handler): Ensure that wait_sig loop wakes up when we punt on - sending a signal. - * poll.cc (poll): Add signal guard here. + * Makefile.in: Remove cygserver_shm.o from cygwin1.dll. + Rename cygserver_shm_outside.o to cygserver_shm.o. + * cygserver.cc (server_request::process): Use the new client_request + constructor. + * cygserver_client.cc: Remove the #ifdef's stubs for the server method + within cygwin. + (client_request_attach_tty::client_request_attach_tty): Use the new + client_request constructor. + (client_request_shutdown::client_request_shutdown): Ditto. + (client_request::client_request): Ditto. + * cygserver_shm.cc (client_request_shm_get::serve): Remove the + #ifdef'd stub for in-cygwin builds. + (client_request_shm_get::client_request_shm_get): Use the new + client_request constructor, and remove the in-cygwin variants. + * cygserver_shm.h (class client_request_shm_get): #ifndef test the + serve method - it's only used in cygserver. + * shm.cc (client_request_shm_get::client_request_shm_get): New function. + * include/cygwin/cygserver.h (request_header): New constructor. + (class client_request): Use it. + New constructor accepting the header size. + #ifndef test the server method - it's only used within cygserver. + (client_request_get_version): #ifdef test the server method. + (client_request_shutdown): Ditto. + (client_request_attach_tty): Ditto. -2001-03-19 Egor Duda <deo@logos-m.ru> +Tue Oct 2 9:57:00 2001 Robert Collins <rbtcollins@hotmail.com> - * tty.h (tty::create_inuse): Add new parameter to allow non- - inheritable 'inuse' events. - * tty.cc (tty::create_inuse): Use new parameter. - * fhandler_tty.cc (fhandler_tty_master::init): Ditto. - * fhandler_tty.cc (fhandler_pty_master::open): Ditto. - * fhandler_tty.cc (fhandler_tty_master::init): Create master_alive - event. - * tty.cc (tty_list::terminate): Close master_alive event. - * fhandler_tty.cc (fhandler_tty_common::close): Send EOF to slaves - when master side is closed. + * Makefile.in: add threaded_queue.o to cygserver.exe. + * cygserver.cc: Include threaded_queue.h + (class server_request): Inherit from queue_request. + (class server_process_param): Inherit from queue_process_param. + (class server_request_queue): Inherit from threaded_queue. + (request_loop): Adjust for new types. + (server_request_queue::process_requests): Remove guts to + threaded_queue::process_requests. + (server_request::server_request): Adjust for new types. + (worker_function): Delete. + (server_request_queue::create_workers): Delete. + (server_request_queue::cleanup): Delete. + (server_request_queue::add): Move guts to threaded_queue::add. + * threaded_queue.cc: New file. + * threaded_queue.h: New file. -Mon Mar 19 14:32:00 2001 Corinna Vinschen <corinna@vinschen.de> +Mon Oct 1 12:38:00 2001 Robert Collins <rbtcollins@hotmail.com> - * mmap.cc (map::get_list_by_fd): Avoid calling `get_namehash' when - file descriptor is -1. + * cygserver.cc (client_request::serve): New function. + * cygserver_process.cc: Inlude <pthread.h> for pthread_once. + (process_cache::process_cache): Initialise a crtiical section for write access. + (process_cache::process): Use the critical section. Also add missing entries to + the cache. + (do_process_init): New function to initalise class process static variables. + (process::process): Ensure that the process access critical section is + initialised. + (process::handle): Close the handle of old process's when they have terminated + and we are returning the handle for a process with the same pid. + * cygserver_shm.cc: Run indent. + Include cygserver_process.h to allow process cache functionality. + (client_request_shm_get::serve): New parameter for process cache support. + Use the process cache, not OpenProcess to get a handle to the originating process. + Fix a handle leak with token_handle. + * cygserver_shm.h (class client_request_shm_get): Update ::serve for process + cache support. + * cygserver_transport_pipes.cc: Redefine debug_printf to be conditional on DEBUG. + * include/cygwin/cygserver.h: Do not implement client_request::serve in the + header. + * include/cygwin/cygserver_process.h (class process_cache): Add a write access + critical section to prevent races when requests from a multithreaded + application arrive. -Sat Mar 17 18:30:00 2001 Corinna Vinschen <corinna@vinschen.de> +Sun Sep 30 23:41:00 2001 Robert Collins <rbtcollins@hotmail.com> - * syscalls.cc (check_posix_perm): New static function. - (fpathconf): Add _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY + * Makefile.in: Add cygserver_process.o to cygserver.exe. + * cygserver.cc: Include signal.h and cygwin_version.h. + Define debug_printf as a macro. + Define DEBUG to a value. + (client_request_attach_tty::serve): Add beginning of process cache support. + Change from #ifdef DEBUG to work with new DEBUG style. + (client_request_get_version::serve): Add beginning of process cache support. + (class server_request): New prototype for support of process cache. + (class queue_process_param): New class to allow request loop threading. + (class server_request_queue): Add beginning of process cache support. + Allow request loop threading. + (request_loop): Thread function for request loops. + (server_request_queue::process_requests): Initiator for threaded request loops. + (client_request_shutdown::serve): Add beginning of process cache support. + (server_request::server_request): Ditto. + (server_request::process): Use debug_printf. Add beginning of process cache support. - (pathconf): Ditto. - * include/cygwin/version.h: Bump API minor number to 37. - -2001-03-18 Egor Duda <deo@logos-m.ru> - - * fhandler.h (fhandler_tty_slave): Declare new methods. - * select.cc (fhandler_tty_slave::select_read): New method. - * select.cc (fhandler_tty_slave::ready_for_read): Ditto. - * select.cc (verify_tty_slave): New function. - * fhandler_termios.cc (fhandler_termios::line_edit): Empty input - buffer on signal. - * fhandler_tty.cc (fhandler_tty_slave::read): Check for input data - after reading from pipe. Reset event if input pipe is empty. - * tty.h (class tty): Allow creating events with manual reset. - * tty.cc (tty::get_event): Use manual_reset flag. - * tty.cc (tty::common_init): Create input_available_event with - manual reset. - -Sat Mar 17 21:48:03 2001 Christopher Faylor <cgf@cygnus.com> - - * external.cc (fillout_pinfo): Match windows pid, as well as cygwin pid - when passed in pid. Don't prematurely break when searching for a pid. - - * thread.h (_winsup_t): Eliminate unneeded field. - -Sat Mar 17 20:46:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (get_95_ifconf): Use strcasematch instead of strcasecmp. - * syscalls.cc (_unlink): Ditto. - (_rename): Ditto. - -Sat Mar 17 12:43:15 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc (suffix_scan::next): Avoid searching for foo.lnk twice when - input is "foo". - -Sat Mar 17 18:10:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * net.cc (cygwin_socket): Set protocol to 0 when address family is - AF_UNIX to avoid WSAEPROTONOSUPPORT error. - -Sat Mar 17 09:51:32 2001 Mathew Brozowski <brozow@tavve.com> - - * net.cc (cygwin_socket): Pass protocol parameter to socket call. - -Sat Mar 17 02:05:38 2001 Christopher Faylor <cgf@cygnus.com> - - * dir.cc (readdir): Use strcasematch for consistency. - * path.cc (symlink_info): Eliminate known_suffix. - (path_conv::check): Always copy ext_here to end of buffer, if found. - (suffix_scan): Eliminate ext_here, add suffixes_start. - (suffix_scan::has): Eliminate an argument. Reorganize. Always return - pointer to end of input path. - (suffix_scan::next): Take a second pass through the suffix list looking - for .lnk. - (symlink_info::check): Eliminate known_suffix usage. - -Sat Mar 17 00:10:52 2001 Christopher Faylor <cgf@cygnus.com> - - * syscalls.cc (stat_dev): Give devices full read/write by default. - -Saturday Mar 17 3:45 2001 Robert Collins <rbtcollins@hotmail.com> - - * thread.cc (MTinterface::CreateCond): Check for null attr pointer. - -Fri Mar 16 21:13:23 2001 Christopher Faylor <cgf@cygnus.com> - - * fhandler_termios.cc (fhandler_termios::line_edit): Don't accept input - when a signal is sent or we'll end up in an EOF/signal race. - -Fri Mar 16 20:25:40 2001 Christopher Faylor <cgf@cygnus.com> - - * path.cc: Translate scan states from defines to enums. - (suffix_scan): Rename state to nextstate for clarity. - (lnk_match): Change to allow multiple states to indicate that a .lnk - has been matched. - (suffix_scan::has): Eliminate a goto. Handle .lnk as a special case, - since a .lnk may also need to be tacked on the end of a .lnk. - (suffix_scan::next): Don't increment next state. Set it specifically. - Recognize new .lnk states. - -Saturday Mar 17 01:19 2001 Robert Collins rbtcollins@hotmail.com - - * cygwin.din: Export the new functions. - * pthread.cc (pthread_cond_*): Add wrapper functions that call - __pthread_cond* functions. - * thread.cc (__pthread_cond_*): Implement the pthread_cond* functions. - * thread.h: Add new class entries and prototypes for __pthread_cond* - functions. - * include/pthread.h: user land header prototypes for pthread_cond* - functions and related defines. - -Wed Mar 14 16:30:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * environ.cc (parse_options): Use strtok_r instead of strtok. - * security.cc (convert_string_sid_to_sid): Ditto. - (aclfromtext): Ditto. Fix buffer usage. - -Wed Mar 14 10:11:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * path.cc (lnk_suffixes): Remove. - (class suffix_scan): Add `lnk_state' flag. - (suffix_scan::lnk_match): Return state of `lnk_state' now. - (suffix_scan::has): Changed behaviour if file has `.lnk' suffix. - (suffix_scan::next): Set `lnk_state' where appropriate. - (symlink_info::check): Fix a wrong `break'. - * syscalls.cc (chown_worker): Change debug statement to reflect - lchown fix. - (lchown): Call chown_worker with `PC_SYM_NOFOLLOW' instead of - `PC_SYM_IGNORE'. - -Tue Mar 13 13:52:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler.cc (fhandler_disk_file::fstat): Add correct modes to - symlinks when stat'ing on FAT or FAT32 file systems. - -2001-03-12 Egor Duda <deo@logos-m.ru> - - * fhandler.h (fhandler_termios::fixup_after_exec): New function. - * fhandler_termios.cc (fhandler_termios::fixup_after_fork): New - function. Fixup output handle. - * fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Output - handle is now fixed up in fhandler_termios::fixup_after_fork(). - -2001-03-12 Egor Duda <deo@logos-m.ru> - - * fhandler.h (fhandler_termios::fhandler_termios): Enable fixup - after fork. - * fhandler_console.cc (fhandler_console::fhandler_console): Fixup - after fork is now enabled in the base class constructor. - -Mon Mar 12 11:19:41 2001 Christopher Faylor <cgf@cygnus.com> - - * mkvers.sh: Include config.h so that DEBUGGING is correctly defined. + (server_request_queue::cleanup): Kill off any request loop threads. + (server_request_queue::add): Add beginning of process cache support. + (handle_signal): Trigger a shutdown. + (main): Print out some useful info at startup - version, date time. + Add process cache support. + Spawn a separate thread for the transport request loop, thus allowing concurrent + support for multiple transports. + * cygserver_client.cc (client_request_get_version::serve): Add process cache + support. + (client_request_attach_tty::serve): Add process cache support. + (client_request_shutdown::serve): Add process cache support. + * cygsserver_process.cc: New file with the process cache support. + * cygserver_shm.cc: Redefine debug_printf to allow conditional output. + * cygwin.din: Export shmdt(). + * shm.cc: Run indent. + Update FIXME's. + (shmdt): New function. + * include/cygwin/cygserver.h (class client_request): Add process cache support. + (class client_request_get_version): Ditto. + (class client_request_shutdown): Ditto. + (class client_request_attach_tty): Ditto. + * include/cygwin/cygserver_process.h: New header for process cache support. -Mon Mar 12 09:47:55 2001 Christopher Faylor <cgf@cygnus.com> +Sun Sep 30 8:52:00 2001 Robert Collins <rbtcollins@hotmail.com> - * spawn.cc (spawn_guts): Don't set EXIT_REPARENTING if parent process - is not a cygwin process (suggested by Jason Gouger - <cygwin@jason-gouger.com>). + * include/cygwin/cygserver_transport.h: Add copyright header. + * include/cygwin/cygserver_transport_pipes.h: Ditto. + * include/cygwin/cygserver_transport_sockets.h: Ditto. -Sun Mar 11 16:00:58 2001 Christopher Faylor <cgf@cygnus.com> +Sat Sep 29 20:40:00 2001 Robert Collins <rbtcollins@hotmail.com> - * child_info.h: Bump magic number for fork/exec/spawn. + * Makefile.in: Add cygserver_transport_sockets.o to DLL_OFILES. + Add cygserver_transport_sockets_outside.o to cygserver.exe. + * cygserver.cc: Include new include files. + * cygserver_client.cc: Ditto. + * cygserver_shm.h: No need to include <sys/socket.h> now. + * cygerver_transport.cc: Include new include files. + (transport_layer_base::transport_layer_base): Strip back to a stub. + (transport_layer_base::listen): Ditto. + (transport_layer_base::accept): Ditto. + (transport_layer_base::close): Ditto. + (transport_layer_base::read): Ditto. + (transport_layer_base::write): Ditto. + (transport_layer_base::connect): Ditto. + * cygserver_transport_pipes.cc: Include new header + "cygwin/cygserver_transport_pipes.h". + * cygserver_transport_sockets.cc: New file. + * dcrt0.cc: No need to include <sys/socket.h> now. + * fhandler_tty.cc: Ditto. + * tty.cc: Ditto. + * include/cygwin/cygserver_transport.h: Strip the base class to a stub. + Remove the cygserver_transport_pipes class. + * include/cygwin/cygserver_transport_pipes.h: New file. + * include/cygwin/cygserver_transport_sockets.h: New file. -Sat Mar 10 20:54:47 2001 Christopher Faylor <cgf@cygnus.com> +Tue Sep 25 16:22:00 2001 Robert Collins <rbtcollins@hotmail.com> - * autoload.cc (noload): Use proper method for multiline strings or - newer gcc's complain. - * exceptions.cc (unused_sig_wrapper): Ditto. - * fhandler.h (fhandler_base): Make get_io_handle and friends return - self. - * fhandler_tty.cc (fhandler_pty_common::close_on_exec): Accomodate - DEBUGGING flag to avoid spurious warnings when inheritance is set. + * autoload.cc: Add dynamic load statement for 'ImpersonateNamedPipeClient'. + * Makefile.in: Add new object files, and build instructions for cygserver.exe. + * cygwin.din: Export ftok, shmat, shmctl and shmget. + * dcrt0.cc: Additional includes for cygserver support. + (dll_crt0_1): Initialise the cygserver client. + * fhandler.h (fhandler_tty): New method cygserver_attach_tty. + * fhandler_tty.cc: Additional includes for cygserver support. + (fhandler_tty_slave::open): Attempt to use the cygserver when obtaining + handles from the parent process. On failure or 9x use the current method. + (fhandler_tty_slave::cygserver_attach_tty): New function. + * fork.cc (fork_child): Fixup shm memory mapped areas. + * pinfo.h: Declare fixup_shms_after_fork(). + * security.h: Declare alloc_sd(). + * tty.cc: Additonal includes to support cygserver. + (tty::common_init): Don't allow others to open us if the cygserver is running. + * winsup.h: Declare cygserver_running. + * cygserver.cc: New file. + * cygserver_client.cc: New file. + * cygserver_shm.cc: New file. + * cygserver_shm.h: New file. + * cygserver_transport.cc: New file. + * cygserver_transport_pipes.cc: New file. + * ipc.cc: New file. + * shm.cc: New file. + * include/cygwin/cygserver.h: New file. + * include/cygwin/cygserver_transport.h: New file. + * include/sys/ipc.h: New file. + * include/sys/shm.h: New file. -Sat Mar 10 16:52:12 2001 Christopher Faylor <cgf@cygnus.com> +2002-02-28 Robert Collins <rbtcollins@hotmail.com> - * shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler - warning. + * thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1. + (__sem_wait): Ditto. + (__sem_trywait): Ditto. - * exceptions.cc (setup_handler): Clarify debugging message. - * sigproc.cc (proc_subproc): Remove PROC_CHILDSTOPPED test. It is - handled by normal PROC_CLEARWAIT case. - (wait_sig): Eliminate "dispatched" tracking. Remove __SIGCHILDSTOPPED - test. Decrement counter again before jumping out of - InterlockedDecrement loop so that subsequent InterlockedIncrement will - keep the counter at the correctly decremented value and also detect - when there are pending signals. - * sigproc.h: Remove __SIGCHILDSTOPPED element. - (procstuff): Remove PROC_CHILDSTOPPED element. +2002-02-27 Christopher Faylor <cgf@redhat.com> + + * include/cygwin/version.h: Bump DLL minor number. + +2002-02-23 Corinna Vinschen <corinna@vinschen.de> + + * cygwin.din (fstat64): New symbol. + (ftruncate64): Ditto. + (lseek64): Ditto. + (lstat64): Ditto. + (mmap64): Ditto. + (seekdir64): Ditto. + (stat64): Ditto. + (telldir64): Ditto. + (truncate64): Ditto. + * dir.cc (telldir64): New function. + (telldir): Call telldir64(). + (seekdir64): New function. + (seekdir): Call seekdir64(). + * fhandler.h: Redefine all methods using __off32_t to use __off64_t. + * fhandler.cc: Use __off64_t and struct __stat64 throughout. + * fhandler_clipboard.cc: Ditto. + * fhandler_disk_file.cc: Ditto. + * fhandler_dsp.cc: Ditto. + * fhandler_floppy.cc: Ditto. + * fhandler_mem.cc: Ditto. + * fhandler_random.cc: Ditto. + * fhandler_socket.cc: Ditto. + * fhandler_tape.cc: Ditto. + * fhandler_zero.cc: Ditto. + * pipe.cc: Ditto. + * glob.c: Ditto, call lstat64 and stat64 in Cygwin. + * mmap.cc: Use __off64_t throughout. + (mmap64): New function. + * sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64. + * syscalls.cc (lseek64): New function. + (stat64_to_stat32): Ditto. + (fstat64): Ditto. + (stat64): Ditto. + (lstat64): Ditto. + (ftruncate64): Ditto. + (truncate64): Ditto. + (_fstat): Call fstat64. + (_stat): Call stat64. + (cygwin_lstat): Rename to avoid declaration problem. Call lstat64. + (stat_worker): Use struct __stat64. + (access): Ditto. + (ftruncate): Call ftruncate64. + (truncate): Call truncate64. + * wincap.cc: Set flag has_64bit_file_access appropriately. + * wincap.h: Add flag has_64bit_file_access. + * winsup.h (ILLEGAL_SEEK): Define as __off64_t. + (stat_dev): Declare using struct __stat64. + (stat_worker): Ditto. + * include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin. + (struct __stat64): Ditto. + (struct stat): Revert definition with explicitly sized datatypes. + Eliminate sized field names. + * include/cygwin/types.h (blksize_t): New type. + (__blkcnt32_t): Ditto. + (__blkcnt64_t): Ditto. + (blkcnt_t): Ditto. + +2002-02-22 Christopher Faylor <cgf@redhat.com> + + * sync.h (new_muto): Just accept an argument which denotes the name of + the muto. Use this argument to construct static storage. + * cygheap.cc (cygheap_init): Reflect above change. + * exceptions.cc (events_init): Ditto. + * malloc.cc (malloc_init): Ditto. + * path.cc (cwdstuff::init): Ditto. + * cygheap.h (cwdstuff): Change name of lock element to make it less + generic. + * path.cc (cwdstuff::get_hash): Ditto. + (cwdstuff::get_initial): Ditto. + (cwdstuff::set): Ditto. + (cwdstuff::get): Ditto. + * sigproc.cc (proc_subproc): Ditto. -Sat Mar 10 15:22:44 2001 Christopher Faylor <cgf@cygnus.com> + * debug.cc (lock_debug): Change to method. Use method rather than + macro throughout. + + * tty.h (tty_min::kill_pgrp): Declare new method. + * fhandler_termios.cc (tty_min::kill_pgrp): New method. + (fhandler_termios::line_edit): Use new method for killing process. + * dcrt0.cc (do_exit): Ditto. + + * dtable.cc (dtable::get_debugger_info): New method for inheriting + dtable info from a debugger. + * tty.cc (tty_init): Attempt to grab file handle info from parent + debugger, if appropriate. + + # dtable.cc (dtable::stdio_init): Make this a method. + (dtable::init_std_file_from_handle): Don't set fd unless it's not open. + (dtable::build_fhandler_from_name): Move name setting to + dtable::build_fhandler. + (dtable::build_fhandler): Add win32 name parameter. + * dcrt0.cc (dll_crt0_1): Change to use dtable stdio_init. + * dtable.h (dtable): Reflect build_fhandler parameter change. + * mmap.cc (mmap_record::alloc_fh): Don't set name parameter in + build_fhandler. + * net.cc (fdsock): Remove set_name call since it is now handled by + build_fhandler. - * syscalls.cc (_rename): Set errno to ENOENT when an old path doesn't - exist (from Kazuhiro Fujieda <fujieda@jaist.ac.jp>). Also set EACCES - when directory is not writable. + * sigproc.cc (proc_subproc): Release muto as early as possible. -Wed Mar 7 15:49:47 2001 Christopher Faylor <cgf@cygnus.com> +2001-02-22 Corinna Vinschen <corinna@vinschen.de> - * syscalls.cc (_read): Change definition to return ssize_t to be - consistent with read. - (_write): Change definition to return ssize_t to be consistent with - write. + * smallprint.c (rn): Allow long long values. + (__small_vsprintf): Add 'D', 'U' and 'X' formats for long long + parameters. -Wed Mar 7 01:08:21 2001 Christopher Faylor <cgf@cygnus.com> +2002-02-19 Christopher Faylor <cgf@redhat.com> - * sigproc.h (sigthread): Declare new methods. Create new winapi_lock - field. - (sigframe:;set): Call get_winapi_lock after frame is set so that signal - handler thread knows not to call SuspendThread. - (sigframe::~sigframe): Release winapi_lock. - * exceptions.cc (sigthread::get_winapi_lock): New method. - (sigthread::release_winapi_lock): New method. - (setup_handler): Use get_winapi_lock to ensure that signalled thread is - not blocked in a Windows API. - - * path.h (path_types): Avoid broken GCC warning. - -Tue Mar 6 14:02:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * path.cc (suffix_scan::has): Change order of conditionals - to allow checking for .lnk suffixes even if in_suffixes is empty. - -Tue Mar 6 13:02:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * autoload.c (cygwin_premain0): Add missing parameter. - * binmode.c (cygwin_premain0): Ditto. - * textmode.c (cygwin_premain0): Ditto. - -Tue Mar 6 12:04:00 2001 Jason Tiller <jtiller@sjm.com> - - * auto_load.cc: Add "GetKeyboardLayout" entry in the list of - Win32 User32.DLL exports to provide. - * fhandler.h (class fhandler_console): Add meta_mask private - member to remember which keystroke modifiers should generate - META. - * fhandler_console.cc (fhandler_console::read): Modify code that - tests a keystroke for a META-escaped key to use the 'meta_mask' - variable. - (fhandler_console::fhandler_console): Add definition for - variable "meta_mask" used to determine if a keystroke should be - preceded by META in the client console stream. Set meta_mask - based on whether or not user's keyboard language is English - - non-English keyboards pass AltGr (right <ALT>) unmolested, - whereas English keyboards now interpret left- and right-<ALT> - as META. - -Mon Mar 5 20:15:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * include/a.out.h: Add copyright hint. - * include/fcntl.h: Ditto. - * include/lastlog.h: Ditto. - * include/memory.h: Ditto. - * include/mntent.h: Ditto. - * include/paths.h: Ditto. - * include/poll.h: Ditto. - * include/syslog.h: Ditto. - * include/termio.h: Ditto. - * include/tzfile.h: Ditto. - * include/arpa/inet.h: Ditto. - * include/asm/byteorder.h: Ditto. - * include/asm/socket.h: Ditto. - * include/asm/types.h: Ditto. - * include/cygwin/if.h: Ditto. - * include/cygwin/mtio.h: Ditto. - * include/cygwin/rdevio.h: Ditto. - * include/cygwin/socket.h: Ditto. - * include/net/if.h: Ditto. - * include/netinet/in.h: Ditto. - * include/netinet/in_systm.h: Ditto. - * include/netinet/ip.h: Ditto. - * include/netinet/ip_icmp.h: Ditto. - * include/netinet/tcp.h: Ditto. - * include/sys/cdefs.h: Ditto. - * include/sys/cygwin.h: Ditto. - * include/sys/ioctl.h: Ditto. - * include/sys/mman.h: Ditto. - * include/sys/mount.h: Ditto. - * include/sys/mtio.h: Ditto. - * include/sys/procfs.h: Ditto. - * include/sys/resource.h: Ditto. - * include/sys/smallprint.h: Ditto. - * include/sys/socket.h: Ditto. - * include/sys/strace.h: Ditto. - * include/sys/syslog.h: Ditto. - * include/sys/sysmacros.h: Ditto. - * include/sys/termio.h: Ditto. - * include/sys/termios.h: Ditto. - * include/sys/uio.h: Ditto. - * include/sys/un.h: Ditto. - * include/sys/utsname.h: Ditto. - * include/sys/vfs.h: Ditto. - * include/sys/wait.h: Ditto. - * regexp/regerror.c: Ditto. - * regexp/regexp.h: Ditto. - * regexp/regmagic.h: Ditto. - -Mon Mar 5 01:25:03 2001 Christopher Faylor <cgf@cygnus.com> - - * dlopen.c (dlopen): Return NULL when name is NULL (suggested by - chrisiasci@aol.com). - - * cygwin.din: Add a new, internally used export - - _check_for_executable. - * dcrt0.cc (dll_crt0_1): Set _check_for_executable for older binaries. - Pass user_data to premain functions. - * fhandler.cc (fhandler_disk_file::open): Only check for executable if - the linked program is interested in the executable bit. - (fhandler_disk_file::check_execable_p): Delete. - * fhandler.h (executable_states): New enumeration of various states of - executable bit caring. - (fhandler_base::set_execable_p): New method. - - * fhandler_termios.cc (fhandler_termios::line_edit): Flag when a signal - has been sent to the tty. Return -1 when this is so. - * fhandler_console.cc (fhandler_console::read): Return -1 when signal - sending character encountered. - - * path.cc (path_conv::check): Record when path refers to a disk device. - Move executable extension check here. - (check_sysfile): Accomodate new EXEC path states. - (has_suffix): Remove. - (next_suffix): Remove. - (class suffix_scan): New clas. - (suffix_scan::has): New method. - (suffix_scan:next): New method. - (symlink_info::check): Use suffix_scan method to control for scanning - for suffixes. - * path.h (path_conv::exec_state): New method. - * perprocess.h: Make "C" friendly. - * include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_S_IEXEC. - Bump CYGWIN_VERSION_API_MINOR. - * include/sys/cygwin.h: Change premain declarations. - - * winsup.h: Move __cplusplus test to after builtin defines. - -2001-03-04 Egor Duda <deo@logos-m.ru> - - * fhandler.h (class fhandler_tty_common): New mutex and event to - syncronize input on master tty with slave tty. - * fhandler_tty.cc (fhandler_pty_master::accept_input): Use them to - syncronize with slave. - * fhandler_tty.cc (fhandler_tty_slave::read): Use input mutex and - event to syncronize with master. Do not limit amount of data read - from master to vmin value. Interrupt on signal and return already - read data, if any. - * fhandler_tty.cc (fhandler_tty_slave::open): Handle input mutex and - event. - * fhandler_tty.cc (fhandler_tty_common::close): Ditto. - * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Ditto. - * fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Ditto. - * fhandler_tty.cc (fhandler_tty_common::dup): Ditto. - * tty.h (tty::open_input_mutex): New function. - * tty.cc (tty::common_init): Create input mutex and event. - -Fri Mar 2 13:32:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * dir.cc (readdir): Fix creating path in symlink check. - -Fri Mar 2 12:33:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * dir.cc (readdir): Fix shortcut==symlink condition. - * environ.cc: Add extern decl for `allow_winsymlinks'. - (struct parse_thing): Add entry for `[no]winsymlinks'. - * path.cc (symlink): Change to be able to create both, - symlink==shortcut and symlink==systemfile, dependent of - the setting of `allow_winsymlinks'. - * security.cc (cygwin_logon_user): Add debug output. - * shortcut.c: Add defines from path.h. - (has_exec_chars): Copy from path.h. - (check_shortcut): Check for executable file condition if not a - shortcut. - -Thu Mar 1 21:06:07 2001 Christopher Faylor <cgf@cygnus.com> - - * exceptions.cc (sig_handle_tty_stop): Ignore attempts to suspend a - process if started by non-cygwin parent. - -Thu Mar 1 20:48:11 2001 Christopher Faylor <cgf@cygnus.com> - - * select.cc (peek_console): Don't report read_ready on mouse events - unless we are looking for mouse events. - * fhandler.h (fhandler_console::mouse_aware): New method. - -Wed Feb 28 15:10:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * uinfo.cc: Eliminate `#include <wchar.h>'. - -2001-02-28 Egor Duda <deo@logos-m.ru> - - * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Determine - drive geometry or partition size to allow seeking from the end of - raw floppy device. Don't allow positioning past the end of media or - to offsets bigger then max off_t. - -2001-02-27 Egor Duda <deo@logos-m.ru> - - * fhandler.h (class fhandler_console): Make all variables that - describe "state" of console to be members of fhandler_console. - default_color is now the color which is set when console recieves - reset command. - * fhandler_console.cc (fhandler_console::fhandler_console): Turn - mouse handling and raw keyboard mode off by default. Initialize - state information. - * fhandler.cc (fhandler_console::set_raw_win32_keyboard_mode): New - function. - * fhandler_console.cc (fhandler_console::set_default_attr): New - function. Reset console attributes to default values. - * fhandler_console.cc (fhandler_console::open): Reset attributes. - * fhandler_console.cc (fhandler_console::get_win32_attr): New function. - Calculate win32-style console attribute based on terminal attributes. - * fhandler_console.cc (fhandler_console::set_cursor_maybe): Use - member variable. - * fhandler_console.cc (fhandler_console::read): If in raw-win32 - keyboard mode, encode win32 keyboard events in \033{x;y;z;t;u;wK - sequences. - * fhandler_console.cc (fhandler_console::dup): Copy all state - information to the dup()ed handle. - * fhandler_console.cc (fhandler_console::scroll_screen): Use current - fill-in attribute. - * fhandler_console.cc (fhandler_console::clear_screen): Ditto. - * fhandler_console.cc (fhandler_console::char_command): Check if we - saw '?' symbol by member variable. Set terminal attributes on \033[Xm - commands. \033[24m - turn off underline mode, \033[27m - turn off - reverse mode, \033[39m - restore default foreground color. - \033[49m - restore default background color. \033[2000h - turn on raw - keyboard mode, \033[2000l - turn off raw keyboard mode. - * fhandler_console.cc (fhandler_console::write): Set attribues to - default values on reset command. - -2001-02-26 Mike Simons <msimons@moria.simons-clan.com> - - * times.cc (settimeofday): Replace function stub with working code. - -Mon Feb 26 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * strace.cc (strace::vprntf): Move prntf functionality to this function - adding an va_list interface to strace. - (strace::printf): Calls strace::vprntf now. - (strace_printf): New function providing an extern "C" interface to - trace output. - * include/sys/strace.h: Make plain C clean. - (class strace): Add `vprntf' method. - -Mon Feb 26 0:10:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * shortcut.c: Remove #include <sys/strace.h>. - -Sun Feb 25 10:32:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * path.cc (symlink): Add a ".lnk" suffix regardless. Add a comment. - -Sun Feb 25 10:18:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * shortcut.c (check_shortcut): Change symlink condition. - -Fri Feb 23 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * mmap.cc (fhandler_disk_file::mmap): Use `addr' correctly. - * fhandler_mem.cc (fhandler_dev_mem::mmap): Ditto. - -Thu Feb 22 17:09:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * path.cc (symlink): Keep relative paths relative in the DOS - path inside of a shortcut. If that's impossible or the target - path is already absolute save an absolute path. - -Thu Feb 22 15:33:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * cygerrno.h: Revert previous patch. - * errno.cc: Ditto. - * dir.cc: Eliminate `dir_suffixes'. - (opendir): Remove usage of `dir_suffixes'. - (rmdir): Ditto. - * fhandler.cc (fhandler_disk_file::open): Remove usage of - `inner_suffixes'. - * path.cc: Rename `inner_suffixes' to `lnk_suffixes'. - (path_conv::check): Remove usage of `inner_suffixes'. - (symlink): Ditto. - (symlink_info::check): Handle checking for `.lnk' in path_conv - exclusively here. - (chdir): Remove usage of `dir_suffixes'. - * shortcut.c: Eliminate debug_printf lines. - (check_shortcut): Don't set error except on failing ReadFile. - * spawn.cc: Remove ".lnk" from `std_suffixes'. - * syscalls.cc (_unlink): Remove usage of `inner_suffixes'. - Remove ".lnk" from `stat_suffixes'. - (_rename): Add check for renaming a symlink to keep the ".lnk" - suffix after renaming. - -Thu Feb 22 13:38:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * shortcut.c: New file. Provides a C interface to reading of - Windows shortcuts to avoid compiler flag `-fvtable-thunks'. - * shortcut.h: Ditto. - * Makefile.in: Add shortcut.o to DLL_OFILES. - * cygerrno.h: Provide a C interface to `geterrno_from_win_error' for - using in shortcut.c. - * errno.cc (geterrno_from_win_error): Define as extern "C". - * path.cc (struct symlink_info): Remove methods `check_shortcut' and - `check_sysfile'. - (shortcut_header): Move to shortcut.c. - (shortcut_initalized): Ditto. - (create_shortcut_header): Ditto. - (cmp_shortcut_header): Ditto. - (symlink_info::check_shortcut): Ditto. Reorganize as a plain C function. - (symlink_info::check_sysfile): Redefine as a global function using the - same parameter list as `check_shortcut' for clearness. - (symlink_info::check): Change parameter list for calls to - `check_shortcut' and `check_sysfile'. - -Thu Feb 22 12:04:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * fhandler.cc (fhandler_disk_file::open): Use `inner_suffixes' when - resolving real_path. - * path.cc (symlink): Ditto for win32_topath. - -Wed Feb 21 22:41:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * Makefile.in: Add `-lshell32 -luuid' to link pass for new-cygwin1.dll. - * autoload.cc: Add LoadDLLinitfunc for ole32.dll. - Add LoadDLLfuncEx statements for CoInitialize@4, CoUninitialize@0 - and CoCreateInstance@20. - * dir.cc (dir_suffixes): New datastructure. - (readdir): Check for R/O *.lnk files to hide the suffix. - (opendir): Use `dir_suffixes' in path conversion. - (rmdir): Ditto. - * fhandler.cc (fhandler_disk_file::fstat): Add S_IFLNK flag - before calling `get_file_attribute'. Take FILE_ATTRIBUTE_READONLY - into account only if the file is no symlink. - * path.cc (inner_suffixes): New datastructure. - (SYMLINKATTR): Eliminated. - (path_conv::check): Use `inner_suffixes' on inner path components. - (shortcut_header): New global static variable. - (shortcut_initalized): Ditto. - (create_shortcut_header): New function. - (cmp_shortcut_header): Ditto. - (symlink): Create symlinks by creating windows shortcuts. Preserve - the old code. - (symlink_info::check_shortcut): New method. - (symlink_info::check_sysfile): Ditto. - (symlink_info::check): Check for shortcuts. Move code reading - old system attribute symlinks into symlink_info::check_sysfile(). - (chdir): Use `dir_suffixes' in path conversion. - * security.cc (get_file_attribute): Check for S_IFLNK flag. - Force 0777 permissions then. - * spawn.cc (std_suffixes): Add ".lnk" suffix. - * syscalls.cc (_unlink): Use `inner_suffixes' in path conversion. - Check for shortcut symlinks to eliminate R/O attribute before - calling DeleteFile(). - (stat_suffixes): Add ".lnk" suffix. - (stat_worker): Force 0777 permissions if file is a symlink. - -2001-02-21 Egor Duda <deo@logos-m.ru> - - * sigproc.cc (getsem): Make semaphore always non-inheritable. - -Mon Feb 19 22:25:53 2001 Christopher Faylor <cgf@cygnus.com> - - * dcrt0.cc (locale_init): Remove. - -2001-02-15 Kazuhiro Fujieda <fujieda@jaist.ac.jp> - - * cygwin.din: Export rand48 functions. - * thread.cc (MTinterface::Init): Remove the initialization of - `reent_data'. - * dcrt0.cc: Add the initalizer to the declaration of `reent_data'. - * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 35. - -2001-02-16 Egor Duda <deo@logos-m.ru> - - * signal.cc (signal): Prohibit setting handlers for SIGKILL and - SIGSTOP - * signal.cc (sigaction): Ditto - * syscalls.cc (_lseek): Return EINVAL on invalid input - -Wed Feb 14 14:54:40 2001 Christophe Iasci <chrisiasci@aol.com> - - * dlfcn.cc (dlopen): Do not call LoadLibrary with a NULL pointer, when - the library is not found - -2001-02-14 Egor Duda <deo@logos-m.ru> - - * fhandler_console.cc (fhandler_console::char_command): Ignore unknown - rendition codes in \033[xx;yym control sequences - -Fri Feb 9 23:19:01 2001 Christopher Faylor <cgf@cygnus.com> - - * fork.cc (fork_parent): Return EAGAIN when can't record pid. - * pinfo.h (pinfo::remember): Return value of call to proc_subproc. - * sigproc.cc (proc_subproc): Return error if can't record pid. - -Fri Feb 9 12:17:27 2001 Christopher Faylor <cgf@cygnus.com> + * fhandler.cc (fhandler_base::puts_readahead): Remove default parameter + setting. Newer gcc's complain about this. + (fhandler_base::set_readahead_valid): Ditto. + * fhandler_dsp.cc (Audio::open): Ditto. + (fhandler_dev_dsp::open): Ditto. - * syscalls.cc (mknod): Add valid parameters. +2002-02-19 Christopher Faylor <cgf@redhat.com> -Thu Feb 8 22:09:00 2001 Corinna Vinschen <corinna@vinschen.de> + * fork.cc (fork_parent): Use sec_user_nih to control process/thread + inheritance/permission. + * spawn.cc (spawn_guts): Ditto. + * security.cc (create_token): Initialize token so that it is not tested + for bogus value later. Use sec_user to control process/thread + creation. + * security.h (__sec_user): Rename declaration from sec_user. + (sec_user_nih): Declare here as inline function wrapper for __sec_user. + (sec_user): Ditto. + * sigproc.cc (czombies): Allocate a character array for zombies to + avoid constructor overhead + (extremely hackish, I know). + (cpchildren): Ditto. + (pchildren): New define. + (zombies): Ditto. + (getsem): Use sec_user_nih to control semaphore inheritance/permission. + +2002-02-16 Christopher Faylor <cgf@redhat.com> + + * times.cc (hires::prime): Restore thread priority on failure + condition. + + * uinfo.cc (uinfo_init): Use more robust method for determining if + process was invoked from a non-cygwin process. + + * sync.h (muto::init): Eliminate "inheritance" parameter. + (new_muto): Reflect removal of parameter. + * sync.cc (muto::init): Ditto. + * cygheap.cc (cygheap_init): Ditto. + * debug.cc (threadname_init): Ditto. + * exceptions.cc (events_init): Ditto. + * malloc.cc (malloc_init): Ditto. + * path.cc (cwdstuff::init): Ditto. + * sigproc.cc (sigproc_init): Ditto. + + * grp.cc (group_lock): Use different method for locking with static + member. + (read_etc_group): REALLY ensure that read lock mutex is released. + * passwd.cc (passwd_lock): Use different method for locking with static + member. + (read_etc_passwd): REALLY ensure that read lock mutex is released. + + * shared.cc (sec_user): Correct reversed inheritance test. + +2002-02-15 Christopher Faylor <cgf@redhat.com> + + * hires.h (hires::usecs): Rename from utime. Accept an argument. + * strace.cc (strace::microseconds): Use hires class for calculating + times. + * sync.h (new_muto): Use NO_COPY explicitly in declaration. + * times.cc (gettimeofday): Reflect change in usecs argument. + (hires::usecs): Ditto. Changed name from utime. + * winsup.h (NO_COPY): Add nocommon attribute to force setting aside + space for variable. + * regcomp.c (REQUIRE): Add a void cast to bypass a warning. + +2002-02-15 Christopher Faylor <cgf@redhat.com> + + * hires.h: New file. + * times.cc (gettimeofday): Use hires class for calculating current time. + (hires::prime): New method. + (hires::utime): Ditto. + +2002-02-14 Christopher Faylor <cgf@redhat.com> + + * include/sys/cygwin.h (cygwin_getinfo_types): New CW_STRACE_ACTIVE. + * external.cc (cygwin_internal): Handle CW_STRACE_ACTIVE. + +2002-02-14 Christopher Faylor <cgf@redhat.com> + + * exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to + asm. + * external.cc (cygwin_internal): Change CW_STRACE_ON to + CW_STRACE_TOGGLE. + * strace.cc (strace::hello): Toggle strace on and off. + * sync.cc (muto::init): Rename from constructor. + * sync.h (muto::new): Delete. + (muto::delete): Ditto. + (new_muto): Simplify. Use muto.init for nearly everything. + * uinfo.cc (uinfo_init): Avoid closing a NULL handle. + * include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to + CW_STRACE_TOGGLE. Delete CW_STRACE_OFF. + * include/sys/strace.h (strace): Add "inited" field. + +2001-02-12 Corinna Vinschen <corinna@vinschen.de> + + * include/cygwin/acl.h: Fix definition of aclent_t. + +2002-02-10 Christopher Faylor <cgf@redhat.com> + + * Makefile.in (DLL_OFILES): Consolidate object files. + +2002-02-10 Corinna Vinschen <corinna@vinschen.de> + + * child_info.h, cygheap.h, fhandler_clipboard.cc, fhandler_dsp.cc, + fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc, + fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc, + pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc, + security.h, thread.h, uinfo.cc, include/cygwin/acl.h: Fix copyright. + +2002-02-10 Corinna Vinschen <corinna@vinschen.de> + + * child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h, + fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc, + fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc, + fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc, + pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc, + security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h: + Change usage of uid_t to __uid16_t, gid_t to __gid16_t and + off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and + INVALID_SEEK instead casting -1 to the appropriate type. + * winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK. + * include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t + types. Don't declare acl functions when compiling Cygwin. + * include/cygwin/grp.h: Declare getgrgid() and getgrnam() with + correct types for internal usage. + +2002-02-10 Corinna Vinschen <corinna@vinschen.de> + + Patch suggested by Pierre A. Humblet <Pierre.Humblet@ieee.org>: + * uinfo.cc (internal_getlogin): Try evaluating user by SID even if + ntsec is off. + (uinfo_init): Set primary group even if ntsec is off. + +2002-02-09 Corinna Vinschen <corinna@vinschen.de> + + * include/cygwin/grp.h: New file. + * include/cygwin/stat.h: Ditto. + * include/cygwin/types.h: Add definitions for __off32_t, + __off64_t, off_t, __uid16_t, __uid32_t, uid_t, __gid16_t, + __gid32_t and gid_t. + * include/sys/cygwin.h: Use correct uid and gid types. - * mmap.cc (mmap): Check for reusing a mapping only on MAP_SHARED - and on MAP_PRIVATE|MAP_ANON in the special case of offset 0. +2002-02-09 Corinna Vinschen <corinna@vinschen.de> -Thu Feb 8 21:57:00 2001 Corinna Vinschen <corinna@vinschen.de> + * dtable.cc (dtable::dup2): Revert previous patch. + * fhandler.h: Ditto. + (fhandler_socket::recv): Define new method. + (fhandler_socket::send): Ditto. + * fhandler_socket.cc (fhandler_socket::recv): New method. + (fhandler_socket::send): Ditto. + (fhandler_socket::read): Call fhandler_socket::recv() now. + (fhandler_socket::write): Call fhandler_socket::send() now. + * net.cc (class wsock_event): Move definition to wsock_event.h. + (fdsock): Revert previous patch. + (cygwin_recv): Move implementation to fhandler_socket::recv(). + (cygwin_send): Move implementation to fhandler_socket::send(). + * wsock_event.h: New file. - * mmap.cc (class list): Add member `hash'. - (list::list): Initialize `hash'. - (list::get_list_by_fd): Use filepath hash value to get the correct - mapping list if it's not an anonymous mapping. - (map::add_list): Initialize `hash' with filepath hash value. - (mmap): Check for reusing a mapping only on MAP_SHARED. +2002-02-06 Alexander Gottwald <Alexander.Gottwald@s1999.tuchemnitz.de> -Wed Feb 7 18:47:36 2001 Christopher Faylor <cgf@cygnus.com> + * net.cc (get_2k_ifconf): Create interface entries for tokenring cards. - * signal.cc (killpg): Correct first argument. +2002-02-08 Corinna Vinschen <corinna@vinschen.de> -Wed Feb 7 22:22:00 2001 Corinna Vinschen <corinna@vinschen.de> + * dtable.cc (dtable::dup2): Store fd for fhandler_socket. + * fhandler.h (fhandler_base::set_fd): New virtual method. + (fhandler_base::get_fd): Ditto. + (fhandler_socket::set_fd): Ditto. + (fhandler_socket::get_fd): Ditto. + * fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead + of native Winsock recv. + (fhandler_socket::write): Call cygwin_send instead of native Winsock + send. + * net.cc (fdsock): Store fd in fhandler_socket. - * autoload.cc: Add LoadDLLinitfunc for iphlpapi.dll. - Add LoadDLLfuncEx statements for GetIfTable@12 and GetIpAddrTable@12. - * fhandler_socket.cc (fhandler_socket::ioctl): Move variable - definitions to the beginning of the function to allow better debugging. - Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. - * net.cc: Include iphlpapi.h. - (get_2k_ifconf): Rewritten. Uses IP Helper API now. - (get_nt_ifconf): Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC - and SIOCGIFMTU. - (get_95_ifconf): Ditto. Renamed from `get_9x_ifconf'. - (get_ifconf): Name loopback `lo' instead of `lo0' as in Linux. - Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU. - Call `get_95_ifconf' only on Windows 95, `get_nt_ifconf' only - on Windows NT < Service Pack 3, `get_2k_ifconf otherwise. - * include/asm/socket.h: Add defines for SIOCGIFHWADDR, SIOCGIFMETRIC - and SIOCGIFMTU. - * include/cygwin/if.h: Add `ifr_hwaddr', `ifr_metric' and `ifr_mtu'. - (struct ifreq): Add `ifru_hwaddr'. +2002-02-07 Corinna Vinschen <corinna@vinschen.de> -Tue Feb 6 15:04:00 2001 Corinna Vinschen <corinna@vinschen.de> + * net.cc (cygwin_getsockname): Fix handling of NULL sun_path. - * syscalls.cc (stat_worker): Add a check for the special case when - a process creates a file using mode 000 using ntsec. +2002-01-29 Corinna Vinschen <corinna@vinschen.de> -Mon Feb 5 17:00:00 2001 Corinna Vinschen <corinna@vinschen.de> + * net.cc (getdomainname): Fix registry key for 9x systems, too. - * fhandler.cc (fhandler_base::open): Always add GENERIC_READ access - when opening raw disk devices. - * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Implement bytewise - access. - * fhandler_raw.cc (fhandler_dev_raw::open): Always open raw disk device - binary. - (fhandler_dev_raw::raw_write): Don't drop read buffer content when - writing after read. +2002-01-29 Corinna Vinschen <corinna@vinschen.de> -Mon Feb 5 13:30:00 2001 Corinna Vinschen <corinna@vinschen.de> + * net.cc (getdomainname): Fix registry key for NT systems. - * mmap.cc (mmap_record::fixup_map): New method to duplicate - the memory protection in a just forked child. - (mmap): Realign gran_len to page boundary only on anonymous - mapping before saving in the mmap_record. - (munmap): Cleanup code. - (msync): Ditto. - (fixup_mmaps_after_fork): Ditto. Call mmap_record::fixup_map now. +2002-01-28 Christopher Faylor <cgf@redhat.com> -Thu Feb 1 23:08:29 2001 Christopher Faylor <cgf@cygnus.com> + * external.cc (cygwin_internal): Initialize various internal settings + if required to allow use of some things from user loaded DLL. + (CW_STRACE_ON): Add new feature. + (CW_CYGWIN_PID_TO_WINPID): Ditto. + * pinfo.cc (set_myself): Call "strace.hello" to initiate possible + strace session. + (pinfo::init): Guard against dereferencing uninitialized myself. + * sigproc.cc (wait_sig): Call strace.hello() when __SIGTRACE "signal" + received. + * strace.cc (strace::hello): New method. + * wincap.cc (wincapc::init): Avoid initializing if already initialized. + * wincap.h (wincapc::wincapc): New method. + * include/sys/cygwin.h: Add new CW_ enums. Kludge typedefs of + {g,u}id_t if required. + * strace.h (strace::hello): Declare new method. - * cygheap.cc (creturn): Correctly calculate cygheap_max. +2002-01-28 Earnie Boyd <earnie@users.sf.net> -Wed Jan 31 10:04:58 2001 Christopher Faylor <cgf@cygnus.com> + * include/sys/strace.h (_STRACE_ON): Define. + (_STRACE_OFF): Ditto. - * shared.cc (shared_info::initialize): Reduce size of heap. +2002-01-24 Christopher Faylor <cgf@redhat.com> -Wed Jan 31 13:22:00 2001 Corinna Vinschen <corinna@vinschen.de> + * speclib: Ensure that temporary def file is removed. - * include/sys/resource.h: Fix typo. +2002-01-23 Christopher Faylor <cgf@redhat.com> -Wed Jan 31 13:20:00 2001 Corinna Vinschen <corinna@vinschen.de> + * speclib: Use rm -f to remove temp file just to quiet any potential + warnings. - * include/sys/resource.h: Add RLIMIT_NLIMITS and RLIM_NLIMITS. +2002-01-23 Corinna Vinschen <corinna@vinschen.de> -Tue Jan 30 18:15:23 2001 Christopher Faylor <cgf@cygnus.com> + * security.cc (create_token): Use sec_user() to create + SECURITY_ATTRIBUTES structure for primary token. Use + MAXIMUM_ALLOWED access rights instead of TOKEN_ALL_ACCESS. - * include/cygwin/version.h: Bump version to 1.3.0. +2002-01-23 Corinna Vinschen <corinna@vinschen.de> -Tue Jan 30 8:55:00 2001 Corinna Vinschen <corinna@vinschen.de> + * path.cc (symlink): Fix check for already existing file. - * pinfo.cc (pinfo::init): Use INVALID_HANDLE_VALUE instead of - explicit cast (HANDLE) 0xffffffff. - * shared.cc (open_shared): Ditto. +2002-01-21 Christopher Faylor <cgf@redhat.com> -Mon Jan 29 17:15:22 2001 Bill Hegardt <bill@troyxcd.com> - - * fhandler_serial.cc (raw_write): Use local copy of OVERLAPPED - structure instead of shared structure to fix a race condition between - read/write. + * cygmagic: Suppress error output when figuring out if sum takes an + option. -Mon Jan 29 14:30:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-21 Christopher Faylor <cgf@redhat.com> - * mmap.cc (mmap): Remove obsolete check for MAP_SHARED|MAP_ANON as - being invalid. + * cygmagic: Attempt to figure out if sum takes an option. -Mon Jan 29 10:23:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-21 DJ Delorie <dj@redhat.com> - * mmap.cc (mmap_record::find_empty): Fix loop condition. + * Makefile.in (libpthread.a): Pass the assembler also. + (libm.a): Ditto. + (libc.a): Ditto. + * speclib: Specify the assembler to dlltool. -Sun Jan 28 19:40:40 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-21 Christopher Faylor <cgf@redhat.com> - * syscalls.cc (_link): Make sure that newpath does not exist. Set - errno if it does. + * include/cygwin/version.h: Bump DLL minor number. -Sun Jan 28 19:29:08 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-21 Corinna Vinschen <corinna@vinschen.de> - * cygheap.cc (init_cheap): Don't specify a load address for the heap. - It doesn't work on #!*& Windows 9x. - (cygheap_init): Move GetUserName to memory_init. - * dcrt0.cc (dll_crt0_1): Call new memory_init functin, eliminate call - to heap_init. - * heap.cc (heap_init): Improve error output. - * heap.h: Correct some declarations. - * shared.cc (mount_table_init): Remove. - (memory_init): Renamed from shared_init. Reorganize to accomodate - strange Windows 9x problems with cygheap/heap interaction. - * shared_info.h: Rename shared_init to memory_init. + * grp.cc (getgrgid): Don't return default gid entry when ntsec is on. + * syscalls.cc (setegid): Don't set primary group in process token. -Sun Jan 28 01:25:33 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-21 Christopher Faylor <cgf@redhat.com> - * include/cygwin/version.h: Bump API version. + * speclib: Don't use /dev/null as DLL name. Just default to what's + already in .def file. -Sun Jan 28 01:18:22 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-21 Christopher Faylor <cgf@redhat.com> - * cygheap.cc (init_cheap): Move username initialization. - (cygheap_init): Here. - * shared_info.h (mount_info): Add a sys_mount_table_counter field. - (shared_info): Ditto. - * path.cc (mount_info::conv_to_win32_path): Check that our mount table - is in sync with the system mount table and reinitialize it if not. - (mount_info::add_reg_mount): Bump sys_mount_table counters if the - system mount table changes. - (mount_info::del_reg_mount): Ditto. - (mount_info::write_cygdrive_info_to_registry): Ditto. - (mount_info::remove_cygdrive_info_from_registry): Ditto. + * exceptions.cc (sig_handle): Remove last vestiges of SA_NOCLDSTOP code + which caused SIGCHLD to be ignored. -Sun Jan 28 00:28:30 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-20 Christopher Faylor <cgf@redhat.com> - Throughout, change 'cygwin_shared.mount' to 'mount_table'. - * child_info.h (child_info): Move shared_h, console_h to cygheap. Add - mount_h. - * cygheap.h (init_cygheap): Add shared_h, console_h. - * cygheap.cc (init_cheap): Initialize heap at a fixed location after - the shared memory regions. Initialize cygheap->user name here. - * dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants. - Remove cygheap_init since it is done in shared_init now. - (_dll_crt0): Initialize mount_h, remove shared_h and console_h - initialization. - * fhandler_console.cc (console_shared_h): Eliminate. - (get_tty_stuff): Use cygheap->console_h rather than console_shared_h. - * heap.cc (heap_init): Use page size constant calculated earlier in - initialization. - * shared.cc: Eliminate cygwin_shared_h. Add cygwin_mount_h. - (mount_table_init): New function for initializing a user mount table. - (open_shared_file_map): Use constant for shared memory region. - Initialize cygheap and mount table here. - (open_shared): Improve debugging output. - (shared_info::initialize): Eliminate call to mount.init. - (shared_terminate): Use cygheap->shared_h. Close cygwin_mount_h. - (open_shared_file_map): Eliminate. - * shared_info.h (mount_info): Add a version field. - (shared_align_past): New macro for calculating location for shared - memory regions. - * sigproc.cc (init_child_info): Eliminate shared_h, console_h. - * spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different - user. - * syscalls.cc (system_info): New global holding system memory defaults. - (getpagesize): Use system_info. - * uinfo.cc (internal_getlogin): Only fill in user name if nonexistent. - * winsup.h: Declare system_info. + * include/cygwin/version.h: Bump DLL minor number. - * passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than - retrieving the name again. +2002-01-20 Christopher Faylor <cgf@redhat.com> -Sat Jan 27 10:18:02 2001 Christopher Faylor <cgf@cygnus.com> + * syscalls.cc (regfree): Make dll_export. - * path.cc (path_conv::check): Detect when path has symlinks. - (symlink_info::check): Remove debugging stuff. - (chdir): Use posix'ized win32 path if cd'ed to a path using symlinks. +2002-01-20 Christopher Faylor <cgf@redhat.com> -Fri Jan 26 21:20:28 2001 Christopher Faylor <cgf@cygnus.com> + * exceptions.cc (ctrl_c_handler): Convert windows pid to cygwin pid + when detecting if we should actually handle CTRL-C. - * exceptions.cc (sigreturn): Call any pending signals prior to - resetting the signal mask so that stacked signals behave correctly. - (sigdelayed): Avoid a race where a signal could end up calling an - incorrect signal handler if two signals come in close together. +2002-01-19 Christopher Faylor <cgf@redhat.com> -Tue Jan 23 21:56:00 2001 Corinna Vinschen <corinna@vinschen.de> + * Makefile.in (new-cygwin1.dll): Revert previous change. libsupc++.a + is only available in libstdc++-v3. - * mmap.cc (fhandler_disk_file::mmap): Call CreateFileMapping with - len != 0 only when performing an anonymous mapping. +2002-01-19 Christopher Faylor <cgf@redhat.com> -Mon Jan 22 15:35:28 2001 Christopher Faylor <cgf@cygnus.com> + * exceptions.cc (sig_handle_tty_stop): Don't send SIGCHLD if parent + doesn't want it. + (sig_handle): Don't check for SA_NOCLDSTOP here. We don't have enough + information. - * path.h: Add a new constant. - * syscalls.cc (_read): Oscillate errno check. +2002-01-19 Christopher Faylor <cgf@redhat.com> -Mon Jan 22 15:27:12 2001 Christopher Faylor <cgf@cygnus.com> + * include/cygwin/version.h: Bump DLL minor number. - * include/cygwin/version.h: Bump API to reflect setlogmask. +2002-01-19 Christopher Faylor <cgf@redhat.com> -Sun Jan 21 22:40:25 2001 Jason Tishler <jt@dothill.com> + * Makefile.in (new-cygwin1.dll): Just use -lsupc++ for link. + * sigproc.cc (proc_exists): Change existence criteria. + * sync.h (new_muto): Add volatile to definition to avoid gcc + optimization problems. - * cygwin.din: Add export for setlogmask(). - * syslog.cc (setlogmask): New function. - -Thu Jan 18 10:27:00 2001 Corinna Vinschen <corinna@vinschen.de> - - * resource.cc (setrlimit): Support RLIMIT_NOFILE. - -Wed Jan 17 23:23:12 2001 Christopher Faylor <cgf@cygnus.com> - - * syscalls.cc (setdtablesize): Call with amount to increment not total - amount. Return success or failure error code. +2002-01-19 Corinna Vinschen <corinna@vinschen.de> -Wed Jan 17 09:47:13 2001 Christopher Faylor <cgf@cygnus.com> + * include/cygwin/version.h: Bump API minor version to 51. - * autoload.cc (LoadDLLinitfunc): Remove debugging statement. - - * exceptions.cc (sig_handle_tty_stop): Move setting of PID_STOPPED to - earlier in interrupt. - (interrupt_setup): i.e., here. - (sig_handle): Don't queue multiple SIGSTOPS. - * fhandler.h (bg_check_types): Enumerate return value of bg_check for - clarity. - * signal.cc (kill_pgrp): Minor cleanup. - * fhandler_termios.cc (fhandler_termios::bg_check): Use enumerated type - for function return. Don't raise signal if a signal is already queued. - * fhandler_console.cc (fhandler_console::read): Use enumerated return - type for bg_check. - * select.cc: Ditto, throughout. - * read.cc: Ditto, throughout. - * termios.cc: Ditto, throughout. - (_read): YA interrupt detect simplification. - * wait.cc (wait4): Ditto. +2002-01-19 Mark Bradshaw <bradshaw@staff.crosswalk.com> -Wed Jan 17 10:56:00 2001 Corinna Vinschen <corinna@vinschen.de> + * cygwin.din: Add recvmsg and sendmsg. + * net.cc: Add cygwin_recvmsg and cygwin_sendmsg. + * /usr/include/sys/socket.h: Add recvmsg and sendmsg. - * cygheap.cc (cygheap_user::~cygheap_user): Temporarily - disable free'ing memory. - -Tue Jan 16 18:01:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-19 Corinna Vinschen <corinna@vinschen.de> - * mmap.cc (mmap): Initialize fh to avoid compiler warnings. + * security.cc (create_token): Close processes token handle as soon + as it's not used anymore. -Mon Jan 15 21:07:00 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-17 Corinna Vinschen <corinna@vinschen.de> - * wait.cc (wait4): Rename variable for consistency. Allow restartable - signal behavior. + * Makefile.in: Add fnmatch.o to DLL_OFILES. + * cygwin.din: Add fnmatch export symbol. + * fnmatch.c: New file. + * include/fnmatch.h: Ditto. + * include/cygwin/version.h: Bump API minor version to 50. -Mon Jan 15 23:15:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-15 Corinna Vinschen <corinna@vinschen.de> - * mmap.cc (mmap): Add more parameter checking. Change error output - in case of EINVAL. Treat mmapping /dev/zero like MAP_ANONYMOUS. + * path.cc (fchdir): Call chdir with full windows path. -Mon Jan 15 20:34:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-14 Corinna Vinschen <corinna@vinschen.de> - * mmap.cc: include <unistd.h>. Define some bit operations for - the new page map. - (mmap_record): Change type of base_address_ to caddr_t. - Add map_map_ member. Add several methods to manipulate map_map_. - (mmap_record::alloc_map): New method. - (mmap_record::free_map): Ditto. - (mmap_record::find_empty): Ditto. - (mmap_record::map_map): Ditto. - (mmap_record::unmap_map): Ditto. - (list::add_record): Change return type to `mmap_record *'. - Allocate page map. - (list::match): New method. - (mmap): Partly rewritten to take care for the new page map. Add some - parameter checking. - (munmap): Ditto. + * dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1" + for file attributes throughout. + * fhandler.cc: Ditto. + * fhandler_disk_file.cc: Ditto. + * path.cc: Ditto. + * path.h: Ditto. + * syscalls.cc: Ditto. + * times.cc (utimes): Use path_conv::isdir() instead of explicit + GetFileAttributes() call. -Mon Jan 15 13:50:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-13 Christopher Faylor <cgf@redhat.com> - * heap.cc (heap_init): Fix extern declaration of getpagesize. - * syscalls.cc (getpagesize): Fix another typo. + * dcrt0.cc (multiple_cygwin_problem): Clarify logic and make + CYGWIN_MISMATCH_OK more powerful. -Mon Jan 15 12:48:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-10 Christopher Faylor <cgf@redhat.com> - * syscalls.cc (getpagesize): Save pagesize in global variable to - avoid calling GetSystemInfo too often. - * heap.cc (getpagesize): Eliminate. - (heap_init): Use getpagesize function from syscalls.cc. + * exceptions.cc (sig_handle): Accept a second argument indicating + whether the signal came from this process or not. + * sigproc.h: Reflect sig_handle arg change. + * signal.cc (kill_pgrp): Add sigframe info. + (abort): New function. Eliminates newlib function of same name. + * sigproc.cc (wait_sig): Pass "signal from this process" value as arg + 2. -Mon Jan 15 11:56:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-10 Corinna Vinschen <corinna@vinschen.de> - * sysconf.cc (sysconf): return `getpagesize ()' on _SC_PAGESIZE - request to avoid implementing the same twice. + * syscalls.cc (pathconf): Guard _PC_PATH_MAX branch against invalid + file parameter. -Sun Jan 14 14:07:50 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-09 Christopher Faylor <cgf@redhat.com> + Robert Collins <rbtcollins@hotmail.com> - * syscalls.cc (_read): Use more lightweight method for determining if - read has been interrupted by a signal. + * exceptions.cc (early_stuff_init): Rename from misnamed + set_console_handler. + (ctrl_c_handler): Attempt to work around potential signal duplication + during process startup. + (sig_handle): Ignore SIGINT when we're just an "exec stub". + * spawn.cc (spawn_guts): Store pid of spawned process in global for use + by ctrl_c_handler. + * dcrt0.cc (dll_crt0_1): Call renamed initialization function. + * winsup.h: Reflect function name change. -Fri Jan 12 00:35:15 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-08 Corinna Vinschen <corinna@vinschen.de> - * debug.h: Add regparm attributes to some functions. + * net.cc (cygwin_accept): Set sun_path for newly connected socket. - * signal.cc (sigaction): Don't treat SIGCONT specially. +2002-01-07 Ralf Habacker <Ralf.Habacker@freenet.de> - * exceptions.cc (interrupt_setup): Save sa_flags of interrupted signal - for later use. - (sig_handler): Default any stopping signal to SIGSTOP. - (call_signal_handler): New function. - (sigdelayed0): New function. - * sigproc.cc (sigproc_init): Initialize SIGSTOP sigaction for special - behavior. - * sigproc.h: Define call_signal_handler. - * syscalls.cc (_read): Allow restartable signal behavior. + * Makefile.in: Add uninstall target. -Thu Jan 11 13:17:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-07 Christopher Faylor <cgf@redhat.com> - * fhandler.h (fhandler_base): New method `fixup_mmap_after_fork'. - (fhandler_disk_file: Ditto. - (fhandler_dev_mem): Ditto. - * fhandler_mem.cc (fhandler_dev_mem::open): Set OBJ_INHERIT attribute - for device\physicalmemory handle. - (fhandler_dev_mem::mmap): Ditto. - * fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork): New - method. - * mmap.cc (mmap_record): Add private `fdesc_' member. Change - constructor accordingly. - (get_fd): New method. - (mmap): Use new mmap_record constructor. - (fhandler_base::fixup_mmap_after_fork): New method. - (fhandler_disk_file::fixup_mmap_after_fork): Ditto. - (fixup_mmaps_after_fork): Call `fixup_mmap_after_fork' of appropriate - fhandler class. + * sigproc.cc (getsem): Clean up debugging output. -Wed Jan 10 22:08:30 2001 Kazuhiro Fujieda <fujieda@jaist.ac.jp> +2002-01-07 Christopher Faylor <cgf@redhat.com> - * sigproc.cc (wait_sig): Allow SIGCONT when stopped. + * sigproc.cc (getsem): Set errno when unable to create own semaphore. + Reorganize to make clearer that error should only come from initial + creation of process semaphore. -Tue Jan 9 16:55:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-06 Christopher Faylor <cgf@redhat.com> - Patch suggested by René Møller Fonseca <fonseca@mip.sdu.dk> - * include/sys/socket.h: Change prototype to have 2nd parameter `const'. - * net.cc (cygwin_bind): Change 2nd parameter to `const'. + * dtable.cc (dtable::init_std_file_from_handle): Add some defensive + code to invalid handle case. -Sun Jan 7 22:59:37 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-06 Corinna Vinschen <corinna@vinschen.de> - * pinfo.cc (codepage_init): Move function. - * environ.cc (codepage_init): To here. - * exceptoins.cc (SIG_NONMASKABLE): Remove SIGCONT from consideration - since it is supposed to be maskable. - * signal.cc (sigaction): Ditto. - * sigproc.cc (wait_sig): Ditto. - * winsup.h: Eliminate global declaration of codepage_init. + * ioctl.cc (ioctl): Make third argument optional. + * include/sys/ioctl.h: Ditto in declaration. + * dtable.cc (dtable::init_std_file_from_handle): Revert previous + bogus patch. + * window.cc (WndProc): Raise SIGURG instead of SIGIO in case of FD_OOB + message. -Thu Jan 5 9:33:00 2001 Corinna Vinschen <corinna@vinschen.de> +2002-01-05 Christopher Faylor <cgf@redhat.com> - * resource.cc (getrlimit): Set errno on EFAULT instead of returning - it. - (setrlimit): Ditto. + * dir.cc (opendir): Guarantee release of alloced fhandler structure on + error. -Thu Jan 5 3:38:00 2001 David Sainty <David.Sainty@optimation.co.nz> +2002-01-05 Corinna Vinschen <corinna@vinschen.de> - * resource.cc (setrlimit): Prevent failing with an error when the - operation would not have changed anything. + * exceptions.cc (sig_handle): Set default action for SIGURG to SIG_IGN. -Thu Jan 4 10:29:54 2001 Earnie Boyd <earnie_boyd@yahoo.com> +2002-01-05 Corinna Vinschen <corinna@vinschen.de> - * thread.cc: Need LONG_MAX definition. + * dtable.cc (dtable::init_std_file_from_handle): Don't treat NULL + handle as errorneous. -Wed Jan 3 13:47:23 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-04 Christopher Faylor <cgf@redhat.com> - * thread.cc (MTinterface::CreateSemaphore): Correctly set semaphore - max. + * cygmagic: Change logic for equality test. -Wed Jan 3 09:44:51 2001 Christopher Faylor <cgf@cygnus.com> +2002-01-04 Christopher Faylor <cgf@redhat.com> - * fhandler_console.cc (fhandler_console::read): Restore missing test - for code page before doing OemToCharBuff. + * dir.cc (opendir): Don't attempt to call sub-opendir if ENOENT. -Wed Jan 3 09:20:20 2001 Jason Tishler <jt@dothill.com> +2002-01-04 Corinna Vinschen <corinna@vinschen.de> - * include/cygwin/version.h: Fix typo in CYGWIN_VERSION_DLL_COMBINED - macro. + * net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCAL + throughout. + (socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types + in families AF_UNIX and AF_LOCAL. Explicitly allow PF_UNSPEC, PF_LOCAL + and PF_INET protocols. Return error otherwise. Implement datagram + socketpairs. + +2002-01-01 Christopher Faylor <cgf@redhat.com> + + * speclib: Remove temp files automatically. + +2002-01-01 Corinna Vinschen <corinna@vinschen.de> + * fhandler.h (fhandler_socket::sun_path): New private member. + (fhandler_socket::set_sun_path): New method. + (fhandler_socket::get_sun_path): Ditto. + * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize + sun_path to NULL. + (fhandler_socket::~fhandler_socket): Free sun_path if needed. + (fhandler_socket::set_sun_path): New method. + * net.cc (cygwin_bind): Set sun_path to path of local socket file. + (cygwin_getsockname): Add code to return correct sockaddr for unix + domain sockets. |