deadlocks.
(class locked_process): Move to another header.
* sync.h (lock_process): Define here.
* cygtls.cc (_cygtls::fixup_after_fork): Reset spinning state as well as
stacklock state.
* dcrt0.cc (lock_process::locker): Define.
(dtable::lock_cs): Delete.
* dtable.cc (dtable_init): Eliminate call to init_lock().
(dtable::fixup_after_fork): Ditto.
(dtable::init_lock): Delete definition.
* dtable.h (dtable::init_lock): Delete declaration.
(dtable::lock): Use process lock rather than dtable-specific lock.
(dtable::unlock): Ditto.
* sigproc.cc (sigproc_init): Minor change to debugging output.
* times.cc (utime_worker): Use build_fh_pc rather than reinterpreting the posix
path name again. Return any error from path_conv immediately.
(lutimes): Export.
* times.cc (utimes_worker): Created from utimes, add nofollow flag
to implement utimes and lutimes.
(utimes): Just call utimes_worker.
(lutimes): New function.
(futimes): Ditto.
* include/cygwin/version.h: Bump API minor version.
cygthread to handle extra argument, throughout.
* cygthread.h (cygthread::callproc): Declare new method.
(cygthread::cygthread): Add optional length argument to allow copying arguments
to executing thread.
* cygthread.cc (cygthread::callproc): Define new method.
(cygthread::stub): Use callfunc to invoke thread func to allow potentially
allocating stack memory which will be returned.
(cygthread::simplestub): Ditto.
(cygthread::cygthread): Accept arglen argument. Reset ev here prior to
activating thread. Wait for ev after activating thread if we're copying
contents to the thread. Wait until the end before setting h, to allow thread
synchronization.
(cygthread::release): Don't reset ev here. Rely on that happening the next
time the thread is activated.
* pinfo.h (commune_process): Rename declaration from _pinfo::commune_process.
* pinfo.cc (commune_process): Ditto for definition. Modify slightly to allow
running as a separate cygthread.
* sigproc.cc (child_info::sync): Always wait for both subproc_ready and any
hProcess if we have a cygwin parent.
(talktome): Change argument to be a pointer to siginfo_t. Contiguously
allocate whole siginfo_t structure + any needed extra for eventual passing to
commune_process thread.
(wait_sig): Accommodate change in talktome argument.
* pipe.cc (fhandler_pipe::fixup_after_exec): Remove debugging.
from ws2_32. Rearrange symbol order accordingly. None of the ws2_32
functions is optional right now.
(wsadata): Move from net.cc here. Define NO_COPY.
(wsock_init): Drop unused symbols ws2_32_handle and wsock32_handle.
(load_wsock32): Remove.
(WSACleanup): Remove.
* fhandler_socket.cc: Drop Winsock 1 accommodations throughout.
(fhandler_socket::readv): Accomodate new POSIX style struct msghdr.
(fhandler_socket::writev): Ditto.
(fhandler_socket::recvmsg): Ditto. Handle "old" applications using
former struct msghdr correctly.
* net.cc: Drop Winsock 1 accommodations throughout.
(wsadata): Move definition to autoload.cc.
(set_socket_inheritance): Remove.
(convert_ws1_ip_optname): New static function to convert Winsock1
IPPROTO_IP option values into Winsock2 IPPROTO_IP option values.
(cygwin_setsockopt): Remove wrong and incomplete cleartext printing
of optname. For "old" applications, convert optname from Winsock1
to Winsock2 values before using them. Add comment to describe the
IP_TOS weirdness on W2K and above.
(cygwin_getsockopt): Remove wrong and incomplete cleartext printing
of optname. For "old" applications, convert optname from Winsock1
to Winsock2 values before using them.
* select.cc (start_thread_socket): Forget about winsock2_active.
* winsup.h (wsock32_handle): Remove declaration.
(ws2_32_handle): Ditto.
(netapi32_handle): Ditto.
(wsadata): Ditto.
(winsock2_active): Remove definition.
* include/cygwin/socket.h: Change formatting slightly.
(socklen_t): Move definition up in file.
(struct msghdr): Convert to POSIX style.
(struct cmsghdr): New type.
(CMSG_ALIGN): New macro.
(CMSG_LEN): Ditto.
(CMSG_SPACE): Ditto.
(CMSG_FIRSTHDR): Ditto.
(CMSG_NXTHDR): Ditto.
(CMSG_DATA): Ditto.
(SCM_RIGHTS): Ditto.
(struct OLD_msghdr): Define old msghdr structure for Cygwin internal
purposes.
(MSG_TRUNC): New macro.
(MSG_CTRUNC): Ditto.
(IP_OPTIONS): Redefine IPPROTO_IP option values to Winsock2 values.
Keep Winsock1 values for Cygwin internal purposes.
* include/cygwin/version.h: Bump API minor version.
(CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR): Define to check for
applications using old struct msghdr.
(CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES): Define to check for
applications using old Winsock1 IPPROTO_IP values.
to add the priority to the message in a syslog conformant way.
(vsyslog): If facility isn't set in the priority, use default facility
as given in call to openlog. Fix agressive use of spaces in syslog
output. Call try_connect_syslogd with priority parameter.
* dtable.h (class dtable): Add class process_lock as a friend.
* dcrt0.cc (get_exit_lock): Delete.
(do_exit): Use process_lock class instead of get_exit_lock.
* exceptions.cc (signal_exit): Ditto.
* pinfo.cc (pinfo::exit): Ditto.
(_pinfo::commune_process): Set process lock around this whole function.
(_pinfo::commune_request): Use process_lock rather than myself.lock.
* pinfo.h (pinfo::_lock): Delete.
(pinfo::initialize_lock): Delete.
(pinfo::lock): Delete.
(pinfo::unlock): Delete.
* winsup.h (get_exit_lock): Delete declaration.
instead.
(get_exit_lock): New function. Grabs the lock and sets initial exit_state.
* exceptions.cc (try_to_debug): Use low_priority_sleep.
(sigpacket::process): Avoid handler if this is an exec stub.
(signal_exit): Use get_exit_lock rather than manipulating the exit_lock
critical section directly.
* pinfo.cc (pinfo::exit): Ditto.
* winsup.h (get_exit_lock): Declare.
(exit_lock): Delete declaration.
commune_send to commune_request throughout.
* pinfo.h (PICOM_EXTRASTR): New flag.
(PICOM_FIFO): Define with new flag.
(_pinfo::hello_pid): Delete.
(_pinfo::tothem): Delete.
(_pinfo::fromthem): Delete.
(_pinfo::commune_process): Rename from commune_recv. Add a siginfo_t argument
to declaration.
(_pinfo::commune_request): Rename from commune_send. Change DWORD to
__uint32_t in declaration.
* pinfo.cc (_pinfo::commune_process): Rename from commune_recv. Add siginfo_t
argument. Use information from argument rather than reading from another pipe.
Synchronize with other process's commune event.
(_pinfo::commune_request): Rename from commune_send. Change DWORD to __uint32
in argument. Fill out information in new siginfo_t element and rely on
extended operation of sig_send rather than trying to deal with synchronization
issues here. Use process handle and read pipe information filled out by
sig_send to gather information from the other process.
* sigproc.cc (sig_send): Take special action if "communing" to ensure
synchronization with the other process and to return information about the
other process to the caller.
(talktome): Accept a siginfo_t and handle arguments. Read additional
information from the signal pipe when _si_commune._si_code has the
PICOM_EXTRASTR flag set.
(wait_sig): Pass the transmitted siginfo_t struct and the pipe handle to
talktome. Close pipe read handle as soon as possible after we detect that
we're exiting.
eof_detected status flag. Delete is_eom and is_eof methods.
Move drive_size, bytes_per_sector, eom_detected status flag, as well
as the methods read_file, write_file, raw_read and raw_write to ...
(class fhandler_dev_floppy): ... here. Remove is_eom and is_eof
methods. Add dup method.
* fhandler_floppy.cc (IS_EOM): New macro.
(fhandler_dev_floppy::is_eom): Remove.
(fhandler_dev_floppy::is_eof): Remove.
(fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags.
(fhandler_dev_floppy::get_drive_info): Only call EX functions on
systems supporting them and stop suffering strange delays.
(fhandler_dev_floppy::read_file): Move here, drop setting
current_position.
(fhandler_dev_floppy::write_file): Move here, drop setting
current_position.
(fhandler_dev_floppy::open): Rearrange comment.
(fhandler_dev_floppy::dup): New method.
(fhandler_dev_floppy::get_current_position): New inline method. Use
instead of former current_position were appropriate.
(fhandler_dev_floppy::raw_read): Move here. Drop EOF handling.
(fhandler_dev_floppy::raw_write): Move here. Drop EOF handling.
(fhandler_dev_floppy::lseek): Remove useless conditions. Convert
sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call.
(fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case
to here.
* fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove.
(fhandler_dev_raw::is_eof): Remove.
(fhandler_dev_raw::write_file): Remove.
(fhandler_dev_raw::read_file): Remove.
(fhandler_dev_raw::raw_read): Remove.
(fhandler_dev_raw::raw_write): Remove.
(fhandler_dev_raw::dup): Drop copying removed members.
(fhandler_dev_raw::ioctl): Drop blocksize testing.
* wincap.h: Implement has_disk_ex_ioctls throughout.
* wincap.cc: Ditto.
(wincap_vista): Preliminary wincaps for Windows Vista/Longhorn.
(wincapc::init): Add Vista/Longhorn handling.
eof_detected status flag. Delete is_eom and is_eof methods.
Move drive_size, bytes_per_sector, eom_detected status flag, as well
as the methods read_file, write_file, raw_read and raw_write to ...
(class fhandler_dev_floppy): ... here. Remove is_eom and is_eof
methods. Add dup method.
* fhandler_floppy.cc (IS_EOM): New macro.
(fhandler_dev_floppy::is_eom): Remove.
(fhandler_dev_floppy::is_eof): Remove.
(fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags.
(fhandler_dev_floppy::get_drive_info): Only call EX functions on
systems supporting them and stop suffering strange delays.
(fhandler_dev_floppy::read_file): Move here, drop setting
current_position.
(fhandler_dev_floppy::write_file): Move here, drop setting
current_position.
(fhandler_dev_floppy::open): Rearrange comment.
(fhandler_dev_floppy::dup): New method.
(fhandler_dev_floppy::get_current_position): New inline method. Use
instead of former current_position were appropriate.
(fhandler_dev_floppy::raw_read): Move here. Drop EOF handling.
(fhandler_dev_floppy::raw_write): Move here. Drop EOF handling.
(fhandler_dev_floppy::lseek): Remove useless conditions. Convert
sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call.
(fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case
to here.
* fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove.
(fhandler_dev_raw::is_eof): Remove.
(fhandler_dev_raw::write_file): Remove.
(fhandler_dev_raw::read_file): Remove.
(fhandler_dev_raw::raw_read): Remove.
(fhandler_dev_raw::raw_write): Remove.
(fhandler_dev_raw::dup): Drop copying removed members.
(fhandler_dev_raw::ioctl): Drop blocksize testing.
* wincap.h: Implement has_disk_ex_ioctls throughout.
* wincap.cc: Ditto.
(wincap_vista): Preliminary wincaps for Windows Vista/Longhorn.
(wincapc::init): Add Vista/Longhorn handling.
(alloc_stack): Use tls stuff for stack info rather than calling VirtualQuery.
(dll_crt0_0): Initialize _impure_ptr stuff much earlier. Move
init_console_handler here.
* fork.cc (class frok): New class renamed from local fork() struct.
(stack_base): Change argument type. Use tls stuff to determine stack info
rather than calling VirtualQuery.
(frok::child): Rename from fork_child. Eliminate now unneeded arguments.
(frok::parent): Rename from fork_parent and ditto. Set error and errno as
appropriate. Fixup impersonation in cleanup, if needed. Try harder to set
errno appropriately.
(fork): Define "grouped" as a frok type. Deal with errors from fork_parent
here.
* init.cc (dll_entry): Remove init_console_handler call.
try IOCTL_DISK_GET_DRIVE_GEOMETRY_EX and
IOCTL_DISK_GET_PARTITION_INFO_EX ioctls first, to allow access to GPT
partitioned disks. Fall back to old non-EX ioctls otherwise.
Add comment to explain NT4 weirdness.
drive_size, current_position and bytes_per_sector.
(fhandler_dev_floppy::get_drive_info): Declare.
* fhandler_floppy.cc (fhandler_dev_floppy::is_eom): Define ERROR_SEEK
and ERROR_SECTOR_NOT_FOUND as end-of-medium conditions.
(fhandler_dev_floppy::get_drive_info): New method to have one function
retrieving drive info.
(fhandler_dev_floppy::open): Call get_drive_info to get drive
information right from the start.
(fhandler_dev_floppy::lseek): Use and set drive information members.
Especially keep track of current_position.
(fhandler_dev_floppy::ioctl): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::write_file): Keep track of
current_position.
(fhandler_dev_raw::read_file): Ditto.
(fhandler_dev_raw::raw_read): Never try to read beyond end-of-medium.
(fhandler_dev_raw::dup): Handle new drive information members.
be overridden.
* exceptions.cc (_cygtls::call_signal_handler): Call signal handler with extra
siginfo_t * and void * parameters when SA_SIGINFO flag is set.
* signal.cc (signal): Clear SA_SIGINFO flag.
(sigqueue): Fix incorrect setting of si_code.
* sigproc.cc (signal_fixup_after_exec): Clear SA_SIGINFO flag when setting
handler to SIG_DFL.
* faq.xml: Remove copyright section, link to license.html
* faq-sections.xml: Remove copyright section, link to license.html
* faq-programming.xml: Remove confusing reference to Red Hat.
* faq-what.xml: Reword "supported" FAQ.
* exceptions.cc (sigpacket::process): Eliminate return after call to reinstated
noreturn function.
(signal_exit): Allow function to exit when a captive process has been
terminated.
* pinfo.cc (pinfo::exit): Enter exit_lock here. Once again exit here under
control of exit_lock.
* sigproc.cc (sig_send): Don't wait for completion if process is exiting.
Remove special __SIGEXIT accommodations.
(wait_sig): Just exit the thread when a __SIGEXIT has been detected. Don't
exit the process.
* sigproc.h (struct sipacket::thread_handle): Put thread_handle here.
* sigproc.cc (sigproc_terminate): Move setting of thread_handle...
(sig_send): ...to here. Put it in packet being sent. Only close pack.wakeup
when we're waiting for completion.
(wait_sig): Use thread_handle directly from received packet.
* cygtls.h (struct _cygtls::thread_handle): New field.
* dcrt0.cc (exit_lock): Remove declaration.
* winsup.h (exit_lock): Add declaration.
* exceptions.cc (sigpacket::process): Properly return after signal_exit.
* pinfo.cc (pinfo::exit): Only exit the process if _my_tls.thread_handle has
not been filled out -- which should be an impossible event.
* sigproc.cc (sigproc_terminate): Fillout _my_tls.thread_handle to provide
something for wait_sig to wait for. Use the siginfo_t version of sig_send and
fill out the tls argument with _my_tls.
(wait_sig): Wait for the thread specified in pack.tls or (for now) complain
bitterly if it doesn't exit.
file attributes argument.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Use
file attributes evaluated from NtQueryFileInformation or
FileInformationByHandle in call to fstat_helper.
Set pc.fileattr from just evaluated file attributes here.
(fhandler_base::fstat_by_name): Use file attributes evaluated from
FindFileFirst or default attribute in call to fstat_helper.
Set pc.fileattr from just evaluated file attributes here.
(fhandler_base::fstat_helper): Use file attributes given as argument,
not file attributes stored in this fhandler, since this information
is potentially wrong. Add comment to explain this.
* path.h (has_attribute): New global inline function.
(path_conv::set_attributes): New method to change fileattr.
* mkgroup.c (print_win_error): Create macro calling ...
(_print_win_error): ... this function created from former
print_win_error. Move up in source.
(PDOMAIN_CONTROLLER_INFOW): Define return type of DcGetDcNameW.
(dsgetdcname): New function pointer for DcGetDcNameW.
(load_netapi): Get DcGetDcNameW address.
(main): If DcGetDcNameW is available, use it.
* mkpasswd.c (PDOMAIN_CONTROLLER_INFOW): Define return type of
DcGetDcNameW.
(dsgetdcname): New function pointer for DcGetDcNameW.
(load_netapi): Get DcGetDcNameW address.
(main): If DcGetDcNameW is available, use it. Rename local variable
domain_name_specified to domain_specified as in mkgroup.c.
pinfo::exit.
* pinfo.cc (pinfo::exit): Move sigproc_terminate later so that signals can be
processed while waiting for hExeced child.
(pinfo::maybe_set_exit_code_from_windows): Set exit code from sigExeced if it
is non-zero. Set exit_state to ES_EXEC_EXIT prior to waiting for captive
process exit code.
* exceptions.cc (sigExeced): New global variable.
(signal_exit): Remove noreturn attribute from declaration.
(signal_exit): Just terminate captive process and return if hExeced on the
theory that the exit will be subsequently handled in the main thread.
* sigproc.cc (sigproc_terminate): Eliminate test for ES_SIGPROCTERMINATE and
use ES_FINAL instead.
(sig_send): Use no_signals_available instead of duplicate test.
* winsup.h (ES_EXEC_EXIT): New enum.
(ES_SIGPROCTERMINATE): Delete.
(EXITCODE_NOSET): Ditto.
* sigproc.cc (no_signals_available): Remove check for hwait_sig. Just rely on
my_sendsig. Pass in an argument controlling when it is appropriate to test
EXITCODE_SET.
(proc_can_be_signalled): Remove checks for myself since this function is never
called in that context.
(sigproc_init): Pre-initialize my_sendsig to non-zero so that
proc_can_be_signalled will know that we expect to be signalable soon.
(sig_send): Change debugging output.
signal thread.
(wait_sig): Correct so that WaitForSingleObject is called when hMainThread is
!= 0, rather than the reverse.
* cygheap.cc (cygheap_fixup_in_child): Clarify potential error message.
* fork.cc (fork_copy): Cosmetic change.
called, since that is the intent of sending a __SIGEXIT. Wait forever for main
thread to go away since, presumably, the main thread told us it was going away.
(av::av): Remove reference to error.
(av::replace0_maybe): Ditto.
(av::dup_maybe): Ditto.
(av::dup_all): Ditto.
(av::unshift): Ditto.
(spawn_guts): On a fault, return E2BIG only if ENOMEM has been set. Otherwise
return EFAULT.
(cygtls::andreas): New element. Replaces _myfault and _myfault_errno.
(cygtls::fault_guarded): Use andreas.
(cygtls::return_from_fault): Ditto.
(cygtls::setup_fault): Add a parameter denoting where to store old fault
handler, if any and use it to "stack" faults.
(cygtls::reset_fault): Restore fault from parameter.
(myfault::sebastian): New variable.
(myfault::~myfault): Pass sebastian to reset_fault.
(myfault::myfault): Store old fault values in sebastian.
(handle_exceptions): Use _sig_tls rather than sigtid to determine if this is
the signal thread.
(set_signal_mask): Ditto for conditionalized CGF code.
* pinfo.cc (pinfo::exit): Exit the thread if we forcefully terminated the main
thread
* sigproc.cc (sigtid): Delete.
(_sig_tls): Define.
(sig_clear): Use _sig_tls rather than sigtid to determine if this is the signal
thread.
(sig_dispatch_pending): Ditto.
(wait_sig): Set _sig_tls here.
* dcrt0.cc (do_exit): Move sigproc_terminate call later since signal handling
was still needed for subsequent stuff. Call sigproc_terminate with new
exit_state value.
* pinfo.cc (pinfo::exit): Call sigproc_terminate with new exit_state value.
* sigproc.cc (proc_terminate): Remove unnecessary (void) parameter.
(sigproc_terminate): Ditto. Add new argument to accept exit state to be set.
(wait_sig): Reorganize __SIGEXIT handling. Add more debugging output.
* winsup.h (sigproc_terminate): Declare with new exit_state argument.
(exit_states): Reorganize to reflect new exit ordering of sigproc_terminate.
appropriately.
* pinfo.cc (pinfo::exit): Always call sigproc_terminate here. Rely on
sigproc_terminate to signal signal thread to handle eventual process exit.
* sigproc.cc (no_signals_available): Change criteria for determining if this
process can handle signals to itself.
(my_sendsig): New variable. Copy of my sendsig handle.
(proc_can_be_signalled): Don't send signals if exit code is set.
(sigproc_terminate): Use and set exit_state appropriately to determine when to
do anything. Send __SIGEXIT to self to control process exit.
(sig_send): Use my_sendsig for sending signals. Don't call
proc_can_be_signalled for myself since the criteria is now different for
sending signals to myself.
(wait_sig): Copy myself->sendsig to my_sendsig for future use. Exit signal
loop when __SIGEXIT is received. Wait for main thread to exit and use its exit
status to actually exit process.
* sigproc.h (__SIGEXIT): New enum.
* dcrt0.cc (alloc_stack): Eliminate superfluous "return;".
* debug.cc (add_handle): Ditto.
* devices.in (device::parse): Ditto.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
(dtable::vfork_child_fixup): Ditto.
* environ.cc (parse_options): Ditto.
* errno.cc (seterrno_from_win_error): Ditto.
* exceptions.cc (sig_handle_tty_stop): Ditto.
(set_signal_mask): Ditto.
* fhandler.cc (fhandler_base::read): Ditto.
(fhandler_base::operator delete): Ditto.
(fhandler_base::seekdir): Ditto.
(fhandler_base::rewinddir): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::fixup_after_exec): Ditto.
* sigproc.cc (sigproc_init): Ditto.
(sigproc_terminate): Ditto.
* devices.cc: Regenerate.
heap. Change fatal error to avoid confusion with cygheap.
* spawn.cc (linebuf::finish): New function.
(linebuf::add): Cosmetic change.
(spawn_guts): Only avoid building windows command line if the program being
executed was actually mounted with -X. Don't return E2BIG if we hit the 32K
size and we're executing a detected cygwin program. Just silently truncate the
windows command line, instead.
(print_version): Ditto.
(cmd_list): Don't depend on terminating '\0' being present on
string-values.
(cmd_get): Don't attempt to read more than present, but keep
extra space for terminating '\0'. Really output REG_BINARY.
Don't leak memory.
(cmd_set): Include trailing '\0' in string's length.
warning.
* path.h (path_conv::set_cygexec): New function.
* spawn.cc (av::iscygwin): Eliminate.
(av::av): Don't initialize iscygwin.
(spawn_guts): Just use real_path.iscygexec for all tests.
(av::fixup): Short circuit test if .exe extension and known cygexec. Set
cygexec flag appropriately if we find that program uses cygwin1.dll.
(dll_crt0_0): Move console initialization earlier.
* init.cc (dll_entry): Move console initialization here.
* exceptions.cc (init_console_handler): Fully remove any old console handler.
* spawn.cc (spawn_guts): Don't fill out windows argv if we've deduced that this
is a cygwin-using program.
(av::fixup): Always check executables to see if they are using cygwin1.dll.
Don't consider .com files to be scripts.
* hookapi.cc (rvadelta): New function.
(PEHeaderFromHModule): Simplify slightly.
(hook_or_detect_cygwin): Use passed in name argument for "HMODULE" rather than
incorrectly reading current program. Calculate delta needed to read image data
and file names if this isn't a real "HMODULE".
* fork.cc (fork_parent): Don't issue errors if "somebody" has set the
PID_EXITED flag on a child. Don't close process handle if it has potentially
already been closed.
* pinfo.cc (winpids::add): Eliminate PID_ALLPIDS handling which was obsoleted
by previous changes.
* spawn.cc (av::fixup): Do win16 detection for .com files. Make sure that
buffer has been unmapped in all cases.
(_cygtls::return_from_fault): Use __ljfault.
* exceptions.cc (set_signal_mask): Revert previous checkin.
* gendef (__sjfault): Split out into a separate function which doesn't bother
with any special signal locking. routines.
(_ljfault): Return from a __sjfault without bothering with signals.
* Makefile.in: Remove extra anchor to make NN4 happy.
* faq.xml: Link to cygwin.com/license.html
* faq-resources.xml: Link instead of duplicating info.
* faq-using.xml: Split out services and network shares FAQ.
* faq-what.xml: Link to cygwin.com/license.html
intact throughout.
(normalize_win32_path): Revert to only checking for slash.
(realpath): Convert drive letters to cygdrive paths before
doing anything else.
* shared_info.h (mount_info::cygdrive_posix_path): Make public.
in favor of calling path_conv with PC_POSIX flag. Align error
handling closer to POSIX. As on Linux, return user space allocated
memory if second parameter is NULL.
thread.
(sigpacket:process): Simplify logic which determines when and how a signal is
masked. Don't trigger sigwait if there is a signal handler.
* sigproc.cc (wait_sig): Update comment. Try to process a signal which is in
the queue if it isn't queued for the target thread (this is still not right).
directory if /dev doesn't actually exist.
(win32_device_name): Don't consider FH_DEV to be a device since it's really a
directory which should go through mount processing.
* fhandler_proc.cc: Use cygheap rather than user heap for allocation of filebuf
throughout.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* fhandler_process.cc: Ditto.
(get_mem_values): Use malloc/realloc/free rather than new.
* pinfo.cc (_pinfo::commune_send): Allocate on cygwin heap rather than user
heap. Avoid calling ReadFile when correct number of characters have been read
or suffer buffer corruption.
(_pinfo::fd): Allocate on cygwin heap rather than user heap.
(_pinfo::fds): Ditto.
(_pinfo::root): Ditto.
(_pinfo::cwd): Ditto.
(_pinfo::cmdline): Ditto.
* devices.h (FH_DEV): New define.
* devices.in: Detect lone /dev.
* devices.cc: Regenerate.
* path.cc (path_conv::check): Treat FH_DEV as a special case.
by reference.
* signal.cc (abort): Accommodate change to set_signal_mask.
* select.cc (pselect): Ditto.
* exceptions.cc (handle_sigsuspend): Ditto.
(ctrl_c_handler): Ditto.
(sighold): Ditto.
(sigrelse): Ditto.
(set_process_mask_delta): Ditto.
(_cygtls::call_signal_handler): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE if
__handle is not set. Set __handle to NULL when out of files.
(fhandler_disk_file::rewinddir): Don't close handle if it's NULL.
(fhandler_disk_file::closedir): Ditto.
dirent_saw_dev.
* dir.cc (opendir): Don't zero __flags here. Push that responsibility to
opendir methods.
(seekdir): Preserve dirent_isrrot in __flags.
(rewinddir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set dirent_isroot
appropriately.
(fhandler_disk_file::readdir): Fill in "cygdrive" and "dev" if it is the root
dir and they are missing.
* fhandler_process.cc (fhandler_process::opendir): Set __flags here.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set __flags here.
(opts): Add -d option.
(GetPW): Add server parameter which is given to Net functions.
(ChangePW): Ditto.
(PrintPW): Ditto.
(SetModals): Ditto.
(usage): Add description for -d/--logonserver option.
(main): Add option handling for -d/--logonserver. Use LOGONSERVER
environment variable content for server to contact, unless
-d/--logonserver option is given. If both is missing, use NULL.
(fhandler_tty_slave::lseek): Delete old method.
(fhandler_tty_master::lseek): Delete old method.
* fhandler_tty.cc (fhandler_tty_common::lseek): Define new method.
* fhandler_tty.cc (fhandler_tty_common::close): Rearrange the code so that the
master end of the input and output pipes is closed before signalling an EOF
event to the slave.
(fhandler_pty_master::close): Likewise.
"noreturn" attribute. Add additional check if parent process is
actually a 64 bit process.
(dll_entry): Only test WOW64 processes with a stack in the usual
"dangerous" process space area.
* lib/ddk/hid.def: Uncomment symbols and add stdcall suffix for
functions declared in hidsdi.h.
Thanks to: Alex J Lennon <ajlennon at organixconsulting dot com>
(child_info::child_info()): New constructor.
(child_info_spawn::child_info_spawn()): Ditto.
(child_info_spawn::operator new): New operator.
(child_info_spawn::set): New function.
* spawn.cc (av()): New constructor.
(av::operator new): New operator.
(av::set): New function.
(spawn_guts): Reorganize so that classes which allocates are defined early in
the function so that it can be properly cleaned up after an efault. Set errno
to E2BIG in the event of a SEGV situation.
* dllfixdbg: Just copy .stab and .stabstr sections when making cygwin1.dbg,
rather than relying on objcopy to keep only the debug sections since objcopy
seems to get it wrong.
* dtable.cc (build_fh_pc): Check setting fh to fhandler_nodevice for NULL, too.
* cygheap.cc (cmalloc): Only emit system_printf warnings on failure if
DEBUGGING.
(crealloc): Ditto.
(ccalloc): Ditto.
* dtable.cc (build_fh_name): Treat NULL return from cnew as indicative of
EMFILE condition.
(build_fh_dev): Ditto.
(dtable::dup_worker): Handle NULL return from build_fh_pc.
(dtable::vfork_child_dup): Trust dup_worker to set errno.
* fhandler.h (fhandler_base::new): Mark as nothrow.
linux.
* include/cygwin/types.h: Include endian.h.
* include/sys/dirent.h: Define DT_* types and conversion macros.
* pinfo.cc (pinfo::init): Remove special handling for PID_ALLPIDS and execed
code, even though it probably still isn't quite right.
* fhandler.h (class fhandler_serial): Declare switch_modem_lines.
* fhandler_serial.cc (fhandler_serial::switch_modem_lines): New
static function to set or clear DTR and/or RTS.
(fhandler_serial::ioctl): Use switch_modem_lines for TIOCMSET
and new TIOCMBIS and TIOCMBIC.
* include/cygwin/version.h: Bump API minor number.
* include/winnt.h (SUBLANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN):
Correct their values.
Thanks to: Daniel K. O. <danielosmari at users dont sf dot net>
(child_info::child_info): Accept an argument controlling whether to create
proc_subproc.
(child_info_spawn::child_info_spawn): Ditto.
* sigproc.cc (child_info::child_info): Ditto.
(child_info_spawn::child_info_spawn): Ditto.
(child_info::sync): Use passed in pid and HANDLE.
* fork.cc (fork_parent): Reflect additional arguments required for
child_info::sync.
* hookapi.cc (hook_or_detect_cygwin): Rename. Change so that NULL 'fn'
argument just returns "true", indicating that program uses cygwin1.dll.
* spawn.cc (av::win16_exe): New element.
* spawn.cc (av::iscygwin): New element.
(av::fixup): New function.
(spawn_guts): Protect against SEGV. Use fixup function to detect when it is
safe to wait for a spawned (as opposed to an execed) program. Reflect changes
in child_info::sync arguments.
* external.cc (cygwin_internal): Reflect function renaming to
hook_or_detect_cygwin.
* cygheap.cc (cygheap_fixup_in_child): Close handle after debug fixup has been
done to prevent false positives in handle collision.
* exceptions.cc (try_to_debug): Notify debugger if already being debugged.
* cygwinenv.sgml: Update tty section to mention rxvt and xterm.
* how-programming.texinfo: Update GPL section of VS FAQ.
* how-using.texinfo: Expand FAQ about out of date pacakages.
* setup-net.sgml: Add troubleshooting setup.exe section.
(getdelim): Export.
* include/sys/stdio.h (getline): Replace macro with function prototype.
(getdelim): Likewise.
* include/cygwin/version.h: Bump API minor number.
(__getdelim): Export.
* include/sys/stdio.h (getline): Define as __getline.
(getdelim): Define as __getdelim.
* include/cygwin/version.h: Bump API minor number.
* winsup.h (close_all_files): Reflect argument change.
* dtable.cc (close_all_files): Ditto.
* dtable.h: Ditto.
* fhandler.h: Ditto.
* spawn.cc (spawn_guts): Move close_all_files back to its original location in
first P_OVERLAY test but use argument denoting that handles are only supposed
to be closed, not released (more work to be done here).
* syscalls.cc (close_all_files): Take an argument denoting whether to release
closed files or not.
* path.cc (symlink): Change argument names to reflect linux man page.
(symlink_worker): Ditto. Also appropriately set ENOENT for empty strings.
* external.cc (cygwin_internal): Use cygpsid::get_id for
CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID.
Turn CW_SET_CYGWIN_REGISTRY_NAME and CW_GET_CYGWIN_REGISTRY_NAME
into noops.
declaration that should have been static.
* thread.cc (verifyable_object_state verifyable_object_isvalid): Make inline
static.
(pthread*::is_good_object): Move to directly after verifyable_object_state
verifyable_object_isvalid and make inline.
everywhere. Leave some thread.cc stuff alone for now.
* cygtls.h: Kludge some definitions to avoid including a problematic windows
header.
(_cygtls::_myfault): New entry.
(_cygtls::_myfault_errno): Ditto.
(_cygtls::fault_guarded): New function.
(_cygtls::setup_fault): Ditto.
(_cygtls::return_from_fault): Ditto.
(_cygtls::clear_fault): Ditto.
(myfault): New class.
* exceptions.cc (handle_exceptions): Handle case of guarded fault in system
routine.
* gendef: Add another entry point for setjmp that the compiler doesn't know
about and won't complain about.
* gentls_offsets: Just include windows.h rather than kludging a HANDLE def.
* miscfuncs.cc (check_null_str): Delete.
(check_null_empty_str): Ditto.
(check_null_empty_str_errno): Ditto.
(check_null_str_errno): Ditto.
(__check_null_invalid_struct): Ditto.
(__check_null_invalid_struct_errno): Ditto.
(__check_invalid_read_ptr): Ditto.
(__check_invalid_read_ptr_errno): Ditto.
(dummytest): New function.
(check_iovec_for_read): Delete.
(chec_iovec): Rename from check_iovec_for_write. Take a read/write parameter.
* tlsoffsets.h: Regenerate.
* winsup.h: Remove check_* declarations.
(check_iovec_for_read): Delete declaration. Turn into a define instead.
(check_iovec_for_write): Ditto.
(check_iovec): New declaration.
* thread.h: Use ifdef guard name consistent with other header files.
fixup_after_fork and set_close_on_exec.
* fhandler_tape.cc (fhandler_dev_tape::open): Create mt_mtx mutex
inheritable.
(fhandler_dev_tape::close): Close mt_mtx.
(fhandler_dev_tape::dup): Duplicate mt_mtx and mt_evt as necessary.
(fhandler_dev_tape::fixup_after_fork): New method.
(fhandler_dev_tape::set_close_on_exec): New method.
(get_setgroups_sidlist): Avoid duplicate groups in group list.
(create_token): Remove special_pgrp local variable. Accomodate
change to get_initgroups_sidlist call.
(wincapc::detect_win16_exe): Implement.
* wincap.cc: Populate detect_win16_exe where appropriate.
* spawn.cc (spawn_guts): Only go out of the way to detect 16-bit apps on
systems which are flummoxed by them.
(inet_ntop): Export.
* net.cc (cygwin_inet_pton): Implement inet_pton for AF_INET for now.
(cygwin_inet_ntop): Implement inet_ntop for AF_INET for now.
* include/arpa/inet.h (inet_pton): Declare.
(inet_ntop): Declare.
* include/cygwin/version.h: Bump API minor number.
Revert PTHREAD_MUTEX_INITIALIZER to PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
since that is actually closer to what linux does.
* thread.h (cw_cancel_action): New enum.
(cancelable_wait): Use cw_cancel_action as third argument.
* thread.cc (cancelable_wait): Ditto. Don't wait for cancel if cancel_action
== cw_no_cancel.
(pthread::create): Don't wait for cancel event since that is racy.
(pthread_mutex::pthread_mutex): Set default to PTHREAD_MUTEX_ERRORCHECK.
(pthread_mutexattr::pthread_mutexattr): Ditto.
(pthread_mutex::_lock): Tell cancelable_wait not to wait for cancellation
event.
(semaphore::_timedwait): Accommodate change in cancelable_wait args.
(pthread::join): Ditto.
(_local_storage::setmode_mode): New element.
* tlsoffsets.h: Regenerate.
* cygwin.din (setmode): Define as cygwin_getmode.
* syscalls.cc (setmode_helper): Use setmode_* variables from tls rather than
using unthreadsafe static.
(setmode): Break out fwalk stuff.
(cygwin_setmode): New function. Put fwalk stdio stuff here.
* thread.h (cw_sig_wait): New enum.
(fast_mutex::lock): Use cancelable_wait with resumable signal.
(cancelable_wait): Change fourth argument to cw_sig_wait enum.
* thread.cc (cancelable_wait): Ditto. Loop on signal detection if fourth
argument == cw_sig_resume.
allocate dynamically.
(pinfo::set_acl): Replace sa_buf by dynamically allocated acl_buf.
* sec_acl.cc (setacl): Allocate acl dynamically.
* sec_helper.cc (sec_acl): Add test for alignment of acl when
DEBUGGING is defined.
(__sec_user): Same for sa_buf.
* security.cc (verify_token): Define sd_buf as PSECURITY_DESCRIPTOR
and allocate dynamically.
(alloc_sd): Allocate acl dynamically.
security.h (sec_user_nih): Change first parameter to
SECURITY_ATTRIBUTES *.
(sec_user): Ditto.
* sigproc.cc (wait_sig): Define sa_buf as PSECURITY_ATTRIBUTES and
allocate dynamically.
* syscalls.cc (seteuid32): Define dacl_buf as PACL and allocate
dynamically.
* uinfo.cc (cygheap_user::init): Define sa_buf as PSECURITY_ATTRIBUTES
and allocate dynamically.
* winbase.h (ilockincr): Mark first argument of inline assembly as
earlyclobber.
(ilockdecr): Ditto.
* fhandler.cc (fhandler_base::raw_read): Ditto for debug message.
* dcrt0.cc (do_exit): Add some more synchronization tests.
* fhandler_fifo.cc (fhandler_fifo::dup): Don't duplicate a nonexistent handle.
Use derived return value rather than always retuning 0.
* fhandler_netdrive.cc (fhandler_netdrive::exists): Wnet -> WNet.
* winsup.h (exit_states): Add a couple of new exit states.
(child_info::dwProcessId): New field.
* cygheap.cc (init_cheap): Delete.
(dup_now): Ditto.
(cygheap_setup_for_child): Ditto.
(cygheap_setup_for_child_cleanup): Ditto.
(cygheap_fixup_in_child): Simplify. Use new "child_copy" function to copy heap
from parent.
(_csbrk): Don't attempt allocation if within cygheap section. Fix so that more
than one allocation will succeed.
(cygheap_init): Reset possibly-nonzero region to zero.
* cygheap.h (cygheap_setup_for_child): Delete declaration.
(cygheap_setup_for_child_cleanup): Ditto.
(cygheap_start): Define as an array.
* cygwin.sc: Modernize. Remove unneeded sections. Define cygheap here.
* dcrt0.cc (do_exit): Reflect argument change to close_all_files.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
* dtable.h: Ditto.
* fhandler.h: Ditto.
* fork.cc (fork_copy): Call ReadProcessMemory if there is no thread
(indicating that we're execing).
(fork_child): Don't mess with hParent.
(fork_parent): Remove hParent stuff. It happens earlier now. Remove call to
cygheap_setup_for_child* stuff.
(fork): Put child_info_stuff in grouped structure. Issue error if parent
handle is not set.
(child_copy): New function.
* sigproc.cc (child_info::child_info): Put cygheap settings here. Set parent
handle.
(child_info::~child_info): Close parent handle if it exists.
* spawn.cc (spawn_guts): Reorganize so that ciresrv is allocated at only the
last minute so that cygheap changes are reflected. Delete cygheap_setup*
calls.
* syscalls.cc (close_all_files): Add an argument to flag when the fd entry
should be released.
* winsup.h (close_all_files): Add an argument to close_all_files declaration.
Declare child_copy.
variable.
* dlfcn.cc (get_full_path_of_dll): Search /usr/bin (for windows compatibility)
and /usr/lib (for UNIX compatibility) when looking for shared libraries.
* environ.cc (conv_envvars): Put back LD_LIBRARY_PATH since it is used by
get_full_path_of_dll().
* errno.cc (errmap): Map MOD_NOT_FOUND to ENOENT.
* cygmagic: Remove debugging cruft.
* install.texinfo ("How do I uninstall..."): Rewrite to cover
removing services, dealing with permissions, and other common
tasks for removing Cygwin completely.
* fhandler_netdrive.cc (struct netdriveinf): New structure to
store thread arguments.
(thread_netdrive): Thread handling all potentially blocking
WNet... calls.
(create_thread_and_wait): Start and wait for above thread.
(fhandler_netdrive::exists): Change to call create_thread_and_wait
instead of calling WNet... function.
(fhandler_netdrive::readdir): Ditto. Fix error handling.
(fhandler_netdrive::rewinddir): New method.
return code from GetFileSize and set file size to 0 if necessary.
* fhandler_netdrive.cc (fhandler_netdrive::fstat): Set permissions
to read/execute for all.
* path.h (enum pathconv_arg): Change PC_FULL to PC_NOUILL.
* path.cc (path_conv::check): Test for PC_NOFULL rather than !PC_FULL.
(cygwin_conv_to_win32_path): Use PC_NOFULL to force non-absolute path.
* dir.cc (mkdir): Check path for writability.
(rmdir): Ditto. Remove check for special directories.
* path.cc (path_conv::check): Set PATH_RO for virtual devices. Set error if
read-only and asked for writability.
* path.h (pathconv_arg): Add PC_WRITABLE.
(path_types): Add PATH_RO.
(path_conv::isro): Add (currently unused) check for read-only filesystem.
Return "ENOSHARE" when we know a share doesn't exist.
* include/sys/mount.h: Add MOUNT_RO flag.
* autoload.cc (WNetGetResourceInformationA): Import.
* fhandler_netdrive.cc (fhandler_netdrive::exists): Detect actual existence of
remote system rather than always assuming that it exists.
(spenv::add_if_exists): Rename from force.
(build_env): Accommodate name changes. Make sure that stuff that is always
supposed to be in the environment is actually added to the environment.
* shared.cc (open_shared): Restore VirtualFree eliminated by 2005-04-28 change.
collision with large data areas.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Accommodate changes to
open_shared arguments.
* fhandler_tape.cc (mtinfo_init): Ditto.
* pinfo.cc (pinfo::init): Use open_shared rather than win32 mmap calls.
* shared.cc (user_shared_initialize): Ditto.
(memory_init): Ditto.
(open_shared): Change to allow use a smore general mmap handler.
* shared_info.h (shared_locations): Add SH_JUSTCREATE, SH_JUSTOPEN.
(open_shared): Change declaration to match new usage.
* autoload.cc (LoadDLLfuncEx2): Define in terms of LoadDLLfuncEx3.
(LoadDLLfuncEx3): New macro.
* mingwex/wcrtomb.c: New file.
* mingwex/btowc.c: New file.
* mingwex/wctob.c: New file.
* mingwex/mb_wc_common.h: New file.
* mingwex/Makefile.in (DISTFILES): Add new files.
(Q8_OBJS): Add new objects.
* include/wchar.h: Adjust comment about mbrtowc() and related
funcions. Add __restrict__ to pointer params in prototypes.
(wmemset. wmemchr, wmemcpy, wmemmove, wcstoll, wcstoull): Remove
arg names from protototypes.
(dev_console::set_default_attr): Ditto, moved from fhandler_console.
(dev_console::fillin_info): Ditto. Accommodate this change throughout this
file.
(fhandler_console::get_win32_attr): Eliminate.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Properly set default
attributes on initialization.
(fhandler_console::open): Set current attributes rather than default color on
open.
(fhandler_console::get_win32_attr): Eliminate.
(dev_console::set_color): New function. Move get_win32_attr stuff here.
(dev_console::set_default_attr): New function, moved from fhandler_console.
(dev_console::fillin_info): Ditto.
(fhandler_console::char_command): Call set_color to set screen characteristics.
* fhandler.h (fhandler_pipe::create_selectable): Declare.
(fhandler_fifo::close_one_end): Declare.
* fhandler_fifo.cc (fhandler_fifo::close_one_end): Define.
(fhandler_fifo::open_not_mine): Use close_one_end to close appropriate end of
pipe.
* pinfo.cc (_pinfo::commune_recv): Ditto.
* pipe.cc (fhandler_pipe::create_selectable): Rename from
create_selectable_pipe. Reorganize.
(fhandler_pipe::create): Use create_selectable.
* fhandler_socket.cc (fhandler_socket::connect): Set connect_state to
connect_failed when connect failed.
* poll.cc (poll): Change errno to EINVAL if allocating memory fails,
according to SUSv3. Add socket descriptors always to except_fds. Test
for failed connect and set revents flags appropriately.
* select.cc (set_bits): Set connect_state to connect_failed when
select indicates failed nonblocking connect.
(fhandler_dev_null::select_except): Set except_ready to false so that
/dev/null is not always in except state.
(peek_socket): Fix bogus conditional.
(fhandler_socket::select_write): Treat all connect_states except
unconnected equivalent to return consistent results.
(fhandler_windows::select_except): Set except_ready to false so that
/dev/windows is not always in except state.
ERROR_NOT_SUPPORTED to workaround Win9x weirdness.
* path.cc (symlink_info::check): Remap ERROR_INVALID_FUNTION to
ERROR_FILE_NOT_FOUND for the same reason.
(get_server_groups): Declare new function.
* security.cc (is_group_member): Simplify.
(get_server_groups): New function.
(get_initgroups_sidlist): Call get_server_groups.
(verify_token): Allow token when supplementary sids are not in
/etc/group but are in the token.
Streamline the code.
* grp.cc (initgroups32): New implementation.
(getgroups32): Handle case where the supplementary groups are set.
* fhandler.h (fhandler_fifo::owner): Eliminate.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk devices
better.
(fhandler_base::fstat_helper): Ditto.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize obsolete
"owner".
(fhandler_fifo::open_not_mine): Add some debugging. Duplicate correct handle
when we own it.
(fhandler_fifo::open): Set flags from input, not from first pipe. Flag that
fork fixup is needed.
(fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
* pinfo.cc (commune_send): Add debugging for fifo.
* cygwin/version.h: Bump API minor version to 127 to reflect exporting of
sigrelese.
(__main): Don't rely on atexit to run dtors.
(do_exit): Specifically call do_global_dtors here.
(cygwin_exit): Ditto.
* dll_init.cc (dll_global_dtors): Make global. Only run dtors once.
(dll_list::init): Just set flag that dtors should be run. Don't rely on
atexit.
* dll_init.h (dll_global_dtors): Declare.
* exceptions.cc (sigrelse): Define.
* path.h (is_fs_device): New method.
(is_lnk_special): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::link): Use "is_lnk_special" rather
than "is_lnk_symlink".
* syscalls.cc (rename): Ditto.
* hookapi.cc (ld_preload): Use colon as a separator rather than space.
error code as well as errno. Use throughout where errno is set from
NT status.
(set_errno): Evaluate val only once.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fix typo in
debug output.
* fhandler_mem.cc (fhandler_dev_mem::open): Rely on
__seterrno_from_nt_status setting Win32 error code in debug output.
* fhandler_proc.cc (format_proc_uptime): Ditto.
(format_proc_stat): Ditto.
* fhandler_process.cc (format_process_stat): Ditto.
* sysconf.cc (sysconf): Ditto.
* fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag.
* fhandler.h (enum change_state): Remove.
(fhandler_base::status): Revert has_changed to a simple bit.
(fhandler_base::fstat_helper): Add nAllocSize parameter. Rename
ftCreationTime to ftChangeTime.
* fhandler_disk_file.cc:
Call fstat_helper with additional
allocation size throughout.
(fhandler_base::fstat_by_handle): Use NT native functions to get
full file information on NT. Call fstat_helper with LastWriteTime
as ctime, if ChangeTime is not available.
(fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime
as ctime.
(fhandler_base::fstat_helper): Add comment. Drop special FAT
handling since it's useless. Use nAllocSize for st_blocks if available.
(fhandler_disk_file::touch_ctime): Only touch LastWriteTime.
(fhandler_disk_file::fchmod): Set has_changed on 9x only.
(fhandler_disk_file::fchown): Don't set has_changed.
(fhandler_disk_file::facl): Ditto.
(fhandler_disk_file::ftruncate): Ditto.
(fhandler_disk_file::link): Set has_changed on 9x only and on original
file only.
(fhandler_base::open_fs): Don't set has_changed in O_TRUNC case.
* ntdll.h (FILE_BASIC_INFORMATION): Define.
(FILE_STANDARD_INFORMATION): Define.
(FILE_INTERNAL_INFORMATION): Define.
(FILE_EA_INFORMATION): Define.
(FILE_ACCESS_INFORMATION): Define.
(FILE_POSITION_INFORMATION): Define.
(FILE_MODE_INFORMATION): Define.
(FILE_ALIGNMENT_INFORMATION): Define.
(FILE_NAME_INFORMATION): Don't define with arbitrary FileName size.
(FILE_ALL_INFORMATION): Define.
(FILE_INFORMATION_CLASS): Add FileAllInformation.
(FILE_FS_VOLUME_INFORMATION): Define.
(FS_INFORMATION_CLASS): Define.
(NtQueryVolumeInformationFile): Define.
* autoload.cc (GetVolumePathNamesForVolumeNameA): Remove.
* autoload.cc (GetVolumeNameForVolumeMountPointA): Add.
* syscalls.cc (sync): Rewrite guid case to skip floppies also on
Windows 2000.
* wincap.h (wincaps::has_get_volume_pathnames): Rename from
has_guid_volumes
* wincap.cc: Accomodate above rename throughout. Set to false on
Windows 2000.
(msleep_max_cnt): Remove.
(msleep_arr): Remove.
(class msleep_sync_array): New class to encapsulate msleep/wakeup
thread synchronization.
(msleep_sync): New object pointer.
(msleep_init): Initialize new msleep_sync object.
(_mutex): Just call msleep_sync->enter() and msleep_sync->leave() for
thread synchronization. Improve debug output a bit more.
(wakeup): Just call msleep_sync->wakeup().
(wakeup_all): Whitespace fix.
(try_connect_guard): New static variable.
(syslogd_inited): Ditto.
(syslogd_sock): Ditto.
(try_connect_syslogd): New function to connect and write syslog to
local syslogd.
(vsyslog): Log to stderr if LOG_PERROR flag has been given to openlog.
Try logging to syslogd. Use Event Log resp. log file as fallback.
(closelog): Close socket to syslogd.
* include/sys/syslog.h (_PATH_LOG): Define.
(INTERNAL_NOPRI): Define if SYSLOG_NAMES is defined.
(INTERNAL_MARK): Ditto.
(struct _code): Ditto.
(prioritynames): Ditto.
(facilitynames): Ditto.
unix socket type. Read socket type from unix socket file.
(fhandler_socket::bind): Write socket type to unix socket file.
(fhandler_socket::connect): Return with errno EPROTOTYPE if
socket type of socket doesn't match socket type of unix socket
trying to connect to.
* bsd_mutex.cc: Include stdlib.h, sys/msg.h and sys/sem.h.
(mtx_init): Initialize lock counter to 0.
(_mtx_lock): Increment and log mutex lock counter.
(mtx_owned): Add winpid argument. Return true only if mutex is
actually owned by process winpid.
(_mtx_assert): Add winpid argument accordingly.
(_mtx_unlock): Log owner and lock count.
(MSLEEP_MUTEX): Remove.
(MSLEEP_SEM): Ditto.
(MSLEEP_EVENT): Ditto.
(msleep_event_name): Ditto.
(msleep_cs): New global critical section.
(msleep_cnt): New global variable indicating msleep record usage.
(msleep_max_cnt): New global variable indicating msleep record size.
(msleep_arr): New global pointer to msleep records.
(msleep_init): Initialize msleep_cs. Allocate msleep_arr array.
(_msleep): Rewrite using new msleep_cs/msleep_arr based thread
synchronization. Don't be shy with debug output.
(wakeup): Rewrite using new msleep_cs/msleep_arr based thread
synchronization.
* bsd_mutex.h (struct mtx): Add lock counter for better debugging.
(mtx_owned): Declare with winpid argument.
(_mtx_assert): Ditto.
(mtx_assert): Define with winpid argument.
* cygserver.cc (version): Remove.
(SERVER_VERSION): New define, decoupling server version information
from source code control system.
(print_version): Simplify printing server version.
* process.cc (process::process): Fix wrong bracketing (and handle leak).
(process::~process): Only try to close _signal_arrived if valid.
* sysv_sem.cc: Include sys/smallprint.h.
(semundo_clear): Define with additional struct thread pointer argument.
Accomodate throughout.
(SEMUNDO_LOCKASSERT): Define with winpid argument. Accomodate
throughout.
(struct sem_undo): Define un_proc as pid_t on Cygwin. Accomodate
throughout.
(seminit): Improve debugging by adding the semid to the mutex name.
(semget): Correctly print key value as 64 bit hex value in debug
output.
(semexit_myhook): Remove Cygwin specific unlocking of mutexes owned
by exiting process. Keep semaphore global lock throughout whole
function to avoid races.
* sysv_shm.cc (GIANT_REQUIRED): Define empty on Cygwin. We know that
Giant is locked.
* fhandler.h (enum change_state): Add.
(fhandler_base::status): Add a bit to has_changed flag.
(fhandler_base::has_changed): Implement with type change_state.
* fhandler.cc (fhandler_base::raw_write): Accomodate type change
of has_changed.
* fhandler_disk_file.cc )fhandler_disk_file::touch_ctime): Also
touch modification time if has_changed == data_changed.
(fhandler_disk_file::fchmod): Also open on 9x, otherwise we can't
touch ctime. Accomodate type change of has_changed.
(fhandler_disk_file::fchown): Accomodate type change of has_changed.
(fhandler_disk_file::facl): Ditto.
(fhandler_disk_file::ftruncate): Ditto.
(fhandler_disk_file::link): Ditto.
(fhandler_base::open_fs): Ditto.
* cygheap.h (cygheap_user::curr_primary_token): New member.
(cygheap_user::primary_token): New method.
(cygheap_user::deimpersonate): Always revert to processes'
impersonation token.
(cygheap_user::reimpersonate): Set processes' or setuid token as
necessary.
(cygheap_user::has_impersonation_tokens): Look for curr_primary_token
value.
(cygheap_user::close_impersonation_tokens): Close curr_primary_token
here if necessary. Don't reset token values to NO_IMPERSONATION since
that's done in uinfo_init anyway.
(init_cygheap::luid): New LUID array keeping privilege LUIDs.
* cygtls.cc (_cygtls::init_thread): Call cygheap->user.reimpersonate.
* dcrt0.cc (hProcToken): New global variable to keep process token.
(hProcImpToken): Ditto for process impersonation token.
(dll_crt0_0): Open process token here once. Duplicate to create
hProcImpToken.
(dll_crt0_1): Call set_cygwin_privileges.
* environ.cc (allow_ntea): Drop duplicate declaration.
(allow_smbntsec): Ditto.
(set_traverse): Only set allow_traverse here.
(environ_init): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Drop call to
enable_restore_privilege.
(fhandler_disk_file::fchown): Ditto.
(fhandler_disk_file::facl): Ditto.
* fork.cc (fork_child): Move call to cygheap->user.reimpersonate after
syn with parent. Call set_cygwin_privileges.
* grp.cc (internal_getgroups): Use hProcImpToken instead of opening
process token.
* path.cc (fs_info::update): Bypass traverse checking when retrieving
volume information using push/pop_thread_privileges.
* registry.cc (load_registry_hive): Drop setting restore privilege
since it's already set if available.
* sec_helper.cc: Include cygtls.h.
(cygpriv): Privilege string array.
(privilege_luid): New function, evaluate LUID from cygpriv_idx.
(privilege_luid_by_name): New function, evaluate LUID from privilege
string.
(privilege_name): New function, evaluate privilege string from
cygpriv_idx.
(set_privilege): New static function called by set_process_privilege
and set_thread_privilege. Call privilege_luid to get privilege LUID.
Fix bug in return value evaluation. Improve debug output.
(set_cygwin_privileges): New function.
(set_process_privilege): Remove.
(enable_restore_privilege): Remove.
* security.cc (allow_traverse): New global variable.
(sys_privs): Change type to cygpriv_idx and store privilege indices
instead of strings.
(SYSTEM_PRIVILEGES_COUNT): Renamed from SYSTEM_PERMISSION_COUNT.
(get_system_priv_list): Don't use numerical constant in malloc call.
Use privilege_luid to get privilege LUIDs.
(get_priv_list): Call privilege_luid_by_name to get LUIDs. Improve
inner privilege LUID comparison loop.
(create_token): Enable create token privilege using
push/pop_self_privileges. Use hProcToken instead of opening process
token. Use default DACL when duplicating token.
(subauth): Enable tcb privilege using push/pop_self_privileges.
Use sec_none instead of homw made security attributes when duplicating
token.
(check_file_access): Don't duplicate access token, use active
impersonation token as is.
* security.h (enum cygpriv_idx): New enumeration type enumerating
possible privileges.
(privilege_luid): Declare new function.
(privilege_luid_by_name): Ditto.
(privilege_name): Ditto.
(allow_traverse): Declare.
(set_privilege): Declare function.
(set_process_privilege): Define as macro.
(enable_restore_privilege): Remove declaration.
(_push_thread_privilege): Define macro.
(push_thread_privilege): Ditto.
(pop_thread_privilege): Ditto.
(pop_self_privilege): Ditto.
* spawn.cc (spawn_guts): Use cygheap->user.primary_token instead of
cygheap->user.token.
* syscalls.cc (statvfs): Bypass traverse checking when retrieving
volume information using push/pop_thread_privileges. Rearrange code
to simplify push/pop bracketing.
(seteuid32): Use hProcToken instead of opening process token. Call
cygheap->user.deimpersonate instead of RevertToSelf. Create
impersonation token from primary internal or external token. Set
cygheap->user.curr_primary_token and cygheap->user.current_token
privileges once here. Drop "failed" and "failed_ptok" labels.
Drop setting DefaultDacl of process token.
(setegid32): Use hProcToken and hProcImpToken instead of opening
process token. Always reimpersonate afterwards.
* uinfo.cc (cygheap_user::init): Use hProcToken instead of opening
process token.
(internal_getlogin): Ditto. Set hProcImpToken, too.
(uinfo_init): Initialize cygheap->user.curr_primary_token.
* winsup.h (hProcToken): Declare.
(hProcImpToken): Declare.
(win_env::operator = ): Declare new operator.
(win_env::reset): Declare new function.
(win_env::~win_env): Declare new destructor.
(getwinenv): Add optional third argument to declaration.
* environ.cc (conv_envvars): Accommodate immediate field.
(win_env::operator =): Define new operator.
(win_env::~win_env): Define new destructor.
(win_env::add_cache): Add value to environment immediately if "immediate" is
set.
(getwinenv): Accept optional third argument which will be used to store
"cached" values to avoid overwriting real cache.
(spenv::force): Declare new field.
(spenvs): Accommodate force field. Add "PATH=" with force set to true.
(spenv::retrieve): Avoid duping anything if we're not building an envblock.
(build_env): Ditto. Use size of potentially constructed new environment block
to determine if we need to create an environment block. Pass getwinenv
temporary storage to avoid inappropriately overwriting the environment cache.
* path.h (is_floppy): Declare.
* syscalls.cc (sync): Check for floppies on A: and B: in guid case.
Don't call setmntent in non-guid case but evaluate drive bit mask
locally.
since waiting for anything else is racy.
* timer.cc (timer_tracker::hcancel): Rename from cancel.
(timer_tracker::cancel): New method.
(timer_tracker::th): Remove.
(timer_tracker::~timer_tracker): Call cancel method.
(timer_tracker::timer_tracker): Ditto.
(timer_tracker::timer_tracker): Always, clear cancel, even though it is
probably not strictly necessary for ttstart.
(timer_thread): Accommodate cancel -> hcancel rename.
(timer_tracker::settime): Ditto.
(timer_tracker::gettime): Ditto.
(timer_delete): Ditto.
* cygwin.din: Export _ctype_.
* include/ctype.h: Mark that _ctype_ is imported.
(wininfo::itv): Ditto.
(wininfo::start_time): Ditto.
(wininfo::window_started): Ditto.
(wininfo::getitimer): Ditto.
(wininfo::setitimer): Ditto.
(wininfo::wininfo): Ditto.
(wininfo::lock): New method.
(wininfo::release): Ditto.
* window.cc: Use new lock/acquire wininfo methods throughout.
(wininfo::wininfo): Delete
(wininfo::getitimer): Ditto.
(wininfo::setitimer): Ditto.
(getitimer): Ditto.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
(wininfo::lock): Define new function.
(wininfo::release): Ditto.
(wininfo::process): Delete WM_TIMER handling.
* timer.cc (struct timetracker): Delete it, flags. Add it_interval,
interval_us, sleepto_us, running, init_muto(), syncthread, and gettime().
(ttstart): Make NO_COPY.
(lock_timer_tracker): New class.
(timer_tracker::timer_tracker): Distinguish ttstart case.
(timer_tracker::~timer_tracker): New destructor. Clean out events, and reset
magic.
(timer_tracker::init_muto): New method.
(to_us): Round up as per POSIX.
(timer_thread): Reorganize to match timer_tracker::settime and
timer_tracker::gettime. Call sig_send without wait. Call auto_release.
(timer_tracker::settime): Reorganize logic to avoid race. Call gettime to
recover old value.
(timer_tracker::gettime): New method.
(timer_create): Properly set errno on invalid timerid. Use new
lock_timer_tracker method.
(timer_delete): Ditto. Simplify code slightly.
(timer_gettime): New function.
(fixup_timers_after_fork): Reinit ttstart.
(getitimer): New implementation.
(setitimer): Ditto.
(ualarm): Ditto.
(alarm): Ditto.
* cygwin.din: Export timer_gettime.
* winsup.h: Remove has has_visible_window_station declaration.
* Makefile.in (DLL_OFILES): Add lsearch.o.
* cygthread.h (cygthread::notify_detached): New element.
(cygthread::cygthread): Take optional fourth argument signifying event to
signal on thread completion.
* cygthread.cc (cygthread::stub): Signal notify_detached event, if it exists.
(cygthread::cygthread): Initialize notify_detached from fourth argument.
(cygthread::detach): Wait for notify_detached field is present.
* lsearch.cc: New file.
* search.h: Ditto.
* include/cygwin/version.h: Bump API minor number to 126.
* cygwin.din: Export lsearch, lfind.
(fhandler_socket::af_local_set_secret): New function combining former
set_connect_secret and get_connect_secret into one function.
(fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
(fhandler_socket::af_local_unsetblocking): Rename from
eid_unsetblocking.
(fhandler_socket::af_local_set_cred): New method.
(fhandler_socket::af_local_copy): New method.
(fhandler_socket::af_local_recv_secret): New method.
(fhandler_socket::af_local_send_secret): New method.
(fhandler_socket::af_local_recv_cred): Rename from eid_recv.
(fhandler_socket::af_local_send_cred): Rename from eid_send.
(fhandler_socket::af_local_accept): New method.
(fhandler_socket::af_local_set_sockpair_cred): Rename from
set_socketpair_eids.
(fhandler_socket::eid_accept): Remove.
(fhandler_socket::eid_connect): Remove.
(fhandler_socket::set_connect_secret): Remove.
(fhandler_socket::get_connect_secret): Remove.
(fhandler_socket::create_secret_event): Remove.
(fhandler_socket::check_peer_secret_event): Remove.
(fhandler_socket::signal_secret_event): Remove.
(fhandler_socket::close_secret_event): Remove.
(fhandler_socket::sec_event_accept): Remove.
(fhandler_socket::sec_event_connect): Remove.
* fhandler_socket.cc (secret_event_name): Remove.
(fhandler_socket::af_local_set_sockpair_cred): Rename from
set_socketpair_eids.
(fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
(fhandler_socket::af_local_unsetblocking): Rename from
eid_unsetblocking.
(fhandler_socket::af_local_recv_secret): New function to receive
AF_LOCAL connect secret over socket itself.
(fhandler_socket::af_local_send_secret): New function to send AF_LOCAL
connect secret over socket itself.
(fhandler_socket::af_local_recv_cred): Rename from eid_recv.
(fhandler_socket::af_local_send_cred): Rename from eid_send.
(fhandler_socket::eid_connect): Remove.
(fhandler_socket::af_local_connect): Take over connect side handling
of AF_LOCAL secret and credential handshake.
(fhandler_socket::eid_accept): Remove.
(fhandler_socket::af_local_accept): New method, take over accept side
handling of AF_LOCAL secret and credential handshake.
(fhandler_socket::af_local_set_cred): New method, set eid credentials
to start values.
(fhandler_socket::af_local_copy): New method, copy secret and
credentials to another socket.
(fhandler_socket::af_local_set_secret): New function combining former
set_connect_secret and get_connect_secret into one function.
(fhandler_socket::create_secret_event): Remove.
(fhandler_socket::signal_secret_event): Remove.
(fhandler_socket::close_secret_event): Remove.
(fhandler_socket::check_peer_secret_event): Remove.
(fhandler_socket::sec_event_connect): Remove.
(fhandler_socket::sec_event_accept): Remove.
(fhandler_socket::fixup_after_fork): Drop secret_event handling.
(fhandler_socket::bind): Call af_local_set_secret.
(fhandler_socket::connect): Call af_local_set_cred and af_local_connect.
(fhandler_socket::listen): Call af_local_set_cred.
(fhandler_socket::accept): Call af_local_copy and af_local_accept on
accepted socket.
(fhandler_socket::close): Don't call close_secret_event.
(fhandler_socket::set_close_on_exec): Don't set secret_event
inheritance.
* net.cc (cygwin_getsockopt): Add debug output.
(socketpair): Call af_local_set_sockpair_cred instead of
set_socketpair_eids.
* select.cc (set_bits): Drop AF_LOCAL special handling in case
of except bit set.