[uClibc-cvs] CVS update of uClibc/libc (pwd_grp/pwd_grp.c termios/ttyname.c unistd/sysconf.c)

Erik Andersen andersen at codepoet.org
Thu Jul 15 09:09:25 UTC 2004


    Date: Thursday, July 15, 2004 @ 03:09:25
  Author: andersen
    Path: /var/cvs/uClibc/libc

Modified: pwd_grp/pwd_grp.c (1.6 -> 1.7) termios/ttyname.c (1.13 -> 1.14)
          unistd/sysconf.c (1.15 -> 1.16)

Cleanup a few of the more egregiously broken sysconf values to
actually match reality.  In particular, _SC_GETPW_R_SIZE_MAX and
_SC_GETGR_R_SIZE_MAX were causing us problems with programs such
as libglib, since they were always returning -1, which is a bit
smaller than the actual passwd and group max buffer sizes.
 -Erik


Index: uClibc/libc/pwd_grp/pwd_grp.c
diff -u uClibc/libc/pwd_grp/pwd_grp.c:1.6 uClibc/libc/pwd_grp/pwd_grp.c:1.7
--- uClibc/libc/pwd_grp/pwd_grp.c:1.6	Wed Feb 11 16:48:41 2004
+++ uClibc/libc/pwd_grp/pwd_grp.c	Thu Jul 15 03:09:24 2004
@@ -49,6 +49,8 @@
 /**********************************************************************/
 /* Sizes for staticly allocated buffers. */
 
+/* If you change these values, also change _SC_GETPW_R_SIZE_MAX and
+ * _SC_GETGR_R_SIZE_MAX in libc/unistd/sysconf.c to match */
 #define PWD_BUFFER_SIZE 256
 #define GRP_BUFFER_SIZE 256
 
Index: uClibc/libc/termios/ttyname.c
diff -u uClibc/libc/termios/ttyname.c:1.13 uClibc/libc/termios/ttyname.c:1.14
--- uClibc/libc/termios/ttyname.c:1.13	Tue Jan 13 03:26:56 2004
+++ uClibc/libc/termios/ttyname.c	Thu Jul 15 03:09:24 2004
@@ -21,6 +21,8 @@
  * However, there is no need to waste space and support non-standard
  * tty names either.  So we compromise and use the following buffer
  * length.  (Erik and Manuel agreed that 32 was more than reasonable.)
+ *
+ * If you change this, also change _SC_TTY_NAME_MAX in libc/unistd/sysconf.c
  */
 #define TTYNAME_BUFLEN		32
 
Index: uClibc/libc/unistd/sysconf.c
diff -u uClibc/libc/unistd/sysconf.c:1.15 uClibc/libc/unistd/sysconf.c:1.16
--- uClibc/libc/unistd/sysconf.c:1.15	Wed Nov  5 00:08:20 2003
+++ uClibc/libc/unistd/sysconf.c	Thu Jul 15 03:09:23 2004
@@ -103,11 +103,7 @@
 #endif
 
     case _SC_OPEN_MAX:
-#if 1
       RETURN_FUNCTION(getdtablesize());
-#else
-      RETURN_NEG_1;
-#endif
 
     case _SC_STREAM_MAX:
 #ifdef	STREAM_MAX
@@ -117,12 +113,7 @@
 #endif
 
     case _SC_TZNAME_MAX:
-#if 0
-      RETURN_FUNCTION(tzname_max ());
-#else
-/*       RETURN_NEG_1; */
       return _POSIX_TZNAME_MAX;
-#endif
 
     case _SC_JOB_CONTROL:
 #ifdef	_POSIX_JOB_CONTROL
@@ -559,46 +550,39 @@
 
       /* POSIX 1003.1c (POSIX Threads).  */
     case _SC_THREADS:
-#ifdef	_POSIX_THREADS
+#ifdef __UCLIBC_HAS_THREADS__
       return 1;
 #else
       RETURN_NEG_1;
 #endif
 
     case _SC_THREAD_SAFE_FUNCTIONS:
-#ifdef	_POSIX_THREAD_SAFE_FUNCTIONS
+#ifdef __UCLIBC_HAS_THREADS__
       return 1;
 #else
       RETURN_NEG_1;
 #endif
 
+/* If you change these, also change libc/pwd_grp/pwd_grp.c to match */
+#define PWD_BUFFER_SIZE 256
+#define GRP_BUFFER_SIZE 256
     case _SC_GETGR_R_SIZE_MAX:
-#ifdef	NSS_BUFLEN_GROUP
-      return NSS_BUFLEN_GROUP;
-#else
-      RETURN_NEG_1;
-#endif
+      return GRP_BUFFER_SIZE;
 
     case _SC_GETPW_R_SIZE_MAX:
-#ifdef	NSS_BUFLEN_PASSWD
-      return NSS_BUFLEN_PASSWD;
-#else
-      RETURN_NEG_1;
-#endif
+      return PWD_BUFFER_SIZE;
 
+/* getlogin() is a worthless interface.  In uClibc we let the user specify
+ * whatever they want via the LOGNAME environment variable, or we return NULL
+ * if getenv() fails to find anything.  So this is merely how large a env
+ * variable can be.  Lets use 256 */
     case _SC_LOGIN_NAME_MAX:
-#ifdef	_POSIX_LOGIN_NAME_MAX
-      return _POSIX_LOGIN_NAME_MAX;
-#else
-      RETURN_NEG_1;
-#endif
+      return 256;
 
+/* If you change this, also change _SC_TTY_NAME_MAX in libc/unistd/sysconf.c */
+#define TTYNAME_BUFLEN		32
     case _SC_TTY_NAME_MAX:
-#ifdef	_POSIX_TTY_NAME_MAX
-      return _POSIX_TTY_NAME_MAX;
-#else
-      RETURN_NEG_1;
-#endif
+      return TTYNAME_BUFLEN;
 
     case _SC_THREAD_DESTRUCTOR_ITERATIONS:
 #ifdef	_POSIX_THREAD_DESTRUCTOR_ITERATIONS



More information about the uClibc-cvs mailing list