* [PATCH] update sysconf, confstr, limits
@ 2011-07-18 22:27 Yaakov (Cygwin/X)
2011-07-18 22:59 ` Christopher Faylor
0 siblings, 1 reply; 2+ messages in thread
From: Yaakov (Cygwin/X) @ 2011-07-18 22:27 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
This patch adds return values for recent additions to sysconf() and
confstr(), and adds a couple of missing <limits.h> defines required by
POSIX.
This patch, plus the one just posted to newlib@, are required for my
next patch, a getconf(1) implementation.
Yaakov
Cygwin/X
[-- Attachment #2: cygwin-sysconf-update.patch --]
[-- Type: text/x-patch, Size: 2952 bytes --]
2011-07-18 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* sysconf.cc (sca): Return -1 for _SC_THREAD_ROBUST_PRIO_INHERIT,
_SC_THREAD_ROBUST_PRIO_PROTECT, and _SC_XOPEN_UUCP.
(SC_MAX): Redefine accordingly.
(csa): Return strings for _CS_POSIX_V7_THREADS_CFLAGS,
_CS_POSIX_V7_THREADS_LDFLAGS, and _CS_V7_ENV.
(CS_MAX): Redefine accordingly.
* include/limits.h (LONG_BIT): Define.
(WORD_BIT): Define.
Index: sysconf.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/sysconf.cc,v
retrieving revision 1.59
diff -u -p -r1.59 sysconf.cc
--- sysconf.cc 6 Jun 2011 05:02:13 -0000 1.59
+++ sysconf.cc 18 Jul 2011 22:17:42 -0000
@@ -219,10 +219,13 @@ static struct
{cons, {c:_POSIX2_SW_DEV}}, /* 119, _SC_2_SW_DEV */
{cons, {c:_POSIX2_UPE}}, /* 120, _SC_2_UPE */
{cons, {c:_POSIX2_VERSION}}, /* 121, _SC_2_VERSION */
+ {cons, {c:-1L}}, /* 122, _SC_THREAD_ROBUST_PRIO_INHERIT */
+ {cons, {c:-1L}}, /* 123, _SC_THREAD_ROBUST_PRIO_PROTECT */
+ {cons, {c:-1L}}, /* 124, _SC_XOPEN_UUCP */
};
#define SC_MIN _SC_ARG_MAX
-#define SC_MAX _SC_2_VERSION
+#define SC_MAX _SC_XOPEN_UUCP
/* sysconf: POSIX 4.8.1.1 */
/* Allows a portable app to determine quantities of resources or
@@ -259,7 +262,7 @@ static struct
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
{0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LIBS */
- {0, NULL}, /* _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS */
+ {0, NULL}, /* _CS_XBS5_ILP32_OFF32_LINTFLAGS */
{ls ("")}, /* _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
{ls ("")}, /* _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
{ls ("")}, /* _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
@@ -273,10 +276,13 @@ static struct
{0, NULL}, /* _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
{0, NULL}, /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
{ls ("POSIX_V6_ILP32_OFFBIG")}, /* _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS */
+ {ls ("")}, /* _CS_POSIX_V7_THREADS_CFLAGS */
+ {ls ("")}, /* _CS_POSIX_V7_THREADS_LDFLAGS */
+ {ls ("POSIXLY_CORRECT=1")}, /* _CS_V7_ENV */
};
#define CS_MIN _CS_PATH
-#define CS_MAX _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
+#define CS_MAX _CS_V7_ENV
extern "C" size_t
confstr (int in, char *buf, size_t len)
Index: include/limits.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/limits.h,v
retrieving revision 1.26
diff -u -p -r1.26 limits.h
--- include/limits.h 11 Aug 2009 07:28:22 -0000 1.26
+++ include/limits.h 18 Jul 2011 22:17:42 -0000
@@ -26,6 +26,14 @@ details. */
#undef CHAR_BIT
#define CHAR_BIT 8
+/* Number of bits in a `long'. */
+#undef LONG_BIT
+#define LONG_BIT 32
+
+/* Number of bits in a `int'. */
+#undef WORD_BIT
+#define WORD_BIT 32
+
/* Maximum length of a multibyte character. */
#ifndef MB_LEN_MAX
/* TODO: This is newlib's max value. We should probably rather define our
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] update sysconf, confstr, limits
2011-07-18 22:27 [PATCH] update sysconf, confstr, limits Yaakov (Cygwin/X)
@ 2011-07-18 22:59 ` Christopher Faylor
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Faylor @ 2011-07-18 22:59 UTC (permalink / raw)
To: cygwin-patches
On Mon, Jul 18, 2011 at 05:26:51PM -0500, Yaakov (Cygwin/X) wrote:
>This patch adds return values for recent additions to sysconf() and
>confstr(), and adds a couple of missing <limits.h> defines required by
>POSIX.
>
>This patch, plus the one just posted to newlib@, are required for my
>next patch, a getconf(1) implementation.
>
>
>Yaakov
>Cygwin/X
>
>2011-07-18 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
>
> * sysconf.cc (sca): Return -1 for _SC_THREAD_ROBUST_PRIO_INHERIT,
> _SC_THREAD_ROBUST_PRIO_PROTECT, and _SC_XOPEN_UUCP.
> (SC_MAX): Redefine accordingly.
> (csa): Return strings for _CS_POSIX_V7_THREADS_CFLAGS,
> _CS_POSIX_V7_THREADS_LDFLAGS, and _CS_V7_ENV.
> (CS_MAX): Redefine accordingly.
> * include/limits.h (LONG_BIT): Define.
> (WORD_BIT): Define.
Looks good. Please check in.
Thanks.
cgf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-18 22:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-18 22:27 [PATCH] update sysconf, confstr, limits Yaakov (Cygwin/X)
2011-07-18 22:59 ` Christopher Faylor
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).