[18458] in Athena Bugs
olc support for systems where sizeof(long) != 4
daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Sat Oct 21 20:32:23 2000
From: epeisach@MIT.EDU
Date: Sat, 21 Oct 2000 20:32:09 -0400
Message-Id: <10010220032.AA28553@kangaroo.mit.edu>
To: source-reviewers@MIT.EDU
Cc: bug-olc@MIT.EDU
Olc makes several assumptions as to the size of ints and longs in it's
network protocol.
The following patches allow olc to compile on the alpha. It works
(in my little testing) for client side requests. I have not found any
obvious gotchas in the server code, but I have not tested that.
The patches:
a) acconfig.h: Created - so that include/config.h.in can be
regenerated - instead of adding new entries by hand. (using autoheader)
b) configure.in: Determine the sizeof int and long.
c) clients/lib/io.c: use net_long and net_ulong instead of long and
unsigned long. Some of the code is sign dependent.
d) clients/lib/nl.c: Ditto
e) config.h.in - regenerated with autoheader - we gain a few entries this way.
(and reorder)
f)include/olc/os.h - define net_long and net_ulong based on sizeof long
g) logger/bbd.c, server/polld/polld.c, server/rpd/rpd.c: If OPEN_MAX
is not defined, but _POSIX_OPEN_MAX is, use that instead.
Enjoy...
*** /dev/null Sat Oct 21 20:20:26 2000
--- acconfig.h Sat Oct 21 20:19:22 2000
***************
*** 0 ****
--- 1,67 ----
+ /* config.h.in is a part of the OLC On-Line Consulting System.
+ * It is a template that gets filled in and turned into config.h by
+ * the Autoconf-generated `configure' script.
+ *
+ * bert Dvornik
+ * MIT Let Me Keep My Tether Account So I Could Work On This
+ *
+ * Copyright (C) 1999 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, see the file "mit-copyright.h".
+ *
+ * $Id: config.h.in,v 1.2 1999/07/30 17:53:22 ghudson Exp $
+ */
+
+ #ifndef OLC_CONFIG_H
+ #define OLC_CONFIG_H
+
+ /* Define this to compile the OLTA server, instead of OLC. */
+ #undef OLTA
+
+ /* Define this to compile the OWL server, instead of OLC. */
+ #undef OWL
+
+
+
+ /* Define this if you want the server to log the actions it's performing */
+ #undef OLCD_LOG_ACTIONS
+
+ /* Define this if you don't want olcd to ever talk to users */
+ #undef OLCD_SILENT
+
+
+
+ /* Define if you have Kerberos 4. */
+ #undef HAVE_KRB4
+
+ /* Define if you have Hesiod. */
+ #undef HAVE_HESIOD
+
+ /* Define if you have the com_err library. */
+ #undef HAVE_COM_ERR
+
+ /* Define if you have Zephyr. */
+ #undef HAVE_ZEPHYR
+
+ /* Define if you have Discuss. */
+ #undef HAVE_DISCUSS
+
+ /* Define to the path to the machtype binary (which provides information
+ * about the client workstation configuration for the consultants). */
+ #undef MACHTYPE_PATH
+
+ /* Define to the path to the dspipe binary (a part of Discuss). */
+ #undef DSPIPE_PATH
+
+ /* Define if you have termio handling. */
+ #undef HAVE_TERMIO
+ @TOP@
+
+
+ @BOTTOM@
+
+ /* Finally, there are some things `configure' can't probe for. These
+ * must go into a file that must be edited by hand...
+ */
+ #include "site.h"
+
+ #endif /* OLC_CONFIG_H */
Index: configure.in
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/configure.in,v
retrieving revision 1.1
diff -c -r1.1 configure.in
*** configure.in 1999/03/06 16:47:14 1.1
--- configure.in 2000/10/20 20:34:42
***************
*** 168,174 ****
dnl *** Checks for typedefs, structures, and compiler characteristics. ***
AC_TYPE_SIGNAL
!
dnl *** Checks for library functions. ***
AC_CHECK_FUNCS(sigaction sigprocmask lrand48)
--- 168,175 ----
dnl *** Checks for typedefs, structures, and compiler characteristics. ***
AC_TYPE_SIGNAL
! AC_CHECK_SIZEOF(int)
! AC_CHECK_SIZEOF(long)
dnl *** Checks for library functions. ***
AC_CHECK_FUNCS(sigaction sigprocmask lrand48)
Index: clients/lib/io.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/clients/lib/io.c,v
retrieving revision 1.26
diff -c -r1.26 io.c
*** io.c 1999/06/28 22:51:49 1.26
--- io.c 2000/10/20 20:36:34
***************
*** 68,96 ****
REQUEST *request;
{
IO_REQUEST net_req;
! long i;
! int klength;
memset(&net_req, 0, sizeof(net_req));
/* build up struct to send over */
! i = htonl((u_long) CURRENT_VERSION);
memcpy(net_req.data, &i, sizeof(i));
! i = htonl((u_long) request->request_type);
memcpy(net_req.data+4, &i, sizeof(i));
! i = htonl((u_long) request->options);
memcpy(net_req.data+8, &i, sizeof(i));
/* options unset */
! i = htonl((u_long) request->requester.uid);
memcpy(net_req.data+16, &i, sizeof(i));
! i = htonl((u_long) request->requester.instance);
memcpy(net_req.data+20, &i, sizeof(i));
strncpy(net_req.data+24, request->requester.username, 10);
--- 68,96 ----
REQUEST *request;
{
IO_REQUEST net_req;
! net_long i;
! net_long klength; /* 4 bytes */
memset(&net_req, 0, sizeof(net_req));
/* build up struct to send over */
! i = htonl((net_ulong) CURRENT_VERSION);
memcpy(net_req.data, &i, sizeof(i));
! i = htonl((net_ulong) request->request_type);
memcpy(net_req.data+4, &i, sizeof(i));
! i = htonl((net_ulong) request->options);
memcpy(net_req.data+8, &i, sizeof(i));
/* options unset */
! i = htonl((net_ulong) request->requester.uid);
memcpy(net_req.data+16, &i, sizeof(i));
! i = htonl((net_ulong) request->requester.instance);
memcpy(net_req.data+20, &i, sizeof(i));
strncpy(net_req.data+24, request->requester.username, 10);
***************
*** 103,112 ****
strncpy(net_req.data+162, request->requester.title, 32);
strncpy(net_req.data+194, request->requester.machine, 32);
! i = htonl((u_long) request->target.uid);
memcpy(net_req.data+228, &i, sizeof(i));
! i = htonl((u_long) request->target.instance);
memcpy(net_req.data+232, &i, sizeof(i));
strncpy(net_req.data+236, request->target.username,10);
--- 103,112 ----
strncpy(net_req.data+162, request->requester.title, 32);
strncpy(net_req.data+194, request->requester.machine, 32);
! i = htonl((net_ulong) request->target.uid);
memcpy(net_req.data+228, &i, sizeof(i));
! i = htonl((net_ulong) request->target.instance);
memcpy(net_req.data+232, &i, sizeof(i));
strncpy(net_req.data+236, request->target.username,10);
***************
*** 124,131 ****
#ifdef HAVE_KRB4
! klength = htonl((u_long) request->kticket.length);
! if (swrite(fd, (char *) &klength, sizeof(int)) != sizeof(int))
{
fprintf(stderr, "Error in sending ticket length. \n");
return(ERROR);
--- 124,131 ----
#ifdef HAVE_KRB4
! klength = htonl((net_ulong) request->kticket.length);
! if (swrite(fd, (char *) &klength, sizeof(net_ulong)) != sizeof(net_ulong))
{
fprintf(stderr, "Error in sending ticket length. \n");
return(ERROR);
***************
*** 140,146 ****
}
#else /* not HAVE_KRB4 */
! klength = htonl((u_long) 0);
if (swrite(fd, &klength, sizeof(int)) != sizeof(int))
{
fprintf(stderr, "Error telling server we don't use kerberos.. \n");
--- 140,146 ----
}
#else /* not HAVE_KRB4 */
! klength = htonl((net_ulong) 0);
if (swrite(fd, &klength, sizeof(int)) != sizeof(int))
{
fprintf(stderr, "Error telling server we don't use kerberos.. \n");
***************
*** 180,200 ****
send_response(fd,SUCCESS);
! list->ustatus = (ntohl(*((u_long *) net_req.data)));
! list->cstatus = (ntohl(*((u_long *) (net_req.data+4))));
! list->ukstatus = (ntohl(*((u_long *) (net_req.data+8))));
! list->ckstatus = (ntohl(*((u_long *) (net_req.data+12))));
! list->utime = (ntohl(*((u_long *) (net_req.data+16))));
! list->ctime = (ntohl(*((u_long *) (net_req.data+20))));
! list->umessage = (ntohl(*((u_long *) (net_req.data+24))));
! list->cmessage = (ntohl(*((u_long *) (net_req.data+28))));
! list->nseen = (ntohl(*((u_long *) (net_req.data+32))));
strncpy(list->topic,(char *)net_req.data+36, TOPIC_SIZE);
strncpy(list->note, (char *)net_req.data+60, NOTE_SIZE);
! list->user.uid = (ntohl(*((u_long *) (net_req.data+124))));
! list->user.instance = (ntohl(*((u_long *) (net_req.data+128))));
strncpy(list->user.username, (char *)net_req.data+132, LOGIN_SIZE+1);
strncpy(list->user.realname, (char *)net_req.data+142, TITLE_SIZE);
--- 180,200 ----
send_response(fd,SUCCESS);
! list->ustatus = (ntohl(*((net_ulong *) net_req.data)));
! list->cstatus = (ntohl(*((net_ulong *) (net_req.data+4))));
! list->ukstatus = (ntohl(*((net_ulong *) (net_req.data+8))));
! list->ckstatus = (ntohl(*((net_ulong *) (net_req.data+12))));
! list->utime = (ntohl(*((net_ulong *) (net_req.data+16))));
! list->ctime = (ntohl(*((net_ulong *) (net_req.data+20))));
! list->umessage = (ntohl(*((net_ulong *) (net_req.data+24))));
! list->cmessage = (ntohl(*((net_ulong *) (net_req.data+28))));
! list->nseen = (ntohl(*((net_ulong *) (net_req.data+32))));
strncpy(list->topic,(char *)net_req.data+36, TOPIC_SIZE);
strncpy(list->note, (char *)net_req.data+60, NOTE_SIZE);
! list->user.uid = (ntohl(*((net_ulong *) (net_req.data+124))));
! list->user.instance = (ntohl(*((net_ulong *) (net_req.data+128))));
strncpy(list->user.username, (char *)net_req.data+132, LOGIN_SIZE+1);
strncpy(list->user.realname, (char *)net_req.data+142, TITLE_SIZE);
***************
*** 206,213 ****
strncpy(list->user.title, (char *)net_req.data+270, TITLE_SIZE);
strncpy(list->user.machine, (char *)net_req.data+302, TITLE_SIZE);
! list->connected.uid = (ntohl(*((u_long *) (net_req.data+336))));
! list->connected.instance = (ntohl(*((u_long *) (net_req.data+340))));
strncpy(list->connected.username, (char *)net_req.data+344, LOGIN_SIZE+1);
strncpy(list->connected.realname, (char *)net_req.data+354, TITLE_SIZE);
--- 206,213 ----
strncpy(list->user.title, (char *)net_req.data+270, TITLE_SIZE);
strncpy(list->user.machine, (char *)net_req.data+302, TITLE_SIZE);
! list->connected.uid = (ntohl(*((net_ulong *) (net_req.data+336))));
! list->connected.instance = (ntohl(*((net_ulong *) (net_req.data+340))));
strncpy(list->connected.username, (char *)net_req.data+344, LOGIN_SIZE+1);
strncpy(list->connected.realname, (char *)net_req.data+354, TITLE_SIZE);
Index: clients/lib/nl.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/clients/lib/nl.c,v
retrieving revision 1.12
diff -c -r1.12 nl.c
*** nl.c 1999/06/28 22:51:50 1.12
--- nl.c 2000/10/20 20:36:31
***************
*** 59,65 ****
int instance;
int *outlen;
{
! long i,len,total_read;
ERRCODE retcode;
#ifdef HAVE_KRB4
KTEXT_ST my_auth;
--- 59,65 ----
int instance;
int *outlen;
{
! net_long i,len,total_read;
ERRCODE retcode;
#ifdef HAVE_KRB4
KTEXT_ST my_auth;
***************
*** 69,75 ****
strncpy(username,LIST_NAME,8);
/* Send request number */
! i = htonl((u_long) VERSION);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 69,75 ----
strncpy(username,LIST_NAME,8);
/* Send request number */
! i = htonl((net_ulong) VERSION);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 77,83 ****
}
/* Send request number */
! i = htonl((u_long) LIST_REQ);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 77,83 ----
}
/* Send request number */
! i = htonl((net_ulong) LIST_REQ);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 92,98 ****
}
/* Send instance */
! i = htonl((u_long) instance);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 92,98 ----
}
/* Send instance */
! i = htonl((net_ulong) instance);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 106,112 ****
*outlen = -retcode;
return(-1);
}
! i = htonl((u_long) my_auth.length);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 106,112 ----
*outlen = -retcode;
return(-1);
}
! i = htonl((net_ulong) my_auth.length);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 118,124 ****
return(errno);
}
#else /* not HAVE_KRB4 */
! i = htonl((u_long) 0);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 118,124 ----
return(errno);
}
#else /* not HAVE_KRB4 */
! i = htonl((net_ulong) 0);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 173,185 ****
int nuke;
int *outlen;
{
! long i,len,total_read;
ERRCODE retcode;
#ifdef HAVE_KRB4
KTEXT_ST my_auth;
#endif
! i = htonl((u_long) VERSION);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 173,185 ----
int nuke;
int *outlen;
{
! net_long i,len,total_read;
ERRCODE retcode;
#ifdef HAVE_KRB4
KTEXT_ST my_auth;
#endif
! i = htonl((net_ulong) VERSION);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 188,196 ****
/* send request # */
if (nuke)
! i = htonl((u_long) SHOW_KILL_REQ);
else
! i = htonl((u_long) SHOW_NO_KILL_REQ);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 188,196 ----
/* send request # */
if (nuke)
! i = htonl((net_ulong) SHOW_KILL_REQ);
else
! i = htonl((net_ulong) SHOW_NO_KILL_REQ);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 205,211 ****
}
/* Send instance */
! i = htonl((u_long) instance);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 205,211 ----
}
/* Send instance */
! i = htonl((net_ulong) instance);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
***************
*** 218,224 ****
close(fd);
return(retcode);
}
! i = htonl((u_long) my_auth.length);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
--- 218,224 ----
close(fd);
return(retcode);
}
! i = htonl((net_ulong) my_auth.length);
retcode = swrite(fd,(char *) &i,sizeof(i));
if (retcode == -1) {
close(fd);
Index: include/config.h.in
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/include/config.h.in,v
retrieving revision 1.2
diff -c -r1.2 config.h.in
*** config.h.in 1999/07/30 17:53:22 1.2
--- config.h.in 2000/10/22 00:19:47
***************
*** 1,3 ****
--- 1,4 ----
+ /* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* config.h.in is a part of the OLC On-Line Consulting System.
* It is a template that gets filled in and turned into config.h by
* the Autoconf-generated `configure' script.
***************
*** 52,111 ****
/* Define to the path to the dspipe binary (a part of Discuss). */
#undef DSPIPE_PATH
-
-
- /* Define if you have the ANSI C header files. */
- #undef STDC_HEADERS
-
- /* Define if you have the <dirent.h> header file. */
- #undef HAVE_DIRENT_H
-
- /* Define if you have the <ndir.h> header file. */
- #undef HAVE_NDIR_H
-
- /* Define if you have the <sys/dir.h> header file. */
- #undef HAVE_SYS_DIR_H
-
- /* Define if you have the <sys/ndir.h> header file. */
- #undef HAVE_SYS_NDIR_H
-
- /* Define if you have the <fcntl.h> header file. */
- #undef HAVE_FCNTL_H
-
- /* Define if you have the <syslog.h> header file. */
- #undef HAVE_SYSLOG_H
-
- /* Define if you have the <time.h> header file. */
- #undef HAVE_TIME_H
-
/* Define if you have termio handling. */
#undef HAVE_TERMIO
-
-
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
! /* Define if you have the sigaction function. */
! #undef HAVE_SIGACTION
! /* Define if you have the sigprocmask function. */
! #undef HAVE_SIGPROCMASK
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setpgid function. */
#undef HAVE_SETPGID
/* Define if you have the setvbuf function. */
#undef HAVE_SETVBUF
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
--- 53,103 ----
/* Define to the path to the dspipe binary (a part of Discuss). */
#undef DSPIPE_PATH
/* Define if you have termio handling. */
#undef HAVE_TERMIO
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
+ /* Define if the `setpgrp' function takes no argument. */
+ #undef SETPGRP_VOID
+ /* Define if you have the ANSI C header files. */
+ #undef STDC_HEADERS
! /* Define if the X Window System is missing or not being used. */
! #undef X_DISPLAY_MISSING
! /* The number of bytes in a int. */
! #undef SIZEOF_INT
!
! /* The number of bytes in a long. */
! #undef SIZEOF_LONG
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
+ /* Define if you have the lrand48 function. */
+ #undef HAVE_LRAND48
+
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setpgid function. */
#undef HAVE_SETPGID
+ /* Define if you have the setpgrp function. */
+ #undef HAVE_SETPGRP
+
/* Define if you have the setvbuf function. */
#undef HAVE_SETVBUF
+ /* Define if you have the sigaction function. */
+ #undef HAVE_SIGACTION
+
+ /* Define if you have the sigprocmask function. */
+ #undef HAVE_SIGPROCMASK
+
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
***************
*** 115,127 ****
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
! /* Define if you have the setpgrp function. */
! #undef HAVE_SETPGRP
! /* Define if the `setpgrp' function takes no argument. */
! #undef SETPGRP_VOID
/* Finally, there are some things `configure' can't probe for. These
* must go into a file that must be edited by hand...
--- 107,132 ----
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
! /* Define if you have the <dirent.h> header file. */
! #undef HAVE_DIRENT_H
! /* Define if you have the <fcntl.h> header file. */
! #undef HAVE_FCNTL_H
+ /* Define if you have the <ndir.h> header file. */
+ #undef HAVE_NDIR_H
+
+ /* Define if you have the <sys/dir.h> header file. */
+ #undef HAVE_SYS_DIR_H
+ /* Define if you have the <sys/ndir.h> header file. */
+ #undef HAVE_SYS_NDIR_H
+
+ /* Define if you have the <syslog.h> header file. */
+ #undef HAVE_SYSLOG_H
+
+ /* Define if you have the <time.h> header file. */
+ #undef HAVE_TIME_H
/* Finally, there are some things `configure' can't probe for. These
* must go into a file that must be edited by hand...
Index: include/olc/os.h
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/include/olc/os.h,v
retrieving revision 1.13
diff -c -r1.13 os.h
*** os.h 1999/01/22 23:13:44 1.13
--- os.h 2000/10/20 20:35:59
***************
*** 20,22 ****
--- 20,33 ----
#include <dirent.h>
#include <sys/socket.h>
#include <sys/resource.h>
+
+ /* These must be signed, the code assumes it */
+ #if (SIZEOF_LONG == 4)
+ typedef long net_long;
+ typedef u_long net_ulong;
+ #elif (SIZEOF_INT == 4)
+ typedef int net_long;
+ typedef u_int net_ulong;
+ #else
+ ?== error: undefined 32 bit type
+ #endif
Index: logger/bbd.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/logger/bbd.c,v
retrieving revision 1.19
diff -c -r1.19 bbd.c
*** bbd.c 1999/06/28 22:52:36 1.19
--- bbd.c 2000/10/20 20:37:27
***************
*** 42,47 ****
--- 42,51 ----
#endif /* LOG_CONS */
#endif /* HAVE_SYSLOG_H */
+ #if !defined(OPEN_MAX) && defined(_POSIX_OPEN_MAX)
+ #define OPEN_MAX _POSIX_OPEN_MAX
+ #endif
+
#define SERVICE_NAME "ols"
char *lf;
***************
*** 120,126 ****
static void
do_tick(int sig)
{
! long now;
struct sigaction action;
action.sa_flags = 0;
--- 124,130 ----
static void
do_tick(int sig)
{
! time_t now;
struct sigaction action;
action.sa_flags = 0;
Index: server/polld/polld.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/server/polld/polld.c,v
retrieving revision 1.17
diff -c -r1.17 polld.c
*** polld.c 1999/06/28 22:52:48 1.17
--- polld.c 2000/10/20 20:37:37
***************
*** 38,43 ****
--- 38,47 ----
#endif /* LOG_CONS */
#endif /* HAVE_SYSLOG_H */
+ #if !defined(OPEN_MAX) && defined(_POSIX_OPEN_MAX)
+ #define OPEN_MAX _POSIX_OPEN_MAX
+ #endif
+
/* Global variables. */
int select_timeout = 600;
Index: server/rpd/rpd.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/server/rpd/rpd.c,v
retrieving revision 1.21
diff -c -r1.21 rpd.c
*** rpd.c 1999/06/28 22:52:52 1.21
--- rpd.c 2000/10/20 20:37:48
***************
*** 25,30 ****
--- 25,34 ----
static int start_profile (int sig );
#endif /* PROFILE */
+ #if !defined(OPEN_MAX) && defined(_POSIX_OPEN_MAX)
+ #define OPEN_MAX _POSIX_OPEN_MAX
+ #endif
+
static void clean_up (int sig);
main(argc, argv)