strace/tests/aio.c

369 lines
12 KiB
C
Raw Normal View History

/*
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "tests.h"
#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
Use <asm/unistd.h> instead of <sys/syscall.h> There are no users of SYS_* macros provided by <sys/syscall.h>, and definitions of __NR_* macros could be obtained directly from <asm/unistd.h>. * defs.h: Include <asm/unistd.h> instead of <sys/syscall.h>. * test/seccomp.c: Likewise. * test/threaded_execve.c: Likewise. * test/x32_lseek.c: Likewise. * test/x32_mmap.c: Likewise. * tests/_newselect.c: Likewise. * tests/access.c: Likewise. * tests/acct.c: Likewise. * tests/aio.c: Likewise. * tests/alarm.c: Likewise. * tests/attach-f-p.c: Likewise. * tests/bpf.c: Likewise. * tests/brk.c: Likewise. * tests/chmod.c: Likewise. * tests/chown.c: Likewise. * tests/chown32.c: Likewise. * tests/chroot.c: Likewise. * tests/clock_adjtime.c: Likewise. * tests/clock_nanosleep.c: Likewise. * tests/clock_xettime.c: Likewise. * tests/copy_file_range.c: Likewise. * tests/creat.c: Likewise. * tests/dup2.c: Likewise. * tests/dup3.c: Likewise. * tests/epoll_create.c: Likewise. * tests/epoll_create1.c: Likewise. * tests/epoll_ctl.c: Likewise. * tests/epoll_pwait.c: Likewise. * tests/epoll_wait.c: Likewise. * tests/eventfd.c: Likewise. * tests/execveat.c: Likewise. * tests/faccessat.c: Likewise. * tests/fchdir.c: Likewise. * tests/fchmod.c: Likewise. * tests/fchmodat.c: Likewise. * tests/fchown.c: Likewise. * tests/fchown32.c: Likewise. * tests/fchownat.c: Likewise. * tests/fcntl.c: Likewise. * tests/fcntl64.c: Likewise. * tests/fdatasync.c: Likewise. * tests/flock.c: Likewise. * tests/fstat.c: Likewise. * tests/fstat64.c: Likewise. * tests/fstatat64.c: Likewise. * tests/fstatfs.c: Likewise. * tests/fstatfs64.c: Likewise. * tests/fsync.c: Likewise. * tests/ftruncate.c: Likewise. * tests/ftruncate64.c: Likewise. * tests/futimesat.c: Likewise. * tests/get_mempolicy.c: Likewise. * tests/getcwd.c: Likewise. * tests/getdents.c: Likewise. * tests/getdents64.c: Likewise. * tests/getegid.c: Likewise. * tests/getegid32.c: Likewise. * tests/geteuid.c: Likewise. * tests/geteuid32.c: Likewise. * tests/getgid.c: Likewise. * tests/getgid32.c: Likewise. * tests/getgroups.c: Likewise. * tests/getgroups32.c: Likewise. * tests/getpgrp.c: Likewise. * tests/getrandom.c: Likewise. * tests/getresgid.c: Likewise. * tests/getresgid32.c: Likewise. * tests/getresuid.c: Likewise. * tests/getresuid32.c: Likewise. * tests/getrlimit.c: Likewise. * tests/getrusage.c: Likewise. * tests/getuid.c: Likewise. * tests/getuid32.c: Likewise. * tests/getxxid.c: Likewise. * tests/ioctl_uffdio.c: Likewise. * tests/ioperm.c: Likewise. * tests/iopl.c: Likewise. * tests/ipc.c: Likewise. * tests/kill.c: Likewise. * tests/lchown.c: Likewise. * tests/lchown32.c: Likewise. * tests/libmmsg.c: Likewise. * tests/libsocketcall.c: Likewise. * tests/link.c: Likewise. * tests/linkat.c: Likewise. * tests/llseek.c: Likewise. * tests/lseek.c: Likewise. * tests/lstat.c: Likewise. * tests/lstat64.c: Likewise. * tests/mbind.c: Likewise. * tests/membarrier.c: Likewise. * tests/memfd_create.c: Likewise. * tests/migrate_pages.c: Likewise. * tests/mkdir.c: Likewise. * tests/mkdirat.c: Likewise. * tests/mknod.c: Likewise. * tests/mknodat.c: Likewise. * tests/mlock.c: Likewise. * tests/mlock2.c: Likewise. * tests/move_pages.c: Likewise. * tests/newfstatat.c: Likewise. * tests/nsyscalls.c: Likewise. * tests/old_mmap.c: Likewise. * tests/oldselect.c: Likewise. * tests/open.c: Likewise. * tests/openat.c: Likewise. * tests/pause.c: Likewise. * tests/poll.c: Likewise. * tests/prctl-seccomp-filter-v.c: Likewise. * tests/prctl-seccomp-strict.c: Likewise. * tests/preadv2-pwritev2.c: Likewise. * tests/prlimit64.c: Likewise. * tests/pselect6.c: Likewise. * tests/ptrace.c: Likewise. * tests/readdir.c: Likewise. * tests/readlink.c: Likewise. * tests/readlinkat.c: Likewise. * tests/reboot.c: Likewise. * tests/remap_file_pages.c: Likewise. * tests/rename.c: Likewise. * tests/renameat.c: Likewise. * tests/renameat2.c: Likewise. * tests/rmdir.c: Likewise. * tests/rt_sigpending.c: Likewise. * tests/rt_sigprocmask.c: Likewise. * tests/rt_sigsuspend.c: Likewise. * tests/rt_sigtimedwait.c: Likewise. * tests/rt_tgsigqueueinfo.c: Likewise. * tests/sched_get_priority_mxx.c: Likewise. * tests/sched_rr_get_interval.c: Likewise. * tests/sched_xetaffinity.c: Likewise. * tests/sched_xetattr.c: Likewise. * tests/sched_xetparam.c: Likewise. * tests/sched_xetscheduler.c: Likewise. * tests/sched_yield.c: Likewise. * tests/seccomp-filter-v.c: Likewise. * tests/seccomp-filter.c: Likewise. * tests/seccomp-strict.c: Likewise. * tests/select.c: Likewise. * tests/sendfile.c: Likewise. * tests/sendfile64.c: Likewise. * tests/set_mempolicy.c: Likewise. * tests/setdomainname.c: Likewise. * tests/setfsgid.c: Likewise. * tests/setfsgid32.c: Likewise. * tests/setfsuid.c: Likewise. * tests/setfsuid32.c: Likewise. * tests/setgid.c: Likewise. * tests/setgid32.c: Likewise. * tests/setgroups.c: Likewise. * tests/setgroups32.c: Likewise. * tests/sethostname.c: Likewise. * tests/setregid.c: Likewise. * tests/setregid32.c: Likewise. * tests/setresgid.c: Likewise. * tests/setresgid32.c: Likewise. * tests/setresuid.c: Likewise. * tests/setresuid32.c: Likewise. * tests/setreuid.c: Likewise. * tests/setreuid32.c: Likewise. * tests/setrlimit.c: Likewise. * tests/setuid.c: Likewise. * tests/setuid32.c: Likewise. * tests/signalfd4.c: Likewise. * tests/socketcall.c: Likewise. * tests/splice.c: Likewise. * tests/stat.c: Likewise. * tests/stat64.c: Likewise. * tests/statfs.c: Likewise. * tests/statfs64.c: Likewise. * tests/swap.c: Likewise. * tests/symlink.c: Likewise. * tests/symlinkat.c: Likewise. * tests/sync.c: Likewise. * tests/sync_file_range.c: Likewise. * tests/sync_file_range2.c: Likewise. * tests/syslog.c: Likewise. * tests/tee.c: Likewise. * tests/time.c: Likewise. * tests/timer_create.c: Likewise. * tests/timer_xettime.c: Likewise. * tests/timerfd_xettime.c: Likewise. * tests/times-fail.c: Likewise. * tests/times.c: Likewise. * tests/truncate.c: Likewise. * tests/truncate64.c: Likewise. * tests/ugetrlimit.c: Likewise. * tests/umount.c: Likewise. * tests/umount2.c: Likewise. * tests/uname.c: Likewise. * tests/unix-pair-send-recv.c: Likewise. * tests/unlink.c: Likewise. * tests/unlinkat.c: Likewise. * tests/userfaultfd.c: Likewise. * tests/utimes.c: Likewise. * tests/vhangup.c: Likewise. * tests/vmsplice.c: Likewise. * tests/waitid.c: Likewise. * tests/waitpid.c: Likewise. * tests/xet_robust_list.c: Likewise. * tests/xetpgid.c: Likewise. * tests/xetpriority.c: Likewise. * tests/xettimeofday.c: Likewise.
2016-08-09 17:38:29 +03:00
#include <asm/unistd.h>
#if defined __NR_io_setup \
&& defined __NR_io_submit \
&& defined __NR_io_getevents \
&& defined __NR_io_cancel \
&& defined __NR_io_destroy
# include <linux/aio_abi.h>
int
main(void)
{
static const long bogus_ctx =
(long) 0xface1e55deadbeefLL;
static const char data2[] =
"\0\1\2\3cat test test test 0123456789abcdef";
const unsigned int sizeof_data0 = 4096;
const unsigned int sizeof_data1 = 8192;
void *data0 = tail_alloc(sizeof_data0);
void *data1 = tail_alloc(sizeof_data1);
const struct iocb proto_cb[] = {
{
.aio_data = (unsigned long) 0xfeedface11111111ULL,
.aio_reqprio = 11,
.aio_buf = (unsigned long) data0,
.aio_offset = (unsigned long) 0xdeface1facefeedULL,
.aio_nbytes = sizeof_data0
},
{
.aio_data = (unsigned long) 0xfeedface22222222ULL,
.aio_reqprio = 22,
.aio_buf = (unsigned long) data1,
.aio_offset = (unsigned long) 0xdeface2cafef00dULL,
.aio_nbytes = sizeof_data1
}
};
const struct iocb *cb = tail_memdup(proto_cb, sizeof(proto_cb));
const struct iovec proto_iov0[] = {
{
.iov_base = data0,
.iov_len = sizeof_data0 / 4
},
{
.iov_base = data0 + sizeof_data0 / 4,
.iov_len = sizeof_data0 / 4 * 3
},
};
const struct iovec *iov0 = tail_memdup(proto_iov0, sizeof(proto_iov0));
const struct iovec proto_iov1[] = {
{
.iov_base = data1,
.iov_len = sizeof_data1 / 4
},
{
.iov_base = data1 + sizeof_data1 / 4,
.iov_len = sizeof_data1 / 4 * 3
},
};
const struct iovec *iov1 = tail_memdup(proto_iov1, sizeof(proto_iov1));
const struct iocb proto_cbv[] = {
{
.aio_data = (unsigned long) 0xfeed11111111faceULL,
.aio_lio_opcode = 7,
.aio_reqprio = 111,
.aio_buf = (unsigned long) iov0,
.aio_offset = (unsigned long) 0xdeface1facefeedULL,
.aio_nbytes = ARRAY_SIZE(proto_iov0)
},
{
.aio_data = (unsigned long) 0xfeed22222222faceULL,
.aio_lio_opcode = 7,
.aio_reqprio = 222,
.aio_buf = (unsigned long) iov1,
.aio_offset = (unsigned long) 0xdeface2cafef00dULL,
.aio_nbytes = ARRAY_SIZE(proto_iov1)
}
};
const struct iocb *cbv = tail_memdup(proto_cbv, sizeof(proto_cbv));
/* For additional decoder testing */
const struct iocb proto_cbv2[] = {
{
.aio_data = 0xbadfacedc0ffeeedULL,
.aio_key = 0xdefaced0,
.aio_lio_opcode = 0xf00d,
.aio_reqprio = 0,
.aio_fildes = 0xdefaced1,
.aio_buf = 0,
},
{
.aio_data = 0,
.aio_key = 0xdefaced0,
.aio_lio_opcode = 1,
.aio_reqprio = 0xbeef,
.aio_fildes = 0xdefaced1,
.aio_buf = 0,
/* In order to make record valid */
.aio_nbytes = (size_t) 0x1020304050607080ULL,
.aio_offset = 0xdeadda7abadc0dedULL,
# ifdef IOCB_FLAG_RESFD
.aio_flags = 0xfacef157,
.aio_resfd = 0xded1ca7e,
# endif
},
{
.aio_data = 0,
.aio_key = 0xdefaced0,
.aio_lio_opcode = 1,
.aio_reqprio = 0xbeef,
.aio_fildes = 0xdefaced1,
.aio_buf = 0xbadc0ffeedefacedULL,
.aio_nbytes = 0x8090a0b0c0d0e0f0ULL,
.aio_offset = 0xdeadda7abadc0dedULL,
},
{
.aio_data = 0,
.aio_key = 0xdefaced0,
.aio_lio_opcode = 1,
.aio_reqprio = 0xbeef,
.aio_fildes = 0xdefaced1,
.aio_buf = (unsigned long)data2,
.aio_nbytes = sizeof(data2),
tests: fix "constant is too large" compilation warnings alarm.c: In function 'main': alarm.c:41: warning: integer constant is too large for 'long' type aio.c: In function 'main': aio.c:162: warning: integer constant is too large for 'long' type btrfs.c: In function 'btrfs_test_sync_ioctls': btrfs.c:202: warning: integer constant is too large for 'long' type btrfs.c: In function 'btrfs_test_subvol_ioctls': btrfs.c:289: warning: integer constant is too large for 'long' type btrfs.c:290: warning: integer constant is too large for 'long' type dup2.c: In function 'main': dup2.c:12: warning: integer constant is too large for 'long' type dup2.c:13: warning: integer constant is too large for 'long' type dup3.c: In function 'main': dup3.c:13: warning: integer constant is too large for 'long' type dup3.c:14: warning: integer constant is too large for 'long' type epoll_create.c: In function 'main': epoll_create.c:12: warning: integer constant is too large for 'long' type epoll_ctl.c: In function 'invoke_syscall': epoll_ctl.c:14: warning: integer constant is too large for 'long' type faccessat.c: In function 'main': faccessat.c:13: warning: integer constant is too large for 'long' type fchdir.c: In function 'main': fchdir.c:12: warning: integer constant is too large for 'long' type struct_flock.c: In function 'invoke_test_syscall': struct_flock.c:48: warning: integer constant is too large for 'long' type struct_flock.c: In function 'test_flock_einval': struct_flock.c:58: warning: integer constant is too large for 'long' type struct_flock.c:59: warning: integer constant is too large for 'long' type fcntl64.c: In function 'test_flock64_einval': fcntl64.c:44: warning: integer constant is too large for 'long' type fcntl64.c:45: warning: integer constant is too large for 'long' type fcntl.c: In function 'test_flock64_einval': fcntl.c:44: warning: integer constant is too large for 'long' type fcntl.c:45: warning: integer constant is too large for 'long' type fdatasync.c: In function 'main': fdatasync.c:12: warning: integer constant is too large for 'long' type flock.c: In function 'main': flock.c:13: warning: integer constant is too large for 'long' type xstatx.c: In function 'main': xstatx.c:255: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:290: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatx.c:294: warning: integer constant is too large for 'long' type xstatfsx.c: In function 'main': xstatfsx.c:113: warning: integer constant is too large for 'long' type fsync.c: In function 'main': fsync.c:12: warning: integer constant is too large for 'long' type ftruncate64.c: In function 'main': ftruncate64.c:39: warning: integer constant is too large for 'long' type futimesat.c: In function 'main': futimesat.c:52: warning: integer constant is too large for 'long' type futimesat.c:59: warning: integer constant is too large for 'long' type get_mempolicy.c: In function 'main': get_mempolicy.c:83: warning: integer constant is too large for 'long' type get_mempolicy.c:84: warning: integer constant is too large for 'long' type get_mempolicy.c:85: warning: integer constant is too large for 'long' type get_mempolicy.c:86: warning: integer constant is too large for 'long' type getdents.c: In function 'main': getdents.c:109: warning: integer constant is too large for 'long' type getdents.c:110: warning: integer constant is too large for 'long' type getdents.c:114: warning: integer constant is too large for 'long' type getdents64.c: In function 'main': getdents64.c:114: warning: integer constant is too large for 'long' type getdents64.c:115: warning: integer constant is too large for 'long' type getdents64.c:119: warning: integer constant is too large for 'long' type xgetrlimit.c: In function 'main': xgetrlimit.c:71: warning: integer constant is too large for 'long' type ioctl_block.c:44: warning: integer constant is too large for 'long' type ioctl_block.c: In function 'main': ioctl_block.c:136: warning: integer constant is too large for 'long' type ioctl_block.c:137: warning: integer constant is too large for 'long' type ioctl_block.c:161: warning: integer constant is too large for 'long' type ioctl_block.c:170: warning: integer constant is too large for 'long' type ioctl_block.c:171: warning: integer constant is too large for 'long' type ioctl_evdev.c:42: warning: integer constant is too large for 'long' type ioctl_mtd.c:46: warning: integer constant is too large for 'long' type ioctl_rtc.c:40: warning: integer constant is too large for 'long' type ioperm.c: In function 'main': ioperm.c:12: warning: integer constant is too large for 'long' type ioctl_v4l2.c: In function 'main': ioctl_v4l2.c:409: warning: integer constant is too large for 'long' type ipc.c: In function 'ipc_call': ipc.c:52: warning: integer constant is too large for 'long' type kill.c: In function 'main': kill.c:59: warning: integer constant is too large for 'long' type kill.c:62: warning: integer constant is too large for 'long' type kill.c:63: warning: integer constant is too large for 'long' type kill.c:68: warning: integer constant is too large for 'long' type linkat.c: In function 'main': linkat.c:14: warning: integer constant is too large for 'long' type linkat.c:15: warning: integer constant is too large for 'long' type mbind.c: In function 'main': mbind.c:41: warning: integer constant is too large for 'long' type mbind.c:43: warning: integer constant is too large for 'long' type mbind.c:44: warning: integer constant is too large for 'long' type migrate_pages.c: In function 'main': migrate_pages.c:41: warning: integer constant is too large for 'long' type In file included from mkdirat.c:10: umode_t.c: In function 'test_syscall': umode_t.c:47: warning: integer constant is too large for 'long' type mknod.c: In function 'call_mknod': mknod.c:16: warning: integer constant is too large for 'long' type mknod.c: In function 'main': mknod.c:23: warning: integer constant is too large for 'long' type mknod.c:49: warning: integer constant is too large for 'long' type mknod.c:56: warning: integer constant is too large for 'long' type mknodat.c:12: warning: integer constant is too large for 'long' type mknodat.c: In function 'call_mknodat': mknodat.c:17: warning: integer constant is too large for 'long' type mknodat.c: In function 'main': mknodat.c:24: warning: integer constant is too large for 'long' type mknodat.c:50: warning: integer constant is too large for 'long' type mknodat.c:57: warning: integer constant is too large for 'long' type mmap.c: In function 'main': mmap.c:51: warning: integer constant is too large for 'long' type move_pages.c: In function 'print_stat_pages': move_pages.c:139: warning: integer constant is too large for 'long' type move_pages.c: In function 'print_move_pages': move_pages.c:166: warning: integer constant is too large for 'long' type move_pages.c: In function 'main': move_pages.c:188: warning: integer constant is too large for 'long' type mq_sendrecv.c: In function 'main': mq_sendrecv.c:238: warning: integer constant is too large for 'long' type mq_sendrecv.c:401: warning: integer constant is too large for 'long' type mq_sendrecv.c:403: warning: integer constant is too large for 'long' type nsyscalls.c: In function 'test_syscall': nsyscalls.c:64: warning: integer constant is too large for 'long' type nsyscalls.c:65: warning: integer constant is too large for 'long' type nsyscalls.c:66: warning: integer constant is too large for 'long' type nsyscalls.c:67: warning: integer constant is too large for 'long' type nsyscalls.c:68: warning: integer constant is too large for 'long' type nsyscalls.c:69: warning: integer constant is too large for 'long' type preadv-pwritev.c: In function 'main': preadv-pwritev.c:162: warning: comparison between signed and unsigned prlimit64.c: In function 'main': prlimit64.c:65: warning: integer constant is too large for 'long' type prlimit64.c:70: warning: integer constant is too large for 'long' type remap_file_pages.c: In function 'main': remap_file_pages.c:42: warning: integer constant is too large for 'long' type remap_file_pages.c:43: warning: integer constant is too large for 'long' type remap_file_pages.c:45: warning: integer constant is too large for 'long' type renameat.c: In function 'main': renameat.c:15: warning: integer constant is too large for 'long' type renameat.c:16: warning: integer constant is too large for 'long' type rt_sigqueueinfo.c: In function 'main': rt_sigqueueinfo.c:41: warning: integer constant is too large for 'long' type rt_tgsigqueueinfo.c: In function 'k_tgsigqueueinfo': rt_tgsigqueueinfo.c:45: warning: integer constant is too large for 'long' type rt_tgsigqueueinfo.c:46: warning: integer constant is too large for 'long' type rt_tgsigqueueinfo.c:47: warning: integer constant is too large for 'long' type rt_tgsigqueueinfo.c: In function 'main': rt_tgsigqueueinfo.c:67: warning: integer constant is too large for 'long' type sendfile.c: In function 'main': sendfile.c:110: warning: integer constant is too large for 'long' type sendfile64.c: In function 'main': sendfile64.c:100: warning: integer constant is too large for 'long' type set_mempolicy.c: In function 'main': set_mempolicy.c:129: warning: integer constant is too large for 'long' type set_mempolicy.c:130: warning: integer constant is too large for 'long' type setrlimit.c: In function 'main': setrlimit.c:44: warning: integer constant is too large for 'long' type socketcall.c: In function 'test_socketcall': socketcall.c:58: warning: integer constant is too large for 'long' type splice.c: In function 'main': splice.c:41: warning: integer constant is too large for 'long' type splice.c:42: warning: integer constant is too large for 'long' type splice.c:45: warning: integer constant is too large for 'long' type splice.c:46: warning: integer constant is too large for 'long' type symlinkat.c: In function 'main': symlinkat.c:12: warning: integer constant is too large for 'long' type sync_file_range.c: In function 'main': sync_file_range.c:42: warning: integer constant is too large for 'long' type sync_file_range.c:43: warning: integer constant is too large for 'long' type syslog.c: In function 'main': syslog.c:14: warning: integer constant is too large for 'long' type tee.c: In function 'main': tee.c:41: warning: integer constant is too large for 'long' type tee.c:42: warning: integer constant is too large for 'long' type timer_create.c: In function 'main': timer_create.c:52: warning: integer constant is too large for 'long' type timer_create.c:84: warning: integer constant is too large for 'long' type timer_create.c:85: warning: integer constant is too large for 'long' type truncate64.c: In function 'main': truncate64.c:41: warning: integer constant is too large for 'long' type xgetrlimit.c: In function 'main': xgetrlimit.c:71: warning: integer constant is too large for 'long' type umode_t.c: In function 'test_syscall': umode_t.c:46: warning: integer constant is too large for 'long' type unlinkat.c: In function 'main': unlinkat.c:13: warning: integer constant is too large for 'long' type waitpid.c: In function 'main': waitpid.c:43: warning: integer constant is too large for 'long' type waitid.c: In function 'poison': waitid.c:141: warning: integer constant is too large for 'long' type xetpriority.c: In function 'main': xetpriority.c:15: warning: integer constant is too large for 'long' type xetpriority.c:19: warning: integer constant is too large for 'long' type xetpriority.c:20: warning: integer constant is too large for 'long' type xetpgid.c: In function 'main': xetpgid.c:43: warning: integer constant is too large for 'long' type xetpgid.c:47: warning: integer constant is too large for 'long' type xetpgid.c:48: warning: integer constant is too large for 'long' type (SLES 11SP4, i386) * tests/alarm.c (main): Add proper suffix to integer constant. * tests/aio.c (main): Likewise. * tests/btrfs.c (btrfs_test_sync_ioctls, btrfs_test_subvol_ioctls): Likewise. * tests/dup2.c (main): Likewise. * tests/dup3.c (main): Likewise. * tests/epoll_create.c (main): Likewise. * tests/epoll_ctl.c (invoke_syscall): Likewise. * tests/faccessat.c (main): Likewise. * tests/fchdir.c (main): Likewise. * tests/fcntl.c (test_flock64_einval): Likewise. * tests/fcntl64.c (test_flock64_einval): Likewise. * tests/fdatasync.c (main): Likewise. * tests/flock.c (main): Likewise. * tests/fstat64.c (SAMPLE_SIZE): Likewise. * tests/fstat.c (SAMPLE_SIZE): Likewise. * tests/fsync.c (main): Likewise. * tests/ftruncate64.c (main): Likewise. * tests/futimesat.c (main): Likewise. * tests/get_mempolicy.c (main): Likewise. * tests/getdents.c (main): Likewise. * tests/getdents64.c (main): Likewise. * tests/ioctl_block.c (lmagic, main): Likewise. * tests/ioctl_evdev.c (lmagic): Likewise. * tests/ioctl_mtd.c (lmagic): Likewise. * tests/ioctl_rtc.c (lmagic): Likewise. * tests/ioctl_v4l2.c (main): Likewise. * tests/ioperm.c (main): Likewise. * tests/ipc.c (ipc_call): Likewise. * tests/kill.c (main): Likewise. * tests/linkat.c (main): Likewise. * tests/lstat64.c (SAMPLE_SIZE): Likewise. * tests/lstat.c (SAMPLE_SIZE): Likewise. * tests/mbind.c (main): Likewise. * tests/migrate_pages.c (main): Likewise. * tests/mkdirat.c (TEST_SYSCALL_PREFIX_ARGS): Likewise. * tests/mknod.c (call_mknod, main): Likewise. * tests/mknodat.c (fd, call_mknodat, main): Likewise. * tests/mmap.c (main): Likewise. * tests/move_pages.c (print_stat_pages, print_move_pages): Likewise. * tests/mq_sendrecv.c (main): Likewise. * tests/nsyscalls.c (test_syscall): Likewise. * tests/prlimit64.c (main): Likewise. * tests/remap_file_pages.c (main): Likewise. * tests/renameat.c (main): Likewise. * tests/rt_sigqueueinfo.c (main): Likewise. * tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo, main): Likewise. * tests/sendfile.c (main): Likewise. * tests/sendfile64.c (main): Likewise. * tests/set_mempolicy.c (main): Likewise. * tests/setrlimit.c (main): Likewise. * tests/socketcall.c (test_socketcall): Likewise. * tests/splice.c (main): Likewise. * tests/stat64.c (SAMPLE_SIZE): Likewise. * tests/stat.c (SAMPLE_SIZE): Likewise. * tests/struct_flock.c (invoke_test_syscall, test_flock_einval): Likewise. * tests/symlinkat.c (main): Likewise. * tests/sync_file_range.c (main): Likewise. * tests/syslog.c (main): Likewise. * tests/tee.c (main): Likewise. * tests/timer_create.c (main): Likewise. * tests/truncate64.c (main): Likewise. * tests/umode_t.c (test_syscall): Likewise. * tests/unlinkat.c (main): Likewise. * tests/waitid.c (main): Likewise. * tests/waitpid.c (main): Likewise. * tests/xetpgid.c (main): Likewise. * tests/xetpriority.c (main): Likewise. * tests/xgetrlimit.c (main): Likewise. * tests/xstatfsx.c (main) [CHECK_ODD_SIZE]: Likewise. * tests/xstatx.c (main): Likewise.
2016-11-13 19:14:46 +03:00
.aio_offset = 0xdeadda7abadc0dedULL,
},
{
.aio_data = 0,
.aio_key = 0xdefaced0,
.aio_lio_opcode = 8,
.aio_reqprio = 0xbeef,
.aio_fildes = 0xdefaced1,
.aio_buf = 0,
.aio_nbytes = 0x8090a0b0c0d0e0f0ULL,
.aio_offset = 0xdeadda7abadc0dedULL,
},
};
const struct iocb *cbv2 = tail_memdup(proto_cbv2, sizeof(proto_cbv2));
const struct iocb proto_cbc = {
.aio_data = (unsigned long) 0xdeadbeefbadc0dedULL,
.aio_reqprio = 99,
.aio_fildes = -42
};
const struct iocb *cbc = tail_memdup(&proto_cbc, sizeof(proto_cbc));
const long proto_cbs[] = {
(long) &cb[0], (long) &cb[1]
};
const long *cbs = tail_memdup(proto_cbs, sizeof(proto_cbs));
const long proto_cbvs[] = {
(long) &cbv[0], (long) &cbv[1],
};
const long *cbvs = tail_memdup(proto_cbvs, sizeof(proto_cbvs));
const long proto_cbvs2[] = {
(long) &cbv2[0], (long) &cbv2[1], (long) &cbv2[2],
(long) &cbv2[3], (long) &cbv2[4],
(long) NULL, (long) 0xffffffffffffffffLL,
};
const long *cbvs2 = tail_memdup(proto_cbvs2, sizeof(proto_cbvs2));
unsigned long *ctx = tail_alloc(sizeof(unsigned long));
*ctx = 0;
const unsigned int nr = ARRAY_SIZE(proto_cb);
const unsigned long lnr = (unsigned long) (0xdeadbeef00000000ULL | nr);
const struct io_event *ev = tail_alloc(nr * sizeof(struct io_event));
const struct timespec proto_ts = { .tv_nsec = 123456789 };
const struct timespec *ts = tail_memdup(&proto_ts, sizeof(proto_ts));
(void) close(0);
if (open("/dev/zero", O_RDONLY))
perror_msg_and_skip("open: %s", "/dev/zero");
long rc = syscall(__NR_io_setup, 0xdeadbeef, NULL);
printf("io_setup(%u, NULL) = %s\n", 0xdeadbeef, sprintrc(rc));
rc = syscall(__NR_io_setup, lnr, ctx + 1);
printf("io_setup(%u, %p) = %s\n", nr, ctx + 1, sprintrc(rc));
if (syscall(__NR_io_setup, lnr, ctx))
perror_msg_and_skip("io_setup");
printf("io_setup(%u, [%#lx]) = 0\n", nr, *ctx);
rc = syscall(__NR_io_submit, bogus_ctx, (long) 0xca7faceddeadf00dLL,
NULL);
printf("io_submit(%#lx, %ld, NULL) = %s\n",
bogus_ctx, (long) 0xca7faceddeadf00dLL, sprintrc(rc));
rc = syscall(__NR_io_submit, *ctx, nr, cbs + nr);
printf("io_submit(%#lx, %ld, %p) = %s\n",
*ctx, (long) nr, cbs + nr, sprintrc(rc));
rc = syscall(__NR_io_submit, *ctx, -1L, cbs);
printf("io_submit(%#lx, -1, %p) = %s\n",
*ctx, cbs, sprintrc(rc));
rc = syscall(__NR_io_submit, *ctx, nr, cbs);
if (rc != (long) nr)
perror_msg_and_skip("io_submit");
printf("io_submit(%#lx, %u, ["
"{data=%#" PRI__x64 ", pread, reqprio=11, fildes=0, "
"buf=%p, nbytes=%u, offset=%" PRI__d64 "}, "
"{data=%#" PRI__x64 ", pread, reqprio=22, fildes=0, "
"buf=%p, nbytes=%u, offset=%" PRI__d64 "}"
"]) = %s\n",
*ctx, nr,
cb[0].aio_data, data0, sizeof_data0, cb[0].aio_offset,
cb[1].aio_data, data1, sizeof_data1, cb[1].aio_offset,
sprintrc(rc));
rc = syscall(__NR_io_getevents, bogus_ctx,
(long) 0xca7faceddeadf00dLL, (long) 0xba5e1e505ca571e0LL,
ev + 1, NULL);
printf("io_getevents(%#lx, %ld, %ld, %p, NULL) = %s\n",
bogus_ctx, (long) 0xca7faceddeadf00dLL,
(long) 0xba5e1e505ca571e0LL, ev + 1, sprintrc(rc));
rc = syscall(__NR_io_getevents, bogus_ctx,
(long) 0xca7faceddeadf00dLL, (long) 0xba5e1e505ca571e0LL,
NULL, ts + 1);
printf("io_getevents(%#lx, %ld, %ld, NULL, %p) = %s\n",
bogus_ctx, (long) 0xca7faceddeadf00dLL,
(long) 0xba5e1e505ca571e0LL, ts + 1, sprintrc(rc));
rc = syscall(__NR_io_getevents, *ctx, nr, nr + 1, ev, ts);
printf("io_getevents(%#lx, %ld, %ld, ["
"{data=%#" PRI__x64 ", obj=%p, res=%u, res2=0}, "
"{data=%#" PRI__x64 ", obj=%p, res=%u, res2=0}"
"], {tv_sec=0, tv_nsec=123456789}) = %s\n",
*ctx, (long) nr, (long) (nr + 1),
cb[0].aio_data, &cb[0], sizeof_data0,
cb[1].aio_data, &cb[1], sizeof_data1,
sprintrc(rc));
rc = syscall(__NR_io_cancel, bogus_ctx, NULL, NULL);
printf("io_cancel(%#lx, NULL, NULL) = %s\n", bogus_ctx, sprintrc(rc));
rc = syscall(__NR_io_cancel, *ctx, cbc + 1, ev);
printf("io_cancel(%#lx, %p, %p) = %s\n", *ctx, cbc + 1, ev,
sprintrc(rc));
rc = syscall(__NR_io_cancel, *ctx, cbc, ev);
printf("io_cancel(%#lx, {data=%#" PRI__x64
", pread, reqprio=99, fildes=-42}, %p) = %s\n",
*ctx, cbc->aio_data, ev, sprintrc(rc));
rc = syscall(__NR_io_submit, (unsigned long) 0xfacef157beeff00dULL,
(long) 0xdeadc0defacefeedLL, NULL);
printf("io_submit(%#lx, %ld, NULL) = %s\n",
(long) 0xfacef157beeff00dULL,
(long) 0xdeadc0defacefeedLL, sprintrc(rc));
rc = syscall(__NR_io_submit, *ctx, -1L, cbvs + nr);
printf("io_submit(%#lx, %ld, %p) = %s\n",
*ctx, -1L, cbvs + nr, sprintrc(rc));
rc = syscall(__NR_io_submit, *ctx, 1057L, cbvs2);
printf("io_submit(%#lx, %ld, ["
"{data=%#" PRI__x64 ", key=%u, %hu /* SUB_??? */, fildes=%d}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d, str=NULL"
", nbytes=%" PRI__u64 ", offset=%" PRI__d64
# ifdef IOCB_FLAG_RESFD
", resfd=%d, flags=%x"
# endif
"}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d, buf=%#" PRI__x64
", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d"
", str=\"\\0\\1\\2\\3%.28s\"..."
", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, "
"{key=%u, pwritev, reqprio=%hd, fildes=%d, buf=%#" PRI__x64
", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}"
", {NULL}, {%#lx}, %p]) = %s\n",
*ctx, 1057L,
cbv2[0].aio_data, cbv2[0].aio_key,
cbv2[0].aio_lio_opcode, cbv2[0].aio_fildes,
cbv2[1].aio_key, cbv2[1].aio_reqprio, cbv2[1].aio_fildes,
cbv2[1].aio_nbytes, cbv2[1].aio_offset,
# ifdef IOCB_FLAG_RESFD
cbv2[1].aio_resfd, cbv2[1].aio_flags,
# endif
cbv2[2].aio_key, cbv2[2].aio_reqprio, cbv2[2].aio_fildes,
cbv2[2].aio_buf, cbv2[2].aio_nbytes, cbv2[2].aio_offset,
cbv2[3].aio_key, cbv2[3].aio_reqprio, cbv2[3].aio_fildes,
data2 + 4, cbv2[3].aio_nbytes, cbv2[3].aio_offset,
cbv2[4].aio_key, cbv2[4].aio_reqprio, cbv2[4].aio_fildes,
cbv2[4].aio_buf, cbv2[4].aio_nbytes, cbv2[4].aio_offset,
cbvs2[6], cbvs2 + 7, sprintrc(rc));
rc = syscall(__NR_io_submit, *ctx, nr, cbvs);
if (rc != (long) nr)
perror_msg_and_skip("io_submit");
printf("io_submit(%#lx, %u, ["
"{data=%#" PRI__x64 ", preadv, reqprio=%hd, fildes=0, "
"iovec=[{iov_base=%p, iov_len=%u}"
", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}, "
"{data=%#" PRI__x64 ", preadv, reqprio=%hd, fildes=0, "
"iovec=[{iov_base=%p, iov_len=%u}"
", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}"
"]) = %s\n",
*ctx, nr,
cbv[0].aio_data, cbv[0].aio_reqprio,
iov0[0].iov_base, (unsigned int) iov0[0].iov_len,
iov0[1].iov_base, (unsigned int) iov0[1].iov_len,
cbv[0].aio_offset,
cbv[1].aio_data, cbv[1].aio_reqprio,
iov1[0].iov_base, (unsigned int) iov1[0].iov_len,
iov1[1].iov_base, (unsigned int) iov1[1].iov_len,
cbv[1].aio_offset,
sprintrc(rc));
rc = syscall(__NR_io_destroy, bogus_ctx);
printf("io_destroy(%#lx) = %s\n",
bogus_ctx, sprintrc(rc));
rc = syscall(__NR_io_destroy, *ctx);
printf("io_destroy(%#lx) = %s\n", *ctx, sprintrc(rc));
puts("+++ exited with 0 +++");
return 0;
}
#else
SKIP_MAIN_UNDEFINED("__NR_io_*")
#endif