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>
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
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>
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.
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
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).
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
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.
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>
/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>
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>
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>
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>
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>
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>
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>
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>