Update.
[glibc.git] / sysdeps / unix / mk-local_lim.c
bloba7f7634ebfb7d7ef63fe8ee7a3797feadcada069
1 /* Copyright (C) 1993, 1996, 1997 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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, 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 bits/local_lim.h from the values defined in the system's
35 headers. */
37 struct param
39 char *name;
40 int value;
43 static struct param params[] =
46 #if !defined (ARG_MAX) && defined (NCARGS)
47 #define ARG_MAX NCARGS
48 #endif
49 #ifdef ARG_MAX
50 { "ARG_MAX", ARG_MAX },
51 #endif
53 #if !defined (CHILD_MAX) && defined (MAXUPRC)
54 #define CHILD_MAX MAXUPRC
55 #endif
56 #ifdef CHILD_MAX
57 { "CHILD_MAX", CHILD_MAX },
58 #endif
60 #if !defined (LINK_MAX) && defined (MAXLINK)
61 #define LINK_MAX MAXLINK
62 #endif
63 #ifdef LINK_MAX
64 { "LINK_MAX", LINK_MAX },
65 #endif
67 #if !defined (OPEN_MAX) && defined (NOFILE)
68 #define OPEN_MAX NOFILE
69 #endif
70 #ifdef OPEN_MAX
71 { "OPEN_MAX", OPEN_MAX },
72 #endif
74 #if !defined (MAX_CANON) && defined (CANBSIZ)
75 #define MAX_CANON CANBSIZ
76 #endif
77 #ifdef MAX_CANON
78 { "MAX_CANON", MAX_CANON },
79 #endif
81 #if !defined (NAME_MAX) && defined (MAXNAMLEN)
82 #define NAME_MAX MAXNAMLEN
83 #endif
84 #ifndef NAME_MAX
85 #define NAME_MAX 255 /* XXX ? */
86 #endif
87 { "NAME_MAX", NAME_MAX },
89 #if !defined (PATH_MAX) && defined (MAXPATHLEN)
90 #define PATH_MAX MAXPATHLEN
91 #endif
92 #ifdef PATH_MAX
93 { "PATH_MAX", PATH_MAX },
94 #endif
96 #if !defined (SYMLOOP_MAX) && defined (MAXSYMLINKS)
97 #define SYMLOOP_MAX MAXSYMLINKS
98 #endif
99 #ifdef SYMLOOP_MAX
100 { "SYMLOOP_MAX", SYMLOOP_MAX },
101 #endif
103 { NULL, 0 }
107 main()
109 extern char *ctime ();
110 extern time_t time ();
111 time_t now = time ((time_t *) NULL);
112 register struct param *p;
114 if (! params[0].name)
115 /* We have no information to give, so let the caller know. */
116 exit (1);
118 printf ("\
119 /* Implementation-specific limits.\n\
120 Generated at %.24s. */\n\n", ctime (&now));
122 for (p = params; p->name != NULL; ++p)
123 printf ("#define %s %d\n", p->name, p->value);
125 exit (0);