[prev in list] [next in list] [prev in thread] [next in thread]
List: ltp-cvs
Subject: [Ltp-cvs] ltp/testcases/open_posix_testsuite/conformance/interfaces/aio_read 1-1.c,NONE,1.1 10-1.c,N
From: Robert Williamson <robbiew () users ! sourceforge ! net>
Date: 2004-12-20 17:04:22
Message-ID: E1CgQxK-000837-9D () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/aio_read
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30688/conformance/interfaces/aio_read
Added Files:
1-1.c 10-1.c 11-1.c 11-2.c 12-1.c 13-1.c 14-1.c 15-1.c 2-1.c
3-1.c 3-2.c 4-1.c 5-1.c 6-1.c 7-1.c 8-1.c 9-1.c assertions.xml
coverage.txt
Log Message:
Update to Version 1.5.0
--- NEW FILE: 11-2.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/11-2.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
struct aiocb aiocb;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_11_2%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = buf;
aiocb.aio_reqprio = -1;
aiocb.aio_nbytes = BUF_SIZE;
if (aio_read(&aiocb) != -1)
{
printf(TNAME " bad aio_read return value()\n");
exit(PTS_FAIL);
}
if (errno != EINVAL)
{
printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
exit(PTS_FAIL);
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 14-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 13-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: assertions.xml ---
<assertions>
<assertion id="1" tag="ref:XSH6TC2:4125:4126">
aio_read() shall read aio_nbytes from the files aio_fildes into the
buffer aio_buf.
</assertion>
<assertion id="2" tag="ref:XSH6TC2:4129:4132">
If prioritized I/O is supported asynchronous operation shall be
submitted at priority equal to a base schedulling priority minus
aio_reqprio.
</assertion>
<assertion id="3" tag="ref:XSH6TC2:4133:4133">
aiocbp may be be used as an argument to aio_error() and aio_return().
</assertion>
<assertion id="4" tag="ref:XSH6TC2:4136:4138">
The file is read at offset given by aio_offset.
</assertion>
<assertion id="5" tag="ref:XSH6TC2:4141:4141">
aio_lio_opcode shall be ignored.
</assertion>
<assertion id="6" tag="ref:XSH6TC2:4151:4152">
For regular files, no data transfer shall occur past the offset
maximum established in the open file description associated with
aio_fildes.
</assertion>
<assertion id="7" tag="ref:XSH6TC2:4154:4154">
The aio_read() function shall return the value zero if operation is
successfuly queued.
</assertion>
<assertion id="8" tag="ref:XSH6TC2:4155:4155">
The aio_read() function shall return the value -1 and set errno to
indicate error if the operation is not succesfully queued.
</assertion>
<assertion id="9" tag="ref:XSH6TC2:4158:4159">
aio_read() shall fail if:
[EAGAIN] The requested AIO operation was not queued to the system
due to system resource limitations.
</assertion>
<assertion id="10" tag="ref:XSH6TC2:4165:4165">
aio_read() shall fail if or the error status of the operation shall be:
[EBADF] aio_fildes argument is not a valid file descriptor open for
reading.
</assertion>
<assertion id="11" tag="ref:XSH6TC2:4166:4168">
aio_read() shall fail if or the error status of the operation shall be:
[EINVAL] aio_offset would be invalid, or aio_reqprio is not a valid
value, or aio_nbytes is an invalid value.
</assertion>
<assertion id="12" tag="ref:XSH6TC2:4174:4174">
The error status of the operation shall be:
[EBADF] aio_fildes argument is not a valid file descriptor open for
reading.
</assertion>
<assertion id="13" tag="ref:XSH6TC2:4375:4376">
The error status of the operation shall be:
[ECANCELED] The requested I/O was canceled before the I/O completed.
</assertion>
<assertion id="14" tag="ref:XSH6TC2:4177:4177">
The error status of the operation shall be:
[EINVAL] aio_offset woud be invalid, or aio_reqprio is not a valid
value, or aio_nbytes is an invalid value.
</assertion>
<assertion id="15" tag="ref:XSH6TC2:4179:4181">
aio_read() shall fail if:
[EOVERFLOW] aio_nbytes is greater than 0, aio_offset is before EOF
and is at or beyond the offset maximum assoicated with aio_fildes.
</assertion>
</assertions>
--- NEW FILE: 3-2.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/3-2.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 256
char buf[BUF_SIZE];
int fd;
struct aiocb aiocb;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_3_2_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
if (write(fd, buf, BUF_SIZE/2) != BUF_SIZE/2)
{
printf(TNAME " Error at write(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
/* try to read BUF_SIZE bytes whereas the file is BUF_SIZE/2 long */
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = buf;
aiocb.aio_nbytes = BUF_SIZE;
if (aio_read(&aiocb) == -1)
{
printf(TNAME " Error at aio_read(): %s\n",
strerror(errno));
exit(PTS_FAIL);
}
/* error status shall be 0 and return status shall be BUF_SIZE/2 */
if (aio_error(&aiocb) != 0)
{
printf(TNAME " Error at aio_error()\n");
exit(PTS_FAIL);
}
if (aio_return(&aiocb) != BUF_SIZE/2)
{
printf(TNAME " Error at aio_return()\n");
exit(PTS_FAIL);
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 1-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 2-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 10-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/10-1.c"
int main()
{
#define BUF_SIZE 111
char buf[BUF_SIZE];
struct aiocb aiocb;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
memset(buf, 0xaa, BUF_SIZE);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = -1;
aiocb.aio_buf = buf;
aiocb.aio_nbytes = BUF_SIZE;
if (aio_read(&aiocb) != -1)
{
printf(TNAME " bad aio_read return value()\n");
exit(PTS_FAIL);
}
if (errno != EBADF)
{
printf(TNAME " errno is not EBADF %s\n", strerror(errno));
exit(PTS_FAIL);
}
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 6-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 9-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
#define TNAME "aio_read/9-1.c"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 12-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 5-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/5-1.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 111
unsigned char buf[BUF_SIZE];
unsigned char check[BUF_SIZE];
int fd;
struct aiocb aiocb;
int i;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_5_1_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
for (i = 0; i < BUF_SIZE; i++)
buf[i] = i;
if (write(fd, buf, BUF_SIZE) != BUF_SIZE)
{
printf(TNAME " Error at write(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
memset(check, 0xaa, BUF_SIZE);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = check;
aiocb.aio_nbytes = BUF_SIZE;
aiocb.aio_lio_opcode = LIO_WRITE;
if (aio_read(&aiocb) == -1)
{
printf(TNAME " Error at aio_read(): %s\n",
strerror(errno));
exit(PTS_FAIL);
}
/* how to synchronize without using sig or aio_suspend ? */
while (0xaa == check[0]);
/* check it */
for (i = 0; i < BUF_SIZE; i++)
{
if (buf[i] != check[i])
{
printf(TNAME " read values are corrupted\n");
exit(PTS_FAIL);
}
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: coverage.txt ---
this file defines the coverage for the aio_read() function testing.
Assertion Covered?
1 YES
2 NO
3 YES
4 YES
5 YES
6 NO
7 YES
8 YES
9 YES
10 YES
11 YES
12 NO
13 NO
14 NO
--- NEW FILE: 7-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/7-1.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 111
unsigned char check[BUF_SIZE];
int fd;
struct aiocb aiocb;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_7_1_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
memset(check, 0xaa, BUF_SIZE);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = check;
aiocb.aio_nbytes = BUF_SIZE;
if (aio_read(&aiocb) == -1)
{
printf(TNAME " Error at aio_read(): %s\n",
strerror(errno));
exit(PTS_FAIL);
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 8-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/1-1.c"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
if (aio_read(NULL) != -1)
{
printf(TNAME " aio_read() should fail when used with a NULL pointer!\n");
exit(PTS_FAIL);
}
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 15-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <unistd.h>
#include <aio.h>
#include "posixtest.h"
int main()
{
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
return PTS_UNTESTED;
}
--- NEW FILE: 3-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/3-1.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
struct aiocb aiocb;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_3_1_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
if (write(fd, buf, BUF_SIZE) != BUF_SIZE)
{
printf(TNAME " Error at write(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = buf;
aiocb.aio_nbytes = BUF_SIZE;
if (aio_read(&aiocb) == -1)
{
printf(TNAME " Error at aio_read(): %s\n",
strerror(errno));
exit(PTS_FAIL);
}
/* error status shall be 0 and return status shall be BUF_SIZE */
if (aio_error(&aiocb) != 0)
{
printf(TNAME " Error at aio_error()\n");
exit(PTS_FAIL);
}
if (aio_return(&aiocb) != BUF_SIZE)
{
printf(TNAME " Error at aio_return()\n");
exit(PTS_FAIL);
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 4-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/4-1.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 128
unsigned char buf[BUF_SIZE*2];
unsigned char check[BUF_SIZE];
int fd;
struct aiocb aiocb;
int i;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_4_1_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
for (i = 0; i < BUF_SIZE*2; i++)
buf[i] = i;
if (write(fd, buf, BUF_SIZE*2) != BUF_SIZE*2)
{
printf(TNAME " Error at write(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
memset(check, 0xaa, BUF_SIZE);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = check;
aiocb.aio_nbytes = BUF_SIZE;
aiocb.aio_offset = BUF_SIZE/2;
if (aio_read(&aiocb) == -1)
{
printf(TNAME " Error at aio_read(): %s\n",
strerror(errno));
exit(PTS_FAIL);
}
/* how to synchronize without using sig or aio_suspend ? */
while (check[0] == 0xaa);
/* check it */
for (i = 0; i < BUF_SIZE; i++)
{
if (buf[i + BUF_SIZE/2] != check[i])
{
printf(TNAME " read values are corrupted\n");
exit(PTS_FAIL);
}
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
--- NEW FILE: 11-1.c ---
/*
* Copyright (c) 2004, IBM Corporation. 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.
*/
#define _XOPEN_SOURCE 600
#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_read/11-1.c"
int main()
{
char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
struct aiocb aiocb;
#if _POSIX_ASYNCHRONOUS_IO != 200112L
exit(PTS_UNSUPPORTED);
#endif
snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_9_1_%d",
getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd == -1)
{
printf(TNAME " Error at open(): %s\n",
strerror(errno));
exit(PTS_UNRESOLVED);
}
unlink(tmpfname);
memset(&aiocb, 0, sizeof(aiocb));
aiocb.aio_fildes = fd;
aiocb.aio_buf = buf;
aiocb.aio_offset = -1;
aiocb.aio_nbytes = BUF_SIZE;
if (aio_read(&aiocb) != -1)
{
printf(TNAME " bad aio_read return value()\n");
exit(PTS_FAIL);
}
if (errno != EINVAL)
{
printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
exit(PTS_FAIL);
}
close(fd);
printf ("Test PASSED\n");
return PTS_PASS;
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Ltp-cvs mailing list
Ltp-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic