svn commit: branches/uClibc-nptl/libc/unistd

sjhill at uclibc.org sjhill at uclibc.org
Mon Aug 21 05:20:52 UTC 2006


Author: sjhill
Date: 2006-08-20 22:20:52 -0700 (Sun, 20 Aug 2006)
New Revision: 15887

Log:
Merge from trunk.


Removed:
   branches/uClibc-nptl/libc/unistd/getopt_long-susv3.c

Modified:
   branches/uClibc-nptl/libc/unistd/Makefile.in
   branches/uClibc-nptl/libc/unistd/confstr.c
   branches/uClibc-nptl/libc/unistd/daemon.c
   branches/uClibc-nptl/libc/unistd/exec.c
   branches/uClibc-nptl/libc/unistd/getlogin.c
   branches/uClibc-nptl/libc/unistd/getopt-susv3.c
   branches/uClibc-nptl/libc/unistd/getopt.c
   branches/uClibc-nptl/libc/unistd/getpass.c
   branches/uClibc-nptl/libc/unistd/sysconf.c
   branches/uClibc-nptl/libc/unistd/usershell.c


Changeset:
Modified: branches/uClibc-nptl/libc/unistd/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/unistd/Makefile.in	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/Makefile.in	2006-08-21 05:20:52 UTC (rev 15887)
@@ -19,11 +19,11 @@
 endif
 
 ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
-CSRC := $(filter-out getopt-susv3.c getopt_long-susv3.c,$(CSRC))
+CSRC := $(filter-out getopt-susv3.c getopt_long-simple.c,$(CSRC))
 else
 CSRC := $(filter-out getopt.c,$(CSRC))
 ifneq ($(UCLIBC_HAS_GETOPT_LONG),y)
-CSRC := $(filter-out getopt_long-susv3.c,$(CSRC))
+CSRC := $(filter-out getopt_long-simple.c,$(CSRC))
 endif
 endif
 
@@ -41,6 +41,8 @@
 UNISTD_OBJ := $(patsubst %.c,$(UNISTD_OUT)/%.o,$(CSRC))
 
 libc-y += $(UNISTD_OBJ)
+libc-a-y += $(UNISTD_OBJ)
+libc-so-y += $(UNISTD_OBJ:.o=.os)
 
 objclean-y += unistd_objclean
 

Modified: branches/uClibc-nptl/libc/unistd/confstr.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/confstr.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/confstr.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,20 +1,21 @@
-/* Copyright (C) 1991, 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 2000-2002, 2003, 2004
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stddef.h>
 #include <errno.h>
@@ -28,7 +29,7 @@
 /* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes
    of BUF with the value corresponding to NAME and zero-terminate BUF.
    Return the number of bytes required to hold NAME's entire value.  */
-size_t confstr ( int name, char *buf, size_t len)
+size_t confstr (int name, char *buf, size_t len)
 {
   const char *string;
   size_t string_len;

Modified: branches/uClibc-nptl/libc/unistd/daemon.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/daemon.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/daemon.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,41 +1,66 @@
 /* vi: set sw=4 ts=4: */
 /* daemon implementation for uClibc
  *
- * Copyright (c) 1991, 1993
+ * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
- * Modified for uClibc by Erik Andersen <andersee at debian.org>
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change 
+ *		ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> 
  *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
  *
- * Original copyright notice is retained at the end of this file.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ * Modified for uClibc by Erik Andersen <andersen at uclibc.org>
  */
 
-#define dup2 __dup2
-#define setsid __setsid
-#define chdir __chdir
-#define fork __fork
-
 #include <stdio.h>
 #include <features.h>
 #include <fcntl.h>
 #include <paths.h>
 #include <unistd.h>
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <errno.h>
+#include <sys/stat.h>
+#include <not-cancel.h>
+#endif
 
-#if defined __ARCH_HAS_MMU__
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
 
+libc_hidden_proto(open)
+libc_hidden_proto(close)
+libc_hidden_proto(_exit)
+libc_hidden_proto(dup2)
+libc_hidden_proto(setsid)
+libc_hidden_proto(chdir)
+libc_hidden_proto(fork)
+
 int daemon( int nochdir, int noclose )
 {
 	int fd;
@@ -46,63 +71,55 @@
 		case 0:
 			break;
 		default:
-			_exit_internal(0);
+			_exit(0);
 	}
 
 	if (setsid() == -1)
 		return(-1);
 
+#ifndef __UCLIBC_HAS_THREADS_NATIVE__
 	/* Make certain we are not a session leader, or else we
 	 * might reacquire a controlling terminal */
 	if (fork())
-		_exit_internal(0);
+		_exit(0);
+#endif
 
 	if (!nochdir)
 		chdir("/");
 
-	if (!noclose && (fd = __open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
-		dup2(fd, STDIN_FILENO);
-		dup2(fd, STDOUT_FILENO);
-		dup2(fd, STDERR_FILENO);
-		if (fd > 2)
-			__close(fd);
+#ifndef __UCLIBC_HAS_THREADS_NATIVE__
+	if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1)
+	{
+#else
+	if (!noclose)
+	{
+		struct stat64 st;
+
+		if ((fd = open_not_cancel(_PATH_DEVNULL, O_RDWR, 0)) != -1
+			&& (__builtin_expect (fstat64 (fd, &st), 0) == 0))
+		{
+			if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0) {
+#endif
+				dup2(fd, STDIN_FILENO);
+				dup2(fd, STDOUT_FILENO);
+				dup2(fd, STDERR_FILENO);
+				if (fd > 2)
+					close(fd);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+			}
+			else {
+				/* We must set an errno value since no
+				   function call actually failed.  */
+				close_not_cancel_no_status (fd);
+				__set_errno (ENODEV);
+				return -1;
+			}
+		} else {
+				close_not_cancel_no_status (fd);
+				return -1;
+		}
+#endif
 	}
 	return(0);
 }
-
 #endif
-
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change 
- *		ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> 
- *
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-

Modified: branches/uClibc-nptl/libc/unistd/exec.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/exec.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/exec.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,18 +1,6 @@
 /*  Copyright (C) 2004     Manuel Novoa III
  *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Library General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Library General Public License for more details.
- *
- *  You should have received a copy of the GNU Library General Public
- *  License along with this library; if not, write to the Free
- *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
 /* Jan 1, 2004
@@ -40,17 +28,16 @@
 #include <sys/mman.h>
 
 libc_hidden_proto(execl)
+libc_hidden_proto(execle)
 libc_hidden_proto(execvp)
 
 libc_hidden_proto(memcpy)
 libc_hidden_proto(strchr)
 libc_hidden_proto(strlen)
-libc_hidden_proto(strchrnul)
 libc_hidden_proto(execve)
 libc_hidden_proto(mmap)
 libc_hidden_proto(munmap)
 libc_hidden_proto(getenv)
-libc_hidden_proto(__environ)
 
 /**********************************************************************/
 #if defined(__ARCH_USE_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__)
@@ -180,6 +167,7 @@
 
 	return n;
 }
+libc_hidden_def(execle)
 
 #endif
 /**********************************************************************/
@@ -221,6 +209,8 @@
 /**********************************************************************/
 #ifdef L_execvp
 
+libc_hidden_proto(strchrnul)
+
 /* Use a default path that matches glibc behavior, since SUSv3 says
  * this is implementation-defined.  The default is current working dir,
  * /bin, and then /usr/bin. */

Modified: branches/uClibc-nptl/libc/unistd/getlogin.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/getlogin.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/getlogin.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,23 +1,8 @@
 /* vi: set sw=4 ts=4: */
-/* getlogin for uClibc
- *
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000-2002 by Erik Andersen <andersen at uclibc.org>
- * Written by Erik Andersen <andersen at uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+/*
+ * getlogin for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen at uclibc.org>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
 #include <stdlib.h>

Modified: branches/uClibc-nptl/libc/unistd/getopt-susv3.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/getopt-susv3.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/getopt-susv3.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,18 +1,6 @@
 /*  Copyright (C) 2003     Manuel Novoa III
  *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Library General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Library General Public License for more details.
- *
- *  You should have received a copy of the GNU Library General Public
- *  License along with this library; if not, write to the Free
- *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
 /*  ATTENTION!   ATTENTION!   ATTENTION!   ATTENTION!   ATTENTION!
@@ -37,7 +25,6 @@
 
 libc_hidden_proto(fprintf)
 libc_hidden_proto(strchr)
-libc_hidden_proto(stderr)
 
 #ifdef __UCLIBC_MJN3_ONLY__
 #warning TODO: Enable gettext awareness.

Modified: branches/uClibc-nptl/libc/unistd/getopt.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/getopt.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/getopt.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -127,7 +127,6 @@
 libc_hidden_proto(strncmp)
 libc_hidden_proto(getenv)
 libc_hidden_proto(fprintf)
-libc_hidden_proto(stderr)
 
 /* For communication from `getopt' to the caller.
    When `getopt' finds an option that takes an argument,

Deleted: branches/uClibc-nptl/libc/unistd/getopt_long-susv3.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/getopt_long-susv3.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/getopt_long-susv3.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2006 Rich Felker <dalias at aerifal.cx>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <stddef.h>
-#include <getopt.h>
-#include <stdio.h>
-
-libc_hidden_proto(getopt)
-
-static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
-{
-	if (optind >= argc || !argv[optind] || argv[optind][0] != '-') return -1;
-	if ((longonly && argv[optind][1]) ||
-		(argv[optind][1] == '-' && argv[optind][2]))
-	{
-		int i;
-		char *opt = argv[optind]+2;
-		for (i=0; longopts[i].name; i++) {
-			const char *name = longopts[i].name;
-			while (*name && *name++ == *opt++);
-			if (*name && *opt != '=') continue;
-			if (*opt == '=') {
-				if (!longopts[i].has_arg) continue;
-				optarg = opt+1;
-			} else {
-				if (longopts[i].has_arg == required_argument) {
-					if (!(optarg = argv[++optind]))
-						return ':';
-				} else optarg = NULL;
-			}
-			optind++;
-			if (idx) *idx = i;
-			if (longopts[i].flag) {
-				*longopts[i].flag = longopts[i].val;
-				return 0;
-			}
-			return longopts[i].val;
-		}
-		if (argv[optind][1] == '-') {
-			optind++;
-			return '?';
-		}
-	}
-	return getopt(argc, argv, optstring);
-}
-
-int getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx)
-{
-	return __getopt_long(argc, argv, optstring, longopts, idx, 0);
-}
-
-int getopt_long_only(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx)
-{
-	return __getopt_long(argc, argv, optstring, longopts, idx, 1);
-}

Modified: branches/uClibc-nptl/libc/unistd/getpass.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/getpass.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/getpass.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,20 +1,20 @@
-/* Copyright (C) 1992,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1999,2001,2003,2004,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <stdio.h>
 #include <string.h>
@@ -22,6 +22,8 @@
 #include <unistd.h>
 #include <string.h>
 
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+
 libc_hidden_proto(strlen)
 libc_hidden_proto(tcsetattr)
 libc_hidden_proto(tcgetattr)
@@ -35,8 +37,6 @@
 libc_hidden_proto(fputc)
 libc_hidden_proto(putc)
 libc_hidden_proto(__fputc_unlocked)
-libc_hidden_proto(stdin)
-libc_hidden_proto(stderr)
 
 /* It is desirable to use this bit on systems that have it.
    The only bit of terminal state we want to twiddle is echoing, which is
@@ -120,3 +120,4 @@
 
   return buf;
 }
+#endif

Modified: branches/uClibc-nptl/libc/unistd/sysconf.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/sysconf.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/sysconf.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 /* Copyright (C) 1991, 93, 95, 96, 97, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -32,6 +33,9 @@
 #ifdef __UCLIBC_HAS_REGEX__
 #include <regex.h>
 #endif
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep.h>
+#endif
 
 libc_hidden_proto(sysconf)
 
@@ -81,6 +85,26 @@
       __set_errno(EINVAL);
       return -1;
 
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+# ifdef __NR_clock_getres
+	case _SC_MONOTONIC_CLOCK:
+	/* Check using the clock_getres system call.  */
+	{
+		struct timespec ts;
+		INTERNAL_SYSCALL_DECL (err);
+		int r;
+		r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts);
+		return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : _POSIX_VERSION;
+	}
+# endif
+	case _SC_THREAD_CPUTIME:
+# ifdef _POSIX_THREAD_CPUTIME > 0
+		return _POSIX_THREAD_CPUTIME;
+# else
+		return -1;
+# endif
+#endif
+
     case _SC_ARG_MAX:
 #ifdef	ARG_MAX
       return ARG_MAX;

Modified: branches/uClibc-nptl/libc/unistd/usershell.c
===================================================================
--- branches/uClibc-nptl/libc/unistd/usershell.c	2006-08-21 05:18:48 UTC (rev 15886)
+++ branches/uClibc-nptl/libc/unistd/usershell.c	2006-08-21 05:20:52 UTC (rev 15887)
@@ -40,6 +40,8 @@
 #include <unistd.h>
 #include <paths.h>
 
+#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
+
 libc_hidden_proto(fstat)
 libc_hidden_proto(fopen)
 libc_hidden_proto(fclose)
@@ -48,7 +50,7 @@
 libc_hidden_proto(fgets_unlocked)
 #ifdef __UCLIBC_HAS_XLOCALE__
 libc_hidden_proto(__ctype_b_loc)
-#else
+#elif __UCLIBC_HAS_CTYPE_TABLES__
 libc_hidden_proto(__ctype_b)
 #endif
 
@@ -146,3 +148,4 @@
     fclose(fp);
     return (char **) validsh;
 }
+#endif




More information about the uClibc-cvs mailing list