mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
2004-02-25 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Handle _SC_NGROUPS_MAX.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2004-02-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Handle
|
||||||
|
_SC_NGROUPS_MAX.
|
||||||
|
|
||||||
2004-02-23 Jakub Jelinek <jakub@redhat.com>
|
2004-02-23 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* wcsmbs/mbrtowc.c (__mbrtowc): Cap s + n at the end of address space.
|
* wcsmbs/mbrtowc.c (__mbrtowc): Cap s + n at the end of address space.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Get file-specific information about a file. Linux version.
|
/* Get file-specific information about a file. Linux version.
|
||||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
Copyright (C) 2003, 2004 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
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -17,6 +17,7 @@
|
|||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -46,7 +47,40 @@ __sysconf (int name)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
case _SC_NGROUPS_MAX:
|
||||||
|
{
|
||||||
|
/* Try to read the information from the /proc/sys/kernel/ngroups_max
|
||||||
|
file. */
|
||||||
|
int fd = __open ("/proc/sys/kernel/ngroups_max", O_RDONLY);
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
/* This is more than enough, the file contains a single
|
||||||
|
integer. */
|
||||||
|
char buf[32];
|
||||||
|
long int res = -1l;
|
||||||
|
|
||||||
|
ssize_t n = __read (fd, buf, sizeof (buf) - 1);
|
||||||
|
if (n > 0)
|
||||||
|
{
|
||||||
|
/* Terminate the string. */
|
||||||
|
buf[n] = '\0';
|
||||||
|
|
||||||
|
char *endp;
|
||||||
|
res = strtol (buf, &endp, 10);
|
||||||
|
if (endp == buf || (*endp != '\0' && *endp != '\n'))
|
||||||
|
res = -1l;
|
||||||
|
}
|
||||||
|
|
||||||
|
__close (fd);
|
||||||
|
|
||||||
|
if (res != -1)
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return posix_sysconf (name);
|
break;
|
||||||
}
|
}
|
||||||
|
return posix_sysconf (name);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user