The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure. This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile. Fix this by not hiding atomic variables
in a structure for modern versions of GCC. The headers already avoid
using a wrapper structure on clang.
Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.
Reported by: Mark Millard
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16585
- If output of non-cygwin process is piped to cygwin process, such
as less, the non-cygwin process sometimes fails to start and hangs.
This patch fixes the issue.
If there's unread data in the pipe from a previous partial read of a
packet, just return. There can't be an administrative packet waiting
to be read in that case.
Define it to be UINT16_MAX, since the pckt_len member of
af_unix_pkt_hdr_t is of type uint16_t.
Previously it was 65536 (== UINT16_MAX + 1), which is 0 when cast to
uint16_t. So an attempt to write a packet of size MAX_AF_PKT_LEN
actually wrote 0 bytes.
And use it in recvmsg.
I'm not sure this implementation is what was intended when the
evaluate_cmsg_data method was added.
For now, just support an ancillary data block consisting of a single
cmsghdr, containing SCM_CREDENTIALS.
For convenience, add a 'mshdr *' argument and make the 'cloexec'
argument false by default. The 'cloexec' argument is not currently
used, and I want to avoid having to artificially specify a value for
it when recvmsg calls evaluate_cmsg_data.
For now, just support an ancillary data block consisting of a single
cmsghdr, containing SCM_CREDENTIALS.
FIXME: We're supposed to check the credentials.
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.
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.
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.
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.
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.
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.
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>
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.
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.
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).
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.