Update.
[glibc/history.git] / sysdeps / unix / bsd / ultrix4 / sysconf.c
bloba24c1c5ce8527629e85f06daf85732ea7b324f80
1 /* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
2 Contributed by Ian Lance Taylor (ian@airs.com).
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
19 /* On Ultrix we can use the getsysinfo call to get the right return
20 value for _SC_CHILD_MAX. Everything else is from <sys/param.h>,
21 which the default sysconf already knows how to handle. */
23 #include <unistd.h>
24 #include <errno.h>
26 /* This is an Ultrix header file. */
27 #include <sys/sysinfo.h>
29 extern int __getsysinfo __P ((unsigned int op, void *buffer,
30 size_t nbytes, int *start, void *arg));
31 extern long int __default_sysconf __P ((int name));
33 long int
34 __sysconf (name)
35 int name;
37 if (name == _SC_CHILD_MAX)
39 int save = errno;
40 int start = 0;
41 int ret;
43 /* getsysinfo returns the number of values it put into the
44 buffer, or 0 if not available, or -1 on error. */
45 if (__getsysinfo (GSI_MAX_UPROCS, &ret, sizeof (ret), &start,
46 (void *) 0) > 0)
48 __set_errno (save);
49 return ret;
52 __set_errno (save);
55 return __default_sysconf (name);
58 #define __sysconf __default_sysconf
60 #include <sysdeps/posix/sysconf.c>