-static int global_queuelen = 128;
-static int nsock, maxsock;
-static fd_set allsock;
-static int toomany;
-static int timingout;
-static struct servent *sp;
-static uid_t uid;
-
-static const char *config_filename = "/etc/inetd.conf";
-
-static FILE *fconfig;
-static char *defhost;
+struct globals {
+ rlim_t rlim_ofile_cur;
+ struct rlimit rlim_ofile;
+ servtab_t *servtab;
+ int global_queuelen;
+ int nsock;
+ int maxsock;
+ int toomany;
+ int timingout;
+ struct servent *sp;
+ uid_t uid;
+ const char *config_filename;
+ FILE *fconfig;
+ char *defhost;
+#ifdef INETD_SETPROCTITLE
+ char **Argv;
+ char *LastArg;
+#endif
+#if ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN
+ char *endring;
+ char *ringpos;
+ char ring[128];
+#endif
+ fd_set allsock;
+ /* Used only in nextline() */
+ char line[80]; /* at least 80, see LINE_SIZE */
+};
+#define G (*(struct globals*)&bb_common_bufsiz1)
+enum { LINE_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line) };
+struct BUG_G_too_big {
+ char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
+};
+#define rlim_ofile_cur (G.rlim_ofile_cur )
+#define rlim_ofile (G.rlim_ofile )
+#define servtab (G.servtab )
+#define global_queuelen (G.global_queuelen)
+#define nsock (G.nsock )
+#define maxsock (G.maxsock )
+#define toomany (G.toomany )
+#define timingout (G.timingout )
+#define sp (G.sp )
+#define uid (G.uid )
+#define config_filename (G.config_filename)
+#define fconfig (G.fconfig )
+#define defhost (G.defhost )
+#define Argv (G.Argv )
+#define LastArg (G.LastArg )
+#define endring (G.endring )
+#define ringpos (G.ringpos )
+#define ring (G.ring )
+#define allsock (G.allsock )
+#define line (G.line )
+#define INIT_G() do { \
+ rlim_ofile_cur = OPEN_MAX; \
+ global_queuelen = 128; \
+ config_filename = "/etc/inetd.conf"; \
+} while (0)