https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=363357c023ce01e936bdaedf0f479292a8fa4e0f

commit 363357c023ce01e936bdaedf0f479292a8fa4e0f
Author:     Corinna Vinschen <cori...@vinschen.de>
AuthorDate: Thu Dec 19 19:52:56 2024 +0100
Commit:     Corinna Vinschen <cori...@vinschen.de>
CommitDate: Thu Dec 19 20:08:18 2024 +0100

    Cygwin: pinfo: raise MAX_PID to 4194304
    
    Reportedly, the maximum pid of 65536 is much too small in bigger
    environments.  Raise the maximum PID to 4194304, whihc is the maximum
    pid on Linux (PID_MAX_LIMIT defined in include/linux/threads.h).
    
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>

Diff:
---
 winsup/cygwin/local_includes/pinfo.h | 2 +-
 winsup/cygwin/pinfo.cc               | 2 +-
 winsup/cygwin/release/3.6.0          | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/local_includes/pinfo.h 
b/winsup/cygwin/local_includes/pinfo.h
index be5d53021523..4de0f80dd0c5 100644
--- a/winsup/cygwin/local_includes/pinfo.h
+++ b/winsup/cygwin/local_includes/pinfo.h
@@ -223,7 +223,7 @@ private:
   DWORD status_exit (DWORD);
 };
 
-#define MAX_PID 65536
+#define MAX_PID 4194304
 
 #define ISSTATE(p, f)  (!!((p)->process_state & f))
 #define NOTSTATE(p, f) (!((p)->process_state & f))
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index fecf76eb6f36..1f26a3ccd77e 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -239,7 +239,7 @@ pinfo::exit (DWORD n)
 }
 # undef self
 
-/* Return next free Cygwin PID between 2 and 65535, round-robin.  Each new
+/* Return next free Cygwin PID between 2 and MAX_PID, round-robin.  Each new
    PID is checked that it doesn't collide with an existing PID.  For that,
    just check if the "cygpid.PID" section exists. */
 pid_t
diff --git a/winsup/cygwin/release/3.6.0 b/winsup/cygwin/release/3.6.0
index 47c19a86bac3..4b7604907902 100644
--- a/winsup/cygwin/release/3.6.0
+++ b/winsup/cygwin/release/3.6.0
@@ -74,3 +74,7 @@ What changed:
   '(18) priority' is now set to the negated sched_policy minus one.
   If SCHED_IDLE is selected, this field is set to 39.  The '(19) nice'
   field is now set to the originally requested nice value.
+
+- Raise maximum pid from 65536 to 4194304 to account for scenarios
+  with lots of CPUs and lots of tasks.
+  Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256927.html

Reply via email to