]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/bsd/ultrix4/sysconf.c
update from main archive
[thirdparty/glibc.git] / sysdeps / unix / bsd / ultrix4 / sysconf.c
1 /* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
2 Contributed by Ian Lance Taylor (ian@airs.com).
3
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.
8
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.
13
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. */
18
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. */
22
23 #include <unistd.h>
24 #include <errno.h>
25
26 /* This is an Ultrix header file. */
27 #include <sys/sysinfo.h>
28
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));
32
33 long int
34 __sysconf (name)
35 int name;
36 {
37 if (name == _SC_CHILD_MAX)
38 {
39 int save = errno;
40 int start = 0;
41 int ret;
42
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)
47 {
48 __set_errno (save);
49 return ret;
50 }
51
52 __set_errno (save);
53 }
54
55 return __default_sysconf (name);
56 }
57
58 #define __sysconf __default_sysconf
59
60 #include <sysdeps/posix/sysconf.c>