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/* assertion:
10 *
11 *	aio_cancel() shall fail if:
12 *	[EBADF] The fildes argument is not a valid descriptor.
13 *
14 * method:
15 *
16 *	use -1 as fildes and check return value is -1 and errno is EBADF
17 *
18 */
19
20#define _XOPEN_SOURCE 600
21#include <stdio.h>
22#include <sys/types.h>
23#include <unistd.h>
24#include <sys/stat.h>
25#include <fcntl.h>
26#include <string.h>
27#include <errno.h>
28#include <stdlib.h>
29#include <aio.h>
30
31#include "posixtest.h"
32
33#define TNAME "aio_cancel/10-1.c"
34
35int main(void)
36{
37
38	if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
39		return PTS_UNSUPPORTED;
40
41	if (aio_cancel(-1, NULL) != -1) {
42		printf(TNAME " bad aio_cancel return value()\n");
43		return PTS_FAIL;
44	}
45
46	if (errno != EBADF) {
47		printf(TNAME " errno is not EBADF %s\n", strerror(errno));
48		return PTS_FAIL;
49	}
50
51	printf("Test PASSED\n");
52	return PTS_PASS;
53}
54