summaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/cuserid.c34
-rw-r--r--sysdeps/posix/getpagesize.c34
-rw-r--r--sysdeps/posix/mkstemp.c27
-rw-r--r--sysdeps/posix/mktemp.c27
-rw-r--r--sysdeps/posix/sysconf.c193
5 files changed, 240 insertions, 75 deletions
diff --git a/sysdeps/posix/cuserid.c b/sysdeps/posix/cuserid.c
index 140442fdee..3108a46c21 100644
--- a/sysdeps/posix/cuserid.c
+++ b/sysdeps/posix/cuserid.c
@@ -1,20 +1,20 @@
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ 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.
+ 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.
-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.
+ 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.
-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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ 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. */
#include <pwd.h>
#include <stdio.h>
@@ -30,9 +30,11 @@ cuserid (s)
char *s;
{
static char name[L_cuserid];
- struct passwd *pwent = getpwuid (geteuid ());
+ char buf[NSS_BUFLEN_PASSWD];
+ struct passwd pwent;
+ struct passwd *pwptr;
- if (pwent == NULL)
+ if (__getpwuid_r (geteuid (), &pwent, buf, sizeof (buf), &pwptr))
{
if (s != NULL)
s[0] = '\0';
@@ -41,5 +43,5 @@ cuserid (s)
if (s == NULL)
s = name;
- return strcpy (s, pwent->pw_name);
+ return strncpy (s, pwptr->pw_name, L_cuserid);
}
diff --git a/sysdeps/posix/getpagesize.c b/sysdeps/posix/getpagesize.c
index 4deb208633..6b2082e926 100644
--- a/sysdeps/posix/getpagesize.c
+++ b/sysdeps/posix/getpagesize.c
@@ -1,29 +1,27 @@
-/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@cygnus.com).
-The GNU C Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+ The GNU C Library is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, 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 General Public License for more details.
+ 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 General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with the GNU C Library; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 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. */
-#include <ansidecl.h>
-#include <stddef.h>
#include <unistd.h>
-extern long int EXFUN(__sysconf, (int));
-
/* Return the system page size. */
-size_t
-DEFUN_VOID(__getpagesize)
+int
+__getpagesize (void)
{
return __sysconf (_SC_PAGESIZE);
}
diff --git a/sysdeps/posix/mkstemp.c b/sysdeps/posix/mkstemp.c
index 920136d416..6daba79266 100644
--- a/sysdeps/posix/mkstemp.c
+++ b/sysdeps/posix/mkstemp.c
@@ -1,21 +1,22 @@
/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ 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.
+ 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.
-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.
+ 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.
-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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ 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. */
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
diff --git a/sysdeps/posix/mktemp.c b/sysdeps/posix/mktemp.c
index 111206f663..f7a1783c8f 100644
--- a/sysdeps/posix/mktemp.c
+++ b/sysdeps/posix/mktemp.c
@@ -1,21 +1,22 @@
/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ 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.
+ 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.
-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.
+ 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.
-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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ 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. */
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index 9660724a39..8dde095b79 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -1,20 +1,20 @@
/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ 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.
+ 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.
-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.
+ 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.
-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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ 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. */
#include <errno.h>
#include <limits.h>
@@ -26,8 +26,6 @@ Cambridge, MA 02139, USA. */
#include <unistd.h>
#include <sys/sysinfo.h>
-extern int __getdtablesize __P ((void));
-extern size_t __getpagesize __P ((void));
/* Get the value of the system variable NAME. */
long int
@@ -463,6 +461,13 @@ __sysconf (name)
return -1;
#endif
+ case _SC_2_C_VERSION:
+#ifdef _POSIX2_C_VERSION
+ return _POSIX2_C_VERSION;
+#else
+ return -1;
+#endif
+
case _SC_2_FORT_DEV:
#ifdef _POSIX2_FORT_DEV
return _POSIX2_FORT_DEV;
@@ -484,6 +489,20 @@ __sysconf (name)
return -1;
#endif
+ case _SC_2_CHAR_TERM:
+#ifdef _POSIX2_CHAR_TERM
+ return _POSIX2_CHAR_TERM;
+#else
+ return -1;
+#endif
+
+ case _SC_2_UPE:
+#ifdef _POSIX2_UPE
+ return _POSIX2_UPE;
+#else
+ return -1;
+#endif
+
/* POSIX 1003.1c (POSIX Threads). */
case _SC_THREADS:
#ifdef _POSIX_THREADS
@@ -620,6 +639,150 @@ __sysconf (name)
case _SC_XOPEN_VERSION:
return _XOPEN_VERSION;
+
+ case _SC_XOPEN_XCU_VERSION:
+ return _XOPEN_XCU_VERSION;
+
+ case _SC_XOPEN_UNIX:
+ return _XOPEN_UNIX;
+
+ case _SC_XOPEN_CRYPT:
+#ifdef _XOPEN_CRYPT
+ return _XOPEN_CRYPT;
+#else
+ return -1;
+#endif
+
+ case _SC_XOPEN_ENH_I18N:
+#ifdef _XOPEN_ENH_I18N
+ return _XOPEN_ENH_I18N;
+#else
+ return -1;
+#endif
+
+ case _SC_XOPEN_SHM:
+#ifdef _XOPEN_SHM
+ return _XOPEN_SHM;
+#else
+ return -1;
+#endif
+
+ case _SC_XOPEN_XPG2:
+#ifdef _XOPEN_XPG2
+ return _XOPEN_XPG2;
+#else
+ return -1;
+#endif
+
+ case _SC_XOPEN_XPG3:
+#ifdef _XOPEN_XPG3
+ return _XOPEN_XPG3;
+#else
+ return -1;
+#endif
+
+ case _SC_XOPEN_XPG4:
+#ifdef _XOPEN_XPG4
+ return _XOPEN_XPG4;
+#else
+ return -1;
+#endif
+
+ case _SC_CHAR_BIT:
+ return CHAR_BIT;
+
+ case _SC_CHAR_MAX:
+ return CHAR_MAX;
+
+ case _SC_CHAR_MIN:
+ return CHAR_MIN;
+
+ case _SC_INT_MAX:
+ return INT_MAX;
+
+ case _SC_INT_MIN:
+ return INT_MIN;
+
+ case _SC_LONG_BIT:
+ return sizeof (long int) * CHAR_BIT;
+
+ case _SC_WORD_BIT:
+ return sizeof (int) * CHAR_BIT;
+
+ case _SC_MB_LEN_MAX:
+ return MB_LEN_MAX;
+
+ case _SC_NZERO:
+ return NZERO;
+
+ case _SC_SSIZE_MAX:
+ return _POSIX_SSIZE_MAX;
+
+ case _SC_SCHAR_MAX:
+ return SCHAR_MAX;
+
+ case _SC_SCHAR_MIN:
+ return SCHAR_MIN;
+
+ case _SC_SHRT_MAX:
+ return SHRT_MAX;
+
+ case _SC_SHRT_MIN:
+ return SHRT_MIN;
+
+ case _SC_UCHAR_MAX:
+ return UCHAR_MAX;
+
+ case _SC_UINT_MAX:
+ return UINT_MAX;
+
+ case _SC_ULONG_MAX:
+ return ULONG_MAX;
+
+ case _SC_USHRT_MAX:
+ return USHRT_MAX;
+
+ case _SC_NL_ARGMAX:
+#ifdef NL_ARGMAX
+ return NL_ARGMAX;
+#else
+ return -1;
+#endif
+
+ case _SC_NL_LANGMAX:
+#ifdef NL_LANGMAX
+ return NL_LANGMAX;
+#else
+ return -1;
+#endif
+
+ case _SC_NL_MSGMAX:
+#ifdef NL_MSGMAX
+ return NL_MSGMAX;
+#else
+ return -1;
+#endif
+
+ case _SC_NL_NMAX:
+#ifdef NL_NMAX
+ return NL_NMAX;
+#else
+ return -1;
+#endif
+
+ case _SC_NL_SETMAX:
+#ifdef NL_SETMAX
+ return NL_SETMAX;
+#else
+ return -1;
+#endif
+
+ case _SC_NL_TEXTMAX:
+#ifdef NL_TEXTMAX
+ return NL_TEXTMAX;
+#else
+ return -1;
+#endif
}
}