* fhandler_console.cc (fhandler_console::char_command): Save the cursor
position relative to the top of the window.
* fhandler_cc (fhandler_console::write): Ditto.
* 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.
* 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/winnt.h: Use defined(_ANONYMOUS_STRUCT) to determine if anonymous
structs are available rather than just testing preprocessor variable directly.
* 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.
* 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.
* 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.
Earnie Boyd [Thu, 30 Aug 2001 04:29:49 +0000 (04:29 +0000)]
* config.guess: Remove the \r from the end of line.
* config.sub: Ditto.
* include/winnt.h: Allow anonymous struct in [U]LARGE_INTEGER
if __cplusplus as well as if _ANONYMOUS_STRUCT.
* config.guess: Add the MSYS system.
* config.sub: Ditto.
* include/winsock.h: Add the __INSIDE_MSYS__ protections.
* incldue/winsock2.h: Ditto.
Jeff Johnston [Wed, 29 Aug 2001 19:47:43 +0000 (19:47 +0000)]
2001-08-29 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/reent.h: Add include of <sys/_types.h>.
No longer include time.h. Add struct __tm to use for
_localtime_buf in the reentrant structure. Add a
_NULL definition to use in initializing the reentrant struct.
* libc/include/sys/config.h: For CYGWIN32 and RTEMS, change
the _READ_WRITE_RETURN_TYPE to _ssize_t which is found in
<sys/_types.h>.
* libc/include/sys/unistd.h: Include <sys/_types.h>.
* libc/time/lcltime.c (localtime): Cast the reentrant struct
_localtime_buf to be struct tm *.
Earnie Boyd [Wed, 29 Aug 2001 13:45:46 +0000 (13:45 +0000)]
* include\winnt.h: Allow anonymous (Xxx.LowPart) or
non-anonymous (Xxx.u.LowPart) access to HighPart and
LowPart of a LARGE_INTEGER or ULARGE_INTEGER.
* include/wingdi.h (HANGUL_CHARSET): Add define.
* 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.