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#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
24int main()
25{
26	struct aiocb aiocb;
27#if _POSIX_ASYNCHRONOUS_IO != 200112L
28	exit(PTS_UNSUPPORTED);
29#endif
30
31	memset(&aiocb, 0, sizeof(struct aiocb));
32	aiocb.aio_fildes = -1;
33
34	if (aio_fsync(O_SYNC, &aiocb) != -1)
35	{
36		printf(TNAME " aio_fsync() accepts bad filedes\n");
37		exit(PTS_FAIL);
38	}
39
40	if (errno != EBADF)
41	{
42		printf(TNAME " errno is not EBADF (%d)\n", errno);
43		exit(PTS_FAIL);
44	}
45
46	printf ("Test PASSED\n");
47	return PTS_PASS;
48}
49