Re: [PATCH v2] Cygwin: signal: Avoid frequent TLS lock/unlock for SIGCONT processing

2025-01-22 Thread Corinna Vinschen
On Jan 22 07:58, Takashi Yano wrote:
> On Tue, 21 Jan 2025 13:20:46 -0800 (PST)
> Jeremy Drake wrote:
> > dscho hooked me up with a workflow to run Git for Windows' test suite on
> > an msys2-runtime pull request's CI artifacts. With this patch and the
> > three you pushed (reverting the v2 patch we had applied already, and
> > applying the two from the cygwin-3_5-branch), the test suite no longer
> > hangs.
> 
> Thanks for testing! I'm happy to hear that.

Me too.  Please push.

Thanks,
Corinna


Re: [PATCH v3] Cygwin: Minor updates to load average calculations

2025-01-22 Thread Corinna Vinschen
Jon?  Are yuo going to review this one?

Thanks,
Corinna


On Jan 20 00:18, Mark Geisert wrote:
> Commentary wording now refers to tasks (i.e., threads) rather than
> processes.  This makes it somewhat easier to justify adding two kinds of
> counters together.  After researching what "load average" has meant over
> time, we have what seems like a reasonable implementation, modulo
> Windows differences to Linux.  The best resource I found is:
> https://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html
> 
> At end of load_init(), obtain and discard the first measure of the
> counters to deal with the first call always returning error, no data.
> Follow this with a specific short delay so the next measure actually has
> data to report.
> 
> At least one older version of Windows, i.e. Win10 Pro 21H1, has a different
> name/location for the '% Processor Time' counter and is missing the
> 'Processor Queue Length' counter entirely.  Code is changed to support
> both possible locations of the former and treat the missing latter as always
> reporting 0.0.
> 
> A release note is added for 3.5.6.
> 
> Reported-by: Mark Liam Brown 
> Addresses: https://cygwin.com/pipermail/cygwin/2024-August/256361.html
> Signed-off-by: Mark Geisert 
> Fixes: 4dc982ddf60b (Cygwin: loadavg: improve debugging of load_init)
> 
> ---
>  winsup/cygwin/loadavg.cc| 50 ++---
>  winsup/cygwin/release/3.5.6 |  3 +++
>  2 files changed, 39 insertions(+), 14 deletions(-)
> 
> diff --git a/winsup/cygwin/loadavg.cc b/winsup/cygwin/loadavg.cc
> index 127591a2e..1c5e553a9 100644
> --- a/winsup/cygwin/loadavg.cc
> +++ b/winsup/cygwin/loadavg.cc
> @@ -15,17 +15,23 @@
>  
>A global load average estimate is maintained in shared memory.  Access to 
> that
>is guarded by a mutex.  This estimate is only updated at most every 5 
> seconds.
> +  The updates are done by any/all callers of the getloadavg() syscall.
>  
> -  We attempt to count running and runnable processes, but unlike linux we 
> don't
> -  count processes in uninterruptible sleep (blocked on I/O).
> +  We attempt to count running and runnable tasks (i.e., threads), but unlike
> +  Linux we don't count tasks in uninterruptible sleep (blocked on I/O).  
> There
> +  doesn't seem to be a kernel counter for the latter on Windows.
>  
> -  The number of running processes is estimated as (NumberOfProcessors) * (%
> -  Processor Time).  The number of runnable processes is estimated as
> -  ProcessorQueueLength.
> +  In the following text and code, "PDH" refers to Process Data Helper, a
> +  Windows component that arranges access to kernel counters.
> +
> +  The number of running tasks is estimated as
> +(the NumberOfProcessors counter) * (the % Processor Time counter).
> +  The number of runnable tasks is taken to be the ProcessorQueueLength 
> counter.
>  
>Note that PDH will only return data for '% Processor Time' afer the second
>call to PdhCollectQueryData(), as it's computed over an interval, so the 
> first
> -  attempt to estimate load will fail and 0.0 will be returned.
> +  attempt to estimate load will fail and 0.0 will be returned.  (This 
> nuisance
> +  is now worked-around near the end of load_init() below.)
>  
>We also assume that '% Processor Time' averaged over the interval since the
>last time getloadavg() was called is a good approximation of the 
> instantaneous
> @@ -68,8 +74,19 @@ static bool load_init (void)
>  if (status != STATUS_SUCCESS)
>{
>   debug_printf ("PdhAddEnglishCounterW(time), status %y", status);
> - return false;
> +
> + /* Windows 10 Pro 21H1, and maybe others, use an alternative name */
> +status = PdhAddEnglishCounterW (query,
> +L"\\Processor Information(_Total)\\% Processor Time",
> +0, &counter1);
> +if (status != STATUS_SUCCESS)
> +  {
> +debug_printf ("PdhAddEnglishCounterW(alt time), status %y", 
> status);
> +return false;
> +  }
>}
> +
> +/* Windows 10 Pro 21H1, and maybe others, are missing this counter */
>  status = PdhAddEnglishCounterW (query,
>   L"\\System\\Processor Queue Length",
>   0, &counter2);
> @@ -77,7 +94,7 @@ static bool load_init (void)
>  if (status != STATUS_SUCCESS)
>{
>   debug_printf ("PdhAddEnglishCounterW(queue length), status %y", status);
> - return false;
> + ; /* Ignore missing counter, just use zero in later calculations */
>}
>  
>  mutex = CreateMutex(&sec_all_nih, FALSE, "cyg.loadavg.mutex");
> @@ -87,6 +104,12 @@ static bool load_init (void)
>  }
>  
>  initialized = true;
> +
> +/* Do the first data collection (which always fails) here, rather than in
> +   get_load(). We wait at least one tick afterward so the collection done
> +   in get_load() is guaranteed to have data to work

Re: [PATCH v7 3/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 not implemented new additions

2025-01-22 Thread Corinna Vinschen
On Jan 17 10:01, Brian Inglis wrote:
> Add unavailable POSIX additions to Not Implemented section.
> 
> Signed-off-by: Brian Inglis 
> ---
>  winsup/doc/posix.xml | 26 --
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
> index ac05657d2246..7e66cb8fc1c0 100644
> --- a/winsup/doc/posix.xml
> +++ b/winsup/doc/posix.xml
> @@ -16,6 +16,9 @@ ISO/IEC DIS 9945 Information technology
>  - Issue 8.
>  
>  
> +CMPLX
> +CMPLXF   
> +CMPLXL   
>  FD_CLR
>  FD_ISSET
>  FD_SET
> @@ -554,6 +557,7 @@ ISO/IEC DIS 9945 Information technology
>  jn
>  jrand48
>  kill
> +kill_dependency  
>  killpg
>  l64a
>  labs
> @@ -1466,6 +1470,8 @@ ISO/IEC DIS 9945 Information technology
>  mempcpy
>  memrchr
>  mkostemps
> +posix_spawn_file_actions_addchdir_np
> +posix_spawn_file_actions_addfchdir_np
>  pow10
>  pow10f
>  pow10l

These first three hunks belong into patch #1 of the set, don't they?

> @@ -1677,9 +1683,14 @@ ISO/IEC DIS 9945 Information technology
>  
>  
>  
> -NOT implemented system interfaces from the 
> Single Unix Specification, Volume 7:
> +NOT implemented system interfaces from the 
> Single UNIX® Specification Version 5:
>  
>  
> +_Fork
> +dcgettext_l  
> +dcngettext_l 
> +dgettext_l   
> +dngettext_l  
>  endnetent
>  fattach
>  fmtmsg
> @@ -1691,17 +1702,28 @@ ISO/IEC DIS 9945 Information technology
>  getnetbyname
>  getnetent
>  getpmsg
> +getresgid
> +getresuid
> +gettext_l
>  isastream
>  mlockall
>  munlockall
> +ngettext_l   
> +posix_close  
> +posix_devctl (prototyped in cygwin-devel "devctl.h" header)

Hmm, I guess we should really keep this hint.

Note to self: However, given this is POSIX-1.2024 now, I think the
header in newlib is now incorrect.  We should rectify this.


Thanks,
Corinna


Re: [PATCH v7 4/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 move or remove dropped entries

2025-01-22 Thread Corinna Vinschen
On Jan 17 10:01, Brian Inglis wrote:
> Move entries no longer in POSIX from the SUS/POSIX section to
> Deprecated Interfaces section and mark with (SUSv4).
> Remove entries no longer in POSIX from the NOT Implemented section.

This looks good, but I just realized that a bunch of functions are
missing.

> -Other UNIX system interfaces, not in 
> POSIX.1-2008 or deprecated:
> +Other UNIX® system interfaces, not in 
> POSIX.1-2024, or deprecated:

When I introduced the ACL functions from the abandoned POSIX.1e draft,
I missed to add them to the docs.

Well, fortunately I'm now noticing this a mere 8 years later... *facepalm*

Sigh.  I'll create a patch to add them on top of your patches later on.


Thanks,
Corinna


Re: [PATCH v7 1/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 TOG Issue 8 ISO 9945 move new

2025-01-22 Thread Corinna Vinschen
Hi Brian,

your patch doesn't apply.  Apparently you didn't rebase the patch to the
latest state in the main branch, because your patch contains the changes
from commit 0813644661e3, which I wrote I'll fix separately in
https://sourceware.org/pipermail/cygwin-patches/2025q1/013265.html


Thanks,
Corinna


On Jan 17 10:01, Brian Inglis wrote:
> Update anchor id and description to current version, year, issue, etc.
> Move new POSIX entries in other sections to the SUS/POSIX section.
> 
> Signed-off-by: Brian Inglis 
> ---
>  winsup/doc/posix.xml | 145 ++-
>  1 file changed, 75 insertions(+), 70 deletions(-)
> 
> diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
> index 2782beb86547..9a8890936875 100644
> --- a/winsup/doc/posix.xml
> +++ b/winsup/doc/posix.xml
> @@ -5,10 +5,15 @@
>  http://www.w3.org/2001/XInclude";>
>  Compatibility
>  
> -System interfaces compatible with the Single 
> Unix Specification, Version 7:
> +System interfaces compatible with the Single 
> UNIX® Specification Version 5:
>  
> -Note that the core of the Single Unix Specification, Version 7 is
> -also IEEE Std 1003.1-2017 (POSIX.1-2017).
> +Note that the core of the Single UNIX® Specification Version 5 is
> +POSIX®.1-2024 also simultaneously IEEE Std 1003.1™-2024 Edition,
> +The Open Group Base Specifications Issue 8
> +(see https://pubs.opengroup.org/onlinepubs/9799919799/), and
> +ISO/IEC DIS 9945 Information technology
> +- Portable Operating System Interface (POSIX®) base specifications
> +- Issue 8.
>  
>  
>  FD_CLR
> @@ -25,6 +30,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  abort
>  abs
>  accept
> +accept4
>  access
>  acos
>  acosf
> @@ -40,6 +46,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  aio_suspend
>  aio_write
>  alarm
> +aligned_alloc
>  alphasort
>  asctime
>  asctime_r
> @@ -49,6 +56,9 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  asinhf
>  asinhl
>  asinl
> +asprintf
> +assert
> +at_quick_exit
>  atan
>  atan2
>  atan2f
> @@ -68,6 +78,8 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  bind
>  bsearch
>  btowc
> +c16rtomb
> +c32rtomb
>  cabs
>  cabsf
>  cabsl
> @@ -77,6 +89,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  cacoshf
>  cacoshl
>  cacosl
> +call_once
>  calloc
>  carg
>  cargf
> @@ -134,6 +147,12 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  close
>  closedir
>  closelog
> +cnd_broadcast
> +cnd_destroy
> +cnd_init
> +cnd_signal
> +cnd_timedwait
> +cnd_wait
>  confstr
>  conj
>  conjf
> @@ -158,7 +177,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  crealf
>  creall
>  creat
> -crypt(available in external "crypt" library)
> +crypt(available in external "libcrypt" library)
>  csin
>  csinf
>  csinh
> @@ -191,6 +210,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  dirfd
>  dirname
>  div
> +dladdr   (see chapter 
> "Implementation Notes")
>  dlclose
>  dlerror
>  dlopen
> @@ -199,8 +219,9 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  drand48
>  dup
>  dup2
> +dup3
>  duplocale
> -encrypt  (available in external "crypt" library)
> +encrypt  (available in external "libcrypt" library)
>  endgrent
>  endhostent
>  endprotoent
> @@ -265,6 +286,8 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  fexecve
>  fflush
>  ffs
> +ffsl
> +ffsll
>  fgetc
>  fgetpos
>  fgets
> @@ -541,6 +564,8 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  malloc
>  mblen
>  mbrlen
> +mbrtoc16
> +mbrtoc32
>  mbrtowc
>  mbsinit
>  mbsnrtowcs
> @@ -551,6 +576,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  memchr
>  memcmp
>  memcpy
> +memmem
>  memmove
>  memset
>  mkdir
> @@ -560,6 +586,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  mkfifoat
>  mknod
>  mknodat
> +mkostemp
>  mkstemp
>  mktime
>  mlock
> @@ -584,6 +611,12 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  msgrcv   (see chapter 
> "Implementation Notes")
>  msgsnd   (see chapter 
> "Implementation Notes")
>  msync
> +mtx_destroy
> +mtx_init
> +mtx_lock
> +mtx_timedlock
> +mtx_trylock
> +mtx_unlock
>  munlock
>  munmap
>  nan
> @@ -622,6 +655,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  pclose
>  perror
>  pipe
> +pipe2
>  poll
>  popen
>  posix_fadvise
> @@ -630,8 +664,10 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
>  posix_memalign
>  posix_openpt
>  posix_spawn
> +posix_spawn_file_actions_addchdir
>  posix_spawn_file_actions_addclose
>  posix_spawn_file_actions_adddup2

Re: [PATCH v3] Cygwin: Minor updates to load average calculations

2025-01-22 Thread Jon Turney

On 22/01/2025 10:13, Corinna Vinschen wrote:

Jon?  Are yuo going to review this one?


This looks fine to me. No notes. Please apply.

Thanks Mark!

(and a particular thank you for fixing the process vs. thread vagueness 
I'd made in the comments)




Re: [PATCH v7 3/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 not implemented new additions

2025-01-22 Thread Corinna Vinschen
On Jan 22 12:04, Corinna Vinschen wrote:
> On Jan 17 10:01, Brian Inglis wrote:
> > Add unavailable POSIX additions to Not Implemented section.
> > 
> > Signed-off-by: Brian Inglis 
> > ---
> >  winsup/doc/posix.xml | 26 --
> >  1 file changed, 24 insertions(+), 2 deletions(-)
> > 
> > diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
> > index ac05657d2246..7e66cb8fc1c0 100644
> > --- a/winsup/doc/posix.xml
> > +++ b/winsup/doc/posix.xml
> > @@ -16,6 +16,9 @@ ISO/IEC DIS 9945 Information technology
> >  - Issue 8.
> >  
> >  
> > +CMPLX  
> > +CMPLXF 
> > +CMPLXL 
> >  FD_CLR
> >  FD_ISSET
> >  FD_SET
> > @@ -554,6 +557,7 @@ ISO/IEC DIS 9945 Information technology
> >  jn
> >  jrand48
> >  kill
> > +kill_dependency
> >  killpg
> >  l64a
> >  labs
> > @@ -1466,6 +1470,8 @@ ISO/IEC DIS 9945 Information technology
> >  mempcpy
> >  memrchr
> >  mkostemps
> > +posix_spawn_file_actions_addchdir_np
> > +posix_spawn_file_actions_addfchdir_np
> >  pow10
> >  pow10f
> >  pow10l
> 
> These first three hunks belong into patch #1 of the set, don't they?

No, sorry, into patch #2, of course.


Corinna


Re: [PATCH] Cygwin: mmap: use 64K pages for bookkeeping

2025-01-22 Thread Corinna Vinschen
On Jan 20 10:36, Ken Brown wrote:
> On 1/20/2025 6:49 AM, Corinna Vinschen wrote:
> > Nice idea, but this may not do what is expected if the mapping is an
> > anonymous mapping, leaving the protection or mapping of trailing pages
> > in a wrong state, isn't it?
> > 
> > Can we easily make sure the type of mapping (file vs anon) is known
> > at the time of rounding, so the rounding is performed differently?
> I hadn't thought of that.  Actually, I *think* the record length is already
> a multiple of 64K for an anonymous mapping.

You're right, of course.  For an anonymous mapping, mmap() forces len to
be a multiple of wincap.allocation_granularity() anyway.

So yeah, looks like your previous patch does the trick.  Feel free to
push it, but I would love to see a comment in mmap_record::match() to
explain why we do it this way.


Thanks,
Corinna


Re: [PATCH v7 1/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 TOG Issue 8 ISO 9945 move new

2025-01-22 Thread Brian Inglis

Hi Corinna,

No - never occurred to me other changes would be made here - I have enough 
problems tracking rebasing from *MY OWN* upstream!


On 2025-01-22 03:51, Corinna Vinschen wrote:

Hi Brian,

your patch doesn't apply.  Apparently you didn't rebase the patch to the
latest state in the main branch, because your patch contains the changes
from commit 0813644661e3, which I wrote I'll fix separately in
https://sourceware.org/pipermail/cygwin-patches/2025q1/013265.html


Thanks,
Corinna


On Jan 17 10:01, Brian Inglis wrote:

Update anchor id and description to current version, year, issue, etc.
Move new POSIX entries in other sections to the SUS/POSIX section.

Signed-off-by: Brian Inglis 
---
  winsup/doc/posix.xml | 145 ++-
  1 file changed, 75 insertions(+), 70 deletions(-)

diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 2782beb86547..9a8890936875 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -5,10 +5,15 @@
  http://www.w3.org/2001/XInclude";>
  Compatibility
  
-System interfaces compatible with the Single Unix Specification, Version 7:

+System interfaces compatible with the Single UNIX® 
Specification Version 5:
  
-Note that the core of the Single Unix Specification, Version 7 is

-also IEEE Std 1003.1-2017 (POSIX.1-2017).
+Note that the core of the Single UNIX® Specification Version 5 is
+POSIX®.1-2024 also simultaneously IEEE Std 1003.1™-2024 Edition,
+The Open Group Base Specifications Issue 8
+(see https://pubs.opengroup.org/onlinepubs/9799919799/), and
+ISO/IEC DIS 9945 Information technology
+- Portable Operating System Interface (POSIX®) base specifications
+- Issue 8.
  
  

  FD_CLR
@@ -25,6 +30,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  abort
  abs
  accept
+accept4
  access
  acos
  acosf
@@ -40,6 +46,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  aio_suspend
  aio_write
  alarm
+aligned_alloc
  alphasort
  asctime
  asctime_r
@@ -49,6 +56,9 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  asinhf
  asinhl
  asinl
+asprintf
+assert
+at_quick_exit
  atan
  atan2
  atan2f
@@ -68,6 +78,8 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  bind
  bsearch
  btowc
+c16rtomb
+c32rtomb
  cabs
  cabsf
  cabsl
@@ -77,6 +89,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  cacoshf
  cacoshl
  cacosl
+call_once
  calloc
  carg
  cargf
@@ -134,6 +147,12 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  close
  closedir
  closelog
+cnd_broadcast
+cnd_destroy
+cnd_init
+cnd_signal
+cnd_timedwait
+cnd_wait
  confstr
  conj
  conjf
@@ -158,7 +177,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  crealf
  creall
  creat
-crypt  (available in external "crypt" library)
+crypt  (available in external "libcrypt" library)
  csin
  csinf
  csinh
@@ -191,6 +210,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  dirfd
  dirname
  div
+dladdr (see chapter "Implementation 
Notes")
  dlclose
  dlerror
  dlopen
@@ -199,8 +219,9 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  drand48
  dup
  dup2
+dup3
  duplocale
-encrypt(available in external "crypt" library)
+encrypt(available in external "libcrypt" library)
  endgrent
  endhostent
  endprotoent
@@ -265,6 +286,8 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  fexecve
  fflush
  ffs
+ffsl
+ffsll
  fgetc
  fgetpos
  fgets
@@ -541,6 +564,8 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  malloc
  mblen
  mbrlen
+mbrtoc16
+mbrtoc32
  mbrtowc
  mbsinit
  mbsnrtowcs
@@ -551,6 +576,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  memchr
  memcmp
  memcpy
+memmem
  memmove
  memset
  mkdir
@@ -560,6 +586,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  mkfifoat
  mknod
  mknodat
+mkostemp
  mkstemp
  mktime
  mlock
@@ -584,6 +611,12 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  msgrcv(see chapter "Implementation 
Notes")
  msgsnd(see chapter "Implementation 
Notes")
  msync
+mtx_destroy
+mtx_init
+mtx_lock
+mtx_timedlock
+mtx_trylock
+mtx_unlock
  munlock
  munmap
  nan
@@ -622,6 +655,7 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  pclose
  perror
  pipe
+pipe2
  poll
  popen
  posix_fadvise
@@ -630,8 +664,10 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).
  posix_memalign
  posix_openpt
  posix_spawn
+posix_spawn_file_actions_addchdir
  posix_spawn_file_actions_addclose
  posix_spawn_file_actions_adddup2
+posix_spawn_file_actions_addfchdir
  posix_sp

Re: [PATCH v7 3/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 not implemented new additions

2025-01-22 Thread Jon Turney

On 22/01/2025 17:36, Brian Inglis wrote:
[...]

"Please note some changes are displaced due to rebase conflicts."

which only appear after commit --amend/rebase --continue!

As I said before, I am now noticing the limitations of interactive 
rebasing and cherry-picking, sometimes skipping patches or hunks, 
especially after conflicts!


If you have any advice for avoiding those conflicts, please hit me with 
your clue stick! ;^>
 If a 'git rebase' reports merge conflicts, I would suggest using 'git 
mergetool' to invoke your favorite 3-way graphical merge tool (I like 
kdiff3, but you might have a different preference).




Re: [PATCH v7 3/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 not implemented new additions

2025-01-22 Thread Brian Inglis

On 2025-01-22 04:08, Corinna Vinschen wrote:

On Jan 22 12:04, Corinna Vinschen wrote:

On Jan 17 10:01, Brian Inglis wrote:

Add unavailable POSIX additions to Not Implemented section.

Signed-off-by: Brian Inglis 
---
  winsup/doc/posix.xml | 26 --
  1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index ac05657d2246..7e66cb8fc1c0 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -16,6 +16,9 @@ ISO/IEC DIS 9945 Information technology
  - Issue 8.
  
  

+CMPLX  
+CMPLXF 
+CMPLXL 
  FD_CLR
  FD_ISSET
  FD_SET
@@ -554,6 +557,7 @@ ISO/IEC DIS 9945 Information technology
  jn
  jrand48
  kill
+kill_dependency
  killpg
  l64a
  labs
@@ -1466,6 +1470,8 @@ ISO/IEC DIS 9945 Information technology
  mempcpy
  memrchr
  mkostemps
+posix_spawn_file_actions_addchdir_np
+posix_spawn_file_actions_addfchdir_np
  pow10
  pow10f
  pow10l


These first three hunks belong into patch #1 of the set, don't they?


No, sorry, into patch #2, of course.


Hi Corinna,

Re previous comment: I thought I was to apply those lib+crypt changes!

As I said in 0/5:

"Please note some changes are displaced due to rebase conflicts."

which only appear after commit --amend/rebase --continue!

As I said before, I am now noticing the limitations of interactive rebasing and 
cherry-picking, sometimes skipping patches or hunks, especially after conflicts!


If you have any advice for avoiding those conflicts, please hit me with your 
clue stick! ;^>


I will return with v8 - caffeine+sugar-powered rather than veggie-powered!

--
Take care. Thanks, Brian Inglis  Calgary, Alberta, Canada

La perfection est atteinte   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
-- Antoine de Saint-Exupéry


[PATCH 1/1] replace undocumented Nt* calls with documented win32 apis

2025-01-22 Thread Sebastian Hernandez via Cygwin-patches
Hi all,

Attaching the patch from the separate discussion in cygwin-developers - Re: 
[Proposed changes/Incoming patch] Undocumented call to 
ntdll.dll!NtAssignProcessToJobObject in msys2.0.dll / cygwin - included in 
mingit/Git for Windows.

The following patch includes the replacement of the following undocumented APIs 
and their documented counterparts.

  *   NtOpenJobObject - 
OpenJobObjectA
  *   NtCreateJobObject - 
CreateJobObjectA
  *   NtQueryInformationJobObject - 
QueryInformationJobObject
  *   NtSetInformationJobObject - 
SetInformationJobObject
  *
NTAssignProcessToJobObject - 
AssignProcessToJobObject

Please let us know if you have any further questions or feedback regarding the 
changes.

Whitney & Sebastian

P.S.
Unfortunately the use of git send-email was not possible due to firewall issues.



>From 2cf2176ee8dd35bc4fca8d420533dfb385241d24 Mon Sep 17 00:00:00 2001
From: "Sebastian Hernandez (from Dev Box)" 
Date: Wed, 22 Jan 2025 10:20:59 -0800
Subject: [PATCH 1/1] replace undocumented Nt* calls with documented win32 apis

---
 winsup/cygwin/local_includes/ntdll.h |  6 --
 winsup/cygwin/resource.cc| 93 ++--
 2 files changed, 61 insertions(+), 38 deletions(-)

diff --git a/winsup/cygwin/local_includes/ntdll.h 
b/winsup/cygwin/local_includes/ntdll.h
index 4497fe53f..9f07b37e4 100644
--- a/winsup/cygwin/local_includes/ntdll.h
+++ b/winsup/cygwin/local_includes/ntdll.h
@@ -1451,7 +1451,6 @@ extern "C"
   NTSTATUS NtAdjustPrivilegesToken (HANDLE, BOOLEAN, PTOKEN_PRIVILEGES, ULONG,
PTOKEN_PRIVILEGES, PULONG);
   NTSTATUS NtAllocateLocallyUniqueId (PLUID);
-  NTSTATUS NtAssignProcessToJobObject (HANDLE, HANDLE);
   NTSTATUS NtCancelTimer (HANDLE, PBOOLEAN);
   NTSTATUS NtClose (HANDLE);
   NTSTATUS NtCommitTransaction (HANDLE, BOOLEAN);
@@ -1461,7 +1460,6 @@ extern "C"
   NTSTATUS NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
  PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG, ULONG,
  ULONG, PVOID, ULONG);
-  NTSTATUS NtCreateJobObject (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
   NTSTATUS NtCreateKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, ULONG,
 PUNICODE_STRING, ULONG, PULONG);
   NTSTATUS NtCreateMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, BOOLEAN);
@@ -1498,7 +1496,6 @@ extern "C"
   NTSTATUS NtOpenEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
   NTSTATUS NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
 PIO_STATUS_BLOCK, ULONG, ULONG);
-  NTSTATUS NtOpenJobObject (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
   NTSTATUS NtOpenKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
   NTSTATUS NtOpenMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
   NTSTATUS NtOpenProcessToken (HANDLE, ACCESS_MASK, PHANDLE);
@@ -1520,8 +1517,6 @@ extern "C"
   NTSTATUS NtQueryEvent (HANDLE, EVENT_INFORMATION_CLASS, PVOID, ULONG, 
PULONG);
   NTSTATUS NtQueryInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
   FILE_INFORMATION_CLASS);
-  NTSTATUS NtQueryInformationJobObject (HANDLE, JOBOBJECTINFOCLASS, PVOID,
-  ULONG, PULONG);
   NTSTATUS NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS, PVOID, ULONG,
  PULONG);
   NTSTATUS NtQueryInformationThread (HANDLE, THREADINFOCLASS, PVOID, ULONG,
@@ -1555,7 +1550,6 @@ extern "C"
   NTSTATUS NtSetEvent (HANDLE, PULONG);
   NTSTATUS NtSetInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
 FILE_INFORMATION_CLASS);
-  NTSTATUS NtSetInformationJobObject (HANDLE, JOBOBJECTINFOCLASS, PVOID, 
ULONG);
   NTSTATUS NtSetInformationThread (HANDLE, THREADINFOCLASS, PVOID, ULONG);
   NTSTATUS NtSetInformationToken (HANDLE, TOKEN_INFORMATION_CLASS, PVOID,
  ULONG);
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc
index 5ec436c2c..64c26c14d 100644
--- a/winsup/cygwin/resource.cc
+++ b/winsup/cygwin/resource.cc
@@ -177,27 +177,43 @@ job_shared_name (PWCHAR buf, LONG num)
 static void
 __get_rlimit_as (struct rlimit *rlp)
 {
-  UNICODE_STRING uname;
   WCHAR jobname[32];
-  OBJECT_ATTRIBUTES attr;
+  char jobnameA[32];
   HANDLE job = NULL;
-  NTSTATUS status;
+  BOOL result;
+  DWORD winError;
   JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobinfo;

   if (cygheap->rlim_as_id)
 {
-  RtlInitUnicodeString (&uname,
-job_shared_name (jobname,
-   cygheap->rlim_as_id));
-  InitializeObjectAttributes (&attr, &uname, 0,
- get_session_parent_dir (), NULL);
+  /* Get the wide

Re: [PATCH v7 4/5] Cygwin: winsup/doc/posix.xml: SUS V5 POSIX 2024 move or remove dropped entries

2025-01-22 Thread Jon Turney

On 22/01/2025 11:23, Corinna Vinschen wrote:

On Jan 17 10:01, Brian Inglis wrote:

Move entries no longer in POSIX from the SUS/POSIX section to
Deprecated Interfaces section and mark with (SUSv4).
Remove entries no longer in POSIX from the NOT Implemented section.


This looks good, but I just realized that a bunch of functions are
missing.


-Other UNIX system interfaces, not in POSIX.1-2008 or 
deprecated:
+Other UNIX® system interfaces, not in POSIX.1-2024, or 
deprecated:


When I introduced the ACL functions from the abandoned POSIX.1e draft,
I missed to add them to the docs.

Well, fortunately I'm now noticing this a mere 8 years later... *facepalm*

Sigh.  I'll create a patch to add them on top of your patches later on.

I happen to notice the other day that we don't mention eaccess() (which 
the glibc extension euidaccess() is a synonym for) here, which I think 
belongs in this section.