Cygwin: add AF_UNIX reparse points to path handling
* check_reparse_point_target returns a path flag mask, rather than
just 1. Return PATH_SYMLINK | PATH_REP for symlinks and directory
mount points, PATH_SOCKET | PATH_REP for AF_UNIX sockets.
* Define Cygwin AF_UNIX socket reparse tag and GUID in ntdll.h.
Corinna Vinschen [Mon, 26 Feb 2018 19:39:48 +0000 (20:39 +0100)]
Cygwin: reduce size of fhandler_cygdrive
fhandler_cygdrive has a size of 696 bytes on x86_64, while the next
biggest fhandler type, fhandler_pty_master, is 584 bytes. The members
responsible for the size are private to opendir/readdir/closedir usage.
fhandler_disk_file stores private readdir data in DIR->__d_internal
instead. Use equivalent method with fhandler_cygdrive. This drops
the size to 464 bytes.
Corinna Vinschen [Fri, 23 Feb 2018 14:24:18 +0000 (15:24 +0100)]
Cygwin: encapsulate Winsock based fhandler_socket classes
Insert another class fhandler_socket_wsock between fhandler_socket
and fhandler_socket_inet/fhandler_socket_local.
Also, add a new method fhandler::is_wsock_socket to allow asking
for sockets in general (is_socket) vs. Winsock-based sockets
(is_wsock_socket).
This allows to develop a new handler_socket_unix class as derived
class from fhandler_socket without any trace of wsock code left
in fhandler_socket.
While this is basically a temporary measure at this time, it may
prove useful for later interoperability with the upcoming Windows 10
AF_UNIX implementation at one point.
Corinna Vinschen [Fri, 23 Feb 2018 12:32:51 +0000 (13:32 +0100)]
Cygwin: drop unused device nodes and clean up socket devices
* Rename DEV_TCP_MAJOR to DEV_SOCK_MAJOR
* Drop FH_TCP, FH_UDP, FH_ICMP in favor of single FH_INET
* Drop FH_UNIX, FH_STREAM, FH_DGRAM in favor of single FH_LOCAL
Corinna Vinschen [Wed, 21 Feb 2018 20:40:01 +0000 (21:40 +0100)]
Cygwin: split out fhandler_socket into inet and local classes
First cut, still incomplete
* fhandler_socket is now base class for other socket classes
* fhandler_socket_inet handles AF_INET and AF_INET6 sockets
* fhandler_socket_local handles AF_LOCAL/AF_UNIX sockets
* finally get rid of fdsock by using set_socket_handle in accept4
* align file-related calls (fstat, fstatvfs, fchown, fchmod, facl)
to Linux.
Corinna Vinschen [Tue, 20 Feb 2018 16:59:45 +0000 (17:59 +0100)]
Cygwin: clean error mapping
- Move definition of windows to POSIX error mapping struct into
cygerrno.h
- Move declaration of winsock errno functions to cygerrno.h
- Input to error mapping functions is DWORD
Corinna Vinschen [Wed, 14 Feb 2018 21:21:58 +0000 (22:21 +0100)]
Cygwin: socket: move socket creation inside fhandler_socket class
Add fhandler_socket::socket method
Add fhandler_socket::set_socket_handle method, basically duplicating
what fdsock is doing. This is the first step in getting rid of fdsock.
Corinna Vinschen [Wed, 14 Feb 2018 11:55:24 +0000 (12:55 +0100)]
Cygwin: improve O_TMPFILE handling
Windows does not remove FILE_ATTRIBUTE_TEMPORARY by itself after a
file has been closed. It's just some attribute which can be set or
removed at will, despite its purpose.
Apparently there are tools out there which use FILE_ATTRIBUTE_TEMPORARY
accidentally or wrongly, even Microsoft's own tools are affected. In
the end, the filesystem is potentially full of files with this attribute
set.
Implement O_TMPFILE files with FILE_ATTRIBUTE_TEMPORARY and
FILE_ATTRIBUTE_HIDDEN set. This combination is pretty unlikely.
* Redefine NSPERSEC to NS100PERSEC
* Define NSPERSEC as nanosecs per second
* Define USPERSEC as microsecs per second
* Use above constants throughout where appropriate
* Rename to_us to timespec_to_us and inline
* Rename it_bad to timespec_bad and inline
Rearrange setsockopt/getsockopt into per level/per optname
preprocessing switch, actual call, per level/per optname
postprocessing switch for better readability as well as
extensibility.
Cygwin: bindresvport: check correctness of address family
Assuming the address parameter is non-NULL, the test in
cygwin_bindresvport_sa only tests if the address family is
supported at all, which is insufficient.
Check if the incoming address family matches the socket
address family and for being AF_INET in cygwin_bindresvport
since the latter doesn't support any other family.
Disable powf/log2?f/exp2?f optimization for single-precision Arm FPU
New optimized powf, logf, log2f, expf and exp2f yield worse performance
on Arm targets with only single precision instructions because the
double precision arithmetic is then implemented via softfloat routines.
This patch uses the old implementation when double precision
instructions are not available on Arm targets.
Testing: Built newlib with GCC's rmprofile Arm multilibs and compared
before/after -> only the above functions are changed and calls to them
(name change from logf to __ieee754_logf and similar). Testing the
changed function on a panel of values yields the same result before the
original patches to improve them and after this one. Double checking the
performance by looping the same panel of values being tested on Arm
Cortex-M4 does show the performance regression is fixed.
Mark Geisert [Wed, 24 Jan 2018 08:34:23 +0000 (00:34 -0800)]
Define internal function mythreadname() -- revised
This new function returns the name of the calling thread; works for both
cygthreads and pthreads. All calls to cygthread::name(/*void*/) replaced
by calls to mythreadname(/*void*/).
Orlando Arias [Fri, 19 Jan 2018 16:45:01 +0000 (11:45 -0500)]
Fix syntax error in exit.c
This patch fixes a syntax error in exit.c that was introduced during the
ANSI-fication of newlib. The patch fixes a compile-time issue that arises when
newlib is configured with the --enable-lite-exit feature.
Yaakov Selkowitz [Tue, 16 Jan 2018 03:19:59 +0000 (21:19 -0600)]
cygwin: make <sys/socket.h> completely visible from <netinet/in.h>
While POSIX mandates that certain socket types shall be defined by the
inclusing of <netinet/in.h>, it also says that this header may also make
visible all <sys/socket.h> symbols. Glibc does this, and without out it,
some packages end up requiring an additional #include <sys/socket.h>.
Yaakov Selkowitz [Fri, 19 Jan 2018 18:06:00 +0000 (12:06 -0600)]
cygwin: remove inclusion of <sys/time.h> from <sys/socket.h>
POSIX does not mention the inclusion of <sys/time.h> in <sys/socket.h>
or <netinet/in.h>, nor is there anything in the latter two that would
require the former.