initial import
[glibc.git] / sysdeps / unix / mk-local_lim.c
blobc9a1d3dfb822768bdc79797129f142db7630295a
1 /* Copyright (C) 1993 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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 #include <stdio.h>
20 #include <sys/types.h>
22 #ifdef HAVE_SYS_PARAM_H
23 #include <sys/param.h>
24 #endif
26 #ifdef HAVE_LIMITS_H
27 #include <limits.h>
28 #endif
30 #ifdef HAVE_SYS_LIMITS_H
31 #include <sys/limits.h>
32 #endif
34 /* Generate local_lim.h from the values defined in the system's headers. */
36 struct param
38 char *name;
39 int value;
42 static struct param params[] =
45 #if !defined (ARG_MAX) && defined (NCARGS)
46 #define ARG_MAX NCARGS
47 #endif
48 #ifdef ARG_MAX
49 { "ARG_MAX", ARG_MAX },
50 #endif
52 #if !defined (CHILD_MAX) && defined (MAXUPRC)
53 #define CHILD_MAX MAXUPRC
54 #endif
55 #ifdef CHILD_MAX
56 { "CHILD_MAX", CHILD_MAX },
57 #endif
59 #if !defined (LINK_MAX) && defined (MAXLINK)
60 #define LINK_MAX MAXLINK
61 #endif
62 #ifdef LINK_MAX
63 { "LINK_MAX", LINK_MAX },
64 #endif
66 #if !defined (OPEN_MAX) && defined (NOFILE)
67 #define OPEN_MAX NOFILE
68 #endif
69 #ifdef OPEN_MAX
70 { "OPEN_MAX", OPEN_MAX },
71 #endif
73 #if !defined (MAX_CANON) && defined (CANBSIZ)
74 #define MAX_CANON CANBSIZ
75 #endif
76 #ifdef MAX_CANON
77 { "MAX_CANON", MAX_CANON },
78 #endif
80 #if !defined (NAME_MAX) && defined (MAXNAMLEN)
81 #define NAME_MAX MAXNAMLEN
82 #endif
83 #ifndef NAME_MAX
84 #define NAME_MAX 255 /* XXX ? */
85 #endif
86 { "NAME_MAX", NAME_MAX },
88 #if !defined (PATH_MAX) && defined (MAXPATHLEN)
89 #define PATH_MAX MAXPATHLEN
90 #endif
91 #ifdef PATH_MAX
92 { "PATH_MAX", PATH_MAX },
93 #endif
95 { NULL, 0 }
98 int
99 main()
101 extern char *ctime ();
102 extern time_t time ();
103 time_t now = time ((time_t *) NULL);
104 register struct param *p;
106 if (! params[0].name)
107 /* We have no information to give, so let the caller know. */
108 exit (1);
110 printf ("\
111 /* Implementation-specific limits.\n\
112 Generated at %.24s. */\n\n", ctime (&now));
114 for (p = params; p->name != NULL; ++p)
115 printf ("#define %s %d\n", p->name, p->value);
117 exit (0);