summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-08-07 10:32:11 -0400
committerAdam Jackson <ajax@redhat.com>2008-08-07 10:32:11 -0400
commit892ec928da3a0653ae54c321e4c3b1aa06c4e678 (patch)
tree32d74163681abff818a700e17c290c09e7539e91
parent339ddc413559d4cb117a72f87b2a70dae6911c32 (diff)
Drastically simplify TRANS_OPEN_MAX.
If your OS doesn't have sysconf(3), then life is already hard for you.
-rw-r--r--Xtransint.h49
-rw-r--r--Xtranssock.c4
2 files changed, 3 insertions, 50 deletions
diff --git a/Xtransint.h b/Xtransint.h
index f9ee8f9..523751e 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -101,55 +101,6 @@ from The Open Group.
# include <sys/utsname.h>
# endif
-/*
- * makedepend screws up on #undef OPEN_MAX, so we define a new symbol
- */
-
-# ifndef TRANS_OPEN_MAX
-
-# ifndef X_NOT_POSIX
-# ifdef _POSIX_SOURCE
-# include <limits.h>
-# else
-# define _POSIX_SOURCE
-# include <limits.h>
-# undef _POSIX_SOURCE
-# endif
-# endif
-# ifndef OPEN_MAX
-# if defined(_SC_OPEN_MAX)
-# define OPEN_MAX (sysconf(_SC_OPEN_MAX))
-# else
-# ifdef SVR4
-# define OPEN_MAX 256
-# else
-# include <sys/param.h>
-# ifndef OPEN_MAX
-# ifdef __OSF1__
-# define OPEN_MAX 256
-# else
-# ifdef NOFILE
-# define OPEN_MAX NOFILE
-# else
-# define OPEN_MAX NOFILES_MAX
-# endif
-# endif
-# endif
-# endif
-# endif
-# endif
-# if defined(_SC_OPEN_MAX)
-# define TRANS_OPEN_MAX OPEN_MAX
-# else /* !__GNU__ */
-# if OPEN_MAX > 256
-# define TRANS_OPEN_MAX 256
-# else
-# define TRANS_OPEN_MAX OPEN_MAX
-# endif
-# endif /*__GNU__*/
-
-# endif /* TRANS_OPEN_MAX */
-
# define ESET(val) errno = val
# define EGET() errno
diff --git a/Xtranssock.c b/Xtranssock.c
index bb1c792..ad3e116 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -99,6 +99,8 @@ from the copyright holders.
#include <sys/stropts.h>
#endif
+#include <unistd.h>
+
#else /* !WIN32 */
#include <X11/Xwinsock.h>
@@ -424,7 +426,7 @@ TRANS(SocketOpen) (int i, int type)
Sockettrans2devtab[i].protocol)) < 0
#ifndef WIN32
#if (defined(X11_t) && !defined(USE_POLL)) || defined(FS_t) || defined(FONT_t)
- || ciptr->fd >= TRANS_OPEN_MAX
+ || ciptr->fd >= sysconf(_SC_OPEN_MAX)
#endif
#endif
) {