Commit Graph

18152 Commits

Author SHA1 Message Date
Thomas Wolff 71291047e2 generated width data, Unicode 10.0
These tables provide character width properties for use by the
wcwidth/wcswidth functions. They are generated from Unicode.
2018-03-12 10:17:20 +01:00
Corinna Vinschen 99796906ab Cygwin: AF_UNIX: fix up thread parameter block allocation
* don't abort on failing allocation, just return with error
* make sure the allocation is restricted to a single process

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-11 14:56:02 +01:00
Corinna Vinschen de29476ed5 Cygwin: AF_UNIX: use get_unique_id to create pipe name
It's the same as get_plain_ino in this case, but it's cleaner
and easier to understand.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-11 14:54:20 +01:00
Corinna Vinschen 4f1ee1a3e7 Cygwin: AF_UNIX: fix dup
Reorder so fhandler_socket::dup is called first.  Add missing
duplication of backing_file_handle.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-10 21:12:27 +01:00
Corinna Vinschen 7b1028974b Cygwin: AF_UNIX: Add fixup_after_exec method
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-10 21:09:28 +01:00
Corinna Vinschen 1bb3d65182 Cygwin: AF_UNIX: fix creating abstract socket symlink name
Add missing NUL termination when creating symlink representing
abstract socket.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-10 21:07:46 +01:00
Corinna Vinschen 8b6804b8a8 Cygwin: don't skip O_TMPFILE files in readdir
Bad idea.  A file hidden from directory listings is not seen by
rm either, so it never calls unlink for the file and a recursive
removal of the parent directory fails with "directory not empty".

Fix comments accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09 21:13:28 +01:00
Corinna Vinschen b194d65615 Cygwin: AF_UNIX: Implemant socketpair
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09 14:19:36 +01:00
Corinna Vinschen f4a1a186f9 Cygwin: fix socketpair prototype
Last parameter is a vector of 2 ints, not a pointer to int

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-09 14:17:39 +01:00
Thomas Wolff e4c65b2e91 describe new locale modifier @cjkwide for user guide 2018-03-08 08:14:39 +01:00
Corinna Vinschen 7d525c171f Cygwin: AF_UNIX: implement getsockopt SO_RCVBUF/SO_SNDBUF
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:56:42 +01:00
Corinna Vinschen 483cbf8954 Cygwin: AF_UNIX: define AF_UNIX_CONNECT_TIMEOUT
Use macro AF_UNIX_CONNECT_TIMEOUT instead of numerical constant
for connect timeout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:55:34 +01:00
Corinna Vinschen 2f48ddb1ca Cygwin: Define FSCTL_PIPE_FLUSH
This fsctl might come in handy at one point...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:54:46 +01:00
Corinna Vinschen 5bb4cc1e6c 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>
2018-03-07 21:53:56 +01:00
Corinna Vinschen d7f7d292d8 Cygwin: reorder read/write calls in fhandler_socket_unix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 21:52:29 +01:00
Corinna Vinschen 855e5d7e14 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>
2018-03-07 16:23:44 +01:00
Corinna Vinschen cde2648c22 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>
2018-03-07 16:19:43 +01:00
Corinna Vinschen 27a63d4ef2 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>
2018-03-07 16:12:55 +01:00
Corinna Vinschen 4de52a0fe1 Cygwin: AF_UNIX: fix SEGV when sending an empty socket name from connect
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 16:08:15 +01:00
Corinna Vinschen 2f2a75b7bb 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>
2018-03-07 16:06:57 +01:00
Corinna Vinschen d69bcdd671 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>
2018-03-07 16:04:26 +01:00
Corinna Vinschen e94fa4ebf3 Cygwin: AF_UNIX: fix comments and move a macro
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 15:43:26 +01:00
Corinna Vinschen 4cd57934be 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>
2018-03-06 19:10:54 +01:00
Corinna Vinschen e2909e2805 Cygwin: AF_UNIX: fix a couple of thinkos and typos
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:42:12 +01:00
Corinna Vinschen cabfef78e9 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>
2018-03-06 18:37:09 +01:00
Corinna Vinschen c502700231 Cygwin: AF_UNIX: initialize rmem/wmem to 256K and use in pipe creation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:28:15 +01:00
Corinna Vinschen c0df506b83 Cygwin: ntdll.h: Add some missing pipe-related definitions
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:24:13 +01:00
Corinna Vinschen f6ce72e623 Cygwin: sys/socket.h: define MSG_CMSG_CLOEXEC
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:23:48 +01:00
Corinna Vinschen 6d2f1d79a8 Cygwin: export hires counter ntod
Needed it new AF_UNIX socket code

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:23:23 +01:00
Sebastian Huber f641474cb2 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>
2018-03-06 11:40:16 +01:00
Sebastian Huber a9c8434527 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>
2018-03-06 11:40:16 +01:00
Corinna Vinschen ae67198d55 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>
2018-03-05 18:08:47 +01:00
Corinna Vinschen a2c02d78be 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>
2018-03-05 17:59:04 +01:00
Corinna Vinschen fe8e2c9b1f 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>
2018-03-05 17:50:52 +01:00
Corinna Vinschen 011fc3b508 Cygwin: cygwait.cc: fix formatting of debug statement
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-05 17:49:50 +01:00
Thomas Wolff f92f048528 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.
2018-03-05 17:15:12 +01:00
Corinna Vinschen df14d97fff Cygwin: AF_UNIX: drop try/except block in bind method
The caller already does it anyway.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 23:40:36 +01:00
Corinna Vinschen be6da79713 Cygwin: AF_UNIX: create pipes with file attribute R/W access
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 23:39:15 +01:00
Corinna Vinschen 00e8707830 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>
2018-03-02 23:33:05 +01:00
Corinna Vinschen 984c8beeff Cygwin: remove outdated comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:22:45 +01:00
Corinna Vinschen 97b7aaaeb7 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>
2018-03-02 18:17:17 +01:00
Corinna Vinschen 7d260cfac4 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>
2018-03-02 18:17:17 +01:00
Corinna Vinschen 488221cf5c Cygwin: small_s[w]printf: add '_' modifier to print lower case hex digits
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:17:17 +01:00
Corinna Vinschen 1949db7829 Cygwin: drop CYGWIN_SOCKET_UUID, define CYGWIN_SOCKET_GUID as GUID pointer
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:17:13 +01:00
Corinna Vinschen d87ef0dac9 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>
2018-03-02 18:08:05 +01:00
Our Air Quality b7520b14d5 Add global stdio streams support for reent small. 2018-03-01 18:05:31 -05:00
Corinna Vinschen dc3928fc75 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>
2018-03-01 18:14:23 +01:00
Corinna Vinschen aa467e6e33 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>
2018-03-01 16:54:57 +01:00
Corinna Vinschen 65267a9a34 Cygwin: move transaction helpers into ntdll.h
We'll need them elsewhere in future.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de
2018-03-01 16:51:12 +01:00
Corinna Vinschen 3e16fd6986 Cygwin: ntdll.h: drop macros available in mingw-w64 headers
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-01 16:50:41 +01:00