about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-05-23 15:04:02 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-05-23 15:04:02 +0000
commite78a844b37920ac10bc5a5e558dbecea7e00518c (patch)
tree316a7ad15b548bc6f804a6ec5ad9cc9665ec5e83
parentc15127b3f166005f0eeb9c566bb989e988659019 (diff)
downloadzsh-e78a844b37920ac10bc5a5e558dbecea7e00518c.tar.gz
zsh-e78a844b37920ac10bc5a5e558dbecea7e00518c.tar.xz
zsh-e78a844b37920ac10bc5a5e558dbecea7e00518c.zip
21270: don't use poll() on Apple
-rw-r--r--ChangeLog4
-rw-r--r--Src/system.h78
2 files changed, 70 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 9af808c6f..3d00b54ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-05-23  Peter Stephenson  <pws@csr.com>
+
+	* 21270: Src/system.h: don't use poll() on Apple.
+
 2005-05-10  Oliver Kiddle  <opk@zsh.org>
 
 	* Haakon Riiser: 21188: Completion/X/Command/_acroread: handle
diff --git a/Src/system.h b/Src/system.h
index 31be575ef..41195364d 100644
--- a/Src/system.h
+++ b/Src/system.h
@@ -27,9 +27,23 @@
  *
  */
 
+#if 0
+/*
+ * Setting _XPG_IV here is actually wrong and is not needed
+ * with currently supported versions (5.43C20 and above)
+ */
 #ifdef sinix
 # define _XPG_IV 1
 #endif
+#endif
+
+#ifdef __linux
+/*
+ * Turn on numerous extensions.
+ * This is in order to get the functions for manipulating /dev/ptmx.
+ */
+#define _GNU_SOURCE 1
+#endif
 
 /* NeXT has half-implemented POSIX support *
  * which currently fools configure         */
@@ -83,6 +97,16 @@ char *alloca _((size_t));
 # include <unistd.h>
 #endif
 
+#ifdef HAVE_STDDEF_H
+/*
+ * Seen on Solaris 8 with gcc: stddef defines offsetof, which clashes
+ * with system.h's definition of the symbol unless we include this
+ * first.  Otherwise, this will be hooked in by wchar.h, too late
+ * for comfort.
+ */
+#include <stddef.h>
+#endif
+
 #include <stdio.h>
 #include <ctype.h>
 #include <sys/stat.h>
@@ -194,19 +218,21 @@ struct timezone {
 # define VARARR(X,Y,Z)	X *(Y) = (X *) alloca(sizeof(X) * (Z))
 #endif
 
-/* we should be getting this value from pathconf(_PC_PATH_MAX) */
-/* but this is too much trouble                                */
+/* we should handle unlimited sizes from pathconf(_PC_PATH_MAX) */
+/* but this is too much trouble                                 */
 #ifndef PATH_MAX
 # ifdef MAXPATHLEN
 #  define PATH_MAX MAXPATHLEN
 # else
-   /* so we will just pick something */
-#  define PATH_MAX 1024
+#  ifdef _POSIX_PATH_MAX
+#   define PATH_MAX _POSIX_PATH_MAX
+#  else
+    /* so we will just pick something */
+#   define PATH_MAX 1024
+#  endif
 # endif
 #endif
 
-/* we should be getting this value from sysconf(_SC_OPEN_MAX) */
-/* but this is too much trouble                               */
 #ifndef OPEN_MAX
 # ifdef NOFILE
 #  define OPEN_MAX NOFILE
@@ -215,6 +241,9 @@ struct timezone {
 #  define OPEN_MAX 64
 # endif
 #endif
+#ifndef HAVE_SYSCONF
+# define zopenmax() ((long) OPEN_MAX)
+#endif
 
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
@@ -271,6 +300,15 @@ struct timezone {
 # include <sys/socket.h>
 #endif
 
+#if defined(__APPLE__) && defined(HAVE_SELECT)
+/*
+ * Prefer select() to poll() on MacOS X since poll() is known
+ * to be problematic in 10.4
+ */
+#undef HAVE_POLL
+#undef HAVE_POLL_H
+#endif
+
 #ifdef HAVE_SYS_FILIO_H
 # include <sys/filio.h>
 #endif
@@ -299,10 +337,6 @@ struct timezone {
 # endif  /* HAVE_TERMIO_H  */
 #endif   /* HAVE_TERMIOS_H */
 
-#ifdef HAVE_TERMCAP_H
-# include <termcap.h>
-#endif
-
 #if defined(GWINSZ_IN_SYS_IOCTL) || defined(CLOBBERS_TYPEAHEAD)
 # include <sys/ioctl.h>
 #endif
@@ -399,8 +433,10 @@ struct timezone {
 /* DIGBUFSIZ is the length of a buffer which can hold the -LONG_MAX-1 *
  * (or with ZSH_64_BIT_TYPE maybe -LONG_LONG_MAX-1)                   *
  * converted to printable decimal form including the sign and the     *
- * terminating null character. Below 0.30103 > lg 2.                  */
-#define DIGBUFSIZE ((int)(((sizeof(zlong) * 8) - 1) * 0.30103) + 3)
+ * terminating null character. Below 0.30103 > lg 2.                  *
+ * BDIGBUFSIZE is for a number converted to printable binary form.    */
+#define DIGBUFSIZE ((int)(((sizeof(zlong) * 8) - 1) * 30103/100000) + 3)
+#define BDIGBUFSIZE ((int)((sizeof(zlong) * 8) + 4))
 
 /* If your stat macros are broken, we will *
  * just undefine them.                     */
@@ -642,3 +678,21 @@ extern short ospeed;
 #if defined(CONFIG_LOCALE) && defined(HAVE_SETLOCALE) && defined(LC_ALL)
 # define USE_LOCALE 1
 #endif /* CONFIG_LOCALE && HAVE_SETLOCALE && LC_ALL */
+
+#ifndef MAILDIR_SUPPORT
+#define mailstat(X,Y) stat(X,Y)
+#endif
+
+#ifdef __CYGWIN__
+# include <sys/cygwin.h>
+# define IS_DIRSEP(c) ((c) == '/' || (c) == '\\')
+#else
+# define IS_DIRSEP(c) ((c) == '/')
+#endif
+
+#if defined(__GNUC__) && !defined(__APPLE__)
+/* Does the OS X port of gcc still gag on __attribute__? */
+#define UNUSED(x) x __attribute__((__unused__))
+#else
+#define UNUSED(x) x
+#endif