97ca0277b3
The preadv/pwritev symbols weren't added to glibc until the 2.10 release, so trying to build the uio test leads to link failures. Add configure tests and update uio.test to handle this. * configure.ac (AC_CHECK_FUNCS): Add preadv/pwritev. * tests/uio.c: Include config.h. (main): Check for HAVE_PREADV and HAVE_PWRITEV. * tests/uio.test: Check exit status of uio helper.
33 lines
675 B
C
33 lines
675 B
C
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include <sys/uio.h>
|
|
#include <assert.h>
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
#if defined(HAVE_PREADV) && defined(HAVE_PWRITEV)
|
|
const off_t offset = 0xdefaceddeadbeefLL;
|
|
int fd;
|
|
char buf[4];
|
|
struct iovec iov = { buf, sizeof buf };
|
|
|
|
assert((fd = open("/dev/zero", O_RDONLY)) >= 0);
|
|
assert(pread(fd, buf, sizeof buf, offset) == 4);
|
|
assert(preadv(fd, &iov, 1, offset) == 4);
|
|
assert(!close(fd));
|
|
|
|
assert((fd = open("/dev/null", O_WRONLY)) >= 0);
|
|
assert(pwrite(fd, buf, sizeof buf, offset) == 4);
|
|
assert(pwritev(fd, &iov, 1, offset) == 4);
|
|
assert(!close(fd));
|
|
|
|
return 0;
|
|
#else
|
|
return 77;
|
|
#endif
|
|
}
|