From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 9969C385842C; Wed, 2 Mar 2022 21:03:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9969C385842C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: sysconf: don't set errno for unsupported options X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: cf00bba99a6170dd95b23b2f60cf3926d492b7df X-Git-Newrev: fcec4830abf0aa4821ba1a5dd1d9fb35d671cb85 Message-Id: <20220302210336.9969C385842C@sourceware.org> Date: Wed, 2 Mar 2022 21:03:36 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 21:03:36 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dfcec4830abf= 0aa4821ba1a5dd1d9fb35d671cb85 commit fcec4830abf0aa4821ba1a5dd1d9fb35d671cb85 Author: Corinna Vinschen Date: Wed Mar 2 22:02:24 2022 +0100 Cygwin: sysconf: don't set errno for unsupported options =20 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. =20 Fixes: 59e3b6ca7dc10 (CVS import) Signed-off-by: Corinna Vinschen 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; } =20 -enum sc_type { nsup, cons, func }; +enum sc_type { cons, func }; =20 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: