]> granicus.if.org Git - libevent/commitdiff
Build with large-file support on platforms where it matters
authorNick Mathewson <nickm@torproject.org>
Mon, 12 Sep 2011 18:53:39 +0000 (14:53 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 12 Sep 2011 18:53:39 +0000 (14:53 -0400)
Some hosts require you to define certain options to get a large off_t
instead of a small one, to get useful ftell and fseek calls instead of
ones that can only support 2GB files, and so on.  This patch makes
Libevent support those platforms by:

   * Defining the right options when we build, and
   * Changing our API so that it does not depend on the platform's
     definition of off_t.

Based on discusion with Michael Herf

configure.in
evconfig-private.h.in
include/event2/util.h

index 5d889efb7f56a6caad66e62b4a78e4454acef9b5..a997de6f9f159cd050bb5970378e03410883f08a 100644 (file)
@@ -172,6 +172,8 @@ fi
 AC_SUBST(EV_LIB_WS32)
 AC_SUBST(EV_LIB_GDI)
 
+AC_SYS_LARGEFILE
+
 LIBEVENT_OPENSSL
 
 dnl Checks for header files.
@@ -542,6 +544,7 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(size_t)
 AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(off_t)
 
 AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, sa_family_t, struct addrinfo, struct sockaddr_storage], , ,
 [#define _GNU_SOURCE
index cffdf53103412c855c146ff874113ed248b19d58..254ae5096216bbdeab98a035f57b676f36868cb9 100644 (file)
 # undef __EXTENSIONS__
 #endif
 
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
 /* Define to 1 if on MINIX. */
 #ifndef _MINIX
 #undef _MINIX
index c71fdcf510cded8ebbc0f6ed35a83aa295982be3..2494b38465e428068f31f962805895738c224d87 100644 (file)
@@ -193,8 +193,21 @@ extern "C" {
 #define ev_ssize_t ssize_t
 #endif
 
+/* Note that we define ev_off_t based on the compile-time size of off_t that
+ * we used to build Libevent, and not based on the current size of off_t.
+ * (For example, we don't define ev_off_t to off_t.).  We do this because
+ * some systems let you build your software with different off_t sizes
+ * at runtime, and so putting in any dependency on off_t would risk API
+ * mismatch.
+ */
 #ifdef _WIN32
 #define ev_off_t ev_int64_t
+#elif _EVENT_SIZEOF_OFF_T == 8
+#define ev_off_t ev_int64_t
+#elif _EVENT_SIZEOF_OFF_T == 4
+#define ev_off_t ev_int32_t
+#elif defined(_EVENT_IN_DOXYGEN)
+#define ev_off_t ...
 #else
 #define ev_off_t off_t
 #endif