1/* 2 * Copyright (c) 2004, Bull SA. All rights reserved. 3 * Created by: Laurent.Vivier@bull.net 4 * This file is licensed under the GPL license. For the full content 5 * of this license, see the COPYING file at the top level of this 6 * source tree. 7 */ 8 9/* 10 * assertion: 11 * 12 * The aio_write() function shall return the value -1 and set errno to 13 indicate error if the operation is not succesfully queued. 14 * 15 * method: 16 * 17 * - if Prioritized Input and Output option is supported, fill in an 18 * aiocb with invalid aio_reqprio 19 * - call aio_write 20 * - check aio_write return value 21 * 22 */ 23 24#define _XOPEN_SOURCE 600 25#include <stdio.h> 26#include <sys/types.h> 27#include <unistd.h> 28#include <sys/stat.h> 29#include <fcntl.h> 30#include <string.h> 31#include <errno.h> 32#include <stdlib.h> 33#include <aio.h> 34 35#include "posixtest.h" 36 37#define TNAME "aio_write/6-1.c" 38 39int main(void) 40{ 41 struct aiocb aiocb; 42 43 if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L) 44 return PTS_UNSUPPORTED; 45 46 if (sysconf(_SC_PRIORITIZED_IO) < 200112L) 47 return PTS_UNTESTED; 48 49 memset(&aiocb, 0, sizeof(struct aiocb)); 50 aiocb.aio_reqprio = -1; 51 52 if (aio_write(&aiocb) != -1) { 53 printf(TNAME " aio_write should fail!\n"); 54 exit(PTS_FAIL); 55 } 56 57 if (errno != EINVAL) { 58 printf(TNAME " errno should be EINVAL!\n"); 59 exit(PTS_FAIL); 60 } 61 62 printf("Test PASSED\n"); 63 return PTS_PASS; 64} 65