Commit Graph

1217 Commits

Author SHA1 Message Date
Jon Turney 7dd1b08836
Cygwin: Add a new win32_pstatus data type for modules on x86_64
Also take a bit more care with sizes in other data types to ensure they
are the same on x86 and x86_64.

Add some explanatory comments.
2020-07-12 15:09:40 +01:00
Corinna Vinschen b3af1d5aa3 Cygwin: Bump DLL version to 3.1.7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-09 10:14:23 +02:00
Corinna Vinschen ee22924137 Cygwin: tcp: Support TCP_QUICKACK
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 21:26:59 +02:00
Corinna Vinschen ffb07b41bc Cygwin: tcp: Support TCP_USER_TIMEOUT
Use TCP_MAXRTMS on newer systems, TCP_MAXRT on older systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 20:30:52 +02:00
Corinna Vinschen 8ccffddc91 Cygwin: tcp: Support TCP_KEEPIDLE, TCP_KEEPCNT, TCP_KEEPINTVL
Use WSAIoctl(SIO_KEEPALIVE_VALS) on older systems.

Make sure that keep-alive timeout is equivalent to
TCP_KEEPIDLE + TCP_KEEPCNT * TCP_KEEPINTVL on older systems,
even with TCP_KEEPCNT being a fixed value on those systems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 20:30:52 +02:00
Corinna Vinschen 0feb77c260 Cygwin: tcp: Support TCP_FASTOPEN
TCP_FASTOPEN is supported since W10 1607.  Fake otherwise.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 20:30:40 +02:00
Corinna Vinschen e037192b50 Cygwin: tcp: fix IPPROTO_TCP option handling
- Drop definitions from <cygwin/sockets.h>
- Drop options only available on BSD
- Fix value of TCP_MAXSEG.  It was still defined as the BSD value
  while WinSock uses another value
- Handle the fact that TCP_MAXSEG is a R/O value in WinSock

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-07-01 09:25:54 +02:00
Corinna Vinschen 8873f073c8 Bump version to 3.1.6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-06-01 10:48:11 +02:00
Corinna Vinschen b74bc88385 Cygwin: fix formatting: drop trailing whitespace
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11 13:45:58 +01:00
Corinna Vinschen 3bb346d593 Cygwin: fix formatting: collapse whitespace-only lines
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11 13:45:58 +01:00
Corinna Vinschen d2ef2331f9 Cygwin: fix formatting: drop spaces leading tabs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-03-11 13:45:58 +01:00
Corinna Vinschen ac36c2ec90 Bump DLL version to 3.1.5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-19 13:38:42 +01:00
Corinna Vinschen 40245925ce Cygwin: rename NSIG to _NSIG, change visibility of NSIG to MISC
NSIG is a deprecated symbol only visible under MISC visibility.
_NSIG is used widely instead, and on most systems NSIG is
defined in terms of _NSIG.

Follow suit: Change NSIG to _NSIG throughout and change visiblity
of NSIG to be defined only in __MISC_VISIBLE case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-18 11:25:12 +01:00
Corinna Vinschen 6afb1ba504 Cygwin: Bump DLL version to 3.1.4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-02-17 13:56:44 +01:00
Keith Packard 9042d0ce65 Use remove-advertising-clause script to edit BSD licenses
This edits licenses held by Berkeley and NetBSD, both of which
have removed the advertising requirement from their licenses.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-01-29 19:03:31 +01:00
Corinna Vinschen 71091d165f Cygwin: Bump DLL version to 3.1.3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-01-24 10:17:31 +01:00
Mark Geisert 7b6414d459 Cygwin: Add missing Linux #define of CPU_SETSIZE
Though our implementation of cpu sets doesn't need it, software from
Linux environments expects this definition to be present.  It's
documented on the Linux CPU_SET(3) man page but was left out due to
oversight.

Addresses https://cygwin.com/ml/cygwin/2019-12/msg00248.html
2020-01-13 16:32:51 +01:00
Corinna Vinschen 7fc78f07ed Cygwin: Bump DLL version to 3.1.2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-18 10:48:10 +01:00
Corinna Vinschen d3574fc148 Cygwin: Bump DLL version to 3.1.1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-16 21:09:50 +01:00
Mark Geisert a083a4f266 Cygwin: fix CPU_SET macro visibility
The CPU_SET macros defined in Cygwin's include/sys/cpuset.h must not
be visible in an application's namespace unless _GNU_SOURCE has been
#defined.  Internally this means wrapping them in #if __GNU_VISIBLE.
2019-09-14 11:31:17 -04:00
Corinna Vinschen 7630c77026 Cygwin: sys/wait.h: Add _wait prototype to avoid compiler warning
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-09-03 17:00:43 +02:00
Mark Geisert 362b98b49a Cygwin: Implement CPU_SET(3) macros
This patch supplies an implementation of the CPU_SET(3) processor
affinity macros as documented on the relevant Linux man page.

There is a mostly superset implementation of cpusets under newlib's
libc/sys/RTEMS/include/sys that has Linux and FreeBSD compatibility
and is built on top of FreeBSD bitsets.  This Cygwin implementation
and the RTEMS one could be combined if desired at some future point.
2019-08-05 13:22:04 +02:00
Corinna Vinschen a13145a30d Cygwin: Export newlib ndbm functions
Signed-off-by: Corinna Vinschen <corinna-cygwin@cygwin.com>
2019-07-24 22:32:48 +02:00
Ken Brown 6b7723a830 Cygwin: unbreak the build with GCC 7
The recent port to GCC 8 used the 'nonstring' attribute, which is
unknown to GCC 7.  Define and use an 'ATTRIBUTE_NONSTRING' macro
instead.
2019-07-19 14:14:33 -04:00
Ken Brown b66dddb56d Cygwin: avoid GCC 8.3 errors with -Werror=stringop-truncation 2019-07-16 13:19:05 -04:00
Mark Geisert fff17ad73f Cygwin: Fix return value of sched_getaffinity
Have sched_getaffinity() interface like glibc's, and provide an
undocumented internal interface __sched_getaffinity_sys() like the Linux
kernel's sched_getaffinity() for benefit of taskset(1).
2019-06-28 17:10:39 +02:00
Corinna Vinschen 383e19ca55 sched: Move Cygwin cpuset definitions into Cygwin-specific header
This avoids build breakage on RTEMS.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-06-27 20:19:31 +02:00
Mark Geisert 641ecb0753 Cygwin: Implement sched_[gs]etaffinity()
This patch set implements the Linux syscalls sched_getaffinity,
sched_setaffinity, pthread_getaffinity_np, and pthread_setaffinity_np.
Linux has a straightforward view of the cpu sets used in affinity masks.
They are simply long (1024-bit) bit masks.  This code emulates that view
while internally dealing with Windows' distribution of available CPUs among
processor groups.
2019-06-24 09:18:14 +02:00
Corinna Vinschen ad101bcb0f Rename <xlocale.h> back to <sys/_locale.h>
libX11 provides <X11/Xlocale.h>.  The build of libX11 itself adds
include/X11 to the compiler's include path.  This results in a name
collision with /usr/include/xlocale.h on case-insensitive filesystems.

Commit 90e35b1eb3 renamed sys/_locale.h to xlocale.h in March 2017 under
the assumption that we should provide the locale_t type in the same file
as on Linux, FreeBSD, and Darwin.

A few weeks later (June 2017), glibc removed the xlocale.h file in favor
of bits/types/locale_t.h, which shouldn't be included directly anyway.

For reference and the reasoning, see
https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336d

Given the above, revert 90e35b1eb3 and
fix additional usage of xlocale.h.
2019-06-14 10:02:08 +02:00
Corinna Vinschen f527171a93 Cygwin: define MSG_EOR and refuse in send(2)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-04-25 19:00:08 +02:00
Corinna Vinschen 9fd429e6a7 Cygwin: Bump DLL version to 3.1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-27 14:01:44 +01:00
Corinna Vinschen 4afc52d57c Cygwin: sys/cygwin.h: fix formatting
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-23 17:50:47 +01:00
Corinna Vinschen ae3370bb9d Cygwin: strace: print windows and cygwin pid in event output
strace only printed the Windows PID in event output so far.

Especially now that Windows and Cygwin PID are decoupled, the
strace user might like to see the Cygwin pid in event output as
well.  However, at process startup, the process might not have
a Cygwin PID yet.

To mitigate this, always print the Windows PID and only add the
Cygwin pid if it exists.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-23 17:50:00 +01:00
Corinna Vinschen df960cb954 Cygwin: bump version to 3.0.5
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-18 11:29:00 +01:00
Corinna Vinschen 7cbe4b59d6 Cygwin: bump version to 3.0.4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-09 20:13:50 +01:00
Corinna Vinschen 633278b877 Cygwin: bump version to 3.0.3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-05 20:00:30 +01:00
Corinna Vinschen 40958b0d86 Cygwin: fenv.h: Add feature test macros, fix values
- feenableexcept,fedisableexcept, fegetexcept are GNU-only
- fegetprec, fesetprec are Solaris, use __MISC_VISIBLE
- _feinitialise is Cygwin-internal only
- Replace self-named FP precision values to values from
  http://www.open-std.org/jtc1/sc22//WG14/www/docs/n752.htm
  as used by Solaris.
- Change return value of fesetprec to adhere to the above document
  and Solaris.
- Document fegetprec, fesetprec as Solaris functions, not as GNU
  functions

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-01 21:08:44 +01:00
Corinna Vinschen 65c569f9fd Cygwin: bump version to 3.0.2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-22 00:13:06 +01:00
Yaakov Selkowitz 850705f92e Cygwin: add secure_getenv
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2019-02-19 13:01:50 -06:00
Corinna Vinschen dd415f1a8c Cygwin: sys/mount.h: fix comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-19 19:34:40 +01:00
Corinna Vinschen 959077ac0a CYgwin: bump API minor for MOUNT_BINARY -> MOUNT_TEXT change
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-18 11:04:38 +01:00
Corinna Vinschen 367c1ae161 Cygwin: mount: define binary mount as default
Commit c1023ee353 changed the way
path_conv::binmode() works.  Rather than returning three states,
O_BINARY, O_TEXT, 0, it only returned 2 states, O_BINARY, O_TEXT.  Since
mounts are only binary if they are explicitely mounted binary by setting
the MOUNT_BINARY flag, textmode is default.

This introduced a new bug.  When inheriting stdio HANDLEs from native
Windows processes, the fhandler and its path_conv are created from a
device struct only.  None of the path or mount flags get set this way.
So the mount flags are 0 and path_conv::binmode() returned 0.

After the path_conv::binmode() change it returned O_TEXT since, as
explained above, the default mount mode is textmode.

Rather than just enforcing binary mode for path_conv's created from
device structs, this patch changes the default mount mode to binary:

Replace MOUNT_BINARY flag with MOUNT_TEXT flag with opposite meaning.
Drop all explicit setting of MOUNT_BINARY.  Drop local set_flags
function, it doesn't add any value.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-18 10:26:53 +01:00
Corinna Vinschen 538e7abc36 Cygwin: bump version to 3.0.1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-16 18:11:16 +01:00
Michael Haubenwallner 135577f708 forkables: simplify disabling via shm
* Rename cygwin_shared->prefer_forkable_hardlinks to
  forkable_hardlink_support, with values
  0 for Unknown, 1 for Supported, -1 for Unsupported.
  Upon first dll loaded ever, dll_list::forkable_ntnamesize checks the
  /var/run/cygfork directory to both exist and reside on NTFS, setting
  cygwin_shared->forkable_hardlink_support accordingly.
* Replace enum forkables_needs by bool forkables_created: Set
  to True by request_forkables after creating forkable hardlinks.
2019-02-07 15:58:02 +01:00
Michael Haubenwallner 5a41aa6f4d forkables: Keep hardlinks disabled via shared mem.
To avoid the need for each process to check the filesystem to detect
that hardlink creation is impossible or disabled, cache this fact in
shared memory.  Removing cygfork directory while in use does disable
hardlinks creation.  To (re-)enable hardlinks creation, the cygfork
directory has to exist before the first cygwin process does fork.

	* forkable.cc (dll_list::forkable_ntnamesize): Short cut
	forkables needs to impossible when disabled via shared memory.
	(dll_list::update_forkables_needs): When detecting hardlink
	creation as impossible (not on NTFS) while still (we are the
	first one checking) enabled via shared memory, disable the
	shared memory value.
	(dll_list::request_forkables): Disable the shared memory value
	when hardlinks creation became disabled, that is when the
	cygfork directory was removed.
	* include/cygwin/version.h: Bump CYGWIN_VERSION_SHARED_DATA 6.
	* shared_info.h (struct shared_info): Add member
	prefer_forkable_hardlinks.  Update CURR_SHARED_MAGIC.
	* shared.cc (shared_info::initialize): Initialize
	prefer_forkable_hardlinks to 1 (Yes).
2019-02-07 15:58:02 +01:00
Corinna Vinschen 658f939003 Cygwin: kill(1): introduce a -W option
Allow to kill processes using Windows PIDs on the command line.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-02 21:02:00 +01:00
Corinna Vinschen b5e1003722 Cygwin: processes: use dedicated Cygwin PID rather than Windows PID
Using the Windows PID as Cygwin PID has a few drawbacks:

- the PIDs on Windows get reused quickly.  Some POSIX applications choke
  on that, so we need extra code to avoid too quick PID reuse.

- The code to avoid PID reuse keeps parent process handles and
  (depending on a build option) child processes open unnecessarily.

- After an execve, the process has a split personality:  Its Windows PID
  is a new PID, while its Cygwin PID is the PID of the execve caller
  process.  This requires to keep two procinfo shared sections open, the
  second just to redirect process info requests to the first, correct
  one.

This patch changes the way Cygwin PIDs are generated:

- Cygwin PIDs are generated independently of the Windows PID, in a way
  expected by POSIX processes.  The PIDs are created incrementally in
  the range between 2 and 65535, round-robin.

- On startup of the first Cygwin process, choose a semi-random start PID
  for the first process in the lower PID range to make the PIDs slightly
  unpredictable.  This may not be necessary but it seems kind of inviting
  to know that the first Cygwin process always starts with PID 2.

- Every process not only creates the shared procinfo section, but also a
  symlink in the NT namespace, symlinking the Windows PID to the Cygwin
  PID.  This drops the need for the extra procinfo section after execve.

- Don't keep other process handles around unnecessarily.

- Simplify the code creating/opening the shared procinfo section and
  make a clear distinction between interfaces getting a Cygwin PID and
  interfaces getting a Windows PID.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-01 20:06:47 +01:00
Corinna Vinschen 0fb497165f Cygwin: seteuid: use Kerberos/MsV1_0 S4U authentication by default
- This simple and official method replaces cyglsa and "create token"
  methods.  No network share access, same as before.

- lsaauth and create_token are disabled now.  If problems crop up,
  they can be easily reactivated.  If no problems crop up, they
  can be removed in a while, together with the lsaauth subdir.

- Bump Cygwin version to 3.0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-26 19:41:03 +01:00
Corinna Vinschen 84230b71c6 Cygwin: uname: Raise size of utsname fields and revamp uname(2) output
New format:

  sysname:      CYGWIN_NT-${osversion}-${os_build_number}[-WOW64]
  nodename:     `gethostname`
  release:      ${cygwin_version}-${API minor}.${arch}[.snap]
  version:      YYYY-MM-DD HH:MM UTC
  machine:      ${arch}
_GNU_SOURCE:
  domainname:   `getdomainname`
!_GNU_SOURCE:
  __domainname: `getdomainname`

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-26 18:37:25 +01:00
Corinna Vinschen 6ffcc50f19 Cygwin: netdb.h: fix __GNU_VISIBLE tests
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-26 18:34:03 +01:00