public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: sysconf: don't set errno for unsupported options
Date: Wed,  2 Mar 2022 21:03:36 +0000 (GMT)	[thread overview]
Message-ID: <20220302210336.9969C385842C@sourceware.org> (raw)

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

commit fcec4830abf0aa4821ba1a5dd1d9fb35d671cb85
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Mar 2 22:02:24 2022 +0100

    Cygwin: sysconf: don't set errno for unsupported options
    
    We return -1 with errno set to EINVAL for sysconf options for
    values required by POSIX, but not implemented on Cygwin.
    This is incorrect.  Return -1, but don't set errno for these options.
    Drop the "nsup" enum to indicate unsupported values, it's not
    required anymore.
    
    Fixes: 59e3b6ca7dc10 (CVS import)
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/sysconf.cc | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
index 0aa63dd14..3d0bb9c4f 100644
--- a/winsup/cygwin/sysconf.cc
+++ b/winsup/cygwin/sysconf.cc
@@ -473,7 +473,7 @@ get_cpu_cache (int in)
   return 0;
 }
 
-enum sc_type { nsup, cons, func };
+enum sc_type { cons, func };
 
 static struct
 {
@@ -547,7 +547,7 @@ static struct
   {cons, {c:BC_SCALE_MAX}},		/*  59, _SC_BC_SCALE_MAX */
   {cons, {c:BC_STRING_MAX}},		/*  60, _SC_BC_STRING_MAX */
   {cons, {c:_POSIX_CLOCK_SELECTION}},	/*  61, _SC_CLOCK_SELECTION */
-  {nsup, {c:0}},			/*  62, _SC_COLL_WEIGHTS_MAX */
+  {cons, {c:-1L}},			/*  62, _SC_COLL_WEIGHTS_MAX */
   {cons, {c:_POSIX_CPUTIME}},		/*  63, _SC_CPUTIME */
   {cons, {c:EXPR_NEST_MAX}},		/*  64, _SC_EXPR_NEST_MAX */
   {cons, {c:HOST_NAME_MAX}},		/*  65, _SC_HOST_NAME_MAX */
@@ -563,19 +563,19 @@ static struct
   {cons, {c:_POSIX_SPAWN}},		/*  75, _SC_SPAWN */
   {cons, {c:_POSIX_SPIN_LOCKS}},	/*  76, _SC_SPIN_LOCKS */
   {cons, {c:-1L}},			/*  77, _SC_SPORADIC_SERVER */
-  {nsup, {c:0}},			/*  78, _SC_SS_REPL_MAX */
+  {cons, {c:-1L}},			/*  78, _SC_SS_REPL_MAX */
   {cons, {c:SYMLOOP_MAX}},		/*  79, _SC_SYMLOOP_MAX */
   {cons, {c:_POSIX_THREAD_CPUTIME}},	/*  80, _SC_THREAD_CPUTIME */
   {cons, {c:-1L}},			/*  81, _SC_THREAD_SPORADIC_SERVER */
   {cons, {c:_POSIX_TIMEOUTS}},		/*  82, _SC_TIMEOUTS */
   {cons, {c:-1L}},			/*  83, _SC_TRACE */
   {cons, {c:-1L}},			/*  84, _SC_TRACE_EVENT_FILTER */
-  {nsup, {c:0}},			/*  85, _SC_TRACE_EVENT_NAME_MAX */
+  {cons, {c:-1}},			/*  85, _SC_TRACE_EVENT_NAME_MAX */
   {cons, {c:-1L}},			/*  86, _SC_TRACE_INHERIT */
   {cons, {c:-1L}},			/*  87, _SC_TRACE_LOG */
-  {nsup, {c:0}},			/*  88, _SC_TRACE_NAME_MAX */
-  {nsup, {c:0}},			/*  89, _SC_TRACE_SYS_MAX */
-  {nsup, {c:0}},			/*  90, _SC_TRACE_USER_EVENT_MAX */
+  {cons, {c:-1L}},			/*  88, _SC_TRACE_NAME_MAX */
+  {cons, {c:-1L}},			/*  89, _SC_TRACE_SYS_MAX */
+  {cons, {c:-1L}},			/*  90, _SC_TRACE_USER_EVENT_MAX */
   {cons, {c:-1L}},			/*  91, _SC_TYPED_MEMORY_OBJECTS */
   {cons, {c:_POSIX_V6_ILP32_OFF32}},	/*  92, _SC_V6_ILP32_OFF32 */
   {cons, {c:_POSIX_V6_ILP32_OFFBIG}},	/*  93, _SC_V6_ILP32_OFFBIG */
@@ -640,8 +640,6 @@ sysconf (int in)
     {
       switch (sca[in].type)
 	{
-	case nsup:
-	  break;
 	case cons:
 	  return sca[in].c;
 	case func:


                 reply	other threads:[~2022-03-02 21:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220302210336.9969C385842C@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).