]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added pwrite() compatibility
authorTimo Sirainen <tss@iki.fi>
Wed, 6 Aug 2003 19:46:51 +0000 (22:46 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 6 Aug 2003 19:46:51 +0000 (22:46 +0300)
--HG--
branch : HEAD

configure.in
src/lib/compat.c
src/lib/compat.h

index bcebb86db75313435f13c859ec7102d5a2b9f602..8e59543047ebe569bd9cf506b0f090eaafc1c9bc 100644 (file)
@@ -225,8 +225,8 @@ fi
 
 dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
 AC_CHECK_FUNCS(fcntl flock inet_aton sigaction getpagesize madvise \
-               strcasecmp stricmp vsnprintf vsyslog writev setrlimit \
-              setproctitle)
+               strcasecmp stricmp vsnprintf vsyslog writev pwrite \
+              setrlimit setproctitle)
 
 dnl * poll/select?
 
index cc44476e70d40d271b525a1191d55ff0ec1b3e71..38fd4be40834a4e545f1a21d84a00d9ce6ee7a3d 100644 (file)
@@ -118,3 +118,19 @@ ssize_t my_writev(int fd, const struct iovec *iov, int iov_len)
        return (ssize_t)written;
 }
 #endif
+
+#ifndef HAVE_PWRITE
+ssize_t pread(int fd, void *buf, size_t count, off_t offset)
+{
+       if (lseek(fd, offset, SEEK_SET) < 0)
+               return -1;
+       return read(fd, buf, count);
+}
+
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
+{
+       if (lseek(fd, offset, SEEK_SET) < 0)
+               return -1;
+       return write(fd, buf, count);
+}
+#endif
index be531f66cc9731700b458edc7a0cefdcb3e3ca94..7d5800df988d00eb1f2245ac172cc37ace355f97 100644 (file)
@@ -94,6 +94,11 @@ struct iovec;
 ssize_t my_writev(int fd, const struct iovec *iov, int iov_len);
 #endif
 
+#ifndef HAVE_PWRITE
+ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+#endif
+
 /* ctype.h isn't safe with signed chars,
    use our own instead if really needed */
 #define i_toupper(x) ((char) toupper((int) (unsigned char) (x)))