/* * Copyright (c) 2004, Bull SA. All rights reserved. * Created by: Laurent.Vivier@bull.net * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. */ /* * assertion: * * aio_read() shall fail with [EAGAIN] if: * The requested AIO operation was not queued to the system * due to system resource limitations. * * method: * * - open file * - queue NUM_AIOCBS 512-byte aio_write * - wait until one returns EAGAIN * * NUM_AIOCBS might need to be adjusted for the system * */ #define _XOPEN_SOURCE 600 #include #include #include #include #include #include #include "posixtest.h" #define TNAME "aio_read/9-1.c" #define NUM_AIOCBS 1024 int main() { char tmpfname[256]; #define BUF_SIZE 512 char buf[BUF_SIZE]; int fd; int i; struct aiocb aiocbs[NUM_AIOCBS]; int last_req; int err; int ret; #if _POSIX_ASYNCHRONOUS_IO != 200112L exit(PTS_UNSUPPORTED); #endif snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_4_1_%d", getpid()); unlink(tmpfname); fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR); if (fd == -1) { printf(TNAME " Error at open(): %s\n", strerror(errno)); exit(PTS_UNRESOLVED); } unlink(tmpfname); if (write(fd, buf, BUF_SIZE) != BUF_SIZE) { printf(TNAME " Error at write(): %s\n", strerror(errno)); close(fd); exit(PTS_UNRESOLVED); } for (i=0; i