Commit Graph

12974 Commits

Author SHA1 Message Date
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
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
Jon Turney a9c8050c36
Cygwin: Ensure PSAPI_VERSION is 1 when building ldd
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building ldd, which gets PSAPI_VERSION=2.

This causes K32GetModuleFileNameEx to be used for GetModuleFileNameEx,
which isn't available on Windows Vista.

Define PSAPI_VERSION as 1 for the built executable to work on Windows
Vista.
2021-05-22 16:06:51 +01: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