blob: 60428ce27b627af25459ca5eb7bda604ec6a22a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* 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:
*
* The aio_write() function shall return the value -1 and set errno to
indicate error if the operation is not successfully queued.
*
* method:
*
* - if Prioritized Input and Output option is supported, fill in an
* aiocb with invalid aio_reqprio
* - call aio_write
* - check aio_write return value
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <aio.h>
#include "posixtest.h"
#define TNAME "aio_write/6-1.c"
int main(void)
{
struct aiocb aiocb;
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
if (sysconf(_SC_PRIORITIZED_IO) < 200112L)
return PTS_UNTESTED;
memset(&aiocb, 0, sizeof(struct aiocb));
aiocb.aio_reqprio = -1;
if (aio_write(&aiocb) != -1) {
printf(TNAME " aio_write should fail!\n");
exit(PTS_FAIL);
}
if (errno != EINVAL) {
printf(TNAME " errno should be EINVAL!\n");
exit(PTS_FAIL);
}
printf("Test PASSED\n");
return PTS_PASS;
}
|