* fhandler.h (dirent_valid_fd): Drop.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): If opening a
real dir, use the underlying fhandler to keep track of the directory
handle. In fdopendir case use original io_handle from fhandler. Use
fhandler's io_handle in subsequent directory functions throughout.
Create handle non-inheritable and set close-on-exec flag.
(readdir_get_ino): Drop dirent_isroot case.
(fhandler_disk_file::readdir): Handle dirent_isroot case here.
(fhandler_disk_file::rewinddir): Revert change from 2007-07-05. Use
NtClose instead of CloseHandle.
* fhandler_virtual.cc (fhandler_virtual::opendir): Drop adding
dirent_valid_fd flag. Set close-on-exec flag.
libiberty.
* random.cc: Import from FreeBSD. Modify for Cygwin environment.
* include/cygwin/stdlib.h (random): Reflect change in return value to be more
linux/freebsd-like.
(srandom): Ditto.
* dir.cc (opendir): Call fhandler's opendir with fd set to -1.
(fdopendir): New function.
(seekdir64): Use dirent_info_mask.
(rewinddir): Ditto.
(closedir): Only release underlying file descriptor if it has been
reserved by opendir itself.
* fhandler.cc (fhandler_base::opendir): Accommodate new parameter.
* fhandler.h (dirent_states): Add dirent_valid_fd and dirent_info_mask.
(fhander_XXX::opendir): Add file descriptor parameter. Use regparms.
(fhandler_procnet::opendir): Drop declaration.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto.
If called from fdopendir, use existing handle to re-open directory
with valid flags. Rename fd to cfd. Use only if no valid incoming fd.
(fhandler_cygdrive::opendir): Accommodate new parameter.
* fhandler_process.cc (fhandler_process::opendir): Ditto.
* fhandler_procnet.cc (fhandler_procnet::opendir): Drop definition.
* fhandler_virtual.cc (fhandler_virtual::opendir): Accommodate new
parameter. Only create new file descriptor entry if called from
opendir. Remove duplicated setting of dir->__flags.
* posix.sgml: Add fdopendir to list of implemented Solaris functions.
* include/cygwin/version.h: Bump API minor number.
* include/sys/dirent.h: Declare fdopendir.
Exclude _ctype stub if using msvcr71.dll or newer.
* include/ctype.h: Don't declare _ctype if using msvcr71.dll or newer.
* include/wctype.h: Likewise.
(CURR_SHARED_MAGIC): Ditto.
(class shared_info): Add heap_slop_inited member.
* shared.cc (shared_info::heap_slop_size): Use heap_slop_inited to
track initializing heap_slop since 0 is a valid value for heap_slop.
Drop useless < 0 consideration.
* cygwin.din: Export freeifaddrs, getifaddrs.
* fhandler_socket.cc (fhandler_socket::ioctl): Drop SOCKET parameter
from get_ifconf.
* net.cc: Include ifaddrs.h.
(in_are_prefix_equal): Match addresses in network byte order.
(ip_addr_prefix): Convert address into host byte order before
testing with IN_LOOPBACK.
(struct ifall): Define.
(get_xp_ifs): Replace get_xp_ifconf. Return struct ifall array.
(get_2k_ifs): Ditto, replace get_2k_ifconf.
(get_nt_ifs): Ditto, replace get_nt_ifconf.
(getifaddrs): New function.
(freeifaddrs): New function.
(get_ifconf): Call matching get_XX_ifs function and create
ifc content from here. Drop lo fake since it's now in get_nt_ifs.
* posix.sgml: Add freeifaddrs and getifaddrs to list of implemented
BSD functions.
* wincap.h (wincapc::has_broken_if_oper_status): New element.
* wincap.cc: Implement above element throughout.
* include/ifaddrs.h: New file.
* include/cygwin/version.h: Bump API minor number.
* cygwin.din (confstr): Make NOSIGFE.
(insque): Export.
(remque): Export.
* lsearch.cc: Remove superfluous _SEARCH_PRIVATE define.
* posix.sgml: Move insque to defined SUSv3 interfaces. Remove
comment for remque.
* include/search.h: Remove _SEARCH_PRIVATE guarded definitions.
Add struct qelem definition. Add insque and remque declarations.
* include/cygwin/version.h: Bump API minor number.
* include/sys/queue.h: Remove insque/remque definitions so as not
to collide with SUSv3 compatible declaration in search.h.
* libc/xsique.cc: New file implementing insque and remque.