Commit Graph

12985 Commits

Author SHA1 Message Date
Corinna Vinschen 5970bbded8 Cygwin: export new sig2str/str2sig
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-02 13:57:03 +02:00
Corinna Vinschen cf9a51371c Cygwin: clarify importance of new GNU-specifc API
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-02 13:53:38 +02:00
Jon Turney 38965159df
Cygwin: Add winsymlinks:sys
Add winsymlinks:sys, to explicitly select always using plain files with
the system attribute containing a magic cookie to represent a symlink.
2021-07-30 15:48:26 +01:00
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
Corinna Vinschen ad8730cc91 Cygwin: utils: refresh tzmap.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28 22:19:37 +02:00
Corinna Vinschen 4f999b4eab Cygwin: utils: tzmap-from-unicode.org: enforce sorting order for LANG=C
Generating the tzmap.h file requires to use the default sorting order.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-28 22:18:38 +02:00
Jon Turney d930fbb6ae
Cygwin: Convert gmondump and profiler synopses to <cmdsynopsis>
Convert gmondump and profiler synopses to <cmdsynopsis>, since
addition of these crossed with e6b667f1.
2021-07-28 15:20:03 +01: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
Corinna Vinschen bf8f2a95df Cygwin: profiler: Fix formatting warnings
DWORD has different types on 32 and 64 bit.  Use a common cast to
unsigned long to use %lu format for DWORD values throughout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-07-21 10:07:22 +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
Mark Geisert 4ad5b0ca31
Cygwin: New tool: gmondump
This new tool was formerly part of 'profiler' but was spun out thanks to
Jon T's reasonable review comment.  Gmondump is more of a debugging tool
than something users might have need for.  Users would more likely use
gprof to make use of symbolic info like function names and source line
numbers.
2021-07-19 13:29:13 +01:00
Mark Geisert 9bd6c0b2b1
Cygwin: New tool: profiler
The new tool formerly known as cygmon is renamed to 'profiler'.  For the
name I considered 'ipsampler' and could not think of any others.  I'm open
to a different name if any is suggested.

I decided that a discussion of the pros and cons of this profiler vs the
existing ssp should probably be in the "Profiling Cygwin Programs" section
of the Cygwin User's Guide rather than in the help for either.  That
material will be supplied at some point.

CONTEXT buffers are made child-specific and thus thread-specific since
there is one profiler thread for each child program being profiled.

The SetThreadPriority() warning comment has been expanded.

chmod() works on Cygwin so the "//XXX ineffective" comment is gone.

I decided to make the "sample all executable sections" and "sample
dynamically generated code" suggestions simply expanded comments for now.

The profiler program is now a Cygwin exe rather than a native exe.
2021-07-19 13:28:37 +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
Jon Turney e6b667f1a4
Cygwin: Use cmdsynopsis element in utils documentation
Use <cmdsynopsis> element markup in utils docbook documentation, rather
than some preformatted text inside <screen>.

(This didn't happen as part of 646745cb, when we first started using
refentry elements to make it possible to generate manpages)

This helps produce better looking manpages:

* uses bold (for command names) and italic (for replaceable items)
* different output formats inconsistently treat tabs inside <screen>
(so we have to be careful to not use them in that preformatted text)

Also clean up various issues:

* Replace '[OPTIONS]' with a real synopsis of the options
* Consistently use 'ITEM...' rather than 'ITEM1 [ITEM2...]' for an item
which should appear 1 or more times (cygcheck -f, getfacl, kill)
* Consistently document the '-h | -V' invocation form
* Since replaceable items are now marked up so they have some formatting
indicating they are replaceable, we can drop wrapping them in angle
brackets, as is done in some places
* Add missing '-W' and '-p PID' options to ps synopsis
* Adjust cygpath synopsis to show that only one 'System information'
option is allowed, possibly modified by -A

Future work:
* Sync up the actual help emitted by the util, where it's been improved
* Also don't use <screen> for formatting 'OPTIONS' section of manpage
* pldd inconsistently uses '-?' rather than '-h'!
2021-07-09 13:21:18 +01:00
Jon Turney be4a8b91ff
Cygwin: Various minor fixes to utils documentation
* Drop duplicate 'Options:' headers (mkgroup, mkpassword)
* Add missing indication that MACHINE is optional with -L (mkgroup, mkpassword)
* Tweak some <refpurpose> which try to be a synopsis, rather than a decription (passwd, ssp)
* Drop some stray '\n' in setfacl options
* Move 'Original Author' note in ssp to an AUTHORS section
* Use <para> to improve formatting of tzset manpage
2021-07-09 13:21:16 +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
Mark Geisert ee0986cfe1
Cygwin: Fix a stray tab in strace documentation 2021-06-13 15:51:11 +01:00
Ken Brown dfe5988f96 Cygwin: fhandler_mqueue::mq_open: fix typo 2021-05-26 12:48:58 -04:00
Corinna Vinschen fd84f6cf51 Cygwin: utils: enable -idirafter to fetch Cygwin headers from mingw sources
Get rid of the last dreaded relative paths pointing to the cygwin dir.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26 11:01:32 +02:00
Corinna Vinschen 48a76190e8 Cygwin: utils: set _WIN32_WINNT and NTDDI_VERSION via Makefile
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26 11:01:32 +02: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