Back to index

glibc  2.9
mk-local_lim.c
Go to the documentation of this file.
00001 /* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #include <stdio.h>
00020 #include <sys/types.h>
00021 
00022 #ifdef HAVE_SYS_PARAM_H
00023 #include <sys/param.h>
00024 #endif
00025 
00026 #ifdef HAVE_LIMITS_H
00027 #include <limits.h>
00028 #endif
00029 
00030 #ifdef HAVE_SYS_LIMITS_H
00031 #include <sys/limits.h>
00032 #endif
00033 
00034 /* Generate bits/local_lim.h from the values defined in the system's
00035    headers.  */
00036 
00037 struct param
00038   {
00039     char *name;
00040     int value;
00041   };
00042 
00043 static struct param params[] =
00044   {
00045 
00046 #if !defined (ARG_MAX) && defined (NCARGS)
00047 #define ARG_MAX NCARGS
00048 #endif
00049 #ifdef ARG_MAX
00050     { "ARG_MAX", ARG_MAX },
00051 #endif
00052 
00053 #if !defined (CHILD_MAX) && defined (MAXUPRC)
00054 #define CHILD_MAX MAXUPRC
00055 #endif
00056 #ifdef CHILD_MAX
00057     { "CHILD_MAX", CHILD_MAX },
00058 #endif
00059 
00060 #if !defined (LINK_MAX) && defined (MAXLINK)
00061 #define LINK_MAX MAXLINK
00062 #endif
00063 #ifdef LINK_MAX
00064     { "LINK_MAX", LINK_MAX },
00065 #endif
00066 
00067 #if !defined (OPEN_MAX) && defined (NOFILE)
00068 #define OPEN_MAX NOFILE
00069 #endif
00070 #ifdef OPEN_MAX
00071     { "OPEN_MAX", OPEN_MAX },
00072 #endif
00073 
00074 #if !defined (MAX_CANON) && defined (CANBSIZ)
00075 #define MAX_CANON CANBSIZ
00076 #endif
00077 #ifdef MAX_CANON
00078     { "MAX_CANON", MAX_CANON },
00079 #endif
00080 
00081 #if !defined (NAME_MAX) && defined (MAXNAMLEN)
00082 #define NAME_MAX MAXNAMLEN
00083 #endif
00084 #ifndef NAME_MAX
00085 #define NAME_MAX     255    /* XXX ? */
00086 #endif
00087     { "NAME_MAX", NAME_MAX },
00088 
00089 #if !defined (PATH_MAX) && defined (MAXPATHLEN)
00090 #define PATH_MAX MAXPATHLEN
00091 #endif
00092 #ifdef PATH_MAX
00093     { "PATH_MAX", PATH_MAX },
00094 #endif
00095 
00096 #if !defined (SYMLOOP_MAX) && defined (MAXSYMLINKS)
00097 #define SYMLOOP_MAX MAXSYMLINKS
00098 #endif
00099 #ifdef SYMLOOP_MAX
00100     { "SYMLOOP_MAX", SYMLOOP_MAX },
00101 #endif
00102 
00103     { NULL, 0 }
00104   };
00105 
00106 int
00107 main()
00108 {
00109   extern char *ctime ();
00110   extern time_t time ();
00111   time_t now = time ((time_t *) NULL);
00112   register struct param *p;
00113 
00114   if (! params[0].name)
00115     /* We have no information to give, so let the caller know.  */
00116     exit (1);
00117 
00118   printf ("\
00119 /* Implementation-specific limits.\n\
00120    Generated at %.24s.  */\n\n", ctime (&now));
00121 
00122   for (p = params; p->name != NULL; ++p)
00123     printf ("#define %s %d\n", p->name, p->value);
00124 
00125   exit (0);
00126 }