4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 12:30:24 +08:00

19581 Commits

Author SHA1 Message Date
Ken Brown via Cygwin-patches
6940081505 Cygwin: AF_INET and AF_LOCAL: recv_internal: fix MSG_WAITALL support
If MSG_WAITALL is set, recv_internal calls WSARecv or WSARecvFrom in a
loop, in an effort to fill all the scatter-gather buffers.  The test
for whether all the buffers are full was previously incorrect.
2020-10-23 08:25:29 -04:00
Ken Brown
324faf1e07 Cygwin: AF_UNIX: socketpair: fix connect state
Both sockets should have connect state 'connected', not just the
second.
2020-10-22 15:12:29 -04:00
Ken Brown
6b08c5e15d Cygwin: AF_UNIX: reopen_shmem: fix view size
Use sizeof (af_unix_shmem_t) as the view size, as when the shared
memory was created.  Previously PAGESIZE was used, causing
NtMapViewOfSection to fail with STATUS_INVALID_VIEW_SIZE.
2020-10-22 14:55:52 -04:00
Ken Brown
7992fc068d Cygwin: AF_UNIX: fill in the default constructor
Previously the default constructor did nothing.  In particular,
fixup_after_fork never got called because need_fork_fixup wasn't set.
2020-10-22 14:45:34 -04:00
Ken Brown
8d99c2f9e2 Cygwin: AF_UNIX: socketpair: set O_RDWR 2020-10-22 12:41:59 -04:00
Jon Turney
ddbcf815c0 Cygwin: Drop do-nothing install_target target 2020-10-22 07:30:51 -04:00
Jon Turney
fea254f1e3 Cygwin: Drop do-nothing install_host target
Drop do-nothing install_host target, which is only used when not
cross-compiling.
2020-10-22 07:30:51 -04:00
Jon Turney
2f44dea077 Cygwin: Remove nostdlib Makefile variable
It's used in one place, and it's value is unconditional.
2020-10-22 07:30:51 -04:00
Jon Turney
005b0a1e3e Cygwin: gendef generates sigfe.s and cygwin.def
Express that gendef generates sigfe.s and cygwin.def in a slightly less
nutty way.
2020-10-22 07:30:51 -04:00
Jon Turney
629e3459bb Cygwin: Drop cygwin version.o from cygserver
The data it contains isn't referenced since 9e9bc3a4.
2020-10-22 07:30:51 -04:00
Jon Turney
d96595e416 Cygwin: Remove lsaauth
Remove lsaauth, not built since 2741dd05.
2020-10-22 07:30:51 -04:00
Ken Brown
db3edfaee9 Cygwin: AF_UNIX: tweak peek_socket_unix
If the socket is listening, then report it as readable (i.e., accept
would not block) if NtQueryInformationFile reports its state as
anything but FILE_PIPE_LISTENING_STATE.  Also report it as readable if
NtQueryInformationFile fails.
2020-10-22 07:30:42 -04:00
Ken Brown
7c04247105 Cygwin: AF_UNIX: select: first cut
Untested.

There are many FIXMEs that need attention.

I haven't thought much about datagram sockets.  Some of the code might
only work for stream sockets.
2020-10-21 19:51:02 -04:00
Ken Brown
84f97738a7 Cygwin: set_bits: extend socket code to all sockets
select.cc:set_bits sets the readfds entry on wsock sockets that have a
failed connect.  Tweak the code so that it applies to all sockets.

To help with this, add virtual connect_state methods to the
fhandler_socket class.  Versions of these methods for
fhandler_socket_wsock and fhandler_socket_unix already exist.
2020-10-21 19:46:49 -04:00
Ken Brown
721814a4cd Cygwin: AF_UNIX: make some methods public
Some previously protected methods are now public so that they can be
used in select.cc.
2020-10-21 19:46:48 -04:00
Ken Brown
58205dc374 Cygwin: AF_UNIX: move the definition of class af_unix_pkt_hdr_t
It is needed in select.cc, so move the definition from
fhandler_socket_unix.cc to fhandler.h.
2020-10-21 19:46:48 -04:00
Ken Brown
533c9b05b8 Cygwin: AF_UNIX: sendmsg: call grab_admin_pkt
Check to see if the peer has sent a shutdown packet before calling
saw_shutdown.
2020-10-21 08:44:06 -04:00
Jon Turney
90e3a93741 Cygwin: Use aclocal option --system-acdir rather than --acdir
In autogen.sh, use 'aclocal --system-acdir' rather than 'aclocal --acdir'.

'--acdir' was deprecated in automake 1.11 and removed in automake 1.13.
2020-10-19 17:54:56 -04:00
Jon Turney
0f6a76a835 Cygwin: Remove --with-windows-{libs,headers} 2020-10-19 17:54:56 -04:00
Jon Turney
d37c87d889 Cygwin: Remove ccwrap
ccwrap massages the compiler's standard include directories to remove
'/usr/include/w32api', with the intent of allowing it to be overriden by
'--with-windows-headers' (See 4c36016b).

I'm not 100% convinced that this is always working as desired, since in
some places w32api includes are done using <w32api/something.h>, which
will find them via the path /usr/include.

If this does turn out to be needed, this could also be implemented by
constructing the appropriate compiler flags once, rather than on every
compiler invocation.
2020-10-19 17:54:55 -04:00
Jon Turney
5accf1be05 Cygwin: Stop using c++wrap for MinGW-compiled utilities
Stop using c++wrap for MinGW-compiled utilities.

(Partially reverts 96079146)
2020-10-19 17:54:55 -04:00
Torbjörn SVENSSON via Newlib
73e7ca5c80 libc/time: Move internal newlib tz-structs into own header
As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch moves the internal struct __tzrule_struct to its own
internal header sys/_tz_structs.h.  This is included from newlib's
time code as well as from Cygwin's localtime wrapper.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-10-19 17:54:54 -04:00
Ken Brown
0ee48565f0 Cygwin: AF_UNIX: recvmsg: check for shutdown
Call grab_admin_pkt at appropriate times to check whether we've been
shut down for reading.  Also, update our shutdown state whenever we
read a packet.

Untested.

FIXME: I'm not sure whether I've treated datagram sockets properly.
2020-10-19 17:23:40 -04:00
Ken Brown
99490d2825 Cygwin: AF_UNIX: grab_admin_pkg: refactor
Extract from grab_admin_pkg two new methods, record_shut_info and
process_admin_pkg.  Also add a new 'peek' argument to grab_admin_pkg.
If this is true, peek to see if the next packet in the pipe is an
administrative packet.  Otherwise, assume we already know it is.
2020-10-19 17:22:34 -04:00
Ken Brown
c60fcf1116 Cygwin: AF_UNIX: sendmsg: send shutdown state
Send the current shutdown state rather than _SHUT_NONE as part of
every packet sent.
2020-10-19 09:26:41 -04:00
Ken Brown
95012189c0 Cygwin: AF_UNIX: sendmsg: fix errno if socket is shut down
Following Posix and Linux, the errno should be EPIPE, not ESHUTDOWN.
2020-10-19 08:56:59 -04:00
Ken Brown
e1beea13e1 Cygwin: AF_UNIX: recvmsg: fix thinko
The pointer 'my_iovptr' was being incremented before it was used.
2020-10-17 14:58:53 -04:00
Jon Turney
039be0a0b4 Cygwin: Remove unused doc/ug-info.xml
Remove doc/ug-info.xml, not used in any document.
2020-10-14 16:02:58 -04:00
Jon Turney
db7375cdab Cygwin: Remove empty MT_SAFE and MT_SAFE_OBJECTS 2020-10-14 16:02:58 -04:00
Jon Turney
affd2cca88 Cygwin: Remove autoconf variable INSTALL_LICENSE
Remove autoconf variable INSTALL_LICENSE, which has a constant value
which is only used once.
2020-10-14 16:02:58 -04:00
Jon Turney
5107953a3a Cygwin: Drop AC_SUBST(LIBSERVER)
The autoconf variable LIBSERVER isn't defined, and it's value isn't
used. (The Makefile.in contains a literal value for the name of this
library instead).
2020-10-14 16:02:58 -04:00
Jon Turney
c9c6abfa16 Cygwin: Remove AC_ARG_PROGRAM/program_transform_name
Not done consistently, and probably never used.
2020-10-14 16:02:58 -04:00
Jon Turney
aed1829c54 Cygwin: Remove AC_PROG_MAKE_SET
This is only needed if we are using an ancient make which doesn't set
${MAKE}, but we say "This makefile requires GNU make." everywhere.

It only has an effect if @SET_MAKE@ is used, which we aren't doing
consistently.
2020-10-14 16:02:58 -04:00
Jon Turney
fe18bd2728 Cygwin: Drop STDINCFLAGS overrides
This used to turn off -nostdinc on a per-file basis, but has no effect
since 4c36016b5706.
2020-10-14 16:02:58 -04:00
Jon Turney
05d657d7a5 Cygwin: Drop looking for w32api in winsup/w32api
Stop looking for w32api headers in the (no longer existent)
winsup/w32api directory (removed in commit 61746d6ae850).
2020-10-14 16:02:58 -04:00
Brian Inglis
0d65875bed format_proc_cpuinfo: add enqcmd cpuinfo flag
Add linux-next 5.9 cpuinfo flag for Intel enqcmd/s instructions:
x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions:
Work submission instruction comes in two flavors. ENQCMD can be called
both in ring 3 and ring 0 and always uses the contents of a PASID MSR
when shipping the command to the device. ENQCMDS allows a kernel driver
to submit commands on behalf of a user process. The driver supplies the
PASID value in ENQCMDS. There isn't any usage of ENQCMD in the kernel as
of now.
The CPU feature flag is shown as "enqcmd" in /proc/cpuinfo.
2020-10-14 16:02:57 -04:00
Thomas Wolff
a51546be1a drop ambiguous-wide behaviour from Unicode CJK locales 2020-10-14 16:02:57 -04:00
Ken Brown
c294f50f3d Cygwin: AF_UNIX: add two FIXME comments 2020-10-14 15:00:26 -04:00
Ken Brown
c90e757a6b Cygwin: AF_UNIX: sendmsg: check for 0-length messages
Don't send 0-length messages on a stream socket.
2020-10-14 14:46:26 -04:00
Ken Brown
e974778591 Cygwin: AF_UNIX: support the MSG_PEEK flag
Not yet tested.
2020-10-14 11:39:52 -04:00
Ken Brown
507e9dab26 Cygwin: AF_UNIX: recvmsg, first cut
Tested by running the server/client programs from Kerrisk, "The Linux
Programming Interface", Sections 57.2 and 57.3.

Support for MSG_PEEK is not yet implemented.

Many things have not yet been tested.
2020-10-14 11:28:55 -04:00
Ken Brown
02e2488405 Cygwin: AF_UNIX: add a new peek_pipe_poll method
This is like peek_pipe, except that it polls until there's data in the
pipe, an error, or a signal.
2020-10-14 11:23:45 -04:00
Ken Brown
03c3f5dcfe Cygwin: AF_UNIX: add methods to check for unread data
When reading from a stream socket, it's possible that the caller
requested fewer bytes that are available in the packet.  In this case
there is user data left in the pipe without a packet header.

Add a member '_unread' to the af_unix_shmem_t class to keep track of
this, and add corresponding methods 'get_unread' and 'set_unread' to
af_unix_shmem_t and fhandler_socket_unix.
2020-10-14 11:15:16 -04:00
Ken Brown
cd42f043f4 Cygwin: AF_UNIX: peek_pipe: change error handling
Return an NTSTATUS code instead of a ULONG.  Add a new ULONG reference
argument to replace the previous return value.
2020-10-14 10:54:32 -04:00
Ken Brown
1533431754 Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS
A successful connection can be indicated by STATUS_SUCCESS or
STATUS_PIPE_CONNECTED.  Previously we were checking only for the
latter.
2020-10-14 10:54:32 -04:00
Ken Brown
8559c26186 Cygwin: AF_UNIX: socket: set the O_RDWR flag 2020-10-14 10:54:32 -04:00
Ken Brown
19074f3157 Cygwin: always recognize AF_UNIX sockets as reparse points
If __WITH_AF_UNIX is defined when Cygwin is built, then a named
AF_UNIX socket is represented by a reparse point with a
Cygwin-specific tag and GUID.  Make such files recognizable as reparse
points (but not as sockets) even if __WITH_AF_UNIX is not defined.
That way utilities such as 'ls' and 'rm' still behave reasonably.

This requires two changes:

- Define the GUID __cygwin_socket_guid unconditionally.

- Make check_reparse_point_target return PATH_REP on a reparse point
  of this type if __WITH_AF_UNIX is not defined.
2020-10-14 10:54:32 -04:00
Ken Brown
412c761a28 Cygwin: fix handling of known reparse points that are not symlinks
Commit aa467e6e, "Cygwin: add AF_UNIX reparse points to path
handling", changed check_reparse_point_target so that it could return
a positive value on a known reparse point that is not a symlink.  But
some of the code in check_reparse_point that handles this positive
return value was executed unconditionally, when it should have been
executed only for symlinks.

As a result, posixify could be called on a buffer containing garbage,
and check_reparse_point could erroneously return a positive value on a
non-symlink.  This is now fixed so that posixify is only called if the
reparse point is a symlink, and check_reparse_point returns 0 if the
reparse point is not a symlink.

Also fix symlink_info::check to handle this last case, in which
check_reparse_point returns 0 on a known reparse point.
2020-10-14 10:54:32 -04:00
Ken Brown
032f622533 Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed
The following Windows system calls currently fail with
STATUS_IO_REPARSE_TAG_NOT_HANDLED when called on an AF_UNIX socket:

- NtOpenFile in get_file_sd

- NtOpenFile in set_file_sd

- NtCreateFile in fhandler_base::open

Fix this by adding the FILE_OPEN_REPARSE_POINT flag to those calls
when the file is a known reparse point.
2020-10-14 10:54:32 -04:00
Torbjörn SVENSSON
2f2e659bf2 libc/include/wchar.h: Remove parameter name
As discussed in GCC bug 97088
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in
prototypes of library functions should use reserved names, or no name
at all.

This patch removes the 'ptr' parameter name from
wint_t _getwchar_r (struct _reent *);
wint_t _getwchar_unlocked_r (struct _reent *);

to avoid possible clashes with user code in case someone uses
before including Newlib's wchar.h (or uses some other conflicting
definition)

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
2020-10-14 10:54:32 -04:00