]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
6 years agoCygwin: Define FSCTL_PIPE_FLUSH
Corinna Vinschen [Wed, 7 Mar 2018 20:54:46 +0000 (21:54 +0100)]
Cygwin: Define FSCTL_PIPE_FLUSH

This fsctl might come in handy at one point...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: Implement read, readv, recvfrom, write, writev, sendto
Corinna Vinschen [Wed, 7 Mar 2018 20:53:56 +0000 (21:53 +0100)]
Cygwin: AF_UNIX: Implement read, readv, recvfrom, write, writev, sendto

All of these functions just call recvfrom/sendmsg which are still TODO

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: reorder read/write calls in fhandler_socket_unix
Corinna Vinschen [Wed, 7 Mar 2018 20:52:29 +0000 (21:52 +0100)]
Cygwin: reorder read/write calls in fhandler_socket_unix

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: fix accept behaviour
Corinna Vinschen [Wed, 7 Mar 2018 15:23:44 +0000 (16:23 +0100)]
Cygwin: AF_UNIX: fix accept behaviour

* Use correct cygwait/WFSO invocation to not die on cancel and signals
  uncontrolled.
* Manage io handles under io_lock.
* Copy peer address to user space under SEH to avoid a resource leak.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: make sure connect wait thread is cleanly interruptible
Corinna Vinschen [Wed, 7 Mar 2018 15:19:32 +0000 (16:19 +0100)]
Cygwin: AF_UNIX: make sure connect wait thread is cleanly interruptible

Using TerminateThread potentially leaks resources.  In our case,
the connect wait thread may be forcefully terminated after
having successfully opened a client side pipe handle.  If this
occurs, we have a stale pipe server instance, so the pipe will
never be closed as long as the process lives.

Avoid this by changing the npfs handle to non-blocking, so we can
wait on a termination event object from inside the thread itself
and cleanly exit from the thread instead of terminating.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: some pipe errors may have multiple status codes
Corinna Vinschen [Wed, 7 Mar 2018 15:12:55 +0000 (16:12 +0100)]
Cygwin: AF_UNIX: some pipe errors may have multiple status codes

Depending on the exact circumstances, some erros are indicated
by different status codes.  Add helper macros to handle them
together.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: fix SEGV when sending an empty socket name from connect
Corinna Vinschen [Wed, 7 Mar 2018 15:08:15 +0000 (16:08 +0100)]
Cygwin: AF_UNIX: fix SEGV when sending an empty socket name from connect

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: fix creation of npfs handle
Corinna Vinschen [Wed, 7 Mar 2018 14:48:21 +0000 (15:48 +0100)]
Cygwin: AF_UNIX: fix creation of npfs handle

The handle to the device is never needed.  As the name impies,
FSCTL_PIPE_WAIT works on the file system, not on the device level.

Drop opening the device and make sure to open only one handle to NPFS.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: Add create_event helper and use throughout
Corinna Vinschen [Wed, 7 Mar 2018 15:00:36 +0000 (16:00 +0100)]
Cygwin: AF_UNIX:  Add create_event helper and use throughout

Minimize overhead in creating a nameless event object.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: fix comments and move a macro
Corinna Vinschen [Wed, 7 Mar 2018 14:43:26 +0000 (15:43 +0100)]
Cygwin: AF_UNIX: fix comments and move a macro

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: Implement listen, accept4, connect, and others
Corinna Vinschen [Tue, 6 Mar 2018 17:55:03 +0000 (18:55 +0100)]
Cygwin: AF_UNIX: Implement listen, accept4, connect, and others

* Implement helper functions
* Improve bind
* Implement setting blocking, ioctl(FIONBIO), fcntl(F_SETFL)
* Implement close_on_exec and fixup_after_fork
* Allow overriding sun_path and peer_sun_path
* Improve comments

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: fix a couple of thinkos and typos
Corinna Vinschen [Tue, 6 Mar 2018 17:42:12 +0000 (18:42 +0100)]
Cygwin: AF_UNIX: fix a couple of thinkos and typos

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: create/open pipes relativ to NPFS rootdir handle
Corinna Vinschen [Tue, 6 Mar 2018 17:37:09 +0000 (18:37 +0100)]
Cygwin: AF_UNIX: create/open pipes relativ to NPFS rootdir handle

Only store and manipulate pipe basename.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: initialize rmem/wmem to 256K and use in pipe creation
Corinna Vinschen [Tue, 6 Mar 2018 17:28:15 +0000 (18:28 +0100)]
Cygwin: AF_UNIX: initialize rmem/wmem to 256K and use in pipe creation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: ntdll.h: Add some missing pipe-related definitions
Corinna Vinschen [Tue, 6 Mar 2018 17:24:13 +0000 (18:24 +0100)]
Cygwin: ntdll.h: Add some missing pipe-related definitions

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sys/socket.h: define MSG_CMSG_CLOEXEC
Corinna Vinschen [Tue, 6 Mar 2018 17:23:48 +0000 (18:23 +0100)]
Cygwin: sys/socket.h: define MSG_CMSG_CLOEXEC

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: export hires counter ntod
Corinna Vinschen [Tue, 6 Mar 2018 17:23:23 +0000 (18:23 +0100)]
Cygwin: export hires counter ntod

Needed it new AF_UNIX socket code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoRTEMS: Use int for _CLOCKID_T_
Sebastian Huber [Thu, 8 Feb 2018 12:02:41 +0000 (13:02 +0100)]
RTEMS: Use int for _CLOCKID_T_

Linux and FreeBSD use int as well.  In addition, this fixes an Ada
incompatiblity problem on 64-bit targets.  See also GCC:

  gcc/ada/libgnarl/s-osinte__rtems.ads

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoMake _CLOCKID_T_ system configurable
Sebastian Huber [Thu, 8 Feb 2018 12:00:42 +0000 (13:00 +0100)]
Make _CLOCKID_T_ system configurable

Let systems optionally provide the _CLOCKID_T_ type via
<machine/_types.h>.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
6 years agoCygwin: move sun_name_t constructors into fhandler_socket_unix.cc
Corinna Vinschen [Mon, 5 Mar 2018 17:08:47 +0000 (18:08 +0100)]
Cygwin: move sun_name_t constructors into fhandler_socket_unix.cc

They are only used there anyway and it allows to use the AF_UNIX
macro without tweaking header files.  While at it, improve
both constructors.  The default constructor now creates the name
of an unnamed socket, the constructor taking parameters carefully
checks its input.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sockets: add bind state, and split out connect state to allow atomic operation
Corinna Vinschen [Mon, 5 Mar 2018 16:59:04 +0000 (17:59 +0100)]
Cygwin: sockets: add bind state, and split out connect state to allow atomic operation

The connect state was stored in a bitfield which is not safe
to do atomic operations on.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: drop debug_printf statement from start_transaction
Corinna Vinschen [Mon, 5 Mar 2018 16:50:52 +0000 (17:50 +0100)]
Cygwin: drop debug_printf statement from start_transaction

start_transaction is now defined in ntdll.h and we can't rely
on debug_printf being available

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: cygwait.cc: fix formatting of debug statement
Corinna Vinschen [Mon, 5 Mar 2018 16:49:50 +0000 (17:49 +0100)]
Cygwin: cygwait.cc: fix formatting of debug statement

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoLocale modifier @cjkwide to adjust ambiguous-width in non-CJK locales
Thomas Wolff [Fri, 2 Mar 2018 19:21:09 +0000 (20:21 +0100)]
Locale modifier @cjkwide to adjust ambiguous-width in non-CJK locales

Locale modifier @cjkwide makes Unicode "ambiguous width" characters
wide.  So ambiguous width characters can be enforced to have width 2
even in non-CJK locales. This gives e.g. users of "Powerline symbols"
the opportunity to adjust their width to the desired behaviour (and the
behaviour apparently expected by some tools) without having to set a CJK
locale and without losing consistence of terminal character width with
wcwidth/wcswidth locale width.

6 years agoCygwin: AF_UNIX: drop try/except block in bind method
Corinna Vinschen [Fri, 2 Mar 2018 22:40:36 +0000 (23:40 +0100)]
Cygwin: AF_UNIX: drop try/except block in bind method

The caller already does it anyway.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: AF_UNIX: create pipes with file attribute R/W access
Corinna Vinschen [Fri, 2 Mar 2018 22:39:15 +0000 (23:39 +0100)]
Cygwin: AF_UNIX: create pipes with file attribute R/W access

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: accept4: Fix resource leak
Corinna Vinschen [Fri, 2 Mar 2018 22:33:05 +0000 (23:33 +0100)]
Cygwin: accept4: Fix resource leak

The new implementation neglected to release the file descriptor
in case of error.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: remove outdated comment
Corinna Vinschen [Fri, 2 Mar 2018 17:22:45 +0000 (18:22 +0100)]
Cygwin: remove outdated comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket_unix: implement socket, bind, and close
Corinna Vinschen [Fri, 2 Mar 2018 17:14:11 +0000 (18:14 +0100)]
Cygwin: fhandler_socket_unix: implement socket, bind, and close

...plus lots of helper functions.  Add comment to explain how everything
works.  This comment will be improved while implementing the yet missing
parts.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: add transform_chars_af_unix helper
Corinna Vinschen [Fri, 2 Mar 2018 17:11:57 +0000 (18:11 +0100)]
Cygwin: add transform_chars_af_unix helper

This function is going to be used for transposing sun_path of
abstract sockets.  This also adds a transposition of the NUL
character to tfx_chars since NUL-bytes in abstract socket names
are perfectly valid.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: small_s[w]printf: add '_' modifier to print lower case hex digits
Corinna Vinschen [Fri, 2 Mar 2018 17:09:35 +0000 (18:09 +0100)]
Cygwin: small_s[w]printf: add '_' modifier to print lower case hex digits

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: drop CYGWIN_SOCKET_UUID, define CYGWIN_SOCKET_GUID as GUID pointer
Corinna Vinschen [Fri, 2 Mar 2018 17:07:39 +0000 (18:07 +0100)]
Cygwin: drop CYGWIN_SOCKET_UUID, define CYGWIN_SOCKET_GUID as GUID pointer

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: ntdll.h: add definitions required for pipe-based AF_UNIX
Corinna Vinschen [Fri, 2 Mar 2018 17:03:11 +0000 (18:03 +0100)]
Cygwin: ntdll.h: add definitions required for pipe-based AF_UNIX

Also remove redundant declaration of RtlInitEmptyUnicodeString

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoAdd global stdio streams support for reent small.
Our Air Quality [Wed, 28 Feb 2018 12:31:48 +0000 (23:31 +1100)]
Add global stdio streams support for reent small.

6 years agoCygwin: convert sun_name_t into class
Corinna Vinschen [Thu, 1 Mar 2018 17:14:23 +0000 (18:14 +0100)]
Cygwin: convert sun_name_t into class

Add constructors and new/delete operators to make sure sun_name_t
objects are allocated on the cygheap.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: add AF_UNIX reparse points to path handling
Corinna Vinschen [Thu, 1 Mar 2018 15:54:57 +0000 (16:54 +0100)]
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: move transaction helpers into ntdll.h
Corinna Vinschen [Thu, 1 Mar 2018 15:51:12 +0000 (16:51 +0100)]
Cygwin: move transaction helpers into ntdll.h

We'll need them elsewhere in future.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de
6 years agoCygwin: ntdll.h: drop macros available in mingw-w64 headers
Corinna Vinschen [Thu, 1 Mar 2018 15:50:41 +0000 (16:50 +0100)]
Cygwin: ntdll.h: drop macros available in mingw-w64 headers

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: path.cc: clean up includes
Corinna Vinschen [Thu, 1 Mar 2018 15:44:09 +0000 (16:44 +0100)]
Cygwin: path.cc: clean up includes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: path_conv: rename is_rep_symlink to is_known_reparse_point
Corinna Vinschen [Thu, 1 Mar 2018 15:41:45 +0000 (16:41 +0100)]
Cygwin: path_conv: rename is_rep_symlink to is_known_reparse_point

...in preparation of reusing this flag for other types of
reparse points, not only symlinks.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: improve storage and handling of AF_UNIX socket path
Corinna Vinschen [Wed, 28 Feb 2018 18:06:41 +0000 (19:06 +0100)]
Cygwin: improve storage and handling of AF_UNIX socket path

Define new struct sun_name_t and use throughout internally.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket_unix: store peer credentials in ucred member
Corinna Vinschen [Wed, 28 Feb 2018 18:01:29 +0000 (19:01 +0100)]
Cygwin: fhandler_socket_unix: store peer credentials in ucred member

* Split out cygwin/_ucred.h file
* drop local credentials

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: cleanup header including within network-releated files
Corinna Vinschen [Wed, 28 Feb 2018 17:56:13 +0000 (18:56 +0100)]
Cygwin: cleanup header including within network-releated files

* Rearrange includes and drop unneccessary ones.

* Don't pull in cygwin/socket.h into sys/un.h just to get
  sa_family_t.  Include sys/types.h and use __sa_family_t instead.

* start including Windows headers using the w32api/ path prefix

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sockets: Fix fstat on unnamed sockets
Corinna Vinschen [Tue, 27 Feb 2018 14:30:00 +0000 (15:30 +0100)]
Cygwin: sockets: Fix fstat on unnamed sockets

Calling fhandler_socket::fstat from fhandler_socket::fstat recursively
is not a good idea...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: reduce size of fhandler_cygdrive newlib-snapshot-20180226
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sockets: Add missing cleanup if socket/socketpair creation fails
Corinna Vinschen [Mon, 26 Feb 2018 17:02:36 +0000 (18:02 +0100)]
Cygwin: sockets: Add missing cleanup if socket/socketpair creation fails

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket_unix: Tiny cleanup
Corinna Vinschen [Mon, 26 Feb 2018 16:58:46 +0000 (17:58 +0100)]
Cygwin: fhandler_socket_unix: Tiny cleanup

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sockets: move type and proto checks into fhandler_socket classes
Corinna Vinschen [Mon, 26 Feb 2018 16:56:47 +0000 (17:56 +0100)]
Cygwin: sockets: move type and proto checks into fhandler_socket classes

Encapsulation required

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: define socketpair as virtual function
Corinna Vinschen [Mon, 26 Feb 2018 16:53:50 +0000 (17:53 +0100)]
Cygwin: fhandler_socket: define socketpair as virtual function

...in preparation of moving the type and protocol test into the
actual classes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agodoc/faq-using.xml: Add BeyondTrust and Cylance to BLODA
David Macek [Fri, 23 Feb 2018 13:22:44 +0000 (14:22 +0100)]
doc/faq-using.xml: Add BeyondTrust and Cylance to BLODA

Cylance:
- https://github.com/git-for-windows/git/issues/1244
- https://cygwin.com/ml/cygwin/2017-04/msg00238.html

BeyondTrust:
- https://cygwin.com/ml/cygwin/2017-04/msg00092.html
- https://cygwin.com/ml/cygwin/2017-05/msg00422.html

6 years agoCygwin: Define SO_PASSCRED and SCM_CREDENTIALS
Corinna Vinschen [Fri, 23 Feb 2018 20:00:17 +0000 (21:00 +0100)]
Cygwin: Define SO_PASSCRED and SCM_CREDENTIALS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Create empty fhandler_socket_unix
Corinna Vinschen [Fri, 23 Feb 2018 19:59:21 +0000 (20:59 +0100)]
Cygwin: Create empty fhandler_socket_unix

* Make distinct from AF_LOCAL for testing purposes.  This will have
  to be reverted as soon as fhandler_socket_unix goes life.

* Move saw_reuseaddr flag back to fhandler_socket status

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix upcalls in some fhandler_socket_local methods
Corinna Vinschen [Fri, 23 Feb 2018 19:59:55 +0000 (20:59 +0100)]
Cygwin: fix upcalls in some fhandler_socket_local methods

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Introduce FH_SOCKET for generic socket file ops
Corinna Vinschen [Fri, 23 Feb 2018 18:45:59 +0000 (19:45 +0100)]
Cygwin: Introduce FH_SOCKET for generic socket file ops

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: encapsulate Winsock based fhandler_socket classes
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: eliminate unused fhandler method hclose
Corinna Vinschen [Fri, 23 Feb 2018 13:56:30 +0000 (14:56 +0100)]
Cygwin: eliminate unused fhandler method hclose

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix fhandler_socket_local::fchmod
Corinna Vinschen [Fri, 23 Feb 2018 12:34:08 +0000 (13:34 +0100)]
Cygwin: fix fhandler_socket_local::fchmod

Rather than just returning 0, return the result of calling
the base class fchmod.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: socket.h: Add SIOCINQ, equivalent to FIONREAD
Corinna Vinschen [Fri, 23 Feb 2018 12:33:23 +0000 (13:33 +0100)]
Cygwin: socket.h: Add SIOCINQ, equivalent to FIONREAD

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: drop unused device nodes and clean up socket devices
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

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: Move select functions into derived classes
Corinna Vinschen [Thu, 22 Feb 2018 15:59:55 +0000 (16:59 +0100)]
Cygwin: fhandler_socket: Move select functions into derived classes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: Rearrange methods
Corinna Vinschen [Thu, 22 Feb 2018 15:54:08 +0000 (16:54 +0100)]
Cygwin: fhandler_socket: Rearrange methods

Follow the same pattern in all fhandler_socket classes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: Add derived fcntl methods
Corinna Vinschen [Thu, 22 Feb 2018 15:37:12 +0000 (16:37 +0100)]
Cygwin: fhandler_socket: Add derived fcntl methods

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: Add derived ioctl methods
Corinna Vinschen [Thu, 22 Feb 2018 15:30:08 +0000 (16:30 +0100)]
Cygwin: fhandler_socket: Add derived ioctl methods

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: Move shutdown and close methods into derived classes
Corinna Vinschen [Thu, 22 Feb 2018 15:28:14 +0000 (16:28 +0100)]
Cygwin: fhandler_socket: Move shutdown and close methods into derived classes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: make socketpair an AF_LOCAL-only method
Corinna Vinschen [Thu, 22 Feb 2018 15:25:28 +0000 (16:25 +0100)]
Cygwin: make socketpair an AF_LOCAL-only method

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agodoc/ntsec.xml: Fix typo
David Macek [Wed, 21 Feb 2018 17:09:47 +0000 (18:09 +0100)]
doc/ntsec.xml: Fix typo

6 years agoCygwin: inline get_socket_flags()
Corinna Vinschen [Wed, 21 Feb 2018 21:00:04 +0000 (22:00 +0100)]
Cygwin: inline get_socket_flags()

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix whitespaces in socket code
Corinna Vinschen [Wed, 21 Feb 2018 20:43:44 +0000 (21:43 +0100)]
Cygwin: fix whitespaces in socket code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: split out fhandler_socket into inet and local classes
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: net.cc: drop redundant declarations
Corinna Vinschen [Tue, 20 Feb 2018 17:14:57 +0000 (18:14 +0100)]
Cygwin: net.cc: drop redundant declarations

Replace cygwin_inet_aton call with cygwin_inet_pton

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: set/getsockopt: Move implementation into fhandler_socket class
Corinna Vinschen [Tue, 20 Feb 2018 17:01:40 +0000 (18:01 +0100)]
Cygwin: set/getsockopt: Move implementation into fhandler_socket class

This requires to export find_winsock_errno from net.cc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: clean error mapping
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

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Make sure fraction of seconds constants enforce 64 bit computation
Corinna Vinschen [Tue, 20 Feb 2018 14:05:23 +0000 (15:05 +0100)]
Cygwin: Make sure fraction of seconds constants enforce 64 bit computation

Dropping the 'LL' specifier leads to 32 bit truncation during timestamp
computation.  Revert it.  Exempt MSPERSEC which is used for 32 bit values.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix declaration of fhandler_socket::socketpair
Corinna Vinschen [Fri, 16 Feb 2018 16:34:57 +0000 (17:34 +0100)]
Cygwin: fix declaration of fhandler_socket::socketpair

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix utils path handling in case cygdrive path is just '/'
Corinna Vinschen [Fri, 16 Feb 2018 16:21:48 +0000 (17:21 +0100)]
Cygwin: fix utils path handling in case cygdrive path is just '/'

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: net: Improve standars conformance comments
Corinna Vinschen [Fri, 16 Feb 2018 15:57:24 +0000 (16:57 +0100)]
Cygwin: net: Improve standars conformance comments

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fhandler_socket: Add :: to potentially colliding WinSock calls
Corinna Vinschen [Fri, 16 Feb 2018 15:41:42 +0000 (16:41 +0100)]
Cygwin: fhandler_socket: Add :: to potentially colliding WinSock calls

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: socketpair: Move socketpair creation inside fhandler_socket class
Corinna Vinschen [Fri, 16 Feb 2018 15:36:19 +0000 (16:36 +0100)]
Cygwin: socketpair: Move socketpair creation inside fhandler_socket class

Add fhandler_socket::socketpair method

Deliberately disable AF_INET socketpairs for now

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sockets: move common settings into set_socket_handle()
Corinna Vinschen [Fri, 16 Feb 2018 15:23:32 +0000 (16:23 +0100)]
Cygwin: sockets: move common settings into set_socket_handle()

Move setting address family, socket type and descriptor flags
into fhandler_socket::set_socket_handle method.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoadd forward declaration to main() to prevent warnings
Jaap de Wolff [Mon, 12 Feb 2018 11:23:45 +0000 (12:23 +0100)]
add forward declaration to main() to prevent warnings

6 years agoadapt prototypes arm/syscalls.c to usual prototypes, and do not rely on implicit...
Jaap de Wolff [Mon, 12 Feb 2018 11:23:44 +0000 (12:23 +0100)]
adapt prototypes arm/syscalls.c to usual prototypes, and do not rely on implicit conversions

6 years agoadd forward declaration to __cxa_atexit to aeabi_atexit, to prevent warnings
Jaap de Wolff [Mon, 12 Feb 2018 11:23:43 +0000 (12:23 +0100)]
add forward declaration to __cxa_atexit to aeabi_atexit, to prevent warnings

6 years agoAdd prototype to _malloc_lock() and *unlock() to malloc.h, and inlude this from nano...
Jaap de Wolff [Mon, 12 Feb 2018 11:23:42 +0000 (12:23 +0100)]
Add prototype to _malloc_lock() and *unlock() to malloc.h, and inlude this from nano-mallocr.c

6 years agoAdd define _COMPILING_NEWLIB for arm to configure.host, as it is obviously needed
Jaap de Wolff [Mon, 12 Feb 2018 11:23:41 +0000 (12:23 +0100)]
Add define _COMPILING_NEWLIB for arm to configure.host, as it is obviously needed

Signed-off-by: Jaap de Wolff <jaap@stretch.de-wolff.org>
6 years agoCygwin: socket: move socket creation inside fhandler_socket class
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: improve O_TMPFILE handling
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: fix file-related functions on unix sockets
Corinna Vinschen [Wed, 14 Feb 2018 09:20:42 +0000 (10:20 +0100)]
Cygwin: fix file-related functions on unix sockets

* Fix an incorrect condition to recognize AF_LOCAL sockets in
  file-related functions (fchmod, fchown, fstat, fsttavfs, facl, link).

* Return successfully when called on unnamed or abstract AF_LOCAL sockets,
  except link, just as on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: improve a comment in fhandler_socket::getsockname
Corinna Vinschen [Wed, 14 Feb 2018 09:31:02 +0000 (10:31 +0100)]
Cygwin: improve a comment in fhandler_socket::getsockname

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: /proc/<pid>/stat: Fix time handling
Corinna Vinschen [Mon, 12 Feb 2018 21:10:08 +0000 (22:10 +0100)]
Cygwin: /proc/<pid>/stat: Fix time handling

* Use 64 bit timestamps
* Use System boot and process start time to compute starttime value per
  Linux proc.5 description.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Drop HZ usage in favor of MSPERSEC and CLOCKS_PER_SEC
Corinna Vinschen [Mon, 12 Feb 2018 21:08:42 +0000 (22:08 +0100)]
Cygwin: Drop HZ usage in favor of MSPERSEC and CLOCKS_PER_SEC

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Define MSPERSEC and fix USPERSEC comment
Corinna Vinschen [Mon, 12 Feb 2018 20:21:58 +0000 (21:21 +0100)]
Cygwin: Define MSPERSEC and fix USPERSEC comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Fix x86 compiler warning
Corinna Vinschen [Wed, 7 Feb 2018 16:34:59 +0000 (17:34 +0100)]
Cygwin: Fix x86 compiler warning

The previous patch introduced a compiler warning on x86.

Given time_t is only 4 bytes on x86 we get a long vs. unsigned long
comparison in timeval_to_ms.  Fix it by careful casting.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: sockets: Handle SO_RCVTIMEO and SO_SNDTIMEO
Corinna Vinschen [Wed, 7 Feb 2018 15:16:51 +0000 (16:16 +0100)]
Cygwin: sockets: Handle SO_RCVTIMEO and SO_SNDTIMEO

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: setsockopt/getsockopt: Add missing optlen checks
Corinna Vinschen [Wed, 7 Feb 2018 14:37:48 +0000 (15:37 +0100)]
Cygwin: setsockopt/getsockopt: Add missing optlen checks

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: Cleanup time handling
Corinna Vinschen [Wed, 7 Feb 2018 12:07:44 +0000 (13:07 +0100)]
Cygwin: Cleanup time handling

* 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

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: setsockopt/getsockopt: Clean up code
Corinna Vinschen [Tue, 6 Feb 2018 17:42:00 +0000 (18:42 +0100)]
Cygwin: setsockopt/getsockopt: Clean up code

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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: bindresvport: Guard prototypes with __MISC_VISIBLE
Corinna Vinschen [Mon, 5 Feb 2018 20:06:29 +0000 (21:06 +0100)]
Cygwin: bindresvport: Guard prototypes with __MISC_VISIBLE

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: bindresvport: Try hard to find unused port
Corinna Vinschen [Mon, 5 Feb 2018 20:05:09 +0000 (21:05 +0100)]
Cygwin: bindresvport: Try hard to find unused port

Workaround the problem that bind doesn't fail with EADDRINUSE
if a socket with the same local address is still in TIME_WAIT.

Use IP Helper functions to check if such a socket exist and don't
even try this port, if so.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: bindresvport: check correctness of address family
Corinna Vinschen [Mon, 5 Feb 2018 20:00:15 +0000 (21:00 +0100)]
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.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
6 years agoCygwin: bindresvport_sa: Ignore incoming port number
Corinna Vinschen [Mon, 5 Feb 2018 18:27:55 +0000 (19:27 +0100)]
Cygwin: bindresvport_sa: Ignore incoming port number

Ignore port number just like glibc, otherwise suffer EADDRINUSE
in subsequent connect calls.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.059229 seconds and 5 git commands to generate.