Commit Graph

9219 Commits

Author SHA1 Message Date
Jon Turney 66eefa25f2
Cygwin: Rename WSYM_sysfile to WSYM_default
Rename WSYM_sysfile to WSYM_default, since it selects more than just
sysfile with magic cookie now.
2021-07-30 15:48:21 +01:00
Corinna Vinschen 26d6595f54 Cygwin: add release msg for previous getaddrinfo patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-30 12:43:26 +02:00
Corinna Vinschen 582c7f9664 Cygwin: getaddrinfo: return valid ai_socktype and ai_protocol values
If a service is supported as TCP and UDP service, GetAddrInfo does not
return two entries, one for TCP, one for UDP, as on Linux.  Rather, it
just returns a single entry with ai_socktype and ai_protocol set to 0.
If the service only exists as TCP or UDP service, then ai->ai_socktype
is set, but ai_protocol isn't.

Fortunately we copy over the result from Windows into local storage
anyway, so this patch adds code to fix up the fields neglected by
Windows.  In case ai_socktype as well as ai_protocol are 0, duplicate
the entry with valid values for ai_socktype and ai_protocol.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-30 12:40:35 +02:00
Corinna Vinschen fff00f776b Cygwin: bump API minor and set DLL version to 3.3.0
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 17:44:20 +02:00
Corinna Vinschen c2ad78d672 Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 17:31:31 +02:00
Corinna Vinschen 520c3a3fa2 Cygwin: pthread.h: clean namespace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 17:27:41 +02:00
Corinna Vinschen 5c4eaf45f1 Cygwin: implement pthread_mutex_clocklock
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 17:22:11 +02:00
Corinna Vinschen 123454f9d0 Cygwin: implement pthread_cond_clockwait
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 17:21:13 +02:00
Corinna Vinschen edf48054e9 Cygwin: implement sem_clockwait
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 17:13:47 +02:00
Corinna Vinschen d4e7869ee4 Cygwin: semaphore.h: clean namespace
use underscored identifiers

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-29 16:53:15 +02:00
Ken Brown f9f1b39180 Cygwin: document getifaddrs fixes 2021-07-28 07:44:25 -04:00
Ken Brown b88d686a68 Cygwin: getifaddrs: don't return a zero IPv4 address
If an interface is disconnected, net.cc:get_ifs tries to fetch IPv4
addresses from the registry.  If it fails, it currently returns
pointers to sockaddr structs with zero address.  Return a NULL pointer
instead, to signal the caller of getifaddrs that we do not have a
valid struct sockaddr.

Partially addresses: https://cygwin.com/pipermail/cygwin/2021-July/248970.html
2021-07-28 07:37:43 -04:00
Ken Brown c08ee10d6b Cygwin: getifaddrs: fix address family for IPv6 netmasks
The code in net.cc:get_ifs that sets the netmask omitted setting the
address family in the IPv6 case.  Fix this by setting it to AF_INET6.

Partially addresses: https://cygwin.com/pipermail/cygwin/2021-July/248970.html
2021-07-28 07:37:43 -04:00
David Allsopp 51a297bcbf Ensure nanosleep(2) never returns negative rem
It appears to be the case that NtQueryTimer can return a negative time
remaining for an unsignalled timer. The value appears to be less than
the timer resolution.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
2021-07-22 09:57:40 +02:00
Mark Geisert ff9c2b3ab9
Cygwin: updates to wire in profiler, gmondump
These are updates to wire into the build tree the new tools profiler and
gmondump, and to supply documentation for the tools.

The documentation for profiler and ssp now mention each other but do not
discuss their similarities or differences.  That will be handled in a
future update to the "Profiling Cygwin Programs" section of the Cygwin
User's Guide, to be supplied.
2021-07-19 13:29:34 +01:00
Ken Brown cee03513d8 Cygwin: cfsetspeed: allow speed to be a numerical baud rate
The Linux man page for cfsetspeed(3) specifies that the speed argument
must be one of the constants Bnnn (e.g., B9600) defined in termios.h.
But Linux in fact allows the speed to be the numerical baud rate
(e.g., 9600).  For consistency with Linux, we now do the same.

Addresses: https://cygwin.com/pipermail/cygwin/2021-July/248887.html
2021-07-12 16:26:13 -04:00
Jon Turney 9a231073a5
Cygwin: Define PSAPI_VERSION as 1 before including psapi.h
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building utils since 48a76190 (and is the default in w32api
>= 9.0.0)

In order for the built executables to run on Windows Vista, we must also
define PSAPI_VERSION as 1 (otherwise '#define GetModuleFileNameExA
K32GetModuleFileNameExA' causes a 'The procedure entry point
K32GetModuleFilenameExA could not be located in the dynamic link library
kernel32.dll' error at run time).

Also drop uneeded psapi.h from dlfcn.cc (31ddf45d), resource.cc
(34a6eeab) and ps.cc (1def2148).
2021-07-09 13:24:08 +01:00
Thomas Wolff 1290301b89 tty/pty: support TIOCSWINSZ pixel-size-only change notification
xterm 368 and mintty 3.5.1 implement a new feature to support
notification of terminal scaling via font zooming also if the terminal
text dimensions (rows/columns) stay unchanged, using
ioctl(TIOCSWINSZ), raising SIGWINCH;
this patches cygwin to support that scenario
2021-07-07 13:38:30 +02:00
Jeremy Drake 4fca7b0da6 Cygwin: respect PC_SYM_FOLLOW and PC_SYM_NOFOLLOW_REP with inner links.
The new GetFinalPathNameW handling for native symlinks in inner path
components is disabled if caller doesn't want to follow symlinks, or
doesn't want to follow reparse points.
2021-07-07 10:46:06 +02:00
Jeremy Drake d0e42141b8 Revert "Cygwin: Handle virtual drives as non-symlinks"
This reverts commit c8949d0400.
2021-07-06 16:57:02 +02:00
Brian Inglis 7323efd73c format_proc_cpuinfo: add Linux 5.13 AMD/Hygon rapl
Linux 5.13 Opossums on Parade added features and changes:
add AMD 0x80000007 EDX:14 rapl runtime average power limit
2021-07-06 16:06:29 +02:00
Takashi Yano 98e3aeb1f5 Cygwin: console: Fix garbled input for non-ASCII chars.
- After the commit ff4440fc, non-ASCII input may sometimes be garbled.
  This patch fixes the issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2021-June/248775.html
2021-07-06 16:04:44 +02:00
Corinna Vinschen bc184284cb Revert "Cygwin: console: Fix garbled input for non-ASCII chars."
This reverts commit 1b242c12aa.
2021-07-06 16:04:22 +02:00
Takashi Yano 1b242c12aa Cygwin: console: Fix garbled input for non-ASCII chars.
- After the commit ff4440fc, non-ASCII input may sometimes be garbled.
  This patch fixes the issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2021-June/248775.html
2021-07-06 16:00:20 +02:00
Mark Geisert 5c9c31c52b
Cygwin: Zero out gmon header before use
Tools that process gmon.out files can be confused by gmon header fields
with garbage in them due to lack of initialization.  Repair that.
2021-06-26 15:24:27 +01:00
Ken Brown dfe5988f96 Cygwin: fhandler_mqueue::mq_open: fix typo 2021-05-26 12:48:58 -04:00
Corinna Vinschen 88a2f9875a Cygwin: set NTDDI_VERSION to enable more recent windows definitions
Set to WDK_NTDDI_VERSION since that enables all the latest.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26 11:01:32 +02:00
Corinna Vinschen 1adb3f11b7 Cygwin: fhandler_mqueue: add missing __reg2 for 32 bit build
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26 11:01:32 +02:00
Corinna Vinschen 59ba43dd9e Cygwin: fhandler_mqueue: disable more methods, add fcntl
Unsupported functionality returns EPERM, fcntl supports
only F_GETFD and F_GETFL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 23:00:32 +02:00
Corinna Vinschen 2b4c7f90d4 Cygwin: fhandler_mqueue::mq_open: set all required fhandler flags
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 22:43:41 +02:00
Corinna Vinschen fd3fb7a147 Cygwin: disable creating directories below /dev/mqueue
...as on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 22:05:13 +02:00
Corinna Vinschen 90e5dbfc24 Cygwin: fhandler_mqueue: fix method declarations
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 22:04:43 +02:00
Corinna Vinschen 782b338530 Cygwin: path_conv: fix mqueue path check
The check for a file or dir within /dev/mqueue is accidentally using
the incoming path, which could be a relative path.  Make sure to
restore the absolute POSIX path in path_copy and only then test the
path.

Also, move the actual check for a valid path below /dev/mqueue into
the fhandler_mqueue class.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 22:03:36 +02:00
Corinna Vinschen 4c09dc4f9c Cygwin: cwdstuff: check if /dev exists
/dev has been handled as virtual dir in cwdstuff, thus not allowing
to start native apps from /dev as CWD, even if /dev actually exists
on disk.  Unfortunately this also affects Cygwin executables started
from a debugger.

When chdir'ing to /dev, check if /dev exists on disk.  If so, treat
it as any other existing path.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 21:46:13 +02:00
Corinna Vinschen efef4b8bf1 Cygwin: POSIX msg queues: implement read(2)/lseek(2)
reuse fhandler_virtual implementation to implement read and lseek.
The output from read(2) is modelled after the output when reading
from an mq file on Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 20:19:19 +02:00
Corinna Vinschen 517c7e79da Cygwin: POSIX msg queues: implement ioctl(2)
Call into fhandler_base::ioctl immediately, thus only allowing
FIONBIO to manipulate blocking behaviour.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 20:17:07 +02:00
Corinna Vinschen 46f3b0ce85 Cygwin: POSIX msg queues: move all mq_* functionality into fhandler_mqueue
The POSIX entry points are just wrappers now, calling into
fhandler_mqueue.  While at it, eliminate mqi_flags, replace with
standard fhandler nonblocking flag.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 20:15:16 +02:00
Corinna Vinschen e0cdd462f1 Cygwin: POSIX msg queues: allocate section views top down
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:55:38 +02:00
Corinna Vinschen fbcd61063b Cygwin: POSIX msg queues: Implement dup
Create a private method fhandler_mqueue::_dup and call it from
dup and fixup_after_fork methods.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:50:16 +02:00
Corinna Vinschen b62450cf17 Cygwin: POSIX msg queues: implement open/mq_open entirely in fhandler
The mq_open call is just a framework now.  This patch moves the
entire functionality into fhandler_mqueue.  To support standard
OS calls (as on Linux), make fhandler_mqueue a derived class from
fhandler_disk_file and keep the base handle the handle to the
default stream, to allow implementing O_PATH functionlaity as well
as reading from the file and NOT reading binary message queue data.

Implement a standard fhandler_mqueue::open method, allowing, for
instance, to touch a file under /dev/mqueue and if it doesn't exist,
to create a message queue file.

FIXME: This introduces a BAD HACK into path_conv::check, which needs
reviewing.

Keep the posix path intact in the fhandler, and change get_proc_fd_name
accordingly to return only the basename plus leading slash for
/proc/<PID>/fd.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:49:04 +02:00
Corinna Vinschen a4e074672a Cygwin: POSIX msg queues: slightly rephrase get_mqinfo
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:42:44 +02:00
Corinna Vinschen 2cc914a34e Cygwin: POSIX msg queues: simplify mq_close
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:41:45 +02:00
Corinna Vinschen 15c96f2b26 Cygwin: get_nt_native_path: allow to append suffix
POSIX message queues will be moved into NTFS streams.
Extend get_nt_native_path to provide a filename suffix which is not
subject to special character transposition, to allow specifying
a colon.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:31:26 +02:00
Corinna Vinschen 4ea7c12a20 Cygwin: POSIX msg queues: move definition of struct msg_hdr
...to mqueue_types.h header.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25 16:17:58 +02:00
Corinna Vinschen 49b84cb264 Cygwin: POSIX msg queues: improve error output in fixup_after_fork
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-22 18:03:01 +02:00
Corinna Vinschen bce3563e98 Cygwin: POSIX msg queues: destroy msg queue fhandler in case of error
...and don't leave a descriptor dangling

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-21 15:26:51 +02:00
Corinna Vinschen 723f38b10a Cygwin: POSIX msg queues: move handling of memory map into fhandler
This encapsulated creation, duplication, and closing of all
Windows objects connected to the message queue in the fhandler.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-21 15:25:37 +02:00
Corinna Vinschen 5b380b1ca6 Cygwin: POSIX ipc: fix evaluation of naming rules
The function evaluating correctness of ipc object names was a
bit half-hearted.  Fix the tests to follow more closely the
desriptions in the Linux man pages.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-21 15:21:29 +02:00
Corinna Vinschen 5f621bd38f Cygwin: posix_ipc.cc: fix typo
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-21 15:18:38 +02:00
Corinna Vinschen 65cb82839a Cygwin: POSIX msg queues: create fhandler with object name
build_fh_dev can take the POSIX object name as parameter anyway,
so use that and drop from mqinfo call.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-21 13:43:51 +02:00