1 /* 2 * Copyright (c) 2004, Bull SA. All rights reserved. 3 * Created by: Laurent.Vivier (at) 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 #define _XOPEN_SOURCE 600 10 #include <stdio.h> 11 #include <sys/types.h> 12 #include <unistd.h> 13 #include <sys/stat.h> 14 #include <fcntl.h> 15 #include <string.h> 16 #include <errno.h> 17 #include <stdlib.h> 18 #include <aio.h> 19 20 #include "posixtest.h" 21 22 #define TNAME "aio_fsync/12-1.c" 23 24 int main(void) 25 { 26 struct aiocb aiocb; 27 28 if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L) 29 return PTS_UNSUPPORTED; 30 31 memset(&aiocb, 0, sizeof(struct aiocb)); 32 aiocb.aio_fildes = -1; 33 34 if (aio_fsync(O_SYNC, &aiocb) != -1) { 35 printf(TNAME " aio_fsync() accepts bad filedes\n"); 36 exit(PTS_FAIL); 37 } 38 39 if (errno != EBADF) { 40 printf(TNAME " errno is not EBADF (%d)\n", errno); 41 exit(PTS_FAIL); 42 } 43 44 printf("Test PASSED\n"); 45 return PTS_PASS; 46 } 47