* lee@sandia.gov
*/
-#define _BSD_SOURCE
-
-#if (_LARGEFILE64_SOURCE && \
- ((defined(__STDC_VERSION__) && __STDC_VERSION__ == 199901L)))
-#define GO64
-#else
-#warning Cannot prompt the 64-bit interface
-#endif
-
-#if defined(GO64) && defined(__GLIBC__)
-#define _ISOC99_SOURCE 1
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#ifndef REDSTORM
-#include <getopt.h>
-#endif
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <sys/queue.h>
+#include <sys/uio.h>
+#include <getopt.h>
+#if defined(SYSIO_LABEL_NAMES)
#include "sysio.h"
-#include "mount.h"
-
+#endif
+#include "xtio.h"
#include "test.h"
/*
* Destination will not be overwritten if it already exist.
*/
-#if (_LARGEFILE64_SOURCE && \
- ((defined(__STDC_VERSION__) && __STDC_VERSION__ == 199901L) || \
- (defined(_ISOC99_SOURCE) && _ISOC99_SOURCE)))
+#if defined(_LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE
#define GO64
#else
#warning Cannot prompt the 64-bit interface
if (use64)
flags |= O_LARGEFILE;
#endif
- fd = open(path, flags, 0666);
+ fd = SYSIO_INTERFACE_NAME(open)(path, flags, 0666);
if (fd < 0) {
perror(path);
err = 1;
}
#ifdef GO64
if (use64)
- off64 = lseek64(fd, off64, SEEK_SET);
+ off64 = SYSIO_INTERFACE_NAME(lseek64)(fd, off64, SEEK_SET);
else
off64 =
#endif
- off = lseek(fd, off, SEEK_SET);
+ off = SYSIO_INTERFACE_NAME(lseek)(fd, off, SEEK_SET);
#ifdef GO64
if ((use64 && off64 < 0) || (!use64 && off < 0)) {
perror(use64 ? "lseek64" : "lseek");
}
#endif
if (which == 'r')
- cc = read(fd, buf, nbytes);
+ cc = SYSIO_INTERFACE_NAME(read)(fd, buf, nbytes);
else
- cc = write(fd, buf, nbytes);
+ cc = SYSIO_INTERFACE_NAME(write)(fd, buf, nbytes);
if (cc < 0) {
perror(path);
err = 1;
}
#ifdef GO64
if (use64) {
- off64 = lseek64(fd, 0, SEEK_CUR);
+ off64 = SYSIO_INTERFACE_NAME(lseek64)(fd, 0, SEEK_CUR);
} else
off64 =
#endif
- off = lseek(fd, 0, SEEK_CUR);
+ off = SYSIO_INTERFACE_NAME(lseek)(fd, 0, SEEK_CUR);
(void )printf(("%s%s@"
#ifdef GO64
"%lld"
);
error:
- if (fd > 0 && close(fd) != 0)
+ if (fd > 0 && SYSIO_INTERFACE_NAME(close)(fd) != 0)
perror(path);
free(buf);
out:
- _sysio_shutdown();
+ _test_sysio_shutdown();
return err;
}