* 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.
* libc/machine/sh/Makefile.am (lib_a_SOURCES):
Make strcmp.S unconditional.
* libc/machine/sh/Makefile.in: Regenerate.
* libc/machine/sh/asm.h (DELAYED_BRANCHES, SL): Also for __SH5__ .
* strcmp.S (strcmp): Add SHmedia variant. Use different registers
for SHcompact.
* 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.
* 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.
Jeff Johnston [Thu, 4 Jul 2002 22:51:08 +0000 (22:51 +0000)]
2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/utime.h: Add include of <_ansi.h>.
* libc/sys/linux/Makefile.am: Add utimes.c.
* libc/sys/linux/Makefile.in: Regenerated.
* libc/sys/linux/inode.c(__umask): New static routine.
(umask): Written to use __umask and attempt to thread lock.
(getumask): New function written to use __umask and thread lock.
* libc/sys/linux/utimes.c: New file.
* libc/sys/linux/sys/time.h: Fix utimes prototype.
* libc/sys/linux/sys/utime.h: New file.
* 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.
* 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.
Jeff Johnston [Tue, 2 Jul 2002 18:18:58 +0000 (18:18 +0000)]
2002-07-02 Chris Demetriou <cgd@broadcom.com>
* libc/include/sys/config.h (__IEEE_LITTLE_ENDIAN)
(__IEEE_BIG_ENDIAN): Define appropriately for MIPS.
Check that one of them is defined and error out if not.
Add any platforms defined in <machine/ieeefp.h> that are missing.
* libc/search/hash.h (DB_BYTE_ORDER, DB_BIG_ENDIAN)
(DB_LITTLE_ENDIAN): New defines.
* libc/search/hash.c: Replace all incorrect checks for
_IEEE_LITTLE_ENDIAN with tests of BYTE_ORDER, and all uses of
BYTE_ORDER, LITTLE_ENDIAN, and BIG_ENDIAN with DB_* versions.
* libc/search/hash_page.c: Likewise.
* mkgroup.c: Add function pointers for functions from advapi32.dll.
(load_netapi): Load used functions from advapi32.dll.
(main): Use function pointers instead of statically linked functions
from advapi32.dll.
* 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.
* 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.
* 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.
* mount.cc (main): Ensure that mount_already_exists() also gets default flag
that is passed to do_mount.
* cygpath.cc (long_options): Add "dos" and "mixed", correct "close", "file" and
"type" to use NULL flag.
(usage): Clean up usage output (more), accomodate new options.
(main): Add --dos and --mixed options; accomodate all output forms in --type.
Make UNIXy output default.
* 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.
* 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.
* 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.
* 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.
Corinna Vinschen [Sun, 30 Jun 2002 13:08:59 +0000 (13:08 +0000)]
* 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.
* 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.
* 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.
* 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.
(spenv::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.
Jeff Johnston [Thu, 27 Jun 2002 22:48:05 +0000 (22:48 +0000)]
2002-06-27 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/_types.h: Define _ssize_t as int if int is
32-bits, otherwise define it as long.
* libc/include/sys/types.h: Include <_ansi.h> and <sys/_types.h>
and define ssize_t as _ssize_t.
* libc/reent/readr.c: Change return type to _ssize_t.
* libc/reent/writer.c: Ditto.
* libc/sys/linux/Makefile.am: Add aio.c.
* libc/sys/linux/Makefile.in: Regenerated.
* libc/sys/linux/aio.c: New file.
* libc/sys/linux/sys/cdefs.h: Add __restrict_arr definition.
* libm/common/fdlibm.h: Undef __P before defining it.
* libm/mathfp/s_pow.c (pow): Fix checks on variable k. Add
exponent_is_even_int variable. Handle case where x is
negative, and y is an odd integer.
* libm/mathfp/sf_pow.c (powf): Likewise.
Corinna Vinschen [Thu, 27 Jun 2002 16:01:38 +0000 (16:01 +0000)]
* 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.