* 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.
Corinna Vinschen [Fri, 24 Aug 2001 06:57:53 +0000 (06:57 +0000)]
* net.cc (free_addr_list): Add define for symmetry.
(free_hostent_ptr): Use free_addr_list to free h_addr_list element.
(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.
Jakub Jelinek [Thu, 23 Aug 2001 15:14:17 +0000 (15:14 +0000)]
* elf-bfd.h (enum elf_reloc_type_class): New.
(struct elf_backend_data): Add elf_backend_reloc_type_class.
(_bfd_elf_reloc_type_class): New.
* elfxx-target.h (elf_backend_reloc_type_class): Define.
(elfNN_bed): Add elf_backend_reloc_type_class.
* elf.c (_bfd_elf_reloc_type_class): New.
* elf32-i386.c (elf_i386_check_relocs): Set DF_TEXTREL if the reloc
is against read-only section.
(elf_i386_size_dynamic_sections): Use DF_TEXTREL flag instead of
looking up section names for DT_TEXTREL.
(elf_i386_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
* elf32-sparc.c (elf32_sparc_check_relocs): Set DF_TEXTREL if the
reloc is against read-only section.
(elf32_sparc_size_dynamic_sections): Use DF_TEXTREL flag instead of
looking up section names for DT_TEXTREL.
(elf32_sparc_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
* elf64-sparc.c (sparc64_elf_check_relocs): Set DF_TEXTREL if the
reloc is against read-only section.
(sparc64_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
looking up section names for DT_TEXTREL.
(sparc64_elf_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
* elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add reltext field.
(elfNN_ia64_hash_table_create): Clear ia64_info.
(get_reloc_section): Set DF_TEXTREL if the reloc is against read-only
section.
(elfNN_ia64_size_dynamic_sections): Use ia64_info->reltext flag
instead of looking up section names for DT_TEXTREL.
(elfNN_ia64_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
* elflink.h (size_dynamic_sections): Add spare DT_NULL tags.
(struct elf_link_sort_rela): New.
(elf_link_sort_cmp1, elf_link_sort_cmp2, elf_link_sort_relocs): New.
(elf_bfd_final_link): Call elf_link_sort_relocs.
Convert one spare DT_NULL into DT_RELCOUNT resp. DT_RELACOUNT if
necessary.
* bfdlink.h (struct bfd_link_info): Add combreloc and
spare_dynamic_tags fields.
* emultempl/elf32.em (place_orphan): Place orphan .rel* sections
into .rel.dyn resp. .rela.dyn if combreloc.
(get_script): If .x linker script is equal to .xn, only put it
once into the binary.
Add .xc and .xsc scripts.
(parse_args): Handle -z combreloc and -z nocombreloc.
* scripttempl/elf.sc (.rela.sbss): Fix a typo.
For .xc and .xsc scripts put all .rel* or .rela* input sections
but .rel*.plt and PLT-like sections into .rel.dyn resp. .rela.dyn.
* genscripts.sh (GENERATE_COMBRELOC_SCRIPT): Set if SCRIPT_NAME
is elf.
Strip trailing whitespace from script.
Generate .xc and .xsc scripts if requested.
* ldmain.c (main): Initialize link_info.combreloc and
link_info.spare_dynamic_tags.
* lexsup.c (OPTION_SPARE_DYNAMIC_TAGS): Define.
(ld_options): Add --spare-dynamic-tags option.
(parse_args): Likewise.
* ld.texinfo: Document -z combreloc and -z nocombreloc.
* ldint.texinfo: Document .xc and .xsc linker scripts.
* NEWS: Add notes about -z combreloc and SHF_MERGE.
* 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.
Egor Duda [Thu, 16 Aug 2001 14:34:27 +0000 (14:34 +0000)]
* 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.
Corinna Vinschen [Thu, 16 Aug 2001 14:29:21 +0000 (14:29 +0000)]
* 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.
Corinna Vinschen [Wed, 15 Aug 2001 10:21:39 +0000 (10:21 +0000)]
* 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.
Corinna Vinschen [Tue, 14 Aug 2001 07:41:45 +0000 (07:41 +0000)]
* 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.
Earnie Boyd [Fri, 10 Aug 2001 11:51:03 +0000 (11:51 +0000)]
* lib/test.c (Win32_Winsock): Replace with __USE_W32_SOCKETS.
Add more includes of w32api headers.
* include/winnt.h (GetCurrentFiber): Change __inline to __inline__.
Swap asm code with that of GetFiberData.
(GetFiberData): Ditto.
* lib/kernels.c: New file, containing library versions of
GetCurrentFiber and GetFiberData.
* lib/makefile.in: Add kernel32.o as static object to libkernal32.a.
* 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.
* 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'.
* 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.
* fhandler_console.cc (get_tty_stuff): Don't initialize shared memory console
area if it is already initialized.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Augment debugging info.
* cygheap.cc (cygheap_root::set): Avoid treating '/' specially.
* 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.
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.
* 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.
* dcrt0.cc (alloc_stack_hard_way): Make half-hearted attempt to deal with
growing stack under Windows 95.
* Makefile.in: Add install-lib and install-headers.
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.
* 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.
* thread.cc (verifyable_object_isvalid): Don't validate
PTHREAD_MUTEX_INITIALIZER pointer as it will cause an exception
in IsBadWritePtr() when running GDB.
* 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.
* 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.
* spawn.cc (spawn_guts): Ditto.
* 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.
* 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.
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'.
* 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.
* some support for funny-endian 16/32-bit insn sets
[cgen/ChangeLog]
2001-07-11 Frank Ch. Eigler <fche@redhat.com>
* desc-cpu.scm (-gen-mach-table-defns): Emit fourth field: the
mach->cpu insn-chunk-bitsize.
(-gen-cpu-open): In @arch@_cgen_rebuild_tables, process above new
field toward CGEN_CPU_TABLE->insn_chunk_bitsize.
* mach.scm (<cpu>): New field insn-chunk-bitsize.
(-cpu-parse, -cpu-read): Parse/initialize it.
* doc/rtl.texi (define-cpu): Document it.
[opcodes/ChangeLog]
2001-07-11 Frank Ch. Eigler <fche@redhat.com>
* cgen-dis.in (print_insn): Use cgen_get_insn_value instead of
bfd_get_bits.
* cgen-opc.c (cgen_get_insn_value, cgen_put_insn_value): Respect
non-zero CGEN_CPU_DESC->insn_chunk_bitsize.
[include/opcode/ChangeLog]
2001-07-11 Frank Ch. Eigler <fche@redhat.com>
* 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.