aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:41:18 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:41:18 +0000
commit5c21103a7879ec9442c7fa201a36253ebd8b0574 (patch)
treedc99b8d2649bf2bbdb34cad32c778ac254a47634
parentb265ce6306bd119cb7e268984ff5a911d9e66b63 (diff)
parentfbaa68575f181ac6660fdec2a4bc270f5d718980 (diff)
downloadltp-aml_tz3_314012010.tar.gz
Change-Id: Id56cc2327dab675aa8f2cfbbcfd1c1ba981aeb7a
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml88
-rw-r--r--INSTALL165
-rw-r--r--METADATA3
-rw-r--r--Makefile12
-rw-r--r--OWNERS3
-rw-r--r--README.kernel_config1
-rw-r--r--README.md20
-rw-r--r--VERSION2
-rw-r--r--android/Android.ltp.mk32
-rw-r--r--android/README.md66
-rw-r--r--android/include/config.h58
-rw-r--r--android/include/libaio.h1
-rw-r--r--android/include/mqueue.h4
-rw-r--r--android/ltp_package_list.mk209
-rw-r--r--android/tools/Dockerfile4
-rw-r--r--android/tools/android_build_generator.py34
-rw-r--r--android/tools/check_success_build.py16
-rwxr-xr-xandroid/tools/cki_coverage.py36
-rwxr-xr-xandroid/tools/compare_ltp_projects.py36
-rw-r--r--android/tools/custom_cflags.json3
-rw-r--r--android/tools/disabled_tests.txt115
-rwxr-xr-xandroid/tools/dump_make_dryrun.sh38
-rwxr-xr-xandroid/tools/gen_android_build.sh11
-rw-r--r--android/tools/make_install_parser.py6
-rw-r--r--android/tools/make_parser.py3
-rwxr-xr-xbuild.sh95
-rw-r--r--configure.ac179
-rw-r--r--doc/build-system-guide.txt2
-rw-r--r--doc/library-api-writing-guidelines.txt30
-rw-r--r--doc/ltp-run-files.txt5
-rw-r--r--doc/maintainer-patch-review-checklist.txt57
-rw-r--r--doc/style-guide.txt442
-rw-r--r--doc/supported-kernel-libc-versions.txt66
-rw-r--r--doc/test-writing-guidelines.txt738
-rw-r--r--doc/user-guide.txt9
-rw-r--r--docparse/.gitignore7
-rw-r--r--docparse/Makefile77
-rw-r--r--docparse/README.md248
-rw-r--r--docparse/data_storage.h333
-rw-r--r--docparse/docparse.c434
-rwxr-xr-xdocparse/parse.sh43
-rwxr-xr-xdocparse/testinfo.pl506
-rw-r--r--gen.bp3473
-rw-r--r--include/lapi/bpf.h30
-rw-r--r--include/lapi/capability.h12
-rw-r--r--include/lapi/clone.h52
-rw-r--r--include/lapi/close_range.h28
-rw-r--r--include/lapi/common_timers.h8
-rw-r--r--include/lapi/cpuset.h14
-rw-r--r--include/lapi/cryptouser.h14
-rw-r--r--include/lapi/dccp.h14
-rw-r--r--include/lapi/epoll.h15
-rw-r--r--include/lapi/execveat.h28
-rw-r--r--include/lapi/fallocate.h12
-rw-r--r--include/lapi/fcntl.h33
-rw-r--r--include/lapi/fsmount.h146
-rw-r--r--include/lapi/futex.h19
-rw-r--r--include/lapi/getrandom.h15
-rw-r--r--include/lapi/if_alg.h39
-rw-r--r--include/lapi/if_ether.h19
-rw-r--r--include/lapi/if_packet.h40
-rw-r--r--include/lapi/init_module.h35
-rw-r--r--include/lapi/io_pgetevents.h35
-rw-r--r--include/lapi/io_uring.h309
-rw-r--r--include/lapi/ioctl.h40
-rw-r--r--include/lapi/iovec.h16
-rw-r--r--include/lapi/ipcbuf.h195
-rw-r--r--include/lapi/keyctl.h14
-rw-r--r--include/lapi/loop.h55
-rw-r--r--include/lapi/memfd.h12
-rw-r--r--include/lapi/mkdirat.h17
-rw-r--r--include/lapi/mmap.h24
-rw-r--r--include/lapi/mount.h15
-rw-r--r--include/lapi/msg.h19
-rw-r--r--include/lapi/msgbuf.h306
-rw-r--r--include/lapi/name_to_handle_at.h59
-rw-r--r--include/lapi/namespaces_constants.h21
-rw-r--r--include/lapi/netinet_in.h14
-rw-r--r--include/lapi/openat2.h80
-rw-r--r--include/lapi/personality.h15
-rw-r--r--include/lapi/pidfd_open.h24
-rw-r--r--include/lapi/posix_types.h21
-rw-r--r--include/lapi/preadv2.h4
-rw-r--r--include/lapi/pwritev2.h4
-rw-r--r--include/lapi/quotactl.h4
-rw-r--r--include/lapi/readdir.h13
-rw-r--r--include/lapi/readlinkat.h18
-rw-r--r--include/lapi/renameat.h19
-rw-r--r--include/lapi/rpc.h27
-rw-r--r--include/lapi/rt_sigaction.h22
-rw-r--r--include/lapi/rtnetlink.h13
-rw-r--r--include/lapi/safe_rt_signal.h25
-rw-r--r--include/lapi/sched.h26
-rw-r--r--include/lapi/sctp.h14
-rw-r--r--include/lapi/seek.h14
-rw-r--r--include/lapi/sem.h27
-rw-r--r--include/lapi/sembuf.h234
-rw-r--r--include/lapi/semun.h35
-rw-r--r--include/lapi/setns.h20
-rw-r--r--include/lapi/shm.h13
-rw-r--r--include/lapi/shmbuf.h273
-rw-r--r--include/lapi/socket.h14
-rw-r--r--include/lapi/splice.h20
-rw-r--r--include/lapi/syncfs.h2
-rw-r--r--include/lapi/syscalls/aarch64.in45
-rw-r--r--include/lapi/syscalls/arc.in315
-rw-r--r--include/lapi/syscalls/arm.in60
-rw-r--r--include/lapi/syscalls/hppa.in13
-rw-r--r--include/lapi/syscalls/i386.in101
-rw-r--r--include/lapi/syscalls/ia64.in34
-rw-r--r--include/lapi/syscalls/mips_n32.in734
-rw-r--r--include/lapi/syscalls/mips_n64.in686
-rw-r--r--include/lapi/syscalls/mips_o32.in826
-rw-r--r--include/lapi/syscalls/order1
-rw-r--r--include/lapi/syscalls/powerpc.in70
-rw-r--r--include/lapi/syscalls/powerpc64.in70
-rw-r--r--include/lapi/syscalls/s390.in231
-rw-r--r--include/lapi/syscalls/s390x.in179
-rw-r--r--include/lapi/syscalls/sh.in382
-rw-r--r--include/lapi/syscalls/sparc.in73
-rw-r--r--include/lapi/syscalls/sparc64.in51
-rw-r--r--include/lapi/syscalls/x86_64.in63
-rw-r--r--include/lapi/tcp.h14
-rw-r--r--include/lapi/tee.h18
-rw-r--r--include/lapi/termbits.h14
-rw-r--r--include/lapi/timerfd.h22
-rw-r--r--include/lapi/tty.h21
-rw-r--r--include/lapi/udp.h14
-rw-r--r--include/lapi/utime.h15
-rw-r--r--include/lapi/vmsplice.h20
-rw-r--r--include/lapi/xfrm.h14
-rw-r--r--include/libsigwait.h44
-rw-r--r--include/libswap.h24
-rw-r--r--include/mk/config.mk.in33
-rw-r--r--include/mk/env_post.mk28
-rw-r--r--include/mk/env_pre.mk44
-rw-r--r--include/mk/features.mk.in5
-rw-r--r--include/mk/functions.mk36
-rw-r--r--include/mk/generic_leaf_target.inc16
-rw-r--r--include/mk/generic_trunk_target.inc13
-rw-r--r--include/mk/lib.mk20
-rw-r--r--include/mk/module.mk4
-rw-r--r--include/mk/rules.mk39
-rw-r--r--include/mk/testcases.mk11
-rw-r--r--include/old/old_device.h19
-rw-r--r--include/old/old_module.h27
-rw-r--r--include/old/test.h13
-rw-r--r--include/parse_vdso.h41
-rw-r--r--include/safe_file_ops_fn.h14
-rw-r--r--include/safe_net_fn.h3
-rw-r--r--include/time64_variants.h65
-rw-r--r--include/tst_af_alg.h32
-rw-r--r--include/tst_ansi_color.h15
-rw-r--r--include/tst_assert.h65
-rw-r--r--include/tst_atomic.h16
-rw-r--r--include/tst_bool_expr.h85
-rw-r--r--include/tst_cgroup.h191
-rw-r--r--include/tst_checkpoint.h15
-rw-r--r--include/tst_checkpoint_fn.h15
-rw-r--r--include/tst_clocks.h20
-rw-r--r--include/tst_clone.h49
-rw-r--r--include/tst_cmd.h76
-rw-r--r--include/tst_common.h53
-rw-r--r--include/tst_cpu.h19
-rw-r--r--include/tst_crypto.h16
-rw-r--r--include/tst_device.h47
-rw-r--r--include/tst_fips.h15
-rw-r--r--include/tst_fs.h73
-rw-r--r--include/tst_fuzzy_sync.h166
-rw-r--r--include/tst_get_bad_addr.h15
-rw-r--r--include/tst_hugepage.h37
-rw-r--r--include/tst_kconfig.h34
-rw-r--r--include/tst_kernel.h23
-rw-r--r--include/tst_kvercmp.h32
-rw-r--r--include/tst_lockdown.h9
-rw-r--r--include/tst_memutils.h22
-rw-r--r--include/tst_minmax.h15
-rw-r--r--include/tst_mkfs.h15
-rw-r--r--include/tst_module.h33
-rw-r--r--include/tst_net.h149
-rw-r--r--include/tst_netdevice.h118
-rw-r--r--include/tst_netlink.h16
-rw-r--r--include/tst_numa.h4
-rw-r--r--include/tst_pid.h15
-rw-r--r--include/tst_private.h40
-rw-r--r--include/tst_process_state.h33
-rw-r--r--include/tst_res_flags.h10
-rw-r--r--include/tst_rtctime.h29
-rw-r--r--include/tst_rtnetlink.h106
-rw-r--r--include/tst_safe_clocks.h142
-rw-r--r--include/tst_safe_file_at.h61
-rw-r--r--include/tst_safe_file_ops.h32
-rw-r--r--include/tst_safe_io_uring.h62
-rw-r--r--include/tst_safe_macros.h202
-rw-r--r--include/tst_safe_net.h24
-rw-r--r--include/tst_safe_posix_ipc.h6
-rw-r--r--include/tst_safe_prw.h31
-rw-r--r--include/tst_safe_pthread.h15
-rw-r--r--include/tst_safe_stdio.h15
-rw-r--r--include/tst_safe_sysv_ipc.h33
-rw-r--r--include/tst_safe_timerfd.h32
-rw-r--r--include/tst_sig_proc.h12
-rw-r--r--include/tst_sys_conf.h4
-rw-r--r--include/tst_taint.h24
-rw-r--r--include/tst_test.h80
-rw-r--r--include/tst_test_macros.h153
-rw-r--r--include/tst_timer.h1012
-rw-r--r--include/tst_wallclock.h4
-rw-r--r--lib/Makefile2
-rw-r--r--lib/README.md152
-rw-r--r--lib/android_libpthread/Makefile2
-rw-r--r--lib/android_librt/Makefile2
-rw-r--r--lib/newlib_tests/.gitignore14
-rw-r--r--lib/newlib_tests/Makefile2
-rw-r--r--lib/newlib_tests/config011
-rw-r--r--lib/newlib_tests/config021
-rw-r--r--lib/newlib_tests/config031
-rw-r--r--lib/newlib_tests/config041
-rw-r--r--lib/newlib_tests/config051
-rw-r--r--lib/newlib_tests/config061
-rwxr-xr-xlib/newlib_tests/shell/net/tst_rhost_run.sh27
-rwxr-xr-xlib/newlib_tests/shell/test_timeout.sh178
-rwxr-xr-xlib/newlib_tests/shell/timeout03.sh47
-rwxr-xr-xlib/newlib_tests/shell/timeout04.sh22
-rwxr-xr-xlib/newlib_tests/shell/tst_check_driver.sh63
-rw-r--r--lib/newlib_tests/test02.c4
-rw-r--r--lib/newlib_tests/test20.c45
-rw-r--r--lib/newlib_tests/test22.c34
-rw-r--r--lib/newlib_tests/test_assert.c19
-rw-r--r--lib/newlib_tests/test_exec.c2
-rw-r--r--lib/newlib_tests/test_kconfig.c3
-rw-r--r--lib/newlib_tests/test_kconfig01.c23
-rw-r--r--lib/newlib_tests/test_kconfig02.c29
-rw-r--r--lib/newlib_tests/test_macros01.c40
-rw-r--r--lib/newlib_tests/test_macros02.c42
-rw-r--r--lib/newlib_tests/test_macros03.c40
-rw-r--r--lib/newlib_tests/test_timer.c113
-rw-r--r--lib/newlib_tests/tst_bool_expr.c131
-rw-r--r--lib/newlib_tests/tst_capability01.c2
-rw-r--r--lib/newlib_tests/tst_cgroup01.c51
-rw-r--r--lib/newlib_tests/tst_cgroup02.c90
-rw-r--r--lib/newlib_tests/tst_device.c8
-rw-r--r--lib/newlib_tests/tst_fuzzy_sync01.c230
-rw-r--r--lib/newlib_tests/tst_fuzzy_sync02.c172
-rw-r--r--lib/newlib_tests/variant.c10
-rw-r--r--lib/safe_file_ops.c203
-rw-r--r--lib/safe_macros.c631
-rw-r--r--lib/safe_net.c281
-rw-r--r--lib/safe_stdio.c34
-rw-r--r--lib/tst_af_alg.c64
-rw-r--r--lib/tst_assert.c83
-rw-r--r--lib/tst_bool_expr.c405
-rw-r--r--lib/tst_capability.c2
-rw-r--r--lib/tst_cgroup.c1124
-rw-r--r--lib/tst_checkpoint.c29
-rw-r--r--lib/tst_clocks.c134
-rw-r--r--lib/tst_clone.c46
-rw-r--r--lib/tst_cpu.c26
-rw-r--r--lib/tst_device.c164
-rw-r--r--lib/tst_fill_file.c40
-rw-r--r--lib/tst_fips.c24
-rw-r--r--lib/tst_fs_setup.c11
-rw-r--r--lib/tst_fs_type.c36
-rw-r--r--lib/tst_hugepage.c61
-rw-r--r--lib/tst_kconfig.c494
-rw-r--r--lib/tst_kernel.c104
-rw-r--r--lib/tst_kvercmp.c33
-rw-r--r--lib/tst_lockdown.c70
-rw-r--r--lib/tst_memutils.c63
-rw-r--r--lib/tst_mkfs.c46
-rw-r--r--lib/tst_module.c13
-rw-r--r--lib/tst_net.c222
-rw-r--r--lib/tst_netdevice.c466
-rw-r--r--lib/tst_process_state.c19
-rw-r--r--lib/tst_res.c6
-rw-r--r--lib/tst_resource.c9
-rw-r--r--lib/tst_rtctime.c127
-rw-r--r--lib/tst_rtnetlink.c412
-rw-r--r--lib/tst_run_cmd.c (renamed from lib/tst_cmd.c)31
-rw-r--r--lib/tst_safe_file_at.c197
-rw-r--r--lib/tst_safe_io_uring.c108
-rw-r--r--lib/tst_safe_macros.c349
-rw-r--r--lib/tst_safe_sysv_ipc.c186
-rw-r--r--lib/tst_safe_timerfd.c69
-rw-r--r--lib/tst_status.c3
-rw-r--r--lib/tst_supported_fs_types.c117
-rw-r--r--lib/tst_sys_conf.c10
-rw-r--r--lib/tst_taint.c9
-rw-r--r--lib/tst_test.c211
-rw-r--r--lib/tst_timer.c24
-rw-r--r--lib/tst_timer_test.c2
-rw-r--r--lib/tst_tmpdir.c97
-rw-r--r--lib/tst_virt.c51
-rw-r--r--lib/tst_wallclock.c43
-rw-r--r--libs/libltpipc/Makefile11
-rw-r--r--libs/libltpnewipc/Makefile11
-rw-r--r--libs/libltpnuma/Makefile2
-rw-r--r--libs/libltpsigwait/Makefile11
-rw-r--r--libs/libltpsigwait/sigwait.c384
-rw-r--r--libs/libltpswap/Makefile12
-rw-r--r--libs/libltpswap/libswap.c65
-rw-r--r--libs/libltpuinput/Makefile2
-rw-r--r--libs/libltpvdso/Makefile11
-rw-r--r--libs/libltpvdso/README1
-rw-r--r--libs/libltpvdso/parse_vdso.c278
-rw-r--r--libs/libltpvdso/vdso_helpers.c77
-rw-r--r--m4/ax_compare_version.m4177
-rw-r--r--m4/ax_prog_perl_modules.m477
-rw-r--r--m4/ltp-acct.m47
-rw-r--r--m4/ltp-docparse.m4112
-rw-r--r--m4/ltp-fanotify.m48
-rw-r--r--m4/ltp-fts.m47
-rw-r--r--m4/ltp-if_link.m46
-rw-r--r--m4/ltp-ioctl.m47
-rw-r--r--m4/ltp-iovec.m46
-rw-r--r--m4/ltp-kcmp_type.m47
-rw-r--r--m4/ltp-libmnl.m48
-rw-r--r--m4/ltp-madvise.m411
-rw-r--r--m4/ltp-mkdtemp.m45
-rw-r--r--m4/ltp-mmsghdr.m410
-rw-r--r--m4/ltp-modify_ldt.m413
-rw-r--r--m4/ltp-perf_event.m46
-rw-r--r--m4/ltp-prctl.m411
-rw-r--r--m4/ltp-quota.m48
-rw-r--r--m4/ltp-rlimit64.m49
-rw-r--r--m4/ltp-signal.m418
-rw-r--r--m4/ltp-statx.m414
-rw-r--r--m4/ltp-timerfd.m47
-rw-r--r--m4/ltp-tirpc.m426
-rw-r--r--m4/ltp-tpacket-v3.m410
-rw-r--r--m4/ltp-uname.m48
-rw-r--r--m4/ltp-x_tables.m425
-rw-r--r--pan/ltp-pan.c10
-rwxr-xr-xrunltp54
-rw-r--r--runtest/Makefile2
-rw-r--r--runtest/can4
-rw-r--r--runtest/commands1
-rw-r--r--runtest/connectors2
-rw-r--r--runtest/containers7
-rw-r--r--runtest/crashme3
-rw-r--r--runtest/crypto1
-rw-r--r--runtest/cve22
-rw-r--r--runtest/fs10
-rw-r--r--runtest/fs_readonly2
-rw-r--r--runtest/ima3
-rw-r--r--runtest/kernel_misc1
-rw-r--r--runtest/lvm.part1217
-rw-r--r--runtest/lvm.part272
-rw-r--r--runtest/mm7
-rw-r--r--runtest/net.features11
-rw-r--r--runtest/net.tcp_cmds3
-rw-r--r--runtest/net.tirpc_tests2
-rw-r--r--runtest/net_stress.multicast48
-rw-r--r--runtest/net_stress.route12
-rw-r--r--runtest/pty3
-rw-r--r--runtest/quickhit316
-rw-r--r--runtest/smoketest16
-rw-r--r--runtest/syscalls152
-rw-r--r--runtest/syscalls-ipc12
-rw-r--r--scenario_groups/Makefile2
-rw-r--r--testcases/commands/.gitignore1
-rwxr-xr-xtestcases/commands/cpio/cpio_tests.sh18
-rwxr-xr-xtestcases/commands/df/df01.sh10
-rw-r--r--testcases/commands/insmod/.gitignore9
-rwxr-xr-xtestcases/commands/ld/ld01.sh4
-rw-r--r--testcases/commands/ldd/datafiles/Makefile2
-rw-r--r--testcases/commands/lsmod/.gitignore9
-rw-r--r--testcases/commands/lsmod/Makefile15
-rwxr-xr-xtestcases/commands/lsmod/lsmod01.sh33
-rw-r--r--testcases/commands/lsmod/ltp_lsmod01.c28
-rwxr-xr-xtestcases/commands/mkfs/mkfs01.sh23
-rwxr-xr-xtestcases/commands/nm/nm01.sh2
-rw-r--r--testcases/commands/shell/Makefile10
-rwxr-xr-xtestcases/commands/shell/shell_pipe01.sh17
-rwxr-xr-xtestcases/commands/unzip/unzip01.sh18
-rw-r--r--testcases/cve/Makefile2
-rw-r--r--testcases/cve/cve-2017-17052.c2
-rw-r--r--testcases/cve/cve-2017-17053.c4
-rw-r--r--testcases/cve/meltdown.c6
-rw-r--r--testcases/cve/stack_clash.c2
-rw-r--r--testcases/kernel/connectors/Makefile2
-rw-r--r--testcases/kernel/connectors/connector_test.sh9
-rw-r--r--testcases/kernel/connectors/pec/Makefile2
-rw-r--r--testcases/kernel/connectors/pec/README48
-rwxr-xr-xtestcases/kernel/connectors/pec/cn_pec.sh141
-rw-r--r--testcases/kernel/connectors/pec/event_generator.c115
-rw-r--r--testcases/kernel/connectors/pec/pec_listener.c54
-rwxr-xr-xtestcases/kernel/connectors/pec/run_pec_test107
-rw-r--r--testcases/kernel/containers/README3
-rw-r--r--testcases/kernel/containers/libclone/Makefile2
-rwxr-xr-xtestcases/kernel/containers/netns/netns_breakns.sh61
-rwxr-xr-xtestcases/kernel/containers/netns/netns_comm.sh96
-rw-r--r--testcases/kernel/containers/netns/netns_helper.h80
-rwxr-xr-xtestcases/kernel/containers/netns/netns_helper.sh131
-rw-r--r--testcases/kernel/containers/netns/netns_netlink.c176
-rw-r--r--[-rwxr-xr-x]testcases/kernel/containers/netns/netns_sysfs.sh122
-rw-r--r--testcases/kernel/containers/pidns/pidns02.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns04.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns05.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns06.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns10.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns12.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns13.c237
-rw-r--r--testcases/kernel/containers/pidns/pidns16.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns17.c4
-rw-r--r--testcases/kernel/containers/pidns/pidns20.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns30.c2
-rw-r--r--testcases/kernel/containers/pidns/pidns31.c2
-rw-r--r--testcases/kernel/containers/share/ns_create.c1
-rw-r--r--testcases/kernel/containers/share/ns_ifmove.c2
-rw-r--r--testcases/kernel/containers/sysvipc/sem_comm.c3
-rw-r--r--testcases/kernel/containers/timens/.gitignore1
-rw-r--r--testcases/kernel/containers/timens/Makefile6
-rw-r--r--testcases/kernel/containers/timens/timens01.c69
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c6
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c10
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c10
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c10
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_test01.c6
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_test02.c7
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_test03.c10
-rw-r--r--testcases/kernel/controllers/cpuctl/cpuctl_test04.c10
-rwxr-xr-xtestcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh2
-rwxr-xr-xtestcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh4
-rwxr-xr-xtestcases/kernel/controllers/cpuctl/run_cpuctl_test.sh4
-rwxr-xr-xtestcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh8
-rwxr-xr-xtestcases/kernel/controllers/cpuset/cpuset_funcs.sh51
-rwxr-xr-xtestcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh10
-rwxr-xr-xtestcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh89
-rw-r--r--testcases/kernel/controllers/cpuset/cpuset_lib/Makefile2
-rw-r--r--testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c36
-rw-r--r--testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c2
-rw-r--r--testcases/kernel/controllers/freezer/vfork.c2
-rw-r--r--testcases/kernel/controllers/libcontrollers/Makefile2
-rw-r--r--testcases/kernel/controllers/libcontrollers/libcontrollers.c11
-rw-r--r--testcases/kernel/controllers/libcontrollers/libcontrollers.h32
-rw-r--r--testcases/kernel/controllers/memcg/control/mem_process.c16
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_failcnt.sh79
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_force_empty.sh64
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_lib.sh563
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_limit_in_bytes.sh106
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh112
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_memsw_limit_in_bytes_test.sh86
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_move_charge_at_immigrate_test.sh102
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_stat_rss.sh68
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_stat_test.sh128
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh81
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh67
-rwxr-xr-xtestcases/kernel/controllers/memcg/functional/memcg_use_hierarchy_test.sh60
-rwxr-xr-xtestcases/kernel/controllers/memctl/run_memctl_test.sh4
-rw-r--r--testcases/kernel/crypto/.gitignore1
-rw-r--r--testcases/kernel/crypto/Makefile4
-rw-r--r--testcases/kernel/crypto/af_alg02.c21
-rw-r--r--testcases/kernel/crypto/af_alg05.c4
-rw-r--r--testcases/kernel/crypto/af_alg07.c135
-rw-r--r--testcases/kernel/crypto/crypto_user02.c65
-rw-r--r--testcases/kernel/device-drivers/agp/kernel_space/Makefile4
-rw-r--r--testcases/kernel/device-drivers/base/tbase/Makefile4
-rw-r--r--testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c2
-rw-r--r--testcases/kernel/device-drivers/dev_sim_framework/kernel_space/Makefile4
-rw-r--r--testcases/kernel/device-drivers/drm/kernel_space/Makefile2
-rw-r--r--testcases/kernel/device-drivers/include/Makefile4
-rw-r--r--testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile8
-rw-r--r--testcases/kernel/device-drivers/nls/Makefile6
-rw-r--r--testcases/kernel/device-drivers/pci/tpci_kernel/Makefile2
-rw-r--r--testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c38
-rw-r--r--testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h1
-rw-r--r--testcases/kernel/device-drivers/rtc/.gitignore1
-rw-r--r--testcases/kernel/device-drivers/rtc/rtc02.c110
-rw-r--r--testcases/kernel/device-drivers/usb/tusb/Makefile10
-rw-r--r--testcases/kernel/device-drivers/v4l/kernel_space/Makefile8
-rwxr-xr-xtestcases/kernel/device-drivers/zram/zram01.sh99
-rwxr-xr-xtestcases/kernel/device-drivers/zram/zram02.sh48
-rwxr-xr-xtestcases/kernel/device-drivers/zram/zram_lib.sh109
-rw-r--r--testcases/kernel/fs/fsstress/fsstress.c4
-rw-r--r--testcases/kernel/fs/fsx-linux/fsx-linux.c2
-rw-r--r--testcases/kernel/fs/ftest/Makefile25
-rw-r--r--testcases/kernel/fs/inode/inode02.c14
-rwxr-xr-xtestcases/kernel/fs/iso9660/isofs.sh36
-rw-r--r--testcases/kernel/fs/lftest/lftest.c111
-rwxr-xr-xtestcases/kernel/fs/linktest/linktest.sh50
-rw-r--r--testcases/kernel/fs/proc/proc01.c9
-rwxr-xr-xtestcases/kernel/fs/quota_remount/quota_remount_test01.sh198
-rw-r--r--testcases/kernel/fs/read_all/read_all.c43
-rw-r--r--testcases/kernel/fs/scsi/ltpfs/Makefile4
-rw-r--r--testcases/kernel/hotplug/memory_hotplug/Makefile3
-rw-r--r--testcases/kernel/hotplug/memory_hotplug/commands.c98
-rw-r--r--testcases/kernel/hotplug/memory_hotplug/memtoy.c1
-rw-r--r--testcases/kernel/input/Makefile21
-rw-r--r--testcases/kernel/input/input_helper.c4
-rw-r--r--testcases/kernel/io/aio/aio02.c23
-rw-r--r--testcases/kernel/io/direct_io/Makefile21
-rw-r--r--testcases/kernel/io/direct_io/diotest4.c2
-rw-r--r--testcases/kernel/io/disktest/Makefile2
-rw-r--r--testcases/kernel/io/disktest/Makefile.linux4
-rw-r--r--testcases/kernel/io/ltp-aiodio/dio_append.c2
-rw-r--r--testcases/kernel/io/ltp-aiodio/dio_truncate.c2
-rw-r--r--testcases/kernel/ipc/pipeio/pipeio.c3
-rw-r--r--testcases/kernel/ipc/semaphore/sem01.c3
-rw-r--r--testcases/kernel/ipc/semaphore/sem02.c3
-rw-r--r--testcases/kernel/logging/kmsg/kmsg01.c2
-rw-r--r--testcases/kernel/mem/.gitignore2
-rw-r--r--testcases/kernel/mem/cpuset/cpuset01.c35
-rw-r--r--testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c38
-rw-r--r--testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c38
-rw-r--r--testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c40
-rw-r--r--testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c39
-rw-r--r--testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c32
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c36
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c36
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c36
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c26
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c27
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c151
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c69
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c34
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c36
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c36
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c36
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c37
-rw-r--r--testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c37
-rw-r--r--testcases/kernel/mem/hugetlb/lib/Makefile2
-rw-r--r--testcases/kernel/mem/hugetlb/lib/hugetlb.c55
-rw-r--r--testcases/kernel/mem/hugetlb/lib/hugetlb.h9
-rw-r--r--testcases/kernel/mem/include/mem.h23
-rw-r--r--testcases/kernel/mem/ksm/ksm01.c12
-rw-r--r--testcases/kernel/mem/ksm/ksm02.c27
-rw-r--r--testcases/kernel/mem/ksm/ksm03.c26
-rw-r--r--testcases/kernel/mem/ksm/ksm04.c32
-rw-r--r--testcases/kernel/mem/ksm/ksm05.c2
-rw-r--r--testcases/kernel/mem/ksm/ksm06.c19
-rw-r--r--testcases/kernel/mem/ksm/ksm_common.h12
-rw-r--r--testcases/kernel/mem/lib/mem.c126
-rw-r--r--testcases/kernel/mem/mem/mem01.c249
-rw-r--r--testcases/kernel/mem/mmapstress/mmap-corruption01.c2
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress01.c2
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress02.c2
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress05.c4
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress06.c4
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress07.c4
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress08.c4
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress09.c4
-rw-r--r--testcases/kernel/mem/mmapstress/mmapstress10.c4
-rw-r--r--testcases/kernel/mem/mtest01/mtest01.c19
-rw-r--r--testcases/kernel/mem/mtest05/mmstress.c32
-rw-r--r--testcases/kernel/mem/mtest06/mmap1.c33
-rw-r--r--testcases/kernel/mem/mtest06/mmap3.c16
-rw-r--r--testcases/kernel/mem/mtest07/mallocstress.c2
-rw-r--r--testcases/kernel/mem/oom/oom03.c26
-rw-r--r--testcases/kernel/mem/oom/oom04.c19
-rw-r--r--testcases/kernel/mem/oom/oom05.c45
-rw-r--r--testcases/kernel/mem/page/page01.c24
-rw-r--r--testcases/kernel/mem/page/page02.c24
-rw-r--r--testcases/kernel/mem/shmt/shmt02.c8
-rw-r--r--testcases/kernel/mem/shmt/shmt03.c12
-rw-r--r--testcases/kernel/mem/shmt/shmt04.c20
-rw-r--r--testcases/kernel/mem/shmt/shmt06.c30
-rw-r--r--testcases/kernel/mem/shmt/shmt07.c10
-rw-r--r--testcases/kernel/mem/shmt/shmt09.c18
-rw-r--r--testcases/kernel/mem/shmt/shmt10.c8
-rw-r--r--testcases/kernel/mem/swapping/swapping01.c30
-rw-r--r--testcases/kernel/mem/thp/Makefile1
-rw-r--r--testcases/kernel/mem/thp/thp01.c5
-rw-r--r--testcases/kernel/mem/thp/thp04.c172
-rw-r--r--testcases/kernel/mem/tunable/max_map_count.c12
-rw-r--r--testcases/kernel/mem/tunable/overcommit_memory.c68
-rwxr-xr-xtestcases/kernel/mem/vma/vma05.sh2
-rw-r--r--testcases/kernel/mem/vmtests/data_space.c14
-rw-r--r--testcases/kernel/mem/vmtests/stack_space.c20
-rw-r--r--testcases/kernel/numa/Makefile2
-rw-r--r--testcases/kernel/numa/README23
-rwxr-xr-xtestcases/kernel/numa/numa01.sh137
-rw-r--r--testcases/kernel/pty/.gitignore3
-rw-r--r--testcases/kernel/pty/Makefile3
-rw-r--r--testcases/kernel/pty/hangup01.c7
-rw-r--r--testcases/kernel/pty/ptem01.c13
-rw-r--r--testcases/kernel/pty/pty01.c11
-rw-r--r--testcases/kernel/pty/pty02.c6
-rw-r--r--testcases/kernel/pty/pty03.c160
-rw-r--r--testcases/kernel/pty/pty04.c483
-rw-r--r--testcases/kernel/pty/pty05.c105
-rw-r--r--testcases/kernel/sched/clisrv/Makefile24
-rw-r--r--testcases/kernel/sched/eas/trace_parse.h4
-rw-r--r--testcases/kernel/sched/hyperthreading/ht_affinity/Makefile2
-rw-r--r--testcases/kernel/sched/hyperthreading/ht_enabled/Makefile2
-rw-r--r--testcases/kernel/sched/hyperthreading/ht_enabled/ht_enabled.c2
-rw-r--r--testcases/kernel/sched/process_stress/process.c3
-rw-r--r--testcases/kernel/sched/pthreads/pth_str01.c20
-rw-r--r--testcases/kernel/sched/sched_stress/Makefile26
-rw-r--r--testcases/kernel/sched/tool/trace_sched.c8
-rw-r--r--testcases/kernel/security/cap_bound/cap_bounds_rw.c24
-rw-r--r--testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c26
-rw-r--r--testcases/kernel/security/cap_bound/check_pe.c14
-rw-r--r--testcases/kernel/security/cap_bound/exec_with_inh.c12
-rw-r--r--testcases/kernel/security/cap_bound/exec_without_inh.c10
-rw-r--r--testcases/kernel/security/dirtyc0w/dirtyc0w.c7
-rw-r--r--testcases/kernel/security/filecaps/inh_capped.c4
-rw-r--r--testcases/kernel/security/filecaps/verify_caps_exec.c48
-rw-r--r--testcases/kernel/security/integrity/ima/README81
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/Makefile10
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_kexec/Makefile11
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_kexec/kexec.policy1
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_keys/Makefile11
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_keys/keycheck.policy1
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_keys/x509_ima.derbin650 -> 0 bytes
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_policy/Makefile11
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_selinux/Makefile11
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/ima_selinux/selinux.policy1
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/measure.policy (renamed from testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy)0
-rw-r--r--testcases/kernel/security/integrity/ima/datafiles/measure.policy-invalid (renamed from testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy-invalid)0
-rw-r--r--testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c114
-rw-r--r--testcases/kernel/security/integrity/ima/src/ima_mmap.c14
-rw-r--r--testcases/kernel/security/integrity/ima/tests/README.md (renamed from testcases/kernel/security/integrity/ima/README.md)70
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/evm_overlay.sh2
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_kexec.sh120
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_keys.sh148
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_measurements.sh102
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_policy.sh3
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_selinux.sh173
-rw-r--r--testcases/kernel/security/integrity/ima/tests/ima_setup.sh213
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_tpm.sh308
-rwxr-xr-xtestcases/kernel/security/integrity/ima/tests/ima_violations.sh12
-rw-r--r--testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c9
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_accept_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_file_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_new_file_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_new_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_policy_io_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_policy_memory_test.c2
-rw-r--r--testcases/kernel/security/tomoyo/tomoyo_rewrite_test.c2
-rw-r--r--testcases/kernel/security/umip/umip_basic_test.c19
-rw-r--r--testcases/kernel/sound/.gitignore1
-rw-r--r--testcases/kernel/sound/Makefile4
-rw-r--r--testcases/kernel/sound/snd_seq01.c133
-rw-r--r--testcases/kernel/sound/snd_timer01.c3
-rw-r--r--testcases/kernel/syscalls/Makefile16
-rw-r--r--testcases/kernel/syscalls/abort/Makefile19
-rw-r--r--testcases/kernel/syscalls/abort/abort01.c24
-rw-r--r--testcases/kernel/syscalls/accept/Makefile19
-rw-r--r--testcases/kernel/syscalls/accept/accept01.c25
-rw-r--r--testcases/kernel/syscalls/accept/accept02.c5
-rw-r--r--testcases/kernel/syscalls/accept4/Makefile17
-rw-r--r--testcases/kernel/syscalls/accept4/accept4_01.c60
-rw-r--r--testcases/kernel/syscalls/access/Makefile19
-rw-r--r--testcases/kernel/syscalls/access/access01.c45
-rw-r--r--testcases/kernel/syscalls/access/access02.c8
-rw-r--r--testcases/kernel/syscalls/access/access03.c28
-rw-r--r--testcases/kernel/syscalls/access/access04.c17
-rw-r--r--testcases/kernel/syscalls/acct/Makefile19
-rw-r--r--testcases/kernel/syscalls/acct/acct01.c5
-rw-r--r--testcases/kernel/syscalls/acct/acct02.c32
-rw-r--r--testcases/kernel/syscalls/add_key/.gitignore1
-rw-r--r--testcases/kernel/syscalls/add_key/Makefile19
-rw-r--r--testcases/kernel/syscalls/add_key/add_key01.c113
-rw-r--r--testcases/kernel/syscalls/add_key/add_key02.c1
-rw-r--r--testcases/kernel/syscalls/add_key/add_key05.c245
-rw-r--r--testcases/kernel/syscalls/adjtimex/.gitignore1
-rw-r--r--testcases/kernel/syscalls/adjtimex/Makefile19
-rw-r--r--testcases/kernel/syscalls/adjtimex/adjtimex03.c85
-rw-r--r--testcases/kernel/syscalls/alarm/Makefile19
-rw-r--r--testcases/kernel/syscalls/bind/.gitignore3
-rw-r--r--testcases/kernel/syscalls/bind/Makefile23
-rw-r--r--testcases/kernel/syscalls/bind/bind01.c14
-rw-r--r--testcases/kernel/syscalls/bind/bind02.c11
-rw-r--r--testcases/kernel/syscalls/bind/bind03.c72
-rw-r--r--testcases/kernel/syscalls/bind/bind04.c168
-rw-r--r--testcases/kernel/syscalls/bind/bind05.c185
-rw-r--r--testcases/kernel/syscalls/bind/bind06.c115
-rw-r--r--testcases/kernel/syscalls/bind/libbind.h28
-rw-r--r--testcases/kernel/syscalls/bpf/.gitignore2
-rw-r--r--testcases/kernel/syscalls/bpf/Makefile3
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_common.c141
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_common.h92
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_map01.c3
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_prog01.c128
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_prog02.c84
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_prog03.c72
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_prog04.c129
-rw-r--r--testcases/kernel/syscalls/bpf/bpf_prog05.c178
-rw-r--r--testcases/kernel/syscalls/brk/.gitignore1
-rw-r--r--testcases/kernel/syscalls/brk/Makefile19
-rw-r--r--testcases/kernel/syscalls/brk/brk01.c7
-rw-r--r--testcases/kernel/syscalls/brk/brk02.c60
-rw-r--r--testcases/kernel/syscalls/cacheflush/Makefile19
-rw-r--r--testcases/kernel/syscalls/cacheflush/cacheflush01.c173
-rw-r--r--testcases/kernel/syscalls/capget/Makefile19
-rw-r--r--testcases/kernel/syscalls/capget/capget01.c17
-rw-r--r--testcases/kernel/syscalls/capget/capget02.c26
-rw-r--r--testcases/kernel/syscalls/capset/Makefile19
-rw-r--r--testcases/kernel/syscalls/capset/capset01.c21
-rw-r--r--testcases/kernel/syscalls/capset/capset02.c28
-rw-r--r--testcases/kernel/syscalls/capset/capset03.c10
-rw-r--r--testcases/kernel/syscalls/capset/capset04.c13
-rw-r--r--testcases/kernel/syscalls/chdir/.gitignore2
-rw-r--r--testcases/kernel/syscalls/chdir/Makefile19
-rw-r--r--testcases/kernel/syscalls/chdir/chdir01.c274
-rw-r--r--testcases/kernel/syscalls/chdir/chdir02.c163
-rw-r--r--testcases/kernel/syscalls/chdir/chdir03.c68
-rw-r--r--testcases/kernel/syscalls/chdir/chdir04.c174
-rw-r--r--testcases/kernel/syscalls/chmod/Makefile19
-rw-r--r--testcases/kernel/syscalls/chmod/chmod01.c2
-rw-r--r--testcases/kernel/syscalls/chown/Makefile19
-rw-r--r--testcases/kernel/syscalls/chown/chown01.c181
-rw-r--r--testcases/kernel/syscalls/chown/chown02.c296
-rw-r--r--testcases/kernel/syscalls/chown/chown03.c237
-rw-r--r--testcases/kernel/syscalls/chown/chown05.c194
-rw-r--r--testcases/kernel/syscalls/chroot/Makefile19
-rw-r--r--testcases/kernel/syscalls/clock_adjtime/Makefile2
-rw-r--r--testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h264
-rw-r--r--testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c126
-rw-r--r--testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c95
-rw-r--r--testcases/kernel/syscalls/clock_getres/Makefile19
-rw-r--r--testcases/kernel/syscalls/clock_getres/clock_getres01.c51
-rw-r--r--testcases/kernel/syscalls/clock_gettime/.gitignore2
-rw-r--r--testcases/kernel/syscalls/clock_gettime/Makefile5
-rw-r--r--testcases/kernel/syscalls/clock_gettime/clock_gettime01.c108
-rw-r--r--testcases/kernel/syscalls/clock_gettime/clock_gettime02.c72
-rw-r--r--testcases/kernel/syscalls/clock_gettime/clock_gettime03.c138
-rw-r--r--testcases/kernel/syscalls/clock_gettime/clock_gettime04.c186
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep/.gitignore2
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep/Makefile19
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c152
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c19
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c111
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c66
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep2/.gitignore1
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep2/Makefile25
-rw-r--r--testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c45
-rw-r--r--testcases/kernel/syscalls/clock_settime/.gitignore1
-rw-r--r--testcases/kernel/syscalls/clock_settime/clock_settime01.c69
-rw-r--r--testcases/kernel/syscalls/clock_settime/clock_settime02.c92
-rw-r--r--testcases/kernel/syscalls/clock_settime/clock_settime03.c112
-rw-r--r--testcases/kernel/syscalls/clone/Makefile19
-rw-r--r--testcases/kernel/syscalls/clone/clone08.c3
-rw-r--r--testcases/kernel/syscalls/clone3/.gitignore2
-rw-r--r--testcases/kernel/syscalls/clone3/Makefile7
-rw-r--r--testcases/kernel/syscalls/clone3/clone301.c185
-rw-r--r--testcases/kernel/syscalls/clone3/clone302.c113
-rw-r--r--testcases/kernel/syscalls/close/.gitignore1
-rw-r--r--testcases/kernel/syscalls/close/Makefile19
-rw-r--r--testcases/kernel/syscalls/close/close01.c137
-rw-r--r--testcases/kernel/syscalls/close/close02.c120
-rw-r--r--testcases/kernel/syscalls/close/close08.c177
-rw-r--r--testcases/kernel/syscalls/close_range/.gitignore2
-rw-r--r--testcases/kernel/syscalls/close_range/Makefile10
-rw-r--r--testcases/kernel/syscalls/close_range/close_range01.c209
-rw-r--r--testcases/kernel/syscalls/close_range/close_range02.c114
-rw-r--r--testcases/kernel/syscalls/cma/Makefile17
-rw-r--r--testcases/kernel/syscalls/cma/process_vm_readv02.c2
-rw-r--r--testcases/kernel/syscalls/cma/process_vm_readv03.c6
-rw-r--r--testcases/kernel/syscalls/cma/process_vm_writev02.c2
-rw-r--r--testcases/kernel/syscalls/confstr/Makefile19
-rw-r--r--testcases/kernel/syscalls/connect/.gitignore1
-rw-r--r--testcases/kernel/syscalls/connect/Makefile19
-rw-r--r--testcases/kernel/syscalls/connect/connect02.c139
-rw-r--r--testcases/kernel/syscalls/copy_file_range/Makefile13
-rw-r--r--testcases/kernel/syscalls/copy_file_range/copy_file_range02.c8
-rw-r--r--testcases/kernel/syscalls/creat/Makefile19
-rw-r--r--testcases/kernel/syscalls/delete_module/.gitignore11
-rw-r--r--testcases/kernel/syscalls/delete_module/delete_module01.c6
-rw-r--r--testcases/kernel/syscalls/delete_module/delete_module03.c12
-rw-r--r--testcases/kernel/syscalls/dup/Makefile19
-rw-r--r--testcases/kernel/syscalls/dup/dup01.c197
-rw-r--r--testcases/kernel/syscalls/dup/dup02.c201
-rw-r--r--testcases/kernel/syscalls/dup/dup03.c229
-rw-r--r--testcases/kernel/syscalls/dup/dup04.c2
-rw-r--r--testcases/kernel/syscalls/dup2/Makefile19
-rw-r--r--testcases/kernel/syscalls/dup2/dup202.c2
-rw-r--r--testcases/kernel/syscalls/dup2/dup204.c2
-rw-r--r--testcases/kernel/syscalls/dup3/Makefile19
-rw-r--r--testcases/kernel/syscalls/epoll/Makefile19
-rw-r--r--testcases/kernel/syscalls/epoll/epoll-ltp.c13
-rw-r--r--testcases/kernel/syscalls/epoll2/examples/Makefile52
-rw-r--r--testcases/kernel/syscalls/epoll2/examples/epoll-test.c996
-rw-r--r--testcases/kernel/syscalls/epoll2/include/dbllist.h98
-rw-r--r--testcases/kernel/syscalls/epoll2/include/epoll.h123
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll.4373
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll.ps604
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll.txt225
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_create.271
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_create.ps270
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_create.txt40
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_ctl.2192
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_ctl.ps362
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_ctl.txt108
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_wait.2124
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_wait.ps314
-rw-r--r--testcases/kernel/syscalls/epoll2/man/epoll_wait.txt68
-rwxr-xr-xtestcases/kernel/syscalls/epoll2/man/mkpages.sh11
-rw-r--r--testcases/kernel/syscalls/epoll2/src/epoll.c28
-rw-r--r--testcases/kernel/syscalls/epoll_create1/Makefile19
-rw-r--r--testcases/kernel/syscalls/epoll_ctl/Makefile17
-rw-r--r--testcases/kernel/syscalls/epoll_pwait/Makefile16
-rw-r--r--testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c11
-rw-r--r--testcases/kernel/syscalls/epoll_wait/Makefile16
-rw-r--r--testcases/kernel/syscalls/epoll_wait/epoll_wait02.c14
-rw-r--r--testcases/kernel/syscalls/eventfd/Makefile19
-rw-r--r--testcases/kernel/syscalls/eventfd/eventfd01.c5
-rw-r--r--testcases/kernel/syscalls/eventfd2/Makefile19
-rw-r--r--testcases/kernel/syscalls/execl/Makefile16
-rw-r--r--testcases/kernel/syscalls/execl/execl01.c2
-rw-r--r--testcases/kernel/syscalls/execle/Makefile19
-rw-r--r--testcases/kernel/syscalls/execle/execle01.c2
-rw-r--r--testcases/kernel/syscalls/execlp/Makefile19
-rw-r--r--testcases/kernel/syscalls/execlp/execlp01.c2
-rw-r--r--testcases/kernel/syscalls/execv/Makefile16
-rw-r--r--testcases/kernel/syscalls/execv/execv01.c2
-rw-r--r--testcases/kernel/syscalls/execve/Makefile19
-rw-r--r--testcases/kernel/syscalls/execve/execve02.c4
-rw-r--r--testcases/kernel/syscalls/execve/execve05.c11
-rw-r--r--testcases/kernel/syscalls/execveat/Makefile17
-rw-r--r--testcases/kernel/syscalls/execveat/execveat01.c2
-rw-r--r--testcases/kernel/syscalls/execveat/execveat03.c2
-rw-r--r--testcases/kernel/syscalls/execvp/Makefile20
-rw-r--r--testcases/kernel/syscalls/exit/Makefile19
-rw-r--r--testcases/kernel/syscalls/exit_group/Makefile19
-rw-r--r--testcases/kernel/syscalls/faccessat/Makefile19
-rw-r--r--testcases/kernel/syscalls/fadvise/Makefile17
-rw-r--r--testcases/kernel/syscalls/fallocate/.gitignore1
-rw-r--r--testcases/kernel/syscalls/fallocate/Makefile19
-rw-r--r--testcases/kernel/syscalls/fallocate/fallocate01.c4
-rw-r--r--testcases/kernel/syscalls/fallocate/fallocate04.c10
-rw-r--r--testcases/kernel/syscalls/fallocate/fallocate05.c14
-rw-r--r--testcases/kernel/syscalls/fallocate/fallocate06.c274
-rw-r--r--testcases/kernel/syscalls/fanotify/.gitignore4
-rw-r--r--testcases/kernel/syscalls/fanotify/Makefile17
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify.h251
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify01.c94
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify02.c37
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify03.c92
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify04.c46
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify05.c175
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify06.c41
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify07.c51
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify08.c15
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify09.c262
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify10.c272
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify11.c49
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify12.c79
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify13.c119
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify14.c31
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify15.c224
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify16.c577
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify17.c267
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify18.c200
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify19.c255
-rw-r--r--testcases/kernel/syscalls/fchdir/Makefile19
-rw-r--r--testcases/kernel/syscalls/fchmod/Makefile19
-rw-r--r--testcases/kernel/syscalls/fchmodat/Makefile19
-rw-r--r--testcases/kernel/syscalls/fchown/Makefile19
-rw-r--r--testcases/kernel/syscalls/fchownat/Makefile19
-rw-r--r--testcases/kernel/syscalls/fcntl/.gitignore4
-rw-r--r--testcases/kernel/syscalls/fcntl/Makefile19
-rw-r--r--testcases/kernel/syscalls/fcntl/fcntl01.c5
-rw-r--r--testcases/kernel/syscalls/fcntl/fcntl31.c9
-rw-r--r--testcases/kernel/syscalls/fcntl/fcntl33.c19
-rw-r--r--testcases/kernel/syscalls/fcntl/fcntl37.c98
-rw-r--r--testcases/kernel/syscalls/fcntl/fcntl38.c96
-rw-r--r--testcases/kernel/syscalls/fcntl/fcntl_common.h5
-rw-r--r--testcases/kernel/syscalls/fdatasync/Makefile19
-rw-r--r--testcases/kernel/syscalls/fdatasync/fdatasync03.c4
-rw-r--r--testcases/kernel/syscalls/fgetxattr/Makefile2
-rw-r--r--testcases/kernel/syscalls/fgetxattr/fgetxattr02.c7
-rw-r--r--testcases/kernel/syscalls/finit_module/.gitignore3
-rw-r--r--testcases/kernel/syscalls/finit_module/Makefile21
-rw-r--r--testcases/kernel/syscalls/finit_module/finit_module.c37
-rw-r--r--testcases/kernel/syscalls/finit_module/finit_module01.c54
-rw-r--r--testcases/kernel/syscalls/finit_module/finit_module02.c136
-rw-r--r--testcases/kernel/syscalls/flistxattr/Makefile16
-rw-r--r--testcases/kernel/syscalls/flock/Makefile19
-rw-r--r--testcases/kernel/syscalls/flock/flock04.c2
-rw-r--r--testcases/kernel/syscalls/fmtmsg/Makefile19
-rw-r--r--testcases/kernel/syscalls/fork/Makefile19
-rw-r--r--testcases/kernel/syscalls/fork/fork04.c4
-rw-r--r--testcases/kernel/syscalls/fork/fork12.c6
-rw-r--r--testcases/kernel/syscalls/fork/fork14.c5
-rw-r--r--testcases/kernel/syscalls/fpathconf/Makefile19
-rw-r--r--testcases/kernel/syscalls/fremovexattr/Makefile2
-rw-r--r--testcases/kernel/syscalls/fsconfig/.gitignore2
-rw-r--r--testcases/kernel/syscalls/fsconfig/Makefile6
-rw-r--r--testcases/kernel/syscalls/fsconfig/fsconfig01.c93
-rw-r--r--testcases/kernel/syscalls/fsconfig/fsconfig02.c97
-rw-r--r--testcases/kernel/syscalls/fsetxattr/Makefile2
-rw-r--r--testcases/kernel/syscalls/fsetxattr/fsetxattr02.c10
-rw-r--r--testcases/kernel/syscalls/fsmount/.gitignore2
-rw-r--r--testcases/kernel/syscalls/fsmount/Makefile8
-rw-r--r--testcases/kernel/syscalls/fsmount/fsmount01.c99
-rw-r--r--testcases/kernel/syscalls/fsmount/fsmount02.c80
-rw-r--r--testcases/kernel/syscalls/fsopen/.gitignore2
-rw-r--r--testcases/kernel/syscalls/fsopen/Makefile6
-rw-r--r--testcases/kernel/syscalls/fsopen/fsopen01.c80
-rw-r--r--testcases/kernel/syscalls/fsopen/fsopen02.c58
-rw-r--r--testcases/kernel/syscalls/fspick/.gitignore2
-rw-r--r--testcases/kernel/syscalls/fspick/Makefile6
-rw-r--r--testcases/kernel/syscalls/fspick/fspick01.c67
-rw-r--r--testcases/kernel/syscalls/fspick/fspick02.c54
-rw-r--r--testcases/kernel/syscalls/fstat/Makefile19
-rw-r--r--testcases/kernel/syscalls/fstat/fstat02.c2
-rw-r--r--testcases/kernel/syscalls/fstat/fstat03.c2
-rw-r--r--testcases/kernel/syscalls/fstatat/Makefile19
-rw-r--r--testcases/kernel/syscalls/fstatfs/Makefile19
-rw-r--r--testcases/kernel/syscalls/fsync/Makefile19
-rw-r--r--testcases/kernel/syscalls/fsync/fsync02.c238
-rw-r--r--testcases/kernel/syscalls/fsync/fsync04.c4
-rw-r--r--testcases/kernel/syscalls/ftruncate/Makefile19
-rw-r--r--testcases/kernel/syscalls/futex/.gitignore1
-rw-r--r--testcases/kernel/syscalls/futex/Makefile18
-rw-r--r--testcases/kernel/syscalls/futex/futex_cmp_requeue01.c32
-rw-r--r--testcases/kernel/syscalls/futex/futex_cmp_requeue02.c21
-rw-r--r--testcases/kernel/syscalls/futex/futex_utils.h23
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait01.c73
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait02.c107
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait03.c98
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait04.c73
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait05.c29
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait_bitset.h75
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait_bitset01.c97
-rw-r--r--testcases/kernel/syscalls/futex/futex_wait_bitset02.c18
-rw-r--r--testcases/kernel/syscalls/futex/futex_wake01.c65
-rw-r--r--testcases/kernel/syscalls/futex/futex_wake02.c117
-rw-r--r--testcases/kernel/syscalls/futex/futex_wake03.c118
-rw-r--r--testcases/kernel/syscalls/futex/futex_wake04.c172
-rw-r--r--testcases/kernel/syscalls/futex/futextest.h160
-rw-r--r--testcases/kernel/syscalls/futimesat/Makefile19
-rw-r--r--testcases/kernel/syscalls/get_mempolicy/.gitignore1
-rw-r--r--testcases/kernel/syscalls/get_mempolicy/Makefile26
-rw-r--r--testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c451
-rw-r--r--testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c91
-rw-r--r--testcases/kernel/syscalls/get_robust_list/Makefile19
-rw-r--r--testcases/kernel/syscalls/getcontext/Makefile19
-rw-r--r--testcases/kernel/syscalls/getcpu/Makefile19
-rw-r--r--testcases/kernel/syscalls/getcwd/Makefile19
-rw-r--r--testcases/kernel/syscalls/getcwd/getcwd04.c6
-rw-r--r--testcases/kernel/syscalls/getdents/Makefile19
-rw-r--r--testcases/kernel/syscalls/getdents/getdents.h136
-rw-r--r--testcases/kernel/syscalls/getdents/getdents01.c222
-rw-r--r--testcases/kernel/syscalls/getdents/getdents02.c220
-rw-r--r--testcases/kernel/syscalls/getdomainname/Makefile19
-rw-r--r--testcases/kernel/syscalls/getdtablesize/Makefile19
-rw-r--r--testcases/kernel/syscalls/getegid/Makefile19
-rw-r--r--testcases/kernel/syscalls/geteuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getgid/getgid01.c97
-rw-r--r--testcases/kernel/syscalls/getgid/getgid03.c91
-rw-r--r--testcases/kernel/syscalls/getgroups/Makefile19
-rw-r--r--testcases/kernel/syscalls/gethostbyname_r/Makefile13
-rw-r--r--testcases/kernel/syscalls/gethostid/Makefile19
-rw-r--r--testcases/kernel/syscalls/gethostname/Makefile19
-rw-r--r--testcases/kernel/syscalls/getitimer/Makefile19
-rw-r--r--testcases/kernel/syscalls/getpagesize/Makefile19
-rw-r--r--testcases/kernel/syscalls/getpeername/Makefile19
-rw-r--r--testcases/kernel/syscalls/getpgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getpgid/getpgid01.c74
-rw-r--r--testcases/kernel/syscalls/getpgrp/Makefile19
-rw-r--r--testcases/kernel/syscalls/getpid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getpid/getpid01.c181
-rw-r--r--testcases/kernel/syscalls/getpid/getpid02.c154
-rw-r--r--testcases/kernel/syscalls/getppid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getppid/getppid01.c166
-rw-r--r--testcases/kernel/syscalls/getppid/getppid02.c120
-rw-r--r--testcases/kernel/syscalls/getpriority/Makefile19
-rw-r--r--testcases/kernel/syscalls/getrandom/Makefile17
-rw-r--r--testcases/kernel/syscalls/getrandom/getrandom02.c12
-rw-r--r--testcases/kernel/syscalls/getresgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getresuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getrlimit/Makefile19
-rw-r--r--testcases/kernel/syscalls/getrusage/Makefile19
-rw-r--r--testcases/kernel/syscalls/getrusage/getrusage04.c4
-rw-r--r--testcases/kernel/syscalls/getsid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getsockname/Makefile19
-rw-r--r--testcases/kernel/syscalls/getsockopt/Makefile19
-rw-r--r--testcases/kernel/syscalls/gettid/Makefile17
-rw-r--r--testcases/kernel/syscalls/gettimeofday/Makefile19
-rw-r--r--testcases/kernel/syscalls/gettimeofday/gettimeofday01.c6
-rw-r--r--testcases/kernel/syscalls/gettimeofday/gettimeofday02.c30
-rw-r--r--testcases/kernel/syscalls/getuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/getxattr/Makefile17
-rw-r--r--testcases/kernel/syscalls/getxattr/getxattr01.c6
-rw-r--r--testcases/kernel/syscalls/init_module/.gitignore11
-rw-r--r--testcases/kernel/syscalls/init_module/Makefile21
-rw-r--r--testcases/kernel/syscalls/init_module/init_module.c37
-rw-r--r--testcases/kernel/syscalls/init_module/init_module01.c56
-rw-r--r--testcases/kernel/syscalls/init_module/init_module02.c98
-rw-r--r--testcases/kernel/syscalls/inotify/.gitignore1
-rw-r--r--testcases/kernel/syscalls/inotify/Makefile17
-rw-r--r--testcases/kernel/syscalls/inotify/inotify01.c10
-rw-r--r--testcases/kernel/syscalls/inotify/inotify06.c25
-rw-r--r--testcases/kernel/syscalls/inotify/inotify09.c4
-rw-r--r--testcases/kernel/syscalls/inotify/inotify10.c219
-rw-r--r--testcases/kernel/syscalls/inotify_init/Makefile19
-rw-r--r--testcases/kernel/syscalls/io_cancel/Makefile19
-rw-r--r--testcases/kernel/syscalls/io_cancel/io_cancel01.c123
-rw-r--r--testcases/kernel/syscalls/io_destroy/Makefile19
-rw-r--r--testcases/kernel/syscalls/io_destroy/io_destroy01.c18
-rw-r--r--testcases/kernel/syscalls/io_getevents/Makefile19
-rw-r--r--testcases/kernel/syscalls/io_getevents/io_getevents01.c120
-rw-r--r--testcases/kernel/syscalls/io_pgetevents/.gitignore2
-rw-r--r--testcases/kernel/syscalls/io_pgetevents/Makefile9
-rw-r--r--testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c87
-rw-r--r--testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c133
-rw-r--r--testcases/kernel/syscalls/io_setup/Makefile19
-rw-r--r--testcases/kernel/syscalls/io_setup/io_setup01.c2
-rw-r--r--testcases/kernel/syscalls/io_submit/Makefile19
-rw-r--r--testcases/kernel/syscalls/io_submit/io_submit01.c10
-rw-r--r--testcases/kernel/syscalls/io_uring/.gitignore2
-rw-r--r--testcases/kernel/syscalls/io_uring/Makefile7
-rw-r--r--testcases/kernel/syscalls/io_uring/io_uring01.c268
-rw-r--r--testcases/kernel/syscalls/io_uring/io_uring02.c267
-rw-r--r--testcases/kernel/syscalls/ioctl/.gitignore9
-rw-r--r--testcases/kernel/syscalls/ioctl/Makefile19
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl01.c14
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl02.c7
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl04.c4
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl07.c9
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl08.c9
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl09.c121
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop01.c155
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop02.c164
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop03.c75
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop04.c98
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop05.c157
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop06.c143
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_loop07.c165
-rw-r--r--testcases/kernel/syscalls/ioctl/ioctl_sg01.c134
-rw-r--r--testcases/kernel/syscalls/ioperm/Makefile19
-rw-r--r--testcases/kernel/syscalls/ioperm/ioperm01.c185
-rw-r--r--testcases/kernel/syscalls/ioperm/ioperm02.c277
-rw-r--r--testcases/kernel/syscalls/iopl/Makefile19
-rw-r--r--testcases/kernel/syscalls/iopl/iopl01.c176
-rw-r--r--testcases/kernel/syscalls/iopl/iopl02.c250
-rw-r--r--testcases/kernel/syscalls/ipc/Makefile41
-rw-r--r--testcases/kernel/syscalls/ipc/Makefile.inc42
-rw-r--r--testcases/kernel/syscalls/ipc/Makefile2.inc36
-rw-r--r--testcases/kernel/syscalls/ipc/lib/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/lib/ipcmsg.h (renamed from include/ipcmsg.h)0
-rw-r--r--testcases/kernel/syscalls/ipc/lib/ipcsem.h (renamed from include/ipcsem.h)2
-rw-r--r--testcases/kernel/syscalls/ipc/lib/ipcshm.h (renamed from include/ipcshm.h)0
-rw-r--r--testcases/kernel/syscalls/ipc/lib/libipc.c (renamed from libs/libltpipc/libipc.c)0
-rw-r--r--testcases/kernel/syscalls/ipc/lib/libmsgctl.c (renamed from libs/libltpipc/libmsgctl.c)0
-rw-r--r--testcases/kernel/syscalls/ipc/lib/libmsgctl.h (renamed from include/libmsgctl.h)0
-rw-r--r--testcases/kernel/syscalls/ipc/libnewipc/Makefile24
-rw-r--r--testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c (renamed from libs/libltpnewipc/libnewipc.c)39
-rw-r--r--testcases/kernel/syscalls/ipc/libnewipc/libnewipc.h (renamed from include/libnewipc.h)5
-rw-r--r--testcases/kernel/syscalls/ipc/msgctl/.gitignore2
-rw-r--r--testcases/kernel/syscalls/ipc/msgctl/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/msgctl/msgctl05.c48
-rw-r--r--testcases/kernel/syscalls/ipc/msgctl/msgctl06.c171
-rw-r--r--testcases/kernel/syscalls/ipc/msgget/.gitignore2
-rw-r--r--testcases/kernel/syscalls/ipc/msgget/Makefile22
-rw-r--r--testcases/kernel/syscalls/ipc/msgget/msgget04.c63
-rw-r--r--testcases/kernel/syscalls/ipc/msgget/msgget05.c71
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/.gitignore1
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c254
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c269
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c226
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c181
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c236
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c249
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv07.c345
-rw-r--r--testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c122
-rw-r--r--testcases/kernel/syscalls/ipc/msgsnd/Makefile22
-rw-r--r--testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c22
-rw-r--r--testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c2
-rw-r--r--testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c2
-rw-r--r--testcases/kernel/syscalls/ipc/msgstress/Makefile27
-rw-r--r--testcases/kernel/syscalls/ipc/msgstress/msgstress01.c2
-rw-r--r--testcases/kernel/syscalls/ipc/msgstress/msgstress02.c2
-rw-r--r--testcases/kernel/syscalls/ipc/msgstress/msgstress03.c2
-rw-r--r--testcases/kernel/syscalls/ipc/msgstress/msgstress04.c2
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/.gitignore2
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/Makefile26
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl01.c554
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl02.c162
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl03.c189
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl04.c219
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl05.c180
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl07.c247
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl08.c52
-rw-r--r--testcases/kernel/syscalls/ipc/semctl/semctl09.c229
-rw-r--r--testcases/kernel/syscalls/ipc/semget/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/semget/semget01.c4
-rw-r--r--testcases/kernel/syscalls/ipc/semget/semget02.c4
-rw-r--r--testcases/kernel/syscalls/ipc/semget/semget03.c4
-rw-r--r--testcases/kernel/syscalls/ipc/semget/semget05.c2
-rw-r--r--testcases/kernel/syscalls/ipc/semget/semget06.c4
-rw-r--r--testcases/kernel/syscalls/ipc/semop/.gitignore2
-rw-r--r--testcases/kernel/syscalls/ipc/semop/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/semop/semop.h51
-rw-r--r--testcases/kernel/syscalls/ipc/semop/semop01.c192
-rw-r--r--testcases/kernel/syscalls/ipc/semop/semop02.c262
-rw-r--r--testcases/kernel/syscalls/ipc/semop/semop03.c248
-rw-r--r--testcases/kernel/syscalls/ipc/semop/semop04.c177
-rw-r--r--testcases/kernel/syscalls/ipc/semop/semop05.c284
-rw-r--r--testcases/kernel/syscalls/ipc/shmat/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/.gitignore3
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl01.c589
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl02.c265
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl03.c217
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl04.c233
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl05.c20
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl06.c55
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl07.c71
-rw-r--r--testcases/kernel/syscalls/ipc/shmctl/shmctl08.c106
-rw-r--r--testcases/kernel/syscalls/ipc/shmdt/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/shmdt/shmdt01.c2
-rw-r--r--testcases/kernel/syscalls/ipc/shmget/Makefile25
-rw-r--r--testcases/kernel/syscalls/ipc/shmget/shmget01.c2
-rw-r--r--testcases/kernel/syscalls/ipc/shmget/shmget02.c2
-rw-r--r--testcases/kernel/syscalls/ipc/shmget/shmget03.c2
-rw-r--r--testcases/kernel/syscalls/ipc/shmget/shmget04.c2
-rw-r--r--testcases/kernel/syscalls/ipc/shmget/shmget05.c2
-rw-r--r--testcases/kernel/syscalls/kcmp/Makefile18
-rw-r--r--testcases/kernel/syscalls/kcmp/kcmp01.c2
-rw-r--r--testcases/kernel/syscalls/kcmp/kcmp02.c4
-rw-r--r--testcases/kernel/syscalls/keyctl/Makefile19
-rw-r--r--testcases/kernel/syscalls/keyctl/keyctl05.c30
-rw-r--r--testcases/kernel/syscalls/kill/.gitignore2
-rw-r--r--testcases/kernel/syscalls/kill/Makefile40
-rw-r--r--testcases/kernel/syscalls/kill/kill01.c161
-rw-r--r--testcases/kernel/syscalls/kill/kill02.c2
-rw-r--r--testcases/kernel/syscalls/kill/kill03.c189
-rw-r--r--testcases/kernel/syscalls/kill/kill04.c133
-rw-r--r--testcases/kernel/syscalls/kill/kill05.c243
-rw-r--r--testcases/kernel/syscalls/kill/kill06.c198
-rw-r--r--testcases/kernel/syscalls/kill/kill07.c2
-rw-r--r--testcases/kernel/syscalls/kill/kill11.c179
-rw-r--r--testcases/kernel/syscalls/lchown/Makefile21
-rw-r--r--testcases/kernel/syscalls/lchown/lchown01.c4
-rw-r--r--testcases/kernel/syscalls/lgetxattr/Makefile16
-rw-r--r--testcases/kernel/syscalls/link/Makefile19
-rw-r--r--testcases/kernel/syscalls/linkat/Makefile19
-rw-r--r--testcases/kernel/syscalls/listen/Makefile19
-rw-r--r--testcases/kernel/syscalls/listxattr/Makefile16
-rw-r--r--testcases/kernel/syscalls/llistxattr/Makefile16
-rw-r--r--testcases/kernel/syscalls/llseek/Makefile19
-rw-r--r--testcases/kernel/syscalls/lremovexattr/lremovexattr01.c2
-rw-r--r--testcases/kernel/syscalls/lseek/Makefile19
-rw-r--r--testcases/kernel/syscalls/lstat/Makefile19
-rw-r--r--testcases/kernel/syscalls/madvise/Makefile19
-rw-r--r--testcases/kernel/syscalls/madvise/madvise06.c182
-rw-r--r--testcases/kernel/syscalls/madvise/madvise08.c10
-rw-r--r--testcases/kernel/syscalls/madvise/madvise09.c6
-rw-r--r--testcases/kernel/syscalls/mallinfo/.gitignore2
-rw-r--r--testcases/kernel/syscalls/mallinfo/Makefile8
-rw-r--r--testcases/kernel/syscalls/mallinfo/mallinfo01.c80
-rw-r--r--testcases/kernel/syscalls/mallinfo/mallinfo02.c63
-rw-r--r--testcases/kernel/syscalls/mallinfo/mallinfo_common.h31
-rw-r--r--testcases/kernel/syscalls/mallopt/Makefile19
-rw-r--r--testcases/kernel/syscalls/mallopt/mallopt01.c143
-rw-r--r--testcases/kernel/syscalls/mbind/Makefile25
-rw-r--r--testcases/kernel/syscalls/mbind/mbind01.c4
-rw-r--r--testcases/kernel/syscalls/membarrier/Makefile2
-rw-r--r--testcases/kernel/syscalls/memcmp/Makefile19
-rw-r--r--testcases/kernel/syscalls/memcpy/Makefile19
-rw-r--r--testcases/kernel/syscalls/memfd_create/.gitignore2
-rw-r--r--testcases/kernel/syscalls/memfd_create/Makefile17
-rw-r--r--testcases/kernel/syscalls/memfd_create/memfd_create01.c5
-rw-r--r--testcases/kernel/syscalls/memfd_create/memfd_create03.c7
-rw-r--r--testcases/kernel/syscalls/memfd_create/memfd_create04.c5
-rw-r--r--testcases/kernel/syscalls/memmap/.gitignore1
-rw-r--r--testcases/kernel/syscalls/memmap/Makefile23
-rw-r--r--testcases/kernel/syscalls/memmap/mem03.c173
-rw-r--r--testcases/kernel/syscalls/memset/Makefile19
-rw-r--r--testcases/kernel/syscalls/migrate_pages/Makefile23
-rw-r--r--testcases/kernel/syscalls/migrate_pages/migrate_pages02.c16
-rw-r--r--testcases/kernel/syscalls/mincore/.gitignore2
-rw-r--r--testcases/kernel/syscalls/mincore/Makefile19
-rw-r--r--testcases/kernel/syscalls/mincore/mincore03.c83
-rw-r--r--testcases/kernel/syscalls/mincore/mincore04.c112
-rw-r--r--testcases/kernel/syscalls/mkdir/Makefile19
-rw-r--r--testcases/kernel/syscalls/mkdirat/Makefile19
-rw-r--r--testcases/kernel/syscalls/mknod/Makefile19
-rw-r--r--testcases/kernel/syscalls/mknodat/Makefile19
-rw-r--r--testcases/kernel/syscalls/mlock/Makefile19
-rw-r--r--testcases/kernel/syscalls/mlockall/Makefile19
-rw-r--r--testcases/kernel/syscalls/mlockall/mlockall03.c8
-rw-r--r--testcases/kernel/syscalls/mmap/.gitignore3
-rw-r--r--testcases/kernel/syscalls/mmap/Makefile19
-rw-r--r--testcases/kernel/syscalls/mmap/mmap001.c3
-rw-r--r--testcases/kernel/syscalls/mmap/mmap01.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap02.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap03.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap04.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap05.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap06.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap07.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap08.c2
-rw-r--r--testcases/kernel/syscalls/mmap/mmap10.c4
-rw-r--r--testcases/kernel/syscalls/mmap/mmap17.c85
-rw-r--r--testcases/kernel/syscalls/mmap/mmap18.c215
-rw-r--r--testcases/kernel/syscalls/mmap/mmap19.c99
-rw-r--r--testcases/kernel/syscalls/modify_ldt/Makefile19
-rw-r--r--testcases/kernel/syscalls/modify_ldt/modify_ldt01.c61
-rw-r--r--testcases/kernel/syscalls/modify_ldt/modify_ldt02.c64
-rw-r--r--testcases/kernel/syscalls/mount/Makefile16
-rw-r--r--testcases/kernel/syscalls/mount/mount03.c2
-rw-r--r--testcases/kernel/syscalls/move_mount/.gitignore2
-rw-r--r--testcases/kernel/syscalls/move_mount/Makefile6
-rw-r--r--testcases/kernel/syscalls/move_mount/move_mount01.c83
-rw-r--r--testcases/kernel/syscalls/move_mount/move_mount02.c92
-rw-r--r--testcases/kernel/syscalls/move_pages/Makefile23
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages01.c2
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages02.c2
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages03.c2
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages04.c2
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages05.c2
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages12.c50
-rw-r--r--testcases/kernel/syscalls/move_pages/move_pages_support.c6
-rw-r--r--testcases/kernel/syscalls/mprotect/Makefile19
-rw-r--r--testcases/kernel/syscalls/mprotect/mprotect04.c2
-rw-r--r--testcases/kernel/syscalls/mq_notify/Makefile19
-rw-r--r--testcases/kernel/syscalls/mq_notify/mq_notify01.c10
-rw-r--r--testcases/kernel/syscalls/mq_notify/mq_notify02.c2
-rw-r--r--testcases/kernel/syscalls/mq_open/Makefile19
-rw-r--r--testcases/kernel/syscalls/mq_timedreceive/Makefile19
-rw-r--r--testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c87
-rw-r--r--testcases/kernel/syscalls/mq_timedsend/Makefile19
-rw-r--r--testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c103
-rw-r--r--testcases/kernel/syscalls/mq_unlink/Makefile19
-rw-r--r--testcases/kernel/syscalls/mq_unlink/mq_unlink01.c2
-rw-r--r--testcases/kernel/syscalls/mremap/Makefile39
-rw-r--r--testcases/kernel/syscalls/msync/Makefile19
-rw-r--r--testcases/kernel/syscalls/msync/msync01.c7
-rw-r--r--testcases/kernel/syscalls/msync/msync02.c7
-rw-r--r--testcases/kernel/syscalls/msync/msync04.c7
-rw-r--r--testcases/kernel/syscalls/munlock/Makefile19
-rw-r--r--testcases/kernel/syscalls/munlockall/Makefile19
-rw-r--r--testcases/kernel/syscalls/munmap/Makefile19
-rw-r--r--testcases/kernel/syscalls/name_to_handle_at/.gitignore2
-rw-r--r--testcases/kernel/syscalls/name_to_handle_at/Makefile7
-rw-r--r--testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c116
-rw-r--r--testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c84
-rw-r--r--testcases/kernel/syscalls/nanosleep/Makefile19
-rw-r--r--testcases/kernel/syscalls/nanosleep/nanosleep01.c4
-rw-r--r--testcases/kernel/syscalls/newuname/Makefile19
-rw-r--r--testcases/kernel/syscalls/nftw/Makefile16
-rw-r--r--testcases/kernel/syscalls/nice/Makefile19
-rw-r--r--testcases/kernel/syscalls/nice/nice01.c2
-rw-r--r--testcases/kernel/syscalls/nice/nice02.c2
-rw-r--r--testcases/kernel/syscalls/open/Makefile19
-rw-r--r--testcases/kernel/syscalls/open/open01.c14
-rw-r--r--testcases/kernel/syscalls/open/open02.c25
-rw-r--r--testcases/kernel/syscalls/open/open05.c3
-rw-r--r--testcases/kernel/syscalls/open/open11.c22
-rw-r--r--testcases/kernel/syscalls/open_by_handle_at/.gitignore2
-rw-r--r--testcases/kernel/syscalls/open_by_handle_at/Makefile7
-rw-r--r--testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c115
-rw-r--r--testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c108
-rw-r--r--testcases/kernel/syscalls/open_tree/.gitignore2
-rw-r--r--testcases/kernel/syscalls/open_tree/Makefile6
-rw-r--r--testcases/kernel/syscalls/open_tree/open_tree01.c74
-rw-r--r--testcases/kernel/syscalls/open_tree/open_tree02.c55
-rw-r--r--testcases/kernel/syscalls/openat/Makefile19
-rw-r--r--testcases/kernel/syscalls/openat2/.gitignore3
-rw-r--r--testcases/kernel/syscalls/openat2/Makefile7
-rw-r--r--testcases/kernel/syscalls/openat2/openat201.c98
-rw-r--r--testcases/kernel/syscalls/openat2/openat202.c87
-rw-r--r--testcases/kernel/syscalls/openat2/openat203.c80
-rw-r--r--testcases/kernel/syscalls/paging/Makefile19
-rw-r--r--testcases/kernel/syscalls/pathconf/Makefile19
-rw-r--r--testcases/kernel/syscalls/pause/Makefile19
-rw-r--r--testcases/kernel/syscalls/pause/pause01.c2
-rw-r--r--testcases/kernel/syscalls/perf_event_open/Makefile15
-rw-r--r--testcases/kernel/syscalls/perf_event_open/perf_event_open01.c6
-rw-r--r--testcases/kernel/syscalls/perf_event_open/perf_event_open02.c9
-rw-r--r--testcases/kernel/syscalls/personality/Makefile19
-rw-r--r--testcases/kernel/syscalls/pidfd_open/.gitignore3
-rw-r--r--testcases/kernel/syscalls/pidfd_open/Makefile6
-rw-r--r--testcases/kernel/syscalls/pidfd_open/pidfd_open01.c41
-rw-r--r--testcases/kernel/syscalls/pidfd_open/pidfd_open02.c58
-rw-r--r--testcases/kernel/syscalls/pidfd_open/pidfd_open03.c57
-rw-r--r--testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal.h (renamed from include/lapi/pidfd_send_signal.h)7
-rw-r--r--testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c6
-rw-r--r--testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c4
-rw-r--r--testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c4
-rw-r--r--testcases/kernel/syscalls/pipe/.gitignore2
-rw-r--r--testcases/kernel/syscalls/pipe/Makefile19
-rw-r--r--testcases/kernel/syscalls/pipe/pipe02.c2
-rw-r--r--testcases/kernel/syscalls/pipe/pipe12.c113
-rw-r--r--testcases/kernel/syscalls/pipe/pipe13.c103
-rw-r--r--testcases/kernel/syscalls/pipe2/.gitignore2
-rw-r--r--testcases/kernel/syscalls/pipe2/Makefile19
-rw-r--r--testcases/kernel/syscalls/pipe2/pipe2_01.c236
-rw-r--r--testcases/kernel/syscalls/pipe2/pipe2_02.c215
-rw-r--r--testcases/kernel/syscalls/pipe2/pipe2_02_child.c26
-rw-r--r--testcases/kernel/syscalls/pipe2/pipe2_04.c106
-rw-r--r--testcases/kernel/syscalls/pivot_root/pivot_root01.c4
-rw-r--r--testcases/kernel/syscalls/pkeys/pkey01.c29
-rw-r--r--testcases/kernel/syscalls/poll/Makefile19
-rw-r--r--testcases/kernel/syscalls/poll/poll02.c15
-rw-r--r--testcases/kernel/syscalls/ppoll/Makefile19
-rw-r--r--testcases/kernel/syscalls/ppoll/ppoll01.c67
-rw-r--r--testcases/kernel/syscalls/prctl/Makefile19
-rw-r--r--testcases/kernel/syscalls/prctl/prctl02.c11
-rw-r--r--testcases/kernel/syscalls/prctl/prctl05.c17
-rw-r--r--testcases/kernel/syscalls/prctl/prctl06.c23
-rw-r--r--testcases/kernel/syscalls/prctl/prctl06.h29
-rw-r--r--testcases/kernel/syscalls/prctl/prctl06_execve.c13
-rw-r--r--testcases/kernel/syscalls/prctl/prctl07.c48
-rw-r--r--testcases/kernel/syscalls/prctl/prctl08.c16
-rw-r--r--testcases/kernel/syscalls/prctl/prctl09.c2
-rw-r--r--testcases/kernel/syscalls/pread/Makefile19
-rw-r--r--testcases/kernel/syscalls/preadv/Makefile17
-rw-r--r--testcases/kernel/syscalls/preadv/preadv03.c4
-rw-r--r--testcases/kernel/syscalls/preadv2/preadv203.c2
-rw-r--r--testcases/kernel/syscalls/profil/Makefile19
-rw-r--r--testcases/kernel/syscalls/profil/profil01.c2
-rw-r--r--testcases/kernel/syscalls/pselect/Makefile19
-rw-r--r--testcases/kernel/syscalls/pselect/pselect01.c16
-rw-r--r--testcases/kernel/syscalls/ptrace/.gitignore4
-rw-r--r--testcases/kernel/syscalls/ptrace/Makefile19
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace01.c50
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace02.c307
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace03.c227
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace08.c176
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace09.c103
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace10.c86
-rw-r--r--testcases/kernel/syscalls/ptrace/ptrace11.c45
-rw-r--r--testcases/kernel/syscalls/pwrite/Makefile19
-rw-r--r--testcases/kernel/syscalls/pwritev/pwritev03.c4
-rw-r--r--testcases/kernel/syscalls/quotactl/.gitignore1
-rw-r--r--testcases/kernel/syscalls/quotactl/Makefile19
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl01.c40
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl02.c5
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl02.h4
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl03.c10
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl04.c56
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl05.c5
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl06.c53
-rw-r--r--testcases/kernel/syscalls/quotactl/quotactl07.c67
-rw-r--r--testcases/kernel/syscalls/read/Makefile19
-rw-r--r--testcases/kernel/syscalls/readahead/Makefile17
-rw-r--r--testcases/kernel/syscalls/readahead/readahead01.c2
-rw-r--r--testcases/kernel/syscalls/readahead/readahead02.c10
-rw-r--r--testcases/kernel/syscalls/readdir/Makefile19
-rw-r--r--testcases/kernel/syscalls/readlink/Makefile19
-rw-r--r--testcases/kernel/syscalls/readlinkat/Makefile19
-rw-r--r--testcases/kernel/syscalls/readv/Makefile19
-rw-r--r--testcases/kernel/syscalls/readv/readv01.c153
-rw-r--r--testcases/kernel/syscalls/reboot/Makefile19
-rw-r--r--testcases/kernel/syscalls/reboot/reboot01.c167
-rw-r--r--testcases/kernel/syscalls/reboot/reboot02.c211
-rw-r--r--testcases/kernel/syscalls/recv/Makefile19
-rw-r--r--testcases/kernel/syscalls/recvfrom/Makefile19
-rw-r--r--testcases/kernel/syscalls/recvmmsg/.gitignore1
-rw-r--r--testcases/kernel/syscalls/recvmmsg/Makefile7
-rw-r--r--testcases/kernel/syscalls/recvmmsg/recvmmsg01.c147
-rw-r--r--testcases/kernel/syscalls/recvmsg/Makefile19
-rw-r--r--testcases/kernel/syscalls/remap_file_pages/Makefile19
-rw-r--r--testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c14
-rw-r--r--testcases/kernel/syscalls/removexattr/Makefile16
-rw-r--r--testcases/kernel/syscalls/rename/Makefile19
-rw-r--r--testcases/kernel/syscalls/renameat/Makefile19
-rw-r--r--testcases/kernel/syscalls/renameat2/Makefile18
-rw-r--r--testcases/kernel/syscalls/request_key/Makefile19
-rw-r--r--testcases/kernel/syscalls/request_key/request_key03.c10
-rw-r--r--testcases/kernel/syscalls/request_key/request_key04.c2
-rw-r--r--testcases/kernel/syscalls/rmdir/Makefile19
-rw-r--r--testcases/kernel/syscalls/rt_sigaction/Makefile19
-rw-r--r--testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c2
-rw-r--r--testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c2
-rw-r--r--testcases/kernel/syscalls/rt_sigprocmask/Makefile19
-rw-r--r--testcases/kernel/syscalls/rt_sigqueueinfo/Makefile19
-rw-r--r--testcases/kernel/syscalls/rt_sigsuspend/Makefile19
-rw-r--r--testcases/kernel/syscalls/rt_sigtimedwait/Makefile29
-rw-r--r--testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c74
-rw-r--r--testcases/kernel/syscalls/sbrk/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_get_priority_max/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_get_priority_min/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_getaffinity/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_getattr/Makefile17
-rw-r--r--testcases/kernel/syscalls/sched_getparam/.gitignore1
-rw-r--r--testcases/kernel/syscalls/sched_getparam/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_getparam/sched_getparam01.c165
-rw-r--r--testcases/kernel/syscalls/sched_getparam/sched_getparam02.c172
-rw-r--r--testcases/kernel/syscalls/sched_getparam/sched_getparam03.c168
-rw-r--r--testcases/kernel/syscalls/sched_getscheduler/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_rr_get_interval/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c174
-rw-r--r--testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c165
-rw-r--r--testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c198
-rw-r--r--testcases/kernel/syscalls/sched_setaffinity/Makefile16
-rw-r--r--testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c6
-rw-r--r--testcases/kernel/syscalls/sched_setattr/Makefile17
-rw-r--r--testcases/kernel/syscalls/sched_setparam/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_setscheduler/Makefile19
-rw-r--r--testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c4
-rw-r--r--testcases/kernel/syscalls/sched_yield/Makefile19
-rw-r--r--testcases/kernel/syscalls/select/Makefile19
-rw-r--r--testcases/kernel/syscalls/select/select01.c189
-rw-r--r--testcases/kernel/syscalls/select/select02.c129
-rw-r--r--testcases/kernel/syscalls/select/select03.c199
-rw-r--r--testcases/kernel/syscalls/select/select04.c100
-rw-r--r--testcases/kernel/syscalls/select/select_var.h66
-rw-r--r--testcases/kernel/syscalls/send/.gitignore1
-rw-r--r--testcases/kernel/syscalls/send/Makefile19
-rw-r--r--testcases/kernel/syscalls/send/send02.c187
-rw-r--r--testcases/kernel/syscalls/sendfile/Makefile19
-rw-r--r--testcases/kernel/syscalls/sendfile/sendfile03.c194
-rw-r--r--testcases/kernel/syscalls/sendfile/sendfile04.c302
-rw-r--r--testcases/kernel/syscalls/sendfile/sendfile05.c248
-rw-r--r--testcases/kernel/syscalls/sendfile/sendfile07.c212
-rw-r--r--testcases/kernel/syscalls/sendmmsg/.gitignore1
-rw-r--r--testcases/kernel/syscalls/sendmmsg/sendmmsg.h27
-rw-r--r--testcases/kernel/syscalls/sendmmsg/sendmmsg01.c36
-rw-r--r--testcases/kernel/syscalls/sendmmsg/sendmmsg02.c75
-rw-r--r--testcases/kernel/syscalls/sendmmsg/sendmmsg_var.h57
-rw-r--r--testcases/kernel/syscalls/sendmsg/.gitignore1
-rw-r--r--testcases/kernel/syscalls/sendmsg/Makefile22
-rw-r--r--testcases/kernel/syscalls/sendmsg/sendmsg02.c3
-rw-r--r--testcases/kernel/syscalls/sendmsg/sendmsg03.c113
-rw-r--r--testcases/kernel/syscalls/sendto/.gitignore1
-rw-r--r--testcases/kernel/syscalls/sendto/Makefile19
-rw-r--r--testcases/kernel/syscalls/sendto/sendto03.c224
-rw-r--r--testcases/kernel/syscalls/set_mempolicy/Makefile3
-rw-r--r--testcases/kernel/syscalls/set_robust_list/Makefile19
-rw-r--r--testcases/kernel/syscalls/set_thread_area/Makefile19
-rw-r--r--testcases/kernel/syscalls/set_tid_address/Makefile19
-rw-r--r--testcases/kernel/syscalls/setdomainname/Makefile19
-rw-r--r--testcases/kernel/syscalls/setegid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setfsgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setfsuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setgid/setgid01.c90
-rw-r--r--testcases/kernel/syscalls/setgid/setgid02.c114
-rw-r--r--testcases/kernel/syscalls/setgid/setgid03.c105
-rw-r--r--testcases/kernel/syscalls/setgroups/Makefile19
-rw-r--r--testcases/kernel/syscalls/setitimer/Makefile19
-rw-r--r--testcases/kernel/syscalls/setns/Makefile16
-rw-r--r--testcases/kernel/syscalls/setns/setns.h46
-rw-r--r--testcases/kernel/syscalls/setns/setns01.c216
-rw-r--r--testcases/kernel/syscalls/setns/setns02.c160
-rw-r--r--testcases/kernel/syscalls/setpgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setpgrp/Makefile19
-rw-r--r--testcases/kernel/syscalls/setpriority/Makefile19
-rw-r--r--testcases/kernel/syscalls/setpriority/setpriority01.c4
-rw-r--r--testcases/kernel/syscalls/setregid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setregid/setregid04.c9
-rw-r--r--testcases/kernel/syscalls/setresgid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setresuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setreuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setrlimit/Makefile19
-rw-r--r--testcases/kernel/syscalls/setrlimit/setrlimit01.c9
-rw-r--r--testcases/kernel/syscalls/setrlimit/setrlimit05.c2
-rw-r--r--testcases/kernel/syscalls/setrlimit/setrlimit06.c8
-rw-r--r--testcases/kernel/syscalls/setsid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setsockopt/.gitignore3
-rw-r--r--testcases/kernel/syscalls/setsockopt/Makefile21
-rw-r--r--testcases/kernel/syscalls/setsockopt/setsockopt01.c243
-rw-r--r--testcases/kernel/syscalls/setsockopt/setsockopt02.c37
-rw-r--r--testcases/kernel/syscalls/setsockopt/setsockopt04.c5
-rw-r--r--testcases/kernel/syscalls/setsockopt/setsockopt05.c107
-rw-r--r--testcases/kernel/syscalls/setsockopt/setsockopt06.c133
-rw-r--r--testcases/kernel/syscalls/setsockopt/setsockopt07.c145
-rw-r--r--testcases/kernel/syscalls/settimeofday/Makefile19
-rw-r--r--testcases/kernel/syscalls/settimeofday/settimeofday01.c211
-rw-r--r--testcases/kernel/syscalls/settimeofday/settimeofday02.c214
-rw-r--r--testcases/kernel/syscalls/setuid/Makefile19
-rw-r--r--testcases/kernel/syscalls/setxattr/Makefile17
-rw-r--r--testcases/kernel/syscalls/setxattr/setxattr01.c1
-rw-r--r--testcases/kernel/syscalls/sgetmask/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigaction/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigaltstack/Makefile19
-rw-r--r--testcases/kernel/syscalls/sighold/Makefile19
-rw-r--r--testcases/kernel/syscalls/signal/Makefile19
-rw-r--r--testcases/kernel/syscalls/signalfd/Makefile19
-rw-r--r--testcases/kernel/syscalls/signalfd4/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigpending/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigprocmask/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigrelse/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigsuspend/Makefile19
-rw-r--r--testcases/kernel/syscalls/sigsuspend/sigsuspend01.c238
-rw-r--r--testcases/kernel/syscalls/sigtimedwait/Makefile28
-rw-r--r--testcases/kernel/syscalls/sigtimedwait/sigtimedwait01.c36
-rw-r--r--testcases/kernel/syscalls/sigwait/Makefile28
-rw-r--r--testcases/kernel/syscalls/sigwait/sigwait01.c36
-rw-r--r--testcases/kernel/syscalls/sigwaitinfo/Makefile23
-rw-r--r--testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c521
-rw-r--r--testcases/kernel/syscalls/socket/Makefile19
-rw-r--r--testcases/kernel/syscalls/socketcall/.gitignore1
-rw-r--r--testcases/kernel/syscalls/socketcall/Makefile19
-rw-r--r--testcases/kernel/syscalls/socketcall/socketcall01.c21
-rw-r--r--testcases/kernel/syscalls/socketcall/socketcall02.c173
-rw-r--r--testcases/kernel/syscalls/socketcall/socketcall03.c187
-rw-r--r--testcases/kernel/syscalls/socketcall/socketcall04.c174
-rw-r--r--testcases/kernel/syscalls/socketpair/Makefile19
-rw-r--r--testcases/kernel/syscalls/sockioctl/Makefile19
-rw-r--r--testcases/kernel/syscalls/splice/Makefile19
-rw-r--r--testcases/kernel/syscalls/splice/splice02.c145
-rw-r--r--testcases/kernel/syscalls/splice/splice04.c10
-rw-r--r--testcases/kernel/syscalls/splice/splice05.c10
-rw-r--r--testcases/kernel/syscalls/ssetmask/Makefile19
-rw-r--r--testcases/kernel/syscalls/stat/Makefile19
-rw-r--r--testcases/kernel/syscalls/statfs/Makefile19
-rw-r--r--testcases/kernel/syscalls/statfs/statfs01.c2
-rw-r--r--testcases/kernel/syscalls/statvfs/Makefile19
-rw-r--r--testcases/kernel/syscalls/statvfs/statvfs01.c2
-rw-r--r--testcases/kernel/syscalls/statx/Makefile17
-rw-r--r--testcases/kernel/syscalls/statx/statx01.c2
-rw-r--r--testcases/kernel/syscalls/statx/statx05.c21
-rw-r--r--testcases/kernel/syscalls/stime/Makefile19
-rw-r--r--testcases/kernel/syscalls/stime/stime_var.h3
-rw-r--r--testcases/kernel/syscalls/string/Makefile19
-rw-r--r--testcases/kernel/syscalls/swapoff/Makefile26
-rw-r--r--testcases/kernel/syscalls/swapoff/Makefile.inc6
-rw-r--r--testcases/kernel/syscalls/swapoff/swapoff01.c102
-rw-r--r--testcases/kernel/syscalls/swapoff/swapoff02.c145
-rw-r--r--testcases/kernel/syscalls/swapon/Makefile25
-rw-r--r--testcases/kernel/syscalls/swapon/libswapon.c90
-rw-r--r--testcases/kernel/syscalls/swapon/libswapon.h39
-rw-r--r--testcases/kernel/syscalls/swapon/swapon01.c95
-rw-r--r--testcases/kernel/syscalls/swapon/swapon02.c164
-rw-r--r--testcases/kernel/syscalls/swapon/swapon03.c252
-rw-r--r--testcases/kernel/syscalls/switch/Makefile17
-rw-r--r--testcases/kernel/syscalls/symlink/Makefile19
-rw-r--r--testcases/kernel/syscalls/symlink/symlink01.c4
-rw-r--r--testcases/kernel/syscalls/symlinkat/Makefile19
-rw-r--r--testcases/kernel/syscalls/sync/.gitignore2
-rw-r--r--testcases/kernel/syscalls/sync/Makefile19
-rw-r--r--testcases/kernel/syscalls/sync/sync01.c214
-rw-r--r--testcases/kernel/syscalls/sync/sync02.c204
-rw-r--r--testcases/kernel/syscalls/sync/sync03.c61
-rw-r--r--testcases/kernel/syscalls/sync_file_range/Makefile19
-rw-r--r--testcases/kernel/syscalls/sync_file_range/sync_file_range02.c7
-rw-r--r--testcases/kernel/syscalls/syncfs/syncfs01.c4
-rw-r--r--testcases/kernel/syscalls/syscall/Makefile19
-rw-r--r--testcases/kernel/syscalls/sysconf/Makefile19
-rw-r--r--testcases/kernel/syscalls/sysctl/Makefile19
-rw-r--r--testcases/kernel/syscalls/sysfs/Makefile19
-rw-r--r--testcases/kernel/syscalls/sysinfo/.gitignore1
-rw-r--r--testcases/kernel/syscalls/sysinfo/Makefile19
-rw-r--r--testcases/kernel/syscalls/sysinfo/sysinfo03.c84
-rw-r--r--testcases/kernel/syscalls/syslog/Makefile19
-rw-r--r--testcases/kernel/syscalls/tee/Makefile19
-rw-r--r--testcases/kernel/syscalls/tee/tee02.c2
-rw-r--r--testcases/kernel/syscalls/tgkill/tgkill01.c10
-rw-r--r--testcases/kernel/syscalls/tgkill/tgkill03.c8
-rw-r--r--testcases/kernel/syscalls/time/.gitignore1
-rw-r--r--testcases/kernel/syscalls/time/Makefile19
-rw-r--r--testcases/kernel/syscalls/time/time01.c193
-rw-r--r--testcases/kernel/syscalls/time/time02.c147
-rw-r--r--testcases/kernel/syscalls/timer_create/Makefile19
-rw-r--r--testcases/kernel/syscalls/timer_delete/Makefile19
-rw-r--r--testcases/kernel/syscalls/timer_delete/timer_delete01.c7
-rw-r--r--testcases/kernel/syscalls/timer_getoverrun/Makefile19
-rw-r--r--testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c6
-rw-r--r--testcases/kernel/syscalls/timer_gettime/Makefile19
-rw-r--r--testcases/kernel/syscalls/timer_gettime/timer_gettime01.c132
-rw-r--r--testcases/kernel/syscalls/timer_settime/.gitignore1
-rw-r--r--testcases/kernel/syscalls/timer_settime/Makefile19
-rw-r--r--testcases/kernel/syscalls/timer_settime/timer_settime01.c137
-rw-r--r--testcases/kernel/syscalls/timer_settime/timer_settime02.c68
-rw-r--r--testcases/kernel/syscalls/timer_settime/timer_settime03.c127
-rw-r--r--testcases/kernel/syscalls/timerfd/.gitignore2
-rw-r--r--testcases/kernel/syscalls/timerfd/Makefile22
-rw-r--r--testcases/kernel/syscalls/timerfd/timerfd01.c322
-rw-r--r--testcases/kernel/syscalls/timerfd/timerfd04.c132
-rw-r--r--testcases/kernel/syscalls/timerfd/timerfd_gettime01.c131
-rw-r--r--testcases/kernel/syscalls/timerfd/timerfd_settime01.c135
-rw-r--r--testcases/kernel/syscalls/timerfd/timerfd_settime02.c120
-rw-r--r--testcases/kernel/syscalls/times/Makefile19
-rw-r--r--testcases/kernel/syscalls/times/times01.c166
-rw-r--r--testcases/kernel/syscalls/tkill/Makefile19
-rw-r--r--testcases/kernel/syscalls/tkill/tkill01.c130
-rw-r--r--testcases/kernel/syscalls/tkill/tkill02.c101
-rw-r--r--testcases/kernel/syscalls/truncate/.gitignore2
-rw-r--r--testcases/kernel/syscalls/truncate/Makefile19
-rw-r--r--testcases/kernel/syscalls/truncate/truncate01.c218
-rw-r--r--testcases/kernel/syscalls/truncate/truncate02.c336
-rw-r--r--testcases/kernel/syscalls/truncate/truncate03.c173
-rw-r--r--testcases/kernel/syscalls/ulimit/Makefile19
-rw-r--r--testcases/kernel/syscalls/umask/Makefile19
-rw-r--r--testcases/kernel/syscalls/umount/Makefile19
-rw-r--r--testcases/kernel/syscalls/umount2/Makefile16
-rw-r--r--testcases/kernel/syscalls/uname/.gitignore1
-rw-r--r--testcases/kernel/syscalls/uname/Makefile19
-rw-r--r--testcases/kernel/syscalls/uname/uname01.c160
-rw-r--r--testcases/kernel/syscalls/uname/uname02.c117
-rw-r--r--testcases/kernel/syscalls/uname/uname03.c132
-rw-r--r--testcases/kernel/syscalls/unlink/Makefile19
-rw-r--r--testcases/kernel/syscalls/unlinkat/Makefile19
-rw-r--r--testcases/kernel/syscalls/unlinkat/unlinkat01.c203
-rw-r--r--testcases/kernel/syscalls/unshare/Makefile19
-rw-r--r--testcases/kernel/syscalls/unshare/unshare01.c309
-rw-r--r--testcases/kernel/syscalls/unshare/unshare02.c239
-rw-r--r--testcases/kernel/syscalls/ustat/Makefile19
-rw-r--r--testcases/kernel/syscalls/utils/common_j_h.c260
-rw-r--r--testcases/kernel/syscalls/utils/compat_16.mk2
-rw-r--r--testcases/kernel/syscalls/utils/include_j_h.h143
-rw-r--r--testcases/kernel/syscalls/utils/mq_timed.h59
-rw-r--r--testcases/kernel/syscalls/utils/newer_64.mk2
-rw-r--r--testcases/kernel/syscalls/utils/poll.h27
-rw-r--r--testcases/kernel/syscalls/utime/Makefile19
-rw-r--r--testcases/kernel/syscalls/utimensat/Makefile23
-rw-r--r--testcases/kernel/syscalls/utimensat/utimensat01.c508
-rwxr-xr-xtestcases/kernel/syscalls/utimensat/utimensat_tests.sh517
-rw-r--r--testcases/kernel/syscalls/utimes/Makefile19
-rw-r--r--testcases/kernel/syscalls/vfork/Makefile19
-rw-r--r--testcases/kernel/syscalls/vhangup/Makefile19
-rw-r--r--testcases/kernel/syscalls/vmsplice/.gitignore1
-rw-r--r--testcases/kernel/syscalls/vmsplice/Makefile19
-rw-r--r--testcases/kernel/syscalls/vmsplice/vmsplice01.c9
-rw-r--r--testcases/kernel/syscalls/vmsplice/vmsplice02.c9
-rw-r--r--testcases/kernel/syscalls/vmsplice/vmsplice04.c93
-rw-r--r--testcases/kernel/syscalls/wait/Makefile19
-rw-r--r--testcases/kernel/syscalls/wait/wait01.c83
-rw-r--r--testcases/kernel/syscalls/wait/wait02.c112
-rw-r--r--testcases/kernel/syscalls/wait4/Makefile19
-rw-r--r--testcases/kernel/syscalls/wait4/wait401.c12
-rw-r--r--testcases/kernel/syscalls/waitid/Makefile19
-rw-r--r--testcases/kernel/syscalls/waitpid/Makefile19
-rw-r--r--testcases/kernel/syscalls/waitpid/waitpid01.c14
-rw-r--r--testcases/kernel/syscalls/write/Makefile19
-rw-r--r--testcases/kernel/syscalls/writev/.gitignore1
-rw-r--r--testcases/kernel/syscalls/writev/Makefile22
-rw-r--r--testcases/kernel/syscalls/writev/writev02.c5
-rw-r--r--testcases/kernel/syscalls/writev/writev03.c153
-rw-r--r--testcases/kernel/syscalls/writev/writev05.c17
-rw-r--r--testcases/kernel/syscalls/writev/writev06.c16
-rw-r--r--testcases/kernel/tracing/pt_test/pt_test.c15
-rw-r--r--testcases/lib/.gitignore1
-rw-r--r--testcases/lib/Makefile3
-rw-r--r--testcases/lib/cmdlib.sh6
-rw-r--r--testcases/lib/tst_device.c20
-rw-r--r--testcases/lib/tst_get_median.c37
-rw-r--r--testcases/lib/tst_net.sh278
-rw-r--r--testcases/lib/tst_net_iface_prefix.c10
-rw-r--r--testcases/lib/tst_net_ip_prefix.c11
-rw-r--r--testcases/lib/tst_net_vars.c65
-rw-r--r--testcases/lib/tst_security.sh36
-rw-r--r--testcases/lib/tst_supported_fs.c5
-rw-r--r--testcases/lib/tst_test.sh137
-rw-r--r--testcases/misc/crash/crash02.c6
-rw-r--r--testcases/misc/lvm/Makefile9
-rwxr-xr-xtestcases/misc/lvm/cleanup_lvm.sh35
-rw-r--r--testcases/misc/lvm/datafiles/Makefile8
-rw-r--r--testcases/misc/lvm/datafiles/runfile.tpl36
-rwxr-xr-xtestcases/misc/lvm/generate_lvm_runfile.sh33
-rwxr-xr-xtestcases/misc/lvm/prepare_lvm.sh84
-rw-r--r--testcases/misc/math/abs/abs01.c2
-rw-r--r--testcases/misc/math/atof/atof01.c2
-rw-r--r--testcases/misc/math/float/Makefile2
-rw-r--r--testcases/misc/math/fptests/fptest01.c2
-rw-r--r--testcases/misc/math/fptests/fptest02.c2
-rw-r--r--testcases/network/Makefile24
-rw-r--r--testcases/network/README.md112
-rwxr-xr-xtestcases/network/busy_poll/busy_poll01.sh10
-rwxr-xr-xtestcases/network/busy_poll/busy_poll02.sh10
-rwxr-xr-xtestcases/network/busy_poll/busy_poll03.sh10
-rw-r--r--testcases/network/can/Makefile2
-rw-r--r--testcases/network/can/filter-tests/00_Descriptions.txt5
-rw-r--r--testcases/network/can/filter-tests/COPYING35
-rw-r--r--testcases/network/can/filter-tests/INSTALL3
-rw-r--r--testcases/network/can/filter-tests/Makefile4
-rw-r--r--testcases/network/can/filter-tests/can_common.h71
-rw-r--r--testcases/network/can/filter-tests/can_filter.c317
-rw-r--r--testcases/network/can/filter-tests/can_rcv_own_msgs.c273
-rwxr-xr-xtestcases/network/can/filter-tests/can_run_tests.sh106
-rwxr-xr-xtestcases/network/dccp/dccp01.sh17
-rwxr-xr-xtestcases/network/dhcp/dhcp_lib.sh9
-rwxr-xr-xtestcases/network/dhcp/dnsmasq_tests.sh2
-rwxr-xr-xtestcases/network/iproute/ip_tests.sh9
-rw-r--r--testcases/network/lib6/asapi_03.c4
-rwxr-xr-xtestcases/network/mpls/mpls02.sh2
-rwxr-xr-xtestcases/network/mpls/mpls_lib.sh4
-rw-r--r--testcases/network/netstress/netstress.c121
-rw-r--r--testcases/network/nfs/nfs_stress/nfs05_make_tree.c10
-rw-r--r--testcases/network/nfs/nfs_stress/nfs_lib.sh45
-rw-r--r--testcases/network/nfs/nfslock01/Makefile2
-rw-r--r--testcases/network/nfsv4/acl/acl1.c2
-rw-r--r--testcases/network/nfsv4/locks/Makefile2
-rw-r--r--testcases/network/nfsv4/locks/locktests.c2
-rw-r--r--testcases/network/rpc/basic_tests/Makefile1
-rw-r--r--testcases/network/rpc/basic_tests/rpc01/lib/librpc01.c2
-rw-r--r--testcases/network/rpc/basic_tests/rpc01/lib/librpc01.h2
-rwxr-xr-xtestcases/network/rpc/basic_tests/rpc01/rpc01.sh51
-rw-r--r--testcases/network/rpc/basic_tests/rpc01/rpc_server.c2
-rw-r--r--testcases/network/rpc/basic_tests/rpc_lib.sh15
-rwxr-xr-xtestcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh61
-rw-r--r--testcases/network/rpc/rpc-tirpc/.gitignore4
-rwxr-xr-xtestcases/network/rpc/rpc-tirpc/rpc_test.sh142
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/Makefile26
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc23
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/include/rpc.h22
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/lib/Makefile2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_cleaner.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/Makefile25
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/Makefile27
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_getport/rpc_pmap_getport.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_set/rpc_pmap_set.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_unset/rpc_pmap_unset.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_complex.c3
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getmaps/tirpc_rpcb_getmaps.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authnone_create/tirpc_authnone_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create/tirpc_authsys_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create_default/tirpc_authsys_create_default.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noproc/tirpc_svcerr_noproc.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noprog/tirpc_svcerr_noprog.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_progvers/tirpc_svcerr_progvers.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_systemerr/tirpc_svcerr_systemerr.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_weakauth/tirpc_svcerr_weakauth.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_set/tirpc_rpcb_set.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_unset/tirpc_rpcb_unset.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create/tirpc_clnt_tp_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_svc_tp_create/tirpc_svc_tp_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_performance.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_stress.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed_limits.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_destroy/tirpc_clnt_destroy.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_create/tirpc_svc_create.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_destroy/tirpc_svc_destroy.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_cleaner.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_1/tirpc_svc_1.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_2/tirpc_svc_2.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c2
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/Makefile23
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c181
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/Makefile23
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c212
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/Makefile23
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c183
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/Makefile23
-rw-r--r--testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c192
-rwxr-xr-xtestcases/network/sctp/sctp01.sh8
-rw-r--r--testcases/network/sctp/sctp_big_chunk.c10
-rw-r--r--testcases/network/stress/README9
-rwxr-xr-xtestcases/network/stress/icmp/icmp-uni-basic.sh2
-rwxr-xr-xtestcases/network/stress/icmp/icmp-uni-vti.sh2
-rwxr-xr-xtestcases/network/stress/interface/if-mtu-change.sh84
-rw-r--r--testcases/network/stress/ipsec/ipsec_lib.sh7
-rw-r--r--testcases/network/stress/multicast/grp-operation/Makefile2
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket41
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh31
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-same-group35
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh20
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-single-socket35
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh25
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-source-filter35
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh20
-rw-r--r--testcases/network/stress/multicast/grp-operation/mcast-lib.sh34
-rwxr-xr-xtestcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh36
-rwxr-xr-xtestcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh53
-rw-r--r--testcases/network/stress/multicast/packet-flood/mcast4-pktfld01207
-rw-r--r--testcases/network/stress/multicast/packet-flood/mcast4-pktfld02225
-rw-r--r--testcases/network/stress/multicast/packet-flood/mcast6-pktfld01203
-rw-r--r--testcases/network/stress/multicast/packet-flood/mcast6-pktfld02220
-rwxr-xr-xtestcases/network/stress/multicast/query-flood/mcast-queryfld01.sh26
-rwxr-xr-xtestcases/network/stress/multicast/query-flood/mcast-queryfld02.sh30
-rwxr-xr-xtestcases/network/stress/multicast/query-flood/mcast-queryfld03.sh44
-rwxr-xr-xtestcases/network/stress/multicast/query-flood/mcast-queryfld04.sh35
-rwxr-xr-xtestcases/network/stress/multicast/query-flood/mcast-queryfld05.sh55
-rwxr-xr-xtestcases/network/stress/multicast/query-flood/mcast-queryfld06.sh63
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast4-queryfld01199
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast4-queryfld02202
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast4-queryfld03208
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast4-queryfld04202
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast4-queryfld05213
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast4-queryfld06219
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast6-queryfld01197
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast6-queryfld02199
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast6-queryfld03205
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast6-queryfld04199
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast6-queryfld05209
-rw-r--r--testcases/network/stress/multicast/query-flood/mcast6-queryfld06213
-rw-r--r--testcases/network/stress/ns-tools/Makefile24
-rw-r--r--testcases/network/stress/ns-tools/tst_net_stress.sh2
-rw-r--r--testcases/network/stress/route/.gitignore1
-rw-r--r--testcases/network/stress/route/00_Descriptions.txt40
-rw-r--r--testcases/network/stress/route/Makefile30
-rwxr-xr-xtestcases/network/stress/route/route-change-dst.sh7
-rwxr-xr-xtestcases/network/stress/route/route-change-gw.sh16
-rwxr-xr-xtestcases/network/stress/route/route-change-if.sh62
-rwxr-xr-xtestcases/network/stress/route/route-change-netlink-dst.sh36
-rwxr-xr-xtestcases/network/stress/route/route-change-netlink-gw.sh33
-rwxr-xr-xtestcases/network/stress/route/route-change-netlink-if.sh39
-rw-r--r--testcases/network/stress/route/route-change-netlink.c324
-rw-r--r--testcases/network/stress/route/route-lib.sh102
-rwxr-xr-xtestcases/network/stress/route/route-redirect.sh62
-rw-r--r--testcases/network/stress/route/route4-redirect212
-rw-r--r--testcases/network/stress/route/route4-rmmod3
-rw-r--r--testcases/network/stress/route/route6-redirect207
-rw-r--r--testcases/network/stress/route/route6-rmmod3
-rwxr-xr-xtestcases/network/tcp_cc/bbr01.sh4
-rwxr-xr-xtestcases/network/tcp_cc/bbr02.sh4
-rwxr-xr-xtestcases/network/tcp_cc/tcp_cc_lib.sh8
-rw-r--r--testcases/network/tcp_cmds/Makefile2
-rwxr-xr-xtestcases/network/tcp_cmds/host/host01.sh104
-rwxr-xr-xtestcases/network/tcp_cmds/ipneigh/ipneigh01.sh6
-rwxr-xr-xtestcases/network/tcp_cmds/netstat/netstat01.sh102
-rwxr-xr-xtestcases/network/tcp_cmds/ping/ping02.sh23
-rw-r--r--testcases/network/tcp_cmds/rcp/Makefile30
-rwxr-xr-xtestcases/network/tcp_cmds/rcp/rcp01.sh144
-rw-r--r--testcases/network/tcp_cmds/rlogin/Makefile31
-rwxr-xr-xtestcases/network/tcp_cmds/rlogin/rlogin01.sh91
-rw-r--r--testcases/network/tcp_cmds/rsh/Makefile31
-rwxr-xr-xtestcases/network/tcp_cmds/rsh/rsh01.sh115
-rwxr-xr-xtestcases/network/tcp_cmds/sendfile/sendfile01.sh114
-rw-r--r--testcases/network/tcp_cmds/sendfile/testsf_s.c20
-rwxr-xr-xtestcases/network/tcp_fastopen/tcp_fastopen_run.sh16
-rwxr-xr-xtestcases/network/traceroute/traceroute01.sh24
-rwxr-xr-xtestcases/network/virt/fou01.sh61
-rwxr-xr-xtestcases/network/virt/geneve01.sh4
-rwxr-xr-xtestcases/network/virt/sit01.sh2
-rw-r--r--testcases/network/virt/virt_lib.sh72
-rwxr-xr-xtestcases/network/virt/vlan03.sh10
-rwxr-xr-xtestcases/network/virt/vxlan03.sh6
-rwxr-xr-xtestcases/network/virt/vxlan04.sh6
-rwxr-xr-xtestcases/network/virt/wireguard01.sh56
-rwxr-xr-xtestcases/network/virt/wireguard02.sh48
-rwxr-xr-xtestcases/network/virt/wireguard_lib.sh66
-rwxr-xr-xtestcases/network/xinetd/xinetd_tests.sh99
-rw-r--r--testcases/open_posix_testsuite/.gitignore2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/aio_h/1-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/aio_h/3-1-buildonly.c16
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/aio_h/4-1.c16
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/errno_h/2-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/errno_h/3-1-buildonly.c158
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/errno_h/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/errno_h/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/10-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/11-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/2-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/3-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/4-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/5-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/6-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/7-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/8-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/mqueue_h/9-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/10-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/11-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/12-1-buildonly.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/13-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/14-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/15-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/16-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/17-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/18-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/19-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/20-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-10-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-11-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-12-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-13-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-4-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-5-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-6-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-7-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-8-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-9-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/4-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/5-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/6-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/7-1-buildonly.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/8-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/pthread_h/9-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/10-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/11-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/12-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/13-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/14-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/15-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/16-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/17-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/18-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/19-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/2-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/3-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sched_h/4-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/14-1-buildonly.c56
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/15-1-buildonly.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/16-1-buildonly.c28
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/17-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/18-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/19-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/2-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/2-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/2-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/2-4-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/21-1-buildonly.c22
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/24-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/25-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/27-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/28-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/29-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/3-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/30-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/32-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/33-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/34-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/35-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/36-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/37-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/38-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/39-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/4-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/40-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/41-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/42-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/43-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/44-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/45-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/46-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/47-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/48-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/49-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/5-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/signal_h/50-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/10-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/11-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/12-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/13-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/14-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/15-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/16-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/17-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/18-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/19-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/20-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/21-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/22-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/23-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/24-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/10-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/11-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/4-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/5-1-buildonly.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/6-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-4-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/8-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/9-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/10-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/11-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/12-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/13-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/14-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/15-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/16-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/17-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/18-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/19-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/2-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/20-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/21-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/22-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/23-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/24-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/25-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/26-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/27-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/28-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/29-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/30-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/31-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/32-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/33-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/34-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/35-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/35-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/35-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/4-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/5-1-buildonly.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/7-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/7-2-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/7-3-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/7-4-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/7-5-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/8-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/time_h/9-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/unistd_h/1-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/definitions/unistd_h/2-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/3-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_error/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-4.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/9-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_return/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_return/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/1-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/9-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/8-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c5
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/fork/19-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/fork/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c5
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/fsync/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/killpg/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/killpg/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/1-1.c13
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/10-1.c17
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/12-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/13-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/14-1.c19
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/15-1.c19
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/18-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/2-1.c17
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/3-1.c17
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/4-1.c19
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/5-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/7-1.c19
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/lio_listio/9-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/localtime/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mktime/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mlock/12-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mlock/8-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mlock/speculative/12-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mlockall/15-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mlockall/speculative/15-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/10-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/11-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c9
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/11-6.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/12-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/13-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/14-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/27-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/3-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/31-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/32-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/6-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/6-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/6-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/6-4.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/6-6.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/7-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/7-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mmap/9-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c18
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_notify/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_notify/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_notify/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_notify/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_notify/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_notify/9-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c9
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_open/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_open/20-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_open/7-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_open/8-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_open/9-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_receive/13-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_send/12-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c15
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/8-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/12-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/15-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/16-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/19-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/20-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-1.c14
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-2.c14
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/munlock/10-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/munmap/1-1.c9
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/munmap/1-2.c9
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/munmap/3-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/munmap/4-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/munmap/9-1.c7
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/nanosleep/5-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-2.c14
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/2-2.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-2.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-3.c26
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/4-1.c26
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_destroy/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getscope/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setdetachstate/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setscope/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_init/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-3.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-3.c14
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c14
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-3.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-2.c14
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-2.c26
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/1-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-3.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/3-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/4-1.c26
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/2-1.c20
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/3-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_key_delete/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/1-2.c16
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-2.c16
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/3-1.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/5-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_setprioceiling/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-3.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/3-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_once/6-1.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_self/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/3-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/2-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/5-1.c20
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedprio/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_setspecific/1-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/10-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/12-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/14-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/16-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c24
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/6-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/9-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/1-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/raise/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/raise/1-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/raise/10000-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/raise/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/raise/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/20-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-6.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/26-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-6.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/20-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-1.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-2.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_destroy/3-1.c12
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_getvalue/2-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-1.c52
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_open/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_post/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_post/6-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/3-1.c1
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/7-1.c1
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/9-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/2-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/5-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/9-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_wait/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_wait/13-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sem_wait/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/shm_open/23-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/shm_open/32-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/shm_open/34-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/shm_open/37-1.c62
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/shm_open/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/11-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-10.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-11.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-12.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-13.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-14.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-15.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-16.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-17.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-18.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-19.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-20.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-21.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-22.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-23.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-24.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-25.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-26.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-4.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-5.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-6.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-7.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-8.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-9.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/10-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/11-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-10.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-11.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-12.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-13.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-14.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-15.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-16.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-17.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-18.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-19.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-20.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-21.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-22.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-23.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-24.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-25.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-26.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-27.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-28.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-29.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-30.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-31.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-32.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-33.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-34.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-35.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-36.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-37.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-38.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-39.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-40.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-41.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-42.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-43.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-44.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-45.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-46.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-47.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-48.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-49.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-50.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-51.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-52.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-8.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-9.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-10.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-11.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-12.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-13.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-14.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-15.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-16.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-17.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-18.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-19.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-20.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-21.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-22.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-23.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-24.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-25.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-26.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-8.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-9.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-10.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-11.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-12.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-13.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-14.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-15.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-16.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-17.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-18.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-19.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-20.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-21.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-22.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-23.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-24.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-25.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-26.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-8.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-9.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-10.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-11.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-12.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-13.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-14.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-15.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-16.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-17.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-18.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-19.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-20.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-21.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-22.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-23.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-24.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-25.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-26.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-8.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-9.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/21-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-10.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-11.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-12.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-13.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-14.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-15.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-16.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-17.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-18.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-19.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-20.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-21.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-22.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-23.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-24.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-25.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-26.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-8.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-9.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-10.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-11.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-12.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-13.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-14.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-15.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-16.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-17.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-18.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-19.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-2.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-20.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-21.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-22.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-23.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-24.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-25.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-26.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-3.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-4.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-5.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-6.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-7.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-8.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-9.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-10.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-11.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-12.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-13.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-14.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-15.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-16.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-17.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-18.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-19.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-20.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-21.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-22.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-23.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-24.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-25.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-26.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-4.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-5.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-6.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-7.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-8.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-9.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/29-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-10.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-11.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-12.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-13.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-14.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-15.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-16.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-17.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-18.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-19.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-20.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-21.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-22.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-23.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-24.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-25.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-26.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-4.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-5.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-6.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-7.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-8.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-9.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/30-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-10.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-100.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-101.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-102.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-103.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-104.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-11.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-12.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-13.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-14.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-15.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-16.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-17.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-18.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-19.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-20.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-21.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-22.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-23.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-24.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-25.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-26.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-27.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-28.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-29.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-30.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-31.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-32.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-33.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-34.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-35.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-36.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-37.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-38.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-39.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-4.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-40.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-41.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-42.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-43.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-44.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-45.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-46.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-47.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-48.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-49.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-5.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-50.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-51.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-52.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-53.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-54.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-55.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-56.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-57.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-58.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-59.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-6.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-60.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-61.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-62.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-63.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-64.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-65.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-66.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-67.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-68.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-69.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-7.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-70.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-71.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-72.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-73.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-74.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-75.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-76.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-77.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-78.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-79.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-8.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-80.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-81.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-82.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-83.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-84.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-85.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-86.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-87.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-88.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-89.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-9.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-90.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-91.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-92.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-93.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-94.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-95.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-96.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-97.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-98.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-99.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-10.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-11.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-12.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-13.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-14.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-15.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-16.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-17.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-18.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-19.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-20.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-21.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-22.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-23.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-24.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-25.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-26.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-4.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-5.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-6.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-7.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-8.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-9.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-10.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-11.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-12.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-13.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-14.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-15.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-16.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-17.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-18.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-19.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-2.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-20.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-21.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-22.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-23.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-24.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-25.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-26.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-3.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-4.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-5.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-6.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-7.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-8.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-9.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/9-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_1-1.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-1.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-2.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_13-1.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_16-1.in6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_17-1.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_2-1.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_22-1.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_23-1.in4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_25-1.in6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_3-1.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-1.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-2.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-3.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-4.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_6-1.in2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/10-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/11-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/12-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/8-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sighold/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigignore/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigismember/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/signal/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/signal/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/signal/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/signal/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/signal/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/signal/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/12-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/9-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/12-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/4-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/6-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/7-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigqueue/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigrelse/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/5-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigset/9-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/1-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/4-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/6-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwait/4-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-2.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/2-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/5-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/6-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/7-1.c8
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/8-1.c6
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/9-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/strchr/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/strcpy/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/strlen/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/strncpy/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c10
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/10-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/11-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/7-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/8-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/9-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/2-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_delete/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/1-1.c4
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-3.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-1.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-2.c2
-rw-r--r--testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-3.c4
-rw-r--r--testcases/open_posix_testsuite/functional/Makefile2
-rw-r--r--testcases/open_posix_testsuite/functional/mqueues/send_rev_2.c16
-rw-r--r--testcases/open_posix_testsuite/functional/semaphores/sem_conpro.c6
-rw-r--r--testcases/open_posix_testsuite/functional/semaphores/sem_philosopher.c14
-rw-r--r--testcases/open_posix_testsuite/functional/semaphores/sem_readerwriter.c14
-rw-r--r--testcases/open_posix_testsuite/functional/semaphores/sem_sleepingbarber.c16
-rw-r--r--testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_1.c12
-rw-r--r--testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_2.c12
-rw-r--r--testcases/open_posix_testsuite/functional/threads/schedule/1-1.c12
-rw-r--r--testcases/open_posix_testsuite/functional/threads/schedule/1-2.c10
-rw-r--r--testcases/open_posix_testsuite/functional/timers/Makefile10
-rw-r--r--testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c30
-rw-r--r--testcases/open_posix_testsuite/functional/timers/timers/LDLIBS1
-rw-r--r--testcases/open_posix_testsuite/functional/timers/timers/twoevtimers.c8
-rw-r--r--testcases/open_posix_testsuite/functional/timers/timers/twoptimers.c30
-rw-r--r--testcases/open_posix_testsuite/include/noatime.h4
-rw-r--r--testcases/open_posix_testsuite/include/posixtest.h6
-rw-r--r--testcases/open_posix_testsuite/include/proc.h4
-rw-r--r--testcases/open_posix_testsuite/include/tempfile.h19
-rwxr-xr-xtestcases/open_posix_testsuite/scripts/generate-makefiles.sh8
-rw-r--r--testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c8
-rw-r--r--testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c14
-rw-r--r--testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/fork/s-c1.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/helper.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c2
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_init/stress.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c6
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c18
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c14
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c18
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c6
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c18
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c14
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c18
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_exit/stress.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c12
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c22
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/s-c.c3
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/stress.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c6
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c1.c16
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c2.c22
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/stress.c26
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c6
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/stress.c12
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c16
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_self/stress.c16
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c3
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c6
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c8
-rw-r--r--testcases/open_posix_testsuite/tools/t0.c4
-rw-r--r--testcases/realtime/configure.ac3
-rw-r--r--testcases/realtime/func/pi-tests/parse-testpi2.py4
-rw-r--r--testcases/realtime/func/pi-tests/sbrk_mutex.c11
-rw-r--r--testcases/realtime/func/pi-tests/testpi-6.c8
-rw-r--r--testcases/realtime/include/librttest.h1
-rw-r--r--testcases/realtime/lib/Makefile2
-rw-r--r--testcases/realtime/lib/librttest.c1
-rw-r--r--testcases/realtime/m4/check.m410
-rw-r--r--testcases/realtime/scripts/parser.py10
-rwxr-xr-xtestscripts/exportfs.sh208
-rwxr-xr-xtestscripts/ltpfslvm.sh200
-rwxr-xr-xtestscripts/ltpfsnolvm.sh150
-rwxr-xr-xtestscripts/lvmtest.sh18
-rw-r--r--tools/apicmds/ltpapicmd.c2
-rwxr-xr-xtravis/alpine.sh20
-rwxr-xr-xtravis/debian.cross-compile.aarch64.sh7
-rwxr-xr-xtravis/debian.cross-compile.ppc64le.sh7
-rwxr-xr-xtravis/debian.cross-compile.sh24
-rwxr-xr-xtravis/debian.i386.sh7
-rwxr-xr-xtravis/debian.minimal.sh12
-rwxr-xr-xtravis/debian.sh20
-rwxr-xr-xtravis/fedora.sh20
-rwxr-xr-xtravis/tumbleweed.sh18
-rw-r--r--utils/benchmark/ebizzy-0.3/ebizzy.c15
-rw-r--r--utils/sctp/func_tests/Makefile2
-rw-r--r--utils/sctp/func_tests/test_1_to_1_accept_close.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_addrs.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_connect.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_connectx.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_events.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_initmsg_connect.c4
-rw-r--r--utils/sctp/func_tests/test_1_to_1_nonblock.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_recvfrom.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_recvmsg.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_rtoinfo.c4
-rw-r--r--utils/sctp/func_tests/test_1_to_1_send.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_sendmsg.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_sendto.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_shutdown.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c6
-rw-r--r--utils/sctp/func_tests/test_1_to_1_sockopt.c4
-rw-r--r--utils/sctp/func_tests/test_1_to_1_threads.c4
-rw-r--r--utils/sctp/func_tests/test_assoc_abort.c6
-rw-r--r--utils/sctp/func_tests/test_assoc_shutdown.c6
-rw-r--r--utils/sctp/func_tests/test_autoclose.c6
-rw-r--r--utils/sctp/func_tests/test_basic.c4
-rw-r--r--utils/sctp/func_tests/test_connect.c6
-rw-r--r--utils/sctp/func_tests/test_connectx.c6
-rw-r--r--utils/sctp/func_tests/test_fragments.c6
-rw-r--r--utils/sctp/func_tests/test_getname.c6
-rw-r--r--utils/sctp/func_tests/test_inaddr_any.c4
-rw-r--r--utils/sctp/func_tests/test_peeloff.c6
-rw-r--r--utils/sctp/func_tests/test_recvmsg.c6
-rw-r--r--utils/sctp/func_tests/test_sctp_sendrecvmsg.c6
-rw-r--r--utils/sctp/func_tests/test_sockopt.c4
-rw-r--r--utils/sctp/func_tests/test_tcp_style.c6
-rw-r--r--utils/sctp/func_tests/test_timetolive.c6
-rw-r--r--utils/sctp/lib/Makefile2
-rw-r--r--utils/sctp/testlib/Makefile2
-rw-r--r--utils/sctp/testlib/sctputil.c12
-rw-r--r--utils/sctp/testlib/sctputil.h30
3216 files changed, 56149 insertions, 59708 deletions
diff --git a/.gitignore b/.gitignore
index 213ff2051..99206de57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
CVS
-.*.swp
*~
*.o
*.o.d
@@ -12,8 +11,6 @@ lib*.a
*.pyc
.cache.mk
*.dwo
-*.mod
-built-in.a
/aclocal.m4
autom4te.cache
diff --git a/.travis.yml b/.travis.yml
index 5d759dab4..51efa22e3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,3 @@
-# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
-
-dist: bionic
sudo: required
language: c
services:
@@ -15,117 +12,90 @@ matrix:
# cross compilation builds
- os: linux
- env: DISTRO=debian:stable VARIANT=cross-compile ARCH=ppc64el TREE=out MAKE_INSTALL=1
+ env: DISTRO=debian:stable VARIANT=cross-compile.ppc64le TREE="out"
compiler: powerpc64le-linux-gnu-gcc
- os: linux
- env: DISTRO=debian:stable VARIANT=cross-compile ARCH=arm64 TREE=out
+ env: DISTRO=debian:stable VARIANT=cross-compile.aarch64 TREE="out"
compiler: aarch64-linux-gnu-gcc
- - os: linux
- env: DISTRO=debian:stable VARIANT=cross-compile ARCH=s390x TREE=out
- compiler: s390x-linux-gnu-gcc
-
# musl (native)
- os: linux
# Message: WARNING: xsltproc: cannot process http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
# doc/meson.build:70:1: ERROR: Problem encountered: Docs cannot be built: xsltproc does not work correctly
- env: DISTRO=alpine:latest METADATA=asciidoctor
+ env: DISTRO=alpine:latest
compiler: gcc
# build with minimal dependencies
- os: linux
- env: DISTRO=debian:stable VARIANT=minimal TREE=out
+ env: DISTRO=debian:stable VARIANT=minimal TREE="out"
compiler: clang
+ # native non-intel
+ - os: linux
+ arch: ppc64le
+ compiler: gcc
+ env: DISTRO=debian:testing
+
+ - os: linux
+ arch: s390x
+ compiler: gcc
+ env: DISTRO=debian:stable
+
# other builds
- os: linux
- env: DISTRO=fedora:latest MAKE_INSTALL=1 CONTAINER=podman METADATA=asciidoctor-pdf
+ env: DISTRO=fedora:latest
compiler: clang
- os: linux
- env: DISTRO=centos:7 TREE=out METADATA=asciidoc-pdf
+ env: DISTRO=centos:6 TREE="out"
compiler: gcc
- os: linux
- env: DISTRO=debian:testing METADATA=asciidoctor-pdf
+ env: DISTRO=debian:testing
compiler: gcc
- os: linux
- env: DISTRO=debian:oldstable METADATA=asciidoc-pdf
+ env: DISTRO=debian:oldstable
compiler: clang
- os: linux
- env: DISTRO=opensuse/tumbleweed CONTAINER=podman METADATA=asciidoctor
+ env: DISTRO=opensuse/tumbleweed
compiler: gcc
- os: linux
- env: DISTRO=opensuse/leap METADATA=asciidoc-pdf
+ env: DISTRO=opensuse/leap
compiler: gcc
- os: linux
- env: DISTRO=debian:oldstable METADATA=asciidoctor
+ env: DISTRO=debian:oldstable
compiler: gcc
- os: linux
- env: DISTRO=debian:testing METADATA=asciidoc-pdf
+ env: DISTRO=debian:testing
compiler: clang
- os: linux
- env: DISTRO=ubuntu:groovy TREE=out METADATA=asciidoctor
+ env: DISTRO=ubuntu:latest TREE="out"
compiler: gcc
- os: linux
- env: DISTRO=ubuntu:xenial METADATA=asciidoc-pdf
+ env: DISTRO=ubuntu:xenial
compiler: gcc
- os: linux
- env: DISTRO=centos:latest METADATA=asciidoctor
+ env: DISTRO=centos:latest
compiler: gcc
before_install:
- - CONTAINER="${CONTAINER:-docker}"
- # distros with glibc >=2.33 require podman and newest runc due docker faccessat2 incompatibility
- - >
- if [ "$CONTAINER" = "podman" ]; then
- # podman
- CONTAINER_ARGS="--runtime=/usr/bin/runc"
- . /etc/os-release
- sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
- wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -
- sudo apt update
- sudo apt -y install podman slirp4netns
-
- # runc
- sudo curl -L https://github.com/opencontainers/runc/releases/download/v1.0.0-rc93/runc.amd64 -o /usr/bin/runc
- sudo chmod +x /usr/bin/runc
- fi
-
- # Docker Hub pull rate limit workaround for docker
- - >
- if [ "$CONTAINER" = "docker" ]; then
- conf="/etc/docker/daemon.json"
- tmp=$(mktemp)
- sudo jq '."registry-mirrors" += ["https://mirror.gcr.io"]' $conf > $tmp
- sudo mv $tmp $conf
- sudo systemctl daemon-reload
- sudo systemctl restart docker
- fi
- - $CONTAINER info
-
- # ltp
- DIR="/usr/src/ltp"
- printf "FROM $DISTRO\nRUN mkdir -p $DIR\nWORKDIR $DIR\nCOPY . $DIR\n" > Dockerfile
- - cat Dockerfile
- - $CONTAINER build $CONTAINER_ARGS -t ltp .
+ - echo "cat Dockerfile"; cat Dockerfile; echo "=====" # FIXME: debug
+ - docker build -t ltp .
script:
- INSTALL="${DISTRO%%:*}"
- INSTALL="${INSTALL%%/*}"
- - if [ "$MAKE_INSTALL" = 1 ]; then INSTALL_OPT="-i"; fi
- - if [ "$METADATA" = "asciidoc-pdf" ]; then CONFIGURE_OPT_EXTRA="--with-metadata-generator=asciidoc --enable-metadata-pdf"; fi
- - if [ "$METADATA" = "asciidoctor" ]; then CONFIGURE_OPT_EXTRA="--with-metadata-generator=asciidoctor"; fi
- - if [ "$METADATA" = "asciidoctor-pdf" ]; then CONFIGURE_OPT_EXTRA="--with-metadata-generator=asciidoctor --enable-metadata-pdf"; fi
- if [ ! "$TREE" ]; then TREE="in"; fi
- case $VARIANT in cross-compile*) BUILD="cross";; i386) BUILD="32";; *) BUILD="native";; esac
- - $CONTAINER run $CONTAINER_ARGS -t ltp /bin/sh -c "cd travis && ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./$INSTALL.$VARIANT.sh; fi && CONFIGURE_OPT_EXTRA=\"$CONFIGURE_OPT_EXTRA\" ../build.sh -o $TREE -t $BUILD -c $CC $INSTALL_OPT"
+ - docker run -t ltp /bin/sh -c "cd travis && ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ./$INSTALL.$VARIANT.sh; fi && ../build.sh -o $TREE -t $BUILD -c $CC"
diff --git a/INSTALL b/INSTALL
index 52d61101e..3d86415a9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,43 +1,49 @@
-Requirements
-------------
-
-Tools are needed for LTP compilation. They should be available as a
-package in any Linux distribution (no specific version is required).
+$Id: INSTALL,v 1.36 2010/01/18 23:46:09 yaberauneya Exp $
-Debian / Ubuntu
+Requirements
+-------------------
- # apt install gcc git make pkgconf autoconf automake bison flex m4 linux-headers-$(uname -r) libc6-dev
+1. In order to compile ltp you must have make 3.80+ (make 3.81 preferred).
+2. In order to compile and use ltp-scanner (a utility in the pan directory),
+ you must have bison/yacc, and flex installed.
-OpenSUSE / SLES
+bison can be obtained here:
+- http://ftp.gnu.org/gnu/bison/bison-2.4.1.tar.gz
- # zypper install gcc git make pkgconf autoconf automake bison flex m4 linux-glibc-devel glibc-devel
+Berkeley yacc can be obtained here:
+- ftp://invisible-island.net/byacc/byacc.tar.gz
-Fedora / CentOS / RHEL
+flex can be obtained here:
+- http://downloads.sourceforge.net/project/flex/flex/flex-2.5.33/flex-2.5.33.tar.bz2
- # yum install gcc git make pkgconf autoconf automake bison flex m4 kernel-headers glibc-headers
+make 3.81 can be obtained here:
+- http://ftp.gnu.org/gnu/make/make-3.81.tar.bz2
-These are minimal build requirements for git compilation. Some tests require
-extra development files of some libraries, see travis/*.sh. There is also
-support for other Linux distributions not listed here.
+If you want to use auto configuration, be sure autoconf-2.61+ & automake-1.10+
+are installed.
-autoconf, automake, m4 (autoconf requirement), git and pkgconf (or pkg-config
-on older distros) are required only for compilation from git (used for creating
-configure file).
+automake-1.10.2's sources can be downloaded from:
+- ftp://ftp.gnu.org/gnu/automake/automake-1.10.2.tar.bz2
+- ftp://ftp.gnu.org/gnu/automake/automake-1.10.2.tar.gz
-pkgconf is recommended also for compilation from tarball as it
-does automatic detection of some library support.
+autoconf-2.61's sources can be downloaded from:
+- ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2
+- ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz
-GNU Bison / Berkeley Yacc is required for ltp-scanner.
+autoconf-2.61 also requires m4-1.4.7+ be installed. Its sources can be
+downloaded from:
+- http://ftp.gnu.org/gnu/m4/m4-1.4.7.tar.bz2
+- http://ftp.gnu.org/gnu/m4/m4-1.4.7.tar.gz
Configuration
--------------
+-------------------
Configuration requires autoconf:
$ cd $TOP_SRCDIR
$ make autotools
$ mkdir -p $TOP_BUILDDIR
- $ cd $TOP_BUILDDIR && $TOP_SRCDIR/configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
+ $ cd $TOP_BUILDDIR && ./configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
- $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios.
- $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios.
@@ -46,11 +52,28 @@ See the In-build-tree and Out-of-build-tree sections below for more details on
what to do next.
Compiling LTP
--------------
+-------------------
-In-build-tree
--------------
+"What's in a Path?"
+-------------------
+
+Before getting started, you should make sure that your build directory and
+source directory are as basic as possible: no commas, colons, semicolons,
+spaces, etc. In fact, this is a relatively good rule of thumb when dealing
+with any [Gnu?] make based opensource project.
+
+We won't `fix' the `issues' associated with these particular set of build
+errors resulting from non-sane pathnames, because it would introduce unneeded
+complexity into the build system and would require non-trivial effort to fix
+and validate the third-party packages, and thus wouldn't be a sustainable
+model to follow.
+
+So, we apologize for the inconvenience, but using other characters like
+underscores and dashes should help when disambiguating words between build
+and source pathnames.
+In-build-tree
+-------------------
In-build-tree support is when you build binaries (applications, binary objects)
in the same directory where the source files reside.
@@ -75,8 +98,7 @@ following information,
iii. config.log
Out-of-build-tree
------------------
-
+-------------------
Out-of-build-tree support is when you build binaries (applications, binary
objects, generated files) outside of the directory where the source files
reside. This is typically used when cross-compiling for multiple targets.
@@ -108,12 +130,12 @@ items which need fixing in the LTP tree.
Quick Start
-----------
- $ tar xzf ltp-XXXXXXXX.tar.gz
- $ cd ltp
- $ ./configure
- $ make all
- # make install
- $ /opt/ltp/runltp
+1> tar xzf ltp-XXXXXXXX.tar.gz
+2> cd ltp
+3> ./configure
+4> make all
+5> make install
+6> /opt/ltp/runltp
*NOTE:
- LTP assumes the existence of the nobody, bin, and daemon users and their
@@ -151,44 +173,78 @@ contributions are welcome.
in the CD-ROM drive. The corresponding tests will fail if either disk is
missing.
-5. The network tests related installation see testcases/network/README.md.
+5. The network tests are executed by running the network.sh script. The network
+ tests require some configuration for them to work correctly:
+
+ i) First, there MUST be another test machine setup to act as the server
+ to these client side tests. This machine MUST have the LTP installed
+ in the same exact location, i.e. if the client has /root/ltp, then the
+ server must have /root/ltp. This is required because certain tests
+ expect to find server files in certain locations. Make sure to compile
+ the LTP on this server machine also.
+
+ ii) Second, the server must be setup to allow the client to connect using
+ the "r" commands, such as rsh. This is done by simply creating/editing
+ the ".rhosts" file under /root. Place the hostname of the client
+ machine in this file to allow root to remotely connect without the use
+ of a password. If server has the PAM system security tool, you need
+ to add the following lines to /etc/securetty:
+ rlogin
+ rsh
+ rexec
+ pts/0
+ pts/1
+ :
+ pts/9
+
+ iii) Next, certain services must be activated in order for certain tests to
+ execute. The following services are activated via inetd/xinetd:
+ rlogind
+ ftpd
+ telnetd
+ echo (stream)
+ fingerd
+ rshd
+ Also, because certain RPC programs are tested, the "portmapper" daemon
+ MUST be started, as well as NFS server AND lock services.
+
+ iv) Finally, before running the network.sh script, two variables must be
+ set: The "RHOST" variable should be set to the hostname of the server.
+ The "PASSWD" variable should be set to root's password on the server
+ machine. This is necessary for tests such as telnet01.sh and ftp01.sh.
+
+ You can now successfully execute the network.sh script.
+
+ You can run the test category which you are interested in, -h option shows
+ the list of the test category:
+ # ./network.sh -h
+
+ For more info about howto run network.sh see testcases/network/README.md.
Cross compiling
---------------
To cross compile, you must specify the correct variables when running configure.
-e.g. CC, LDFLAGS, etc.
-For correct pkgconf / pkg-config detection you need to set
-PKG_CONFIG_SYSROOT_DIR=$SYSROOT
+e.g. CC, LDFLAGS, etc...
After configure has run, it will generate include/mk/config.mk. You can tweak
settings in there if need be, but you should not specificy settings on the
command-line when running make.
-32 bit build on 64 bit machine
-------------------------------
-
-You need to set CFLAGS=-m32 LDFLAGS=-m32 and PKG_CONFIG_LIBDIR
-
-* RPM based distributions (openSUSE, Fedora, etc.)
-PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
-
-* Debian / Ubuntu and derivates
-PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
-
-* Arch Linux
-PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
+uClinux Users
+--------------
+Specify UCLINUX=1 when calling make; -DUCLINUX=1 use is deprecated and highly
+discouraged.
Android Users
-------------
-
Specify ANDROID=1 when calling make. Many tests which would otherwise work are
currently not built because they share a directory with an incompatible test.
The shell scripts expect /bin/sh to exist, so create a symlink.
Variables in Makefile
----------------------
+----------------------
The conventions enforced are standard ones. Here's a quick summary:
@@ -203,11 +259,10 @@ LDFLAGS - linker flags, e.g. "-L$SYSROOT/usr/lib" "-L$SYSROOT/lib". DO NOT
LDLIBS - libraries listed after objects during link, e.g. -lc, -lpthread,
-lltp.
-For other variables and more info about the build systems see
-doc/build-system-guide.txt.
+See README.mk-devel for a more terse description of what's available.
Common Issues
--------------
+----------------------
Issue: When executing configure it says:
diff --git a/METADATA b/METADATA
index 472213398..d15c65dcc 100644
--- a/METADATA
+++ b/METADATA
@@ -2,6 +2,7 @@
# CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
# DEPENDING ON IT IN YOUR PROJECT. ***
third_party {
- license_note: "would be RESTRICTED save for GFDL in: testcases/kernel/device-drivers/v4l/user_space/doc/spec/*.htm*"
+ # would be RESTRICTED save for GFDL in:
+ # testcases/kernel/device-drivers/v4l/user_space/doc/spec/*.htm*
license_type: BY_EXCEPTION_ONLY
}
diff --git a/Makefile b/Makefile
index 56812d77b..768ca4606 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
#
# Top-level Makefile for LTP. See INSTALL for more info.
#
-# Copyright (c) Linux Test Project, 2009-2020
-# Copyright (c) Cisco Systems Inc., 2009-2010
+# Copyright (C) 2009-2010, Cisco Systems Inc.
+# Copyright (C) 2010-2011, Linux Test Project.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,10 +63,6 @@ endif
endef
COMMON_TARGETS += testcases tools
-ifeq ($(WITH_METADATA),yes)
-COMMON_TARGETS += docparse
-endif
-
# Don't want to nuke the original files if we're installing in-build-tree.
ifneq ($(BUILD_TREE_STATE),$(BUILD_TREE_SRCDIR_INSTALL))
INSTALL_TARGETS += runtest scenario_groups testscripts
@@ -93,7 +89,11 @@ include-install: $(top_builddir)/include/config.h include/mk/config.mk include-a
INSTALL_DIR := $(DESTDIR)/$(prefix)
# DO NOT REMOVE THIS CALL (see clean_install_dir call below...)!!!!
+ifdef MAKE_3_80_COMPAT
+INSTALL_DIR := $(call MAKE_3_80_abspath,$(INSTALL_DIR))
+else
INSTALL_DIR := $(abspath $(INSTALL_DIR))
+endif
# build tree bootstrap targets and $(INSTALL_DIR) target.
$(sort $(addprefix $(abs_top_builddir)/,$(BOOTSTRAP_TARGETS)) $(INSTALL_DIR) $(DESTDIR)/$(bindir)):
diff --git a/OWNERS b/OWNERS
index 42bc09966..5606eddd6 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,5 +1,4 @@
adelva@google.com
-balsini@google.com
-edliaw@google.com
smuckle@google.com
sspatil@google.com
+trong@google.com
diff --git a/README.kernel_config b/README.kernel_config
index 547dd4f33..ffb2dec95 100644
--- a/README.kernel_config
+++ b/README.kernel_config
@@ -131,6 +131,7 @@ CONFIG_KEXEC_JUMP=y
---------------------------------
Enabling HOTPLUG for your Kernels
---------------------------------
+CONFIG_HOTPLUG=y
CONFIG_HOTPLUG_CPU=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ACPI_HOTPLUG_CPU=y
diff --git a/README.md b/README.md
index 56d10d450..d248f7c2d 100644
--- a/README.md
+++ b/README.md
@@ -37,9 +37,8 @@ on properly functioning systems, they are intended to find (or cause) problems.
Quick guide to running the tests
================================
-If you have git, autoconf, automake, m4, pkgconf / pkg-config, libc headers,
-linux kernel headers and other common development packages installed (see
-INSTALL and travis/*.sh), the chances are the following will work:
+If you have git, autoconf, automake, m4, the linux headers and the common
+developer packages installed, the chances are the following will work.
```
$ git clone https://github.com/linux-test-project/ltp.git
@@ -51,9 +50,6 @@ $ ./configure
Now you can continue either with compiling and running a single test or with
compiling and installing the whole testsuite.
-For optional library dependencies look into scripts for major distros in
-`travis/` directory. You can also build whole LTP with `./build.sh` script.
-
Shortcut to running a single test
---------------------------------
If you need to execute a single test you actually do not need to compile
@@ -108,9 +104,6 @@ dependencies.
* If a tests fails due to a missing user or group, see the Quick Start section
of `INSTALL`.
-Running tests
--------------
-
To run all the test suites
```
@@ -175,12 +168,6 @@ well.
For more info see `doc/user-guide.txt` or online at
https://github.com/linux-test-project/ltp/wiki/User-Guidelines.
-Network tests
--------------
-Network tests require certain setup, described in `testcases/network/README.md`
-(online at https://github.com/linux-test-project/ltp/tree/master/testcases/network)
-and `INSTALL`.
-
Developers corner
=================
@@ -188,7 +175,6 @@ Before you start you should read following documents:
* `doc/test-writing-guidelines.txt`
* `doc/build-system-guide.txt`
-* `doc/library-api-writing-guidelines.txt`
There is also a step-by-step tutorial:
@@ -198,7 +184,7 @@ If something is not covered there don't hesitate to ask on the LTP mailing
list. Also note that these documents are available online at:
* https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines
-* https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines
+* https://github.com/linux-test-project/ltp/wiki/Style-Guide
* https://github.com/linux-test-project/ltp/wiki/Build-System
* https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial
diff --git a/VERSION b/VERSION
index e2a9538cd..74a2a4f18 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-20210524
+20200120
diff --git a/android/Android.ltp.mk b/android/Android.ltp.mk
index 26421a7cf..18d119e58 100644
--- a/android/Android.ltp.mk
+++ b/android/Android.ltp.mk
@@ -41,14 +41,6 @@ module_prebuilt := testcases/data/ld01/f1.c
module_src_files := testcases/commands/ld/datafiles/f1.c
include $(ltp_build_prebuilt)
-module_prebuilt := testcases/data/rpc01/file.1
-module_src_files := testcases/network/rpc/basic_tests/rpc01/datafiles/file.1
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/rpc01/file.2
-module_src_files := testcases/network/rpc/basic_tests/rpc01/datafiles/file.2
-include $(ltp_build_prebuilt)
-
module_prebuilt := testcases/data/binfmt_misc02/file.extension
module_src_files := testcases/kernel/fs/binfmt_misc/datafiles/file.extension
include $(ltp_build_prebuilt)
@@ -153,24 +145,16 @@ module_prebuilt := testcases/data/file01/in.zip
module_src_files := testcases/commands/file/datafiles/in.zip
include $(ltp_build_prebuilt)
-module_prebuilt := testcases/data/ima_kexec/kexec.policy
-module_src_files := testcases/kernel/security/integrity/ima/datafiles/ima_kexec/kexec.policy
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ima_keys/keycheck.policy
-module_src_files := testcases/kernel/security/integrity/ima/datafiles/ima_keys/keycheck.policy
-include $(ltp_build_prebuilt)
-
module_prebuilt := testcases/data/ld01/main.c
module_src_files := testcases/commands/ld/datafiles/main.c
include $(ltp_build_prebuilt)
module_prebuilt := testcases/data/ima_policy/measure.policy
-module_src_files := testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy
+module_src_files := testcases/kernel/security/integrity/ima/datafiles/measure.policy
include $(ltp_build_prebuilt)
module_prebuilt := testcases/data/ima_policy/measure.policy-invalid
-module_src_files := testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy-invalid
+module_src_files := testcases/kernel/security/integrity/ima/datafiles/measure.policy-invalid
include $(ltp_build_prebuilt)
module_prebuilt := testcases/data/ld01/rd1.c
@@ -181,19 +165,7 @@ module_prebuilt := testcases/data/ld01/rf1.c
module_src_files := testcases/commands/ld/datafiles/rf1.c
include $(ltp_build_prebuilt)
-module_prebuilt := testcases/data/lvm/runfile.tpl
-module_src_files := testcases/misc/lvm/datafiles/runfile.tpl
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ima_selinux/selinux.policy
-module_src_files := testcases/kernel/security/integrity/ima/datafiles/ima_selinux/selinux.policy
-include $(ltp_build_prebuilt)
-
module_prebuilt := testcases/data/unzip01/test.zip
module_src_files := testcases/commands/unzip/datafiles/test.zip
include $(ltp_build_prebuilt)
-module_prebuilt := testcases/data/ima_keys/x509_ima.der
-module_src_files := testcases/kernel/security/integrity/ima/datafiles/ima_keys/x509_ima.der
-include $(ltp_build_prebuilt)
-
diff --git a/android/README.md b/android/README.md
index 47be077d1..4f55d3906 100644
--- a/android/README.md
+++ b/android/README.md
@@ -131,7 +131,6 @@ Update these files by running the script located at
external/ltp/android/tools/gen_android_build.sh. Instructions for the script
are in external/ltp/android/how-to-update.txt.
-
How do I enable or disable tests from VTS LTP?
----------------------------------------------
@@ -159,7 +158,6 @@ If the runtime of LTP changes significantly be sure to update the runtime-hint
and test-timeout parameters to VTS in
`test/vts-testcase/kernel/ltp/stable/AndroidTest.xml`.
-
How do I see recent VTS LTP results?
----------------------------------------------------------
@@ -169,7 +167,6 @@ done on internal devices.
Test results are also gathered by Linaro and may be seen
[here](https://qa-reports.linaro.org/android-lkft/).
-
Help! The external/ltp build is failing!
----------------------------------------
@@ -177,7 +174,6 @@ Try doing a make distclean inside of external/ltp. If an upgrade to LTP has
recently merged or the build files were recently updated, stale files in
external/ltp can cause build failures.
-
What outstanding issues exist?
------------------------------
@@ -186,7 +182,6 @@ The hotlist for LTP bugs is [ltp-todo](https://buganizer.corp.google.com/hotlist
When you begin working on an LTP bug please assign the bug to yourself so that
others know it is being worked on.
-
Testing x86_64
--------------
@@ -200,7 +195,6 @@ To run LTP tests for x86 platform, you can do:
* `atest vts_ltp_test_x86`
* `atest vts_ltp_test_x86_64`
-
Sending Fixes Upstream
----------------------
@@ -213,69 +207,9 @@ One easy way to do this is by using git format-patch and git send-email.
There is an #LTP channel on freenode. The maintainer Cyril Hrubis is there (his
nick is metan).
-
Merging Fixes
------------------------
When possible please merge fixes upstream first. Then cherrypick the change
onto aosp/master in external/ltp.
-
-Upgrade LTP to the latest upstream release
--------------------------------------------
-
-LTP has three releases per year. Keeping the current project aligned with the
-upstream development is important to get additional tests and bug-fixes.
-
-### Merge the changes
-
-AOSP external projects have a branch that track the changes to the upstream
-repository, called `aosp/upstream-master`.
-That branch is automatically updated with:
-
-`repo sync .`
-
-Create a new branch to work on the merge, that will contain the merge commit
-itself and conflicts resolutions:
-
-`repo start mymerge .`
-
-Find the commit for the latest LTP release, for example
-
-```
-$ git log --oneline aosp/upstream-master
-c00f96994 (aosp/upstream-master) openposix/Makefile: Use tabs instead of spaces
-a90664f8d Makefile: Use SPDX in Makefile
-0fb171f2b LTP 20210524
-```
-
-Force the creation of a merge commit (no fast-forward).
-
-`git merge <release commit> --no-ff`
-
-Fix all the merge conflicts ensuring that the project still builds, by
-periodically running:
-
-`git clean -dfx && make autotools && ./configure && make -j`
-
-### Update the Android build targets
-
-Building LTP with the Android build system requires the additional Android
-build configuration files mentioned above.
-A new LTP release may have disabled existing tests or enabled new ones, so the
-Android build configurations must be updated accordingly.
-This is done by the script `android/tools/gen_android_build.sh`:
-
-`git clean -dfx && android/tools/gen_android_build.sh && git clean -dfx && mma .`
-
-This command will possibly update the files `android/Android.ltp.mk`,
-`android/ltp_package_list.mk` and `gen.bp`.
-
-It's a good practice to create an explanatory commit message that presents the
-differences in the test suite.
-`android/tools/compare_ltp_projects.py` is a script that helps comparing the tests available in two different LTP folders.
-
-LTP_NEW=$ANDROID_BUILD_TOP/external/ltp
-LTP_OLD=/tmp/ltp-base
-git archive aosp/master | tar -x -C $LTP_OLD
-android/tools/compare_ltp_projects.py --ltp-new $LTP_NEW --ltp-old $LTP_OLD
diff --git a/android/include/config.h b/android/include/config.h
index 42a40ee9d..bb216469e 100644
--- a/android/include/config.h
+++ b/android/include/config.h
@@ -177,9 +177,6 @@
/* Define to 1 if you have the <linux/netlink.h> header file. */
#define HAVE_LINUX_NETLINK_H 1
-/* Define to 1 if you have the <linux/openat2.h> header file. */
-#define HAVE_LINUX_OPENAT2_H 1
-
/* Define to 1 if you have the <linux/ptrace.h> header file. */
#define HAVE_LINUX_PTRACE_H 1
@@ -252,9 +249,6 @@
/* Define to 1 if you have the `openat' function. */
#define HAVE_OPENAT 1
-/* Define to 1 if you have the `openat2' function. */
-/* #undef HAVE_OPENAT2 */
-
/* Define to 1 if you have the <openssl/sha.h> header file. */
#define HAVE_OPENSSL_SHA_H 1
@@ -277,7 +271,7 @@
#define HAVE_PREADV 1
/* Define to 1 if you have the `preadv2' function. */
-#define HAVE_PREADV2 1
+/* #undef HAVE_PREADV2 */
/* Define to 1 if you have the `profil' function. */
#define HAVE_PROFIL 1
@@ -289,10 +283,7 @@
#define HAVE_PWRITEV 1
/* Define to 1 if you have the `pwritev2' function. */
-#define HAVE_PWRITEV2 1
-
-/* Define to 1 if you have the `rand_r' function. */
-#define HAVE_RAND_R 1
+/* #undef HAVE_PWRITEV2 */
/* Define to 1 if you have the `readlinkat' function. */
#define HAVE_READLINKAT 1
@@ -306,15 +297,9 @@
/* Define to 1 if you have the `renameat2' function. */
#define HAVE_RENAMEAT2 1
-/* Define to 1 if you have the <rpc/rpc.h> header file. */
-/* #undef HAVE_RPC_RPC_H 1 */
-
/* Define to 1 if you have the `sched_getcpu' function. */
#define HAVE_SCHED_GETCPU 1
-/* Define to 1 if you have the `setns` function. */
-#define HAVE_SETNS 1
-
/* Define to 1 if you have the <selinux/selinux.h> header file. */
#define HAVE_SELINUX_SELINUX_H 1
@@ -348,12 +333,6 @@
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
-/* Define to 1 if the system has the type `struct af_alg_iv'. */
-#define HAVE_STRUCT_AF_ALG_IV 1
-
-/* Define to 1 if the system has the type `struct clone_args'. */
-#define HAVE_STRUCT_CLONE_ARGS 1
-
/* Define to 1 if the system has the type `struct acct_v3'. */
/* #undef HAVE_STRUCT_ACCT_V3 */
@@ -383,12 +362,6 @@
/* Define to 1 if the system has the type `struct iovec'. */
#define HAVE_STRUCT_IOVEC 1
-/* Define to 1 if the system has the type `struct ipc64_perm'. */
-#define HAVE_STRUCT_IPC64_PERM
-
-/* Define to 1 if you have the type `struct loop_config'. */
-#define HAVE_STRUCT_LOOP_CONFIG 1
-
/* Define to 1 if the system has the type `struct mmsghdr'. */
#define HAVE_STRUCT_MMSGHDR 1
@@ -407,24 +380,12 @@
/* Define to 1 if the system has the type `struct rlimit64'. */
#define HAVE_STRUCT_RLIMIT64 1
-/* Define to 1 if the system has the type `struct semid64_ds'. */
-#define HAVE_STRUCT_SEMID64_DS 1
-
-/* Define to 1 if the system has the type `struct semun'. */
-#define HAVE_STRUCT_SEMUN 1
-
-/* Define to 1 if the system has the type `struct shmid64_ds'. */
-#define HAVE_STRUCT_SHMID64_DS
-
/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */
#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
/* Define to 1 if `ssi_signo' is a member of `struct signalfd_siginfo'. */
#define HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO 1
-/* Define to 1 if the system has the type `struct sockaddr_alg'. */
-#define HAVE_STRUCT_SOCKADDR_ALG 1
-
/* Define to 1 if the system has the type `struct statx'. */
#define HAVE_STRUCT_STATX 1
@@ -465,21 +426,6 @@
/* Define to 1 if the system has the type `struct xt_entry_target'. */
#define HAVE_STRUCT_XT_ENTRY_TARGET 1
-/* Define to 1 if the system has the type `struct __kernel_itimerspec'. */
-#define HAVE_STRUCT___KERNEL_ITIMERSPEC 1
-
-/* Define to 1 if the system has the type `struct __kernel_old_timespec'. */
-#define HAVE_STRUCT___KERNEL_OLD_TIMESPEC 1
-
-/* Define to 1 if the system has the type `struct __kernel_timespec'. */
-#define HAVE_STRUCT___KERNEL_TIMESPEC 1
-
-/* Define to 1 if the system has the type `struct __kernel_timex'. */
-#define HAVE_STRUCT___KERNEL_TIMEX 1
-
-/* Define to 1 if the system has the type `struct __kernel_timex_timeval'. */
-#define HAVE_STRUCT___KERNEL_TIMEX_TIMEVAL 1
-
/* Define to 1 if you have the `syncfs' function. */
#define HAVE_SYNCFS 1
diff --git a/android/include/libaio.h b/android/include/libaio.h
index 59e0aa674..ff04b5ab5 100644
--- a/android/include/libaio.h
+++ b/android/include/libaio.h
@@ -6,7 +6,6 @@
// Instead override those definitions with the ones below.
#define __LINUX__AIO_ABI_H
-#include <errno.h>
#include <stdint.h>
#if __UINTPTR_MAX__ == UINT64_MAX
diff --git a/android/include/mqueue.h b/android/include/mqueue.h
index 509e7de78..e8d3c6317 100644
--- a/android/include/mqueue.h
+++ b/android/include/mqueue.h
@@ -3,8 +3,4 @@
#include <linux/mqueue.h>
-#ifndef mqd_t
-#define mqd_t __kernel_mqd_t
-#endif
-
#endif /* __MQUEUE_H */
diff --git a/android/ltp_package_list.mk b/android/ltp_package_list.mk
index 284c25c18..045e9f542 100644
--- a/android/ltp_package_list.mk
+++ b/android/ltp_package_list.mk
@@ -31,16 +31,13 @@ ltp_packages := \
ltp_add_key02 \
ltp_add_key03 \
ltp_add_key04 \
- ltp_add_key05 \
ltp_adjtimex01 \
ltp_adjtimex02 \
- ltp_adjtimex03 \
ltp_af_alg01 \
ltp_af_alg03 \
ltp_af_alg04 \
ltp_af_alg05 \
ltp_af_alg06 \
- ltp_af_alg07 \
ltp_aio-stress \
ltp_aio01 \
ltp_aio02 \
@@ -60,18 +57,12 @@ ltp_packages := \
ltp_bind01 \
ltp_bind02 \
ltp_bind03 \
- ltp_bind04 \
- ltp_bind05 \
- ltp_bind06 \
ltp_block_dev \
ltp_bpf_map01 \
ltp_bpf_prog01 \
ltp_bpf_prog02 \
ltp_bpf_prog03 \
- ltp_bpf_prog04 \
- ltp_bpf_prog05 \
ltp_brk01 \
- ltp_brk02 \
ltp_cacheflush01 \
ltp_can_filter \
ltp_can_rcv_own_msgs \
@@ -90,6 +81,8 @@ ltp_packages := \
ltp_cgroup_regression_getdelays \
ltp_cgroup_xattr \
ltp_chdir01 \
+ ltp_chdir02 \
+ ltp_chdir03 \
ltp_chdir04 \
ltp_check_keepcaps \
ltp_check_pe \
@@ -117,15 +110,11 @@ ltp_packages := \
ltp_clock_getres01 \
ltp_clock_gettime01 \
ltp_clock_gettime02 \
- ltp_clock_gettime03 \
- ltp_clock_gettime04 \
ltp_clock_nanosleep01 \
ltp_clock_nanosleep02 \
- ltp_clock_nanosleep03 \
- ltp_clock_nanosleep04 \
+ ltp_clock_nanosleep2_01 \
ltp_clock_settime01 \
ltp_clock_settime02 \
- ltp_clock_settime03 \
ltp_clone01 \
ltp_clone02 \
ltp_clone03 \
@@ -135,14 +124,10 @@ ltp_packages := \
ltp_clone07 \
ltp_clone08 \
ltp_clone09 \
- ltp_clone301 \
- ltp_clone302 \
ltp_close01 \
ltp_close02 \
- ltp_close_range01 \
- ltp_close_range02 \
+ ltp_close08 \
ltp_connect01 \
- ltp_connect02 \
ltp_copy_file_range01 \
ltp_copy_file_range02 \
ltp_copy_file_range03 \
@@ -277,7 +262,6 @@ ltp_packages := \
ltp_fallocate03 \
ltp_fallocate04 \
ltp_fallocate05 \
- ltp_fallocate06 \
ltp_fanotify01 \
ltp_fanotify02 \
ltp_fanotify03 \
@@ -293,10 +277,6 @@ ltp_packages := \
ltp_fanotify13 \
ltp_fanotify14 \
ltp_fanotify15 \
- ltp_fanotify16 \
- ltp_fanotify17 \
- ltp_fanotify18 \
- ltp_fanotify19 \
ltp_fanotify_child \
ltp_fanout01 \
ltp_fchdir01 \
@@ -393,18 +373,12 @@ ltp_packages := \
ltp_fcntl35_64 \
ltp_fcntl36 \
ltp_fcntl36_64 \
- ltp_fcntl37 \
- ltp_fcntl37_64 \
- ltp_fcntl38 \
- ltp_fcntl38_64 \
ltp_fdatasync01 \
ltp_fdatasync02 \
ltp_fdatasync03 \
ltp_fgetxattr01 \
ltp_fgetxattr02 \
ltp_fgetxattr03 \
- ltp_finit_module01 \
- ltp_finit_module02 \
ltp_flistxattr01 \
ltp_flistxattr02 \
ltp_flistxattr03 \
@@ -441,17 +415,8 @@ ltp_packages := \
ltp_fremovexattr02 \
ltp_fs_fill \
ltp_fs_perms \
- ltp_fsconfig01 \
- ltp_fsconfig02 \
ltp_fsetxattr01 \
ltp_fsetxattr02 \
- ltp_fsmount01 \
- ltp_fsmount02 \
- ltp_fsopen01 \
- ltp_fsopen02 \
- ltp_fspick01 \
- ltp_fspick02 \
- ltp_fsstress \
ltp_fstat02 \
ltp_fstat02_64 \
ltp_fstat03 \
@@ -487,6 +452,7 @@ ltp_packages := \
ltp_futex_wait04 \
ltp_futex_wait05 \
ltp_futex_wait_bitset01 \
+ ltp_futex_wait_bitset02 \
ltp_futex_wake01 \
ltp_futex_wake02 \
ltp_futex_wake04 \
@@ -526,7 +492,6 @@ ltp_packages := \
ltp_geny0 \
ltp_geny1 \
ltp_get_mempolicy01 \
- ltp_get_mempolicy02 \
ltp_get_robust_list01 \
ltp_getaddrinfo_01 \
ltp_getcpu01 \
@@ -623,8 +588,6 @@ ltp_packages := \
ltp_in \
ltp_in6_02 \
ltp_inh_capped \
- ltp_init_module01 \
- ltp_init_module02 \
ltp_inode01 \
ltp_inode02 \
ltp_inotify01 \
@@ -636,7 +599,6 @@ ltp_packages := \
ltp_inotify07 \
ltp_inotify08 \
ltp_inotify09 \
- ltp_inotify10 \
ltp_inotify_init1_01 \
ltp_inotify_init1_02 \
ltp_input01 \
@@ -647,12 +609,8 @@ ltp_packages := \
ltp_io_cancel01 \
ltp_io_destroy01 \
ltp_io_getevents01 \
- ltp_io_pgetevents01 \
- ltp_io_pgetevents02 \
ltp_io_setup01 \
ltp_io_submit01 \
- ltp_io_uring01 \
- ltp_io_uring02 \
ltp_iobw \
ltp_ioctl01 \
ltp_ioctl03 \
@@ -661,14 +619,6 @@ ltp_packages := \
ltp_ioctl06 \
ltp_ioctl07 \
ltp_ioctl08 \
- ltp_ioctl09 \
- ltp_ioctl_loop01 \
- ltp_ioctl_loop02 \
- ltp_ioctl_loop03 \
- ltp_ioctl_loop04 \
- ltp_ioctl_loop05 \
- ltp_ioctl_loop06 \
- ltp_ioctl_loop07 \
ltp_ioctl_ns01 \
ltp_ioctl_ns02 \
ltp_ioctl_ns03 \
@@ -676,7 +626,6 @@ ltp_packages := \
ltp_ioctl_ns05 \
ltp_ioctl_ns06 \
ltp_ioctl_ns07 \
- ltp_ioctl_sg01 \
ltp_iogen \
ltp_ioperm01 \
ltp_ioperm02 \
@@ -697,8 +646,10 @@ ltp_packages := \
ltp_keyctl06 \
ltp_keyctl07 \
ltp_keyctl08 \
+ ltp_kill01 \
ltp_kill02 \
ltp_kill03 \
+ ltp_kill04 \
ltp_kill06 \
ltp_kill08 \
ltp_kill09 \
@@ -763,8 +714,6 @@ ltp_packages := \
ltp_madvise08 \
ltp_madvise09 \
ltp_madvise10 \
- ltp_mallinfo01 \
- ltp_mallinfo02 \
ltp_max_map_count \
ltp_mbind01 \
ltp_mbind02 \
@@ -776,7 +725,9 @@ ltp_packages := \
ltp_mc_verify_opts \
ltp_mc_verify_opts_error \
ltp_meltdown \
+ ltp_mem01 \
ltp_mem02 \
+ ltp_mem03 \
ltp_mem_process \
ltp_membarrier01 \
ltp_memcg_process_stress \
@@ -798,8 +749,6 @@ ltp_packages := \
ltp_migrate_pages03 \
ltp_mincore01 \
ltp_mincore02 \
- ltp_mincore03 \
- ltp_mincore04 \
ltp_mkdir02 \
ltp_mkdir03 \
ltp_mkdir04 \
@@ -847,9 +796,6 @@ ltp_packages := \
ltp_mmap14 \
ltp_mmap15 \
ltp_mmap16 \
- ltp_mmap17 \
- ltp_mmap18 \
- ltp_mmap19 \
ltp_mmap2 \
ltp_mmap3 \
ltp_mmapstress01 \
@@ -874,8 +820,6 @@ ltp_packages := \
ltp_mount04 \
ltp_mount05 \
ltp_mount06 \
- ltp_move_mount01 \
- ltp_move_mount02 \
ltp_move_pages01 \
ltp_move_pages02 \
ltp_move_pages03 \
@@ -895,7 +839,6 @@ ltp_packages := \
ltp_mremap02 \
ltp_mremap03 \
ltp_mremap05 \
- ltp_msgget05 \
ltp_msync01 \
ltp_msync02 \
ltp_msync03 \
@@ -907,8 +850,6 @@ ltp_packages := \
ltp_munmap01 \
ltp_munmap02 \
ltp_munmap03 \
- ltp_name_to_handle_at01 \
- ltp_name_to_handle_at02 \
ltp_nanosleep01 \
ltp_nanosleep02 \
ltp_nanosleep04 \
@@ -959,16 +900,9 @@ ltp_packages := \
ltp_open12_child \
ltp_open13 \
ltp_open14 \
- ltp_open_by_handle_at01 \
- ltp_open_by_handle_at02 \
- ltp_open_tree01 \
- ltp_open_tree02 \
ltp_openat01 \
ltp_openat02_child \
ltp_openat03 \
- ltp_openat201 \
- ltp_openat202 \
- ltp_openat203 \
ltp_openfile \
ltp_overcommit_memory \
ltp_page01 \
@@ -983,9 +917,6 @@ ltp_packages := \
ltp_perf_event_open02 \
ltp_personality01 \
ltp_personality02 \
- ltp_pidfd_open01 \
- ltp_pidfd_open02 \
- ltp_pidfd_open03 \
ltp_pidfd_send_signal01 \
ltp_pidfd_send_signal02 \
ltp_pidfd_send_signal03 \
@@ -1002,12 +933,8 @@ ltp_packages := \
ltp_pipe09 \
ltp_pipe10 \
ltp_pipe11 \
- ltp_pipe12 \
- ltp_pipe13 \
ltp_pipe2_01 \
ltp_pipe2_02 \
- ltp_pipe2_02_child \
- ltp_pipe2_04 \
ltp_pivot_root01 \
ltp_pkey01 \
ltp_pm_get_sched_values \
@@ -1075,15 +1002,8 @@ ltp_packages := \
ltp_ptrace04 \
ltp_ptrace05 \
ltp_ptrace07 \
- ltp_ptrace08 \
- ltp_ptrace09 \
- ltp_ptrace10 \
- ltp_ptrace11 \
ltp_pty01 \
ltp_pty02 \
- ltp_pty03 \
- ltp_pty04 \
- ltp_pty05 \
ltp_pwrite01 \
ltp_pwrite01_64 \
ltp_pwrite02 \
@@ -1108,7 +1028,6 @@ ltp_packages := \
ltp_quotactl04 \
ltp_quotactl05 \
ltp_quotactl06 \
- ltp_quotactl07 \
ltp_random-access \
ltp_random-access-del-create \
ltp_read01 \
@@ -1133,7 +1052,6 @@ ltp_packages := \
ltp_reboot02 \
ltp_recv01 \
ltp_recvfrom01 \
- ltp_recvmmsg01 \
ltp_recvmsg01 \
ltp_recvmsg02 \
ltp_recvmsg03 \
@@ -1165,7 +1083,6 @@ ltp_packages := \
ltp_rmdir01 \
ltp_rmdir02 \
ltp_rmdir03 \
- ltp_route-change-netlink \
ltp_rt_sigaction01 \
ltp_rt_sigaction02 \
ltp_rt_sigaction03 \
@@ -1177,7 +1094,6 @@ ltp_packages := \
ltp_rt_sigtimedwait01 \
ltp_rt_tgsigqueueinfo01 \
ltp_rtc01 \
- ltp_rtc02 \
ltp_sbrk01 \
ltp_sbrk02 \
ltp_sbrk03 \
@@ -1193,6 +1109,7 @@ ltp_packages := \
ltp_sched_getattr01 \
ltp_sched_getattr02 \
ltp_sched_getparam01 \
+ ltp_sched_getparam02 \
ltp_sched_getparam03 \
ltp_sched_getscheduler01 \
ltp_sched_getscheduler02 \
@@ -1226,10 +1143,7 @@ ltp_packages := \
ltp_select02 \
ltp_select03 \
ltp_select04 \
- ltp_semctl08 \
- ltp_semctl09 \
ltp_send01 \
- ltp_send02 \
ltp_sendfile02 \
ltp_sendfile02_64 \
ltp_sendfile03 \
@@ -1247,12 +1161,9 @@ ltp_packages := \
ltp_sendfile09 \
ltp_sendfile09_64 \
ltp_sendmmsg01 \
- ltp_sendmmsg02 \
ltp_sendmsg01 \
- ltp_sendmsg03 \
ltp_sendto01 \
ltp_sendto02 \
- ltp_sendto03 \
ltp_set_mempolicy01 \
ltp_set_mempolicy02 \
ltp_set_mempolicy03 \
@@ -1359,9 +1270,6 @@ ltp_packages := \
ltp_setsockopt02 \
ltp_setsockopt03 \
ltp_setsockopt04 \
- ltp_setsockopt05 \
- ltp_setsockopt06 \
- ltp_setsockopt07 \
ltp_settimeofday01 \
ltp_settimeofday02 \
ltp_setuid01 \
@@ -1375,8 +1283,6 @@ ltp_packages := \
ltp_setxattr03 \
ltp_sgetmask01 \
ltp_shmctl05 \
- ltp_shmctl06 \
- ltp_shmctl08 \
ltp_sigaction01 \
ltp_sigaction02 \
ltp_sigaltstack01 \
@@ -1401,13 +1307,13 @@ ltp_packages := \
ltp_smack_notroot \
ltp_smack_set_socket_labels \
ltp_smount \
- ltp_snd_seq01 \
ltp_snd_timer01 \
ltp_socket01 \
ltp_socket02 \
ltp_socketcall01 \
ltp_socketcall02 \
ltp_socketcall03 \
+ ltp_socketcall04 \
ltp_socketpair01 \
ltp_socketpair02 \
ltp_sockioctl01 \
@@ -1463,6 +1369,8 @@ ltp_packages := \
ltp_symlink05 \
ltp_symlinkat01 \
ltp_sync01 \
+ ltp_sync02 \
+ ltp_sync03 \
ltp_sync_file_range01 \
ltp_sync_file_range02 \
ltp_syncfs01 \
@@ -1479,7 +1387,6 @@ ltp_packages := \
ltp_sysfs06 \
ltp_sysinfo01 \
ltp_sysinfo02 \
- ltp_sysinfo03 \
ltp_syslog11 \
ltp_syslog12 \
ltp_syslogtst \
@@ -1505,19 +1412,10 @@ ltp_packages := \
ltp_test17 \
ltp_test18 \
ltp_test19 \
- ltp_test20 \
- ltp_test22 \
- ltp_test_assert \
ltp_test_exec \
ltp_test_exec_child \
ltp_test_guarded_buf \
ltp_test_kconfig \
- ltp_test_kconfig01 \
- ltp_test_kconfig02 \
- ltp_test_macros01 \
- ltp_test_macros02 \
- ltp_test_macros03 \
- ltp_test_timer \
ltp_testcases_bin_add_ipv6addr \
ltp_testcases_bin_ar01.sh \
ltp_testcases_bin_arping01.sh \
@@ -1542,6 +1440,7 @@ ltp_packages := \
ltp_testcases_bin_busy_poll02.sh \
ltp_testcases_bin_busy_poll03.sh \
ltp_testcases_bin_busy_poll_lib.sh \
+ ltp_testcases_bin_can_run_tests.sh \
ltp_testcases_bin_cgroup_fj_common.sh \
ltp_testcases_bin_cgroup_fj_function.sh \
ltp_testcases_bin_cgroup_fj_stress.sh \
@@ -1560,10 +1459,9 @@ ltp_packages := \
ltp_testcases_bin_check_icmpv6_connectivity \
ltp_testcases_bin_check_netem \
ltp_testcases_bin_check_setkey \
- ltp_testcases_bin_cleanup_lvm.sh \
ltp_testcases_bin_clockdiff01.sh \
ltp_testcases_bin_cmdlib.sh \
- ltp_testcases_bin_cn_pec.sh \
+ ltp_testcases_bin_connector_test.sh \
ltp_testcases_bin_cp_tests.sh \
ltp_testcases_bin_cpio_tests.sh \
ltp_testcases_bin_cpuacct.sh \
@@ -1614,7 +1512,6 @@ ltp_packages := \
ltp_testcases_bin_find_portbundle \
ltp_testcases_bin_force_erase.sh \
ltp_testcases_bin_fork_freeze.sh \
- ltp_testcases_bin_fou01.sh \
ltp_testcases_bin_freeze_cancel.sh \
ltp_testcases_bin_freeze_kill_thaw.sh \
ltp_testcases_bin_freeze_move_thaw.sh \
@@ -1714,7 +1611,6 @@ ltp_packages := \
ltp_testcases_bin_ftrace_stress_ftrace_tracing_on.sh \
ltp_testcases_bin_ftrace_stress_test.sh \
ltp_testcases_bin_gdb01.sh \
- ltp_testcases_bin_generate_lvm_runfile.sh \
ltp_testcases_bin_geneve01.sh \
ltp_testcases_bin_geneve02.sh \
ltp_testcases_bin_get_ifname \
@@ -1762,11 +1658,8 @@ ltp_packages := \
ltp_testcases_bin_if-route-addlarge.sh \
ltp_testcases_bin_if-updown.sh \
ltp_testcases_bin_if4-addr-change.sh \
- ltp_testcases_bin_ima_kexec.sh \
- ltp_testcases_bin_ima_keys.sh \
ltp_testcases_bin_ima_measurements.sh \
ltp_testcases_bin_ima_policy.sh \
- ltp_testcases_bin_ima_selinux.sh \
ltp_testcases_bin_ima_setup.sh \
ltp_testcases_bin_ima_tpm.sh \
ltp_testcases_bin_ima_violations.sh \
@@ -1798,19 +1691,27 @@ ltp_packages := \
ltp_testcases_bin_mc_commo.sh \
ltp_testcases_bin_mc_member.sh \
ltp_testcases_bin_mc_opts.sh \
- ltp_testcases_bin_mcast-group-multiple-socket.sh \
- ltp_testcases_bin_mcast-group-same-group.sh \
- ltp_testcases_bin_mcast-group-single-socket.sh \
- ltp_testcases_bin_mcast-group-source-filter.sh \
+ ltp_testcases_bin_mcast-group-multiple-socket \
+ ltp_testcases_bin_mcast-group-same-group \
+ ltp_testcases_bin_mcast-group-single-socket \
+ ltp_testcases_bin_mcast-group-source-filter \
ltp_testcases_bin_mcast-lib.sh \
- ltp_testcases_bin_mcast-pktfld01.sh \
- ltp_testcases_bin_mcast-pktfld02.sh \
- ltp_testcases_bin_mcast-queryfld01.sh \
- ltp_testcases_bin_mcast-queryfld02.sh \
- ltp_testcases_bin_mcast-queryfld03.sh \
- ltp_testcases_bin_mcast-queryfld04.sh \
- ltp_testcases_bin_mcast-queryfld05.sh \
- ltp_testcases_bin_mcast-queryfld06.sh \
+ ltp_testcases_bin_mcast4-pktfld01 \
+ ltp_testcases_bin_mcast4-pktfld02 \
+ ltp_testcases_bin_mcast4-queryfld01 \
+ ltp_testcases_bin_mcast4-queryfld02 \
+ ltp_testcases_bin_mcast4-queryfld03 \
+ ltp_testcases_bin_mcast4-queryfld04 \
+ ltp_testcases_bin_mcast4-queryfld05 \
+ ltp_testcases_bin_mcast4-queryfld06 \
+ ltp_testcases_bin_mcast6-pktfld01 \
+ ltp_testcases_bin_mcast6-pktfld02 \
+ ltp_testcases_bin_mcast6-queryfld01 \
+ ltp_testcases_bin_mcast6-queryfld02 \
+ ltp_testcases_bin_mcast6-queryfld03 \
+ ltp_testcases_bin_mcast6-queryfld04 \
+ ltp_testcases_bin_mcast6-queryfld05 \
+ ltp_testcases_bin_mcast6-queryfld06 \
ltp_testcases_bin_memcg_control_test.sh \
ltp_testcases_bin_memcg_failcnt.sh \
ltp_testcases_bin_memcg_force_empty.sh \
@@ -1861,20 +1762,20 @@ ltp_packages := \
ltp_testcases_bin_pm_include.sh \
ltp_testcases_bin_pm_sched_domain.py \
ltp_testcases_bin_pm_sched_mc.py \
- ltp_testcases_bin_prepare_lvm.sh \
ltp_testcases_bin_quota_remount_test01.sh \
+ ltp_testcases_bin_rcp01.sh \
ltp_testcases_bin_rcu_torture.sh \
ltp_testcases_bin_remove_password.sh \
+ ltp_testcases_bin_rlogin01.sh \
ltp_testcases_bin_route-change-dst.sh \
ltp_testcases_bin_route-change-gw.sh \
ltp_testcases_bin_route-change-if.sh \
- ltp_testcases_bin_route-change-netlink-dst.sh \
- ltp_testcases_bin_route-change-netlink-gw.sh \
- ltp_testcases_bin_route-change-netlink-if.sh \
ltp_testcases_bin_route-lib.sh \
- ltp_testcases_bin_route-redirect.sh \
+ ltp_testcases_bin_route4-redirect \
ltp_testcases_bin_route4-rmmod \
+ ltp_testcases_bin_route6-redirect \
ltp_testcases_bin_route6-rmmod \
+ ltp_testcases_bin_rsh01.sh \
ltp_testcases_bin_run_capbounds.sh \
ltp_testcases_bin_run_cpuctl_latency_test.sh \
ltp_testcases_bin_run_cpuctl_stress_test.sh \
@@ -1883,6 +1784,7 @@ ltp_packages := \
ltp_testcases_bin_run_freezer.sh \
ltp_testcases_bin_run_io_throttle_test.sh \
ltp_testcases_bin_run_memctl_test.sh \
+ ltp_testcases_bin_run_pec_test \
ltp_testcases_bin_run_sched_cliserv.sh \
ltp_testcases_bin_runpwtests01.sh \
ltp_testcases_bin_runpwtests02.sh \
@@ -1902,7 +1804,6 @@ ltp_packages := \
ltp_testcases_bin_sctp_ipsec_vti.sh \
ltp_testcases_bin_sendfile01.sh \
ltp_testcases_bin_set_ipv4addr \
- ltp_testcases_bin_shell_pipe01.sh \
ltp_testcases_bin_sit01.sh \
ltp_testcases_bin_smack_common.sh \
ltp_testcases_bin_smack_file_access.sh \
@@ -2311,6 +2212,7 @@ ltp_packages := \
ltp_testcases_bin_udp_ipsec_vti.sh \
ltp_testcases_bin_unshare01.sh \
ltp_testcases_bin_unzip01.sh \
+ ltp_testcases_bin_utimensat_tests.sh \
ltp_testcases_bin_vfork_freeze.sh \
ltp_testcases_bin_virt_lib.sh \
ltp_testcases_bin_vlan01.sh \
@@ -2321,9 +2223,6 @@ ltp_packages := \
ltp_testcases_bin_vxlan02.sh \
ltp_testcases_bin_vxlan03.sh \
ltp_testcases_bin_vxlan04.sh \
- ltp_testcases_bin_wireguard01.sh \
- ltp_testcases_bin_wireguard02.sh \
- ltp_testcases_bin_wireguard_lib.sh \
ltp_testcases_bin_write_freezing.sh \
ltp_testcases_bin_xinetd_tests.sh \
ltp_testcases_bin_zram01.sh \
@@ -2355,22 +2254,15 @@ ltp_packages := \
ltp_testcases_data_file01_in.txt \
ltp_testcases_data_file01_in.wav \
ltp_testcases_data_file01_in.zip \
- ltp_testcases_data_ima_kexec_kexec.policy \
- ltp_testcases_data_ima_keys_keycheck.policy \
- ltp_testcases_data_ima_keys_x509_ima.der \
ltp_testcases_data_ima_policy_measure.policy \
ltp_testcases_data_ima_policy_measure.policy-invalid \
- ltp_testcases_data_ima_selinux_selinux.policy \
ltp_testcases_data_ld01_d1.c \
ltp_testcases_data_ld01_f1.c \
ltp_testcases_data_ld01_main.c \
ltp_testcases_data_ld01_rd1.c \
ltp_testcases_data_ld01_rf1.c \
- ltp_testcases_data_lvm_runfile.tpl \
ltp_testcases_data_mc_member_ManyGroups \
ltp_testcases_data_mc_member_TooManyGroups \
- ltp_testcases_data_rpc01_file.1 \
- ltp_testcases_data_rpc01_file.2 \
ltp_testcases_data_stress_floppy_dd_file \
ltp_testcases_data_stress_floppy_dumpdir_1K_file \
ltp_testcases_data_unzip01_dir.out \
@@ -2385,11 +2277,10 @@ ltp_packages := \
ltp_thp01 \
ltp_thp02 \
ltp_thp03 \
- ltp_thp04 \
ltp_time-schedule \
ltp_time01 \
+ ltp_time02 \
ltp_timed_forkbomb \
- ltp_timens01 \
ltp_timer_create01 \
ltp_timer_create02 \
ltp_timer_create03 \
@@ -2399,15 +2290,12 @@ ltp_packages := \
ltp_timer_gettime01 \
ltp_timer_settime01 \
ltp_timer_settime02 \
- ltp_timer_settime03 \
ltp_timerfd01 \
ltp_timerfd02 \
ltp_timerfd03 \
- ltp_timerfd04 \
ltp_timerfd_create01 \
ltp_timerfd_gettime01 \
ltp_timerfd_settime01 \
- ltp_timerfd_settime02 \
ltp_times01 \
ltp_times03 \
ltp_tkill01 \
@@ -2423,17 +2311,16 @@ ltp_packages := \
ltp_tpci \
ltp_trace_sched \
ltp_trerrno \
+ ltp_truncate01 \
+ ltp_truncate01_64 \
ltp_truncate02 \
ltp_truncate02_64 \
ltp_truncate03 \
ltp_truncate03_64 \
- ltp_tst_bool_expr \
ltp_tst_brk \
ltp_tst_brkm \
ltp_tst_capability01 \
ltp_tst_capability02 \
- ltp_tst_cgroup01 \
- ltp_tst_cgroup02 \
ltp_tst_check_drivers \
ltp_tst_checkpoint \
ltp_tst_checkpoint_wait_timeout \
@@ -2448,9 +2335,6 @@ ltp_packages := \
ltp_tst_fs_fill_hardlinks \
ltp_tst_fs_fill_subdirs \
ltp_tst_fs_has_free \
- ltp_tst_fuzzy_sync01 \
- ltp_tst_fuzzy_sync02 \
- ltp_tst_get_median \
ltp_tst_get_unused_port \
ltp_tst_getconf \
ltp_tst_kvcmp \
@@ -2489,6 +2373,7 @@ ltp_packages := \
ltp_umount2_03 \
ltp_uname01 \
ltp_uname02 \
+ ltp_uname03 \
ltp_uname04 \
ltp_unlink05 \
ltp_unlink07 \
@@ -2522,7 +2407,6 @@ ltp_packages := \
ltp_vmsplice01 \
ltp_vmsplice02 \
ltp_vmsplice03 \
- ltp_vmsplice04 \
ltp_wait01 \
ltp_wait02 \
ltp_wait401 \
@@ -2550,7 +2434,6 @@ ltp_packages := \
ltp_writetest \
ltp_writev01 \
ltp_writev02 \
- ltp_writev03 \
ltp_writev05 \
ltp_writev06 \
ltp_writev07 \
diff --git a/android/tools/Dockerfile b/android/tools/Dockerfile
index e771156ef..7f6a78148 100644
--- a/android/tools/Dockerfile
+++ b/android/tools/Dockerfile
@@ -1,10 +1,10 @@
-FROM ubuntu:20.04
+FROM ubuntu:18.04
ARG userid
ARG groupid
ARG username
ARG ltproot
-RUN apt-get update && apt-get install -y python autoconf build-essential libssl-dev pkgconf
+RUN apt-get update && apt-get install -y python autoconf build-essential libssl-dev
# Set up the user so that files are owned by the proper user
RUN groupadd -g $groupid $username \
diff --git a/android/tools/android_build_generator.py b/android/tools/android_build_generator.py
index 9d674059b..f6615992f 100644
--- a/android/tools/android_build_generator.py
+++ b/android/tools/android_build_generator.py
@@ -24,14 +24,14 @@
import argparse
import fileinput
import json
-import os
+import os.path
import re
import make_parser
import make_install_parser
-MAKE_DRY_RUN_FILE_NAME = os.path.join('dump', 'make_dry_run.dump')
-MAKE_INSTALL_DRY_RUN_FILE_NAME = os.path.join('dump', 'make_install_dry_run.dump')
+MAKE_DRY_RUN_FILE_NAME = 'make_dry_run.dump'
+MAKE_INSTALL_DRY_RUN_FILE_NAME = 'make_install_dry_run.dump'
DISABLED_TESTS_FILE_NAME = 'disabled_tests.txt'
DISABLED_LIBS_FILE_NAME = 'disabled_libs.txt'
DISABLED_CFLAGS_FILE_NAME = 'disabled_cflags.txt'
@@ -110,8 +110,8 @@ class BuildGenerator(object):
'''
base_name = os.path.basename(cc_target)
if base_name in ltp_names_used:
- print('ERROR: base name {} of cc_target {} already used. Skipping...'.format(
- base_name, cc_target))
+ print 'ERROR: base name {} of cc_target {} already used. Skipping...'.format(
+ base_name, cc_target)
return
ltp_names_used.add(base_name)
@@ -135,7 +135,7 @@ class BuildGenerator(object):
target_bp.append(' srcs: ["%s"],' % list(local_src_files)[0])
else:
target_bp.append(' srcs: [')
- for src in sorted(local_src_files):
+ for src in local_src_files:
target_bp.append(' "%s",' % src)
target_bp.append(' ],')
@@ -143,7 +143,7 @@ class BuildGenerator(object):
target_bp.append(' cflags: ["%s"],' % list(local_cflags)[0])
elif len(local_cflags) > 1:
target_bp.append(' cflags: [')
- for cflag in sorted(local_cflags):
+ for cflag in local_cflags:
target_bp.append(' "%s",' % cflag)
target_bp.append(' ],')
@@ -151,7 +151,7 @@ class BuildGenerator(object):
target_bp.append(' local_include_dirs: ["%s"],' % list(local_c_includes)[0])
elif len(local_c_includes) > 1:
target_bp.append(' local_include_dirs: [')
- for d in sorted(local_c_includes):
+ for d in local_c_includes:
target_bp.append(' "%s",' % d)
target_bp.append(' ],')
@@ -163,7 +163,7 @@ class BuildGenerator(object):
target_bp.append(' static_libs: ["libltp_%s"],' % list(static_libraries)[0])
elif len(static_libraries) > 1:
target_bp.append(' static_libs: [')
- for lib in sorted(static_libraries):
+ for lib in static_libraries:
target_bp.append(' "libltp_%s",' % lib)
target_bp.append(' ],')
@@ -175,7 +175,7 @@ class BuildGenerator(object):
target_bp.append(' shared_libs: ["lib%s"],' % list(shared_libraries)[0])
elif len(shared_libraries) > 1:
target_bp.append(' shared_libs: [')
- for lib in sorted(shared_libraries):
+ for lib in shared_libraries:
target_bp.append(' "lib%s",' % lib)
target_bp.append(' ],')
@@ -335,7 +335,7 @@ class BuildGenerator(object):
for i in cc_libraries:
if len(set(cc_libraries[i]).intersection(disabled_libs)) > 0:
if not os.path.basename(i) in disabled_tests:
- print(os.path.basename(i))
+ print os.path.basename(i)
print("Disabled_cflag tests: Test cases listed here are"
"suggested to be disabled since they require a disabled cflag. "
@@ -346,7 +346,7 @@ class BuildGenerator(object):
idx = module_name.find('_')
if idx > 0:
module_name = module_name[:idx]
- print(module_name)
+ print module_name
# Remove include directories that don't exist. They're an error in
# Soong.
@@ -463,7 +463,7 @@ class BuildGenerator(object):
output_path: string
'''
with open(output_path, 'a') as f:
- for k in sorted(self._bp_result.keys()):
+ for k in sorted(self._bp_result.iterkeys()):
f.write('\n'.join(self._bp_result[k]))
f.write('\n')
self._bp_result = {}
@@ -475,7 +475,7 @@ class BuildGenerator(object):
output_path: string
'''
with open(output_path, 'a') as f:
- for k in sorted(self._mk_result.keys()):
+ for k in sorted(self._mk_result.iterkeys()):
f.write('\n'.join(self._mk_result[k]))
f.write('\n')
self._mk_result = {}
@@ -548,10 +548,10 @@ def main():
unused_cflags_targs = generator.GetUnusedCustomCFlagsTargets()
if unused_cflags_targs:
- print('NOTE: Tests had custom cflags, but were never seen: {}'.format(
- ', '.join(unused_cflags_targs)))
+ print 'NOTE: Tests had custom cflags, but were never seen: {}'.format(
+ ', '.join(unused_cflags_targs))
- print('Finished!')
+ print 'Finished!'
if __name__ == '__main__':
diff --git a/android/tools/check_success_build.py b/android/tools/check_success_build.py
index a35532565..71756a6ad 100644
--- a/android/tools/check_success_build.py
+++ b/android/tools/check_success_build.py
@@ -80,7 +80,7 @@ class Module(object):
}[self._type]()
if not success:
- print(" Module build failed: " + os.path.basename(self._path))
+ print " Module build failed: " + os.path.basename(self._path)
return success
def IsBuildSuccessModuleTestname(self):
@@ -111,8 +111,8 @@ class Module(object):
True if success
"""
# TODO(yuexima) check lib build
- print("Checking module_lib is not supported now, " + \
- "assuming build success: " + self._path)
+ print "Checking module_lib is not supported now, " + \
+ "assuming build success: " + self._path
return True
def IsBuildSuccessModulePrebuilt(self):
@@ -171,14 +171,14 @@ class LtpModuleChecker(object):
module.IsBuildSuccess(self._module_counts)
]
- print("module type counts:")
- print(self._module_counts)
+ print "module type counts:"
+ print self._module_counts
- print(str(len(modules_succeed)) + \
+ print str(len(modules_succeed)) + \
" of " + str(sum([self._module_counts[i]
for i in self._module_counts])) + \
- " modules were succesfully built.")
- print("--Check complete.")
+ " modules were succesfully built."
+ print "--Check complete."
def main():
diff --git a/android/tools/cki_coverage.py b/android/tools/cki_coverage.py
index 9a0c8c9a6..6590ee38e 100755
--- a/android/tools/cki_coverage.py
+++ b/android/tools/cki_coverage.py
@@ -37,7 +37,7 @@ import xml.etree.ElementTree as ET
import subprocess
if "ANDROID_BUILD_TOP" not in os.environ:
- print("Please set up your Android build environment by running "
+ print ("Please set up your Android build environment by running "
"\". build/envsetup.sh\" and \"lunch\".")
sys.exit(-1)
@@ -341,14 +341,14 @@ class CKI_Coverage(object):
count = 0
uncovered = 0
- print("")
- print(" Covered Syscalls")
+ print ""
+ print " Covered Syscalls"
for syscall in self.cki_syscalls:
if (len(self.syscall_tests[syscall["name"]]) -
len(self.disabled_tests[syscall["name"]]) <= 0):
continue
if not count % 20:
- print("%25s Disabled Enabled arm64 arm x86_64 x86 -----------" %
+ print ("%25s Disabled Enabled arm64 arm x86_64 x86 -----------" %
"-------------")
enabled = (len(self.syscall_tests[syscall["name"]]) -
len(self.disabled_tests[syscall["name"]]))
@@ -366,14 +366,14 @@ class CKI_Coverage(object):
count += 1
count = 0
- print("\n")
- print(" Uncovered Syscalls")
+ print "\n"
+ print " Uncovered Syscalls"
for syscall in self.cki_syscalls:
if (len(self.syscall_tests[syscall["name"]]) -
len(self.disabled_tests[syscall["name"]]) > 0):
continue
if not count % 20:
- print("%25s Disabled Enabled arm64 arm x86_64 x86 -----------" %
+ print ("%25s Disabled Enabled arm64 arm x86_64 x86 -----------" %
"-------------")
enabled = (len(self.syscall_tests[syscall["name"]]) -
len(self.disabled_tests[syscall["name"]]))
@@ -391,8 +391,8 @@ class CKI_Coverage(object):
uncovered += 1
count += 1
- print("")
- print("Total uncovered syscalls: %s out of %s" %
+ print ""
+ print ("Total uncovered syscalls: %s out of %s" %
(uncovered, len(self.cki_syscalls)))
def output_summary(self):
@@ -411,9 +411,9 @@ class CKI_Coverage(object):
uncovered_with_test += 1
else:
uncovered_without_test += 1
- print("arch, cki syscalls, uncovered with disabled test(s), "
+ print ("arch, cki syscalls, uncovered with disabled test(s), "
"uncovered with no tests, total uncovered")
- print("%s, %s, %s, %s, %s" % (self._arch, len(self.cki_syscalls),
+ print ("%s, %s, %s, %s, %s" % (self._arch, len(self.cki_syscalls),
uncovered_with_test, uncovered_without_test,
uncovered_with_test + uncovered_without_test))
@@ -436,7 +436,7 @@ class CKI_Coverage(object):
for s in cki.syscalls:
if s["name"] in CKI_BLACKLIST:
if error_on_match:
- print("Syscall %s found in both bionic CKI and blacklist!" % s["name"])
+ print "Syscall %s found in both bionic CKI and blacklist!" % s["name"]
sys.exit()
else:
unlisted_syscalls.append(s)
@@ -542,13 +542,13 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.arch is not None and args.arch not in gensyscalls.all_arches:
- print("Arch must be one of the following:")
- print(gensyscalls.all_arches)
+ print "Arch must be one of the following:"
+ print gensyscalls.all_arches
exit(-1)
if args.k:
minversion = "4.9"
- print("Checking kernel version %s" % minversion)
+ print "Checking kernel version %s" % minversion
minversion = "?h=v" + minversion
unistd_h_url += stable_url + unistd_h + minversion
arm64_unistd32_h_url += stable_url + arm64_unistd32_h + minversion
@@ -579,7 +579,7 @@ if __name__ == "__main__":
if args.l:
for syscall in cki.syscalls:
if args.arch is None or syscall[args.arch]:
- print(syscall["name"])
+ print syscall["name"]
exit(0)
cki_cov.load_ltp_tests()
@@ -589,11 +589,11 @@ if __name__ == "__main__":
beta_string = ("*** WARNING: This script is still in development and may\n"
"*** report both false positives and negatives.")
- print(beta_string)
+ print beta_string
if args.s:
cki_cov.output_summary()
exit(0)
cki_cov.output_results()
- print(beta_string)
+ print beta_string
diff --git a/android/tools/compare_ltp_projects.py b/android/tools/compare_ltp_projects.py
index e5a7d46db..a2bc0458f 100755
--- a/android/tools/compare_ltp_projects.py
+++ b/android/tools/compare_ltp_projects.py
@@ -48,7 +48,7 @@ def scan_tests(ltp_root, suite):
runtest_dir = ltp_root + os.path.sep + 'runtest'
test_suiteFile = runtest_dir + os.path.sep + suite
if not os.path.isfile(test_suiteFile):
- print('No tests defined for suite {}',format(suite))
+ print ('No tests defined for suite {}',format(suite))
return tests
with open(test_suiteFile) as f:
@@ -73,7 +73,7 @@ def scan_test_suites(ltp_root, scenario):
runtest_dir = ltp_root + os.path.sep + 'runtest'
if not os.path.isdir(runtest_dir):
- print('Invalid ltp_root {}, runtest directory doesnt exist'.format(ltp_root))
+ print ('Invalid ltp_root {}, runtest directory doesnt exist'.format(ltp_root))
sys.exit(2)
test_suites = []
@@ -111,12 +111,12 @@ def scan_ltp(ltp_root, scenario):
'''
if not os.path.isdir(ltp_root):
- print('ltp_root {} does not exist'.format(ltp_root))
+ print ('ltp_root {} does not exist'.format(ltp_root))
sys.exit(1)
test_suites = scan_test_suites(ltp_root, scenario)
if not test_suites:
- print('No Testsuites found for scenario {}'.format(scenario))
+ print ('No Testsuites found for scenario {}'.format(scenario))
sys.exit(3)
ltp_tests = {}
@@ -169,35 +169,31 @@ def show_diff(ltp_tests_1, ltp_tests_2):
# total rows we have to print
total_rows = max(len(deleted_test_suites), len(added_test_suites))
- deleted_text = 'Deleted ({})'.format(len(deleted_test_suites))
- added_text = 'Added ({})'.format(len(added_test_suites))
if total_rows > 0:
- print('{:*^{len}}'.format(' Tests Suites ', len=width*2+2))
- print('{:>{len}} {:>{len}}'.format(deleted_text, added_text, len=width))
+ print ('{:*^{len}}'.format(' Tests Suites ', len=width*2+2))
+ print ('{:>{len}} {:>{len}}'.format('Deleted', 'Added', len=width))
for i in range(total_rows):
- print('{:>{len}} {:>{len}}'.format('' if i >= len(deleted_test_suites) else str(deleted_test_suites[i]),
+ print ('{:>{len}} {:>{len}}'.format('' if i >= len(deleted_test_suites) else str(deleted_test_suites[i]),
'' if i >= len(added_test_suites) else str(added_test_suites[i]), len=width))
print('')
# total rows we have to print
total_rows = max(len(deleted_tests), len(added_tests))
- deleted_text = 'Deleted ({})'.format(len(deleted_tests))
- added_text = 'Added ({})'.format(len(added_tests))
if total_rows:
- print('{:*^{len}}'.format(' Tests ', len=width*2+2))
- print('{:>{len}} {:>{len}}'.format(deleted_text, added_text, len=width))
+ print ('{:*^{len}}'.format(' Tests ', len=width*2+2))
+ print ('{:>{len}} {:>{len}}'.format('Deleted', 'Added', len=width))
for i in range(total_rows):
- print('{:>{len}} {:>{len}}'.format('' if i >= len(deleted_tests) else str(deleted_tests[i]),
+ print ('{:>{len}} {:>{len}}'.format('' if i >= len(deleted_tests) else str(deleted_tests[i]),
'' if i >= len(added_tests) else str(added_tests[i]), len=width))
def main():
arg_parser = argparse.ArgumentParser(
description='Diff 2 LTP projects for supported test cases')
- arg_parser.add_argument('--ltp-old',
- dest='ltp_old',
+ arg_parser.add_argument('--ltp-root1',
+ dest='ltp_root1',
required=True,
help="LTP Root Directory before merge")
- arg_parser.add_argument('--ltp-new',
- dest='ltp_new',
+ arg_parser.add_argument('--ltp-root2',
+ dest='ltp_root2',
required=True,
help="LTP Root Directory after merge")
arg_parser.add_argument('--scenario', default=None,
@@ -205,8 +201,8 @@ def main():
help="LTP scenario to list tests for")
args = arg_parser.parse_args()
- ltp_tests1 = scan_ltp(args.ltp_old, args.scenario)
- ltp_tests2 = scan_ltp(args.ltp_new, args.scenario)
+ ltp_tests1 = scan_ltp(args.ltp_root1, args.scenario)
+ ltp_tests2 = scan_ltp(args.ltp_root2, args.scenario)
show_diff(ltp_tests1, ltp_tests2)
if __name__ == '__main__':
diff --git a/android/tools/custom_cflags.json b/android/tools/custom_cflags.json
index cbded5c04..34cd79919 100644
--- a/android/tools/custom_cflags.json
+++ b/android/tools/custom_cflags.json
@@ -1,5 +1,4 @@
{
"testcases/kernel/syscalls/getcwd/getcwd02": ["-U_FORTIFY_SOURCE"],
- "testcases/cve/stack_clash": ["-Wno-infinite-recursion"],
- "testcases/kernel/syscalls/bpf/bpf_prog05": ["-Wno-shift-count-overflow"]
+ "testcases/cve/stack_clash": ["-Wno-infinite-recursion"]
}
diff --git a/android/tools/disabled_tests.txt b/android/tools/disabled_tests.txt
index 16459fedc..2a950da1e 100644
--- a/android/tools/disabled_tests.txt
+++ b/android/tools/disabled_tests.txt
@@ -13,8 +13,6 @@ mallopt01
profil01
stime01
stime02
-## Uses SHM_LOCKED
-shmctl07
# Test SysV IPC, which is not allowed in Android kernels.
@@ -366,6 +364,9 @@ in6_01
# bionic doesn't expose resolver routines to the public
mc_gethost
+# Actually two conflicting tests with the same name (upstream bug)
+fsstress
+
# Require mkfifo
gf12
gf13
@@ -476,119 +477,9 @@ testcases/bin/fs_bind/regression/test03
# Depends on CONFIG_EXT4_FS_ENCRYPTION which is not required on Android.
# b/123523766
statx05
-# Depends on exportfs (NFS not supported on Android).
-# b/191236106
-statx07
# Disabled from LTP20190517
# b/136666217
# Needs pthread_cancel() and friends
af_alg02
-# Depends on DNOTIFY (not enabled in Android).
-# b/191236494
-fcntl38
-fcntl38_64
-
-# Depends on HDLC line discipline (not enabled on Android).
-# b/191224903
-pty05
-
-# Disable RPC tests as not available in Android.
-rpc01.sh
-rpc_lib.sh
-rpc_test.sh
-rpcinfo01.sh
-rup01.sh
-rusers01.sh
-rpc_auth_destroy
-rpc_authnone_create
-rpc_authunix_create
-rpc_authunix_create_default
-rpc_callrpc
-rpc_callrpc_dataint
-rpc_callrpc_performance
-rpc_callrpc_scalability
-rpc_callrpc_stress
-rpc_cleaner
-rpc_clnt_broadcast
-rpc_clnt_broadcast_complex
-rpc_clnt_broadcast_dataint
-rpc_clnt_broadcast_performance
-rpc_clnt_broadcast_scalability
-rpc_clnt_broadcast_stress
-rpc_clnt_call
-rpc_clnt_call_complex
-rpc_clnt_call_dataint
-rpc_clnt_call_performance
-rpc_clnt_call_scalability
-rpc_clnt_call_stress
-rpc_clnt_control
-rpc_clnt_control_dataint
-rpc_clnt_create
-rpc_clnt_create_stress
-rpc_clnt_destroy
-rpc_clnt_destroy_stress
-rpc_clnt_freeres
-rpc_clnt_geterr
-rpc_clnt_pcreateerror
-rpc_clnt_perrno
-rpc_clnt_perror
-rpc_clnt_spcreateerror
-rpc_clnt_sperrno
-rpc_clnt_sperror
-rpc_clntraw_create
-rpc_clntraw_create_complex
-rpc_clntraw_create_performance
-rpc_clnttcp_create
-rpc_clnttcp_create_limits
-rpc_clnttcp_create_performance
-rpc_clnttcp_create_stress
-rpc_clntudp_bufcreate
-rpc_clntudp_bufcreate_limits
-rpc_clntudp_create
-rpc_clntudp_create_performance
-rpc_clntudp_create_stress
-rpc_get_myaddress
-rpc_pmap_getmaps
-rpc_pmap_getport
-rpc_pmap_rmtcall
-rpc_pmap_rmtcall_performance
-rpc_pmap_rmtcall_stress
-rpc_pmap_set
-rpc_pmap_unset
-rpc_svc_1
-rpc_svc_2
-rpc_svc_destroy
-rpc_svc_destroy_stress
-rpc_svc_freeargs
-rpc_svc_freeargs_svc
-rpc_svc_getargs
-rpc_svc_getargs_client
-rpc_svc_getargs_dataint
-rpc_svc_getcaller
-rpc_svc_register
-rpc_svc_sendreply
-rpc_svc_sendreply_client
-rpc_svc_unregister
-rpc_svcerr_auth
-rpc_svcerr_noproc
-rpc_svcerr_noprog
-rpc_svcerr_progvers
-rpc_svcerr_systemerr
-rpc_svcerr_weakauth
-rpc_svcfd_create
-rpc_svcfd_create_limits
-rpc_svcraw_create
-rpc_svcraw_create_performance
-rpc_svctcp_create
-rpc_svctcp_create_limits
-rpc_svctcp_create_performance
-rpc_svctcp_create_stress
-rpc_svcudp_bufcreate
-rpc_svcudp_bufcreate_limits
-rpc_svcudp_create
-rpc_svcudp_create_performance
-rpc_svcudp_create_stress
-rpc_xprt_register
-rpc_xprt_unregister
diff --git a/android/tools/dump_make_dryrun.sh b/android/tools/dump_make_dryrun.sh
index 1c7f0d87c..086fe1075 100755
--- a/android/tools/dump_make_dryrun.sh
+++ b/android/tools/dump_make_dryrun.sh
@@ -19,39 +19,23 @@ set -e
[ -z $TOOLS_DIR ] && TOOLS_DIR=$(realpath $(dirname $0))
[ -z $LTP_ROOT ] && LTP_ROOT=$(realpath $TOOLS_DIR/../..)
-[ -z $TOOLS_DUMP_DIR ] && TOOLS_DUMP_DIR=$(realpath $TOOLS_DIR/dump)
-
-mkdir -p $TOOLS_DUMP_DIR
if ! [ -f $LTP_ROOT/include/config.h ]; then
- echo ""
echo "LTP has not been configured."
- echo ""
- echo "Executing \"cd $LTP_ROOT; make autotools\""
- (cd $LTP_ROOT; make autotools > /dev/null)
- echo ""
- echo "Executing \"cd $LTP_ROOT; ./configure\""
- (cd $LTP_ROOT; ./configure > /dev/null)
-
- OUTPUT=$TOOLS_DUMP_DIR/config.h.dump
- cat $LTP_ROOT/include/config.h > $OUTPUT
+ echo "Executing \"cd $LTP_ROOT; make autotools; ./configure\""
+ (cd $LTP_ROOT; make autotools)
+ (cd $LTP_ROOT; ./configure)
fi
-MAKE_FLAGS="-j1 --dry-run V=1"
-
-OUTPUT=$TOOLS_DUMP_DIR/make_dry_run.dump
-CMD="make $MAKE_FLAGS -C $LTP_ROOT/testcases"
-echo ""
-echo "Dumping output to $OUTPUT from command '$CMD'"
-$CMD > $OUTPUT
+OUTPUT=$TOOLS_DIR/make_dry_run.dump
+echo "Dumping output to $OUTPUT from command 'make -C $LTP_ROOT/testcases --dry-run'"
+make -j1 -C $LTP_ROOT/testcases --dry-run > $OUTPUT
-OUTPUT=$TOOLS_DUMP_DIR/make_install_dry_run.dump
-CMD="make $MAKE_FLAGS -C $LTP_ROOT/testcases install"
-echo ""
-echo "Dumping output to $OUTPUT from command '$CMD'"
-$CMD > $OUTPUT
+OUTPUT=$TOOLS_DIR/make_install_dry_run.dump
+echo "Dumping output to $OUTPUT from command 'make -C $LTP_ROOT/testcases install --dry-run'"
+make -j1 -C $LTP_ROOT/testcases install --dry-run > $OUTPUT
-echo ""
echo "Distclean $LTP_ROOT ..."
-make -C $LTP_ROOT distclean > /dev/null
+make -C $LTP_ROOT distclean
+echo "Finished!"
diff --git a/android/tools/gen_android_build.sh b/android/tools/gen_android_build.sh
index 2b1486581..763c925de 100755
--- a/android/tools/gen_android_build.sh
+++ b/android/tools/gen_android_build.sh
@@ -18,7 +18,6 @@
set -e
TOOLS_DIR=$(realpath $(dirname $0))
-TOOLS_DUMP_DIR=$TOOLS_DIR/dump
LTP_ANDROID_DIR=$(realpath $TOOLS_DIR/..)
LTP_ROOT=$(realpath $LTP_ANDROID_DIR/..)
CUSTOM_CFLAGS_PATH=$TOOLS_DIR/custom_cflags.json
@@ -42,7 +41,7 @@ case $1 in
;;
esac
-if ! [ -f $TOOLS_DUMP_DIR/make_dry_run.dump ]; then
+if ! [ -f $TOOLS_DIR/make_dry_run.dump ]; then
DOCKER_USERNAME=$(id -un)
DOCKER_UID=$(id -u)
DOCKER_GID=$(id -g)
@@ -71,10 +70,6 @@ echo "" >> $OUTPUT_BP
echo "// This file is autogenerated by $(basename $0)" >> $OUTPUT_BP
echo "" >> $OUTPUT_BP
-echo ""
-echo "Parsing LTP make dry_run output..."
-CMD="python android_build_generator.py --ltp_root $LTP_ROOT --output_mk_path $OUTPUT_MK \
+python android_build_generator.py --ltp_root $LTP_ROOT --output_mk_path $OUTPUT_MK \
--output_bp_path $OUTPUT_BP --output_plist_path $OUTPUT_PLIST \
- --custom_cflags_file $CUSTOM_CFLAGS_PATH"
-echo $CMD
-$CMD
+ --custom_cflags_file $CUSTOM_CFLAGS_PATH
diff --git a/android/tools/make_install_parser.py b/android/tools/make_install_parser.py
index bc94d7e76..f339e1db0 100644
--- a/android/tools/make_install_parser.py
+++ b/android/tools/make_install_parser.py
@@ -47,7 +47,7 @@ class MakeInstallParser(object):
Returns:
string, directives in form install['target'] = [ 'srcfile' ]
'''
- pattern = re.compile(r'install\s+-m\s+\d+\s+"%s%s(.+)"\s+/opt/ltp/(.+)' %
+ pattern = re.compile(r'install -m \d+ "%s%s(.*)" "/opt/ltp/(.*)"' %
(os.path.realpath(self.ltp_root), os.sep))
result = []
@@ -87,7 +87,7 @@ def main():
make_install_parser = MakeInstallParser(args.ltp_root)
result = make_install_parser.ParseFile(args.input_path)
- print(pprint.pprint(result))
+ print pprint.pprint(result)
if __name__ == '__main__':
- main()
+ main() \ No newline at end of file
diff --git a/android/tools/make_parser.py b/android/tools/make_parser.py
index d845569fe..4b6e3eff9 100644
--- a/android/tools/make_parser.py
+++ b/android/tools/make_parser.py
@@ -47,7 +47,6 @@ class MakeParser(object):
cc_parser.add_argument('-D', dest='defines', action='append')
cc_parser.add_argument('-I', dest='includes', action='append')
cc_parser.add_argument('-l', dest='libraries', action='append')
- cc_parser.add_argument('-L', dest='libraries_path', action='append')
cc_parser.add_argument('-c', dest='compile', action='store_true')
cc_parser.add_argument('-o', dest='target', action='store')
self.cc_parser = cc_parser
@@ -202,7 +201,7 @@ def main():
make_parser = MakeParser(args.ltp_root)
result = make_parser.ParseFile(args.input_path)
- print(pprint.pprint(result))
+ print pprint.pprint(result)
if __name__ == '__main__':
main()
diff --git a/build.sh b/build.sh
index 9335595ca..c6d146335 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
# Script for travis builds.
#
# TODO: Implement comparison of installed files. List of installed files can
@@ -9,85 +9,57 @@
set -e
-CFLAGS="${CFLAGS:--Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=return-type -fno-common}"
+CFLAGS="${CFLAGS:--Werror=implicit-function-declaration}"
CC="${CC:-gcc}"
DEFAULT_PREFIX="$HOME/ltp-install"
DEFAULT_BUILD="native"
DEFAULT_TREE="in"
-CONFIGURE_OPTS_IN_TREE="--with-open-posix-testsuite --with-realtime-testsuite $CONFIGURE_OPT_EXTRA"
+CONFIGURE_OPTS_IN_TREE="--with-open-posix-testsuite --with-realtime-testsuite"
# TODO: open posix testsuite is currently broken in out-tree-build. Enable it once it's fixed.
-CONFIGURE_OPTS_OUT_TREE="--with-realtime-testsuite $CONFIGURE_OPT_EXTRA"
+CONFIGURE_OPTS_OUT_TREE="--with-realtime-testsuite"
MAKE_OPTS="-j$(getconf _NPROCESSORS_ONLN)"
build_32()
{
- local dir
- local arch="$(uname -m)"
-
echo "===== 32-bit ${1}-tree build into $PREFIX ====="
-
- if [ -z "$PKG_CONFIG_LIBDIR" ]; then
- if [ "$arch" != "x86_64" ]; then
- echo "ERROR: auto-detection not supported platform $arch, export PKG_CONFIG_LIBDIR!"
- exit 1
- fi
-
- for dir in /usr/lib/i386-linux-gnu/pkgconfig \
- /usr/lib32/pkgconfig /usr/lib/pkgconfig; do
- if [ -d "$dir" ]; then
- PKG_CONFIG_LIBDIR="$dir"
- break
- fi
- done
- if [ -z "$PKG_CONFIG_LIBDIR" ]; then
- echo "WARNING: PKG_CONFIG_LIBDIR not found, build might fail"
- fi
- fi
-
CFLAGS="-m32 $CFLAGS" LDFLAGS="-m32 $LDFLAGS"
- build $1 $2
+ build $1
}
build_native()
{
echo "===== native ${1}-tree build into $PREFIX ====="
- build $1 $2
+ build $1
}
build_cross()
{
- local host=$(basename "${CC%-gcc}")
- if [ "$host" = "gcc" ]; then
- echo "Invalid CC variable for cross compilation: $CC (clang not supported)" >&2
- exit 1
- fi
+ local host="${CC%-gcc}"
+ [ -n "$host" ] || \
+ { echo "Missing CC variable, pass it with -c option." >&2; exit 1; }
echo "===== cross-compile ${host} ${1}-tree build into $PREFIX ====="
- build $1 $2 "--host=$host"
+ build $1 "--host=$host" CROSS_COMPILE="${host}-"
}
build()
{
local tree="$1"
- local install="$2"
- shift 2
+ shift
echo "=== autotools ==="
make autotools
if [ "$tree" = "in" ]; then
- build_in_tree $install $@
+ build_in_tree $@
else
- build_out_tree $install $@
+ build_out_tree $@
fi
}
build_out_tree()
{
- local install="$1"
- shift
-
local tree="$PWD"
local build="$tree/../ltp-build"
local make_opts="$MAKE_OPTS -C $build -f $tree/Makefile top_srcdir=$tree top_builddir=$build"
@@ -99,30 +71,19 @@ build_out_tree()
echo "=== build ==="
make $make_opts
- if [ "$install" = 1 ]; then
- echo "=== install ==="
- make $make_opts DESTDIR="$PREFIX" SKIP_IDCHECK=1 install
- else
- echo "make install skipped, use -i to run it"
- fi
+ echo "=== install ==="
+ make $make_opts DESTDIR="$PREFIX" SKIP_IDCHECK=1 install
}
build_in_tree()
{
- local install="$1"
- shift
-
run_configure ./configure $CONFIGURE_OPTS_IN_TREE --prefix=$PREFIX $@
echo "=== build ==="
make $MAKE_OPTS
- if [ "$install" = 1 ]; then
- echo "=== install ==="
- make $MAKE_OPTS install
- else
- echo "make install skipped, use -i to run it"
- fi
+ echo "=== install ==="
+ make $MAKE_OPTS install
}
run_configure()
@@ -130,8 +91,8 @@ run_configure()
local configure=$1
shift
- export CC CFLAGS LDFLAGS PKG_CONFIG_LIBDIR
- echo "CC='$CC' CFLAGS='$CFLAGS' LDFLAGS='$LDFLAGS' PKG_CONFIG_LIBDIR='$PKG_CONFIG_LIBDIR'"
+ export CC CFLAGS LDFLAGS
+ echo "CC='$CC' CFLAGS='$CFLAGS' LDFLAGS='$LDFLAGS'"
echo "=== configure $configure $@ ==="
if ! $configure $@; then
@@ -169,28 +130,20 @@ in in-tree build
out out-of-tree build
BUILD TYPES:
-32 32-bit build (PKG_CONFIG_LIBDIR auto-detection for x86_64)
-cross cross-compile build (requires set compiler via -c switch)
-native native build
-
-Default configure options:
-in-tree: $CONFIGURE_OPTS_IN_TREE
-out-of-tree $CONFIGURE_OPTS_OUT_TREE
-
-configure options can extend the default with \$CONFIGURE_OPT_EXTRA environment variable
+32 32-bit in-tree build
+cross cross-compile in-tree build (requires set compiler via -c switch)
+native native in-tree build
EOF
}
PREFIX="$DEFAULT_PREFIX"
build="$DEFAULT_BUILD"
tree="$DEFAULT_TREE"
-install=0
-while getopts "c:hio:p:t:" opt; do
+while getopts "c:ho:p:t:" opt; do
case "$opt" in
c) CC="$OPTARG";;
h) usage; exit 0;;
- i) install=1;;
o) case "$OPTARG" in
in|out) tree="$OPTARG";;
*) echo "Wrong build tree '$OPTARG'" >&2; usage; exit 1;;
@@ -213,4 +166,4 @@ echo
echo "=== compiler version ==="
$CC --version
-eval build_$build $tree $install
+eval build_$build $tree
diff --git a/configure.ac b/configure.ac
index 9347b704f..50d14967d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,10 +13,10 @@ AC_CONFIG_FILES([ \
execltp \
])
-AC_ARG_VAR(HOSTCC, [The C compiler on the host])
-
AM_MAINTAINER_MODE([enable])
+AM_CONDITIONAL(CROSS_COMPILATION, test x$cross_compiling = xyes)
+
AC_CANONICAL_HOST
AC_PROG_CC
@@ -30,41 +30,28 @@ AC_DEFUN([AC_PROG_STRIP], [AC_CHECK_TOOL(STRIP, strip, :)])
AC_PROG_STRIP
AC_PROG_YACC
-m4_ifndef([PKG_CHECK_EXISTS],
- [m4_fatal([must install pkg-config or pkgconfig and pkg.m4 macro (usual dependency), see INSTALL])])
-
AC_PREFIX_DEFAULT(/opt/ltp)
-AC_CHECK_DECLS([IFLA_NET_NS_PID],,,[#include <linux/if_link.h>])
-AC_CHECK_DECLS([MADV_MERGEABLE],,,[#include <sys/mman.h>])
-AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ],,,[#include <sys/prctl.h>])
-AC_CHECK_DECLS([SEM_STAT_ANY],,,[#include <sys/sem.h>])
-
-AC_CHECK_HEADERS_ONCE([ \
- asm/ldt.h \
+AC_CHECK_HEADERS([ \
ifaddrs.h \
keyutils.h \
linux/can.h \
linux/cgroupstats.h \
linux/cryptouser.h \
- linux/close_range.h \
linux/dccp.h \
- linux/fs.h \
linux/genetlink.h \
linux/if_alg.h \
- linux/if_ether.h \
linux/if_packet.h \
- linux/io_uring.h \
+ linux/if_ether.h \
linux/keyctl.h \
linux/mempolicy.h \
linux/module.h \
linux/netlink.h \
- linux/openat2.h \
linux/seccomp.h \
linux/securebits.h \
- linux/tty.h \
linux/types.h \
linux/userfaultfd.h \
+ mm.h \
netinet/sctp.h \
pthread.h \
sys/epoll.h \
@@ -72,47 +59,26 @@ AC_CHECK_HEADERS_ONCE([ \
sys/inotify.h \
sys/prctl.h \
sys/shm.h \
- sys/timerfd.h \
sys/ustat.h \
sys/utsname.h \
sys/xattr.h \
xfs/xqm.h \
])
-AC_CHECK_HEADERS(fts.h, [have_fts=1])
-AC_SUBST(HAVE_FTS_H, $have_fts)
-AC_CHECK_FUNCS_ONCE([ \
- clone3 \
- close_range \
+AC_CHECK_FUNCS([ \
copy_file_range \
epoll_pwait \
execveat \
fallocate \
fchownat \
- fsconfig \
- fsmount \
- fsopen \
- fspick \
fstatat \
- getauxval \
getdents \
getdents64 \
- io_pgetevents \
- io_uring_setup \
- io_uring_register \
- io_uring_enter \
kcmp \
- mallinfo \
- mallopt \
mkdirat \
mknodat \
- modify_ldt \
- move_mount \
name_to_handle_at \
- open_tree \
openat \
- openat2 \
- pidfd_open \
pidfd_send_signal \
pkey_mprotect \
preadv \
@@ -120,102 +86,26 @@ AC_CHECK_FUNCS_ONCE([ \
profil \
pwritev \
pwritev2 \
- rand_r \
readlinkat \
recvmmsg \
renameat \
renameat2 \
sched_getcpu \
sendmmsg \
- setns \
sigpending \
splice \
- statx \
stime \
- sync_file_range \
syncfs \
+ sync_file_range \
tee \
- timerfd_create \
- timerfd_gettime \
- timerfd_settime \
unshare \
ustat \
vmsplice \
])
-AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))
-
-AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
-AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
-AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>])
-
-AC_CHECK_MEMBERS([struct utsname.domainname],,,[
-#define _GNU_SOURCE
-#include <sys/utsname.h>
-])
-
-AC_CHECK_TYPES([enum kcmp_type],,,[#include <linux/kcmp.h>])
-AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
-AC_CHECK_TYPES([struct af_alg_iv, struct sockaddr_alg],,,[# include <linux/if_alg.h>])
-AC_CHECK_TYPES([struct clone_args],,,[#include <sched.h>])
-AC_CHECK_TYPES([struct fanotify_event_info_fid, struct fanotify_event_info_header],,,[#include <sys/fanotify.h>])
-AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
-
-AC_CHECK_TYPES([struct file_handle],,,[
-#define _GNU_SOURCE
-#include <fcntl.h>
-])
-
-AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
-AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
-AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
-AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
-AC_CHECK_TYPES([struct loop_config],,,[#include <linux/loop.h>])
-
-AC_CHECK_TYPES([struct __kernel_itimerspec],,,[#include <linux/time_types.h>])
-AC_CHECK_TYPES([struct __kernel_old_timespec],,,[#include <linux/time_types.h>])
-AC_CHECK_TYPES([struct __kernel_old_timeval],,,[#include <linux/time_types.h>])
-AC_CHECK_TYPES([struct __kernel_timespec],,,[#include <linux/time_types.h>])
-
-AC_CHECK_TYPES([struct __kernel_timex],,,[#include <sys/timex.h>])
-AC_CHECK_TYPES([struct __kernel_timex_timeval],,,[#include <sys/timex.h>])
-
-AC_CHECK_TYPES([struct mmsghdr],,,[
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/socket.h>
-])
-
-AC_CHECK_TYPES([struct msqid64_ds],,,[#include <sys/msgbuf.h>])
-
-AC_CHECK_TYPES([struct rlimit64],,,[
-#define _LARGEFILE64_SOURCE
-#include <sys/resource.h>
-])
-
-AC_CHECK_TYPES([struct semun],,,[#include <sys/sem.h>])
-AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
-AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
-
-AC_CHECK_TYPES([struct statx, struct statx_timestamp],,,[
-#define _GNU_SOURCE
-#include <sys/stat.h>
-])
-
-AC_CHECK_TYPES([struct termio],,,[#include <sys/ioctl.h>])
-AC_CHECK_TYPES([struct tpacket_req3],,,[# include <linux/if_packet.h>])
-AC_CHECK_TYPES([struct user_desc, struct modify_ldt_ldt_s],[],[],[#include <asm/ldt.h>])
-
-AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <limits.h>
-#include <linux/netfilter_ipv4/ip_tables.h>
-])
# Tools knobs
-# Bash
+# Expect
AC_ARG_WITH([bash],
[AC_HELP_STRING([--with-bash],
[have the Bourne Again Shell interpreter])],
@@ -228,34 +118,6 @@ else
AC_SUBST([WITH_BASH],["no"])
fi
-# metadata
-AC_ARG_ENABLE([metadata],
- [AC_HELP_STRING([--disable-metadata],
- [Disable metadata generation (both HTML and PDF, default no)])],
- [], [enable_metadata=yes]
-)
-AC_ARG_ENABLE([metadata_html],
- [AC_HELP_STRING([--disable-metadata-html],
- [Disable metadata HTML generation (default no)])],
- [], [enable_metadata_html=yes]
-)
-
-AC_ARG_ENABLE([metadata_pdf],
- [AC_HELP_STRING([--enable-metadata-pdf],
- [Enable metadata PDF generation (default no)])],
- [], [enable_metadata_pdf=no]
-)
-
-AC_ARG_WITH([metadata_generator],
- [AC_HELP_STRING([--with-metadata-generator=asciidoc|asciidoctor],
- [Specify metadata generator to use (default autodetect)])],
- [with_metadata_generator=$withval],
- [with_metadata_generator=detect]
-)
-
-LTP_DOCPARSE
-
-# Expect
AC_ARG_WITH([expect],
[AC_HELP_STRING([--with-expect],
[have the Tcl/expect library])],
@@ -344,7 +206,7 @@ fi
AC_CONFIG_COMMANDS([syscalls.h], [cd ${ac_top_srcdir}/include/lapi/syscalls; ./regen.sh])
# custom functions
-# NOTE: don't create custom functions for simple checks, put them into this file
+LTP_CHECK_ACCT
LTP_CHECK_ACL_SUPPORT
LTP_CHECK_ATOMIC_MEMORY_MODEL
LTP_CHECK_BUILTIN_CLEAR_CACHE
@@ -352,22 +214,36 @@ LTP_CHECK_CAPABILITY_SUPPORT
LTP_CHECK_CC_WARN_OLDSTYLE
LTP_CHECK_CLONE_SUPPORTS_7_ARGS
LTP_CHECK_CRYPTO
+LTP_CHECK_FANOTIFY
+LTP_CHECK_FIDEDUPE
LTP_CHECK_FORTIFY_SOURCE
+LTP_CHECK_FTS_H
+LTP_CHECK_IF_LINK
+LTP_CHECK_IOVEC
+LTP_CHECK_KCMP_TYPE
LTP_CHECK_KERNEL_DEVEL
LTP_CHECK_KEYUTILS_SUPPORT
-LTP_CHECK_LIBMNL
LTP_CHECK_LINUX_PTRACE
LTP_CHECK_LINUXRANDOM
+LTP_CHECK_MADVISE
+LTP_CHECK_MKDTEMP
+LTP_CHECK_MMSGHDR
LTP_CHECK_MREMAP_FIXED
LTP_CHECK_NOMMU_LINUX
+LTP_CHECK_PERF_EVENT
+LTP_CHECK_PRCTL_SUPPORT
+LTP_CHECK_RLIMIT64
LTP_CHECK_SELINUX
+LTP_CHECK_SIGNAL
+LTP_CHECK_STATX
LTP_CHECK_SYNC_ADD_AND_FETCH
LTP_CHECK_SYSCALL_EVENTFD
LTP_CHECK_SYSCALL_FCNTL
+LTP_CHECK_SYSCALL_MODIFY_LDT
if test "x$with_numa" = xyes; then
LTP_CHECK_SYSCALL_NUMA
- numa_error_msg="test requires libnuma development packages with LIBNUMA_API_VERSION >= 2"
+ numa_error_msg="test requires libnuma >= 2 and it's development packages"
else
numa_error_msg="NUMA support was disabled during build"
fi
@@ -375,10 +251,15 @@ AC_DEFINE_UNQUOTED(NUMA_ERROR_MSG, ["$numa_error_msg"], [Error message when no N
LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
+LTP_CHECK_SYSCALL_QUOTACTL
LTP_CHECK_SYSCALL_SIGNALFD
LTP_CHECK_SYSCALL_UTIMENSAT
LTP_CHECK_TASKSTATS
+LTP_CHECK_TIMERFD
test "x$with_tirpc" = xyes && LTP_CHECK_TIRPC
+LTP_CHECK_TPACKET_V3
+LTP_CHECK_UNAME_DOMAINNAME
+LTP_CHECK_X_TABLES
LTP_DETECT_HOST_CPU
AC_OUTPUT
diff --git a/doc/build-system-guide.txt b/doc/build-system-guide.txt
index 166f7fb92..c4b36239b 100644
--- a/doc/build-system-guide.txt
+++ b/doc/build-system-guide.txt
@@ -158,8 +158,6 @@ $(LDFLAGS) : What to pass in to the linker, including -L arguments
$(LDLIBS) : Libraries to pass to the linker (e.g. -lltp, etc).
-$(LTPLDLIBS) : LTP internal libraries i.e. these in libs/ directory.
-
$(OPT_CFLAGS) : Optimization flags to pass into the C compiler, -O2,
etc. If you specify -O2 or higher, you should also
specify -fno-strict-aliasing, because of gcc
diff --git a/doc/library-api-writing-guidelines.txt b/doc/library-api-writing-guidelines.txt
deleted file mode 100644
index 5de35a7e2..000000000
--- a/doc/library-api-writing-guidelines.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-LTP Library API Writing Guidelines
-==================================
-
-1. General Rules
-----------------
-
-For extending library API it applies the same general rules as for writing tests,
-(see https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines[Test Writing Guidelines],
-offline: 'doc/test-writing-guidelines.txt'),
-with strong focus on readability and simplicity.
-
-Library tests are in 'lib/newlib_tests' directory.
-
-Don't forget to update docs when you change the API.
-
-2. C API
---------
-
-API source code is in headers `include/*.h`, `include/lapi/*.h` (backward
-compatibility for old kernel and libc) and C sources in `lib/*.c`. Files have
-'tst_' prefix.
-
-3. Shell API
-------------
-
-API source code is in `tst_test.sh`, `tst_security.sh` and `tst_net.sh`
-(all in 'testcases/lib' directory).
-
-Changes in the shell API should not introduce uncommon dependencies
-(use basic commands installed everywhere by default).
diff --git a/doc/ltp-run-files.txt b/doc/ltp-run-files.txt
index 3f405b387..c29086987 100644
--- a/doc/ltp-run-files.txt
+++ b/doc/ltp-run-files.txt
@@ -56,7 +56,9 @@ if run network tests flag is passed these additional tests are run
- nfs
To test filesystem with LVM
-- testscripts/lvmtest.sh
+- ltpfslvm.sh
+w/o LVM
+- ltpfsnolvm.sh
Device Mapper tests
- ltpdmmapper.sh
@@ -69,6 +71,7 @@ other filesystem or disk type tests
- autofs1.sh
- autofs4.sh
- diskio.sh
+ - exportfs.sh
- isofs.sh
- sysfs.sh
diff --git a/doc/maintainer-patch-review-checklist.txt b/doc/maintainer-patch-review-checklist.txt
deleted file mode 100644
index 5420fa933..000000000
--- a/doc/maintainer-patch-review-checklist.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-# Maintainer Patch Review Checklist
-
-Patchset should be tested locally and ideally also in maintainer's fork in
-https://travis-ci.org/[Travis CI].
-
-NOTE: Travis does only build testing, passing the CI means only that the
- test compiles fine on variety of different distributions and
- releases.
-
-The test should be executed at least once locally and should PASS as well.
-
-Commit messages should have
-
-* Author's `Signed-off-by` tag
-* Committer's `Reviewed-by` or `Signed-off-by` tag
-* Check also mailing lists for other reviewers / testers tags, notes and failure reports
-* `Fixes: hash` if it fixes particular LTP commit
-* `Fixes: #N` if it fixes github issue number N, so it's automatically closed
-
-After patch is accepted or rejected, set correct state and archive in
-https://patchwork.ozlabs.org/project/ltp/list/[LTP patchwork instance].
-
-Also update LTP WIKI (git URL https://github.com/linux-test-project/ltp.wiki.git)
-if touch `doc/*.txt`.
-
-## New tests
-New test should
-
-* Have a record in runtest file
-* Test should work fine with more than one iteration
- (e.g. run with `-i 100`)
-* Have a brief description
-* License: the default license for new tests is GPL v2 or later, use
- GPL-2.0-or-later; the licence for test (e.g. GPL-2.0) should not change
- unless test is completely rewritten
-* Old copyrights should be kept unless test is completely rewritten
-
-### C tests
-* Use new https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#22-writing-a-test-in-c[C API]
-* Test binaries are added into corresponding '.gitignore' files
-* Check coding style with
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl[checkpatch.pl]
- (more in https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#131-c-coding-style[C coding style])
-* Docparse documentation
-* If a test is a regression test it should include tags
- (more in https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#2238-test-tags[Test tags])
-
-### Shell tests
-* Use new https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#23-writing-a-testcase-in-shell[shell API]
-* Check coding style with
- https://salsa.debian.org/debian/devscripts/raw/master/scripts/checkbashisms.pl[checkbashism.pl]
- (more in https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#132-shell-coding-style[Shell coding style])
-* If a test is a regression test it should include related kernel or glibc commits as a comment
-
-## LTP library
-For patchset touching library please check also
-https://github.com/linux-test-project/ltp/wiki/LTP-Library-API-Writing-Guidelines[LTP Library API Writing Guidelines].
diff --git a/doc/style-guide.txt b/doc/style-guide.txt
new file mode 100644
index 000000000..b853fa8dc
--- /dev/null
+++ b/doc/style-guide.txt
@@ -0,0 +1,442 @@
+LTP Style Guide
+===============
+
+**********************************************************************
+Welcome to the *LTP Project Coding Guideline* document! This document is
+designed to guide committers and contributors in producing consistent, quality
+deterministic testcases and port testcases from other sources to LTP so that
+they can be easily maintained by project members and external contributors.
+
+Please refer to the *Linux Kernel Coding Guidelines* unless stated otherwise
+in this document.
+
+Changelog:
+
+ * Initial version: Ngie Cooper <yaneurabeya@gmail.com>
+ * Reformatted for asciidoc: Cyril Hrubis <chrubis@suse.cz>
+**********************************************************************
+
+Using libltp
+------------
+
+Of course the manpages should be the primary source of information in
+terms of how you should use libltp, but this section provides a quick
+set of guidelines to hit the ground running with libltp.
+
+When you can use libltp please observe the following guidelines:
+
+1. Should I use tst_*() interface in forked processes?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+No, only use libltp in non-forked processes and functions +perror(3)+ /
++exit(3)+ otherwise. Reason being:
+
+ * Calling +tst_resm()+ from multiple processes is messy.
+ * Calling cleanup can break test execution.
+ * Establishing a complicated scheme of tracking the testcase state
+ for teardown is undesirable.
+
+2. Use SAFE_* macros
+~~~~~~~~~~~~~~~~~~~~
+
+Use +SAFE_*+ macros (see +safe_macros.h+) instead of bare calls to libcalls and
+syscalls. This will:
+
+ * Reduce number of lines wasted on repeated in multiple files with
+ error catching logic.
+ * Ensure that error catching is consistent and informative; all
+ +SAFE_*+ macros contain the line number of the failure as well as
+ the file where the failure occurred by design. So unless the
+ stack gets stomped on, you will be able to determine where
+ the failures occurred if and when they do occur with absolute
+ determinism.
+ * Mute some unchecked return code warnings.
+
+3. Don't call cleanup() from within setup()
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Unless you need to clean up or reset system state that wouldn't otherwise be
+handled by a proper release of all OS resources.
+
+This includes (but is not limited to):
+
+ * Memory mapped pages.
+ * Mounted filesystems.
+ * File descriptors (if they're in temporary directories, etc).
+ * Temporary files / directories.
+ * Waiting for child processes.
+ * +/proc+ & +/sysfs+ tunable states.
+
+You don't need to clean up the following:
+
+ * +malloc(3)+'ed memory.
+ * Read-only file descriptors in persistent paths (i.e. not
+ temporary directories).
+
+Please be aware of some of the caveats surrounding forking,
+exec'ing and descriptor inheritance, etc.
+
+4. Call APIs that don't require freeing up resources on failure first
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ * +tst_require_root()+
+ * +tst_sig(...)+
+ * +malloc(3)+
+ * +tst_tmpdir()+
+
+That way you can simplify your setup and avoid calling cleanup whenever
+possible!
+
+5. If the test needs to run as root
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If the test need to run as root, check to make sure that you're root
+*before doing any other setup* via +tst_require_root()+.
+
+6. No custom reporting APIs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Don't roll your own reporting APIs unless you're porting testcases or are
+concerned about portability.
+
+7. Handle TBROK and TFAIL correctly
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Use +TBROK+ when an unexpected failure unrelated to the goal of the testcase
+occurred, and use +TFAIL+ when an unexpected failure related to the goal of
+the testcase occurred.
+
+8. Don't roll your own syscall numbers
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Header +lapi/syscalls.h+ exists for this purpose and does a pretty
+dang good job.
+
+9. Keep errors as short and sweet as possible
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For example:
+[source,c]
+----------------------------------------------------
+if (fork() == -1)
+ tst_brkm(TBROK, cleanup, "fork failed");
+
+/* or */
+
+if (fork() == -1)
+ tst_brkm(TBROK, cleanup, "fork # 1 failed");
+
+if (fork() == -1)
+ tst_brkm(TBROK, cleanup, "fork # 2 failed");
+----------------------------------------------------
+
+If you can't determine where the failure has occurred in a testcase based on
+the entire content of the failure messages, then determining the cause of
+failure may be impossible.
+
+10. Reporting errno and the TEST() macro
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Don't roll your own +errno+ / +strerror()+ printout when you use +tst_resm()+
+calls. Use either +TERRNO+ or +TTERRNO+. Similarly, if a testcase passed and
+it's obvious why it passed (for example a function call returns +0+ or
++TEST_RETURN == 0+).
+
+[source,c]
+-------------------------------------------------------------------------------
+/* Example without TEST(...) macro */
+
+exp_errno = ENOENT;
+
+if (fn() == -1) {
+ /*
+ * Using TERRNO here is valid because the error case
+ * isn't static.
+ */
+ if (exp_errno == ENOENT)
+ tst_resm(TPASS|TERRNO,
+ "fn failed as expected");
+ /*
+ * Using strerror(TEST_ERRNO) here is valid because
+ * the error case isn't static.
+ */
+ else
+ tst_resm(TFAIL|TERRNO,
+ "fn failed unexpectedly; expected "
+ "%d - %s",
+ exp_errno, strerror(exp_errno));
+} else
+ tst_resm(TBROK, "fn passed unexpectedly");
+
+/* Example using TEST(...) macro */
+
+TEST(fn());
+if (TEST_RETURN == 0)
+ tst_resm(TPASS, "fn passed as expected");
+else
+ tst_resm(TFAIL|TTERRNO, "fn failed");
+-------------------------------------------------------------------------------
+
+[NOTE]
+The +TEST()+ macro is not thread-safe as it saves return value and errno into
+global variable.
+
+12. Use tst_brkm() when possible
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Use...
+[source,c]
+------------------------------
+tst_brkm(TBROK, cleanup, ...);
+------------------------------
+...instead of...
+[source,c]
+------------------------------
+tst_resm(TBROK, ...);
+cleanup();
+tst_exit();
+------------------------------
+
+[NOTE]
+As you see the +tst_brkm()+ no longer requires non +NULL+ cleanup_fn argument
+in order to call +tst_exit()+.
+
+13. Indentation
+~~~~~~~~~~~~~~~
+
+Use hard tabs for first-level indentation, and 4 spaces for every line longer
+than 80 columns. Use a linebreak with string constants in format functions
+like +*printf()+, the +tst_resm()+ APIs, etc.
+
+Example:
+[source,c]
+-------------------------------------------------------------------------------
+if ((this_is_a_poorly_formed_really_long_variable = function_call()) == NULL &&
+ statement1() && i < j && l != 5) {
+ /* Use tabs here */
+ printf("The rain in Spain falls mainly in the plain.\nThe quick brown "
+ "fox jumped over the lazy yellow dog\n");
+ tst_resm(TPASS,
+ "Half would turn and fight. The other half would try to swim "
+ "across. But my uncle told me about a few that... they'd swim "
+ "halfway out, turn with the current, and ride it all the way out "
+ "to sea. Fisherman would find them a mile offshore, swimming.");
+}
+-------------------------------------------------------------------------------
+
+14. System headers
+~~~~~~~~~~~~~~~~~~
+
+Don't use +linux/+ headers if at all possible. Usually they are replaced with
++sys/+ headers as things work their way into glibc. Furthermore, +linux/+
+headers get shuffled around a lot more than their +sys/+ counterparts it
+seems.
+
+15. Signal handlers
+~~~~~~~~~~~~~~~~~~~~
+
+Avoid doing tricky things in signal handlers. Calling most of the libc
+functions from signal handler may lead to deadlocks or memory corruption. If
+you really need to do anything more complicated that +should_run = 0;+ in your
+signal handler consult +man 7 signal+ for async-signal-safe functions.
+
+Porting Testcases
+-----------------
+
+If one of the following is true...
+
+ 1. You are porting a testcase directly to LTP which doesn't need to
+ be ported outside of Linux.
+ 2. The beforementioned project or source is no longer contributing
+ changes to the testcases.
+
+Then please fully port the testcase(s) to LTP. Otherwise, add robust porting
+shims around the testcases using libltp APIs to reduce longterm maintenance
+and leave the sources alone so it's easier to sync the testcases from the
+upstream source.
+
+New Testcases
+-------------
+
+ 1. Always use libltp for Linux centric tests. No ifs, ands, or buts
+ about it.
+ 2. Sort headers, like:
+
+[source,c]
+---------------------------------------------------------------------------
+/*
+ * sys/types.h is usually (but not always) required by POSIX
+ * APIs.
+ */
+#include <sys/types.h>
+/* sys headers, alphabetical order. */
+/* directory prefixed libc headers. */
+/* non-directory prefixed libc headers. */
+/* directory prefixed non-libc (third-party) headers. */
+/* non-directory prefixed non-libc (third-party) headers. */
+/* Sourcebase relative includes. */
+
+/* e.g. */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <netinet/icmp.h>
+#include <stdio.h>
+#include <dbus-1.0/dbus/dbus.h>
+#include <archive.h>
+#include "foo/bar.h"
+#include "test.h"
+---------------------------------------------------------------------------
+
+3. Comments
+~~~~~~~~~~~
+
+Do not use obvious comments ("child process", "parse options", etc). This
+leads to visual comment noise pollution.
+
+4. Inline assignments
+~~~~~~~~~~~~~~~~~~~~
+
+Don't do inline assignment, i.e.
+
+[source,c]
+---------------------------------------------------------------------------
+int foo = 0;
+
+Use separate statements:
+
+int foo;
+
+foo = 0;
+---------------------------------------------------------------------------
+
+The only exception to this is when you define global variables.
+
+5. How to assert test is running as root?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Your testcase should be runnable as root and non-root. What does that mean? It
+should fail gracefully as non-root if it has insufficient privileges, or use
++tst_require_root()+ if root access is absolutely required.
+
+A lot of newer testcases don't honor this fact and it causes random
+unnecessary errors when run as non-privileged users.
+
+6. Do I need to create temporary directory?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Use +tst_tmpdir()+ if your testcase will:
+
+* Create temporary files.
+* Dump core.
+* Etc. Otherwise, don't bother with the API.
+
+[NOTE]
+If you created temporary directory with +tst_tmpdir()+ don't forget to call
++tst_rmdir()+ when the test is cleaning up. This is *NOT* done automatically.
+
+7. Setting up signal handlers
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Use +tst_sig()+ instead of bothering with sigaction / signal. This reduces
+potential of leaving a mess around if your test doesn't exit cleanly (now,
+there are some signals that can't be blocked, i.e. +SIGKILL+ and +SIGSTOP+,
+but the rest can be caught).
+
+8. Basic template
+~~~~~~~~~~~~~~~~~
+
+The following is a basic testcase template:
+[source,c]
+---------------------------------------------------------------------------
+#include "test.h"
+
+char *TCID = "testname";
+int TST_TOTAL = /* ... */
+
+static void setup(void)
+{
+ /* ... */
+
+ tst_require_root();
+
+ tst_tmpdir();
+
+ /* ... */
+
+ TEST_PAUSE;
+}
+
+static void cleanup(void)
+{
+
+ TEST_CLEANUP;
+
+ /* ... */
+
+ tst_rmdir();
+}
+
+int main(void)
+{
+ /* ... */
+
+ setup(); /* Optional */
+
+ cleanup(); /* Optional */
+ tst_exit(); /* DON'T FORGET THIS -- this must be last! */
+}
+---------------------------------------------------------------------------
+
+Fixing Legacy Testcases
+-----------------------
+
+Unless you interested in exercising self-masochism, do minimal changes
+to testcases when fixing them so it's easier to track potential
+breakage in testcases after a commit is made (mistakes happen and no
+one is perfect). If it works after you fix it -- great -- move on.
+It's more the job of the committers / maintainers to do things like
+style commits.
+
+It's better to focus on adding more content to LTP as a contributor
+and fixing functional issues with existing tests than it is worrying
+about whitespace, unnecessary pedanticness of function calls, etc.
+
+As ugly as the style is in the surrounding code may be, stick to it.
+Otherwise anyone reading the code will cringe at the chaos and
+non-uniform `style', and it will be more difficult to fix later.
+
+
+Fixing Open Posix Testsuite
+---------------------------
+
+The *Open Posix Testsuite* does not use libltp interface and moreover aims to
+be usable on any *POSIX* compatible operating system.
+
+So *NO* Linux, BSD specific syscalls there.
+
+Contribution to the project
+---------------------------
+
+Since CVS is effectively dead for LTP proper, we ask that you submit
+patches that are git friendly and patchable.
+
+Guidelines for submitting patches are as follows:
+
+1. Use +git commit -s+ . You know you want to ;) .. (you may need to
+ submit a correct signed-off-by line, e.g. use git config first).
+2. Provide a short (<= 50 character) description of the commit.
+3. Provide a little more terse (1-2 paragraph maximum, <= 72 character
+ lines) description of what the commit does.
+4. Format the email with +git format-patch --attach+ command .
+
+Example of a commit message:
+
+-------------------------------------------------------------------
+Short description of my commit.
+
+This is a much longer description of my commit. Blah blah blah blah
+blah blah blah blah blah.
+
+Signed-off-by: John Smith <dev@null>
+-------------------------------------------------------------------
diff --git a/doc/supported-kernel-libc-versions.txt b/doc/supported-kernel-libc-versions.txt
deleted file mode 100644
index 6575e2025..000000000
--- a/doc/supported-kernel-libc-versions.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-Supported kernel, libc, toolchain versions
-==========================================
-
-1. Build testing with Travis CI
--------------------------------
-
-We test master branch in https://travis-ci.org/github/linux-test-project/ltp/builds[travis CI]
-to ensure LTP builds on various distributions including old, current and bleeding edge.
-We test both gcc and clang toolchains, various architectures with cross-compilation.
-For list of tested distros see
-https://github.com/linux-test-project/ltp/blob/master/.travis.yml[.travis.yml].
-
-
-NOTE: Travis does only build testing, passing the CI means only that the
- test compiles fine on variety of different distributions and releases.
- Travis also uses the latest distribution image of a particular release.
-
-1.1 Oldest tested distributions
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-[align="center",options="header"]
-|==============================================================
-| Distro | kernel | glibc | gcc | clang
-| CentOS 7 | 3.10 | 2.17 | 4.8.5 | -
-| Ubuntu 16.04 LTS xenial | 4.4 | 2.23 | 5.3.1 | -
-| Debian 9 stretch (oldstable) | 4.9.30 | 2.24 | 6.3.0 | 3.8
-|==============================================================
-
-Older distributions are not officially supported, which means that it
-may or may not work. It all depends on your luck. It should be possible
-to compile latest LTP even on slightly older distributions than we
-support with a few manual tweaks, e.g. disabling manually tests for
-newly added syscalls, etc. Trivial fixes/workarounds may be accepted,
-but users are encouraged to move to a newer distro.
-
-If latest LTP cannot be compiled even with some amount of workarounds,
-you may result to older LTP releases, however these are _not_ supported
-in any way. Also if you are trying to run LTP on more than 10 years old
-distribution you may as well reconsider you life choices.
-
-1.2 Tested architectures
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-[align="center",options="header"]
-|==================================
-| arch | build
-| x86_64 | native
-| x86 emulation | native
-| aarch64 | cross compilation
-| ppc64le | cross compilation
-| s390x | cross compilation
-|==================================
-
-1.3 Supported libc
-~~~~~~~~~~~~~~~~~~
-
-[align="center",options="header"]
-|==================================
-| Libc | Note
-| https://www.gnu.org/software/libc/[GNU C Library (glibc)] | Targetted libc, tested both compilation and actual test results.
-| https://uclibc-ng.org/[uClibc-ng] | Although not being tested it should work as well as it attempt to maintain a glibc compatible interface.
-| https://www.uclibc.org/[uClibc] | Older https://www.uclibc.org/[uClibc] might have problems.
-| https://musl.libc.org/[musl] | Not yet fully supported (see
- https://github.com/linux-test-project/ltp/blob/master/travis/alpine.sh[travis script]
- for list of files which need to be deleted in order to compile under musl).
-| binder (Android) | Please use https://android.googlesource.com/platform/external/ltp/[AOSP fork].
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index c268b8804..f0aa69ad4 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -24,6 +24,7 @@ Do not reinvent the wheel!
* Do not add custom PASS/FAIL reporting functions
* Do not write Makefiles from scratch,
use LTP build system instead, etc.
+* ...
1.2 Code duplication
~~~~~~~~~~~~~~~~~~~~
@@ -47,12 +48,10 @@ LTP adopted Linux kernel coding style. If you aren't familiar with its rules
locate 'linux/Documentation/CodingStyle' in the kernel sources and read it,
it's a well written introduction.
-There is also
-https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl[checkpatch.pl]
-script from kernel git tree which can be used to check your patches before the
-submission. Please use reasonably recent one.
+There is also a checkpatch (see 'linux/scripts/checkpatch.pl') script that can
+be used to check your patches before the submission.
-NOTE: If checkpatch.pl does not report any problems, the code still may be wrong
+NOTE: If checkpatch does not report any problems, the code still may be wrong
as the tool only looks for common mistakes.
1.3.2 Shell coding style
@@ -328,15 +327,6 @@ time may vary arbitrarily, for these timeout can be disabled by setting it to
Test can find out how much time (in seconds) is remaining to timeout,
by calling 'tst_timeout_remaining()'.
-LAPI headers
-++++++++++++
-
-Use our LAPI headers ('include "lapi/foo.h"') to keep compatibility with old
-distributions. LAPI header should always include original header. Older linux
-headers were problematic, therefore we preferred to use libc headers. There are
-still some bugs when combining certain glibc headers with linux headers, see
-https://sourceware.org/glibc/wiki/Synchronizing_Headers.
-
A word about the cleanup() callback
+++++++++++++++++++++++++++++++++++
@@ -431,7 +421,6 @@ Printf-like function to report test result, it's mostly used with ttype:
| 'TPASS' | Test has passed.
| 'TFAIL' | Test has failed.
| 'TINFO' | General message.
-| 'TWARN' | Something went wrong but we decided to continue. Mostly used in cleanup functions.
|==============================
The 'ttype' can be combined bitwise with 'TERRNO' or 'TTERRNO' to print
@@ -453,60 +442,6 @@ Printf-like function to report error and exit the test, it can be used with ttyp
The 'ttype' can be combined bitwise with 'TERRNO' or 'TTERRNO' to print
'errno', 'TST_ERR' respectively.
-There are also 'TST_EXP_*()' macros that can simplify syscall unit tests to a
-single line, use them whenever possible. These macros take a function call as
-the first parameter and a printf-like format string and parameters as well.
-These test macros then expand to a code that runs the call, checks the return
-value and errno and reports the test result.
-
-[source,c]
--------------------------------------------------------------------------------
-static void test(void)
-{
- ...
- TST_EXP_PASS(stat(fname, &statbuf), "stat(%s, ...)", fname);
-
- if (!TST_PASS)
- return;
- ...
-}
--------------------------------------------------------------------------------
-
-The 'TST_EXP_PASS()' can be used for calls that return -1 on failure and 0 on
-success. It will check for the return value and reports failure if the return
-value is not equal to 0. The call also sets the 'TST_PASS' variable to 1 if
-the call succeeeded.
-
-[source,c]
--------------------------------------------------------------------------------
-static void test(void)
-{
- ...
- TST_EXP_FD(open(fname, O_RDONLY), "open(%s, O_RDONLY)", fname);
-
- SAFE_CLOSE(TST_RET);
- ...
-}
--------------------------------------------------------------------------------
-
-The 'TST_EXP_FD()' is the same as 'TST_EXP_PASS()' the only difference is that
-the return value is expected to be a file descriptor so the call passes if
-positive integer is returned.
-
-[source,c]
--------------------------------------------------------------------------------
-static void test(void)
-{
- ...
- TST_EXP_FAIL(stat(fname, &statbuf), ENOENT, "stat(%s, ...)", fname);
- ...
-}
--------------------------------------------------------------------------------
-
-The 'TST_EXP_FAIL()' is similar to 'TST_EXP_PASS()' but it fails the test if
-the call haven't failed with -1 and 'errno' wasn't set to the expected one
-passed as the second argument.
-
[source,c]
-------------------------------------------------------------------------------
const char *tst_strsig(int sig);
@@ -549,9 +484,9 @@ void tst_flush(void);
Flush output streams, handling errors appropriately.
This function is rarely needed when you have to flush the output streams
-before calling 'fork()' or 'clone()'. Note that the 'SAFE_FORK()' and 'SAFE_CLONE()'
-calls this function automatically. See 3.4 FILE buffers and fork() for explanation
-why is this needed.
+before calling 'fork()' or 'clone()'. Note that the 'SAFE_FORK()' calls this
+function automatically. See 3.4 FILE buffers and fork() for explanation why is
+this needed.
2.2.3 Test temporary directory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -619,7 +554,7 @@ struct tst_option {
};
-------------------------------------------------------------------------------
-Test specific command line parameters can be passed with the 'NULL' terminated
+Test specific command line parameters can be passed with the 'NULL'-terminated
array of 'struct tst_option'. The 'optstr' is the command line option i.e. "o"
or "o:" if option has a parameter. Only short options are supported. The 'arg'
is where 'optarg' is stored upon match. If option has no parameter it's set to
@@ -734,10 +669,10 @@ This happens when 'stdout' gets redirected to a file. In this case, the
'stdout' is not line buffered, but block buffered. Hence after a fork content
of the buffers will be printed by the parent and each of the children.
-To avoid that you should use 'SAFE_FORK()', 'SAFE_CLONE()' or 'tst_clone()'.
+To avoid that you should use 'SAFE_FORK()'.
IMPORTANT: You have to set the '.forks_child' flag in the test structure
- if your testcase forks or calls 'SAFE_CLONE()'.
+ if your testcase forks.
2.2.8 Doing the test in the child process
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -771,23 +706,6 @@ The 'tst_reap_children()' function makes the process wait for all of its
children and exits with 'tst_brk(TBROK, ...)' if any of them returned
a non zero exit code.
-When using 'SAFE_CLONE' or 'tst_clone', this may not work depending on
-the parameters passed to clone. The following call to 'SAFE_CLONE' is
-identical to 'fork()', so will work as expected.
-
-[source,c]
---------------------------------------------------------------------------------
-const struct tst_clone_args args = {
- .exit_signal = SIGCHLD,
-};
-
-SAFE_CLONE(&args);
---------------------------------------------------------------------------------
-
-If 'exit_signal' is set to something else, then this will break
-'tst_reap_children'. It's not expected that all parameters to clone will
-work with the LTP library unless specific action is taken by the test code.
-
.Using 'tst_res()' from binaries started by 'exec()'
[source,c]
-------------------------------------------------------------------------------
@@ -806,7 +724,7 @@ static void do_test(void)
execve(path, argv, environ);
- tst_res(TFAIL | TERRNO, "EXEC!");
+ tst_res(TBROK | TERRNO, "EXEC!");
}
static struct tst_test test = {
@@ -902,14 +820,11 @@ For the details of the interface, look into the 'include/tst_checkpoint.h'.
* Z - zombie process
* T - process is traced
*/
-TST_PROCESS_STATE_WAIT(pid, state, msec_timeout)
+TST_PROCESS_STATE_WAIT(pid, state)
-------------------------------------------------------------------------------
The 'TST_PROCESS_STATE_WAIT()' waits until process 'pid' is in requested
-'state' or timeout is reached. The call polls +/proc/pid/stat+ to get this
-information. A timeout of 0 will wait infinitely.
-
-On timeout -1 is returned and errno set to ETIMEDOUT.
+'state'. The call polls +/proc/pid/stat+ to get this information.
It's mostly used with state 'S' which means that process is sleeping in kernel
for example in 'pause()' or any other blocking syscall.
@@ -980,58 +895,39 @@ LTP_ALIGN(x, a)
Aligns the x to be next multiple of a. The a must be power of 2.
-2.2.13 Filesystem type detection and skiplist
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2.2.13 Filesystem type detection
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some tests are known to fail on certain filesystems (you cannot swap on TMPFS,
there are unimplemented 'fcntl()' etc.).
-If your test needs to be skipped on certain filesystems use the
-'.skip_filesystems' field in the tst_test structure as follows:
+If your test needs to be skipped on certain filesystems, use the interface
+below:
[source,c]
-------------------------------------------------------------------------------
#include "tst_test.h"
-static struct tst_test test = {
- ...
- .skip_filesystems = (const char *const []) {
- "tmpfs",
- "ramfs",
- "nfs",
- NULL
- },
-};
--------------------------------------------------------------------------------
-
-When the '.all_filesystem' flag is set the '.skip_filesystems' list is passed
-to the function that detects supported filesystems any listed filesystem is
-not included in the resulting list of supported filesystems.
-
-If test needs to adjust expectations based on filesystem type it's also
-possible to detect filesystem type at the runtime. This is preferably used
-when only subset of the test is not applicable for a given filesystem.
+ /*
+ * Unsupported only on NFS.
+ */
+ if (tst_fs_type(".") == TST_NFS_MAGIC)
+ tst_brk(TCONF, "Test not supported on NFS filesystem");
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-static void run(void)
-{
- ...
+ /*
+ * Unsupported on NFS, TMPFS and RAMFS
+ */
+ long type;
switch ((type = tst_fs_type("."))) {
case TST_NFS_MAGIC:
case TST_TMPFS_MAGIC:
case TST_RAMFS_MAGIC:
- tst_brk(TCONF, "Subtest not supported on %s",
+ tst_brk(TCONF, "Test not supported on %s filesystem",
tst_fs_type_name(type));
- return;
break;
}
-
- ...
-}
-------------------------------------------------------------------------------
2.2.14 Thread-safety in the LTP library
@@ -1181,17 +1077,6 @@ FS deferred IO metadata/cache interference, we suggest doing "syncfs" before the
tst_dev_bytes_written first invocation. And an inline function named tst_dev_sync
is created for that intention.
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-
-voud tst_find_backing_dev(const char *path, char *dev);
--------------------------------------------------------------------------------
-
-This function finds the block dev that this path belongs to, it uses stat function
-to get the major/minor number of the path. Then scan them in "/proc/self/mountinfo"
-and list 2th column value after ' - ' string as its block dev if match succeeds.
-
2.2.16 Formatting a device with a filesystem
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1219,9 +1104,6 @@ The extra options 'extra_opts' should either be 'NULL' if there are none, or a
will be passed after device name. e.g: +mkfs -t ext4 -b 1024 /dev/sda1 102400+
in this case.
-Note that perfer to store the options which can be passed before or after device
-name by 'fs_opts' array.
-
2.2.17 Verifying a filesystem's free space
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1308,17 +1190,6 @@ Directory is considered empty if it contains only '.' and '..'.
-------------------------------------------------------------------------------
#include "tst_test.h"
-void tst_purge_dir(const char *path);
--------------------------------------------------------------------------------
-
-Deletes the contents of given directory but keeps the directory itself. Useful
-for cleaning up the temporary directory and mount points between test cases or
-test iterations. Terminates the program with 'TBROK' on error.
-
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-
int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount);
-------------------------------------------------------------------------------
@@ -1328,31 +1199,11 @@ Fill a file with specified pattern using file descriptor.
-------------------------------------------------------------------------------
#include "tst_test.h"
-int tst_prealloc_size_fd(int fd, size_t bs, size_t bcount);
--------------------------------------------------------------------------------
-
-Preallocate the specified amount of space using 'fallocate()'. Falls back to
-'tst_fill_fd()' if 'fallocate()' fails.
-
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-
int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount);
-------------------------------------------------------------------------------
Creates/overwrites a file with specified pattern using file path.
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-
-int tst_prealloc_file(const char *path, size_t bs, size_t bcount);
--------------------------------------------------------------------------------
-
-Create/overwrite a file and preallocate the specified amount of space for it.
-The allocated space will not be initialized to any particular content.
-
2.2.19 Getting an unused PID number
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1386,32 +1237,28 @@ different once the call returns and should be used only for rough estimates.
-------------------------------------------------------------------------------
#include "tst_test.h"
-int tst_cmd(const char *const argv[],
+int tst_run_cmd(const char *const argv[],
const char *stdout_path,
const char *stderr_path,
- enum tst_cmd_flags flags);
+ int pass_exit_val);
-------------------------------------------------------------------------------
-'tst_cmd()' is a wrapper for 'vfork() + execvp()' which provides a way
+'tst_run_cmd' is a wrapper for 'vfork() + execvp()' which provides a way
to execute an external program.
-'argv[]' is a 'NULL' terminated array of strings starting with the program name
+'argv[]' is a NULL-terminated array of strings starting with the program name
which is followed by optional arguments.
-'TST_CMD_PASS_RETVAL' enum 'tst_cmd_flags' makes 'tst_cmd()'
-return the program exit code to the caller, otherwise 'tst_cmd()' exit the
-tests on failure. 'TST_CMD_TCONF_ON_MISSING' check for program in '$PATH' and exit
-with 'TCONF' if not found.
+A non-zero 'pass_exit_val' makes 'tst_run_cmd' return the program exit code to
+the caller. A zero for 'pass_exit_val' makes 'tst_run_cmd' exit the tests
+on failure.
-In case that 'execvp()' has failed and the enum 'TST_CMD_PASS_RETVAL' flag was set, the
+In case that 'execvp()' has failed and the 'pass_exit_val' flag was set, the
return value is '255' if 'execvp()' failed with 'ENOENT' and '254' otherwise.
'stdout_path' and 'stderr_path' determine where to redirect the program
stdout and stderr I/O streams.
-The 'SAFE_CMD()' macro can be used automatic handling non-zero exits (exits
-with 'TBROK') and 'ENOENT' (exits with 'TCONF').
-
.Example
[source,c]
-------------------------------------------------------------------------------
@@ -1421,7 +1268,7 @@ const char *const cmd[] = { "ls", "-l", NULL };
...
/* Store output of 'ls -l' into log.txt */
- tst_cmd(cmd, "log.txt", NULL, 0);
+ tst_run_cmd(cmd, "log.txt", NULL, 0);
...
-------------------------------------------------------------------------------
@@ -1561,7 +1408,7 @@ static struct tst_test test = {
If the test needs additional files to be copied to the test temporary
directory all you need to do is to list their filenames in the
-'NULL' terminated array '.resource_files' in the tst_test structure.
+'NULL'-terminated array '.resource_files' in the tst_test structure.
When resource files is set test temporary directory is created automatically,
there is need to set '.needs_tmpdir' as well.
@@ -1627,41 +1474,38 @@ test.c:8: INFO: do_action(arg) failed
2.2.24 Tainted kernels
^^^^^^^^^^^^^^^^^^^^^^
-If you need to detect whether a testcase triggers a kernel warning, bug or
-oops, the following can be used to detect TAINT_W or TAINT_D:
+If you need to detect, if a testcase triggers a kernel warning, bug or oops,
+the following can be used to detect TAINT_W or TAINT_D:
[source,c]
-------------------------------------------------------------------------------
#include "tst_test.h"
+#include "tst_taint.h"
-static struct tst_test test = {
+void setup(void)
+{
...
- .taint_check = TST_TAINT_W | TST_TAINT_D,
+ tst_taint_init(TST_TAINT_W | TST_TAINT_D);
...
-};
-
+}
+...
void run(void)
{
...
- if (tst_taint_check() != 0)
- tst_res(TFAIL, "kernel has issues");
+ if (tst_taint_check() == 0)
+ tst_res(TPASS, "kernel is not tainted");
else
- tst_res(TPASS, "kernel seems to be fine");
+ tst_res(TFAIL, "kernel is tainted");
}
-------------------------------------------------------------------------------
-To initialize taint checks, you have to set the taint flags you want to test
-for in the 'taint_check' attribute of the tst_test struct. LTP library will
-then automatically call 'tst_taint_init()' during test setup. The function
-will generate a 'TCONF' if the requested flags are not fully supported on the
-running kernel, and 'TBROK' if the kernel is already tainted before executing
-the test.
+You have to call tst_taint_init() with non-zero flags first, preferably during
+setup(). The function will generate a TCONF if the requested flags are not
+fully supported on the running kernel, and TBROK if either a zero mask was
+supplied or if the kernel is already tainted before executing the test.
-LTP library will then automatically check kernel taint at the end of testing.
-If '.all_filesystems' is set in struct tst_test, taint check will be performed
-after each file system and taint will abort testing early with 'TFAIL'. You
-can optionally also call 'tst_taint_check()' during 'run()', which returns 0
-or the tainted flags set in '/proc/sys/kernel/tainted' as specified earlier.
+Then you can call tst_taint_check() during run(), which returns 0 or the
+tainted flags set in /proc/sys/kernel/tainted as specified earlier.
Depending on your kernel version, not all tainted-flags will be supported.
@@ -1673,14 +1517,14 @@ https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html
^^^^^^^^^^^^^^^^
CRC32c checksum generation is supported by LTP. In order to use it, the
-test should include 'tst_checksum.h' header, then can call 'tst_crc32c()'.
+test should include "tst_checksum.h" header, then can call tst_crc32c().
2.2.26 Checking kernel for the driver support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some tests may need specific kernel drivers, either compiled in, or built
-as a module. If '.needs_drivers' points to a 'NULL' terminated array of kernel
-module names these are all checked and the test exits with 'TCONF' on the
+as a module. If .need_drivers points to a NULL-terminated array of kernel
+module names these are all checked and the test exits with TCONF on the
first missing driver.
Since it relies on modprobe command, the check will be skipped if the command
@@ -1691,7 +1535,7 @@ itself is not available on the system.
LTP library can be instructed to save and restore value of specified
(/proc|sys) files. This is achieved by initialized tst_test struct
-field 'save_restore'. It is a 'NULL' terminated array of strings where
+field 'save_restore'. It is a NULL terminated array of strings where
each string represents a file, whose value is saved at the beginning
and restored at the end of the test. Only first line of a specified
file is saved and restored.
@@ -1699,10 +1543,10 @@ file is saved and restored.
Pathnames can be optionally prefixed to specify how strictly (during
'store') are handled errors:
-* (no prefix) - test ends with 'TCONF', if file doesn't exist
+* (no prefix) - test ends with TCONF, if file doesn't exist
* '?' - test prints info message and continues,
if file doesn't exist or open/read fails
-* '!' - test ends with 'TBROK', if file doesn't exist
+* '!' - test ends with TBROK, if file doesn't exist
'restore' is always strict and will TWARN if it encounters any error.
@@ -1735,26 +1579,21 @@ on the system, disabled syscalls can be detected by checking for 'ENOSYS'
errno etc.
However in rare cases core kernel features couldn't be detected based on the
-kernel userspace API and we have to resort to parse the kernel .config.
+kernel userspace API and we have to resort to kernel .config parsing.
-For this cases the test should set the 'NULL' terminated '.needs_kconfigs'
-array of boolean expressions with constraints on the kconfig variables. The
-boolean expression consits of variables, two binary operations '&' and '|',
-negation '!' and correct sequence of parentesis '()'. Variables are expected
-to be in a form of "CONFIG_FOO[=bar]".
-
-The test will continue to run if all expressions are evaluated to 'True'.
-Missing variable is mapped to 'False' as well as variable with different than
-specified value, e.g. 'CONFIG_FOO=bar' will evaluate to 'False' if the value
-is anything else but 'bar'. If config variable is specified as plain
-'CONFIG_FOO' it's evaluated to true it's set to any value (typically =y or =m).
+For this cases the test should set the 'NULL' terminated needs_kconfig array
+of kernel config options required for the test. The config option can be
+specified either as plain "CONFIG_FOO" in which case it's sufficient for the
+test continue if it's set to any value (typically =y or =m). Or with a value
+as "CONFIG_FOO=bar" in which case the value has to match as well. The test is
+aborted with 'TCONF' if any of the required options were not set.
[source,c]
-------------------------------------------------------------------------------
#include "tst_test.h"
static const char *kconfigs[] = {
- "CONFIG_X86_INTEL_UMIP | CONFIG_X86_UMIP",
+ "CONFIG_X86_INTEL_UMIP",
NULL
};
@@ -1816,8 +1655,8 @@ over, rather than that the test library provides support for test variants.
The idea behind test variants is simple, we run the test several times each
time with different syscall variant.
-The implementation consist of test_variants integer that, if set, denotes number
-of test variants. The test is then forked and executed test_variants times each
+The implementation consist of test_variant integer that, if set, denotes number
+of test variants. The test is then forked and executed test_variant times each
time with different value in global tst_variant variable.
[source,c]
@@ -1963,7 +1802,7 @@ static void run(void)
if (TST_RET > -1) {
tst_res(TFAIL, "Created raw socket");
} else if (TST_ERR != EPERM) {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TBROK | TTERRNO,
"Failed to create socket for wrong reason");
} else {
tst_res(TPASS | TTERRNO, "Didn't create raw socket");
@@ -1991,7 +1830,7 @@ static struct tst_test test = {
--------------------------------------------------------------------------------
Look at the test struct at the bottom. We have filled in the 'caps' field with
-a 'NULL' terminated array containing two 'tst_cap' structs. 'TST_CAP_REQ'
+a NULL terminated array containing two 'tst_cap' structs. 'TST_CAP_REQ'
actions are executed before setup and 'TST_CAP_DROP' are executed after
setup. This means it is possible to both request and drop a capability.
@@ -2100,326 +1939,6 @@ specified by the user plus some other heuristics.
For full documentation see the comments in 'include/tst_fuzzy_sync.h'.
-2.2.34 Reserving hugepages
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Many of the LTP tests need to use hugepage in their testing, this allows the
-test can reserve hugepages from system only via '.request_hugepages = xx'.
-
-If set non-zero number of 'request_hugepages', test will try to reserve the
-expected number of hugepage for testing in setup phase. If system does not
-have enough hpage for using, it will try the best to reserve 80% available
-number of hpages. With success test stores the reserved hugepage number in
-'tst_hugepages'. For the system without hugetlb supporting, variable
-'tst_hugepages' will be set to 0.
-
-Also, we do cleanup and restore work for the hpages resetting automatically.
-
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-
-static void run(void)
-{
- ...
-
- if (tst_hugepages == test.request_hugepages)
- TEST(do_hpage_test);
- else
- ...
- ...
-}
-
-struct tst_test test = {
- .test_all = run,
- .request_hugepages = 2,
- ...
-};
--------------------------------------------------------------------------------
-
-or,
-
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-
-static void run(void)
-{
- ...
-}
-
-static void setup(void)
-{
-        if (tst_hugepages != test.requested_hugepages)
-                tst_brk(TCONF, "...");
-}
-
-struct tst_test test = {
- .test_all = run,
- .request_hugepages = 2,
- ...
-};
--------------------------------------------------------------------------------
-
-2.2.35 Checking for required commands
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Required commands can be checked with '.needs_cmds', which points to a 'NULL'
-terminated array of strings such as:
-
-[source,c]
--------------------------------------------------------------------------------
-.needs_cmds = (const char *const []) {
- "useradd",
- "userdel",
- NULL
-},
--------------------------------------------------------------------------------
-
-2.2.36 Assert sys or proc file value
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Using TST_ASSERT_INT/STR(path, val) to assert that integer value or string stored in
-the prefix field of file pointed by path equals to the value passed to this function.
-
-Also having a similar api pair TST_ASSERT_FILE_INT/STR(path, prefix, val) to assert
-the field value of file.
-
-2.2.36 Using Control Group
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Some LTP tests need specific Control Group configurations. tst_cgroup.h provides
-APIs to discover and use CGroups. There are many differences between CGroups API
-V1 and V2. We encapsulate the details of configuring CGroups in high-level
-functions which follow the V2 kernel API. Allowing one to use CGroups without
-caring too much about the current system's configuration.
-
-Also, the LTP library will automatically mount/umount and configure the CGroup
-hierarchies if that is required (e.g. if you run the tests from init with no
-system manager).
-
-[source,c]
--------------------------------------------------------------------------------
-#include "tst_test.h"
-#include "tst_cgroup.h"
-
-static const struct tst_cgroup_group *cg;
-
-static void run(void)
-{
- ...
- // do test under cgroup
- ...
-}
-
-static void setup(void)
-{
- tst_cgroup_require("memory", NULL);
- cg = tst_cgroup_get_test_group();
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%lu", MEMSIZE);
- if (SAFE_CGROUP_HAS(cg, "memory.swap.max"))
- SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%zu", memsw);
-}
-
-static void cleanup(void)
-{
- tst_cgroup_cleanup();
-}
-
-struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .cleanup = cleanup,
- ...
-};
--------------------------------------------------------------------------------
-
-Above, we first ensure the memory controller is available on the
-test's CGroup with 'tst_cgroup_require'. We then get a structure,
-'cg', which represents the test's CGroup. Note that
-'tst_cgroup_get_test_group' should not be called many times, as it is
-allocated in a guarded buffer (See section 2.2.31). Therefor it is
-best to call it once in 'setup' and not 'run' because 'run' may be
-repeated with the '-i' option.
-
-We then write the current processes PID into 'cgroup.procs', which
-moves the current process into the test's CGroup. After which we set
-the maximum memory size by writing to 'memory.max'. If the memory
-controller is mounted on CGroups V1 then the library will actually
-write to 'memory.limit_in_bytes'. As a general rule, if a file exists
-on both CGroup versions, then we use the V2 naming.
-
-Some controller features, such as 'memory.swap', can be
-disabled. Therefor we need to check if they exist before accessing
-them. This can be done with 'SAFE_CGROUP_HAS' which can be called on
-any control file or feature.
-
-Most tests only require setting a few limits similar to the above. In
-such cases the differences between V1 and V2 are hidden. Setup and
-cleanup is also mostly hidden. However things can get much worse.
-
-[source,c]
--------------------------------------------------------------------------------
-static const struct tst_cgroup_group *cg;
-static const struct tst_cgroup_group *cg_drain;
-static struct tst_cgroup_group *cg_child;
-
-static void run(void)
-{
- char buf[BUFSIZ];
- size_t mem = 0;
-
- cg_child = tst_cgroup_group_mk(cg, "child");
- SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
-
- if (TST_CGROUP_VER(cg, "memory") != TST_CGROUP_V1)
- SAFE_CGROUP_PRINT(cg, "cgroup.subtree_control", "+memory");
- if (TST_CGROUP_VER(cg, "cpuset") != TST_CGROUP_V1)
- SAFE_CGROUP_PRINT(cg, "cgroup.subtree_control", "+cpuset");
-
- if (!SAFE_FORK()) {
- SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
-
- if (SAFE_CGROUP_HAS(cg_child, "memory.swap"))
- SAFE_CGROUP_SCANF(cg_child, "memory.swap.current", "%zu", &mem);
- SAFE_CGROUP_READ(cg_child, "cpuset.mems", buf, sizeof(buf));
-
- // Do something with cpuset.mems and memory.current values
- ...
-
- exit(0);
- }
-
- tst_reap_children();
- SAFE_CGROUP_PRINTF(cg_drain, "cgroup.procs", "%d", getpid());
- cg_child = tst_cgroup_group_rm(cg_child);
-}
-
-static void setup(void)
-{
- tst_cgroup_require("memory", NULL);
- tst_cgroup_require("cpuset", NULL);
-
- cg = tst_cgroup_get_test_group();
- cg_drain = tst_cgroup_get_drain_group();
-}
-
-static void cleanup(void)
-{
- if (cg_child) {
- SAFE_CGROUP_PRINTF(cg_drain, "cgroup.procs", "%d", getpid());
- cg_child = tst_cgroup_group_rm(cg_child);
- }
-
- tst_cgroup_cleanup();
-}
-
-struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .cleanup = cleanup,
- ...
-};
--------------------------------------------------------------------------------
-
-Starting with setup; we can see here that we also fetch the 'drain'
-CGroup. This is a shared group (between parallel tests) which may
-contain processes from other tests. It should have default settings and
-these should not be changed by the test. It can be used to remove
-processes from other CGroups incase the hierarchy root is not
-accessible.
-
-In 'run', we first create a child CGroup with 'tst_cgroup_mk'. As we
-create this CGroup in 'run' we should also remove it at the end of
-run. We also need to check if it exists and remove it in cleanup as
-well. Because there are 'SAFE_' functions which may jump to cleanup.
-
-We then move the main test process into the child CGroup. This is
-important as it means that before we destroy the child CGroup we have
-to move the main test process elsewhere. For that we use the 'drain'
-group.
-
-Next we enable the memory and cpuset controller configuration on the
-test CGroup's descendants (i.e. 'cg_child'). This allows each child to
-have its own settings. The file 'cgroup.subtree_control' does not
-exist on V1. Because it is possible to have both V1 and V2 active at
-the same time. We can not simply check if 'subtree_control' exists
-before writing to it. We have to check if a particular controller is
-on V2 before trying to add it to 'subtree_control'. Trying to add a V1
-controller will result in 'ENOENT'.
-
-We then fork a child process and add this to the child CGroup. Within
-the child process we try to read 'memory.swap.current'. It is possible
-that the memory controller was compiled without swap support, so it is
-necessary to check if 'memory.swap' is enabled. That is unless the
-test will never reach the point where 'memory.swap.*' are used without
-swap support.
-
-The parent process waits for the child process to be reaped before
-destroying the child CGroup. So there is no need to transfer the child
-to drain. However the parent process must be moved otherwise we will
-get 'EBUSY' when trying to remove the child CGroup.
-
-Another example of an edge case is the following.
-
-[source,c]
--------------------------------------------------------------------------------
- if (TST_CGROUP_VER(cg, "memory") == TST_CGROUP_V1)
- SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", ~0UL);
- else
- SAFE_CGROUP_PRINT(cg, "memory.swap.max", "max");
--------------------------------------------------------------------------------
-
-CGroups V2 introduced a feature where 'memory[.swap].max' could be set to
-"max". This does not appear to work on V1 'limit_in_bytes' however. For most
-tests, simply using a large number is sufficient and there is no need to use
-"max". Importantly though, one should be careful to read both the V1 and V2
-kernel docs. The LTP library can not handle all edge cases. It does the minimal
-amount of work to make testing on both V1 and V2 feasible.
-
-2.2.37 Require minimum numbers of CPU for a testcase
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Some tests require more than specific number of CPU. It can be defined with
-`.min_cpus = N`.
-
-2.2.38 Test tags
-^^^^^^^^^^^^^^^^
-
-Test tags are name-value pairs that can hold any test metadata.
-
-We have additional support for CVE entries, git commit in mainline kernel,
-stable kernel or glibc git repository. If a test is a regression test it
-should include these tags. They are printed when test fails and exported
-into documentation.
-
-CVE, mainline and stable kernel git commits in a regression test for a kernel bug:
-[source,c]
--------------------------------------------------------------------------------
-struct tst_test test = {
- ...
- .tags = (const struct tst_tag[]) {
- {"linux-git", "9392a27d88b9"},
- {"linux-git", "ff002b30181d"},
- {"linux-stable-git", "c4a23c852e80"},
- {"CVE", "2020-29373"},
- {}
- }
-};
--------------------------------------------------------------------------------
-
-Glibc git commit in a regression test for a glibc bug:
-[source,c]
--------------------------------------------------------------------------------
-struct tst_test test = {
- ...
- .tags = (const struct tst_tag[]) {
- {"glibc-git", "574500a108be"},
- {}
- }
-};
--------------------------------------------------------------------------------
-
2.3 Writing a testcase in shell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2475,15 +1994,11 @@ able to clean up correctly even in this situation. The easiest solution for
this is to keep track of what was initialized and act accordingly in the
cleanup.
-WARNING: Similar to the C library, calling 'tst_brk' in the $TST_CLEANUP does
+WARNING: Similar to the C library, calling tst_brk() in the $TST_CLEANUP does
not exit the test and 'TBROK' is converted to 'TWARN'.
-Notice also the 'tst_run' shell API function called at the end of the test that
-actually starts the test.
-
-WARNING: cleanup function is called only after 'tst_run' has been started.
-Calling 'tst_brk' in shell libraries, e.g. 'tst_test.sh' or 'tst_net.sh' does
-not trigger calling it.
+Notice also the 'tst_run' function called at the end of the test that actually
+starts the test.
[source,sh]
-------------------------------------------------------------------------------
@@ -2600,8 +2115,8 @@ tst_run
'$TST_TEST_DATA' can be used with '$TST_CNT'. If '$TST_TEST_DATA_IFS' not specified,
space as default value is used. Of course, it's possible to use separate functions.
-2.3.2 Library environment variables and functions for shell
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2.3.2 Library environment variables for shell
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Similarily to the C library various checks and preparations can be requested
simply by setting right '$TST_NEEDS_FOO'.
@@ -2609,8 +2124,7 @@ simply by setting right '$TST_NEEDS_FOO'.
[options="header"]
|=============================================================================
| Variable name | Action done
-| 'TST_NEEDS_ROOT' | Exit the test with 'TCONF' unless executed under root.
-| | Alternatively the 'tst_require_root' command can be used.
+| 'TST_NEEDS_ROOT' | Exit the test with 'TCONF' unless executed under root
| 'TST_NEEDS_TMPDIR' | Create test temporary directory and cd into it.
| 'TST_NEEDS_DEVICE' | Prepare test temporary device, the path to testing
device is stored in '$TST_DEVICE' variable.
@@ -2622,19 +2136,11 @@ simply by setting right '$TST_NEEDS_FOO'.
| 'TST_TIMEOUT' | Maximum timeout set for the test in sec. Must be int >= 1,
or -1 (special value to disable timeout), default is 300.
Variable is meant be set in tests, not by user.
- It's an equivalent of `tst_test.timeout` in C, can be set
- via 'tst_set_timeout(timeout)' after test has started.
-|=============================================================================
-
-[options="header"]
-|=============================================================================
-| Function name | Action done
-| 'tst_set_timeout(timeout)' | Maximum timeout set for the test in sec.
- See 'TST_TIMEOUT' variable.
+ It's equivalent of `tst_test.timeout` in C.
|=============================================================================
NOTE: Network tests (see testcases/network/README.md) use additional variables
-and functions in 'tst_net.sh'.
+in 'tst_net.sh'.
Checking for presence of commands
+++++++++++++++++++++++++++++++++
@@ -2660,10 +2166,7 @@ runtime, since sometimes we need to the check at runtime too.
'tst_check_cmds()' can be used for requirements just for a particular test
as it doesn't exit (it issues 'tst_res TCONF'). Expected usage is:
-
-[source,sh]
--------------------------------------------------------------------------------
-#!/bin/sh
+...
TST_TESTFUNC=do_test
. tst_test.sh
@@ -2676,7 +2179,7 @@ do_test()
}
tst_run
--------------------------------------------------------------------------------
+...
Locating kernel modules
+++++++++++++++++++++++
@@ -2688,9 +2191,6 @@ module in a few possible paths.
If module was found the path to it will be stored into '$TST_MODPATH'
variable, if module wasn't found the test will exit with 'TCONF'.
-Alternatively the 'tst_require_module()' function can be used to do the same
-at runtime.
-
2.3.3 Optional command line parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -2814,63 +2314,30 @@ that can sleep for defined amount of seconds, milliseconds or microseconds.
tst_sleep 100ms
-------------------------------------------------------------------------------
-Retry a function call multiple times
-++++++++++++++++++++++++++++++++++++
-
-Sometimes an LTP test needs to retry a function call multiple times because
-the system is not ready to process it successfully on the first try. The LTP
-library has useful tools to handle the call retry automatically.
-'TST_RETRY_FUNC()' will keep retrying for up to 1 second. If you want a custom
-time limit use 'TST_RETRY_FN_EXP_BACKOFF()'. Both methods return the value
-returned by the last 'FUNC' call.
-
-The delay between retries starts at 1 microsecond and doubles after each call.
-The retry loop ends when the function call succeeds or when the next delay
-exceeds the specified time (1 second for 'TST_RETRY_FUNC()'). The maximum
-delay is multiplied by TST_TIMEOUT_MUL. The total cumulative delay may be up
-to twice as long as the adjusted maximum delay.
-
-The C version of 'TST_RETRY_FUNC()' is a macro which takes two arguments:
-
-* 'FUNC' is the complete function call with arguments which should be retried
- multiple times.
-* 'SUCCESS_CHECK' is a macro or function which will validate 'FUNC' return
- value. 'FUNC' call was successful if 'SUCCESS_CHECK(ret)' evaluates to
- non-zero.
-
-Both retry methods clear 'errno' before every 'FUNC' call so your
-'SUCCESS_CHECK' can look for specific error codes as well. The LTP library
-also includes predefined 'SUCCESS_CHECK' macros for the most common call
-conventions:
+Retry a function in limited time
+++++++++++++++++++++++++++++++++
-* 'TST_RETVAL_EQ0()' - The call was successful if 'FUNC' returned 0 or NULL
-* 'TST_RETVAL_NOTNULL()' - The call was successful if 'FUNC' returned any
- value other than 0 or NULL.
-* 'TST_RETVAL_GE0()' - The call was successful if 'FUNC' returned value >= 0.
+Sometimes LTP test needs retrying a function for many times to get success.
+This achievement makes that possible via keeping it retrying if the return
+value of the function is NOT as we expected. After exceeding a limited time,
+test will break from the retries immediately. The time limit is multiplied
+with LTP_TIMEOUT_MUL.
[source,c]
-------------------------------------------------------------------------------
-/* Keep trying for 1 second */
-TST_RETRY_FUNC(FUNC, SUCCESS_CHECK)
+# retry function in 1 second
+TST_RETRY_FUNC(FUNC, EXPECTED_RET)
-/* Keep trying for up to 2*N seconds */
-TST_RETRY_FN_EXP_BACKOFF(FUNC, SUCCESS_CHECK, N)
+# retry function in N second
+TST_RETRY_FN_EXP_BACKOFF(FUNC, EXPECTED_RET, N)
-------------------------------------------------------------------------------
-The shell version of 'TST_RETRY_FUNC()' is simpler and takes slightly
-different arguments:
-
-* 'FUNC' is a string containing the complete function or program call with
- arguments.
-* 'EXPECTED_RET' is a single expected return value. 'FUNC' call was successful
- if the return value is equal to EXPECTED_RET.
-
[source,sh]
-------------------------------------------------------------------------------
-# Keep trying for 1 second
+# retry function in 1 second
TST_RETRY_FUNC "FUNC arg1 arg2 ..." "EXPECTED_RET"
-# Keep trying for up to 2*N seconds
+# retry function in N second
TST_RETRY_FN_EXP_BACKOFF "FUNC arg1 arg2 ..." "EXPECTED_RET" "N"
-------------------------------------------------------------------------------
@@ -2951,7 +2418,7 @@ ROD_SILENT command arg1 arg2 ...
command arg1 arg2 ... > /dev/null 2>&1
if [ $? -ne 0 ]; then
- tst_brk TBROK "..."
+ tst_brkm TBROK "..."
fi
@@ -2961,7 +2428,7 @@ ROD command arg1 arg2 ...
ROD arg1 arg2 ...
if [ $? -ne 0 ]; then
- tst_brk TBROK "..."
+ tst_brkm TBROK "..."
fi
-------------------------------------------------------------------------------
@@ -2992,8 +2459,8 @@ EXPECT_PASS command arg1 arg2 ... [ \> file ]
EXPECT_FAIL command arg1 arg2 ... [ \> file ]
-------------------------------------------------------------------------------
-'EXPECT_PASS' calls 'tst_res TPASS' if the command exited with 0 exit code,
-and 'tst_res TFAIL' otherwise. 'EXPECT_FAIL' does vice versa.
+'EXPECT_PASS' calls 'tst_resm TPASS' if the command exited with 0 exit code,
+and 'tst_resm TFAIL' otherwise. 'EXPECT_FAIL' does vice versa.
Output redirection rules are the same as for the 'ROD' function. In addition
to that, 'EXPECT_FAIL' always redirects the command's stderr to '/dev/null'.
@@ -3212,11 +2679,10 @@ skips 'atexit(3)' callbacks.
4. Test Contribution Checklist
------------------------------
-1. Test compiles and runs fine (check with `-i 10` too)
-2. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl[checkpatch.pl]
- does not report any errors
+1. Test compiles and runs fine (check with -i 10 too)
+2. Checkpatch does not report any errors
3. The runtest entires are in place
-4. Test binaries are added into corresponding '.gitignore' files
+4. Test files are added into corresponding .gitignore files
5. Patches apply over the latest git
diff --git a/doc/user-guide.txt b/doc/user-guide.txt
index 8df29e688..13865bc88 100644
--- a/doc/user-guide.txt
+++ b/doc/user-guide.txt
@@ -1,7 +1,7 @@
LTP User Guidelines
===================
-For compiling, installing and running the tests see `README.md`.
+For compiling and installing and running the tests see `README.md`.
For running LTP network tests see `testcases/network/README.md`.
1. Library environment variables
@@ -13,16 +13,13 @@ For running LTP network tests see `testcases/network/README.md`.
| 'LTPROOT' | Prefix for installed LTP, the default is '/opt/ltp'.
| 'LTP_COLORIZE_OUTPUT' | Force colorized output behaviour. 'y' or '1': always colorize
'n' or '0': never colorize.
-| 'LTP_DEV' | Path to the block device to be used
- (C: '.needs_device = 1', shell: 'TST_NEEDS_DEVICE=1').
-| 'LTP_DEV_FS_TYPE' | Filesystem used for testing (default: 'ext2').
| 'LTP_TIMEOUT_MUL' | Multiply timeout, must be number >= 1 (> 1 is useful for
slow machines to avoid unexpected timeout).
Variable is also used in shell tests, but ceiled to int.
| 'PATH' | It's required to addjust path:
`PATH="$PATH:$LTPROOT/testcases/bin"`
-| 'TMPDIR' | Base directory for template directory (C: '.needs_tmpdir = 1'
- and others, which imply it, shell: 'TST_NEEDS_TMPDIR=1').
+| 'TMPDIR' | Base directory for template directory, which is required by C tests
+ `tst_test->needs_tmpdir=1` (or others) or shell 'TST_NEEDS_TMPDIR=1').
| 'TST_NO_CLEANUP' | Disable running test cleanup (defined in 'TST_CLEANUP').
|==============================================================================
diff --git a/docparse/.gitignore b/docparse/.gitignore
deleted file mode 100644
index 7a87b4234..000000000
--- a/docparse/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/*.txt
-/docbook-xsl.css
-/docparse
-/metadata.json
-/metadata.html
-/metadata.pdf
-/metadata.chunked/
diff --git a/docparse/Makefile b/docparse/Makefile
deleted file mode 100644
index e2defad38..000000000
--- a/docparse/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-
-top_srcdir ?= ..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-include $(top_srcdir)/include/mk/functions.mk
-
-ifeq ($(METADATA_GENERATOR),asciidoctor)
-METADATA_GENERATOR_CMD := asciidoctor
-METADATA_GENERATOR_PARAMS := -d book metadata.txt
-METADATA_GENERATOR_PARAMS_HTML := -b xhtml
-METADATA_GENERATOR_PARAMS_PDF := -b pdf -r asciidoctor-pdf
-else ifeq ($(METADATA_GENERATOR),asciidoc)
-METADATA_GENERATOR_CMD := a2x
-METADATA_GENERATOR_PARAMS := --xsltproc-opts "--stringparam toc.section.depth 1" -d book -L --resource="$(PWD)" metadata.txt
-METADATA_GENERATOR_PARAMS_HTML := -f xhtml
-METADATA_GENERATOR_PARAMS_PDF := -f pdf
-METADATA_GENERATOR_PARAMS_HTML_CHUNKED := -f chunked
-else ifeq ($(METADATA_GENERATOR),)
-$(error 'METADATA_GENERATOR' not not configured, run ./configure in the root directory)
-else
-$(error '$(METADATA_GENERATOR)' not supported, only asciidoctor and asciidoc are supported)
-endif
-
-ifdef VERBOSE
-METADATA_GENERATOR_PARAMS += -v
-endif
-
-CLEAN_TARGETS := *.css *.js *.txt
-MAKE_TARGETS := metadata.json
-
-ifeq ($(WITH_METADATA_HTML),yes)
-MAKE_TARGETS += metadata.html
-ifneq ($(METADATA_GENERATOR_PARAMS_HTML_CHUNKED),)
-MAKE_TARGETS += metadata.chunked
-endif
-endif
-
-ifeq ($(WITH_METADATA_PDF),yes)
-MAKE_TARGETS += metadata.pdf
-endif
-
-HOST_MAKE_TARGETS := docparse
-
-INSTALL_DIR = metadata
-INSTALL_TARGETS = *.css *.js
-
-ifndef METADATA_GENERATOR
-METADATA_GENERATOR := asciidoctor
-endif
-
-.PHONY: metadata.json
-
-metadata.json: docparse
- $(abs_srcdir)/parse.sh > metadata.json
-
-txt: metadata.json
- $(abs_srcdir)/testinfo.pl metadata.json
-
-ifeq ($(WITH_METADATA_HTML),yes)
-metadata.html: txt
- $(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_HTML)
-
-ifneq ($(METADATA_GENERATOR_PARAMS_HTML_CHUNKED),)
-metadata.chunked: txt
- $(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_HTML_CHUNKED)
-endif
-endif
-
-ifeq ($(WITH_METADATA_PDF),yes)
-metadata.pdf: txt
- $(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_PDF)
-endif
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/docparse/README.md b/docparse/README.md
deleted file mode 100644
index 37bf4614b..000000000
--- a/docparse/README.md
+++ /dev/null
@@ -1,248 +0,0 @@
-Motivation for metadata exctraction
-===================================
-
-Exporting documentation
------------------------
-
-This allow us to build browseable documentation for the testcases, e.g. a
-catalogue of test information that would be searchable etc. At this point there
-is a single page generated from the extracted data that tries to outline the
-intent.
-
-
-Propagating test requirements
------------------------------
-
-Some subtests require differnt hardware resources/software versions/etc. the
-test execution framework needs to consume these so that it can locate proper
-hardware, install proper software, etc.
-
-Some examples of requriments are:
-
-* Test needs at least 1GB of RAM.
-
-* Test needs a block device at least 512MB in size
-
-* Test needs a NUMA machine with two memory nodes and at least 300 free pages on each node
-
-* Test needs i2c eeprom connected on a i2c bus
-
-* Test needs two serial ports connected via null-modem cable
-
-
-With this information extracted from the tests the testrunner can then map the
-requiremnts on the available machines in a lab and select a proper machine for
-the particular (sub)set of testcases as well as supply a particular test with
-additional information needed for the test, such as address of the i2c device,
-paths to the serial devices, etc. In the case of virtual machines the test could
-also dynamically prepare the correct environment for the test on demand.
-
-
-Parallel test execution
------------------------
-
-An LTP testrun on a modern hardware wastes most of the machine resources
-because the testcases are running sequentially. However in order to execute
-tests in parallel we need to know which system resources are utilized by a
-given test, as obviously we cannot run two tests that monopolize the same
-resource. In some cases we would also need to partition the system resource
-accordingly, e.g. if we have two memory stress tests running at the same time
-we will need to cap each of these tests on half of the available memory, or
-make sure that sum of the memory used by these two tests is not greater an
-available memory.
-
-Examples of such tests are:
-
-* Tests that mess with global system state
- - system time (e.g. settimeofday() test and leap second test)
- - SysV SHM
- - ...
-
-* Tests that use block device
-
-* Tests that work with a particular hardware resource
- - i2c eeprom test
- - serial port tests
- - ...
-
-Exporting test runtime/timeout to the testrunner
-------------------------------------------------
-
-Currently most of the testrunners usually do not know for how long is the test
-supposed to run, this means that we have to guess some upper limit on how long
-a test is supposed to run. The value is usually twice of the maximal runtime
-for all testcases or whole suite or even larger. This means that we are wasting
-time in the case that the test ends up stuck and we could have failed it much
-sooner in most of the cases. This becomes quite important for a kernel
-regression tests that do crash the host, if the information that the test is
-supposed to crash a kernel under a minute is exported to the testrunner we can
-reboot the machine much faster in an event of a crash.
-
-Getting rid of runtest files
-----------------------------
-
-This would also allow us to get rid of the unflexible and hard to maintain
-runtest files. Once this system is in place we will have a list of all tests
-along with their respective metadata - which means that we will be able to
-generate subsets of the test easily on the fly.
-
-In order to achieve this we need two things:
-
-Each test will describe which syscall/functionality it tests in the metadata.
-Then we could define groups of tests based on that. I.e. instead of having
-syscall runtest file we would ask the testrunner to run all test that have a
-defined which syscall they test, or whose filename matches a particular syscall name.
-
-Secondly we will have to store the test variants in the test metadata instead
-of putting them in a file that is unrelated to the test.
-
-For example:
-
-* To run CVE related test we would select testcases with CVE tag
-
-* To run IPC test we will define a list of IPC syscalls and run all syscall
- test that are in the list
-
-* And many more...
-
-
-Implementation
-==============
-
-The docparser is implemented as a minimal C tokenizer that can parse and
-extract code comments and C structures. The docparser then runs over all C
-sources in the testcases directory and if tst\_test structure is present in the
-source it's parsed and the result is included in the resulting metadata.
-
-During parsing the metadata is stored in a simple key/value storage that more
-or less follows C structure layout, i.e. can include hash, array, and string.
-Once the parsing is finished the result is filtered so that only interesting
-fields of the tst\_test structure are included and then converted into JSON
-output.
-
-This process produces one big JSON file with metadata for all tests, that
-is then installed along with the testcases. This would then be used by the
-testrunner.
-
-The test requirements are stored in the tst\_test structure either as
-bitflags, integers or arrays of strings:
-
-```c
-struct tst_test test = {
- ...
- /* tests needs to run with UID=0 */
- .needs_root = 1,
-
- /*
- * Tests needs a block device at least 1024MB in size and also
- * mkfs.ext4 installed.
- */
- .needs_device = 1,
- .dev_min_size = 1024,
- .dev_fs_type = ext4,
-
- /* Indicates that the test is messing with system wall clock */
- .restore_wallclock = 1,
-
- /* Tests needs uinput either compiled in or loaded as a module */
- .needs_drivers = (const char *[]) {
- "uinput",
- NULL
- },
-
- /* Tests needs enabled kernel config flags */
- .needs_kconfigs = (const char *[]) {
- "CONFIG_X86_INTEL_UMIP=y",
- NULL
- },
-
- /* Additional array of key value pairs */
- .tags = (const struct tst_tag[]) {
- {"linux-git", "43a6684519ab"},
- {"CVE", "2017-2671"},
- {NULL, NULL}
- }
-};
-```
-
-The test documentation is stored in a special comment such as:
-
-```
-/*\
- * Test description
- *
- * This is a test description.
- * Consisting of several lines.
- */
-```
-
-Which will yield following json output:
-
-```json
- "testcaseXY": {
- "needs_root": "1",
- "needs_device": "1",
- "dev_min_size": "1024",
- "dev_fs_type": "ext4",
- "restore_wallclock": "1",
- "needs_drivers": [
- "uinput",
- ],
- "needs_kconfigs": [
- "CONFIG_X86_INTEL_UMIP=y",
- ],
- "tags": [
- [
- "linux-git",
- "43a6684519ab"
- ],
- [
- "CVE",
- "2017-2671"
- ],
- ],
- "doc": [
- "Test description",
- "",
- "This is a test description.",
- "Consisting of several lines."
- ],
- "fname": "testcases/kernel/syscalls/foo/testcaseXY.c"
- },
-```
-
-The final JSON file is JSON object of test descriptions indexed by a test name
-with a header describing the testsuite:
-
-```json
-{
- "testsuite": "Linux Test Project",
- "testsuite_short": "LTP",
- "url": "https://github.com/linux-test-project/ltp/",
- "scm_url_base": "https://github.com/linux-test-project/ltp/tree/master/",
- "timeout": 300,
- "version": "20200930",
- "tests": {
- "testcaseXY": {
- ...
- },
- ...
- }
-}
-```
-
-Open Points
-===========
-
-There are stil some loose ends. Mostly it's not well defined where to put
-things and how to format them.
-
-* Some of the hardware requirements are already listed in the tst\_test. Should
- we put all of them there?
-
-* What would be the format for test documentation and how to store things such
- as test variants there?
-
-So far this proof of concept generates a metadata file. I guess that we need
-actual consumers which will help to settle things down, I will try to look into
-making use of this in the runltp-ng at least as a reference implementation.
diff --git a/docparse/data_storage.h b/docparse/data_storage.h
deleted file mode 100644
index 339450c8b..000000000
--- a/docparse/data_storage.h
+++ /dev/null
@@ -1,333 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
- */
-
-#ifndef DATA_STORAGE_H__
-#define DATA_STORAGE_H__
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-enum data_type {
- DATA_ARRAY,
- DATA_HASH,
- DATA_STRING,
-};
-
-struct data_node_array {
- enum data_type type;
- unsigned int array_len;
- unsigned int array_used;
- struct data_node *array[];
-};
-
-struct data_hash_elem {
- struct data_node *node;
- char *id;
-};
-
-struct data_node_hash {
- enum data_type type;
- unsigned int elems_len;
- unsigned int elems_used;
- struct data_hash_elem elems[];
-};
-
-struct data_node_string {
- enum data_type type;
- char val[];
-};
-
-struct data_node {
- union {
- enum data_type type;
- struct data_node_hash hash;
- struct data_node_array array;
- struct data_node_string string;
- };
-};
-
-static inline struct data_node *data_node_string(const char *string)
-{
- size_t size = sizeof(struct data_node_string) + strlen(string) + 1;
- struct data_node *node = malloc(size);
-
- if (!node)
- return NULL;
-
- node->type = DATA_STRING;
- strcpy(node->string.val, string);
-
- return node;
-}
-
-#define MAX_ELEMS 100
-
-static inline struct data_node *data_node_hash(void)
-{
- size_t size = sizeof(struct data_node_hash)
- + MAX_ELEMS * sizeof(struct data_hash_elem);
- struct data_node *node = malloc(size);
-
- if (!node)
- return NULL;
-
- node->type = DATA_HASH;
- node->hash.elems_len = MAX_ELEMS;
- node->hash.elems_used = 0;
-
- return node;
-}
-
-static inline struct data_node *data_node_array(void)
-{
- size_t size = sizeof(struct data_node_array) +
- + MAX_ELEMS * sizeof(struct data_node*);
- struct data_node *node = malloc(size);
-
- if (!node)
- return NULL;
-
- node->type = DATA_ARRAY;
- node->array.array_len = MAX_ELEMS;
- node->array.array_used = 0;
-
- return node;
-}
-
-static inline int data_node_hash_add(struct data_node *self, const char *id, struct data_node *payload)
-{
- if (self->type != DATA_HASH)
- return 1;
-
- struct data_node_hash *hash = &self->hash;
-
- if (hash->elems_used == hash->elems_len)
- return 1;
-
- struct data_hash_elem *elem = &hash->elems[hash->elems_used++];
-
- elem->node = payload;
- elem->id = strdup(id);
-
- return 0;
-}
-
-static inline void data_node_free(struct data_node *self)
-{
- unsigned int i;
-
- switch (self->type) {
- case DATA_STRING:
- break;
- case DATA_HASH:
- for (i = 0; i < self->hash.elems_used; i++) {
- data_node_free(self->hash.elems[i].node);
- free(self->hash.elems[i].id);
- }
- break;
- case DATA_ARRAY:
- for (i = 0; i < self->array.array_used; i++)
- data_node_free(self->array.array[i]);
- break;
- }
-
- free(self);
-}
-
-static inline int data_node_hash_del(struct data_node *self, const char *id)
-{
- unsigned int i;
- struct data_node_hash *hash = &self->hash;
-
- for (i = 0; i < hash->elems_used; i++) {
- if (!strcmp(hash->elems[i].id, id))
- break;
- }
-
- if (i >= hash->elems_used)
- return 0;
-
- data_node_free(hash->elems[i].node);
- free(hash->elems[i].id);
-
- hash->elems[i] = hash->elems[--hash->elems_used];
-
- return 1;
-}
-
-static struct data_node *data_node_hash_get(struct data_node *self, const char *id)
-{
- unsigned int i;
- struct data_node_hash *hash = &self->hash;
-
- for (i = 0; i < hash->elems_used; i++) {
- if (!strcmp(hash->elems[i].id, id))
- break;
- }
-
- if (i >= hash->elems_used)
- return NULL;
-
- return hash->elems[i].node;
-}
-
-static inline int data_node_array_add(struct data_node *self, struct data_node *payload)
-{
- if (self->type != DATA_ARRAY)
- return 1;
-
- struct data_node_array *array = &self->array;
-
- if (array->array_used == array->array_len)
- return 1;
-
- array->array[array->array_used++] = payload;
-
- return 0;
-}
-
-static inline unsigned int data_node_array_len(struct data_node *self)
-{
- if (self->type != DATA_ARRAY)
- return 0;
-
- return self->array.array_used;
-}
-
-static inline void data_print_padd(unsigned int i)
-{
- while (i-- > 0)
- putchar(' ');
-}
-
-static inline void data_node_print_(struct data_node *self, unsigned int padd)
-{
- unsigned int i;
-
- switch (self->type) {
- case DATA_STRING:
- data_print_padd(padd);
- printf("'%s'\n", self->string.val);
- break;
- case DATA_HASH:
- for (i = 0; i < self->hash.elems_used; i++) {
- data_print_padd(padd);
- printf("%s = {\n", self->hash.elems[i].id);
- data_node_print_(self->hash.elems[i].node, padd+1);
- data_print_padd(padd);
- printf("},\n");
- }
- break;
- case DATA_ARRAY:
- for (i = 0; i < self->array.array_used; i++) {
- data_print_padd(padd);
- printf("{\n");
- data_node_print_(self->array.array[i], padd+1);
- data_print_padd(padd);
- printf("},\n");
- }
- break;
- }
-}
-
-static inline void data_node_print(struct data_node *self)
-{
- printf("{\n");
- data_node_print_(self, 1);
- printf("}\n");
-}
-
-static inline void data_fprintf(FILE *f, unsigned int padd, const char *fmt, ...)
- __attribute__((format (printf, 3, 4)));
-
-static inline void data_fprintf(FILE *f, unsigned int padd, const char *fmt, ...)
-{
- va_list va;
-
- while (padd-- > 0)
- putc(' ', f);
-
- va_start(va, fmt);
- vfprintf(f, fmt, va);
- va_end(va);
-}
-
-
-static inline void data_fprintf_esc(FILE *f, unsigned int padd, const char *str)
-{
- while (padd-- > 0)
- fputc(' ', f);
-
- fputc('"', f);
-
- while (*str) {
- switch (*str) {
- case '\\':
- fputs("\\\\", f);
- break;
- case '"':
- fputs("\\\"", f);
- break;
- case '\t':
- fputs(" ", f);
- break;
- default:
- /* RFC 8259 specify chars before 0x20 as invalid */
- if (*str >= 0x20)
- putc(*str, f);
- else
- fprintf(stderr, "%s:%d: WARNING: invalid character for JSON: %x\n",
- __FILE__, __LINE__, *str);
- break;
- }
- str++;
- }
-
- fputc('"', f);
-}
-
-static inline void data_to_json_(struct data_node *self, FILE *f, unsigned int padd, int do_padd)
-{
- unsigned int i;
-
- switch (self->type) {
- case DATA_STRING:
- padd = do_padd ? padd : 0;
- data_fprintf_esc(f, padd, self->string.val);
- break;
- case DATA_HASH:
- for (i = 0; i < self->hash.elems_used; i++) {
- data_fprintf(f, padd, "\"%s\": ", self->hash.elems[i].id);
- data_to_json_(self->hash.elems[i].node, f, padd+1, 0);
- if (i < self->hash.elems_used - 1)
- fprintf(f, ",\n");
- else
- fprintf(f, "\n");
- }
- break;
- case DATA_ARRAY:
- data_fprintf(f, do_padd ? padd : 0, "[\n");
- for (i = 0; i < self->array.array_used; i++) {
- data_to_json_(self->array.array[i], f, padd+1, 1);
- if (i < self->array.array_used - 1)
- fprintf(f, ",\n");
- else
- fprintf(f, "\n");
- }
- data_fprintf(f, padd, "]");
- break;
- }
-}
-
-static inline void data_to_json(struct data_node *self, FILE *f, unsigned int padd)
-{
- fprintf(f, "{\n");
- data_to_json_(self, f, padd + 1, 1);
- data_fprintf(f, padd, "}");
-}
-
-#endif /* DATA_STORAGE_H__ */
diff --git a/docparse/docparse.c b/docparse/docparse.c
deleted file mode 100644
index 8cd0d0eef..000000000
--- a/docparse/docparse.c
+++ /dev/null
@@ -1,434 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <libgen.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#include "data_storage.h"
-
-#define WARN(str) fprintf(stderr, "WARNING: " str "\n")
-
-static void oneline_comment(FILE *f)
-{
- int c;
-
- do {
- c = getc(f);
- } while (c != '\n');
-}
-
-static const char *eat_asterisk_space(const char *c)
-{
- unsigned int i = 0;
-
- while (isspace(c[i]))
- i++;
-
- if (c[i] == '*') {
- if (isspace(c[i+1]))
- i++;
- return &c[i+1];
- }
-
- return c;
-}
-
-static void multiline_comment(FILE *f, struct data_node *doc)
-{
- int c;
- int state = 0;
- char buf[4096];
- unsigned int bufp = 0;
-
- for (;;) {
- c = getc(f);
-
- if (doc) {
- if (c == '\n') {
- struct data_node *line;
- buf[bufp] = 0;
- line = data_node_string(eat_asterisk_space(buf));
- if (data_node_array_add(doc, line))
- WARN("doc string comment truncated");
- bufp = 0;
- continue;
- }
-
- if (bufp + 1 >= sizeof(buf))
- continue;
-
- buf[bufp++] = c;
- }
-
- switch (state) {
- case 0:
- if (c == '*')
- state = 1;
- break;
- case 1:
- switch (c) {
- case '/':
- return;
- case '*':
- continue;
- default:
- state = 0;
- break;
- }
- break;
- }
- }
-
-}
-
-static const char doc_prefix[] = "\\\n";
-
-static void maybe_doc_comment(FILE *f, struct data_node *doc)
-{
- int c, i;
-
- for (i = 0; doc_prefix[i]; i++) {
- c = getc(f);
-
- if (c == doc_prefix[i])
- continue;
-
- if (c == '*')
- ungetc(c, f);
-
- multiline_comment(f, NULL);
- return;
- }
-
- multiline_comment(f, doc);
-}
-
-static void maybe_comment(FILE *f, struct data_node *doc)
-{
- int c = getc(f);
-
- switch (c) {
- case '/':
- oneline_comment(f);
- break;
- case '*':
- maybe_doc_comment(f, doc);
- break;
- default:
- ungetc(c, f);
- break;
- }
-}
-
-const char *next_token(FILE *f, struct data_node *doc)
-{
- size_t i = 0;
- static char buf[4096];
- int c;
- int in_str = 0;
-
- for (;;) {
- c = fgetc(f);
-
- if (c == EOF)
- goto exit;
-
- if (in_str) {
- if (c == '"') {
- if (i == 0 || buf[i-1] != '\\')
- goto exit;
- }
-
- buf[i++] = c;
- continue;
- }
-
- switch (c) {
- case '{':
- case '}':
- case ';':
- case '(':
- case ')':
- case '=':
- case ',':
- case '[':
- case ']':
- if (i) {
- ungetc(c, f);
- goto exit;
- }
-
- buf[i++] = c;
- goto exit;
- case '0' ... '9':
- case 'a' ... 'z':
- case 'A' ... 'Z':
- case '.':
- case '_':
- case '-':
- buf[i++] = c;
- break;
- case '/':
- maybe_comment(f, doc);
- break;
- case '"':
- in_str = 1;
- break;
- case ' ':
- case '\n':
- case '\t':
- if (i)
- goto exit;
- break;
- }
- }
-
-exit:
- if (i == 0 && !in_str)
- return NULL;
-
- buf[i] = 0;
- return buf;
-}
-
-static int parse_array(FILE *f, struct data_node *node)
-{
- const char *token;
-
- for (;;) {
- if (!(token = next_token(f, NULL)))
- return 1;
-
- if (!strcmp(token, "{")) {
- struct data_node *ret = data_node_array();
- parse_array(f, ret);
-
- if (data_node_array_len(ret))
- data_node_array_add(node, ret);
- else
- data_node_free(ret);
-
- continue;
- }
-
- if (!strcmp(token, "}"))
- return 0;
-
- if (!strcmp(token, ","))
- continue;
-
- if (!strcmp(token, "NULL"))
- continue;
-
- struct data_node *str = data_node_string(token);
-
- data_node_array_add(node, str);
- }
-
- return 0;
-}
-
-static int parse_test_struct(FILE *f, struct data_node *doc, struct data_node *node)
-{
- const char *token;
- char *id = NULL;
- int state = 0;
- struct data_node *ret;
-
- for (;;) {
- if (!(token = next_token(f, doc)))
- return 1;
-
- if (!strcmp(token, "}"))
- return 0;
-
- switch (state) {
- case 0:
- id = strdup(token);
- state = 1;
- continue;
- case 1:
- if (!strcmp(token, "="))
- state = 2;
- else
- WARN("Expected '='");
- continue;
- case 2:
- if (!strcmp(token, "(")) {
- state = 3;
- continue;
- }
- break;
- case 3:
- if (!strcmp(token, ")"))
- state = 2;
- continue;
-
- case 4:
- if (!strcmp(token, ","))
- state = 0;
- continue;
- }
-
- if (!strcmp(token, "{")) {
- ret = data_node_array();
- parse_array(f, ret);
- } else {
- ret = data_node_string(token);
- }
-
- const char *key = id;
- if (key[0] == '.')
- key++;
-
- data_node_hash_add(node, key, ret);
- free(id);
- state = 4;
- }
-}
-
-static const char *tokens[] = {
- "static",
- "struct",
- "tst_test",
- "test",
- "=",
- "{",
-};
-
-static struct data_node *parse_file(const char *fname)
-{
- int state = 0, found = 0;
- const char *token;
-
- if (access(fname, F_OK)) {
- fprintf(stderr, "file %s does not exist\n", fname);
- return NULL;
- }
-
- FILE *f = fopen(fname, "r");
-
- struct data_node *res = data_node_hash();
- struct data_node *doc = data_node_array();
-
- while ((token = next_token(f, doc))) {
- if (state < 6 && !strcmp(tokens[state], token))
- state++;
- else
- state = 0;
-
- if (state < 6)
- continue;
-
- found = 1;
- parse_test_struct(f, doc, res);
- }
-
-
- if (data_node_array_len(doc)) {
- data_node_hash_add(res, "doc", doc);
- found = 1;
- } else {
- data_node_free(doc);
- }
-
- fclose(f);
-
- if (!found) {
- data_node_free(res);
- return NULL;
- }
-
- return res;
-}
-
-static const char *filter_out[] = {
- "bufs",
- "cleanup",
- "mntpoint",
- "setup",
- "tcnt",
- "test",
- "test_all",
- NULL
-};
-
-static struct implies {
- const char *flag;
- const char **implies;
-} implies[] = {
- {"mount_device", (const char *[]) {"format_device", "needs_device",
- "needs_tmpdir", NULL}},
- {"format_device", (const char *[]) {"needs_device", "needs_tmpdir",
- NULL}},
- {"all_filesystems", (const char *[]) {"needs_device", "needs_tmpdir",
- NULL}},
- {"needs_device", (const char *[]) {"needs_tmpdir", NULL}},
- {"needs_checkpoints", (const char *[]) {"needs_tmpdir", NULL}},
- {"resource_files", (const char *[]) {"needs_tmpdir", NULL}},
- {NULL, (const char *[]) {NULL}}
-};
-
-const char *strip_name(char *path)
-{
- char *name = basename(path);
- size_t len = strlen(name);
-
- if (len > 2 && name[len-1] == 'c' && name[len-2] == '.')
- name[len-2] = '\0';
-
- return name;
-}
-
-int main(int argc, char *argv[])
-{
- unsigned int i, j;
- struct data_node *res;
-
- if (argc != 2) {
- fprintf(stderr, "Usage: docparse filename.c\n");
- return 1;
- }
-
- res = parse_file(argv[1]);
- if (!res)
- return 0;
-
- /* Filter out useless data */
- for (i = 0; filter_out[i]; i++)
- data_node_hash_del(res, filter_out[i]);
-
- /* Normalize the result */
- for (i = 0; implies[i].flag; i++) {
- if (data_node_hash_get(res, implies[i].flag)) {
- for (j = 0; implies[i].implies[j]; j++) {
- if (data_node_hash_get(res, implies[i].implies[j]))
- fprintf(stderr, "%s: useless tag: %s\n",
- argv[1], implies[i].implies[j]);
- }
- }
- }
-
- for (i = 0; implies[i].flag; i++) {
- if (data_node_hash_get(res, implies[i].flag)) {
- for (j = 0; implies[i].implies[j]; j++) {
- if (!data_node_hash_get(res, implies[i].implies[j]))
- data_node_hash_add(res, implies[i].implies[j],
- data_node_string("1"));
- }
- }
- }
-
- data_node_hash_add(res, "fname", data_node_string(argv[1]));
- printf(" \"%s\": ", strip_name(argv[1]));
- data_to_json(res, stdout, 2);
- data_node_free(res);
-
- return 0;
-}
diff --git a/docparse/parse.sh b/docparse/parse.sh
deleted file mode 100755
index 79011bc10..000000000
--- a/docparse/parse.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-set -e
-
-top_builddir=$PWD/..
-top_srcdir="$(cd $(dirname $0)/..; pwd)"
-
-cd $top_srcdir
-
-version=$(cat $top_srcdir/VERSION)
-if [ -d .git ]; then
- version=$(git describe 2>/dev/null) || version=$(cat $top_srcdir/VERSION).GIT-UNKNOWN
-fi
-
-echo '{'
-echo ' "testsuite": "Linux Test Project",'
-echo ' "testsuite_short": "LTP",'
-echo ' "url": "https://github.com/linux-test-project/ltp/",'
-echo ' "scm_url_base": "https://github.com/linux-test-project/ltp/tree/master/",'
-echo ' "timeout": 300,'
-echo " \"version\": \"$version\","
-echo ' "tests": {'
-
-first=1
-
-for test in `find testcases/ -name '*.c'`; do
- a=$($top_builddir/docparse/docparse "$test")
- if [ -n "$a" ]; then
- if [ -z "$first" ]; then
- echo ','
- fi
- first=
- cat <<EOF
-$a
-EOF
- fi
-done
-
-echo
-echo ' }'
-echo '}'
diff --git a/docparse/testinfo.pl b/docparse/testinfo.pl
deleted file mode 100755
index 31148e3a4..000000000
--- a/docparse/testinfo.pl
+++ /dev/null
@@ -1,506 +0,0 @@
-#!/usr/bin/perl
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2020-2021 Petr Vorel <pvorel@suse.cz>
-
-use strict;
-use warnings;
-
-use JSON qw(decode_json);
-use Cwd qw(abs_path);
-use File::Basename qw(dirname);
-
-use constant OUTDIR => dirname(abs_path($0));
-
-# tags which expect git tree, also need constant for URL
-our @TAGS_GIT = ("linux-git", "linux-stable-git", "glibc-git");
-
-# tags should map these in lib/tst_test.c
-use constant LINUX_GIT_URL => "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=";
-use constant LINUX_STABLE_GIT_URL => "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=";
-use constant GLIBC_GIT_URL => "https://sourceware.org/git/?p=glibc.git;a=commit;h=";
-use constant CVE_DB_URL => "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-";
-
-sub load_json
-{
- my ($fname, $mode) = @_;
- local $/;
-
- open(my $fh, '<', $fname) or die("Can't open $fname $!");
-
- return <$fh>;
-}
-
-sub log_info
-{
- my $msg = shift;
- print STDERR "INFO: $msg\n";
-}
-
-sub log_warn
-{
- my $msg = shift;
- print STDERR "WARN: $msg\n";
-}
-
-sub print_asciidoc_page
-{
- my ($fh, $json, $title, $content) = @_;
-
- print $fh <<EOL;
-// -*- mode:doc; -*-
-// vim: set syntax=asciidoc:
-
-$title
-
-$content
-EOL
-}
-
-sub tag_url {
- my ($tag, $value, $scm_url_base) = @_;
-
- if ($tag eq "fname") {
- return $scm_url_base . $value;
- }
-
- if ($tag eq "CVE") {
- return CVE_DB_URL . $value;
- }
-
- # *_GIT_URL
- my $key = tag2env($tag) . "_URL";
- if (defined($constant::declared{"main::$key"})) {
- return eval("main::$key") . $value;
- }
-
- die("unknown constant '$key' for tag $tag, define it!");
-}
-
-sub bold
-{
- return "*$_[0]*";
-}
-
-sub code
-{
- return "+$_[0]+";
-}
-
-sub hr
-{
- return "\n\n'''\n\n";
-}
-
-sub html_a
-{
- my ($url, $text) = @_;
-
- # escape ]
- $text =~ s/([]])/\\$1/g;
-
- return "$url\[$text\]";
-}
-
-sub h1
-{
- return "== $_[0]\n";
-}
-
-sub h2
-{
- return "=== $_[0]\n";
-}
-
-sub h3
-{
- return "==== $_[0]\n";
-}
-
-sub label
-{
- return "[[$_[0]]]\n";
-}
-
-sub paragraph
-{
- return "$_[0]\n\n";
-}
-
-sub reference
-{
- my ($link, %args) = @_;
-
- $args{text} //= $link;
- $args{delimiter} //= "";
-
- return "xref:$link\[$args{text}\]$args{delimiter}\n";
-}
-
-sub table
-{
- return "|===\n";
-}
-
-sub table_escape
-{
- my $out = $_[0];
-
- $out =~ s/\|/\\|/g;
- return $out;
-}
-
-sub print_defined
-{
- my ($key, $val, $val2) = @_;
-
- if (defined($val)) {
- return paragraph(bold($key) . ": " . $val . (defined($val2) ? " $val2" : ""));
- }
-}
-
-sub content_about
-{
- my $json = shift;
- my $content;
-
- $content .= print_defined("URL", $json->{'url'});
- $content .= print_defined("Version", $json->{'version'});
- $content .= print_defined("Default timeout", $json->{'timeout'}, "seconds");
-
- return $content;
-}
-
-sub uniq {
- my %seen;
- grep !$seen{$_}++, @_;
-}
-
-sub get_test_names
-{
- my @names = @{$_[0]};
- my ($letter, $prev_letter);
- my $content;
-
- for my $name (sort @names) {
- $letter = substr($name, 0, 1);
- if (defined($prev_letter) && $letter ne $prev_letter) {
- $content .= "\n";
- }
-
- $content .= reference($name, delimiter => " ");
- $prev_letter = $letter;
- }
- $content .= "\n";
-
- return $content;
-}
-
-sub get_test_letters
-{
- my @names = @{$_[0]};
- my $letter;
- my $prev_letter = "";
- my $content;
-
- for (@names) {
- $_ = substr($_, 0, 1);
- }
- @names = uniq(@names);
-
- for my $letter (@names) {
- $content .= reference($letter);
- }
- $content .= "\n";
-
- return $content;
-}
-
-sub tag2title
-{
- my $tag = shift;
- return code(".$tag");
-}
-
-sub get_filters
-{
- my $json = shift;
- my %data;
-
- while (my ($k, $v) = each %{$json->{'tests'}}) {
- for my $j (keys %{$v}) {
- next if ($j eq 'fname' || $j eq 'doc');
- $data{$j} = () unless (defined($data{$j}));
-
- if ($j eq 'tags') {
- for my $tags (@{$v}{'tags'}) {
- for my $tag (@$tags) {
- my $k2 = $$tag[0];
- my $v2 = $$tag[1];
- $data{$j}{$k2} = () unless (defined($data{$j}{$k2}));
- push @{$data{$j}{$k2}}, $k unless grep{$_ eq $k} @{$data{$j}{$k2}};
- }
- }
- } else {
- push @{$data{$j}}, $k unless grep{$_ eq $k} @{$data{$j}};
- }
- }
- }
- return \%data;
-}
-
-sub content_filter
-{
- my $k = $_[0];
- my $title = $_[1];
- my $desc = $_[2];
- my $h = $_[3];
- my ($letter, $prev_letter, $content);
-
- $content = label($k);
- $content .= $title;
- $content .= paragraph("Tests containing $desc flag.");
-
- $content .= get_test_names(\@{$h});
-
- return $content;
-}
-
-sub content_filters
-{
- my $json = shift;
- my $data = get_filters($json);
- my %h = %$data;
- my $content;
-
- for my $k (sort keys %$data) {
- my $title = tag2title($k);
- if (ref($h{$k}) eq 'HASH') {
- $content .= label($k);
- $content .= h2($title);
- for my $k2 (sort keys %{$h{$k}}) {
- my $title2 = code($k2);
- $content .= content_filter($k2, h3($title2), "$title $title2", $h{$k}{$k2});
- }
- } else {
- $content .= content_filter($k, h2($title), $title, \@{$h{$k}});
- }
- }
-
- return $content;
-}
-
-sub tag2env
-{
- my $tag = shift;
- $tag =~ s/-/_/g;
- return uc($tag);
-}
-
-sub detect_git
-{
- my %data;
-
- for my $tag (@TAGS_GIT) {
- my $env = tag2env($tag);
-
- unless (defined $ENV{$env} && $ENV{$env}) {
- log_warn("git repository $tag not defined. Define it in \$$env");
- next;
- }
-
- unless (-d $ENV{$env}) {
- log_warn("\$$env does not exit ('$ENV{$env}')");
- next;
- }
-
- if (system("which git >/dev/null")) {
- log_warn("git not in \$PATH ('$ENV{'PATH'}')");
- next;
- }
-
- chdir($ENV{$env});
- if (!system("git log -1 > /dev/null")) {
- log_info("using '$ENV{$env}' as $env repository");
- $data{$tag} = $ENV{$env};
- } else {
- log_warn("git failed, git not installed or \$$env is not a git repository? ('$ENV{$env}')");
- }
- chdir(OUTDIR);
- }
-
- return \%data;
-}
-
-sub content_all_tests
-{
- my $json = shift;
- my @names = sort keys %{$json->{'tests'}};
- my $letters = paragraph(get_test_letters(\@names));
- my $git_url = detect_git();
- my $tmp = undef;
- my $printed = "";
- my $content;
-
- $content .= paragraph("Total $#names tests.");
- $content .= $letters;
- $content .= get_test_names(\@names);
-
- for my $name (@names) {
- my $letter = substr($name, 0, 1);
-
- if ($printed ne $letter) {
- $content .= label($letter);
- $content .= h2($letter);
- $printed = $letter;
- }
-
- $content .= hr() if (defined($tmp));
- $content .= label($name);
- $content .= h3($name);
- $content .= $letters;
-
- if (defined($json->{'scm_url_base'}) &&
- defined($json->{'tests'}{$name}{fname})) {
- $content .= paragraph(html_a(tag_url("fname", $json->{'tests'}{$name}{fname},
- $json->{'scm_url_base'}), "source"));
- }
-
- if (defined $json->{'tests'}{$name}{doc}) {
- for my $doc (@{$json->{'tests'}{$name}{doc}}) {
-
- # fix formatting for asciidoc [DOCUMENTATION] => *Documentation*
- if ($doc =~ s/^\[(.*)\]$/$1/) {
- $doc = paragraph(bold(ucfirst(lc($doc))));
- }
-
- $content .= "$doc\n";
- }
- $content .= "\n";
- }
-
- if ($json->{'tests'}{$name}{timeout}) {
- if ($json->{'tests'}{$name}{timeout} eq -1) {
- $content .= paragraph("Test timeout is disabled");
- } else {
- $content .= paragraph("Test timeout is $json->{'tests'}{$name}{timeout} seconds");
- }
- } else {
- $content .= paragraph("Test timeout defaults to $json->{'timeout'} seconds");
- }
-
- my $tmp2 = undef;
- for my $k (sort keys %{$json->{'tests'}{$name}}) {
- my $v = $json->{'tests'}{$name}{$k};
- next if ($k eq "tags" || $k eq "fname" || $k eq "doc");
- if (!defined($tmp2)) {
- $content .= table . "|Key|Value\n\n"
- }
-
- $content .= "|" . reference($k, text => tag2title($k)) . "\n|";
-
- if (ref($v) eq 'ARRAY') {
- # two dimensional array
- if (ref(@$v[0]) eq 'ARRAY') {
- for my $v2 (@$v) {
- $content .= paragraph(table_escape(join(' ', @$v2)));
- }
- } else {
- # one dimensional array
- $content .= table_escape(join(', ', @$v));
- }
- } else {
- # plain content
- $content .= table_escape($v);
- }
-
- $content .= "\n";
-
- $tmp2 = 1;
- }
- if (defined($tmp2)) {
- $content .= table . "\n";
- }
-
- $tmp2 = undef;
- my %commits;
- my @sorted_tags = sort { $a->[0] cmp $b->[0] } @{$json->{'tests'}{$name}{tags} // []};
-
- for my $tag (@sorted_tags) {
- if (!defined($tmp2)) {
- $content .= table . "|Tags|Info\n"
- }
- my $k = @$tag[0];
- my $v = @$tag[1];
-
- if (defined($$git_url{$k})) {
- $commits{$k} = () unless (defined($commits{$k}));
- unless (defined($commits{$k}{$v})) {
- chdir($$git_url{$k});
- $commits{$k}{$v} = `git log --pretty=format:'%s' -1 $v`;
- chdir(OUTDIR);
- }
- $v .= ' ("' . $commits{$k}{$v} . '")';
- }
-
- $v = html_a(tag_url($k, @$tag[1]), $v);
- $content .= "\n|" . reference($k) . "\n|$v\n";
- $tmp2 = 1;
- }
- if (defined($tmp2)) {
- $content .= table . "\n";
- }
-
- $tmp = 1;
- }
-
- return $content;
-}
-
-
-my $json = decode_json(load_json($ARGV[0]));
-
-my $config = [
- {
- file => "about.txt",
- title => h2("About $json->{'testsuite'}"),
- content => \&content_about,
- },
- {
- file => "filters.txt",
- title => h1("Test filtered by used flags"),
- content => \&content_filters,
- },
- {
- file => "all-tests.txt",
- title => h1("All tests"),
- content => \&content_all_tests,
- },
-];
-
-sub print_asciidoc_main
-{
- my $config = shift;
- my $file = "metadata.txt";
- my $content;
-
- open(my $fh, '>', $file) or die("Can't open $file $!");
-
- $content = <<EOL;
-:doctype: inline
-:sectanchors:
-:toc:
-
-EOL
- for my $c (@{$config}) {
- $content .= "include::$c->{'file'}\[\]\n";
- }
- print_asciidoc_page($fh, $json, h1($json->{'testsuite_short'} . " test catalog"), $content);
-}
-
-for my $c (@{$config}) {
- open(my $fh, '>', $c->{'file'}) or die("Can't open $c->{'file'} $!");
- print_asciidoc_page($fh, $json, $c->{'title'}, $c->{'content'}->($json));
-}
-
-print_asciidoc_main($config);
diff --git a/gen.bp b/gen.bp
index 22a5db8c6..a33848043 100644
--- a/gen.bp
+++ b/gen.bp
@@ -55,6 +55,19 @@ cc_library_static {
}
cc_library_static {
+ name: "libltp_ipc",
+ defaults: ["ltp_defaults"],
+ local_include_dirs: [
+ "include",
+ "include/old",
+ ],
+ srcs: [
+ "testcases/kernel/syscalls/ipc/lib/libipc.c",
+ "testcases/kernel/syscalls/ipc/lib/libmsgctl.c",
+ ],
+}
+
+cc_library_static {
name: "libltp_kerntest",
defaults: ["ltp_defaults"],
local_include_dirs: [
@@ -96,16 +109,11 @@ cc_library_static {
"lib/tlibio.c",
"lib/tst_af_alg.c",
"lib/tst_ansi_color.c",
- "lib/tst_assert.c",
- "lib/tst_bool_expr.c",
"lib/tst_buffers.c",
"lib/tst_capability.c",
- "lib/tst_cgroup.c",
"lib/tst_checkpoint.c",
"lib/tst_checksum.c",
"lib/tst_clocks.c",
- "lib/tst_clone.c",
- "lib/tst_cmd.c",
"lib/tst_coredump.c",
"lib/tst_cpu.c",
"lib/tst_crypto.c",
@@ -113,36 +121,26 @@ cc_library_static {
"lib/tst_dir_is_empty.c",
"lib/tst_fill_file.c",
"lib/tst_fill_fs.c",
- "lib/tst_fips.c",
"lib/tst_fs_has_free.c",
"lib/tst_fs_link_count.c",
"lib/tst_fs_setup.c",
"lib/tst_fs_type.c",
"lib/tst_get_bad_addr.c",
- "lib/tst_hugepage.c",
"lib/tst_ioctl.c",
"lib/tst_kconfig.c",
"lib/tst_kernel.c",
"lib/tst_kvercmp.c",
- "lib/tst_lockdown.c",
- "lib/tst_memutils.c",
"lib/tst_mkfs.c",
"lib/tst_module.c",
- "lib/tst_net.c",
- "lib/tst_netdevice.c",
"lib/tst_parse_opts.c",
"lib/tst_path_has_mnt_flags.c",
"lib/tst_pid.c",
"lib/tst_process_state.c",
"lib/tst_res.c",
"lib/tst_resource.c",
- "lib/tst_rtctime.c",
- "lib/tst_rtnetlink.c",
- "lib/tst_safe_file_at.c",
- "lib/tst_safe_io_uring.c",
+ "lib/tst_run_cmd.c",
"lib/tst_safe_macros.c",
"lib/tst_safe_sysv_ipc.c",
- "lib/tst_safe_timerfd.c",
"lib/tst_sig.c",
"lib/tst_sig_proc.c",
"lib/tst_status.c",
@@ -159,18 +157,6 @@ cc_library_static {
}
cc_library_static {
- name: "libltp_ltpnewipc",
- defaults: ["ltp_defaults"],
- local_include_dirs: [
- "include",
- "include/old",
- ],
- srcs: [
- "libs/libltpnewipc/libnewipc.c",
- ],
-}
-
-cc_library_static {
name: "libltp_ltpnuma",
defaults: ["ltp_defaults"],
local_include_dirs: [
@@ -183,30 +169,6 @@ cc_library_static {
}
cc_library_static {
- name: "libltp_ltpsigwait",
- defaults: ["ltp_defaults"],
- local_include_dirs: [
- "include",
- "include/old",
- ],
- srcs: [
- "libs/libltpsigwait/sigwait.c",
- ],
-}
-
-cc_library_static {
- name: "libltp_ltpswap",
- defaults: ["ltp_defaults"],
- local_include_dirs: [
- "include",
- "include/old",
- ],
- srcs: [
- "libs/libltpswap/libswap.c",
- ],
-}
-
-cc_library_static {
name: "libltp_ltpuinput",
defaults: ["ltp_defaults"],
local_include_dirs: [
@@ -219,19 +181,6 @@ cc_library_static {
}
cc_library_static {
- name: "libltp_ltpvdso",
- defaults: ["ltp_defaults"],
- local_include_dirs: [
- "include",
- "include/old",
- ],
- srcs: [
- "libs/libltpvdso/parse_vdso.c",
- "libs/libltpvdso/vdso_helpers.c",
- ],
-}
-
-cc_library_static {
name: "libltp_mem",
defaults: ["ltp_defaults"],
local_include_dirs: [
@@ -398,15 +347,6 @@ cc_test {
}
cc_test {
- name: "ltp_add_key05",
- stem: "add_key05",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/add_key/add_key05.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_adjtimex01",
stem: "adjtimex01",
defaults: ["ltp_test_defaults"],
@@ -425,15 +365,6 @@ cc_test {
}
cc_test {
- name: "ltp_adjtimex03",
- stem: "adjtimex03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/adjtimex/adjtimex03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_af_alg01",
stem: "af_alg01",
defaults: ["ltp_test_defaults"],
@@ -484,16 +415,6 @@ cc_test {
}
cc_test {
- name: "ltp_af_alg07",
- stem: "af_alg07",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/crypto/af_alg07.c"],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_aio-stress",
stem: "aio-stress",
defaults: ["ltp_test_defaults"],
@@ -674,33 +595,6 @@ cc_test {
}
cc_test {
- name: "ltp_bind04",
- stem: "bind04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/bind/bind04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_bind05",
- stem: "bind05",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/bind/bind05.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_bind06",
- stem: "bind06",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/bind/bind06.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_block_dev",
stem: "block_dev",
defaults: ["ltp_test_defaults"],
@@ -713,10 +607,7 @@ cc_test {
name: "ltp_bpf_map01",
stem: "bpf_map01",
defaults: ["ltp_test_defaults"],
- srcs: [
- "testcases/kernel/syscalls/bpf/bpf_common.c",
- "testcases/kernel/syscalls/bpf/bpf_map01.c",
- ],
+ srcs: ["testcases/kernel/syscalls/bpf/bpf_map01.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -726,10 +617,7 @@ cc_test {
name: "ltp_bpf_prog01",
stem: "bpf_prog01",
defaults: ["ltp_test_defaults"],
- srcs: [
- "testcases/kernel/syscalls/bpf/bpf_common.c",
- "testcases/kernel/syscalls/bpf/bpf_prog01.c",
- ],
+ srcs: ["testcases/kernel/syscalls/bpf/bpf_prog01.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -739,10 +627,7 @@ cc_test {
name: "ltp_bpf_prog02",
stem: "bpf_prog02",
defaults: ["ltp_test_defaults"],
- srcs: [
- "testcases/kernel/syscalls/bpf/bpf_common.c",
- "testcases/kernel/syscalls/bpf/bpf_prog02.c",
- ],
+ srcs: ["testcases/kernel/syscalls/bpf/bpf_prog02.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -752,45 +637,13 @@ cc_test {
name: "ltp_bpf_prog03",
stem: "bpf_prog03",
defaults: ["ltp_test_defaults"],
- srcs: [
- "testcases/kernel/syscalls/bpf/bpf_common.c",
- "testcases/kernel/syscalls/bpf/bpf_prog03.c",
- ],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_bpf_prog04",
- stem: "bpf_prog04",
- defaults: ["ltp_test_defaults"],
- srcs: [
- "testcases/kernel/syscalls/bpf/bpf_common.c",
- "testcases/kernel/syscalls/bpf/bpf_prog04.c",
- ],
+ srcs: ["testcases/kernel/syscalls/bpf/bpf_prog03.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
cc_test {
- name: "ltp_bpf_prog05",
- stem: "bpf_prog05",
- defaults: ["ltp_test_defaults"],
- srcs: [
- "testcases/kernel/syscalls/bpf/bpf_common.c",
- "testcases/kernel/syscalls/bpf/bpf_prog05.c",
- ],
- cflags: [
- "-D_GNU_SOURCE",
- "-Wno-shift-count-overflow",
- ],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_brk01",
stem: "brk01",
defaults: ["ltp_test_defaults"],
@@ -800,15 +653,6 @@ cc_test {
}
cc_test {
- name: "ltp_brk02",
- stem: "brk02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/brk/brk02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_cacheflush01",
stem: "cacheflush01",
defaults: ["ltp_test_defaults"],
@@ -823,9 +667,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/network/can/filter-tests/can_filter.c"],
cflags: [
- "-DAF_CAN=PF_CAN",
"-DETH_P_CAN=0x000C",
"-DPF_CAN=29",
+ "-DAF_CAN=PF_CAN",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -837,9 +681,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/network/can/filter-tests/can_rcv_own_msgs.c"],
cflags: [
- "-DAF_CAN=PF_CAN",
"-DETH_P_CAN=0x000C",
"-DPF_CAN=29",
+ "-DAF_CAN=PF_CAN",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -932,8 +776,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cgroup_fj/cgroup_fj_proc.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -944,8 +788,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cgroup/cgroup_regression_6_2.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -956,8 +800,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cgroup/cgroup_regression_fork_processes.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -968,8 +812,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cgroup/cgroup_regression_getdelays.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -993,6 +837,24 @@ cc_test {
}
cc_test {
+ name: "ltp_chdir02",
+ stem: "chdir02",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/chdir/chdir02.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+ name: "ltp_chdir03",
+ stem: "chdir03",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/chdir/chdir03.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_chdir04",
stem: "chdir04",
defaults: ["ltp_test_defaults"],
@@ -1089,9 +951,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/chown/chown01.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1103,9 +965,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/chown/chown01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1116,9 +978,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/chown/chown02.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1130,9 +992,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/chown/chown02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1143,9 +1005,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/chown/chown03.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1157,9 +1019,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/chown/chown03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1170,9 +1032,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/chown/chown05.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1184,9 +1046,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/chown/chown05.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/chown",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -1251,8 +1113,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/clock_getres/clock_getres01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -1276,27 +1138,6 @@ cc_test {
}
cc_test {
- name: "ltp_clock_gettime03",
- stem: "clock_gettime03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clock_gettime/clock_gettime03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_clock_gettime04",
- stem: "clock_gettime04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clock_gettime/clock_gettime04.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpvdso",
- ],
-}
-
-cc_test {
name: "ltp_clock_nanosleep01",
stem: "clock_nanosleep01",
defaults: ["ltp_test_defaults"],
@@ -1315,19 +1156,10 @@ cc_test {
}
cc_test {
- name: "ltp_clock_nanosleep03",
- stem: "clock_nanosleep03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_clock_nanosleep04",
- stem: "clock_nanosleep04",
+ name: "ltp_clock_nanosleep2_01",
+ stem: "clock_nanosleep2_01",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c"],
+ srcs: ["testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -1351,15 +1183,6 @@ cc_test {
}
cc_test {
- name: "ltp_clock_settime03",
- stem: "clock_settime03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clock_settime/clock_settime03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_clone01",
stem: "clone01",
defaults: ["ltp_test_defaults"],
@@ -1441,24 +1264,6 @@ cc_test {
}
cc_test {
- name: "ltp_clone301",
- stem: "clone301",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clone3/clone301.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_clone302",
- stem: "clone302",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/clone3/clone302.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_close01",
stem: "close01",
defaults: ["ltp_test_defaults"],
@@ -1477,21 +1282,10 @@ cc_test {
}
cc_test {
- name: "ltp_close_range01",
- stem: "close_range01",
+ name: "ltp_close08",
+ stem: "close08",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/close_range/close_range01.c"],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_close_range02",
- stem: "close_range02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/close_range/close_range02.c"],
- cflags: ["-D_GNU_SOURCE"],
+ srcs: ["testcases/kernel/syscalls/close/close08.c"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -1506,15 +1300,6 @@ cc_test {
}
cc_test {
- name: "ltp_connect02",
- stem: "connect02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/connect/connect02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_copy_file_range01",
stem: "copy_file_range01",
defaults: ["ltp_test_defaults"],
@@ -1547,8 +1332,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuacct/cpuacct_task.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -1559,8 +1344,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1574,8 +1359,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1589,8 +1374,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1604,8 +1389,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1619,8 +1404,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl_fj/cpuctl_fj_cpu-hog.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -1631,8 +1416,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl_fj/cpuctl_fj_simple_echo.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -1643,8 +1428,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_latency_check_task.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1658,8 +1443,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_latency_test.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1673,8 +1458,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_test01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1688,8 +1473,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_test02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1703,8 +1488,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_test03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1718,8 +1503,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/cpuctl/cpuctl_test04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -1742,14 +1527,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/cpuset/cpuset01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -1760,8 +1545,8 @@ cc_test {
srcs: ["testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c"],
local_include_dirs: ["include/old"],
static_libs: [
- "libltp_controllers",
"libltp_cpu_set",
+ "libltp_controllers",
"libltp_ltp",
],
}
@@ -1773,8 +1558,8 @@ cc_test {
srcs: ["testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c"],
local_include_dirs: ["include/old"],
static_libs: [
- "libltp_controllers",
"libltp_cpu_set",
+ "libltp_controllers",
"libltp_ltp",
],
}
@@ -1786,8 +1571,8 @@ cc_test {
srcs: ["testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_mem_hog.c"],
local_include_dirs: ["include/old"],
static_libs: [
- "libltp_controllers",
"libltp_cpu_set",
+ "libltp_controllers",
"libltp_ltp",
],
}
@@ -1799,8 +1584,8 @@ cc_test {
srcs: ["testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/cpuset_memory_pressure.c"],
local_include_dirs: ["include/old"],
static_libs: [
- "libltp_controllers",
"libltp_cpu_set",
+ "libltp_controllers",
"libltp_ltp",
],
}
@@ -1812,8 +1597,8 @@ cc_test {
srcs: ["testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_sched_domains_check.c"],
local_include_dirs: ["include/old"],
static_libs: [
- "libltp_controllers",
"libltp_cpu_set",
+ "libltp_controllers",
"libltp_ltp",
],
}
@@ -1825,8 +1610,8 @@ cc_test {
srcs: ["testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_test.c"],
local_include_dirs: ["include/old"],
static_libs: [
- "libltp_controllers",
"libltp_cpu_set",
+ "libltp_controllers",
"libltp_ltp",
],
}
@@ -1917,8 +1702,8 @@ cc_test {
stem: "create-files",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/fs-bench/boxmuler.c",
"testcases/kernel/fs/fs-bench/create-files.c",
+ "testcases/kernel/fs/fs-bench/boxmuler.c",
],
local_include_dirs: ["include/old"],
}
@@ -2130,8 +1915,8 @@ cc_test {
"testcases/kernel/io/direct_io/diotest_routines.c",
],
cflags: [
- "-DSHARED_OFILE",
"-D_GNU_SOURCE",
+ "-DSHARED_OFILE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2142,12 +1927,12 @@ cc_test {
stem: "diotest2",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/io/direct_io/diotest2.c",
"testcases/kernel/io/direct_io/diotest_routines.c",
+ "testcases/kernel/io/direct_io/diotest2.c",
],
cflags: [
- "-DSHARED_OFILE",
"-D_GNU_SOURCE",
+ "-DSHARED_OFILE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2162,8 +1947,8 @@ cc_test {
"testcases/kernel/io/direct_io/diotest_routines.c",
],
cflags: [
- "-DSHARED_OFILE",
"-D_GNU_SOURCE",
+ "-DSHARED_OFILE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2174,12 +1959,12 @@ cc_test {
stem: "diotest5",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/io/direct_io/diotest5.c",
"testcases/kernel/io/direct_io/diotest_routines.c",
+ "testcases/kernel/io/direct_io/diotest5.c",
],
cflags: [
- "-DSHARED_OFILE",
"-D_GNU_SOURCE",
+ "-DSHARED_OFILE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2194,8 +1979,8 @@ cc_test {
"testcases/kernel/io/direct_io/diotest_routines.c",
],
cflags: [
- "-DSHARED_OFILE",
"-D_GNU_SOURCE",
+ "-DSHARED_OFILE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2235,26 +2020,26 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: [
"testcases/kernel/io/disktest/Getopt.c",
- "testcases/kernel/io/disktest/childmain.c",
+ "testcases/kernel/io/disktest/sfunc.c",
"testcases/kernel/io/disktest/dump.c",
- "testcases/kernel/io/disktest/globals.c",
- "testcases/kernel/io/disktest/io.c",
- "testcases/kernel/io/disktest/main.c",
"testcases/kernel/io/disktest/parse.c",
- "testcases/kernel/io/disktest/sfunc.c",
- "testcases/kernel/io/disktest/signals.c",
"testcases/kernel/io/disktest/stats.c",
+ "testcases/kernel/io/disktest/usage.c",
"testcases/kernel/io/disktest/threading.c",
+ "testcases/kernel/io/disktest/globals.c",
+ "testcases/kernel/io/disktest/io.c",
+ "testcases/kernel/io/disktest/childmain.c",
+ "testcases/kernel/io/disktest/main.c",
"testcases/kernel/io/disktest/timer.c",
- "testcases/kernel/io/disktest/usage.c",
+ "testcases/kernel/io/disktest/signals.c",
],
cflags: [
"-DLINUX",
"-D_FILE_OFFSET_BITS=64",
- "-D_GNU_SOURCE",
"-D_LARGEFILE64_SOURCE",
- "-D_LARGE_FILES",
+ "-D_GNU_SOURCE",
"-D_THREAD_SAFE",
+ "-D_LARGE_FILES",
],
local_include_dirs: ["include/old"],
}
@@ -2268,8 +2053,8 @@ cc_test {
"testcases/kernel/io/direct_io/dma_thread_diotest.c",
],
cflags: [
- "-DSHARED_OFILE",
"-D_GNU_SOURCE",
+ "-DSHARED_OFILE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2406,9 +2191,9 @@ cc_test {
stem: "eas_big_to_small",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/eas_big_to_small.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2419,9 +2204,9 @@ cc_test {
stem: "eas_one_big_task",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/eas_one_big_task.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2432,9 +2217,9 @@ cc_test {
stem: "eas_one_small_task",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/eas_one_small_task.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2445,9 +2230,9 @@ cc_test {
stem: "eas_small_big_toggle",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/eas_small_big_toggle.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2459,8 +2244,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: [
"testcases/kernel/sched/eas/eas_small_to_big.c",
- "testcases/kernel/sched/eas/trace_parse.c",
"testcases/kernel/sched/eas/util.c",
+ "testcases/kernel/sched/eas/trace_parse.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2471,9 +2256,9 @@ cc_test {
stem: "eas_two_big_three_small",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/eas_two_big_three_small.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -2927,15 +2712,6 @@ cc_test {
}
cc_test {
- name: "ltp_fallocate06",
- stem: "fallocate06",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fallocate/fallocate06.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_fanotify01",
stem: "fanotify01",
defaults: ["ltp_test_defaults"],
@@ -3071,42 +2847,6 @@ cc_test {
}
cc_test {
- name: "ltp_fanotify16",
- stem: "fanotify16",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fanotify/fanotify16.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fanotify17",
- stem: "fanotify17",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fanotify/fanotify17.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fanotify18",
- stem: "fanotify18",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fanotify/fanotify18.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fanotify19",
- stem: "fanotify19",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fanotify/fanotify19.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_fanotify_child",
stem: "fanotify_child",
defaults: ["ltp_test_defaults"],
@@ -3221,9 +2961,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fchown/fchown01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3235,9 +2975,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fchown/fchown01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3248,9 +2988,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fchown/fchown02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3262,9 +3002,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fchown/fchown02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3275,9 +3015,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fchown/fchown03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3289,9 +3029,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fchown/fchown03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3302,9 +3042,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fchown/fchown04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3316,9 +3056,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fchown/fchown04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3329,9 +3069,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fchown/fchown05.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3343,9 +3083,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fchown/fchown05.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fchown",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fchown",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3375,9 +3115,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl01.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3388,14 +3128,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3407,9 +3147,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl02.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3420,14 +3160,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3439,9 +3179,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl03.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3452,14 +3192,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3471,9 +3211,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl04.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3484,14 +3224,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl04.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3503,9 +3243,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl05.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3516,14 +3256,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl05.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3535,9 +3275,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl06.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3548,14 +3288,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl06.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3567,9 +3307,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl07.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3580,14 +3320,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl07.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3599,9 +3339,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl08.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3612,14 +3352,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl08.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3631,9 +3371,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl09.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3644,14 +3384,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl09.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3663,9 +3403,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl10.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3676,14 +3416,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl10.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3695,9 +3435,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl11.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3708,14 +3448,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl11.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3727,9 +3467,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl12.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3740,14 +3480,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl12.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3759,9 +3499,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl13.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3772,14 +3512,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl13.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3791,9 +3531,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl14.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3804,14 +3544,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl14.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3823,9 +3563,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl15.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3836,14 +3576,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl15.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3855,9 +3595,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl16.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3868,14 +3608,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl16.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3887,9 +3627,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl17.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3900,14 +3640,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl17.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3919,9 +3659,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl18.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3932,14 +3672,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl18.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3951,9 +3691,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl19.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3964,14 +3704,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl19.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3983,9 +3723,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl20.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -3996,14 +3736,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl20.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4015,9 +3755,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl21.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4028,14 +3768,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl21.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4047,9 +3787,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl22.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4060,14 +3800,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl22.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4079,9 +3819,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl23.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4092,14 +3832,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl23.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4111,9 +3851,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl24.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4124,14 +3864,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl24.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4143,9 +3883,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl25.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4156,14 +3896,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl25.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4175,9 +3915,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl26.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4188,14 +3928,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl26.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4207,9 +3947,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl27.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4220,14 +3960,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl27.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4239,9 +3979,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl28.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4252,14 +3992,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl28.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4271,9 +4011,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl29.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4284,14 +4024,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl29.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4303,9 +4043,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl30.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4316,14 +4056,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl30.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4335,9 +4075,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl31.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4348,14 +4088,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl31.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4367,9 +4107,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl32.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4380,14 +4120,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl32.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4399,9 +4139,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl33.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4412,14 +4152,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl33.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4431,9 +4171,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl34.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4444,14 +4184,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl34.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4463,9 +4203,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl35.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4476,14 +4216,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl35.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fcntl",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4495,9 +4235,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/fcntl/fcntl36.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -4508,78 +4248,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fcntl/fcntl36.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
- "-D_GNU_SOURCE",
- ],
- local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
- "testcases/kernel/syscalls/utils",
- ],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fcntl37",
- stem: "fcntl37",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fcntl/fcntl37.c"],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
- "testcases/kernel/syscalls/utils",
- ],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fcntl37_64",
- stem: "fcntl37_64",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fcntl/fcntl37.c"],
- cflags: [
"-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fcntl",
"testcases/kernel/syscalls/utils",
- ],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fcntl38",
- stem: "fcntl38",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fcntl/fcntl38.c"],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fcntl",
- "testcases/kernel/syscalls/utils",
- ],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fcntl38_64",
- stem: "fcntl38_64",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fcntl/fcntl38.c"],
- cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
- "-D_GNU_SOURCE",
- ],
- local_include_dirs: [
"include/old",
- "testcases/kernel/syscalls/fcntl",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -4639,24 +4315,6 @@ cc_test {
}
cc_test {
- name: "ltp_finit_module01",
- stem: "finit_module01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/finit_module/finit_module01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_finit_module02",
- stem: "finit_module02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/finit_module/finit_module02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_flistxattr01",
stem: "flistxattr01",
defaults: ["ltp_test_defaults"],
@@ -4984,24 +4642,6 @@ cc_test {
}
cc_test {
- name: "ltp_fsconfig01",
- stem: "fsconfig01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fsconfig/fsconfig01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fsconfig02",
- stem: "fsconfig02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fsconfig/fsconfig02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_fsetxattr01",
stem: "fsetxattr01",
defaults: ["ltp_test_defaults"],
@@ -5020,84 +4660,14 @@ cc_test {
}
cc_test {
- name: "ltp_fsmount01",
- stem: "fsmount01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fsmount/fsmount01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fsmount02",
- stem: "fsmount02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fsmount/fsmount02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fsopen01",
- stem: "fsopen01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fsopen/fsopen01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fsopen02",
- stem: "fsopen02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fsopen/fsopen02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fspick01",
- stem: "fspick01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fspick/fspick01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fspick02",
- stem: "fspick02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/fspick/fspick02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_fsstress",
- stem: "fsstress",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/fs/fsstress/fsstress.c"],
- cflags: [
- "-DNO_XFS",
- "-D_GNU_SOURCE",
- "-D_LARGEFILE64_SOURCE",
- ],
- local_include_dirs: [
- "include/old",
- "testcases/kernel/fs/fsstress",
- ],
-}
-
-cc_test {
name: "ltp_fstat02",
stem: "fstat02",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstat/fstat02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5108,13 +4678,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstat/fstat02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5125,9 +4695,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstat/fstat03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5138,13 +4708,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstat/fstat03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5164,9 +4734,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstatfs/fstatfs01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fstatfs",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5177,13 +4747,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstatfs/fstatfs01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fstatfs",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fstatfs",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5194,9 +4764,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstatfs/fstatfs02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fstatfs",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5207,13 +4777,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fstatfs/fstatfs02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/fstatfs",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/fstatfs",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5225,12 +4795,12 @@ cc_test {
srcs: ["testcases/kernel/fs/fsx-linux/fsx-linux.c"],
cflags: [
"-DNO_XFS",
- "-D_GNU_SOURCE",
"-D_LARGEFILE64_SOURCE",
+ "-D_GNU_SOURCE",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/fs/fsx-linux",
+ "include/old",
],
}
@@ -5275,8 +4845,8 @@ cc_test {
stem: "ftest01",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/ftest/ftest01.c",
"testcases/kernel/fs/ftest/libftest.c",
+ "testcases/kernel/fs/ftest/ftest01.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -5299,8 +4869,8 @@ cc_test {
stem: "ftest03",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/ftest/ftest03.c",
"testcases/kernel/fs/ftest/libftest.c",
+ "testcases/kernel/fs/ftest/ftest03.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -5311,8 +4881,8 @@ cc_test {
stem: "ftest04",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/ftest/ftest04.c",
"testcases/kernel/fs/ftest/libftest.c",
+ "testcases/kernel/fs/ftest/ftest04.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -5323,8 +4893,8 @@ cc_test {
stem: "ftest05",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/ftest/ftest05.c",
"testcases/kernel/fs/ftest/libftest.c",
+ "testcases/kernel/fs/ftest/ftest05.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -5335,8 +4905,8 @@ cc_test {
stem: "ftest06",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/ftest/ftest06.c",
"testcases/kernel/fs/ftest/libftest.c",
+ "testcases/kernel/fs/ftest/ftest06.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -5359,8 +4929,8 @@ cc_test {
stem: "ftest08",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/ftest/ftest08.c",
"testcases/kernel/fs/ftest/libftest.c",
+ "testcases/kernel/fs/ftest/ftest08.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -5372,9 +4942,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/ftruncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5385,13 +4955,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/ftruncate",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/ftruncate",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5402,9 +4972,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/ftruncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5415,13 +4985,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/ftruncate",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/ftruncate",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5432,9 +5002,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/ftruncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5445,13 +5015,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate04.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/ftruncate",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/ftruncate",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5520,6 +5090,15 @@ cc_test {
}
cc_test {
+ name: "ltp_futex_wait_bitset02",
+ stem: "futex_wait_bitset02",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/futex/futex_wait_bitset02.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_futex_wake01",
stem: "futex_wake01",
defaults: ["ltp_test_defaults"],
@@ -5833,22 +5412,14 @@ cc_test {
stem: "get_mempolicy01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpnuma",
+ local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
+ "testcases/kernel/include",
+ "include/old",
],
-}
-
-cc_test {
- name: "ltp_get_mempolicy02",
- stem: "get_mempolicy02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c"],
- local_include_dirs: ["include/old"],
static_libs: [
+ "libltp_kerntest",
"libltp_ltp",
- "libltp_ltpnuma",
],
}
@@ -5959,9 +5530,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getegid/getegid01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getegid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5973,9 +5544,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getegid/getegid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getegid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -5986,9 +5557,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getegid/getegid02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getegid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6000,9 +5571,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getegid/getegid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getegid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6013,9 +5584,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/geteuid/geteuid01.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/geteuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6027,9 +5598,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/geteuid/geteuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/geteuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6040,9 +5611,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/geteuid/geteuid02.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/geteuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6054,9 +5625,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/geteuid/geteuid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/geteuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6067,9 +5638,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getgid/getgid01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6081,9 +5652,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getgid/getgid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6094,9 +5665,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getgid/getgid03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6108,9 +5679,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getgid/getgid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6121,9 +5692,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getgroups/getgroups01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/getgroups",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/getgroups",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6135,9 +5706,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getgroups/getgroups01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/getgroups",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/getgroups",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6148,9 +5719,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getgroups/getgroups03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/getgroups",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/getgroups",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6162,9 +5733,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getgroups/getgroups03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/getgroups",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/getgroups",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6355,9 +5926,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getresgid/getresgid01.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getresgid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6369,9 +5940,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getresgid/getresgid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getresgid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6382,9 +5953,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getresgid/getresgid02.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getresgid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6396,9 +5967,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getresgid/getresgid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getresgid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6409,9 +5980,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getresgid/getresgid03.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getresgid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6423,9 +5994,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getresgid/getresgid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getresgid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6436,9 +6007,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getresuid/getresuid01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getresuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6450,9 +6021,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getresuid/getresuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getresuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6463,9 +6034,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getresuid/getresuid02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getresuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6477,9 +6048,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getresuid/getresuid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getresuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6490,9 +6061,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getresuid/getresuid03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getresuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6504,9 +6075,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getresuid/getresuid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/getresuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -6653,9 +6224,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getuid/getuid01.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6667,9 +6238,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getuid/getuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6680,9 +6251,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/getuid/getuid03.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6694,9 +6265,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/getuid/getuid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/getuid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -6759,6 +6330,7 @@ cc_test {
stem: "hangup01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/pty/hangup01.c"],
+ cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -6793,16 +6365,16 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
- "testcases/kernel/mem/hugetlb/lib",
"testcases/kernel/mem/include",
+ "testcases/kernel/mem/hugetlb/lib",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
- "libltp_hugetlb",
+ "libltp_mem",
"libltp_kerntest",
+ "libltp_hugetlb",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -6812,16 +6384,16 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
- "testcases/kernel/mem/hugetlb/lib",
"testcases/kernel/mem/include",
+ "testcases/kernel/mem/hugetlb/lib",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
- "libltp_hugetlb",
+ "libltp_mem",
"libltp_kerntest",
+ "libltp_hugetlb",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -6831,16 +6403,16 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
- "testcases/kernel/mem/hugetlb/lib",
"testcases/kernel/mem/include",
+ "testcases/kernel/mem/hugetlb/lib",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
- "libltp_hugetlb",
+ "libltp_mem",
"libltp_kerntest",
+ "libltp_hugetlb",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -6850,16 +6422,16 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
- "testcases/kernel/mem/hugetlb/lib",
"testcases/kernel/mem/include",
+ "testcases/kernel/mem/hugetlb/lib",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
- "libltp_hugetlb",
+ "libltp_mem",
"libltp_kerntest",
+ "libltp_hugetlb",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -6871,8 +6443,8 @@ cc_test {
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
shared_libs: [
- "libcrypto",
"libdl",
+ "libcrypto",
],
}
@@ -6914,24 +6486,6 @@ cc_test {
}
cc_test {
- name: "ltp_init_module01",
- stem: "init_module01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/init_module/init_module01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_init_module02",
- stem: "init_module02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/init_module/init_module02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_inode01",
stem: "inode01",
defaults: ["ltp_test_defaults"],
@@ -7033,15 +6587,6 @@ cc_test {
}
cc_test {
- name: "ltp_inotify10",
- stem: "inotify10",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/inotify/inotify10.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_inotify_init1_01",
stem: "inotify_init1_01",
defaults: ["ltp_test_defaults"],
@@ -7064,8 +6609,8 @@ cc_test {
stem: "input01",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/input/input01.c",
"testcases/kernel/input/input_helper.c",
+ "testcases/kernel/input/input01.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -7076,8 +6621,8 @@ cc_test {
stem: "input02",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/input/input02.c",
"testcases/kernel/input/input_helper.c",
+ "testcases/kernel/input/input02.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -7100,8 +6645,8 @@ cc_test {
stem: "input05",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/input/input05.c",
"testcases/kernel/input/input_helper.c",
+ "testcases/kernel/input/input05.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -7112,8 +6657,8 @@ cc_test {
stem: "input06",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/input/input06.c",
"testcases/kernel/input/input_helper.c",
+ "testcases/kernel/input/input06.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -7147,24 +6692,6 @@ cc_test {
}
cc_test {
- name: "ltp_io_pgetevents01",
- stem: "io_pgetevents01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_io_pgetevents02",
- stem: "io_pgetevents02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_io_setup01",
stem: "io_setup01",
defaults: ["ltp_test_defaults"],
@@ -7183,31 +6710,13 @@ cc_test {
}
cc_test {
- name: "ltp_io_uring01",
- stem: "io_uring01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/io_uring/io_uring01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_io_uring02",
- stem: "io_uring02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/io_uring/io_uring02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_iobw",
stem: "iobw",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/io-throttle/iobw.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -7279,78 +6788,6 @@ cc_test {
}
cc_test {
- name: "ltp_ioctl09",
- stem: "ioctl09",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl09.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop01",
- stem: "ioctl_loop01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop02",
- stem: "ioctl_loop02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop03",
- stem: "ioctl_loop03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop04",
- stem: "ioctl_loop04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop05",
- stem: "ioctl_loop05",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop05.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop06",
- stem: "ioctl_loop06",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop06.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ioctl_loop07",
- stem: "ioctl_loop07",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_loop07.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_ioctl_ns01",
stem: "ioctl_ns01",
defaults: ["ltp_test_defaults"],
@@ -7414,35 +6851,26 @@ cc_test {
}
cc_test {
- name: "ltp_ioctl_sg01",
- stem: "ioctl_sg01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ioctl/ioctl_sg01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_iogen",
stem: "iogen",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/fs/doio/bytes_by_prefix.c",
+ "testcases/kernel/fs/doio/iogen.c",
"testcases/kernel/fs/doio/dataascii.c",
"testcases/kernel/fs/doio/databin.c",
- "testcases/kernel/fs/doio/datapid.c",
"testcases/kernel/fs/doio/file_lock.c",
"testcases/kernel/fs/doio/forker.c",
- "testcases/kernel/fs/doio/iogen.c",
"testcases/kernel/fs/doio/open_flags.c",
+ "testcases/kernel/fs/doio/datapid.c",
+ "testcases/kernel/fs/doio/write_log.c",
"testcases/kernel/fs/doio/pattern.c",
"testcases/kernel/fs/doio/string_to_tokens.c",
- "testcases/kernel/fs/doio/write_log.c",
+ "testcases/kernel/fs/doio/bytes_by_prefix.c",
],
cflags: ["-D_LARGEFILE64_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/fs/doio/include",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -7619,12 +7047,33 @@ cc_test {
}
cc_test {
+ name: "ltp_kill01",
+ stem: "kill01",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/kill/kill01.c"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
+}
+
+cc_test {
name: "ltp_kill02",
stem: "kill02",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7632,8 +7081,29 @@ cc_test {
stem: "kill03",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
+}
+
+cc_test {
+ name: "ltp_kill04",
+ stem: "kill04",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/kill/kill04.c"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7641,8 +7111,14 @@ cc_test {
stem: "kill06",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill06.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7650,8 +7126,14 @@ cc_test {
stem: "kill08",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill08.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7659,8 +7141,14 @@ cc_test {
stem: "kill09",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill09.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7668,8 +7156,14 @@ cc_test {
stem: "kill10",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill10.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7677,8 +7171,14 @@ cc_test {
stem: "kill11",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill11.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7686,8 +7186,14 @@ cc_test {
stem: "kill12",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/kill/kill12.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -7705,14 +7211,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/ksm/ksm01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -7722,14 +7228,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/ksm/ksm02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -7739,14 +7245,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/ksm/ksm03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -7756,14 +7262,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/ksm/ksm04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -7773,14 +7279,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/ksm/ksm05.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -7790,14 +7296,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/ksm/ksm06.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -7807,9 +7313,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lchown/lchown01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lchown",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -7821,9 +7327,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/lchown/lchown01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lchown",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -7834,9 +7340,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lchown/lchown02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lchown",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -7848,9 +7354,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/lchown/lchown02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lchown",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -7861,9 +7367,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lchown/lchown03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lchown",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -7875,9 +7381,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/lchown/lchown03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lchown",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8156,9 +7662,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lstat/lstat01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8169,13 +7675,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lstat/lstat01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8186,9 +7692,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lstat/lstat02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8199,13 +7705,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/lstat/lstat02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/lstat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8318,37 +7824,19 @@ cc_test {
}
cc_test {
- name: "ltp_mallinfo01",
- stem: "mallinfo01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mallinfo/mallinfo01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_mallinfo02",
- stem: "mallinfo02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mallinfo/mallinfo02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_max_map_count",
stem: "max_map_count",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/tunable/max_map_count.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -8358,9 +7846,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mbind/mbind01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8375,9 +7863,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mbind/mbind02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8392,9 +7880,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mbind/mbind03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8409,9 +7897,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mbind/mbind04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8467,13 +7955,22 @@ cc_test {
srcs: ["testcases/cve/meltdown.c"],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/realtime/include",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
cc_test {
+ name: "ltp_mem01",
+ stem: "mem01",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/mem/mem/mem01.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_mem02",
stem: "mem02",
defaults: ["ltp_test_defaults"],
@@ -8483,13 +7980,22 @@ cc_test {
}
cc_test {
+ name: "ltp_mem03",
+ stem: "mem03",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/memmap/mem03.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_mem_process",
stem: "mem_process",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memcg/control/mem_process.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8509,8 +8015,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memcg/stress/memcg_process_stress.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8521,8 +8027,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memcg/regression/memcg_test_1.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8533,8 +8039,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memcg/regression/memcg_test_2.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8545,8 +8051,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memcg/regression/memcg_test_3.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8557,8 +8063,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memcg/regression/memcg_test_4.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -8587,8 +8093,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/memctl/memctl_test01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: [
"libltp_controllers",
@@ -8601,8 +8107,8 @@ cc_test {
stem: "memfd_create01",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/memfd_create/memfd_create01.c",
"testcases/kernel/syscalls/memfd_create/memfd_create_common.c",
+ "testcases/kernel/syscalls/memfd_create/memfd_create01.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -8613,8 +8119,8 @@ cc_test {
stem: "memfd_create02",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/memfd_create/memfd_create02.c",
"testcases/kernel/syscalls/memfd_create/memfd_create_common.c",
+ "testcases/kernel/syscalls/memfd_create/memfd_create02.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -8637,8 +8143,8 @@ cc_test {
stem: "memfd_create04",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/memfd_create/memfd_create04.c",
"testcases/kernel/syscalls/memfd_create/memfd_create_common.c",
+ "testcases/kernel/syscalls/memfd_create/memfd_create04.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -8664,8 +8170,8 @@ cc_test {
],
cflags: ["-D_GNU_SOURCE"],
local_include_dirs: [
- "include/old",
"testcases/kernel/hotplug/memory_hotplug",
+ "include/old",
],
}
@@ -8678,9 +8184,9 @@ cc_test {
"testcases/kernel/syscalls/migrate_pages/migrate_pages_common.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8697,9 +8203,9 @@ cc_test {
"testcases/kernel/syscalls/migrate_pages/migrate_pages_common.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8716,9 +8222,9 @@ cc_test {
"testcases/kernel/syscalls/migrate_pages/migrate_pages_common.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -8745,24 +8251,6 @@ cc_test {
}
cc_test {
- name: "ltp_mincore03",
- stem: "mincore03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mincore/mincore03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_mincore04",
- stem: "mincore04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mincore/mincore04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_mkdir02",
stem: "mkdir02",
defaults: ["ltp_test_defaults"],
@@ -9186,33 +8674,6 @@ cc_test {
}
cc_test {
- name: "ltp_mmap17",
- stem: "mmap17",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mmap/mmap17.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_mmap18",
- stem: "mmap18",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mmap/mmap18.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_mmap19",
- stem: "mmap19",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/mmap/mmap19.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_mmap2",
stem: "mmap2",
defaults: ["ltp_test_defaults"],
@@ -9436,24 +8897,6 @@ cc_test {
}
cc_test {
- name: "ltp_move_mount01",
- stem: "move_mount01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/move_mount/move_mount01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_move_mount02",
- stem: "move_mount02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/move_mount/move_mount02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_move_pages01",
stem: "move_pages01",
defaults: ["ltp_test_defaults"],
@@ -9462,9 +8905,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9477,13 +8920,13 @@ cc_test {
stem: "move_pages02",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/move_pages/move_pages02.c",
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
+ "testcases/kernel/syscalls/move_pages/move_pages02.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9500,9 +8943,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9519,9 +8962,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9534,13 +8977,13 @@ cc_test {
stem: "move_pages05",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/move_pages/move_pages05.c",
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
+ "testcases/kernel/syscalls/move_pages/move_pages05.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9557,9 +9000,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9572,13 +9015,13 @@ cc_test {
stem: "move_pages07",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/move_pages/move_pages07.c",
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
+ "testcases/kernel/syscalls/move_pages/move_pages07.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9595,9 +9038,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9614,9 +9057,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9629,13 +9072,13 @@ cc_test {
stem: "move_pages11",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/move_pages/move_pages11.c",
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
+ "testcases/kernel/syscalls/move_pages/move_pages11.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9652,9 +9095,9 @@ cc_test {
"testcases/kernel/syscalls/move_pages/move_pages_support.c",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/include",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: [
"libltp_kerntest",
@@ -9703,8 +9146,14 @@ cc_test {
stem: "mremap01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mremap/mremap01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -9712,8 +9161,14 @@ cc_test {
stem: "mremap02",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mremap/mremap02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -9721,8 +9176,14 @@ cc_test {
stem: "mremap03",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mremap/mremap03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
+ static_libs: [
+ "libltp_ipc",
+ "libltp_ltp",
+ ],
}
cc_test {
@@ -9730,19 +9191,13 @@ cc_test {
stem: "mremap05",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/mremap/mremap05.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_msgget05",
- stem: "msgget05",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ipc/msgget/msgget05.c"],
- local_include_dirs: ["include/old"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
static_libs: [
+ "libltp_ipc",
"libltp_ltp",
- "libltp_ltpnewipc",
],
}
@@ -9846,24 +9301,6 @@ cc_test {
}
cc_test {
- name: "ltp_name_to_handle_at01",
- stem: "name_to_handle_at01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_name_to_handle_at02",
- stem: "name_to_handle_at02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_nanosleep01",
stem: "nanosleep01",
defaults: ["ltp_test_defaults"],
@@ -9962,8 +9399,8 @@ cc_test {
stem: "nfs_flock",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/network/nfs/nfslock01/nfs_flock.c",
"testcases/network/nfs/nfslock01/nfs_flock_func.c",
+ "testcases/network/nfs/nfslock01/nfs_flock.c",
],
local_include_dirs: ["include/old"],
}
@@ -9973,8 +9410,8 @@ cc_test {
stem: "nfs_flock_dgen",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/network/nfs/nfslock01/nfs_flock_dgen.c",
"testcases/network/nfs/nfslock01/nfs_flock_func.c",
+ "testcases/network/nfs/nfslock01/nfs_flock_dgen.c",
],
local_include_dirs: ["include/old"],
}
@@ -9984,16 +9421,16 @@ cc_test {
stem: "nftw01",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/syscalls/nftw/tools.c",
"testcases/kernel/syscalls/nftw/lib.c",
- "testcases/kernel/syscalls/nftw/nftw.c",
"testcases/kernel/syscalls/nftw/test.c",
+ "testcases/kernel/syscalls/nftw/nftw.c",
"testcases/kernel/syscalls/nftw/test_func.c",
- "testcases/kernel/syscalls/nftw/tools.c",
],
cflags: [
"-D_LARGEFILE_SOURCE",
- "-D_XOPEN_SOURCE=500",
"-D_XOPEN_SOURCE_EXTENDED",
+ "-D_XOPEN_SOURCE=500",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -10004,16 +9441,16 @@ cc_test {
stem: "nftw6401",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/syscalls/nftw/lib64.c",
+ "testcases/kernel/syscalls/nftw/tools64.c",
"testcases/kernel/syscalls/nftw/nftw64.c",
+ "testcases/kernel/syscalls/nftw/lib64.c",
"testcases/kernel/syscalls/nftw/test64.c",
"testcases/kernel/syscalls/nftw/test_func64.c",
- "testcases/kernel/syscalls/nftw/tools64.c",
],
cflags: [
"-D_LARGEFILE64_SOURCE",
- "-D_XOPEN_SOURCE=500",
"-D_XOPEN_SOURCE_EXTENDED",
+ "-D_XOPEN_SOURCE=500",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -10070,8 +9507,8 @@ cc_test {
stem: "ns-icmp_redirector",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/network/stress/ns-tools/ns-common.c",
"testcases/network/stress/ns-tools/ns-icmp_redirector.c",
+ "testcases/network/stress/ns-tools/ns-common.c",
],
local_include_dirs: ["include/old"],
}
@@ -10169,8 +9606,8 @@ cc_test {
stem: "ns-udpsender",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/network/stress/ns-tools/ns-common.c",
"testcases/network/stress/ns-tools/ns-udpsender.c",
+ "testcases/network/stress/ns-tools/ns-common.c",
],
local_include_dirs: ["include/old"],
}
@@ -10201,14 +9638,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/oom/oom01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -10218,14 +9655,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/oom/oom02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -10235,14 +9672,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/oom/oom03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -10252,14 +9689,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/oom/oom04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -10269,14 +9706,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/oom/oom05.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -10407,42 +9844,6 @@ cc_test {
}
cc_test {
- name: "ltp_open_by_handle_at01",
- stem: "open_by_handle_at01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_open_by_handle_at02",
- stem: "open_by_handle_at02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_open_tree01",
- stem: "open_tree01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/open_tree/open_tree01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_open_tree02",
- stem: "open_tree02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/open_tree/open_tree02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_openat01",
stem: "openat01",
defaults: ["ltp_test_defaults"],
@@ -10470,33 +9871,6 @@ cc_test {
}
cc_test {
- name: "ltp_openat201",
- stem: "openat201",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/openat2/openat201.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_openat202",
- stem: "openat202",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/openat2/openat202.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_openat203",
- stem: "openat203",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/openat2/openat203.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_openfile",
stem: "openfile",
defaults: ["ltp_test_defaults"],
@@ -10511,14 +9885,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/tunable/overcommit_memory.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -10634,33 +10008,6 @@ cc_test {
}
cc_test {
- name: "ltp_pidfd_open01",
- stem: "pidfd_open01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pidfd_open/pidfd_open01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pidfd_open02",
- stem: "pidfd_open02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pidfd_open/pidfd_open02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pidfd_open03",
- stem: "pidfd_open03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pidfd_open/pidfd_open03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_pidfd_send_signal01",
stem: "pidfd_send_signal01",
defaults: ["ltp_test_defaults"],
@@ -10693,8 +10040,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/pids/pids_task1.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10705,8 +10052,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/controllers/pids/pids_task2.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/controllers/libcontrollers",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10811,24 +10158,6 @@ cc_test {
}
cc_test {
- name: "ltp_pipe12",
- stem: "pipe12",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pipe/pipe12.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pipe13",
- stem: "pipe13",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pipe/pipe13.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_pipe2_01",
stem: "pipe2_01",
defaults: ["ltp_test_defaults"],
@@ -10847,24 +10176,6 @@ cc_test {
}
cc_test {
- name: "ltp_pipe2_02_child",
- stem: "pipe2_02_child",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pipe2/pipe2_02_child.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pipe2_04",
- stem: "pipe2_04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/pipe2/pipe2_04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_pivot_root01",
stem: "pivot_root01",
defaults: ["ltp_test_defaults"],
@@ -10915,9 +10226,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10928,13 +10239,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10945,9 +10256,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10958,13 +10269,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10975,9 +10286,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -10988,13 +10299,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11005,9 +10316,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11018,13 +10329,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/fadvise/posix_fadvise04.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/fadvise",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11134,9 +10445,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pread/pread01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pread",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11147,13 +10458,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pread/pread01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/pread",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/pread",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11164,9 +10475,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pread/pread02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pread",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11177,13 +10488,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pread/pread02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/pread",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/pread",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11194,9 +10505,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pread/pread03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pread",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11207,13 +10518,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pread/pread03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/pread",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/pread",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11224,9 +10535,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv/preadv01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/preadv",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11237,13 +10548,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv/preadv01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/preadv",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11254,9 +10565,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv/preadv02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/preadv",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11267,13 +10578,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv/preadv02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/preadv",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11284,9 +10595,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv/preadv03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/preadv",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11297,13 +10608,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv/preadv03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/preadv",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11314,9 +10625,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv2/preadv201.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/preadv2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11327,13 +10638,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv2/preadv201.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/preadv2",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11344,9 +10655,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv2/preadv202.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/preadv2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11357,13 +10668,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv2/preadv202.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/preadv2",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11374,9 +10685,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv2/preadv203.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/preadv2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11387,13 +10698,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/preadv2/preadv203.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/preadv2",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11459,9 +10770,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pselect/pselect01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pselect",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11472,13 +10783,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pselect/pselect01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pselect",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11489,9 +10800,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pselect/pselect02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pselect",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11502,13 +10813,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pselect/pselect02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pselect",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11519,9 +10830,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pselect/pselect03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pselect",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11532,13 +10843,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pselect/pselect03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pselect",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11557,6 +10868,7 @@ cc_test {
stem: "ptem01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/pty/ptem01.c"],
+ cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -11593,9 +10905,9 @@ cc_test {
stem: "pthcli",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/clisrv/pthcli.c",
- "testcases/kernel/sched/clisrv/readline.c",
"testcases/kernel/sched/clisrv/writen.c",
+ "testcases/kernel/sched/clisrv/readline.c",
+ "testcases/kernel/sched/clisrv/pthcli.c",
],
cflags: ["-D_LINUX"],
local_include_dirs: ["include/old"],
@@ -11606,9 +10918,9 @@ cc_test {
stem: "pthserv",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/clisrv/pthserv.c",
- "testcases/kernel/sched/clisrv/readline.c",
"testcases/kernel/sched/clisrv/writen.c",
+ "testcases/kernel/sched/clisrv/readline.c",
+ "testcases/kernel/sched/clisrv/pthserv.c",
],
cflags: ["-D_LINUX"],
local_include_dirs: ["include/old"],
@@ -11669,46 +10981,11 @@ cc_test {
}
cc_test {
- name: "ltp_ptrace08",
- stem: "ptrace08",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ptrace/ptrace08.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ptrace09",
- stem: "ptrace09",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ptrace/ptrace09.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ptrace10",
- stem: "ptrace10",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ptrace/ptrace10.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_ptrace11",
- stem: "ptrace11",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ptrace/ptrace11.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_pty01",
stem: "pty01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/pty/pty01.c"],
+ cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -11718,33 +10995,7 @@ cc_test {
stem: "pty02",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/pty/pty02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pty03",
- stem: "pty03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/pty/pty03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pty04",
- stem: "pty04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/pty/pty04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_pty05",
- stem: "pty05",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/pty/pty05.c"],
+ cflags: ["-D_GNU_SOURCE"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -11755,9 +11006,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11768,13 +11019,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11785,9 +11036,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11798,13 +11049,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11815,9 +11066,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11828,13 +11079,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11845,9 +11096,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11858,13 +11109,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwrite/pwrite04.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwrite",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11875,9 +11126,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev/pwritev01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11888,13 +11139,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev/pwritev01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/pwritev",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11905,9 +11156,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev/pwritev02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11918,13 +11169,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev/pwritev02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/pwritev",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11935,9 +11186,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev/pwritev03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11948,13 +11199,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev/pwritev03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/pwritev",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -11965,9 +11216,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev2/pwritev201.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11978,13 +11229,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev2/pwritev201.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -11995,9 +11246,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev2/pwritev202.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -12008,13 +11259,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/pwritev2/pwritev202.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/pwritev2",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -12074,15 +11325,6 @@ cc_test {
}
cc_test {
- name: "ltp_quotactl07",
- stem: "quotactl07",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/quotactl/quotactl07.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_random-access",
stem: "random-access",
defaults: ["ltp_test_defaults"],
@@ -12302,22 +11544,13 @@ cc_test {
}
cc_test {
- name: "ltp_recvmmsg01",
- stem: "recvmmsg01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/recvmmsg/recvmmsg01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_recvmsg01",
stem: "recvmsg01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/recvmsg/recvmsg01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -12328,8 +11561,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/recvmsg/recvmsg02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -12340,8 +11573,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/recvmsg/recvmsg03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -12599,15 +11832,6 @@ cc_test {
}
cc_test {
- name: "ltp_route-change-netlink",
- stem: "route-change-netlink",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/network/stress/route/route-change-netlink.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_rt_sigaction01",
stem: "rt_sigaction01",
defaults: ["ltp_test_defaults"],
@@ -12684,12 +11908,10 @@ cc_test {
name: "ltp_rt_sigtimedwait01",
stem: "rt_sigtimedwait01",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c"],
+ srcs: ["testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c"],
+ cflags: ["-DTEST_RT_SIGTIMEDWAIT"],
local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpsigwait",
- ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
@@ -12711,15 +11933,6 @@ cc_test {
}
cc_test {
- name: "ltp_rtc02",
- stem: "rtc02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/device-drivers/rtc/rtc02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_sbrk01",
stem: "sbrk01",
defaults: ["ltp_test_defaults"],
@@ -12751,9 +11964,9 @@ cc_test {
stem: "sched_boost",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sched_boost.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12764,9 +11977,9 @@ cc_test {
stem: "sched_cfs_prio",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sched_cfs_prio.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12777,9 +11990,9 @@ cc_test {
stem: "sched_dl_runtime",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sched_dl_runtime.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12790,8 +12003,8 @@ cc_test {
stem: "sched_driver",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/sched_stress/sched.c",
"testcases/kernel/sched/sched_stress/sched_driver.c",
+ "testcases/kernel/sched/sched_stress/sched.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12870,6 +12083,15 @@ cc_test {
}
cc_test {
+ name: "ltp_sched_getparam02",
+ stem: "sched_getparam02",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/sched_getparam/sched_getparam02.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_sched_getparam03",
stem: "sched_getparam03",
defaults: ["ltp_test_defaults"],
@@ -12901,9 +12123,9 @@ cc_test {
stem: "sched_latency_dl",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sched_latency_dl.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12914,9 +12136,9 @@ cc_test {
stem: "sched_latency_rt",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sched_latency_rt.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12927,9 +12149,9 @@ cc_test {
stem: "sched_prio_3_fifo",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/eas/sched_prio_3_fifo.c",
- "testcases/kernel/sched/eas/trace_parse.c",
"testcases/kernel/sched/eas/util.c",
+ "testcases/kernel/sched/eas/trace_parse.c",
+ "testcases/kernel/sched/eas/sched_prio_3_fifo.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -12940,9 +12162,9 @@ cc_test {
stem: "sched_prio_3_rr",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/eas/sched_prio_3_rr.c",
- "testcases/kernel/sched/eas/trace_parse.c",
"testcases/kernel/sched/eas/util.c",
+ "testcases/kernel/sched/eas/trace_parse.c",
+ "testcases/kernel/sched/eas/sched_prio_3_rr.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -13106,8 +12328,8 @@ cc_test {
stem: "sched_tc3",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/sched_stress/sched.c",
"testcases/kernel/sched/sched_stress/sched_tc3.c",
+ "testcases/kernel/sched/sched_stress/sched.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -13118,8 +12340,8 @@ cc_test {
stem: "sched_tc4",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/sched_stress/sched.c",
"testcases/kernel/sched/sched_stress/sched_tc4.c",
+ "testcases/kernel/sched/sched_stress/sched.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -13142,8 +12364,8 @@ cc_test {
stem: "sched_tc6",
defaults: ["ltp_test_defaults"],
srcs: [
- "testcases/kernel/sched/sched_stress/sched.c",
"testcases/kernel/sched/sched_stress/sched_tc6.c",
+ "testcases/kernel/sched/sched_stress/sched.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -13204,30 +12426,6 @@ cc_test {
}
cc_test {
- name: "ltp_semctl08",
- stem: "semctl08",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ipc/semctl/semctl08.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpnewipc",
- ],
-}
-
-cc_test {
- name: "ltp_semctl09",
- stem: "semctl09",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ipc/semctl/semctl09.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpnewipc",
- ],
-}
-
-cc_test {
name: "ltp_send01",
stem: "send01",
defaults: ["ltp_test_defaults"],
@@ -13237,23 +12435,14 @@ cc_test {
}
cc_test {
- name: "ltp_send02",
- stem: "send02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/send/send02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_sendfile02",
stem: "sendfile02",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13264,15 +12453,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile02.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13283,9 +12472,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13296,15 +12485,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile03.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13315,9 +12504,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13328,15 +12517,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile04.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13347,9 +12536,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile05.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13360,15 +12549,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile05.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13379,9 +12568,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile06.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13392,15 +12581,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile06.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13411,9 +12600,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile07.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13424,15 +12613,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile07.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13443,9 +12632,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile08.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13456,15 +12645,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile08.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13475,9 +12664,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile09.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13488,15 +12677,15 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendfile/sendfile09.c"],
cflags: [
- "-DOFF_T=off64_t",
- "-DTST_USE_NEWER64_SYSCALL=1",
- "-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ "-DOFF_T=off64_t",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/sendfile",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/sendfile",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13511,34 +12700,13 @@ cc_test {
}
cc_test {
- name: "ltp_sendmmsg02",
- stem: "sendmmsg02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/sendmmsg/sendmmsg02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_sendmsg01",
stem: "sendmsg01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sendmsg/sendmsg01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/utils",
- ],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_sendmsg03",
- stem: "sendmsg03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/sendmsg/sendmsg03.c"],
- local_include_dirs: [
"include/old",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -13562,15 +12730,6 @@ cc_test {
}
cc_test {
- name: "ltp_sendto03",
- stem: "sendto03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/sendto/sendto03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_set_mempolicy01",
stem: "set_mempolicy01",
defaults: ["ltp_test_defaults"],
@@ -13696,9 +12855,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsgid/setfsgid01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setfsgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setfsgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13710,9 +12869,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsgid/setfsgid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setfsgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setfsgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13723,9 +12882,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsgid/setfsgid02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setfsgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setfsgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13737,9 +12896,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsgid/setfsgid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setfsgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setfsgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13750,9 +12909,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsgid/setfsgid03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setfsgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setfsgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13764,9 +12923,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsgid/setfsgid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setfsgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setfsgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13777,9 +12936,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13791,9 +12950,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13804,9 +12963,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13818,9 +12977,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13831,9 +12990,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13845,9 +13004,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13858,9 +13017,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13872,9 +13031,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setfsuid/setfsuid04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setfsuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13885,9 +13044,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgid/setgid01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13899,9 +13058,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgid/setgid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13912,9 +13071,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgid/setgid02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13926,9 +13085,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgid/setgid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13939,9 +13098,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgid/setgid03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13953,9 +13112,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgid/setgid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setgid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setgid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13966,9 +13125,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgroups/setgroups01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13980,9 +13139,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgroups/setgroups01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -13993,9 +13152,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgroups/setgroups02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14007,9 +13166,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgroups/setgroups02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14020,9 +13179,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgroups/setgroups03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14034,9 +13193,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgroups/setgroups03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14047,9 +13206,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setgroups/setgroups04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14061,9 +13220,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setgroups/setgroups04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setgroups",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14213,9 +13372,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setregid/setregid01.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14227,9 +13386,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setregid/setregid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14240,9 +13399,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setregid/setregid02.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14254,9 +13413,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setregid/setregid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14267,9 +13426,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setregid/setregid03.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14281,9 +13440,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setregid/setregid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14294,9 +13453,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setregid/setregid04.c"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14308,9 +13467,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setregid/setregid04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/setregid",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -14321,9 +13480,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresgid/setresgid01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14335,9 +13494,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresgid/setresgid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14348,9 +13507,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresgid/setresgid02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14362,9 +13521,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresgid/setresgid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14375,9 +13534,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresgid/setresgid03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14389,9 +13548,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresgid/setresgid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14402,9 +13561,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresgid/setresgid04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14416,9 +13575,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresgid/setresgid04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setresgid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14429,9 +13588,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresuid/setresuid01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14443,9 +13602,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresuid/setresuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14456,9 +13615,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresuid/setresuid02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14470,9 +13629,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresuid/setresuid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14483,9 +13642,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresuid/setresuid03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14497,9 +13656,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresuid/setresuid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14510,9 +13669,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresuid/setresuid04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14524,9 +13683,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresuid/setresuid04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14537,9 +13696,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setresuid/setresuid05.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14551,9 +13710,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setresuid/setresuid05.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setresuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setresuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14564,9 +13723,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14578,9 +13737,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14591,9 +13750,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14605,9 +13764,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid02.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14618,9 +13777,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14632,9 +13791,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14645,9 +13804,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid04.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14659,9 +13818,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14672,9 +13831,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid05.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14686,9 +13845,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid05.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14699,9 +13858,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid06.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14713,9 +13872,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid06.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14726,9 +13885,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setreuid/setreuid07.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14740,9 +13899,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setreuid/setreuid07.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/setreuid",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14847,33 +14006,6 @@ cc_test {
}
cc_test {
- name: "ltp_setsockopt05",
- stem: "setsockopt05",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/setsockopt/setsockopt05.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_setsockopt06",
- stem: "setsockopt06",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/setsockopt/setsockopt06.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_setsockopt07",
- stem: "setsockopt07",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/setsockopt/setsockopt07.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_settimeofday01",
stem: "settimeofday01",
defaults: ["ltp_test_defaults"],
@@ -14897,9 +14029,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setuid/setuid01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14911,9 +14043,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setuid/setuid01.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14924,9 +14056,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setuid/setuid03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14938,9 +14070,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setuid/setuid03.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14951,9 +14083,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/setuid/setuid04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -14965,9 +14097,9 @@ cc_test {
srcs: ["testcases/kernel/syscalls/setuid/setuid04.c"],
cflags: ["-DTST_USE_COMPAT16_SYSCALL=1"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/setuid",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/setuid",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15013,32 +14145,17 @@ cc_test {
stem: "shmctl05",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/ipc/shmctl/shmctl05.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_shmctl06",
- stem: "shmctl06",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ipc/shmctl/shmctl06.c"],
- local_include_dirs: ["include/old"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/ipc/lib",
+ "include/old",
+ ],
static_libs: [
+ "libltp_ipc",
"libltp_ltp",
- "libltp_ltpnewipc",
],
}
cc_test {
- name: "ltp_shmctl08",
- stem: "shmctl08",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/ipc/shmctl/shmctl08.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_sigaction01",
stem: "sigaction01",
defaults: ["ltp_test_defaults"],
@@ -15213,24 +14330,20 @@ cc_test {
name: "ltp_sigtimedwait01",
stem: "sigtimedwait01",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/sigtimedwait/sigtimedwait01.c"],
+ srcs: ["testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c"],
+ cflags: ["-DTEST_SIGTIMEDWAIT"],
local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpsigwait",
- ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
name: "ltp_sigwait01",
stem: "sigwait01",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/sigwait/sigwait01.c"],
+ srcs: ["testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c"],
+ cflags: ["-DTEST_SIGWAIT"],
local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpsigwait",
- ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
@@ -15238,11 +14351,9 @@ cc_test {
stem: "sigwaitinfo01",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c"],
+ cflags: ["-DTEST_SIGWAITINFO"],
local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpsigwait",
- ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
@@ -15273,16 +14384,6 @@ cc_test {
}
cc_test {
- name: "ltp_snd_seq01",
- stem: "snd_seq01",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/sound/snd_seq01.c"],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_snd_timer01",
stem: "snd_timer01",
defaults: ["ltp_test_defaults"],
@@ -15338,6 +14439,15 @@ cc_test {
}
cc_test {
+ name: "ltp_socketcall04",
+ stem: "socketcall04",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/socketcall/socketcall04.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_socketpair01",
stem: "socketpair01",
defaults: ["ltp_test_defaults"],
@@ -15446,9 +14556,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/stat/stat01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/stat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15459,13 +14569,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/stat/stat01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/stat",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/stat",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15476,9 +14586,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/stat/stat02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/stat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15489,13 +14599,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/stat/stat02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/stat",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/stat",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15506,9 +14616,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/stat/stat03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/stat",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15519,13 +14629,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/stat/stat03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
- "testcases/kernel/syscalls/stat",
"testcases/kernel/syscalls/utils",
+ "testcases/kernel/syscalls/stat",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15536,9 +14646,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/statfs/statfs01.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/statfs",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15549,13 +14659,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/statfs/statfs01.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/statfs",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -15566,9 +14676,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/statfs/statfs02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/statfs",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15579,13 +14689,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/statfs/statfs02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/statfs",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -15596,9 +14706,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/statfs/statfs03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/statfs",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -15609,13 +14719,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/statfs/statfs03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
+ "testcases/kernel/syscalls/utils",
"include/old",
"testcases/kernel/syscalls/statfs",
- "testcases/kernel/syscalls/utils",
],
static_libs: ["libltp_ltp"],
}
@@ -15760,9 +14870,9 @@ cc_test {
stem: "sugov_latency",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sugov_latency.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -15773,9 +14883,9 @@ cc_test {
stem: "sugov_stale_util",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sugov_stale_util.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -15786,9 +14896,9 @@ cc_test {
stem: "sugov_wakeups",
defaults: ["ltp_test_defaults"],
srcs: [
+ "testcases/kernel/sched/eas/util.c",
"testcases/kernel/sched/eas/sugov_wakeups.c",
"testcases/kernel/sched/eas/trace_parse.c",
- "testcases/kernel/sched/eas/util.c",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -15808,60 +14918,75 @@ cc_test {
name: "ltp_swapoff01",
stem: "swapoff01",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/swapoff/swapoff01.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpswap",
+ srcs: [
+ "testcases/kernel/syscalls/swapon/libswapon.c",
+ "testcases/kernel/syscalls/swapoff/swapoff01.c",
],
+ local_include_dirs: [
+ "include/old",
+ "testcases/kernel/syscalls/swapon",
+ ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
name: "ltp_swapoff02",
stem: "swapoff02",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/swapoff/swapoff02.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpswap",
+ srcs: [
+ "testcases/kernel/syscalls/swapoff/swapoff02.c",
+ "testcases/kernel/syscalls/swapon/libswapon.c",
+ ],
+ local_include_dirs: [
+ "include/old",
+ "testcases/kernel/syscalls/swapon",
],
+ static_libs: ["libltp_ltp"],
}
cc_test {
name: "ltp_swapon01",
stem: "swapon01",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/swapon/swapon01.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpswap",
+ srcs: [
+ "testcases/kernel/syscalls/swapon/swapon01.c",
+ "testcases/kernel/syscalls/swapon/libswapon.c",
],
+ local_include_dirs: [
+ "include/old",
+ "testcases/kernel/syscalls/swapon",
+ ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
name: "ltp_swapon02",
stem: "swapon02",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/swapon/swapon02.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpswap",
+ srcs: [
+ "testcases/kernel/syscalls/swapon/libswapon.c",
+ "testcases/kernel/syscalls/swapon/swapon02.c",
+ ],
+ local_include_dirs: [
+ "include/old",
+ "testcases/kernel/syscalls/swapon",
],
+ static_libs: ["libltp_ltp"],
}
cc_test {
name: "ltp_swapon03",
stem: "swapon03",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/swapon/swapon03.c"],
- local_include_dirs: ["include/old"],
- static_libs: [
- "libltp_ltp",
- "libltp_ltpswap",
+ srcs: [
+ "testcases/kernel/syscalls/swapon/swapon03.c",
+ "testcases/kernel/syscalls/swapon/libswapon.c",
],
+ local_include_dirs: [
+ "include/old",
+ "testcases/kernel/syscalls/swapon",
+ ],
+ static_libs: ["libltp_ltp"],
}
cc_test {
@@ -15870,14 +14995,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/swapping/swapping01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -15945,6 +15070,24 @@ cc_test {
}
cc_test {
+ name: "ltp_sync02",
+ stem: "sync02",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/sync/sync02.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+ name: "ltp_sync03",
+ stem: "sync03",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/sync/sync03.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_sync_file_range01",
stem: "sync_file_range01",
defaults: ["ltp_test_defaults"],
@@ -16089,15 +15232,6 @@ cc_test {
}
cc_test {
- name: "ltp_sysinfo03",
- stem: "sysinfo03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/sysinfo/sysinfo03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_syslog11",
stem: "syslog11",
defaults: ["ltp_test_defaults"],
@@ -16323,33 +15457,6 @@ cc_test {
}
cc_test {
- name: "ltp_test20",
- stem: "test20",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test20.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test22",
- stem: "test22",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test22.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test_assert",
- stem: "test_assert",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_assert.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_test_exec",
stem: "test_exec",
defaults: ["ltp_test_defaults"],
@@ -16385,60 +15492,6 @@ cc_test {
static_libs: ["libltp_ltp"],
}
-cc_test {
- name: "ltp_test_kconfig01",
- stem: "test_kconfig01",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_kconfig01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test_kconfig02",
- stem: "test_kconfig02",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_kconfig02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test_macros01",
- stem: "test_macros01",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_macros01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test_macros02",
- stem: "test_macros02",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_macros02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test_macros03",
- stem: "test_macros03",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_macros03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_test_timer",
- stem: "test_timer",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/test_timer.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
sh_test {
name: "ltp_testcases_bin_add_ipv6addr",
src: "testcases/network/stress/ns-tools/add_ipv6addr",
@@ -16632,6 +15685,14 @@ sh_test {
}
sh_test {
+ name: "ltp_testcases_bin_can_run_tests.sh",
+ src: "testcases/network/can/filter-tests/can_run_tests.sh",
+ sub_dir: "ltp/testcases/bin",
+ filename: "can_run_tests.sh",
+ compile_multilib: "both",
+}
+
+sh_test {
name: "ltp_testcases_bin_cgroup_fj_common.sh",
src: "testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh",
sub_dir: "ltp/testcases/bin",
@@ -16776,14 +15837,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_cleanup_lvm.sh",
- src: "testcases/misc/lvm/cleanup_lvm.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "cleanup_lvm.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_clockdiff01.sh",
src: "testcases/network/tcp_cmds/clockdiff/clockdiff01.sh",
sub_dir: "ltp/testcases/bin",
@@ -16800,10 +15853,10 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_cn_pec.sh",
- src: "testcases/kernel/connectors/pec/cn_pec.sh",
+ name: "ltp_testcases_bin_connector_test.sh",
+ src: "testcases/kernel/connectors/connector_test.sh",
sub_dir: "ltp/testcases/bin",
- filename: "cn_pec.sh",
+ filename: "connector_test.sh",
compile_multilib: "both",
}
@@ -17208,14 +16261,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_fou01.sh",
- src: "testcases/network/virt/fou01.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "fou01.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_freeze_cancel.sh",
src: "testcases/kernel/controllers/freezer/freeze_cancel.sh",
sub_dir: "ltp/testcases/bin",
@@ -18008,14 +17053,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_generate_lvm_runfile.sh",
- src: "testcases/misc/lvm/generate_lvm_runfile.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "generate_lvm_runfile.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_geneve01.sh",
src: "testcases/network/virt/geneve01.sh",
sub_dir: "ltp/testcases/bin",
@@ -18392,22 +17429,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_ima_kexec.sh",
- src: "testcases/kernel/security/integrity/ima/tests/ima_kexec.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "ima_kexec.sh",
- compile_multilib: "both",
-}
-
-sh_test {
- name: "ltp_testcases_bin_ima_keys.sh",
- src: "testcases/kernel/security/integrity/ima/tests/ima_keys.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "ima_keys.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_ima_measurements.sh",
src: "testcases/kernel/security/integrity/ima/tests/ima_measurements.sh",
sub_dir: "ltp/testcases/bin",
@@ -18424,14 +17445,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_ima_selinux.sh",
- src: "testcases/kernel/security/integrity/ima/tests/ima_selinux.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "ima_selinux.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_ima_setup.sh",
src: "testcases/kernel/security/integrity/ima/tests/ima_setup.sh",
sub_dir: "ltp/testcases/bin",
@@ -18680,34 +17693,34 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_mcast-group-multiple-socket.sh",
- src: "testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh",
+ name: "ltp_testcases_bin_mcast-group-multiple-socket",
+ src: "testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-group-multiple-socket.sh",
+ filename: "mcast-group-multiple-socket",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-group-same-group.sh",
- src: "testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh",
+ name: "ltp_testcases_bin_mcast-group-same-group",
+ src: "testcases/network/stress/multicast/grp-operation/mcast-group-same-group",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-group-same-group.sh",
+ filename: "mcast-group-same-group",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-group-single-socket.sh",
- src: "testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh",
+ name: "ltp_testcases_bin_mcast-group-single-socket",
+ src: "testcases/network/stress/multicast/grp-operation/mcast-group-single-socket",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-group-single-socket.sh",
+ filename: "mcast-group-single-socket",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-group-source-filter.sh",
- src: "testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh",
+ name: "ltp_testcases_bin_mcast-group-source-filter",
+ src: "testcases/network/stress/multicast/grp-operation/mcast-group-source-filter",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-group-source-filter.sh",
+ filename: "mcast-group-source-filter",
compile_multilib: "both",
}
@@ -18720,66 +17733,130 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_mcast-pktfld01.sh",
- src: "testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh",
+ name: "ltp_testcases_bin_mcast4-pktfld01",
+ src: "testcases/network/stress/multicast/packet-flood/mcast4-pktfld01",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-pktfld01",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-pktfld02",
+ src: "testcases/network/stress/multicast/packet-flood/mcast4-pktfld02",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-pktfld02",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-queryfld01",
+ src: "testcases/network/stress/multicast/query-flood/mcast4-queryfld01",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-queryfld01",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-queryfld02",
+ src: "testcases/network/stress/multicast/query-flood/mcast4-queryfld02",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-queryfld02",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-queryfld03",
+ src: "testcases/network/stress/multicast/query-flood/mcast4-queryfld03",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-queryfld03",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-queryfld04",
+ src: "testcases/network/stress/multicast/query-flood/mcast4-queryfld04",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-queryfld04",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-queryfld05",
+ src: "testcases/network/stress/multicast/query-flood/mcast4-queryfld05",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-queryfld05",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast4-queryfld06",
+ src: "testcases/network/stress/multicast/query-flood/mcast4-queryfld06",
+ sub_dir: "ltp/testcases/bin",
+ filename: "mcast4-queryfld06",
+ compile_multilib: "both",
+}
+
+sh_test {
+ name: "ltp_testcases_bin_mcast6-pktfld01",
+ src: "testcases/network/stress/multicast/packet-flood/mcast6-pktfld01",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-pktfld01.sh",
+ filename: "mcast6-pktfld01",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-pktfld02.sh",
- src: "testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh",
+ name: "ltp_testcases_bin_mcast6-pktfld02",
+ src: "testcases/network/stress/multicast/packet-flood/mcast6-pktfld02",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-pktfld02.sh",
+ filename: "mcast6-pktfld02",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-queryfld01.sh",
- src: "testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh",
+ name: "ltp_testcases_bin_mcast6-queryfld01",
+ src: "testcases/network/stress/multicast/query-flood/mcast6-queryfld01",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-queryfld01.sh",
+ filename: "mcast6-queryfld01",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-queryfld02.sh",
- src: "testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh",
+ name: "ltp_testcases_bin_mcast6-queryfld02",
+ src: "testcases/network/stress/multicast/query-flood/mcast6-queryfld02",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-queryfld02.sh",
+ filename: "mcast6-queryfld02",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-queryfld03.sh",
- src: "testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh",
+ name: "ltp_testcases_bin_mcast6-queryfld03",
+ src: "testcases/network/stress/multicast/query-flood/mcast6-queryfld03",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-queryfld03.sh",
+ filename: "mcast6-queryfld03",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-queryfld04.sh",
- src: "testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh",
+ name: "ltp_testcases_bin_mcast6-queryfld04",
+ src: "testcases/network/stress/multicast/query-flood/mcast6-queryfld04",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-queryfld04.sh",
+ filename: "mcast6-queryfld04",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-queryfld05.sh",
- src: "testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh",
+ name: "ltp_testcases_bin_mcast6-queryfld05",
+ src: "testcases/network/stress/multicast/query-flood/mcast6-queryfld05",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-queryfld05.sh",
+ filename: "mcast6-queryfld05",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_mcast-queryfld06.sh",
- src: "testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh",
+ name: "ltp_testcases_bin_mcast6-queryfld06",
+ src: "testcases/network/stress/multicast/query-flood/mcast6-queryfld06",
sub_dir: "ltp/testcases/bin",
- filename: "mcast-queryfld06.sh",
+ filename: "mcast6-queryfld06",
compile_multilib: "both",
}
@@ -19184,18 +18261,18 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_prepare_lvm.sh",
- src: "testcases/misc/lvm/prepare_lvm.sh",
+ name: "ltp_testcases_bin_quota_remount_test01.sh",
+ src: "testcases/kernel/fs/quota_remount/quota_remount_test01.sh",
sub_dir: "ltp/testcases/bin",
- filename: "prepare_lvm.sh",
+ filename: "quota_remount_test01.sh",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_quota_remount_test01.sh",
- src: "testcases/kernel/fs/quota_remount/quota_remount_test01.sh",
+ name: "ltp_testcases_bin_rcp01.sh",
+ src: "testcases/network/tcp_cmds/rcp/rcp01.sh",
sub_dir: "ltp/testcases/bin",
- filename: "quota_remount_test01.sh",
+ filename: "rcp01.sh",
compile_multilib: "both",
}
@@ -19216,6 +18293,14 @@ sh_test {
}
sh_test {
+ name: "ltp_testcases_bin_rlogin01.sh",
+ src: "testcases/network/tcp_cmds/rlogin/rlogin01.sh",
+ sub_dir: "ltp/testcases/bin",
+ filename: "rlogin01.sh",
+ compile_multilib: "both",
+}
+
+sh_test {
name: "ltp_testcases_bin_route-change-dst.sh",
src: "testcases/network/stress/route/route-change-dst.sh",
sub_dir: "ltp/testcases/bin",
@@ -19240,58 +18325,50 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_route-change-netlink-dst.sh",
- src: "testcases/network/stress/route/route-change-netlink-dst.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "route-change-netlink-dst.sh",
- compile_multilib: "both",
-}
-
-sh_test {
- name: "ltp_testcases_bin_route-change-netlink-gw.sh",
- src: "testcases/network/stress/route/route-change-netlink-gw.sh",
+ name: "ltp_testcases_bin_route-lib.sh",
+ src: "testcases/network/stress/route/route-lib.sh",
sub_dir: "ltp/testcases/bin",
- filename: "route-change-netlink-gw.sh",
+ filename: "route-lib.sh",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_route-change-netlink-if.sh",
- src: "testcases/network/stress/route/route-change-netlink-if.sh",
+ name: "ltp_testcases_bin_route4-redirect",
+ src: "testcases/network/stress/route/route4-redirect",
sub_dir: "ltp/testcases/bin",
- filename: "route-change-netlink-if.sh",
+ filename: "route4-redirect",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_route-lib.sh",
- src: "testcases/network/stress/route/route-lib.sh",
+ name: "ltp_testcases_bin_route4-rmmod",
+ src: "testcases/network/stress/route/route4-rmmod",
sub_dir: "ltp/testcases/bin",
- filename: "route-lib.sh",
+ filename: "route4-rmmod",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_route-redirect.sh",
- src: "testcases/network/stress/route/route-redirect.sh",
+ name: "ltp_testcases_bin_route6-redirect",
+ src: "testcases/network/stress/route/route6-redirect",
sub_dir: "ltp/testcases/bin",
- filename: "route-redirect.sh",
+ filename: "route6-redirect",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_route4-rmmod",
- src: "testcases/network/stress/route/route4-rmmod",
+ name: "ltp_testcases_bin_route6-rmmod",
+ src: "testcases/network/stress/route/route6-rmmod",
sub_dir: "ltp/testcases/bin",
- filename: "route4-rmmod",
+ filename: "route6-rmmod",
compile_multilib: "both",
}
sh_test {
- name: "ltp_testcases_bin_route6-rmmod",
- src: "testcases/network/stress/route/route6-rmmod",
+ name: "ltp_testcases_bin_rsh01.sh",
+ src: "testcases/network/tcp_cmds/rsh/rsh01.sh",
sub_dir: "ltp/testcases/bin",
- filename: "route6-rmmod",
+ filename: "rsh01.sh",
compile_multilib: "both",
}
@@ -19360,6 +18437,14 @@ sh_test {
}
sh_test {
+ name: "ltp_testcases_bin_run_pec_test",
+ src: "testcases/kernel/connectors/pec/run_pec_test",
+ sub_dir: "ltp/testcases/bin",
+ filename: "run_pec_test",
+ compile_multilib: "both",
+}
+
+sh_test {
name: "ltp_testcases_bin_run_sched_cliserv.sh",
src: "testcases/kernel/sched/clisrv/run_sched_cliserv.sh",
sub_dir: "ltp/testcases/bin",
@@ -19512,14 +18597,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_shell_pipe01.sh",
- src: "testcases/commands/shell/shell_pipe01.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "shell_pipe01.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_sit01.sh",
src: "testcases/network/virt/sit01.sh",
sub_dir: "ltp/testcases/bin",
@@ -22784,6 +21861,14 @@ sh_test {
}
sh_test {
+ name: "ltp_testcases_bin_utimensat_tests.sh",
+ src: "testcases/kernel/syscalls/utimensat/utimensat_tests.sh",
+ sub_dir: "ltp/testcases/bin",
+ filename: "utimensat_tests.sh",
+ compile_multilib: "both",
+}
+
+sh_test {
name: "ltp_testcases_bin_vfork_freeze.sh",
src: "testcases/kernel/controllers/freezer/vfork_freeze.sh",
sub_dir: "ltp/testcases/bin",
@@ -22864,30 +21949,6 @@ sh_test {
}
sh_test {
- name: "ltp_testcases_bin_wireguard01.sh",
- src: "testcases/network/virt/wireguard01.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "wireguard01.sh",
- compile_multilib: "both",
-}
-
-sh_test {
- name: "ltp_testcases_bin_wireguard02.sh",
- src: "testcases/network/virt/wireguard02.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "wireguard02.sh",
- compile_multilib: "both",
-}
-
-sh_test {
- name: "ltp_testcases_bin_wireguard_lib.sh",
- src: "testcases/network/virt/wireguard_lib.sh",
- sub_dir: "ltp/testcases/bin",
- filename: "wireguard_lib.sh",
- compile_multilib: "both",
-}
-
-sh_test {
name: "ltp_testcases_bin_write_freezing.sh",
src: "testcases/kernel/controllers/freezer/write_freezing.sh",
sub_dir: "ltp/testcases/bin",
@@ -22933,8 +21994,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/network/tcp_cmds/sendfile/testsf_c.c"],
local_include_dirs: [
- "include/old",
"testcases/network/tcp_cmds/include",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -22958,8 +22019,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/network/tcp_cmds/sendfile/testsf_s.c"],
local_include_dirs: [
- "include/old",
"testcases/network/tcp_cmds/include",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -23010,14 +22071,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/thp/thp01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -23027,14 +22088,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/thp/thp02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -23044,31 +22105,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/thp/thp03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
- ],
- static_libs: [
- "libltp_kerntest",
- "libltp_ltp",
- "libltp_mem",
- ],
-}
-
-cc_test {
- name: "ltp_thp04",
- stem: "thp04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/mem/thp/thp04.c"],
- local_include_dirs: [
- "include/old",
"testcases/kernel/include",
- "testcases/kernel/mem/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -23091,19 +22135,19 @@ cc_test {
}
cc_test {
- name: "ltp_timed_forkbomb",
- stem: "timed_forkbomb",
+ name: "ltp_time02",
+ stem: "time02",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/controllers/freezer/timed_forkbomb.c"],
+ srcs: ["testcases/kernel/syscalls/time/time02.c"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
cc_test {
- name: "ltp_timens01",
- stem: "timens01",
+ name: "ltp_timed_forkbomb",
+ stem: "timed_forkbomb",
defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/containers/timens/timens01.c"],
+ srcs: ["testcases/kernel/controllers/freezer/timed_forkbomb.c"],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
}
@@ -23197,16 +22241,6 @@ cc_test {
}
cc_test {
- name: "ltp_timer_settime03",
- stem: "timer_settime03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/timer_settime/timer_settime03.c"],
- cflags: ["-D_GNU_SOURCE"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_timerfd01",
stem: "timerfd01",
defaults: ["ltp_test_defaults"],
@@ -23234,15 +22268,6 @@ cc_test {
}
cc_test {
- name: "ltp_timerfd04",
- stem: "timerfd04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/timerfd/timerfd04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_timerfd_create01",
stem: "timerfd_create01",
defaults: ["ltp_test_defaults"],
@@ -23270,15 +22295,6 @@ cc_test {
}
cc_test {
- name: "ltp_timerfd_settime02",
- stem: "timerfd_settime02",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/timerfd/timerfd_settime02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_times01",
stem: "times01",
defaults: ["ltp_test_defaults"],
@@ -23414,14 +22430,44 @@ cc_test {
}
cc_test {
+ name: "ltp_truncate01",
+ stem: "truncate01",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/truncate/truncate01.c"],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/truncate",
+ "testcases/kernel/syscalls/utils",
+ "include/old",
+ ],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+ name: "ltp_truncate01_64",
+ stem: "truncate01_64",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/truncate/truncate01.c"],
+ cflags: [
+ "-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
+ ],
+ local_include_dirs: [
+ "testcases/kernel/syscalls/truncate",
+ "testcases/kernel/syscalls/utils",
+ "include/old",
+ ],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_truncate02",
stem: "truncate02",
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/truncate/truncate02.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/truncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -23432,13 +22478,13 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/truncate/truncate02.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/truncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -23449,9 +22495,9 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/truncate/truncate03.c"],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/truncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
@@ -23462,27 +22508,18 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/syscalls/truncate/truncate03.c"],
cflags: [
- "-DTST_USE_NEWER64_SYSCALL=1",
"-D_FILE_OFFSET_BITS=64",
+ "-DTST_USE_NEWER64_SYSCALL=1",
],
local_include_dirs: [
- "include/old",
"testcases/kernel/syscalls/truncate",
"testcases/kernel/syscalls/utils",
+ "include/old",
],
static_libs: ["libltp_ltp"],
}
cc_test {
- name: "ltp_tst_bool_expr",
- stem: "tst_bool_expr",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/tst_bool_expr.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_tst_brk",
stem: "tst_brk",
defaults: ["ltp_test_defaults"],
@@ -23521,24 +22558,6 @@ cc_test {
}
cc_test {
- name: "ltp_tst_cgroup01",
- stem: "tst_cgroup01",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/tst_cgroup01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_tst_cgroup02",
- stem: "tst_cgroup02",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/tst_cgroup02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_tst_check_drivers",
stem: "tst_check_drivers",
defaults: ["ltp_test_defaults"],
@@ -23667,33 +22686,6 @@ cc_test {
}
cc_test {
- name: "ltp_tst_fuzzy_sync01",
- stem: "tst_fuzzy_sync01",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/tst_fuzzy_sync01.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_tst_fuzzy_sync02",
- stem: "tst_fuzzy_sync02",
- defaults: ["ltp_test_defaults"],
- srcs: ["lib/newlib_tests/tst_fuzzy_sync02.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
- name: "ltp_tst_get_median",
- stem: "tst_get_median",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/lib/tst_get_median.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_tst_get_unused_port",
stem: "tst_get_unused_port",
defaults: ["ltp_test_defaults"],
@@ -24044,6 +23036,15 @@ cc_test {
}
cc_test {
+ name: "ltp_uname03",
+ stem: "uname03",
+ defaults: ["ltp_test_defaults"],
+ srcs: ["testcases/kernel/syscalls/uname/uname03.c"],
+ local_include_dirs: ["include/old"],
+ static_libs: ["libltp_ltp"],
+}
+
+cc_test {
name: "ltp_uname04",
stem: "uname04",
defaults: ["ltp_test_defaults"],
@@ -24276,14 +23277,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/vma/vma01.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -24293,14 +23294,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/vma/vma02.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -24310,14 +23311,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/vma/vma03.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -24327,14 +23328,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/vma/vma04.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -24344,14 +23345,14 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/mem/vma/vma05_vdso.c"],
local_include_dirs: [
- "include/old",
- "testcases/kernel/include",
"testcases/kernel/mem/include",
+ "testcases/kernel/include",
+ "include/old",
],
static_libs: [
+ "libltp_mem",
"libltp_kerntest",
"libltp_ltp",
- "libltp_mem",
],
}
@@ -24383,15 +23384,6 @@ cc_test {
}
cc_test {
- name: "ltp_vmsplice04",
- stem: "vmsplice04",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/vmsplice/vmsplice04.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_wait01",
stem: "wait01",
defaults: ["ltp_test_defaults"],
@@ -24613,8 +23605,8 @@ cc_test {
defaults: ["ltp_test_defaults"],
srcs: ["testcases/kernel/io/writetest/writetest.c"],
cflags: [
- "-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-D_LARGEFILE64_SOURCE",
],
local_include_dirs: ["include/old"],
static_libs: ["libltp_ltp"],
@@ -24639,15 +23631,6 @@ cc_test {
}
cc_test {
- name: "ltp_writev03",
- stem: "writev03",
- defaults: ["ltp_test_defaults"],
- srcs: ["testcases/kernel/syscalls/writev/writev03.c"],
- local_include_dirs: ["include/old"],
- static_libs: ["libltp_ltp"],
-}
-
-cc_test {
name: "ltp_writev05",
stem: "writev05",
defaults: ["ltp_test_defaults"],
diff --git a/include/lapi/bpf.h b/include/lapi/bpf.h
index 5ae25293b..d3d444b0c 100644
--- a/include/lapi/bpf.h
+++ b/include/lapi/bpf.h
@@ -37,10 +37,8 @@
#define BPF_OP(code) ((code) & 0xf0)
#define BPF_ADD 0x00
#define BPF_SUB 0x10
-#define BPF_DIV 0x30
#define BPF_LSH 0x60
#define BPF_RSH 0x70
-#define BPF_MOD 0x90
#define BPF_JEQ 0x10
@@ -451,14 +449,6 @@ enum bpf_func_id {
.off = 0, \
.imm = 0 })
-#define BPF_ALU32_REG(OP, DST, SRC) \
- ((struct bpf_insn) { \
- .code = BPF_ALU | BPF_OP(OP) | BPF_X, \
- .dst_reg = DST, \
- .src_reg = SRC, \
- .off = 0, \
- .imm = 0 })
-
#define BPF_ALU64_IMM(OP, DST, IMM) \
((struct bpf_insn) { \
.code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
@@ -467,14 +457,6 @@ enum bpf_func_id {
.off = 0, \
.imm = IMM })
-#define BPF_ALU32_IMM(OP, DST, IMM) \
- ((struct bpf_insn) { \
- .code = BPF_ALU | BPF_OP(OP) | BPF_K, \
- .dst_reg = DST, \
- .src_reg = 0, \
- .off = 0, \
- .imm = IMM })
-
#define BPF_MOV64_REG(DST, SRC) \
((struct bpf_insn) { \
.code = BPF_ALU64 | BPF_MOV | BPF_X, \
@@ -483,14 +465,6 @@ enum bpf_func_id {
.off = 0, \
.imm = 0 })
-#define BPF_MOV32_REG(DST, SRC) \
- ((struct bpf_insn) { \
- .code = BPF_ALU | BPF_MOV | BPF_X, \
- .dst_reg = DST, \
- .src_reg = SRC, \
- .off = 0, \
- .imm = 0 })
-
#define BPF_LD_IMM64(DST, IMM) \
BPF_LD_IMM64_RAW(DST, 0, IMM)
@@ -579,12 +553,12 @@ enum bpf_func_id {
/* End copy from tools/include/filter.h */
/* Start copy from tools/lib/bpf */
-static inline uint64_t ptr_to_u64(const void *ptr)
+inline uint64_t ptr_to_u64(const void *ptr)
{
return (uint64_t) (unsigned long) ptr;
}
-static inline int bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size)
+inline int bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size)
{
return tst_syscall(__NR_bpf, cmd, attr, size);
}
diff --git a/include/lapi/capability.h b/include/lapi/capability.h
index 95cb6819b..8833f0605 100644
--- a/include/lapi/capability.h
+++ b/include/lapi/capability.h
@@ -24,26 +24,14 @@
# define CAP_NET_RAW 13
#endif
-#ifndef CAP_SYS_CHROOT
-# define CAP_SYS_CHROOT 18
-#endif
-
#ifndef CAP_SYS_ADMIN
# define CAP_SYS_ADMIN 21
#endif
-#ifndef CAP_SYS_TIME
-# define CAP_SYS_TIME 25
-#endif
-
#ifndef CAP_AUDIT_READ
# define CAP_AUDIT_READ 37
#endif
-#ifndef CAP_SYS_RESOURCE
-# define CAP_SYS_RESOURCE 24
-#endif
-
#ifndef CAP_TO_INDEX
# define CAP_TO_INDEX(x) ((x) >> 5)
#endif
diff --git a/include/lapi/clone.h b/include/lapi/clone.h
deleted file mode 100644
index e49b50e5c..000000000
--- a/include/lapi/clone.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef LAPI_CLONE_H__
-#define LAPI_CLONE_H__
-
-#include <sys/syscall.h>
-#include <linux/types.h>
-#include <sched.h>
-#include <stdint.h>
-
-#include "config.h"
-#include "lapi/syscalls.h"
-
-#ifndef HAVE_STRUCT_CLONE_ARGS
-struct clone_args {
- uint64_t __attribute__((aligned(8))) flags;
- uint64_t __attribute__((aligned(8))) pidfd;
- uint64_t __attribute__((aligned(8))) child_tid;
- uint64_t __attribute__((aligned(8))) parent_tid;
- uint64_t __attribute__((aligned(8))) exit_signal;
- uint64_t __attribute__((aligned(8))) stack;
- uint64_t __attribute__((aligned(8))) stack_size;
- uint64_t __attribute__((aligned(8))) tls;
-};
-#endif
-
-#ifndef HAVE_CLONE3
-static inline int clone3(struct clone_args *args, size_t size)
-{
- return tst_syscall(__NR_clone3, args, size);
-}
-#endif
-
-#ifndef CLONE_PIDFD
-#define CLONE_PIDFD 0x00001000 /* set if a pidfd should be placed in parent */
-#endif
-
-static inline void clone3_supported_by_kernel(void)
-{
- if ((tst_kvercmp(5, 3, 0)) < 0) {
- /* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_clone3, NULL, 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel version < v5.3");
- }
-}
-
-#endif /* LAPI_CLONE_H__ */
diff --git a/include/lapi/close_range.h b/include/lapi/close_range.h
deleted file mode 100644
index 19db52d3d..000000000
--- a/include/lapi/close_range.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) 2021 SUSE LLC */
-
-#ifndef LAPI_CLOSE_RANGE__
-# define LAPI_CLOSE_RANGE__
-
-# include "lapi/syscalls.h"
-
-# ifdef HAVE_LINUX_CLOSE_RANGE_H
-# include <linux/close_range.h>
-# endif
-
-# ifndef CLOSE_RANGE_UNSHARE
-# define CLOSE_RANGE_UNSHARE (1U << 1)
-# endif
-
-# ifndef CLOSE_RANGE_CLOEXEC
-# define CLOSE_RANGE_CLOEXEC (1U << 2)
-# endif
-
-# ifndef HAVE_CLOSE_RANGE
-static inline int close_range(unsigned int fd, unsigned int max_fd,
- unsigned int flags)
-{
- return tst_syscall(__NR_close_range, fd, max_fd, flags);
-}
-# endif
-#endif /* LAPI_CLOSE_RANGE_H__ */
diff --git a/include/lapi/common_timers.h b/include/lapi/common_timers.h
index b783beff4..df4196eeb 100644
--- a/include/lapi/common_timers.h
+++ b/include/lapi/common_timers.h
@@ -15,7 +15,7 @@
#define NSEC_PER_SEC (1000000000L)
#endif
-static const clock_t clock_list[] = {
+clock_t clock_list[] = {
CLOCK_REALTIME,
CLOCK_MONOTONIC,
CLOCK_PROCESS_CPUTIME_ID,
@@ -34,7 +34,7 @@ static const clock_t clock_list[] = {
case def_name: \
return #def_name;
-static inline const char *get_clock_str(const int clock_id)
+const char *get_clock_str(const int clock_id)
{
switch (clock_id) {
CLOCK_TO_STR(CLOCK_REALTIME);
@@ -50,7 +50,7 @@ static inline const char *get_clock_str(const int clock_id)
}
}
-static inline int possibly_unsupported(clock_t clock)
+int possibly_unsupported(clock_t clock)
{
switch (clock) {
case CLOCK_BOOTTIME:
@@ -63,7 +63,7 @@ static inline int possibly_unsupported(clock_t clock)
}
}
-static inline int have_cputime_timers(void)
+int have_cputime_timers(void)
{
return tst_kvercmp(2, 6, 12) >= 0;
}
diff --git a/include/lapi/cpuset.h b/include/lapi/cpuset.h
index 8f7136c3b..b5db5a634 100644
--- a/include/lapi/cpuset.h
+++ b/include/lapi/cpuset.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
diff --git a/include/lapi/cryptouser.h b/include/lapi/cryptouser.h
index e92fe96fb..94d641446 100644
--- a/include/lapi/cryptouser.h
+++ b/include/lapi/cryptouser.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2018 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CRYPTOUSER_H__
diff --git a/include/lapi/dccp.h b/include/lapi/dccp.h
index a0f014850..0d852adca 100644
--- a/include/lapi/dccp.h
+++ b/include/lapi/dccp.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAPI_DCCP_H__
diff --git a/include/lapi/epoll.h b/include/lapi/epoll.h
index 899eeb9d4..8ab4f98f6 100644
--- a/include/lapi/epoll.h
+++ b/include/lapi/epoll.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LAPI_EPOLL_H__
diff --git a/include/lapi/execveat.h b/include/lapi/execveat.h
index 7a7032288..53c8be8a5 100644
--- a/include/lapi/execveat.h
+++ b/include/lapi/execveat.h
@@ -1,6 +1,25 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2018 MediaTek Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 or any later of the GNU General Public License
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
#ifndef EXECVEAT_H
@@ -11,12 +30,13 @@
#include "lapi/syscalls.h"
#if !defined(HAVE_EXECVEAT)
-static inline int execveat(int dirfd, const char *pathname,
- char *const argv[], char *const envp[],
- int flags)
+int execveat(int dirfd, const char *pathname,
+ char *const argv[], char *const envp[],
+ int flags)
{
return tst_syscall(__NR_execveat, dirfd, pathname, argv, envp, flags);
}
#endif
+
#endif /* EXECVEAT_H */
diff --git a/include/lapi/fallocate.h b/include/lapi/fallocate.h
index 72f52c78f..3c711bdfa 100644
--- a/include/lapi/fallocate.h
+++ b/include/lapi/fallocate.h
@@ -1,7 +1,17 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2007
* Copyright (c) 2014 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
*/
#ifndef FALLOCATE_H
diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
index e08970c4f..358230ff7 100644
--- a/include/lapi/fcntl.h
+++ b/include/lapi/fcntl.h
@@ -1,19 +1,27 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __LAPI_FCNTL_H__
#define __LAPI_FCNTL_H__
-#include "config.h"
#include <fcntl.h>
#include <sys/socket.h>
-#ifndef O_DIRECT
-# define O_DIRECT 040000
-#endif
-
#ifndef O_CLOEXEC
# define O_CLOEXEC 02000000
#endif
@@ -137,17 +145,4 @@
# define SPLICE_F_NONBLOCK 2
#endif
-#ifndef MAX_HANDLE_SZ
-# define MAX_HANDLE_SZ 128
-#endif
-
-#ifndef HAVE_STRUCT_FILE_HANDLE
-struct file_handle {
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-#endif /* HAVE_STRUCT_FILE_HANDLE */
-
#endif /* __LAPI_FCNTL_H__ */
diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
deleted file mode 100644
index d6ebed9b4..000000000
--- a/include/lapi/fsmount.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef FSMOUNT_H__
-#define FSMOUNT_H__
-
-#include <sys/mount.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-
-#include "config.h"
-#include "lapi/fcntl.h"
-#include "lapi/syscalls.h"
-
-#ifndef HAVE_FSOPEN
-static inline int fsopen(const char *fsname, unsigned int flags)
-{
- return tst_syscall(__NR_fsopen, fsname, flags);
-}
-#endif /* HAVE_FSOPEN */
-
-#ifndef HAVE_FSCONFIG
-static inline int fsconfig(int fd, unsigned int cmd, const char *key,
- const void *value, int aux)
-{
- return tst_syscall(__NR_fsconfig, fd, cmd, key, value, aux);
-}
-#endif /* HAVE_FSCONFIG */
-
-#ifndef HAVE_FSMOUNT
-static inline int fsmount(int fd, unsigned int flags, unsigned int mount_attrs)
-{
- return tst_syscall(__NR_fsmount, fd, flags, mount_attrs);
-}
-#endif /* HAVE_FSMOUNT */
-
-#ifndef HAVE_FSPICK
-static inline int fspick(int dirfd, const char *pathname, unsigned int flags)
-{
- return tst_syscall(__NR_fspick, dirfd, pathname, flags);
-}
-#endif /* HAVE_FSPICK */
-
-#ifndef HAVE_MOVE_MOUNT
-static inline int move_mount(int from_dirfd, const char *from_pathname,
- int to_dirfd, const char *to_pathname,
- unsigned int flags)
-{
- return tst_syscall(__NR_move_mount, from_dirfd, from_pathname, to_dirfd,
- to_pathname, flags);
-}
-#endif /* HAVE_MOVE_MOUNT */
-
-#ifndef HAVE_OPEN_TREE
-static inline int open_tree(int dirfd, const char *pathname, unsigned int flags)
-{
- return tst_syscall(__NR_open_tree, dirfd, pathname, flags);
-}
-#endif /* HAVE_OPEN_TREE */
-
-/*
- * New headers added in kernel after 5.2 release, create them for old userspace.
-*/
-
-#ifndef OPEN_TREE_CLONE
-
-/*
- * open_tree() flags.
- */
-#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
-#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
-
-/*
- * move_mount() flags.
- */
-#define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
-#define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
-#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
-#define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */
-#define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */
-#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
-#define MOVE_MOUNT__MASK 0x00000077
-
-/*
- * fsopen() flags.
- */
-#define FSOPEN_CLOEXEC 0x00000001
-
-/*
- * fspick() flags.
- */
-#define FSPICK_CLOEXEC 0x00000001
-#define FSPICK_SYMLINK_NOFOLLOW 0x00000002
-#define FSPICK_NO_AUTOMOUNT 0x00000004
-#define FSPICK_EMPTY_PATH 0x00000008
-
-/*
- * The type of fsconfig() call made.
- */
-enum fsconfig_command {
- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */
- FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
-};
-
-/*
- * fsmount() flags.
- */
-#define FSMOUNT_CLOEXEC 0x00000001
-
-/*
- * Mount attributes.
- */
-#define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */
-#define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */
-#define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */
-#define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */
-#define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */
-#define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */
-#define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */
-#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
-#define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */
-
-#endif /* OPEN_TREE_CLONE */
-
-static inline void fsopen_supported_by_kernel(void)
-{
- if ((tst_kvercmp(5, 2, 0)) < 0) {
- /* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_fsopen, NULL, 0));
- if (TST_RET != -1)
- SAFE_CLOSE(TST_RET);
- else if (TST_ERR == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel version < v5.2");
- }
-}
-
-#endif /* FSMOUNT_H__ */
diff --git a/include/lapi/futex.h b/include/lapi/futex.h
index 00b26c355..1ecea478e 100644
--- a/include/lapi/futex.h
+++ b/include/lapi/futex.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LAPI_FUTEX_H__
@@ -10,8 +23,4 @@
typedef volatile uint32_t futex_t;
-#if !defined(SYS_futex) && defined(SYS_futex_time64)
-#define SYS_futex SYS_futex_time64
-#endif
-
#endif /* LAPI_FUTEX_H__ */
diff --git a/include/lapi/getrandom.h b/include/lapi/getrandom.h
index 83e0a0e05..f5609fc44 100644
--- a/include/lapi/getrandom.h
+++ b/include/lapi/getrandom.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __GETRANDOM_H__
diff --git a/include/lapi/if_alg.h b/include/lapi/if_alg.h
index 9c04a444c..5a74df99b 100644
--- a/include/lapi/if_alg.h
+++ b/include/lapi/if_alg.h
@@ -8,10 +8,9 @@
#ifdef HAVE_LINUX_IF_ALG_H
# include <linux/if_alg.h>
-#endif
+#else
# include <stdint.h>
-#ifndef HAVE_STRUCT_SOCKADDR_ALG
struct sockaddr_alg {
uint16_t salg_family;
uint8_t salg_type[14];
@@ -19,41 +18,21 @@ struct sockaddr_alg {
uint32_t salg_mask;
uint8_t salg_name[64];
};
-#endif
-#ifndef HAVE_STRUCT_AF_ALG_IV
struct af_alg_iv {
uint32_t ivlen;
uint8_t iv[0];
};
-#endif
-#ifndef ALG_SET_KEY
-# define ALG_SET_KEY 1
-#endif
+#define ALG_SET_KEY 1
+#define ALG_SET_IV 2
+#define ALG_SET_OP 3
+#define ALG_SET_AEAD_ASSOCLEN 4
+#define ALG_SET_AEAD_AUTHSIZE 5
-#ifndef ALG_SET_IV
-# define ALG_SET_IV 2
-#endif
+#define ALG_OP_DECRYPT 0
+#define ALG_OP_ENCRYPT 1
-#ifndef ALG_SET_OP
-# define ALG_SET_OP 3
-#endif
-
-#ifndef ALG_SET_AEAD_ASSOCLEN
-# define ALG_SET_AEAD_ASSOCLEN 4
-#endif
-
-#ifndef ALG_SET_AEAD_AUTHSIZE
-# define ALG_SET_AEAD_AUTHSIZE 5
-#endif
-
-#ifndef ALG_OP_DECRYPT
-# define ALG_OP_DECRYPT 0
-#endif
-
-#ifndef ALG_OP_ENCRYPT
-# define ALG_OP_ENCRYPT 1
-#endif
+#endif /* !HAVE_LINUX_IF_ALG_H */
#endif /* IF_ALG_H__ */
diff --git a/include/lapi/if_ether.h b/include/lapi/if_ether.h
deleted file mode 100644
index 0e9a4fcc1..000000000
--- a/include/lapi/if_ether.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-#ifndef __LAPI_IF_ETHER_H__
-#define __LAPI_IF_ETHER_H__
-
-#include "config.h"
-
-#ifdef HAVE_LINUX_IF_ETHER_H
-# include <linux/if_ether.h>
-#endif
-
-#ifndef ETH_P_ALL
-# define ETH_P_ALL 0x0003
-#endif
-
-#endif /* __LAPI_IF_ETHER_H__ */
diff --git a/include/lapi/if_packet.h b/include/lapi/if_packet.h
index fdaed293d..c077b564d 100644
--- a/include/lapi/if_packet.h
+++ b/include/lapi/if_packet.h
@@ -7,48 +7,12 @@
#ifndef __LAPI_IF_PACKET_H__
#define __LAPI_IF_PACKET_H__
-#include "config.h"
-
-#ifdef HAVE_LINUX_IF_PACKET_H
-# include <linux/if_packet.h>
-#endif
-
-#ifndef PACKET_RX_RING
-# define PACKET_RX_RING 5
-#endif
-
-#ifndef PACKET_VERSION
-# define PACKET_VERSION 10
-#endif
-
-#ifndef PACKET_RESERVE
-# define PACKET_RESERVE 12
-#endif
-
-#ifndef PACKET_VNET_HDR
-# define PACKET_VNET_HDR 15
-#endif
-
#ifndef PACKET_FANOUT
-# define PACKET_FANOUT 18
+#define PACKET_FANOUT 18
#endif
#ifndef PACKET_FANOUT_ROLLOVER
-# define PACKET_FANOUT_ROLLOVER 3
-#endif
-
-#ifndef HAVE_STRUCT_TPACKET_REQ3
-# define TPACKET_V3 2
-
-struct tpacket_req3 {
- unsigned int tp_block_size;
- unsigned int tp_block_nr;
- unsigned int tp_frame_size;
- unsigned int tp_frame_nr;
- unsigned int tp_retire_blk_tov;
- unsigned int tp_sizeof_priv;
- unsigned int tp_feature_req_word;
-};
+#define PACKET_FANOUT_ROLLOVER 3
#endif
#endif /* __LAPI_IF_PACKET_H__ */
diff --git a/include/lapi/init_module.h b/include/lapi/init_module.h
deleted file mode 100644
index 14eaabee6..000000000
--- a/include/lapi/init_module.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef INIT_MODULE_H__
-#define INIT_MODULE_H__
-
-#include "config.h"
-#include "lapi/syscalls.h"
-#include "tst_test.h"
-
-static inline int init_module(void *module_image, unsigned long len,
- const char *param_values)
-{
- return tst_syscall(__NR_init_module, module_image, len, param_values);
-}
-
-static inline int finit_module(int fd, const char *param_values, int flags)
-{
- return tst_syscall(__NR_finit_module, fd, param_values, flags);
-}
-
-static inline void finit_module_supported_by_kernel(void)
-{
- if ((tst_kvercmp(3, 8, 0)) < 0) {
- /* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_finit_module, 0, "", 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel version < v3.8");
- }
-}
-
-#endif /* INIT_MODULE_H__ */
diff --git a/include/lapi/io_pgetevents.h b/include/lapi/io_pgetevents.h
deleted file mode 100644
index 5bb9a60c3..000000000
--- a/include/lapi/io_pgetevents.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef IO_PGETEVENTS_H
-#define IO_PGETEVENTS_H
-
-#include <sys/syscall.h>
-#include <sys/types.h>
-
-#include "config.h"
-#include "lapi/syscalls.h"
-
-#ifdef HAVE_LIBAIO
-#include <libaio.h>
-
-static inline int sys_io_pgetevents(io_context_t ctx, long min_nr, long max_nr,
- struct io_event *events, void *timeout, sigset_t *sigmask)
-{
- return tst_syscall(__NR_io_pgetevents, ctx, min_nr, max_nr, events,
- timeout, sigmask);
-}
-
-static inline int sys_io_pgetevents_time64(io_context_t ctx, long min_nr, long max_nr,
- struct io_event *events, void *timeout, sigset_t *sigmask)
-{
- return tst_syscall(__NR_io_pgetevents_time64, ctx, min_nr, max_nr,
- events, timeout, sigmask);
-}
-
-#endif /* HAVE_LIBAIO */
-
-#endif /* IO_PGETEVENTS_H */
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
deleted file mode 100644
index 897ed7c64..000000000
--- a/include/lapi/io_uring.h
+++ /dev/null
@@ -1,309 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 ARM. All rights reserved.
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- *
- * Mostly copied/adapted from <linux/io_uring.h>
- */
-
-#ifndef IO_URING_H__
-#define IO_URING_H__
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <stdlib.h>
-#include <linux/fs.h>
-
-#include "lapi/syscalls.h"
-
-#ifdef HAVE_LINUX_IO_URING_H
-#include <linux/io_uring.h>
-#endif
-
-#ifndef IOSQE_FIXED_FILE
-
-#ifndef __kernel_rwf_t
-typedef int __kernel_rwf_t;
-#endif
-
-/*
- * IO submission data structure (Submission Queue Entry)
- */
-struct io_uring_sqe {
- uint8_t opcode; /* type of operation for this sqe */
- uint8_t flags; /* IOSQE_ flags */
- uint16_t ioprio; /* ioprio for the request */
- int32_t fd; /* file descriptor to do IO on */
- union {
- uint64_t off; /* offset into file */
- uint64_t addr2;
- };
- uint64_t addr; /* pointer to buffer or iovecs */
- uint32_t len; /* buffer size or number of iovecs */
- union {
- __kernel_rwf_t rw_flags;
- uint32_t fsync_flags;
- uint16_t poll_events;
- uint32_t sync_range_flags;
- uint32_t msg_flags;
- uint32_t timeout_flags;
- uint32_t accept_flags;
- uint32_t cancel_flags;
- uint32_t open_flags;
- uint32_t statx_flags;
- uint32_t fadvise_advice;
- };
- uint64_t user_data; /* data to be passed back at completion time */
- union {
- struct {
- /* index into fixed buffers, if used */
- uint16_t buf_index;
- /* personality to use, if used */
- uint16_t personality;
- };
- uint64_t __pad2[3];
- };
-};
-
-enum {
- IOSQE_FIXED_FILE_BIT,
- IOSQE_IO_DRAIN_BIT,
- IOSQE_IO_LINK_BIT,
-};
-
-/*
- * sqe->flags
- */
-/* use fixed fileset */
-#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
-/* issue after inflight IO */
-#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
-/* links next sqe */
-#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
-
-/*
- * io_uring_setup() flags
- */
-#define IORING_SETUP_IOPOLL (1U << 0) /* io_context is polled */
-#define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */
-#define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */
-#define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */
-#define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */
-#define IORING_SETUP_ATTACH_WQ (1U << 5) /* attach to existing wq */
-
-enum {
- IORING_OP_NOP,
- IORING_OP_READV,
- IORING_OP_WRITEV,
- IORING_OP_FSYNC,
- IORING_OP_READ_FIXED,
- IORING_OP_WRITE_FIXED,
- IORING_OP_POLL_ADD,
- IORING_OP_POLL_REMOVE,
- IORING_OP_SYNC_FILE_RANGE,
- IORING_OP_SENDMSG,
- IORING_OP_RECVMSG,
- IORING_OP_TIMEOUT,
- IORING_OP_TIMEOUT_REMOVE,
- IORING_OP_ACCEPT,
- IORING_OP_ASYNC_CANCEL,
- IORING_OP_LINK_TIMEOUT,
- IORING_OP_CONNECT,
- IORING_OP_FALLOCATE,
- IORING_OP_OPENAT,
- IORING_OP_CLOSE,
- IORING_OP_FILES_UPDATE,
- IORING_OP_STATX,
- IORING_OP_READ,
- IORING_OP_WRITE,
- IORING_OP_FADVISE,
- IORING_OP_MADVISE,
- IORING_OP_SEND,
- IORING_OP_RECV,
- IORING_OP_OPENAT2,
- IORING_OP_EPOLL_CTL,
-
- /* this goes last, obviously */
- IORING_OP_LAST,
-};
-
-/*
- * sqe->fsync_flags
- */
-#define IORING_FSYNC_DATASYNC (1U << 0)
-
-/*
- * sqe->timeout_flags
- */
-#define IORING_TIMEOUT_ABS (1U << 0)
-
-/*
- * IO completion data structure (Completion Queue Entry)
- */
-struct io_uring_cqe {
- uint64_t user_data; /* sqe->data submission passed back */
- int32_t res; /* result code for this event */
- uint32_t flags;
-};
-
-/*
- * Magic offsets for the application to mmap the data it needs
- */
-#define IORING_OFF_SQ_RING 0ULL
-#define IORING_OFF_CQ_RING 0x8000000ULL
-#define IORING_OFF_SQES 0x10000000ULL
-
-/*
- * Filled with the offset for mmap(2)
- */
-struct io_sqring_offsets {
- uint32_t head;
- uint32_t tail;
- uint32_t ring_mask;
- uint32_t ring_entries;
- uint32_t flags;
- uint32_t dropped;
- uint32_t array;
- uint32_t resv1;
- uint64_t resv2;
-};
-
-/*
- * sq_ring->flags
- */
-#define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */
-
-struct io_cqring_offsets {
- uint32_t head;
- uint32_t tail;
- uint32_t ring_mask;
- uint32_t ring_entries;
- uint32_t overflow;
- uint32_t cqes;
- uint64_t resv[2];
-};
-
-/*
- * io_uring_enter(2) flags
- */
-#define IORING_ENTER_GETEVENTS (1U << 0)
-#define IORING_ENTER_SQ_WAKEUP (1U << 1)
-
-/*
- * Passed in for io_uring_setup(2). Copied back with updated info on success
- */
-struct io_uring_params {
- uint32_t sq_entries;
- uint32_t cq_entries;
- uint32_t flags;
- uint32_t sq_thread_cpu;
- uint32_t sq_thread_idle;
- uint32_t features;
- uint32_t wq_fd;
- uint32_t resv[3];
- struct io_sqring_offsets sq_off;
- struct io_cqring_offsets cq_off;
-};
-
-/*
- * io_uring_params->features flags
- */
-#define IORING_FEAT_SINGLE_MMAP (1U << 0)
-#define IORING_FEAT_NODROP (1U << 1)
-#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
-#define IORING_FEAT_RW_CUR_POS (1U << 3)
-#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
-
-/*
- * io_uring_register(2) opcodes and arguments
- */
-#define IORING_REGISTER_BUFFERS 0
-#define IORING_UNREGISTER_BUFFERS 1
-#define IORING_REGISTER_FILES 2
-#define IORING_UNREGISTER_FILES 3
-#define IORING_REGISTER_EVENTFD 4
-#define IORING_UNREGISTER_EVENTFD 5
-#define IORING_REGISTER_FILES_UPDATE 6
-#define IORING_REGISTER_EVENTFD_ASYNC 7
-#define IORING_REGISTER_PROBE 8
-#define IORING_REGISTER_PERSONALITY 9
-#define IORING_UNREGISTER_PERSONALITY 10
-
-struct io_uring_files_update {
- uint32_t offset;
- uint32_t resv;
- uint64_t __attribute__((aligned(8))) fds;
-};
-
-#define IO_URING_OP_SUPPORTED (1U << 0)
-
-struct io_uring_probe_op {
- uint8_t op;
- uint8_t resv;
- uint16_t flags; /* IO_URING_OP_* flags */
- uint32_t resv2;
-};
-
-struct io_uring_probe {
- uint8_t last_op; /* last opcode supported */
- uint8_t ops_len; /* length of ops[] array below */
- uint16_t resv;
- uint32_t resv2[3];
- struct io_uring_probe_op ops[0];
-};
-
-#endif /* IOSQE_FIXED_FILE */
-
-#ifndef IOSQE_IO_HADRLINK
-/* like LINK, but stronger */
-#define IOSQE_IO_HARDLINK_BIT 3
-#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
-#endif /* IOSQE_IO_HADRLINK */
-
-#ifndef IOSQE_ASYNC
-/* always go async */
-#define IOSQE_ASYNC_BIT 4
-#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
-#endif /* IOSQE_ASYNC */
-
-#ifndef HAVE_IO_URING_REGISTER
-static inline int io_uring_register(int fd, unsigned int opcode, void *arg,
- unsigned int nr_args)
-{
- return tst_syscall(__NR_io_uring_register, fd, opcode, arg, nr_args);
-}
-#endif /* HAVE_IO_URING_REGISTER */
-
-
-#ifndef HAVE_IO_URING_SETUP
-static inline int io_uring_setup(unsigned int entries,
- struct io_uring_params *p)
-{
- return tst_syscall(__NR_io_uring_setup, entries, p);
-}
-#endif /* HAVE_IO_URING_SETUP */
-
-#ifndef HAVE_IO_URING_ENTER
-static inline int io_uring_enter(int fd, unsigned int to_submit,
- unsigned int min_complete, unsigned int flags, sigset_t *sig)
-{
- return tst_syscall(__NR_io_uring_enter, fd, to_submit, min_complete,
- flags, sig, _NSIG / 8);
-}
-#endif /* HAVE_IO_URING_ENTER */
-
-static inline void io_uring_setup_supported_by_kernel(void)
-{
- if ((tst_kvercmp(5, 1, 0)) < 0) {
- TEST(syscall(__NR_io_uring_setup, NULL, 0));
- if (TST_RET != -1)
- SAFE_CLOSE(TST_RET);
- else if (TST_ERR == ENOSYS)
- tst_brk(TCONF,
- "Test not supported on kernel version < v5.1");
- }
-}
-
-#endif /* IO_URING_H__ */
diff --git a/include/lapi/ioctl.h b/include/lapi/ioctl.h
deleted file mode 100644
index ecd250290..000000000
--- a/include/lapi/ioctl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#ifndef IOCTL_H__
-#define IOCTL_H__
-
-#include "config.h"
-#include <sys/ioctl.h>
-
-/* musl not including it in <sys/ioctl.h> */
-#include <sys/ttydefaults.h>
-
-#ifndef TIOCVHANGUP
-# define TIOCVHANGUP 0x5437
-#endif
-
-#ifndef HAVE_STRUCT_TERMIO
-# ifndef NCC
-# ifdef __powerpc__
-# define NCC 10
-# else
-# define NCC 8
-# endif
-# endif /* NCC */
-
-struct termio
- {
- unsigned short int c_iflag; /* input mode flags */
- unsigned short int c_oflag; /* output mode flags */
- unsigned short int c_cflag; /* control mode flags */
- unsigned short int c_lflag; /* local mode flags */
- unsigned char c_line; /* line discipline */
- unsigned char c_cc[NCC]; /* control characters */
-};
-#endif /* HAVE_STRUCT_TERMIO */
-
-#endif /* IOCTL_H__ */
diff --git a/include/lapi/iovec.h b/include/lapi/iovec.h
index d479e9f85..4e8182fed 100644
--- a/include/lapi/iovec.h
+++ b/include/lapi/iovec.h
@@ -1,6 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
*/
#ifndef IOVEC_H
diff --git a/include/lapi/ipcbuf.h b/include/lapi/ipcbuf.h
deleted file mode 100644
index b42c4bf30..000000000
--- a/include/lapi/ipcbuf.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef IPCBUF_H
-#define IPCBUF_H
-
-#include "config.h"
-#include "lapi/posix_types.h"
-
-#ifndef HAVE_STRUCT_IPC64_PERM
-
-#if defined(__hppa__)
-#define HAVE_IPC64_PERM
-/*
- * The ipc64_perm structure for PA-RISC is almost identical to
- * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the kernel.
- * 'seq' has been changed from long to int so that it's the same size
- * on 64-bit kernels as on 32-bit ones.
- */
-
-struct ipc64_perm
-{
- __kernel_key_t key;
- __kernel_uid_t uid;
- __kernel_gid_t gid;
- __kernel_uid_t cuid;
- __kernel_gid_t cgid;
-#if __BITS_PER_LONG != 64
- unsigned short int __pad1;
-#endif
- __kernel_mode_t mode;
- unsigned short int __pad2;
- unsigned short int seq;
- unsigned int __pad3;
- unsigned long long int __unused1;
- unsigned long long int __unused2;
-};
-#endif /* __hppa__ */
-
-#if defined(__powerpc__) || defined(__powerpc64__)
-#define HAVE_IPC64_PERM
-/*
- * The ipc64_perm structure for the powerpc is identical to
- * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
- * kernel. Note extra padding because this structure is passed back
- * and forth between kernel and user space. Pad space is left for:
- * - 1 32-bit value to fill up for 8-byte alignment
- * - 2 miscellaneous 64-bit values
- */
-
-struct ipc64_perm
-{
- __kernel_key_t key;
- __kernel_uid_t uid;
- __kernel_gid_t gid;
- __kernel_uid_t cuid;
- __kernel_gid_t cgid;
- __kernel_mode_t mode;
- unsigned int seq;
- unsigned int __pad1;
- unsigned long long __unused1;
- unsigned long long __unused2;
-};
-
-#endif /* defined(__powerpc__) || defined(__powerpc64__) */
-
-#if defined(__s390__)
-#define HAVE_IPC64_PERM
-/*
- * The user_ipc_perm structure for S/390 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct ipc64_perm
-{
- __kernel_key_t key;
- __kernel_uid32_t uid;
- __kernel_gid32_t gid;
- __kernel_uid32_t cuid;
- __kernel_gid32_t cgid;
- __kernel_mode_t mode;
- unsigned short __pad1;
- unsigned short seq;
-#ifndef __s390x__
- unsigned short __pad2;
-#endif /* ! __s390x__ */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* defined(__powerpc__) || defined(__powerpc64__) */
-
-#if defined(__sparc__)
-#define HAVE_IPC64_PERM
-/*
- * The ipc64_perm structure for sparc/sparc64 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit seq
- * - on sparc for 32 bit mode (it is 32 bit on sparc64)
- * - 2 miscellaneous 64-bit values
- */
-
-struct ipc64_perm
-{
- __kernel_key_t key;
- __kernel_uid32_t uid;
- __kernel_gid32_t gid;
- __kernel_uid32_t cuid;
- __kernel_gid32_t cgid;
-#ifndef __arch64__
- unsigned short __pad0;
-#endif
- __kernel_mode_t mode;
- unsigned short __pad1;
- unsigned short seq;
- unsigned long long __unused1;
- unsigned long long __unused2;
-};
-
-#endif /* __sparc__ */
-
-#if defined(__xtensa__)
-#define HAVE_IPC64_PERM
-/*
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file "COPYING" in the main directory of
- * this archive for more details.
- */
-
-struct ipc64_perm
-{
- __kernel_key_t key;
- __kernel_uid32_t uid;
- __kernel_gid32_t gid;
- __kernel_uid32_t cuid;
- __kernel_gid32_t cgid;
- __kernel_mode_t mode;
- unsigned long seq;
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* __xtensa__ */
-
-#ifndef HAVE_IPC64_PERM
-/*
- * The generic ipc64_perm structure:
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * ipc64_perm was originally meant to be architecture specific, but
- * everyone just ended up making identical copies without specific
- * optimizations, so we may just as well all use the same one.
- *
- * Pad space is left for:
- * - 32-bit mode_t on architectures that only had 16 bit
- * - 32-bit seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct ipc64_perm {
- __kernel_key_t key;
- __kernel_uid32_t uid;
- __kernel_gid32_t gid;
- __kernel_uid32_t cuid;
- __kernel_gid32_t cgid;
- __kernel_mode_t mode;
- /* pad if mode_t is u16: */
- unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
- unsigned short seq;
- unsigned short __pad2;
- __kernel_ulong_t __unused1;
- __kernel_ulong_t __unused2;
-};
-
-#endif /* ipc64_perm */
-
-#endif /* HAVE_IPC64_PERM */
-
-#endif /* IPCBUF_H */
diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index c53876e96..9f5892e06 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEYCTL_H__
diff --git a/include/lapi/loop.h b/include/lapi/loop.h
deleted file mode 100644
index 87a902317..000000000
--- a/include/lapi/loop.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-#ifndef LAPI_LOOP_H
-#define LAPI_LOOP_H
-
-#include "config.h"
-#include <linux/types.h>
-#include <linux/loop.h>
-
-#ifndef LO_FLAGS_PARTSCAN
-# define LO_FLAGS_PARTSCAN 8
-#endif
-
-#ifndef LO_FLAGS_DIRECT_IO
-# define LO_FLAGS_DIRECT_IO 16
-#endif
-
-#ifndef LOOP_SET_CAPACITY
-# define LOOP_SET_CAPACITY 0x4C07
-#endif
-
-#ifndef LOOP_SET_DIRECT_IO
-# define LOOP_SET_DIRECT_IO 0x4C08
-#endif
-
-#ifndef LOOP_SET_BLOCK_SIZE
-# define LOOP_SET_BLOCK_SIZE 0x4C09
-#endif
-
-#ifndef LOOP_CONFIGURE
-# define LOOP_CONFIGURE 0x4C0A
-#endif
-
-#ifndef HAVE_STRUCT_LOOP_CONFIG
-/*
- * struct loop_config - Complete configuration for a loop device.
- * @fd: fd of the file to be used as a backing file for the loop device.
- * @block_size: block size to use; ignored if 0.
- * @info: struct loop_info64 to configure the loop device with.
- *
- * This structure is used with the LOOP_CONFIGURE ioctl, and can be used to
- * atomically setup and configure all loop device parameters at once.
- */
-struct loop_config {
- __u32 fd;
- __u32 block_size;
- struct loop_info64 info;
- __u64 __reserved[8];
-};
-#endif
-
-#endif
diff --git a/include/lapi/memfd.h b/include/lapi/memfd.h
index e38e671bb..12a91f4a9 100644
--- a/include/lapi/memfd.h
+++ b/include/lapi/memfd.h
@@ -1,6 +1,16 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
*/
#ifndef LAPI_MEMFD_H
diff --git a/include/lapi/mkdirat.h b/include/lapi/mkdirat.h
index ae2c7284b..d61e56e35 100644
--- a/include/lapi/mkdirat.h
+++ b/include/lapi/mkdirat.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __MKDIRAT_H__
@@ -11,7 +24,7 @@
#include "lapi/fcntl.h"
#ifndef HAVE_MKDIRAT
-static inline int mkdirat(int dirfd, const char *dirname, int mode)
+int mkdirat(int dirfd, const char *dirname, int mode)
{
return ltp_syscall(__NR_mkdirat, dirfd, dirname, mode);
}
diff --git a/include/lapi/mmap.h b/include/lapi/mmap.h
index 12845b76e..98b6ade1e 100644
--- a/include/lapi/mmap.h
+++ b/include/lapi/mmap.h
@@ -1,7 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015 Fujitsu Ltd.
* Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
*/
#ifndef LAPI_MMAP_H__
@@ -66,16 +78,6 @@
# define MADV_KEEPONFORK 19
#endif
-#ifndef MAP_FIXED_NOREPLACE
-
-#ifdef __alpha__
-# define MAP_FIXED_NOREPLACE 0x200000
-#else
-# define MAP_FIXED_NOREPLACE 0x100000
-#endif
-
-#endif /* MAP_FIXED_NOREPLACE */
-
#ifdef HAVE_SYS_SHM_H
# include <sys/shm.h>
# define MMAP_GRANULARITY SHMLBA
diff --git a/include/lapi/mount.h b/include/lapi/mount.h
index b8ae1f594..6c41e45a2 100644
--- a/include/lapi/mount.h
+++ b/include/lapi/mount.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015 Cui Bixuan <cuibixuan@huawei.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __MOUNT_H__
diff --git a/include/lapi/msg.h b/include/lapi/msg.h
deleted file mode 100644
index 029511120..000000000
--- a/include/lapi/msg.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-#ifndef LAPI_MSG_H
-#define LAPI_MSG_H
-
-#include <sys/msg.h>
-
-#ifndef MSG_COPY
-# define MSG_COPY 040000 /* copy (not remove) all queue messages */
-#endif
-
-#ifndef MSG_STAT_ANY
-# define MSG_STAT_ANY 13
-#endif
-
-#endif
diff --git a/include/lapi/msgbuf.h b/include/lapi/msgbuf.h
deleted file mode 100644
index 873902e95..000000000
--- a/include/lapi/msgbuf.h
+++ /dev/null
@@ -1,306 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef IPC_MSGBUF_H
-#define IPC_MSGBUF_H
-
-#include "lapi/posix_types.h"
-#include <sys/sem.h>
-#include "tst_timer.h"
-#include "ipcbuf.h"
-
-#ifndef HAVE_MSQID64_DS
-
-#if defined(__mips__)
-#define HAVE_MSQID64_DS
-
-#if __BITS_PER_LONG == 64
-/*
- * The msqid64_ds structure for the MIPS architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous unsigned long values
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
- long msg_stime; /* last msgsnd time */
- long msg_rtime; /* last msgrcv time */
- long msg_ctime; /* last change time */
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-#elif defined (__MIPSEB__)
-#define HAVE_MSQID64_DS_TIME_HIGH
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
- unsigned long msg_stime_high;
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_rtime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_ctime_high;
- unsigned long msg_ctime; /* last change time */
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-#elif defined (__MIPSEL__)
-#define HAVE_MSQID64_DS_TIME_HIGH
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_stime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_rtime_high;
- unsigned long msg_ctime; /* last change time */
- unsigned long msg_ctime_high;
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-#endif
-
-#endif /* __mips__ */
-
-#if defined(__hppa__)
-#define HAVE_MSQID64_DS
-/*
- * The msqid64_ds structure for parisc architecture, copied from sparc.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
-#if __BITS_PER_LONG == 64
- long msg_stime; /* last msgsnd time */
- long msg_rtime; /* last msgrcv time */
- long msg_ctime; /* last change time */
-#else
-#define HAVE_MSQID64_DS_TIME_HIGH
- unsigned long msg_stime_high;
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_rtime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_ctime_high;
- unsigned long msg_ctime; /* last change time */
-#endif
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* __hppa__ */
-
-#if defined(__powerpc__) || defined(__powerpc64__)
-#define HAVE_MSQID64_DS
-/*
- * The msqid64_ds structure for the PowerPC architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
-#ifdef __powerpc64__
- long msg_stime; /* last msgsnd time */
- long msg_rtime; /* last msgrcv time */
- long msg_ctime; /* last change time */
-#else
-#define HAVE_MSQID64_DS_TIME_HIGH
- unsigned long msg_stime_high;
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_rtime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_ctime_high;
- unsigned long msg_ctime; /* last change time */
-#endif
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-#endif /* defined(__powerpc__) || defined(__powerpc64__) */
-
-#if defined(__sparc__)
-#define HAVE_MSQID64_DS
-/*
- * The msqid64_ds structure for sparc64 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
-#if defined(__arch64__)
- long msg_stime; /* last msgsnd time */
- long msg_rtime; /* last msgrcv time */
- long msg_ctime; /* last change time */
-#else
-#define HAVE_MSQID64_DS_TIME_HIGH
- unsigned long msg_stime_high;
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_rtime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_ctime_high;
- unsigned long msg_ctime; /* last change time */
-#endif
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* __sparc__ */
-
-#if defined(__x86_64__) && defined(__ILP32__)
-#define HAVE_MSQID64_DS
-/*
- * The msqid64_ds structure for x86 architecture with x32 ABI.
- *
- * On x86-32 and x86-64 we can just use the generic definition, but
- * x32 uses the same binary layout as x86_64, which is differnet
- * from other 32-bit architectures.
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
- __kernel_long_t msg_stime; /* last msgsnd time */
- __kernel_long_t msg_rtime; /* last msgrcv time */
- __kernel_long_t msg_ctime; /* last change time */
- __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */
- __kernel_ulong_t msg_qnum; /* number of messages in queue */
- __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- __kernel_ulong_t __unused4;
- __kernel_ulong_t __unused5;
-};
-
-#endif /* defined(__x86_64__) && defined(__ILP32__) */
-
-#if defined(__xtensa__)
-#define HAVE_MSQID64_DS
-/*
- * The msqid64_ds structure for the Xtensa architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
-#ifdef __XTENSA_EB__
-#define HAVE_MSQID64_DS_TIME_HIGH
- unsigned long msg_stime_high;
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_rtime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_ctime_high;
- unsigned long msg_ctime; /* last change time */
-#elif defined(__XTENSA_EL__)
-#define HAVE_MSQID64_DS_TIME_HIGH
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_stime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_rtime_high;
- unsigned long msg_ctime; /* last change time */
- unsigned long msg_ctime_high;
-#else
-# error processor byte order undefined!
-#endif
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-#endif /* __xtensa__ */
-
-#ifndef HAVE_MSQID64_DS
-/*
- * generic msqid64_ds structure.
- *
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * msqid64_ds was originally meant to be architecture specific, but
- * everyone just ended up making identical copies without specific
- * optimizations, so we may just as well all use the same one.
- *
- * 64 bit architectures use a 64-bit long time field here, while
- * 32 bit architectures have a pair of unsigned long values.
- * On big-endian systems, the lower half is in the wrong place.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
-#if __BITS_PER_LONG == 64
- long msg_stime; /* last msgsnd time */
- long msg_rtime; /* last msgrcv time */
- long msg_ctime; /* last change time */
-#else
-#define HAVE_MSQID64_DS_TIME_HIGH
- unsigned long msg_stime; /* last msgsnd time */
- unsigned long msg_stime_high;
- unsigned long msg_rtime; /* last msgrcv time */
- unsigned long msg_rtime_high;
- unsigned long msg_ctime; /* last change time */
- unsigned long msg_ctime_high;
-#endif
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-#endif /* msqid64_ds */
-
-#endif /* HAVE_MSQID64_DS */
-
-#endif /* IPC_MSGBUF_H */
diff --git a/include/lapi/name_to_handle_at.h b/include/lapi/name_to_handle_at.h
deleted file mode 100644
index 275db4ae0..000000000
--- a/include/lapi/name_to_handle_at.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef NAME_TO_HANDLE_AT_H__
-#define NAME_TO_HANDLE_AT_H__
-
-#include <sys/syscall.h>
-#include "config.h"
-#include "lapi/syscalls.h"
-#include "lapi/fcntl.h"
-#include "tst_buffers.h"
-#include "tst_test.h"
-
-#ifndef HAVE_NAME_TO_HANDLE_AT
-static inline int name_to_handle_at(int dfd, const char *pathname,
- struct file_handle *handle,
- int *mount_id, int flags)
-{
- return tst_syscall(__NR_name_to_handle_at, dfd, pathname, handle,
- mount_id, flags);
-}
-
-static inline int open_by_handle_at(int mount_fd, struct file_handle *handle,
- int flags)
-{
- return tst_syscall(__NR_open_by_handle_at, mount_fd, handle, flags);
-}
-#endif /* HAVE_NAME_TO_HANDLE_AT */
-
-/* Returns a valid pointer on success, NULL on errors */
-static inline struct file_handle *
-allocate_file_handle(int dfd, const char *pathname)
-{
- struct file_handle fh = {}, *fhp;
- int mount_id;
-
- /*
- * Make an initial call to name_to_handle_at() to discover the size
- * required for the file handle.
- */
- TEST(name_to_handle_at(dfd, pathname, &fh, &mount_id, 0));
- if (TST_RET != -1 || TST_ERR != EOVERFLOW) {
- tst_res(TFAIL | TTERRNO,
- "name_to_handle_at() should fail with EOVERFLOW");
- return NULL;
- }
-
- /* Valid file handle */
- fhp = tst_alloc(sizeof(*fhp) + fh.handle_bytes);
- fhp->handle_type = fh.handle_type;
- fhp->handle_bytes = fh.handle_bytes;
-
- return fhp;
-}
-
-#endif /* NAME_TO_HANDLE_AT_H__ */
diff --git a/include/lapi/namespaces_constants.h b/include/lapi/namespaces_constants.h
index 8f73c4302..52ee38382 100644
--- a/include/lapi/namespaces_constants.h
+++ b/include/lapi/namespaces_constants.h
@@ -1,7 +1,17 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2015 Red Hat, Inc.
- */
+/* Copyright (c) 2015 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of version 2 the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ ***********************************************************************/
#ifndef __NAMESPACES_CONSTANTS_H__
#define __NAMESPACES_CONSTANTS_H__
@@ -24,8 +34,5 @@
#ifndef CLONE_NEWUTS
# define CLONE_NEWUTS 0x04000000
#endif
-#ifndef CLONE_NEWTIME
-# define CLONE_NEWTIME 0x00000080
-#endif
#endif /* __NAMESPACES_CONSTANTS_H__ */
diff --git a/include/lapi/netinet_in.h b/include/lapi/netinet_in.h
index e88485c5c..427f28318 100644
--- a/include/lapi/netinet_in.h
+++ b/include/lapi/netinet_in.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAPI_IN_H__
diff --git a/include/lapi/openat2.h b/include/lapi/openat2.h
deleted file mode 100644
index 3067f2392..000000000
--- a/include/lapi/openat2.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef OPENAT2_H
-#define OPENAT2_H
-
-#include <sys/syscall.h>
-#include <linux/types.h>
-
-#include "lapi/syscalls.h"
-
-#include "config.h"
-
-#ifdef HAVE_LINUX_OPENAT2_H
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <linux/openat2.h>
-#else
-
-/*
- * Arguments for how openat2(2) should open the target path. If only @flags and
- * @mode are non-zero, then openat2(2) operates very similarly to openat(2).
- *
- * However, unlike openat(2), unknown or invalid bits in @flags result in
- * -EINVAL rather than being silently ignored. @mode must be zero unless one of
- * {O_CREAT, O_TMPFILE} are set.
- *
- * @flags: O_* flags.
- * @mode: O_CREAT/O_TMPFILE file mode.
- * @resolve: RESOLVE_* flags.
- */
-struct open_how {
- uint64_t flags;
- uint64_t mode;
- uint64_t resolve;
-};
-
-/* how->resolve flags for openat2(2). */
-#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings
- (includes bind-mounts). */
-#define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style
- "magic-links". */
-#define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks
- (implies OEXT_NO_MAGICLINKS) */
-#define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like
- "..", symlinks, and absolute
- paths which escape the dirfd. */
-#define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".."
- be scoped inside the dirfd
- (similar to chroot(2)). */
-#endif /* HAVE_LINUX_OPENAT2_H */
-
-#ifndef HAVE_OPENAT2
-static inline int openat2(int dfd, const char *pathname,
- struct open_how *how, size_t size)
-{
- return tst_syscall(__NR_openat2, dfd, pathname, how, size);
-}
-#endif
-
-struct open_how_pad {
- /* how should be kept as the first entry here */
- struct open_how how;
- uint64_t pad;
-};
-
-static inline void openat2_supported_by_kernel(void)
-{
- if ((tst_kvercmp(5, 6, 0)) < 0) {
- /* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_openat2, -1, NULL, NULL, 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel version < v5.6");
- }
-}
-
-#endif /* OPENAT2_H */
diff --git a/include/lapi/personality.h b/include/lapi/personality.h
index 6b4b7ebf3..d85baa085 100644
--- a/include/lapi/personality.h
+++ b/include/lapi/personality.h
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
/* In the Linux kernel and glibc enums are (mostly) used for the constants,
* but in musl macros are used.
*/
diff --git a/include/lapi/pidfd_open.h b/include/lapi/pidfd_open.h
deleted file mode 100644
index 2b0c5b073..000000000
--- a/include/lapi/pidfd_open.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef PIDFD_OPEN_H
-#define PIDFD_OPEN_H
-
-#include <sys/syscall.h>
-#include <sys/types.h>
-
-#include "lapi/syscalls.h"
-
-#include "config.h"
-
-#ifndef HAVE_PIDFD_OPEN
-static inline int pidfd_open(pid_t pid, unsigned int flags)
-{
- return tst_syscall(__NR_pidfd_open, pid, flags);
-}
-#endif
-
-#endif /* PIDFD_OPEN_H */
diff --git a/include/lapi/posix_types.h b/include/lapi/posix_types.h
deleted file mode 100644
index 9c0947cca..000000000
--- a/include/lapi/posix_types.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Linux Test Project, 2014-2019
- */
-
-#ifndef POSIX_TYPES_H__
-#define POSIX_TYPES_H__
-
-#include <linux/posix_types.h>
-
-#ifndef __kernel_long_t
-# if defined(__x86_64__) && defined(__ILP32__)
-typedef long long __kernel_long_t;
-typedef unsigned long long __kernel_ulong_t;
-# else
-typedef long __kernel_long_t;
-typedef unsigned long __kernel_ulong_t;
-# endif
-#endif
-
-#endif /* POSIX_TYPES_H__ */
diff --git a/include/lapi/preadv2.h b/include/lapi/preadv2.h
index 19ac589f3..538ed7218 100644
--- a/include/lapi/preadv2.h
+++ b/include/lapi/preadv2.h
@@ -19,8 +19,8 @@
/* LO_HI_LONG taken from glibc */
# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32)
-static inline ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt,
- off_t offset, int flags)
+ssize_t preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset,
+ int flags)
{
return tst_syscall(__NR_preadv2, fd, iov, iovcnt,
LO_HI_LONG(offset), flags);
diff --git a/include/lapi/pwritev2.h b/include/lapi/pwritev2.h
index a93f017c6..305e48e02 100644
--- a/include/lapi/pwritev2.h
+++ b/include/lapi/pwritev2.h
@@ -15,8 +15,8 @@
/* LO_HI_LONG taken from glibc */
# define LO_HI_LONG(val) (long) (val), (long) (((uint64_t) (val)) >> 32)
-static inline ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt,
- off_t offset, int flags)
+ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset,
+ int flags)
{
return tst_syscall(__NR_pwritev2, fd, iov, iovcnt,
LO_HI_LONG(offset), flags);
diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h
index c1ec9d6e1..d3223b863 100644
--- a/include/lapi/quotactl.h
+++ b/include/lapi/quotactl.h
@@ -59,10 +59,6 @@ struct fs_quota_statv {
# define PRJQUOTA 2
#endif
-#ifndef Q_XQUOTARM
-# define Q_XQUOTARM XQM_CMD(6)
-#endif
-
#ifndef Q_XGETQSTATV
# define Q_XGETQSTATV XQM_CMD(8)
#endif
diff --git a/include/lapi/readdir.h b/include/lapi/readdir.h
index 84e77ae0a..65746af48 100644
--- a/include/lapi/readdir.h
+++ b/include/lapi/readdir.h
@@ -1,7 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Fujitsu Ltd.
* Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef READDIR_H
diff --git a/include/lapi/readlinkat.h b/include/lapi/readlinkat.h
index 4205d0070..155f62064 100644
--- a/include/lapi/readlinkat.h
+++ b/include/lapi/readlinkat.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __READLINKAT_H__
@@ -11,8 +24,7 @@
#include "lapi/fcntl.h"
#ifndef HAVE_READLINKAT
-static inline int readlinkat(int dirfd, const char *pathname,
- char *buf, size_t bufsiz)
+int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz)
{
return ltp_syscall(__NR_readlinkat, dirfd, pathname, buf, bufsiz);
}
diff --git a/include/lapi/renameat.h b/include/lapi/renameat.h
index c92b30a9a..fe84e9df6 100644
--- a/include/lapi/renameat.h
+++ b/include/lapi/renameat.h
@@ -1,7 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2007
* Copyright (c) 2014 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef RENAMEAT_H
@@ -12,8 +25,8 @@
#include "lapi/syscalls.h"
#if !defined(HAVE_RENAMEAT)
-static inline int renameat(int olddirfd, const char *oldpath, int newdirfd,
- const char *newpath)
+int renameat(int olddirfd, const char *oldpath, int newdirfd,
+ const char *newpath)
{
return ltp_syscall(__NR_renameat, olddirfd, oldpath, newdirfd,
newpath);
diff --git a/include/lapi/rpc.h b/include/lapi/rpc.h
new file mode 100644
index 000000000..c20a95beb
--- /dev/null
+++ b/include/lapi/rpc.h
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+ */
+
+#ifndef LAPI_RPC_H__
+#define LAPI_RPC_H__
+
+#include "config.h"
+
+#ifdef HAVE_NETCONFIG_H
+# include <netconfig.h>
+# include <rpc/rpc.h>
+# include <rpc/types.h>
+# include <rpc/xdr.h>
+# include <rpc/svc.h>
+#elif defined(HAVE_TIRPC_NETCONFIG_H)
+# include <tirpc/netconfig.h>
+# include <tirpc/rpc/rpc.h>
+# include <tirpc/rpc/types.h>
+# include <tirpc/rpc/xdr.h>
+# include <tirpc/rpc/svc.h>
+#else
+# error Missing rpc headers!
+#endif
+
+#endif /* LAPI_RPC_H__ */
diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
index 3af91362f..29068eb67 100644
--- a/include/lapi/rt_sigaction.h
+++ b/include/lapi/rt_sigaction.h
@@ -1,9 +1,29 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved.
* Copyright (c) 2009 FUJITSU LIMITED. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
* Author: Liu Bo <liubo2009@cn.fujitsu.com>
* Author: Ngie Cooper <yaneurabeya@gmail.com>
+ *
*/
#ifndef LTP_RT_SIGACTION_H
diff --git a/include/lapi/rtnetlink.h b/include/lapi/rtnetlink.h
deleted file mode 100644
index 8a1b5385b..000000000
--- a/include/lapi/rtnetlink.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) 2021 Petr Vorel <petr.vorel@gmail.com> */
-
-#ifndef LAPI_IF_ADDR_H__
-# define LAPI_IF_ADDR_H__
-
-#include <linux/rtnetlink.h>
-
-#ifndef IFA_FLAGS
-# define IFA_FLAGS 8
-#endif
-
-#endif /* LAPI_IF_ADDR_H__ */
diff --git a/include/lapi/safe_rt_signal.h b/include/lapi/safe_rt_signal.h
index 952085608..67fa44417 100644
--- a/include/lapi/safe_rt_signal.h
+++ b/include/lapi/safe_rt_signal.h
@@ -15,15 +15,10 @@ static inline int safe_rt_sigaction(const char *file, const int lineno,
int ret;
ret = ltp_rt_sigaction(signum, act, oact, sigsetsize);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "ltp_rt_sigaction(%i, %p, %p, %zu) failed",
- signum, act, oact, sigsetsize);
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid ltp_rt_sigaction(%i, %p, %p, %zu) return value %d",
- signum, act, oact, sigsetsize, ret);
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: ltp_rt_sigaction(%i, %p, %p, %zu) failed",
+ file, lineno, signum, act, oact, sigsetsize);
}
return ret;
@@ -40,14 +35,10 @@ static inline int safe_rt_sigprocmask(const char *file, const int lineno,
int ret;
ret = tst_syscall(__NR_rt_sigprocmask, how, set, oldset, sigsetsize);
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "rt_sigprocmask(%i, %p, %p, %zu) failed",
- how, set, oldset, sigsetsize);
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid rt_sigprocmask(%i, %p, %p, %zu) return value %d",
- how, set, oldset, sigsetsize, ret);
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: rt_sigprocmask(%i, %p, %p, %zu) failed",
+ file, lineno, how, set, oldset, sigsetsize);
}
return ret;
diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index ee38c3a1c..057662dae 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015 Cui Bixuan <cuibixuan@huawei.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __SCHED_H__
@@ -28,14 +41,17 @@ struct sched_attr {
uint64_t sched_period;
};
-static inline int sched_setattr(pid_t pid, const struct sched_attr *attr,
- unsigned int flags)
+int sched_setattr(pid_t pid,
+ const struct sched_attr *attr,
+ unsigned int flags)
{
return syscall(__NR_sched_setattr, pid, attr, flags);
}
-static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
- unsigned int size, unsigned int flags)
+int sched_getattr(pid_t pid,
+ struct sched_attr *attr,
+ unsigned int size,
+ unsigned int flags)
{
return syscall(__NR_sched_getattr, pid, attr, size, flags);
}
diff --git a/include/lapi/sctp.h b/include/lapi/sctp.h
index c4c1cc91f..647052bc8 100644
--- a/include/lapi/sctp.h
+++ b/include/lapi/sctp.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2018 Oracle and/or its affiliates.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAPI_SCTP_H__
diff --git a/include/lapi/seek.h b/include/lapi/seek.h
index 1a29ba45d..023f1fb90 100644
--- a/include/lapi/seek.h
+++ b/include/lapi/seek.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SEEK_H__
diff --git a/include/lapi/sem.h b/include/lapi/sem.h
deleted file mode 100644
index d3ee027d3..000000000
--- a/include/lapi/sem.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2015 Linux Test Project
- */
-#ifndef LAPI_SEM_H
-#define LAPI_SEM_H
-
-#include <sys/sem.h>
-
-#ifdef HAVE_STRUCT_SEMUN
-/* union semun is defined by including <sys/sem.h> */
-#else
-/* according to X/OPEN we have to define it ourselves */
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
- unsigned short *array; /* array for GETALL, SETALL */
- /* Linux specific part: */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-#endif
-
-#ifndef SEM_STAT_ANY
-# define SEM_STAT_ANY 20
-#endif
-
-#endif /* LAPI_SEM_H */
diff --git a/include/lapi/sembuf.h b/include/lapi/sembuf.h
deleted file mode 100644
index 94ad005ca..000000000
--- a/include/lapi/sembuf.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef IPC_SEMBUF_H
-#define IPC_SEMBUF_H
-
-#include "lapi/posix_types.h"
-#include <sys/sem.h>
-#include "tst_timer.h"
-#include "ipcbuf.h"
-
-#ifndef HAVE_STRUCT_SEMID64_DS
-
-#if defined(__mips__)
-#define HAVE_SEMID64_DS
-/*
- * The semid64_ds structure for the MIPS architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for 2 miscellaneous 64-bit values on mips64,
- * but used for the upper 32 bit of the time values on mips32.
- */
-#if __BITS_PER_LONG == 64
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
- long sem_otime; /* last semop time */
- long sem_ctime; /* last change time */
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-#else
-#define HAVE_SEMID64_DS_TIME_HIGH
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_ctime; /* last change time */
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long sem_otime_high;
- unsigned long sem_ctime_high;
-};
-#endif
-#endif /* __mips__ */
-
-#if defined(__hppa__)
-#define HAVE_SEMID64_DS
-/*
- * The semid64_ds structure for parisc architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
-#if __BITS_PER_LONG == 64
- long sem_otime; /* last semop time */
- long sem_ctime; /* last change time */
-#else
-#define HAVE_SEMID64_DS_TIME_HIGH
- unsigned long sem_otime_high;
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_ctime_high;
- unsigned long sem_ctime; /* last change time */
-#endif
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-#endif /* __hppa__ */
-
-#if defined(__powerpc__) || defined(__powerpc64__)
-#define HAVE_SEMID64_DS
-/*
- * The semid64_ds structure for PPC architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32/64-bit values
- */
-
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
-#ifndef __powerpc64__
-#define HAVE_SEMID64_DS_TIME_HIGH
- unsigned long sem_otime_high;
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_ctime_high;
- unsigned long sem_ctime; /* last change time */
-#else
- long sem_otime; /* last semop time */
- long sem_ctime; /* last change time */
-#endif
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused3;
- unsigned long __unused4;
-};
-#endif /* defined(__powerpc__) || defined(__powerpc64__) */
-
-#if defined(__sparc__)
-#define HAVE_SEMID64_DS
-/*
- * The semid64_ds structure for sparc architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
-#if defined(__arch64__)
- long sem_otime; /* last semop time */
- long sem_ctime; /* last change time */
-#else
-#define HAVE_SEMID64_DS_TIME_HIGH
- unsigned long sem_otime_high;
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_ctime_high;
- unsigned long sem_ctime; /* last change time */
-#endif
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-#endif /* __sparc__ */
-
-#if defined(__x86_64__)
-#define HAVE_SEMID64_DS
-/*
- * The semid64_ds structure for x86 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- *
- * x86_64 and x32 incorrectly added padding here, so the structures
- * are still incompatible with the padding on x86.
- */
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
-#ifdef __i386__
-#define HAVE_SEMID64_DS_TIME_HIGH
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_otime_high;
- unsigned long sem_ctime; /* last change time */
- unsigned long sem_ctime_high;
-#else
- __kernel_long_t sem_otime; /* last semop time */
- __kernel_ulong_t __unused1;
- __kernel_long_t sem_ctime; /* last change time */
- __kernel_ulong_t __unused2;
-#endif
- __kernel_ulong_t sem_nsems; /* no. of semaphores in array */
- __kernel_ulong_t __unused3;
- __kernel_ulong_t __unused4;
-};
-#endif /* defined(__x86_64__) */
-
-#if defined(__xtensa__)
-#define HAVE_SEMID64_DS
-#define HAVE_SEMID64_DS_TIME_HIGH
-
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
-#ifdef __XTENSA_EL__
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_otime_high;
- unsigned long sem_ctime; /* last change time */
- unsigned long sem_ctime_high;
-#else
- unsigned long sem_otime_high;
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_ctime_high;
- unsigned long sem_ctime; /* last change time */
-#endif
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused3;
- unsigned long __unused4;
-};
-
-#endif /* __xtensa__ */
-
-#ifndef HAVE_SEMID64_DS
-/*
- * The semid64_ds structure for most architectures (though it came
- * from x86_32 originally). Note extra padding because this structure
- * is passed back and forth between kernel and user space.
- *
- * semid64_ds was originally meant to be architecture specific, but
- * everyone just ended up making identical copies without specific
- * optimizations, so we may just as well all use the same one.
- *
- * 64 bit architectures use a 64-bit long time field here, while
- * 32 bit architectures have a pair of unsigned long values.
- *
- * On big-endian systems, the padding is in the wrong place for
- * historic reasons, so user space has to reconstruct a time_t
- * value using
- *
- * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
- * ((long long)kernel_semid64_ds.sem_otime_high << 32)
- *
- * Pad space is left for 2 miscellaneous 32-bit values
- */
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
-#if __BITS_PER_LONG == 64
- long sem_otime; /* last semop time */
- long sem_ctime; /* last change time */
-#else
-#define HAVE_SEMID64_DS_TIME_HIGH
- unsigned long sem_otime; /* last semop time */
- unsigned long sem_otime_high;
- unsigned long sem_ctime; /* last change time */
- unsigned long sem_ctime_high;
-#endif
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused3;
- unsigned long __unused4;
-};
-#endif /* semid64_ds */
-
-#endif /* HAVE_SEMID64_DS */
-
-#endif /* IPC_SEMBUF_H */
diff --git a/include/lapi/semun.h b/include/lapi/semun.h
new file mode 100644
index 000000000..e56ea0db0
--- /dev/null
+++ b/include/lapi/semun.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SEMUN_H__
+#define SEMUN_H__
+
+#if defined(_UAPI_LINUX_SEM_H) && !defined(_SEM_SEMUN_UNDEFINED)
+/* union semun is defined by including <sys/sem.h> */
+#else
+/* according to X/OPEN we have to define it ourselves */
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
+ unsigned short *array; /* array for GETALL, SETALL */
+ /* Linux specific part: */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+};
+#endif
+
+#endif /* SEMUN_H__ */
diff --git a/include/lapi/setns.h b/include/lapi/setns.h
deleted file mode 100644
index 2d0be8846..000000000
--- a/include/lapi/setns.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-#ifndef LAPI_SETNS_H__
-#define LAPI_SETNS_H__
-
-#include "config.h"
-#include "lapi/syscalls.h"
-#include <sched.h>
-
-#ifndef HAVE_SETNS
-static inline int setns(int fd, int nstype)
-{
- return tst_syscall(__NR_setns, fd, nstype);
-}
-#endif
-
-#endif /* LAPI_SETNS_H__ */
diff --git a/include/lapi/shm.h b/include/lapi/shm.h
deleted file mode 100644
index 61c4e37bf..000000000
--- a/include/lapi/shm.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-#ifndef LAPI_SHM_H__
-#define LAPI_SHM_H__
-
-#ifndef SHM_STAT_ANY
-# define SHM_STAT_ANY 15
-#endif
-
-#endif /* LAPI_SHM_H__ */
diff --git a/include/lapi/shmbuf.h b/include/lapi/shmbuf.h
deleted file mode 100644
index 3857557b9..000000000
--- a/include/lapi/shmbuf.h
+++ /dev/null
@@ -1,273 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef IPC_SHMBUF_H
-#define IPC_SHMBUF_H
-
-#include "lapi/posix_types.h"
-#include <sys/sem.h>
-#include "tst_timer.h"
-#include "ipcbuf.h"
-
-#ifndef HAVE_STRUCT_SHMID64_DS
-
-#if defined(__mips__)
-#define HAVE_SHMID64_DS
-/*
- * The shmid64_ds structure for the MIPS architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * As MIPS was lacking proper padding after shm_?time, we use 48 bits
- * of the padding at the end to store a few additional bits of the time.
- * libc implementations need to take care to convert this into a proper
- * data structure when moving to 64-bit time_t.
- */
-
-#if __BITS_PER_LONG == 64
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
- size_t shm_segsz; /* size of segment (bytes) */
- long shm_atime; /* last attach time */
- long shm_dtime; /* last detach time */
- long shm_ctime; /* last change time */
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-#else
-#define HAVE_SHMID64_DS_TIME_HIGH
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
- size_t shm_segsz; /* size of segment (bytes) */
- unsigned long shm_atime; /* last attach time */
- unsigned long shm_dtime; /* last detach time */
- unsigned long shm_ctime; /* last change time */
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned short shm_atime_high;
- unsigned short shm_dtime_high;
- unsigned short shm_ctime_high;
- unsigned short __unused1;
-};
-#endif
-
-#endif /* __mips__ */
-
-#if defined(__hppa__)
-#define HAVE_SHMID64_DS
-/*
- * The shmid64_ds structure for parisc architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
-#if __BITS_PER_LONG == 64
- long shm_atime; /* last attach time */
- long shm_dtime; /* last detach time */
- long shm_ctime; /* last change time */
-#else
-#define HAVE_SHMID64_DS_TIME_HIGH
- unsigned long shm_atime_high;
- unsigned long shm_atime; /* last attach time */
- unsigned long shm_dtime_high;
- unsigned long shm_dtime; /* last detach time */
- unsigned long shm_ctime_high;
- unsigned long shm_ctime; /* last change time */
- unsigned int __pad4;
-#endif
- __kernel_size_t shm_segsz; /* size of segment (bytes) */
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-#endif /* __hppa__ */
-
-#if defined(__powerpc__) || defined(__powerpc64__)
-#define HAVE_SHMID64_DS
-/*
- * The shmid64_ds structure for PPC architecture.
- *
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
-#ifdef __powerpc64__
- long shm_atime; /* last attach time */
- long shm_dtime; /* last detach time */
- long shm_ctime; /* last change time */
-#else
-#define HAVE_SHMID64_DS_TIME_HIGH
- unsigned long shm_atime_high;
- unsigned long shm_atime; /* last attach time */
- unsigned long shm_dtime_high;
- unsigned long shm_dtime; /* last detach time */
- unsigned long shm_ctime_high;
- unsigned long shm_ctime; /* last change time */
- unsigned long __unused4;
-#endif
- size_t shm_segsz; /* size of segment (bytes) */
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused5;
- unsigned long __unused6;
-};
-
-#endif /* defined(__powerpc__) || defined(__powerpc64__) */
-
-#if defined(__sparc__)
-#define HAVE_SHMID64_DS
-/*
- * The shmid64_ds structure for sparc architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
-#if defined(__arch64__)
- long shm_atime; /* last attach time */
- long shm_dtime; /* last detach time */
- long shm_ctime; /* last change time */
-#else
-#define HAVE_SHMID64_DS_TIME_HIGH
- unsigned long shm_atime_high;
- unsigned long shm_atime; /* last attach time */
- unsigned long shm_dtime_high;
- unsigned long shm_dtime; /* last detach time */
- unsigned long shm_ctime_high;
- unsigned long shm_ctime; /* last change time */
-#endif
- size_t shm_segsz; /* size of segment (bytes) */
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* __sparc__ */
-
-#if defined(__x86_64__) && defined(__ILP32__)
-#define HAVE_SHMID64_DS
-/*
- * The shmid64_ds structure for x86 architecture with x32 ABI.
- *
- * On x86-32 and x86-64 we can just use the generic definition, but
- * x32 uses the same binary layout as x86_64, which is differnet
- * from other 32-bit architectures.
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
- size_t shm_segsz; /* size of segment (bytes) */
- __kernel_long_t shm_atime; /* last attach time */
- __kernel_long_t shm_dtime; /* last detach time */
- __kernel_long_t shm_ctime; /* last change time */
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- __kernel_ulong_t shm_nattch; /* no. of current attaches */
- __kernel_ulong_t __unused4;
- __kernel_ulong_t __unused5;
-};
-#endif /* defined(__x86_64__) && defined(__ILP32__) */
-
-#if defined(__xtensa__)
-#define HAVE_SHMID64_DS
-#define HAVE_SHMID64_DS_TIME_HIGH
-/*
- * The shmid64_ds structure for Xtensa architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space, but the padding is on the wrong
- * side for big-endian xtensa, for historic reasons.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
- size_t shm_segsz; /* size of segment (bytes) */
- unsigned long shm_atime; /* last attach time */
- unsigned long shm_atime_high;
- unsigned long shm_dtime; /* last detach time */
- unsigned long shm_dtime_high;
- unsigned long shm_ctime; /* last change time */
- unsigned long shm_ctime_high;
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-#endif /* __xtensa__ */
-
-#ifndef HAVE_SHMID64_DS
-/*
- * The shmid64_ds structure for most architectures (though it came
- * from x86_32 originally). Note extra padding because this structure
- * is passed back and forth between kernel and user space.
- *
- * shmid64_ds was originally meant to be architecture specific, but
- * everyone just ended up making identical copies without specific
- * optimizations, so we may just as well all use the same one.
- *
- * 64 bit architectures use a 64-bit long time field here, while
- * 32 bit architectures have a pair of unsigned long values.
- * On big-endian systems, the lower half is in the wrong place.
- *
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
- size_t shm_segsz; /* size of segment (bytes) */
-#if __BITS_PER_LONG == 64
- long shm_atime; /* last attach time */
- long shm_dtime; /* last detach time */
- long shm_ctime; /* last change time */
-#else
-#define HAVE_SHMID64_DS_TIME_HIGH
- unsigned long shm_atime; /* last attach time */
- unsigned long shm_atime_high;
- unsigned long shm_dtime; /* last detach time */
- unsigned long shm_dtime_high;
- unsigned long shm_ctime; /* last change time */
- unsigned long shm_ctime_high;
-#endif
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-#endif /* shmid64_ds */
-
-#endif /* HAVE_SHMID64_DS */
-
-#endif /* IPC_SHMBUF_H */
diff --git a/include/lapi/socket.h b/include/lapi/socket.h
index d6389e504..f32782fed 100644
--- a/include/lapi/socket.h
+++ b/include/lapi/socket.h
@@ -1,7 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2016 Fujitsu Ltd.
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it would be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.
*/
#ifndef __LAPI_SOCKET_H__
diff --git a/include/lapi/splice.h b/include/lapi/splice.h
index 76ac7084a..8ac8bd47f 100644
--- a/include/lapi/splice.h
+++ b/include/lapi/splice.h
@@ -1,7 +1,21 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2007
* Copyright (c) 2014 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
*/
#ifndef SPLICE_H
@@ -11,8 +25,8 @@
#include "lapi/syscalls.h"
#if !defined(HAVE_SPLICE)
-static inline ssize_t splice(int fd_in, loff_t *off_in, int fd_out,
- loff_t *off_out, size_t len, unsigned int flags)
+ssize_t splice(int fd_in, loff_t *off_in, int fd_out,
+ loff_t *off_out, size_t len, unsigned int flags)
{
return tst_syscall(__NR_splice, fd_in, off_in,
fd_out, off_out, len, flags);
diff --git a/include/lapi/syncfs.h b/include/lapi/syncfs.h
index d3c0c8a2a..e5d29fa96 100644
--- a/include/lapi/syncfs.h
+++ b/include/lapi/syncfs.h
@@ -12,7 +12,7 @@
#include "lapi/syscalls.h"
#if !defined(HAVE_SYNCFS)
-static inline int syncfs(int fd)
+int syncfs(int fd)
{
return tst_syscall(__NR_syncfs, fd);
}
diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
index 2def6ba3d..0e00641bc 100644
--- a/include/lapi/syscalls/aarch64.in
+++ b/include/lapi/syscalls/aarch64.in
@@ -256,17 +256,12 @@ sendmmsg 269
process_vm_readv 270
process_vm_writev 271
kcmp 272
-finit_module 273
-sched_setattr 274
-sched_getattr 275
-renameat2 276
-seccomp 277
getrandom 278
memfd_create 279
bpf 280
-execveat 281
userfaultfd 282
membarrier 283
+execveat 281
mlock2 284
copy_file_range 285
preadv2 286
@@ -274,43 +269,5 @@ pwritev2 287
pkey_mprotect 288
pkey_alloc 289
pkey_free 290
-statx 291
-io_pgetevents 292
-rseq 293
-kexec_file_load 294
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
_sysctl 1078
diff --git a/include/lapi/syscalls/arc.in b/include/lapi/syscalls/arc.in
deleted file mode 100644
index 9bcd84706..000000000
--- a/include/lapi/syscalls/arc.in
+++ /dev/null
@@ -1,315 +0,0 @@
-io_setup 0
-io_destroy 1
-io_submit 2
-io_cancel 3
-io_getevents 4
-setxattr 5
-lsetxattr 6
-fsetxattr 7
-getxattr 8
-lgetxattr 9
-fgetxattr 10
-listxattr 11
-llistxattr 12
-flistxattr 13
-removexattr 14
-lremovexattr 15
-fremovexattr 16
-getcwd 17
-lookup_dcookie 18
-eventfd2 19
-epoll_create1 20
-epoll_ctl 21
-epoll_pwait 22
-dup 23
-dup3 24
-fcntl 25
-inotify_init1 26
-inotify_add_watch 27
-inotify_rm_watch 28
-ioctl 29
-ioprio_set 30
-ioprio_get 31
-flock 32
-mknodat 33
-mkdirat 34
-unlinkat 35
-symlinkat 36
-linkat 37
-renameat 38
-umount2 39
-mount 40
-pivot_root 41
-nfsservctl 42
-statfs 43
-fstatfs 44
-truncate 45
-ftruncate 46
-fallocate 47
-faccessat 48
-chdir 49
-fchdir 50
-chroot 51
-fchmod 52
-fchmodat 53
-fchownat 54
-fchown 55
-openat 56
-close 57
-vhangup 58
-pipe2 59
-quotactl 60
-getdents64 61
-lseek 62
-read 63
-write 64
-readv 65
-writev 66
-pread64 67
-pwrite64 68
-preadv 69
-pwritev 70
-sendfile 71
-pselect6 72
-ppoll 73
-signalfd4 74
-vmsplice 75
-splice 76
-tee 77
-readlinkat 78
-fstatat 79
-fstat 80
-sync 81
-fsync 82
-fdatasync 83
-sync_file_range2 84
-sync_file_range 84
-timerfd_create 85
-timerfd_settime 86
-timerfd_gettime 87
-utimensat 88
-acct 89
-capget 90
-capset 91
-personality 92
-exit 93
-exit_group 94
-waitid 95
-set_tid_address 96
-unshare 97
-futex 98
-set_robust_list 99
-get_robust_list 100
-nanosleep 101
-getitimer 102
-setitimer 103
-kexec_load 104
-init_module 105
-delete_module 106
-timer_create 107
-timer_gettime 108
-timer_getoverrun 109
-timer_settime 110
-timer_delete 111
-clock_settime 112
-clock_gettime 113
-clock_getres 114
-clock_nanosleep 115
-syslog 116
-ptrace 117
-sched_setparam 118
-sched_setscheduler 119
-sched_getscheduler 120
-sched_getparam 121
-sched_setaffinity 122
-sched_getaffinity 123
-sched_yield 124
-sched_get_priority_max 125
-sched_get_priority_min 126
-sched_rr_get_interval 127
-restart_syscall 128
-kill 129
-tkill 130
-tgkill 131
-sigaltstack 132
-rt_sigsuspend 133
-rt_sigaction 134
-rt_sigprocmask 135
-rt_sigpending 136
-rt_sigtimedwait 137
-rt_sigqueueinfo 138
-rt_sigreturn 139
-setpriority 140
-getpriority 141
-reboot 142
-setregid 143
-setgid 144
-setreuid 145
-setuid 146
-setresuid 147
-getresuid 148
-setresgid 149
-getresgid 150
-setfsuid 151
-setfsgid 152
-times 153
-setpgid 154
-getpgid 155
-getsid 156
-setsid 157
-getgroups 158
-setgroups 159
-uname 160
-sethostname 161
-setdomainname 162
-getrlimit 163
-setrlimit 164
-getrusage 165
-umask 166
-prctl 167
-getcpu 168
-gettimeofday 169
-settimeofday 170
-adjtimex 171
-getpid 172
-getppid 173
-getuid 174
-geteuid 175
-getgid 176
-getegid 177
-gettid 178
-sysinfo 179
-mq_open 180
-mq_unlink 181
-mq_timedsend 182
-mq_timedreceive 183
-mq_notify 184
-mq_getsetattr 185
-msgget 186
-msgctl 187
-msgrcv 188
-msgsnd 189
-semget 190
-semctl 191
-semtimedop 192
-semop 193
-shmget 194
-shmctl 195
-shmat 196
-shmdt 197
-socket 198
-socketpair 199
-bind 200
-listen 201
-accept 202
-connect 203
-getsockname 204
-getpeername 205
-sendto 206
-recvfrom 207
-setsockopt 208
-getsockopt 209
-shutdown 210
-sendmsg 211
-recvmsg 212
-readahead 213
-brk 214
-munmap 215
-mremap 216
-add_key 217
-request_key 218
-keyctl 219
-clone 220
-execve 221
-mmap 222
-fadvise64 223
-swapon 224
-swapoff 225
-mprotect 226
-msync 227
-mlock 228
-munlock 229
-mlockall 230
-munlockall 231
-mincore 232
-madvise 233
-remap_file_pages 234
-mbind 235
-get_mempolicy 236
-set_mempolicy 237
-migrate_pages 238
-move_pages 239
-rt_tgsigqueueinfo 240
-perf_event_open 241
-accept4 242
-recvmmsg 243
-cacheflush 244
-arc_settls 245
-arc_gettls 246
-sysfs 247
-arc_usr_cmpxchg 248
-wait4 260
-prlimit64 261
-fanotify_init 262
-fanotify_mark 263
-name_to_handle_at 264
-open_by_handle_at 265
-clock_adjtime 266
-syncfs 267
-setns 268
-sendmmsg 269
-process_vm_readv 270
-process_vm_writev 271
-kcmp 272
-getrandom 278
-memfd_create 279
-bpf 280
-execveat 281
-userfaultfd 282
-membarrier 283
-mlock2 284
-copy_file_range 285
-preadv2 286
-pwritev2 287
-pkey_mprotect 288
-pkey_alloc 289
-pkey_free 290
-statx 291
-io_pgetevents 292
-rseq 293
-kexec_file_load 294
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
-pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in
index 98c840cb8..a6a594c2e 100644
--- a/include/lapi/syscalls/arm.in
+++ b/include/lapi/syscalls/arm.in
@@ -10,16 +10,21 @@ link (__NR_SYSCALL_BASE+ 9)
unlink (__NR_SYSCALL_BASE+ 10)
execve (__NR_SYSCALL_BASE+ 11)
chdir (__NR_SYSCALL_BASE+ 12)
+time (__NR_SYSCALL_BASE+ 13)
mknod (__NR_SYSCALL_BASE+ 14)
chmod (__NR_SYSCALL_BASE+ 15)
lchown (__NR_SYSCALL_BASE+ 16)
lseek (__NR_SYSCALL_BASE+ 19)
getpid (__NR_SYSCALL_BASE+ 20)
mount (__NR_SYSCALL_BASE+ 21)
+umount (__NR_SYSCALL_BASE+ 22)
setuid (__NR_SYSCALL_BASE+ 23)
getuid (__NR_SYSCALL_BASE+ 24)
+stime (__NR_SYSCALL_BASE+ 25)
ptrace (__NR_SYSCALL_BASE+ 26)
+alarm (__NR_SYSCALL_BASE+ 27)
pause (__NR_SYSCALL_BASE+ 29)
+utime (__NR_SYSCALL_BASE+ 30)
access (__NR_SYSCALL_BASE+ 33)
nice (__NR_SYSCALL_BASE+ 34)
sync (__NR_SYSCALL_BASE+ 36)
@@ -54,16 +59,20 @@ sigsuspend (__NR_SYSCALL_BASE+ 72)
sigpending (__NR_SYSCALL_BASE+ 73)
sethostname (__NR_SYSCALL_BASE+ 74)
setrlimit (__NR_SYSCALL_BASE+ 75)
+getrlimit (__NR_SYSCALL_BASE+ 76)
getrusage (__NR_SYSCALL_BASE+ 77)
gettimeofday (__NR_SYSCALL_BASE+ 78)
settimeofday (__NR_SYSCALL_BASE+ 79)
getgroups (__NR_SYSCALL_BASE+ 80)
setgroups (__NR_SYSCALL_BASE+ 81)
+select (__NR_SYSCALL_BASE+ 82)
symlink (__NR_SYSCALL_BASE+ 83)
readlink (__NR_SYSCALL_BASE+ 85)
uselib (__NR_SYSCALL_BASE+ 86)
swapon (__NR_SYSCALL_BASE+ 87)
reboot (__NR_SYSCALL_BASE+ 88)
+readdir (__NR_SYSCALL_BASE+ 89)
+mmap (__NR_SYSCALL_BASE+ 90)
munmap (__NR_SYSCALL_BASE+ 91)
truncate (__NR_SYSCALL_BASE+ 92)
ftruncate (__NR_SYSCALL_BASE+ 93)
@@ -73,6 +82,7 @@ getpriority (__NR_SYSCALL_BASE+ 96)
setpriority (__NR_SYSCALL_BASE+ 97)
statfs (__NR_SYSCALL_BASE+ 99)
fstatfs (__NR_SYSCALL_BASE+100)
+socketcall (__NR_SYSCALL_BASE+102)
syslog (__NR_SYSCALL_BASE+103)
setitimer (__NR_SYSCALL_BASE+104)
getitimer (__NR_SYSCALL_BASE+105)
@@ -80,9 +90,11 @@ stat (__NR_SYSCALL_BASE+106)
lstat (__NR_SYSCALL_BASE+107)
fstat (__NR_SYSCALL_BASE+108)
vhangup (__NR_SYSCALL_BASE+111)
+syscall (__NR_SYSCALL_BASE+113)
wait4 (__NR_SYSCALL_BASE+114)
swapoff (__NR_SYSCALL_BASE+115)
sysinfo (__NR_SYSCALL_BASE+116)
+ipc (__NR_SYSCALL_BASE+117)
fsync (__NR_SYSCALL_BASE+118)
sigreturn (__NR_SYSCALL_BASE+119)
clone (__NR_SYSCALL_BASE+120)
@@ -101,9 +113,7 @@ sysfs (__NR_SYSCALL_BASE+135)
personality (__NR_SYSCALL_BASE+136)
setfsuid (__NR_SYSCALL_BASE+138)
setfsgid (__NR_SYSCALL_BASE+139)
-_llseek (__NR_SYSCALL_BASE+140)
getdents (__NR_SYSCALL_BASE+141)
-_newselect (__NR_SYSCALL_BASE+142)
flock (__NR_SYSCALL_BASE+143)
msync (__NR_SYSCALL_BASE+144)
readv (__NR_SYSCALL_BASE+145)
@@ -324,23 +334,15 @@ accept4 (__NR_SYSCALL_BASE+366)
fanotify_init (__NR_SYSCALL_BASE+367)
fanotify_mark (__NR_SYSCALL_BASE+368)
prlimit64 (__NR_SYSCALL_BASE+369)
-name_to_handle_at (__NR_SYSCALL_BASE+370)
-open_by_handle_at (__NR_SYSCALL_BASE+371)
-clock_adjtime (__NR_SYSCALL_BASE+372)
syncfs (__NR_SYSCALL_BASE+373)
-sendmmsg (__NR_SYSCALL_BASE+374)
-setns (__NR_SYSCALL_BASE+375)
process_vm_readv (__NR_SYSCALL_BASE+376)
process_vm_writev (__NR_SYSCALL_BASE+377)
kcmp (__NR_SYSCALL_BASE+378)
-finit_module (__NR_SYSCALL_BASE+379)
sched_setattr (__NR_SYSCALL_BASE+380)
sched_getattr (__NR_SYSCALL_BASE+381)
renameat2 (__NR_SYSCALL_BASE+382)
-seccomp (__NR_SYSCALL_BASE+383)
getrandom (__NR_SYSCALL_BASE+384)
memfd_create (__NR_SYSCALL_BASE+385)
-bpf (__NR_SYSCALL_BASE+386)
execveat (__NR_SYSCALL_BASE+387)
userfaultfd (__NR_SYSCALL_BASE+388)
membarrier (__NR_SYSCALL_BASE+389)
@@ -352,42 +354,4 @@ pkey_mprotect (__NR_SYSCALL_BASE+394)
pkey_alloc (__NR_SYSCALL_BASE+395)
pkey_free (__NR_SYSCALL_BASE+396)
statx (__NR_SYSCALL_BASE+397)
-rseq (__NR_SYSCALL_BASE+398)
-io_pgetevents (__NR_SYSCALL_BASE+399)
-migrate_pages (__NR_SYSCALL_BASE+400)
-kexec_file_load (__NR_SYSCALL_BASE+401)
-clock_gettime64 (__NR_SYSCALL_BASE+403)
-clock_settime64 (__NR_SYSCALL_BASE+404)
-clock_adjtime64 (__NR_SYSCALL_BASE+405)
-clock_getres_time64 (__NR_SYSCALL_BASE+406)
-clock_nanosleep_time64 (__NR_SYSCALL_BASE+407)
-timer_gettime64 (__NR_SYSCALL_BASE+408)
-timer_settime64 (__NR_SYSCALL_BASE+409)
-timerfd_gettime64 (__NR_SYSCALL_BASE+410)
-timerfd_settime64 (__NR_SYSCALL_BASE+411)
-utimensat_time64 (__NR_SYSCALL_BASE+412)
-pselect6_time64 (__NR_SYSCALL_BASE+413)
-ppoll_time64 (__NR_SYSCALL_BASE+414)
-io_pgetevents_time64 (__NR_SYSCALL_BASE+416)
-recvmmsg_time64 (__NR_SYSCALL_BASE+417)
-mq_timedsend_time64 (__NR_SYSCALL_BASE+418)
-mq_timedreceive_time64 (__NR_SYSCALL_BASE+419)
-semtimedop_time64 (__NR_SYSCALL_BASE+420)
-rt_sigtimedwait_time64 (__NR_SYSCALL_BASE+421)
-futex_time64 (__NR_SYSCALL_BASE+422)
-sched_rr_get_interval_time64 (__NR_SYSCALL_BASE+423)
pidfd_send_signal (__NR_SYSCALL_BASE+424)
-io_uring_setup (__NR_SYSCALL_BASE+425)
-io_uring_enter (__NR_SYSCALL_BASE+426)
-io_uring_register (__NR_SYSCALL_BASE+427)
-open_tree (__NR_SYSCALL_BASE+428)
-move_mount (__NR_SYSCALL_BASE+429)
-fsopen (__NR_SYSCALL_BASE+430)
-fsconfig (__NR_SYSCALL_BASE+431)
-fsmount (__NR_SYSCALL_BASE+432)
-fspick (__NR_SYSCALL_BASE+433)
-pidfd_open (__NR_SYSCALL_BASE+434)
-clone3 (__NR_SYSCALL_BASE+435)
-close_range (__NR_SYSCALL_BASE+436)
-openat2 (__NR_SYSCALL_BASE+437)
-pidfd_getfd (__NR_SYSCALL_BASE+438)
diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in
index e1628c4b1..d92f33f40 100644
--- a/include/lapi/syscalls/hppa.in
+++ b/include/lapi/syscalls/hppa.in
@@ -17,7 +17,6 @@ splice 291
tee 293
vmsplice 294
syncfs 327
-setns 328
process_vm_readv 330
process_vm_writev 331
memfd_create 340
@@ -27,16 +26,4 @@ mlock2 345
copy_file_range 346
preadv2 347
pwritev2 348
-io_pgetevents 350
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-close_range 436 \ No newline at end of file
diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index aaa02c7bf..bad6e409f 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -125,7 +125,6 @@ modify_ldt 123
adjtimex 124
mprotect 125
sigprocmask 126
-create_module 127
init_module 128
delete_module 129
get_kernel_syms 130
@@ -138,9 +137,7 @@ personality 136
afs_syscall 137
setfsuid 138
setfsgid 139
-_llseek 140
getdents 141
-_newselect 142
flock 143
msync 144
readv 145
@@ -165,7 +162,6 @@ mremap 163
setresuid 164
getresuid 165
vm86 166
-query_module 167
poll 168
nfsservctl 169
setresgid 170
@@ -256,14 +252,14 @@ epoll_wait 256
remap_file_pages 257
set_tid_address 258
timer_create 259
-timer_settime 260
-timer_gettime 261
-timer_getoverrun 262
-timer_delete 263
-clock_settime 264
-clock_gettime 265
-clock_getres 266
-clock_nanosleep 267
+timer_settime (__NR_timer_create+1)
+timer_gettime (__NR_timer_create+2)
+timer_getoverrun (__NR_timer_create+3)
+timer_delete (__NR_timer_create+4)
+clock_settime (__NR_timer_create+5)
+clock_gettime (__NR_timer_create+6)
+clock_getres (__NR_timer_create+7)
+clock_nanosleep (__NR_timer_create+8)
statfs64 268
fstatfs64 269
tgkill 270
@@ -274,11 +270,11 @@ mbind 274
get_mempolicy 275
set_mempolicy 276
mq_open 277
-mq_unlink 278
-mq_timedsend 279
-mq_timedreceive 280
-mq_notify 281
-mq_getsetattr 282
+mq_unlink (__NR_mq_open+1)
+mq_timedsend (__NR_mq_open+2)
+mq_timedreceive (__NR_mq_open+3)
+mq_notify (__NR_mq_open+4)
+mq_getsetattr (__NR_mq_open+5)
kexec_load 283
waitid 284
add_key 286
@@ -336,39 +332,17 @@ recvmmsg 337
fanotify_init 338
fanotify_mark 339
prlimit64 340
-name_to_handle_at 341
-open_by_handle_at 342
-clock_adjtime 343
syncfs 344
-sendmmsg 345
-setns 346
process_vm_readv 347
process_vm_writev 348
kcmp 349
-finit_module 350
sched_setattr 351
sched_getattr 352
-renameat2 353
-seccomp 354
+renameat2 354
getrandom 355
memfd_create 356
bpf 357
execveat 358
-socket 359
-socketpair 360
-bind 361
-connect 362
-listen 363
-accept4 364
-getsockopt 365
-setsockopt 366
-getsockname 367
-getpeername 368
-sendto 369
-sendmsg 370
-recvfrom 371
-recvmsg 372
-shutdown 373
userfaultfd 374
membarrier 375
mlock2 376
@@ -379,51 +353,4 @@ pkey_mprotect 380
pkey_alloc 381
pkey_free 382
statx 383
-arch_prctl 384
-io_pgetevents 385
-rseq 386
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in
index 5467f80f2..0e6ba54a8 100644
--- a/include/lapi/syscalls/ia64.in
+++ b/include/lapi/syscalls/ia64.in
@@ -18,7 +18,7 @@ lseek 1040
getpid 1041
getppid 1042
mount 1043
-umount2 1044
+umount 1044
setuid 1045
getuid 1046
geteuid 1047
@@ -139,7 +139,6 @@ sched_rr_get_interval 1167
nanosleep 1168
nfsservctl 1169
prctl 1170
-old_getpagesize 1171
mmap2 1172
pciconfig_read 1173
pciconfig_write 1174
@@ -294,49 +293,20 @@ recvmmsg 1322
fanotify_init 1323
fanotify_mark 1324
prlimit64 1325
-name_to_handle_at 1326
-open_by_handle_at 1327
-clock_adjtime 1328
syncfs 1329
-setns 1330
-sendmmsg 1331
process_vm_readv 1332
process_vm_writev 1333
-accept4 1334
-finit_module 1335
-sched_setattr 1336
-sched_getattr 1337
renameat2 1338
getrandom 1339
memfd_create 1340
-bpf 1341
-execveat 1342
userfaultfd 1343
membarrier 1344
-kcmp 1345
+execveat 1342
mlock2 1346
copy_file_range 1347
preadv2 1348
pwritev2 1349
-statx 1350
-io_pgetevents 1351
-perf_event_open 1352
-seccomp 1353
pkey_mprotect 1354
pkey_alloc 1355
pkey_free 1356
-rseq 1357
pidfd_send_signal 1448
-io_uring_setup 1449
-io_uring_enter 1450
-io_uring_register 1451
-open_tree 1452
-move_mount 1453
-fsopen 1454
-fsconfig 1455
-fsmount 1456
-fspick 1457
-pidfd_open 1458
-close_range 1460
-openat2 1461
-pidfd_getfd 1462
diff --git a/include/lapi/syscalls/mips_n32.in b/include/lapi/syscalls/mips_n32.in
index dad8107f4..25dc020d1 100644
--- a/include/lapi/syscalls/mips_n32.in
+++ b/include/lapi/syscalls/mips_n32.in
@@ -1,371 +1,363 @@
-read 6000
-write 6001
-open 6002
-close 6003
-stat 6004
-fstat 6005
-lstat 6006
-poll 6007
-lseek 6008
-mmap 6009
-mprotect 6010
-munmap 6011
-brk 6012
-rt_sigaction 6013
-rt_sigprocmask 6014
-ioctl 6015
-pread64 6016
-pwrite64 6017
-readv 6018
-writev 6019
-access 6020
-pipe 6021
-_newselect 6022
-sched_yield 6023
-mremap 6024
-msync 6025
-mincore 6026
-madvise 6027
-shmget 6028
-shmat 6029
-shmctl 6030
-dup 6031
-dup2 6032
-pause 6033
-nanosleep 6034
-getitimer 6035
-setitimer 6036
-alarm 6037
-getpid 6038
-sendfile 6039
-socket 6040
-connect 6041
-accept 6042
-sendto 6043
-recvfrom 6044
-sendmsg 6045
-recvmsg 6046
-shutdown 6047
-bind 6048
-listen 6049
-getsockname 6050
-getpeername 6051
-socketpair 6052
-setsockopt 6053
-getsockopt 6054
-clone 6055
-fork 6056
-execve 6057
-exit 6058
-wait4 6059
-kill 6060
-uname 6061
-semget 6062
-semop 6063
-semctl 6064
-shmdt 6065
-msgget 6066
-msgsnd 6067
-msgrcv 6068
-msgctl 6069
-fcntl 6070
-flock 6071
-fsync 6072
-fdatasync 6073
-truncate 6074
-ftruncate 6075
-getdents 6076
-getcwd 6077
-chdir 6078
-fchdir 6079
-rename 6080
-mkdir 6081
-rmdir 6082
-creat 6083
-link 6084
-unlink 6085
-symlink 6086
-readlink 6087
-chmod 6088
-fchmod 6089
-chown 6090
-fchown 6091
-lchown 6092
-umask 6093
-gettimeofday 6094
-getrlimit 6095
-getrusage 6096
-sysinfo 6097
-times 6098
-ptrace 6099
-getuid 6100
-syslog 6101
-getgid 6102
-setuid 6103
-setgid 6104
-geteuid 6105
-getegid 6106
-setpgid 6107
-getppid 6108
-getpgrp 6109
-setsid 6110
-setreuid 6111
-setregid 6112
-getgroups 6113
-setgroups 6114
-setresuid 6115
-getresuid 6116
-setresgid 6117
-getresgid 6118
-getpgid 6119
-setfsuid 6120
-setfsgid 6121
-getsid 6122
-capget 6123
-capset 6124
-rt_sigpending 6125
-rt_sigtimedwait 6126
-rt_sigqueueinfo 6127
-rt_sigsuspend 6128
-sigaltstack 6129
-utime 6130
-mknod 6131
-personality 6132
-ustat 6133
-statfs 6134
-fstatfs 6135
-sysfs 6136
-getpriority 6137
-setpriority 6138
-sched_setparam 6139
-sched_getparam 6140
-sched_setscheduler 6141
-sched_getscheduler 6142
-sched_get_priority_max 6143
-sched_get_priority_min 6144
-sched_rr_get_interval 6145
-mlock 6146
-munlock 6147
-mlockall 6148
-munlockall 6149
-vhangup 6150
-pivot_root 6151
-_sysctl 6152
-prctl 6153
-adjtimex 6154
-setrlimit 6155
-chroot 6156
-sync 6157
-acct 6158
-settimeofday 6159
-mount 6160
-umount2 6161
-swapon 6162
-swapoff 6163
-reboot 6164
-sethostname 6165
-setdomainname 6166
-create_module 6167
-init_module 6168
-delete_module 6169
-get_kernel_syms 6170
-query_module 6171
-quotactl 6172
-nfsservctl 6173
-getpmsg 6174
-putpmsg 6175
-afs_syscall 6176
-reserved177 6177
-gettid 6178
-readahead 6179
-setxattr 6180
-lsetxattr 6181
-fsetxattr 6182
-getxattr 6183
-lgetxattr 6184
-fgetxattr 6185
-listxattr 6186
-llistxattr 6187
-flistxattr 6188
-removexattr 6189
-lremovexattr 6190
-fremovexattr 6191
-tkill 6192
-reserved193 6193
-futex 6194
-sched_setaffinity 6195
-sched_getaffinity 6196
-cacheflush 6197
-cachectl 6198
-sysmips 6199
-io_setup 6200
-io_destroy 6201
-io_getevents 6202
-io_submit 6203
-io_cancel 6204
-exit_group 6205
-lookup_dcookie 6206
-epoll_create 6207
-epoll_ctl 6208
-epoll_wait 6209
-remap_file_pages 6210
-rt_sigreturn 6211
-fcntl64 6212
-set_tid_address 6213
-restart_syscall 6214
-semtimedop 6215
-fadvise64 6216
-statfs64 6217
-fstatfs64 6218
-sendfile64 6219
-timer_create 6220
-timer_settime 6221
-timer_gettime 6222
-timer_getoverrun 6223
-timer_delete 6224
-clock_settime 6225
-clock_gettime 6226
-clock_getres 6227
-clock_nanosleep 6228
-tgkill 6229
-utimes 6230
-mbind 6231
-get_mempolicy 6232
-set_mempolicy 6233
-mq_open 6234
-mq_unlink 6235
-mq_timedsend 6236
-mq_timedreceive 6237
-mq_notify 6238
-mq_getsetattr 6239
-vserver 6240
-waitid 6241
-add_key 6243
-request_key 6244
-keyctl 6245
-set_thread_area 6246
-inotify_init 6247
-inotify_add_watch 6248
-inotify_rm_watch 6249
-migrate_pages 6250
-openat 6251
-mkdirat 6252
-mknodat 6253
-fchownat 6254
-futimesat 6255
-newfstatat 6256
-unlinkat 6257
-renameat 6258
-linkat 6259
-symlinkat 6260
-readlinkat 6261
-fchmodat 6262
-faccessat 6263
-pselect6 6264
-ppoll 6265
-unshare 6266
-splice 6267
-sync_file_range 6268
-tee 6269
-vmsplice 6270
-move_pages 6271
-set_robust_list 6272
-get_robust_list 6273
-kexec_load 6274
-getcpu 6275
-epoll_pwait 6276
-ioprio_set 6277
-ioprio_get 6278
-utimensat 6279
-signalfd 6280
-timerfd 6281
-eventfd 6282
-fallocate 6283
-timerfd_create 6284
-timerfd_gettime 6285
-timerfd_settime 6286
-signalfd4 6287
-eventfd2 6288
-epoll_create1 6289
-dup3 6290
-pipe2 6291
-inotify_init1 6292
-preadv 6293
-pwritev 6294
-rt_tgsigqueueinfo 6295
-perf_event_open 6296
-accept4 6297
-recvmmsg 6298
-getdents64 6299
-fanotify_init 6300
-fanotify_mark 6301
-prlimit64 6302
-name_to_handle_at 6303
-open_by_handle_at 6304
-clock_adjtime 6305
-syncfs 6306
-sendmmsg 6307
-setns 6308
-process_vm_readv 6309
-process_vm_writev 6310
-kcmp 6311
-finit_module 6312
-sched_setattr 6313
-sched_getattr 6314
-renameat2 6315
-seccomp 6316
-getrandom 6317
-memfd_create 6318
-bpf 6319
-execveat 6320
-userfaultfd 6321
-membarrier 6322
-mlock2 6323
-copy_file_range 6324
-preadv2 6325
-pwritev2 6326
-pkey_mprotect 6327
-pkey_alloc 6328
-pkey_free 6329
-statx 6330
-rseq 6331
-io_pgetevents 6332
-clock_gettime64 6403
-clock_settime64 6404
-clock_adjtime64 6405
-clock_getres_time64 6406
-clock_nanosleep_time64 6407
-timer_gettime64 6408
-timer_settime64 6409
-timerfd_gettime64 6410
-timerfd_settime64 6411
-utimensat_time64 6412
-pselect6_time64 6413
-ppoll_time64 6414
-io_pgetevents_time64 6416
-recvmmsg_time64 6417
-mq_timedsend_time64 6418
-mq_timedreceive_time64 6419
-semtimedop_time64 6420
-rt_sigtimedwait_time64 6421
-futex_time64 6422
-sched_rr_get_interval_time64 6423
-pidfd_send_signal 6424
-io_uring_setup 6425
-io_uring_enter 6426
-io_uring_register 6427
-open_tree 6428
-move_mount 6429
-fsopen 6430
-fsconfig 6431
-fsmount 6432
-fspick 6433
-pidfd_open 6434
-clone3 6435
-close_range 6436
-openat2 6437
-pidfd_getfd 6438
-faccessat2 6439
-process_madvise 6440
-epoll_pwait2 6441
-mount_setattr 6442
+read 0
+write 1
+open 2
+close 3
+stat 4
+fstat 5
+lstat 6
+poll 7
+lseek 8
+mmap 9
+mprotect 10
+munmap 11
+brk 12
+rt_sigaction 13
+rt_sigprocmask 14
+ioctl 15
+pread64 16
+pwrite64 17
+readv 18
+writev 19
+access 20
+pipe 21
+_newselect 22
+sched_yield 23
+mremap 24
+msync 25
+mincore 26
+madvise 27
+shmget 28
+shmat 29
+shmctl 30
+dup 31
+dup2 32
+pause 33
+nanosleep 34
+getitimer 35
+setitimer 36
+alarm 37
+getpid 38
+sendfile 39
+socket 40
+connect 41
+accept 42
+sendto 43
+recvfrom 44
+sendmsg 45
+recvmsg 46
+shutdown 47
+bind 48
+listen 49
+getsockname 50
+getpeername 51
+socketpair 52
+setsockopt 53
+getsockopt 54
+clone 55
+fork 56
+execve 57
+exit 58
+wait4 59
+kill 60
+uname 61
+semget 62
+semop 63
+semctl 64
+shmdt 65
+msgget 66
+msgsnd 67
+msgrcv 68
+msgctl 69
+fcntl 70
+flock 71
+fsync 72
+fdatasync 73
+truncate 74
+ftruncate 75
+getdents 76
+getcwd 77
+chdir 78
+fchdir 79
+rename 80
+mkdir 81
+rmdir 82
+creat 83
+link 84
+unlink 85
+symlink 86
+readlink 87
+chmod 88
+fchmod 89
+chown 90
+fchown 91
+lchown 92
+umask 93
+gettimeofday 94
+getrlimit 95
+getrusage 96
+sysinfo 97
+times 98
+ptrace 99
+getuid 100
+syslog 101
+getgid 102
+setuid 103
+setgid 104
+geteuid 105
+getegid 106
+setpgid 107
+getppid 108
+getpgrp 109
+setsid 110
+setreuid 111
+setregid 112
+getgroups 113
+setgroups 114
+setresuid 115
+getresuid 116
+setresgid 117
+getresgid 118
+getpgid 119
+setfsuid 120
+setfsgid 121
+getsid 122
+capget 123
+capset 124
+rt_sigpending 125
+rt_sigtimedwait 126
+rt_sigqueueinfo 127
+rt_sigsuspend 128
+sigaltstack 129
+utime 130
+mknod 131
+personality 132
+ustat 133
+statfs 134
+fstatfs 135
+sysfs 136
+getpriority 137
+setpriority 138
+sched_setparam 139
+sched_getparam 140
+sched_setscheduler 141
+sched_getscheduler 142
+sched_get_priority_max 143
+sched_get_priority_min 144
+sched_rr_get_interval 145
+mlock 146
+munlock 147
+mlockall 148
+munlockall 149
+vhangup 150
+pivot_root 151
+_sysctl 152
+prctl 153
+adjtimex 154
+setrlimit 155
+chroot 156
+sync 157
+acct 158
+settimeofday 159
+mount 160
+umount2 161
+swapon 162
+swapoff 163
+reboot 164
+sethostname 165
+setdomainname 166
+create_module 167
+init_module 168
+delete_module 169
+get_kernel_syms 170
+query_module 171
+quotactl 172
+nfsservctl 173
+getpmsg 174
+putpmsg 175
+afs_syscall 176
+reserved177 177
+gettid 178
+readahead 179
+setxattr 180
+lsetxattr 181
+fsetxattr 182
+getxattr 183
+lgetxattr 184
+fgetxattr 185
+listxattr 186
+llistxattr 187
+flistxattr 188
+removexattr 189
+lremovexattr 190
+fremovexattr 191
+tkill 192
+reserved193 193
+futex 194
+sched_setaffinity 195
+sched_getaffinity 196
+cacheflush 197
+cachectl 198
+sysmips 199
+io_setup 200
+io_destroy 201
+io_getevents 202
+io_submit 203
+io_cancel 204
+exit_group 205
+lookup_dcookie 206
+epoll_create 207
+epoll_ctl 208
+epoll_wait 209
+remap_file_pages 210
+rt_sigreturn 211
+fcntl64 212
+set_tid_address 213
+restart_syscall 214
+semtimedop 215
+fadvise64 216
+statfs64 217
+fstatfs64 218
+sendfile64 219
+timer_create 220
+timer_settime 221
+timer_gettime 222
+timer_getoverrun 223
+timer_delete 224
+clock_settime 225
+clock_gettime 226
+clock_getres 227
+clock_nanosleep 228
+tgkill 229
+utimes 230
+mbind 231
+get_mempolicy 232
+set_mempolicy 233
+mq_open 234
+mq_unlink 235
+mq_timedsend 236
+mq_timedreceive 237
+mq_notify 238
+mq_getsetattr 239
+vserver 240
+waitid 241
+add_key 243
+request_key 244
+keyctl 245
+set_thread_area 246
+inotify_init 247
+inotify_add_watch 248
+inotify_rm_watch 249
+migrate_pages 250
+openat 251
+mkdirat 252
+mknodat 253
+fchownat 254
+futimesat 255
+newfstatat 256
+unlinkat 257
+renameat 258
+linkat 259
+symlinkat 260
+readlinkat 261
+fchmodat 262
+faccessat 263
+pselect6 264
+ppoll 265
+unshare 266
+splice 267
+sync_file_range 268
+tee 269
+vmsplice 270
+move_pages 271
+set_robust_list 272
+get_robust_list 273
+kexec_load 274
+getcpu 275
+epoll_pwait 276
+ioprio_set 277
+ioprio_get 278
+utimensat 279
+signalfd 280
+timerfd 281
+eventfd 282
+fallocate 283
+timerfd_create 284
+timerfd_gettime 285
+timerfd_settime 286
+signalfd4 287
+eventfd2 288
+epoll_create1 289
+dup3 290
+pipe2 291
+inotify_init1 292
+preadv 293
+pwritev 294
+rt_tgsigqueueinfo 295
+perf_event_open 296
+accept4 297
+recvmmsg 298
+getdents64 299
+fanotify_init 300
+fanotify_mark 301
+prlimit64 302
+name_to_handle_at 303
+open_by_handle_at 304
+clock_adjtime 305
+syncfs 306
+sendmmsg 307
+setns 308
+process_vm_readv 309
+process_vm_writev 310
+kcmp 311
+finit_module 312
+sched_setattr 313
+sched_getattr 314
+renameat2 315
+seccomp 316
+getrandom 317
+memfd_create 318
+bpf 319
+execveat 320
+userfaultfd 321
+membarrier 322
+mlock2 323
+copy_file_range 324
+preadv2 325
+pwritev2 326
+pkey_mprotect 327
+pkey_alloc 328
+pkey_free 329
+statx 330
+rseq 331
+io_pgetevents 332
+clock_gettime64 403
+clock_settime64 404
+clock_adjtime64 405
+clock_getres_time64 406
+clock_nanosleep_time64 407
+timer_gettime64 408
+timer_settime64 409
+timerfd_gettime64 410
+timerfd_settime64 411
+utimensat_time64 412
+pselect6_time64 413
+ppoll_time64 414
+io_pgetevents_time64 416
+recvmmsg_time64 417
+mq_timedsend_time64 418
+mq_timedreceive_time64 419
+semtimedop_time64 420
+rt_sigtimedwait_time64 421
+futex_time64 422
+sched_rr_get_interval_time64 423
+pidfd_send_signal 424
+io_uring_setup 425
+io_uring_enter 426
+io_uring_register 427
+open_tree 428
+move_mount 429
+fsopen 430
+fsconfig 431
+fsmount 432
+fspick 433
+pidfd_open 434
diff --git a/include/lapi/syscalls/mips_n64.in b/include/lapi/syscalls/mips_n64.in
index a6c0c8cdd..68ba6f1a0 100644
--- a/include/lapi/syscalls/mips_n64.in
+++ b/include/lapi/syscalls/mips_n64.in
@@ -1,347 +1,339 @@
-read 5000
-write 5001
-open 5002
-close 5003
-stat 5004
-fstat 5005
-lstat 5006
-poll 5007
-lseek 5008
-mmap 5009
-mprotect 5010
-munmap 5011
-brk 5012
-rt_sigaction 5013
-rt_sigprocmask 5014
-ioctl 5015
-pread64 5016
-pwrite64 5017
-readv 5018
-writev 5019
-access 5020
-pipe 5021
-_newselect 5022
-sched_yield 5023
-mremap 5024
-msync 5025
-mincore 5026
-madvise 5027
-shmget 5028
-shmat 5029
-shmctl 5030
-dup 5031
-dup2 5032
-pause 5033
-nanosleep 5034
-getitimer 5035
-setitimer 5036
-alarm 5037
-getpid 5038
-sendfile 5039
-socket 5040
-connect 5041
-accept 5042
-sendto 5043
-recvfrom 5044
-sendmsg 5045
-recvmsg 5046
-shutdown 5047
-bind 5048
-listen 5049
-getsockname 5050
-getpeername 5051
-socketpair 5052
-setsockopt 5053
-getsockopt 5054
-clone 5055
-fork 5056
-execve 5057
-exit 5058
-wait4 5059
-kill 5060
-uname 5061
-semget 5062
-semop 5063
-semctl 5064
-shmdt 5065
-msgget 5066
-msgsnd 5067
-msgrcv 5068
-msgctl 5069
-fcntl 5070
-flock 5071
-fsync 5072
-fdatasync 5073
-truncate 5074
-ftruncate 5075
-getdents 5076
-getcwd 5077
-chdir 5078
-fchdir 5079
-rename 5080
-mkdir 5081
-rmdir 5082
-creat 5083
-link 5084
-unlink 5085
-symlink 5086
-readlink 5087
-chmod 5088
-fchmod 5089
-chown 5090
-fchown 5091
-lchown 5092
-umask 5093
-gettimeofday 5094
-getrlimit 5095
-getrusage 5096
-sysinfo 5097
-times 5098
-ptrace 5099
-getuid 5100
-syslog 5101
-getgid 5102
-setuid 5103
-setgid 5104
-geteuid 5105
-getegid 5106
-setpgid 5107
-getppid 5108
-getpgrp 5109
-setsid 5110
-setreuid 5111
-setregid 5112
-getgroups 5113
-setgroups 5114
-setresuid 5115
-getresuid 5116
-setresgid 5117
-getresgid 5118
-getpgid 5119
-setfsuid 5120
-setfsgid 5121
-getsid 5122
-capget 5123
-capset 5124
-rt_sigpending 5125
-rt_sigtimedwait 5126
-rt_sigqueueinfo 5127
-rt_sigsuspend 5128
-sigaltstack 5129
-utime 5130
-mknod 5131
-personality 5132
-ustat 5133
-statfs 5134
-fstatfs 5135
-sysfs 5136
-getpriority 5137
-setpriority 5138
-sched_setparam 5139
-sched_getparam 5140
-sched_setscheduler 5141
-sched_getscheduler 5142
-sched_get_priority_max 5143
-sched_get_priority_min 5144
-sched_rr_get_interval 5145
-mlock 5146
-munlock 5147
-mlockall 5148
-munlockall 5149
-vhangup 5150
-pivot_root 5151
-_sysctl 5152
-prctl 5153
-adjtimex 5154
-setrlimit 5155
-chroot 5156
-sync 5157
-acct 5158
-settimeofday 5159
-mount 5160
-umount2 5161
-swapon 5162
-swapoff 5163
-reboot 5164
-sethostname 5165
-setdomainname 5166
-create_module 5167
-init_module 5168
-delete_module 5169
-get_kernel_syms 5170
-query_module 5171
-quotactl 5172
-nfsservctl 5173
-getpmsg 5174
-putpmsg 5175
-afs_syscall 5176
-reserved177 5177
-gettid 5178
-readahead 5179
-setxattr 5180
-lsetxattr 5181
-fsetxattr 5182
-getxattr 5183
-lgetxattr 5184
-fgetxattr 5185
-listxattr 5186
-llistxattr 5187
-flistxattr 5188
-removexattr 5189
-lremovexattr 5190
-fremovexattr 5191
-tkill 5192
-reserved193 5193
-futex 5194
-sched_setaffinity 5195
-sched_getaffinity 5196
-cacheflush 5197
-cachectl 5198
-sysmips 5199
-io_setup 5200
-io_destroy 5201
-io_getevents 5202
-io_submit 5203
-io_cancel 5204
-exit_group 5205
-lookup_dcookie 5206
-epoll_create 5207
-epoll_ctl 5208
-epoll_wait 5209
-remap_file_pages 5210
-rt_sigreturn 5211
-set_tid_address 5212
-restart_syscall 5213
-semtimedop 5214
-fadvise64 5215
-timer_create 5216
-timer_settime 5217
-timer_gettime 5218
-timer_getoverrun 5219
-timer_delete 5220
-clock_settime 5221
-clock_gettime 5222
-clock_getres 5223
-clock_nanosleep 5224
-tgkill 5225
-utimes 5226
-mbind 5227
-get_mempolicy 5228
-set_mempolicy 5229
-mq_open 5230
-mq_unlink 5231
-mq_timedsend 5232
-mq_timedreceive 5233
-mq_notify 5234
-mq_getsetattr 5235
-vserver 5236
-waitid 5237
-add_key 5239
-request_key 5240
-keyctl 5241
-set_thread_area 5242
-inotify_init 5243
-inotify_add_watch 5244
-inotify_rm_watch 5245
-migrate_pages 5246
-openat 5247
-mkdirat 5248
-mknodat 5249
-fchownat 5250
-futimesat 5251
-newfstatat 5252
-unlinkat 5253
-renameat 5254
-linkat 5255
-symlinkat 5256
-readlinkat 5257
-fchmodat 5258
-faccessat 5259
-pselect6 5260
-ppoll 5261
-unshare 5262
-splice 5263
-sync_file_range 5264
-tee 5265
-vmsplice 5266
-move_pages 5267
-set_robust_list 5268
-get_robust_list 5269
-kexec_load 5270
-getcpu 5271
-epoll_pwait 5272
-ioprio_set 5273
-ioprio_get 5274
-utimensat 5275
-signalfd 5276
-timerfd 5277
-eventfd 5278
-fallocate 5279
-timerfd_create 5280
-timerfd_gettime 5281
-timerfd_settime 5282
-signalfd4 5283
-eventfd2 5284
-epoll_create1 5285
-dup3 5286
-pipe2 5287
-inotify_init1 5288
-preadv 5289
-pwritev 5290
-rt_tgsigqueueinfo 5291
-perf_event_open 5292
-accept4 5293
-recvmmsg 5294
-fanotify_init 5295
-fanotify_mark 5296
-prlimit64 5297
-name_to_handle_at 5298
-open_by_handle_at 5299
-clock_adjtime 5300
-syncfs 5301
-sendmmsg 5302
-setns 5303
-process_vm_readv 5304
-process_vm_writev 5305
-kcmp 5306
-finit_module 5307
-getdents64 5308
-sched_setattr 5309
-sched_getattr 5310
-renameat2 5311
-seccomp 5312
-getrandom 5313
-memfd_create 5314
-bpf 5315
-execveat 5316
-userfaultfd 5317
-membarrier 5318
-mlock2 5319
-copy_file_range 5320
-preadv2 5321
-pwritev2 5322
-pkey_mprotect 5323
-pkey_alloc 5324
-pkey_free 5325
-statx 5326
-rseq 5327
-io_pgetevents 5328
-pidfd_send_signal 5424
-io_uring_setup 5425
-io_uring_enter 5426
-io_uring_register 5427
-open_tree 5428
-move_mount 5429
-fsopen 5430
-fsconfig 5431
-fsmount 5432
-fspick 5433
-pidfd_open 5434
-clone3 5435
-close_range 5436
-openat2 5437
-pidfd_getfd 5438
-faccessat2 5439
-process_madvise 5440
-epoll_pwait2 5441
-mount_setattr 5442
+read 0
+write 1
+open 2
+close 3
+stat 4
+fstat 5
+lstat 6
+poll 7
+lseek 8
+mmap 9
+mprotect 10
+munmap 11
+brk 12
+rt_sigaction 13
+rt_sigprocmask 14
+ioctl 15
+pread64 16
+pwrite64 17
+readv 18
+writev 19
+access 20
+pipe 21
+_newselect 22
+sched_yield 23
+mremap 24
+msync 25
+mincore 26
+madvise 27
+shmget 28
+shmat 29
+shmctl 30
+dup 31
+dup2 32
+pause 33
+nanosleep 34
+getitimer 35
+setitimer 36
+alarm 37
+getpid 38
+sendfile 39
+socket 40
+connect 41
+accept 42
+sendto 43
+recvfrom 44
+sendmsg 45
+recvmsg 46
+shutdown 47
+bind 48
+listen 49
+getsockname 50
+getpeername 51
+socketpair 52
+setsockopt 53
+getsockopt 54
+clone 55
+fork 56
+execve 57
+exit 58
+wait4 59
+kill 60
+uname 61
+semget 62
+semop 63
+semctl 64
+shmdt 65
+msgget 66
+msgsnd 67
+msgrcv 68
+msgctl 69
+fcntl 70
+flock 71
+fsync 72
+fdatasync 73
+truncate 74
+ftruncate 75
+getdents 76
+getcwd 77
+chdir 78
+fchdir 79
+rename 80
+mkdir 81
+rmdir 82
+creat 83
+link 84
+unlink 85
+symlink 86
+readlink 87
+chmod 88
+fchmod 89
+chown 90
+fchown 91
+lchown 92
+umask 93
+gettimeofday 94
+getrlimit 95
+getrusage 96
+sysinfo 97
+times 98
+ptrace 99
+getuid 100
+syslog 101
+getgid 102
+setuid 103
+setgid 104
+geteuid 105
+getegid 106
+setpgid 107
+getppid 108
+getpgrp 109
+setsid 110
+setreuid 111
+setregid 112
+getgroups 113
+setgroups 114
+setresuid 115
+getresuid 116
+setresgid 117
+getresgid 118
+getpgid 119
+setfsuid 120
+setfsgid 121
+getsid 122
+capget 123
+capset 124
+rt_sigpending 125
+rt_sigtimedwait 126
+rt_sigqueueinfo 127
+rt_sigsuspend 128
+sigaltstack 129
+utime 130
+mknod 131
+personality 132
+ustat 133
+statfs 134
+fstatfs 135
+sysfs 136
+getpriority 137
+setpriority 138
+sched_setparam 139
+sched_getparam 140
+sched_setscheduler 141
+sched_getscheduler 142
+sched_get_priority_max 143
+sched_get_priority_min 144
+sched_rr_get_interval 145
+mlock 146
+munlock 147
+mlockall 148
+munlockall 149
+vhangup 150
+pivot_root 151
+_sysctl 152
+prctl 153
+adjtimex 154
+setrlimit 155
+chroot 156
+sync 157
+acct 158
+settimeofday 159
+mount 160
+umount2 161
+swapon 162
+swapoff 163
+reboot 164
+sethostname 165
+setdomainname 166
+create_module 167
+init_module 168
+delete_module 169
+get_kernel_syms 170
+query_module 171
+quotactl 172
+nfsservctl 173
+getpmsg 174
+putpmsg 175
+afs_syscall 176
+reserved177 177
+gettid 178
+readahead 179
+setxattr 180
+lsetxattr 181
+fsetxattr 182
+getxattr 183
+lgetxattr 184
+fgetxattr 185
+listxattr 186
+llistxattr 187
+flistxattr 188
+removexattr 189
+lremovexattr 190
+fremovexattr 191
+tkill 192
+reserved193 193
+futex 194
+sched_setaffinity 195
+sched_getaffinity 196
+cacheflush 197
+cachectl 198
+sysmips 199
+io_setup 200
+io_destroy 201
+io_getevents 202
+io_submit 203
+io_cancel 204
+exit_group 205
+lookup_dcookie 206
+epoll_create 207
+epoll_ctl 208
+epoll_wait 209
+remap_file_pages 210
+rt_sigreturn 211
+set_tid_address 212
+restart_syscall 213
+semtimedop 214
+fadvise64 215
+timer_create 216
+timer_settime 217
+timer_gettime 218
+timer_getoverrun 219
+timer_delete 220
+clock_settime 221
+clock_gettime 222
+clock_getres 223
+clock_nanosleep 224
+tgkill 225
+utimes 226
+mbind 227
+get_mempolicy 228
+set_mempolicy 229
+mq_open 230
+mq_unlink 231
+mq_timedsend 232
+mq_timedreceive 233
+mq_notify 234
+mq_getsetattr 235
+vserver 236
+waitid 237
+add_key 239
+request_key 240
+keyctl 241
+set_thread_area 242
+inotify_init 243
+inotify_add_watch 244
+inotify_rm_watch 245
+migrate_pages 246
+openat 247
+mkdirat 248
+mknodat 249
+fchownat 250
+futimesat 251
+newfstatat 252
+unlinkat 253
+renameat 254
+linkat 255
+symlinkat 256
+readlinkat 257
+fchmodat 258
+faccessat 259
+pselect6 260
+ppoll 261
+unshare 262
+splice 263
+sync_file_range 264
+tee 265
+vmsplice 266
+move_pages 267
+set_robust_list 268
+get_robust_list 269
+kexec_load 270
+getcpu 271
+epoll_pwait 272
+ioprio_set 273
+ioprio_get 274
+utimensat 275
+signalfd 276
+timerfd 277
+eventfd 278
+fallocate 279
+timerfd_create 280
+timerfd_gettime 281
+timerfd_settime 282
+signalfd4 283
+eventfd2 284
+epoll_create1 285
+dup3 286
+pipe2 287
+inotify_init1 288
+preadv 289
+pwritev 290
+rt_tgsigqueueinfo 291
+perf_event_open 292
+accept4 293
+recvmmsg 294
+fanotify_init 295
+fanotify_mark 296
+prlimit64 297
+name_to_handle_at 298
+open_by_handle_at 299
+clock_adjtime 300
+syncfs 301
+sendmmsg 302
+setns 303
+process_vm_readv 304
+process_vm_writev 305
+kcmp 306
+finit_module 307
+getdents64 308
+sched_setattr 309
+sched_getattr 310
+renameat2 311
+seccomp 312
+getrandom 313
+memfd_create 314
+bpf 315
+execveat 316
+userfaultfd 317
+membarrier 318
+mlock2 319
+copy_file_range 320
+preadv2 321
+pwritev2 322
+pkey_mprotect 323
+pkey_alloc 324
+pkey_free 325
+statx 326
+rseq 327
+io_pgetevents 328
+pidfd_send_signal 424
+io_uring_setup 425
+io_uring_enter 426
+io_uring_register 427
+open_tree 428
+move_mount 429
+fsopen 430
+fsconfig 431
+fsmount 432
+fspick 433
+pidfd_open 434
diff --git a/include/lapi/syscalls/mips_o32.in b/include/lapi/syscalls/mips_o32.in
index 238f77009..505bfd8db 100644
--- a/include/lapi/syscalls/mips_o32.in
+++ b/include/lapi/syscalls/mips_o32.in
@@ -1,417 +1,409 @@
-syscall 4000
-exit 4001
-fork 4002
-read 4003
-write 4004
-open 4005
-close 4006
-waitpid 4007
-creat 4008
-link 4009
-unlink 4010
-execve 4011
-chdir 4012
-time 4013
-mknod 4014
-chmod 4015
-lchown 4016
-break 4017
-unused18 4018
-lseek 4019
-getpid 4020
-mount 4021
-umount 4022
-setuid 4023
-getuid 4024
-stime 4025
-ptrace 4026
-alarm 4027
-unused28 4028
-pause 4029
-utime 4030
-stty 4031
-gtty 4032
-access 4033
-nice 4034
-ftime 4035
-sync 4036
-kill 4037
-rename 4038
-mkdir 4039
-rmdir 4040
-dup 4041
-pipe 4042
-times 4043
-prof 4044
-brk 4045
-setgid 4046
-getgid 4047
-signal 4048
-geteuid 4049
-getegid 4050
-acct 4051
-umount2 4052
-lock 4053
-ioctl 4054
-fcntl 4055
-mpx 4056
-setpgid 4057
-ulimit 4058
-unused59 4059
-umask 4060
-chroot 4061
-ustat 4062
-dup2 4063
-getppid 4064
-getpgrp 4065
-setsid 4066
-sigaction 4067
-sgetmask 4068
-ssetmask 4069
-setreuid 4070
-setregid 4071
-sigsuspend 4072
-sigpending 4073
-sethostname 4074
-setrlimit 4075
-getrlimit 4076
-getrusage 4077
-gettimeofday 4078
-settimeofday 4079
-getgroups 4080
-setgroups 4081
-reserved82 4082
-symlink 4083
-unused84 4084
-readlink 4085
-uselib 4086
-swapon 4087
-reboot 4088
-readdir 4089
-mmap 4090
-munmap 4091
-truncate 4092
-ftruncate 4093
-fchmod 4094
-fchown 4095
-getpriority 4096
-setpriority 4097
-profil 4098
-statfs 4099
-fstatfs 4100
-ioperm 4101
-socketcall 4102
-syslog 4103
-setitimer 4104
-getitimer 4105
-stat 4106
-lstat 4107
-fstat 4108
-unused109 4109
-iopl 4110
-vhangup 4111
-idle 4112
-vm86 4113
-wait4 4114
-swapoff 4115
-sysinfo 4116
-ipc 4117
-fsync 4118
-sigreturn 4119
-clone 4120
-setdomainname 4121
-uname 4122
-modify_ldt 4123
-adjtimex 4124
-mprotect 4125
-sigprocmask 4126
-create_module 4127
-init_module 4128
-delete_module 4129
-get_kernel_syms 4130
-quotactl 4131
-getpgid 4132
-fchdir 4133
-bdflush 4134
-sysfs 4135
-personality 4136
-afs_syscall 4137
-setfsuid 4138
-setfsgid 4139
-_llseek 4140
-getdents 4141
-_newselect 4142
-flock 4143
-msync 4144
-readv 4145
-writev 4146
-cacheflush 4147
-cachectl 4148
-sysmips 4149
-unused150 4150
-getsid 4151
-fdatasync 4152
-_sysctl 4153
-mlock 4154
-munlock 4155
-mlockall 4156
-munlockall 4157
-sched_setparam 4158
-sched_getparam 4159
-sched_setscheduler 4160
-sched_getscheduler 4161
-sched_yield 4162
-sched_get_priority_max 4163
-sched_get_priority_min 4164
-sched_rr_get_interval 4165
-nanosleep 4166
-mremap 4167
-accept 4168
-bind 4169
-connect 4170
-getpeername 4171
-getsockname 4172
-getsockopt 4173
-listen 4174
-recv 4175
-recvfrom 4176
-recvmsg 4177
-send 4178
-sendmsg 4179
-sendto 4180
-setsockopt 4181
-shutdown 4182
-socket 4183
-socketpair 4184
-setresuid 4185
-getresuid 4186
-query_module 4187
-poll 4188
-nfsservctl 4189
-setresgid 4190
-getresgid 4191
-prctl 4192
-rt_sigreturn 4193
-rt_sigaction 4194
-rt_sigprocmask 4195
-rt_sigpending 4196
-rt_sigtimedwait 4197
-rt_sigqueueinfo 4198
-rt_sigsuspend 4199
-pread64 4200
-pwrite64 4201
-chown 4202
-getcwd 4203
-capget 4204
-capset 4205
-sigaltstack 4206
-sendfile 4207
-getpmsg 4208
-putpmsg 4209
-mmap2 4210
-truncate64 4211
-ftruncate64 4212
-stat64 4213
-lstat64 4214
-fstat64 4215
-pivot_root 4216
-mincore 4217
-madvise 4218
-getdents64 4219
-fcntl64 4220
-reserved221 4221
-gettid 4222
-readahead 4223
-setxattr 4224
-lsetxattr 4225
-fsetxattr 4226
-getxattr 4227
-lgetxattr 4228
-fgetxattr 4229
-listxattr 4230
-llistxattr 4231
-flistxattr 4232
-removexattr 4233
-lremovexattr 4234
-fremovexattr 4235
-tkill 4236
-sendfile64 4237
-futex 4238
-sched_setaffinity 4239
-sched_getaffinity 4240
-io_setup 4241
-io_destroy 4242
-io_getevents 4243
-io_submit 4244
-io_cancel 4245
-exit_group 4246
-lookup_dcookie 4247
-epoll_create 4248
-epoll_ctl 4249
-epoll_wait 4250
-remap_file_pages 4251
-set_tid_address 4252
-restart_syscall 4253
-fadvise64 4254
-statfs64 4255
-fstatfs64 4256
-timer_create 4257
-timer_settime 4258
-timer_gettime 4259
-timer_getoverrun 4260
-timer_delete 4261
-clock_settime 4262
-clock_gettime 4263
-clock_getres 4264
-clock_nanosleep 4265
-tgkill 4266
-utimes 4267
-mbind 4268
-get_mempolicy 4269
-set_mempolicy 4270
-mq_open 4271
-mq_unlink 4272
-mq_timedsend 4273
-mq_timedreceive 4274
-mq_notify 4275
-mq_getsetattr 4276
-vserver 4277
-waitid 4278
-add_key 4280
-request_key 4281
-keyctl 4282
-set_thread_area 4283
-inotify_init 4284
-inotify_add_watch 4285
-inotify_rm_watch 4286
-migrate_pages 4287
-openat 4288
-mkdirat 4289
-mknodat 4290
-fchownat 4291
-futimesat 4292
-fstatat64 4293
-unlinkat 4294
-renameat 4295
-linkat 4296
-symlinkat 4297
-readlinkat 4298
-fchmodat 4299
-faccessat 4300
-pselect6 4301
-ppoll 4302
-unshare 4303
-splice 4304
-sync_file_range 4305
-tee 4306
-vmsplice 4307
-move_pages 4308
-set_robust_list 4309
-get_robust_list 4310
-kexec_load 4311
-getcpu 4312
-epoll_pwait 4313
-ioprio_set 4314
-ioprio_get 4315
-utimensat 4316
-signalfd 4317
-timerfd 4318
-eventfd 4319
-fallocate 4320
-timerfd_create 4321
-timerfd_gettime 4322
-timerfd_settime 4323
-signalfd4 4324
-eventfd2 4325
-epoll_create1 4326
-dup3 4327
-pipe2 4328
-inotify_init1 4329
-preadv 4330
-pwritev 4331
-rt_tgsigqueueinfo 4332
-perf_event_open 4333
-accept4 4334
-recvmmsg 4335
-fanotify_init 4336
-fanotify_mark 4337
-prlimit64 4338
-name_to_handle_at 4339
-open_by_handle_at 4340
-clock_adjtime 4341
-syncfs 4342
-sendmmsg 4343
-setns 4344
-process_vm_readv 4345
-process_vm_writev 4346
-kcmp 4347
-finit_module 4348
-sched_setattr 4349
-sched_getattr 4350
-renameat2 4351
-seccomp 4352
-getrandom 4353
-memfd_create 4354
-bpf 4355
-execveat 4356
-userfaultfd 4357
-membarrier 4358
-mlock2 4359
-copy_file_range 4360
-preadv2 4361
-pwritev2 4362
-pkey_mprotect 4363
-pkey_alloc 4364
-pkey_free 4365
-statx 4366
-rseq 4367
-io_pgetevents 4368
-semget 4393
-semctl 4394
-shmget 4395
-shmctl 4396
-shmat 4397
-shmdt 4398
-msgget 4399
-msgsnd 4400
-msgrcv 4401
-msgctl 4402
-clock_gettime64 4403
-clock_settime64 4404
-clock_adjtime64 4405
-clock_getres_time64 4406
-clock_nanosleep_time64 4407
-timer_gettime64 4408
-timer_settime64 4409
-timerfd_gettime64 4410
-timerfd_settime64 4411
-utimensat_time64 4412
-pselect6_time64 4413
-ppoll_time64 4414
-io_pgetevents_time64 4416
-recvmmsg_time64 4417
-mq_timedsend_time64 4418
-mq_timedreceive_time64 4419
-semtimedop_time64 4420
-rt_sigtimedwait_time64 4421
-futex_time64 4422
-sched_rr_get_interval_time64 4423
-pidfd_send_signal 4424
-io_uring_setup 4425
-io_uring_enter 4426
-io_uring_register 4427
-open_tree 4428
-move_mount 4429
-fsopen 4430
-fsconfig 4431
-fsmount 4432
-fspick 4433
-pidfd_open 4434
-clone3 4435
-close_range 4436
-openat2 4437
-pidfd_getfd 4438
-faccessat2 4439
-process_madvise 4440
-epoll_pwait2 4441
-mount_setattr 4442
+syscall 0
+exit 1
+fork 2
+read 3
+write 4
+open 5
+close 6
+waitpid 7
+creat 8
+link 9
+unlink 10
+execve 11
+chdir 12
+time 13
+mknod 14
+chmod 15
+lchown 16
+break 17
+unused18 18
+lseek 19
+getpid 20
+mount 21
+umount 22
+setuid 23
+getuid 24
+stime 25
+ptrace 26
+alarm 27
+unused28 28
+pause 29
+utime 30
+stty 31
+gtty 32
+access 33
+nice 34
+ftime 35
+sync 36
+kill 37
+rename 38
+mkdir 39
+rmdir 40
+dup 41
+pipe 42
+times 43
+prof 44
+brk 45
+setgid 46
+getgid 47
+signal 48
+geteuid 49
+getegid 50
+acct 51
+umount2 52
+lock 53
+ioctl 54
+fcntl 55
+mpx 56
+setpgid 57
+ulimit 58
+unused59 59
+umask 60
+chroot 61
+ustat 62
+dup2 63
+getppid 64
+getpgrp 65
+setsid 66
+sigaction 67
+sgetmask 68
+ssetmask 69
+setreuid 70
+setregid 71
+sigsuspend 72
+sigpending 73
+sethostname 74
+setrlimit 75
+getrlimit 76
+getrusage 77
+gettimeofday 78
+settimeofday 79
+getgroups 80
+setgroups 81
+reserved82 82
+symlink 83
+unused84 84
+readlink 85
+uselib 86
+swapon 87
+reboot 88
+readdir 89
+mmap 90
+munmap 91
+truncate 92
+ftruncate 93
+fchmod 94
+fchown 95
+getpriority 96
+setpriority 97
+profil 98
+statfs 99
+fstatfs 100
+ioperm 101
+socketcall 102
+syslog 103
+setitimer 104
+getitimer 105
+stat 106
+lstat 107
+fstat 108
+unused109 109
+iopl 110
+vhangup 111
+idle 112
+vm86 113
+wait4 114
+swapoff 115
+sysinfo 116
+ipc 117
+fsync 118
+sigreturn 119
+clone 120
+setdomainname 121
+uname 122
+modify_ldt 123
+adjtimex 124
+mprotect 125
+sigprocmask 126
+create_module 127
+init_module 128
+delete_module 129
+get_kernel_syms 130
+quotactl 131
+getpgid 132
+fchdir 133
+bdflush 134
+sysfs 135
+personality 136
+afs_syscall 137
+setfsuid 138
+setfsgid 139
+_llseek 140
+getdents 141
+_newselect 142
+flock 143
+msync 144
+readv 145
+writev 146
+cacheflush 147
+cachectl 148
+sysmips 149
+unused150 150
+getsid 151
+fdatasync 152
+_sysctl 153
+mlock 154
+munlock 155
+mlockall 156
+munlockall 157
+sched_setparam 158
+sched_getparam 159
+sched_setscheduler 160
+sched_getscheduler 161
+sched_yield 162
+sched_get_priority_max 163
+sched_get_priority_min 164
+sched_rr_get_interval 165
+nanosleep 166
+mremap 167
+accept 168
+bind 169
+connect 170
+getpeername 171
+getsockname 172
+getsockopt 173
+listen 174
+recv 175
+recvfrom 176
+recvmsg 177
+send 178
+sendmsg 179
+sendto 180
+setsockopt 181
+shutdown 182
+socket 183
+socketpair 184
+setresuid 185
+getresuid 186
+query_module 187
+poll 188
+nfsservctl 189
+setresgid 190
+getresgid 191
+prctl 192
+rt_sigreturn 193
+rt_sigaction 194
+rt_sigprocmask 195
+rt_sigpending 196
+rt_sigtimedwait 197
+rt_sigqueueinfo 198
+rt_sigsuspend 199
+pread64 200
+pwrite64 201
+chown 202
+getcwd 203
+capget 204
+capset 205
+sigaltstack 206
+sendfile 207
+getpmsg 208
+putpmsg 209
+mmap2 210
+truncate64 211
+ftruncate64 212
+stat64 213
+lstat64 214
+fstat64 215
+pivot_root 216
+mincore 217
+madvise 218
+getdents64 219
+fcntl64 220
+reserved221 221
+gettid 222
+readahead 223
+setxattr 224
+lsetxattr 225
+fsetxattr 226
+getxattr 227
+lgetxattr 228
+fgetxattr 229
+listxattr 230
+llistxattr 231
+flistxattr 232
+removexattr 233
+lremovexattr 234
+fremovexattr 235
+tkill 236
+sendfile64 237
+futex 238
+sched_setaffinity 239
+sched_getaffinity 240
+io_setup 241
+io_destroy 242
+io_getevents 243
+io_submit 244
+io_cancel 245
+exit_group 246
+lookup_dcookie 247
+epoll_create 248
+epoll_ctl 249
+epoll_wait 250
+remap_file_pages 251
+set_tid_address 252
+restart_syscall 253
+fadvise64 254
+statfs64 255
+fstatfs64 256
+timer_create 257
+timer_settime 258
+timer_gettime 259
+timer_getoverrun 260
+timer_delete 261
+clock_settime 262
+clock_gettime 263
+clock_getres 264
+clock_nanosleep 265
+tgkill 266
+utimes 267
+mbind 268
+get_mempolicy 269
+set_mempolicy 270
+mq_open 271
+mq_unlink 272
+mq_timedsend 273
+mq_timedreceive 274
+mq_notify 275
+mq_getsetattr 276
+vserver 277
+waitid 278
+add_key 280
+request_key 281
+keyctl 282
+set_thread_area 283
+inotify_init 284
+inotify_add_watch 285
+inotify_rm_watch 286
+migrate_pages 287
+openat 288
+mkdirat 289
+mknodat 290
+fchownat 291
+futimesat 292
+fstatat64 293
+unlinkat 294
+renameat 295
+linkat 296
+symlinkat 297
+readlinkat 298
+fchmodat 299
+faccessat 300
+pselect6 301
+ppoll 302
+unshare 303
+splice 304
+sync_file_range 305
+tee 306
+vmsplice 307
+move_pages 308
+set_robust_list 309
+get_robust_list 310
+kexec_load 311
+getcpu 312
+epoll_pwait 313
+ioprio_set 314
+ioprio_get 315
+utimensat 316
+signalfd 317
+timerfd 318
+eventfd 319
+fallocate 320
+timerfd_create 321
+timerfd_gettime 322
+timerfd_settime 323
+signalfd4 324
+eventfd2 325
+epoll_create1 326
+dup3 327
+pipe2 328
+inotify_init1 329
+preadv 330
+pwritev 331
+rt_tgsigqueueinfo 332
+perf_event_open 333
+accept4 334
+recvmmsg 335
+fanotify_init 336
+fanotify_mark 337
+prlimit64 338
+name_to_handle_at 339
+open_by_handle_at 340
+clock_adjtime 341
+syncfs 342
+sendmmsg 343
+setns 344
+process_vm_readv 345
+process_vm_writev 346
+kcmp 347
+finit_module 348
+sched_setattr 349
+sched_getattr 350
+renameat2 351
+seccomp 352
+getrandom 353
+memfd_create 354
+bpf 355
+execveat 356
+userfaultfd 357
+membarrier 358
+mlock2 359
+copy_file_range 360
+preadv2 361
+pwritev2 362
+pkey_mprotect 363
+pkey_alloc 364
+pkey_free 365
+statx 366
+rseq 367
+io_pgetevents 368
+semget 393
+semctl 394
+shmget 395
+shmctl 396
+shmat 397
+shmdt 398
+msgget 399
+msgsnd 400
+msgrcv 401
+msgctl 402
+clock_gettime64 403
+clock_settime64 404
+clock_adjtime64 405
+clock_getres_time64 406
+clock_nanosleep_time64 407
+timer_gettime64 408
+timer_settime64 409
+timerfd_gettime64 410
+timerfd_settime64 411
+utimensat_time64 412
+pselect6_time64 413
+ppoll_time64 414
+io_pgetevents_time64 416
+recvmmsg_time64 417
+mq_timedsend_time64 418
+mq_timedreceive_time64 419
+semtimedop_time64 420
+rt_sigtimedwait_time64 421
+futex_time64 422
+sched_rr_get_interval_time64 423
+pidfd_send_signal 424
+io_uring_setup 425
+io_uring_enter 426
+io_uring_register 427
+open_tree 428
+move_mount 429
+fsopen 430
+fsconfig 431
+fsmount 432
+fspick 433
+pidfd_open 434
diff --git a/include/lapi/syscalls/order b/include/lapi/syscalls/order
index 548097681..62352c7a8 100644
--- a/include/lapi/syscalls/order
+++ b/include/lapi/syscalls/order
@@ -1,5 +1,4 @@
aarch64
-arc
arm
hppa
i386
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index 2d287a606..91467f326 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -125,7 +125,6 @@ modify_ldt 123
adjtimex 124
mprotect 125
sigprocmask 126
-create_module 127
init_module 128
delete_module 129
get_kernel_syms 130
@@ -138,9 +137,7 @@ personality 136
afs_syscall 137
setfsuid 138
setfsgid 139
-_llseek 140
getdents 141
-_newselect 142
flock 143
msync 144
readv 145
@@ -164,7 +161,6 @@ nanosleep 162
mremap 163
setresuid 164
getresuid 165
-query_module 166
poll 167
nfsservctl 168
setresgid 169
@@ -342,81 +338,25 @@ sendmsg 341
recvmsg 342
recvmmsg 343
accept4 344
-name_to_handle_at 345
-open_by_handle_at 346
-clock_adjtime 347
+syscalls 345
syncfs 348
-sendmmsg 349
-setns 350
-process_vm_readv 351
+process_vm_readv 351
process_vm_writev 352
-finit_module 353
kcmp 354
sched_setattr 355
sched_getattr 356
renameat2 357
-seccomp 358
getrandom 359
memfd_create 360
-bpf 361
-execveat 362
-switch_endian 363
userfaultfd 364
membarrier 365
+execveat 362
mlock2 378
copy_file_range 379
preadv2 380
pwritev2 381
-kexec_file_load 382
statx 383
+pidfd_send_signal 424
+pkey_mprotect 386
pkey_alloc 384
pkey_free 385
-pkey_mprotect 386
-rseq 387
-io_pgetevents 388
-semtimedop 392
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
-pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index 2d287a606..91467f326 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -125,7 +125,6 @@ modify_ldt 123
adjtimex 124
mprotect 125
sigprocmask 126
-create_module 127
init_module 128
delete_module 129
get_kernel_syms 130
@@ -138,9 +137,7 @@ personality 136
afs_syscall 137
setfsuid 138
setfsgid 139
-_llseek 140
getdents 141
-_newselect 142
flock 143
msync 144
readv 145
@@ -164,7 +161,6 @@ nanosleep 162
mremap 163
setresuid 164
getresuid 165
-query_module 166
poll 167
nfsservctl 168
setresgid 169
@@ -342,81 +338,25 @@ sendmsg 341
recvmsg 342
recvmmsg 343
accept4 344
-name_to_handle_at 345
-open_by_handle_at 346
-clock_adjtime 347
+syscalls 345
syncfs 348
-sendmmsg 349
-setns 350
-process_vm_readv 351
+process_vm_readv 351
process_vm_writev 352
-finit_module 353
kcmp 354
sched_setattr 355
sched_getattr 356
renameat2 357
-seccomp 358
getrandom 359
memfd_create 360
-bpf 361
-execveat 362
-switch_endian 363
userfaultfd 364
membarrier 365
+execveat 362
mlock2 378
copy_file_range 379
preadv2 380
pwritev2 381
-kexec_file_load 382
statx 383
+pidfd_send_signal 424
+pkey_mprotect 386
pkey_alloc 384
pkey_free 385
-pkey_mprotect 386
-rseq 387
-io_pgetevents 388
-semtimedop 392
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
-pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in
index c978b6660..dcf0a7148 100644
--- a/include/lapi/syscalls/s390.in
+++ b/include/lapi/syscalls/s390.in
@@ -10,17 +10,12 @@ link 9
unlink 10
execve 11
chdir 12
-time 13
mknod 14
chmod 15
-lchown 16
lseek 19
getpid 20
mount 21
umount 22
-setuid 23
-getuid 24
-stime 25
ptrace 26
alarm 27
pause 29
@@ -36,11 +31,7 @@ dup 41
pipe 42
times 43
brk 45
-setgid 46
-getgid 47
signal 48
-geteuid 49
-getegid 50
acct 51
umount2 52
ioctl 54
@@ -54,18 +45,13 @@ getppid 64
getpgrp 65
setsid 66
sigaction 67
-setreuid 70
-setregid 71
sigsuspend 72
sigpending 73
sethostname 74
setrlimit 75
-getrlimit 76
getrusage 77
gettimeofday 78
settimeofday 79
-getgroups 80
-setgroups 81
symlink 83
readlink 85
uselib 86
@@ -77,12 +63,10 @@ munmap 91
truncate 92
ftruncate 93
fchmod 94
-fchown 95
getpriority 96
setpriority 97
statfs 99
fstatfs 100
-ioperm 101
socketcall 102
syslog 103
setitimer 104
@@ -105,7 +89,6 @@ uname 122
adjtimex 124
mprotect 125
sigprocmask 126
-create_module 127
init_module 128
delete_module 129
get_kernel_syms 130
@@ -116,11 +99,7 @@ bdflush 134
sysfs 135
personality 136
afs_syscall 137
-setfsuid 138
-setfsgid 139
-_llseek 140
getdents 141
-_newselect 142
flock 143
msync 144
readv 145
@@ -142,13 +121,8 @@ sched_get_priority_min 160
sched_rr_get_interval 161
nanosleep 162
mremap 163
-setresuid 164
-getresuid 165
-query_module 167
poll 168
nfsservctl 169
-setresgid 170
-getresgid 171
prctl 172
rt_sigreturn 173
rt_sigaction 174
@@ -159,7 +133,6 @@ rt_sigqueueinfo 178
rt_sigsuspend 179
pread64 180
pwrite64 181
-chown 182
getcwd 183
capget 184
capset 185
@@ -168,39 +141,11 @@ sendfile 187
getpmsg 188
putpmsg 189
vfork 190
-ugetrlimit 191
-mmap2 192
-truncate64 193
-ftruncate64 194
-stat64 195
-lstat64 196
-fstat64 197
-lchown32 198
-getuid32 199
-getgid32 200
-geteuid32 201
-getegid32 202
-setreuid32 203
-setregid32 204
-getgroups32 205
-setgroups32 206
-fchown32 207
-setresuid32 208
-getresuid32 209
-setresgid32 210
-getresgid32 211
-chown32 212
-setuid32 213
-setgid32 214
-setfsuid32 215
-setfsgid32 216
pivot_root 217
mincore 218
madvise 219
getdents64 220
-fcntl64 221
readahead 222
-sendfile64 223
setxattr 224
lsetxattr 225
fsetxattr 226
@@ -231,21 +176,17 @@ epoll_wait 251
set_tid_address 252
fadvise64 253
timer_create 254
-timer_settime 255
-timer_gettime 256
-timer_getoverrun 257
-timer_delete 258
-clock_settime 259
-clock_gettime 260
-clock_getres 261
-clock_nanosleep 262
-fadvise64_64 264
+timer_settime (__NR_timer_create+1)
+timer_gettime (__NR_timer_create+2)
+timer_getoverrun (__NR_timer_create+3)
+timer_delete (__NR_timer_create+4)
+clock_settime (__NR_timer_create+5)
+clock_gettime (__NR_timer_create+6)
+clock_getres (__NR_timer_create+7)
+clock_nanosleep (__NR_timer_create+8)
statfs64 265
fstatfs64 266
remap_file_pages 267
-mbind 268
-get_mempolicy 269
-set_mempolicy 270
mq_open 271
mq_unlink 272
mq_timedsend 273
@@ -262,13 +203,11 @@ ioprio_get 283
inotify_init 284
inotify_add_watch 285
inotify_rm_watch 286
-migrate_pages 287
openat 288
mkdirat 289
mknodat 290
fchownat 291
futimesat 292
-fstatat64 293
unlinkat 294
renameat 295
linkat 296
@@ -285,7 +224,6 @@ splice 306
sync_file_range 307
tee 308
vmsplice 309
-move_pages 310
getcpu 311
epoll_pwait 312
utimes 313
@@ -310,100 +248,99 @@ perf_event_open 331
fanotify_init 332
fanotify_mark 333
prlimit64 334
-name_to_handle_at 335
-open_by_handle_at 336
-clock_adjtime 337
+time 13
+lchown 16
+setuid 23
+getuid 24
+stime 25
+setgid 46
+getgid 47
+geteuid 49
+getegid 50
+setreuid 70
+setregid 71
+getrlimit 76
+getgroups 80
+setgroups 81
+fchown 95
+ioperm 101
+setfsuid 138
+setfsgid 139
+setresuid 164
+getresuid 165
+setresgid 170
+getresgid 171
+chown 182
+ugetrlimit 191
+mmap2 192
+truncate64 193
+ftruncate64 194
+stat64 195
+lstat64 196
+fstat64 197
+lchown32 198
+getuid32 199
+getgid32 200
+geteuid32 201
+getegid32 202
+setreuid32 203
+setregid32 204
+getgroups32 205
+setgroups32 206
+fchown32 207
+setresuid32 208
+getresuid32 209
+setresgid32 210
+getresgid32 211
+chown32 212
+setuid32 213
+setgid32 214
+setfsuid32 215
+setfsgid32 216
+fcntl64 221
+sendfile64 223
+fadvise64_64 264
+fstatat64 293
+select 142
+getrlimit 191
+lchown 198
+getuid 199
+getgid 200
+geteuid 201
+getegid 202
+setreuid 203
+setregid 204
+getgroups 205
+setgroups 206
+fchown 207
+setresuid 208
+getresuid 209
+setresgid 210
+getresgid 211
+chown 212
+setuid 213
+setgid 214
+setfsuid 215
+setfsgid 216
+newfstatat 293
syncfs 338
-setns 339
process_vm_readv 340
process_vm_writev 341
-s390_runtime_instr 342
kcmp 343
-finit_module 344
sched_setattr 345
sched_getattr 346
renameat2 347
-seccomp 348
getrandom 349
memfd_create 350
bpf 351
-s390_pci_mmio_write 352
-s390_pci_mmio_read 353
-execveat 354
userfaultfd 355
membarrier 356
-recvmmsg 357
-sendmmsg 358
-socket 359
-socketpair 360
-bind 361
-connect 362
-listen 363
-accept4 364
-getsockopt 365
-setsockopt 366
-getsockname 367
-getpeername 368
-sendto 369
-sendmsg 370
-recvfrom 371
-recvmsg 372
-shutdown 373
+execveat 354
mlock2 374
copy_file_range 375
preadv2 376
pwritev2 377
-s390_guarded_storage 378
-statx 379
-s390_sthyi 380
-kexec_file_load 381
-io_pgetevents 382
-rseq 383
pkey_mprotect 384
pkey_alloc 385
pkey_free 386
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index d123db6cb..2dce00f90 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -89,7 +89,6 @@ uname 122
adjtimex 124
mprotect 125
sigprocmask 126
-create_module 127
init_module 128
delete_module 129
get_kernel_syms 130
@@ -101,7 +100,6 @@ sysfs 135
personality 136
afs_syscall 137
getdents 141
-select 142
flock 143
msync 144
readv 145
@@ -123,7 +121,6 @@ sched_get_priority_min 160
sched_rr_get_interval 161
nanosleep 162
mremap 163
-query_module 167
poll 168
nfsservctl 169
prctl 172
@@ -144,26 +141,6 @@ sendfile 187
getpmsg 188
putpmsg 189
vfork 190
-getrlimit 191
-lchown 198
-getuid 199
-getgid 200
-geteuid 201
-getegid 202
-setreuid 203
-setregid 204
-getgroups 205
-setgroups 206
-fchown 207
-setresuid 208
-getresuid 209
-setresgid 210
-getresgid 211
-chown 212
-setuid 213
-setgid 214
-setfsuid 215
-setfsgid 216
pivot_root 217
mincore 218
madvise 219
@@ -199,20 +176,17 @@ epoll_wait 251
set_tid_address 252
fadvise64 253
timer_create 254
-timer_settime 255
-timer_gettime 256
-timer_getoverrun 257
-timer_delete 258
-clock_settime 259
-clock_gettime 260
-clock_getres 261
-clock_nanosleep 262
+timer_settime (__NR_timer_create+1)
+timer_gettime (__NR_timer_create+2)
+timer_getoverrun (__NR_timer_create+3)
+timer_delete (__NR_timer_create+4)
+clock_settime (__NR_timer_create+5)
+clock_gettime (__NR_timer_create+6)
+clock_getres (__NR_timer_create+7)
+clock_nanosleep (__NR_timer_create+8)
statfs64 265
fstatfs64 266
remap_file_pages 267
-mbind 268
-get_mempolicy 269
-set_mempolicy 270
mq_open 271
mq_unlink 272
mq_timedsend 273
@@ -229,13 +203,11 @@ ioprio_get 283
inotify_init 284
inotify_add_watch 285
inotify_rm_watch 286
-migrate_pages 287
openat 288
mkdirat 289
mknodat 290
fchownat 291
futimesat 292
-newfstatat 293
unlinkat 294
renameat 295
linkat 296
@@ -252,7 +224,6 @@ splice 306
sync_file_range 307
tee 308
vmsplice 309
-move_pages 310
getcpu 311
epoll_pwait 312
utimes 313
@@ -277,81 +248,97 @@ perf_event_open 331
fanotify_init 332
fanotify_mark 333
prlimit64 334
-name_to_handle_at 335
-open_by_handle_at 336
-clock_adjtime 337
+time 13
+lchown 16
+setuid 23
+getuid 24
+stime 25
+setgid 46
+getgid 47
+geteuid 49
+getegid 50
+setreuid 70
+setregid 71
+getrlimit 191
+getgroups 80
+setgroups 81
+fchown 95
+ioperm 101
+setfsuid 138
+setfsgid 139
+setresuid 164
+getresuid 165
+setresgid 170
+getresgid 171
+chown 182
+mmap2 192
+truncate64 193
+ftruncate64 194
+stat64 195
+lstat64 196
+fstat64 197
+lchown32 198
+getuid32 199
+getgid32 200
+geteuid32 201
+getegid32 202
+setreuid32 203
+setregid32 204
+getgroups32 205
+setgroups32 206
+fchown32 207
+setresuid32 208
+getresuid32 209
+setresgid32 210
+getresgid32 211
+chown32 212
+setuid32 213
+setgid32 214
+setfsuid32 215
+setfsgid32 216
+fcntl64 221
+sendfile64 223
+fadvise64_64 264
+fstatat64 293
+select 142
+getrlimit 191
+lchown 198
+getuid 199
+getgid 200
+geteuid 201
+getegid 202
+setreuid 203
+setregid 204
+getgroups 205
+setgroups 206
+fchown 207
+setresuid 208
+getresuid 209
+setresgid 210
+getresgid 211
+chown 212
+setuid 213
+setgid 214
+setfsuid 215
+setfsgid 216
+newfstatat 293
syncfs 338
-setns 339
process_vm_readv 340
process_vm_writev 341
-s390_runtime_instr 342
kcmp 343
-finit_module 344
sched_setattr 345
sched_getattr 346
renameat2 347
-seccomp 348
getrandom 349
memfd_create 350
-bpf 351
-s390_pci_mmio_write 352
-s390_pci_mmio_read 353
-execveat 354
userfaultfd 355
membarrier 356
-recvmmsg 357
-sendmmsg 358
-socket 359
-socketpair 360
-bind 361
-connect 362
-listen 363
-accept4 364
-getsockopt 365
-setsockopt 366
-getsockname 367
-getpeername 368
-sendto 369
-sendmsg 370
-recvfrom 371
-recvmsg 372
-shutdown 373
+execveat 354
mlock2 374
copy_file_range 375
preadv2 376
pwritev2 377
-s390_guarded_storage 378
-statx 379
-s390_sthyi 380
-kexec_file_load 381
-io_pgetevents 382
-rseq 383
pkey_mprotect 384
pkey_alloc 385
pkey_free 386
-semtimedop 392
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index 22da7d6ff..996ebc956 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -15,6 +15,7 @@ time 13
mknod 14
chmod 15
lchown 16
+break 17
oldstat 18
lseek 19
getpid 20
@@ -28,8 +29,11 @@ alarm 27
oldfstat 28
pause 29
utime 30
+stty 31
+gtty 32
access 33
nice 34
+ftime 35
sync 36
kill 37
rename 38
@@ -38,6 +42,7 @@ rmdir 40
dup 41
pipe 42
times 43
+prof 44
brk 45
setgid 46
getgid 47
@@ -46,9 +51,13 @@ geteuid 49
getegid 50
acct 51
umount2 52
+lock 53
ioctl 54
fcntl 55
+mpx 56
setpgid 57
+ulimit 58
+oldolduname 59
umask 60
chroot 61
ustat 62
@@ -71,6 +80,7 @@ gettimeofday 78
settimeofday 79
getgroups 80
setgroups 81
+select 82
symlink 83
oldlstat 84
readlink 85
@@ -86,8 +96,10 @@ fchmod 94
fchown 95
getpriority 96
setpriority 97
+profil 98
statfs 99
fstatfs 100
+ioperm 101
socketcall 102
syslog 103
setitimer 104
@@ -96,7 +108,10 @@ stat 106
lstat 107
fstat 108
olduname 109
+iopl 110
vhangup 111
+idle 112
+vm86old 113
wait4 114
swapoff 115
sysinfo 116
@@ -112,17 +127,17 @@ mprotect 125
sigprocmask 126
init_module 128
delete_module 129
+get_kernel_syms 130
quotactl 131
getpgid 132
fchdir 133
bdflush 134
sysfs 135
personality 136
+afs_syscall 137
setfsuid 138
setfsgid 139
-_llseek 140
getdents 141
-_newselect 142
flock 143
msync 144
readv 145
@@ -146,6 +161,7 @@ nanosleep 162
mremap 163
setresuid 164
getresuid 165
+vm86 166
poll 168
nfsservctl 169
setresgid 170
@@ -166,6 +182,8 @@ capget 184
capset 185
sigaltstack 186
sendfile 187
+streams1 188
+streams2 189
vfork 190
ugetrlimit 191
mmap2 192
@@ -196,208 +214,160 @@ setfsgid32 216
pivot_root 217
mincore 218
madvise 219
-getdents64 220
-fcntl64 221
-gettid 224
-readahead 225
-setxattr 226
-lsetxattr 227
-fsetxattr 228
-getxattr 229
-lgetxattr 230
-fgetxattr 231
-listxattr 232
-llistxattr 233
-flistxattr 234
-removexattr 235
-lremovexattr 236
-fremovexattr 237
-tkill 238
-sendfile64 239
-futex 240
-sched_setaffinity 241
-sched_getaffinity 242
-io_setup 245
-io_destroy 246
-io_getevents 247
-io_submit 248
-io_cancel 249
-fadvise64 250
-exit_group 252
-lookup_dcookie 253
-epoll_create 254
-epoll_ctl 255
-epoll_wait 256
-remap_file_pages 257
-set_tid_address 258
-timer_create 259
-timer_settime 260
-timer_gettime 261
-timer_getoverrun 262
-timer_delete 263
-clock_settime 264
-clock_gettime 265
-clock_getres 266
-clock_nanosleep 267
-statfs64 268
-fstatfs64 269
-tgkill 270
-utimes 271
-fadvise64_64 272
-mbind 274
-get_mempolicy 275
-set_mempolicy 276
-mq_open 277
-mq_unlink 278
-mq_timedsend 279
-mq_timedreceive 280
-mq_notify 281
-mq_getsetattr 282
-kexec_load 283
-waitid 284
-add_key 285
-request_key 286
-keyctl 287
-ioprio_set 288
-ioprio_get 289
-inotify_init 290
-inotify_add_watch 291
-inotify_rm_watch 292
-migrate_pages 294
-openat 295
-mkdirat 296
-mknodat 297
-fchownat 298
-futimesat 299
-fstatat64 300
-unlinkat 301
-renameat 302
-linkat 303
-symlinkat 304
-readlinkat 305
-fchmodat 306
-faccessat 307
-pselect6 308
-ppoll 309
-unshare 310
-set_robust_list 311
-get_robust_list 312
-splice 313
-sync_file_range 314
-tee 315
-vmsplice 316
-move_pages 317
-getcpu 318
-epoll_pwait 319
-utimensat 320
-signalfd 321
-timerfd_create 322
-eventfd 323
-fallocate 324
-timerfd_settime 325
-timerfd_gettime 326
-signalfd4 327
-eventfd2 328
-epoll_create1 329
-dup3 330
-pipe2 331
-inotify_init1 332
-preadv 333
-pwritev 334
-rt_tgsigqueueinfo 335
-perf_event_open 336
-fanotify_init 337
-fanotify_mark 338
-prlimit64 339
-socket 340
-bind 341
-connect 342
-listen 343
-accept 344
-getsockname 345
-getpeername 346
-socketpair 347
-send 348
-sendto 349
-recv 350
-recvfrom 351
-shutdown 352
-setsockopt 353
-getsockopt 354
-sendmsg 355
-recvmsg 356
-recvmmsg 357
-accept4 358
-name_to_handle_at 359
-open_by_handle_at 360
-clock_adjtime 361
-syncfs 362
-sendmmsg 363
-setns 364
-process_vm_readv 365
-process_vm_writev 366
-kcmp 367
-finit_module 368
-sched_getattr 369
-sched_setattr 370
-renameat2 371
-seccomp 372
-getrandom 373
-memfd_create 374
-bpf 375
-execveat 376
-userfaultfd 377
-membarrier 378
-mlock2 379
-copy_file_range 380
-preadv2 381
-pwritev2 382
-statx 383
-pkey_mprotect 384
-pkey_alloc 385
-pkey_free 386
-rseq 387
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
+socket 220
+bind 221
+connect 222
+listen 223
+accept 224
+getsockname 225
+getpeername 226
+socketpair 227
+send 228
+sendto 229
+recv 230
+recvfrom 231
+shutdown 232
+setsockopt 233
+getsockopt 234
+sendmsg 235
+recvmsg 236
+semop 237
+semget 238
+semctl 239
+msgsnd 240
+msgrcv 241
+msgget 242
+msgctl 243
+shmatcall 244
+shmdt 245
+shmget 246
+shmctl 247
+getdents64 248
+fcntl64 249
+gettid 252
+readahead 253
+setxattr 254
+lsetxattr 255
+fsetxattr 256
+getxattr 257
+lgetxattr 258
+fgetxattr 269
+listxattr 260
+llistxattr 261
+flistxattr 262
+removexattr 263
+lremovexattr 264
+fremovexattr 265
+tkill 266
+sendfile64 267
+futex 268
+sched_setaffinity 269
+sched_getaffinity 270
+set_thread_area 271
+get_thread_area 272
+io_setup 273
+io_destroy 274
+io_getevents 275
+io_submit 276
+io_cancel 277
+fadvise64 278
+exit_group 280
+lookup_dcookie 281
+epoll_create 282
+epoll_ctl 283
+epoll_wait 284
+remap_file_pages 285
+set_tid_address 286
+timer_create 287
+timer_settime (__NR_timer_create+1)
+timer_gettime (__NR_timer_create+2)
+timer_getoverrun (__NR_timer_create+3)
+timer_delete (__NR_timer_create+4)
+clock_settime (__NR_timer_create+5)
+clock_gettime (__NR_timer_create+6)
+clock_getres (__NR_timer_create+7)
+clock_nanosleep (__NR_timer_create+8)
+statfs64 296
+fstatfs64 297
+tgkill 298
+utimes 299
+fadvise64_64 300
+vserver 301
+mbind 302
+get_mempolicy 303
+set_mempolicy 304
+mq_open 305
+mq_unlink (__NR_mq_open+1)
+mq_timedsend (__NR_mq_open+2)
+mq_timedreceive (__NR_mq_open+3)
+mq_notify (__NR_mq_open+4)
+mq_getsetattr (__NR_mq_open+5)
+kexec_load 311
+waitid 312
+add_key 313
+request_key 314
+keyctl 315
+ioprio_set 316
+ioprio_get 317
+inotify_init 318
+inotify_add_watch 319
+inotify_rm_watch 320
+migrate_pages 322
+openat 323
+mkdirat 324
+mknodat 325
+fchownat 326
+futimesat 327
+fstatat64 328
+unlinkat 329
+renameat 330
+linkat 331
+symlinkat 332
+readlinkat 333
+fchmodat 334
+faccessat 335
+pselect6 336
+ppoll 337
+unshare 338
+set_robust_list 339
+get_robust_list 340
+splice 341
+sync_file_range 342
+tee 343
+vmsplice 344
+move_pages 345
+getcpu 346
+epoll_pwait 347
+utimensat 348
+signalfd 349
+timerfd_create 350
+eventfd 351
+fallocate 352
+timerfd_settime 353
+timerfd_gettime 354
+signalfd4 355
+eventfd2 356
+epoll_create1 357
+dup3 358
+pipe2 359
+inotify_init1 360
+preadv 361
+pwritev 362
+rt_tgsigqueueinfo 363
+perf_event_open 364
+recvmmsg 365
+accept4 366
+fanotify_init 367
+fanotify_mark 368
+prlimit64 369
+syncfs 373
+process_vm_readv 376
+process_vm_writev 377
+kcmp 378
+memfd_create 385
+execveat 387
+mlock2 390
+copy_file_range 391
+preadv2 392
+pwritev2 393
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index 7324b4ac6..65902e00a 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -51,6 +51,7 @@ geteuid 49
getegid 50
acct 51
getgid32 53
+memory_ordering 52
ioctl 54
reboot 55
mmap2 56
@@ -110,6 +111,10 @@ getresuid32 109
setresgid32 110
getresgid32 111
setregid32 112
+setresuid 108
+getresuid 109
+setresgid 110
+getresgid 111
recvmsg 113
sendmsg 114
getgroups32 115
@@ -161,6 +166,7 @@ sched_set_affinity 160
sched_get_affinity 161
getdomainname 162
setdomainname 163
+utrap_install 164
quotactl 165
set_tid_address 166
mount 167
@@ -180,7 +186,6 @@ flistxattr 180
removexattr 181
lremovexattr 182
sigpending 183
-query_module 184
setpgid 185
fremovexattr 186
tkill 187
@@ -217,7 +222,6 @@ clone 217
ioprio_get 218
adjtimex 219
sigprocmask 220
-create_module 221
delete_module 222
get_kernel_syms 223
getpgid 224
@@ -226,13 +230,12 @@ sysfs 226
afs_syscall 227
setfsuid 228
setfsgid 229
-_newselect 230
+time 231
time 231
splice 232
stime 233
statfs64 234
fstatfs64 235
-_llseek 236
mlock 237
munlock 238
mlockall 239
@@ -263,7 +266,6 @@ timer_gettime 263
timer_getoverrun 264
timer_delete 265
timer_create 266
-vserver 267
io_setup 268
io_destroy 269
io_submit 270
@@ -328,81 +330,22 @@ recvmmsg 328
fanotify_init 329
fanotify_mark 330
prlimit64 331
-name_to_handle_at 332
-open_by_handle_at 333
-clock_adjtime 334
syncfs 335
-sendmmsg 336
-setns 337
process_vm_readv 338
process_vm_writev 339
-kern_features 340
kcmp 341
-finit_module 342
-sched_setattr 343
-sched_getattr 344
renameat2 345
-seccomp 346
getrandom 347
memfd_create 348
bpf 349
-execveat 350
membarrier 351
userfaultfd 352
-bind 353
-listen 354
-setsockopt 355
+execveat 350
mlock2 356
copy_file_range 357
preadv2 358
pwritev2 359
-statx 360
-io_pgetevents 361
pkey_mprotect 362
pkey_alloc 363
pkey_free 364
-rseq 365
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index 862d806fa..d303622b4 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -29,8 +29,6 @@ alarm 27
sigaltstack 28
pause 29
utime 30
-lchown32 31
-fchown32 32
access 33
nice 34
sync 36
@@ -51,6 +49,7 @@ acct 51
memory_ordering 52
ioctl 54
reboot 55
+mmap2 56
symlink 57
readlink 58
execve 59
@@ -165,7 +164,6 @@ flistxattr 180
removexattr 181
lremovexattr 182
sigpending 183
-query_module 184
setpgid 185
fremovexattr 186
tkill 187
@@ -202,7 +200,6 @@ clone 217
ioprio_get 218
adjtimex 219
sigprocmask 220
-create_module 221
delete_module 222
get_kernel_syms 223
getpgid 224
@@ -211,12 +208,10 @@ sysfs 226
afs_syscall 227
setfsuid 228
setfsgid 229
-_newselect 230
splice 232
stime 233
statfs64 234
fstatfs64 235
-_llseek 236
mlock 237
munlock 238
mlockall 239
@@ -247,7 +242,6 @@ timer_gettime 263
timer_getoverrun 264
timer_delete 265
timer_create 266
-vserver 267
io_setup 268
io_destroy 269
io_submit 270
@@ -312,62 +306,21 @@ recvmmsg 328
fanotify_init 329
fanotify_mark 330
prlimit64 331
-name_to_handle_at 332
-open_by_handle_at 333
-clock_adjtime 334
syncfs 335
-sendmmsg 336
-setns 337
process_vm_readv 338
process_vm_writev 339
-kern_features 340
kcmp 341
-finit_module 342
-sched_setattr 343
-sched_getattr 344
renameat2 345
-seccomp 346
getrandom 347
memfd_create 348
-bpf 349
-execveat 350
membarrier 351
userfaultfd 352
-bind 353
-listen 354
-setsockopt 355
+execveat 350
mlock2 356
copy_file_range 357
preadv2 358
pwritev2 359
-statx 360
-io_pgetevents 361
pkey_mprotect 362
pkey_alloc 363
pkey_free 364
-rseq 365
-semtimedop 392
-semget 393
-semctl 394
-shmget 395
-shmctl 396
-shmat 397
-shmdt 398
-msgget 399
-msgsnd 400
-msgrcv 401
-msgctl 402
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-close_range 436
-openat2 437
-pidfd_getfd 438
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index 1345002f5..3e9e19ae6 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -172,11 +172,9 @@ sethostname 170
setdomainname 171
iopl 172
ioperm 173
-create_module 174
init_module 175
delete_module 176
get_kernel_syms 177
-query_module 178
quotactl 179
nfsservctl 180
getpmsg 181
@@ -301,24 +299,15 @@ recvmmsg 299
fanotify_init 300
fanotify_mark 301
prlimit64 302
-name_to_handle_at 303
-open_by_handle_at 304
-clock_adjtime 305
syncfs 306
-sendmmsg 307
-setns 308
-getcpu 309
process_vm_readv 310
process_vm_writev 311
kcmp 312
-finit_module 313
sched_setattr 314
sched_getattr 315
renameat2 316
-seccomp 317
getrandom 318
memfd_create 319
-kexec_file_load 320
bpf 321
execveat 322
userfaultfd 323
@@ -331,56 +320,4 @@ pkey_mprotect 329
pkey_alloc 330
pkey_free 331
statx 332
-io_pgetevents 333
-rseq 334
pidfd_send_signal 424
-io_uring_setup 425
-io_uring_enter 426
-io_uring_register 427
-open_tree 428
-move_mount 429
-fsopen 430
-fsconfig 431
-fsmount 432
-fspick 433
-pidfd_open 434
-clone3 435
-close_range 436
-openat2 437
-pidfd_getfd 438
-rt_sigaction 512
-rt_sigreturn 513
-ioctl 514
-readv 515
-writev 516
-recvfrom 517
-sendmsg 518
-recvmsg 519
-execve 520
-ptrace 521
-rt_sigpending 522
-rt_sigtimedwait 523
-rt_sigqueueinfo 524
-sigaltstack 525
-timer_create 526
-mq_notify 527
-kexec_load 528
-waitid 529
-set_robust_list 530
-get_robust_list 531
-vmsplice 532
-move_pages 533
-preadv 534
-pwritev 535
-rt_tgsigqueueinfo 536
-recvmmsg 537
-sendmmsg 538
-process_vm_readv 539
-process_vm_writev 540
-setsockopt 541
-getsockopt 542
-io_setup 543
-io_submit 544
-execveat 545
-preadv2 546
-pwritev2 547
diff --git a/include/lapi/tcp.h b/include/lapi/tcp.h
index bb98f28f0..ebb0d79b2 100644
--- a/include/lapi/tcp.h
+++ b/include/lapi/tcp.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAPI_TCP_H__
diff --git a/include/lapi/tee.h b/include/lapi/tee.h
index 237f4e1e0..1d9819581 100644
--- a/include/lapi/tee.h
+++ b/include/lapi/tee.h
@@ -1,7 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2007
* Copyright (c) 2014 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef TEE_H
@@ -11,8 +24,7 @@
#include "lapi/syscalls.h"
#if !defined(HAVE_TEE)
-static inline ssize_t tee(int fd_in, int fd_out,
- size_t len, unsigned int flags)
+ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags)
{
return tst_syscall(__NR_tee, fd_in, fd_out, len, flags);
}
diff --git a/include/lapi/termbits.h b/include/lapi/termbits.h
index d79da085b..23ad5a7d8 100644
--- a/include/lapi/termbits.h
+++ b/include/lapi/termbits.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2018 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation
*/
#ifndef LAPI_TERMBITS_H__
diff --git a/include/lapi/timerfd.h b/include/lapi/timerfd.h
index 91773ff72..467cd15c1 100644
--- a/include/lapi/timerfd.h
+++ b/include/lapi/timerfd.h
@@ -1,7 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2007
* Copyright (c) 2014 Fujitsu Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef TIMERFD_H
@@ -16,16 +27,15 @@
#endif
#if !defined(HAVE_TIMERFD_CREATE)
-static inline int timerfd_create(int clockid, int flags)
+int timerfd_create(int clockid, int flags)
{
return ltp_syscall(__NR_timerfd_create, clockid, flags);
}
#endif
#if !defined(HAVE_TIMERFD_GETTIME)
-static inline int timerfd_settime(int fd, int flags,
- const struct itimerspec *new_value,
- struct itimerspec *old_value)
+int timerfd_settime(int fd, int flags, const struct itimerspec *new_value,
+ struct itimerspec *old_value)
{
return ltp_syscall(__NR_timerfd_settime, fd, flags, new_value,
old_value);
@@ -33,7 +43,7 @@ static inline int timerfd_settime(int fd, int flags,
#endif
#if !defined(HAVE_TIMERFD_SETTIME)
-static inline int timerfd_gettime(int fd, struct itimerspec *curr_value)
+int timerfd_gettime(int fd, struct itimerspec *curr_value)
{
return ltp_syscall(__NR_timerfd_gettime, fd, curr_value);
}
diff --git a/include/lapi/tty.h b/include/lapi/tty.h
deleted file mode 100644
index 6122145f3..000000000
--- a/include/lapi/tty.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#ifndef LAPI_TTY_H
-#define LAPI_TTY_H
-
-#ifdef HAVE_LINUX_TTY_H
-# include <linux/tty.h>
-#endif
-
-#ifndef N_HDLC
-# define N_HDLC 13
-#endif
-
-#ifndef N_SLCAN
-# define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
-#endif
-
-#endif /* LAPI_TTY_H */
diff --git a/include/lapi/udp.h b/include/lapi/udp.h
index 5c73dd369..b6f50f8f9 100644
--- a/include/lapi/udp.h
+++ b/include/lapi/udp.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2018 Oracle and/or its affiliates.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LAPI_UDP_H__
diff --git a/include/lapi/utime.h b/include/lapi/utime.h
index dbfaa55be..4209d4cfb 100644
--- a/include/lapi/utime.h
+++ b/include/lapi/utime.h
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __UTIME_H__
diff --git a/include/lapi/vmsplice.h b/include/lapi/vmsplice.h
index 96b32f3fa..d8b710fdd 100644
--- a/include/lapi/vmsplice.h
+++ b/include/lapi/vmsplice.h
@@ -1,7 +1,21 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2007
* Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
*/
#ifndef VMSPLICE_H
@@ -13,8 +27,8 @@
#include "lapi/iovec.h"
#if !defined(HAVE_VMSPLICE)
-static inline ssize_t vmsplice(int fd, const struct iovec *iov,
- unsigned long nr_segs, unsigned int flags)
+ssize_t vmsplice(int fd, const struct iovec *iov,
+ unsigned long nr_segs, unsigned int flags)
{
return tst_syscall(__NR_vmsplice, fd, iov, nr_segs, flags);
}
diff --git a/include/lapi/xfrm.h b/include/lapi/xfrm.h
index d9051202c..45236b29f 100644
--- a/include/lapi/xfrm.h
+++ b/include/lapi/xfrm.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2018 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation
*/
#ifndef LAPI_XFRM_H__
diff --git a/include/libsigwait.h b/include/libsigwait.h
deleted file mode 100644
index 2fca578b1..000000000
--- a/include/libsigwait.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef SIGWAIT_H__
-#define SIGWAIT_H__
-
-#include "tst_test.h"
-#include "tst_timer.h"
-#include <signal.h>
-
-/* swi: sigwaitinfo() */
-typedef int (*swi_func) (const sigset_t * set, siginfo_t * info,
- void * timeout);
-typedef void (*test_func) (swi_func, int, enum tst_ts_type type);
-
-struct sigwait_test_desc {
- test_func tf;
- int signo;
-};
-
-void test_empty_set(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_timeout(swi_func sigwaitinfo, int signo, enum tst_ts_type type);
-void test_unmasked_matching(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_unmasked_matching_noinfo(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_masked_matching(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_masked_matching_rt(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_masked_matching_noinfo(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_bad_address(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void test_bad_address3(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
-void sigwait_setup(void);
-#endif /* SIGWAIT_H__ */
diff --git a/include/libswap.h b/include/libswap.h
deleted file mode 100644
index d4b5301a5..000000000
--- a/include/libswap.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
- * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
- */
-
-/*
- * Contains common content for all swapon/swapoff tests
- */
-
-#ifndef __LIBSWAP_H__
-#define __LIBSWAP_H__
-
-/*
- * Make a swap file
- */
-int make_swapfile(const char *swapfile, int safe);
-
-/*
- * Check swapon/swapoff support status of filesystems or files
- * we are testing on.
- */
-void is_swap_supported(const char *filename);
-#endif /* __LIBSWAP_H__ */
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index 218447ef3..0bc59887a 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -31,18 +31,10 @@ RANLIB := @RANLIB@
STRIP := @STRIP@
YACC := @YACC@
-HOSTCC = @HOSTCC@
-build := @build@
-host := @host@
-ifeq ($(strip $(HOSTCC)),)
-# native build, respect CC
-ifeq ($(build),$(host))
-HOSTCC := $(CC)
-else
-# cross compilation
-HOSTCC := cc
-endif
-endif
+# XXX: I'm lazy... but if someone has a working javac, they should have a
+# working jar on their systems.
+JAR := jar
+JAVAC := @JAVAC@
AIO_LIBS := @AIO_LIBS@
CAP_LIBS := @CAP_LIBS@
@@ -51,13 +43,10 @@ CRYPTO_LIBS := @CRYPTO_LIBS@
LEXLIB := @LEXLIB@
NUMA_LIBS := @NUMA_LIBS@
SELINUX_LIBS := @SELINUX_LIBS@
-HAVE_RPC := @HAVE_RPC@
-LIBTIRPC_CFLAGS := @LIBTIRPC_CFLAGS@
-LIBTIRPC_LIBS := @LIBTIRPC_LIBS@
+TIRPC_CPPFLAGS := @TIRPC_CPPFLAGS@
+TIRPC_LIBS := @TIRPC_LIBS@
KEYUTILS_LIBS := @KEYUTILS_LIBS@
HAVE_FTS_H := @HAVE_FTS_H@
-LIBMNL_LIBS := @LIBMNL_LIBS@
-LIBMNL_CFLAGS := @LIBMNL_CFLAGS@
prefix := @prefix@
@@ -75,7 +64,7 @@ LDFLAGS := @LDFLAGS@
DEBUG_CFLAGS ?= -g
-# for -fstrict-aliasing see doc/build-system-guide.txt
+# Please see README.mk-devel about -fstrict-aliasing.
OPT_CFLAGS ?= -O2 -fno-strict-aliasing -pipe
WCFLAGS ?= -Wall -W @GCC_WARN_OLDSTYLE@
@@ -83,14 +72,6 @@ WCFLAGS ?= -Wall -W @GCC_WARN_OLDSTYLE@
LDFLAGS += $(WLDFLAGS)
CFLAGS += $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
-ifeq ($(strip $(HOST_CFLAGS)),)
-HOST_CFLAGS := $(CFLAGS)
-endif
-
-ifeq ($(strip $(HOST_LDFLAGS)),)
-HOST_LDFLAGS := $(LDFLAGS)
-endif
-
LINUX_VERSION := @LINUX_VERSION@
LINUX_DIR := @LINUX_DIR@
LINUX_VERSION_MAJOR := @LINUX_VERSION_MAJOR@
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index 1d22f9c53..f4169ad66 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -1,8 +1,7 @@
#
# Environment post-setup Makefile.
#
-# Copyright (c) Linux Test Project, 2009-2020
-# Copyright (c) Cisco Systems Inc., 2009
+# Copyright (C) 2009, Cisco Systems Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,11 +46,12 @@ LDFLAGS += -L$(top_builddir)/lib/android_libpthread
LDFLAGS += -L$(top_builddir)/lib/android_librt
endif
-MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(sort $(wildcard $(abs_srcdir)/*.c))))
+MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c)))
+
MAKE_TARGETS := $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS))
# with only *.dwo, .[0-9]+.dwo can not be cleaned
-CLEAN_TARGETS += $(MAKE_TARGETS) $(HOST_MAKE_TARGETS) *.o *.pyc .cache.mk *.dwo .*.dwo
+CLEAN_TARGETS += $(MAKE_TARGETS) *.o *.pyc .cache.mk *.dwo .*.dwo
# Majority of the files end up in testcases/bin...
INSTALL_DIR ?= testcases/bin
@@ -79,16 +79,32 @@ INSTALL_TARGETS := $(patsubst $(abs_srcdir)/%,%,$(INSTALL_TARGETS))
# scripts, so let's chmod them like that.
INSTALL_MODE ?= 00775
+ifdef MAKE_3_80_COMPAT
+
+INSTALL_PATH := $(call MAKE_3_80_abspath,$(DESTDIR)/$(INSTALL_DIR))
+
+INSTALL_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(INSTALL_TARGETS)))
+MAKE_TARGETS_ABS := $(call MAKE_3_80_abspath,$(addprefix $(INSTALL_PATH)/,$(MAKE_TARGETS)))
+
+INSTALL_FILES := $(INSTALL_TARGETS_ABS) $(MAKE_TARGETS_ABS)
+
+$(INSTALL_TARGETS_ABS):
+ test -d "$(@D)" || mkdir -p "$(@D)"
+ install -m $(INSTALL_MODE) "$(abs_srcdir)/$(subst $(INSTALL_PATH)/,,$@)" "$@"
+
+$(MAKE_TARGETS_ABS):
+ test -d "$(@D)" || mkdir -p "$(@D)"
+ install -m $(INSTALL_MODE) "$(abs_builddir)/$(subst $(INSTALL_PATH)/,,$@)" "$@"
+else
$(abspath $(addprefix $(DESTDIR)/$(INSTALL_DIR)/,$(sort $(dir $(INSTALL_TARGETS) $(MAKE_TARGETS))))):
mkdir -p "$@"
$(foreach install_target,$(INSTALL_TARGETS),$(eval $(call generate_install_rule,$(install_target),$(abs_srcdir),$(INSTALL_DIR))))
$(foreach make_target,$(MAKE_TARGETS),$(eval $(call generate_install_rule,$(make_target),$(abs_builddir),$(INSTALL_DIR))))
+endif
else # else ! $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
$(error You must define $$(prefix) before executing install)
endif # END $(filter-out install,$(MAKECMDGOALS)),$(MAKECMDGOALS)
endif
-include $(top_srcdir)/include/mk/rules.mk
-
endif
diff --git a/include/mk/env_pre.mk b/include/mk/env_pre.mk
index f36215167..c4a1f4708 100644
--- a/include/mk/env_pre.mk
+++ b/include/mk/env_pre.mk
@@ -1,8 +1,7 @@
#
# Make pre-include environment Makefile.
#
-# Copyright (c) Linux Test Project, 2009-2020
-# Copyright (c) Cisco Systems Inc., 2009
+# Copyright (C) 2009, Cisco Systems Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,13 +36,28 @@ BUILD_TREE_NONSRCDIR_INSTALL := 3
# configure not run.
BUILD_TREE_UNCONFIGURED := 4
+ifndef MAKE_VERSION_CHECK
+export MAKE_VERSION_CHECK = 1
+ifneq ($(firstword $(sort 3.80 $(MAKE_VERSION))),3.80)
+$(error Your version of make $(MAKE_VERSION) is too old. Upgrade to at least 3.80; 3.81+ is preferred)
+else
+ifneq ($(filter 3.80%,$(MAKE_VERSION)),)
+export MAKE_3_80_COMPAT := 1
+endif # make 3.80?
+endif # At least make 3.80?
+endif # MAKE_VERSION_CHECK
+
# Get the absolute path for the source directory.
top_srcdir ?= $(error You must define top_srcdir before including this file)
include $(top_srcdir)/include/mk/functions.mk
# Where's the root source directory?
+ifdef MAKE_3_80_COMPAT
+abs_top_srcdir := $(call MAKE_3_80_abspath,$(top_srcdir))
+else
abs_top_srcdir := $(abspath $(top_srcdir))
+endif
#
# Where's the root object directory?
@@ -53,20 +67,26 @@ abs_top_srcdir := $(abspath $(top_srcdir))
#
top_builddir ?= $(top_srcdir)
-# We need the absolute path
+# We need the absolute path...
+ifdef MAKE_3_80_COMPAT
+abs_top_builddir := $(call MAKE_3_80_abspath,$(top_builddir))
+else
abs_top_builddir := $(abspath $(top_builddir))
+endif
# Where's the root object directory?
builddir := .
abs_builddir := $(CURDIR)
-cwd_rel1 := $(subst $(abs_top_builddir),,$(abs_builddir))
-cwd_rel2 := $(subst $(abs_top_builddir)/,,$(abs_builddir))
-cwd_rel_from_top := $(if $(cwd_rel1),$(cwd_rel2),$(cwd_rel1))
+cwd_rel_from_top := $(subst $(abs_top_builddir),,$(abs_builddir))
-# Where's the source located at? Squish all of the / away by using abspath
+# Where's the source located at? Squish all of the / away by using abspath...
+ifdef MAKE_3_80_COMPAT
+abs_srcdir := $(call MAKE_3_80_abspath,$(abs_top_srcdir)/$(cwd_rel_from_top))
+else
abs_srcdir := $(abspath $(abs_top_srcdir)/$(cwd_rel_from_top))
+endif
srcdir := $(strip $(subst $(abs_top_srcdir)/,,$(abs_srcdir)))
@@ -116,7 +136,13 @@ BUILD_TREE_STATE := $(BUILD_TREE_NONSRCDIR_INSTALL)
endif
endif
+ifeq ($(MAKE_3_80_COMPAT),1)
+# Trick make 3.80 into thinking that the default goal is all.
+.PHONY: default
+default: all
+else
.DEFAULT_GOAL := all
+endif
endif # END autotools, *clean...
@@ -126,8 +152,4 @@ BUILD_TREE_STATE ?= $(BUILD_TREE_UNCONFIGURED)
# just these two vars and $(CURDIR).
export abs_top_srcdir abs_top_builddir BUILD_TREE_STATE
-ifeq ($V,1)
-VERBOSE=1
-endif
-
endif
diff --git a/include/mk/features.mk.in b/include/mk/features.mk.in
index ecb15a0f7..8e561b738 100644
--- a/include/mk/features.mk.in
+++ b/include/mk/features.mk.in
@@ -27,11 +27,6 @@ WITH_PERL := @WITH_PERL@
WITH_PYTHON := @WITH_PYTHON@
-METADATA_GENERATOR := @METADATA_GENERATOR@
-WITH_METADATA := @WITH_METADATA@
-WITH_METADATA_HTML := @WITH_METADATA_HTML@
-WITH_METADATA_PDF := @WITH_METADATA_PDF@
-
# Features knobs
# Test suite knobs
diff --git a/include/mk/functions.mk b/include/mk/functions.mk
index e86dbccdc..6f67b5af8 100644
--- a/include/mk/functions.mk
+++ b/include/mk/functions.mk
@@ -1,8 +1,7 @@
#
# A Makefile with a collection of reusable functions.
#
-# Copyright (c) Linux Test Project, 2009-2020
-# Copyright (c) Cisco Systems Inc., 2009
+# Copyright (C) 2009, Cisco Systems Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,6 +20,25 @@
# Ngie Cooper, July 2009
#
+SQUOTE := '
+
+# ' # to keep colorized editors from going nuts
+
+MAKE_3_80_realpath = $(shell $(top_srcdir)/scripts/realpath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))')
+
+MAKE_3_80_abspath = $(shell $(top_srcdir)/scripts/abspath.sh '$(subst $(SQUOTE),\\$(SQUOTE),$(1))')
+
+#
+# NOTE (garrcoop):
+#
+# The following functions are (sometimes) split into 3.80 and 3.81+
+# counterparts, and not conditionalized inside of the define(s) to work around
+# an issue with how make 3.80 evaluates defines.
+#
+# SO DO NOT INTERNALIZE CONDITIONALS IN DEFINES OR YOU WILL BREAK MAKE 3.80!
+#
+
+#
# Generate an install rule which also creates the install directory if needed
# to avoid unnecessary bourne shell based for-loops and install errors, as well
# as adhoc install rules.
@@ -28,16 +46,26 @@
# 1 -> Target basename.
# 2 -> Source directory.
# 3 -> Destination directory.
+#
+ifdef MAKE_3_80_COMPAT
+define generate_install_rule
+
+INSTALL_FILES += $$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1))
+$$(call MAKE_3_80_abspath,$$(DESTDIR)/$(3)/$(1)): \
+ $$(call MAKE_3_80_abspath,$$(dir $$(DESTDIR)/$(3)/$(1)))
+ install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@"
+endef
+else # not MAKE_3_80_COMPAT
define generate_install_rule
INSTALL_FILES += $$(abspath $$(DESTDIR)/$(3)/$(1))
$$(abspath $$(DESTDIR)/$(3)/$(1)): \
$$(abspath $$(dir $$(DESTDIR)/$(3)/$(1)))
- install -m $$(INSTALL_MODE) $(shell test -d "$(2)/$(1)" && echo "-d") $(PARAM) "$(2)/$(1)" $$@
- $(shell test -d "$(2)/$(1)" && echo "install -m "'$$(INSTALL_MODE) $(PARAM)' "$(2)/$(1)/*" -t '$$@')
+ install -m $$(INSTALL_MODE) "$(2)/$(1)" "$$@"
endef
+endif # END MAKE_3_80_COMPAT
#
# Set SUBDIRS to the subdirectories where Makefiles were found.
diff --git a/include/mk/generic_leaf_target.inc b/include/mk/generic_leaf_target.inc
index 64953f89a..dd54d05e9 100644
--- a/include/mk/generic_leaf_target.inc
+++ b/include/mk/generic_leaf_target.inc
@@ -57,13 +57,11 @@
# rope to hang one's self in the event of
# unwanted behavior.
#
-# $(HOST_MAKE_TARGETS) : Host tools which use $HOSTCC.
-#
# $(CLEAN_TARGETS) : What targets should be cleaned (must be
-# real files or directories). This will automatically append
-# adds the .o suffix to all files referenced by
-# $(MAKE_TARGETS)) to CLEAN_TARGETS, if MAKE_TARGETS wasn't
-# defined (see
+# real files). This will automatically append
+# adds the .o suffix to all files referenced
+# by $(MAKE_TARGETS)) to CLEAN_TARGETS, if
+# MAKE_TARGETS wasn't defined (see
# $(MAKE_TARGETS)).
# $(INSTALL_MODE) : What mode should we using when calling
# install(1)?
@@ -94,16 +92,12 @@
.PHONY: all clean install
-ifneq ($(strip $(MAKE_TARGETS)),)
-$(MAKE_TARGETS) += $(HOST_MAKE_TARGETS)
-endif
-
$(MAKE_TARGETS): | $(MAKE_DEPS)
all: $(MAKE_TARGETS)
clean:: $(CLEAN_DEPS)
- -$(RM) -f -r $(CLEAN_TARGETS)
+ -$(RM) -f $(CLEAN_TARGETS)
$(INSTALL_FILES): | $(INSTALL_DEPS)
diff --git a/include/mk/generic_trunk_target.inc b/include/mk/generic_trunk_target.inc
index fc59f944f..cc255c62a 100644
--- a/include/mk/generic_trunk_target.inc
+++ b/include/mk/generic_trunk_target.inc
@@ -75,16 +75,9 @@ trunk-install: $(INSTALL_FILES)
all: trunk-all
clean:: trunk-clean
-ifdef VERBOSE
@set -e; for dir in $(SUBDIRS); do \
$(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \
done
-else
- @set -e; for dir in $(SUBDIRS); do \
- echo "DIR $$dir"; \
- $(MAKE) --no-print-directory -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \
- done
-endif
ifneq ($(abs_builddir),$(abs_srcdir))
$(RM) -Rf $(SUBDIRS)
endif
@@ -97,15 +90,9 @@ ifeq ($(strip $(SUBDIRS)),)
$(error SUBDIRS empty -- did you want generic_leaf_target instead?)
else
$(RECURSIVE_TARGETS): %: | $(SUBDIRS)
-ifdef VERBOSE
@set -e; for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \
done
-else
- @set -e; for dir in $(SUBDIRS); do \
- $(MAKE) --no-print-directory -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \
- done
-endif
endif
# vim: syntax=make
diff --git a/include/mk/lib.mk b/include/mk/lib.mk
index f9b6c0aff..36e1ba17b 100644
--- a/include/mk/lib.mk
+++ b/include/mk/lib.mk
@@ -1,8 +1,7 @@
#
# library include Makefile.
#
-# Copyright (c) Linux Test Project, 2009-2020
-# Copyright (c) Cisco Systems Inc., 2009
+# Copyright (C) 2009, Cisco Systems Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,26 +49,25 @@ endif
MAKE_TARGETS += $(LIB)
LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c)
-LIBSRCS := $(sort $(LIBSRCS))
+
+ifdef MAKE_3_80_COMPAT
+LIBSRCS := $(call MAKE_3_80_abspath,$(LIBSRCS))
+else
LIBSRCS := $(abspath $(LIBSRCS))
+endif
+
LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS)))
+
LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS))
LIBOBJS := $(LIBSRCS:.c=.o)
$(LIB): $(notdir $(LIBOBJS))
- @if [ -z "$(strip $^)" ] ; then \
+ if [ -z "$(strip $^)" ] ; then \
echo "Cowardly refusing to create empty archive"; \
exit 1; \
fi
-ifdef VERBOSE
$(if $(AR),$(AR),ar) -rc "$@" $^
$(if $(RANLIB),$(RANLIB),ranlib) "$@"
-else
- @echo "AR $@"
- @$(if $(AR),$(AR),ar) -rc "$@" $^
- @echo "RANLIB $@"
- @$(if $(RANLIB),$(RANLIB),ranlib) "$@"
-endif
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/include/mk/module.mk b/include/mk/module.mk
index 6c8814b96..07d8fa89e 100644
--- a/include/mk/module.mk
+++ b/include/mk/module.mk
@@ -42,10 +42,10 @@ endif
ifneq ($(filter install clean,$(MAKECMDGOALS)),)
MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS))
-MAKE_TARGETS += $(sort $(wildcard *.ko))
+MAKE_TARGETS += $(wildcard *.ko)
endif
-CLEAN_TARGETS += .dep_modules *.mod built-in.a
+CLEAN_TARGETS += .dep_modules
MODULE_SOURCES := $(patsubst %.ko,%.c,$(filter %.ko, $(MAKE_TARGETS)))
diff --git a/include/mk/rules.mk b/include/mk/rules.mk
deleted file mode 100644
index c8f4bbbbe..000000000
--- a/include/mk/rules.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-target_rel_dir := $(if $(cwd_rel_from_top),$(cwd_rel_from_top)/,)
-
-%.o: %.c
-ifdef VERBOSE
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
-else
- @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
- @echo CC $(target_rel_dir)$@
-endif
-
-ifdef VERBOSE
-COMPILE.c=$(CC) $(CPPFLAGS) $(CFLAGS) -c
-else
-COMPILE.c=@echo CC $(target_rel_dir)$@; $(CC) $(CPPFLAGS) $(CFLAGS) -c
-endif
-
-%: %.o
-ifdef VERBOSE
- $(CC) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@
-else
- @$(CC) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@
- @echo LD $(target_rel_dir)$@
-endif
-
-$(HOST_MAKE_TARGETS): %: %.c
-ifdef VERBOSE
- $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $< $(HOST_LDLIBS) -o $@
-else
- @$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $< $(HOST_LDLIBS) -o $@
- @echo HOSTCC $(target_rel_dir)$@
-endif
-
-%: %.c
-ifdef VERBOSE
- $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@
-else
- @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LTPLDLIBS) $(LDLIBS) -o $@
- @echo CC $(target_rel_dir)$@
-endif
diff --git a/include/mk/testcases.mk b/include/mk/testcases.mk
index 1c81773d0..684655fbf 100644
--- a/include/mk/testcases.mk
+++ b/include/mk/testcases.mk
@@ -48,17 +48,8 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach
MAKE_DEPS += $(LTPLIBS_FILES)
-.PHONY: $(LTPLIBS_FILES)
-
$(LTPLIBS_FILES): $(LTPLIBS_DIRS)
-
-$(LTPLIBS_FILES): %:
-ifdef VERBOSE
- $(MAKE) -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all
-else
- @echo "BUILD $(notdir $@)"
- @$(MAKE) --no-print-directory -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all
-endif
+ $(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all
LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
diff --git a/include/old/old_device.h b/include/old/old_device.h
index a6e9fea86..17da57e1f 100644
--- a/include/old/old_device.h
+++ b/include/old/old_device.h
@@ -41,7 +41,6 @@ const char *tst_dev_fs_type(void);
* Note that you have to call tst_tmpdir() beforehand.
*
* Returns path to the device or NULL if it cannot be created.
- * Call tst_release_device() when you're done.
*/
const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size);
@@ -53,29 +52,11 @@ static inline const char *tst_acquire_device(void (cleanup_fn)(void))
}
/*
- * Acquire a loop device with specified temp filename. This function allows
- * you to acquire multiple devices at the same time. LTP_DEV is ignored.
- * If you call this function directly, use tst_detach_device() to release
- * the devices. tst_release_device() will not work correctly.
- *
- * The return value points to a static buffer and additional calls of
- * tst_acquire_loop_device() or tst_acquire_device() will overwrite it.
- */
-const char *tst_acquire_loop_device(unsigned int size, const char *filename);
-
-/*
* @dev: device path returned by the tst_acquire_device()
*/
int tst_release_device(const char *dev);
/*
- * Cleanup function for tst_acquire_loop_device(). If you have acquired
- * a device using tst_acquire_device(), use tst_release_device() instead.
- * @dev: device path returned by the tst_acquire_loop_device()
- */
-int tst_detach_device(const char *dev);
-
-/*
* Just like umount() but retries several times on failure.
* @path: Path to umount
*/
diff --git a/include/old/old_module.h b/include/old/old_module.h
index 496520d64..c50efec76 100644
--- a/include/old/old_module.h
+++ b/include/old/old_module.h
@@ -34,14 +34,6 @@
#ifndef TST_MODULE
#define TST_MODULE
-void tst_module_exists_(void (cleanup_fn)(void), const char *mod_name,
- char **mod_path);
-
-void tst_module_load_(void (cleanup_fn)(void), const char *mod_name,
- char *const argv[]);
-
-void tst_module_unload_(void (cleanup_fn)(void), const char *mod_name);
-
/*
* Check module existence.
*
@@ -52,11 +44,8 @@ void tst_module_unload_(void (cleanup_fn)(void), const char *mod_name);
*
* In case of failure, test'll call cleanup_fn and exit with TCONF return value.
*/
-static inline void tst_module_exists(void (cleanup_fn)(void),
- const char *mod_name, char **mod_path)
-{
- tst_module_exists_(cleanup_fn, mod_name, mod_path);
-}
+void tst_module_exist(void (cleanup_fn)(void), const char *mod_name,
+ char **mod_path);
/*
* Load a module using insmod program.
@@ -69,11 +58,8 @@ static inline void tst_module_exists(void (cleanup_fn)(void),
* In case of insmod failure, test will call cleanup_fn and exit with TBROK
* return value.
*/
-static inline void tst_module_load(void (cleanup_fn)(void),
- const char *mod_name, char *const argv[])
-{
- tst_module_load_(cleanup_fn, mod_name, argv);
-}
+void tst_module_load(void (cleanup_fn)(void),
+ const char *mod_name, char *const argv[]);
/*
* Unload a module using rmmod program. In case of failure, test will call
@@ -81,9 +67,6 @@ static inline void tst_module_load(void (cleanup_fn)(void),
*
* @mod_name: can be module name or module's file name.
*/
-static inline void tst_module_unload(void (cleanup_fn)(void), const char *mod_name)
-{
- tst_module_unload_(cleanup_fn, mod_name);
-}
+void tst_module_unload(void (cleanup_fn)(void), const char *mod_name);
#endif /* TST_MODULE */
diff --git a/include/old/test.h b/include/old/test.h
index 2ae7dba71..604254eea 100644
--- a/include/old/test.h
+++ b/include/old/test.h
@@ -129,7 +129,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
tst_resm_hexd_(__FILE__, __LINE__, (ttype), (buf), (size), \
(arg_fmt), ##__VA_ARGS__)
-void tst_brkm__(const char *file, const int lineno, int ttype,
+void tst_brkm_(const char *file, const int lineno, int ttype,
void (*func)(void), const char *arg_fmt, ...)
__attribute__ ((format (printf, 5, 6))) LTP_ATTRIBUTE_NORETURN;
@@ -139,18 +139,11 @@ void tst_brkm__(const char *file, const int lineno, int ttype,
if (tst_test) \
tst_brk_(__FILE__, __LINE__, flags, fmt, ##__VA_ARGS__); \
else \
- tst_brkm__(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \
- } while (0)
-
-#define tst_brkm_(file, lineno, flags, cleanup, fmt, ...) do { \
- if (tst_test) \
- tst_brk_(file, lineno, flags, fmt, ##__VA_ARGS__); \
- else \
- tst_brkm__(file, lineno, flags, cleanup, fmt, ##__VA_ARGS__); \
+ tst_brkm_(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \
} while (0)
#else
# define tst_brkm(flags, cleanup, fmt, ...) do { \
- tst_brkm__(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \
+ tst_brkm_(__FILE__, __LINE__, flags, cleanup, fmt, ##__VA_ARGS__); \
} while (0)
#endif
diff --git a/include/parse_vdso.h b/include/parse_vdso.h
deleted file mode 100644
index 5212fc659..000000000
--- a/include/parse_vdso.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef PARSE_VDSO_H__
-#define PARSE_VDSO_H__
-
-#include <stdint.h>
-
-/*
- * To use this vDSO parser, first call one of the vdso_init_* functions.
- * If you've already parsed auxv, then pass the value of AT_SYSINFO_EHDR
- * to vdso_init_from_sysinfo_ehdr. Otherwise pass auxv to vdso_init_from_auxv.
- * Then call vdso_sym for each symbol you want. For example, to look up
- * gettimeofday on x86_64, use:
- *
- * <some pointer> = vdso_sym("LINUX_2.6", "gettimeofday");
- * or
- * <some pointer> = vdso_sym("LINUX_2.6", "__vdso_gettimeofday");
- *
- * vdso_sym will return 0 if the symbol doesn't exist or if the init function
- * failed or was not called. vdso_sym is a little slow, so its return value
- * should be cached.
- *
- * vdso_sym is threadsafe; the init functions are not.
- *
- * These are the prototypes:
- */
-
-#include <time.h>
-
-extern void vdso_init_from_auxv(void *auxv);
-extern void vdso_init_from_sysinfo_ehdr(uintptr_t base);
-extern void *vdso_sym(const char *version, const char *name);
-
-typedef int (*gettime_t)(clockid_t clk_id, void *ts);
-void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime,
- gettime_t *ptr_vdso_gettime64);
-#endif /* PARSE_VDSO_H__ */
diff --git a/include/safe_file_ops_fn.h b/include/safe_file_ops_fn.h
index 6d680967b..052fb1b9a 100644
--- a/include/safe_file_ops_fn.h
+++ b/include/safe_file_ops_fn.h
@@ -24,16 +24,6 @@
#include "lapi/utime.h"
/*
- * Count number of expected assigned conversions. Any conversion starts with '%'.
- * The '%%' matches % and no assignment is done. The %*x matches as x would do but
- * the assignment is suppressed.
- *
- * NOTE: This is not 100% correct for complex scanf strings, but will do for
- * all of our intended usage.
- */
-int tst_count_scanf_conversions(const char *fmt);
-
-/*
* All-in-one function to scanf value(s) from a file.
*/
int file_scanf(const char *file, const int lineno,
@@ -65,7 +55,7 @@ void safe_file_printf(const char *file, const int lineno,
/*
* Safe function to copy files, no more system("cp ...") please.
*/
-int safe_cp(const char *file, const int lineno,
+void safe_cp(const char *file, const int lineno,
void (*cleanup_fn)(void),
const char *src, const char *dst);
@@ -81,7 +71,7 @@ int safe_cp(const char *file, const int lineno,
* times is a timespec[2] (as for utimensat(2)). If times is NULL then
* the access/modification times of the file is set to the current time.
*/
-int safe_touch(const char *file, const int lineno,
+void safe_touch(const char *file, const int lineno,
void (*cleanup_fn)(void),
const char *pathname,
mode_t mode, const struct timespec times[2]);
diff --git a/include/safe_net_fn.h b/include/safe_net_fn.h
index ff81b1337..2fda11fab 100644
--- a/include/safe_net_fn.h
+++ b/include/safe_net_fn.h
@@ -47,9 +47,6 @@ ssize_t safe_sendto(const char *file, const int lineno, char len_strict,
ssize_t safe_sendmsg(const char *file, const int lineno, size_t msg_len,
int sockfd, const struct msghdr *msg, int flags);
-ssize_t safe_recv(const char *file, const int lineno, size_t len,
- int sockfd, void *buf, size_t size, int flags);
-
ssize_t safe_recvmsg(const char *file, const int lineno, size_t msg_len,
int sockfd, struct msghdr *msg, int flags);
diff --git a/include/time64_variants.h b/include/time64_variants.h
deleted file mode 100644
index fc52623c8..000000000
--- a/include/time64_variants.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-#ifndef TIME64_VARIANTS_H
-#define TIME64_VARIANTS_H
-
-#include "config.h"
-
-#ifdef HAVE_LIBAIO
-#include <libaio.h>
-#endif
-
-#include <signal.h>
-#include <stdio.h>
-#include <poll.h>
-#include <time.h>
-#include "tst_timer.h"
-
-struct tst_ts;
-struct pollfd;
-struct io_event;
-struct sembuf;
-struct mmsghdr;
-
-struct time64_variants {
- char *desc;
-
- enum tst_ts_type ts_type;
- int (*clock_gettime)(clockid_t clk_id, void *ts);
- int (*clock_settime)(clockid_t clk_id, void *ts);
- int (*clock_nanosleep)(clockid_t clock_id, int flags, void *request, void *remain);
-
- int (*timer_gettime)(kernel_timer_t timer, void *its);
- int (*timer_settime)(kernel_timer_t timerid, int flags, void *its, void *old_its);
- int (*tfd_gettime)(int fd, void *its);
- int (*tfd_settime)(int fd, int flags, void *new_value, void *old_value);
-
-#ifdef HAVE_LIBAIO
- int (*io_pgetevents)(io_context_t ctx, long min_nr, long max_nr,
- struct io_event *events, void *timeout, sigset_t *sigmask);
-#endif
-
- int (*mqt_send)(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
- unsigned int msg_prio, void *abs_timeout);
- ssize_t (*mqt_receive)(mqd_t mqdes, char *msg_ptr, size_t msg_len,
- unsigned int *msg_prio, void *abs_timeout);
- int (*ppoll)(struct pollfd *fds, nfds_t nfds, void *tmo_p,
- const sigset_t *sigmask, size_t sigsetsize);
- int (*sched_rr_get_interval)(pid_t pid, void *ts);
- int (*semop)(int semid, struct sembuf *sops, size_t nsops);
- int (*semtimedop)(int semid, struct sembuf *sops, size_t nsops, void *timeout);
- int (*sigwait) (const sigset_t * set, siginfo_t * info,
- void * timeout);
- int (*recvmmsg)(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
- unsigned int flags, void *timeout);
- int (*sendmmsg)(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
- unsigned int flags);
- int (*utimensat)(int dirfd, const char *pathname, void *times,
- int flags);
-};
-
-#endif /* TIME64_VARIANTS_H */
diff --git a/include/tst_af_alg.h b/include/tst_af_alg.h
index fd2ff0647..fc4b1989a 100644
--- a/include/tst_af_alg.h
+++ b/include/tst_af_alg.h
@@ -133,36 +133,4 @@ int tst_alg_setup(const char *algtype, const char *algname,
int tst_alg_setup_reqfd(const char *algtype, const char *algname,
const uint8_t *key, unsigned int keylen);
-/** Specification of control data to send to an AF_ALG request socket */
-struct tst_alg_sendmsg_params {
-
- /** If true, send ALG_SET_OP with ALG_OP_ENCRYPT */
- bool encrypt;
-
- /** If true, send ALG_SET_OP with ALG_OP_DECRYPT */
- bool decrypt;
-
- /** If ivlen != 0, send ALG_SET_IV */
- const uint8_t *iv;
- unsigned int ivlen;
-
- /** If assoclen != 0, send ALG_SET_AEAD_ASSOCLEN */
- unsigned int assoclen;
-
- /* Value to use as msghdr::msg_flags */
- uint32_t msg_flags;
-};
-
-/**
- * Send some data to an AF_ALG request socket, including control data.
- * @param reqfd An AF_ALG request socket
- * @param data The data to send
- * @param datalen The length of data in bytes
- * @param params Specification of the control data to send
- *
- * On failure, tst_brk() is called with TBROK.
- */
-void tst_alg_sendmsg(int reqfd, const void *data, size_t datalen,
- const struct tst_alg_sendmsg_params *params);
-
#endif /* TST_AF_ALG_H */
diff --git a/include/tst_ansi_color.h b/include/tst_ansi_color.h
index 770bf46d9..495299901 100644
--- a/include/tst_ansi_color.h
+++ b/include/tst_ansi_color.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_ANSI_COLOR_H__
diff --git a/include/tst_assert.h b/include/tst_assert.h
deleted file mode 100644
index dcb62dfea..000000000
--- a/include/tst_assert.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-#ifndef TST_ASSERT_H__
-#define TST_ASSERT_H__
-
-#define TST_ASSERT_INT(path, val) \
- tst_assert_int(__FILE__, __LINE__, path, val)
-
-/*
- * Asserts that integer value stored in file pointed by path equals to the
- * value passed to this function. This is mostly useful for asserting correct
- * values in sysfs, procfs, etc.
- */
-void tst_assert_int(const char *file, const int lineno,
- const char *path, int val);
-
-#define TST_ASSERT_FILE_INT(path, prefix, val) \
- tst_assert_file_int(__FILE__, __LINE__, path, prefix, val)
-
-/*
- * Same as tst_assert_int() but for unsigned long.
- */
-void tst_assert_ulong(const char *file, const int lineno,
- const char *path, unsigned long val);
-
-#define TST_ASSERT_ULONG(path, val) \
- tst_assert_ulong(__FILE__, __LINE__, path, val)
-
-/*
- * Asserts that integer value stored in the prefix field of file pointed by path
- * equals to the value passed to this function. This is mostly useful for
- * asserting correct field values in sysfs, procfs, etc.
- */
-
-void tst_assert_file_int(const char *file, const int lineno,
- const char *path, const char *prefix, int val);
-
-
-#define TST_ASSERT_STR(path, val) \
- tst_assert_str(__FILE__, __LINE__, path, val)
-
-/*
- * Asserts that a string value stored in file pointed by path equals to the
- * value passed to this function. This is mostly useful for asserting correct
- * values in sysfs, procfs, etc.
- */
-void tst_assert_str(const char *file, const int lineno,
- const char *path, const char *val);
-
-#define TST_ASSERT_FILE_STR(path, prefix, val) \
- tst_assert_file_str(__FILE__, __LINE__, path, prefix, val)
-
-/*
- * Asserts that a string value stored in the prefix field of file pointed by path
- * equals to the value passed to this function. This is mostly useful for
- * asserting correct field values in sysfs, procfs, etc.
- */
-void tst_assert_file_str(const char *file, const int lineno,
- const char *path, const char *prefix, const char *val);
-
-#endif /* TST_ASSERT_H__ */
diff --git a/include/tst_atomic.h b/include/tst_atomic.h
index 061cd3dc6..5736d28bb 100644
--- a/include/tst_atomic.h
+++ b/include/tst_atomic.h
@@ -1,7 +1,19 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
/* The LTP library has some of its own atomic synchronisation primitives
* contained in this file. Generally speaking these should not be used
* directly in tests for synchronisation, instead use tst_checkpoint.h,
diff --git a/include/tst_bool_expr.h b/include/tst_bool_expr.h
deleted file mode 100644
index 894d21954..000000000
--- a/include/tst_bool_expr.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-#ifndef TST_BOOL_EXPR_H__
-#define TST_BOOL_EXPR_H__
-
-enum tst_op {
- TST_OP_NOT,
- TST_OP_AND,
- TST_OP_OR,
- TST_OP_VAR,
- /* Used only internally */
- TST_OP_LPAR,
- TST_OP_RPAR,
-};
-
-struct tst_expr_tok {
- enum tst_op op;
- const char *tok;
- size_t tok_len;
- struct tst_expr_tok *next;
- const void *priv;
-};
-
-struct tst_expr {
- struct tst_expr_tok *rpn;
- struct tst_expr_tok buf[];
-};
-
-/*
- * Parses an boolean expression and returns a simplified RPN version.
- *
- * If expression is not valid the call prints error into stderr and returns
- * NULL. On success pointer to an expression is returned which can be evaluated
- * by the tst_bool_expr_eval() function and has to be later freed by the
- * caller.
- *
- * The boolean expression can consists of:
- *
- * - unary negation opeartion !
- * - two binary operations & and |
- * - correct sequence of parentheses ()
- * - strings that are treated as boolean variables
- *
- * e.g. '(A | B) & C' or 'Variable_1 & Variable_2' are both a valid boolean
- * expressions.
- *
- * @expr String containing a boolean expression to be parsed.
- * @return Pointer to an RPN expression.
- */
-struct tst_expr *tst_bool_expr_parse(const char *expr);
-
-/*
- * Prints an string representation of the expression into a FILE.
- *
- * @param A FILE to print to.
- * @expr An expression to print.
- */
-void tst_bool_expr_print(FILE *f, struct tst_expr *expr);
-
-/*
- * Evaluates an expression given a map for variables.
- *
- * The call will fail if:
- * - map function returns -1 which indicates undefined variable
- * - the eval function runs out of stack
- *
- * @param expr Boolean expression in RPN.
- * @param map Mapping function for boolean variables.
- *
- * @return Returns 0 or 1 if expression was evaluated correctly and -1 on error.
- */
-int tst_bool_expr_eval(struct tst_expr *expr,
- int (*map)(struct tst_expr_tok *var));
-
-/*
- * Frees the memory allocated by the tst_bool_expr_parse().
- *
- * @param Boolean expression.
- */
-void tst_bool_expr_free(struct tst_expr *expr);
-
-#endif /* TST_BOOL_EXPR_H__ */
diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
deleted file mode 100644
index d4c93db79..000000000
--- a/include/tst_cgroup.h
+++ /dev/null
@@ -1,191 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Red Hat, Inc.
- * Copyright (c) 2020 Li Wang <liwang@redhat.com>
- * Copyright (c) 2020-2021 SUSE LLC <rpalethorpe@suse.com>
- */
-/*\
- * [DESCRIPTION]
- *
- * The LTP CGroups API tries to present a consistent interface to the
- * many possible CGroup configurations a system could have.
- *
- * You may ask; "Why don't you just mount a simple CGroup hierarchy,
- * instead of scanning the current setup?". The short answer is that
- * it is not possible unless no CGroups are currently active and
- * almost all of our users will have CGroups active. Even if
- * unmounting the current CGroup hierarchy is a reasonable thing to do
- * to the sytem manager, it is highly unlikely the CGroup hierarchy
- * will be destroyed. So users would be forced to remove their CGroup
- * configuration and reboot the system.
- *
- * The core library tries to ensure an LTP CGroup exists on each
- * hierarchy root. Inside the LTP group it ensures a 'drain' group
- * exists and creats a test group for the current test. In the worst
- * case we end up with a set of hierarchies like the follwoing. Where
- * existing system-manager-created CGroups have been omitted.
- *
- * (V2 Root) (V1 Root 1) ... (V1 Root N)
- * | | |
- * (ltp) (ltp) ... (ltp)
- * / \ / \ / \
- * (drain) (test-n) (drain) (test-n) ... (drain) (test-n)
- *
- * V2 CGroup controllers use a single unified hierarchy on a single
- * root. Two or more V1 controllers may share a root or have their own
- * root. However there may exist only one instance of a controller.
- * So you can not have the same V1 controller on multiple roots.
- *
- * It is possible to have both a V2 hierarchy and V1 hierarchies
- * active at the same time. Which is what is shown above. Any
- * controllers attached to V1 hierarchies will not be available in the
- * V2 hierarchy. The reverse is also true.
- *
- * Note that a single hierarchy may be mounted multiple
- * times. Allowing it to be accessed at different locations. However
- * subsequent mount operations will fail if the mount options are
- * different from the first.
- *
- * The user may pre-create the CGroup hierarchies and the ltp CGroup,
- * otherwise the library will try to create them. If the ltp group
- * already exists and has appropriate permissions, then admin
- * privileges will not be required to run the tests.
- *
- * Because the test may not have access to the CGroup root(s), the
- * drain CGroup is created. This can be used to store processes which
- * would otherwise block the destruction of the individual test CGroup
- * or one of its descendants.
- *
- * The test author may create child CGroups within the test CGroup
- * using the CGroup Item API. The library will create the new CGroup
- * in all the relevant hierarchies.
- *
- * There are many differences between the V1 and V2 CGroup APIs. If a
- * controller is on both V1 and V2, it may have different parameters
- * and control files. Some of these control files have a different
- * name, but similar functionality. In this case the Item API uses
- * the V2 names and aliases them to the V1 name when appropriate.
- *
- * Some control files only exist on one of the versions or they can be
- * missing due to other reasons. The Item API allows the user to check
- * if the file exists before trying to use it.
- *
- * Often a control file has almost the same functionality between V1
- * and V2. Which means it can be used in the same way most of the
- * time, but not all. For now this is handled by exposing the API
- * version a controller is using to allow the test author to handle
- * edge cases. (e.g. V2 memory.swap.max accepts "max", but V1
- * memory.memsw.limit_in_bytes does not).
- */
-
-#ifndef TST_CGROUP_H
-#define TST_CGROUP_H
-
-#include <sys/types.h>
-
-/* CGroups Kernel API version */
-enum tst_cgroup_ver {
- TST_CGROUP_V1 = 1,
- TST_CGROUP_V2 = 2,
-};
-
-/* Used to specify CGroup hierarchy configuration options, allowing a
- * test to request a particular CGroup structure.
- */
-struct tst_cgroup_opts {
- /* Only try to mount V1 CGroup controllers. This will not
- * prevent V2 from being used if it is already mounted, it
- * only indicates that we should mount V1 controllers if
- * nothing is present. By default we try to mount V2 first. */
- int only_mount_v1:1;
-};
-
-/* A Control Group in LTP's aggregated hierarchy */
-struct tst_cgroup_group;
-
-/* Search the system for mounted cgroups and available
- * controllers. Called automatically by tst_cgroup_require.
- */
-void tst_cgroup_scan(void);
-/* Print the config detected by tst_cgroup_scan */
-void tst_cgroup_print_config(void);
-
-/* Ensure the specified controller is available in the test's default
- * CGroup, mounting/enabling it if necessary */
-void tst_cgroup_require(const char *const ctrl_name,
- const struct tst_cgroup_opts *const options)
- __attribute__ ((nonnull (1)));
-
-/* Tear down any CGroups created by calls to tst_cgroup_require */
-void tst_cgroup_cleanup(void);
-
-/* Get the default CGroup for the test. It allocates memory (in a
- * guarded buffer) so should always be called from setup
- */
-const struct tst_cgroup_group *tst_cgroup_get_test_group(void)
- __attribute__ ((warn_unused_result));
-/* Get the shared drain group. Also should be called from setup */
-const struct tst_cgroup_group *tst_cgroup_get_drain_group(void)
- __attribute__ ((warn_unused_result));
-
-/* Create a descendant CGroup */
-struct tst_cgroup_group *
-tst_cgroup_group_mk(const struct tst_cgroup_group *const parent,
- const char *const group_name)
- __attribute__ ((nonnull, warn_unused_result));
-/* Remove a descendant CGroup */
-struct tst_cgroup_group *
-tst_cgroup_group_rm(struct tst_cgroup_group *const cg)
- __attribute__ ((nonnull, warn_unused_result));
-
-#define TST_CGROUP_VER(cg, ctrl_name) \
- tst_cgroup_ver(__FILE__, __LINE__, (cg), (ctrl_name))
-
-enum tst_cgroup_ver tst_cgroup_ver(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const ctrl_name)
- __attribute__ ((nonnull, warn_unused_result));
-
-#define SAFE_CGROUP_HAS(cg, file_name) \
- safe_cgroup_has(__FILE__, __LINE__, (cg), (file_name))
-
-int safe_cgroup_has(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const file_name)
- __attribute__ ((nonnull, warn_unused_result));
-
-#define SAFE_CGROUP_READ(cg, file_name, out, len) \
- safe_cgroup_read(__FILE__, __LINE__, \
- (cg), (file_name), (out), (len))
-
-ssize_t safe_cgroup_read(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const file_name,
- char *const out, const size_t len)
- __attribute__ ((nonnull));
-
-#define SAFE_CGROUP_PRINTF(cg, file_name, fmt, ...) \
- safe_cgroup_printf(__FILE__, __LINE__, \
- (cg), (file_name), (fmt), __VA_ARGS__)
-
-#define SAFE_CGROUP_PRINT(cg, file_name, str) \
- safe_cgroup_printf(__FILE__, __LINE__, (cg), (file_name), "%s", (str))
-
-void safe_cgroup_printf(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const file_name,
- const char *const fmt, ...)
- __attribute__ ((format (printf, 5, 6), nonnull));
-
-#define SAFE_CGROUP_SCANF(cg, file_name, fmt, ...) \
- safe_cgroup_scanf(__FILE__, __LINE__, \
- (cg), (file_name), (fmt), __VA_ARGS__)
-
-void safe_cgroup_scanf(const char *file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const file_name,
- const char *fmt, ...)
- __attribute__ ((format (scanf, 5, 6), nonnull));
-
-
-#endif /* TST_CGROUP_H */
diff --git a/include/tst_checkpoint.h b/include/tst_checkpoint.h
index 5c8067d0d..d6f7607ab 100644
--- a/include/tst_checkpoint.h
+++ b/include/tst_checkpoint.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_CHECKPOINT__
diff --git a/include/tst_checkpoint_fn.h b/include/tst_checkpoint_fn.h
index 57db905c8..496798164 100644
--- a/include/tst_checkpoint_fn.h
+++ b/include/tst_checkpoint_fn.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_CHECKPOINT_FN__
diff --git a/include/tst_clocks.h b/include/tst_clocks.h
index 80030c6b0..90784a3fd 100644
--- a/include/tst_clocks.h
+++ b/include/tst_clocks.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
@@ -15,9 +28,4 @@ int tst_clock_gettime(clockid_t clk_id, struct timespec *ts);
int tst_clock_settime(clockid_t clk_id, struct timespec *ts);
-/*
- * Converts clock id to a readable name.
- */
-const char *tst_clock_name(clockid_t clk_id);
-
#endif /* TST_CLOCKS__ */
diff --git a/include/tst_clone.h b/include/tst_clone.h
index 9ffdc68d1..fd52097e2 100644
--- a/include/tst_clone.h
+++ b/include/tst_clone.h
@@ -1,37 +1,28 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Xiao Yang <yangx.jy@cn.fujitsu.com>
- */
-
-#ifndef TST_CLONE_H__
-#define TST_CLONE_H__
-
-#ifdef TST_TEST_H__
-
-/* The parts of clone3's clone_args we support */
-struct tst_clone_args {
- uint64_t flags;
- uint64_t exit_signal;
-};
-
-/* clone3 with fallbacks to clone when possible. Be aware that it
- * returns -1 if clone3 fails (except ENOSYS), but -2 if clone fails.
*
- * Without CLONE_VM this acts like fork so you may want to set
- * tst_test.forks_child (safe_clone requires this).
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program.
*
- * You should set exit_signal to SIGCHLD for
- * tst_reap_children. Otherwise you must call wait with the
- * appropriate parameters.
*/
-pid_t tst_clone(const struct tst_clone_args *args);
-
-pid_t safe_clone(const char *file, const int lineno,
- const struct tst_clone_args *args);
-/* "Safe" version of tst_clone */
-#define SAFE_CLONE(args) safe_clone(__FILE__, __LINE__, args)
-
-#endif /* TST_TEST_H__ */
+#ifndef TST_CLONE_H__
+#define TST_CLONE_H__
/* Functions from lib/cloner.c */
int ltp_clone(unsigned long flags, int (*fn)(void *arg), void *arg,
diff --git a/include/tst_cmd.h b/include/tst_cmd.h
index 1f39f690f..9f4240e91 100644
--- a/include/tst_cmd.h
+++ b/include/tst_cmd.h
@@ -1,21 +1,23 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_CMD_H__
#define TST_CMD_H__
-enum tst_cmd_flags {
- /*
- * return the program exit code, otherwise it will call cleanup_fn() if the
- * program exit code is not zero.
- */
- TST_CMD_PASS_RETVAL = 1,
-
- /* exit with TCONF if program is not in path */
- TST_CMD_TCONF_ON_MISSING = 2,
-};
-
/*
* vfork() + execvp() specified program.
* @argv: a list of two (at least program name + NULL) or more pointers that
@@ -25,64 +27,68 @@ enum tst_cmd_flags {
* redirection is not needed.
* @stderr_fd: file descriptor where to redirect stderr. Set -1 if
* redirection is not needed.
- * @flags: enum tst_cmd_flags
+ * @pass_exit_val: if it's non-zero, this function will return the program
+ * exit code, otherwise it will call cleanup_fn() if the program
+ * exit code is not zero.
*/
-int tst_cmd_fds_(void (cleanup_fn)(void),
+int tst_run_cmd_fds_(void (cleanup_fn)(void),
const char *const argv[],
int stdout_fd,
int stderr_fd,
- enum tst_cmd_flags flags);
+ int pass_exit_val);
-/* Executes tst_cmd_fds() and redirects its output to a file
+/* Executes tst_run_cmd_fds() and redirects its output to a file
* @stdout_path: path where to redirect stdout. Set NULL if redirection is
* not needed.
* @stderr_path: path where to redirect stderr. Set NULL if redirection is
* not needed.
- * @flags: enum tst_cmd_flags
+ * @pass_exit_val: if it's non-zero, this function will return the program
+ * exit code, otherwise it will call cleanup_fn() if the program
+ * exit code is not zero.
*/
-int tst_cmd_(void (cleanup_fn)(void),
+int tst_run_cmd_(void (cleanup_fn)(void),
const char *const argv[],
const char *stdout_path,
const char *stderr_path,
- enum tst_cmd_flags flags);
+ int pass_exit_val);
#ifdef TST_TEST_H__
-static inline int tst_cmd_fds(const char *const argv[],
+static inline int tst_run_cmd_fds(const char *const argv[],
int stdout_fd,
int stderr_fd,
- enum tst_cmd_flags flags)
+ int pass_exit_val)
{
- return tst_cmd_fds_(NULL, argv,
- stdout_fd, stderr_fd, flags);
+ return tst_run_cmd_fds_(NULL, argv,
+ stdout_fd, stderr_fd, pass_exit_val);
}
-static inline int tst_cmd(const char *const argv[],
+static inline int tst_run_cmd(const char *const argv[],
const char *stdout_path,
const char *stderr_path,
- enum tst_cmd_flags flags)
+ int pass_exit_val)
{
- return tst_cmd_(NULL, argv,
- stdout_path, stderr_path, flags);
+ return tst_run_cmd_(NULL, argv,
+ stdout_path, stderr_path, pass_exit_val);
}
#else
-static inline int tst_cmd_fds(void (cleanup_fn)(void),
+static inline int tst_run_cmd_fds(void (cleanup_fn)(void),
const char *const argv[],
int stdout_fd,
int stderr_fd,
- enum tst_cmd_flags flags)
+ int pass_exit_val)
{
- return tst_cmd_fds_(cleanup_fn, argv,
- stdout_fd, stderr_fd, flags);
+ return tst_run_cmd_fds_(cleanup_fn, argv,
+ stdout_fd, stderr_fd, pass_exit_val);
}
-static inline int tst_cmd(void (cleanup_fn)(void),
+static inline int tst_run_cmd(void (cleanup_fn)(void),
const char *const argv[],
const char *stdout_path,
const char *stderr_path,
- enum tst_cmd_flags flags)
+ int pass_exit_val)
{
- return tst_cmd_(cleanup_fn, argv,
- stdout_path, stderr_path, flags);
+ return tst_run_cmd_(cleanup_fn, argv,
+ stdout_path, stderr_path, pass_exit_val);
}
#endif
diff --git a/include/tst_common.h b/include/tst_common.h
index fd7a900d4..a0c06a3f7 100644
--- a/include/tst_common.h
+++ b/include/tst_common.h
@@ -26,61 +26,36 @@
/**
* TST_RETRY_FUNC() - Repeatedly retry a function with an increasing delay.
* @FUNC - The function which will be retried
- * @ECHCK - Function/macro for validating @FUNC return value
+ * @ERET - The value returned from @FUNC on success
*
- * This macro will call @FUNC in a loop with a delay between retries.
- * If ECHCK(ret) evaluates to non-zero, the loop ends. The delay between
- * retries starts at one microsecond and is then doubled each iteration until
- * it exceeds one second (the total time sleeping will be approximately one
- * second as well). When the delay exceeds one second, the loop will end.
- * The TST_RETRY_FUNC() macro returns the last value returned by @FUNC.
+ * This macro will call @FUNC in a loop with a delay between retries. If @FUNC
+ * returns @ERET then the loop exits. The delay between retries starts at one
+ * micro second and is then doubled each iteration until it exceeds one second
+ * (the total time sleeping will be approximately one second as well). When the
+ * delay exceeds one second tst_brk() is called.
*/
-#define TST_RETRY_FUNC(FUNC, ECHCK) \
- TST_RETRY_FN_EXP_BACKOFF(FUNC, ECHCK, 1)
+#define TST_RETRY_FUNC(FUNC, ERET) \
+ TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, 1)
-#define TST_RETRY_FN_EXP_BACKOFF(FUNC, ECHCK, MAX_DELAY) \
+#define TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, MAX_DELAY) \
({ unsigned int tst_delay_, tst_max_delay_; \
- typeof(FUNC) tst_ret_; \
tst_delay_ = 1; \
tst_max_delay_ = tst_multiply_timeout(MAX_DELAY * 1000000); \
for (;;) { \
- errno = 0; \
- tst_ret_ = FUNC; \
- if (ECHCK(tst_ret_)) \
+ typeof(FUNC) tst_ret_ = FUNC; \
+ if (tst_ret_ == ERET) \
break; \
if (tst_delay_ < tst_max_delay_) { \
usleep(tst_delay_); \
tst_delay_ *= 2; \
} else { \
- break; \
+ tst_brk(TBROK, #FUNC" timed out"); \
} \
} \
- tst_ret_; \
+ ERET; \
})
-/*
- * Return value validation macros for TST_RETRY_FUNC():
- * TST_RETVAL_EQ0() - Check that value is equal to zero
- */
-#define TST_RETVAL_EQ0(x) (!(x))
-
-/*
- * TST_RETVAL_NOTNULL() - Check that value is not equal to zero/NULL
- */
-#define TST_RETVAL_NOTNULL(x) (!!(x))
-
-/*
- * TST_RETVAL_GE0() - Check that value is greater than or equal to zero
- */
-#define TST_RETVAL_GE0(x) ((x) >= 0)
-
-#define TST_BUILD_BUG_ON(condition) \
- do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0)
-
#define TST_BRK_SUPPORTS_ONLY_TCONF_TBROK(condition) \
- TST_BUILD_BUG_ON(condition)
-
-#define TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(condition) \
- TST_BUILD_BUG_ON(condition)
+ do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0)
#endif /* TST_COMMON_H__ */
diff --git a/include/tst_cpu.h b/include/tst_cpu.h
index b3a449bea..2e21384f9 100644
--- a/include/tst_cpu.h
+++ b/include/tst_cpu.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_CPU_H__
@@ -8,14 +21,10 @@
long tst_ncpus(void);
long tst_ncpus_conf(void);
long tst_ncpus_max(void);
-long tst_ncpus_available(void);
#define VIRT_ANY 0 /* catch-all argument for tst_is_virt() */
#define VIRT_XEN 1 /* xen dom0/domU */
#define VIRT_KVM 2 /* only default virtual CPU */
-#define VIRT_IBMZ 3 /* ibm system z */
-#define VIRT_IBMZ_LPAR 4 /* ibm system z lpar */
-#define VIRT_IBMZ_ZVM 5 /* ibm system z zvm */
#define VIRT_OTHER 0xffff /* unrecognized hypervisor */
int tst_is_virt(int virt_type);
diff --git a/include/tst_crypto.h b/include/tst_crypto.h
index ae406bd04..d5871ab79 100644
--- a/include/tst_crypto.h
+++ b/include/tst_crypto.h
@@ -1,7 +1,19 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2018 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
/**
* @file tst_crypto.h
*
diff --git a/include/tst_device.h b/include/tst_device.h
index 1d1246e82..3ad33bd48 100644
--- a/include/tst_device.h
+++ b/include/tst_device.h
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2016-2019 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_DEVICE_H__
@@ -25,13 +37,6 @@ extern struct tst_device *tst_device;
int tst_umount(const char *path);
/*
- * Verifies if an earlier mount is successful or not.
- * @path: Mount path to verify
- */
-int tst_is_mounted(const char *path);
-int tst_is_mounted_at_tmpdir(const char *path);
-
-/*
* Clears a first few blocks of the device. This is needed when device has
* already been formatted with a filesystems, subset of mkfs.foo utils aborts
* the operation if it finds a filesystem signature there.
@@ -58,24 +63,10 @@ int tst_find_free_loopdev(const char *path, size_t path_len);
int tst_attach_device(const char *dev_path, const char *file_path);
/*
- * Detaches a file from a loop device fd.
- *
- * @dev_path Path to the loop device e.g. /dev/loop0
- * @dev_fd a open fd for the loop device
- * @return Zero on succes, non-zero otherwise.
- */
-int tst_detach_device_by_fd(const char *dev_path, int dev_fd);
-
-/*
* Detaches a file from a loop device.
*
* @dev_path Path to the loop device e.g. /dev/loop0
* @return Zero on succes, non-zero otherwise.
- *
- * Internally this function opens the device and calls
- * tst_detach_device_by_fd(). If you keep device file descriptor open you
- * have to call the by_fd() variant since having the device open twice will
- * prevent it from being detached.
*/
int tst_detach_device(const char *dev_path);
@@ -93,16 +84,4 @@ int tst_dev_sync(int fd);
*/
unsigned long tst_dev_bytes_written(const char *dev);
-/*
- * Wipe the contents of given directory but keep the directory itself
- */
-void tst_purge_dir(const char *path);
-
-/*
- * Find the file or path belongs to which block dev
- * @path Path to find the backing dev
- * @dev The block dev
- */
-void tst_find_backing_dev(const char *path, char *dev);
-
#endif /* TST_DEVICE_H__ */
diff --git a/include/tst_fips.h b/include/tst_fips.h
deleted file mode 100644
index 881c32391..000000000
--- a/include/tst_fips.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
- */
-
-#ifndef TST_FIPS_H__
-#define TST_FIPS_H__
-
-/*
- * Detect whether FIPS enabled
- * @return 0: FIPS not enabled, 1: FIPS enabled
- */
-int tst_fips_enabled(void);
-
-#endif /* TST_FIPS_H__ */
diff --git a/include/tst_fs.h b/include/tst_fs.h
index 36d4b46f0..386fea3cd 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_FS_H__
@@ -29,7 +42,6 @@
#define TST_NILFS_MAGIC 0x3434
#define TST_EXOFS_MAGIC 0x5DF5
#define TST_OVERLAYFS_MAGIC 0x794c7630
-#define TST_FUSE_MAGIC 0x65735546
enum {
TST_BYTES = 1,
@@ -142,15 +154,6 @@ int tst_get_path(const char *prog_name, char *buf, size_t buf_len);
int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount);
/*
- * Preallocate space in open file. If fallocate() fails, falls back to
- * using tst_fill_fd().
- * @fd: file descriptor
- * @bs: block size
- * @bcount: blocks count
- */
-int tst_prealloc_size_fd(int fd, size_t bs, size_t bcount);
-
-/*
* Creates/ovewrites a file with specified pattern
* @path: path to file
* @pattern: pattern
@@ -159,56 +162,18 @@ int tst_prealloc_size_fd(int fd, size_t bs, size_t bcount);
*/
int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount);
-/*
- * Creates file of specified size. Space will be only preallocated if possible.
- * @path: path to file
- * @bs: block size
- * @bcount: blocks amount
- */
-int tst_prealloc_file(const char *path, size_t bs, size_t bcount);
-
-enum tst_fs_impl {
- TST_FS_UNSUPPORTED = 0,
- TST_FS_KERNEL = 1,
- TST_FS_FUSE = 2,
-};
+#define TST_FS_SKIP_FUSE 0x01
/*
- * Returns if filesystem is suppored and if driver is in kernel or FUSE.
- *
- * @fs_type A filesystem name to check the support for.
+ * Return 1 if a specified fiilsystem is supported
+ * Return 0 if a specified fiilsystem isn't supported
*/
-enum tst_fs_impl tst_fs_is_supported(const char *fs_type);
+int tst_fs_is_supported(const char *fs_type, int flags);
/*
* Returns NULL-terminated array of kernel-supported filesystems.
- *
- * @skiplist A NULL terminated array of filesystems to skip.
-*/
-const char **tst_get_supported_fs_types(const char *const *skiplist);
-
-/*
- * Returns 1 if filesystem is in skiplist 0 otherwise.
- *
- * @fs_type A filesystem type to lookup.
- * @skiplist A NULL terminated array of fileystemsytems to skip.
- */
-int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist);
-
-/*
- * Check whether device supports FS quotas. Negative return value means that
- * quotas appear to be broken.
- */
-int tst_check_quota_support(const char *device, int format, char *quotafile);
-
-/*
- * Check for quota support and terminate the test with appropriate exit status
- * if quotas are not supported or broken.
*/
-#define tst_require_quota_support(dev, fmt, qfile) \
- tst_require_quota_support_(__FILE__, __LINE__, (dev), (fmt), (qfile))
-void tst_require_quota_support_(const char *file, const int lineno,
- const char *device, int format, char *quotafile);
+const char **tst_get_supported_fs_types(int flags);
/*
* Creates and writes to files on given path until write fails with ENOSPC
diff --git a/include/tst_fuzzy_sync.h b/include/tst_fuzzy_sync.h
index 775f5cb3b..cc569cb3c 100644
--- a/include/tst_fuzzy_sync.h
+++ b/include/tst_fuzzy_sync.h
@@ -59,13 +59,12 @@
* @sa tst_fzsync_pair
*/
-#include <math.h>
-#include <stdbool.h>
-#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
+#include <math.h>
+#include <stdlib.h>
+#include <pthread.h>
#include "tst_atomic.h"
-#include "tst_cpu.h"
#include "tst_timer.h"
#include "tst_safe_pthread.h"
@@ -181,15 +180,6 @@ struct tst_fzsync_pair {
int exec_loop;
/** Internal; The second thread or 0 */
pthread_t thread_b;
- /**
- * The flag indicates single core machines or not
- *
- * If running on single core machines, it would take considerable
- * amount of time to run fuzzy sync library.
- * Thus call sched_yield to give up cpu to decrease the test time.
- */
- bool yield_in_wait;
-
};
#define CHK(param, low, hi, def) do { \
@@ -216,9 +206,6 @@ static void tst_fzsync_pair_init(struct tst_fzsync_pair *pair)
CHK(max_dev_ratio, 0, 1, 0.1);
CHK(exec_time_p, 0, 1, 0.5);
CHK(exec_loops, 20, INT_MAX, 3000000);
-
- if (tst_ncpus_available() <= 1)
- pair->yield_in_wait = 1;
}
#undef CHK
@@ -233,13 +220,46 @@ static void tst_fzsync_pair_cleanup(struct tst_fzsync_pair *pair)
{
if (pair->thread_b) {
/* Revoke thread B if parent hits accidental break */
- if (!pair->exit)
+ if (!pair->exit) {
tst_atomic_store(1, &pair->exit);
+ usleep(100000);
+
+/*
+ * b/148414662
+ * Android does not support pthread_cancel. This mechanism is just used to avoid
+ * a timeout in a rare failure case and is not required for proper operation, so
+ * just skip it for now (effort will be made upstream to remove the use of
+ * pthread_cancel).
+ * pthread_cancel(pair->thread_b);
+ */
+ }
SAFE_PTHREAD_JOIN(pair->thread_b, NULL);
pair->thread_b = 0;
}
}
+/** To store the run_b pointer and pass to tst_fzsync_thread_wrapper */
+struct tst_fzsync_run_thread {
+ void *(*func)(void *);
+ void *arg;
+};
+
+/**
+ * Wrap run_b for tst_fzsync_pair_reset to enable pthread cancel
+ * at the start of the thread B.
+ */
+static void *tst_fzsync_thread_wrapper(void *run_thread)
+{
+ struct tst_fzsync_run_thread t = *(struct tst_fzsync_run_thread *)run_thread;
+
+/*
+ * See above comment for b/148414662
+ * pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+ * pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+ */
+ return t.func(t.arg);
+}
+
/**
* Zero some stat fields
*
@@ -280,7 +300,6 @@ static void tst_fzsync_pair_reset(struct tst_fzsync_pair *pair,
tst_init_stat(&pair->diff_ab);
tst_init_stat(&pair->spins_avg);
pair->delay = 0;
- pair->delay_bias = 0;
pair->sampling = pair->min_samples;
pair->exec_loop = 0;
@@ -288,8 +307,10 @@ static void tst_fzsync_pair_reset(struct tst_fzsync_pair *pair,
pair->a_cntr = 0;
pair->b_cntr = 0;
pair->exit = 0;
- if (run_b)
- SAFE_PTHREAD_CREATE(&pair->thread_b, 0, run_b, 0);
+ if (run_b) {
+ struct tst_fzsync_run_thread wrap_run_b = {.func = run_b, .arg = NULL};
+ SAFE_PTHREAD_CREATE(&pair->thread_b, 0, tst_fzsync_thread_wrapper, &wrap_run_b);
+ }
pair->exec_time_start = (float)tst_timeout_remaining();
}
@@ -498,15 +519,15 @@ static void tst_fzsync_pair_update(struct tst_fzsync_pair *pair)
per_spin_time = fabsf(pair->diff_ab.avg) / MAX(pair->spins_avg.avg, 1.0f);
time_delay = drand48() * (pair->diff_sa.avg + pair->diff_sb.avg)
- pair->diff_sb.avg;
- pair->delay += (int)(1.1 * time_delay / per_spin_time);
+ pair->delay += (int)(time_delay / per_spin_time);
if (!pair->sampling) {
tst_res(TINFO,
"Reached deviation ratios < %.2f, introducing randomness",
pair->max_dev_ratio);
- tst_res(TINFO, "Delay range is [%d, %d]",
- -(int)(pair->diff_sb.avg / per_spin_time) + pair->delay_bias,
- (int)(pair->diff_sa.avg / per_spin_time) + pair->delay_bias);
+ tst_res(TINFO, "Delay range is [-%d, %d]",
+ (int)(pair->diff_sb.avg / per_spin_time) + pair->delay_bias,
+ (int)(pair->diff_sa.avg / per_spin_time) - pair->delay_bias);
tst_fzsync_pair_info(pair);
pair->sampling = -1;
}
@@ -526,7 +547,6 @@ static void tst_fzsync_pair_update(struct tst_fzsync_pair *pair)
* @param our_cntr The counter for the thread we are on
* @param other_cntr The counter for the thread we are synchronising with
* @param spins A pointer to the spin counter or NULL
- * @param exit Exit flag when we need to break out of the wait loop
*
* Used by tst_fzsync_pair_wait_a(), tst_fzsync_pair_wait_b(),
* tst_fzsync_start_race_a(), etc. If the calling thread is ahead of the other
@@ -538,9 +558,7 @@ static void tst_fzsync_pair_update(struct tst_fzsync_pair *pair)
*/
static inline void tst_fzsync_pair_wait(int *our_cntr,
int *other_cntr,
- int *spins,
- int *exit,
- bool yield_in_wait)
+ int *spins)
{
if (tst_atomic_inc(other_cntr) == INT_MAX) {
/*
@@ -550,59 +568,27 @@ static inline void tst_fzsync_pair_wait(int *our_cntr,
* line above before doing that. If we are in rear position
* then our counter may already have been set to zero.
*/
- if (yield_in_wait) {
- while (tst_atomic_load(our_cntr) > 0
- && tst_atomic_load(our_cntr) < INT_MAX
- && !tst_atomic_load(exit)) {
- if (spins)
- (*spins)++;
-
- sched_yield();
- }
- } else {
- while (tst_atomic_load(our_cntr) > 0
- && tst_atomic_load(our_cntr) < INT_MAX
- && !tst_atomic_load(exit)) {
- if (spins)
- (*spins)++;
- }
+ while (tst_atomic_load(our_cntr) > 0
+ && tst_atomic_load(our_cntr) < INT_MAX) {
+ if (spins)
+ (*spins)++;
}
-
tst_atomic_store(0, other_cntr);
/*
* Once both counters have been set to zero the invariant
* is restored and we can continue.
*/
- if (yield_in_wait) {
- while (tst_atomic_load(our_cntr) > 1
- && !tst_atomic_load(exit))
- sched_yield();
- } else {
- while (tst_atomic_load(our_cntr) > 1
- && !tst_atomic_load(exit))
- ;
- }
+ while (tst_atomic_load(our_cntr) > 1)
+ ;
} else {
/*
* If our counter is less than the other thread's we are ahead
* of it and need to wait.
*/
- if (yield_in_wait) {
- while (tst_atomic_load(our_cntr) <
- tst_atomic_load(other_cntr)
- && !tst_atomic_load(exit)) {
- if (spins)
- (*spins)++;
- sched_yield();
- }
- } else {
- while (tst_atomic_load(our_cntr) <
- tst_atomic_load(other_cntr)
- && !tst_atomic_load(exit)) {
- if (spins)
- (*spins)++;
- }
+ while (tst_atomic_load(our_cntr) < tst_atomic_load(other_cntr)) {
+ if (spins)
+ (*spins)++;
}
}
}
@@ -615,8 +601,7 @@ static inline void tst_fzsync_pair_wait(int *our_cntr,
*/
static inline void tst_fzsync_wait_a(struct tst_fzsync_pair *pair)
{
- tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr,
- NULL, &pair->exit, pair->yield_in_wait);
+ tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr, NULL);
}
/**
@@ -627,8 +612,7 @@ static inline void tst_fzsync_wait_a(struct tst_fzsync_pair *pair)
*/
static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair)
{
- tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr,
- NULL, &pair->exit, pair->yield_in_wait);
+ tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, NULL);
}
/**
@@ -644,6 +628,7 @@ static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair)
*/
static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair)
{
+ int exit = 0;
float rem_p = 1 - tst_timeout_remaining() / pair->exec_time_start;
if ((pair->exec_time_p * SAMPLING_SLICE < rem_p)
@@ -658,18 +643,19 @@ static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair)
if (pair->exec_time_p < rem_p) {
tst_res(TINFO,
"Exceeded execution time, requesting exit");
- tst_atomic_store(1, &pair->exit);
+ exit = 1;
}
if (++pair->exec_loop > pair->exec_loops) {
tst_res(TINFO,
"Exceeded execution loops, requesting exit");
- tst_atomic_store(1, &pair->exit);
+ exit = 1;
}
+ tst_atomic_store(exit, &pair->exit);
tst_fzsync_wait_a(pair);
- if (pair->exit) {
+ if (exit) {
tst_fzsync_pair_cleanup(pair);
return 0;
}
@@ -716,15 +702,8 @@ static inline void tst_fzsync_start_race_a(struct tst_fzsync_pair *pair)
tst_fzsync_wait_a(pair);
delay = pair->delay;
- if (pair->yield_in_wait) {
- while (delay < 0) {
- sched_yield();
- delay++;
- }
- } else {
- while (delay < 0)
- delay++;
- }
+ while (delay < 0)
+ delay++;
tst_fzsync_time(&pair->a_start);
}
@@ -738,8 +717,7 @@ static inline void tst_fzsync_start_race_a(struct tst_fzsync_pair *pair)
static inline void tst_fzsync_end_race_a(struct tst_fzsync_pair *pair)
{
tst_fzsync_time(&pair->a_end);
- tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr,
- &pair->spins, &pair->exit, pair->yield_in_wait);
+ tst_fzsync_pair_wait(&pair->a_cntr, &pair->b_cntr, &pair->spins);
}
/**
@@ -755,15 +733,8 @@ static inline void tst_fzsync_start_race_b(struct tst_fzsync_pair *pair)
tst_fzsync_wait_b(pair);
delay = pair->delay;
- if (pair->yield_in_wait) {
- while (delay > 0) {
- sched_yield();
- delay--;
- }
- } else {
- while (delay > 0)
- delay--;
- }
+ while (delay > 0)
+ delay--;
tst_fzsync_time(&pair->b_start);
}
@@ -777,8 +748,7 @@ static inline void tst_fzsync_start_race_b(struct tst_fzsync_pair *pair)
static inline void tst_fzsync_end_race_b(struct tst_fzsync_pair *pair)
{
tst_fzsync_time(&pair->b_end);
- tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr,
- &pair->spins, &pair->exit, pair->yield_in_wait);
+ tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, &pair->spins);
}
/**
diff --git a/include/tst_get_bad_addr.h b/include/tst_get_bad_addr.h
index 69d740209..aed1752b8 100644
--- a/include/tst_get_bad_addr.h
+++ b/include/tst_get_bad_addr.h
@@ -1,6 +1,19 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_GET_BAD_ADDR_H__
diff --git a/include/tst_hugepage.h b/include/tst_hugepage.h
deleted file mode 100644
index e08a2daa2..000000000
--- a/include/tst_hugepage.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Red Hat, Inc.
- */
-
-#ifndef TST_HUGEPAGE__
-#define TST_HUGEPAGE__
-
-#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/"
-#define PATH_NR_HPAGES "/proc/sys/vm/nr_hugepages"
-
-extern char *nr_opt; /* -s num Set the number of the been allocated hugepages */
-extern char *Hopt; /* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */
-
-/*
- * Get the default hugepage size. Returns 0 if hugepages are not supported.
- */
-size_t tst_get_hugepage_size(void);
-
-/*
- * Try the best to request a specified number of huge pages from system,
- * it will store the reserved hpage number in tst_hugepages.
- *
- * Note: this depend on the status of system memory fragmentation.
- */
-unsigned long tst_request_hugepages(unsigned long hpages);
-
-/*
- * This variable is used for recording the number of hugepages which system can
- * provides. It will be equal to 'hpages' if tst_request_hugepages on success,
- * otherwise set it to a number of hugepages that we were able to reserve.
- *
- * If system does not support hugetlb, then it will be set to 0.
- */
-extern unsigned long tst_hugepages;
-
-#endif /* TST_HUGEPAGE_H */
diff --git a/include/tst_kconfig.h b/include/tst_kconfig.h
index 1bb21fea8..2d2cfd782 100644
--- a/include/tst_kconfig.h
+++ b/include/tst_kconfig.h
@@ -6,27 +6,27 @@
#ifndef TST_KCONFIG_H__
#define TST_KCONFIG_H__
-struct tst_kconfig_var {
- char id[64];
- unsigned int id_len;
- char choice;
- char *val;
+struct tst_kconfig_res {
+ char match;
+ char *value;
};
/**
- *
- * Reads a kernel config, parses it and writes results into an array of
- * tst_kconfig_var structures.
+ * Reads a kernel config and parses it for values defined in kconfigs array.
*
* The path to the kernel config should be autodetected in most of the cases as
* the code looks for know locations. It can be explicitely set/overrided with
* the KCONFIG_PATH environment variable as well.
*
- * The caller has to initialize the tst_kconfig_var structure. The id has to be
- * filled with config variable name such as 'CONFIG_FOO', the id_len should
- * hold the id string length and the choice and val has to be zeroed.
+ * The kcofings array is expected to contain strings in a format "CONFIG_FOO"
+ * or "CONFIG_FOO=bar". The result array has to be suitably sized to fit the
+ * results.
+ *
+ * @param kconfigs array of config strings to look for
+ * @param results array to store results to
+ * @param cnt size of the arrays
*
- * After a call to this function each choice be set as follows:
+ * The match in the tst_kconfig_res structure is set as follows:
*
* 'm' - config option set to m
* 'y' - config option set to y
@@ -34,13 +34,11 @@ struct tst_kconfig_var {
* 'n' - config option is not set
* 0 - config option not found
*
- * In the case that match is set to 'v' the val pointer points to a newly
- * allocated string that holds the value.
- *
- * @param vars An array of caller initalized tst_kconfig_var structures.
- * @param vars_len Length of the vars array.
+ * In the case that match is set to 'v' the value points to a newly allocated
+ * string that holds the value.
*/
-void tst_kconfig_read(struct tst_kconfig_var vars[], size_t vars_len);
+void tst_kconfig_read(const char *const kconfigs[],
+ struct tst_kconfig_res results[], size_t cnt);
/**
* Checks if required kernel configuration options are set in the kernel
diff --git a/include/tst_kernel.h b/include/tst_kernel.h
index 9e17bb71e..88941e160 100644
--- a/include/tst_kernel.h
+++ b/include/tst_kernel.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_KERNEL_H__
@@ -13,11 +26,9 @@ int tst_kernel_bits(void);
/**
* Checks support for the kernel driver.
*
- * @param driver The name of the driver.
- * @return Returns 0 if the kernel has the driver,
- * -1 when driver is missing or config file not available.
- * On Android *always* 0 (always expect the driver is available).
+ * @param name The name of the driver.
+ * @return Returns 0 if the kernel has the driver or modprobe is missing.
*/
-int tst_check_driver(const char *driver);
+int tst_check_driver(const char *name);
#endif /* TST_KERNEL_H__ */
diff --git a/include/tst_kvercmp.h b/include/tst_kvercmp.h
index 495e8db1f..134997678 100644
--- a/include/tst_kvercmp.h
+++ b/include/tst_kvercmp.h
@@ -1,6 +1,34 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2009-2016 Cyril Hrubis chrubis@suse.cz
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*/
#ifndef TST_KVERCMP_H__
@@ -30,7 +58,7 @@ int tst_kvexcmp(const char *tst_exv, const char *cur_kver);
/*
* Compare given kernel version with currently running kernel.
*
- * Returns negative if older, 0 if the same and possitive if newer.
+ * Returns negative if older, 0 if the smame and possitive if newer.
*/
int tst_kvercmp(int r1, int r2, int r3);
diff --git a/include/tst_lockdown.h b/include/tst_lockdown.h
deleted file mode 100644
index 2bd1aa251..000000000
--- a/include/tst_lockdown.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#ifndef TST_LOCKDOWN_H
-#define TST_LOCKDOWN_H
-
-int tst_secureboot_enabled(void);
-int tst_lockdown_enabled(void);
-
-#endif /* TST_LOCKDOWN_H */
diff --git a/include/tst_memutils.h b/include/tst_memutils.h
deleted file mode 100644
index 91dad07cd..000000000
--- a/include/tst_memutils.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-#ifndef TST_MEMUTILS_H__
-#define TST_MEMUTILS_H__
-
-/*
- * Fill up to maxsize physical memory with fillchar, then free it for reuse.
- * If maxsize is zero, fill as much memory as possible. This function is
- * intended for data disclosure vulnerability tests to reduce the probability
- * that a vulnerable kernel will leak a block of memory that was full of
- * zeroes by chance.
- *
- * The function keeps a safety margin to avoid invoking OOM killer and
- * respects the limitations of available address space. (Less than 3GB can be
- * polluted on a 32bit system regardless of available physical RAM.)
- */
-void tst_pollute_memory(size_t maxsize, int fillchar);
-
-#endif /* TST_MEMUTILS_H__ */
diff --git a/include/tst_minmax.h b/include/tst_minmax.h
index 6417dd703..838c3a831 100644
--- a/include/tst_minmax.h
+++ b/include/tst_minmax.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_MINMAX_H__
diff --git a/include/tst_mkfs.h b/include/tst_mkfs.h
index b89bf812f..eb5f6642a 100644
--- a/include/tst_mkfs.h
+++ b/include/tst_mkfs.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_MKFS_H__
diff --git a/include/tst_module.h b/include/tst_module.h
deleted file mode 100644
index 2654c5afb..000000000
--- a/include/tst_module.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
- * Alexey Kodanev <alexey.kodanev@oracle.com>
- */
-
-#ifndef TST_MODULE_H
-#define TST_MODULE_H
-
-void tst_module_exists_(void (cleanup_fn)(void), const char *mod_name,
- char **mod_path);
-
-static inline void tst_module_exists(const char *mod_name, char **mod_path)
-{
- tst_module_exists_(NULL, mod_name, mod_path);
-}
-
-void tst_module_load_(void (cleanup_fn)(void), const char *mod_name,
- char *const argv[]);
-
-static inline void tst_module_load(const char *mod_name, char *const argv[])
-{
- tst_module_load_(NULL, mod_name, argv);
-}
-
-void tst_module_unload_(void (cleanup_fn)(void), const char *mod_name);
-
-static inline void tst_module_unload(const char *mod_name)
-{
- tst_module_unload_(NULL, mod_name);
-}
-
-#endif /* TST_MODULE_H */
diff --git a/include/tst_net.h b/include/tst_net.h
index daefdd9d9..e1edc7200 100644
--- a/include/tst_net.h
+++ b/include/tst_net.h
@@ -3,33 +3,142 @@
* Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
*/
-#ifndef TST_NET_H_
-#define TST_NET_H_
-
#include <arpa/inet.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <sys/types.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAX_IPV4_PREFIX 32
+#define MAX_IPV6_PREFIX 128
+
+#define tst_res_comment(...) { \
+ fprintf(stderr, "# "); \
+ tst_res(__VA_ARGS__); } \
+
-void tst_get_in_addr(const char *ip_str, struct in_addr *ip);
-void tst_get_in6_addr(const char *ip_str, struct in6_addr *ip6);
+#define tst_brk_comment(...) { \
+ fprintf(stderr, "# "); \
+ tst_brk(TCONF, __VA_ARGS__); } \
+
+static inline void print_svar(const char *name, const char *val)
+{
+ if (name && val)
+ printf("export %s=\"%s\"\n", name, val);
+}
+
+static inline void print_svar_change(const char *name, const char *val)
+{
+ if (name && val)
+ printf("export %s=\"${%s:-%s}\"\n", name, name, val);
+}
/*
- * Find valid connection address for a given bound socket
+ * Function bit_count is from ipcalc project, ipcalc.c.
*/
-socklen_t tst_get_connect_address(int sock, struct sockaddr_storage *addr);
+static inline int bit_count(uint32_t i)
+{
+ int c = 0;
+ unsigned int seen_one = 0;
+
+ while (i > 0) {
+ if (i & 1) {
+ seen_one = 1;
+ c++;
+ } else {
+ if (seen_one)
+ return -1;
+ }
+ i >>= 1;
+ }
+
+ return c;
+}
/*
- * Initialize AF_INET/AF_INET6 socket address structure with address and port
+ * Function mask2prefix is from ipcalc project, ipcalc.c.
*/
-void tst_init_sockaddr_inet(struct sockaddr_in *sa, const char *ip_str, uint16_t port);
-void tst_init_sockaddr_inet_bin(struct sockaddr_in *sa, uint32_t ip_val, uint16_t port);
-void tst_init_sockaddr_inet6(struct sockaddr_in6 *sa, const char *ip_str, uint16_t port);
-void tst_init_sockaddr_inet6_bin(struct sockaddr_in6 *sa, const struct in6_addr *ip_val, uint16_t port);
+static inline int mask2prefix(struct in_addr mask)
+{
+ return bit_count(ntohl(mask.s_addr));
+}
+
+/*
+ * Function ipv4_mask_to_int is from ipcalc project, ipcalc.c.
+ */
+static inline int ipv4_mask_to_int(const char *prefix)
+{
+ int ret;
+ struct in_addr in;
+
+ ret = inet_pton(AF_INET, prefix, &in);
+ if (ret == 0)
+ return -1;
+
+ return mask2prefix(in);
+}
+
+/*
+ * Function safe_atoi is from ipcalc project, ipcalc.c.
+ */
+static inline int safe_atoi(const char *s, int *ret_i)
+{
+ char *x = NULL;
+ long l;
+
+ errno = 0;
+ l = strtol(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno > 0 ? -errno : -EINVAL;
+
+ if ((long)(int)l != l)
+ return -ERANGE;
+
+ *ret_i = (int)l;
+
+ return 0;
+}
+
+/*
+ * Function get_prefix use code from ipcalc project, str_to_prefix/ipcalc.c.
+ */
+static inline int get_prefix(const char *ip_str, int is_ipv6)
+{
+ char *prefix_str = NULL;
+ int prefix = -1, r;
+
+ prefix_str = strchr(ip_str, '/');
+ if (!prefix_str)
+ return -1;
+
+ *(prefix_str++) = '\0';
+
+ if (!is_ipv6 && strchr(prefix_str, '.'))
+ prefix = ipv4_mask_to_int(prefix_str);
+ else {
+ r = safe_atoi(prefix_str, &prefix);
+ if (r != 0)
+ tst_brk_comment("conversion error: '%s' is not integer",
+ prefix_str);
+ }
+
+ if (prefix < 0 || ((is_ipv6 && prefix > MAX_IPV6_PREFIX) ||
+ (!is_ipv6 && prefix > MAX_IPV4_PREFIX)))
+ tst_brk_comment("bad %s prefix: %s", is_ipv6 ? "IPv6" : "IPv4",
+ prefix_str);
+
+ return prefix;
+}
-void safe_getaddrinfo(const char *file, const int lineno, const char *src_addr,
- const char *port, const struct addrinfo *hints,
- struct addrinfo **addr_info);
+static inline void get_in_addr(const char *ip_str, struct in_addr *ip)
+{
+ if (inet_pton(AF_INET, ip_str, ip) <= 0)
+ tst_brk_comment("bad IPv4 address: '%s'", ip_str);
+}
-#endif /* TST_NET_H_ */
+static inline void get_in6_addr(const char *ip_str, struct in6_addr *ip6)
+{
+ if (inet_pton(AF_INET6, ip_str, ip6) <= 0)
+ tst_brk_comment("bad IPv6 address: '%s'", ip_str);
+}
diff --git a/include/tst_netdevice.h b/include/tst_netdevice.h
deleted file mode 100644
index 3a6698731..000000000
--- a/include/tst_netdevice.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright (c) 2021 Linux Test Project
- */
-
-#ifndef TST_NETDEVICE_H
-#define TST_NETDEVICE_H
-
-/* Find device index for given network interface name. */
-int tst_netdev_index_by_name(const char *file, const int lineno,
- const char *ifname);
-#define NETDEV_INDEX_BY_NAME(ifname) \
- tst_netdev_index_by_name(__FILE__, __LINE__, (ifname))
-
-/* Activate or deactivate network interface */
-int tst_netdev_set_state(const char *file, const int lineno,
- const char *ifname, int up);
-#define NETDEV_SET_STATE(ifname, up) \
- tst_netdev_set_state(__FILE__, __LINE__, (ifname), (up))
-
-/* Create a connected pair of virtual network devices */
-int tst_create_veth_pair(const char *file, const int lineno,
- const char *ifname1, const char *ifname2);
-#define CREATE_VETH_PAIR(ifname1, ifname2) \
- tst_create_veth_pair(__FILE__, __LINE__, (ifname1), (ifname2))
-
-int tst_remove_netdev(const char *file, const int lineno, const char *ifname);
-#define REMOVE_NETDEV(ifname) tst_remove_netdev(__FILE__, __LINE__, (ifname))
-
-int tst_netdev_add_address(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *address,
- unsigned int prefix, size_t addrlen, unsigned int flags);
-#define NETDEV_ADD_ADDRESS(ifname, family, address, prefix, addrlen, flags) \
- tst_netdev_add_address(__FILE__, __LINE__, (ifname), (family), \
- (address), (prefix), (addrlen), (flags))
-
-int tst_netdev_add_address_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t address, unsigned int prefix,
- unsigned int flags);
-#define NETDEV_ADD_ADDRESS_INET(ifname, address, prefix, flags) \
- tst_netdev_add_address_inet(__FILE__, __LINE__, (ifname), (address), \
- (prefix), (flags))
-
-int tst_netdev_remove_address(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *address,
- size_t addrlen);
-#define NETDEV_REMOVE_ADDRESS(ifname, family, address, addrlen) \
- tst_netdev_remove_address(__FILE__, __LINE__, (ifname), (family), \
- (address), (addrlen))
-
-int tst_netdev_remove_address_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t address);
-#define NETDEV_REMOVE_ADDRESS_INET(ifname, address) \
- tst_netdev_remove_address_inet(__FILE__, __LINE__, (ifname), (address))
-
-int tst_netdev_change_ns_fd(const char *file, const int lineno,
- const char *ifname, int nsfd);
-#define NETDEV_CHANGE_NS_FD(ifname, nsfd) \
- tst_netdev_change_ns_fd(__FILE__, __LINE__, (ifname), (nsfd))
-
-int tst_netdev_change_ns_pid(const char *file, const int lineno,
- const char *ifname, pid_t nspid);
-#define NETDEV_CHANGE_NS_PID(ifname, nspid) \
- tst_netdev_change_ns_pid(__FILE__, __LINE__, (ifname), (nspid))
-
-/*
- * Add new static entry to main routing table. If you specify gateway address,
- * the interface name is optional.
- */
-int tst_netdev_add_route(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *srcaddr,
- unsigned int srcprefix, size_t srclen, const void *dstaddr,
- unsigned int dstprefix, size_t dstlen, const void *gateway,
- size_t gatewaylen);
-#define NETDEV_ADD_ROUTE(ifname, family, srcaddr, srcprefix, srclen, dstaddr, \
- dstprefix, dstlen, gateway, gatewaylen) \
- tst_netdev_add_route(__FILE__, __LINE__, (ifname), (family), \
- (srcaddr), (srcprefix), (srclen), (dstaddr), (dstprefix), \
- (dstlen), (gateway), (gatewaylen))
-
-/*
- * Simplified function for adding IPv4 static route. If you set srcprefix
- * or dstprefix to 0, the corresponding address will be ignored. Interface
- * name is optional if gateway address is non-zero.
- */
-int tst_netdev_add_route_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t srcaddr, unsigned int srcprefix,
- in_addr_t dstaddr, unsigned int dstprefix, in_addr_t gateway);
-#define NETDEV_ADD_ROUTE_INET(ifname, srcaddr, srcprefix, dstaddr, dstprefix, \
- gateway) \
- tst_netdev_add_route_inet(__FILE__, __LINE__, (ifname), (srcaddr), \
- (srcprefix), (dstaddr), (dstprefix), (gateway))
-
-/*
- * Remove static entry from main routing table.
- */
-int tst_netdev_remove_route(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *srcaddr,
- unsigned int srcprefix, size_t srclen, const void *dstaddr,
- unsigned int dstprefix, size_t dstlen, const void *gateway,
- size_t gatewaylen);
-#define NETDEV_REMOVE_ROUTE(ifname, family, srcaddr, srcprefix, srclen, \
- dstaddr, dstprefix, dstlen, gateway, gatewaylen) \
- tst_netdev_remove_route(__FILE__, __LINE__, (ifname), (family), \
- (srcaddr), (srcprefix), (srclen), (dstaddr), (dstprefix), \
- (dstlen), (gateway), (gatewaylen))
-
-/*
- * Simplified function for removing IPv4 static route.
- */
-int tst_netdev_remove_route_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t srcaddr, unsigned int srcprefix,
- in_addr_t dstaddr, unsigned int dstprefix, in_addr_t gateway);
-#define NETDEV_REMOVE_ROUTE_INET(ifname, srcaddr, srcprefix, dstaddr, \
- dstprefix, gateway) \
- tst_netdev_remove_route_inet(__FILE__, __LINE__, (ifname), (srcaddr), \
- (srcprefix), (dstaddr), (dstprefix), (gateway))
-
-#endif /* TST_NETDEVICE_H */
diff --git a/include/tst_netlink.h b/include/tst_netlink.h
index 2030ac30b..892ef8f78 100644
--- a/include/tst_netlink.h
+++ b/include/tst_netlink.h
@@ -1,7 +1,19 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2018 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
/**
* @file tst_netlink.h
*
diff --git a/include/tst_numa.h b/include/tst_numa.h
index 846e093a9..4f9806602 100644
--- a/include/tst_numa.h
+++ b/include/tst_numa.h
@@ -1,4 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
* Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
*/
diff --git a/include/tst_pid.h b/include/tst_pid.h
index 9ba1abb27..9c1c65214 100644
--- a/include/tst_pid.h
+++ b/include/tst_pid.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_PID_H__
diff --git a/include/tst_private.h b/include/tst_private.h
deleted file mode 100644
index fe0955f3b..000000000
--- a/include/tst_private.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
- *
- * Internal helper functions for the shell library. Do not use directly
- * in test programs.
- */
-
-#ifndef TST_PRIVATE_H_
-#define TST_PRIVATE_H_
-
-#include <stdio.h>
-#include <netdb.h>
-
-#define MAX_IPV4_PREFIX 32
-#define MAX_IPV6_PREFIX 128
-
-#define tst_res_comment(...) { \
- fprintf(stderr, "# "); \
- tst_res(__VA_ARGS__); } \
-
-
-#define tst_brk_comment(...) { \
- fprintf(stderr, "# "); \
- tst_brk(TCONF, __VA_ARGS__); } \
-
-void tst_print_svar(const char *name, const char *val);
-void tst_print_svar_change(const char *name, const char *val);
-
-int tst_get_prefix(const char *ip_str, int is_ipv6);
-
-/*
- * Checks kernel config for a single configuration option and returns its
- * state if found. The possible return values are the same as for
- * tst_kconfig_var.choice, with the same meaning. See tst_kconfig_read()
- * description in tst_kconfig.h.
- */
-char tst_kconfig_get(const char *confname);
-
-#endif
diff --git a/include/tst_process_state.h b/include/tst_process_state.h
index c32aa58e6..fab0491d9 100644
--- a/include/tst_process_state.h
+++ b/include/tst_process_state.h
@@ -1,5 +1,24 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (C) 2012-2014 Cyril Hrubis chrubis@suse.cz
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
@@ -28,9 +47,9 @@
*/
#ifdef TST_TEST_H__
-#define TST_PROCESS_STATE_WAIT(pid, state, msec_timeout) \
+#define TST_PROCESS_STATE_WAIT(pid, state) \
tst_process_state_wait(__FILE__, __LINE__, NULL, \
- (pid), (state), (msec_timeout))
+ (pid), (state))
#else
/*
* The same as above but does not use tst_brkm() interface.
@@ -43,11 +62,11 @@ int tst_process_state_wait2(pid_t pid, const char state);
# define TST_PROCESS_STATE_WAIT(cleanup_fn, pid, state) \
tst_process_state_wait(__FILE__, __LINE__, (cleanup_fn), \
- (pid), (state), 0)
+ (pid), (state))
#endif
-int tst_process_state_wait(const char *file, const int lineno,
- void (*cleanup_fn)(void), pid_t pid,
- const char state, unsigned int msec_timeout);
+void tst_process_state_wait(const char *file, const int lineno,
+ void (*cleanup_fn)(void),
+ pid_t pid, const char state);
#endif /* TST_PROCESS_STATE__ */
diff --git a/include/tst_res_flags.h b/include/tst_res_flags.h
index 8eda2f8b8..b79d69a9a 100644
--- a/include/tst_res_flags.h
+++ b/include/tst_res_flags.h
@@ -1,5 +1,11 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright (c) Linux Test Project, 2014
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef TST_RES_FLAGS_H
diff --git a/include/tst_rtctime.h b/include/tst_rtctime.h
deleted file mode 100644
index c2c282e90..000000000
--- a/include/tst_rtctime.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2020 Unisoc Inc.
- */
-
-#ifndef TST_RTCTIME
-#define TST_RTCTIME
-
-#include <sys/ioctl.h>
-#include <linux/rtc.h>
-
-int tst_rtc_ioctl(const char *rtc_dev, unsigned long request,
- struct rtc_time *rtc_tm);
-
-static inline int tst_rtc_gettime(const char *rtc_dev, struct rtc_time *rtc_tm)
-{
- return tst_rtc_ioctl(rtc_dev, RTC_RD_TIME, rtc_tm);
-}
-
-static inline int tst_rtc_settime(const char *rtc_dev, struct rtc_time *rtc_tm)
-{
- return tst_rtc_ioctl(rtc_dev, RTC_SET_TIME, rtc_tm);
-}
-
-void tst_rtc_time_to_tm(long long time, struct rtc_time *tm);
-
-long long tst_rtc_tm_to_time(struct rtc_time *tm);
-
-#endif /* TST_RTCTIME */
diff --git a/include/tst_rtnetlink.h b/include/tst_rtnetlink.h
deleted file mode 100644
index 12ec258f2..000000000
--- a/include/tst_rtnetlink.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright (c) 2021 Linux Test Project
- */
-
-#ifndef TST_RTNETLINK_H
-#define TST_RTNETLINK_H
-
-struct tst_rtnl_context;
-
-struct tst_rtnl_attr_list {
- unsigned short type;
- const void *data;
- ssize_t len;
- const struct tst_rtnl_attr_list *sublist;
-};
-
-struct tst_rtnl_message {
- struct nlmsghdr *header;
- struct nlmsgerr *err;
- void *payload;
- size_t payload_size;
-};
-
-/* Open a netlink socket */
-struct tst_rtnl_context *tst_rtnl_create_context(const char *file,
- const int lineno);
-#define RTNL_CREATE_CONTEXT() tst_rtnl_create_context(__FILE__, __LINE__)
-
-/* Free a tst_rtnl_message array returned by tst_rtnl_recv() */
-void tst_rtnl_free_message(struct tst_rtnl_message *msg);
-#define RTNL_FREE_MESSAGE tst_rtnl_free_message
-
-/* Close netlink socket */
-void tst_rtnl_destroy_context(const char *file, const int lineno,
- struct tst_rtnl_context *ctx);
-#define RTNL_DESTROY_CONTEXT(ctx) \
- tst_rtnl_destroy_context(__FILE__, __LINE__, (ctx))
-
-/* Send all messages in given buffer */
-int tst_rtnl_send(const char *file, const int lineno,
- struct tst_rtnl_context *ctx);
-#define RTNL_SEND(ctx) tst_rtnl_send(__FILE__, __LINE__, (ctx))
-
-/* Send all messages in given buffer and validate kernel response */
-int tst_rtnl_send_validate(const char *file, const int lineno,
- struct tst_rtnl_context *ctx);
-#define RTNL_SEND_VALIDATE(ctx) \
- tst_rtnl_send_validate(__FILE__, __LINE__, (ctx))
-
-/* Wait until data is available for reading from the netlink socket */
-int tst_rtnl_wait(struct tst_rtnl_context *ctx);
-#define RTNL_WAIT tst_rtnl_wait
-
-/*
- * Read from netlink socket and return an array of partially parsed messages.
- * header == NULL indicates end of array.
- */
-struct tst_rtnl_message *tst_rtnl_recv(const char *file, const int lineno,
- struct tst_rtnl_context *ctx);
-#define RTNL_RECV(ctx) tst_rtnl_recv(__FILE__, __LINE__, (ctx))
-
-/* Add new message to buffer */
-int tst_rtnl_add_message(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, const struct nlmsghdr *header,
- const void *payload, size_t payload_size);
-#define RTNL_ADD_MESSAGE(ctx, header, payload, psize) \
- tst_rtnl_add_message(__FILE__, __LINE__, (ctx), (header), (payload), \
- (psize))
-
-/* Add arbitrary attribute to last message */
-int tst_rtnl_add_attr(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, unsigned short type, const void *data,
- unsigned short len);
-#define RTNL_ADD_ATTR(ctx, type, data, len) \
- tst_rtnl_add_attr(__FILE__, __LINE__, (ctx), (type), (data), (len))
-
-/* Add string attribute to last message */
-int tst_rtnl_add_attr_string(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, unsigned short type, const char *data);
-#define RTNL_ADD_ATTR_STRING(ctx, type, data) \
- tst_rtnl_add_attr_string(__FILE__, __LINE__, (ctx), (type), (data))
-
-/*
- * Add list of arbitrary attributes to last message. The list is terminated
- * by attribute with negative length. Nested sublists are supported.
- */
-int tst_rtnl_add_attr_list(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, const struct tst_rtnl_attr_list *list);
-#define RTNL_ADD_ATTR_LIST(ctx, list) \
- tst_rtnl_add_attr_list(__FILE__, __LINE__, (ctx), (list))
-
-/* Check that all sent messages with NLM_F_ACK flag have been acked without
- * error. Usage:
- *
- * tst_rtnl_send(ctx);
- * tst_rtnl_wait(ctx);
- * response = tst_rtnl_recv(ctx);
- * if (!tst_rtnl_check_acks(ctx, response)) { ... }
- * tst_rtnl_free_message(response);
- */
-int tst_rtnl_check_acks(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, struct tst_rtnl_message *response);
-#define RTNL_CHECK_ACKS(ctx, response) \
- tst_rtnl_context(__FILE__, __LINE__, (ctx), (response))
-
-#endif /* TST_RTNETLINK_H */
diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h
index 5661ce57b..34ed953b4 100644
--- a/include/tst_safe_clocks.h
+++ b/include/tst_safe_clocks.h
@@ -11,143 +11,55 @@
#include <time.h>
#include <sys/timex.h>
#include "tst_test.h"
-#include "tst_clocks.h"
#include "lapi/syscalls.h"
#include "lapi/posix_clocks.h"
-static inline int safe_clock_getres(const char *file, const int lineno,
+static inline void safe_clock_getres(const char *file, const int lineno,
clockid_t clk_id, struct timespec *res)
{
int rval;
rval = clock_getres(clk_id, res);
+ if (rval != 0)
+ tst_brk(TBROK | TERRNO,
+ "%s:%d clock_getres() failed", file, lineno);
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "clock_getres(%s) failed", tst_clock_name(clk_id));
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid clock_getres(%s) return value %d",
- tst_clock_name(clk_id), rval);
- }
-
- return rval;
}
-static inline int safe_clock_gettime(const char *file, const int lineno,
+static inline void safe_clock_gettime(const char *file, const int lineno,
clockid_t clk_id, struct timespec *tp)
{
int rval;
rval = clock_gettime(clk_id, tp);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "clock_gettime(%s) failed", tst_clock_name(clk_id));
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid clock_gettime(%s) return value %d",
- tst_clock_name(clk_id), rval);
- }
-
- return rval;
+ if (rval != 0)
+ tst_brk(TBROK | TERRNO,
+ "%s:%d clock_gettime() failed", file, lineno);
}
-static inline int safe_clock_settime(const char *file, const int lineno,
+static inline void safe_clock_settime(const char *file, const int lineno,
clockid_t clk_id, struct timespec *tp)
{
int rval;
rval = clock_settime(clk_id, tp);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "clock_gettime(%s) failed", tst_clock_name(clk_id));
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid clock_gettime(%s) return value %d",
- tst_clock_name(clk_id), rval);
- }
-
- return rval;
-}
-
-static inline int safe_timer_create(const char *file, const int lineno,
- clockid_t clockid, struct sigevent *sevp, timer_t *timerid)
-{
- int ret;
-
- errno = 0;
- ret = timer_create(clockid, sevp, timerid);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "timer_create(%s) failed", tst_clock_name(clockid));
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timer_create(%s) return value %d",
- tst_clock_name(clockid), ret);
- }
-
- return ret;
-}
-
-static inline int safe_timer_settime(const char *file, const int lineno,
- timer_t timerid, int flags, const struct itimerspec *new_value,
- struct itimerspec *old_value)
-{
- int ret;
-
- errno = 0;
- ret = timer_settime(timerid, flags, new_value, old_value);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "timer_settime() failed");
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timer_settime() return value %d", ret);
- }
-
- return ret;
-}
-
-static inline int safe_timer_gettime(const char *file, const int lineno,
- timer_t timerid, struct itimerspec *curr_value)
-{
- int ret;
-
- errno = 0;
- ret = timer_gettime(timerid, curr_value);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "timer_gettime() failed");
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timer_gettime() return value %d", ret);
- }
-
- return ret;
+ if (rval != 0)
+ tst_brk(TBROK | TERRNO,
+ "%s:%d clock_gettime() failed", file, lineno);
}
-static inline int safe_timer_delete(const char *file, const int lineno,
- timer_t timerid)
+static inline int safe_clock_adjtime(const char *file, const int lineno,
+ clockid_t clk_id, struct timex *txc)
{
- int ret;
-
- errno = 0;
- ret = timer_delete(timerid);
+ int rval;
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "timer_delete() failed");
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timer_delete() return value %d", ret);
- }
+ rval = tst_syscall(__NR_clock_adjtime, clk_id, txc);
+ if (rval < 0)
+ tst_brk(TBROK | TERRNO,
+ "%s:%d clock_adjtime() failed %i", file, lineno, rval);
- return ret;
+ return rval;
}
#define SAFE_CLOCK_GETRES(clk_id, res)\
@@ -159,17 +71,7 @@ static inline int safe_timer_delete(const char *file, const int lineno,
#define SAFE_CLOCK_SETTIME(clk_id, tp)\
safe_clock_settime(__FILE__, __LINE__, (clk_id), (tp))
-#define SAFE_TIMER_CREATE(clockid, sevp, timerid)\
- safe_timer_create(__FILE__, __LINE__, (clockid), (sevp), (timerid))
-
-#define SAFE_TIMER_SETTIME(timerid, flags, new_value, old_value)\
- safe_timer_settime(__FILE__, __LINE__, (timerid), (flags),\
- (new_value), (old_value))
-
-#define SAFE_TIMER_GETTIME(timerid, curr_value)\
- safe_timer_gettime(__FILE__, __LINE__, (timerid), (curr_value))
-
-#define SAFE_TIMER_DELETE(timerid)\
- safe_timer_delete(__FILE__, __LINE__, timerid)
+#define SAFE_CLOCK_ADJTIME(clk_id, txc)\
+ safe_clock_adjtime(__FILE__, __LINE__, (clk_id), (txc))
#endif /* SAFE_CLOCKS_H__ */
diff --git a/include/tst_safe_file_at.h b/include/tst_safe_file_at.h
deleted file mode 100644
index 8df34227f..000000000
--- a/include/tst_safe_file_at.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 SUSE LLC <rpalethorpe@suse.com>
- */
-
-#ifndef TST_SAFE_FILE_AT_H
-#define TST_SAFE_FILE_AT_H
-
-#include <sys/types.h>
-#include <stdarg.h>
-
-#define SAFE_OPENAT(dirfd, path, oflags, ...) \
- safe_openat(__FILE__, __LINE__, \
- (dirfd), (path), (oflags), ## __VA_ARGS__)
-
-#define SAFE_FILE_READAT(dirfd, path, buf, nbyte) \
- safe_file_readat(__FILE__, __LINE__, \
- (dirfd), (path), (buf), (nbyte))
-
-
-#define SAFE_FILE_PRINTFAT(dirfd, path, fmt, ...) \
- safe_file_printfat(__FILE__, __LINE__, \
- (dirfd), (path), (fmt), __VA_ARGS__)
-
-#define SAFE_UNLINKAT(dirfd, path, flags) \
- safe_unlinkat(__FILE__, __LINE__, (dirfd), (path), (flags))
-
-const char *tst_decode_fd(const int fd)
- __attribute__((warn_unused_result));
-
-int safe_openat(const char *const file, const int lineno, const int dirfd,
- const char *const path, const int oflags, ...)
- __attribute__((nonnull, warn_unused_result));
-
-ssize_t safe_file_readat(const char *const file, const int lineno,
- const int dirfd, const char *const path,
- char *const buf, const size_t nbyte)
- __attribute__ ((nonnull));
-
-int tst_file_vprintfat(const int dirfd, const char *const path,
- const char *const fmt, va_list va)
- __attribute__((nonnull));
-int tst_file_printfat(const int dirfd, const char *const path,
- const char *const fmt, ...)
- __attribute__ ((format (printf, 3, 4), nonnull));
-
-int safe_file_vprintfat(const char *const file, const int lineno,
- const int dirfd, const char *const path,
- const char *const fmt, va_list va)
- __attribute__ ((nonnull));
-
-int safe_file_printfat(const char *const file, const int lineno,
- const int dirfd, const char *const path,
- const char *const fmt, ...)
- __attribute__ ((format (printf, 5, 6), nonnull));
-
-int safe_unlinkat(const char *const file, const int lineno,
- const int dirfd, const char *const path, const int flags)
- __attribute__ ((nonnull));
-
-#endif
diff --git a/include/tst_safe_file_ops.h b/include/tst_safe_file_ops.h
index 223eddd1f..b62a7447f 100644
--- a/include/tst_safe_file_ops.h
+++ b/include/tst_safe_file_ops.h
@@ -1,5 +1,24 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (C) 2012 Cyril Hrubis chrubis@suse.cz
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef TST_SAFE_FILE_OPS
@@ -7,9 +26,6 @@
#include "safe_file_ops_fn.h"
-#define FILE_SCANF(path, fmt, ...) \
- file_scanf(__FILE__, __LINE__, (path), (fmt), ## __VA_ARGS__)
-
#define SAFE_FILE_SCANF(path, fmt, ...) \
safe_file_scanf(__FILE__, __LINE__, NULL, \
(path), (fmt), ## __VA_ARGS__)
@@ -28,14 +44,6 @@
&tst_rval); \
tst_rval;})
-#define SAFE_READ_PROC_STATUS(pid, item) \
- ({long tst_rval_; \
- char tst_path_[128]; \
- sprintf(tst_path_, "/proc/%d/status", pid); \
- SAFE_FILE_LINES_SCANF(tst_path_, item " %ld", \
- &tst_rval_); \
- tst_rval_;})
-
#define FILE_PRINTF(path, fmt, ...) \
file_printf(__FILE__, __LINE__, \
(path), (fmt), ## __VA_ARGS__)
diff --git a/include/tst_safe_io_uring.h b/include/tst_safe_io_uring.h
deleted file mode 100644
index cb26aec1e..000000000
--- a/include/tst_safe_io_uring.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) Linux Test Project, 2021
- */
-
-#ifndef TST_IO_URING_H__
-#define TST_IO_URING_H__
-
-#include "config.h"
-#include "lapi/io_uring.h"
-
-struct tst_io_uring {
- int fd;
- void *sqr_base, *cqr_base;
- /* buffer sizes in bytes for unmapping */
- size_t sqr_mapsize, cqr_mapsize;
-
- /* Number of entries in the ring buffers */
- uint32_t sqr_size, cqr_size;
-
- /* Submission queue pointers */
- struct io_uring_sqe *sqr_entries;
- const uint32_t *sqr_head, *sqr_mask, *sqr_flags, *sqr_dropped;
- uint32_t *sqr_tail, *sqr_array;
-
- /* Completion queue pointers */
- const struct io_uring_cqe *cqr_entries;
- const uint32_t *cqr_tail, *cqr_mask, *cqr_overflow;
- uint32_t *cqr_head;
-};
-
-/*
- * Call io_uring_setup() with given arguments and prepare memory mappings
- * into the tst_io_uring structure passed in the third argument.
- */
-#define SAFE_IO_URING_INIT(entries, params, uring) \
- safe_io_uring_init(__FILE__, __LINE__, (entries), (params), (uring))
-int safe_io_uring_init(const char *file, const int lineno,
- unsigned int entries, struct io_uring_params *params,
- struct tst_io_uring *uring);
-
-/*
- * Release io_uring mappings and close the file descriptor. uring->fd will
- * be set to -1 after close.
- */
-#define SAFE_IO_URING_CLOSE(uring) \
- safe_io_uring_close(__FILE__, __LINE__, (uring))
-int safe_io_uring_close(const char *file, const int lineno,
- struct tst_io_uring *uring);
-
-/*
- * Call io_uring_enter() and check for errors. The "strict" argument controls
- * pedantic check whether return value is equal to "to_submit" argument.
- */
-#define SAFE_IO_URING_ENTER(strict, fd, to_submit, min_complete, flags, sig) \
- safe_io_uring_enter(__FILE__, __LINE__, (strict), (fd), (to_submit), \
- (min_complete), (flags), (sig))
-int safe_io_uring_enter(const char *file, const int lineno, int strict,
- int fd, unsigned int to_submit, unsigned int min_complete,
- unsigned int flags, sigset_t *sig);
-
-#endif /* TST_IO_URING_H__ */
diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index dcef58bda..80c4d9cb9 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -1,6 +1,19 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2010-2018 Linux Test Project
* Copyright (c) 2011-2015 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_SAFE_MACROS_H__
@@ -12,7 +25,6 @@
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/vfs.h>
-#include <sys/sysinfo.h>
#include <fcntl.h>
#include <libgen.h>
#include <signal.h>
@@ -22,7 +34,6 @@
#include <grp.h>
#include "safe_macros_fn.h"
-#include "tst_cmd.h"
#define SAFE_BASENAME(path) \
safe_basename(__FILE__, __LINE__, NULL, (path))
@@ -45,16 +56,22 @@ int safe_chroot(const char *file, const int lineno, const char *path);
#define SAFE_DIRNAME(path) \
safe_dirname(__FILE__, __LINE__, NULL, (path))
-int safe_dup(const char *file, const int lineno, int oldfd);
+static inline int safe_dup(const char *file, const int lineno,
+ int oldfd)
+{
+ int rval;
+
+ rval = dup(oldfd);
+ if (rval == -1) {
+ tst_brk_(file, lineno, TBROK | TERRNO,
+ "dup(%i) failed", oldfd);
+ }
+ return rval;
+}
#define SAFE_DUP(oldfd) \
safe_dup(__FILE__, __LINE__, (oldfd))
-int safe_dup2(const char *file, const int lineno, int oldfd, int newfd);
-
-#define SAFE_DUP2(oldfd, newfd) \
- safe_dup2(__FILE__, __LINE__, (oldfd), (newfd))
-
#define SAFE_GETCWD(buf, size) \
safe_getcwd(__FILE__, __LINE__, NULL, (buf), (size))
@@ -67,11 +84,6 @@ int safe_dup2(const char *file, const int lineno, int oldfd, int newfd);
#define SAFE_MALLOC(size) \
safe_malloc(__FILE__, __LINE__, NULL, (size))
-void *safe_realloc(const char *file, const int lineno, void *ptr, size_t size);
-
-#define SAFE_REALLOC(ptr, size) \
- safe_realloc(__FILE__, __LINE__, (ptr), (size))
-
#define SAFE_MKDIR(pathname, mode) \
safe_mkdir(__FILE__, __LINE__, NULL, (pathname), (mode))
@@ -88,11 +100,6 @@ void *safe_realloc(const char *file, const int lineno, void *ptr, size_t size);
#define SAFE_PIPE(fildes) \
safe_pipe(__FILE__, __LINE__, NULL, (fildes))
-int safe_pipe2(const char *file, const int lineno, int fildes[2], int flags);
-
-#define SAFE_PIPE2(fildes, flags) \
- safe_pipe2(__FILE__, __LINE__, (fildes), (flags))
-
#define SAFE_READ(len_strict, fildes, buf, nbyte) \
safe_read(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte))
@@ -129,7 +136,7 @@ int safe_setreuid(const char *file, const int lineno,
int safe_setpgid(const char *file, const int lineno, pid_t pid, pid_t pgid);
#define SAFE_SETPGID(pid, pgid) \
- safe_setpgid(__FILE__, __LINE__, (pid), (pgid))
+ safe_setpgid(__FILE__, __LINE__, (pid), (pgid));
pid_t safe_getpgid(const char *file, const int lineno, pid_t pid);
@@ -140,7 +147,7 @@ pid_t safe_getpgid(const char *file, const int lineno, pid_t pid);
safe_unlink(__FILE__, __LINE__, NULL, (pathname))
#define SAFE_LINK(oldpath, newpath) \
- safe_link(__FILE__, __LINE__, NULL, (oldpath), (newpath))
+ safe_link(__FILE__, __LINE__, NULL, (oldpath), (newpath))
#define SAFE_LINKAT(olddirfd, oldpath, newdirfd, newpath, flags) \
safe_linkat(__FILE__, __LINE__, NULL, (olddirfd), (oldpath), \
@@ -150,7 +157,7 @@ pid_t safe_getpgid(const char *file, const int lineno, pid_t pid);
safe_readlink(__FILE__, __LINE__, NULL, (path), (buf), (bufsize))
#define SAFE_SYMLINK(oldpath, newpath) \
- safe_symlink(__FILE__, __LINE__, NULL, (oldpath), (newpath))
+ safe_symlink(__FILE__, __LINE__, NULL, (oldpath), (newpath))
#define SAFE_WRITE(len_strict, fildes, buf, nbyte) \
safe_write(__FILE__, __LINE__, NULL, (len_strict), (fildes), (buf), (nbyte))
@@ -177,10 +184,10 @@ pid_t safe_getpgid(const char *file, const int lineno, pid_t pid);
safe_fchown(__FILE__, __LINE__, NULL, (fd), (owner), (group))
#define SAFE_WAIT(status) \
- safe_wait(__FILE__, __LINE__, NULL, (status))
+ safe_wait(__FILE__, __LINE__, NULL, (status))
#define SAFE_WAITPID(pid, status, opts) \
- safe_waitpid(__FILE__, __LINE__, NULL, (pid), (status), (opts))
+ safe_waitpid(__FILE__, __LINE__, NULL, (pid), (status), (opts))
#define SAFE_KILL(pid, sig) \
safe_kill(__FILE__, __LINE__, NULL, (pid), (sig))
@@ -211,16 +218,13 @@ pid_t safe_getpgid(const char *file, const int lineno, pid_t pid);
#define SAFE_READDIR(dirp) \
safe_readdir(__FILE__, __LINE__, NULL, (dirp))
-#define SAFE_IOCTL_(file, lineno, fd, request, ...) \
+#define SAFE_IOCTL(fd, request, ...) \
({int tst_ret_ = ioctl(fd, request, ##__VA_ARGS__); \
tst_ret_ < 0 ? \
- tst_brk_((file), (lineno), TBROK | TERRNO, \
+ tst_brk(TBROK | TERRNO, \
"ioctl(%i,%s,...) failed", fd, #request), 0 \
: tst_ret_;})
-#define SAFE_IOCTL(fd, request, ...) \
- SAFE_IOCTL_(__FILE__, __LINE__, (fd), (request), ##__VA_ARGS__)
-
#define SAFE_FCNTL(fd, cmd, ...) \
({int tst_ret_ = fcntl(fd, cmd, ##__VA_ARGS__); \
tst_ret_ == -1 ? \
@@ -258,14 +262,10 @@ static inline int safe_ftruncate(const char *file, const int lineno,
int rval;
rval = ftruncate(fd, length);
-
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "ftruncate(%d,%ld) failed", fd, (long)length);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid ftruncate(%d,%ld) return value %d", fd,
- (long)length, rval);
+ "ftruncate(%d,%ld) failed",
+ fd, (long)length);
}
return rval;
@@ -279,14 +279,10 @@ static inline int safe_truncate(const char *file, const int lineno,
int rval;
rval = truncate(path, length);
-
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "truncate(%s,%ld) failed", path, (long)length);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid truncate(%s,%ld) return value %d", path,
- (long)length, rval);
+ "truncate(%s,%ld) failed",
+ path, (long)length);
}
return rval;
@@ -303,11 +299,7 @@ static inline int safe_stat(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "stat(%s,%p) failed", path, buf);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid stat(%s,%p) return value %d", path, buf,
- rval);
+ "stat(%s,%p) failed", path, buf);
}
return rval;
@@ -325,9 +317,6 @@ static inline int safe_fstat(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
"fstat(%d,%p) failed", fd, buf);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid fstat(%d,%p) return value %d", fd, buf, rval);
}
return rval;
@@ -345,10 +334,6 @@ static inline int safe_lstat(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
"lstat(%s,%p) failed", path, buf);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid lstat(%s,%p) return value %d", path, buf,
- rval);
}
return rval;
@@ -365,17 +350,13 @@ static inline int safe_statfs(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "statfs(%s,%p) failed", path, buf);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid statfs(%s,%p) return value %d", path, buf,
- rval);
+ "statfs(%s,%p) failed", path, buf);
}
return rval;
}
#define SAFE_STATFS(path, buf) \
- safe_statfs(__FILE__, __LINE__, (path), (buf))
+ safe_statfs(__FILE__, __LINE__, (path), (buf))
static inline off_t safe_lseek(const char *file, const int lineno,
int fd, off_t offset, int whence)
@@ -386,11 +367,8 @@ static inline off_t safe_lseek(const char *file, const int lineno,
if (rval == (off_t) -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "lseek(%d,%ld,%d) failed", fd, (long)offset, whence);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid lseek(%d,%ld,%d) return value %ld", fd,
- (long)offset, whence, (long)rval);
+ "lseek(%d,%ld,%d) failed",
+ fd, (long)offset, whence);
}
return rval;
@@ -407,11 +385,8 @@ static inline int safe_getrlimit(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "getrlimit(%d,%p) failed", resource, rlim);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid getrlimit(%d,%p) return value %d", resource,
- rlim, rval);
+ "getrlimit(%d,%p) failed",
+ resource, rlim);
}
return rval;
@@ -428,11 +403,8 @@ static inline int safe_setrlimit(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "setrlimit(%d,%p) failed", resource, rlim);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid setrlimit(%d,%p) return value %d", resource,
- rlim, rval);
+ "setrlimit(%d,%p) failed",
+ resource, rlim);
}
return rval;
@@ -441,8 +413,21 @@ static inline int safe_setrlimit(const char *file, const int lineno,
safe_setrlimit(__FILE__, __LINE__, (resource), (rlim))
typedef void (*sighandler_t)(int);
-sighandler_t safe_signal(const char *file, const int lineno,
- int signum, sighandler_t handler);
+static inline sighandler_t safe_signal(const char *file, const int lineno,
+ int signum, sighandler_t handler)
+{
+ sighandler_t rval;
+
+ rval = signal(signum, handler);
+
+ if (rval == SIG_ERR) {
+ tst_brk_(file, lineno, TBROK | TERRNO,
+ "signal(%d,%p) failed",
+ signum, handler);
+ }
+
+ return rval;
+}
#define SAFE_SIGNAL(signum, handler) \
safe_signal(__FILE__, __LINE__, (signum), (handler))
@@ -453,36 +438,6 @@ int safe_sigaction(const char *file, const int lineno,
#define SAFE_SIGACTION(signum, act, oldact) \
safe_sigaction(__FILE__, __LINE__, (signum), (act), (oldact))
-int safe_sigaddset(const char *file, const int lineno,
- sigset_t *sigs, int signo);
-#define SAFE_SIGADDSET(sigs, signo) \
- safe_sigaddset(__FILE__, __LINE__, (sigs), (signo))
-
-int safe_sigdelset(const char *file, const int lineno,
- sigset_t *sigs, int signo);
-#define SAFE_SIGDELSET(sigs, signo) \
- safe_sigdelset(__FILE__, __LINE__, (sigs), (signo))
-
-int safe_sigemptyset(const char *file, const int lineno,
- sigset_t *sigs);
-#define SAFE_SIGEMPTYSET(sigs) \
- safe_sigemptyset(__FILE__, __LINE__, (sigs))
-
-int safe_sigfillset(const char *file, const int lineno,
- sigset_t *sigs);
-#define SAFE_SIGFILLSET(sigs) \
- safe_sigfillset(__FILE__, __LINE__, (sigs))
-
-int safe_sigprocmask(const char *file, const int lineno,
- int how, sigset_t *set, sigset_t *oldset);
-#define SAFE_SIGPROCMASK(how, set, oldset) \
- safe_sigprocmask(__FILE__, __LINE__, (how), (set), (oldset))
-
-int safe_sigwait(const char *file, const int lineno,
- sigset_t *set, int *sig);
-#define SAFE_SIGWAIT(set, sig) \
- safe_sigwait(__FILE__, __LINE__, (set), (sig))
-
#define SAFE_EXECLP(file, arg, ...) do { \
execlp((file), (arg), ##__VA_ARGS__); \
tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \
@@ -495,12 +450,6 @@ int safe_sigwait(const char *file, const int lineno,
"execl(%s, %s, ...) failed", file, arg); \
} while (0)
-#define SAFE_EXECVP(file, arg) do { \
- execvp((file), (arg)); \
- tst_brk_(__FILE__, __LINE__, TBROK | TERRNO, \
- "execvp(%s, %p) failed", file, arg); \
- } while (0)
-
int safe_getpriority(const char *file, const int lineno, int which, id_t who);
#define SAFE_GETPRIORITY(which, who) \
safe_getpriority(__FILE__, __LINE__, (which), (who))
@@ -578,6 +527,11 @@ int safe_mincore(const char *file, const int lineno, void *start,
#define SAFE_MINCORE(start, length, vec) \
safe_mincore(__FILE__, __LINE__, (start), (length), (vec))
+int safe_fanotify_init(const char *file, const int lineno,
+ unsigned int flags, unsigned int event_f_flags);
+#define SAFE_FANOTIFY_INIT(fan, mode) \
+ safe_fanotify_init(__FILE__, __LINE__, (fan), (mode))
+
int safe_personality(const char *filename, unsigned int lineno,
unsigned long persona);
#define SAFE_PERSONALITY(persona) safe_personality(__FILE__, __LINE__, persona)
@@ -590,29 +544,7 @@ int safe_personality(const char *filename, unsigned int lineno,
} \
} while (0)
-int safe_unshare(const char *file, const int lineno, int flags);
+void safe_unshare(const char *file, const int lineno, int flags);
#define SAFE_UNSHARE(flags) safe_unshare(__FILE__, __LINE__, (flags))
-int safe_setns(const char *file, const int lineno, int fd, int nstype);
-#define SAFE_SETNS(fd, nstype) safe_setns(__FILE__, __LINE__, (fd), (nstype))
-
-void safe_cmd(const char *file, const int lineno, const char *const argv[],
- const char *stdout_path, const char *stderr_path);
-
-#define SAFE_CMD(argv, stdout_path, stderr_path) \
- safe_cmd(__FILE__, __LINE__, (argv), (stdout_path), (stderr_path))
-/*
- * SAFE_PTRACE() treats any non-zero return value as error. Don't use it
- * for requests like PTRACE_PEEK* or PTRACE_SECCOMP_GET_FILTER which use
- * the return value to pass arbitrary data.
- */
-long tst_safe_ptrace(const char *file, const int lineno, int req, pid_t pid,
- void *addr, void *data);
-#define SAFE_PTRACE(req, pid, addr, data) \
- tst_safe_ptrace(__FILE__, __LINE__, req, pid, addr, data)
-
-int safe_sysinfo(const char *file, const int lineno, struct sysinfo *info);
-#define SAFE_SYSINFO(info) \
- safe_sysinfo(__FILE__, __LINE__, (info))
-
#endif /* SAFE_MACROS_H__ */
diff --git a/include/tst_safe_net.h b/include/tst_safe_net.h
index e85b79a3e..9bc257ce8 100644
--- a/include/tst_safe_net.h
+++ b/include/tst_safe_net.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_SAFE_NET_H__
@@ -12,7 +25,6 @@
#include <sys/un.h>
#include "safe_net_fn.h"
-#include "tst_net.h"
#define SAFE_SOCKET(domain, type, protocol) \
safe_socket(__FILE__, __LINE__, NULL, domain, type, protocol)
@@ -42,9 +54,6 @@
#define SAFE_SENDMSG(msg_len, fd, msg, flags) \
safe_sendmsg(__FILE__, __LINE__, msg_len, fd, msg, flags)
-#define SAFE_RECV(msg_len, fd, buf, size, flags) \
- safe_recv(__FILE__, __LINE__, (msg_len), (fd), (buf), (size), (flags))
-
#define SAFE_RECVMSG(msg_len, fd, msg, flags) \
safe_recvmsg(__FILE__, __LINE__, msg_len, fd, msg, flags)
@@ -74,9 +83,4 @@
#define TST_GET_UNUSED_PORT(family, type) \
tst_get_unused_port(__FILE__, __LINE__, NULL, family, type)
-/* new API only */
-
-#define SAFE_GETADDRINFO(src_addr, port, hints, addr_info) \
- safe_getaddrinfo(__FILE__, __LINE__, src_addr, port, hints, addr_info)
-
#endif /* TST_SAFE_NET_H__ */
diff --git a/include/tst_safe_posix_ipc.h b/include/tst_safe_posix_ipc.h
index b60c12c9e..d74ef4ee8 100644
--- a/include/tst_safe_posix_ipc.h
+++ b/include/tst_safe_posix_ipc.h
@@ -36,11 +36,9 @@ static inline int safe_mq_open(const char *file, const int lineno,
va_end(ap);
rval = mq_open(pathname, oflags, mode, attr);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "mq_open(%s,%d,%04o,%p) failed", pathname, oflags,
- mode, attr);
+ tst_brk(TBROK | TERRNO, "%s:%d: mq_open(%s,%d,0%o,%p) failed",
+ file, lineno, pathname, oflags, mode, attr);
}
return rval;
diff --git a/include/tst_safe_prw.h b/include/tst_safe_prw.h
index 2e506cb41..f824c0720 100644
--- a/include/tst_safe_prw.h
+++ b/include/tst_safe_prw.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2010-2017 Linux Test Project
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_SAFE_PRW_H__
@@ -15,12 +28,8 @@ static inline ssize_t safe_pread(const char *file, const int lineno,
if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "pread(%d,%p,%zu,%lld) failed",
- fildes, buf, nbyte, (long long)offset);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid pread(%d,%p,%zu,%lld) return value %zd",
- fildes, buf, nbyte, (long long)offset, rval);
+ "pread(%d,%p,%zu,%lld) failed",
+ fildes, buf, nbyte, (long long)offset);
}
return rval;
@@ -38,12 +47,8 @@ static inline ssize_t safe_pwrite(const char *file, const int lineno,
rval = pwrite(fildes, buf, nbyte, offset);
if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "pwrite(%d,%p,%zu,%lld) failed",
- fildes, buf, nbyte, (long long)offset);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid pwrite(%d,%p,%zu,%lld) return value %zd",
- fildes, buf, nbyte, (long long)offset, rval);
+ "pwrite(%d,%p,%zu,%lld) failed",
+ fildes, buf, nbyte, (long long)offset);
}
return rval;
diff --git a/include/tst_safe_pthread.h b/include/tst_safe_pthread.h
index 0c6d4d201..0242d4c76 100644
--- a/include/tst_safe_pthread.h
+++ b/include/tst_safe_pthread.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_SAFE_PTHREAD_H__
diff --git a/include/tst_safe_stdio.h b/include/tst_safe_stdio.h
index e4bff34da..9162a6d4b 100644
--- a/include/tst_safe_stdio.h
+++ b/include/tst_safe_stdio.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2013-2016 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_SAFE_STDIO_H__
diff --git a/include/tst_safe_sysv_ipc.h b/include/tst_safe_sysv_ipc.h
index 7804ce192..4c7500531 100644
--- a/include/tst_safe_sysv_ipc.h
+++ b/include/tst_safe_sysv_ipc.h
@@ -1,5 +1,18 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2017 Xiao yang <yangx.jy@cn.fujitsu.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TST_SAFE_SYSV_IPC_H__
@@ -9,7 +22,6 @@
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/shm.h>
-#include <sys/sem.h>
int safe_msgget(const char *file, const int lineno, key_t key, int msgflg);
#define SAFE_MSGGET(key, msgflg) \
@@ -52,21 +64,4 @@ int safe_shmctl(const char *file, const int lineno, int shmid, int cmd,
(shmid) = ((cmd) == IPC_RMID ? -1 : (shmid)); \
tst_ret_;})
-int safe_semget(const char *file, const int lineno, key_t key, int nsems,
- int semflg);
-#define SAFE_SEMGET(key, nsems, semflg) \
- safe_semget(__FILE__, __LINE__, (key), (nsems), (semflg))
-
-int safe_semctl(const char *file, const int lineno, int semid, int semnum,
- int cmd, ...);
-#define SAFE_SEMCTL(semid, semnum, cmd, ...) ({ \
- int tst_ret_ = safe_semctl(__FILE__, __LINE__, (semid), (semnum), \
- (cmd), ##__VA_ARGS__); \
- (semid) = ((cmd) == IPC_RMID ? -1 : (semid)); \
- tst_ret_; })
-
-int safe_semop(const char *file, const int lineno, int semid, struct sembuf *sops,
- size_t nsops);
-#define SAFE_SEMOP(semid, sops, nsops) \
- safe_semop(__FILE__, __LINE__, (semid), (sops), (nsops))
#endif /* TST_SAFE_SYSV_IPC_H__ */
diff --git a/include/tst_safe_timerfd.h b/include/tst_safe_timerfd.h
deleted file mode 100644
index 526f12838..000000000
--- a/include/tst_safe_timerfd.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#ifndef TST_SAFE_TIMERFD_H__
-#define TST_SAFE_TIMERFD_H__
-
-#include "lapi/timerfd.h"
-
-int safe_timerfd_create(const char *file, const int lineno,
- int clockid, int flags);
-
-#define SAFE_TIMERFD_CREATE(clockid, flags)\
- safe_timerfd_create(__FILE__, __LINE__, (clockid), (flags))
-
-int safe_timerfd_gettime(const char *file, const int lineno,
- int fd, struct itimerspec *curr_value);
-
-#define SAFE_TIMERFD_GETTIME(fd, curr_value)\
- safe_timerfd_gettime(__FILE__, __LINE__, (fd), (curr_value))
-
-int safe_timerfd_settime(const char *file, const int lineno,
- int fd, int flags,
- const struct itimerspec *new_value,
- struct itimerspec *old_value);
-
-#define SAFE_TIMERFD_SETTIME(fd, flags, new_value, old_value)\
- safe_timerfd_settime(__FILE__, __LINE__, (fd), (flags), (new_value), \
- (old_value))
-
-#endif /* SAFE_TIMERFD_H__ */
diff --git a/include/tst_sig_proc.h b/include/tst_sig_proc.h
index b85981e77..fb7f93f6c 100644
--- a/include/tst_sig_proc.h
+++ b/include/tst_sig_proc.h
@@ -1,5 +1,15 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Copyright (c) 2016 Linux Test Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*/
#ifndef TST_SIG_PROC_H__
diff --git a/include/tst_sys_conf.h b/include/tst_sys_conf.h
index 323e29a27..784a94dbe 100644
--- a/include/tst_sys_conf.h
+++ b/include/tst_sys_conf.h
@@ -1,4 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
* Copyright (c) 2018 Jan Stancek <jstancek@redhat.com>
*/
diff --git a/include/tst_taint.h b/include/tst_taint.h
index bd8076c1c..0acc1140c 100644
--- a/include/tst_taint.h
+++ b/include/tst_taint.h
@@ -7,12 +7,14 @@
*
* ...
* #include "tst_test.h"
+ * #include "tst_taint.h"
* ..
- * static struct tst_test test = {
+ * void setup(void)
+ * {
* ...
- * .taint_check = TST_TAINT_W | TST_TAINT_D,
+ * tst_taint_init(TST_TAINT_W | TST_TAINT_D));
* ...
- * };
+ * }
*
* void run(void)
* {
@@ -27,14 +29,10 @@
*
*
*
- * The above code checks whether the kernel issued a warning (TST_TAINT_W)
+ * The above code checks, if the kernel issued a warning (TST_TAINT_W)
* or even died (TST_TAINT_D) during test execution.
* If these are set after running a test case, we most likely
* triggered a kernel bug.
- *
- * You do not need to use tst_taint_check() explicitly because it'll be called
- * automatically at the end of testing by the LTP library if
- * tst_test.taint_check in non-zero.
*/
#ifndef TST_TAINTED_H__
@@ -62,14 +60,10 @@
#define TST_TAINT_E (1 << 13) /* unsigned module was loaded */
#define TST_TAINT_L (1 << 14) /* A soft lock-up has previously occurred */
#define TST_TAINT_K (1 << 15) /* kernel has been live-patched */
-#define TST_TAINT_X (1 << 16) /* auxiliary taint, for distro's use */
-#define TST_TAINT_T (1 << 17) /* kernel was built with the struct randomization plugin */
+#define TST_TAINT_X (1 << 16) /* auxiliary taint, for distro's use */
/*
- * Initialize and prepare support for checking tainted kernel. Called
- * automatically by LTP library during test setup if tst_test.taint_check
- * is non-zero. The value of tst_test.taint_check will be passed as the mask
- * argument.
+ * Initialize and prepare support for checking tainted kernel.
*
* supply the mask of TAINT-flags you want to check, for example
* (TST_TAINT_W | TST_TAINT_D) when you want to check if the kernel issued
@@ -77,7 +71,7 @@
*
* This function tests if the requested flags are supported on the
* locally running kernel. In case the tainted-flags are already set by
- * the kernel, there is no reason to continue and TBROK is generated.
+ * the kernel, there is no reason to continue and TCONF is generated.
*
* The mask must not be zero.
*/
diff --git a/include/tst_test.h b/include/tst_test.h
index 6ad355506..21c7dfbdb 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -18,7 +18,6 @@
#include "tst_common.h"
#include "tst_res_flags.h"
-#include "tst_test_macros.h"
#include "tst_checkpoint.h"
#include "tst_device.h"
#include "tst_mkfs.h"
@@ -29,6 +28,7 @@
#include "tst_process_state.h"
#include "tst_atomic.h"
#include "tst_kvercmp.h"
+#include "tst_clone.h"
#include "tst_kernel.h"
#include "tst_minmax.h"
#include "tst_get_bad_addr.h"
@@ -37,11 +37,6 @@
#include "tst_coredump.h"
#include "tst_buffers.h"
#include "tst_capability.h"
-#include "tst_hugepage.h"
-#include "tst_assert.h"
-#include "tst_lockdown.h"
-#include "tst_fips.h"
-#include "tst_taint.h"
/*
* Reports testcase result.
@@ -51,11 +46,7 @@ void tst_res_(const char *file, const int lineno, int ttype,
__attribute__ ((format (printf, 4, 5)));
#define tst_res(ttype, arg_fmt, ...) \
- ({ \
- TST_RES_SUPPORTS_TCONF_TFAIL_TINFO_TPASS_TWARN(!((TTYPE_RESULT(ttype) ?: TCONF) & \
- (TCONF | TFAIL | TINFO | TPASS | TWARN))); \
- tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__);\
- })
+ tst_res_(__FILE__, __LINE__, (ttype), (arg_fmt), ##__VA_ARGS__)
void tst_resm_hexd_(const char *file, const int lineno, int ttype,
const void *buf, size_t size, const char *arg_fmt, ...)
@@ -93,7 +84,6 @@ pid_t safe_fork(const char *filename, unsigned int lineno);
#include "tst_safe_macros.h"
#include "tst_safe_file_ops.h"
#include "tst_safe_net.h"
-#include "tst_clone.h"
/*
* Wait for all children and exit with TBROK if
@@ -159,36 +149,6 @@ struct tst_test {
int all_filesystems:1;
/*
- * The skip_filesystem is a NULL terminated list of filesystems the
- * test does not support. It can also be used to disable whole class of
- * filesystems with a special keyworks such as "fuse".
- */
- const char *const *skip_filesystems;
-
- /* Minimum number of online CPU required by the test */
- unsigned long min_cpus;
-
- /*
- * If set non-zero number of request_hugepages, test will try to reserve the
- * expected number of hugepage for testing in setup phase. If system does not
- * have enough hpage for using, it will try the best to reserve 80% available
- * number of hpages. With success test stores the reserved hugepage number in
- * 'tst_hugepages. For the system without hugetlb supporting, variable
- * 'tst_hugepages' will be set to 0.
- *
- * Also, we do cleanup and restore work for the hpages resetting automatically.
- */
- unsigned long request_hugepages;
-
- /*
- * If set to non-zero, call tst_taint_init(taint_check) during setup
- * and check kernel taint at the end of the test. If all_filesystems
- * is non-zero, taint check will be performed after each FS test and
- * testing will be terminated by TBROK if taint is detected.
- */
- unsigned int taint_check;
-
- /*
* If set non-zero denotes number of test variant, the test is executed
* variants times each time with tst_variant set to different number.
*
@@ -203,6 +163,8 @@ struct tst_test {
/* Device filesystem type override NULL == default */
const char *dev_fs_type;
+ /* Flags to be passed to tst_get_supported_fs_types() */
+ int dev_fs_flags;
/* Options passed to SAFE_MKFS() when format_device is set */
const char *const *dev_fs_opts;
@@ -260,9 +222,6 @@ struct tst_test {
* {NULL, NULL} terminated array of tags.
*/
const struct tst_tag *tags;
-
- /* NULL terminated array of required commands */
- const char *const *needs_cmds;
};
/*
@@ -278,6 +237,33 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
*/
void tst_reinit(void);
+//TODO Clean?
+#define TEST(SCALL) \
+ do { \
+ errno = 0; \
+ TST_RET = SCALL; \
+ TST_ERR = errno; \
+ } while (0)
+
+#define TEST_VOID(SCALL) \
+ do { \
+ errno = 0; \
+ SCALL; \
+ TST_ERR = errno; \
+ } while (0)
+
+extern long TST_RET;
+extern int TST_ERR;
+
+extern void *TST_RET_PTR;
+
+#define TESTPTR(SCALL) \
+ do { \
+ errno = 0; \
+ TST_RET_PTR = (void*)SCALL; \
+ TST_ERR = errno; \
+ } while (0)
+
/*
* Functions to convert ERRNO to its name and SIGNAL to its name.
*/
@@ -313,5 +299,9 @@ int main(int argc, char *argv[])
#define TST_TEST_TCONF(message) \
static struct tst_test test = { .tconf_msg = message } \
+/*
+ * This is a hack to make the testcases link without defining TCID
+ */
+const char *TCID;
#endif /* TST_TEST_H__ */
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
deleted file mode 100644
index 89dfe5a31..000000000
--- a/include/tst_test_macros.h
+++ /dev/null
@@ -1,153 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2015-2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-#ifndef TST_TEST_MACROS_H__
-#define TST_TEST_MACROS_H__
-
-#define TEST(SCALL) \
- do { \
- errno = 0; \
- TST_RET = SCALL; \
- TST_ERR = errno; \
- } while (0)
-
-#define TEST_VOID(SCALL) \
- do { \
- errno = 0; \
- SCALL; \
- TST_ERR = errno; \
- } while (0)
-
-extern long TST_RET;
-extern int TST_ERR;
-extern int TST_PASS;
-
-extern void *TST_RET_PTR;
-
-#define TESTPTR(SCALL) \
- do { \
- errno = 0; \
- TST_RET_PTR = (void*)SCALL; \
- TST_ERR = errno; \
- } while (0)
-
-
-#define TST_2_(_1, _2, ...) _2
-
-#define TST_FMT_(FMT, _1, ...) FMT, ##__VA_ARGS__
-
-#define TST_MSG_(RES, FMT, SCALL, ...) \
- tst_res_(__FILE__, __LINE__, RES, \
- TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__))
-
-#define TST_MSGP_(RES, FMT, PAR, SCALL, ...) \
- tst_res_(__FILE__, __LINE__, RES, \
- TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR)
-
-#define TST_EXP_POSITIVE(SCALL, ...) \
- do { \
- TEST(SCALL); \
- \
- TST_PASS = 0; \
- \
- if (TST_RET == -1) { \
- TST_MSG_(TFAIL | TTERRNO, " failed", \
- #SCALL, ##__VA_ARGS__); \
- break; \
- } \
- \
- if (TST_RET < 0) { \
- TST_MSGP_(TFAIL | TTERRNO, " invalid retval %ld", \
- TST_RET, #SCALL, ##__VA_ARGS__); \
- break; \
- } \
- \
- TST_PASS = 1; \
- \
- } while (0)
-
-#define TST_EXP_FD_SILENT(SCALL, ...) TST_EXP_POSITIVE(SCALL, __VA_ARGS__)
-
-#define TST_EXP_FD(SCALL, ...) \
- do { \
- TST_EXP_FD_SILENT(SCALL, __VA_ARGS__); \
- \
- if (TST_PASS) \
- TST_MSGP_(TPASS, " returned fd %ld", TST_RET, \
- #SCALL, ##__VA_ARGS__); \
- } while (0)
-
-#define TST_EXP_PID_SILENT(SCALL, ...) TST_EXP_POSITIVE(SCALL, __VA_ARGS__)
-
-#define TST_EXP_PID(SCALL, ...) \
- do { \
- TST_EXP_PID_SILENT(SCALL, __VA_ARGS__); \
- \
- if (TST_PASS) \
- TST_MSGP_(TPASS, " returned pid %ld", TST_RET, \
- #SCALL, ##__VA_ARGS__); \
- } while (0)
-
-#define TST_EXP_PASS_SILENT(SCALL, ...) \
- do { \
- TEST(SCALL); \
- \
- TST_PASS = 0; \
- \
- if (TST_RET == -1) { \
- TST_MSG_(TFAIL | TTERRNO, " failed", \
- #SCALL, ##__VA_ARGS__); \
- break; \
- } \
- \
- if (TST_RET != 0) { \
- TST_MSGP_(TFAIL | TTERRNO, " invalid retval %ld", \
- TST_RET, #SCALL, ##__VA_ARGS__); \
- break; \
- } \
- \
- TST_PASS = 1; \
- \
- } while (0)
-
-#define TST_EXP_PASS(SCALL, ...) \
- do { \
- TST_EXP_PASS_SILENT(SCALL, __VA_ARGS__); \
- \
- if (TST_PASS) \
- TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__); \
- } while (0) \
-
-#define TST_EXP_FAIL(SCALL, ERRNO, ...) \
- do { \
- TEST(SCALL); \
- \
- TST_PASS = 0; \
- \
- if (TST_RET == 0) { \
- TST_MSG_(TFAIL, " succeeded", #SCALL, ##__VA_ARGS__); \
- break; \
- } \
- \
- if (TST_RET != -1) { \
- TST_MSGP_(TFAIL | TTERRNO, " invalid retval %ld", \
- TST_RET, #SCALL, ##__VA_ARGS__); \
- break; \
- } \
- \
- if (ERRNO) { \
- if (TST_ERR == ERRNO) { \
- TST_MSG_(TPASS | TTERRNO, "", \
- #SCALL, ##__VA_ARGS__); \
- TST_PASS = 1; \
- } else { \
- TST_MSGP_(TFAIL | TTERRNO, " expected %s", \
- tst_strerrno(ERRNO), \
- #SCALL, ##__VA_ARGS__); \
- } \
- } \
- } while (0)
-
-#endif /* TST_TEST_MACROS_H__ */
diff --git a/include/tst_timer.h b/include/tst_timer.h
index ea5e20dd3..d361aa2ed 100644
--- a/include/tst_timer.h
+++ b/include/tst_timer.h
@@ -1,5 +1,24 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright (C) 2015-2020 Cyril Hrubis <chrubis@suse.cz>
+/*
+ * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
@@ -12,1000 +31,254 @@
#ifndef TST_TIMER
#define TST_TIMER
-#include <linux/time_types.h>
-#include <linux/types.h>
-#include <sched.h>
#include <sys/time.h>
-#include <mqueue.h>
#include <time.h>
-#include "tst_test.h"
-#include "lapi/common_timers.h"
-#include "lapi/posix_types.h"
-#include "lapi/syscalls.h"
-
-/*
- * Converts timeval to microseconds.
- */
-static inline long long tst_timeval_to_us(struct timeval t)
-{
- return ((long long)t.tv_sec) * 1000000 + t.tv_usec;
-}
-
-/*
- * Converts timeval to milliseconds.
- */
-static inline long long tst_timeval_to_ms(struct timeval t)
-{
- return ((long long)t.tv_sec) * 1000 + (t.tv_usec + 500) / 1000;
-}
-
-/*
- * Converts milliseconds to struct timeval
- */
-static inline struct timeval tst_ms_to_timeval(long long ms)
-{
- struct timeval ret;
-
- ret.tv_sec = ms / 1000;
- ret.tv_usec = (ms % 1000) * 1000;
-
- return ret;
-}
-
-/*
- * Converts microseconds to struct timeval
- */
-static inline struct timeval tst_us_to_timeval(long long us)
-{
- struct timeval ret;
-
- ret.tv_sec = us / 1000000;
- ret.tv_usec = us % 1000000;
-
- return ret;
-}
-
-/*
- * Returns difference between two timeval structures.
- */
-static inline struct timeval tst_timeval_diff(struct timeval t1,
- struct timeval t2)
-{
- struct timeval res;
-
- res.tv_sec = t1.tv_sec - t2.tv_sec;
-
- if (t1.tv_usec < t2.tv_usec) {
- res.tv_sec--;
- res.tv_usec = 1000000 - (t2.tv_usec - t1.tv_usec);
- } else {
- res.tv_usec = t1.tv_usec - t2.tv_usec;
- }
-
- return res;
-}
-
-static inline long long tst_timeval_diff_us(struct timeval t1,
- struct timeval t2)
-{
- return tst_timeval_to_us(tst_timeval_diff(t1, t2));
-}
-
-static inline long long tst_timeval_diff_ms(struct timeval t1,
- struct timeval t2)
-{
- return tst_timeval_to_ms(tst_timeval_diff(t1, t2));
-}
-
-typedef __kernel_long_t __kernel_old_time_t;
-
-#ifndef HAVE_STRUCT___KERNEL_OLD_TIMEVAL
-struct __kernel_old_timeval {
- __kernel_old_time_t tv_sec; /* seconds */
- __kernel_suseconds_t tv_usec; /* microseconds */
-};
-#endif
-
-#ifndef HAVE_STRUCT___KERNEL_OLD_TIMESPEC
-struct __kernel_old_timespec {
- __kernel_old_time_t tv_sec; /* seconds */
- __kernel_old_time_t tv_nsec; /* nanoseconds */
-};
-#endif
-
-typedef long long __kernel_time64_t;
-
-#ifndef HAVE_STRUCT___KERNEL_TIMESPEC
-struct __kernel_timespec {
- __kernel_time64_t tv_sec; /* seconds */
- long long tv_nsec; /* nanoseconds */
-};
-#endif
-
-struct __kernel_old_itimerspec {
- struct __kernel_old_timespec it_interval; /* timer period */
- struct __kernel_old_timespec it_value; /* timer expiration */
-};
-
-#ifndef HAVE_STRUCT___KERNEL_ITIMERSPEC
-struct __kernel_itimerspec {
- struct __kernel_timespec it_interval; /* timer period */
- struct __kernel_timespec it_value; /* timer expiration */
-};
-#endif
-
-enum tst_ts_type {
- TST_LIBC_TIMESPEC,
- TST_KERN_OLD_TIMESPEC,
- TST_KERN_TIMESPEC
-};
-
-struct tst_ts {
- enum tst_ts_type type;
- union ts {
- struct timespec libc_ts;
- struct __kernel_old_timespec kern_old_ts;
- struct __kernel_timespec kern_ts;
- } ts;
-};
-
-struct tst_its {
- enum tst_ts_type type;
- union {
- struct __kernel_old_itimerspec kern_old_its;
- struct __kernel_itimerspec kern_its;
- } ts;
-};
-
-static inline void *tst_ts_get(struct tst_ts *t)
-{
- if (!t)
- return NULL;
-
- switch (t->type) {
- case TST_LIBC_TIMESPEC:
- return &t->ts.libc_ts;
- case TST_KERN_OLD_TIMESPEC:
- return &t->ts.kern_old_ts;
- case TST_KERN_TIMESPEC:
- return &t->ts.kern_ts;
- default:
- tst_brk(TBROK, "Invalid type: %d", t->type);
- return NULL;
- }
-}
-
-static inline void *tst_its_get(struct tst_its *t)
-{
- if (!t)
- return NULL;
-
- switch (t->type) {
- case TST_KERN_OLD_TIMESPEC:
- return &t->ts.kern_old_its;
- case TST_KERN_TIMESPEC:
- return &t->ts.kern_its;
- default:
- tst_brk(TBROK, "Invalid type: %d", t->type);
- return NULL;
- }
-}
-
-static inline int libc_clock_getres(clockid_t clk_id, void *ts)
-{
- return clock_getres(clk_id, ts);
-}
-
-static inline int sys_clock_getres(clockid_t clk_id, void *ts)
-{
- return tst_syscall(__NR_clock_getres, clk_id, ts);
-}
-
-static inline int sys_clock_getres64(clockid_t clk_id, void *ts)
-{
- return tst_syscall(__NR_clock_getres_time64, clk_id, ts);
-}
-
-static inline int libc_clock_gettime(clockid_t clk_id, void *ts)
-{
- return clock_gettime(clk_id, ts);
-}
-
-static inline int sys_clock_gettime(clockid_t clk_id, void *ts)
-{
- return tst_syscall(__NR_clock_gettime, clk_id, ts);
-}
-
-static inline int sys_clock_gettime64(clockid_t clk_id, void *ts)
-{
- return tst_syscall(__NR_clock_gettime64, clk_id, ts);
-}
-
-static inline int libc_clock_settime(clockid_t clk_id, void *ts)
-{
- return clock_settime(clk_id, ts);
-}
-
-static inline int sys_clock_settime(clockid_t clk_id, void *ts)
-{
- return tst_syscall(__NR_clock_settime, clk_id, ts);
-}
-
-static inline int sys_clock_settime64(clockid_t clk_id, void *ts)
-{
- return tst_syscall(__NR_clock_settime64, clk_id, ts);
-}
-
-static inline int libc_clock_nanosleep(clockid_t clk_id, int flags,
- void *request, void *remain)
-{
- return clock_nanosleep(clk_id, flags, request, remain);
-}
-
-static inline int sys_clock_nanosleep(clockid_t clk_id, int flags,
- void *request, void *remain)
-{
- return tst_syscall(__NR_clock_nanosleep, clk_id, flags,
- request, remain);
-}
-
-static inline int sys_clock_nanosleep64(clockid_t clk_id, int flags,
- void *request, void *remain)
-{
- return tst_syscall(__NR_clock_nanosleep_time64, clk_id, flags,
- request, remain);
-}
-
-static inline int sys_futex(int *uaddr, int futex_op, int val, void *to,
- int *uaddr2, int val3)
-{
- return tst_syscall(__NR_futex, uaddr, futex_op, val, to, uaddr2, val3);
-}
-
-static inline int sys_futex_time64(int *uaddr, int futex_op, int val, void *to,
- int *uaddr2, int val3)
-{
- return tst_syscall(__NR_futex_time64, uaddr, futex_op, val, to, uaddr2, val3);
-}
-
-static inline int libc_mq_timedsend(mqd_t mqdes, const char *msg_ptr,
- size_t msg_len, unsigned int msg_prio, void *abs_timeout)
-{
- return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout);
-}
-
-static inline int sys_mq_timedsend(mqd_t mqdes, const char *msg_ptr,
- size_t msg_len, unsigned int msg_prio, void *abs_timeout)
-{
- return tst_syscall(__NR_mq_timedsend, mqdes, msg_ptr, msg_len, msg_prio,
- abs_timeout);
-}
-
-static inline int sys_mq_timedsend64(mqd_t mqdes, const char *msg_ptr,
- size_t msg_len, unsigned int msg_prio, void *abs_timeout)
-{
- return tst_syscall(__NR_mq_timedsend_time64, mqdes, msg_ptr, msg_len,
- msg_prio, abs_timeout);
-}
-
-static inline ssize_t libc_mq_timedreceive(mqd_t mqdes, char *msg_ptr,
- size_t msg_len, unsigned int *msg_prio, void *abs_timeout)
-{
- return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout);
-}
-
-static inline ssize_t sys_mq_timedreceive(mqd_t mqdes, char *msg_ptr,
- size_t msg_len, unsigned int *msg_prio, void *abs_timeout)
-{
- return tst_syscall(__NR_mq_timedreceive, mqdes, msg_ptr, msg_len,
- msg_prio, abs_timeout);
-}
-
-static inline ssize_t sys_mq_timedreceive64(mqd_t mqdes, char *msg_ptr,
- size_t msg_len, unsigned int *msg_prio, void *abs_timeout)
-{
- return tst_syscall(__NR_mq_timedreceive_time64, mqdes, msg_ptr, msg_len,
- msg_prio, abs_timeout);
-}
-static inline int libc_sched_rr_get_interval(pid_t pid, void *ts)
+static inline long long tst_timespec_to_ns(struct timespec t)
{
- return sched_rr_get_interval(pid, ts);
-}
-
-static inline int sys_sched_rr_get_interval(pid_t pid, void *ts)
-{
- return tst_syscall(__NR_sched_rr_get_interval, pid, ts);
-}
-
-static inline int sys_sched_rr_get_interval64(pid_t pid, void *ts)
-{
- return tst_syscall(__NR_sched_rr_get_interval_time64, pid, ts);
-}
-
-static inline int sys_timer_gettime(kernel_timer_t timerid, void *its)
-{
- return tst_syscall(__NR_timer_gettime, timerid, its);
-}
-
-static inline int sys_timer_gettime64(kernel_timer_t timerid, void *its)
-{
- return tst_syscall(__NR_timer_gettime64, timerid, its);
-}
-
-static inline int sys_timer_settime(kernel_timer_t timerid, int flags, void *its,
- void *old_its)
-{
- return tst_syscall(__NR_timer_settime, timerid, flags, its, old_its);
-}
-
-static inline int sys_timer_settime64(kernel_timer_t timerid, int flags, void *its,
- void *old_its)
-{
- return tst_syscall(__NR_timer_settime64, timerid, flags, its, old_its);
-}
-
-static inline int sys_timerfd_gettime(int fd, void *its)
-{
- return tst_syscall(__NR_timerfd_gettime, fd, its);
-}
-
-static inline int sys_timerfd_gettime64(int fd, void *its)
-{
- return tst_syscall(__NR_timerfd_gettime64, fd, its);
-}
-
-static inline int sys_timerfd_settime(int fd, int flags, void *its,
- void *old_its)
-{
- return tst_syscall(__NR_timerfd_settime, fd, flags, its, old_its);
-}
-
-static inline int sys_timerfd_settime64(int fd, int flags, void *its,
- void *old_its)
-{
- return tst_syscall(__NR_timerfd_settime64, fd, flags, its, old_its);
+ return t.tv_sec * 1000000000 + t.tv_nsec;
}
/*
- * Returns tst_ts seconds.
+ * Converts timespec to microseconds.
*/
-static inline long long tst_ts_get_sec(struct tst_ts ts)
+static inline long long tst_timespec_to_us(struct timespec t)
{
- switch (ts.type) {
- case TST_LIBC_TIMESPEC:
- return ts.ts.libc_ts.tv_sec;
- case TST_KERN_OLD_TIMESPEC:
- return ts.ts.kern_old_ts.tv_sec;
- case TST_KERN_TIMESPEC:
- return ts.ts.kern_ts.tv_sec;
- default:
- tst_brk(TBROK, "Invalid type: %d", ts.type);
- return -1;
- }
+ return t.tv_sec * 1000000 + (t.tv_nsec + 500) / 1000;
}
/*
- * Returns tst_ts nanoseconds.
+ * Converts timespec to milliseconds.
*/
-static inline long long tst_ts_get_nsec(struct tst_ts ts)
+static inline long long tst_timespec_to_ms(struct timespec t)
{
- switch (ts.type) {
- case TST_LIBC_TIMESPEC:
- return ts.ts.libc_ts.tv_nsec;
- case TST_KERN_OLD_TIMESPEC:
- return ts.ts.kern_old_ts.tv_nsec;
- case TST_KERN_TIMESPEC:
- return ts.ts.kern_ts.tv_nsec;
- default:
- tst_brk(TBROK, "Invalid type: %d", ts.type);
- return -1;
- }
+ return t.tv_sec * 1000 + (t.tv_nsec + 500000) / 1000000;
}
/*
- * Sets tst_ts seconds.
- */
-static inline void tst_ts_set_sec(struct tst_ts *ts, long long sec)
-{
- switch (ts->type) {
- case TST_LIBC_TIMESPEC:
- ts->ts.libc_ts.tv_sec = sec;
- break;
- case TST_KERN_OLD_TIMESPEC:
- ts->ts.kern_old_ts.tv_sec = sec;
- break;
- case TST_KERN_TIMESPEC:
- ts->ts.kern_ts.tv_sec = sec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", ts->type);
- }
-}
-
-/*
- * Sets tst_ts nanoseconds.
- */
-static inline void tst_ts_set_nsec(struct tst_ts *ts, long long nsec)
-{
- switch (ts->type) {
- case TST_LIBC_TIMESPEC:
- ts->ts.libc_ts.tv_nsec = nsec;
- break;
- case TST_KERN_OLD_TIMESPEC:
- ts->ts.kern_old_ts.tv_nsec = nsec;
- break;
- case TST_KERN_TIMESPEC:
- ts->ts.kern_ts.tv_nsec = nsec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", ts->type);
- }
-}
-
-/*
- * Returns tst_its it_interval seconds.
- */
-static inline long long tst_its_get_interval_sec(struct tst_its its)
-{
- switch (its.type) {
- case TST_KERN_OLD_TIMESPEC:
- return its.ts.kern_old_its.it_interval.tv_sec;
- case TST_KERN_TIMESPEC:
- return its.ts.kern_its.it_interval.tv_sec;
- default:
- tst_brk(TBROK, "Invalid type: %d", its.type);
- return -1;
- }
-}
-
-/*
- * Returns tst_its it_interval nanoseconds.
- */
-static inline long long tst_its_get_interval_nsec(struct tst_its its)
-{
- switch (its.type) {
- case TST_KERN_OLD_TIMESPEC:
- return its.ts.kern_old_its.it_interval.tv_nsec;
- case TST_KERN_TIMESPEC:
- return its.ts.kern_its.it_interval.tv_nsec;
- default:
- tst_brk(TBROK, "Invalid type: %d", its.type);
- return -1;
- }
-}
-
-/*
- * Sets tst_its it_interval seconds.
- */
-static inline void tst_its_set_interval_sec(struct tst_its *its, long long sec)
-{
- switch (its->type) {
- break;
- case TST_KERN_OLD_TIMESPEC:
- its->ts.kern_old_its.it_interval.tv_sec = sec;
- break;
- case TST_KERN_TIMESPEC:
- its->ts.kern_its.it_interval.tv_sec = sec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", its->type);
- }
-}
-
-/*
- * Sets tst_its it_interval nanoseconds.
- */
-static inline void tst_its_set_interval_nsec(struct tst_its *its, long long nsec)
-{
- switch (its->type) {
- break;
- case TST_KERN_OLD_TIMESPEC:
- its->ts.kern_old_its.it_interval.tv_nsec = nsec;
- break;
- case TST_KERN_TIMESPEC:
- its->ts.kern_its.it_interval.tv_nsec = nsec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", its->type);
- }
-}
-
-/*
- * Returns tst_its it_value seconds.
- */
-static inline long long tst_its_get_value_sec(struct tst_its its)
-{
- switch (its.type) {
- case TST_KERN_OLD_TIMESPEC:
- return its.ts.kern_old_its.it_value.tv_sec;
- case TST_KERN_TIMESPEC:
- return its.ts.kern_its.it_value.tv_sec;
- default:
- tst_brk(TBROK, "Invalid type: %d", its.type);
- return -1;
- }
-}
-
-/*
- * Returns tst_its it_value nanoseconds.
- */
-static inline long long tst_its_get_value_nsec(struct tst_its its)
-{
- switch (its.type) {
- case TST_KERN_OLD_TIMESPEC:
- return its.ts.kern_old_its.it_value.tv_nsec;
- case TST_KERN_TIMESPEC:
- return its.ts.kern_its.it_value.tv_nsec;
- default:
- tst_brk(TBROK, "Invalid type: %d", its.type);
- return -1;
- }
-}
-
-/*
- * Sets tst_its it_value seconds.
- */
-static inline void tst_its_set_value_sec(struct tst_its *its, long long sec)
-{
- switch (its->type) {
- break;
- case TST_KERN_OLD_TIMESPEC:
- its->ts.kern_old_its.it_value.tv_sec = sec;
- break;
- case TST_KERN_TIMESPEC:
- its->ts.kern_its.it_value.tv_sec = sec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", its->type);
- }
-}
-
-/*
- * Sets tst_its it_value nanoseconds.
- */
-static inline void tst_its_set_value_nsec(struct tst_its *its, long long nsec)
-{
- switch (its->type) {
- break;
- case TST_KERN_OLD_TIMESPEC:
- its->ts.kern_old_its.it_value.tv_nsec = nsec;
- break;
- case TST_KERN_TIMESPEC:
- its->ts.kern_its.it_value.tv_nsec = nsec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", its->type);
- }
-}
-
-/*
- * Checks that timespec is valid, i.e. that the timestamp is not zero and that
- * the nanoseconds are normalized i.e. in <0, 1s) interval.
- *
- * 0: On success, i.e. timespec updated correctly.
- * -1: Error, timespec not updated.
- * -2: Error, tv_nsec is corrupted.
- */
-static inline int tst_ts_valid(struct tst_ts *t)
-{
- long long nsec = tst_ts_get_nsec(*t);
-
- if (nsec < 0 || nsec >= 1000000000)
- return -2;
-
- if (tst_ts_get_sec(*t) == 0 && tst_ts_get_nsec(*t) == 0)
- return -1;
-
- return 0;
-}
-
-/*
- * Converts timespec to tst_ts.
- */
-static inline struct tst_ts tst_ts_from_timespec(struct timespec ts)
-{
- struct tst_ts t = {
- .type = TST_LIBC_TIMESPEC,
- .ts.libc_ts.tv_sec = ts.tv_sec,
- .ts.libc_ts.tv_nsec = ts.tv_nsec,
- };
-
- return t;
-}
-
-/*
- * Converst tst_ts into timespec.
- */
-static inline struct timespec tst_ts_to_timespec(struct tst_ts t)
-{
- return t.ts.libc_ts;
-}
-
-/*
- * Converts tst_ts to nanoseconds.
- */
-static inline long long tst_ts_to_ns(struct tst_ts t)
-{
- return tst_ts_get_sec(t) * 1000000000 + tst_ts_get_nsec(t);
-}
-
-/*
- * Converts tst_ts to microseconds and rounds the value.
- */
-static inline long long tst_ts_to_us(struct tst_ts t)
-{
- return tst_ts_get_sec(t) * 1000000 +
- (tst_ts_get_nsec(t) + 500) / 1000;
-}
-
-/*
- * Converts timespec to microseconds and rounds the value.
- */
-static inline long long tst_timespec_to_us(struct timespec ts)
-{
- return tst_ts_to_us(tst_ts_from_timespec(ts));
-}
-
-/*
- * Converts tst_ts to milliseconds and rounds the value.
+ * Converts timeval to microseconds.
*/
-static inline long long tst_ts_to_ms(struct tst_ts t)
+static inline long long tst_timeval_to_us(struct timeval t)
{
- return tst_ts_get_sec(t) * 1000 +
- (tst_ts_get_nsec(t) + 500000) / 1000000;
+ return t.tv_sec * 1000000 + t.tv_usec;
}
/*
- * Converts timespec to milliseconds and rounds the value.
+ * Converts timeval to milliseconds.
*/
-static inline long long tst_timespec_to_ms(struct timespec ts)
+static inline long long tst_timeval_to_ms(struct timeval t)
{
- return tst_ts_to_ms(tst_ts_from_timespec(ts));
+ return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000;
}
/*
- * Converts nanoseconds to tst_ts
+ * Converts ms to struct timeval
*/
-static inline struct tst_ts
-tst_ts_from_ns(enum tst_ts_type type, long long ns)
+static inline struct timeval tst_ms_to_timeval(long long ms)
{
- struct tst_ts ret = {.type = type};
+ struct timeval ret;
- tst_ts_set_sec(&ret, ns / 1000000000);
- tst_ts_set_nsec(&ret, ns % 1000000000);
+ ret.tv_sec = ms / 1000;
+ ret.tv_usec = (ms % 1000) * 1000;
return ret;
}
/*
- * Converts microseconds to tst_ts
+ * Converts us to struct timeval
*/
-static inline struct tst_ts
-tst_ts_from_us(enum tst_ts_type type, long long us)
+static inline struct timeval tst_us_to_timeval(long long us)
{
- struct tst_ts ret = {.type = type};
+ struct timeval ret;
- tst_ts_set_sec(&ret, us / 1000000);
- tst_ts_set_nsec(&ret, (us % 1000000) * 1000);
+ ret.tv_sec = us / 1000000;
+ ret.tv_usec = us % 1000000;
return ret;
}
/*
- * Converts microseconds to timespec
+ * Converts ms to struct timespec
*/
-static inline struct timespec
-tst_timespec_from_us(long long us)
+static inline struct timespec tst_ms_to_timespec(long long ms)
{
- return tst_ts_to_timespec(tst_ts_from_us(TST_LIBC_TIMESPEC, us));
-}
+ struct timespec ret;
-/*
- * Converts miliseconds to tst_ts
- */
-static inline struct tst_ts
-tst_ts_from_ms(enum tst_ts_type type, long long ms)
-{
- struct tst_ts ret = {.type = type};
-
- tst_ts_set_sec(&ret, ms / 1000);
- tst_ts_set_nsec(&ret, (ms % 1000) * 1000000);
+ ret.tv_sec = ms / 1000;
+ ret.tv_nsec = (ms % 1000) * 1000000;
return ret;
}
/*
- * Converts miliseconds to timespec
- */
-static inline struct timespec
-tst_timespec_from_ms(long long ms)
-{
- return tst_ts_to_timespec(tst_ts_from_ms(TST_LIBC_TIMESPEC, ms));
-}
-
-/*
- * Sets tst_its it_value from microseconds.
+ * Converts us to struct timespec
*/
-static inline void tst_its_set_interval_from_us(struct tst_its *its, long long usec)
+static inline struct timespec tst_us_to_timespec(long long us)
{
- struct timespec tp = tst_timespec_from_us(usec);
+ struct timespec ret;
- tst_its_set_interval_sec(its, tp.tv_sec);
- tst_its_set_interval_nsec(its, tp.tv_nsec);
-}
-
-/*
- * Sets tst_its it_value from microseconds.
- */
-static inline void tst_its_set_value_from_us(struct tst_its *its, long long usec)
-{
- struct timespec tp = tst_timespec_from_us(usec);
-
- tst_its_set_value_sec(its, tp.tv_sec);
- tst_its_set_value_nsec(its, tp.tv_nsec);
-}
-
-/*
- * Sets tst_its it_interval from tst_ts.
- */
-static inline void tst_its_set_interval_from_ts(struct tst_its *its, struct tst_ts ts)
-{
- tst_its_set_interval_sec(its, tst_ts_get_sec(ts));
- tst_its_set_interval_nsec(its, tst_ts_get_nsec(ts));
-}
+ ret.tv_sec = us / 1000000;
+ ret.tv_nsec = (us % 1000000) * 1000;
-/*
- * Sets tst_its it_value from tst_ts.
- */
-static inline void tst_its_set_value_from_ts(struct tst_its *its, struct tst_ts ts)
-{
- tst_its_set_value_sec(its, tst_ts_get_sec(ts));
- tst_its_set_value_nsec(its, tst_ts_get_nsec(ts));
+ return ret;
}
/*
- * Returns if t1 less than t2. Both t1 and t2 must be normalized.
+ * Comparsions
*/
-static inline int tst_ts_lt(struct tst_ts t1, struct tst_ts t2)
+static inline int tst_timespec_lt(struct timespec t1, struct timespec t2)
{
- if (tst_ts_get_sec(t1) == tst_ts_get_sec(t2))
- return tst_ts_get_nsec(t1) < tst_ts_get_nsec(t2);
+ if (t1.tv_sec == t2.tv_sec)
+ return t1.tv_nsec < t2.tv_nsec;
- return tst_ts_get_sec(t1) < tst_ts_get_sec(t2);
+ return t1.tv_sec < t2.tv_sec;
}
/*
- * Returns if ts1 less than ts2. Both ts1 and ts2 must be normalized.
+ * Adds us microseconds to t.
*/
-static inline int tst_timespec_lt(struct timespec ts1, struct timespec ts2)
+static inline struct timespec tst_timespec_add_us(struct timespec t,
+ long long us)
{
- return tst_ts_lt(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
-}
+ t.tv_sec += us / 1000000;
+ t.tv_nsec += (us % 1000000) * 1000;
-/*
- * Returns normalized tst_ts, i.e. 0 <= nsec < 1000000000.
- */
-static inline struct tst_ts tst_ts_normalize(struct tst_ts t)
-{
- long long sec = tst_ts_get_sec(t);
- long long nsec = tst_ts_get_nsec(t);
-
- if (nsec >= 1000000000) {
- tst_ts_set_sec(&t, sec + 1);
- tst_ts_set_nsec(&t, nsec - 1000000000);
- }
-
- if (nsec < 0) {
- tst_ts_set_sec(&t, sec - 1);
- tst_ts_set_nsec(&t, nsec + 1000000000);
+ if (t.tv_nsec >= 1000000000) {
+ t.tv_sec++;
+ t.tv_nsec -= 1000000000;
}
return t;
}
/*
- * Adds us microseconds to tst_ts.
+ * Adds two timespec structures.
*/
-static inline struct tst_ts
-tst_ts_add_us(struct tst_ts t, long long us)
+static inline struct timespec tst_timespec_add(struct timespec t1,
+ struct timespec t2)
{
- struct tst_ts res = {.type = t.type};
-
- tst_ts_set_sec(&res, tst_ts_get_sec(t) + us / 1000000);
- tst_ts_set_nsec(&res, tst_ts_get_nsec(t) + (us % 1000000) * 1000);
+ struct timespec res;
- return tst_ts_normalize(res);
-}
+ res.tv_sec = t1.tv_sec + t2.tv_sec;
+ res.tv_nsec = t1.tv_nsec + t2.tv_nsec;
-/*
- * Adds us microseconds to struct timespec.
- */
-static inline struct timespec
-tst_timespec_add_us(struct timespec ts, long long us)
-{
- struct tst_ts res;
-
- res = tst_ts_add_us(tst_ts_from_timespec(ts), us);
+ if (res.tv_nsec >= 1000000000) {
+ res.tv_sec++;
+ res.tv_nsec -= 1000000000;
+ }
- return tst_ts_to_timespec(res);
+ return res;
}
/*
- * Substracts us microseconds from tst_ts.
+ * Subtracts us microseconds from t.
*/
-static inline struct tst_ts
-tst_ts_sub_us(struct tst_ts t, long long us)
+static inline struct timespec tst_timespec_sub_us(struct timespec t,
+ long long us)
{
- struct tst_ts res = {.type = t.type};
+ t.tv_sec -= us / 1000000;
+ t.tv_nsec -= (us % 1000000) * 1000;
- tst_ts_set_sec(&res, tst_ts_get_sec(t) - us / 1000000);
- tst_ts_set_nsec(&res, tst_ts_get_nsec(t) - (us % 1000000) * 1000);
+ if (t.tv_nsec < 0) {
+ t.tv_sec--;
+ t.tv_nsec += 1000000000;
+ }
- return tst_ts_normalize(res);
+ return t;
}
/*
- * Substracts us microseconds from timespec.
+ * Returns difference between two timespec structures.
*/
-static inline struct timespec
-tst_timespec_sub_us(struct timespec ts, long long us)
+static inline struct timespec tst_timespec_diff(struct timespec t1,
+ struct timespec t2)
{
- struct tst_ts res;
-
- res = tst_ts_sub_us(tst_ts_from_timespec(ts), us);
+ struct timespec res;
- return tst_ts_to_timespec(res);
-}
-
-/*
- * Adds two tst_ts structures.
- */
-static inline struct tst_ts
-tst_ts_add(struct tst_ts t1, struct tst_ts t2)
-{
- struct tst_ts res = {.type = t1.type};
+ res.tv_sec = t1.tv_sec - t2.tv_sec;
- tst_ts_set_sec(&res, tst_ts_get_sec(t1) + tst_ts_get_sec(t2));
- tst_ts_set_nsec(&res, tst_ts_get_nsec(t1) + tst_ts_get_nsec(t2));
+ if (t1.tv_nsec < t2.tv_nsec) {
+ res.tv_sec--;
+ res.tv_nsec = 1000000000 - (t2.tv_nsec - t1.tv_nsec);
+ } else {
+ res.tv_nsec = t1.tv_nsec - t2.tv_nsec;
+ }
- return tst_ts_normalize(res);
+ return res;
}
-/*
- * Adds two timespec structures.
- */
-static inline struct timespec
-tst_timespec_add(struct timespec ts1, struct timespec ts2)
+static inline long long tst_timespec_diff_ns(struct timespec t1,
+ struct timespec t2)
{
- struct tst_ts res;
-
- res = tst_ts_add(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
-
- return tst_ts_to_timespec(res);
+ return t1.tv_nsec - t2.tv_nsec + 1000000000LL * (t1.tv_sec - t2.tv_sec);
}
-/*
- * Substract two tst_ts structures.
- */
-static inline struct tst_ts
-tst_ts_diff(struct tst_ts t1, struct tst_ts t2)
+static inline long long tst_timespec_diff_us(struct timespec t1,
+ struct timespec t2)
{
- struct tst_ts res = {.type = t1.type};
-
- tst_ts_set_sec(&res, tst_ts_get_sec(t1) - tst_ts_get_sec(t2));
- tst_ts_set_nsec(&res, tst_ts_get_nsec(t1) - tst_ts_get_nsec(t2));
-
- return tst_ts_normalize(res);
+ return tst_timespec_to_us(tst_timespec_diff(t1, t2));
}
-/*
- * Substract two timespec structures.
- */
-static inline struct timespec
-tst_timespec_diff(struct timespec ts1, struct timespec ts2)
+static inline long long tst_timespec_diff_ms(struct timespec t1,
+ struct timespec t2)
{
- struct tst_ts res;
-
- res = tst_ts_diff(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
-
- return tst_ts_to_timespec(res);
+ return tst_timespec_to_ms(tst_timespec_diff(t1, t2));
}
/*
- * Substract two tst_ts structures returns number of nanoseconds.
+ * Returns difference between two timeval structures.
*/
-static inline long long
-tst_ts_diff_ns(struct tst_ts t1, struct tst_ts t2)
+static inline struct timeval tst_timeval_diff(struct timeval t1,
+ struct timeval t2)
{
- return tst_ts_to_ns(tst_ts_diff(t1, t2));
-}
+ struct timeval res;
-/*
- * Substract two timespec structures returns number of nanoseconds.
- */
-static inline long long
-tst_timespec_diff_ns(struct timespec ts1, struct timespec ts2)
-{
- return tst_ts_diff_ns(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
-}
+ res.tv_sec = t1.tv_sec - t2.tv_sec;
-/*
- * Substract two tst_ts structures returns number of microseconds.
- */
-static inline long long
-tst_ts_diff_us(struct tst_ts t1, struct tst_ts t2)
-{
- return tst_ts_to_us(tst_ts_diff(t1, t2));
-}
+ if (t1.tv_usec < t2.tv_usec) {
+ res.tv_sec--;
+ res.tv_usec = 1000000 - (t2.tv_usec - t1.tv_usec);
+ } else {
+ res.tv_usec = t1.tv_usec - t2.tv_usec;
+ }
-/*
- * Substract two timespec structures returns number of microseconds.
- */
-static inline long long
-tst_timespec_diff_us(struct timespec ts1, struct timespec ts2)
-{
- return tst_ts_diff_us(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
+ return res;
}
-/*
- * Substract two tst_ts structures returns number of milliseconds.
- */
-static inline long long
-tst_ts_diff_ms(struct tst_ts t1, struct tst_ts t2)
+static inline long long tst_timeval_diff_us(struct timeval t1,
+ struct timeval t2)
{
- return tst_ts_to_ms(tst_ts_diff(t1, t2));
+ return tst_timeval_to_us(tst_timeval_diff(t1, t2));
}
-/*
- * Substract two timespec structures returns number of milliseconds.
- */
-static inline long long
-tst_timespec_diff_ms(struct timespec ts1, struct timespec ts2)
+static inline long long tst_timeval_diff_ms(struct timeval t1,
+ struct timeval t2)
{
- return tst_ts_diff_ms(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
+ return tst_timeval_to_ms(tst_timeval_diff(t1, t2));
}
/*
* Returns absolute value of difference between two timespec structures.
*/
-static inline struct tst_ts
-tst_ts_abs_diff(struct tst_ts t1, struct tst_ts t2)
+static inline struct timespec tst_timespec_abs_diff(struct timespec t1,
+ struct timespec t2)
{
- if (tst_ts_lt(t1, t2))
- return tst_ts_diff(t2, t1);
+ if (tst_timespec_lt(t1, t2))
+ return tst_timespec_diff(t2, t1);
else
- return tst_ts_diff(t1, t2);
+ return tst_timespec_diff(t1, t2);
}
-/*
- * Returns absolute value of difference between two tst_ts structures in
- * microseconds.
- */
-static inline long long
-tst_ts_abs_diff_us(struct tst_ts t1, struct tst_ts t2)
-{
- return tst_ts_to_us(tst_ts_abs_diff(t1, t2));
-}
-
-/*
- * Returns absolute value of difference between two timespec structures in
- * microseconds.
- */
-static inline long long
-tst_timespec_abs_diff_us(struct timespec ts1, struct timespec ts2)
+static inline long long tst_timespec_abs_diff_us(struct timespec t1,
+ struct timespec t2)
{
- return tst_ts_abs_diff_us(tst_ts_from_timespec(ts1), tst_ts_from_timespec(ts2));
+ return tst_timespec_to_us(tst_timespec_abs_diff(t1, t2));
}
-/*
- * Returns absolute value of difference between two timespec structures in
- * milliseconds.
- */
-static inline long long
-tst_ts_abs_diff_ms(struct tst_ts t1, struct tst_ts t2)
+static inline long long tst_timespec_abs_diff_ms(struct timespec t1,
+ struct timespec t2)
{
- return tst_ts_to_ms(tst_ts_abs_diff(t1, t2));
+ return tst_timespec_to_ms(tst_timespec_abs_diff(t1, t2));
}
/*
@@ -1059,4 +332,9 @@ static inline long long tst_timer_elapsed_us(void)
return tst_timespec_to_us(tst_timer_elapsed());
}
+/*
+ * Returns a string containing given clock type name
+ */
+const char *tst_clock_name(clockid_t);
+
#endif /* TST_TIMER */
diff --git a/include/tst_wallclock.h b/include/tst_wallclock.h
index 1d142c5ca..7d6723a7a 100644
--- a/include/tst_wallclock.h
+++ b/include/tst_wallclock.h
@@ -12,8 +12,4 @@ void tst_wallclock_save(void);
void tst_wallclock_restore(void);
-void tst_rtc_clock_save(const char *rtc_dev);
-
-void tst_rtc_clock_restore(const char *rtc_dev);
-
#endif /* TST_WALLCLK_H__ */
diff --git a/lib/Makefile b/lib/Makefile
index f019432e8..e7fc753da 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -32,7 +32,7 @@ else
FILTER_OUT_LIBSRCS += tlibio.c tst_safe_sysv_ipc.c
endif
-INTERNAL_LIB := libltp.a
+LIB := libltp.a
pc_file := $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc
diff --git a/lib/README.md b/lib/README.md
deleted file mode 100644
index cc7f706d2..000000000
--- a/lib/README.md
+++ /dev/null
@@ -1,152 +0,0 @@
-# Test library design document
-
-## High-level picture
-
- library process
- +----------------------------+
- | main |
- | tst_run_tcases |
- | do_setup |
- | for_each_variant |
- | for_each_filesystem | test process
- | fork_testrun ------------->+--------------------------------------------+
- | waitpid | | testrun |
- | | | do_test_setup |
- | | | tst_test->setup |
- | | | run_tests |
- | | | tst_test->test(i) or tst_test->test_all |
- | | | do_test_cleanup |
- | | | tst_test->cleanup |
- | | | exit(0) |
- | do_exit | +--------------------------------------------+
- | do_cleanup |
- | exit(ret) |
- +----------------------------+
-
-## Test lifetime overview
-
-When a test is executed the very first thing to happen is that we check for
-various test prerequisites. These are described in the tst\_test structure and
-range from simple '.require\_root' to a more complicated kernel .config boolean
-expressions such as: "CONFIG\_X86\_INTEL\_UMIP=y | CONFIG\_X86\_UMIP=y".
-
-If all checks are passed the process carries on with setting up the test
-environment as requested in the tst\_test structure. There are many different
-setup steps that have been put into the test library again ranging from rather
-simple creation of a unique test temporary directory to a bit more complicated
-ones such as preparing, formatting, and mounting a block device.
-
-The test library also intializes shrared memory used for IPC at this step.
-
-Once all the prerequisites are checked and test environment has been prepared
-we can move on executing the testcase itself. The actual test is executed in a
-forked process, however there are a few hops before we get there.
-
-First of all there are test variants, which means that the test is re-executed
-several times with a slightly different setting. This is usually used to test a
-family of similar syscalls, where we test each of these syscalls exactly the
-same, but without re-executing the test binary itself. Test variants are
-implemented as a simple global variable counter that gets increased on each
-iteration. In a case of syscall tests we switch between which syscall to call
-based on the global counter.
-
-Then there is all\_filesystems flag which is mostly the same as test variants
-but executes the test for each filesystem supported by the system. Note that we
-can get cartesian product between test variants and all filesystems as well.
-
-In a pseudo code it could be expressed as:
-
-```
-for test_variants:
- for all_filesystems:
- fork_testrun()
-```
-
-Before we fork() the test process the test library sets up a timeout alarm and
-also a heartbeat signal handlers and also sets up an alarm(2) accordingly to
-the test timeout. When a test times out the test library gets SIGALRM and the
-alarm handler mercilessly kills all forked children by sending SIGKILL to the
-whole process group. The heartbeat handler is used by the test process to reset
-this timer for example when the test functions run in a loop.
-
-With that done we finally fork() the test process. The test process firstly
-resets signal handlers and sets its pid to be a process group leader so that we
-can slaughter all children if needed. The test library proceeds with suspending
-itself in waitpid() syscall and waits for the child to finish at this point.
-
-The test process goes ahead and calls the test setup() function if present in
-the tst\_test structure. It's important that we execute all test callbacks
-after we have forked the process, that way we cannot crash the test library
-process. The setup can also cause the test to exit prematurely by either direct
-or indirect (SAFE\_MACROS()) call to tst\_brk(). In this case the
-fork\_testrun() function exits, but the loops for test variants or filesystems
-carries on.
-
-All that is left to be done is to actually execute the tests, what happnes now
-depends on the -i and -I command line parameters that can request that the
-run() or run\_all() callbacks are executed N times or for N seconds. Again the
-test can exit at any time by direct or indirect call to tst\_brk().
-
-Once the test is finished all that is left for the test process is the test
-cleanup(). So if a there is a cleanup() callback in the tst\_test structure
-it's executed. The cleanup() callback runs in a special context where the
-tst\_brk(TBROK, ...) calls are converted into tst\_res(TWARN, ...) calls. This
-is because we found out that carrying on with partially broken cleanup is
-usually better option than exiting it in the middle.
-
-The test cleanup() is also called by the tst\_brk() handler in order to cleanup
-before exiting the test process, hence it must be able to cope even with
-partial test setup. Usually it suffices to make sure to clean up only
-resources that already have been set up and to do that in an inverse order that
-we did in setup().
-
-Once the test process exits or leaves the run() or run\_all() function the test
-library wakes up from the waitpid() call, and checks if the test process
-exitted normally.
-
-Once the testrun is finished the test library does a cleanup() as well to clean
-up resources set up in the test library setup(), reports test results and
-finally exits the process.
-
-### Test library and fork()-ing
-
-Things are a bit more complicated when fork()-ing is involved, however the test
-results are stored in a page of a shared memory and incremented by atomic
-operations, hence the results are stored right after the test reporting
-function returns from the test library and the access is, by definition,
-race-free as well.
-
-On the other hand the test library, apart from sending a SIGKILL to the whole
-process group on timeout, does not track grandchildren.
-
-This especially means that:
-
-- The test exits once the main test process exits.
-
-- While the test results are, by the design, propagated to the test library
- we may still miss a child that gets killed by a signal or exits unexpectedly.
-
-The test writer should, because of this, take care for reaping these proceses
-properly, in most cases this could be simply done by calling
-tst\_reap\_children() to collect and dissect deceased.
-
-Also note that tst\_brk() does exit only the current process, so if a child
-process calls tst\_brk() the counters are incremented and only the process
-exits.
-
-### Test library and exec()
-
-The piece of mapped memory to store the results to is not preserved over
-exec(2), hence to use the test library from a binary started by an exec() it
-has to be remaped. In this case the process must to call tst\_reinit() before
-calling any other library functions. In order to make this happen the program
-environment carries LTP\_IPC\_PATH variable with a path to the backing file on
-tmpfs. This also allows us to use the test library from shell testcases.
-
-### Test library and process synchronization
-
-The piece of mapped memory is also used as a base for a futex-based
-synchronization primitives called checkpoints. And as said previously the
-memory can be mapped to any process by calling the tst\_reinit() function. As a
-matter of a fact there is even a tst\_checkpoint binary that allows us to use
-the checkpoints from shell code as well.
diff --git a/lib/android_libpthread/Makefile b/lib/android_libpthread/Makefile
index 441cadcb9..2946d093f 100644
--- a/lib/android_libpthread/Makefile
+++ b/lib/android_libpthread/Makefile
@@ -2,6 +2,6 @@ top_srcdir ?= ../..
include $(top_srcdir)/include/mk/env_pre.mk
-INTERNAL_LIB := libpthread.a
+LIB := libpthread.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/lib/android_librt/Makefile b/lib/android_librt/Makefile
index 70d520c0a..ecb1fbe6c 100644
--- a/lib/android_librt/Makefile
+++ b/lib/android_librt/Makefile
@@ -2,6 +2,6 @@ top_srcdir ?= ../..
include $(top_srcdir)/include/mk/env_pre.mk
-INTERNAL_LIB := librt.a
+LIB := librt.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
index b95ead2c2..d4aa4935f 100644
--- a/lib/newlib_tests/.gitignore
+++ b/lib/newlib_tests/.gitignore
@@ -16,8 +16,6 @@ test15
test16
tst_capability01
tst_capability02
-tst_cgroup01
-tst_cgroup02
tst_device
tst_safe_fileops
tst_res_hexd
@@ -25,21 +23,9 @@ tst_strstatus
test17
test18
test19
-test20
-test22
tst_expiration_timer
-test_assert
-test_timer
test_exec
test_exec_child
test_kconfig
-test_kconfig01
-test_kconfig02
variant
test_guarded_buf
-tst_bool_expr
-test_macros01
-test_macros02
-test_macros03
-tst_fuzzy_sync01
-tst_fuzzy_sync02
diff --git a/lib/newlib_tests/Makefile b/lib/newlib_tests/Makefile
index 7acdd1ff7..2fc50160a 100644
--- a/lib/newlib_tests/Makefile
+++ b/lib/newlib_tests/Makefile
@@ -11,8 +11,6 @@ test15: CFLAGS+=-pthread
test16: CFLAGS+=-pthread
test16: LDLIBS+=-lrt
tst_expiration_timer: LDLIBS+=-lrt
-tst_fuzzy_sync01: CFLAGS+=-pthread
-tst_fuzzy_sync02: CFLAGS+=-pthread
ifeq ($(ANDROID),1)
FILTER_OUT_MAKE_TARGETS += test08
diff --git a/lib/newlib_tests/config01 b/lib/newlib_tests/config01
index 1d94d810a..96d68d836 100644
--- a/lib/newlib_tests/config01
+++ b/lib/newlib_tests/config01
@@ -2,4 +2,3 @@
CONFIG_MMU=y
CONFIG_EXT4_FS=m
CONFIG_PGTABLE_LEVELS=4
-CONFIG_DEFAULT_HOSTNAME="(none)"
diff --git a/lib/newlib_tests/config02 b/lib/newlib_tests/config02
index e1b0e8086..2de45cff8 100644
--- a/lib/newlib_tests/config02
+++ b/lib/newlib_tests/config02
@@ -2,4 +2,3 @@
# CONFIG_MMU is not set
CONFIG_EXT4_FS=m
CONFIG_PGTABLE_LEVELS=4
-CONFIG_DEFAULT_HOSTNAME="(none)"
diff --git a/lib/newlib_tests/config03 b/lib/newlib_tests/config03
index 05c8e194a..1a3b9e648 100644
--- a/lib/newlib_tests/config03
+++ b/lib/newlib_tests/config03
@@ -2,4 +2,3 @@
CONFIG_MMU=y
CONFIG_EXT4_FS=m
CONFIG_PGTABLE_LEVELS=44
-CONFIG_DEFAULT_HOSTNAME="(none)"
diff --git a/lib/newlib_tests/config04 b/lib/newlib_tests/config04
index da01579b6..cce7051ae 100644
--- a/lib/newlib_tests/config04
+++ b/lib/newlib_tests/config04
@@ -2,4 +2,3 @@
CONFIG_MMU=y
CONFIG_EXT4_FS=y
CONFIG_PGTABLE_LEVELS=4
-CONFIG_DEFAULT_HOSTNAME="(none)"
diff --git a/lib/newlib_tests/config05 b/lib/newlib_tests/config05
index 490f94fa6..a9d7bab4d 100644
--- a/lib/newlib_tests/config05
+++ b/lib/newlib_tests/config05
@@ -1,4 +1,3 @@
# Everything is wrong
CONFIG_EXT4_FS=y
CONFIG_PGTABLE_LEVELS=44
-CONFIG_DEFAULT_HOSTNAME=""
diff --git a/lib/newlib_tests/config06 b/lib/newlib_tests/config06
deleted file mode 100644
index b7db25411..000000000
--- a/lib/newlib_tests/config06
+++ /dev/null
@@ -1 +0,0 @@
-# Empty
diff --git a/lib/newlib_tests/shell/net/tst_rhost_run.sh b/lib/newlib_tests/shell/net/tst_rhost_run.sh
deleted file mode 100755
index 119247f8e..000000000
--- a/lib/newlib_tests/shell/net/tst_rhost_run.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-
-TST_TESTFUNC=do_test
-PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
-. tst_net.sh
-
-export TST_NET_RHOST_RUN_DEBUG=1
-
-do_test()
-{
- local file="/etc/fstab"
-
- tst_rhost_run -c 'which grep' > /dev/null || \
- tst_brk TCONF "grep not found on rhost"
-
- tst_rhost_run -c "[ -f $file ]" || \
- tst_brk TCONF "$file not found on rhost"
-
- tst_rhost_run -s -c "grep -q \"[^ ]\" $file"
- tst_rhost_run -s -c "grep -q '[^ ]' $file"
-
- tst_res TPASS "tst_rhost_run is working"
-}
-
-tst_run
diff --git a/lib/newlib_tests/shell/test_timeout.sh b/lib/newlib_tests/shell/test_timeout.sh
index b05680cb1..26477d6f2 100755
--- a/lib/newlib_tests/shell/test_timeout.sh
+++ b/lib/newlib_tests/shell/test_timeout.sh
@@ -1,178 +1,42 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
PATH="$(dirname $0):$(dirname $0)/../../../testcases/lib/:$PATH"
-# Test cases are separated by newlines.
-# Every test has the following fields in this order:
-# file
-# timeout_mul
-# use_cat
-# max_runtime
-# expected_exit_code
-# expected passes
-# expected failed
-# expected broken
-# description
-# Whole lines can be commented out using "#"
DATA="
-timeout01.sh| |0| |0
-timeout02.sh| |0| |0
-timeout02.sh| foo|0| |2
-timeout02.sh| 2|0| |0
-timeout01.sh| 2|0| |0
-timeout02.sh| 1.1|0| |0
-timeout02.sh| -10|0| |2
-timeout02.sh| -0.1|0| |0
-timeout02.sh| -1.1|0| |2
-timeout02.sh|-10.1|0| |2
-timeout03.sh| |0|12|137| | | |Test kill if test does not terminate by SIGINT
-timeout04.sh| |0| | 2|0|0|1|Verify that timeout is enforced
-timeout02.sh| 2|1| 2| |1|0|0|Test termination of timeout process
+timeout01.sh||0
+timeout02.sh||0
+timeout02.sh|foo|2
+timeout02.sh|2|0
+timeout01.sh|2|0
+timeout02.sh|1.1|0
+timeout02.sh|-10|2
+timeout02.sh|-0.1|0
+timeout02.sh|-1.1|2
+timeout02.sh|-10.1|2
"
-# Executes a test
-# Parameter:
-# - test: The test to execute
-# - timeout: The timeout multiplicator (optional)
-# - use_cat: Pipe the output of the command through cat (optional)
-# If this is used, the exit code is NOT returned!
-#
-# The function returns the following global variables:
-# - test_exit: The exit code of the test
-# - test_duration: The duration of the test in seconds
-# - test_output: The full output of the test
-# - test_passed: The number of passed tests parsed from the summary
-# - test_failed: The number of failed tests parsed from the summary
-# - test_broken: The number of broken tests parsed from the summary
-run_test()
-{
- local test=$1
- local timeout=$2
- local use_cat=$3
- local tmpfile start end;
-
- tmpfile=$(mktemp -t ltp_timeout_XXXXXXXX)
- start=$(date +%s)
- # We have to use set monitor mode (set -m) here.
- # In most shells in most cases this creates a
- # new process group for the next command.
- # A process group is required for the timeout functionality,
- # because it sends signals to the whole process group.
- set -m
- # The use_cat is for testing if any programm using stdout
- # is still running, after the test finished.
- # cat will wait for its stdin to be closed.
- #
- # In the pure shell implementation of the timeout handling,
- # the sleep process was never killed, when a test finished
- # before the timeout.
- if [ "$use_cat" = "1" ]; then
- LTP_TIMEOUT_MUL=$timeout $test 2>&1 | cat >$tmpfile
- else
- LTP_TIMEOUT_MUL=$timeout $test 1>$tmpfile 2>&1
- fi
- test_exit=$?
- set +m
- end=$(date +%s)
-
- test_duration=$((end - start))
- test_output=$(cat $tmpfile)
- rm $tmpfile
-
- eval $(echo "$test_output" | awk '
- BEGIN {sum=0}
- $1 == "Summary:" {
- sum=1;
- }
- sum && ( \
- $1 == "passed" \
- || $1 == "failed" \
- || $1 == "broken") {
- print "test_" $1 "=" $2
- }
- ')
-}
-
echo "Testing timeout in shell API"
echo
failed=0
-test_nr=0
-
-old_ifs="$IFS"
-IFS=$(printf "\n\b")
-
-# Remove comments and empty lines
-CLEANED_DATA=$(echo "$DATA" | sed '/^\s*#/d;/^\s*$/d')
-test_max=$(echo "$CLEANED_DATA" | wc -l)
-for d in $CLEANED_DATA; do
- IFS="$old_ifs"
-
- file=$(echo $d | cut -d'|' -f1 | xargs)
- timeout=$(echo $d | cut -d'|' -f2 | xargs)
- use_cat=$(echo $d | cut -d'|' -f3 | xargs)
- max_runtime=$(echo $d | cut -d'|' -f4 | xargs)
- max_runtime=${max_runtime:--1}
- exp_exit=$(echo $d | cut -d'|' -f5 | xargs)
- exp_exit=${exp_exit:--1}
- exp_passed=$(echo $d | cut -d'|' -f6 | xargs)
- exp_passed=${exp_passed:--1}
- exp_failed=$(echo $d | cut -d'|' -f7 | xargs)
- exp_failed=${exp_failed:--1}
- exp_broken=$(echo $d | cut -d'|' -f8 | xargs)
- exp_broken=${exp_broken:--1}
- description=$(echo $d | cut -d'|' -f9)
-
- test_nr=$(($test_nr + 1))
-
- cur_fails=0
-
- if [ -z "$description" ]; then
- description="$file (LTP_TIMEOUT_MUL='$timeout')"
- fi
-
- echo "=== $test_nr/$test_max $description ==="
- run_test "$file" "$timeout" "$use_cat"
-
- if [ $max_runtime -ne -1 ] && [ $test_duration -gt $max_runtime ]; then
- echo "FAILED (runtime: $test_duration, expected less than $max_runtime)"
- cur_fails=$((cur_fails + 1))
- fi
-
- if [ $exp_passed -ne -1 ] && [ $exp_passed -ne $test_passed ]; then
- echo "FAILED (passes: $test_passed, expected $exp_passed)"
- cur_fails=$((cur_fails + 1))
- fi
-
- if [ $exp_failed -ne -1 ] && [ $exp_failed -ne $test_failed ]; then
- echo "FAILED (failed: $test_failed, expected $exp_failed)"
- cur_fails=$((cur_fails + 1))
- fi
-
- if [ $exp_broken -ne -1 ] && [ $exp_broken -ne $test_broken ]; then
- echo "FAILED (broken: $test_broken, expected $exp_broken)"
- cur_fails=$((cur_fails + 1))
- fi
-
- if [ $exp_exit -ne -1 ] && [ $test_exit -ne $exp_exit ]; then
- echo "FAILED (exit code: $test_exit, expected $exp_exit)"
- cur_fails=$((cur_fails + 1))
- fi
-
- if [ $cur_fails -gt 0 ]; then
- failed=$((failed + 1))
- echo "--------"
- echo "$test_output"
- echo "--------"
+for i in $DATA; do
+ file=$(echo $i | cut -d'|' -f1)
+ timeout=$(echo $i | cut -d'|' -f2)
+ exp_exit=$(echo $i | cut -d'|' -f3)
+
+ echo "=== $file (LTP_TIMEOUT_MUL='$timeout') ==="
+ LTP_TIMEOUT_MUL=$timeout $file
+ ret=$?
+ if [ $ret -ne $exp_exit ]; then
+ echo "FAILED (exit code: $ret, expected $exp_exit)"
+ failed=$((failed+1))
else
echo "PASSED"
fi
echo
done
-IFS="$old_ifs"
echo "Failed tests: $failed"
exit $failed
diff --git a/lib/newlib_tests/shell/timeout03.sh b/lib/newlib_tests/shell/timeout03.sh
deleted file mode 100755
index cd548d9a2..000000000
--- a/lib/newlib_tests/shell/timeout03.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-
-# testing shell timeout handling in _tst_kill_test()
-# expected output:
-# timeout03 1 TINFO: timeout per run is 0h 0m 1s
-# timeout03 1 TINFO: testing killing test after TST_TIMEOUT
-# timeout03 1 TBROK: Test timeouted, sending SIGINT! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1
-# timeout03 1 TBROK: test interrupted or timed out
-# timeout03 1 TPASS: test run cleanup after timeout
-# timeout03 1 TINFO: Test is still running, waiting 10s
-# timeout03 1 TINFO: Test is still running, waiting 9s
-# timeout03 1 TINFO: Test is still running, waiting 8s
-# timeout03 1 TINFO: Test is still running, waiting 7s
-# timeout03 1 TINFO: Test is still running, waiting 6s
-# timeout03 1 TINFO: Test is still running, waiting 5s
-# timeout03 1 TINFO: Test is still running, waiting 4s
-# timeout03 1 TINFO: Test is still running, waiting 3s
-# timeout03 1 TINFO: Test is still running, waiting 2s
-# timeout03 1 TINFO: Test is still running, waiting 1s
-# timeout03 1 TBROK: Test still running, sending SIGKILL
-# Killed
-
-TST_TESTFUNC=do_test
-TST_CLEANUP=cleanup
-
-TST_TIMEOUT=1
-. tst_test.sh
-
-do_test()
-{
- tst_res TINFO "testing killing test after TST_TIMEOUT"
-
- sleep 2
- tst_res TFAIL "test: running after TST_TIMEOUT"
-}
-
-cleanup()
-{
- tst_res TPASS "test run cleanup after timeout"
-
- sleep 15 # must be higher than wait time in _tst_kill_test
- tst_res TFAIL "cleanup: running after TST_TIMEOUT"
-}
-
-tst_run
diff --git a/lib/newlib_tests/shell/timeout04.sh b/lib/newlib_tests/shell/timeout04.sh
deleted file mode 100755
index c702905f3..000000000
--- a/lib/newlib_tests/shell/timeout04.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-
-TST_TESTFUNC=do_test
-
-TST_TIMEOUT=1
-. tst_test.sh
-
-do_test()
-{
- tst_res TINFO "Start"
- sleep 5
- tst_res TFAIL "End"
-}
-
-do_cleanup()
-{
- tst_res TINFO "cleanup"
-}
-
-tst_run
diff --git a/lib/newlib_tests/shell/tst_check_driver.sh b/lib/newlib_tests/shell/tst_check_driver.sh
deleted file mode 100755
index d188b6f77..000000000
--- a/lib/newlib_tests/shell/tst_check_driver.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-
-TST_TESTFUNC=test
-TST_SETUP=setup
-TST_CNT=3
-TST_NEEDS_CMDS="tst_check_drivers find grep head sed"
-. tst_test.sh
-
-MODULES_DIR="${MODULES_DIR:-/lib/modules/$(uname -r)}"
-
-setup()
-{
- tst_res TINFO "using modules directory '$MODULES_DIR'"
-
- [ -d "$MODULES_DIR" ] || \
- tst_brk TCONF "modules directory '$MODULES_DIR' missing"
-}
-
-test_drivers()
-{
- local paths="$*"
- local drv
-
- if [ -z "$paths" ]; then
- tst_res TCONF "no modules found"
- return
- fi
-
- for drv in $paths; do
- drv="$(echo $drv | sed 's/.*\/\([^/]\+\)\.ko.*/\1/')"
- EXPECT_PASS tst_check_drivers $drv
- drv="$(echo $drv | sed 's/_/-/g')"
- EXPECT_PASS tst_check_drivers $drv
- done
-}
-
-test1()
-{
- tst_res TINFO "check loadable module detection"
- test_drivers $(find $MODULES_DIR | grep -E '_[^/]+\.ko' | head -3)
-}
-
-test2()
-{
- tst_res TINFO "check non-existing module detection"
- EXPECT_FAIL tst_check_drivers not-existing-kernel-module
-}
-
-test3()
-{
- local f="$MODULES_DIR/modules.builtin"
-
- tst_res TINFO "check built-in module detection"
-
- [ -f "$f" ] || \
- tst_brk TCONF "missing '$f'"
-
- test_drivers $(grep -E '_[^/]+\.ko' $f | head -3)
-}
-
-tst_run
diff --git a/lib/newlib_tests/test02.c b/lib/newlib_tests/test02.c
index ec2a1d13d..f1b6a7ca4 100644
--- a/lib/newlib_tests/test02.c
+++ b/lib/newlib_tests/test02.c
@@ -10,7 +10,7 @@
#include "tst_test.h"
void tst_resm_(char *, int, int, char *);
-void tst_brkm__(char *, int, int, void (*)(void), char *);
+void tst_brkm_(char *, int, int, void (*)(void), char *);
static void cleanup(void)
{
@@ -24,7 +24,7 @@ static void do_test(unsigned int i)
tst_resm_(__FILE__, __LINE__, TPASS, "passed message");
break;
case 1:
- tst_brkm__(__FILE__, __LINE__, TCONF, cleanup, "Non-NULL cleanup");
+ tst_brkm_(__FILE__, __LINE__, TCONF, cleanup, "Non-NULL cleanup");
break;
}
}
diff --git a/lib/newlib_tests/test20.c b/lib/newlib_tests/test20.c
deleted file mode 100644
index 53317b669..000000000
--- a/lib/newlib_tests/test20.c
+++ /dev/null
@@ -1,45 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Li Wang <liwang@redhat.com>
- */
-
-/*
- * Tests .request_hugepages + .save_restore
- */
-
-#include "tst_test.h"
-#include "tst_hugepage.h"
-#include "tst_sys_conf.h"
-
-static const char * const save_restore[] = {
- "!/proc/sys/kernel/numa_balancing",
- NULL,
-};
-
-static void do_test(void) {
-
- unsigned long val, hpages;
-
- tst_res(TINFO, "tst_hugepages = %lu", tst_hugepages);
- SAFE_FILE_PRINTF("/proc/sys/kernel/numa_balancing", "1");
-
- hpages = test.request_hugepages;
- SAFE_FILE_SCANF(PATH_NR_HPAGES, "%lu", &val);
- if (val != hpages)
- tst_brk(TBROK, "nr_hugepages = %lu, but expect %lu", val, hpages);
- else
- tst_res(TPASS, "test .needs_hugepges");
-
- hpages = tst_request_hugepages(3);
- SAFE_FILE_SCANF(PATH_NR_HPAGES, "%lu", &val);
- if (val != hpages)
- tst_brk(TBROK, "nr_hugepages = %lu, but expect %lu", val, hpages);
- else
- tst_res(TPASS, "tst_request_hugepages");
-}
-
-static struct tst_test test = {
- .test_all = do_test,
- .request_hugepages = 2,
- .save_restore = save_restore,
-};
diff --git a/lib/newlib_tests/test22.c b/lib/newlib_tests/test22.c
deleted file mode 100644
index 520b8dad8..000000000
--- a/lib/newlib_tests/test22.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * Test that TBROK is propagated correctly to the results even if we wait on
- * child and throw away the status.
- */
-#include "tst_test.h"
-
-static void do_test(void)
-{
- int pid = SAFE_FORK();
-
- if (pid) {
- tst_res(TPASS, "Test main pid");
- SAFE_WAITPID(pid, NULL, 0);
- return;
- }
-
- if (tst_variant == 1)
- tst_brk(TBROK, "Test child!");
- else
- tst_brk(TCONF, "Test child!");
-
- tst_res(TPASS, "Test child");
-}
-
-static struct tst_test test = {
- .test_all = do_test,
- .test_variants = 2,
- .forks_child = 1,
-};
diff --git a/lib/newlib_tests/test_assert.c b/lib/newlib_tests/test_assert.c
deleted file mode 100644
index 092303893..000000000
--- a/lib/newlib_tests/test_assert.c
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-
-#include <stdio.h>
-#include "tst_test.h"
-
-static void do_test(void)
-{
- TST_ASSERT_INT("/proc/self/oom_score", 0);
- TST_ASSERT_STR("/proc/self/comm", "test_assert");
- TST_ASSERT_FILE_INT("/proc/self/io", "read_bytes:", 0);
- TST_ASSERT_FILE_STR("/proc/self/status1", "State", "unexpected");
-}
-
-static struct tst_test test = {
- .test_all = do_test,
-};
diff --git a/lib/newlib_tests/test_exec.c b/lib/newlib_tests/test_exec.c
index 370a0b948..75f1b03a4 100644
--- a/lib/newlib_tests/test_exec.c
+++ b/lib/newlib_tests/test_exec.c
@@ -25,7 +25,7 @@ static void do_test(void)
execve(path, argv, environ);
- tst_res(TFAIL | TERRNO, "EXEC!");
+ tst_res(TBROK | TERRNO, "EXEC!");
}
static struct tst_test test = {
diff --git a/lib/newlib_tests/test_kconfig.c b/lib/newlib_tests/test_kconfig.c
index 9280f07ca..d9c662fc5 100644
--- a/lib/newlib_tests/test_kconfig.c
+++ b/lib/newlib_tests/test_kconfig.c
@@ -14,9 +14,6 @@ static const char *kconfigs[] = {
"CONFIG_MMU",
"CONFIG_EXT4_FS=m",
"CONFIG_PGTABLE_LEVELS=4",
- "CONFIG_MMU & CONFIG_EXT4_FS=m",
- "CONFIG_EXT4_FS=m | CONFIG_MMU",
- "CONFIG_DEFAULT_HOSTNAME=\"(none)\"",
NULL
};
diff --git a/lib/newlib_tests/test_kconfig01.c b/lib/newlib_tests/test_kconfig01.c
deleted file mode 100644
index ee919dcac..000000000
--- a/lib/newlib_tests/test_kconfig01.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- *
- * Invalid boolean expression test.
- */
-
-#include "tst_test.h"
-
-static void do_test(void)
-{
- tst_res(TPASS, "Test passed!");
-}
-
-static const char *kconfigs[] = {
- "CONFIG_EXT4_FS=m | CONFIG_MMU)",
- NULL
-};
-
-static struct tst_test test = {
- .test_all = do_test,
- .needs_kconfigs = kconfigs,
-};
diff --git a/lib/newlib_tests/test_kconfig02.c b/lib/newlib_tests/test_kconfig02.c
deleted file mode 100644
index 176929222..000000000
--- a/lib/newlib_tests/test_kconfig02.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- *
- * Invalid boolean expression test.
- */
-
-#include "tst_test.h"
-
-static void do_test(void)
-{
- tst_res(TPASS, "Test passed!");
-}
-
-static const char *kconfigs[] = {
- "\"CONFIG_FOO=val\"",
- "CONFIG_a=1",
- "CONFIG_FOO=",
- "CONFIG_DEFAULT_HOSTNAME=\"(none",
- "CONFIG_DEFAULT_HOSTNAME=\"(none)\"a",
- "CONFIG_BROKEN=a\" | CONFIG_FOO",
- "CONFIG_BROKEN=a=",
- NULL
-};
-
-static struct tst_test test = {
- .test_all = do_test,
- .needs_kconfigs = kconfigs,
-};
diff --git a/lib/newlib_tests/test_macros01.c b/lib/newlib_tests/test_macros01.c
deleted file mode 100644
index 9a920f8e4..000000000
--- a/lib/newlib_tests/test_macros01.c
+++ /dev/null
@@ -1,40 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * Test macros.
- */
-
-#include "tst_test.h"
-
-static int fail_fd(void)
-{
- errno = EINVAL;
- return -1;
-}
-
-static int pass_fd(void)
-{
- return 42;
-}
-
-static int inval_val(void)
-{
- return -42;
-}
-
-static void do_test(void)
-{
- TST_EXP_FD(fail_fd(), "TEST DESCRIPTION");
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FD(pass_fd(), "%s", "TEST DESCRIPTION PARAM");
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FD(inval_val());
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
-}
-
-static struct tst_test test = {
- .test_all = do_test,
-};
diff --git a/lib/newlib_tests/test_macros02.c b/lib/newlib_tests/test_macros02.c
deleted file mode 100644
index f0a692ab6..000000000
--- a/lib/newlib_tests/test_macros02.c
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * Test macros.
- */
-
-#include "tst_test.h"
-
-static int fail_fn(void)
-{
- errno = EINVAL;
- return -1;
-}
-
-static int pass_fn(void)
-{
- return 0;
-}
-
-static int inval_ret_fn(void)
-{
- return 42;
-}
-
-static void do_test(void)
-{
- TST_EXP_FAIL(fail_fn(), EINVAL);
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL(fail_fn(), ENOTTY);
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL(pass_fn(), ENOTTY);
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_FAIL(inval_ret_fn(), ENOTTY, "TEST DESCRIPTION");
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
-}
-
-static struct tst_test test = {
- .test_all = do_test,
-};
diff --git a/lib/newlib_tests/test_macros03.c b/lib/newlib_tests/test_macros03.c
deleted file mode 100644
index 414370980..000000000
--- a/lib/newlib_tests/test_macros03.c
+++ /dev/null
@@ -1,40 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * Test macros.
- */
-
-#include "tst_test.h"
-
-static int fail_fn(void)
-{
- errno = EINVAL;
- return -1;
-}
-
-static int pass_fn(void)
-{
- return 0;
-}
-
-static int inval_ret_fn(void)
-{
- return 42;
-}
-
-static void do_test(void)
-{
- TST_EXP_PASS(fail_fn());
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_PASS(pass_fn(), "TEST DESCRIPTION");
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
- TST_EXP_PASS(inval_ret_fn());
- tst_res(TINFO, "TST_PASS = %i", TST_PASS);
-}
-
-static struct tst_test test = {
- .test_all = do_test,
-};
diff --git a/lib/newlib_tests/test_timer.c b/lib/newlib_tests/test_timer.c
deleted file mode 100644
index 6b670d810..000000000
--- a/lib/newlib_tests/test_timer.c
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * Tests for include/tst_timer.h
- */
-
-#include "tst_test.h"
-#include "tst_timer.h"
-
-#define VAL_MS 1001
-#define VAL_US 1001000
-
-static void test_diff(enum tst_ts_type type)
-{
- struct tst_ts ts1, ts2;
- long long diff;
-
- ts1 = tst_ts_from_ms(type, VAL_MS);
- ts2 = tst_ts_from_us(type, VAL_US);
-
- diff = tst_ts_diff_ns(ts1, ts2);
-
- if (diff == 0)
- tst_res(TPASS, "ns_diff = 0");
- else
- tst_res(TFAIL, "ns_diff = %lli", diff);
-
- diff = tst_ts_diff_ns(ts1, ts2);
-
- if (diff == 0)
- tst_res(TPASS, "us_diff = 0");
- else
- tst_res(TFAIL, "us_diff = %lli", diff);
-
- diff = tst_ts_diff_ms(ts1, ts2);
-
- if (diff == 0)
- tst_res(TPASS, "ms_diff = 0");
- else
- tst_res(TFAIL, "ms_diff = %lli", diff);
-}
-
-static void test_lt(enum tst_ts_type type)
-{
- struct tst_ts ts1, ts2;
-
- ts1 = tst_ts_from_ms(type, VAL_MS);
- ts2 = tst_ts_from_us(type, VAL_US + 1);
-
- if (tst_ts_lt(ts1, ts2))
- tst_res(TPASS, "ts1 < ts2");
- else
- tst_res(TFAIL, "ts1 >= ts2");
-
- ts1 = tst_ts_add_us(ts1, 1);
-
- if (tst_ts_lt(ts1, ts2))
- tst_res(TFAIL, "ts1 < ts2");
- else
- tst_res(TPASS, "ts1 >= ts2");
-
- ts1 = tst_ts_add_us(ts1, 1);
-
- if (tst_ts_lt(ts1, ts2))
- tst_res(TFAIL, "ts1 < ts2");
- else
- tst_res(TPASS, "ts1 >= ts2");
-}
-
-static void test_add_sub(enum tst_ts_type type)
-{
- struct tst_ts ts;
-
- ts = tst_ts_from_ns(type, 999999000);
- ts = tst_ts_add_us(ts, 1);
-
- long long sec = tst_ts_get_sec(ts);
- long long nsec = tst_ts_get_nsec(ts);
-
- /* Check that result was normalized */
- if (sec != 1 || nsec != 0)
- tst_res(TFAIL, "sec = %lli, nsec = %lli", sec, nsec);
- else
- tst_res(TPASS, "sec = %lli, nsec = %lli", sec, nsec);
-
- ts = tst_ts_from_ms(type, 1000);
- ts = tst_ts_sub_us(ts, 1);
-
- sec = tst_ts_get_sec(ts);
- nsec = tst_ts_get_nsec(ts);
-
- /* Check that result was normalized */
- if (sec != 0 || nsec != 999999000)
- tst_res(TFAIL, "sec = %lli, nsec = %lli", sec, nsec);
- else
- tst_res(TPASS, "sec = %lli, nsec = %lli", sec, nsec);
-}
-
-static void do_test(unsigned int n)
-{
- tst_res(TINFO, "Testing with type = %i", n);
- test_diff(n);
- test_lt(n);
- test_add_sub(n);
-}
-
-static struct tst_test test = {
- .test = do_test,
- .tcnt = 3,
-};
diff --git a/lib/newlib_tests/tst_bool_expr.c b/lib/newlib_tests/tst_bool_expr.c
deleted file mode 100644
index 8f0929d35..000000000
--- a/lib/newlib_tests/tst_bool_expr.c
+++ /dev/null
@@ -1,131 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * Basic unit test for the bolean expression parser and evaluator.
- */
-
-#include <string.h>
-#include <stdio.h>
-#include "tst_test.h"
-#include "tst_bool_expr.h"
-
-static int a, b, c;
-
-static int map(struct tst_expr_tok *var)
-{
- if (!strncmp(var->tok, "A", var->tok_len))
- return a;
-
- if (!strncmp(var->tok, "B", var->tok_len))
- return b;
-
- if (!strncmp(var->tok, "C", var->tok_len))
- return c;
-
- if (!strncmp(var->tok, "True", var->tok_len))
- return 1;
-
- if (!strncmp(var->tok, "False", var->tok_len))
- return 0;
-
- return -1;
-}
-
-static void parse_fail(const char *expr)
-{
- struct tst_expr *res;
-
- tst_res(TINFO, "Parsing '%s'", expr);
-
- res = tst_bool_expr_parse(expr);
-
- if (res) {
- printf("In RPN: ");
- tst_bool_expr_print(stdout, res);
- printf("\n");
- tst_bool_expr_free(res);
- tst_res(TFAIL, "Expression was parsed");
- } else {
- tst_res(TPASS, "Parser returned an error");
- }
-}
-
-static void do_eval_test(const char *expr_str, int set_a, int set_b, int set_c, int exp_res)
-{
- struct tst_expr *expr;
- int res;
-
- a = set_a;
- b = set_b;
- c = set_c;
-
- tst_res(TINFO, "'%s' A=%i B=%i C=%i == %i", expr_str, a, b, c, exp_res);
-
- expr = tst_bool_expr_parse(expr_str);
-
- if (!expr) {
- tst_res(TFAIL, "Parser returned error");
- return;
- }
-
- printf("In RPN: ");
- tst_bool_expr_print(stdout, expr);
- printf("\n");
-
- res = tst_bool_expr_eval(expr, map);
-
- if (res == exp_res)
- tst_res(TPASS, "Got %i", res);
- else
- tst_res(TFAIL, "Got %i", res);
-
- tst_bool_expr_free(expr);
-}
-
-static void do_test(void)
-{
- do_eval_test("(A | B) & !!C", 0, 0, 0, 0);
- do_eval_test("(A | B) & !!C", 1, 0, 1, 1);
- do_eval_test("!A & B", 1, 0, 0, 0);
- do_eval_test("!A & B", 0, 1, 0, 1);
- do_eval_test("A & !B", 1, 0, 0, 1);
- do_eval_test("!!A & !!B", 0, 1, 0, 0);
- do_eval_test("!!A & !!B", 1, 1, 0, 1);
- do_eval_test("!(A & B) & C", 1, 1, 0, 0);
- do_eval_test("A & (B | C)", 1, 1, 0, 1);
- do_eval_test("A & B | C", 1, 1, 0, 1);
- do_eval_test("((((A)))&(B))", 1, 1, 0, 1);
- do_eval_test(" A \t", 0, 0, 0, 0);
- do_eval_test("False & A", 1, 0, 0, 0);
- do_eval_test("! Undefined", 0, 0, 0, -1);
-
- do_eval_test("\"(none)\"", 0, 0, 0, -1);
- do_eval_test("\"(none)\" & \" \"", 0, 0, 0, -1);
-
- parse_fail("A!");
- parse_fail("A &");
- parse_fail("A B");
- parse_fail("A ) B");
- parse_fail("A ( B");
- parse_fail("A ( B )");
- parse_fail("A |");
- parse_fail("A ! B");
- parse_fail("A! & B");
- parse_fail("A & | B");
- parse_fail("A & (B |)");
- parse_fail("A & ( | B)");
- parse_fail("A & B &");
- parse_fail("((A )");
- parse_fail("& A");
- parse_fail("! &");
- parse_fail(")");
- parse_fail("| A");
- parse_fail("");
-}
-
-static struct tst_test test = {
- .test_all = do_test,
-};
diff --git a/lib/newlib_tests/tst_capability01.c b/lib/newlib_tests/tst_capability01.c
index 47ac04569..7d3f0f1ea 100644
--- a/lib/newlib_tests/tst_capability01.c
+++ b/lib/newlib_tests/tst_capability01.c
@@ -22,7 +22,7 @@ static void run(void)
tst_res(TFAIL, "Created raw socket");
SAFE_CLOSE(TST_RET);
} else if (TST_ERR != EPERM) {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TBROK | TTERRNO,
"Failed to create socket for wrong reason");
} else {
tst_res(TPASS | TTERRNO, "Didn't create raw socket");
diff --git a/lib/newlib_tests/tst_cgroup01.c b/lib/newlib_tests/tst_cgroup01.c
deleted file mode 100644
index 54a370362..000000000
--- a/lib/newlib_tests/tst_cgroup01.c
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) 2021 SUSE LLC */
-
-#include <stdio.h>
-
-#include "tst_test.h"
-#include "tst_cgroup.h"
-
-static char *only_mount_v1;
-static char *no_cleanup;
-static struct tst_option opts[] = {
- {"v", &only_mount_v1, "-v\tOnly try to mount CGroups V1"},
- {"n", &no_cleanup, "-n\tLeave CGroups created by test"},
- {NULL, NULL, NULL},
-};
-struct tst_cgroup_opts cgopts;
-
-static void do_test(void)
-{
- tst_res(TPASS, "pass");
-}
-
-static void setup(void)
-{
- cgopts.only_mount_v1 = !!only_mount_v1,
-
- tst_cgroup_scan();
- tst_cgroup_print_config();
-
- tst_cgroup_require("memory", &cgopts);
- tst_cgroup_print_config();
- tst_cgroup_require("cpuset", &cgopts);
- tst_cgroup_print_config();
-}
-
-static void cleanup(void)
-{
- if (no_cleanup) {
- tst_res(TINFO, "no cleanup");
- } else {
- tst_res(TINFO, "cleanup");
- tst_cgroup_cleanup();
- }
-}
-
-static struct tst_test test = {
- .test_all = do_test,
- .setup = setup,
- .cleanup = cleanup,
- .options = opts,
-};
diff --git a/lib/newlib_tests/tst_cgroup02.c b/lib/newlib_tests/tst_cgroup02.c
deleted file mode 100644
index 1e2152064..000000000
--- a/lib/newlib_tests/tst_cgroup02.c
+++ /dev/null
@@ -1,90 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) 2021 SUSE LLC */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "tst_test.h"
-#include "tst_cgroup.h"
-
-static char *only_mount_v1;
-static char *no_cleanup;
-static struct tst_option opts[] = {
- {"v", &only_mount_v1, "-v\tOnly try to mount CGroups V1"},
- {"n", &no_cleanup, "-n\tLeave CGroups created by test"},
- {NULL, NULL, NULL},
-};
-static struct tst_cgroup_opts cgopts;
-static const struct tst_cgroup_group *cg;
-static const struct tst_cgroup_group *cg_drain;
-static struct tst_cgroup_group *cg_child;
-
-static void do_test(void)
-{
- char buf[BUFSIZ];
- size_t mem;
-
- if (TST_CGROUP_VER(cg, "memory") != TST_CGROUP_V1)
- SAFE_CGROUP_PRINT(cg, "cgroup.subtree_control", "+memory");
- if (TST_CGROUP_VER(cg, "cpuset") != TST_CGROUP_V1)
- SAFE_CGROUP_PRINT(cg, "cgroup.subtree_control", "+cpuset");
-
- cg_child = tst_cgroup_group_mk(cg, "child");
- if (!SAFE_FORK()) {
- SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
-
- SAFE_CGROUP_SCANF(cg_child, "memory.current", "%zu", &mem);
- tst_res(TPASS, "child/memory.current = %zu", mem);
- SAFE_CGROUP_PRINTF(cg_child, "memory.max",
- "%zu", (1UL << 24) - 1);
- SAFE_CGROUP_PRINTF(cg_child, "memory.swap.max",
- "%zu", 1UL << 31);
-
- SAFE_CGROUP_READ(cg_child, "cpuset.mems", buf, sizeof(buf));
- tst_res(TPASS, "child/cpuset.mems = %s", buf);
- SAFE_CGROUP_PRINT(cg_child, "cpuset.mems", buf);
-
- exit(0);
- }
-
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%zu", (1UL << 24) - 1);
- SAFE_CGROUP_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
- SAFE_CGROUP_SCANF(cg, "memory.current", "%zu", &mem);
- tst_res(TPASS, "memory.current = %zu", mem);
-
- tst_reap_children();
- SAFE_CGROUP_PRINTF(cg_drain, "cgroup.procs", "%d", getpid());
- cg_child = tst_cgroup_group_rm(cg_child);
-}
-
-static void setup(void)
-{
- cgopts.only_mount_v1 = !!only_mount_v1,
-
- tst_cgroup_scan();
- tst_cgroup_print_config();
-
- tst_cgroup_require("memory", &cgopts);
- tst_cgroup_require("cpuset", &cgopts);
-
- cg = tst_cgroup_get_test_group();
- cg_drain = tst_cgroup_get_drain_group();
-}
-
-static void cleanup(void)
-{
- if (cg_child) {
- SAFE_CGROUP_PRINTF(cg_drain, "cgroup.procs", "%d", getpid());
- cg_child = tst_cgroup_group_rm(cg_child);
- }
- if (!no_cleanup)
- tst_cgroup_cleanup();
-}
-
-static struct tst_test test = {
- .test_all = do_test,
- .setup = setup,
- .cleanup = cleanup,
- .options = opts,
- .forks_child = 1,
-};
diff --git a/lib/newlib_tests/tst_device.c b/lib/newlib_tests/tst_device.c
index ad077affd..1344495b3 100644
--- a/lib/newlib_tests/tst_device.c
+++ b/lib/newlib_tests/tst_device.c
@@ -13,7 +13,6 @@ static void do_test(void)
{
int fd;
const char *dev;
- char block_dev[100];
uint64_t ltp_dev_size;
dev = tst_device->dev;
@@ -30,13 +29,6 @@ static void do_test(void)
tst_res(TPASS, "Got expected device size");
else
tst_res(TFAIL, "Got unexpected device size");
-
- tst_find_backing_dev("/boot", block_dev);
- tst_res(TPASS, "/boot belongs to %s block dev", block_dev);
- tst_find_backing_dev("/", block_dev);
- tst_res(TPASS, "/ belongs to %s block dev", block_dev);
- tst_find_backing_dev("/tmp", block_dev);
- tst_find_backing_dev("/boot/xuyang", block_dev);
}
static struct tst_test test = {
diff --git a/lib/newlib_tests/tst_fuzzy_sync01.c b/lib/newlib_tests/tst_fuzzy_sync01.c
deleted file mode 100644
index 73408e4d1..000000000
--- a/lib/newlib_tests/tst_fuzzy_sync01.c
+++ /dev/null
@@ -1,230 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Richard Palethorpe <rpalethorpe@suse.com>
- */
-/*\
- * [DESCRIPTION]
- *
- * This verifies Fuzzy Sync's basic ability to reproduce a particular
- * outcome to a data race when the critical sections are not aligned.
- *
- * We make the simplifying assumptions that:
- * - Each thread contains a single contiguous critical section.
- * - The threads only interact through a single variable.
- * - The various timings are constant except for variations introduced
- * by the environment.
- *
- * If a single data race has N critical sections then we may remove
- * N-1 sections to produce a more difficult race. We may then test
- * only the more difficult race and induce from this the outcome of
- * testing the easier races.
- *
- * In real code, the threads may interact through many side
- * effects. While some of these side effects may not result in a bug,
- * they may effect the total time it takes to execute either
- * thread. This will be handled in tst_fuzzy_sync02.
- *
- * The number of variables which two threads interact through is
- * irrelevant as the combined state of two variables can be
- * represented with a single variable. We may also reduce the number
- * of states to simply those required to show the thread is inside or
- * outside of the critical section.
- *
- * There are two fundamental races which require alignment under these
- * assumptions:
- * 1 2
- * A +-----+ +----+ The outer box is total execution time.
- * | # | | # | The '#' is the critical section.
- *
- * | # | | # |
- * B +----+ +-----+
- *
- * So we can either have the critical section of the shorter race
- * before that of the longer one. Or the critical section of the
- * longer one before the shorter.
- *
- * In reality both threads will never be the same length, but we can
- * test that anyway. We also test with both A as the shorter and B as
- * the shorter. We also vary the distance of the critical section from
- * the start or end. The delay times are cubed to ensure that a delay
- * range is required.
- *
- * When entering their critical sections, both threads increment the
- * 'c' counter variable atomically. They both also increment it when
- * leaving their critical sections. We record the value of 'c' when A
- * increments it. From the recorded values of 'c' we can deduce if the
- * critical sections overlap and their ordering.
- *
- * Start (cs) | End (ct) | Ordering
- * --------------------------------------------
- * 1 | 2 | A before B
- * 3 | 4 | B before A
- *
- * Any other combination of 'cs' and 'ct' means the critical sections
- * overlapped.
-\*/
-
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-
-/* Scale all the delay times by this function. The races become harder
- * the faster this function grows. With cubic scaling the race windows
- * will be 27 times smaller than the entry or return delays. Because
- * TIME_SCALE(1) = 1*1*1, TIME_SCALE(3) = 3*3*3.
- */
-#define TIME_SCALE(x) ((x) * (x) * (x))
-
-/* The time signature of a code path containing a critical section. */
-struct window {
- /* The delay until the start of the critical section */
- const int critical_s;
- /* The length of the critical section */
- const int critical_t;
- /* The remaining delay until the method returns */
- const int return_t;
-};
-
-/* The time signatures of threads A and B */
-struct race {
- const struct window a;
- const struct window b;
-};
-
-static int c;
-static struct tst_fzsync_pair pair;
-
-static const struct race races[] = {
- /* Degnerate cases where the critical sections are already
- * aligned. The first case will fail when ncpu < 2 as a yield
- * inside the critical section is required for the other
- * thread to run.
- */
- { .a = { 0, 0, 0 }, .b = { 0, 0, 0 } },
- { .a = { 0, 1, 0 }, .b = { 0, 1, 0 } },
- { .a = { 1, 1, 1 }, .b = { 1, 1, 1 } },
- { .a = { 3, 1, 1 }, .b = { 3, 1, 1 } },
-
- /* Both windows are the same length */
- { .a = { 3, 1, 1 }, .b = { 1, 1, 3 } },
- { .a = { 1, 1, 3 }, .b = { 3, 1, 1 } },
-
- /* Different sized windows */
- { .a = { 3, 1, 1 }, .b = { 1, 1, 2 } },
- { .a = { 1, 1, 3 }, .b = { 2, 1, 1 } },
- { .a = { 2, 1, 1 }, .b = { 1, 1, 3 } },
- { .a = { 1, 1, 2 }, .b = { 3, 1, 1 } },
-
- /* Same as above, but with critical section at entry or exit */
- { .a = { 3, 1, 0 }, .b = { 0, 1, 3 } },
- { .a = { 0, 1, 3 }, .b = { 3, 1, 0 } },
-
- { .a = { 3, 1, 0 }, .b = { 0, 1, 2 } },
- { .a = { 0, 1, 3 }, .b = { 2, 1, 0 } },
- { .a = { 2, 1, 0 }, .b = { 0, 1, 3 } },
- { .a = { 0, 1, 2 }, .b = { 3, 1, 0 } },
-
- /* One side is very short */
- { .a = { 3, 1, 1 }, .b = { 0, 1, 0 } },
- { .a = { 1, 1, 3 }, .b = { 0, 1, 0 } },
- { .a = { 0, 1, 0 }, .b = { 1, 1, 3 } },
- { .a = { 0, 1, 0 }, .b = { 3, 1, 1 } },
-
- { .a = { 3, 1, 1 }, .b = { 0, 0, 0 } },
- { .a = { 1, 1, 3 }, .b = { 0, 0, 0 } },
- { .a = { 0, 0, 0 }, .b = { 1, 1, 3 } },
- { .a = { 0, 0, 0 }, .b = { 3, 1, 1 } },
-
-};
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&pair);
-}
-
-static void setup(void)
-{
- pair.min_samples = 10000;
-
- tst_fzsync_pair_init(&pair);
-}
-
-static void delay(const int t)
-{
- int k = TIME_SCALE(t);
-
- while (k--)
- sched_yield();
-}
-
-static void *worker(void *v)
-{
- unsigned int i = *(unsigned int *)v;
- const struct window b = races[i].b;
-
- while (tst_fzsync_run_b(&pair)) {
- if (tst_atomic_load(&c))
- tst_brk(TBROK, "Counter should now be zero");
-
- tst_fzsync_start_race_b(&pair);
- delay(b.critical_s);
-
- tst_atomic_add_return(1, &c);
- delay(b.critical_t);
- tst_atomic_add_return(1, &c);
-
- delay(b.return_t);
- tst_fzsync_end_race_b(&pair);
- }
-
- return NULL;
-}
-
-static void run(unsigned int i)
-{
- const struct window a = races[i].a;
- int cs, ct, r, too_early = 0, critical = 0, too_late = 0;
-
- tst_fzsync_pair_reset(&pair, NULL);
- SAFE_PTHREAD_CREATE(&pair.thread_b, 0, worker, &i);
-
- while (tst_fzsync_run_a(&pair)) {
-
- tst_fzsync_start_race_a(&pair);
- delay(a.critical_s);
-
- cs = tst_atomic_add_return(1, &c);
- delay(a.critical_t);
- ct = tst_atomic_add_return(1, &c);
-
- delay(a.return_t);
- tst_fzsync_end_race_a(&pair);
-
- if (cs == 1 && ct == 2)
- too_early++;
- else if (cs == 3 && ct == 4)
- too_late++;
- else
- critical++;
-
- r = tst_atomic_add_return(-4, &c);
- if (r)
- tst_brk(TBROK, "cs = %d, ct = %d, r = %d", cs, ct, r);
-
- if (critical > 100) {
- tst_fzsync_pair_cleanup(&pair);
- break;
- }
- }
-
- tst_res(critical > 50 ? TPASS : TFAIL,
- "acs:%-2d act:%-2d art:%-2d | =:%-4d -:%-4d +:%-4d",
- a.critical_s, a.critical_t, a.return_t,
- critical, too_early, too_late);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(races),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
-};
diff --git a/lib/newlib_tests/tst_fuzzy_sync02.c b/lib/newlib_tests/tst_fuzzy_sync02.c
deleted file mode 100644
index 394fb22e4..000000000
--- a/lib/newlib_tests/tst_fuzzy_sync02.c
+++ /dev/null
@@ -1,172 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Richard Palethorpe <rpalethorpe@suse.com>
- */
-/*\
- * [DESCRIPTION]
- *
- * This verifies Fuzzy Sync's ability to reproduce a particular
- * outcome to a data race when multiple races are present.
- *
- * We make the simplifying assumptions that:
- * - There is one data race we want to hit and one to avoid.
- * - Each thread contains two contiguous critical sections. One for each race.
- * - The threads only interact through two variables, one for each race.
- * - If we hit the race we want to avoid then it causes thread A to exit early.
- *
- * We don't consider more complicated dynamic interactions between the
- * two threads. Fuzzy Sync will eventually trigger a race so long as
- * the delay range is large enough. Assuming the race is possible to
- * reproduce without further tampering to increase the race window (a
- * technique specific to each race). So I conject that beyond a lower
- * threshold of complexity, increasing the complexity of the race is
- * no different from adding random noise.
- *
- * Emperically this appears to be true. So far we have seen in
- * reproducers that there are no more than two significant data
- * races. One we wish to reproduce and one we wish to avoid. It is
- * possible that the code contains multiple data races, but that they
- * appear only as two to us.
- *
- * Indeed it is also only possible to add a delay to A or B. So
- * regardless of the underlying complexity we really only have two
- * options.
- *
- * Here we only test a bias to delay B. A delay of A would be
- * identical except that the necessary delay bias would be negative.
- *
-\*/
-
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-
-/* The time signature of a code path containing a critical section. */
-struct window {
- /* The delay until the start of the critical section */
- const int critical_s;
- /* The length of the critical section */
- const int critical_t;
- /* The remaining delay until the method returns */
- const int return_t;
-};
-
-/* The time signatures of threads A and B. We interlace the two
- * windows for each thread. bd.return_t is ignored, but ad.return_t is
- * used instead of a.return_t if the ad and bd critical sections
- * overlap. This may result in the critical section of a never being
- * reached.
- */
-struct race {
- const struct window ad;
- const struct window a;
- const struct window bd;
- const struct window b;
-};
-
-static int c, d;
-static struct tst_fzsync_pair pair;
-
-static const struct race races[] = {
- { .a = { 1, 1, 1 }, .b = { 1, 1, 1 },
- .ad = { 0, 1, 0 }, .bd = { 0, 1, 0 } },
- { .a = { 30, 1, 1 }, .b = { 1, 1, 1 },
- .ad = { 0, 1, 0 }, .bd = { 0, 20, 0 } },
- { .a = { 40, 1, 0 }, .b = { 1, 1, 20 },
- .ad = { 1, 10, 0 }, .bd = { 1, 10, 0 } },
-};
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&pair);
-}
-
-static void setup(void)
-{
- pair.min_samples = 10000;
-
- tst_fzsync_pair_init(&pair);
-}
-
-static struct window to_abs(const struct window w)
-{
- const struct window wc = {
- w.critical_s,
- w.critical_s + w.critical_t,
- w.critical_s + w.critical_t + w.return_t,
- };
-
- return wc;
-}
-
-static void *worker(void *v)
-{
- unsigned int i = *(unsigned int *)v;
- const struct window b = to_abs(races[i].b);
- const struct window bd = to_abs(races[i].bd);
- int now, fin = MAX(b.return_t, bd.return_t);
-
- while (tst_fzsync_run_b(&pair)) {
- tst_fzsync_start_race_b(&pair);
- for (now = 0; now <= fin; now++) {
- if (now == b.critical_s || now == b.critical_t)
- tst_atomic_add_return(1, &c);
- if (now == bd.critical_s || now == bd.critical_t)
- tst_atomic_add_return(1, &d);
-
- sched_yield();
- }
- tst_fzsync_end_race_b(&pair);
- }
-
- return NULL;
-}
-
-static void run(unsigned int i)
-{
- const struct window a = to_abs(races[i].a);
- const struct window ad = to_abs(races[i].ad);
- int critical = 0;
- int now, fin;
-
- tst_fzsync_pair_reset(&pair, NULL);
- SAFE_PTHREAD_CREATE(&pair.thread_b, 0, worker, &i);
-
- while (tst_fzsync_run_a(&pair)) {
- c = 0;
- d = 0;
- fin = a.return_t;
-
- tst_fzsync_start_race_a(&pair);
- for (now = 0; now <= fin; now++) {
- if (now >= ad.critical_s &&
- now <= ad.critical_t && tst_atomic_load(&d) > 0)
- fin = ad.return_t;
-
- if (now >= a.critical_s &&
- now <= a.critical_t && tst_atomic_load(&c) == 1) {
- tst_atomic_add_return(1, &c);
- critical++;
- }
-
- sched_yield();
- }
- tst_fzsync_end_race_a(&pair);
-
- if (fin == ad.return_t)
- tst_fzsync_pair_add_bias(&pair, 1);
-
- if (critical > 100) {
- tst_fzsync_pair_cleanup(&pair);
- break;
- }
- }
-
- tst_res(critical > 50 ? TPASS : TFAIL, "%d| =:%-4d", i, critical);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(races),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
-};
diff --git a/lib/newlib_tests/variant.c b/lib/newlib_tests/variant.c
index 0f5be46e3..b5816fff0 100644
--- a/lib/newlib_tests/variant.c
+++ b/lib/newlib_tests/variant.c
@@ -17,12 +17,12 @@ static void do_test(void)
tst_res(TPASS, "Test passed");
break;
case 2:
- /* This exits the test immediately */
+ /* This exits the test immediatelly */
tst_brk(TBROK, "Test broken");
break;
}
- tst_res(TINFO, "test() function exiting normally");
+ tst_res(TINFO, "test() function exitting normaly");
}
static void setup(void)
@@ -31,13 +31,13 @@ static void setup(void)
switch (tst_variant) {
case 0:
- tst_res(TINFO, "Starting tst_brk(TCONF) test");
+ tst_res(TINFO, "Starting tst_brk TCONF test");
break;
case 1:
- tst_res(TINFO, "Starting tst_res(TPASS) test");
+ tst_res(TINFO, "Starting tst_res TPASS test");
break;
case 2:
- tst_res(TINFO, "Starting tst_brk(TBROK) test");
+ tst_res(TINFO, "Starting tst_res TBROK test");
break;
}
}
diff --git a/lib/safe_file_ops.c b/lib/safe_file_ops.c
index 249a512a1..b576cb97e 100644
--- a/lib/safe_file_ops.c
+++ b/lib/safe_file_ops.c
@@ -34,7 +34,15 @@
#include "test.h"
#include "safe_file_ops_fn.h"
-int tst_count_scanf_conversions(const char *fmt)
+/*
+ * Count number of expected assigned conversions. Any conversion starts with '%'.
+ * The '%%' matches % and no assignment is done. The %*x matches as x would do but
+ * the assignment is suppressed.
+ *
+ * NOTE: This is not 100% correct for complex scanf strings, but will do for
+ * all of our intended usage.
+ */
+static int count_scanf_conversions(const char *fmt)
{
unsigned int cnt = 0;
int flag = 0;
@@ -76,33 +84,36 @@ int file_scanf(const char *file, const int lineno,
f = fopen(path, "r");
if (f == NULL) {
- tst_resm_(file, lineno, TWARN, "Failed to open FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to open FILE '%s' at %s:%d",
+ path, file, lineno);
return 1;
}
- exp_convs = tst_count_scanf_conversions(fmt);
+ exp_convs = count_scanf_conversions(fmt);
va_start(va, fmt);
ret = vfscanf(f, fmt, va);
va_end(va);
if (ret == EOF) {
- tst_resm_(file, lineno, TWARN,
- "The FILE '%s' ended prematurely", path);
+ tst_resm(TWARN,
+ "The FILE '%s' ended prematurely at %s:%d",
+ path, file, lineno);
goto err;
}
if (ret != exp_convs) {
- tst_resm_(file, lineno, TWARN,
- "Expected %i conversions got %i FILE '%s'",
- exp_convs, ret, path);
+ tst_resm(TWARN,
+ "Expected %i conversions got %i FILE '%s' at %s:%d",
+ exp_convs, ret, path, file, lineno);
goto err;
}
if (fclose(f)) {
- tst_resm_(file, lineno, TWARN, "Failed to close FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to close FILE '%s' at %s:%d",
+ path, file, lineno);
return 1;
}
@@ -110,10 +121,10 @@ int file_scanf(const char *file, const int lineno,
err:
if (fclose(f)) {
- tst_resm_(file, lineno, TWARN, "Failed to close FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to close FILE '%s' at %s:%d",
+ path, file, lineno);
}
-
return 1;
}
@@ -128,33 +139,36 @@ void safe_file_scanf(const char *file, const int lineno,
f = fopen(path, "r");
if (f == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to open FILE '%s' for reading", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to open FILE '%s' for reading at %s:%d",
+ path, file, lineno);
return;
}
- exp_convs = tst_count_scanf_conversions(fmt);
+ exp_convs = count_scanf_conversions(fmt);
va_start(va, fmt);
ret = vfscanf(f, fmt, va);
va_end(va);
if (ret == EOF) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "The FILE '%s' ended prematurely", path);
+ tst_brkm(TBROK, cleanup_fn,
+ "The FILE '%s' ended prematurely at %s:%d",
+ path, file, lineno);
return;
}
if (ret != exp_convs) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Expected %i conversions got %i FILE '%s'",
- exp_convs, ret, path);
+ tst_brkm(TBROK, cleanup_fn,
+ "Expected %i conversions got %i FILE '%s' at %s:%d",
+ exp_convs, ret, path, file, lineno);
return;
}
if (fclose(f)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to close FILE '%s'", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to close FILE '%s' at %s:%d",
+ path, file, lineno);
return;
}
}
@@ -176,18 +190,20 @@ int file_lines_scanf(const char *file, const int lineno,
va_list ap;
if (!fmt) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn, "pattern is NULL");
+ tst_brkm(TBROK, cleanup_fn, "pattern is NULL, %s:%d",
+ file, lineno);
return 1;
}
fp = fopen(path, "r");
if (fp == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to open FILE '%s' for reading", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to open FILE '%s' for reading at %s:%d",
+ path, file, lineno);
return 1;
}
- arg_count = tst_count_scanf_conversions(fmt);
+ arg_count = count_scanf_conversions(fmt);
while (fgets(line, BUFSIZ, fp) != NULL) {
va_start(ap, fmt);
@@ -200,9 +216,8 @@ int file_lines_scanf(const char *file, const int lineno,
fclose(fp);
if (strict && ret != arg_count) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Expected %i conversions got %i FILE '%s'",
- arg_count, ret, path);
+ tst_brkm(TBROK, cleanup_fn, "Expected %i conversions got %i"
+ " at %s:%d", arg_count, ret, file, lineno);
return 1;
}
@@ -218,24 +233,27 @@ int file_printf(const char *file, const int lineno,
f = fopen(path, "w");
if (f == NULL) {
- tst_resm_(file, lineno, TWARN, "Failed to open FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to open FILE '%s' at %s:%d",
+ path, file, lineno);
return 1;
}
va_start(va, fmt);
if (vfprintf(f, fmt, va) < 0) {
- tst_resm_(file, lineno, TWARN, "Failed to print to FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to print to FILE '%s' at %s:%d",
+ path, file, lineno);
goto err;
}
va_end(va);
if (fclose(f)) {
- tst_resm_(file, lineno, TWARN, "Failed to close FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to close FILE '%s' at %s:%d",
+ path, file, lineno);
return 1;
}
@@ -243,10 +261,10 @@ int file_printf(const char *file, const int lineno,
err:
if (fclose(f)) {
- tst_resm_(file, lineno, TWARN, "Failed to close FILE '%s'",
- path);
+ tst_resm(TWARN,
+ "Failed to close FILE '%s' at %s:%d",
+ path, file, lineno);
}
-
return 1;
}
@@ -260,30 +278,33 @@ void safe_file_printf(const char *file, const int lineno,
f = fopen(path, "w");
if (f == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to open FILE '%s' for writing", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to open FILE '%s' for writing at %s:%d",
+ path, file, lineno);
return;
}
va_start(va, fmt);
if (vfprintf(f, fmt, va) < 0) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Failed to print to FILE '%s'", path);
+ tst_brkm(TBROK, cleanup_fn,
+ "Failed to print to FILE '%s' at %s:%d",
+ path, file, lineno);
return;
}
va_end(va);
if (fclose(f)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to close FILE '%s'", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to close FILE '%s' at %s:%d",
+ path, file, lineno);
return;
}
}
//TODO: C implementation? better error condition reporting?
-int safe_cp(const char *file, const int lineno,
+void safe_cp(const char *file, const int lineno,
void (*cleanup_fn) (void), const char *src, const char *dst)
{
size_t len = strlen(src) + strlen(dst) + 16;
@@ -295,12 +316,10 @@ int safe_cp(const char *file, const int lineno,
ret = system(buf);
if (ret) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Failed to copy '%s' to '%s'", src, dst);
- return ret;
+ tst_brkm(TBROK, cleanup_fn,
+ "Failed to copy '%s' to '%s' at %s:%d",
+ src, dst, file, lineno);
}
-
- return 0;
}
#ifndef HAVE_UTIMENSAT
@@ -323,7 +342,7 @@ static void set_time(struct timeval *res, const struct timespec *src,
#endif
-int safe_touch(const char *file, const int lineno,
+void safe_touch(const char *file, const int lineno,
void (*cleanup_fn)(void),
const char *pathname,
mode_t mode, const struct timespec times[2])
@@ -334,41 +353,28 @@ int safe_touch(const char *file, const int lineno,
defmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
ret = open(pathname, O_CREAT | O_WRONLY, defmode);
-
if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to open file '%s'", pathname);
- return ret;
- } else if (ret < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid open(%s) return value %d", pathname, ret);
- return ret;
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to open file '%s' at %s:%d",
+ pathname, file, lineno);
+ return;
}
ret = close(ret);
-
if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to close file '%s'", pathname);
- return ret;
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid close('%s') return value %d", pathname, ret);
- return ret;
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to close file '%s' at %s:%d",
+ pathname, file, lineno);
+ return;
}
if (mode != 0) {
ret = chmod(pathname, mode);
-
if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to chmod file '%s'", pathname);
- return ret;
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid chmod('%s') return value %d",
- pathname, ret);
- return ret;
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to chmod file '%s' at %s:%d",
+ pathname, file, lineno);
+ return;
}
}
@@ -383,28 +389,19 @@ int safe_touch(const char *file, const int lineno,
struct timeval cotimes[2];
ret = stat(pathname, &sb);
-
if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to stat file '%s'", pathname);
- return ret;
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid stat('%s') return value %d",
- pathname, ret);
- return ret;
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to stat file '%s' at %s:%d",
+ pathname, file, lineno);
+ return;
}
ret = gettimeofday(cotimes, NULL);
-
if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to gettimeofday()");
- return ret;
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid gettimeofday() return value %d", ret);
- return ret;
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to gettimeofday() at %s:%d",
+ file, lineno);
+ return;
}
cotimes[1] = cotimes[0];
@@ -418,18 +415,8 @@ int safe_touch(const char *file, const int lineno,
}
#endif
if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to update the access/modification time on file '%s'",
- pathname);
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
-#ifdef HAVE_UTIMENSAT
- "Invalid utimensat('%s') return value %d",
-#else
- "Invalid utimes('%s') return value %d",
-#endif
- pathname, ret);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "Failed to update the access/modification time on file"
+ " '%s' at %s:%d", pathname, file, lineno);
}
-
- return ret;
}
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index a5b6bc504..41fa4ca83 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -1,8 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Linux Test Project, 2010-2020
- */
-
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/mman.h>
@@ -11,7 +6,6 @@
#include <sys/wait.h>
#include <sys/mount.h>
#include <sys/xattr.h>
-#include <sys/sysinfo.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
@@ -30,10 +24,10 @@ char *safe_basename(const char *file, const int lineno,
char *rval;
rval = basename(path);
-
if (rval == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "basename(%s) failed", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: basename(%s) failed",
+ file, lineno, path);
}
return rval;
@@ -46,13 +40,10 @@ safe_chdir(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = chdir(path);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "chdir(%s) failed", path);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid chdir(%s) return value %d", path, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: chdir(%s) failed",
+ file, lineno, path);
}
return rval;
@@ -65,13 +56,10 @@ safe_close(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = close(fildes);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "close(%d) failed", fildes);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid close(%d) return value %d", fildes, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: close(%d) failed",
+ file, lineno, fildes);
}
return rval;
@@ -84,14 +72,10 @@ safe_creat(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = creat(pathname, mode);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "creat(%s,%04o) failed", pathname, mode);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid creat(%s,%04o) return value %d", pathname,
- mode, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: creat(%s,0%o) failed",
+ file, lineno, pathname, mode);
}
return rval;
@@ -103,10 +87,10 @@ char *safe_dirname(const char *file, const int lineno,
char *rval;
rval = dirname(path);
-
if (rval == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "dirname(%s) failed", path);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: dirname(%s) failed",
+ file, lineno, path);
}
return rval;
@@ -118,10 +102,10 @@ char *safe_getcwd(const char *file, const int lineno, void (*cleanup_fn) (void),
char *rval;
rval = getcwd(buf, size);
-
if (rval == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "getcwd(%p,%zu) failed", buf, size);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getcwd(%p,%zu) failed",
+ file, lineno, buf, size);
}
return rval;
@@ -133,10 +117,10 @@ struct passwd *safe_getpwnam(const char *file, const int lineno,
struct passwd *rval;
rval = getpwnam(name);
-
if (rval == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "getpwnam(%s) failed", name);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getpwnam(%s) failed",
+ file, lineno, name);
}
return rval;
@@ -149,14 +133,10 @@ safe_getrusage(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = getrusage(who, usage);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "getrusage(%d,%p) failed", who, usage);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid getrusage(%d,%p) return value %d", who,
- usage, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getrusage(%d,%p) failed",
+ file, lineno, who, usage);
}
return rval;
@@ -168,10 +148,10 @@ void *safe_malloc(const char *file, const int lineno, void (*cleanup_fn) (void),
void *rval;
rval = malloc(size);
-
if (rval == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "malloc(%zu) failed", size);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: malloc(%zu) failed",
+ file, lineno, size);
}
return rval;
@@ -183,14 +163,10 @@ int safe_mkdir(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = mkdir(pathname, mode);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "mkdir(%s, %04o) failed", pathname, mode);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid mkdir(%s, %04o) return value %d", pathname,
- mode, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: mkdir(%s,0%o) failed",
+ file, lineno, pathname, mode);
}
return (rval);
@@ -202,13 +178,10 @@ int safe_rmdir(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = rmdir(pathname);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "rmdir(%s) failed", pathname);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid rmdir(%s) return value %d", pathname, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: rmdir(%s) failed",
+ file, lineno, pathname);
}
return (rval);
@@ -220,14 +193,10 @@ int safe_munmap(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = munmap(addr, length);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "munmap(%p,%zu) failed", addr, length);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid munmap(%p,%zu) return value %d", addr,
- length, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: munmap(%p,%zu) failed",
+ file, lineno, addr, length);
}
return rval;
@@ -250,14 +219,10 @@ int safe_open(const char *file, const int lineno, void (*cleanup_fn) (void),
va_end(ap);
rval = open(pathname, oflags, mode);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "open(%s,%d,%04o) failed", pathname, oflags, mode);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid open(%s,%d,%04o) return value %d", pathname,
- oflags, mode, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: open(%s,%d,0%o) failed",
+ file, lineno, pathname, oflags, mode);
}
return rval;
@@ -269,14 +234,10 @@ int safe_pipe(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = pipe(fildes);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "pipe({%d,%d}) failed", fildes[0], fildes[1]);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid pipe({%d,%d}) return value %d", fildes[0],
- fildes[1], rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: pipe({%d,%d}) failed",
+ file, lineno, fildes[0], fildes[1]);
}
return rval;
@@ -288,15 +249,10 @@ ssize_t safe_read(const char *file, const int lineno, void (*cleanup_fn) (void),
ssize_t rval;
rval = read(fildes, buf, nbyte);
-
if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "read(%d,%p,%zu) failed, returned %zd", fildes, buf,
- nbyte, rval);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid read(%d,%p,%zu) return value %zd", fildes,
- buf, nbyte, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: read(%d,%p,%zu) failed, returned %zd",
+ file, lineno, fildes, buf, nbyte, rval);
}
return rval;
@@ -308,14 +264,10 @@ int safe_setegid(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = setegid(egid);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "setegid(%u) failed", (unsigned int)egid);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid setegid(%u) return value %d",
- (unsigned int)egid, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: setegid(%u) failed",
+ file, lineno, (unsigned) egid);
}
return rval;
@@ -327,14 +279,10 @@ int safe_seteuid(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = seteuid(euid);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "seteuid(%u) failed", (unsigned int)euid);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid seteuid(%u) return value %d",
- (unsigned int)euid, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: seteuid(%u) failed",
+ file, lineno, (unsigned) euid);
}
return rval;
@@ -346,14 +294,10 @@ int safe_setgid(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = setgid(gid);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "setgid(%u) failed", (unsigned int)gid);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid setgid(%u) return value %d",
- (unsigned int)gid, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: setgid(%u) failed",
+ file, lineno, (unsigned) gid);
}
return rval;
@@ -365,14 +309,10 @@ int safe_setuid(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = setuid(uid);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "setuid(%u) failed", (unsigned int)uid);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid setuid(%u) return value %d",
- (unsigned int)uid, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: setuid(%u) failed",
+ file, lineno, (unsigned) uid);
}
return rval;
@@ -384,14 +324,10 @@ int safe_getresuid(const char *file, const int lineno, void (*cleanup_fn)(void),
int rval;
rval = getresuid(ruid, euid, suid);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "getresuid(%p, %p, %p) failed", ruid, euid, suid);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid getresuid(%p, %p, %p) return value %d", ruid,
- euid, suid, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getresuid(%p, %p, %p) failed",
+ file, lineno, ruid, euid, suid);
}
return rval;
@@ -403,14 +339,10 @@ int safe_getresgid(const char *file, const int lineno, void (*cleanup_fn)(void),
int rval;
rval = getresgid(rgid, egid, sgid);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "getresgid(%p, %p, %p) failed", rgid, egid, sgid);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid getresgid(%p, %p, %p) return value %d", rgid,
- egid, sgid, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getresgid(%p, %p, %p) failed",
+ file, lineno, rgid, egid, sgid);
}
return rval;
@@ -422,13 +354,10 @@ int safe_unlink(const char *file, const int lineno, void (*cleanup_fn) (void),
int rval;
rval = unlink(pathname);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "unlink(%s) failed", pathname);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid unlink(%s) return value %d", pathname, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: unlink(%s) failed",
+ file, lineno, pathname);
}
return rval;
@@ -444,12 +373,9 @@ int safe_link(const char *file, const int lineno,
rval = link(oldpath, newpath);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "link(%s,%s) failed", oldpath, newpath);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid link(%s,%s) return value %d", oldpath,
- newpath, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: link(%s,%s) failed",
+ file, lineno, oldpath, newpath);
}
return rval;
@@ -464,13 +390,10 @@ int safe_linkat(const char *file, const int lineno,
rval = linkat(olddirfd, oldpath, newdirfd, newpath, flags);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "linkat(%d,%s,%d,%s,%d) failed", olddirfd, oldpath,
- newdirfd, newpath, flags);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid linkat(%d,%s,%d,%s,%d) return value %d",
- olddirfd, oldpath, newdirfd, newpath, flags, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: linkat(%d,%s,%d,%s,%d) failed",
+ file, lineno, olddirfd, oldpath, newdirfd,
+ newpath, flags);
}
return rval;
@@ -485,12 +408,9 @@ ssize_t safe_readlink(const char *file, const int lineno,
rval = readlink(path, buf, bufsize);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "readlink(%s,%p,%zu) failed", path, buf, bufsize);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid readlink(%s,%p,%zu) return value %zd", path,
- buf, bufsize, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: readlink(%s,%p,%zu) failed",
+ file, lineno, path, buf, bufsize);
} else {
/* readlink does not append a NUL byte to the buffer.
* Add it now. */
@@ -512,12 +432,9 @@ int safe_symlink(const char *file, const int lineno,
rval = symlink(oldpath, newpath);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "symlink(%s,%s) failed", oldpath, newpath);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid symlink(%s,%s) return value %d", oldpath,
- newpath, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: symlink(%s,%s) failed",
+ file, lineno, oldpath, newpath);
}
return rval;
@@ -529,14 +446,10 @@ ssize_t safe_write(const char *file, const int lineno, void (cleanup_fn) (void),
ssize_t rval;
rval = write(fildes, buf, nbyte);
-
if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "write(%d,%p,%zu) failed", fildes, buf, nbyte);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid write(%d,%p,%zu) return value %zd", fildes,
- buf, nbyte, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: write(%d,%p,%zu) failed",
+ file, lineno, fildes, buf, rval);
}
return rval;
@@ -553,21 +466,21 @@ long safe_strtol(const char *file, const int lineno,
if ((errno == ERANGE && (rval == LONG_MAX || rval == LONG_MIN))
|| (errno != 0 && rval == 0)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "strtol(%s) failed", str);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: strtol(%s) failed", file, lineno, str);
return rval;
}
if (endptr == str || (*endptr != '\0' && *endptr != '\n')) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "strtol(%s): Invalid value", str);
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: strtol(%s): Invalid value", file, lineno, str);
return 0;
}
if (rval > max || rval < min) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "strtol(%s): %ld is out of range %ld - %ld",
- str, rval, min, max);
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: strtol(%s): %ld is out of range %ld - %ld",
+ file, lineno, str, rval, min, max);
return 0;
}
@@ -586,21 +499,21 @@ unsigned long safe_strtoul(const char *file, const int lineno,
if ((errno == ERANGE && rval == ULONG_MAX)
|| (errno != 0 && rval == 0)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "strtoul(%s) failed", str);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: strtoul(%s) failed", file, lineno, str);
return rval;
}
if (rval > max || rval < min) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "strtoul(%s): %lu is out of range %lu - %lu",
- str, rval, min, max);
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: strtoul(%s): %lu is out of range %lu - %lu",
+ file, lineno, str, rval, min, max);
return 0;
}
if (endptr == str || (*endptr != '\0' && *endptr != '\n')) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Invalid value: '%s'", str);
+ tst_brkm(TBROK, cleanup_fn,
+ "Invalid value: '%s' at %s:%d", str, file, lineno);
return 0;
}
@@ -611,18 +524,20 @@ long safe_sysconf(const char *file, const int lineno,
void (cleanup_fn) (void), int name)
{
long rval;
-
errno = 0;
+
rval = sysconf(name);
if (rval == -1) {
if (errno) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "sysconf(%d) failed", name);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: sysconf(%d) failed",
+ file, lineno, name);
} else {
- tst_resm_(file, lineno, TINFO,
- "sysconf(%d): queried option is not available or there is no definite limit",
- name);
+ tst_resm(TINFO, "%s:%d: sysconf(%d): "
+ "queried option is not available"
+ " or there is no definite limit",
+ file, lineno, name);
}
}
@@ -637,12 +552,9 @@ int safe_chmod(const char *file, const int lineno,
rval = chmod(path, mode);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "chmod(%s,%04o) failed", path, mode);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid chmod(%s,%04o) return value %d", path, mode,
- rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: chmod(%s,0%o) failed",
+ file, lineno, path, mode);
}
return rval;
@@ -656,12 +568,9 @@ int safe_fchmod(const char *file, const int lineno,
rval = fchmod(fd, mode);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "fchmod(%d,%04o) failed", fd, mode);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid fchmod(%d,%04o) return value %d", fd, mode,
- rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: fchmod(%d,0%o) failed",
+ file, lineno, fd, mode);
}
return rval;
@@ -675,12 +584,9 @@ int safe_chown(const char *file, const int lineno, void (cleanup_fn)(void),
rval = chown(path, owner, group);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "chown(%s,%d,%d) failed", path, owner, group);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid chown(%s,%d,%d) return value %d", path,
- owner, group, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: chown(%s,%d,%d) failed",
+ file, lineno, path, owner, group);
}
return rval;
@@ -694,12 +600,9 @@ int safe_fchown(const char *file, const int lineno, void (cleanup_fn)(void),
rval = fchown(fd, owner, group);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "fchown(%d,%d,%d) failed", fd, owner, group);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid fchown(%d,%d,%d) return value %d", fd,
- owner, group, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: fchown(%d,%d,%d) failed",
+ file, lineno, fd, owner, group);
}
return rval;
@@ -711,13 +614,10 @@ pid_t safe_wait(const char *file, const int lineno, void (cleanup_fn)(void),
pid_t rval;
rval = wait(status);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "wait(%p) failed", status);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid wait(%p) return value %d", status, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: wait(%p) failed",
+ file, lineno, status);
}
return rval;
@@ -729,14 +629,10 @@ pid_t safe_waitpid(const char *file, const int lineno, void (cleanup_fn)(void),
pid_t rval;
rval = waitpid(pid, status, opts);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "waitpid(%d,%p,%d) failed", pid, status, opts);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid waitpid(%d,%p,%d) return value %d", pid,
- status, opts, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: waitpid(%d,%p,%d) failed",
+ file, lineno, pid, status, opts);
}
return rval;
@@ -748,11 +644,9 @@ void *safe_memalign(const char *file, const int lineno,
void *rval;
rval = memalign(alignment, size);
-
- if (rval == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "memalign() failed");
- }
+ if (rval == NULL)
+ tst_brkm(TBROK | TERRNO, cleanup_fn, "memalign failed at %s:%d",
+ file, lineno);
return rval;
}
@@ -765,12 +659,9 @@ int safe_kill(const char *file, const int lineno, void (cleanup_fn)(void),
rval = kill(pid, sig);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "kill(%d,%s) failed", pid, tst_strsig(sig));
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid kill(%d,%s) return value %d", pid,
- tst_strsig(sig), rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: kill(%d,%s) failed",
+ file, lineno, pid, tst_strsig(sig));
}
return rval;
@@ -784,12 +675,9 @@ int safe_mkfifo(const char *file, const int lineno,
rval = mkfifo(pathname, mode);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "mkfifo(%s, %04o) failed", pathname, mode);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid mkfifo(%s, %04o) return value %d", pathname,
- mode, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: mkfifo(%s, 0%o) failed",
+ file, lineno, pathname, mode);
}
return rval;
@@ -803,12 +691,9 @@ int safe_rename(const char *file, const int lineno, void (*cleanup_fn)(void),
rval = rename(oldpath, newpath);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "rename(%s, %s) failed", oldpath, newpath);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid rename(%s, %s) return value %d", oldpath,
- newpath, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: rename(%s, %s) failed",
+ file, lineno, oldpath, newpath);
}
return rval;
@@ -839,7 +724,7 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
const char *filesystemtype, unsigned long mountflags,
const void *data)
{
- int rval = -1;
+ int rval;
/*
* Don't try using the kernel's NTFS driver when mounting NTFS, since
@@ -861,29 +746,25 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
if (possibly_fuse(filesystemtype)) {
char buf[1024];
- tst_resm_(file, lineno, TINFO, "Trying FUSE...");
+ tst_resm(TINFO, "Trying FUSE...");
snprintf(buf, sizeof(buf), "mount.%s '%s' '%s'",
- filesystemtype, source, target);
+ filesystemtype, source, target);
rval = tst_system(buf);
if (WIFEXITED(rval) && WEXITSTATUS(rval) == 0)
return 0;
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "mount.%s failed with %i", filesystemtype, rval);
+ tst_brkm(TBROK, cleanup_fn, "mount.%s failed with %i",
+ filesystemtype, rval);
return -1;
- } else if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "mount(%s, %s, %s, %lu, %p) failed", source, target,
- filesystemtype, mountflags, data);
} else {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid mount(%s, %s, %s, %lu, %p) return value %d",
- source, target, filesystemtype, mountflags, data,
- rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: mount(%s, %s, %s, %lu, %p) failed",
+ file, lineno, source, target, filesystemtype,
+ mountflags, data);
}
- return rval;
+ return -1;
}
int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void),
@@ -891,14 +772,12 @@ int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void),
{
int rval;
- rval = tst_umount(target);
+ rval = umount(target);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "umount(%s) failed", target);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid umount(%s) return value %d", target, rval);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: umount(%s) failed",
+ file, lineno, target);
}
return rval;
@@ -912,8 +791,8 @@ DIR* safe_opendir(const char *file, const int lineno, void (cleanup_fn)(void),
rval = opendir(name);
if (!rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "opendir(%s) failed", name);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: opendir(%s) failed", file, lineno, name);
}
return rval;
@@ -926,12 +805,9 @@ int safe_closedir(const char *file, const int lineno, void (cleanup_fn)(void),
rval = closedir(dirp);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "closedir(%p) failed", dirp);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid closedir(%p) return value %d", dirp, rval);
+ if (rval) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: closedir(%p) failed", file, lineno, dirp);
}
return rval;
@@ -947,8 +823,8 @@ struct dirent *safe_readdir(const char *file, const int lineno, void (cleanup_fn
rval = readdir(dirp);
if (!rval && errno) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "readdir(%p) failed", dirp);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: readdir(%p) failed", file, lineno, dirp);
}
errno = err;
@@ -961,14 +837,10 @@ int safe_getpriority(const char *file, const int lineno, int which, id_t who)
errno = 0;
rval = getpriority(which, who);
-
- if (rval == -1 && errno) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "getpriority(%i, %i) failed", which, who);
- } else if (errno) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "getpriority(%i, %i) failed with return value %d",
- which, who, rval);
+ if (errno) {
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d getpriority(%i, %i) failed",
+ file, lineno, which, who);
}
errno = err;
@@ -984,18 +856,14 @@ ssize_t safe_getxattr(const char *file, const int lineno, const char *path,
if (rval == -1) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "getxattr(%s, %s, %p, %zu) failed",
- path, name, value, size);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid getxattr(%s, %s, %p, %zu) return value %zd",
- path, name, value, size, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: getxattr(%s, %s, %p, %zu) failed",
+ file, lineno, path, name, value, size);
}
return rval;
@@ -1008,20 +876,16 @@ int safe_setxattr(const char *file, const int lineno, const char *path,
rval = setxattr(path, name, value, size, flags);
- if (rval == -1) {
+ if (rval) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "setxattr(%s, %s, %p, %zu) failed",
- path, name, value, size);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid setxattr(%s, %s, %p, %zu) return value %d",
- path, name, value, size, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: setxattr(%s, %s, %p, %zu) failed",
+ file, lineno, path, name, value, size);
}
return rval;
@@ -1034,20 +898,16 @@ int safe_lsetxattr(const char *file, const int lineno, const char *path,
rval = lsetxattr(path, name, value, size, flags);
- if (rval == -1) {
+ if (rval) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "lsetxattr(%s, %s, %p, %zu, %i) failed",
- path, name, value, size, flags);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid lsetxattr(%s, %s, %p, %zu, %i) return value %d",
- path, name, value, size, flags, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: lsetxattr(%s, %s, %p, %zu, %i) failed",
+ file, lineno, path, name, value, size, flags);
}
return rval;
@@ -1060,20 +920,16 @@ int safe_fsetxattr(const char *file, const int lineno, int fd, const char *name,
rval = fsetxattr(fd, name, value, size, flags);
- if (rval == -1) {
+ if (rval) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "fsetxattr(%i, %s, %p, %zu, %i) failed",
- fd, name, value, size, flags);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid fsetxattr(%i, %s, %p, %zu, %i) return value %d",
- fd, name, value, size, flags, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: fsetxattr(%i, %s, %p, %zu, %i) failed",
+ file, lineno, fd, name, value, size, flags);
}
return rval;
@@ -1086,19 +942,16 @@ int safe_removexattr(const char *file, const int lineno, const char *path,
rval = removexattr(path, name);
- if (rval == -1) {
+ if (rval) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "removexattr(%s, %s) failed", path, name);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid removexattr(%s, %s) return value %d", path,
- name, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: removexattr(%s, %s) failed",
+ file, lineno, path, name);
}
return rval;
@@ -1111,19 +964,16 @@ int safe_lremovexattr(const char *file, const int lineno, const char *path,
rval = lremovexattr(path, name);
- if (rval == -1) {
+ if (rval) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "lremovexattr(%s, %s) failed", path, name);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid lremovexattr(%s, %s) return value %d", path,
- name, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: lremovexattr(%s, %s) failed",
+ file, lineno, path, name);
}
return rval;
@@ -1136,19 +986,16 @@ int safe_fremovexattr(const char *file, const int lineno, int fd,
rval = fremovexattr(fd, name);
- if (rval == -1) {
+ if (rval) {
if (errno == ENOTSUP) {
- tst_brkm_(file, lineno, TCONF, NULL,
- "no xattr support in fs or mounted without user_xattr option");
- return rval;
+ tst_brkm(TCONF, NULL,
+ "%s:%d: no xattr support in fs or mounted "
+ "without user_xattr option", file, lineno);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "fremovexattr(%i, %s) failed", fd, name);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid fremovexattr(%i, %s) return value %d", fd,
- name, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: fremovexattr(%i, %s) failed",
+ file, lineno, fd, name);
}
return rval;
@@ -1160,12 +1007,9 @@ int safe_fsync(const char *file, const int lineno, int fd)
rval = fsync(fd);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "fsync(%i) failed", fd);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid fsync(%i) return value %d", fd, rval);
+ if (rval) {
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: fsync(%i) failed", file, lineno, fd);
}
return rval;
@@ -1176,10 +1020,9 @@ pid_t safe_setsid(const char *file, const int lineno)
pid_t rval;
rval = setsid();
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "setsid() failed");
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: setsid() failed", file, lineno);
}
return rval;
@@ -1191,13 +1034,9 @@ int safe_mknod(const char *file, const int lineno, const char *pathname,
int rval;
rval = mknod(pathname, mode, dev);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "mknod() failed");
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid mknod() return value %d", rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: mknod() failed", file, lineno);
}
return rval;
@@ -1209,13 +1048,9 @@ int safe_mlock(const char *file, const int lineno, const void *addr,
int rval;
rval = mlock(addr, len);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "mlock() failed");
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid mlock() return value %d", rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: mlock() failed", file, lineno);
}
return rval;
@@ -1227,13 +1062,9 @@ int safe_munlock(const char *file, const int lineno, const void *addr,
int rval;
rval = munlock(addr, len);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "munlock() failed");
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid munlock() return value %d", rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: munlock() failed", file, lineno);
}
return rval;
@@ -1245,32 +1076,10 @@ int safe_mincore(const char *file, const int lineno, void *start,
int rval;
rval = mincore(start, length, vec);
-
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "mincore() failed");
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid mincore() return value %d", rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: mincore() failed", file, lineno);
}
return rval;
}
-
-int safe_sysinfo(const char *file, const int lineno, struct sysinfo *info)
-{
- int ret;
-
- errno = 0;
- ret = sysinfo(info);
-
- if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "sysinfo() failed");
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid sysinfo() return value %d", ret);
- }
-
- return ret;
-}
diff --git a/lib/safe_net.c b/lib/safe_net.c
index 211fd9b67..499368007 100644
--- a/lib/safe_net.c
+++ b/lib/safe_net.c
@@ -18,7 +18,6 @@
#include <errno.h>
#include "test.h"
-#include "safe_macros_fn.h"
#include "safe_net_fn.h"
char *tst_sock_addr(const struct sockaddr *sa, socklen_t salen, char *res,
@@ -112,7 +111,7 @@ int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void),
rval = socket(domain, type, protocol);
- if (rval == -1) {
+ if (rval < 0) {
switch (errno) {
case EPROTONOSUPPORT:
case ESOCKTNOSUPPORT:
@@ -125,12 +124,9 @@ int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void),
ttype = TBROK;
}
- tst_brkm_(file, lineno, ttype | TERRNO, cleanup_fn,
- "socket(%d, %d, %d) failed", domain, type, protocol);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid socket(%d, %d, %d) return value %d", domain,
- type, protocol, rval);
+ tst_brkm(ttype | TERRNO, cleanup_fn,
+ "%s:%d: socket(%d, %d, %d) failed", file, lineno,
+ domain, type, protocol);
}
return rval;
@@ -143,7 +139,7 @@ int safe_socketpair(const char *file, const int lineno, int domain, int type,
rval = socketpair(domain, type, protocol, sv);
- if (rval == -1) {
+ if (rval < 0) {
switch (errno) {
case EPROTONOSUPPORT:
case EOPNOTSUPP:
@@ -154,13 +150,9 @@ int safe_socketpair(const char *file, const int lineno, int domain, int type,
ttype = TBROK;
}
- tst_brkm_(file, lineno, ttype | TERRNO, NULL,
- "socketpair(%d, %d, %d, %p) failed", domain, type,
- protocol, sv);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid socketpair(%d, %d, %d, %p) return value %d",
- domain, type, protocol, sv, rval);
+ tst_brkm(ttype | TERRNO, NULL,
+ "%s:%d: socketpair(%d, %d, %d, %p) failed",
+ file, lineno, domain, type, protocol, sv);
}
return rval;
@@ -171,15 +163,12 @@ int safe_getsockopt(const char *file, const int lineno, int sockfd, int level,
{
int rval = getsockopt(sockfd, level, optname, optval, optlen);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "getsockopt(%d, %d, %d, %p, %p) failed",
- sockfd, level, optname, optval, optlen);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid getsockopt(%d, %d, %d, %p, %p) return value %d",
- sockfd, level, optname, optval, optlen, rval);
- }
+ if (!rval)
+ return 0;
+
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: getsockopt(%d, %d, %d, %p, %p) failed",
+ file, lineno, sockfd, level, optname, optval, optlen);
return rval;
}
@@ -191,14 +180,10 @@ int safe_setsockopt(const char *file, const int lineno, int sockfd, int level,
rval = setsockopt(sockfd, level, optname, optval, optlen);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "setsockopt(%d, %d, %d, %p, %d) failed",
- sockfd, level, optname, optval, optlen);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid setsockopt(%d, %d, %d, %p, %d) return value %d",
- sockfd, level, optname, optval, optlen, rval);
+ if (rval) {
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: setsockopt(%d, %d, %d, %p, %d) failed",
+ file, lineno, sockfd, level, optname, optval, optlen);
}
return rval;
@@ -212,13 +197,9 @@ ssize_t safe_send(const char *file, const int lineno, char len_strict,
rval = send(sockfd, buf, len, flags);
if (rval == -1 || (len_strict && (size_t)rval != len)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "send(%d, %p, %zu, %d) failed", sockfd, buf, len,
- flags);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid send(%d, %p, %zu, %d) return value %zd",
- sockfd, buf, len, flags, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: send(%d, %p, %zu, %d) failed",
+ file, lineno, sockfd, buf, len, flags);
}
return rval;
@@ -234,17 +215,11 @@ ssize_t safe_sendto(const char *file, const int lineno, char len_strict,
rval = sendto(sockfd, buf, len, flags, dest_addr, addrlen);
if (rval == -1 || (len_strict && (size_t)rval != len)) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "sendto(%d, %p, %zu, %d, %s, %d) failed",
- sockfd, buf, len, flags,
- tst_sock_addr(dest_addr, addrlen, res, sizeof(res)),
- addrlen);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid sendto(%d, %p, %zu, %d, %s, %d) return value %zd",
- sockfd, buf, len, flags,
- tst_sock_addr(dest_addr, addrlen, res, sizeof(res)),
- addrlen, rval);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: sendto(%d, %p, %zu, %d, %s, %d) failed",
+ file, lineno, sockfd, buf, len, flags,
+ tst_sock_addr(dest_addr, addrlen, res, sizeof(res)),
+ addrlen);
}
return rval;
@@ -258,44 +233,18 @@ ssize_t safe_sendmsg(const char *file, const int lineno, size_t len,
rval = sendmsg(sockfd, msg, flags);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "sendmsg(%d, %p, %d) failed", sockfd, msg, flags);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid sendmsg(%d, %p, %d) return value %zd",
- sockfd, msg, flags, rval);
- } else if (len && (size_t)rval != len) {
- tst_brkm_(file, lineno, TBROK, NULL,
- "sendmsg(%d, %p, %d) ret(%zd) != len(%zu)",
- sockfd, msg, flags, rval, len);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: sendmsg(%d, %p, %d) failed",
+ file, lineno, sockfd, msg, flags);
}
- return rval;
-}
-
-ssize_t safe_recv(const char *file, const int lineno, size_t len,
- int sockfd, void *buf, size_t size, int flags)
-{
- ssize_t rval;
-
- rval = recv(sockfd, buf, size, flags);
-
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "recv(%d, %p, %zu, %d) failed", sockfd, buf, size,
- flags);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid recv(%d, %p, %zu, %d) return value %zd",
- sockfd, buf, size, flags, rval);
- } else if (len && (size_t)rval != len) {
- tst_brkm_(file, lineno, TBROK, NULL,
- "recv(%d, %p, %zu, %d) ret(%zd) != len(%zu)",
- sockfd, buf, size, flags, rval, len);
+ if (len && (size_t)rval != len) {
+ tst_brkm(TBROK, NULL,
+ "%s:%d: sendmsg(%d, %p, %d) ret(%zd) != len(%zu)",
+ file, lineno, sockfd, msg, flags, rval, len);
}
return rval;
-
}
ssize_t safe_recvmsg(const char *file, const int lineno, size_t len,
@@ -306,16 +255,15 @@ ssize_t safe_recvmsg(const char *file, const int lineno, size_t len,
rval = recvmsg(sockfd, msg, flags);
if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "recvmsg(%d, %p, %d) failed", sockfd, msg, flags);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid recvmsg(%d, %p, %d) return value %zd",
- sockfd, msg, flags, rval);
- } else if (len && (size_t)rval != len) {
- tst_brkm_(file, lineno, TBROK, NULL,
- "recvmsg(%d, %p, %d) ret(%zd) != len(%zu)",
- sockfd, msg, flags, rval, len);
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: recvmsg(%d, %p, %d) failed",
+ file, lineno, sockfd, msg, flags);
+ }
+
+ if (len && (size_t)rval != len) {
+ tst_brkm(TBROK, NULL,
+ "%s:%d: recvmsg(%d, %p, %d) ret(%zd) != len(%zu)",
+ file, lineno, sockfd, msg, flags, rval, len);
}
return rval;
@@ -326,41 +274,35 @@ int safe_bind(const char *file, const int lineno, void (cleanup_fn)(void),
int socket, const struct sockaddr *address,
socklen_t address_len)
{
- int i, ret;
+ int i;
char buf[128];
for (i = 0; i < 120; i++) {
- ret = bind(socket, address, address_len);
-
- if (!ret)
+ if (!bind(socket, address, address_len))
return 0;
- if (ret != -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid bind(%d, %s, %d) return value %d",
- socket, tst_sock_addr(address, address_len,
- buf, sizeof(buf)), address_len, ret);
- return ret;
- } else if (errno != EADDRINUSE) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "bind(%d, %s, %d) failed", socket,
- tst_sock_addr(address, address_len, buf,
- sizeof(buf)), address_len);
- return ret;
+ if (errno != EADDRINUSE) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: bind(%d, %s, %d) failed", file, lineno,
+ socket, tst_sock_addr(address, address_len,
+ buf, sizeof(buf)),
+ address_len);
+ return -1;
}
if ((i + 1) % 10 == 0) {
- tst_resm_(file, lineno, TINFO,
- "address is in use, waited %3i sec", i + 1);
+ tst_resm(TINFO, "address is in use, waited %3i sec",
+ i + 1);
}
sleep(1);
}
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Failed to bind(%d, %s, %d) after 120 retries", socket,
- tst_sock_addr(address, address_len, buf, sizeof(buf)),
- address_len);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: Failed to bind(%d, %s, %d) after 120 retries", file,
+ lineno, socket,
+ tst_sock_addr(address, address_len, buf, sizeof(buf)),
+ address_len);
return -1;
}
@@ -371,13 +313,10 @@ int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void),
rval = listen(socket, backlog);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "listen(%d, %d) failed", socket, backlog);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid listen(%d, %d) return value %d", socket,
- backlog, rval);
+ if (rval < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: listen(%d, %d) failed", file, lineno, socket,
+ backlog);
}
return rval;
@@ -390,13 +329,10 @@ int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void),
rval = accept(sockfd, addr, addrlen);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "accept(%d, %p, %d) failed", sockfd, addr, *addrlen);
- } else if (rval < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid accept(%d, %p, %d) return value %d", sockfd,
- addr, *addrlen, rval);
+ if (rval < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: accept(%d, %p, %d) failed", file, lineno,
+ sockfd, addr, *addrlen);
}
return rval;
@@ -410,16 +346,11 @@ int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void),
rval = connect(sockfd, addr, addrlen);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "connect(%d, %s, %d) failed", sockfd,
- tst_sock_addr(addr, addrlen, buf, sizeof(buf)),
- addrlen);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid connect(%d, %s, %d) return value %d", sockfd,
- tst_sock_addr(addr, addrlen, buf, sizeof(buf)),
- addrlen, rval);
+ if (rval < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: connect(%d, %s, %d) failed", file, lineno,
+ sockfd, tst_sock_addr(addr, addrlen, buf,
+ sizeof(buf)), addrlen);
}
return rval;
@@ -434,16 +365,11 @@ int safe_getsockname(const char *file, const int lineno,
rval = getsockname(sockfd, addr, addrlen);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "getsockname(%d, %s, %d) failed", sockfd,
- tst_sock_addr(addr, *addrlen, buf, sizeof(buf)),
- *addrlen);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid getsockname(%d, %s, %d) return value %d",
- sockfd, tst_sock_addr(addr, *addrlen, buf,
- sizeof(buf)), *addrlen, rval);
+ if (rval < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getsockname(%d, %s, %d) failed", file, lineno,
+ sockfd, tst_sock_addr(addr, *addrlen, buf,
+ sizeof(buf)), *addrlen);
}
return rval;
@@ -454,13 +380,10 @@ int safe_gethostname(const char *file, const int lineno,
{
int rval = gethostname(name, size);
- if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "gethostname(%p, %zu) failed", name, size);
- } else if (rval) {
- tst_brkm_(file, lineno, TBROK | TERRNO, NULL,
- "Invalid gethostname(%p, %zu) return value %d", name,
- size, rval);
+ if (rval < 0) {
+ tst_brkm(TBROK | TERRNO, NULL,
+ "%s:%d: gethostname(%p, %zu) failed",
+ file, lineno, name, size);
}
return rval;
@@ -472,7 +395,7 @@ int safe_gethostname(const char *file, const int lineno,
unsigned short tst_get_unused_port(const char *file, const int lineno,
void (cleanup_fn)(void), unsigned short family, int type)
{
- int sock, ret;
+ int sock;
socklen_t slen;
struct sockaddr_storage _addr;
struct sockaddr *addr = (struct sockaddr *)&_addr;
@@ -495,31 +418,35 @@ unsigned short tst_get_unused_port(const char *file, const int lineno,
break;
default:
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "%s(): Unsupported socket family %d", __func__,
- family);
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: unknown family", file, lineno);
return -1;
}
- sock = safe_socket(file, lineno, cleanup_fn, addr->sa_family, type, 0);
-
- if (sock < 0)
- return sock;
-
- ret = safe_bind(file, lineno, cleanup_fn, sock, addr, slen);
-
- if (ret)
- return ret;
-
- ret = safe_getsockname(file, lineno, cleanup_fn, sock, addr, &slen);
+ sock = socket(addr->sa_family, type, 0);
+ if (sock < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: socket failed", file, lineno);
+ return -1;
+ }
- if (ret)
- return ret;
+ if (bind(sock, addr, slen) < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: bind failed", file, lineno);
+ return -1;
+ }
- ret = safe_close(file, lineno, cleanup_fn, sock);
+ if (getsockname(sock, addr, &slen) == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: getsockname failed", file, lineno);
+ return -1;
+ }
- if (ret)
- return ret;
+ if (close(sock) == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: close failed", file, lineno);
+ return -1;
+ }
switch (family) {
case AF_INET:
diff --git a/lib/safe_stdio.c b/lib/safe_stdio.c
index ab23e43bb..966a039a5 100644
--- a/lib/safe_stdio.c
+++ b/lib/safe_stdio.c
@@ -29,8 +29,9 @@ FILE *safe_fopen(const char *file, const int lineno, void (cleanup_fn)(void),
FILE *f = fopen(path, mode);
if (f == NULL) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "fopen(%s,%s) failed", path, mode);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: fopen(%s,%s) failed",
+ file, lineno, path, mode);
}
return f;
@@ -43,12 +44,9 @@ int safe_fclose(const char *file, const int lineno, void (cleanup_fn)(void),
ret = fclose(f);
- if (ret == EOF) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "fclose(%p) failed", f);
- } else if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid fclose(%p) return value %d", f, ret);
+ if (ret) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: fclose(%p) failed", file, lineno, f);
}
return ret;
@@ -64,12 +62,9 @@ int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void),
ret = vasprintf(strp, fmt, va);
va_end(va);
- if (ret == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "asprintf(%s,...) failed", fmt);
- } else if (ret < 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "Invalid asprintf(%s,...) return value %d", fmt, ret);
+ if (ret < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: asprintf(%s,...) failed", file, lineno, fmt);
}
return ret;
@@ -86,12 +81,13 @@ FILE *safe_popen(const char *file, const int lineno, void (cleanup_fn)(void),
if (stream == NULL) {
if (errno != 0) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "popen(%s,%s) failed", command, type);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: popen(%s,%s) failed",
+ file, lineno, command, type);
} else {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "popen(%s,%s) failed: Out of memory",
- command, type);
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: popen(%s,%s) failed: Out of memory",
+ file, lineno, command, type);
}
}
diff --git a/lib/tst_af_alg.c b/lib/tst_af_alg.c
index d3895a83d..97be548b4 100644
--- a/lib/tst_af_alg.c
+++ b/lib/tst_af_alg.c
@@ -146,67 +146,3 @@ int tst_alg_setup_reqfd(const char *algtype, const char *algname,
close(algfd);
return reqfd;
}
-
-void tst_alg_sendmsg(int reqfd, const void *data, size_t datalen,
- const struct tst_alg_sendmsg_params *params)
-{
- struct iovec iov = {
- .iov_base = (void *)data,
- .iov_len = datalen,
- };
- struct msghdr msg = {
- .msg_iov = &iov,
- .msg_iovlen = 1,
- .msg_flags = params->msg_flags,
- };
- size_t controllen;
- uint8_t *control;
- struct cmsghdr *cmsg;
- struct af_alg_iv *alg_iv;
-
- if (params->encrypt && params->decrypt)
- tst_brk(TBROK, "Both encrypt and decrypt are specified");
-
- controllen = 0;
- if (params->encrypt || params->decrypt)
- controllen += CMSG_SPACE(sizeof(uint32_t));
- if (params->ivlen)
- controllen += CMSG_SPACE(sizeof(struct af_alg_iv) +
- params->ivlen);
- if (params->assoclen)
- controllen += CMSG_SPACE(sizeof(uint32_t));
-
- control = SAFE_MALLOC(controllen);
- memset(control, 0, controllen);
- msg.msg_control = control;
- msg.msg_controllen = controllen;
- cmsg = CMSG_FIRSTHDR(&msg);
-
- if (params->encrypt || params->decrypt) {
- cmsg->cmsg_level = SOL_ALG;
- cmsg->cmsg_type = ALG_SET_OP;
- cmsg->cmsg_len = CMSG_LEN(sizeof(uint32_t));
- *(uint32_t *)CMSG_DATA(cmsg) =
- params->encrypt ? ALG_OP_ENCRYPT : ALG_OP_DECRYPT;
- cmsg = CMSG_NXTHDR(&msg, cmsg);
- }
- if (params->ivlen) {
- cmsg->cmsg_level = SOL_ALG;
- cmsg->cmsg_type = ALG_SET_IV;
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct af_alg_iv) +
- params->ivlen);
- alg_iv = (struct af_alg_iv *)CMSG_DATA(cmsg);
- alg_iv->ivlen = params->ivlen;
- memcpy(alg_iv->iv, params->iv, params->ivlen);
- cmsg = CMSG_NXTHDR(&msg, cmsg);
- }
- if (params->assoclen) {
- cmsg->cmsg_level = SOL_ALG;
- cmsg->cmsg_type = ALG_SET_AEAD_ASSOCLEN;
- cmsg->cmsg_len = CMSG_LEN(sizeof(uint32_t));
- *(uint32_t *)CMSG_DATA(cmsg) = params->assoclen;
- cmsg = CMSG_NXTHDR(&msg, cmsg);
- }
-
- SAFE_SENDMSG(datalen, reqfd, &msg, 0);
-}
diff --git a/lib/tst_assert.c b/lib/tst_assert.c
deleted file mode 100644
index 9b8ebc167..000000000
--- a/lib/tst_assert.c
+++ /dev/null
@@ -1,83 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-#include <stdio.h>
-#define TST_NO_DEFAULT_MAIN
-#include "tst_assert.h"
-#include "tst_test.h"
-
-void tst_assert_int(const char *file, const int lineno, const char *path, int val)
-{
- int sys_val;
-
- safe_file_scanf(file, lineno, NULL, path, "%d", &sys_val);
-
- if (val == sys_val) {
- tst_res_(file, lineno, TPASS, "%s = %d", path, val);
- return;
- }
-
- tst_res_(file, lineno, TFAIL, "%s != %d got %d", path, val, sys_val);
-}
-
-void tst_assert_ulong(const char *file, const int lineno, const char *path, unsigned long val)
-{
- unsigned long sys_val;
-
- safe_file_scanf(file, lineno, NULL, path, "%lu", &sys_val);
-
- if (val == sys_val) {
- tst_res_(file, lineno, TPASS, "%s = %lu", path, val);
- return;
- }
-
- tst_res_(file, lineno, TFAIL, "%s != %lu got %lu", path, val, sys_val);
-}
-
-void tst_assert_file_int(const char *file, const int lineno, const char *path, const char *prefix, int val)
-{
- int sys_val;
- char fmt[1024];
-
- snprintf(fmt, sizeof(fmt), "%s%%d", prefix);
- file_lines_scanf(file, lineno, NULL, 1, path, fmt, &sys_val);
-
- if (val == sys_val) {
- tst_res_(file, lineno, TPASS, "%s %s = %d", path, prefix, sys_val);
- return;
- }
-
- tst_res_(file, lineno, TFAIL, "%s %s != %d got %d", path, prefix, val, sys_val);
-}
-
-void tst_assert_str(const char *file, const int lineno, const char *path, const char *val)
-{
- char sys_val[1024];
-
- safe_file_scanf(file, lineno, NULL, path, "%1024s", sys_val);
- if (!strcmp(val, sys_val)) {
- tst_res_(file, lineno, TPASS, "%s = '%s'", path, val);
- return;
- }
-
- tst_res_(file, lineno, TFAIL, "%s != '%s' got '%s'", path, val, sys_val);
-}
-
-void tst_assert_file_str(const char *file, const int lineno, const char *path, const char *prefix, const char *val)
-{
- char sys_val[1024];
- char fmt[2048];
-
- snprintf(fmt, sizeof(fmt), "%s: %%1024s", prefix);
- file_lines_scanf(file, lineno, NULL, 1, path, fmt, sys_val);
-
- if (!strcmp(val, sys_val)) {
- tst_res_(file, lineno, TPASS, "%s %s = '%s'", path, prefix, sys_val);
- return;
- }
-
- tst_res_(file, lineno, TFAIL, "%s %s != '%s' got '%s'", path, prefix, val, sys_val);
-}
diff --git a/lib/tst_bool_expr.c b/lib/tst_bool_expr.c
deleted file mode 100644
index 387c38b91..000000000
--- a/lib/tst_bool_expr.c
+++ /dev/null
@@ -1,405 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-/*
- * Boolean expression is evaluated in three steps.
- *
- * First of all the string containing the expression is tokenized. The
- * tokenizer runs twice and we only count number of tokens in the first pass in
- * order to simplify the memory allocation.
- *
- * Secondly the the expression is transformed to a postfix (RPN) notation by
- * the shunting yard algorithm and the correctness of the expression is checked
- * during the transformation as well. The fact that parenthesis are matched is
- * asserted by the shunting yard algorithm itself while the rest is checked
- * simply by checking if the preceding token is in a set of allowed tokens.
- * This could be thought of as a simple open-coded state machine.
- *
- * An expression in the RPN form can be evaluated given a variable mapping
- * function. The evaluation ignores most of errors because invalid expression
- * will be rejected in the second step.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "tst_bool_expr.h"
-
-static int char_to_op(char c)
-{
- switch (c) {
- case '(':
- return TST_OP_LPAR;
- case ')':
- return TST_OP_RPAR;
- case '&':
- return TST_OP_AND;
- case '|':
- return TST_OP_OR;
- case '!':
- return TST_OP_NOT;
- default:
- return TST_OP_VAR;
- }
-}
-
-static int new_tok(struct tst_expr_tok **last, const char *tok, size_t tok_len)
-{
- if (!tok_len)
- return 0;
-
- if (!(*last))
- return 1;
-
- (*last)->tok = tok;
- (*last)->tok_len = tok_len;
- (*last)->op = char_to_op(tok[0]);
- (*last)++;
-
- return 1;
-}
-
-static unsigned int tokenize(const char *expr, struct tst_expr_tok *last)
-{
- size_t i, j;
- unsigned int token_cnt = 0;
-
- for (j = i = 0; expr[i]; i++) {
- switch (expr[i]) {
- case '(':
- case ')':
- case '!':
- case '&':
- case '|':
- token_cnt += new_tok(&last, &expr[j], i - j);
- token_cnt += new_tok(&last, &expr[i], 1);
- j = i+1;
- break;
- case '\t':
- case ' ':
- token_cnt += new_tok(&last, &expr[j], i - j);
- j = i+1;
- break;
- case '"':
- while (expr[i+1] != '"' && expr[i+1])
- i++;
-
- if (expr[i+1] == '"')
- i++;
- break;
- default:
- break;
- }
- }
-
- token_cnt += new_tok(&last, &expr[j], i - j);
-
- return token_cnt;
-}
-
-void tst_bool_expr_print(FILE *f, struct tst_expr *expr)
-{
- struct tst_expr_tok *i;
- size_t j;
-
- for (i = expr->rpn; i; i = i->next) {
- for (j = 0; j < i->tok_len; j++)
- putc(i->tok[j], f);
-
- if (i->next)
- putc(' ', f);
- }
-}
-
-static void print_spaces(FILE *f, unsigned int spaces)
-{
- while (spaces--)
- putc(' ', f);
-}
-
-static void tst_bool_expr_err(FILE *f, struct tst_expr *expr, unsigned int cnt)
-{
- unsigned int i, spaces, err_len;
- const char *err;
-
- fprintf(f, "%s", expr->buf->tok);
- fprintf(f, "\n");
-
- for (i = 0; i < cnt; i++) {
- if (expr->buf[i].priv)
- break;
- }
-
- spaces = expr->buf[i].tok - expr->buf[0].tok;
- err = expr->buf[i].priv;
- err_len = strlen(err);
-
- print_spaces(f, spaces);
-
- fprintf(f, "^\n");
-
- if (err_len < spaces)
- print_spaces(f, spaces - err_len + 1);
-
- fprintf(f, "%s\n", err);
-}
-
-static inline void stack_push(struct tst_expr_tok *stack[], unsigned int *op_stack_pos,
- struct tst_expr_tok *op)
-{
- stack[(*op_stack_pos)++] = op;
-}
-
-static inline int stack_empty(unsigned int op_stack_pos)
-{
- return op_stack_pos == 0;
-}
-
-static inline struct tst_expr_tok *stack_pop(struct tst_expr_tok *stack[],
- unsigned int *op_stack_pos)
-{
- if (stack_empty(*op_stack_pos))
- return NULL;
-
- return stack[--(*op_stack_pos)];
-}
-
-#define TST_OP_NONE -1
-
-static inline int stack_peek_op(struct tst_expr_tok *stack[],
- unsigned int op_stack_pos)
-{
- if (stack_empty(op_stack_pos))
- return TST_OP_NONE;
-
- return stack[op_stack_pos - 1]->op;
-}
-
-/*
- * This is a complete list of which tokens can happen before any of:
- * - variable
- * - left parentesis
- * - negation
- *
- * The -1 represents start of the expression.
- */
-static inline int check_one(int op)
-{
- switch (op) {
- case TST_OP_AND:
- case TST_OP_OR:
- case TST_OP_NOT:
- case TST_OP_NONE:
- case TST_OP_LPAR:
- return 0;
- default:
- return 1;
- }
-}
-
-/*
- * And this checks for tokens that can happen before any of:
- * - right parentesis
- * - and
- * - or
- *
- * This is also used to check that the last token in expression is correct one.
- */
-static inline int check_two(int op)
-{
- switch (op) {
- case TST_OP_VAR:
- case TST_OP_RPAR:
- return 1;
- default:
- return 0;
- }
-}
-
-static int shunting_yard(struct tst_expr *expr, unsigned int cnt)
-{
- struct tst_expr_tok *op_stack[cnt];
- unsigned int op_stack_pos = 0;
- struct tst_expr_tok *out[cnt + 1];
- unsigned int out_pos = 0;
- struct tst_expr_tok *i;
- unsigned int j;
- int prev_op = TST_OP_NONE;
-
- for (i = expr->buf; i < &(expr->buf[cnt]); i++) {
- switch (i->op) {
- case TST_OP_VAR:
- if (check_one(prev_op)) {
- i->priv = "Expected operation";
- goto err;
- }
-
- stack_push(out, &out_pos, i);
-
- while (stack_peek_op(op_stack, op_stack_pos) == TST_OP_NOT)
- stack_push(out, &out_pos, stack_pop(op_stack, &op_stack_pos));
- break;
- case TST_OP_LPAR:
- if (check_one(prev_op)) {
- i->priv = "Expected operation";
- goto err;
- }
-
- stack_push(op_stack, &op_stack_pos, i);
- break;
- case TST_OP_RPAR:
- if (!check_two(prev_op)) {
- i->priv = "Expected variable or )";
- goto err;
- }
-
- /* pop everything till ( */
- for (;;) {
- struct tst_expr_tok *op = stack_pop(op_stack, &op_stack_pos);
-
- if (!op) {
- i->priv = "Missing (";
- goto err;
- }
-
- if (op->op == TST_OP_LPAR)
- break;
-
- stack_push(out, &out_pos, op);
- }
-
- while (stack_peek_op(op_stack, op_stack_pos) == TST_OP_NOT)
- stack_push(out, &out_pos, stack_pop(op_stack, &op_stack_pos));
- break;
- case TST_OP_NOT:
- if (check_one(prev_op)) {
- i->priv = "Expected operation";
- goto err;
- }
- stack_push(op_stack, &op_stack_pos, i);
- break;
- case TST_OP_AND:
- case TST_OP_OR:
- if (!check_two(prev_op)) {
- i->priv = "Expected variable or (";
- goto err;
- }
-
- /*
- * There can be at most one binary op on the stack
- * since we pop the one present on the stack before we
- * attempt to push new one they so never accumulate.
- */
- switch (stack_peek_op(op_stack, op_stack_pos)) {
- case TST_OP_AND:
- case TST_OP_OR:
- stack_push(out, &out_pos, stack_pop(op_stack, &op_stack_pos));
- break;
- }
-
- stack_push(op_stack, &op_stack_pos, i);
- break;
- }
-
- prev_op = i->op;
- }
-
- if (!check_two(expr->buf[cnt-1].op)) {
- expr->buf[cnt-1].priv = "Unfinished expression";
- goto err;
- }
-
- /* pop remaining operations */
- while ((i = stack_pop(op_stack, &op_stack_pos))) {
- if (i->op == TST_OP_LPAR) {
- i->priv = "Missing )";
- goto err;
- }
-
- stack_push(out, &out_pos, i);
- }
-
- /* construct the list */
- out[out_pos] = NULL;
-
- for (j = 0; j < out_pos; j++)
- out[j]->next = out[j + 1];
-
- expr->rpn = out[0];
-
- return 0;
-err:
- return 1;
-}
-
-struct tst_expr *tst_bool_expr_parse(const char *expr)
-{
- struct tst_expr *ret;
- unsigned int tok_cnt = tokenize(expr, NULL);
-
- if (!tok_cnt)
- return NULL;
-
- ret = malloc(sizeof(struct tst_expr) + sizeof(struct tst_expr_tok) * tok_cnt);
- if (!ret)
- return NULL;
-
- tokenize(expr, ret->buf);
-
- if (shunting_yard(ret, tok_cnt)) {
- tst_bool_expr_err(stderr, ret, tok_cnt);
- tst_bool_expr_free(ret);
- return NULL;
- }
-
- return ret;
-}
-
-#define MAX_STACK 16
-
-int tst_bool_expr_eval(struct tst_expr *expr,
- int (*map)(struct tst_expr_tok *var))
-{
- struct tst_expr_tok *i;
- int stack[MAX_STACK];
- int pos = -1;
-
- for (i = expr->rpn; i; i = i->next) {
- switch (i->op) {
- case TST_OP_NOT:
- stack[pos] = !stack[pos];
- break;
- case TST_OP_OR:
- stack[pos-1] = stack[pos] || stack[pos-1];
- pos--;
- break;
- case TST_OP_AND:
- stack[pos-1] = stack[pos] && stack[pos-1];
- pos--;
- break;
- case TST_OP_VAR:
- if (pos + 1 >= MAX_STACK) {
- fprintf(stderr, "Eval out of stack!\n");
- return -1;
- }
-
- stack[++pos] = map(i);
-
- /* map reported undefined variable -> abort */
- if (stack[pos] == -1)
- return -1;
- break;
- /* does not happen */
- default:
- break;
- }
- }
-
- return stack[0];
-}
-
-void tst_bool_expr_free(struct tst_expr *expr)
-{
- free(expr);
-}
diff --git a/lib/tst_capability.c b/lib/tst_capability.c
index cb0502e2e..1fa0e49c5 100644
--- a/lib/tst_capability.c
+++ b/lib/tst_capability.c
@@ -57,7 +57,7 @@ void tst_cap_action(struct tst_cap *cap)
uint32_t mask = CAP_TO_MASK(cap->id);
if (tst_capget(&hdr, cur))
- tst_brk(TBROK | TERRNO, "tst_capget()");
+ tst_brk(TBROK | TTERRNO, "tst_capget()");
memcpy(new, cur, sizeof(new));
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
deleted file mode 100644
index 1e036d3c3..000000000
--- a/lib/tst_cgroup.c
+++ /dev/null
@@ -1,1124 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Red Hat, Inc.
- * Copyright (c) 2020 Li Wang <liwang@redhat.com>
- * Copyright (c) 2020-2021 SUSE LLC <rpalethorpe@suse.com>
- */
-
-#define TST_NO_DEFAULT_MAIN
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <mntent.h>
-#include <sys/mount.h>
-
-#include "tst_test.h"
-#include "lapi/fcntl.h"
-#include "lapi/mount.h"
-#include "lapi/mkdirat.h"
-#include "tst_safe_file_at.h"
-#include "tst_cgroup.h"
-
-struct cgroup_root;
-
-/* A node in a single CGroup hierarchy. It exists mainly for
- * convenience so that we do not have to traverse the CGroup structure
- * for frequent operations.
- *
- * This is actually a single-linked list not a tree. We only need to
- * traverse from leaf towards root.
- */
-struct cgroup_dir {
- const char *dir_name;
- const struct cgroup_dir *dir_parent;
-
- /* Shortcut to root */
- const struct cgroup_root *dir_root;
-
- /* Subsystems (controllers) bit field. Only controllers which
- * were required and configured for this node are added to
- * this field. So it may be different from root->css_field.
- */
- uint32_t ctrl_field;
-
- /* In general we avoid having sprintfs everywhere and use
- * openat, linkat, etc.
- */
- int dir_fd;
-
- int we_created_it:1;
-};
-
-/* The root of a CGroup hierarchy/tree */
-struct cgroup_root {
- enum tst_cgroup_ver ver;
- /* A mount path */
- char mnt_path[PATH_MAX];
- /* Subsystems (controllers) bit field. Includes all
- * controllers found while scanning this root.
- */
- uint32_t ctrl_field;
-
- /* CGroup hierarchy: mnt -> ltp -> {drain, test -> ??? } We
- * keep a flat reference to ltp, drain and test for
- * convenience.
- */
-
- /* Mount directory */
- struct cgroup_dir mnt_dir;
- /* LTP CGroup directory, contains drain and test dirs */
- struct cgroup_dir ltp_dir;
- /* Drain CGroup, see cgroup_cleanup */
- struct cgroup_dir drain_dir;
- /* CGroup for current test. Which may have children. */
- struct cgroup_dir test_dir;
-
- int we_mounted_it:1;
- /* cpuset is in compatability mode */
- int no_cpuset_prefix:1;
-};
-
-/* Controller sub-systems */
-enum cgroup_ctrl_indx {
- CTRL_MEMORY = 1,
- CTRL_CPUSET = 2,
-};
-#define CTRLS_MAX CTRL_CPUSET
-
-/* At most we can have one cgroup V1 tree for each controller and one
- * (empty) v2 tree.
- */
-#define ROOTS_MAX (CTRLS_MAX + 1)
-
-/* Describes a controller file or knob
- *
- * The primary purpose of this is to map V2 names to V1
- * names.
- */
-struct cgroup_file {
- /* Canonical name. Is the V2 name unless an item is V1 only */
- const char *const file_name;
- /* V1 name or NULL if item is V2 only */
- const char *const file_name_v1;
-
- /* The controller this item belongs to or zero for
- * 'cgroup.<item>'.
- */
- const enum cgroup_ctrl_indx ctrl_indx;
-};
-
-/* Describes a Controller or subsystem
- *
- * Internally the kernel seems to call controllers subsystems and uses
- * the abbreviations subsys and css.
- */
-struct cgroup_ctrl {
- /* Userland name of the controller (e.g. 'memory' not 'memcg') */
- const char *const ctrl_name;
- /* List of files belonging to this controller */
- const struct cgroup_file *const files;
- /* Our index for the controller */
- const enum cgroup_ctrl_indx ctrl_indx;
-
- /* Runtime; hierarchy the controller is attached to */
- struct cgroup_root *ctrl_root;
- /* Runtime; whether we required the controller */
- int we_require_it:1;
-};
-
-struct tst_cgroup_group {
- char group_name[NAME_MAX + 1];
- /* Maps controller ID to the tree which contains it. The V2
- * tree is at zero even if it contains no controllers.
- */
- struct cgroup_dir *dirs_by_ctrl[ROOTS_MAX];
- /* NULL terminated list of trees */
- struct cgroup_dir *dirs[ROOTS_MAX + 1];
-};
-
-/* Always use first item for unified hierarchy */
-static struct cgroup_root roots[ROOTS_MAX + 1];
-
-/* Lookup tree for item names. */
-typedef struct cgroup_file files_t[];
-
-static const files_t cgroup_ctrl_files = {
- /* procs exists on V1, however it was read-only until kernel v3.0. */
- { "cgroup.procs", "tasks", 0 },
- { "cgroup.subtree_control", NULL, 0 },
- { "cgroup.clone_children", "cgroup.clone_children", 0 },
- { }
-};
-
-static const files_t memory_ctrl_files = {
- { "memory.current", "memory.usage_in_bytes", CTRL_MEMORY },
- { "memory.max", "memory.limit_in_bytes", CTRL_MEMORY },
- { "memory.swappiness", "memory.swappiness", CTRL_MEMORY },
- { "memory.swap.current", "memory.memsw.usage_in_bytes", CTRL_MEMORY },
- { "memory.swap.max", "memory.memsw.limit_in_bytes", CTRL_MEMORY },
- { "memory.kmem.usage_in_bytes", "memory.kmem.usage_in_bytes", CTRL_MEMORY },
- { "memory.kmem.limit_in_bytes", "memory.kmem.limit_in_bytes", CTRL_MEMORY },
- { }
-};
-
-static const files_t cpuset_ctrl_files = {
- { "cpuset.cpus", "cpuset.cpus", CTRL_CPUSET },
- { "cpuset.mems", "cpuset.mems", CTRL_CPUSET },
- { "cpuset.memory_migrate", "cpuset.memory_migrate", CTRL_CPUSET },
- { }
-};
-
-static struct cgroup_ctrl controllers[] = {
- [0] = { "cgroup", cgroup_ctrl_files, 0, NULL, 0 },
- [CTRL_MEMORY] = {
- "memory", memory_ctrl_files, CTRL_MEMORY, NULL, 0
- },
- [CTRL_CPUSET] = {
- "cpuset", cpuset_ctrl_files, CTRL_CPUSET, NULL, 0
- },
- { }
-};
-
-static const struct tst_cgroup_opts default_opts = { 0 };
-
-/* We should probably allow these to be set in environment
- * variables */
-static const char *ltp_cgroup_dir = "ltp";
-static const char *ltp_cgroup_drain_dir = "drain";
-static char test_cgroup_dir[NAME_MAX + 1];
-static const char *ltp_mount_prefix = "/tmp/cgroup_";
-static const char *ltp_v2_mount = "unified";
-
-#define first_root \
- (roots[0].ver ? roots : roots + 1)
-#define for_each_root(r) \
- for ((r) = first_root; (r)->ver; (r)++)
-#define for_each_v1_root(r) \
- for ((r) = roots + 1; (r)->ver; (r)++)
-#define for_each_ctrl(ctrl) \
- for ((ctrl) = controllers + 1; (ctrl)->ctrl_name; (ctrl)++)
-
-/* In all cases except one, this only loops once.
- *
- * If (ctrl) == 0 and multiple V1 (and a V2) hierarchies are mounted,
- * then we need to loop over multiple directories. For example if we
- * need to write to "tasks"/"cgroup.procs" which exists for each
- * hierarchy.
- */
-#define for_each_dir(cg, ctrl, t) \
- for ((t) = (ctrl) ? (cg)->dirs_by_ctrl + (ctrl) : (cg)->dirs; \
- *(t); \
- (t) = (ctrl) ? (cg)->dirs + ROOTS_MAX : (t) + 1)
-
-__attribute__ ((nonnull))
-static int has_ctrl(const uint32_t ctrl_field,
- const struct cgroup_ctrl *const ctrl)
-{
- return !!(ctrl_field & (1 << ctrl->ctrl_indx));
-}
-
-__attribute__ ((nonnull))
-static void add_ctrl(uint32_t *const ctrl_field,
- const struct cgroup_ctrl *const ctrl)
-{
- *ctrl_field |= 1 << ctrl->ctrl_indx;
-}
-
-__attribute__ ((warn_unused_result))
-struct cgroup_root *tst_cgroup_root_get(void)
-{
- return roots[0].ver ? roots : roots + 1;
-}
-
-static int cgroup_v2_mounted(void)
-{
- return !!roots[0].ver;
-}
-
-static int cgroup_v1_mounted(void)
-{
- return !!roots[1].ver;
-}
-
-static int cgroup_mounted(void)
-{
- return cgroup_v2_mounted() || cgroup_v1_mounted();
-}
-
-__attribute__ ((nonnull, warn_unused_result))
-static int cgroup_ctrl_on_v2(const struct cgroup_ctrl *const ctrl)
-{
- return ctrl->ctrl_root && ctrl->ctrl_root->ver == TST_CGROUP_V2;
-}
-
-__attribute__ ((nonnull))
-static void cgroup_dir_mk(const struct cgroup_dir *const parent,
- const char *const dir_name,
- struct cgroup_dir *const new)
-{
- const char *dpath;
-
- new->dir_root = parent->dir_root;
- new->dir_name = dir_name;
- new->dir_parent = parent;
- new->ctrl_field = parent->ctrl_field;
- new->we_created_it = 0;
-
- if (!mkdirat(parent->dir_fd, dir_name, 0777)) {
- new->we_created_it = 1;
- goto opendir;
- }
-
- if (errno == EEXIST)
- goto opendir;
-
- dpath = tst_decode_fd(parent->dir_fd);
-
- if (errno == EACCES) {
- tst_brk(TCONF | TERRNO,
- "Lack permission to make '%s/%s'; premake it or run as root",
- dpath, dir_name);
- } else {
- tst_brk(TBROK | TERRNO,
- "mkdirat(%d<%s>, '%s', 0777)",
- parent->dir_fd, dpath, dir_name);
- }
-
-opendir:
- new->dir_fd = SAFE_OPENAT(parent->dir_fd, dir_name,
- O_PATH | O_DIRECTORY);
-}
-
-void tst_cgroup_print_config(void)
-{
- struct cgroup_root *root;
- const struct cgroup_ctrl *ctrl;
-
- tst_res(TINFO, "Detected Controllers:");
-
- for_each_ctrl(ctrl) {
- root = ctrl->ctrl_root;
-
- if (!root)
- continue;
-
- tst_res(TINFO, "\t%.10s %s @ %s:%s",
- ctrl->ctrl_name,
- root->no_cpuset_prefix ? "[noprefix]" : "",
- root->ver == TST_CGROUP_V1 ? "V1" : "V2",
- root->mnt_path);
- }
-}
-
-__attribute__ ((nonnull, warn_unused_result))
-static struct cgroup_ctrl *cgroup_find_ctrl(const char *const ctrl_name)
-{
- struct cgroup_ctrl *ctrl = controllers;
-
- while (ctrl->ctrl_name && strcmp(ctrl_name, ctrl->ctrl_name))
- ctrl++;
-
- if (!ctrl->ctrl_name)
- ctrl = NULL;
-
- return ctrl;
-}
-
-/* Determine if a mounted cgroup hierarchy is unique and record it if so.
- *
- * For CGroups V2 this is very simple as there is only one
- * hierarchy. We just record which controllers are available and check
- * if this matches what we read from any previous mount points.
- *
- * For V1 the set of controllers S is partitioned into sets {P_1, P_2,
- * ..., P_n} with one or more controllers in each partion. Each
- * partition P_n can be mounted multiple times, but the same
- * controller can not appear in more than one partition. Usually each
- * partition contains a single controller, but, for example, cpu and
- * cpuacct are often mounted together in the same partiion.
- *
- * Each controller partition has its own hierarchy (root) which we
- * must track and update independently.
- */
-__attribute__ ((nonnull))
-static void cgroup_root_scan(const char *const mnt_type,
- const char *const mnt_dir,
- char *const mnt_opts)
-{
- struct cgroup_root *root = roots;
- const struct cgroup_ctrl *const_ctrl;
- struct cgroup_ctrl *ctrl;
- uint32_t ctrl_field = 0;
- int no_prefix = 0;
- char buf[BUFSIZ];
- char *tok;
- const int mnt_dfd = SAFE_OPEN(mnt_dir, O_PATH | O_DIRECTORY);
-
- if (!strcmp(mnt_type, "cgroup"))
- goto v1;
-
- SAFE_FILE_READAT(mnt_dfd, "cgroup.controllers", buf, sizeof(buf));
-
- for (tok = strtok(buf, " "); tok; tok = strtok(NULL, " ")) {
- if ((const_ctrl = cgroup_find_ctrl(tok)))
- add_ctrl(&ctrl_field, const_ctrl);
- }
-
- if (root->ver && ctrl_field == root->ctrl_field)
- goto discard;
-
- if (root->ctrl_field)
- tst_brk(TBROK, "Available V2 controllers are changing between scans?");
-
- root->ver = TST_CGROUP_V2;
-
- goto backref;
-
-v1:
- for (tok = strtok(mnt_opts, ","); tok; tok = strtok(NULL, ",")) {
- if ((const_ctrl = cgroup_find_ctrl(tok)))
- add_ctrl(&ctrl_field, const_ctrl);
-
- no_prefix |= !strcmp("noprefix", tok);
- }
-
- if (!ctrl_field)
- goto discard;
-
- for_each_v1_root(root) {
- if (!(ctrl_field & root->ctrl_field))
- continue;
-
- if (ctrl_field == root->ctrl_field)
- goto discard;
-
- tst_brk(TBROK,
- "The intersection of two distinct sets of mounted controllers should be null?"
- "Check '%s' and '%s'", root->mnt_path, mnt_dir);
- }
-
- if (root >= roots + ROOTS_MAX) {
- tst_brk(TBROK,
- "Unique controller mounts have exceeded our limit %d?",
- ROOTS_MAX);
- }
-
- root->ver = TST_CGROUP_V1;
-
-backref:
- strcpy(root->mnt_path, mnt_dir);
- root->mnt_dir.dir_root = root;
- root->mnt_dir.dir_name = root->mnt_path;
- root->mnt_dir.dir_fd = mnt_dfd;
- root->ctrl_field = ctrl_field;
- root->no_cpuset_prefix = no_prefix;
-
- for_each_ctrl(ctrl) {
- if (has_ctrl(root->ctrl_field, ctrl))
- ctrl->ctrl_root = root;
- }
-
- return;
-
-discard:
- close(mnt_dfd);
-}
-
-void tst_cgroup_scan(void)
-{
- struct mntent *mnt;
- FILE *f = setmntent("/proc/self/mounts", "r");
-
- if (!f) {
- tst_brk(TBROK | TERRNO, "Can't open /proc/self/mounts");
- return;
- }
-
- mnt = getmntent(f);
- if (!mnt) {
- tst_brk(TBROK | TERRNO, "Can't read mounts or no mounts?");
- return;
- }
-
- do {
- if (strncmp(mnt->mnt_type, "cgroup", 6))
- continue;
-
- cgroup_root_scan(mnt->mnt_type, mnt->mnt_dir, mnt->mnt_opts);
- } while ((mnt = getmntent(f)));
-}
-
-static void cgroup_mount_v2(void)
-{
- char mnt_path[PATH_MAX];
-
- sprintf(mnt_path, "%s%s", ltp_mount_prefix, ltp_v2_mount);
-
- if (!mkdir(mnt_path, 0777)) {
- roots[0].mnt_dir.we_created_it = 1;
- goto mount;
- }
-
- if (errno == EEXIST)
- goto mount;
-
- if (errno == EACCES) {
- tst_res(TINFO | TERRNO,
- "Lack permission to make %s, premake it or run as root",
- mnt_path);
- return;
- }
-
- tst_brk(TBROK | TERRNO, "mkdir(%s, 0777)", mnt_path);
- return;
-
-mount:
- if (!mount("cgroup2", mnt_path, "cgroup2", 0, NULL)) {
- tst_res(TINFO, "Mounted V2 CGroups on %s", mnt_path);
- tst_cgroup_scan();
- roots[0].we_mounted_it = 1;
- return;
- }
-
- tst_res(TINFO | TERRNO, "Could not mount V2 CGroups on %s", mnt_path);
-
- if (roots[0].mnt_dir.we_created_it) {
- roots[0].mnt_dir.we_created_it = 0;
- SAFE_RMDIR(mnt_path);
- }
-}
-
-__attribute__ ((nonnull))
-static void cgroup_mount_v1(struct cgroup_ctrl *const ctrl)
-{
- char mnt_path[PATH_MAX];
- int made_dir = 0;
-
- sprintf(mnt_path, "%s%s", ltp_mount_prefix, ctrl->ctrl_name);
-
- if (!mkdir(mnt_path, 0777)) {
- made_dir = 1;
- goto mount;
- }
-
- if (errno == EEXIST)
- goto mount;
-
- if (errno == EACCES) {
- tst_res(TINFO | TERRNO,
- "Lack permission to make %s, premake it or run as root",
- mnt_path);
- return;
- }
-
- tst_brk(TBROK | TERRNO, "mkdir(%s, 0777)", mnt_path);
- return;
-
-mount:
- if (mount(ctrl->ctrl_name, mnt_path, "cgroup", 0, ctrl->ctrl_name)) {
- tst_res(TINFO | TERRNO,
- "Could not mount V1 CGroup on %s", mnt_path);
-
- if (made_dir)
- SAFE_RMDIR(mnt_path);
- return;
- }
-
- tst_res(TINFO, "Mounted V1 %s CGroup on %s", ctrl->ctrl_name, mnt_path);
- tst_cgroup_scan();
- if (!ctrl->ctrl_root)
- return;
-
- ctrl->ctrl_root->we_mounted_it = 1;
- ctrl->ctrl_root->mnt_dir.we_created_it = made_dir;
-
- if (ctrl->ctrl_indx == CTRL_MEMORY) {
- SAFE_FILE_PRINTFAT(ctrl->ctrl_root->mnt_dir.dir_fd,
- "memory.use_hierarchy", "%d", 1);
- }
-}
-
-__attribute__ ((nonnull))
-static void cgroup_copy_cpuset(const struct cgroup_root *const root)
-{
- char knob_val[BUFSIZ];
- int i;
- const char *const n0[] = {"mems", "cpus"};
- const char *const n1[] = {"cpuset.mems", "cpuset.cpus"};
- const char *const *const fname = root->no_cpuset_prefix ? n0 : n1;
-
- for (i = 0; i < 2; i++) {
- SAFE_FILE_READAT(root->mnt_dir.dir_fd,
- fname[i], knob_val, sizeof(knob_val));
- SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd,
- fname[i], "%s", knob_val);
- }
-}
-
-/* Ensure the specified controller is available.
- *
- * First we check if the specified controller has a known mount point,
- * if not then we scan the system. If we find it then we goto ensuring
- * the LTP group exists in the hierarchy the controller is using.
- *
- * If we can't find the controller, then we try to create it. First we
- * check if the V2 hierarchy/tree is mounted. If it isn't then we try
- * mounting it and look for the controller. If it is already mounted
- * then we know the controller is not available on V2 on this system.
- *
- * If we can't mount V2 or the controller is not on V2, then we try
- * mounting it on its own V1 tree.
- *
- * Once we have mounted the controller somehow, we create a hierarchy
- * of cgroups. If we are on V2 we first need to enable the controller
- * for all children of root. Then we create hierarchy described in
- * tst_cgroup.h.
- *
- * If we are using V1 cpuset then we copy the available mems and cpus
- * from root to the ltp group and set clone_children on the ltp group
- * to distribute these settings to the test cgroups. This means the
- * test author does not have to copy these settings before using the
- * cpuset.
- *
- */
-void tst_cgroup_require(const char *const ctrl_name,
- const struct tst_cgroup_opts *options)
-{
- const char *const cgsc = "cgroup.subtree_control";
- struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
- struct cgroup_root *root;
-
- if (!options)
- options = &default_opts;
-
- if (ctrl->we_require_it) {
- tst_res(TWARN, "Duplicate tst_cgroup_require(%s, )",
- ctrl->ctrl_name);
- }
- ctrl->we_require_it = 1;
-
- if (ctrl->ctrl_root)
- goto mkdirs;
-
- tst_cgroup_scan();
-
- if (ctrl->ctrl_root)
- goto mkdirs;
-
- if (!cgroup_v2_mounted() && !options->only_mount_v1)
- cgroup_mount_v2();
-
- if (ctrl->ctrl_root)
- goto mkdirs;
-
- cgroup_mount_v1(ctrl);
-
- if (!ctrl->ctrl_root) {
- tst_brk(TCONF,
- "'%s' controller required, but not available",
- ctrl->ctrl_name);
- return;
- }
-
-mkdirs:
- root = ctrl->ctrl_root;
- add_ctrl(&root->mnt_dir.ctrl_field, ctrl);
-
- if (cgroup_ctrl_on_v2(ctrl)) {
- if (root->we_mounted_it) {
- SAFE_FILE_PRINTFAT(root->mnt_dir.dir_fd,
- cgsc, "+%s", ctrl->ctrl_name);
- } else {
- tst_file_printfat(root->mnt_dir.dir_fd,
- cgsc, "+%s", ctrl->ctrl_name);
- }
- }
-
- if (!root->ltp_dir.dir_fd)
- cgroup_dir_mk(&root->mnt_dir, ltp_cgroup_dir, &root->ltp_dir);
- else
- root->ltp_dir.ctrl_field |= root->mnt_dir.ctrl_field;
-
- if (cgroup_ctrl_on_v2(ctrl)) {
- SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd,
- cgsc, "+%s", ctrl->ctrl_name);
- } else {
- SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd,
- "cgroup.clone_children", "%d", 1);
-
- if (ctrl->ctrl_indx == CTRL_CPUSET)
- cgroup_copy_cpuset(root);
- }
-
- cgroup_dir_mk(&root->ltp_dir, ltp_cgroup_drain_dir, &root->drain_dir);
-
- sprintf(test_cgroup_dir, "test-%d", getpid());
- cgroup_dir_mk(&root->ltp_dir, test_cgroup_dir, &root->test_dir);
-}
-
-static void cgroup_drain(const enum tst_cgroup_ver ver,
- const int source_dfd, const int dest_dfd)
-{
- char pid_list[BUFSIZ];
- char *tok;
- const char *const file_name =
- ver == TST_CGROUP_V1 ? "tasks" : "cgroup.procs";
- int fd;
- ssize_t ret;
-
- ret = SAFE_FILE_READAT(source_dfd, file_name,
- pid_list, sizeof(pid_list));
- if (ret < 0)
- return;
-
- fd = SAFE_OPENAT(dest_dfd, file_name, O_WRONLY);
- if (fd < 0)
- return;
-
- for (tok = strtok(pid_list, "\n"); tok; tok = strtok(NULL, "\n")) {
- ret = dprintf(fd, "%s", tok);
-
- if (ret < (ssize_t)strlen(tok))
- tst_brk(TBROK | TERRNO, "Failed to drain %s", tok);
- }
- SAFE_CLOSE(fd);
-}
-
-__attribute__ ((nonnull))
-static void close_path_fds(struct cgroup_root *const root)
-{
- if (root->test_dir.dir_fd > 0)
- SAFE_CLOSE(root->test_dir.dir_fd);
- if (root->ltp_dir.dir_fd > 0)
- SAFE_CLOSE(root->ltp_dir.dir_fd);
- if (root->drain_dir.dir_fd > 0)
- SAFE_CLOSE(root->drain_dir.dir_fd);
- if (root->mnt_dir.dir_fd > 0)
- SAFE_CLOSE(root->mnt_dir.dir_fd);
-}
-
-/* Maybe remove CGroups used during testing and clear our data
- *
- * This will never remove CGroups we did not create to allow tests to
- * be run in parallel.
- *
- * Each test process is given its own unique CGroup. Unless we want to
- * stress test the CGroup system. We should at least remove these
- * unique per test CGroups.
- *
- * We probably also want to remove the LTP parent CGroup, although
- * this may have been created by the system manager or another test
- * (see notes on parallel testing).
- *
- * On systems with no initial CGroup setup we may try to destroy the
- * CGroup roots we mounted so that they can be recreated by another
- * test. Note that successfully unmounting a CGroup root does not
- * necessarily indicate that it was destroyed.
- *
- * The ltp/drain CGroup is required for cleaning up test CGroups when
- * we can not move them to the root CGroup. CGroups can only be
- * removed when they have no members and only leaf or root CGroups may
- * have processes within them. As test processes create and destroy
- * their own CGroups they must move themselves either to root or
- * another leaf CGroup. So we move them to drain while destroying the
- * unique test CGroup.
- *
- * If we have access to root and created the LTP CGroup we then move
- * the test process to root and destroy the drain and LTP
- * CGroups. Otherwise we just leave the test process to die in the
- * drain, much like many a unwanted terrapin.
- *
- * Finally we clear any data we have collected on CGroups. This will
- * happen regardless of whether anything was removed.
- */
-void tst_cgroup_cleanup(void)
-{
- struct cgroup_root *root;
- struct cgroup_ctrl *ctrl;
-
- if (!cgroup_mounted())
- goto clear_data;
-
- for_each_root(root) {
- if (!root->test_dir.dir_name)
- continue;
-
- cgroup_drain(root->ver,
- root->test_dir.dir_fd, root->drain_dir.dir_fd);
- SAFE_UNLINKAT(root->ltp_dir.dir_fd, root->test_dir.dir_name,
- AT_REMOVEDIR);
- }
-
- for_each_root(root) {
- if (!root->ltp_dir.we_created_it)
- continue;
-
- cgroup_drain(root->ver,
- root->drain_dir.dir_fd, root->mnt_dir.dir_fd);
-
- if (root->drain_dir.dir_name) {
- SAFE_UNLINKAT(root->ltp_dir.dir_fd,
- root->drain_dir.dir_name, AT_REMOVEDIR);
- }
-
- if (root->ltp_dir.dir_name) {
- SAFE_UNLINKAT(root->mnt_dir.dir_fd,
- root->ltp_dir.dir_name, AT_REMOVEDIR);
- }
- }
-
- for_each_ctrl(ctrl) {
- if (!cgroup_ctrl_on_v2(ctrl) || !ctrl->ctrl_root->we_mounted_it)
- continue;
-
- SAFE_FILE_PRINTFAT(ctrl->ctrl_root->mnt_dir.dir_fd,
- "cgroup.subtree_control",
- "-%s", ctrl->ctrl_name);
- }
-
- for_each_root(root) {
- if (!root->we_mounted_it)
- continue;
-
- /* This probably does not result in the CGroup root
- * being destroyed */
- if (umount2(root->mnt_path, MNT_DETACH))
- continue;
-
- SAFE_RMDIR(root->mnt_path);
- }
-
-clear_data:
- for_each_ctrl(ctrl) {
- ctrl->ctrl_root = NULL;
- ctrl->we_require_it = 0;
- }
-
- for_each_root(root)
- close_path_fds(root);
-
- memset(roots, 0, sizeof(roots));
-}
-
-__attribute__ ((nonnull (1)))
-static void cgroup_group_init(struct tst_cgroup_group *const cg,
- const char *const group_name)
-{
- memset(cg, 0, sizeof(*cg));
-
- if (!group_name)
- return;
-
- if (strlen(group_name) > NAME_MAX)
- tst_brk(TBROK, "Group name is too long");
-
- strcpy(cg->group_name, group_name);
-}
-
-__attribute__ ((nonnull))
-static void cgroup_group_add_dir(struct tst_cgroup_group *const cg,
- struct cgroup_dir *const dir)
-{
- const struct cgroup_ctrl *ctrl;
- int i;
-
- if (dir->dir_root->ver == TST_CGROUP_V2)
- cg->dirs_by_ctrl[0] = dir;
-
- for_each_ctrl(ctrl) {
- if (has_ctrl(dir->ctrl_field, ctrl))
- cg->dirs_by_ctrl[ctrl->ctrl_indx] = dir;
- }
-
- for (i = 0; cg->dirs[i]; i++);
- cg->dirs[i] = dir;
-}
-
-struct tst_cgroup_group *
-tst_cgroup_group_mk(const struct tst_cgroup_group *const parent,
- const char *const group_name)
-{
- struct tst_cgroup_group *cg;
- struct cgroup_dir *const *dir;
- struct cgroup_dir *new_dir;
-
- cg = SAFE_MALLOC(sizeof(*cg));
- cgroup_group_init(cg, group_name);
-
- for_each_dir(parent, 0, dir) {
- new_dir = SAFE_MALLOC(sizeof(*new_dir));
- cgroup_dir_mk(*dir, group_name, new_dir);
- cgroup_group_add_dir(cg, new_dir);
- }
-
- return cg;
-}
-
-struct tst_cgroup_group *tst_cgroup_group_rm(struct tst_cgroup_group *const cg)
-{
- struct cgroup_dir **dir;
-
- for_each_dir(cg, 0, dir) {
- close((*dir)->dir_fd);
- SAFE_UNLINKAT((*dir)->dir_parent->dir_fd,
- (*dir)->dir_name,
- AT_REMOVEDIR);
- free(*dir);
- }
-
- free(cg);
- return NULL;
-}
-
-__attribute__ ((nonnull, warn_unused_result))
-static const struct cgroup_file *cgroup_file_find(const char *const file,
- const int lineno,
- const char *const file_name)
-{
- const struct cgroup_file *cfile;
- const struct cgroup_ctrl *ctrl;
- char ctrl_name[32];
- const char *const sep = strchr(file_name, '.');
- size_t len;
-
- if (!sep) {
- tst_brk_(file, lineno, TBROK,
- "Invalid file name '%s'; did not find controller separator '.'",
- file_name);
- return NULL;
- }
-
- len = sep - file_name;
- memcpy(ctrl_name, file_name, len);
- ctrl_name[len] = '\0';
-
- ctrl = cgroup_find_ctrl(ctrl_name);
-
- if (!ctrl) {
- tst_brk_(file, lineno, TBROK,
- "Did not find controller '%s'\n", ctrl_name);
- return NULL;
- }
-
- for (cfile = ctrl->files; cfile->file_name; cfile++) {
- if (!strcmp(file_name, cfile->file_name))
- break;
- }
-
- if (!cfile->file_name) {
- tst_brk_(file, lineno, TBROK,
- "Did not find '%s' in '%s'\n",
- file_name, ctrl->ctrl_name);
- return NULL;
- }
-
- return cfile;
-}
-
-enum tst_cgroup_ver tst_cgroup_ver(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const ctrl_name)
-{
- const struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
- const struct cgroup_dir *dir;
-
- if (!strcmp(ctrl_name, "cgroup")) {
- tst_brk_(file, lineno,
- TBROK,
- "cgroup may be present on both V1 and V2 hierarchies");
- return 0;
- }
-
- if (!ctrl) {
- tst_brk_(file, lineno,
- TBROK, "Unknown controller '%s'", ctrl_name);
- return 0;
- }
-
- dir = cg->dirs_by_ctrl[ctrl->ctrl_indx];
-
- if (!dir) {
- tst_brk_(file, lineno,
- TBROK, "%s controller not attached to CGroup %s",
- ctrl_name, cg->group_name);
- return 0;
- }
-
- return dir->dir_root->ver;
-}
-
-__attribute__ ((nonnull, warn_unused_result))
-static const char *cgroup_file_alias(const struct cgroup_file *const cfile,
- const struct cgroup_dir *const dir)
-{
- if (dir->dir_root->ver != TST_CGROUP_V1)
- return cfile->file_name;
-
- if (cfile->ctrl_indx == CTRL_CPUSET &&
- dir->dir_root->no_cpuset_prefix &&
- cfile->file_name_v1) {
- return strchr(cfile->file_name_v1, '.') + 1;
- }
-
- return cfile->file_name_v1;
-}
-
-int safe_cgroup_has(const char *const file, const int lineno,
- const struct tst_cgroup_group *cg,
- const char *const file_name)
-{
- const struct cgroup_file *const cfile =
- cgroup_file_find(file, lineno, file_name);
- struct cgroup_dir *const *dir;
- const char *alias;
-
- if (!cfile)
- return 0;
-
- for_each_dir(cg, cfile->ctrl_indx, dir) {
- if (!(alias = cgroup_file_alias(cfile, *dir)))
- continue;
-
- if (!faccessat((*dir)->dir_fd, file_name, F_OK, 0))
- return 1;
-
- if (errno == ENOENT)
- continue;
-
- tst_brk_(file, lineno, TBROK | TERRNO,
- "faccessat(%d<%s>, %s, F_OK, 0)",
- (*dir)->dir_fd, tst_decode_fd((*dir)->dir_fd), alias);
- }
-
- return 0;
-}
-
-__attribute__ ((warn_unused_result))
-static struct tst_cgroup_group *cgroup_group_from_roots(const size_t tree_off)
-{
- struct cgroup_root *root;
- struct cgroup_dir *dir;
- struct tst_cgroup_group *cg;
-
- cg = tst_alloc(sizeof(*cg));
- cgroup_group_init(cg, NULL);
-
- for_each_root(root) {
- dir = (typeof(dir))(((char *)root) + tree_off);
-
- if (dir->ctrl_field)
- cgroup_group_add_dir(cg, dir);
- }
-
- if (cg->dirs[0]) {
- strncpy(cg->group_name, cg->dirs[0]->dir_name, NAME_MAX);
- return cg;
- }
-
- tst_brk(TBROK,
- "No CGroups found; maybe you forgot to call tst_cgroup_require?");
-
- return cg;
-}
-
-const struct tst_cgroup_group *tst_cgroup_get_test_group(void)
-{
- return cgroup_group_from_roots(offsetof(struct cgroup_root, test_dir));
-}
-
-const struct tst_cgroup_group *tst_cgroup_get_drain_group(void)
-{
- return cgroup_group_from_roots(offsetof(struct cgroup_root, drain_dir));
-}
-
-ssize_t safe_cgroup_read(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const file_name,
- char *const out, const size_t len)
-{
- const struct cgroup_file *const cfile =
- cgroup_file_find(file, lineno, file_name);
- struct cgroup_dir *const *dir;
- const char *alias;
- size_t prev_len = 0;
- char prev_buf[BUFSIZ];
-
- for_each_dir(cg, cfile->ctrl_indx, dir) {
- if (!(alias = cgroup_file_alias(cfile, *dir)))
- continue;
-
- if (prev_len)
- memcpy(prev_buf, out, prev_len);
-
- TEST(safe_file_readat(file, lineno,
- (*dir)->dir_fd, alias, out, len));
- if (TST_RET < 0)
- continue;
-
- if (prev_len && memcmp(out, prev_buf, prev_len)) {
- tst_brk_(file, lineno, TBROK,
- "%s has different value across roots",
- file_name);
- break;
- }
-
- prev_len = MIN(sizeof(prev_buf), (size_t)TST_RET);
- }
-
- out[MAX(TST_RET, 0)] = '\0';
-
- return TST_RET;
-}
-
-void safe_cgroup_printf(const char *const file, const int lineno,
- const struct tst_cgroup_group *cg,
- const char *const file_name,
- const char *const fmt, ...)
-{
- const struct cgroup_file *const cfile =
- cgroup_file_find(file, lineno, file_name);
- struct cgroup_dir *const *dir;
- const char *alias;
- va_list va;
-
- for_each_dir(cg, cfile->ctrl_indx, dir) {
- if (!(alias = cgroup_file_alias(cfile, *dir)))
- continue;
-
- va_start(va, fmt);
- safe_file_vprintfat(file, lineno,
- (*dir)->dir_fd, alias, fmt, va);
- va_end(va);
- }
-}
-
-void safe_cgroup_scanf(const char *const file, const int lineno,
- const struct tst_cgroup_group *const cg,
- const char *const file_name,
- const char *const fmt, ...)
-{
- va_list va;
- char buf[BUFSIZ];
- ssize_t len = safe_cgroup_read(file, lineno,
- cg, file_name, buf, sizeof(buf));
- const int conv_cnt = tst_count_scanf_conversions(fmt);
- int ret;
-
- if (len < 1)
- return;
-
- va_start(va, fmt);
- if ((ret = vsscanf(buf, fmt, va)) < 1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "'%s': vsscanf('%s', '%s', ...)", file_name, buf, fmt);
- }
- va_end(va);
-
- if (conv_cnt == ret)
- return;
-
- tst_brk_(file, lineno, TBROK,
- "'%s': vsscanf('%s', '%s', ..): Less conversions than expected: %d != %d",
- file_name, buf, fmt, ret, conv_cnt);
-}
diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
index b41986f0c..5e5b11496 100644
--- a/lib/tst_checkpoint.c
+++ b/lib/tst_checkpoint.c
@@ -43,8 +43,9 @@ void tst_checkpoint_init(const char *file, const int lineno,
unsigned int page_size;
if (tst_futexes) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "checkpoints already initialized");
+ tst_brkm(TBROK, cleanup_fn,
+ "%s: %d checkpoints already initialized",
+ file, lineno);
return;
}
@@ -60,9 +61,9 @@ void tst_checkpoint_init(const char *file, const int lineno,
* the init as a first function with NULL as cleanup function.
*/
if (cleanup_fn && !tst_tmpdir_created()) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "You have to create test temporary directory "
- "first (call tst_tmpdir())");
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d You have to create test temporary directory "
+ "first (call tst_tmpdir())", file, lineno);
return;
}
@@ -86,9 +87,6 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
struct timespec timeout;
int ret;
- if (!tst_max_futexes)
- tst_brkm(TBROK, NULL, "Set test.needs_checkpoints = 1");
-
if (id >= tst_max_futexes) {
errno = EOVERFLOW;
return -1;
@@ -110,9 +108,6 @@ int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
{
unsigned int msecs = 0, waked = 0;
- if (!tst_max_futexes)
- tst_brkm(TBROK, NULL, "Set test.needs_checkpoints = 1");
-
if (id >= tst_max_futexes) {
errno = EOVERFLOW;
return -1;
@@ -149,9 +144,9 @@ void tst_safe_checkpoint_wait(const char *file, const int lineno,
ret = tst_checkpoint_wait(id, msec_timeout);
if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "tst_checkpoint_wait(%u, %i) failed", id,
- msec_timeout);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: tst_checkpoint_wait(%u, %i)",
+ file, lineno, id, msec_timeout);
}
}
@@ -162,8 +157,8 @@ void tst_safe_checkpoint_wake(const char *file, const int lineno,
int ret = tst_checkpoint_wake(id, nr_wake, DEFAULT_MSEC_TIMEOUT);
if (ret) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "tst_checkpoint_wake(%u, %u, %i) failed", id, nr_wake,
- DEFAULT_MSEC_TIMEOUT);
+ tst_brkm(TBROK | TERRNO, cleanup_fn,
+ "%s:%d: tst_checkpoint_wake(%u, %u, %i)",
+ file, lineno, id, nr_wake, DEFAULT_MSEC_TIMEOUT);
}
}
diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c
index cdcb9fc4f..5195da38f 100644
--- a/lib/tst_clocks.c
+++ b/lib/tst_clocks.c
@@ -3,142 +3,28 @@
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
*/
+/*
+ * clock_gettime() and clock_getres() functions
+ */
+
+#define _GNU_SOURCE
+#include <unistd.h>
#include <time.h>
+#include <sys/syscall.h>
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "tst_timer.h"
#include "tst_clocks.h"
-#include "lapi/syscalls.h"
-#include "lapi/posix_clocks.h"
-
-typedef int (*mysyscall)(clockid_t clk_id, void *ts);
-
-int syscall_supported_by_kernel(long sysnr)
-{
- int ret;
-
- ret = syscall(sysnr, 0, NULL);
- if (ret == -1 && errno == ENOSYS)
- return 0;
-
- return 1;
-}
int tst_clock_getres(clockid_t clk_id, struct timespec *res)
{
- static struct tst_ts tts = { 0, };
- static mysyscall func;
- int ret;
-
-#if (__NR_clock_getres_time64 != __LTP__NR_INVALID_SYSCALL)
- if (!func && syscall_supported_by_kernel(__NR_clock_getres_time64)) {
- func = sys_clock_getres64;
- tts.type = TST_KERN_TIMESPEC;
- }
-#endif
-
- if (!func && syscall_supported_by_kernel(__NR_clock_getres)) {
- func = sys_clock_getres;
- tts.type = TST_KERN_OLD_TIMESPEC;
- }
-
- if (!func) {
- tst_res(TCONF, "clock_getres() not available");
- errno = ENOSYS;
- return -1;
- }
-
- ret = func(clk_id, tst_ts_get(&tts));
- res->tv_sec = tst_ts_get_sec(tts);
- res->tv_nsec = tst_ts_get_nsec(tts);
- return ret;
+ return syscall(SYS_clock_getres, clk_id, res);
}
int tst_clock_gettime(clockid_t clk_id, struct timespec *ts)
{
- static struct tst_ts tts = { 0, };
- static mysyscall func;
- int ret;
-
-#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)
- if (!func && syscall_supported_by_kernel(__NR_clock_gettime64)) {
- func = sys_clock_gettime64;
- tts.type = TST_KERN_TIMESPEC;
- }
-#endif
-
- if (!func && syscall_supported_by_kernel(__NR_clock_gettime)) {
- func = sys_clock_gettime;
- tts.type = TST_KERN_OLD_TIMESPEC;
- }
-
- if (!func) {
- tst_res(TCONF, "clock_gettime() not available");
- errno = ENOSYS;
- return -1;
- }
-
- ret = func(clk_id, tst_ts_get(&tts));
- ts->tv_sec = tst_ts_get_sec(tts);
- ts->tv_nsec = tst_ts_get_nsec(tts);
- return ret;
+ return syscall(SYS_clock_gettime, clk_id, ts);
}
int tst_clock_settime(clockid_t clk_id, struct timespec *ts)
{
- static struct tst_ts tts = { 0, };
- static mysyscall func;
-
-#if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL)
- if (!func && syscall_supported_by_kernel(__NR_clock_settime64)) {
- func = sys_clock_settime64;
- tts.type = TST_KERN_TIMESPEC;
- }
-#endif
-
- if (!func && syscall_supported_by_kernel(__NR_clock_settime)) {
- func = sys_clock_settime;
- tts.type = TST_KERN_OLD_TIMESPEC;
- }
-
- if (!func) {
- tst_res(TCONF, "clock_settime() not available");
- errno = ENOSYS;
- return -1;
- }
-
- tst_ts_set_sec(&tts, ts->tv_sec);
- tst_ts_set_nsec(&tts, ts->tv_nsec);
- return func(clk_id, tst_ts_get(&tts));
-}
-
-const char *tst_clock_name(clockid_t clk_id)
-{
- switch (clk_id) {
- case CLOCK_REALTIME:
- return "CLOCK_REALTIME";
- case CLOCK_MONOTONIC:
- return "CLOCK_MONOTONIC";
- case CLOCK_PROCESS_CPUTIME_ID:
- return "CLOCK_PROCESS_CPUTIME_ID";
- case CLOCK_THREAD_CPUTIME_ID:
- return "CLOCK_THREAD_CPUTIME_ID";
- case CLOCK_MONOTONIC_RAW:
- return "CLOCK_MONOTONIC_RAW";
- case CLOCK_REALTIME_COARSE:
- return "CLOCK_REALTIME_COARSE";
- case CLOCK_MONOTONIC_COARSE:
- return "CLOCK_MONOTONIC_COARSE";
- case CLOCK_BOOTTIME:
- return "CLOCK_BOOTTIME";
- case CLOCK_REALTIME_ALARM:
- return "CLOCK_REALTIME_ALARM";
- case CLOCK_BOOTTIME_ALARM:
- return "CLOCK_BOOTTIME_ALARM";
- case CLOCK_TAI:
- return "CLOCK_TAI";
- default:
- return "INVALID/UNKNOWN CLOCK";
- }
+ return syscall(SYS_clock_settime, clk_id, ts);
}
diff --git a/lib/tst_clone.c b/lib/tst_clone.c
deleted file mode 100644
index 07e7f0767..000000000
--- a/lib/tst_clone.c
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) 2021 SUSE LLC
- * Richard Palethorpe <rpalethorpe@suse.com>
- */
-
-#define TST_NO_DEFAULT_MAIN
-
-#include <stddef.h>
-
-#include "tst_test.h"
-#include "lapi/clone.h"
-
-pid_t tst_clone(const struct tst_clone_args *tst_args)
-{
- struct clone_args args = {
- .flags = tst_args->flags,
- .exit_signal = tst_args->exit_signal,
- };
- int flags;
- pid_t pid = -1;
-
- tst_flush();
-
- errno = ENOSYS;
- if (__NR_clone3 != __LTP__NR_INVALID_SYSCALL)
- pid = syscall(__NR_clone3, &args, sizeof(args));
-
- if (pid == -1 && errno != ENOSYS)
- return -1;
-
- if (pid != -1)
- return pid;
-
- flags = args.exit_signal | args.flags;
-
-#ifdef __s390x__
- pid = syscall(__NR_clone, NULL, flags);
-#else
- pid = syscall(__NR_clone, flags, NULL);
-#endif
-
- if (pid == -1)
- return -2;
-
- return pid;
-}
diff --git a/lib/tst_cpu.c b/lib/tst_cpu.c
index b4c7c2f81..033155e47 100644
--- a/lib/tst_cpu.c
+++ b/lib/tst_cpu.c
@@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "lapi/cpuset.h"
-
#include <stdlib.h>
#include <unistd.h>
#include "test.h"
@@ -73,27 +71,3 @@ long tst_ncpus_max(void)
}
return ncpus_max;
}
-
-long tst_ncpus_available(void)
-{
-#ifdef CPU_COUNT_S
- long ncpus = tst_ncpus_max();
- size_t cpusz = CPU_ALLOC_SIZE(ncpus);
- cpu_set_t *cpus = CPU_ALLOC(ncpus);
-
- if (!cpus)
- tst_brkm(TBROK | TERRNO, NULL, "CPU_ALLOC(%zu)", cpusz);
-
- if (sched_getaffinity(0, cpusz, cpus)) {
- tst_resm(TWARN | TERRNO, "sched_getaffinity(0, %zu, %zx)",
- cpusz, (size_t)cpus);
- } else {
- ncpus = CPU_COUNT_S(cpusz, cpus);
- }
- CPU_FREE(cpus);
-
- return ncpus;
-#else
- return tst_ncpus();
-#endif
-}
diff --git a/lib/tst_device.c b/lib/tst_device.c
index 87373ca57..b9a2bc837 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -31,7 +31,6 @@
#include <linux/loop.h>
#include <stdint.h>
#include <inttypes.h>
-#include <sys/sysmacros.h>
#include "lapi/syscalls.h"
#include "test.h"
#include "safe_macros.h"
@@ -194,75 +193,52 @@ int tst_attach_device(const char *dev, const char *file)
return 0;
}
-int tst_detach_device_by_fd(const char *dev, int dev_fd)
+int tst_detach_device(const char *dev)
{
- int ret, i;
+ int dev_fd, ret, i;
+
+ dev_fd = open(dev, O_RDONLY);
+ if (dev_fd < 0) {
+ tst_resm(TWARN | TERRNO, "open(%s) failed", dev);
+ return 1;
+ }
/* keep trying to clear LOOPDEV until we get ENXIO, a quick succession
* of attach/detach might not give udev enough time to complete */
for (i = 0; i < 40; i++) {
ret = ioctl(dev_fd, LOOP_CLR_FD, 0);
- if (ret && (errno == ENXIO))
+ if (ret && (errno == ENXIO)) {
+ close(dev_fd);
return 0;
+ }
if (ret && (errno != EBUSY)) {
tst_resm(TWARN,
"ioctl(%s, LOOP_CLR_FD, 0) unexpectedly failed with: %s",
dev, tst_strerrno(errno));
+ close(dev_fd);
return 1;
}
usleep(50000);
}
+ close(dev_fd);
tst_resm(TWARN,
"ioctl(%s, LOOP_CLR_FD, 0) no ENXIO for too long", dev);
return 1;
}
-int tst_detach_device(const char *dev)
-{
- int dev_fd, ret;
-
- dev_fd = open(dev, O_RDONLY);
- if (dev_fd < 0) {
- tst_resm(TWARN | TERRNO, "open(%s) failed", dev);
- return 1;
- }
-
- ret = tst_detach_device_by_fd(dev, dev_fd);
- close(dev_fd);
- return ret;
-}
-
int tst_dev_sync(int fd)
{
return syscall(__NR_syncfs, fd);
}
-const char *tst_acquire_loop_device(unsigned int size, const char *filename)
-{
- unsigned int acq_dev_size = MAX(size, DEV_SIZE_MB);
-
- if (tst_prealloc_file(filename, 1024 * 1024, acq_dev_size)) {
- tst_resm(TWARN | TERRNO, "Failed to create %s", filename);
- return NULL;
- }
-
- if (tst_find_free_loopdev(dev_path, sizeof(dev_path)) == -1)
- return NULL;
-
- if (tst_attach_device(dev_path, filename))
- return NULL;
-
- return dev_path;
-}
-
const char *tst_acquire_device__(unsigned int size)
{
int fd;
- const char *dev;
+ char *dev;
struct stat st;
unsigned int acq_dev_size;
uint64_t ltp_dev_size;
@@ -313,12 +289,20 @@ const char *tst_acquire_device__(unsigned int size)
ltp_dev_size, acq_dev_size);
}
- dev = tst_acquire_loop_device(acq_dev_size, DEV_FILE);
+ if (tst_fill_file(DEV_FILE, 0, 1024 * 1024, acq_dev_size)) {
+ tst_resm(TWARN | TERRNO, "Failed to create " DEV_FILE);
+ return NULL;
+ }
- if (dev)
- device_acquired = 1;
+ if (tst_find_free_loopdev(dev_path, sizeof(dev_path)) == -1)
+ return NULL;
- return dev;
+ if (tst_attach_device(dev_path, DEV_FILE))
+ return NULL;
+
+ device_acquired = 1;
+
+ return dev_path;
}
const char *tst_acquire_device_(void (cleanup_fn)(void), unsigned int size)
@@ -386,17 +370,10 @@ int tst_umount(const char *path)
if (!ret)
return 0;
- if (err != EBUSY) {
- tst_resm(TWARN, "umount('%s') failed with %s",
- path, tst_strerrno(err));
- errno = err;
- return ret;
- }
-
tst_resm(TINFO, "umount('%s') failed with %s, try %2i...",
path, tst_strerrno(err), i+1);
- if (i == 0) {
+ if (i == 0 && err == EBUSY) {
tst_resm(TINFO, "Likely gvfsd-trash is probing newly "
"mounted fs, kill it to speed up tests.");
}
@@ -409,50 +386,6 @@ int tst_umount(const char *path)
return -1;
}
-int tst_is_mounted(const char *path)
-{
- char line[PATH_MAX];
- FILE *file;
- int ret = 0;
-
- file = SAFE_FOPEN(NULL, "/proc/mounts", "r");
-
- while (fgets(line, sizeof(line), file)) {
- if (strstr(line, path) != NULL) {
- ret = 1;
- break;
- }
- }
-
- SAFE_FCLOSE(NULL, file);
-
- if (!ret)
- tst_resm(TINFO, "No device is mounted at %s", path);
-
- return ret;
-}
-
-int tst_is_mounted_at_tmpdir(const char *path)
-{
- char cdir[PATH_MAX], mpath[PATH_MAX];
- int ret;
-
- if (!getcwd(cdir, PATH_MAX)) {
- tst_resm(TWARN | TERRNO, "Failed to find current directory");
- return 0;
- }
-
- ret = snprintf(mpath, PATH_MAX, "%s/%s", cdir, path);
- if (ret < 0 || ret >= PATH_MAX) {
- tst_resm(TWARN | TERRNO,
- "snprintf() should have returned %d instead of %d",
- PATH_MAX, ret);
- return 0;
- }
-
- return tst_is_mounted(mpath);
-}
-
int find_stat_file(const char *dev, char *path, size_t path_len)
{
const char *devname = strrchr(dev, '/') + 1;
@@ -501,46 +434,3 @@ unsigned long tst_dev_bytes_written(const char *dev)
return dev_bytes_written;
}
-
-void tst_find_backing_dev(const char *path, char *dev)
-{
- struct stat buf;
- FILE *file;
- char line[PATH_MAX];
- char *pre = NULL;
- char *next = NULL;
- unsigned int dev_major, dev_minor, line_mjr, line_mnr;
-
- if (stat(path, &buf) < 0)
- tst_brkm(TWARN | TERRNO, NULL, "stat() failed");
-
- dev_major = major(buf.st_dev);
- dev_minor = minor(buf.st_dev);
- file = SAFE_FOPEN(NULL, "/proc/self/mountinfo", "r");
- *dev = '\0';
-
- while (fgets(line, sizeof(line), file)) {
- if (sscanf(line, "%*d %*d %d:%d", &line_mjr, &line_mnr) != 2)
- continue;
-
- if (line_mjr == dev_major && line_mnr == dev_minor) {
- pre = strstr(line, " - ");
- pre = strtok_r(pre, " ", &next);
- pre = strtok_r(NULL, " ", &next);
- pre = strtok_r(NULL, " ", &next);
- strcpy(dev, pre);
- break;
- }
- }
-
- SAFE_FCLOSE(NULL, file);
-
- if (!*dev)
- tst_brkm(TBROK, NULL, "Cannot find block device for %s", path);
-
- if (stat(dev, &buf) < 0)
- tst_brkm(TWARN | TERRNO, NULL, "stat(%s) failed", dev);
-
- if (S_ISBLK(buf.st_mode) != 1)
- tst_brkm(TCONF, NULL, "dev(%s) isn't a block dev", dev);
-}
diff --git a/lib/tst_fill_file.c b/lib/tst_fill_file.c
index 80472007f..f2bc52d42 100644
--- a/lib/tst_fill_file.c
+++ b/lib/tst_fill_file.c
@@ -19,14 +19,12 @@
*
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include "lapi/fallocate.h"
#include "test.h"
@@ -56,22 +54,6 @@ int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount)
return 0;
}
-int tst_prealloc_size_fd(int fd, size_t bs, size_t bcount)
-{
- int ret;
-
- errno = 0;
- ret = fallocate(fd, 0, 0, bs * bcount);
-
- if (ret && errno == ENOSPC)
- return ret;
-
- if (ret)
- ret = tst_fill_fd(fd, 0, bs, bcount);
-
- return ret;
-}
-
int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount)
{
int fd;
@@ -94,25 +76,3 @@ int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount)
return 0;
}
-
-int tst_prealloc_file(const char *path, size_t bs, size_t bcount)
-{
- int fd;
-
- fd = open(path, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR);
- if (fd < 0)
- return -1;
-
- if (tst_prealloc_size_fd(fd, bs, bcount)) {
- close(fd);
- unlink(path);
- return -1;
- }
-
- if (close(fd) < 0) {
- unlink(path);
- return -1;
- }
-
- return 0;
-}
diff --git a/lib/tst_fips.c b/lib/tst_fips.c
deleted file mode 100644
index 82dafef7a..000000000
--- a/lib/tst_fips.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
- */
-
-#define TST_NO_DEFAULT_MAIN
-
-#define PATH_FIPS "/proc/sys/crypto/fips_enabled"
-
-#include "tst_test.h"
-#include "tst_safe_macros.h"
-#include "tst_fips.h"
-
-int tst_fips_enabled(void)
-{
- int fips = 0;
-
- if (access(PATH_FIPS, R_OK) == 0) {
- SAFE_FILE_SCANF(PATH_FIPS, "%d", &fips);
- }
-
- tst_res(TINFO, "FIPS: %s", fips ? "on" : "off");
- return fips;
-}
diff --git a/lib/tst_fs_setup.c b/lib/tst_fs_setup.c
index 6b93483de..54ea37077 100644
--- a/lib/tst_fs_setup.c
+++ b/lib/tst_fs_setup.c
@@ -36,15 +36,14 @@ int mount_overlay(const char *file, const int lineno, int skip)
if (errno == ENODEV) {
if (skip) {
- tst_brk_(file, lineno, TCONF,
- TST_FS_SETUP_OVERLAYFS_MSG);
+ tst_brk(TCONF, "%s:%d: " TST_FS_SETUP_OVERLAYFS_MSG,
+ file, lineno);
} else {
- tst_res_(file, lineno, TINFO,
- TST_FS_SETUP_OVERLAYFS_MSG);
+ tst_res(TINFO, "%s:%d: " TST_FS_SETUP_OVERLAYFS_MSG,
+ file, lineno);
}
} else {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "overlayfs mount failed");
+ tst_brk(TBROK | TERRNO, "overlayfs mount failed");
}
return ret;
}
diff --git a/lib/tst_fs_type.c b/lib/tst_fs_type.c
index 8475f4c78..1d0ac9669 100644
--- a/lib/tst_fs_type.c
+++ b/lib/tst_fs_type.c
@@ -47,46 +47,44 @@ const char *tst_fs_type_name(long f_type)
{
switch (f_type) {
case TST_TMPFS_MAGIC:
- return "tmpfs";
+ return "TMPFS";
case TST_NFS_MAGIC:
- return "nfs";
+ return "NFS";
case TST_V9FS_MAGIC:
- return "9p";
+ return "9P";
case TST_RAMFS_MAGIC:
- return "ramfs";
+ return "RAMFS";
case TST_BTRFS_MAGIC:
- return "btrfs";
+ return "BTRFS";
case TST_XFS_MAGIC:
- return "xfs";
+ return "XFS";
case TST_EXT2_OLD_MAGIC:
- return "ext2";
+ return "EXT2";
case TST_EXT234_MAGIC:
- return "ext2/ext3/ext4";
+ return "EXT2/EXT3/EXT4";
case TST_MINIX_MAGIC:
case TST_MINIX_MAGIC2:
case TST_MINIX2_MAGIC:
case TST_MINIX2_MAGIC2:
case TST_MINIX3_MAGIC:
- return "minix";
+ return "MINIX";
case TST_UDF_MAGIC:
- return "udf";
+ return "UDF";
case TST_SYSV2_MAGIC:
case TST_SYSV4_MAGIC:
- return "sysv";
+ return "SYSV";
case TST_UFS_MAGIC:
case TST_UFS2_MAGIC:
- return "ufs";
+ return "UFS";
case TST_F2FS_MAGIC:
- return "f2fs";
+ return "F2FS";
case TST_NILFS_MAGIC:
- return "nilfs";
+ return "NILFS";
case TST_EXOFS_MAGIC:
- return "exofs";
+ return "EXOFS";
case TST_OVERLAYFS_MAGIC:
- return "overlayfs";
- case TST_FUSE_MAGIC:
- return "fuse";
+ return "OVERLAYFS";
default:
- return "unknown";
+ return "Unknown";
}
}
diff --git a/lib/tst_hugepage.c b/lib/tst_hugepage.c
deleted file mode 100644
index 1d0e62e5b..000000000
--- a/lib/tst_hugepage.c
+++ /dev/null
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Red Hat, Inc.
- */
-
-#define TST_NO_DEFAULT_MAIN
-
-#include "tst_test.h"
-#include "tst_hugepage.h"
-
-unsigned long tst_hugepages;
-char *nr_opt;
-char *Hopt;
-
-size_t tst_get_hugepage_size(void)
-{
- if (access(PATH_HUGEPAGES, F_OK))
- return 0;
-
- return SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
-}
-
-unsigned long tst_request_hugepages(unsigned long hpages)
-{
- unsigned long val, max_hpages;
-
- if (access(PATH_HUGEPAGES, F_OK)) {
- tst_hugepages = 0;
- goto out;
- }
-
- if (nr_opt)
- tst_hugepages = SAFE_STRTOL(nr_opt, 1, LONG_MAX);
- else
- tst_hugepages = hpages;
-
- SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
- max_hpages = SAFE_READ_MEMINFO("MemFree:") / SAFE_READ_MEMINFO("Hugepagesize:");
-
- if (tst_hugepages > max_hpages) {
- tst_res(TINFO, "Requested number(%lu) of hugepages is too large, "
- "limiting to 80%% of the max hugepage count %lu",
- tst_hugepages, max_hpages);
- tst_hugepages = max_hpages * 0.8;
-
- if (tst_hugepages < 1)
- goto out;
- }
-
- tst_sys_conf_save("?/proc/sys/vm/nr_hugepages");
- SAFE_FILE_PRINTF(PATH_NR_HPAGES, "%lu", tst_hugepages);
- SAFE_FILE_SCANF(PATH_NR_HPAGES, "%lu", &val);
- if (val != tst_hugepages)
- tst_brk(TCONF, "nr_hugepages = %lu, but expect %lu. "
- "Not enough hugepages for testing.",
- val, tst_hugepages);
-
- tst_res(TINFO, "%lu hugepage(s) reserved", tst_hugepages);
-out:
- return tst_hugepages;
-}
diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index c2b85821b..4b51413e5 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -11,9 +11,7 @@
#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"
-#include "tst_private.h"
#include "tst_kconfig.h"
-#include "tst_bool_expr.h"
static const char *kconfig_path(char *path_buf, size_t path_buf_len)
{
@@ -54,7 +52,7 @@ static char is_gzip;
static FILE *open_kconfig(void)
{
FILE *fp;
- char buf[1064];
+ char buf[1024];
char path_buf[1024];
const char *path = kconfig_path(path_buf, sizeof(path_buf));
@@ -86,108 +84,126 @@ static void close_kconfig(FILE *fp)
fclose(fp);
}
-static inline int kconfig_parse_line(const char *line,
- struct tst_kconfig_var *vars,
- unsigned int vars_len)
+struct match {
+ /* match len, string length up to \0 or = */
+ size_t len;
+ /* if set part of conf string after = */
+ const char *val;
+ /* if set the config option was matched already */
+ int match;
+};
+
+static int is_set(const char *str, const char *val)
{
- unsigned int i, var_len = 0;
- const char *var;
- int is_not_set = 0;
+ size_t vlen = strlen(val);
- while (isspace(*line))
- line++;
+ while (isspace(*str))
+ str++;
- if (*line == '#') {
- if (!strstr(line, "is not set"))
- return 0;
+ if (strncmp(str, val, vlen))
+ return 0;
- is_not_set = 1;
+ switch (str[vlen]) {
+ case ' ':
+ case '\n':
+ case '\0':
+ return 1;
+ break;
+ default:
+ return 0;
}
+}
- var = strstr(line, "CONFIG_");
+static inline int match(struct match *match, const char *conf,
+ struct tst_kconfig_res *result, const char *line)
+{
+ if (match->match)
+ return 0;
+
+ const char *cfg = strstr(line, "CONFIG_");
- if (!var)
+ if (!cfg)
return 0;
- for (;;) {
- switch (var[var_len]) {
- case 'A' ... 'Z':
- case '0' ... '9':
- case '_':
- var_len++;
- break;
- default:
- goto out;
+ if (strncmp(cfg, conf, match->len))
+ return 0;
+
+ const char *val = &cfg[match->len];
+
+ switch (cfg[match->len]) {
+ case '=':
break;
+ case ' ':
+ if (is_set(val, "is not set")) {
+ result->match = 'n';
+ goto match;
}
+ /* fall through */
+ default:
+ return 0;
}
-out:
-
- for (i = 0; i < vars_len; i++) {
- const char *val;
- unsigned int val_len = 0;
-
- if (vars[i].id_len != var_len)
- continue;
+ if (is_set(val, "=y")) {
+ result->match = 'y';
+ goto match;
+ }
- if (strncmp(vars[i].id, var, var_len))
- continue;
+ if (is_set(val, "=m")) {
+ result->match = 'm';
+ goto match;
+ }
- if (is_not_set) {
- vars[i].choice = 'n';
- return 1;
- }
+ result->match = 'v';
+ result->value = strndup(val+1, strlen(val)-2);
- val = var + var_len;
+match:
+ match->match = 1;
+ return 1;
+}
- while (isspace(*val))
- val++;
+void tst_kconfig_read(const char *const *kconfigs,
+ struct tst_kconfig_res results[], size_t cnt)
+{
+ struct match matches[cnt];
+ FILE *fp;
+ unsigned int i, j;
+ char buf[1024];
- if (*val != '=')
- return 0;
+ for (i = 0; i < cnt; i++) {
+ const char *val = strchr(kconfigs[i], '=');
- val++;
+ if (strncmp("CONFIG_", kconfigs[i], 7))
+ tst_brk(TBROK, "Invalid config string '%s'", kconfigs[i]);
- while (isspace(*val))
- val++;
+ matches[i].match = 0;
+ matches[i].len = strlen(kconfigs[i]);
- while (!isspace(val[val_len]))
- val_len++;
-
- if (val_len == 1) {
- switch (val[0]) {
- case 'y':
- vars[i].choice = 'y';
- return 1;
- case 'm':
- vars[i].choice = 'm';
- return 1;
- }
+ if (val) {
+ matches[i].val = val + 1;
+ matches[i].len -= strlen(val);
}
- vars[i].choice = 'v';
- vars[i].val = strndup(val, val_len);
+ results[i].match = 0;
+ results[i].value = NULL;
}
- return 0;
-}
-
-void tst_kconfig_read(struct tst_kconfig_var vars[], size_t vars_len)
-{
- char line[128];
- unsigned int vars_found = 0;
-
- FILE *fp = open_kconfig();
+ fp = open_kconfig();
if (!fp)
tst_brk(TBROK, "Cannot parse kernel .config");
- while (fgets(line, sizeof(line), fp)) {
- if (kconfig_parse_line(line, vars, vars_len))
- vars_found++;
+ while (fgets(buf, sizeof(buf), fp)) {
+ for (i = 0; i < cnt; i++) {
+ if (match(&matches[i], kconfigs[i], &results[i], buf)) {
+ for (j = 0; j < cnt; j++) {
+ if (matches[j].match)
+ break;
+ }
+
+ if (j == cnt)
+ goto exit;
+ }
+ }
- if (vars_found == vars_len)
- goto exit;
}
exit:
@@ -203,333 +219,67 @@ static size_t array_len(const char *const kconfigs[])
return i;
}
-static const char *strnchr(const char *s, int c, unsigned int len)
-{
- unsigned int i;
-
- for (i = 0; i < len; i++) {
- if (s[i] == c)
- return s + i;
- }
-
- return NULL;
-}
-
-static inline unsigned int get_len(const char* kconfig, unsigned int len)
+static int compare_res(struct tst_kconfig_res *res, const char *kconfig,
+ char match, const char *val)
{
- const char *sep = strnchr(kconfig, '=', len);
-
- if (!sep)
- return len;
-
- return sep - kconfig;
-}
-
-static void print_err(FILE *f, const struct tst_expr_tok *var,
- size_t spaces, const char *err)
-{
- size_t i;
-
- for (i = 0; i < var->tok_len; i++)
- fputc(var->tok[i], f);
-
- fputc('\n', f);
-
- while (spaces--)
- fputc(' ', f);
-
- fprintf(f, "^\n%s\n\n", err);
-}
-
-static int validate_var(const struct tst_expr_tok *var)
-{
- size_t i = 7;
-
- if (var->tok_len < 7 || strncmp(var->tok, "CONFIG_", 7)) {
- print_err(stderr, var, 0, "Expected CONFIG_ prefix");
- return 1;
- }
-
- while (var->tok[i]) {
- char c;
-
- if (i >= var->tok_len)
- return 0;
-
- c = var->tok[i];
-
- if ((c >= 'A' && c <= 'Z') || c == '_') {
- i++;
- continue;
- }
-
- if (c >= '0' && c <= '9') {
- i++;
- continue;
- }
-
- if (c == '=') {
- i++;
- break;
- }
-
- print_err(stderr, var, i, "Unexpected character in variable name");
+ if (res->match != match) {
+ tst_res(TINFO, "Needs kernel %s, have %c", kconfig, res->match);
return 1;
}
- if (i >= var->tok_len) {
-
- if (var->tok[i-1] == '=') {
- print_err(stderr, var, i, "Missing value");
- return -1;
- }
-
+ if (match != 'v')
return 0;
- }
-
- if (var->tok[i] == '"') {
- do {
- i++;
- } while (i < var->tok_len && var->tok[i] != '"');
- if (i < var->tok_len - 1) {
- print_err(stderr, var, i, "Garbage after a string");
- return 1;
- }
-
- if (var->tok[i] != '"') {
- print_err(stderr, var, i, "Untermianted string");
- return 1;
- }
-
- return 0;
- }
-
- do {
- i++;
- } while (i < var->tok_len && isalnum(var->tok[i]));
-
- if (i < var->tok_len) {
- print_err(stderr, var, i, "Invalid character in variable value");
+ if (strcmp(res->value, val)) {
+ tst_res(TINFO, "Needs kernel %s, have %s", kconfig, res->value);
return 1;
}
return 0;
}
-static int validate_vars(struct tst_expr *const exprs[], unsigned int expr_cnt)
-{
- unsigned int i;
- const struct tst_expr_tok *j;
- unsigned int ret = 0;
-
- for (i = 0; i < expr_cnt; i++) {
- for (j = exprs[i]->rpn; j; j = j->next) {
- if (j->op == TST_OP_VAR)
- ret |= validate_var(j);
- }
- }
-
- return ret;
-}
-
-
-static inline unsigned int get_var_cnt(struct tst_expr *const exprs[],
- unsigned int expr_cnt)
-{
- unsigned int i;
- const struct tst_expr_tok *j;
- unsigned int cnt = 0;
-
- for (i = 0; i < expr_cnt; i++) {
- for (j = exprs[i]->rpn; j; j = j->next) {
- if (j->op == TST_OP_VAR)
- cnt++;
- }
- }
-
- return cnt;
-}
-
-static const struct tst_kconfig_var *find_var(const struct tst_kconfig_var vars[],
- unsigned int var_cnt,
- const char *var)
-{
- unsigned int i;
-
- for (i = 0; i < var_cnt; i++) {
- if (!strcmp(vars[i].id, var))
- return &vars[i];
- }
-
- return NULL;
-}
-
-/*
- * Fill in the kconfig variables array from the expressions. Also makes sure
- * that each variable is copied to the array exaclty once.
- */
-static inline unsigned int populate_vars(struct tst_expr *exprs[],
- unsigned int expr_cnt,
- struct tst_kconfig_var vars[])
+void tst_kconfig_check(const char *const kconfigs[])
{
+ size_t cnt = array_len(kconfigs);
+ struct tst_kconfig_res results[cnt];
unsigned int i;
- struct tst_expr_tok *j;
- unsigned int cnt = 0;
-
- for (i = 0; i < expr_cnt; i++) {
- for (j = exprs[i]->rpn; j; j = j->next) {
- const struct tst_kconfig_var *var;
-
- if (j->op != TST_OP_VAR)
- continue;
-
- vars[cnt].id_len = get_len(j->tok, j->tok_len);
-
- if (vars[cnt].id_len + 1 >= sizeof(vars[cnt].id))
- tst_brk(TBROK, "kconfig var id too long!");
-
- strncpy(vars[cnt].id, j->tok, vars[cnt].id_len);
- vars[cnt].id[vars[cnt].id_len] = 0;
- vars[cnt].choice = 0;
-
- var = find_var(vars, cnt, vars[cnt].id);
-
- if (var)
- j->priv = var;
- else
- j->priv = &vars[cnt++];
- }
- }
-
- return cnt;
-}
-
-static int map(struct tst_expr_tok *expr)
-{
- const struct tst_kconfig_var *var = expr->priv;
-
- if (var->choice == 0)
- return 0;
-
- const char *val = strnchr(expr->tok, '=', expr->tok_len);
-
- /* CONFIG_FOO evaluates to true if y or m */
- if (!val)
- return var->choice == 'y' || var->choice == 'm';
-
- val++;
-
- unsigned int len = expr->tok_len - (val - expr->tok);
- char choice = 'v';
-
- if (!strncmp(val, "n", len))
- choice = 'n';
-
- if (!strncmp(val, "y", len))
- choice = 'y';
-
- if (!strncmp(val, "m", len))
- choice = 'm';
-
- if (choice != 'v')
- return var->choice == choice;
-
- if (strlen(var->val) != len)
- return 0;
-
- return !strncmp(val, var->val, len);
-}
-
-static void dump_vars(const struct tst_expr *expr)
-{
- const struct tst_expr_tok *i;
- const struct tst_kconfig_var *var;
-
- tst_res(TINFO, "Variables:");
-
- for (i = expr->rpn; i; i = i->next) {
- if (i->op != TST_OP_VAR)
- continue;
+ int abort_test = 0;
- var = i->priv;
+ tst_kconfig_read(kconfigs, results, cnt);
- if (!var->choice) {
- tst_res(TINFO, " %s Undefined", var->id);
+ for (i = 0; i < cnt; i++) {
+ if (results[i].match == 0) {
+ tst_res(TINFO, "Missing kernel %s", kconfigs[i]);
+ abort_test = 1;
continue;
}
- if (var->choice == 'v') {
- tst_res(TINFO, " %s=%s", var->id, var->val);
+ if (results[i].match == 'n') {
+ tst_res(TINFO, "Kernel %s is not set", kconfigs[i]);
+ abort_test = 1;
continue;
}
- tst_res(TINFO, " %s=%c", var->id, var->choice);
- }
-}
-
-void tst_kconfig_check(const char *const kconfigs[])
-{
- size_t expr_cnt = array_len(kconfigs);
- struct tst_expr *exprs[expr_cnt];
- unsigned int i, var_cnt;
- int abort_test = 0;
-
- for (i = 0; i < expr_cnt; i++) {
- exprs[i] = tst_bool_expr_parse(kconfigs[i]);
+ const char *val = strchr(kconfigs[i], '=');
- if (!exprs[i])
- tst_brk(TBROK, "Invalid kconfig expression!");
- }
-
- if (validate_vars(exprs, expr_cnt))
- tst_brk(TBROK, "Invalid kconfig variables!");
-
- var_cnt = get_var_cnt(exprs, expr_cnt);
- struct tst_kconfig_var vars[var_cnt];
+ if (val) {
+ char match = 'v';
+ val++;
- var_cnt = populate_vars(exprs, expr_cnt, vars);
+ if (!strcmp(val, "y"))
+ match = 'y';
- tst_kconfig_read(vars, var_cnt);
+ if (!strcmp(val, "m"))
+ match = 'm';
- for (i = 0; i < expr_cnt; i++) {
- int val = tst_bool_expr_eval(exprs[i], map);
+ if (compare_res(&results[i], kconfigs[i], match, val))
+ abort_test = 1;
- if (val != 1) {
- abort_test = 1;
- tst_res(TINFO, "Constrain '%s' not satisfied!", kconfigs[i]);
- dump_vars(exprs[i]);
}
- tst_bool_expr_free(exprs[i]);
- }
-
- for (i = 0; i < var_cnt; i++) {
- if (vars[i].choice == 'v')
- free(vars[i].val);
+ free(results[i].value);
}
if (abort_test)
tst_brk(TCONF, "Aborting due to unsuitable kernel config, see above!");
}
-
-char tst_kconfig_get(const char *confname)
-{
- struct tst_kconfig_var var;
-
- var.id_len = strlen(confname);
-
- if (var.id_len >= sizeof(var.id))
- tst_brk(TBROK, "Kconfig var name \"%s\" too long", confname);
-
- strcpy(var.id, confname);
- var.choice = 0;
- var.val = NULL;
-
- tst_kconfig_read(&var, 1);
-
- if (var.choice == 'v')
- free(var.val);
-
- return var.choice;
-}
diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
index c908bb04c..73ab9f1b1 100644
--- a/lib/tst_kernel.c
+++ b/lib/tst_kernel.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) 2020-2021 Petr Vorel <pvorel@suse.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,11 +17,8 @@
#include <sys/personality.h>
#include <sys/utsname.h>
-#include <limits.h>
-
#include "test.h"
#include "tst_kernel.h"
-#include "old_safe_stdio.h"
static int get_kernel_bits_from_uname(struct utsname *buf)
{
@@ -85,97 +81,19 @@ int tst_kernel_bits(void)
return kernel_bits;
}
-static int tst_search_driver(const char *driver, const char *file)
+int tst_check_driver(const char *name)
{
- struct stat st;
- char buf[PATH_MAX];
- char *path = NULL, *search = NULL, *sep = NULL;
- FILE *f;
- int ret = -1;
-
- struct utsname uts;
-
- if (uname(&uts)) {
- tst_brkm(TBROK | TERRNO, NULL, "uname() failed");
- return -1;
- }
- SAFE_ASPRINTF(NULL, &path, "/lib/modules/%s/%s", uts.release, file);
-
- if (stat(path, &st) || !(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))) {
- tst_resm(TWARN, "expected file %s does not exist or not a file", path);
- return -1;
- }
-
- if (access(path, R_OK)) {
- tst_resm(TWARN, "file %s cannot be read", path);
- return -1;
- }
-
- SAFE_ASPRINTF(NULL, &search, "/%s.ko", driver);
-
- f = SAFE_FOPEN(NULL, path, "r");
-
- while (fgets(buf, sizeof(buf), f)) {
- /* cut dependencies after : */
- if ((sep = strchr(buf, ':')))
- *sep = 0;
-
- /* driver found */
- if (strstr(buf, search) != NULL) {
- ret = 0;
- break;
- }
- }
-
- SAFE_FCLOSE(NULL, f);
- free(search);
- free(path);
-
- return ret;
-}
-
-static int tst_check_driver_(const char *driver)
-{
- if (!tst_search_driver(driver, "modules.dep") ||
- !tst_search_driver(driver, "modules.builtin"))
- return 0;
-
- return -1;
-}
-
-int tst_check_driver(const char *driver)
-{
-#ifdef __ANDROID__
- /*
- * Android may not have properly installed modules.* files. We could
- * search modules in /system/lib/modules, but to to determine built-in
- * drivers we need modules.builtin. Therefore assume all drivers are
- * available.
+#ifndef __ANDROID__
+ const char * const argv[] = { "modprobe", "-n", name, NULL };
+ int res = tst_run_cmd_(NULL, argv, "/dev/null", "/dev/null", 1);
+
+ /* 255 - it looks like modprobe not available */
+ return (res == 255) ? 0 : res;
+#else
+ /* Android modprobe may not have '-n', or properly installed
+ * module.*.bin files to determine built-in drivers. Assume
+ * all drivers are available.
*/
return 0;
#endif
-
- if (!tst_check_driver_(driver))
- return 0;
-
- int ret = -1;
-
- if (strrchr(driver, '-') || strrchr(driver, '_')) {
- char *driver2 = strdup(driver);
- char *ix = driver2;
- char find = '-', replace = '_';
-
- if (strrchr(driver, '_')) {
- find = '_';
- replace = '-';
- }
-
- while ((ix = strchr(ix, find)))
- *ix++ = replace;
-
- ret = tst_check_driver_(driver2);
- free(driver2);
- }
-
- return ret;
}
diff --git a/lib/tst_kvercmp.c b/lib/tst_kvercmp.c
index 8bf65d309..dc3bb669b 100644
--- a/lib/tst_kvercmp.c
+++ b/lib/tst_kvercmp.c
@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -26,8 +25,6 @@
#include <sys/utsname.h>
#include "test.h"
-#define OSRELEASE_PATH "/etc/os-release"
-
static char *parse_digit(const char *str, int *d)
{
unsigned long v;
@@ -130,10 +127,6 @@ int tst_kvexcmp(const char *tst_exv, const char *cur_ver)
const char *tst_kvcmp_distname(const char *kver)
{
- static char distname[64];
- char *ret = distname;
- char *p = distname;
-
if (strstr(kver, ".el5uek"))
return "OL5UEK";
@@ -146,32 +139,6 @@ const char *tst_kvcmp_distname(const char *kver)
if (strstr(kver, ".el6"))
return "RHEL6";
- if (strstr(kver, ".el7"))
- return "RHEL7";
-
- if (strstr(kver, ".el8"))
- return "RHEL8";
-
- if (access(OSRELEASE_PATH, F_OK) != -1) {
- SAFE_FILE_LINES_SCANF(NULL, OSRELEASE_PATH, "ID=%s", distname);
-
- if (p[0] == '"') {
- ret = distname + 1;
- p = ret;
- }
-
- while (*p) {
- if (*p == '"') {
- *p = 0;
- break;
- }
- *p = toupper((unsigned char)*p);
- p++;
- }
-
- return ret;
- }
-
return NULL;
}
diff --git a/lib/tst_lockdown.c b/lib/tst_lockdown.c
deleted file mode 100644
index 26a57b6a1..000000000
--- a/lib/tst_lockdown.c
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#define TST_NO_DEFAULT_MAIN
-
-#define PATH_LOCKDOWN "/sys/kernel/security/lockdown"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mount.h>
-
-#include "tst_test.h"
-#include "tst_safe_macros.h"
-#include "tst_safe_stdio.h"
-#include "tst_lockdown.h"
-#include "tst_private.h"
-
-#define EFIVAR_SECUREBOOT "/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c"
-
-int tst_secureboot_enabled(void)
-{
- int fd;
- char data[5];
-
- if (access(EFIVAR_SECUREBOOT, F_OK)) {
- tst_res(TINFO, "Efivar FS not available");
- return -1;
- }
-
- fd = open(EFIVAR_SECUREBOOT, O_RDONLY);
-
- if (fd == -1) {
- tst_res(TINFO | TERRNO,
- "Cannot open SecureBoot Efivar sysfile");
- return -1;
- } else if (fd < 0) {
- tst_brk(TBROK | TERRNO, "Invalid open() return value %d", fd);
- return -1;
- }
-
- SAFE_READ(1, fd, data, 5);
- SAFE_CLOSE(fd);
- tst_res(TINFO, "SecureBoot: %s", data[4] ? "on" : "off");
- return data[4];
-}
-
-int tst_lockdown_enabled(void)
-{
- char line[BUFSIZ];
- FILE *file;
-
- if (access(PATH_LOCKDOWN, F_OK) != 0) {
- char flag;
-
- flag = tst_kconfig_get("CONFIG_EFI_SECURE_BOOT_LOCK_DOWN");
-
- /* SecureBoot enabled could mean integrity lockdown */
- if (flag == 'y' && tst_secureboot_enabled() > 0)
- return 1;
-
- tst_res(TINFO, "Unable to determine system lockdown state");
- return 0;
- }
-
- file = SAFE_FOPEN(PATH_LOCKDOWN, "r");
- if (!fgets(line, sizeof(line), file))
- tst_brk(TBROK | TERRNO, "fgets %s", PATH_LOCKDOWN);
- SAFE_FCLOSE(file);
-
- return (strstr(line, "[none]") == NULL);
-}
diff --git a/lib/tst_memutils.c b/lib/tst_memutils.c
deleted file mode 100644
index dd09db490..000000000
--- a/lib/tst_memutils.c
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-#include <unistd.h>
-#include <limits.h>
-#include <sys/sysinfo.h>
-#include <stdlib.h>
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-
-#define BLOCKSIZE (16 * 1024 * 1024)
-
-void tst_pollute_memory(size_t maxsize, int fillchar)
-{
- size_t i, map_count = 0, safety = 0, blocksize = BLOCKSIZE;
- void **map_blocks;
- struct sysinfo info;
-
- SAFE_SYSINFO(&info);
- safety = MAX(4096 * SAFE_SYSCONF(_SC_PAGESIZE), 128 * 1024 * 1024);
- safety /= info.mem_unit;
-
- if (info.freeswap > safety)
- safety = 0;
-
- /* Not enough free memory to avoid invoking OOM killer */
- if (info.freeram <= safety)
- return;
-
- if (!maxsize)
- maxsize = SIZE_MAX;
-
- if (info.freeram - safety < maxsize / info.mem_unit)
- maxsize = (info.freeram - safety) * info.mem_unit;
-
- blocksize = MIN(maxsize, blocksize);
- map_count = maxsize / blocksize;
- map_blocks = SAFE_MALLOC(map_count * sizeof(void *));
-
- /*
- * Keep allocating until the first failure. The address space may be
- * too fragmented or just smaller than maxsize.
- */
- for (i = 0; i < map_count; i++) {
- map_blocks[i] = mmap(NULL, blocksize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
- if (map_blocks[i] == MAP_FAILED) {
- map_count = i;
- break;
- }
-
- memset(map_blocks[i], fillchar, blocksize);
- }
-
- for (i = 0; i < map_count; i++)
- SAFE_MUNMAP(map_blocks[i], blocksize);
-
- free(map_blocks);
-}
diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index 736324f04..5d208eceb 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -33,20 +33,14 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
char extra_opts_str[1024] = "";
if (!dev) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "No device specified");
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: No device specified", file, lineno);
return;
}
if (!fs_type) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "No fs_type specified");
- return;
- }
-
- if (!strcmp(fs_type, "tmpfs")) {
- tst_resm_(file, lineno, TINFO,
- "Skipping mkfs for TMPFS filesystem");
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: No fs_type specified", file, lineno);
return;
}
@@ -57,8 +51,9 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
argv[pos++] = fs_opts[i];
if (pos + 2 > OPTS_MAX) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Too many mkfs options");
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: Too much mkfs options",
+ file, lineno);
return;
}
@@ -75,8 +70,8 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
argv[pos++] = extra_opts[i];
if (pos + 1 > OPTS_MAX) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Too many mkfs options");
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: Too much mkfs options", file, lineno);
return;
}
@@ -88,27 +83,22 @@ void tst_mkfs_(const char *file, const int lineno, void (cleanup_fn)(void),
argv[pos] = NULL;
- if (tst_clear_device(dev)) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "tst_clear_device() failed");
- }
+ if (tst_clear_device(dev))
+ tst_brkm(TBROK, cleanup_fn, "tst_clear_device() failed");
- tst_resm_(file, lineno, TINFO,
- "Formatting %s with %s opts='%s' extra opts='%s'",
- dev, fs_type, fs_opts_str, extra_opts_str);
- ret = tst_cmd(cleanup_fn, argv, "/dev/null", NULL, TST_CMD_PASS_RETVAL |
- TST_CMD_TCONF_ON_MISSING);
+ tst_resm(TINFO, "Formatting %s with %s opts='%s' extra opts='%s'",
+ dev, fs_type, fs_opts_str, extra_opts_str);
+ ret = tst_run_cmd(cleanup_fn, argv, "/dev/null", NULL, 1);
switch (ret) {
case 0:
break;
case 255:
- tst_brkm_(file, lineno, TCONF, cleanup_fn,
- "%s not found in $PATH", mkfs);
- break;
+ tst_brkm(TCONF, cleanup_fn,
+ "%s:%d: %s not found in $PATH", file, lineno, mkfs);
default:
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "%s failed with exit code %i", mkfs, ret);
+ tst_brkm(TBROK, cleanup_fn,
+ "%s:%d: %s failed with %i", file, lineno, mkfs, ret);
}
}
diff --git a/lib/tst_module.c b/lib/tst_module.c
index 9bd443623..ed39952ee 100644
--- a/lib/tst_module.c
+++ b/lib/tst_module.c
@@ -28,7 +28,7 @@
#include "ltp_priv.h"
#include "old_module.h"
-void tst_module_exists_(void (cleanup_fn)(void),
+void tst_module_exists(void (cleanup_fn)(void),
const char *mod_name, char **mod_path)
{
/* check current working directory */
@@ -77,11 +77,11 @@ void tst_module_exists_(void (cleanup_fn)(void),
free(buf);
}
-void tst_module_load_(void (cleanup_fn)(void),
+void tst_module_load(void (cleanup_fn)(void),
const char *mod_name, char *const argv[])
{
char *mod_path = NULL;
- tst_module_exists_(cleanup_fn, mod_name, &mod_path);
+ tst_module_exists(cleanup_fn, mod_name, &mod_path);
const int offset = 2; /* command name & module path */
int size = 0;
@@ -97,11 +97,11 @@ void tst_module_load_(void (cleanup_fn)(void),
for (i = offset; i < size; ++i)
mod_argv[i] = argv[i - offset];
- tst_cmd(cleanup_fn, mod_argv, NULL, NULL, 0);
+ tst_run_cmd(cleanup_fn, mod_argv, NULL, NULL, 0);
free(mod_path);
}
-void tst_module_unload_(void (cleanup_fn)(void), const char *mod_name)
+void tst_module_unload(void (cleanup_fn)(void), const char *mod_name)
{
int i, rc;
@@ -109,8 +109,7 @@ void tst_module_unload_(void (cleanup_fn)(void), const char *mod_name)
rc = 1;
for (i = 0; i < 50; i++) {
- rc = tst_cmd(NULL, argv, "/dev/null", "/dev/null",
- TST_CMD_PASS_RETVAL);
+ rc = tst_run_cmd(NULL, argv, "/dev/null", "/dev/null", 1);
if (!rc)
break;
diff --git a/lib/tst_net.c b/lib/tst_net.c
deleted file mode 100644
index de343bb39..000000000
--- a/lib/tst_net.c
+++ /dev/null
@@ -1,222 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
- * Copyright (c) 2019 Martin Doucha <mdoucha@suse.cz>
- */
-
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "tst_net.h"
-#include "tst_private.h"
-
-void tst_print_svar(const char *name, const char *val)
-{
- if (name && val)
- printf("export %s=\"%s\"\n", name, val);
-}
-
-void tst_print_svar_change(const char *name, const char *val)
-{
- if (name && val)
- printf("export %s=\"${%s:-%s}\"\n", name, name, val);
-}
-
-/*
- * Function bit_count is from ipcalc project, ipcalc.c.
- */
-static int tst_bit_count(uint32_t i)
-{
- int c = 0;
- unsigned int seen_one = 0;
-
- while (i > 0) {
- if (i & 1) {
- seen_one = 1;
- c++;
- } else {
- if (seen_one)
- return -1;
- }
- i >>= 1;
- }
-
- return c;
-}
-
-/*
- * Function mask2prefix is from ipcalc project, ipcalc.c.
- */
-static int tst_mask2prefix(struct in_addr mask)
-{
- return tst_bit_count(ntohl(mask.s_addr));
-}
-
-/*
- * Function ipv4_mask_to_int is from ipcalc project, ipcalc.c.
- */
-static int tst_ipv4_mask_to_int(const char *prefix)
-{
- int ret;
- struct in_addr in;
-
- ret = inet_pton(AF_INET, prefix, &in);
- if (ret == 0)
- return -1;
-
- return tst_mask2prefix(in);
-}
-
-/*
- * Function safe_atoi is from ipcalc project, ipcalc.c.
- */
-static int tst_safe_atoi(const char *s, int *ret_i)
-{
- char *x = NULL;
- long l;
-
- errno = 0;
- l = strtol(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno > 0 ? -errno : -EINVAL;
-
- if ((long)(int)l != l)
- return -ERANGE;
-
- *ret_i = (int)l;
-
- return 0;
-}
-
-/*
- * Function get_prefix use code from ipcalc project, str_to_prefix/ipcalc.c.
- */
-int tst_get_prefix(const char *ip_str, int is_ipv6)
-{
- char *prefix_str = NULL;
- int prefix = -1, r;
-
- prefix_str = strchr(ip_str, '/');
- if (!prefix_str)
- return -1;
-
- *(prefix_str++) = '\0';
-
- if (!is_ipv6 && strchr(prefix_str, '.'))
- prefix = tst_ipv4_mask_to_int(prefix_str);
- else {
- r = tst_safe_atoi(prefix_str, &prefix);
- if (r != 0)
- tst_brk_comment("conversion error: '%s' is not integer",
- prefix_str);
- }
-
- if (prefix < 0 || ((is_ipv6 && prefix > MAX_IPV6_PREFIX) ||
- (!is_ipv6 && prefix > MAX_IPV4_PREFIX)))
- tst_brk_comment("bad %s prefix: %s", is_ipv6 ? "IPv6" : "IPv4",
- prefix_str);
-
- return prefix;
-}
-
-void tst_get_in_addr(const char *ip_str, struct in_addr *ip)
-{
- if (inet_pton(AF_INET, ip_str, ip) <= 0)
- tst_brk_comment("bad IPv4 address: '%s'", ip_str);
-}
-
-void tst_get_in6_addr(const char *ip_str, struct in6_addr *ip6)
-{
- if (inet_pton(AF_INET6, ip_str, ip6) <= 0)
- tst_brk_comment("bad IPv6 address: '%s'", ip_str);
-}
-
-socklen_t tst_get_connect_address(int sock, struct sockaddr_storage *addr)
-{
- struct sockaddr_in *inet_ptr;
- struct sockaddr_in6 *inet6_ptr;
- size_t tmp_size;
- socklen_t ret = sizeof(*addr);
-
- SAFE_GETSOCKNAME(sock, (struct sockaddr*)addr, &ret);
-
- /* Sanitize wildcard addresses */
- switch (addr->ss_family) {
- case AF_INET:
- inet_ptr = (struct sockaddr_in*)addr;
-
- switch (ntohl(inet_ptr->sin_addr.s_addr)) {
- case INADDR_ANY:
- case INADDR_BROADCAST:
- inet_ptr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- break;
- }
-
- break;
-
- case AF_INET6:
- inet6_ptr = (struct sockaddr_in6*)addr;
- tmp_size = sizeof(struct in6_addr);
-
- if (!memcmp(&inet6_ptr->sin6_addr, &in6addr_any, tmp_size)) {
- memcpy(&inet6_ptr->sin6_addr, &in6addr_loopback,
- tmp_size);
- }
-
- break;
- }
-
- return ret;
-}
-
-void tst_init_sockaddr_inet(struct sockaddr_in *sa, const char *ip_str, uint16_t port)
-{
- memset(sa, 0, sizeof(struct sockaddr_in));
- sa->sin_family = AF_INET;
- sa->sin_port = htons(port);
- tst_get_in_addr(ip_str, &sa->sin_addr);
-}
-
-void tst_init_sockaddr_inet_bin(struct sockaddr_in *sa, uint32_t ip_val, uint16_t port)
-{
- memset(sa, 0, sizeof(struct sockaddr_in));
- sa->sin_family = AF_INET;
- sa->sin_port = htons(port);
- sa->sin_addr.s_addr = htonl(ip_val);
-}
-
-void tst_init_sockaddr_inet6(struct sockaddr_in6 *sa, const char *ip_str, uint16_t port)
-{
- memset(sa, 0, sizeof(struct sockaddr_in6));
- sa->sin6_family = AF_INET6;
- sa->sin6_port = htons(port);
- tst_get_in6_addr(ip_str, &sa->sin6_addr);
-}
-
-void tst_init_sockaddr_inet6_bin(struct sockaddr_in6 *sa, const struct in6_addr *ip_val, uint16_t port)
-{
- memset(sa, 0, sizeof(struct sockaddr_in6));
- sa->sin6_family = AF_INET6;
- sa->sin6_port = htons(port);
- memcpy(&sa->sin6_addr, ip_val, sizeof(struct in6_addr));
-}
-
-void safe_getaddrinfo(const char *file, const int lineno, const char *src_addr,
- const char *port, const struct addrinfo *hints,
- struct addrinfo **addr_info)
-{
- int err = getaddrinfo(src_addr, port, hints, addr_info);
-
- if (err) {
- tst_brk_(file, lineno, TBROK, "getaddrinfo failed, %s",
- gai_strerror(err));
- }
-
- if (!*addr_info)
- tst_brk_(file, lineno, TBROK, "failed to get the address");
-}
diff --git a/lib/tst_netdevice.c b/lib/tst_netdevice.c
deleted file mode 100644
index d098173d5..000000000
--- a/lib/tst_netdevice.c
+++ /dev/null
@@ -1,466 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Linux Test Project
- */
-
-#include <asm/types.h>
-#include <linux/netlink.h>
-#include <linux/veth.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include "lapi/rtnetlink.h"
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "tst_rtnetlink.h"
-#include "tst_netdevice.h"
-
-static struct tst_rtnl_context *create_request(const char *file,
- const int lineno, unsigned int type, unsigned int flags,
- const void *payload, size_t psize)
-{
- struct tst_rtnl_context *ctx;
- struct nlmsghdr header = {
- .nlmsg_type = type,
- .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags,
- };
-
- ctx = tst_rtnl_create_context(file, lineno);
-
- if (!ctx)
- return NULL;
-
- if (!tst_rtnl_add_message(file, lineno, ctx, &header, payload, psize)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return NULL;
- }
-
- return ctx;
-}
-
-int tst_netdev_index_by_name(const char *file, const int lineno,
- const char *ifname)
-{
- struct ifreq ifr;
- int sock, ret;
-
- if (strlen(ifname) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname);
- return -1;
- }
-
- sock = safe_socket(file, lineno, NULL, AF_INET, SOCK_DGRAM, 0);
-
- if (sock < 0)
- return -1;
-
- strcpy(ifr.ifr_name, ifname);
- ret = SAFE_IOCTL_(file, lineno, sock, SIOCGIFINDEX, &ifr);
- safe_close(file, lineno, NULL, sock);
-
- return ret ? -1 : ifr.ifr_ifindex;
-}
-
-int tst_netdev_set_state(const char *file, const int lineno,
- const char *ifname, int up)
-{
- struct ifreq ifr;
- int sock, ret;
-
- if (strlen(ifname) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname);
- return -1;
- }
-
- sock = safe_socket(file, lineno, NULL, AF_INET, SOCK_DGRAM, 0);
-
- if (sock < 0)
- return -1;
-
- strcpy(ifr.ifr_name, ifname);
- ret = SAFE_IOCTL_(file, lineno, sock, SIOCGIFFLAGS, &ifr);
-
- if (ret) {
- safe_close(file, lineno, NULL, sock);
- return ret;
- }
-
- if (up)
- ifr.ifr_flags |= IFF_UP;
- else
- ifr.ifr_flags &= ~IFF_UP;
-
- ret = SAFE_IOCTL_(file, lineno, sock, SIOCSIFFLAGS, &ifr);
- safe_close(file, lineno, NULL, sock);
-
- return ret;
-}
-
-int tst_create_veth_pair(const char *file, const int lineno,
- const char *ifname1, const char *ifname2)
-{
- int ret;
- struct ifinfomsg info = { .ifi_family = AF_UNSPEC };
- struct tst_rtnl_context *ctx;
- struct tst_rtnl_attr_list peerinfo[] = {
- {IFLA_IFNAME, ifname2, strlen(ifname2) + 1, NULL},
- {0, NULL, -1, NULL}
- };
- struct tst_rtnl_attr_list peerdata[] = {
- {VETH_INFO_PEER, &info, sizeof(info), peerinfo},
- {0, NULL, -1, NULL}
- };
- struct tst_rtnl_attr_list attrs[] = {
- {IFLA_IFNAME, ifname1, strlen(ifname1) + 1, NULL},
- {IFLA_LINKINFO, NULL, 0, (const struct tst_rtnl_attr_list[]){
- {IFLA_INFO_KIND, "veth", 4, NULL},
- {IFLA_INFO_DATA, NULL, 0, peerdata},
- {0, NULL, -1, NULL}
- }},
- {0, NULL, -1, NULL}
- };
-
- if (strlen(ifname1) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname1);
- return 0;
- }
-
- if (strlen(ifname2) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname2);
- return 0;
- }
-
- ctx = create_request(file, lineno, RTM_NEWLINK,
- NLM_F_CREATE | NLM_F_EXCL, &info, sizeof(info));
-
- if (!ctx)
- return 0;
-
- if (tst_rtnl_add_attr_list(file, lineno, ctx, attrs) != 2) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- ret = tst_rtnl_send_validate(file, lineno, ctx);
- tst_rtnl_destroy_context(file, lineno, ctx);
-
- if (!ret) {
- tst_brk_(file, lineno, TBROK | TTERRNO,
- "Failed to create veth interfaces %s+%s", ifname1,
- ifname2);
- }
-
- return ret;
-}
-
-int tst_remove_netdev(const char *file, const int lineno, const char *ifname)
-{
- struct ifinfomsg info = { .ifi_family = AF_UNSPEC };
- struct tst_rtnl_context *ctx;
- int ret;
-
- if (strlen(ifname) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname);
- return 0;
- }
-
- ctx = create_request(file, lineno, RTM_DELLINK, 0, &info, sizeof(info));
-
- if (!ctx)
- return 0;
-
- if (!tst_rtnl_add_attr_string(file, lineno, ctx, IFLA_IFNAME, ifname)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- ret = tst_rtnl_send_validate(file, lineno, ctx);
- tst_rtnl_destroy_context(file, lineno, ctx);
-
- if (!ret) {
- tst_brk_(file, lineno, TBROK | TTERRNO,
- "Failed to remove netdevice %s", ifname);
- }
-
- return ret;
-}
-
-static int modify_address(const char *file, const int lineno,
- unsigned int action, unsigned int nl_flags, const char *ifname,
- unsigned int family, const void *address, unsigned int prefix,
- size_t addrlen, uint32_t addr_flags)
-{
- struct tst_rtnl_context *ctx;
- int index, ret;
- struct ifaddrmsg info = {
- .ifa_family = family,
- .ifa_prefixlen = prefix
- };
-
- index = tst_netdev_index_by_name(file, lineno, ifname);
-
- if (index < 0) {
- tst_brk_(file, lineno, TBROK, "Interface %s not found", ifname);
- return 0;
- }
-
- info.ifa_index = index;
- ctx = create_request(file, lineno, action, nl_flags, &info,
- sizeof(info));
-
- if (!ctx)
- return 0;
-
- if (!tst_rtnl_add_attr(file, lineno, ctx, IFA_FLAGS, &addr_flags,
- sizeof(uint32_t))) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- if (!tst_rtnl_add_attr(file, lineno, ctx, IFA_LOCAL, address,
- addrlen)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- ret = tst_rtnl_send_validate(file, lineno, ctx);
- tst_rtnl_destroy_context(file, lineno, ctx);
-
- if (!ret) {
- tst_brk_(file, lineno, TBROK | TTERRNO,
- "Failed to modify %s network address", ifname);
- }
-
- return ret;
-}
-
-int tst_netdev_add_address(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *address,
- unsigned int prefix, size_t addrlen, unsigned int flags)
-{
- return modify_address(file, lineno, RTM_NEWADDR,
- NLM_F_CREATE | NLM_F_EXCL, ifname, family, address, prefix,
- addrlen, flags);
-}
-
-int tst_netdev_add_address_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t address, unsigned int prefix,
- unsigned int flags)
-{
- return tst_netdev_add_address(file, lineno, ifname, AF_INET,
- &address, prefix, sizeof(address), flags);
-}
-
-int tst_netdev_remove_address(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *address,
- size_t addrlen)
-{
- return modify_address(file, lineno, RTM_DELADDR, 0, ifname, family,
- address, 0, addrlen, 0);
-}
-
-int tst_netdev_remove_address_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t address)
-{
- return tst_netdev_remove_address(file, lineno, ifname, AF_INET,
- &address, sizeof(address));
-}
-
-static int change_ns(const char *file, const int lineno, const char *ifname,
- unsigned short attr, uint32_t value)
-{
- struct ifinfomsg info = { .ifi_family = AF_UNSPEC };
- struct tst_rtnl_context *ctx;
- int ret;
-
- if (strlen(ifname) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname);
- return 0;
- }
-
- ctx = create_request(file, lineno, RTM_NEWLINK, 0, &info, sizeof(info));
-
- if (!tst_rtnl_add_attr_string(file, lineno, ctx, IFLA_IFNAME, ifname)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- if (!tst_rtnl_add_attr(file, lineno, ctx, attr, &value,
- sizeof(uint32_t))) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- ret = tst_rtnl_send_validate(file, lineno, ctx);
- tst_rtnl_destroy_context(file, lineno, ctx);
-
- if (!ret) {
- tst_brk_(file, lineno, TBROK | TTERRNO,
- "Failed to move %s to another namespace", ifname);
- }
-
- return ret;
-}
-
-int tst_netdev_change_ns_fd(const char *file, const int lineno,
- const char *ifname, int nsfd)
-{
- return change_ns(file, lineno, ifname, IFLA_NET_NS_FD, nsfd);
-}
-
-int tst_netdev_change_ns_pid(const char *file, const int lineno,
- const char *ifname, pid_t nspid)
-{
- return change_ns(file, lineno, ifname, IFLA_NET_NS_PID, nspid);
-}
-
-static int modify_route(const char *file, const int lineno, unsigned int action,
- unsigned int flags, const char *ifname, unsigned int family,
- const void *srcaddr, unsigned int srcprefix, size_t srclen,
- const void *dstaddr, unsigned int dstprefix, size_t dstlen,
- const void *gateway, size_t gatewaylen)
-{
- struct tst_rtnl_context *ctx;
- int ret;
- int32_t index;
- struct rtmsg info = {
- .rtm_family = family,
- .rtm_dst_len = dstprefix,
- .rtm_src_len = srcprefix,
- .rtm_table = RT_TABLE_MAIN,
- .rtm_protocol = RTPROT_STATIC,
- .rtm_type = RTN_UNICAST
- };
-
- if (!ifname && !gateway) {
- tst_brk_(file, lineno, TBROK,
- "Interface name or gateway address required");
- return 0;
- }
-
- if (ifname && strlen(ifname) >= IFNAMSIZ) {
- tst_brk_(file, lineno, TBROK,
- "Network device name \"%s\" too long", ifname);
- return 0;
- }
-
- if (ifname) {
- index = tst_netdev_index_by_name(file, lineno, ifname);
-
- if (index < 0)
- return 0;
- }
-
- if (action == RTM_DELROUTE)
- info.rtm_scope = RT_SCOPE_NOWHERE;
- else
- info.rtm_scope = RT_SCOPE_UNIVERSE;
-
- ctx = create_request(file, lineno, action, flags, &info, sizeof(info));
-
- if (srcaddr && !tst_rtnl_add_attr(file, lineno, ctx, RTA_SRC, srcaddr,
- srclen)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- if (dstaddr && !tst_rtnl_add_attr(file, lineno, ctx, RTA_DST, dstaddr,
- dstlen)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- if (gateway && !tst_rtnl_add_attr(file, lineno, ctx, RTA_GATEWAY,
- gateway, gatewaylen)) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- if (ifname && !tst_rtnl_add_attr(file, lineno, ctx, RTA_OIF, &index,
- sizeof(index))) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return 0;
- }
-
- ret = tst_rtnl_send_validate(file, lineno, ctx);
- tst_rtnl_destroy_context(file, lineno, ctx);
-
- if (!ret) {
- tst_brk_(file, lineno, TBROK | TTERRNO,
- "Failed to modify network route");
- }
-
- return ret;
-}
-
-static int modify_route_inet(const char *file, const int lineno,
- unsigned int action, unsigned int flags, const char *ifname,
- in_addr_t srcaddr, unsigned int srcprefix, in_addr_t dstaddr,
- unsigned int dstprefix, in_addr_t gateway)
-{
- void *src = NULL, *dst = NULL, *gw = NULL;
- size_t srclen = 0, dstlen = 0, gwlen = 0;
-
- if (srcprefix) {
- src = &srcaddr;
- srclen = sizeof(srcaddr);
- }
-
- if (dstprefix) {
- dst = &dstaddr;
- dstlen = sizeof(dstaddr);
- }
-
- if (gateway) {
- gw = &gateway;
- gwlen = sizeof(gateway);
- }
-
- return modify_route(file, lineno, action, flags, ifname, AF_INET, src,
- srcprefix, srclen, dst, dstprefix, dstlen, gw, gwlen);
-}
-
-int tst_netdev_add_route(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *srcaddr,
- unsigned int srcprefix, size_t srclen, const void *dstaddr,
- unsigned int dstprefix, size_t dstlen, const void *gateway,
- size_t gatewaylen)
-{
- return modify_route(file, lineno, RTM_NEWROUTE,
- NLM_F_CREATE | NLM_F_EXCL, ifname, family, srcaddr, srcprefix,
- srclen, dstaddr, dstprefix, dstlen, gateway, gatewaylen);
-}
-
-int tst_netdev_add_route_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t srcaddr, unsigned int srcprefix,
- in_addr_t dstaddr, unsigned int dstprefix, in_addr_t gateway)
-{
- return modify_route_inet(file, lineno, RTM_NEWROUTE,
- NLM_F_CREATE | NLM_F_EXCL, ifname, srcaddr, srcprefix, dstaddr,
- dstprefix, gateway);
-}
-
-int tst_netdev_remove_route(const char *file, const int lineno,
- const char *ifname, unsigned int family, const void *srcaddr,
- unsigned int srcprefix, size_t srclen, const void *dstaddr,
- unsigned int dstprefix, size_t dstlen, const void *gateway,
- size_t gatewaylen)
-{
- return modify_route(file, lineno, RTM_DELROUTE, 0, ifname, family,
- srcaddr, srcprefix, srclen, dstaddr, dstprefix, dstlen,
- gateway, gatewaylen);
-}
-
-int tst_netdev_remove_route_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t srcaddr, unsigned int srcprefix,
- in_addr_t dstaddr, unsigned int dstprefix, in_addr_t gateway)
-{
- return modify_route_inet(file, lineno, RTM_DELROUTE, 0, ifname,
- srcaddr, srcprefix, dstaddr, dstprefix, gateway);
-}
diff --git a/lib/tst_process_state.c b/lib/tst_process_state.c
index 11790c947..7a7824959 100644
--- a/lib/tst_process_state.c
+++ b/lib/tst_process_state.c
@@ -28,12 +28,11 @@
#include "test.h"
#include "tst_process_state.h"
-int tst_process_state_wait(const char *file, const int lineno,
- void (*cleanup_fn)(void), pid_t pid,
- const char state, unsigned int msec_timeout)
+void tst_process_state_wait(const char *file, const int lineno,
+ void (*cleanup_fn)(void),
+ pid_t pid, const char state)
{
char proc_path[128], cur_state;
- unsigned int msecs = 0;
snprintf(proc_path, sizeof(proc_path), "/proc/%i/stat", pid);
@@ -42,18 +41,10 @@ int tst_process_state_wait(const char *file, const int lineno,
"%*i %*s %c", &cur_state);
if (state == cur_state)
- break;
+ return;
- usleep(1000);
- msecs += 1;
-
- if (msec_timeout && msecs >= msec_timeout) {
- errno = ETIMEDOUT;
- return -1;
- }
+ usleep(10000);
}
-
- return 0;
}
int tst_process_state_wait2(pid_t pid, const char state)
diff --git a/lib/tst_res.c b/lib/tst_res.c
index 8d86b48a4..c35f41b74 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -575,7 +575,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
}
}
-void tst_brkm__(const char *file, const int lineno, int ttype,
+void tst_brkm_(const char *file, const int lineno, int ttype,
void (*func)(void), const char *arg_fmt, ...)
{
char tmesg[USERMESG];
@@ -589,10 +589,10 @@ void tst_brkm__(const char *file, const int lineno, int ttype,
}
tst_brk_(file, lineno, ttype, "%s", tmesg);
+ } else {
+ tst_brk__(file, lineno, ttype, func, "%s", tmesg);
}
- tst_brk__(file, lineno, ttype, func, "%s", tmesg);
-
/* Shouldn't be reached, but fixes build time warnings about noreturn. */
abort();
}
diff --git a/lib/tst_resource.c b/lib/tst_resource.c
index c35d05a25..0b9b381f1 100644
--- a/lib/tst_resource.c
+++ b/lib/tst_resource.c
@@ -102,8 +102,9 @@ void tst_resource_copy(const char *file, const int lineno,
const char *filename, const char *dest)
{
if (!tst_tmpdir_created()) {
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Temporary directory doesn't exist");
+ tst_brkm(TBROK, cleanup_fn,
+ "Temporary directory doesn't exist at %s:%d",
+ file, lineno);
return;
}
@@ -132,6 +133,6 @@ void tst_resource_copy(const char *file, const int lineno,
if (file_copy(file, lineno, cleanup_fn, startwd, filename, dest))
return;
- tst_brkm_(file, lineno, TBROK, cleanup_fn,
- "Failed to copy resource '%s'", filename);
+ tst_brkm(TBROK, cleanup_fn, "Failed to copy resource '%s' at %s:%d",
+ filename, file, lineno);
}
diff --git a/lib/tst_rtctime.c b/lib/tst_rtctime.c
deleted file mode 100644
index c62ac731d..000000000
--- a/lib/tst_rtctime.c
+++ /dev/null
@@ -1,127 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Unisoc Communications Inc.
- *
- * This file is a implementation for rtc set read,covert to tm functions
- */
-
-#include <stdbool.h>
-#include <limits.h>
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "tst_rtctime.h"
-
-#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400)
-
-static const unsigned char rtc_days_in_month[] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-static inline bool is_leap_year(unsigned int year)
-{
- return (!(year % 4) && (year % 100)) || !(year % 400);
-}
-
-static long long tst_mktime(const unsigned int year0, const unsigned int mon0,
- const unsigned int day, const unsigned int hour,
- const unsigned int min, const unsigned int sec)
-{
- unsigned int mon = mon0, year = year0;
-
- /* 1..12 -> 11,12,1..10 */
- mon -= 2;
- if (0 >= (int) (mon)) {
- mon += 12; /* Puts Feb last since it has leap day */
- year -= 1;
- }
-
- return ((((long long)
- (year/4 - year/100 + year/400 + 367*mon/12 + day) +
- year*365 - 719499
- )*24 + hour /* now have hours - midnight tomorrow handled here */
- )*60 + min /* now have minutes */
- )*60 + sec; /* finally seconds */
-}
-
-/*
- * The number of days in the month.
- */
-static int rtc_month_days(unsigned int month, unsigned int year)
-{
- return rtc_days_in_month[month] + (is_leap_year(year) && month == 1);
-}
-
-/*
- * tst_rtc_time_to_tm - Converts time_t to rtc_time.
- * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
- */
-void tst_rtc_time_to_tm(long long time, struct rtc_time *tm)
-{
- unsigned int month, year, secs;
- int days;
-
- /* time must be positive */
- days = time / 86400;
- secs = time % 86400;
-
- /* day of the week, 1970-01-01 was a Thursday */
- tm->tm_wday = (days + 4) % 7;
-
- year = 1970 + days / 365;
- days -= (year - 1970) * 365
- + LEAPS_THRU_END_OF(year - 1)
- - LEAPS_THRU_END_OF(1970 - 1);
- while (days < 0) {
- year -= 1;
- days += 365 + is_leap_year(year);
- }
- tm->tm_year = year - 1900;
- tm->tm_yday = days + 1;
-
- for (month = 0; month < 11; month++) {
- int newdays;
-
- newdays = days - rtc_month_days(month, year);
- if (newdays < 0)
- break;
- days = newdays;
- }
- tm->tm_mon = month;
- tm->tm_mday = days + 1;
-
- tm->tm_hour = secs / 3600;
- secs -= tm->tm_hour * 3600;
- tm->tm_min = secs / 60;
- tm->tm_sec = secs - tm->tm_min * 60;
-
- tm->tm_isdst = 0;
-}
-
-/*
- * tst_rtc_tm_to_time - Converts rtc_time to time_t.
- * Convert Gregorian date to seconds since 01-01-1970 00:00:00.
- */
-long long tst_rtc_tm_to_time(struct rtc_time *tm)
-{
- return tst_mktime(((unsigned int)tm->tm_year + 1900), tm->tm_mon + 1,
- tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
-}
-
-int tst_rtc_ioctl(const char *rtc_dev, unsigned long request,
- struct rtc_time *rtc_tm)
-{
- int ret;
- int rtc_fd = -1;
-
- rtc_fd = SAFE_OPEN(rtc_dev, O_RDONLY);
-
- ret = ioctl(rtc_fd, request, rtc_tm);
-
- if (ret != 0)
- return -1;
-
- if (rtc_fd > 0)
- SAFE_CLOSE(rtc_fd);
-
- return 0;
-}
diff --git a/lib/tst_rtnetlink.c b/lib/tst_rtnetlink.c
deleted file mode 100644
index 1ecda3a9f..000000000
--- a/lib/tst_rtnetlink.c
+++ /dev/null
@@ -1,412 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Linux Test Project
- */
-
-#include <stdlib.h>
-#include <limits.h>
-#include <asm/types.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "tst_rtnetlink.h"
-
-struct tst_rtnl_context {
- int socket;
- pid_t pid;
- uint32_t seq;
- size_t bufsize, datalen;
- char *buffer;
- struct nlmsghdr *curmsg;
-};
-
-static int tst_rtnl_grow_buffer(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, size_t size)
-{
- size_t needed, offset, curlen = NLMSG_ALIGN(ctx->datalen);
- char *buf;
-
- if (ctx->bufsize - curlen >= size)
- return 1;
-
- needed = size - (ctx->bufsize - curlen);
- size = ctx->bufsize + (ctx->bufsize > needed ? ctx->bufsize : needed);
- size = NLMSG_ALIGN(size);
- buf = safe_realloc(file, lineno, ctx->buffer, size);
-
- if (!buf)
- return 0;
-
- memset(buf + ctx->bufsize, 0, size - ctx->bufsize);
- offset = ((char *)ctx->curmsg) - ctx->buffer;
- ctx->buffer = buf;
- ctx->curmsg = (struct nlmsghdr *)(buf + offset);
- ctx->bufsize = size;
-
- return 1;
-}
-
-void tst_rtnl_destroy_context(const char *file, const int lineno,
- struct tst_rtnl_context *ctx)
-{
- safe_close(file, lineno, NULL, ctx->socket);
- free(ctx->buffer);
- free(ctx);
-}
-
-struct tst_rtnl_context *tst_rtnl_create_context(const char *file,
- const int lineno)
-{
- struct tst_rtnl_context *ctx;
- struct sockaddr_nl addr = { .nl_family = AF_NETLINK };
-
- ctx = safe_malloc(file, lineno, NULL, sizeof(struct tst_rtnl_context));
-
- if (!ctx)
- return NULL;
-
- ctx->pid = 0;
- ctx->seq = 0;
- ctx->buffer = NULL;
- ctx->bufsize = 1024;
- ctx->datalen = 0;
- ctx->curmsg = NULL;
- ctx->socket = safe_socket(file, lineno, NULL, AF_NETLINK,
- SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_ROUTE);
-
- if (ctx->socket < 0) {
- free(ctx);
- return NULL;
- }
-
- if (safe_bind(file, lineno, NULL, ctx->socket, (struct sockaddr *)&addr,
- sizeof(addr))) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return NULL;
- }
-
- ctx->buffer = safe_malloc(file, lineno, NULL, ctx->bufsize);
-
- if (!ctx->buffer) {
- tst_rtnl_destroy_context(file, lineno, ctx);
- return NULL;
- }
-
- memset(ctx->buffer, 0, ctx->bufsize);
-
- return ctx;
-}
-
-void tst_rtnl_free_message(struct tst_rtnl_message *msg)
-{
- if (!msg)
- return;
-
- // all ptr->header and ptr->info pointers point to the same buffer
- // msg->header is the start of the buffer
- free(msg->header);
- free(msg);
-}
-
-int tst_rtnl_send(const char *file, const int lineno,
- struct tst_rtnl_context *ctx)
-{
- int ret;
- struct sockaddr_nl addr = { .nl_family = AF_NETLINK };
- struct iovec iov;
- struct msghdr msg = {
- .msg_name = &addr,
- .msg_namelen = sizeof(addr),
- .msg_iov = &iov,
- .msg_iovlen = 1
- };
-
- if (!ctx->curmsg) {
- tst_brk_(file, lineno, TBROK, "%s(): No message to send",
- __func__);
- return 0;
- }
-
- if (ctx->curmsg->nlmsg_flags & NLM_F_MULTI) {
- struct nlmsghdr eom = { .nlmsg_type = NLMSG_DONE };
-
- if (!tst_rtnl_add_message(file, lineno, ctx, &eom, NULL, 0))
- return 0;
-
- /* NLMSG_DONE message must not have NLM_F_MULTI flag */
- ctx->curmsg->nlmsg_flags = 0;
- }
-
- iov.iov_base = ctx->buffer;
- iov.iov_len = ctx->datalen;
- ret = safe_sendmsg(file, lineno, ctx->datalen, ctx->socket, &msg, 0);
-
- if (ret > 0)
- ctx->curmsg = NULL;
-
- return ret;
-}
-
-int tst_rtnl_wait(struct tst_rtnl_context *ctx)
-{
- struct pollfd fdinfo = {
- .fd = ctx->socket,
- .events = POLLIN
- };
-
- return poll(&fdinfo, 1, 1000);
-}
-
-struct tst_rtnl_message *tst_rtnl_recv(const char *file, const int lineno,
- struct tst_rtnl_context *ctx)
-{
- char tmp, *tmpbuf, *buffer = NULL;
- struct tst_rtnl_message *ret;
- struct nlmsghdr *ptr;
- size_t retsize, bufsize = 0;
- ssize_t size;
- int i, size_left, msgcount;
-
- /* Each recv() call returns one message, read all pending messages */
- while (1) {
- errno = 0;
- size = recv(ctx->socket, &tmp, 1,
- MSG_DONTWAIT | MSG_PEEK | MSG_TRUNC);
-
- if (size < 0) {
- if (errno != EAGAIN) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "recv() failed");
- }
-
- break;
- }
-
- tmpbuf = safe_realloc(file, lineno, buffer, bufsize + size);
-
- if (!tmpbuf)
- break;
-
- buffer = tmpbuf;
- size = safe_recv(file, lineno, size, ctx->socket,
- buffer + bufsize, size, 0);
-
- if (size < 0)
- break;
-
- bufsize += size;
- }
-
- if (!bufsize) {
- free(buffer);
- return NULL;
- }
-
- ptr = (struct nlmsghdr *)buffer;
- size_left = bufsize;
- msgcount = 0;
-
- for (; size_left > 0 && NLMSG_OK(ptr, size_left); msgcount++)
- ptr = NLMSG_NEXT(ptr, size_left);
-
- retsize = (msgcount + 1) * sizeof(struct tst_rtnl_message);
- ret = safe_malloc(file, lineno, NULL, retsize);
-
- if (!ret) {
- free(buffer);
- return NULL;
- }
-
- memset(ret, 0, retsize);
- ptr = (struct nlmsghdr *)buffer;
- size_left = bufsize;
-
- for (i = 0; i < msgcount; i++, ptr = NLMSG_NEXT(ptr, size_left)) {
- ret[i].header = ptr;
- ret[i].payload = NLMSG_DATA(ptr);
- ret[i].payload_size = NLMSG_PAYLOAD(ptr, 0);
-
- if (ptr->nlmsg_type == NLMSG_ERROR)
- ret[i].err = NLMSG_DATA(ptr);
- }
-
- return ret;
-}
-
-int tst_rtnl_add_message(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, const struct nlmsghdr *header,
- const void *payload, size_t payload_size)
-{
- size_t size;
- unsigned int extra_flags = 0;
-
- if (!tst_rtnl_grow_buffer(file, lineno, ctx, NLMSG_SPACE(payload_size)))
- return 0;
-
- if (!ctx->curmsg) {
- /*
- * datalen may hold the size of last sent message for ACK
- * checking, reset it back to 0 here
- */
- ctx->datalen = 0;
- ctx->curmsg = (struct nlmsghdr *)ctx->buffer;
- } else {
- size = NLMSG_ALIGN(ctx->curmsg->nlmsg_len);
-
- extra_flags = NLM_F_MULTI;
- ctx->curmsg->nlmsg_flags |= extra_flags;
- ctx->curmsg = NLMSG_NEXT(ctx->curmsg, size);
- ctx->datalen = NLMSG_ALIGN(ctx->datalen);
- }
-
- *ctx->curmsg = *header;
- ctx->curmsg->nlmsg_len = NLMSG_LENGTH(payload_size);
- ctx->curmsg->nlmsg_flags |= extra_flags;
- ctx->curmsg->nlmsg_seq = ctx->seq++;
- ctx->curmsg->nlmsg_pid = ctx->pid;
-
- if (payload_size)
- memcpy(NLMSG_DATA(ctx->curmsg), payload, payload_size);
-
- ctx->datalen += ctx->curmsg->nlmsg_len;
-
- return 1;
-}
-
-int tst_rtnl_add_attr(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, unsigned short type,
- const void *data, unsigned short len)
-{
- size_t size;
- struct rtattr *attr;
-
- if (!ctx->curmsg) {
- tst_brk_(file, lineno, TBROK,
- "%s(): No message to add attributes to", __func__);
- return 0;
- }
-
- if (!tst_rtnl_grow_buffer(file, lineno, ctx, RTA_SPACE(len)))
- return 0;
-
- size = NLMSG_ALIGN(ctx->curmsg->nlmsg_len);
- attr = (struct rtattr *)(((char *)ctx->curmsg) + size);
- attr->rta_type = type;
- attr->rta_len = RTA_LENGTH(len);
- memcpy(RTA_DATA(attr), data, len);
- ctx->curmsg->nlmsg_len = size + attr->rta_len;
- ctx->datalen = NLMSG_ALIGN(ctx->datalen) + attr->rta_len;
-
- return 1;
-}
-
-int tst_rtnl_add_attr_string(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, unsigned short type,
- const char *data)
-{
- return tst_rtnl_add_attr(file, lineno, ctx, type, data,
- strlen(data) + 1);
-}
-
-int tst_rtnl_add_attr_list(const char *file, const int lineno,
- struct tst_rtnl_context *ctx,
- const struct tst_rtnl_attr_list *list)
-{
- int i, ret;
- size_t offset;
-
- for (i = 0; list[i].len >= 0; i++) {
- if (list[i].len > USHRT_MAX) {
- tst_brk_(file, lineno, TBROK,
- "%s(): Attribute value too long", __func__);
- return -1;
- }
-
- offset = NLMSG_ALIGN(ctx->datalen);
- ret = tst_rtnl_add_attr(file, lineno, ctx, list[i].type,
- list[i].data, list[i].len);
-
- if (!ret)
- return -1;
-
- if (list[i].sublist) {
- struct rtattr *attr;
-
- ret = tst_rtnl_add_attr_list(file, lineno, ctx,
- list[i].sublist);
-
- if (ret < 0)
- return ret;
-
- attr = (struct rtattr *)(ctx->buffer + offset);
-
- if (ctx->datalen - offset > USHRT_MAX) {
- tst_brk_(file, lineno, TBROK,
- "%s(): Sublist too long", __func__);
- return -1;
- }
-
- attr->rta_len = ctx->datalen - offset;
- }
- }
-
- return i;
-}
-
-int tst_rtnl_check_acks(const char *file, const int lineno,
- struct tst_rtnl_context *ctx, struct tst_rtnl_message *res)
-{
- struct nlmsghdr *msg = (struct nlmsghdr *)ctx->buffer;
- int size_left = ctx->datalen;
-
- for (; size_left > 0 && NLMSG_OK(msg, size_left);
- msg = NLMSG_NEXT(msg, size_left)) {
-
- if (!(msg->nlmsg_flags & NLM_F_ACK))
- continue;
-
- while (res->header && res->header->nlmsg_seq != msg->nlmsg_seq)
- res++;
-
- if (!res->err || res->header->nlmsg_seq != msg->nlmsg_seq) {
- tst_brk_(file, lineno, TBROK,
- "No ACK found for Netlink message %u",
- msg->nlmsg_seq);
- return 0;
- }
-
- if (res->err->error) {
- TST_ERR = -res->err->error;
- return 0;
- }
- }
-
- return 1;
-}
-
-int tst_rtnl_send_validate(const char *file, const int lineno,
- struct tst_rtnl_context *ctx)
-{
- struct tst_rtnl_message *response;
- int ret;
-
- TST_ERR = 0;
-
- if (tst_rtnl_send(file, lineno, ctx) <= 0)
- return 0;
-
- tst_rtnl_wait(ctx);
- response = tst_rtnl_recv(file, lineno, ctx);
-
- if (!response)
- return 0;
-
- ret = tst_rtnl_check_acks(file, lineno, ctx, response);
- tst_rtnl_free_message(response);
-
- return ret;
-}
diff --git a/lib/tst_cmd.c b/lib/tst_run_cmd.c
index 7446249f9..8e4bf6ba3 100644
--- a/lib/tst_cmd.c
+++ b/lib/tst_run_cmd.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -17,6 +16,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Alexey Kodanev <alexey.kodanev@oracle.com>
+ *
*/
#include <errno.h>
@@ -27,16 +27,15 @@
#include <unistd.h>
#include <signal.h>
#include "test.h"
-#include "tst_cmd.h"
#define OPEN_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
#define OPEN_FLAGS (O_WRONLY | O_APPEND | O_CREAT)
-int tst_cmd_fds_(void (cleanup_fn)(void),
+int tst_run_cmd_fds_(void (cleanup_fn)(void),
const char *const argv[],
int stdout_fd,
int stderr_fd,
- enum tst_cmd_flags flags)
+ int pass_exit_val)
{
int rc;
@@ -56,16 +55,6 @@ int tst_cmd_fds_(void (cleanup_fn)(void),
*/
void *old_handler = signal(SIGCHLD, SIG_DFL);
- char path[PATH_MAX];
-
- if (tst_get_path(argv[0], path, sizeof(path))) {
- if (flags & TST_CMD_TCONF_ON_MISSING)
- tst_brkm(TCONF, cleanup_fn, "Couldn't find '%s' in $PATH at %s:%d", argv[0],
- __FILE__, __LINE__);
- else
- return 255;
- }
-
pid_t pid = vfork();
if (pid == -1) {
tst_brkm(TBROK | TERRNO, cleanup_fn, "vfork failed at %s:%d",
@@ -84,7 +73,10 @@ int tst_cmd_fds_(void (cleanup_fn)(void),
dup2(stderr_fd, STDERR_FILENO);
}
- execvp(argv[0], (char *const *)argv);
+ if (execvp(argv[0], (char *const *)argv)) {
+ if (errno == ENOENT)
+ _exit(255);
+ }
_exit(254);
}
@@ -105,7 +97,7 @@ int tst_cmd_fds_(void (cleanup_fn)(void),
rc = WEXITSTATUS(ret);
- if (!(flags & TST_CMD_PASS_RETVAL) && rc) {
+ if ((!pass_exit_val) && rc) {
tst_brkm(TBROK, cleanup_fn,
"'%s' exited with a non-zero code %d at %s:%d",
argv[0], rc, __FILE__, __LINE__);
@@ -115,11 +107,11 @@ int tst_cmd_fds_(void (cleanup_fn)(void),
return rc;
}
-int tst_cmd_(void (cleanup_fn)(void),
+int tst_run_cmd_(void (cleanup_fn)(void),
const char *const argv[],
const char *stdout_path,
const char *stderr_path,
- enum tst_cmd_flags flags)
+ int pass_exit_val)
{
int stdout_fd = -1;
int stderr_fd = -1;
@@ -145,7 +137,8 @@ int tst_cmd_(void (cleanup_fn)(void),
stderr_path, __FILE__, __LINE__);
}
- rc = tst_cmd_fds(cleanup_fn, argv, stdout_fd, stderr_fd, flags);
+ rc = tst_run_cmd_fds(cleanup_fn, argv, stdout_fd, stderr_fd,
+ pass_exit_val);
if ((stdout_fd != -1) && (close(stdout_fd) == -1))
tst_resm(TWARN | TERRNO,
diff --git a/lib/tst_safe_file_at.c b/lib/tst_safe_file_at.c
deleted file mode 100644
index ca8ef2f68..000000000
--- a/lib/tst_safe_file_at.c
+++ /dev/null
@@ -1,197 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 SUSE LLC <rpalethorpe@suse.com>
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include "lapi/fcntl.h"
-#include "tst_safe_file_at.h"
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-
-static char fd_path[PATH_MAX];
-
-const char *tst_decode_fd(const int fd)
-{
- ssize_t ret;
- char proc_path[32];
-
- if (fd < 0)
- return "!";
-
- sprintf(proc_path, "/proc/self/fd/%d", fd);
- ret = readlink(proc_path, fd_path, sizeof(fd_path));
-
- if (ret < 0)
- return "?";
-
- fd_path[ret] = '\0';
-
- return fd_path;
-}
-
-int safe_openat(const char *const file, const int lineno,
- const int dirfd, const char *const path, const int oflags, ...)
-{
- va_list ap;
- int fd;
- mode_t mode;
-
- va_start(ap, oflags);
- mode = va_arg(ap, int);
- va_end(ap);
-
- fd = openat(dirfd, path, oflags, mode);
- if (fd > -1)
- return fd;
-
- tst_brk_(file, lineno, TBROK | TERRNO,
- "openat(%d<%s>, '%s', %o, %o)",
- dirfd, tst_decode_fd(dirfd), path, oflags, mode);
-
- return fd;
-}
-
-ssize_t safe_file_readat(const char *const file, const int lineno,
- const int dirfd, const char *const path,
- char *const buf, const size_t nbyte)
-{
- int fd = safe_openat(file, lineno, dirfd, path, O_RDONLY);
- ssize_t rval;
-
- if (fd < 0)
- return -1;
-
- rval = safe_read(file, lineno, NULL, 0, fd, buf, nbyte - 1);
- if (rval < 0)
- return -1;
-
- close(fd);
- buf[rval] = '\0';
-
- if (rval >= (ssize_t)nbyte - 1) {
- tst_brk_(file, lineno, TBROK,
- "Buffer length %zu too small to read %d<%s>/%s",
- nbyte, dirfd, tst_decode_fd(dirfd), path);
- }
-
- return rval;
-}
-
-int tst_file_vprintfat(const int dirfd, const char *const path,
- const char *const fmt, va_list va)
-{
- const int fd = openat(dirfd, path, O_WRONLY);
- int ret, errno_cpy;
-
- if (fd < 0)
- return -1;
-
- ret = vdprintf(fd, fmt, va);
- errno_cpy = errno;
- close(fd);
-
- if (ret < 0) {
- errno = errno_cpy;
- return -2;
- }
-
- return ret;
-}
-
-int tst_file_printfat(const int dirfd, const char *const path,
- const char *const fmt, ...)
-{
- va_list va;
- int rval;
-
- va_start(va, fmt);
- rval = tst_file_vprintfat(dirfd, path, fmt, va);
- va_end(va);
-
- return rval;
-}
-
-int safe_file_vprintfat(const char *const file, const int lineno,
- const int dirfd, const char *const path,
- const char *const fmt, va_list va)
-{
- char buf[16];
- va_list vac;
- int rval, errno_cpy;
-
- va_copy(vac, va);
-
- rval = tst_file_vprintfat(dirfd, path, fmt, va);
-
- if (rval == -2) {
- errno_cpy = errno;
- rval = vsnprintf(buf, sizeof(buf), fmt, vac);
- va_end(vac);
-
- if (rval >= (ssize_t)sizeof(buf))
- strcpy(buf + sizeof(buf) - 5, "...");
- else if (rval < 0)
- buf[0] = '\0';
-
- errno = errno_cpy;
- tst_brk_(file, lineno, TBROK | TERRNO,
- "vdprintf(%d<%s>, '%s', '%s'<%s>)",
- dirfd, tst_decode_fd(dirfd), path, fmt, buf);
- return -1;
- }
-
- va_end(vac);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "openat(%d<%s>, '%s', O_WRONLY)",
- dirfd, tst_decode_fd(dirfd), path);
- }
-
- return rval;
-}
-
-int safe_file_printfat(const char *const file, const int lineno,
- const int dirfd, const char *const path,
- const char *const fmt, ...)
-{
- va_list va;
- int rval;
-
- va_start(va, fmt);
- rval = safe_file_vprintfat(file, lineno, dirfd, path, fmt, va);
- va_end(va);
-
- return rval;
-}
-
-int safe_unlinkat(const char *const file, const int lineno,
- const int dirfd, const char *const path, const int flags)
-{
- const int rval = unlinkat(dirfd, path, flags);
- const char *flags_sym;
-
- if (!rval)
- return rval;
-
- switch(flags) {
- case AT_REMOVEDIR:
- flags_sym = "AT_REMOVEDIR";
- break;
- case 0:
- flags_sym = "0";
- break;
- default:
- flags_sym = "?";
- break;
- }
-
- tst_brk_(file, lineno, TBROK | TERRNO,
- "unlinkat(%d<%s>, '%s', %s)",
- dirfd, tst_decode_fd(dirfd), path, flags_sym);
-
- return rval;
-}
diff --git a/lib/tst_safe_io_uring.c b/lib/tst_safe_io_uring.c
deleted file mode 100644
index f300fd38c..000000000
--- a/lib/tst_safe_io_uring.c
+++ /dev/null
@@ -1,108 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 SUSE LLC <mdoucha@suse.cz>
- */
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "tst_safe_io_uring.h"
-
-int safe_io_uring_init(const char *file, const int lineno,
- unsigned int entries, struct io_uring_params *params,
- struct tst_io_uring *uring)
-{
- errno = 0;
- uring->fd = io_uring_setup(entries, params);
-
- if (uring->fd == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "io_uring_setup() failed");
- return uring->fd;
- } else if (uring->fd < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "io_uring_setup() returned invalid value %d",
- uring->fd);
- return uring->fd;
- }
-
- uring->sqr_size = params->sq_entries;
- uring->cqr_size = params->cq_entries;
- uring->sqr_mapsize = params->sq_off.array +
- params->sq_entries * sizeof(__u32);
- uring->cqr_mapsize = params->cq_off.cqes +
- params->cq_entries * sizeof(struct io_uring_cqe);
-
- uring->sqr_base = safe_mmap(file, lineno, NULL, uring->sqr_mapsize,
- PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, uring->fd,
- IORING_OFF_SQ_RING);
-
- if (uring->sqr_base == MAP_FAILED)
- return -1;
-
- uring->sqr_entries = safe_mmap(file, lineno, NULL,
- params->sq_entries * sizeof(struct io_uring_sqe),
- PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, uring->fd,
- IORING_OFF_SQES);
-
- if (uring->sqr_entries == MAP_FAILED)
- return -1;
-
- uring->cqr_base = safe_mmap(file, lineno, NULL, uring->cqr_mapsize,
- PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, uring->fd,
- IORING_OFF_CQ_RING);
-
- if (uring->cqr_base == MAP_FAILED)
- return -1;
-
- uring->sqr_head = uring->sqr_base + params->sq_off.head;
- uring->sqr_tail = uring->sqr_base + params->sq_off.tail;
- uring->sqr_mask = uring->sqr_base + params->sq_off.ring_mask;
- uring->sqr_flags = uring->sqr_base + params->sq_off.flags;
- uring->sqr_dropped = uring->sqr_base + params->sq_off.dropped;
- uring->sqr_array = uring->sqr_base + params->sq_off.array;
-
- uring->cqr_head = uring->cqr_base + params->cq_off.head;
- uring->cqr_tail = uring->cqr_base + params->cq_off.tail;
- uring->cqr_mask = uring->cqr_base + params->cq_off.ring_mask;
- uring->cqr_overflow = uring->cqr_base + params->cq_off.overflow;
- uring->cqr_entries = uring->cqr_base + params->cq_off.cqes;
- return uring->fd;
-}
-
-int safe_io_uring_close(const char *file, const int lineno,
- struct tst_io_uring *uring)
-{
- int ret;
-
- safe_munmap(file, lineno, NULL, uring->cqr_base, uring->cqr_mapsize);
- safe_munmap(file, lineno, NULL, uring->sqr_entries,
- uring->sqr_size * sizeof(struct io_uring_sqe));
- safe_munmap(file, lineno, NULL, uring->sqr_base, uring->sqr_mapsize);
- ret = safe_close(file, lineno, NULL, uring->fd);
- uring->fd = -1;
- return ret;
-}
-
-int safe_io_uring_enter(const char *file, const int lineno, int strict,
- int fd, unsigned int to_submit, unsigned int min_complete,
- unsigned int flags, sigset_t *sig)
-{
- int ret;
-
- errno = 0;
- ret = io_uring_enter(fd, to_submit, min_complete, flags, sig);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "io_uring_enter() failed");
- } else if (ret < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid io_uring_enter() return value %d", ret);
- } else if (strict && to_submit != (unsigned int)ret) {
- tst_brk_(file, lineno, TBROK,
- "io_uring_enter() submitted %d items (expected %d)",
- ret, to_submit);
- }
-
- return ret;
-}
diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c
index fd5f1704b..f5413a18e 100644
--- a/lib/tst_safe_macros.c
+++ b/lib/tst_safe_macros.c
@@ -5,17 +5,14 @@
#define _GNU_SOURCE
#include <unistd.h>
-#include <stdlib.h>
#include <errno.h>
#include <sched.h>
-#include <sys/ptrace.h>
#include "config.h"
#ifdef HAVE_SYS_FANOTIFY_H
# include <sys/fanotify.h>
#endif
#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"
-#include "lapi/setns.h"
#include "tst_safe_macros.h"
#include "lapi/personality.h"
@@ -24,14 +21,10 @@ int safe_setpgid(const char *file, const int lineno, pid_t pid, pid_t pgid)
int rval;
rval = setpgid(pid, pgid);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "setpgid(%i, %i) failed", pid, pgid);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid setpgid(%i, %i) return value %d", pid, pgid,
- rval);
+ if (rval) {
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: setpgid(%i, %i) failed",
+ file, lineno, pid, pgid);
}
return rval;
@@ -42,30 +35,45 @@ pid_t safe_getpgid(const char *file, const int lineno, pid_t pid)
pid_t pgid;
pgid = getpgid(pid);
-
if (pgid == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "getpgid(%i) failed",
- pid);
- } else if (pgid < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid getpgid(%i) return value %d", pid, pgid);
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: getpgid(%i) failed", file, lineno, pid);
}
return pgid;
}
+int safe_fanotify_init(const char *file, const int lineno,
+ unsigned int flags, unsigned int event_f_flags)
+{
+ int rval;
+
+#ifdef HAVE_SYS_FANOTIFY_H
+ rval = fanotify_init(flags, event_f_flags);
+
+ if (rval == -1) {
+ if (errno == ENOSYS) {
+ tst_brk(TCONF,
+ "fanotify is not configured in this kernel.");
+ }
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: fanotify_init() failed", file, lineno);
+ }
+#else
+ tst_brk(TCONF, "Header <sys/fanotify.h> is not present");
+#endif /* HAVE_SYS_FANOTIFY_H */
+
+ return rval;
+}
+
int safe_personality(const char *filename, unsigned int lineno,
unsigned long persona)
{
int prev_persona = personality(persona);
- if (prev_persona == -1) {
+ if (prev_persona < 0) {
tst_brk_(filename, lineno, TBROK | TERRNO,
"persona(%ld) failed", persona);
- } else if (prev_persona < 0) {
- tst_brk_(filename, lineno, TBROK | TERRNO,
- "Invalid persona(%ld) return value %d", persona,
- prev_persona);
}
return prev_persona;
@@ -77,33 +85,26 @@ int safe_setregid(const char *file, const int lineno,
int rval;
rval = setregid(rgid, egid);
-
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "setregid(%li, %li) failed", (long)rgid, (long)egid);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid setregid(%li, %li) return value %d",
- (long)rgid, (long)egid, rval);
+ "setregid(%li, %li) failed",
+ (long)rgid, (long)egid);
}
return rval;
}
+
int safe_setreuid(const char *file, const int lineno,
uid_t ruid, uid_t euid)
{
int rval;
rval = setreuid(ruid, euid);
-
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "setreuid(%li, %li) failed", (long)ruid, (long)euid);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid setreuid(%li, %li) return value %d",
- (long)ruid, (long)euid, rval);
+ "setreuid(%li, %li) failed",
+ (long)ruid, (long)euid);
}
return rval;
@@ -122,138 +123,6 @@ int safe_sigaction(const char *file, const int lineno,
tst_brk_(file, lineno, TBROK | TERRNO,
"sigaction(%s (%d), %p, %p) failed",
tst_strsig(signum), signum, act, oldact);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid sigaction(%s (%d), %p, %p) return value %d",
- tst_strsig(signum), signum, act, oldact, rval);
- }
-
- return rval;
-}
-
-int safe_sigaddset(const char *file, const int lineno,
- sigset_t *sigs, int signo)
-{
- int rval;
-
- rval = sigaddset(sigs, signo);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "sigaddset() %s (%i) failed", tst_strsig(signo),
- signo);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid sigaddset() %s (%i) return value %d",
- tst_strsig(signo), signo, rval);
- }
-
- return rval;
-}
-
-int safe_sigdelset(const char *file, const int lineno,
- sigset_t *sigs, int signo)
-{
- int rval;
-
- rval = sigdelset(sigs, signo);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "sigdelset() %s (%i) failed", tst_strsig(signo),
- signo);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid sigdelset() %s (%i) return value %d",
- tst_strsig(signo), signo, rval);
- }
-
- return rval;
-}
-
-int safe_sigemptyset(const char *file, const int lineno,
- sigset_t *sigs)
-{
- int rval;
-
- rval = sigemptyset(sigs);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "sigemptyset() failed");
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid sigemptyset() return value %d", rval);
- }
-
- return rval;
-}
-
-int safe_sigfillset(const char *file, const int lineno,
- sigset_t *sigs)
-{
- int rval;
-
- rval = sigfillset(sigs);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "sigfillset() failed");
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid sigfillset() return value %d", rval);
- }
-
- return rval;
-}
-
-static const char *strhow(int how)
-{
- switch (how) {
- case SIG_BLOCK:
- return "SIG_BLOCK";
- case SIG_UNBLOCK:
- return "SIG_UNBLOCK";
- case SIG_SETMASK:
- return "SIG_SETMASK";
- default:
- return "???";
- }
-}
-
-int safe_sigprocmask(const char *file, const int lineno,
- int how, sigset_t *set, sigset_t *oldset)
-{
- int rval;
-
- rval = sigprocmask(how, set, oldset);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "sigprocmask(%s, %p, %p) failed", strhow(how), set,
- oldset);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid sigprocmask(%s, %p, %p) return value %d",
- strhow(how), set, oldset, rval);
- }
-
- return rval;
-}
-
-int safe_sigwait(const char *file, const int lineno,
- sigset_t *set, int *sig)
-{
- int rval;
-
- rval = sigwait(set, sig);
-
- if (rval > 0) {
- errno = rval;
- tst_brk_(file, lineno, TBROK | TERRNO,
- "sigwait(%p, %p) failed", set, sig);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK,
- "Invalid sigwait(%p, %p) return value %d", set, sig,
- rval);
}
return rval;
@@ -310,24 +179,19 @@ int safe_chroot(const char *file, const int lineno, const char *path)
int rval;
rval = chroot(path);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "chroot(%s) failed",
- path);
- } else if (rval) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid chroot(%s) return value %d", path, rval);
+ "chroot(%s) failed", path);
}
return rval;
}
-int safe_unshare(const char *file, const int lineno, int flags)
+void safe_unshare(const char *file, const int lineno, int flags)
{
int res;
res = unshare(flags);
-
if (res == -1) {
if (errno == EINVAL) {
tst_brk_(file, lineno, TCONF | TERRNO,
@@ -336,144 +200,5 @@ int safe_unshare(const char *file, const int lineno, int flags)
tst_brk_(file, lineno, TBROK | TERRNO,
"unshare(%d) failed", flags);
}
- } else if (res) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid unshare(%d) return value %d", flags, res);
- }
-
- return res;
-}
-
-int safe_setns(const char *file, const int lineno, int fd, int nstype)
-{
- int ret;
-
- ret = setns(fd, nstype);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "setns(%i, %i) failed",
- fd, nstype);
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid setns(%i, %i) return value %d", fd, nstype,
- ret);
- }
-
- return ret;
-}
-
-long tst_safe_ptrace(const char *file, const int lineno, int req, pid_t pid,
- void *addr, void *data)
-{
- long ret;
-
- errno = 0;
- ret = ptrace(req, pid, addr, data);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "ptrace() failed");
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid ptrace() return value %ld", ret);
- }
-
- return ret;
-}
-
-int safe_pipe2(const char *file, const int lineno, int fildes[2], int flags)
-{
- int ret;
-
- ret = pipe2(fildes, flags);
-
- if (ret == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "pipe2({%d,%d}) failed with flag(%d)", fildes[0],
- fildes[1], flags);
- } else if (ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid pipe2({%d,%d}, %d) return value %d",
- fildes[0], fildes[1], flags, ret);
- }
-
- return ret;
-}
-
-int safe_dup(const char *file, const int lineno, int oldfd)
-{
- int rval;
-
- rval = dup(oldfd);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "dup(%i) failed", oldfd);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid dup(%i) return value %d", oldfd, rval);
- }
-
- return rval;
-}
-
-int safe_dup2(const char *file, const int lineno, int oldfd, int newfd)
-{
- int rval;
-
- rval = dup2(oldfd, newfd);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "dup2(%i, %i) failed", oldfd, newfd);
- } else if (rval != newfd) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid dup2(%i, %i) return value %d",
- oldfd, newfd, rval);
- }
-
- return rval;
-}
-
-void *safe_realloc(const char *file, const int lineno, void *ptr, size_t size)
-{
- void *ret;
-
- ret = realloc(ptr, size);
-
- if (!ret) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "realloc(%p, %zu) failed", ptr, size);
- }
-
- return ret;
-}
-
-sighandler_t safe_signal(const char *file, const int lineno,
- int signum, sighandler_t handler)
-{
- sighandler_t rval;
-
- rval = signal(signum, handler);
-
- if (rval == SIG_ERR) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "signal(%d,%p) failed",
- signum, handler);
- }
-
- return rval;
-}
-
-void safe_cmd(const char *file, const int lineno, const char *const argv[],
- const char *stdout_path, const char *stderr_path)
-{
- int rval;
-
- switch ((rval = tst_cmd(argv, stdout_path, stderr_path,
- TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING))) {
- case 0:
- break;
- default:
- tst_brk_(file, lineno, TBROK, "%s failed (%d)", argv[0], rval);
}
}
diff --git a/lib/tst_safe_sysv_ipc.c b/lib/tst_safe_sysv_ipc.c
index 5eaa82539..30b5f6ec7 100644
--- a/lib/tst_safe_sysv_ipc.c
+++ b/lib/tst_safe_sysv_ipc.c
@@ -10,12 +10,14 @@
#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"
#include "tst_safe_sysv_ipc.h"
-#include "lapi/sem.h"
/*
- * The IPC_STAT, IPC_SET, IPC_RMID can return either 0 or -1.
+ * The IPC_STAT, IPC_SET and IPC_RMID can return either 0 or -1.
+ *
+ * Linux specific cmds either returns -1 on failure or positive integer
+ * either index into an kernel array or shared primitive indentifier.
*/
-static int msg_ret_check(int cmd, int ret)
+static int ret_check(int cmd, int ret)
{
switch (cmd) {
case IPC_STAT:
@@ -23,41 +25,7 @@ static int msg_ret_check(int cmd, int ret)
case IPC_RMID:
return ret != 0;
default:
- return ret < 0;
- }
-}
-
-/*
- * The IPC_STAT, IPC_SET, IPC_RMID, SHM_LOCK, SHM_UNLOCK can return either 0 or -1.
- */
-static int shm_ret_check(int cmd, int ret)
-{
- switch (cmd) {
- case IPC_STAT:
- case IPC_SET:
- case IPC_RMID:
- case SHM_LOCK:
- case SHM_UNLOCK:
- return ret != 0;
- default:
- return ret < 0;
- }
-}
-
-/*
- * The IPC_STAT, IPC_SET, IPC_RMID, SETALL, SETVAL can return either 0 or -1.
- */
-static int sem_ret_check(int cmd, int ret)
-{
- switch (cmd) {
- case IPC_STAT:
- case IPC_SET:
- case IPC_RMID:
- case SETALL:
- case SETVAL:
- return ret != 0;
- default:
- return ret < 0;
+ return ret == -1;
}
}
@@ -66,14 +34,9 @@ int safe_msgget(const char *file, const int lineno, key_t key, int msgflg)
int rval;
rval = msgget(key, msgflg);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "msgget(%i, %x) failed",
- (int)key, msgflg);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid msgget(%i, %x) return value %d", (int)key,
- msgflg, rval);
+ tst_brk(TBROK | TERRNO, "%s:%d: msgget(%i, %x) failed",
+ file, lineno, (int)key, msgflg);
}
return rval;
@@ -85,15 +48,10 @@ int safe_msgsnd(const char *file, const int lineno, int msqid, const void *msgp,
int rval;
rval = msgsnd(msqid, msgp, msgsz, msgflg);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "msgsnd(%i, %p, %zu, %x) failed", msqid, msgp, msgsz,
- msgflg);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid msgsnd(%i, %p, %zu, %x) return value %d",
- msqid, msgp, msgsz, msgflg, rval);
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: msgsnd(%i, %p, %zu, %x) failed",
+ file, lineno, msqid, msgp, msgsz, msgflg);
}
return rval;
@@ -105,15 +63,10 @@ ssize_t safe_msgrcv(const char *file, const int lineno, int msqid, void *msgp,
ssize_t rval;
rval = msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "msgrcv(%i, %p, %zu, %li, %x) failed",
- msqid, msgp, msgsz, msgtyp, msgflg);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid msgrcv(%i, %p, %zu, %li, %x) return value %ld",
- msqid, msgp, msgsz, msgtyp, msgflg, rval);
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: msgrcv(%i, %p, %zu, %li, %x) failed",
+ file, lineno, msqid, msgp, msgsz, msgtyp, msgflg);
}
return rval;
@@ -125,16 +78,13 @@ int safe_msgctl(const char *file, const int lineno, int msqid, int cmd,
int rval;
rval = msgctl(msqid, cmd, buf);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "msgctl(%i, %i, %p) failed", msqid, cmd, buf);
- } else if (msg_ret_check(cmd, rval)) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid msgctl(%i, %i, %p) return value %d", msqid,
- cmd, buf, rval);
+ if (ret_check(cmd, rval)) {
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: msgctl(%i, %i, %p) = %i failed",
+ file, lineno, msqid, cmd, buf, rval);
}
+
return rval;
}
@@ -144,14 +94,9 @@ int safe_shmget(const char *file, const int lineno, key_t key, size_t size,
int rval;
rval = shmget(key, size, shmflg);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "shmget(%i, %zu, %x) failed", (int)key, size, shmflg);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid shmget(%i, %zu, %x) return value %d",
- (int)key, size, shmflg, rval);
+ tst_brk(TBROK | TERRNO, "%s:%d: shmget(%i, %zu, %x) failed",
+ file, lineno, (int)key, size, shmflg);
}
return rval;
@@ -163,10 +108,9 @@ void *safe_shmat(const char *file, const int lineno, int shmid,
void *rval;
rval = shmat(shmid, shmaddr, shmflg);
-
if (rval == (void *)-1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "shmat(%i, %p, %x) failed", shmid, shmaddr, shmflg);
+ tst_brk(TBROK | TERRNO, "%s:%d: shmat(%i, %p, %x) failed",
+ file, lineno, shmid, shmaddr, shmflg);
}
return rval;
@@ -177,13 +121,9 @@ int safe_shmdt(const char *file, const int lineno, const void *shmaddr)
int rval;
rval = shmdt(shmaddr);
-
if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "shmdt(%p) failed",
- shmaddr);
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid shmdt(%p) return value %d", shmaddr, rval);
+ tst_brk(TBROK | TERRNO, "%s:%d: shmdt(%p) failed",
+ file, lineno, shmaddr);
}
return rval;
@@ -195,78 +135,10 @@ int safe_shmctl(const char *file, const int lineno, int shmid, int cmd,
int rval;
rval = shmctl(shmid, cmd, buf);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "shmctl(%i, %i, %p) failed", shmid, cmd, buf);
- } else if (shm_ret_check(cmd, rval)) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid shmctl(%i, %i, %p) return value %d", shmid,
- cmd, buf, rval);
- }
-
- return rval;
-}
-
-int safe_semget(const char *file, const int lineno, key_t key, int nsems,
- int semflg)
-{
- int rval;
-
- rval = semget(key, nsems, semflg);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "semget(%i, %i, %x) failed", (int)key, nsems, semflg);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid semget(%i, %i, %x) return value %d",
- (int)key, nsems, semflg, rval);
- }
-
- return rval;
-}
-
-int safe_semctl(const char *file, const int lineno, int semid, int semnum,
- int cmd, ...)
-{
- int rval;
- va_list va;
- union semun un;
-
- va_start(va, cmd);
-
- un = va_arg(va, union semun);
-
- va_end(va);
-
- rval = semctl(semid, semnum, cmd, un);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "semctl(%i, %i, %i,...) failed", semid, semnum, cmd);
- } else if (sem_ret_check(cmd, rval)) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid semctl(%i, %i, %i,...) return value %d", semid,
- semnum, cmd, rval);
- }
-
- return rval;
-}
-
-int safe_semop(const char *file, const int lineno, int semid, struct sembuf *sops,
- size_t nsops)
-{
- int rval;
-
- rval = semop(semid, sops, nsops);
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "semop(%d, %p, %zu) failed", semid, sops, nsops);
- } else if (rval < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid semop(%d, %p, %zu) return value %d",
- semid, sops, nsops, rval);
+ if (ret_check(cmd, rval)) {
+ tst_brk(TBROK | TERRNO,
+ "%s:%d: shmctl(%i, %i, %p) = %i failed",
+ file, lineno, shmid, cmd, buf, rval);
}
return rval;
diff --git a/lib/tst_safe_timerfd.c b/lib/tst_safe_timerfd.c
deleted file mode 100644
index d31f6e35e..000000000
--- a/lib/tst_safe_timerfd.c
+++ /dev/null
@@ -1,69 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#include "tst_safe_timerfd.h"
-#include "lapi/timerfd.h"
-#include "tst_clocks.h"
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-
-#define TTYPE (errno == ENOTSUP ? TCONF : TBROK)
-
-int safe_timerfd_create(const char *file, const int lineno,
- int clockid, int flags)
-{
- int fd;
-
- fd = timerfd_create(clockid, flags);
-
- if (fd == -1) {
- tst_brk_(file, lineno, TTYPE | TERRNO,
- "timerfd_create(%s) failed", tst_clock_name(clockid));
- } else if (fd < 0) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timerfd_create(%s) return value %d",
- tst_clock_name(clockid), fd);
- }
-
- return fd;
-}
-
-int safe_timerfd_gettime(const char *file, const int lineno,
- int fd, struct itimerspec *curr_value)
-{
- int rval;
-
- rval = timerfd_gettime(fd, curr_value);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TTYPE | TERRNO,
- "timerfd_gettime() failed");
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timerfd_gettime() return value %d", rval);
- }
-
- return rval;
-}
-
-int safe_timerfd_settime(const char *file, const int lineno,
- int fd, int flags,
- const struct itimerspec *new_value,
- struct itimerspec *old_value)
-{
- int rval;
-
- rval = timerfd_settime(fd, flags, new_value, old_value);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TTYPE | TERRNO,
- "timerfd_settime() failed");
- } else if (rval) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "Invalid timerfd_settime() return value %d", rval);
- }
-
- return rval;
-}
diff --git a/lib/tst_status.c b/lib/tst_status.c
index 9124faaa3..f1affeac5 100644
--- a/lib/tst_status.c
+++ b/lib/tst_status.c
@@ -20,8 +20,7 @@ const char *exited(int status)
const char *signaled(int status)
{
- snprintf(buf, sizeof(buf), "killed by %s",
- tst_strsig(WTERMSIG(status)));
+ snprintf(buf, sizeof(buf), "killed by %s", tst_strsig(status));
return buf;
}
diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
index 592a526ae..00ede549d 100644
--- a/lib/tst_supported_fs_types.c
+++ b/lib/tst_supported_fs_types.c
@@ -8,7 +8,6 @@
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/wait.h>
-#include <sys/quota.h>
#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"
@@ -23,7 +22,6 @@ static const char *const fs_type_whitelist[] = {
"vfat",
"exfat",
"ntfs",
- "tmpfs",
NULL
};
@@ -34,11 +32,6 @@ static int has_mkfs(const char *fs_type)
char buf[128];
int ret;
- if (strstr(fs_type, "tmpfs")) {
- tst_res(TINFO, "mkfs is not needed for tmpfs");
- return 1;
- }
-
sprintf(buf, "mkfs.%s >/dev/null 2>&1", fs_type);
ret = tst_system(buf);
@@ -52,47 +45,22 @@ static int has_mkfs(const char *fs_type)
return 1;
}
-int tst_fs_in_skiplist(const char *fs_type, const char *const *skiplist)
-{
- unsigned int i;
-
- if (!skiplist)
- return 0;
-
- for (i = 0; skiplist[i]; i++) {
- if (!strcmp(fs_type, skiplist[i]))
- return 1;
- }
-
- return 0;
-}
-
-static enum tst_fs_impl has_kernel_support(const char *fs_type)
+static int has_kernel_support(const char *fs_type, int flags)
{
static int fuse_supported = -1;
const char *tmpdir = getenv("TMPDIR");
char buf[128];
- char template[PATH_MAX];
int ret;
if (!tmpdir)
tmpdir = "/tmp";
- snprintf(template, sizeof(template), "%s/mountXXXXXX", tmpdir);
- if (!mkdtemp(template))
- tst_brk(TBROK | TERRNO , "mkdtemp(%s) failed", template);
-
- ret = mount("/dev/zero", template, fs_type, 0, NULL);
- if ((ret && errno != ENODEV) || !ret) {
- if (!ret)
- tst_umount(template);
+ mount("/dev/zero", tmpdir, fs_type, 0, NULL);
+ if (errno != ENODEV) {
tst_res(TINFO, "Kernel supports %s", fs_type);
- SAFE_RMDIR(template);
- return TST_FS_KERNEL;
+ return 1;
}
- SAFE_RMDIR(template);
-
/* Is FUSE supported by kernel? */
if (fuse_supported == -1) {
ret = open("/dev/fuse", O_RDWR);
@@ -105,7 +73,7 @@ static enum tst_fs_impl has_kernel_support(const char *fs_type)
}
if (!fuse_supported)
- return TST_FS_UNSUPPORTED;
+ return 0;
/* Is FUSE implementation installed? */
sprintf(buf, "mount.%s >/dev/null 2>&1", fs_type);
@@ -113,84 +81,31 @@ static enum tst_fs_impl has_kernel_support(const char *fs_type)
ret = tst_system(buf);
if (WEXITSTATUS(ret) == 127) {
tst_res(TINFO, "Filesystem %s is not supported", fs_type);
- return TST_FS_UNSUPPORTED;
+ return 0;
+ }
+
+ if (flags & TST_FS_SKIP_FUSE) {
+ tst_res(TINFO, "Skipping FUSE as requested by the test");
+ return 0;
}
tst_res(TINFO, "FUSE does support %s", fs_type);
- return TST_FS_FUSE;
+ return 1;
}
-enum tst_fs_impl tst_fs_is_supported(const char *fs_type)
+int tst_fs_is_supported(const char *fs_type, int flags)
{
- enum tst_fs_impl ret;
-
- ret = has_kernel_support(fs_type);
- if (!ret)
- return TST_FS_UNSUPPORTED;
-
- if (has_mkfs(fs_type))
- return ret;
-
- return TST_FS_UNSUPPORTED;
+ return has_kernel_support(fs_type, flags) && has_mkfs(fs_type);
}
-const char **tst_get_supported_fs_types(const char *const *skiplist)
+const char **tst_get_supported_fs_types(int flags)
{
unsigned int i, j = 0;
- int skip_fuse;
- enum tst_fs_impl sup;
-
- skip_fuse = tst_fs_in_skiplist("fuse", skiplist);
for (i = 0; fs_type_whitelist[i]; i++) {
- if (tst_fs_in_skiplist(fs_type_whitelist[i], skiplist)) {
- tst_res(TINFO, "Skipping %s as requested by the test",
- fs_type_whitelist[i]);
- continue;
- }
-
- sup = tst_fs_is_supported(fs_type_whitelist[i]);
-
- if (skip_fuse && sup == TST_FS_FUSE) {
- tst_res(TINFO,
- "Skipping FUSE based %s as requested by the test",
- fs_type_whitelist[i]);
- continue;
- }
-
- if (sup)
+ if (tst_fs_is_supported(fs_type_whitelist[i], flags))
fs_types[j++] = fs_type_whitelist[i];
}
return fs_types;
}
-
-int tst_check_quota_support(const char *device, int format, char *quotafile)
-{
- TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), device, format, quotafile));
-
- /* Not supported */
- if (TST_RET == -1 && TST_ERR == ESRCH)
- return 0;
-
- /* Broken */
- if (TST_RET)
- return -1;
-
- quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), device, 0, 0);
- return 1;
-}
-
-void tst_require_quota_support_(const char *file, const int lineno,
- const char *device, int format, char *quotafile)
-{
- int status = tst_check_quota_support(device, format, quotafile);
-
- if (!status) {
- tst_brk_(file, lineno, TCONF,
- "Kernel or device does not support FS quotas");
- }
-
- if (status < 0)
- tst_brk_(file, lineno, TBROK|TTERRNO, "FS quotas are broken");
-}
diff --git a/lib/tst_sys_conf.c b/lib/tst_sys_conf.c
index 4ad9f8b9b..bbe469936 100644
--- a/lib/tst_sys_conf.c
+++ b/lib/tst_sys_conf.c
@@ -1,5 +1,6 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
* Copyright (c) 2018 Jan Stancek <jstancek@redhat.com>
*/
@@ -26,11 +27,8 @@ int tst_sys_conf_save_str(const char *path, const char *value)
{
struct tst_sys_conf *n = SAFE_MALLOC(sizeof(*n));
- strncpy(n->path, path, sizeof(n->path)-1);
- strncpy(n->value, value, sizeof(n->value)-1);
-
- n->path[sizeof(n->path) - 1] = 0;
- n->value[sizeof(n->value) - 1] = 0;
+ strncpy(n->path, path, sizeof(n->path));
+ strncpy(n->value, value, sizeof(n->value));
n->next = save_restore_data;
save_restore_data = n;
diff --git a/lib/tst_taint.c b/lib/tst_taint.c
index 49146aacb..a5dbf77d2 100644
--- a/lib/tst_taint.c
+++ b/lib/tst_taint.c
@@ -82,14 +82,9 @@ void tst_taint_init(unsigned int mask)
tst_res(TCONF, "Kernel is too old for requested mask");
taint_mask = mask;
- taint = tst_taint_read();
-
- if (taint & TST_TAINT_W) {
- tst_res(TCONF, "Ignoring already set kernel warning taint");
- taint_mask &= ~TST_TAINT_W;
- }
- if ((taint & taint_mask) != 0)
+ taint = tst_taint_read();
+ if ((taint & mask) != 0)
tst_brk(TBROK, "Kernel is already tainted: %u", taint);
}
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 55449c80b..8d7dee2cc 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1,10 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) Linux Test Project, 2016-2021
*/
-#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
@@ -33,15 +31,7 @@
#include "old_device.h"
#include "old_tmpdir.h"
-/*
- * Hack to get TCID defined in newlib tests
- */
-const char *TCID __attribute__((weak));
-
-/* update also docparse/testinfo.pl */
#define LINUX_GIT_URL "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id="
-#define LINUX_STABLE_GIT_URL "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id="
-#define GLIBC_GIT_URL "https://sourceware.org/git/?p=glibc.git;a=commit;h="
#define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
struct tst_test *tst_test;
@@ -60,7 +50,6 @@ struct results {
int skipped;
int failed;
int warnings;
- int broken;
unsigned int timeout;
};
@@ -73,13 +62,12 @@ extern unsigned int tst_max_futexes;
#define IPC_ENV_VAR "LTP_IPC_PATH"
-static char ipc_path[1064];
+static char ipc_path[1024];
const char *tst_ipc_path = ipc_path;
static char shm_path[1024];
int TST_ERR;
-int TST_PASS;
long TST_RET;
static void do_cleanup(void);
@@ -185,9 +173,6 @@ static void update_results(int ttype)
case TFAIL:
tst_atomic_inc(&results->failed);
break;
- case TBROK:
- tst_atomic_inc(&results->broken);
- break;
}
}
@@ -196,28 +181,28 @@ static void print_result(const char *file, const int lineno, int ttype,
{
char buf[1024];
char *str = buf;
- int ret, size = sizeof(buf), ssize, int_errno, buflen;
+ int ret, size = sizeof(buf), ssize, int_errno;
const char *str_errno = NULL;
const char *res;
switch (TTYPE_RESULT(ttype)) {
case TPASS:
- res = "TPASS";
+ res = "PASS";
break;
case TFAIL:
- res = "TFAIL";
+ res = "FAIL";
break;
case TBROK:
- res = "TBROK";
+ res = "BROK";
break;
case TCONF:
- res = "TCONF";
+ res = "CONF";
break;
case TWARN:
- res = "TWARN";
+ res = "WARN";
break;
case TINFO:
- res = "TINFO";
+ res = "INFO";
break;
default:
tst_brk(TBROK, "Invalid ttype value %i", ttype);
@@ -270,17 +255,7 @@ static void print_result(const char *file, const int lineno, int ttype,
snprintf(str, size, "\n");
- /* we might be called from signal handler, so use write() */
- buflen = str - buf + 1;
- str = buf;
- while (buflen) {
- ret = write(STDERR_FILENO, str, buflen);
- if (ret <= 0)
- break;
-
- str += ret;
- buflen -= ret;
- }
+ fputs(buf, stderr);
}
void tst_vres_(const char *file, const int lineno, int ttype,
@@ -325,7 +300,6 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
const char *fmt, va_list va)
{
print_result(file, lineno, ttype, fmt, va);
- update_results(TTYPE_RESULT(ttype));
/*
* The getpid implementation in some C library versions may cause cloned
@@ -372,13 +346,15 @@ static void check_child_status(pid_t pid, int status)
}
if (!(WIFEXITED(status)))
- tst_brk(TBROK, "Child (%i) exited abnormally", pid);
+ tst_brk(TBROK, "Child (%i) exited abnormaly", pid);
ret = WEXITSTATUS(status);
switch (ret) {
case TPASS:
+ break;
case TBROK:
case TCONF:
+ tst_brk(ret, "Reported by child (%i)", pid);
break;
default:
tst_brk(TBROK, "Invalid child (%i) exit value %i", pid, ret);
@@ -428,31 +404,6 @@ pid_t safe_fork(const char *filename, unsigned int lineno)
return pid;
}
-pid_t safe_clone(const char *file, const int lineno,
- const struct tst_clone_args *args)
-{
- pid_t pid;
-
- if (!tst_test->forks_child)
- tst_brk(TBROK, "test.forks_child must be set!");
-
- pid = tst_clone(args);
-
- switch (pid) {
- case -1:
- tst_brk_(file, lineno, TBROK | TERRNO, "clone3 failed");
- break;
- case -2:
- tst_brk_(file, lineno, TBROK | TERRNO, "clone failed");
- return -1;
- }
-
- if (!pid)
- atexit(tst_free_all);
-
- return pid;
-}
-
static struct option {
char *optstr;
char *help;
@@ -485,23 +436,18 @@ static void print_test_tags(void)
unsigned int i;
const struct tst_tag *tags = tst_test->tags;
- if (!tags)
- return;
-
printf("\nTags\n");
printf("----\n");
- for (i = 0; tags[i].name; i++) {
- if (!strcmp(tags[i].name, "CVE"))
- printf(CVE_DB_URL "%s\n", tags[i].value);
- else if (!strcmp(tags[i].name, "linux-git"))
- printf(LINUX_GIT_URL "%s\n", tags[i].value);
- else if (!strcmp(tags[i].name, "linux-stable-git"))
- printf(LINUX_STABLE_GIT_URL "%s\n", tags[i].value);
- else if (!strcmp(tags[i].name, "glibc-git"))
- printf(GLIBC_GIT_URL "%s\n", tags[i].value);
- else
- printf("%s: %s\n", tags[i].name, tags[i].value);
+ if (tags) {
+ for (i = 0; tags[i].name; i++) {
+ if (!strcmp(tags[i].name, "CVE"))
+ printf(CVE_DB_URL "%s\n", tags[i].value);
+ else if (!strcmp(tags[i].name, "linux-git"))
+ printf(LINUX_GIT_URL "%s\n", tags[i].value);
+ else
+ printf("%s: %s\n", tags[i].name, tags[i].value);
+ }
}
printf("\n");
@@ -679,39 +625,42 @@ static void print_colored(const char *str)
printf("%s", str);
}
-static void print_failure_hint(const char *tag, const char *hint,
- const char *url)
+static void print_failure_hints(void)
{
+ unsigned int i;
const struct tst_tag *tags = tst_test->tags;
if (!tags)
return;
- unsigned int i;
int hint_printed = 0;
-
for (i = 0; tags[i].name; i++) {
- if (!strcmp(tags[i].name, tag)) {
+ if (!strcmp(tags[i].name, "linux-git")) {
if (!hint_printed) {
hint_printed = 1;
printf("\n");
print_colored("HINT: ");
- printf("You _MAY_ be %s, see:\n\n", hint);
+ printf("You _MAY_ be missing kernel fixes, see:\n\n");
}
- printf("%s%s\n", url, tags[i].value);
+ printf(LINUX_GIT_URL "%s\n", tags[i].value);
}
+
}
-}
-/* update also docparse/testinfo.pl */
-static void print_failure_hints(void)
-{
- print_failure_hint("linux-git", "missing kernel fixes", LINUX_GIT_URL);
- print_failure_hint("linux-stable-git", "missing stable kernel fixes",
- LINUX_STABLE_GIT_URL);
- print_failure_hint("glibc-git", "missing glibc fixes", GLIBC_GIT_URL);
- print_failure_hint("CVE", "vulnerable to CVE(s)", CVE_DB_URL);
+ hint_printed = 0;
+ for (i = 0; tags[i].name; i++) {
+ if (!strcmp(tags[i].name, "CVE")) {
+ if (!hint_printed) {
+ hint_printed = 1;
+ printf("\n");
+ print_colored("HINT: ");
+ printf("You _MAY_ be vunerable to CVE(s), see:\n\n");
+ }
+
+ printf(CVE_DB_URL "%s\n", tags[i].value);
+ }
+ }
}
static void do_exit(int ret)
@@ -731,13 +680,9 @@ static void do_exit(int ret)
if (results->warnings)
ret |= TWARN;
- if (results->broken)
- ret |= TBROK;
-
printf("\nSummary:\n");
printf("passed %d\n", results->passed);
printf("failed %d\n", results->failed);
- printf("broken %d\n", results->broken);
printf("skipped %d\n", results->skipped);
printf("warnings %d\n", results->warnings);
}
@@ -774,9 +719,6 @@ static int results_equal(struct results *a, struct results *b)
if (a->skipped != b->skipped)
return 0;
- if (a->broken != b->broken)
- return 0;
-
return 1;
}
@@ -830,7 +772,7 @@ static void assert_test_fn(void)
cnt++;
if (!cnt)
- tst_brk(TBROK, "No test function specified");
+ tst_brk(TBROK, "No test function speficied");
if (cnt != 1)
tst_brk(TBROK, "You can define only one test function");
@@ -915,7 +857,7 @@ static void do_setup(int argc, char *argv[])
assert_test_fn();
- TCID = tid = get_tid(argv);
+ tid = get_tid(argv);
if (tst_test->sample)
tst_test = tst_timer_test_setup(tst_test);
@@ -928,16 +870,6 @@ static void do_setup(int argc, char *argv[])
if (tst_test->min_kver)
check_kver();
- if (tst_test->needs_cmds) {
- const char *cmd;
- char path[PATH_MAX];
- int i;
-
- for (i = 0; (cmd = tst_test->needs_cmds[i]); ++i)
- if (tst_get_path(cmd, path, sizeof(path)))
- tst_brk(TCONF, "Couldn't find '%s' in $PATH", cmd);
- }
-
if (tst_test->needs_drivers) {
const char *name;
int i;
@@ -947,20 +879,16 @@ static void do_setup(int argc, char *argv[])
tst_brk(TCONF, "%s driver not available", name);
}
- if (tst_test->mount_device)
- tst_test->format_device = 1;
-
if (tst_test->format_device)
tst_test->needs_device = 1;
- if (tst_test->all_filesystems)
+ if (tst_test->mount_device) {
tst_test->needs_device = 1;
+ tst_test->format_device = 1;
+ }
- if (tst_test->min_cpus > (unsigned long)tst_ncpus())
- tst_brk(TCONF, "Test needs at least %lu CPUs online", tst_test->min_cpus);
-
- if (tst_test->request_hugepages)
- tst_request_hugepages(tst_test->request_hugepages);
+ if (tst_test->all_filesystems)
+ tst_test->needs_device = 1;
setup_ipc();
@@ -1042,27 +970,12 @@ static void do_setup(int argc, char *argv[])
if (tst_test->restore_wallclock)
tst_wallclock_save();
-
- if (tst_test->taint_check)
- tst_taint_init(tst_test->taint_check);
}
static void do_test_setup(void)
{
main_pid = getpid();
- if (!tst_test->all_filesystems && tst_test->skip_filesystems) {
- long fs_type = tst_fs_type(".");
- const char *fs_name = tst_fs_type_name(fs_type);
-
- if (tst_fs_in_skiplist(fs_name, tst_test->skip_filesystems)) {
- tst_brk(TCONF, "%s is not supported by the test",
- fs_name);
- }
-
- tst_res(TINFO, "%s is supported by the test", fs_name);
- }
-
if (tst_test->caps)
tst_cap_setup(tst_test->caps, TST_CAP_REQ);
@@ -1093,7 +1006,8 @@ static void do_cleanup(void)
tst_rmdir();
}
- tst_sys_conf_restore(0);
+ if (tst_test->save_restore)
+ tst_sys_conf_restore(0);
if (tst_test->restore_wallclock)
tst_wallclock_restore();
@@ -1168,16 +1082,6 @@ static void heartbeat(void)
if (tst_clock_gettime(CLOCK_MONOTONIC, &tst_start_time))
tst_res(TWARN | TERRNO, "tst_clock_gettime() failed");
- if (getppid() == 1) {
- tst_res(TFAIL, "Main test process might have exit!");
- /*
- * We need kill the task group immediately since the
- * main process has exit.
- */
- kill(0, SIGKILL);
- exit(TBROK);
- }
-
kill(getppid(), SIGUSR1);
}
@@ -1236,7 +1140,7 @@ static void alarm_handler(int sig LTP_ATTRIBUTE_UNUSED)
if (++sigkill_retries > 10) {
WRITE_MSG("Cannot kill test processes!\n");
WRITE_MSG("Congratulation, likely test hit a kernel bug.\n");
- WRITE_MSG("Exiting uncleanly...\n");
+ WRITE_MSG("Exitting uncleanly...\n");
_exit(TFAIL);
}
}
@@ -1345,11 +1249,6 @@ static int fork_testrun(void)
alarm(0);
SAFE_SIGNAL(SIGINT, SIG_DFL);
- if (tst_test->taint_check && tst_taint_check()) {
- tst_res(TFAIL, "Kernel is now tainted.");
- return TFAIL;
- }
-
if (WIFEXITED(status) && WEXITSTATUS(status))
return WEXITSTATUS(status);
@@ -1369,7 +1268,7 @@ static int run_tcases_per_fs(void)
{
int ret = 0;
unsigned int i;
- const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);
+ const char *const *filesystems = tst_get_supported_fs_types(tst_test->dev_fs_flags);
if (!filesystems[0])
tst_brk(TCONF, "There are no supported filesystems");
@@ -1388,8 +1287,10 @@ static int run_tcases_per_fs(void)
mntpoint_mounted = 0;
}
- if (ret == TCONF)
+ if (ret == TCONF) {
+ update_results(ret);
continue;
+ }
if (ret == 0)
continue;
@@ -1412,6 +1313,8 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
do_setup(argc, argv);
+ TCID = tid;
+
SAFE_SIGNAL(SIGALRM, alarm_handler);
SAFE_SIGNAL(SIGUSR1, heartbeat_handler);
@@ -1441,7 +1344,7 @@ void tst_flush(void)
if (rval != 0)
tst_brk(TBROK | TERRNO, "fflush(stderr) failed");
- rval = fflush(stdout);
+ rval = fflush(stderr);
if (rval != 0)
tst_brk(TBROK | TERRNO, "fflush(stdout) failed");
diff --git a/lib/tst_timer.c b/lib/tst_timer.c
index 62d8f9080..f7f09f3d2 100644
--- a/lib/tst_timer.c
+++ b/lib/tst_timer.c
@@ -15,6 +15,30 @@
static struct timespec start_time, stop_time;
static clockid_t clock_id;
+const char *tst_clock_name(clockid_t clk_id)
+{
+ switch (clk_id) {
+ case CLOCK_REALTIME:
+ return "CLOCK_REALTIME";
+ case CLOCK_REALTIME_COARSE:
+ return "CLOCK_REALTIME_COARSE";
+ case CLOCK_MONOTONIC:
+ return "CLOCK_MONOTONIC";
+ case CLOCK_MONOTONIC_COARSE:
+ return "CLOCK_MONOTONIC_COARSE";
+ case CLOCK_MONOTONIC_RAW:
+ return "CLOCK_MONOTONIC_RAW";
+ case CLOCK_BOOTTIME:
+ return "CLOCK_BOOTTIME";
+ case CLOCK_PROCESS_CPUTIME_ID:
+ return "CLOCK_PROCESS_CPUTIME_ID";
+ case CLOCK_THREAD_CPUTIME_ID:
+ return "CLOCK_THREAD_CPUTIME_ID";
+ default:
+ return "UNKNOWN/INVALID";
+ }
+}
+
void tst_timer_check(clockid_t clk_id)
{
if (tst_clock_gettime(clk_id, &start_time)) {
diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
index 3cd52fc9d..196c51272 100644
--- a/lib/tst_timer_test.c
+++ b/lib/tst_timer_test.c
@@ -267,7 +267,7 @@ void do_timer_test(long long usec, unsigned int nsamples)
cur_sample = 0;
for (i = 0; i < (int)nsamples; i++) {
if (sample(CLOCK_MONOTONIC, usec)) {
- tst_res(TINFO, "sampling function failed, exiting");
+ tst_res(TINFO, "sampling function failed, exitting");
return;
}
}
diff --git a/lib/tst_tmpdir.c b/lib/tst_tmpdir.c
index 0c39eb89f..09b7b6e22 100644
--- a/lib/tst_tmpdir.c
+++ b/lib/tst_tmpdir.c
@@ -99,8 +99,6 @@ static char test_start_work_dir[PATH_MAX];
/* lib/tst_checkpoint.c */
extern futex_t *tst_futexes;
-static int rmobj(const char *obj, char **errmsg);
-
int tst_tmpdir_created(void)
{
return TESTDIR != NULL;
@@ -121,65 +119,60 @@ const char *tst_get_startwd(void)
return test_start_work_dir;
}
-static int purge_dir(const char *path, char **errptr)
+static int rmobj(char *obj, char **errmsg)
{
int ret_val = 0;
DIR *dir;
struct dirent *dir_ent;
char dirobj[PATH_MAX];
- static char err_msg[PATH_MAX + 1280];
-
- /* Do NOT perform the request if the directory is "/" */
- if (!strcmp(path, "/")) {
- if (errptr) {
- strcpy(err_msg, "Cannot purge system root directory");
- *errptr = err_msg;
- }
+ struct stat statbuf;
+ static char err_msg[1024];
+ int fd;
- return -1;
- }
+ fd = open(obj, O_DIRECTORY | O_NOFOLLOW);
+ if (fd != -1) {
+ close(fd);
- errno = 0;
+ /* Do NOT perform the request if the directory is "/" */
+ if (!strcmp(obj, "/")) {
+ if (errmsg != NULL) {
+ sprintf(err_msg, "Cannot remove /");
+ *errmsg = err_msg;
+ }
+ return -1;
+ }
- /* Open the directory to get access to what is in it */
- if (!(dir = opendir(path))) {
- if (errptr) {
- sprintf(err_msg,
- "Cannot open directory %s; errno=%d: %s",
- path, errno, tst_strerrno(errno));
- *errptr = err_msg;
+ /* Open the directory to get access to what is in it */
+ if ((dir = opendir(obj)) == NULL) {
+ if (rmdir(obj) != 0) {
+ if (errmsg != NULL) {
+ sprintf(err_msg,
+ "rmdir(%s) failed; errno=%d: %s",
+ obj, errno, tst_strerrno(errno));
+ *errmsg = err_msg;
+ }
+ return -1;
+ } else {
+ return 0;
+ }
}
- return -1;
- }
- /* Loop through the entries in the directory, removing each one */
- for (dir_ent = readdir(dir); dir_ent; dir_ent = readdir(dir)) {
- /* Don't remove "." or ".." */
- if (!strcmp(dir_ent->d_name, ".")
- || !strcmp(dir_ent->d_name, ".."))
- continue;
-
- /* Recursively remove the current entry */
- sprintf(dirobj, "%s/%s", path, dir_ent->d_name);
- if (rmobj(dirobj, errptr) != 0)
- ret_val = -1;
- }
+ /* Loop through the entries in the directory, removing each one */
+ for (dir_ent = (struct dirent *)readdir(dir);
+ dir_ent != NULL; dir_ent = (struct dirent *)readdir(dir)) {
- closedir(dir);
- return ret_val;
-}
+ /* Don't remove "." or ".." */
+ if (!strcmp(dir_ent->d_name, ".")
+ || !strcmp(dir_ent->d_name, ".."))
+ continue;
-static int rmobj(const char *obj, char **errmsg)
-{
- int ret_val = 0;
- struct stat statbuf;
- static char err_msg[PATH_MAX + 1280];
- int fd;
+ /* Recursively call this routine to remove the current entry */
+ sprintf(dirobj, "%s/%s", obj, dir_ent->d_name);
+ if (rmobj(dirobj, errmsg) != 0)
+ ret_val = -1;
+ }
- fd = open(obj, O_DIRECTORY | O_NOFOLLOW);
- if (fd >= 0) {
- close(fd);
- ret_val = purge_dir(obj, errmsg);
+ closedir(dir);
/* If there were problems removing an entry, don't attempt to
remove the directory itself */
@@ -337,11 +330,3 @@ void tst_rmdir(void)
__func__, TESTDIR, errmsg);
}
}
-
-void tst_purge_dir(const char *path)
-{
- char *err;
-
- if (purge_dir(path, &err))
- tst_brkm(TBROK, NULL, "%s: %s", __func__, err);
-}
diff --git a/lib/tst_virt.c b/lib/tst_virt.c
index 21e8f7343..d21f74c1c 100644
--- a/lib/tst_virt.c
+++ b/lib/tst_virt.c
@@ -56,8 +56,7 @@ static int is_kvm(void)
SAFE_FCLOSE(NULL, cpuinfo);
- if (file_exist("/dev/vda") || file_exist("/dev/block/vda")
- || file_exist("/sys/block/vda"))
+ if (file_exist("/dev/vda") || file_exist("/dev/block/vda"))
found = 1;
return found;
@@ -80,46 +79,13 @@ static int is_xen(void)
return 0;
}
-static int is_ibmz(int virt_type)
-{
- FILE *sysinfo;
- char line[64];
- int found_lpar, found_zvm;
-
- if (access("/proc/sysinfo", F_OK) != 0)
- return 0;
-
- sysinfo = SAFE_FOPEN(NULL, "/proc/sysinfo", "r");
- found_lpar = 0;
- found_zvm = 0;
- while (fgets(line, sizeof(line), sysinfo) != NULL) {
- if (strstr(line, "LPAR"))
- found_lpar = 1;
- else if (strstr(line, "z/VM"))
- found_zvm = 1;
- }
-
- SAFE_FCLOSE(NULL, sysinfo);
-
- switch (virt_type) {
- case VIRT_IBMZ:
- return found_lpar;
- case VIRT_IBMZ_LPAR:
- return found_lpar && !found_zvm;
- case VIRT_IBMZ_ZVM:
- return found_lpar && found_zvm;
- default:
- return 0;
- }
-}
-
static int try_systemd_detect_virt(void)
{
FILE *f;
char virt_type[64];
int ret;
- /* See tst_cmd.c */
+ /* See tst_run_cmd.c */
void *old_handler = signal(SIGCHLD, SIG_DFL);
f = popen("systemd-detect-virt", "r");
@@ -151,9 +117,6 @@ static int try_systemd_detect_virt(void)
if (!strncmp("xen", virt_type, 3))
return VIRT_XEN;
- if (!strncmp("zvm", virt_type, 3))
- return VIRT_IBMZ_ZVM;
-
return VIRT_OTHER;
}
@@ -161,24 +124,20 @@ int tst_is_virt(int virt_type)
{
int ret = try_systemd_detect_virt();
- if (ret > 0) {
+ if (ret >= 0) {
if (virt_type == VIRT_ANY)
- return 1;
+ return ret != 0;
else
return ret == virt_type;
}
switch (virt_type) {
case VIRT_ANY:
- return is_xen() || is_kvm() || is_ibmz(VIRT_IBMZ);
+ return is_xen() || is_kvm();
case VIRT_XEN:
return is_xen();
case VIRT_KVM:
return is_kvm();
- case VIRT_IBMZ:
- case VIRT_IBMZ_LPAR:
- case VIRT_IBMZ_ZVM:
- return is_ibmz(virt_type);
case VIRT_OTHER:
return 0;
}
diff --git a/lib/tst_wallclock.c b/lib/tst_wallclock.c
index 838dde8b3..282d6ada3 100644
--- a/lib/tst_wallclock.c
+++ b/lib/tst_wallclock.c
@@ -11,14 +11,11 @@
#include "tst_test.h"
#include "tst_timer.h"
#include "tst_clocks.h"
-#include "tst_rtctime.h"
#include "tst_wallclock.h"
#include "lapi/posix_clocks.h"
static struct timespec real_begin, mono_begin;
-static struct rtc_time rtc_begin;
-
static int clock_saved;
void tst_wallclock_save(void)
@@ -61,43 +58,3 @@ void tst_wallclock_restore(void)
if (tst_clock_settime(CLOCK_REALTIME, &adjust))
tst_brk(TBROK | TERRNO, "tst_clock_settime() realtime failed");
}
-
-void tst_rtc_clock_save(const char *rtc_dev)
-{
- /* save initial monotonic time to restore it when needed */
- if (tst_rtc_gettime(rtc_dev, &rtc_begin))
- tst_brk(TBROK | TERRNO, "tst_rtc_gettime() realtime failed");
-
- if (tst_clock_gettime(CLOCK_MONOTONIC_RAW, &mono_begin))
- tst_brk(TBROK | TERRNO, "tst_clock_gettime() monotonic failed");
-
- clock_saved = 1;
-}
-
-void tst_rtc_clock_restore(const char *rtc_dev)
-{
- static struct timespec mono_end, elapsed;
- static struct timespec rtc_begin_tm, rtc_adjust;
- static struct rtc_time rtc_restore;
-
- if (!clock_saved)
- return;
-
- clock_saved = 0;
-
- if (tst_clock_gettime(CLOCK_MONOTONIC_RAW, &mono_end))
- tst_brk(TBROK | TERRNO, "tst_clock_gettime() monotonic failed");
-
- elapsed = tst_timespec_diff(mono_end, mono_begin);
-
- rtc_begin_tm.tv_nsec = 0;
- rtc_begin_tm.tv_sec = tst_rtc_tm_to_time(&rtc_begin);
-
- rtc_adjust = tst_timespec_add(rtc_begin_tm, elapsed);
-
- tst_rtc_time_to_tm(rtc_adjust.tv_sec, &rtc_restore);
-
- /* restore realtime clock based on monotonic delta */
- if (tst_rtc_settime(rtc_dev, &rtc_restore))
- tst_brk(TBROK | TERRNO, "tst_rtc_settime() realtime failed");
-}
diff --git a/libs/libltpipc/Makefile b/libs/libltpipc/Makefile
deleted file mode 100644
index ad8f5a23b..000000000
--- a/libs/libltpipc/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
-
-top_srcdir ?= ../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INTERNAL_LIB := libltpipc.a
-
-include $(top_srcdir)/include/mk/lib.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpnewipc/Makefile b/libs/libltpnewipc/Makefile
deleted file mode 100644
index 741c78f81..000000000
--- a/libs/libltpnewipc/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2016 Xiao Yang <yangx.jy@cn.fujitsu.com>
-
-top_srcdir ?= ../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INTERNAL_LIB := libltpnewipc.a
-
-include $(top_srcdir)/include/mk/lib.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpnuma/Makefile b/libs/libltpnuma/Makefile
index a6856758d..56d6b7762 100644
--- a/libs/libltpnuma/Makefile
+++ b/libs/libltpnuma/Makefile
@@ -6,7 +6,7 @@ top_srcdir ?= ../..
include $(top_srcdir)/include/mk/env_pre.mk
-INTERNAL_LIB := libltpnuma.a
+LIB := libltpnuma.a
include $(top_srcdir)/include/mk/lib.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpsigwait/Makefile b/libs/libltpsigwait/Makefile
deleted file mode 100644
index e0ea025ad..000000000
--- a/libs/libltpsigwait/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
-
-top_srcdir ?= ../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INTERNAL_LIB := libltpsigwait.a
-
-include $(top_srcdir)/include/mk/lib.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpsigwait/sigwait.c b/libs/libltpsigwait/sigwait.c
deleted file mode 100644
index 2be949929..000000000
--- a/libs/libltpsigwait/sigwait.c
+++ /dev/null
@@ -1,384 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */
-
-#define TST_NO_DEFAULT_MAIN
-#include <errno.h>
-#include <stdlib.h>
-#include <limits.h>
-#include "lapi/syscalls.h"
-#include "libsigwait.h"
-#include "tst_sig_proc.h"
-
-void test_empty_set(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs;
- siginfo_t si;
- pid_t child;
-
- SAFE_SIGEMPTYSET(&sigs);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, INT_MAX, 100000);
-
- TEST(sigwaitinfo(&sigs, &si, NULL));
- if (TST_RET == -1) {
- if (TST_ERR == EINTR)
- tst_res(TPASS, "Wait interrupted by expected signal");
- else
- tst_res(TFAIL | TTERRNO, "Expected error number EINTR, got");
- } else {
- tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET);
- }
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-void test_timeout(swi_func sigwaitinfo, int signo, enum tst_ts_type type)
-{
- sigset_t sigs;
- siginfo_t si;
- pid_t child;
- struct tst_ts ts;
-
- ts.type = type;
- tst_ts_set_sec(&ts, 1);
- tst_ts_set_nsec(&ts, 0);
-
- SAFE_SIGEMPTYSET(&sigs);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, INT_MAX, 100000);
-
- TEST(sigwaitinfo(&sigs, &si, tst_ts_get(&ts)));
- if (TST_RET == -1) {
- if (TST_ERR == EAGAIN)
- tst_res(TPASS, "Wait interrupted by timeout");
- else
- tst_res(TFAIL | TTERRNO, "Expected error number EAGAIN, got");
- } else {
- tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET);
- }
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-/* Note: sigwait-ing for a signal that is not blocked is unspecified
- * by POSIX; but works for non-ignored signals under Linux
- */
-void test_unmasked_matching(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs;
- siginfo_t si;
- pid_t child;
-
- SAFE_SIGEMPTYSET(&sigs);
- SAFE_SIGADDSET(&sigs, signo);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, INT_MAX, 100000);
-
- TEST(sigwaitinfo(&sigs, &si, NULL));
- if (TST_RET == signo) {
- if (si.si_pid == child && si.si_code == SI_USER &&
- si.si_signo == signo)
- tst_res(TPASS, "struct siginfo is correct");
- else
- tst_res(TFAIL, "struct siginfo mismatch");
- } else {
- tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed");
- }
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-void test_unmasked_matching_noinfo(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs;
- pid_t child;
-
- SAFE_SIGEMPTYSET(&sigs);
- SAFE_SIGADDSET(&sigs, signo);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, INT_MAX, 100000);
-
- TEST(sigwaitinfo(&sigs, NULL, NULL));
- if (TST_RET == signo)
- tst_res(TPASS, "Wait interrupted by expected signal");
- else
- tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed");
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-void test_masked_matching(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs, oldmask;
- siginfo_t si;
- pid_t child;
-
- SAFE_SIGEMPTYSET(&sigs);
- SAFE_SIGADDSET(&sigs, signo);
-
- /* let's not get interrupted by our dying child */
- SAFE_SIGADDSET(&sigs, SIGCHLD);
-
- TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "sigprocmask() failed");
-
- /* don't wait on a SIGCHLD */
- SAFE_SIGDELSET(&sigs, SIGCHLD);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, 1, 0);
-
- TEST(sigwaitinfo(&sigs, &si, NULL));
- if (TST_RET == signo) {
- if (si.si_pid == child && si.si_code == SI_USER &&
- si.si_signo == signo)
- tst_res(TPASS, "struct siginfo is correct");
- else
- tst_res(TFAIL, "struct siginfo mismatch");
- } else {
- tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed");
- }
-
- TEST(sigprocmask(SIG_SETMASK, &oldmask, &sigs));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
-
- if (sigismember(&sigs, signo))
- tst_res(TPASS, "sigwaitinfo restored the original mask");
- else
- tst_res(TFAIL,
- "sigwaitinfo failed to restore the original mask");
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-void test_masked_matching_rt(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs, oldmask;
- siginfo_t si;
- pid_t child[2];
- int status;
-
- signo = SIGRTMIN + 1;
-
- SAFE_SIGEMPTYSET(&sigs);
- SAFE_SIGADDSET(&sigs, signo);
- SAFE_SIGADDSET(&sigs, signo + 1);
-
- /* let's not get interrupted by our dying child */
- SAFE_SIGADDSET(&sigs, SIGCHLD);
-
- TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "sigprocmask() failed");
-
- /* don't wait on a SIGCHLD */
- SAFE_SIGDELSET(&sigs, SIGCHLD);
-
- /* Run a child that will wake us up */
- child[0] = create_sig_proc(signo, 1, 0);
- child[1] = create_sig_proc(signo + 1, 1, 0);
-
- /* Ensure that the signals have been sent */
- SAFE_WAITPID(child[0], &status, 0);
- SAFE_WAITPID(child[1], &status, 0);
-
- TEST(sigwaitinfo(&sigs, &si, NULL));
- if (TST_RET == signo) {
- if (si.si_pid == child[0] && si.si_code == SI_USER &&
- si.si_signo == signo)
- tst_res(TPASS, "struct siginfo is correct");
- else
- tst_res(TFAIL, "struct siginfo mismatch");
- } else {
- tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed");
- }
-
- /* eat the other signal */
- TEST(sigwaitinfo(&sigs, &si, NULL));
- if (TST_RET == signo + 1) {
- if (si.si_pid == child[1] && si.si_code == SI_USER &&
- si.si_signo == signo + 1)
- tst_res(TPASS, "struct siginfo is correct");
- else
- tst_res(TFAIL, "struct siginfo mismatch");
- } else {
- tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed");
- }
-
- TEST(sigprocmask(SIG_SETMASK, &oldmask, &sigs));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
-
- if (sigismember(&sigs, signo))
- tst_res(TPASS, "sigwaitinfo restored the original mask");
- else
- tst_res(TFAIL,
- "sigwaitinfo failed to restore the original mask");
-}
-
-void test_masked_matching_noinfo(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs, oldmask;
- pid_t child;
-
- SAFE_SIGEMPTYSET(&sigs);
- SAFE_SIGADDSET(&sigs, signo);
-
- /* let's not get interrupted by our dying child */
- SAFE_SIGADDSET(&sigs, SIGCHLD);
-
- TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "sigprocmask() failed");
-
- /* don't wait on a SIGCHLD */
- SAFE_SIGDELSET(&sigs, SIGCHLD);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, 1, 0);
-
- TEST(sigwaitinfo(&sigs, NULL, NULL));
- if (TST_RET == signo)
- tst_res(TPASS, "Wait interrupted by expected signal");
- else
- tst_res(TFAIL | TTERRNO, "sigwaitinfo() failed");
-
- TEST(sigprocmask(SIG_SETMASK, &oldmask, &sigs));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
-
- if (sigismember(&sigs, signo))
- tst_res(TPASS, "sigwaitinfo restored the original mask");
- else
- tst_res(TFAIL,
- "sigwaitinfo failed to restore the original mask");
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-void test_bad_address(swi_func sigwaitinfo, int signo,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs, oldmask;
- pid_t child;
-
- SAFE_SIGEMPTYSET(&sigs);
- SAFE_SIGADDSET(&sigs, signo);
-
- /* let's not get interrupted by our dying child */
- SAFE_SIGADDSET(&sigs, SIGCHLD);
-
- TEST(sigprocmask(SIG_SETMASK, &sigs, &oldmask));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "sigprocmask() failed");
-
- /* don't wait on a SIGCHLD */
- SAFE_SIGDELSET(&sigs, SIGCHLD);
-
- /* Run a child that will wake us up */
- child = create_sig_proc(signo, 1, 0);
-
- TEST(sigwaitinfo(&sigs, (void *)1, NULL));
- if (TST_RET == -1) {
- if (TST_ERR == EFAULT)
- tst_res(TPASS, "Fault occurred while accessing the buffers");
- else
- tst_res(TFAIL | TTERRNO, "Expected error number EFAULT, got");
- } else {
- tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET);
- }
-
- TEST(sigprocmask(SIG_SETMASK, &oldmask, NULL));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "restoring original signal mask failed");
-
- SAFE_KILL(child, SIGTERM);
- SAFE_WAIT(NULL);
-}
-
-void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- pid_t pid;
- int status;
-
- pid = SAFE_FORK();
- if (pid == 0) {
- signal(SIGSEGV, SIG_DFL);
-
- /*
- * depending on glibc implementation we should
- * either crash or get EFAULT
- */
- TEST(sigwaitinfo((void *)1, NULL, NULL));
-
- if (TST_RET == -1 && TST_ERR == EFAULT)
- _exit(0);
-
- tst_res(TINFO | TTERRNO, "swi_func returned: %ld", TST_RET);
- _exit(1);
- }
-
- SAFE_WAITPID(pid, &status, 0);
-
- if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
- || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
- tst_res(TPASS, "Child exited with expected code");
- return;
- }
-
- if (WIFEXITED(status)) {
- tst_res(TFAIL, "Unrecognised child exit code: %d",
- WEXITSTATUS(status));
- }
- if (WIFSIGNALED(status)) {
- tst_res(TFAIL, "Unrecognised child termsig: %d",
- WTERMSIG(status));
- }
-}
-
-void test_bad_address3(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
- enum tst_ts_type type LTP_ATTRIBUTE_UNUSED)
-{
- sigset_t sigs;
-
- SAFE_SIGEMPTYSET(&sigs);
- TEST(sigwaitinfo(&sigs, NULL, (void *)1));
- if (TST_RET == -1) {
- if (TST_ERR == EFAULT)
- tst_res(TPASS, "Fault occurred while accessing the buffers");
- else
- tst_res(TFAIL | TTERRNO, "Expected error number EFAULT, got");
- } else {
- tst_res(TFAIL, "Expected return value -1, got: %ld", TST_RET);
- }
-}
-
-static void empty_handler(int sig LTP_ATTRIBUTE_UNUSED)
-{
-}
-
-void sigwait_setup(void)
-{
- signal(SIGUSR1, empty_handler);
- signal(SIGALRM, empty_handler);
- signal(SIGUSR2, SIG_IGN);
-}
diff --git a/libs/libltpswap/Makefile b/libs/libltpswap/Makefile
deleted file mode 100644
index d8e692d17..000000000
--- a/libs/libltpswap/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-#
-# Copyright (C) Richard Purdie <richard.purdie@linuxfoundation.org>
-
-top_srcdir ?= ../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INTERNAL_LIB := libltpswap.a
-
-include $(top_srcdir)/include/mk/lib.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
deleted file mode 100644
index 796ac0334..000000000
--- a/libs/libltpswap/libswap.c
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
- * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
- */
-
-#include <errno.h>
-
-#define TST_NO_DEFAULT_MAIN
-
-#include "lapi/syscalls.h"
-#include "tst_test.h"
-#include "libswap.h"
-
-/*
- * Make a swap file
- */
-int make_swapfile(const char *swapfile, int safe)
-{
- if (!tst_fs_has_free(".", sysconf(_SC_PAGESIZE) * 10, TST_BYTES))
- tst_brk(TBROK, "Insufficient disk space to create swap file");
-
- /* create file */
- if (tst_fill_file(swapfile, 0, sysconf(_SC_PAGESIZE), 10) != 0)
- tst_brk(TBROK, "Failed to create swapfile");
-
- /* make the file swapfile */
- const char *argv[2 + 1];
- argv[0] = "mkswap";
- argv[1] = swapfile;
- argv[2] = NULL;
-
- return tst_cmd(argv, "/dev/null", "/dev/null", safe);
-}
-
-/*
- * Check swapon/swapoff support status of filesystems or files
- * we are testing on.
- */
-void is_swap_supported(const char *filename)
-{
- int fibmap = tst_fibmap(filename);
- long fs_type = tst_fs_type(filename);
- const char *fstype = tst_fs_type_name(fs_type);
-
- int ret = make_swapfile(filename, 1);
- if (ret != 0) {
- if (fibmap == 1)
- tst_brk(TCONF, "mkswap on %s not supported", fstype);
- else
- tst_brk(TFAIL, "mkswap on %s failed", fstype);
- }
-
- TEST(tst_syscall(__NR_swapon, filename, 0));
- if (TST_RET == -1) {
- if (fibmap == 1 && errno == EINVAL)
- tst_brk(TCONF, "Swapfile on %s not implemented", fstype);
- else
- tst_brk(TFAIL | TTERRNO, "swapon on %s failed", fstype);
- }
-
- TEST(tst_syscall(__NR_swapoff, filename, 0));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "swapoff on %s failed", fstype);
-}
diff --git a/libs/libltpuinput/Makefile b/libs/libltpuinput/Makefile
index c72dd2e1e..dd2a6c096 100644
--- a/libs/libltpuinput/Makefile
+++ b/libs/libltpuinput/Makefile
@@ -6,7 +6,7 @@ top_srcdir ?= ../..
include $(top_srcdir)/include/mk/env_pre.mk
-INTERNAL_LIB := libltpuinput.a
+LIB := libltpuinput.a
include $(top_srcdir)/include/mk/lib.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpvdso/Makefile b/libs/libltpvdso/Makefile
deleted file mode 100644
index 6b35bdf87..000000000
--- a/libs/libltpvdso/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2020
-
-top_srcdir ?= ../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-LIB := libltpvdso.a
-
-include $(top_srcdir)/include/mk/lib.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpvdso/README b/libs/libltpvdso/README
deleted file mode 100644
index e208f7ef3..000000000
--- a/libs/libltpvdso/README
+++ /dev/null
@@ -1 +0,0 @@
-Copied from kernel tree: tools/testing/selftests/vDSO/parse_vdso.c
diff --git a/libs/libltpvdso/parse_vdso.c b/libs/libltpvdso/parse_vdso.c
deleted file mode 100644
index cd75a8945..000000000
--- a/libs/libltpvdso/parse_vdso.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * parse_vdso.c: Linux reference vDSO parser
- * Written by Andrew Lutomirski, 2011-2014.
- *
- * This code is meant to be linked in to various programs that run on Linux.
- * As such, it is available with as few restrictions as possible. This file
- * is licensed under the Creative Commons Zero License, version 1.0,
- * available at http://creativecommons.org/publicdomain/zero/1.0/legalcode
- *
- * The vDSO is a regular ELF DSO that the kernel maps into user space when
- * it starts a program. It works equally well in statically and dynamically
- * linked binaries.
- *
- * This code is tested on x86. In principle it should work on any
- * architecture that has a vDSO.
- */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <string.h>
-#include <limits.h>
-#include <elf.h>
-
-/* And here's the code. */
-#ifndef ELF_BITS
-# if ULONG_MAX > 0xffffffffUL
-# define ELF_BITS 64
-# else
-# define ELF_BITS 32
-# endif
-#endif
-
-#define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x
-#define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x)
-#define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
-
-static struct vdso_info
-{
- bool valid;
-
- /* Load information */
- uintptr_t load_addr;
- uintptr_t load_offset; /* load_addr - recorded vaddr */
-
- /* Symbol table */
- ELF(Sym) *symtab;
- const char *symstrings;
- void *bucket, *chain;
- ELF(Word) nbucket, nchain;
- bool hash_ent_is_dword;
-
- /* Version table */
- ELF(Versym) *versym;
- ELF(Verdef) *verdef;
-} vdso_info;
-
-/* Straight from the ELF specification. */
-static unsigned long elf_hash(const unsigned char *name)
-{
- unsigned long h = 0, g;
- while (*name)
- {
- h = (h << 4) + *name++;
- if ((g = h & 0xf0000000))
- h ^= g >> 24;
- h &= ~g;
- }
- return h;
-}
-
-/* return value of hash table entry */
-ELF(Word) get_hash_val(void *ptr, ELF(Word) idx)
-{
- if (vdso_info.hash_ent_is_dword) {
- ELF(Xword) *table = ptr;
- /* for vdso assume all values fit in Elf Word */
- return (ELF(Word)) table[idx];
- }
-
- ELF(Word) *table = ptr;
- return table[idx];
-}
-
-/* return pointer to hash table entry */
-void *get_hash_ptr(void *ptr, ELF(Word) idx)
-{
- if (vdso_info.hash_ent_is_dword)
- return &((ELF(Xword) *) ptr)[idx];
-
- return &((ELF(Word) *) ptr)[idx];
-}
-
-void vdso_init_from_sysinfo_ehdr(uintptr_t base)
-{
- size_t i;
- bool found_vaddr = false;
-
- vdso_info.valid = false;
-
- vdso_info.load_addr = base;
-
- ELF(Ehdr) *hdr = (ELF(Ehdr)*)base;
- if (hdr->e_ident[EI_CLASS] !=
- (ELF_BITS == 32 ? ELFCLASS32 : ELFCLASS64)) {
- return; /* Wrong ELF class -- check ELF_BITS */
- }
-
- /* 64bit s390 and alpha have hash entry size of 8 bytes */
- if ((hdr->e_machine == EM_ALPHA
- || hdr->e_machine == EM_S390)
- && hdr->e_ident[EI_CLASS] == ELFCLASS64)
- vdso_info.hash_ent_is_dword = true;
- else
- vdso_info.hash_ent_is_dword = false;
-
- ELF(Phdr) *pt = (ELF(Phdr)*)(vdso_info.load_addr + hdr->e_phoff);
- ELF(Dyn) *dyn = 0;
-
- /*
- * We need two things from the segment table: the load offset
- * and the dynamic table.
- */
- for (i = 0; i < hdr->e_phnum; i++)
- {
- if (pt[i].p_type == PT_LOAD && !found_vaddr) {
- found_vaddr = true;
- vdso_info.load_offset = base
- + (uintptr_t)pt[i].p_offset
- - (uintptr_t)pt[i].p_vaddr;
- } else if (pt[i].p_type == PT_DYNAMIC) {
- dyn = (ELF(Dyn)*)(base + pt[i].p_offset);
- }
- }
-
- if (!found_vaddr || !dyn)
- return; /* Failed */
-
- /*
- * Fish out the useful bits of the dynamic table.
- */
- ELF(Word) *hash = 0;
- vdso_info.symstrings = 0;
- vdso_info.symtab = 0;
- vdso_info.versym = 0;
- vdso_info.verdef = 0;
- for (i = 0; dyn[i].d_tag != DT_NULL; i++) {
- switch (dyn[i].d_tag) {
- case DT_STRTAB:
- vdso_info.symstrings = (const char *)
- ((uintptr_t)dyn[i].d_un.d_ptr
- + vdso_info.load_offset);
- break;
- case DT_SYMTAB:
- vdso_info.symtab = (ELF(Sym) *)
- ((uintptr_t)dyn[i].d_un.d_ptr
- + vdso_info.load_offset);
- break;
- case DT_HASH:
- hash = (ELF(Word) *)
- ((uintptr_t)dyn[i].d_un.d_ptr
- + vdso_info.load_offset);
- break;
- case DT_VERSYM:
- vdso_info.versym = (ELF(Versym) *)
- ((uintptr_t)dyn[i].d_un.d_ptr
- + vdso_info.load_offset);
- break;
- case DT_VERDEF:
- vdso_info.verdef = (ELF(Verdef) *)
- ((uintptr_t)dyn[i].d_un.d_ptr
- + vdso_info.load_offset);
- break;
- }
- }
- if (!vdso_info.symstrings || !vdso_info.symtab || !hash)
- return; /* Failed */
-
- if (!vdso_info.verdef)
- vdso_info.versym = 0;
-
-
- vdso_info.nbucket = get_hash_val(hash, 0);
- vdso_info.nchain = get_hash_val(hash, 1);
- vdso_info.bucket = get_hash_ptr(hash, 2);
- vdso_info.chain = get_hash_ptr(hash, vdso_info.nbucket + 2);
-
- /* That's all we need. */
- vdso_info.valid = true;
-}
-
-static bool vdso_match_version(ELF(Versym) ver,
- const char *name, ELF(Word) hash)
-{
- /*
- * This is a helper function to check if the version indexed by
- * ver matches name (which hashes to hash).
- *
- * The version definition table is a mess, and I don't know how
- * to do this in better than linear time without allocating memory
- * to build an index. I also don't know why the table has
- * variable size entries in the first place.
- *
- * For added fun, I can't find a comprehensible specification of how
- * to parse all the weird flags in the table.
- *
- * So I just parse the whole table every time.
- */
-
- /* First step: find the version definition */
- ver &= 0x7fff; /* Apparently bit 15 means "hidden" */
- ELF(Verdef) *def = vdso_info.verdef;
- while(true) {
- if ((def->vd_flags & VER_FLG_BASE) == 0
- && (def->vd_ndx & 0x7fff) == ver)
- break;
-
- if (def->vd_next == 0)
- return false; /* No definition. */
-
- def = (ELF(Verdef) *)((char *)def + def->vd_next);
- }
-
- /* Now figure out whether it matches. */
- ELF(Verdaux) *aux = (ELF(Verdaux)*)((char *)def + def->vd_aux);
- return def->vd_hash == hash
- && !strcmp(name, vdso_info.symstrings + aux->vda_name);
-}
-
-void *vdso_sym(const char *version, const char *name)
-{
- unsigned long ver_hash;
- if (!vdso_info.valid)
- return 0;
-
- ver_hash = elf_hash((const void*)version);
- ELF(Word) chain = get_hash_val(vdso_info.bucket,
- elf_hash((const void*)name) % vdso_info.nbucket);
-
- for (; chain != STN_UNDEF; chain = get_hash_val(vdso_info.chain, chain)) {
- ELF(Sym) *sym = &vdso_info.symtab[chain];
-
- /* Check for a defined global or weak function w/ right name. */
- if (ELF64_ST_TYPE(sym->st_info) != STT_FUNC)
- continue;
- if (ELF64_ST_BIND(sym->st_info) != STB_GLOBAL &&
- ELF64_ST_BIND(sym->st_info) != STB_WEAK)
- continue;
- if (sym->st_shndx == SHN_UNDEF)
- continue;
- if (strcmp(name, vdso_info.symstrings + sym->st_name))
- continue;
-
- /* Check symbol version. */
- if (vdso_info.versym
- && !vdso_match_version(vdso_info.versym[chain],
- version, ver_hash))
- continue;
-
- return (void *)(vdso_info.load_offset + sym->st_value);
- }
-
- return 0;
-}
-
-void vdso_init_from_auxv(void *auxv)
-{
- int i;
-
- ELF(auxv_t) *elf_auxv = auxv;
- for (i = 0; elf_auxv[i].a_type != AT_NULL; i++) {
- if (elf_auxv[i].a_type == AT_SYSINFO_EHDR) {
- vdso_init_from_sysinfo_ehdr(elf_auxv[i].a_un.a_val);
- return;
- }
- }
-
- vdso_info.valid = false;
-}
diff --git a/libs/libltpvdso/vdso_helpers.c b/libs/libltpvdso/vdso_helpers.c
deleted file mode 100644
index 208c12f65..000000000
--- a/libs/libltpvdso/vdso_helpers.c
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar<viresh.kumar@linaro.org>
- */
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-
-#include "parse_vdso.h"
-#include "config.h"
-
-#ifdef HAVE_GETAUXVAL
-# include <sys/auxv.h>
-#endif /* HAVE_GETAUXVAL */
-
-static unsigned long sysinfo_ehdr;
-
-static void vdso_init(void)
-{
-#ifdef HAVE_GETAUXVAL
- if (sysinfo_ehdr)
- return;
-
- sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
- if (!sysinfo_ehdr) {
- tst_res(TINFO, "Couldn't find AT_SYSINFO_EHDR");
- return;
- }
-
- vdso_init_from_sysinfo_ehdr(sysinfo_ehdr);
-#else
- tst_res(TINFO, "getauxval() not supported");
-#endif /* HAVE_GETAUXVAL */
-}
-
-void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime,
- gettime_t *ptr_vdso_gettime64)
-{
- /*
- * Some vDSO exports its clock_gettime() implementation with a different
- * name and version from other architectures, so we need to handle it as
- * a special case.
- */
-#if defined(__powerpc__) || defined(__powerpc64__)
- const char *version = "LINUX_2.6.15";
- const char *name = "__kernel_clock_gettime";
-#elif defined(__aarch64__)
- const char *version = "LINUX_2.6.39";
- const char *name = "__kernel_clock_gettime";
-#elif defined(__s390__)
- const char *version = "LINUX_2.6.29";
- const char *name = "__kernel_clock_gettime";
-#elif defined(__nds32__)
- const char *version = "LINUX_4";
- const char *name = "__vdso_clock_gettime";
-#elif defined(__riscv)
- const char *version = "LINUX_4.15";
- const char *name = "__vdso_clock_gettime";
-#else
- const char *version = "LINUX_2.6";
- const char *name = "__vdso_clock_gettime";
-#endif
-
- const char *version64 = "LINUX_2.6";
- const char *name64 = "__vdso_clock_gettime64";
-
- vdso_init();
-
- *ptr_vdso_gettime = vdso_sym(version, name);
- if (!*ptr_vdso_gettime)
- tst_res(TINFO, "Couldn't find vdso_gettime()");
-
- *ptr_vdso_gettime64 = vdso_sym(version64, name64);
- if (!*ptr_vdso_gettime64)
- tst_res(TINFO, "Couldn't find vdso_gettime64()");
-}
diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4
deleted file mode 100644
index ffb4997e8..000000000
--- a/m4/ax_compare_version.m4
+++ /dev/null
@@ -1,177 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-#
-# DESCRIPTION
-#
-# This macro compares two version strings. Due to the various number of
-# minor-version numbers that can exist, and the fact that string
-# comparisons are not compatible with numeric comparisons, this is not
-# necessarily trivial to do in a autoconf script. This macro makes doing
-# these comparisons easy.
-#
-# The six basic comparisons are available, as well as checking equality
-# limited to a certain number of minor-version levels.
-#
-# The operator OP determines what type of comparison to do, and can be one
-# of:
-#
-# eq - equal (test A == B)
-# ne - not equal (test A != B)
-# le - less than or equal (test A <= B)
-# ge - greater than or equal (test A >= B)
-# lt - less than (test A < B)
-# gt - greater than (test A > B)
-#
-# Additionally, the eq and ne operator can have a number after it to limit
-# the test to that number of minor versions.
-#
-# eq0 - equal up to the length of the shorter version
-# ne0 - not equal up to the length of the shorter version
-# eqN - equal up to N sub-version levels
-# neN - not equal up to N sub-version levels
-#
-# When the condition is true, shell commands ACTION-IF-TRUE are run,
-# otherwise shell commands ACTION-IF-FALSE are run. The environment
-# variable 'ax_compare_version' is always set to either 'true' or 'false'
-# as well.
-#
-# Examples:
-#
-# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
-# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
-#
-# would both be true.
-#
-# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
-# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
-#
-# would both be false.
-#
-# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
-#
-# would be true because it is only comparing two minor versions.
-#
-# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
-#
-# would be true because it is only comparing the lesser number of minor
-# versions of the two values.
-#
-# Note: The characters that separate the version numbers do not matter. An
-# empty string is the same as version 0. OP is evaluated by autoconf, not
-# configure, so must be a string, not a variable.
-#
-# The author would like to acknowledge Guido Draheim whose advice about
-# the m4_case and m4_ifvaln functions make this macro only include the
-# portions necessary to perform the specific comparison specified by the
-# OP argument in the final configure script.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 13
-
-dnl #########################################################################
-AC_DEFUN([AX_COMPARE_VERSION], [
- AC_REQUIRE([AC_PROG_AWK])
-
- # Used to indicate true or false condition
- ax_compare_version=false
-
- # Convert the two version strings to be compared into a format that
- # allows a simple string comparison. The end result is that a version
- # string of the form 1.12.5-r617 will be converted to the form
- # 0001001200050617. In other words, each number is zero padded to four
- # digits, and non digits are removed.
- AS_VAR_PUSHDEF([A],[ax_compare_version_A])
- A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
- -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/[[^0-9]]//g'`
-
- AS_VAR_PUSHDEF([B],[ax_compare_version_B])
- B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
- -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/[[^0-9]]//g'`
-
- dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
- dnl # then the first line is used to determine if the condition is true.
- dnl # The sed right after the echo is to remove any indented white space.
- m4_case(m4_tolower($2),
- [lt],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
- ],
- [gt],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
- ],
- [le],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
- ],
- [ge],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
- ],[
- dnl Split the operator from the subversion count if present.
- m4_bmatch(m4_substr($2,2),
- [0],[
- # A count of zero means use the length of the shorter version.
- # Determine the number of characters in A and B.
- ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
- ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
-
- # Set A to no more than B's length and B to no more than A's length.
- A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
- B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
- ],
- [[0-9]+],[
- # A count greater than zero means use only that many subversions
- A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
- B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
- ],
- [.+],[
- AC_WARNING(
- [invalid OP numeric parameter: $2])
- ],[])
-
- # Pad zeros at end of numbers to make same length.
- ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
- B="$B`echo $A | sed 's/./0/g'`"
- A="$ax_compare_version_tmp_A"
-
- # Check for equality or inequality as necessary.
- m4_case(m4_tolower(m4_substr($2,0,2)),
- [eq],[
- test "x$A" = "x$B" && ax_compare_version=true
- ],
- [ne],[
- test "x$A" != "x$B" && ax_compare_version=true
- ],[
- AC_WARNING([invalid OP parameter: $2])
- ])
- ])
-
- AS_VAR_POPDEF([A])dnl
- AS_VAR_POPDEF([B])dnl
-
- dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
- if test "$ax_compare_version" = "true" ; then
- m4_ifvaln([$4],[$4],[:])dnl
- m4_ifvaln([$5],[else $5])dnl
- fi
-]) dnl AX_COMPARE_VERSION
diff --git a/m4/ax_prog_perl_modules.m4 b/m4/ax_prog_perl_modules.m4
deleted file mode 100644
index 70b3230eb..000000000
--- a/m4/ax_prog_perl_modules.m4
+++ /dev/null
@@ -1,77 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-#
-# DESCRIPTION
-#
-# Checks to see if the given perl modules are available. If true the shell
-# commands in ACTION-IF-TRUE are executed. If not the shell commands in
-# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
-# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
-# will be run.
-#
-# MODULES is a space separated list of module names. To check for a
-# minimum version of a module, append the version number to the module
-# name, separated by an equals sign.
-#
-# Example:
-#
-# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
-# AC_MSG_WARN(Need some Perl modules)
-#
-# LICENSE
-#
-# Copyright (c) 2009 Dean Povey <povey@wedgetail.com>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 8
-
-AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
-AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
-
-m4_define([ax_perl_modules])
-m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
- [
- m4_append([ax_perl_modules],
- [']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
- ])
-
-# Make sure we have perl
-if test -z "$PERL"; then
-AC_CHECK_PROG(PERL,perl,perl)
-fi
-
-if test "x$PERL" != x; then
- ax_perl_modules_failed=0
- for ax_perl_module in ax_perl_modules; do
- AC_MSG_CHECKING(for perl module $ax_perl_module)
-
- # Would be nice to log result here, but can't rely on autoconf internals
- $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
- if test $? -ne 0; then
- AC_MSG_RESULT(no);
- ax_perl_modules_failed=1
- else
- AC_MSG_RESULT(ok);
- fi
- done
-
- # Run optional shell commands
- if test "$ax_perl_modules_failed" = 0; then
- :
- $2
- else
- :
- $3
- fi
-else
- AC_MSG_WARN(could not find perl)
-fi])dnl
diff --git a/m4/ltp-acct.m4 b/m4/ltp-acct.m4
new file mode 100644
index 000000000..61bc01947
--- /dev/null
+++ b/m4/ltp-acct.m4
@@ -0,0 +1,7 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 SUSE LLC
+dnl Author: Christian Amann <camann@suse.com>
+
+AC_DEFUN([LTP_CHECK_ACCT],[
+AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
+])
diff --git a/m4/ltp-docparse.m4 b/m4/ltp-docparse.m4
deleted file mode 100644
index 88d2e08e4..000000000
--- a/m4/ltp-docparse.m4
+++ /dev/null
@@ -1,112 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-
-AC_DEFUN([LTP_CHECK_METADATA_GENERATOR_ASCIIDOCTOR], [
- AC_MSG_NOTICE(checking asciidoctor as metadata generator)
- AC_PATH_TOOL(asciidoctor, "asciidoctor")
- metadata_generator_html=$asciidoctor
- # pdf requires both asciidoctor and asciidoctor-pdf
- if test "x$metadata_generator_html" != x; then
- AC_PATH_TOOL(asciidoctor_pdf, "asciidoctor-pdf")
- metadata_generator_pdf=$asciidoctor_pdf
- fi
-])
-
-AC_DEFUN([LTP_CHECK_METADATA_GENERATOR_ASCIIDOC], [
- AC_MSG_NOTICE(checking asciidoc as metadata generator)
- AC_PATH_TOOL(a2x, "a2x")
- if test "x$a2x" != x; then
- version="`$a2x --version | cut -d ' ' -f2 `"
- AX_COMPARE_VERSION([$version], lt, 9, [
- AC_MSG_WARN([a2x unsupported version: $version. Use a2x >= 9])
- a2x=
- ])
- fi
- metadata_generator_html=$a2x
- # pdf requires both asciidoc and dblatex
- if test "x$metadata_generator_html" != x; then
- AC_PATH_TOOL(dblatex, "dblatex")
- metadata_generator_pdf=$dblatex
- fi
-])
-
-AC_DEFUN([LTP_DOCPARSE], [
-with_metadata=no
-with_metadata_html=no
-with_metadata_pdf=no
-
-if test "x$enable_metadata" = xyes && test "x$enable_metadata_html" = xyes -o "x$enable_metadata_pdf" = xyes; then
- AX_PROG_PERL_MODULES(Cwd File::Basename JSON LWP::Simple)
-fi
-
-if test "x$ax_perl_modules_failed" = x0; then
- if test "x$with_metadata_generator" = xasciidoctor -o "x$with_metadata_generator" = xdetect; then
- LTP_CHECK_METADATA_GENERATOR_ASCIIDOCTOR
- elif test "x$with_metadata_generator" = xasciidoc; then
- LTP_CHECK_METADATA_GENERATOR_ASCIIDOC
- else
- AC_MSG_ERROR([invalid metadata generator '$with_metadata_generator', use --with-metadata-generator=asciidoc|asciidoctor])
- fi
-
- # autodetection: check also Asciidoc
- if test "x$with_metadata_generator" = xdetect; then
- with_metadata_generator='asciidoctor'
- # problems with Asciidoctor: (html enabled && not found) || (pdf enabled && not found) => try Asciidoc
- if test "x$enable_metadata_html" = xyes -a "x$metadata_generator_html" = x ||
- test "x$enable_metadata_pdf" = xyes -a "x$metadata_generator_pdf" = x; then
- backup_html="$metadata_generator_html"
- backup_pdf="$metadata_generator_pdf"
- AC_MSG_NOTICE(missing some dependencies for Asciidoctor => trying Asciidoc)
- with_metadata_generator='asciidoc'
- LTP_CHECK_METADATA_GENERATOR_ASCIIDOC
- # prefer Asciidoctor if it's not worse than Asciidoc
- # (html not enabled || asciidoctor html found || asciidoc html not found) && (pdf ...)
- if test "x$enable_metadata_html" != xyes -o "x$backup_html" != x -o "x$metadata_generator_html" = x &&
- test "x$enable_metadata_pdf" != xyes -o "x$backup_pdf" != x -o "x$metadata_generator_pdf" = x; then
- with_metadata_generator='asciidoctor'
- metadata_generator_html="$backup_html"
- metadata_generator_pdf="$backup_pdf"
- fi
- fi
- if test "x$metadata_generator_html" != x -o "x$metadata_generator_pdf" != x; then
- AC_MSG_NOTICE(choosing $with_metadata_generator for metadata generation)
- fi
- fi
-
- if test "x$enable_metadata_html" = xno; then
- AC_MSG_NOTICE(HTML metadata generation disabled)
- elif test "x$metadata_generator_html" != x; then
- with_metadata_html=yes
- fi
-
- if test "x$enable_metadata_pdf" = xno; then
- AC_MSG_NOTICE(PDF metadata generation disabled)
- elif test "x$metadata_generator_pdf" != x; then
- with_metadata_pdf=yes
- fi
-fi
-
-reason="metadata generation skipped due missing suitable generator"
-hint="specify correct generator with --with-metadata-generator=asciidoc|asciidoctor or use --disable-metadata|--disable-metadata-html|--disable-metadata-pdf"
-
-if test -z "$ax_perl_modules_failed"; then
- AC_MSG_NOTICE(metadata generation disabled)
-elif test "x$ax_perl_modules_failed" = x1; then
- AC_MSG_WARN(metadata generation skipped due missing required Perl modules)
-elif test "x$with_metadata_html" = xno -a "x$with_metadata_pdf" = xno; then
- AC_MSG_WARN([$reason, $hint])
-else
- with_metadata=yes
- AC_SUBST(METADATA_GENERATOR, $with_metadata_generator)
- if test "x$with_metadata_html" = xno -a "x$enable_metadata_html" = xyes; then
- AC_MSG_WARN([HTML $reason, $hint])
- fi
- if test "x$with_metadata_pdf" = xno -a "x$enable_metadata_pdf" = xyes; then
- AC_MSG_WARN([PDF $reason, $hint])
- fi
-fi
-
-AC_SUBST(WITH_METADATA, $with_metadata)
-AC_SUBST(WITH_METADATA_HTML, $with_metadata_html)
-AC_SUBST(WITH_METADATA_PDF, $with_metadata_pdf)
-])
diff --git a/m4/ltp-fanotify.m4 b/m4/ltp-fanotify.m4
new file mode 100644
index 000000000..f2e31eb68
--- /dev/null
+++ b/m4/ltp-fanotify.m4
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+
+AC_DEFUN([LTP_CHECK_FANOTIFY],[
+AC_CHECK_TYPES([struct fanotify_event_info_header],,,[#include <sys/fanotify.h>])
+AC_CHECK_TYPES([struct fanotify_event_info_fid],,,[#include <sys/fanotify.h>])
+AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
+])
diff --git a/m4/ltp-fts.m4 b/m4/ltp-fts.m4
new file mode 100644
index 000000000..0da692f23
--- /dev/null
+++ b/m4/ltp-fts.m4
@@ -0,0 +1,7 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+
+AC_DEFUN([LTP_CHECK_FTS_H],[
+ AC_CHECK_HEADERS(fts.h, [have_fts=1])
+ AC_SUBST(HAVE_FTS_H, $have_fts)
+])
diff --git a/m4/ltp-if_link.m4 b/m4/ltp-if_link.m4
new file mode 100644
index 000000000..b7228bf3e
--- /dev/null
+++ b/m4/ltp-if_link.m4
@@ -0,0 +1,6 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Linux Test Project, 2015
+
+AC_DEFUN([LTP_CHECK_IF_LINK],[
+AC_CHECK_DECLS([IFLA_NET_NS_PID],,,[#include <linux/if_link.h>])
+])
diff --git a/m4/ltp-ioctl.m4 b/m4/ltp-ioctl.m4
new file mode 100644
index 000000000..81187867c
--- /dev/null
+++ b/m4/ltp-ioctl.m4
@@ -0,0 +1,7 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 SUSE LLC
+dnl Author: Christian Amann <camann@suse.com>
+
+AC_DEFUN([LTP_CHECK_FIDEDUPE],[
+AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
+])
diff --git a/m4/ltp-iovec.m4 b/m4/ltp-iovec.m4
new file mode 100644
index 000000000..27cef7098
--- /dev/null
+++ b/m4/ltp-iovec.m4
@@ -0,0 +1,6 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2014 Linux Test Project
+
+AC_DEFUN([LTP_CHECK_IOVEC],[
+AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
+])
diff --git a/m4/ltp-kcmp_type.m4 b/m4/ltp-kcmp_type.m4
new file mode 100644
index 000000000..a75212813
--- /dev/null
+++ b/m4/ltp-kcmp_type.m4
@@ -0,0 +1,7 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Linux Test Project, 2015
+dnl Author: Cedric Hnyda <chnyda@suse.com>
+
+AC_DEFUN([LTP_CHECK_KCMP_TYPE],[
+AC_CHECK_TYPES([enum kcmp_type],,,[#include <linux/kcmp.h>])
+])
diff --git a/m4/ltp-libmnl.m4 b/m4/ltp-libmnl.m4
deleted file mode 100644
index c6e357bae..000000000
--- a/m4/ltp-libmnl.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-
-AC_DEFUN([LTP_CHECK_LIBMNL], [
- PKG_CHECK_MODULES([LIBMNL], [libmnl], [
- AC_DEFINE([HAVE_LIBMNL], [1], [Define to 1 if you have libmnl library and headers])
- ], [have_libmnl=no])
-])
diff --git a/m4/ltp-madvise.m4 b/m4/ltp-madvise.m4
new file mode 100644
index 000000000..3ab203ca9
--- /dev/null
+++ b/m4/ltp-madvise.m4
@@ -0,0 +1,11 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Linux Test Project, 2011
+dnl Author: Cyril Hrubis <chrubis@suse.cz>
+
+AC_DEFUN([LTP_CHECK_MADVISE],
+[
+AC_CHECK_DECLS([MADV_MERGEABLE],[have_madv_mergeable="yes"],,[#include <sys/mman.h>])
+if test "x$have_madv_mergeable" = "xyes"; then
+ AC_DEFINE(HAVE_MADV_MERGEABLE,1,[Define to 1 if you have MADV_MERGEABLE])
+fi
+])
diff --git a/m4/ltp-mkdtemp.m4 b/m4/ltp-mkdtemp.m4
new file mode 100644
index 000000000..8fe99d99d
--- /dev/null
+++ b/m4/ltp-mkdtemp.m4
@@ -0,0 +1,5 @@
+dnl Copyright (c) Linux Test Project, 2011-2012
+dnl Author: Cyril Hrubis <chrubis@suse.cz>
+
+AC_DEFUN([LTP_CHECK_MKDTEMP],[
+AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))])
diff --git a/m4/ltp-mmsghdr.m4 b/m4/ltp-mmsghdr.m4
new file mode 100644
index 000000000..c509c6a9c
--- /dev/null
+++ b/m4/ltp-mmsghdr.m4
@@ -0,0 +1,10 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
+
+AC_DEFUN([LTP_CHECK_MMSGHDR],[
+AC_CHECK_TYPES([struct mmsghdr],,,[
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+])
diff --git a/m4/ltp-modify_ldt.m4 b/m4/ltp-modify_ldt.m4
new file mode 100644
index 000000000..e473ddca2
--- /dev/null
+++ b/m4/ltp-modify_ldt.m4
@@ -0,0 +1,13 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Red Hat Inc., 2008
+dnl Author: Masatake YAMATO <yamato@redhat.com>
+
+AC_DEFUN([LTP_CHECK_SYSCALL_MODIFY_LDT],
+[
+AC_CHECK_FUNCS(modify_ldt)
+AC_CHECK_HEADERS(asm/ldt.h,[LTP_SYSCALL_MODIFY_LDT_HEADER=yes])
+if test x"$LTP_SYSCALL_MODIFY_LDT_HEADER" = xyes; then
+ AC_CHECK_TYPES([struct user_desc, struct modify_ldt_ldt_s],[],[],[
+#include <asm/ldt.h>
+])
+fi])
diff --git a/m4/ltp-perf_event.m4 b/m4/ltp-perf_event.m4
new file mode 100644
index 000000000..9415c0718
--- /dev/null
+++ b/m4/ltp-perf_event.m4
@@ -0,0 +1,6 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
+
+AC_DEFUN([LTP_CHECK_PERF_EVENT],[
+AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
+])
diff --git a/m4/ltp-prctl.m4 b/m4/ltp-prctl.m4
new file mode 100644
index 000000000..e429db8fe
--- /dev/null
+++ b/m4/ltp-prctl.m4
@@ -0,0 +1,11 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Cisco Systems Inc., 2009
+dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
+
+AC_DEFUN([LTP_CHECK_PRCTL_SUPPORT],[
+AC_CHECK_HEADERS(sys/prctl.h,[
+ AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ], [],[],[
+#include <sys/prctl.h>
+]) dnl AC_CHECK_DECLS
+])]
+)
diff --git a/m4/ltp-quota.m4 b/m4/ltp-quota.m4
new file mode 100644
index 000000000..bcdff7041
--- /dev/null
+++ b/m4/ltp-quota.m4
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 Fujitsu Ltd.
+dnl Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+
+AC_DEFUN([LTP_CHECK_SYSCALL_QUOTACTL],[
+AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
+AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
+])
diff --git a/m4/ltp-rlimit64.m4 b/m4/ltp-rlimit64.m4
new file mode 100644
index 000000000..dccb40188
--- /dev/null
+++ b/m4/ltp-rlimit64.m4
@@ -0,0 +1,9 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2018 Google, Inc.
+
+AC_DEFUN([LTP_CHECK_RLIMIT64],[
+AC_CHECK_TYPES([struct rlimit64],,,[
+#define _LARGEFILE64_SOURCE
+#include <sys/resource.h>
+])
+])
diff --git a/m4/ltp-signal.m4 b/m4/ltp-signal.m4
new file mode 100644
index 000000000..6f5ce8365
--- /dev/null
+++ b/m4/ltp-signal.m4
@@ -0,0 +1,18 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Cisco Systems, Inc. 2009
+dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
+
+dnl LTP_CHECK_SIGNAL
+dnl --------------------------
+dnl * Check for sa_handler in struct_sigaction. The very fact that this
+dnl definition is present or missing signifies whether or not the rt_sig*
+dnl syscalls exist and are implemented on the target architecture, as the
+dnl sigaction(2) call obscures this point in glibc. This doesn't signify
+dnl whether or not the RT signals function though -- those must be proved
+dnl through functionality tests.
+AC_DEFUN([LTP_CHECK_SIGNAL],
+[
+AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[
+#include <signal.h>
+])
+])
diff --git a/m4/ltp-statx.m4 b/m4/ltp-statx.m4
new file mode 100644
index 000000000..3dc06f63e
--- /dev/null
+++ b/m4/ltp-statx.m4
@@ -0,0 +1,14 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Zilogic Systems Pvt. Ltd., 2018
+
+AC_DEFUN([LTP_CHECK_STATX],[
+AC_CHECK_FUNCS(statx,,)
+AC_CHECK_HEADER(linux/fs.h,,,)
+AC_CHECK_TYPES([struct statx],,,[[
+ #define _GNU_SOURCE
+ #include <sys/stat.h>
+]])
+AC_CHECK_TYPES([struct statx_timestamp],,,[[
+ #define _GNU_SOURCE
+ #include <sys/stat.h>]])
+])
diff --git a/m4/ltp-timerfd.m4 b/m4/ltp-timerfd.m4
new file mode 100644
index 000000000..02d1969fb
--- /dev/null
+++ b/m4/ltp-timerfd.m4
@@ -0,0 +1,7 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Linux Test Project, 2014
+
+AC_DEFUN([LTP_CHECK_TIMERFD],[
+AC_CHECK_FUNCS([timerfd_create timerfd_settime timerfd_gettime])
+AC_CHECK_HEADERS([sys/timerfd.h])
+])
diff --git a/m4/ltp-tirpc.m4 b/m4/ltp-tirpc.m4
index 0fa706771..baa5239dc 100644
--- a/m4/ltp-tirpc.m4
+++ b/m4/ltp-tirpc.m4
@@ -1,23 +1,15 @@
dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
dnl Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-AC_DEFUN([LTP_CHECK_TIRPC], [
- dnl libtirpc library and headers
- PKG_CHECK_MODULES([LIBTIRPC], [libtirpc >= 0.2.4], [
- have_libtirpc=yes
- ], [have_libtirpc=no])
+AC_DEFUN([LTP_CHECK_TIRPC],[
+ TIRPC_CPPFLAGS=""
+ TIRPC_LIBS=""
- dnl TI-RPC headers (in glibc, since 2.26 installed only when configured
- dnl with --enable-obsolete-rpc)
- dnl NOTE: To port tests for ntirpc would require use non-deprecated
- dnl functions as it does not have the deprecated ones any more (e.g. use
- dnl rpc_broadcast() instead of clnt_broadcast()), but glibc implementation
- dnl does not have the new ones. We could either provide the deprecated
- dnl functions (copy from libtirpc src/rpc_soc.c) or drop glibc tests.
- AC_CHECK_FUNCS([xdr_char clnttcp_create], [have_rpc_glibc=yes])
+ AC_CHECK_HEADERS([tirpc/netconfig.h netconfig.h], [
+ TIRPC_CPPFLAGS="-I${SYSROOT}/usr/include/tirpc"
+ AC_DEFINE(HAVE_LIBTIRPC, 1, [Define to 1 if you have libtirpc headers installed])
+ AC_CHECK_LIB(tirpc, rpcb_set, [TIRPC_LIBS="-ltirpc"])])
- if test "x$have_libtirpc" = "xyes" -o "x$have_rpc_glibc" = "xyes"; then
- AC_SUBST(HAVE_RPC, 1)
- fi
+ AC_SUBST(TIRPC_CPPFLAGS)
+ AC_SUBST(TIRPC_LIBS)
])
diff --git a/m4/ltp-tpacket-v3.m4 b/m4/ltp-tpacket-v3.m4
new file mode 100644
index 000000000..7b730a23c
--- /dev/null
+++ b/m4/ltp-tpacket-v3.m4
@@ -0,0 +1,10 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
+
+AC_DEFUN([LTP_CHECK_TPACKET_V3],[
+AC_CHECK_TYPES([struct tpacket_req3],,,[
+#ifdef HAVE_LINUX_IF_PACKET_H
+# include <linux/if_packet.h>
+#endif
+])
+])
diff --git a/m4/ltp-uname.m4 b/m4/ltp-uname.m4
new file mode 100644
index 000000000..9e9f1d5f8
--- /dev/null
+++ b/m4/ltp-uname.m4
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
+
+AC_DEFUN([LTP_CHECK_UNAME_DOMAINNAME],[
+AC_CHECK_MEMBERS([struct utsname.domainname],,,[
+#define _GNU_SOURCE
+#include <sys/utsname.h>
+])])
diff --git a/m4/ltp-x_tables.m4 b/m4/ltp-x_tables.m4
new file mode 100644
index 000000000..736aa8b07
--- /dev/null
+++ b/m4/ltp-x_tables.m4
@@ -0,0 +1,25 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+dnl the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([LTP_CHECK_X_TABLES],[
+AC_CHECK_TYPES([struct xt_entry_match, struct xt_entry_target],,,[
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <limits.h>
+#include <linux/netfilter_ipv4/ip_tables.h>
+])
+])
diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 298072fe0..8b9fbe559 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -336,7 +336,7 @@ int main(int argc, char **argv)
if (!strcmp(logfilename, "-")) {
logfile = stdout;
} else {
- if ((logfile = fopen(logfilename, "a+e")) == NULL) {
+ if ((logfile = fopen(logfilename, "a+")) == NULL) {
fprintf(stderr,
"pan(%s): Error %s (%d) opening log file '%s'\n",
panname, strerror(errno), errno,
@@ -453,7 +453,7 @@ int main(int argc, char **argv)
}
if (failcmdfilename) {
- if (!(failcmdfile = fopen(failcmdfilename, "a+e"))) {
+ if (!(failcmdfile = fopen(failcmdfilename, "a+"))) {
fprintf(stderr,
"pan(%s): Error %s (%d) opening fail cmd file '%s'\n",
panname, strerror(errno), errno,
@@ -463,7 +463,7 @@ int main(int argc, char **argv)
}
if (tconfcmdfilename) {
- tconfcmdfile = fopen(tconfcmdfilename, "a+e");
+ tconfcmdfile = fopen(tconfcmdfilename, "a+");
if (!tconfcmdfile) {
fprintf(stderr, "pan(%s): Error %s (%d) opening "
"tconf cmd file '%s'\n", panname,
@@ -1389,8 +1389,8 @@ static void write_test_start(struct tag_pgrp *running, int no_kmsg)
if (!strcmp(reporttype, "rts")) {
printf
- ("%s\ntag=%s stime=%lld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
- "<<<test_start>>>", running->cmd->name, (long long)running->mystime,
+ ("%s\ntag=%s stime=%ld\ncmdline=\"%s\"\ncontacts=\"%s\"\nanalysis=%s\n%s\n",
+ "<<<test_start>>>", running->cmd->name, running->mystime,
running->cmd->cmdline, "", "exit", "<<<test_output>>>");
}
fflush(stdout);
diff --git a/runltp b/runltp
index 7cd0c159f..ec0811834 100755
--- a/runltp
+++ b/runltp
@@ -171,7 +171,6 @@ usage()
-z BIG_DEVICE Some tests require a big unmounted block device
to run correctly.
-Z LTP_BIG_DEV_FS_TYPE The file system of the big device
- -W ZOOFILE Specify the zoo file used to record current test tags (default PID of this script)
@@ -220,11 +219,10 @@ main()
local RANDOMRUN=0
local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%m_%d-%Hh_%Mm_%Ss"`
local scenfile=
- local ZOOFILE=$$
version_date=$(cat "$LTPROOT/Version")
- while getopts a:b:B:c:C:T:d:D:ef:F:g:hi:I:K:l:m:M:No:pqQr:Rs:S:t:T:w:x:z:Z:W: arg
+ while getopts a:b:B:c:C:T:d:D:ef:F:g:hi:I:K:l:m:M:No:pqQr:Rs:S:t:T:w:x:z:Z: arg
do case $arg in
a) EMAIL_TO=$OPTARG
ALT_EMAIL_OUT=1;;
@@ -320,9 +318,9 @@ main()
/*)
HTMLFILE="$OPTARG";;
*)
- HTMLFILE="$LTPROOT/output/$OPTARG"
- ALT_DIR_OUT=1;;
+ HTMLFILE="$LTPROOT/output/$OPTARG";;
esac
+ ALT_DIR_OUT=1
ALT_HTML_OUT=1;;
h) usage;;
@@ -448,7 +446,6 @@ main()
B) LTP_DEV_FS_TYPE=$OPTARG;;
z) BIG_DEVICE=$OPTARG;;
Z) BIG_DEVICE_FS_TYPE=$OPTARG;;
- W) ZOOFILE=$OPTARG;;
\?) usage;;
esac
done
@@ -555,8 +552,6 @@ main()
# write to it as user nobody
export TMPDIR=$TMP
- trap "cleanup" 0
-
chmod 777 $TMP || \
{
echo "unable to chmod 777 $TMP ... aborting"
@@ -711,7 +706,7 @@ EOF
fi
[ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
- PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE $NO_KMSG -e -S $INSTANCES $DURATION -a ${ZOOFILE} \
+ PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE $NO_KMSG -e -S $INSTANCES $DURATION -a $$ \
-n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE $TCONFCMDFILE"
echo "COMMAND: $PAN_COMMAND"
if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
@@ -807,7 +802,7 @@ EOF
fi
# Some tests need to run inside the "bin" directory.
cd "${LTPROOT}/testcases/bin"
- "${LTPROOT}/bin/ltp-pan" $QUIET_MODE $NO_KMSG -e -S $INSTANCES $DURATION -a ${ZOOFILE} -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE $TCONFCMDFILE
+ "${LTPROOT}/bin/ltp-pan" $QUIET_MODE $NO_KMSG -e -S $INSTANCES $DURATION -a $$ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE $TCONFCMDFILE
if [ $? -eq 0 ]; then
echo "INFO: ltp-pan reported all tests PASS"
@@ -940,9 +935,45 @@ EOF
exit $VALUE
}
+create_block()
+{
+ #create a block device
+ dd if=/dev/zero of=${TMP}/test.img bs=1024 count=262144 >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "Failed to create loopback device image, please check disk space and re-run"
+ return 1
+ else
+ ##search for an unused loop dev
+ LOOP_DEV=$(losetup -f)
+ if [ $? -ne 0 ]; then
+ echo "no unused loop device is found"
+ return 1
+ else
+ ##attach the created file to loop dev.
+ losetup $LOOP_DEV ${TMP}/test.img
+ if [ $? -ne 0 ]; then
+ echo "losetup failed to create block device"
+ return 1
+ fi
+ DEVICE=$LOOP_DEV
+ return 0
+ fi
+ fi
+}
+
set_block_device()
{
- if [ -n "$DEVICE" ]; then
+ if [ -z "$DEVICE" ]; then
+ create_block
+ if [ $? -ne 0 ]; then
+ echo "no block device was specified on commandline."
+ echo "Block device could not be created using loopback device"
+ echo "Tests which require block device are disabled."
+ echo "You can specify it with option -b"
+ else
+ export LTP_DEV=$DEVICE
+ fi
+ else
export LTP_DEV=$DEVICE
fi
}
@@ -957,6 +988,7 @@ cleanup()
LTP_SCRIPT="$(basename $0)"
if [ "$LTP_SCRIPT" = "runltp" ]; then
+ trap "cleanup" 0
setup
main "$@"
fi
diff --git a/runtest/Makefile b/runtest/Makefile
index 6a1565b6a..b7caaee06 100644
--- a/runtest/Makefile
+++ b/runtest/Makefile
@@ -36,7 +36,7 @@ ifneq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
UNWANTED_FILES += power_management_tests
endif
-INSTALL_TARGETS := $(filter-out $(UNWANTED_FILES),$(notdir $(patsubst $(abs_srcdir)/%,%,$(sort $(wildcard $(abs_srcdir)/*)))))
+INSTALL_TARGETS := $(filter-out $(UNWANTED_FILES),$(notdir $(patsubst $(abs_srcdir)/%,%,$(wildcard $(abs_srcdir)/*))))
MAKE_TARGETS :=
diff --git a/runtest/can b/runtest/can
index b637183c6..6aa2ae9f5 100644
--- a/runtest/can
+++ b/runtest/can
@@ -1,2 +1,2 @@
-can_filter can_filter
-can_rcv_own_msgs can_rcv_own_msgs
+can_filter can_run_tests.sh can_filter
+can_rcv_own_msgs can_run_tests.sh can_rcv_own_msgs
diff --git a/runtest/commands b/runtest/commands
index 8cfad0449..058266b54 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -41,4 +41,3 @@ gdb01_sh gdb01.sh
unshare01_sh unshare01.sh
sysctl01_sh sysctl01.sh
sysctl02_sh sysctl02.sh
-shell_test01 echo "SUCCESS" | shell_pipe01.sh
diff --git a/runtest/connectors b/runtest/connectors
index 2c7aed474..6153a98e6 100644
--- a/runtest/connectors
+++ b/runtest/connectors
@@ -1,2 +1,2 @@
#DESCRIPTION:Netlink Connector tests
-cn_pec_sh cn_pec.sh
+Connectors connector_test.sh
diff --git a/runtest/containers b/runtest/containers
index 276096709..871cd2a42 100644
--- a/runtest/containers
+++ b/runtest/containers
@@ -85,10 +85,3 @@ userns04 userns04
userns05 userns05
userns06 userns06
userns07 userns07
-
-# time namespaces
-sysinfo03 sysinfo03
-clock_nanosleep03 clock_nanosleep03
-clock_gettime03 clock_gettime03
-timens01 timens01
-timerfd04 timerfd04
diff --git a/runtest/crashme b/runtest/crashme
index 47f5f93b4..14750749d 100644
--- a/runtest/crashme
+++ b/runtest/crashme
@@ -10,6 +10,9 @@ crash01 crash01
crash02 crash02 -v 2
# Generate random syscalls and execute them, less probability
# to hose your system, but still.
+mem01 mem01 -r
+# Memory eater. Loves to be run in parallel with other programs.
+# May panic on buggy systems if the OOM killer was not fast enough :-)
fork12 fork12
# Fork as many children as possible. On systems with lots of memory
# and kernels prior to 2.4.19, this can hang the system by using up all pids
diff --git a/runtest/crypto b/runtest/crypto
index 446559efc..be8bc81d2 100644
--- a/runtest/crypto
+++ b/runtest/crypto
@@ -4,7 +4,6 @@ af_alg03 af_alg03
af_alg04 af_alg04
af_alg05 af_alg05
af_alg06 af_alg06
-af_alg07 af_alg07
pcrypt_aead01 pcrypt_aead01
crypto_user01 crypto_user01
crypto_user02 crypto_user02
diff --git a/runtest/cve b/runtest/cve
index 3beb88bb0..57cf66075 100644
--- a/runtest/cve
+++ b/runtest/cve
@@ -12,17 +12,13 @@ cve-2016-4997 setsockopt03
cve-2016-5195 dirtyc0w
cve-2016-7042 cve-2016-7042
cve-2016-7117 cve-2016-7117
-cve-2016-8655 setsockopt06
cve-2016-9604 keyctl08
-cve-2016-9793 setsockopt04
cve-2016-10044 cve-2016-10044
cve-2017-2618 cve-2017-2618
-cve-2017-2636 pty05
cve-2017-2671 cve-2017-2671
cve-2017-6951 request_key05
cve-2017-7308 setsockopt02
cve-2017-7472 keyctl04
-cve-2017-10661 timerfd_settime02
cve-2017-12192 keyctl07
cve-2017-12193 add_key04
cve-2017-15274 add_key02
@@ -30,7 +26,6 @@ cve-2017-15299 request_key03 -b cve-2017-15299
cve-2017-15537 ptrace07
cve-2017-15649 fanout01
cve-2017-15951 request_key03 -b cve-2017-15951
-cve-2017-17712 sendmsg03
cve-2017-17805 af_alg02
cve-2017-17806 af_alg01
cve-2017-17807 request_key04
@@ -41,24 +36,7 @@ cve-2017-16939 cve-2017-16939
cve-2017-16995 bpf_prog03
cve-2017-17053 cve-2017-17053
cve-2017-18075 pcrypt_aead01
-cve-2017-1000111 setsockopt07
-cve-2017-1000112 setsockopt05
cve-2017-1000380 snd_timer01
-cve-2017-1000405 thp04
cve-2018-5803 sctp_big_chunk
-cve-2018-7566 snd_seq01
-cve-2018-8897 ptrace09
-cve-2018-9568 connect02
cve-2018-1000001 realpath01
-cve-2018-1000199 ptrace08
-cve-2018-1000204 ioctl_sg01
-cve-2018-12896 timer_settime03
-cve-2018-18445 bpf_prog04
-cve-2018-18559 bind06
cve-2018-19854 crypto_user01
-cve-2019-8912 af_alg07
-cve-2020-11494 pty04
-cve-2020-14386 sendto03
-cve-2020-14416 pty03
-cve-2020-29373 io_uring02
-cve-2021-3444 bpf_prog05
diff --git a/runtest/fs b/runtest/fs
index 17b1415eb..463185756 100644
--- a/runtest/fs
+++ b/runtest/fs
@@ -40,7 +40,7 @@ rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:$TMPDIR/rwte
iogen01 export LTPROOT; rwtest -N iogen01 -i 120s -s read,write -Da -Dv -n 2 500b:$TMPDIR/doio.f1.$$ 1000b:$TMPDIR/doio.f2.$$
fs_inod01 fs_inod $TMPDIR 10 10 10
-linker01 linktest.sh
+linker01 linktest.sh 1000 1000
openfile01 openfile -f10 -t10
inode01 inode01
inode02 inode02
@@ -58,7 +58,7 @@ ftest06 ftest06
ftest07 ftest07
ftest08 ftest08
-lftest01 lftest
+lftest01 lftest 100
writetest01 writetest
#Also run the fs_di (Data Integrity tests)
@@ -69,9 +69,9 @@ fs_di fs_di -d $TMPDIR
# Was not sure why it should reside in runtest/crashme and won't get tested ever
proc01 proc01 -m 128
-read_all_dev read_all -d /dev -p -q -r 3
-read_all_proc read_all -d /proc -q -r 3
-read_all_sys read_all -d /sys -q -r 3
+read_all_dev read_all -d /dev -p -q -r 10
+read_all_proc read_all -d /proc -q -r 10
+read_all_sys read_all -d /sys -q -r 10
#Run the File System Race Condition Check tests as well
fs_racer fs_racer.sh -t 5
diff --git a/runtest/fs_readonly b/runtest/fs_readonly
index dc70d28d8..0e1be5f6d 100644
--- a/runtest/fs_readonly
+++ b/runtest/fs_readonly
@@ -51,5 +51,5 @@ test_robind50 test_robind.sh -c "ftest05"
test_robind51 test_robind.sh -c "ftest06"
test_robind52 test_robind.sh -c "ftest07"
test_robind53 test_robind.sh -c "ftest08"
-test_robind54 test_robind.sh -c "-- lftest -n 80"
+test_robind54 test_robind.sh -c "lftest 80"
test_robind55 test_robind.sh -c "writetest"
diff --git a/runtest/ima b/runtest/ima
index 29caa034a..f3ea88cf0 100644
--- a/runtest/ima
+++ b/runtest/ima
@@ -3,7 +3,4 @@ ima_measurements ima_measurements.sh
ima_policy ima_policy.sh
ima_tpm ima_tpm.sh
ima_violations ima_violations.sh
-ima_keys ima_keys.sh
-ima_kexec ima_kexec.sh
-ima_selinux ima_selinux.sh
evm_overlay evm_overlay.sh
diff --git a/runtest/kernel_misc b/runtest/kernel_misc
index abb75ebaf..7937c7bbf 100644
--- a/runtest/kernel_misc
+++ b/runtest/kernel_misc
@@ -1,7 +1,6 @@
kmsg01 kmsg01
fw_load fw_load
rtc01 rtc01
-rtc02 rtc02
block_dev block_dev
tpci tpci
tbio tbio
diff --git a/runtest/lvm.part1 b/runtest/lvm.part1
new file mode 100644
index 000000000..b2e9c0551
--- /dev/null
+++ b/runtest/lvm.part1
@@ -0,0 +1,217 @@
+#DESCRIPTION:lvm filesystem tests
+# Check the MSDOS filesystem
+gf102 growfiles -W gf102 -d /test/growfiles/msdos -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf103 growfiles -W gf103 -d /test/growfiles/msdos -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf104 growfiles -W gf104 -d /test/growfiles/msdos -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf105 growfiles -W gf105 -d /test/growfiles/msdos -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf116 growfiles -W gf116 -d /test/growfiles/msdos -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf117 growfiles -W gf117 -d /test/growfiles/msdos -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf118 growfiles -W gf118 -d /test/growfiles/msdos -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf119 growfiles -W gf119 -d /test/growfiles/msdos -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf112 mkfifo /test/growfiles/msdos/gffifo17; growfiles -W gf112 -b -e 1 -u -i 0 -L 30 /test/growfiles/msdos/gffifo17
+gf113 mkfifo /test/growfiles/msdos/gffifo18; growfiles -W gf113 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/msdos/gffifo18
+gf101 growfiles -W gf101 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/msdos/glseek20 /test/growfiles/msdos/glseek20.2
+gf106 growfiles -W gf106 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/msdos/g_rand10 /test/growfiles/msdos/g_rand10.2
+gf107 growfiles -W gf107 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/msdos/g_rand13 /test/growfiles/msdos/g_rand13.2
+gf108 growfiles -W gf108 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/msdos/g_rand11 /test/growfiles/msdos/g_rand11.2
+gf109 growfiles -W gf109 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/msdos/g_rand12 /test/growfiles/msdos/g_rand12.2
+gf110 growfiles -W gf110 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/msdos/g_lio14 /test/growfiles/msdos/g_lio14.2
+gf111 growfiles -W gf111 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/msdos/g_lio15 /test/growfiles/msdos/g_lio15.2
+gf114 growfiles -W gf114 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/msdos/glseek19 /test/growfiles/msdos/glseek19.2
+gf115 growfiles -W gf115 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/msdos/Lgfile1
+gf120 growfiles -W gf120 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/msdos/gfbigio-$$
+gf121 growfiles -W gf121 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/msdos/gf-bld-$$
+gf122 growfiles -W gf122 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/msdos/gf-bldf-$$
+gf123 growfiles -W gf123 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/msdos/gf-inf-$$
+gf124 growfiles -W gf124 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/msdos/gf-jbld-$$
+gf125 growfiles -W gf125 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/msdos/gf-large-gs-$$
+gf126 growfiles -W gf126 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/msdos/gfsmallio-$$
+gf127 growfiles -W gf127 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/msdos/gfsparse-1-$$
+gf128 growfiles -W gf128 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/msdos/gfsparse-2-$$
+gf129 growfiles -W gf129 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/msdos/gfsparse-3-$$
+gf130 growfiles -W gf130 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/msdos/gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/msdos/rwtest01%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/msdos/rwtest02%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/msdos/rwtest03%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/msdos/rwtest04%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/msdos/rwtest05%f
+# Check the Reiserfs filesystem
+gf202 growfiles -W gf202 -d /test/growfiles/reiser -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf203 growfiles -W gf203 -d /test/growfiles/reiser -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf204 growfiles -W gf204 -d /test/growfiles/reiser -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf205 growfiles -W gf205 -d /test/growfiles/reiser -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf216 growfiles -W gf216 -d /test/growfiles/reiser -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf217 growfiles -W gf217 -d /test/growfiles/reiser -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf218 growfiles -W gf218 -d /test/growfiles/reiser -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf219 growfiles -W gf219 -d /test/growfiles/reiser -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf212 mkfifo /test/growfiles/reiser/gffifo17; growfiles -W gf212 -b -e 1 -u -i 0 -L 30 /test/growfiles/reiser/gffifo17
+gf213 mkfifo /test/growfiles/reiser/gffifo18; growfiles -W gf213 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/reiser/gffifo18
+gf201 growfiles -W gf201 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/reiser/glseek20 /test/growfiles/reiser/glseek20.2
+gf206 growfiles -W gf206 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/reiser/g_rand10 /test/growfiles/reiser/g_rand10.2
+gf207 growfiles -W gf207 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/reiser/g_rand13 /test/growfiles/reiser/g_rand13.2
+gf208 growfiles -W gf208 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/reiser/g_rand11 /test/growfiles/reiser/g_rand11.2
+gf209 growfiles -W gf209 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/reiser/g_rand12 /test/growfiles/reiser/g_rand12.2
+gf210 growfiles -W gf210 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/reiser/g_lio14 /test/growfiles/reiser/g_lio14.2
+gf211 growfiles -W gf211 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/reiser/g_lio15 /test/growfiles/reiser/g_lio15.2
+gf214 growfiles -W gf214 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/reiser/glseek19 /test/growfiles/reiser/glseek19.2
+gf215 growfiles -W gf215 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/reiser/Lgfile1
+gf220 growfiles -W gf220 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/reiser/gfbigio-$$
+gf221 growfiles -W gf221 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/reiser/gf-bld-$$
+gf222 growfiles -W gf222 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/reiser/gf-bldf-$$
+gf223 growfiles -W gf223 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/reiser/gf-inf-$$
+gf224 growfiles -W gf224 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/reiser/gf-jbld-$$
+gf225 growfiles -W gf225 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/reiser/gf-large-gs-$$
+gf226 growfiles -W gf226 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/reiser/gfsmallio-$$
+gf227 growfiles -W gf227 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/reiser/gfsparse-1-$$
+gf228 growfiles -W gf228 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/reiser/gfsparse-2-$$
+gf229 growfiles -W gf229 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/reiser/gfsparse-3-$$
+gf230 growfiles -W gf230 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/reiser/gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/reiser/rwtest06%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/reiser/rwtest07%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/reiser/rwtest08%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/reiser/rwtest09%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/reiser/rwtest10%f
+# Check the EXT2 filesystem
+gf302 growfiles -W gf302 -d /test/growfiles/ext2 -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf303 growfiles -W gf303 -d /test/growfiles/ext2 -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf304 growfiles -W gf304 -d /test/growfiles/ext2 -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf305 growfiles -W gf305 -d /test/growfiles/ext2 -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf316 growfiles -W gf316 -d /test/growfiles/ext2 -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf317 growfiles -W gf317 -d /test/growfiles/ext2 -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf318 growfiles -W gf318 -d /test/growfiles/ext2 -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf319 growfiles -W gf319 -d /test/growfiles/ext2 -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf312 mkfifo /test/growfiles/ext2/gffifo17; growfiles -W gf312 -d /test/growfiles/ext2 -b -e 1 -u -i 0 -L 30 /test/growfiles/ext2/gffifo17
+gf313 mkfifo /test/growfiles/ext2/gffifo18; growfiles -W gf313 -d /test/growfiles/ext2 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/ext2/gffifo18
+gf301 growfiles -W gf301 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/ext2/glseek20 /test/growfiles/ext2/glseek20.2
+gf306 growfiles -W gf306 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/ext2/g_rand10 /test/growfiles/ext2/g_rand10.2
+gf307 growfiles -W gf307 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/ext2/g_rand13 /test/growfiles/ext2/g_rand13.2
+gf308 growfiles -W gf308 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/ext2/g_rand11 /test/growfiles/ext2/g_rand11.2
+gf309 growfiles -W gf309 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/ext2/g_rand12 /test/growfiles/ext2/g_rand12.2
+gf310 growfiles -W gf310 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/ext2/g_lio14 /test/growfiles/ext2/g_lio14.2
+gf311 growfiles -W gf311 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/ext2/g_lio15 /test/growfiles/ext2/g_lio15.2
+gf314 growfiles -W gf314 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/ext2/glseek19 /test/growfiles/ext2/glseek19.2
+gf315 growfiles -W gf315 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/ext2/Lgfile1
+gf320 growfiles -W gf320 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/ext2/gfbigio-$$
+gf321 growfiles -W gf321 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/ext2/gf-bld-$$
+gf322 growfiles -W gf322 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/ext2/gf-bldf-$$
+gf323 growfiles -W gf323 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/ext2/gf-inf-$$
+gf324 growfiles -W gf324 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/ext2/gf-jbld-$$
+gf325 growfiles -W gf325 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/ext2/gf-large-gs-$$
+gf326 growfiles -W gf326 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/ext2/gfsmallio-$$
+gf327 growfiles -W gf327 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/ext2/gfsparse-1-$$
+gf328 growfiles -W gf328 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/ext2/gfsparse-2-$$
+gf329 growfiles -W gf329 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/ext2/gfsparse-3-$$
+gf330 growfiles -W gf330 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/ext2/gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/ext2/rwtest11%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/ext2/rwtest12%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/ext2/rwtest13%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/ext2/rwtest14%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/ext2/rwtest15%f
+# Check an NFS filesystem
+gf402 growfiles -W gf402 -d /test/growfiles/nfs -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf403 growfiles -W gf403 -d /test/growfiles/nfs -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf404 growfiles -W gf404 -d /test/growfiles/nfs -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf405 growfiles -W gf405 -d /test/growfiles/nfs -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf416 growfiles -W gf416 -d /test/growfiles/nfs -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf417 growfiles -W gf417 -d /test/growfiles/nfs -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf418 growfiles -W gf418 -d /test/growfiles/nfs -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf419 growfiles -W gf419 -d /test/growfiles/nfs -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf412 mkfifo /test/growfiles/nfs/gffifo17; growfiles -W gf412 -b -e 1 -u -i 0 -L 30 /test/growfiles/nfs/gffifo17
+gf413 mkfifo /test/growfiles/nfs/gffifo18; growfiles -W gf413 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/nfs/gffifo18
+gf401 growfiles -W gf401 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/nfs/glseek20 /test/growfiles/nfs/glseek20.2
+gf406 growfiles -W gf406 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/nfs/g_rand10 /test/growfiles/nfs/g_rand10.2
+gf407 growfiles -W gf407 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/nfs/g_rand13 /test/growfiles/nfs/g_rand13.2
+gf408 growfiles -W gf408 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/nfs/g_rand11 /test/growfiles/nfs/g_rand11.2
+gf409 growfiles -W gf409 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/nfs/g_rand12 /test/growfiles/nfs/g_rand12.2
+gf410 growfiles -W gf410 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/nfs/g_lio14 /test/growfiles/nfs/g_lio14.2
+gf411 growfiles -W gf411 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/nfs/g_lio15 /test/growfiles/nfs/g_lio15.2
+gf414 growfiles -W gf414 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/nfs/glseek19 /test/growfiles/nfs/glseek19.2
+gf415 growfiles -W gf415 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/nfs/Lgfile1
+gf420 growfiles -W gf420 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/nfs/gfbigio-$$
+gf421 growfiles -W gf421 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/nfs/gf-bld-$$
+gf422 growfiles -W gf422 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/nfs/gf-bldf-$$
+gf423 growfiles -W gf423 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/nfs/gf-inf-$$
+gf424 growfiles -W gf424 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/nfs/gf-jbld-$$
+gf425 growfiles -W gf425 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/nfs/gf-large-gs-$$
+gf426 growfiles -W gf426 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/nfs/gfsmallio-$$
+gf427 growfiles -W gf427 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/nfs/gfsparse-1-$$
+gf428 growfiles -W gf428 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/nfs/gfsparse-2-$$
+gf429 growfiles -W gf429 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/nfs/gfsparse-3-$$
+gf430 growfiles -W gf430 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/nfs/gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/nfs/rwtest16%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/nfs/rwtest17%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/nfs/rwtest18%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/nfs/rwtest19%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/nfs/rwtest20%f
+# Check a Ram Disk filesystem
+gf502 growfiles -W gf502 -d /test/growfiles/ramdisk -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf503 growfiles -W gf503 -d /test/growfiles/ramdisk -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf504 growfiles -W gf504 -d /test/growfiles/ramdisk -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf505 growfiles -W gf505 -d /test/growfiles/ramdisk -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf516 growfiles -W gf516 -d /test/growfiles/ramdisk -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf517 growfiles -W gf517 -d /test/growfiles/ramdisk -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf518 growfiles -W gf518 -d /test/growfiles/ramdisk -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf519 growfiles -W gf519 -d /test/growfiles/ramdisk -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf512 mkfifo /test/growfiles/ramdisk/gffifo17; growfiles -W gf512 -b -e 1 -u -i 0 -L 30 /test/growfiles/ramdisk/gffifo17
+gf513 mkfifo /test/growfiles/ramdisk/gffifo18; growfiles -W gf513 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/ramdisk/gffifo18
+gf501 growfiles -W gf501 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/ramdisk/glseek20 /test/growfiles/ramdisk/glseek20.2
+gf506 growfiles -W gf506 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/ramdisk/g_rand10 /test/growfiles/ramdisk/g_rand10.2
+gf507 growfiles -W gf507 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/ramdisk/g_rand13 /test/growfiles/ramdisk/g_rand13.2
+gf508 growfiles -W gf508 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/ramdisk/g_rand11 /test/growfiles/ramdisk/g_rand11.2
+gf509 growfiles -W gf509 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/ramdisk/g_rand12 /test/growfiles/ramdisk/g_rand12.2
+gf510 growfiles -W gf510 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/ramdisk/g_lio14 /test/growfiles/ramdisk/g_lio14.2
+gf511 growfiles -W gf511 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/ramdisk/g_lio15 /test/growfiles/ramdisk/g_lio15.2
+gf514 growfiles -W gf514 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/ramdisk/glseek19 /test/growfiles/ramdisk/glseek19.2
+gf515 growfiles -W gf515 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/ramdisk/Lgfile1
+gf520 growfiles -W gf520 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/ramdisk/gfbigio-$$
+gf521 growfiles -W gf521 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/ramdisk/gf-bld-$$
+gf522 growfiles -W gf522 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/ramdisk/gf-bldf-$$
+gf523 growfiles -W gf523 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/ramdisk/gf-inf-$$
+gf524 growfiles -W gf524 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/ramdisk/gf-jbld-$$
+gf525 growfiles -W gf525 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/ramdisk/gf-large-gs-$$
+gf526 growfiles -W gf526 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/ramdisk/gfsmallio-$$
+gf527 growfiles -W gf527 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/ramdisk/gfsparse-1-$$
+gf528 growfiles -W gf528 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/ramdisk/gfsparse-2-$$
+gf529 growfiles -W gf529 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/ramdisk/gfsparse-3-$$
+gf530 growfiles -W gf530 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/ramdisk/gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/ramdisk/rwtest21%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/ramdisk/rwtest22%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/ramdisk/rwtest23%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/ramdisk/rwtest24%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/ramdisk/rwtest25%f
+# Check the MINIX filesystem
+gf602 growfiles -W gf602 -d /test/growfiles/minix -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf603 growfiles -W gf603 -d /test/growfiles/minix -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf604 growfiles -W gf604 -d /test/growfiles/minix -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf605 growfiles -W gf605 -d /test/growfiles/minix -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf616 growfiles -W gf616 -d /test/growfiles/minix -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf617 growfiles -W gf617 -d /test/growfiles/minix -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf618 growfiles -W gf618 -d /test/growfiles/minix -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf619 growfiles -W gf619 -d /test/growfiles/minix -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf612 mkfifo /test/growfiles/minix/gffifo17; growfiles -W gf612 -b -e 1 -u -i 0 -L 30 /test/growfiles/minix/gffifo17
+gf613 mkfifo /test/growfiles/minix/gffifo18; growfiles -W gf613 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/minix/gffifo18
+gf601 growfiles -W gf601 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/minix/glseek20 /test/growfiles/minix/glseek20.2
+gf606 growfiles -W gf606 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/minix/g_rand10 /test/growfiles/minix/g_rand10.2
+gf607 growfiles -W gf607 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/minix/g_rand13 /test/growfiles/minix/g_rand13.2
+gf608 growfiles -W gf608 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/minix/g_rand11 /test/growfiles/minix/g_rand11.2
+gf609 growfiles -W gf609 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/minix/g_rand12 /test/growfiles/minix/g_rand12.2
+gf610 growfiles -W gf610 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/minix/g_lio14 /test/growfiles/minix/g_lio14.2
+gf611 growfiles -W gf611 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/minix/g_lio15 /test/growfiles/minix/g_lio15.2
+gf614 growfiles -W gf614 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/minix/glseek19 /test/growfiles/minix/glseek19.2
+gf615 growfiles -W gf615 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/minix/Lgfile1
+gf620 growfiles -W gf620 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/minix/gfbigio-$$
+gf621 growfiles -W gf621 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/minix/gf-bld-$$
+gf622 growfiles -W gf622 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/minix/gf-bldf-$$
+gf623 growfiles -W gf623 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/minix/gf-inf-$$
+gf624 growfiles -W gf624 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/minix/gf-jbld-$$
+gf625 growfiles -W gf625 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/minix/gf-large-gs-$$
+gf626 growfiles -W gf626 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/minix/gfsmallio-$$
+gf627 growfiles -W gf627 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/minix/gfsparse-1-$$
+gf628 growfiles -W gf628 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/minix/gfsparse-2-$$
+gf629 growfiles -W gf629 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/minix/gfsparse-3-$$
+gf630 growfiles -W gf630 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/minix/gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/minix/rwtest26%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/minix/rwtest27%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/minix/rwtest28%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/minix/rwtest29%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/minix/rwtest30%f
diff --git a/runtest/lvm.part2 b/runtest/lvm.part2
new file mode 100644
index 000000000..f0dbf3277
--- /dev/null
+++ b/runtest/lvm.part2
@@ -0,0 +1,72 @@
+# Check the EXT3 filesystem
+gf702 growfiles -W gf702 -d /test/growfiles/ext3 -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf703 growfiles -W gf703 -d /test/growfiles/ext3 -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf704 growfiles -W gf704 -d /test/growfiles/ext3 -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf705 growfiles -W gf705 -d /test/growfiles/ext3 -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf716 growfiles -W gf716 -d /test/growfiles/ext3 -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf717 growfiles -W gf717 -d /test/growfiles/ext3 -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf718 growfiles -W gf718 -d /test/growfiles/ext3 -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf719 growfiles -W gf719 -d /test/growfiles/ext3 -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf712 mkfifo gffifo17; growfiles -W gf712 -d /test/growfiles/ext3 -b -e 1 -u -i 0 -L 30 gffifo17
+gf713 mkfifo gffifo18; growfiles -W gf713 -d /test/growfiles/ext3 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 gffifo18
+gf701 growfiles -W gf701 -d /test/growfiles/ext3 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 glseek20 glseek20.2
+gf706 growfiles -W gf706 -d /test/growfiles/ext3 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 g_rand10 g_rand10.2
+gf707 growfiles -W gf707 -d /test/growfiles/ext3 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p g_rand13 g_rand13.2
+gf708 growfiles -W gf708 -d /test/growfiles/ext3 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 g_rand11 g_rand11.2
+gf709 growfiles -W gf709 -d /test/growfiles/ext3 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p g_rand12 g_rand12.2
+gf710 growfiles -W gf710 -d /test/growfiles/ext3 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l g_lio14 g_lio14.2
+gf711 growfiles -W gf711 -d /test/growfiles/ext3 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L g_lio15 g_lio15.2
+gf714 growfiles -W gf714 -d /test/growfiles/ext3 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 glseek19 glseek19.2
+gf715 growfiles -W gf715 -d /test/growfiles/ext3 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 Lgfile1
+gf720 growfiles -W gf720 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 gfbigio-$$
+gf721 growfiles -W gf721 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 gf-bld-$$
+gf722 growfiles -W gf722 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 gf-bldf-$$
+gf723 growfiles -W gf723 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 gf-inf-$$
+gf724 growfiles -W gf724 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 gf-jbld-$$
+gf725 growfiles -W gf725 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 gf-large-gs-$$
+gf726 growfiles -W gf726 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 gfsmallio-$$
+gf727 growfiles -W gf727 -d /test/growfiles/ext3 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u gfsparse-1-$$
+gf728 growfiles -W gf728 -d /test/growfiles/ext3 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u gfsparse-2-$$
+gf729 growfiles -W gf729 -d /test/growfiles/ext3 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u gfsparse-3-$$
+gf730 growfiles -W gf730 -d /test/growfiles/ext3 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 gf-sync-$$
+rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/ext3/rwtest11%f
+rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/ext3/rwtest12%f
+rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/ext3/rwtest13%f
+rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/ext3/rwtest14%f
+rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/ext3/rwtest15%f
+# Check the JFS filesystem
+gf802 growfiles -W gf802 -d /test/growfiles/jfs -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
+gf803 growfiles -W gf803 -d /test/growfiles/jfs -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
+gf804 growfiles -W gf804 -d /test/growfiles/jfs -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
+gf805 growfiles -W gf805 -d /test/growfiles/jfs -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
+gf816 growfiles -W gf816 -d /test/growfiles/jfs -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
+gf817 growfiles -W gf817 -d /test/growfiles/jfs -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
+gf818 growfiles -W gf818 -d /test/growfiles/jfs -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
+gf819 growfiles -W gf819 -d /test/growfiles/jfs -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
+gf812 mkfifo /test/growfiles/jfs/gffifo17; growfiles -W gf812 -b -e 1 -u -i 0 -L 30 /test/growfiles/jfs/gffifo17
+gf813 mkfifo /test/growfiles/jfs/gffifo18; growfiles -W gf813 -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 /test/growfiles/jfs/gffifo18
+gf801 growfiles -W gf801 -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 /test/growfiles/jfs/glseek20 /test/growfiles/jfs/glseek20.2
+gf806 growfiles -W gf806 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 /test/growfiles/jfs/g_rand10 /test/growfiles/jfs/g_rand10.2
+gf807 growfiles -W gf807 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p /test/growfiles/jfs/g_rand13 /test/growfiles/jfs/g_rand13.2
+gf808 growfiles -W gf808 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 /test/growfiles/jfs/g_rand11 /test/growfiles/jfs/g_rand11.2
+gf809 growfiles -W gf809 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p /test/growfiles/jfs/g_rand12 /test/growfiles/jfs/g_rand12.2
+gf810 growfiles -W gf810 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l /test/growfiles/jfs/g_lio14 /test/growfiles/jfs/g_lio14.2
+gf811 growfiles -W gf811 -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L /test/growfiles/jfs/g_lio15 /test/growfiles/jfs/g_lio15.2
+gf814 growfiles -W gf814 -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 /test/growfiles/jfs/glseek19 /test/growfiles/jfs/glseek19.2
+gf815 growfiles -W gf815 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 /test/growfiles/jfs/Lgfile1
+gf820 growfiles -W gf820 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 /test/growfiles/jfs/gfbigio-$$
+gf821 growfiles -W gf821 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/jfs/gf-bld-$$
+gf822 growfiles -W gf822 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 /test/growfiles/jfs/gf-bldf-$$
+gf823 growfiles -W gf823 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 /test/growfiles/jfs/gf-inf-$$
+gf824 growfiles -W gf824 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 /test/growfiles/jfs/gf-jbld-$$
+gf825 growfiles -W gf825 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 /test/growfiles/jfs/gf-large-gs-$$
+gf826 growfiles -W gf826 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 /test/growfiles/jfs/gfsmallio-$$
+gf827 growfiles -W gf827 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u /test/growfiles/jfs/gfsparse-1-$$
+gf828 growfiles -W gf828 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u /test/growfiles/jfs/gfsparse-2-$$
+gf829 growfiles -W gf829 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u /test/growfiles/jfs/gfsparse-3-$$
+gf830 growfiles -W gf830 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 /test/growfiles/jfs/gf-sync-$$
+rwtest11 export LTPROOT; rwtest -N rwtest11 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/jfs/rwtest11%f
+rwtest12 export LTPROOT; rwtest -N rwtest12 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/jfs/rwtest12%f
+rwtest13 export LTPROOT; rwtest -N rwtest13 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/jfs/rwtest13%f
+rwtest14 export LTPROOT; rwtest -N rwtest14 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/jfs/rwtest14%f
+rwtest15 export LTPROOT; rwtest -N rwtest15 -c -q -i 50 -T 64b 500b:/test/growfiles/jfs/rwtest15%f
diff --git a/runtest/mm b/runtest/mm
index 6537666a9..a09f39c1e 100644
--- a/runtest/mm
+++ b/runtest/mm
@@ -20,7 +20,9 @@ mtest06_3 mmap3 -x 0.002 -p
# Remains diabled till the infinite loop problem is solved
#mtest-6_4 shmat1 -x 0.00005
+mem01 mem01
mem02 mem02
+mem03 mem03
page01 page01
page02 page02
@@ -69,9 +71,7 @@ ksm04_1 ksm04 -u 128
ksm05 ksm05 -I 10
ksm06 ksm06
ksm06_1 ksm06 -n 10
-ksm06_2 ksm06 -n 8000
-
-cpuset01 cpuset01
+ksm06_2 ksm06 -n 10000
oom01 oom01
oom02 oom02
@@ -84,7 +84,6 @@ swapping01 swapping01 -i 5
thp01 thp01 -I 120
thp02 thp02
thp03 thp03
-thp04 thp04
vma01 vma01
vma02 vma02
diff --git a/runtest/net.features b/runtest/net.features
index 37c380aaa..44a974563 100644
--- a/runtest/net.features
+++ b/runtest/net.features
@@ -60,12 +60,6 @@ gre_ipv6_01 gre01.sh -6
gre_ipv4_02 gre02.sh
gre_ipv6_02 gre02.sh -6
-gue01 fou01.sh -t gue
-gue01_ipv6 fou01.sh -t gue -6
-
-fou01 fou01.sh
-fou01_ipv6 fou01.sh -6
-
dctcp_ipv4_01 dctcp01.sh
dctcp_ipv6_01 dctcp01.sh -6
@@ -84,8 +78,3 @@ mpls03_ipv6 mpls03.sh -6
mpls04 mpls04.sh
fanout01 fanout01
-
-wireguard01 wireguard01.sh
-wireguard01_ipv6 wireguard01.sh -6
-wireguard02 wireguard02.sh
-wireguard02_ipv6 wireguard02.sh -6
diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index db47dfd5b..afe6d7c71 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -11,6 +11,9 @@ host host01.sh
netstat netstat01.sh
ping01 ping01.sh
ping02 ping02.sh
+rcp rcp01.sh
+rlogin rlogin01.sh
+rsh rsh01.sh
sendfile sendfile01.sh
tcpdump tcpdump01.sh
telnet telnet01.sh
diff --git a/runtest/net.tirpc_tests b/runtest/net.tirpc_tests
index 8aa69ef4d..48e9ba3f5 100644
--- a/runtest/net.tirpc_tests
+++ b/runtest/net.tirpc_tests
@@ -38,7 +38,7 @@ tirpc_clnt_control rpc_test.sh -s tirpc_svc_3 -c tirpc_clnt_control
tirpc_rpc_reg rpc_test.sh -c tirpc_rpc_reg
tirpc_rpc_call rpc_test.sh -s tirpc_svc_1 -c tirpc_rpc_call
tirpc_rpc_broadcast rpc_test.sh -s tirpc_svc_1 -c tirpc_rpc_broadcast
-tirpc_rpc_broadcast_exp rpc_test.sh -s tirpc_svc_1 -c tirpc_rpc_broadcast_exp -e "1,2"
+tirpc_rpc_broadcast_exp rpc_test.sh -s tirpc_svc_1 -c tirpc_rpc_broadcast_exp -e "1 2"
tirpc_clnt_create rpc_test.sh -s tirpc_svc_2 -c tirpc_clnt_create
tirpc_clnt_create_timed rpc_test.sh -s tirpc_svc_2 -c tirpc_clnt_create_timed
diff --git a/runtest/net_stress.multicast b/runtest/net_stress.multicast
index 08b1770fb..d2288df62 100644
--- a/runtest/net_stress.multicast
+++ b/runtest/net_stress.multicast
@@ -2,28 +2,28 @@
# Stress test for TCP/IP protocol stack (Multicast)
#
-mcast4-group-single-socket mcast-group-single-socket.sh
-mcast4-group-multiple-socket mcast-group-multiple-socket.sh
-mcast4-group-same-group mcast-group-same-group.sh
-mcast4-group-source-filter mcast-group-source-filter.sh
-mcast4-pktfld01 mcast-pktfld01.sh
-mcast4-pktfld02 mcast-pktfld02.sh
-mcast4-queryfld01 mcast-queryfld01.sh
-mcast4-queryfld02 mcast-queryfld02.sh
-mcast4-queryfld03 mcast-queryfld03.sh
-mcast4-queryfld04 mcast-queryfld04.sh
-mcast4-queryfld05 mcast-queryfld05.sh
-mcast4-queryfld06 mcast-queryfld06.sh
+mcast4-group-single-socket mcast-group-single-socket
+mcast4-group-multiple-socket mcast-group-multiple-socket
+mcast4-group-same-group mcast-group-same-group
+mcast4-group-source-filter mcast-group-source-filter
+mcast4-pktfld01 mcast4-pktfld01
+mcast4-pktfld02 mcast4-pktfld02
+mcast4-queryfld01 mcast4-queryfld01
+mcast4-queryfld02 mcast4-queryfld02
+mcast4-queryfld03 mcast4-queryfld03
+mcast4-queryfld04 mcast4-queryfld04
+mcast4-queryfld05 mcast4-queryfld05
+mcast4-queryfld06 mcast4-queryfld06
-mcast6-group-single-socket mcast-group-single-socket.sh -6
-mcast6-group-multiple-socket mcast-group-multiple-socket.sh -6
-mcast6-group-same-group mcast-group-same-group.sh -6
-mcast6-group-source-filter mcast-group-source-filter.sh -6
-mcast6-pktfld01 mcast-pktfld01.sh -6
-mcast6-pktfld02 mcast-pktfld02.sh -6
-mcast6-queryfld01 mcast-queryfld01.sh -6
-mcast6-queryfld02 mcast-queryfld02.sh -6
-mcast6-queryfld03 mcast-queryfld03.sh -6
-mcast6-queryfld04 mcast-queryfld04.sh -6
-mcast6-queryfld05 mcast-queryfld05.sh -6
-mcast6-queryfld06 mcast-queryfld06.sh -6
+mcast6-group-single-socket mcast-group-single-socket -6
+mcast6-group-multiple-socket mcast-group-multiple-socket -6
+mcast6-group-same-group mcast-group-same-group -6
+mcast6-group-source-filter mcast-group-source-filter -6
+mcast6-pktfld01 mcast6-pktfld01
+mcast6-pktfld02 mcast6-pktfld02
+mcast6-queryfld01 mcast6-queryfld01
+mcast6-queryfld02 mcast6-queryfld02
+mcast6-queryfld03 mcast6-queryfld03
+mcast6-queryfld04 mcast6-queryfld04
+mcast6-queryfld05 mcast6-queryfld05
+mcast6-queryfld06 mcast6-queryfld06
diff --git a/runtest/net_stress.route b/runtest/net_stress.route
index 5590ef023..4eff6766a 100644
--- a/runtest/net_stress.route
+++ b/runtest/net_stress.route
@@ -2,15 +2,11 @@
route4-change-dst route-change-dst.sh
route4-change-gw route-change-gw.sh
route4-change-if route-change-if.sh
-route4-change-netlink-dst route-change-netlink-dst.sh
-route4-change-netlink-gw route-change-netlink-gw.sh
-route4-change-netlink-if route-change-netlink-if.sh
-route4-redirect route-redirect.sh
+route4-redirect route4-redirect
+route4-rmmod route4-rmmod
route6-change-dst route-change-dst.sh -6
route6-change-gw route-change-gw.sh -6
route6-change-if route-change-if.sh -6
-route6-change-netlink-dst route-change-netlink-dst.sh -6
-route6-change-netlink-gw route-change-netlink-gw.sh -6
-route6-change-netlink-if route-change-netlink-if.sh -6
-route6-redirect route-redirect.sh -6
+route6-redirect route6-redirect
+route6-rmmod route6-rmmod
diff --git a/runtest/pty b/runtest/pty
index a43b18f2d..52e2c07f1 100644
--- a/runtest/pty
+++ b/runtest/pty
@@ -1,9 +1,6 @@
#DESCRIPTION:Terminal type stress
pty01 pty01
pty02 pty02
-pty03 pty03
-pty04 pty04
-pty05 pty05
ptem01 ptem01
hangup01 hangup01
diff --git a/runtest/quickhit b/runtest/quickhit
new file mode 100644
index 000000000..e01b838fb
--- /dev/null
+++ b/runtest/quickhit
@@ -0,0 +1,316 @@
+#DESCRIPTION:A small subset of the syscalls
+access01 access01
+# Basic test for access(2) using F_OK, R_OK, W_OK and X_OK arguments.
+access03 access03
+# EFAULT error testing for access(2)
+alarm02 alarm02
+# Boundary Value Test for alarm(2)
+# TEST CASES
+# Test Case One - A call to alarm() shall not return an error if
+# seconds is a -1.
+# Test FAILS if a non-zero value is returned.
+# Test Case Two - A call to alarm() shall not return an error if
+# seconds is the maximum unsigned integer (2**63).
+# Test FAILS if a non-zero value is returned.
+# Test Case Three - A call to alarm() shall not return an error if
+# seconds is the maximum unsigned integer plus 1 ((2**63)+1).
+# Test FAILS if a non-zero value is returned.
+alarm03 alarm03
+# alarm(2) cleared by a fork
+# TEST CASES
+# 1.) alarm(100), fork, child's alarm(0) shall return 0;
+# 2.) alarm(100), fork, parent's alarm(0) shall return non-zero.
+brk01 brk01
+# Basic test for brk()
+# TEST CASES
+# 1.) brk(2) returns...
+chdir02 chdir02
+# Basic test for chdir(2)
+# TEST CASES
+# 1.) chdir(2) returns...
+chmod02 chmod02
+# Basic test for chmod(2)
+# TEST CASES
+# 1.) chmod(2) returns...
+chown01 chown01
+# Basic test for chown(2)
+# TEST CASES
+# 1.) chown(2) returns...
+close08 close08
+# Basic test for close(2)
+# TEST CASES
+# 1.) close(2) returns...
+dup01 dup01
+# Basic test for dup(2)
+# TEST CASES
+# 1.) dup(2) returns...(See Description)
+dup02 dup02
+# Negative test for dup(2) with bad fd
+# TEST CASES
+# 1-?.) dup(2) returns -1 with errno set to EBADF...(See Description)
+dup03 dup03
+# Negative test for dup(2) (too many fds)
+dup04 dup04
+# Basic test for dup(2) of a system pipe descriptor
+dup05 dup05
+# Basic test for dup(2) of a named pipe descriptor
+execl01 execl01
+# Basic test for execl(2)
+execle01 execle01
+# Basic test for execle(2)
+execlp01 execlp01
+# Basic test for execlp(2
+execv01 execv01
+# Basic test for execv(2)
+execve01 execve01
+# Basic test for execve(2)
+execvp01 execvp01
+# Basic test for execvp(2)
+f00f f00f
+# This is a simple test for handling of the pentium f00f bug.
+# It is an example of a catistrophic test case. If the system
+# doesn't correctly handle this test, it will likely lockup.
+fchmod01 fchmod01
+# Basic test for fchmod(2) using 0700 argument.
+fchown01 fchown01
+# Basic test for fchown(2)
+fcntl02 fcntl02
+# Basic test for fcntl(2) using F_DUPFD argument
+fcntl03 fcntl03
+# Basic test for fcntl(2) using F_GETFD argument
+fcntl04 fcntl04
+# Basic test for fcntl(2) using F_GETFL argument
+fcntl05 fcntl05
+# Basic test for fcntl(2) using F_GETLK argument
+fcntl07 fcntl07
+# Close-On-Exec of named pipe functional test
+fcntl08 fcntl08
+# Basic test for fcntl(2) using F_SETFL argument
+fcntl09 fcntl09
+# Basic test for fcntl(2) using F_SETLK argument
+fcntl10 fcntl10
+# Basic test for fcntl(2) using F_SETLKW argument
+fork01 fork01
+# Basic test for fork(2)
+# TEST CASES
+# 1.) fork returns without error
+# 2.) fork returns the pid of the child
+fork04 fork04
+# Child inheritance of Environment Variables after fork()
+# TEST CASES
+# Test these environment variables correctly inherited by child:
+# 1. TERM
+# 2. NoTSetzWq
+# 3. TESTPROG
+fork05 fork05
+# This is a test sent in my Ulrich Drepper to test for a bug in fork() where
+# %gs is not handled correctly. See fork05.c for a copy of Ulrich's email
+fpathconf01 fpathconf01
+# Basic test for fpathconf(2)
+fstatfs01 fstatfs01
+# Basic test for fstatfs(2)
+fsync01 fsync01
+# Basic test for fsync(2)
+getegid01 getegid01
+# Basic test for getegid(2)
+geteuid01 geteuid01
+# Basic test for geteuid(2)
+getgid01 getgid01
+# Basic test for getgid(2)
+getgroups01 getgroups01
+# Getgroups system call critical test
+# TEST CASES
+# 1. Check to see if getgroups(-1, gidset) fails and sets errno to EINVAL
+# 2. Check to see if getgroups(0, gidset) does not return -1 and gidset is
+# not modified.
+# 3. Check to see if getgroups(x, gigset) fails and sets errno to EINVAL,
+# where x is one less then what is returned by getgroups(0, gidset).
+# 4. Check to see if getgroups() succeeds and gidset contains
+# group id returned from getgid().
+gethostid01 gethostid01
+# Basic test for gethostid(2)
+gethostname01 gethostname01
+# Basic test for gethostname(2)
+getpgrp01 getpgrp01
+# Basic test for getpgrp(2)
+getpid01 getpid01
+# Basic test for getpid(2)
+getppid01 getppid01
+# Basic test for getppid(2)
+getuid01 getuid01
+# Basic test for getuid(2)
+kill02 kill02
+# Sending a signal to processes with the same process group ID.
+kill09 kill09
+# Basic test for kill(2)
+link02 link02
+# Basic test for link(2)
+link03 link03
+# multi links tests
+link04 link04
+# Negative test cases for link(2)
+link05 link05
+# multi links (EMLINK) negative test
+lseek01 lseek01
+lseek02 lseek02
+lseek07 lseek07
+lseek11 lseek11
+# Negative test for lseek(2) of a pipe
+lstat02 lstat02
+# Basic test for lstat(2)
+qmm01 mmap001 -m 1
+# Basic mmap() test.
+open03 open03
+# Basic test for open(2)
+pathconf01 pathconf01
+# Basic test for pathconf(2)
+pause01 pause01
+# Basic test for pause(2)
+read01 read01
+# Basic test for read(2)
+readdir01 readdir01
+# write multiple files and try to find them with readdir
+# TEST CASES
+# 1.) Create n files and check that readdir() finds n files
+readlink01 readlink01
+# Basic test for readlink(2)
+rename02 rename02
+# Basic test for rename(2)
+sbrk01 sbrk01
+# Basic test for sbrk(2)
+select01 select01
+# select to a file
+# TEST CASES
+# 1.) select(2) to a fd of regular file with no I/O and small timeout
+select02 select02
+# select of system pipe fds
+select03 select03
+select04 select04
+# select of fd of a named-pipe (FIFO)
+setgid01 setgid01
+# Basic test for setgid(2)
+setpgid01 setpgid01
+# Basic test for setpgid(2)
+setpgrp01 setpgrp01
+# Basic test for setpgrp(2)
+setregid01 setregid01
+# Basic test for setregid(2)
+setreuid01 setreuid01
+# Basic test for setreuid(2)
+setuid01 setuid01
+# Basic test for setuid(2)
+sighold02 sighold02
+# Holding all signals
+signal03 signal03
+# Boundary value and other invalid value checking of signal setup
+# and signal sending.
+sigrelse01 sigrelse01
+# Releasing held signals
+statfs01 statfs01
+# Basic test for statfs(2) mounted filesys
+statvfs01 statvfs01
+# Basic test for statvfs(2) mounted filesys
+sync01 sync01
+# Basic test for sync(2)
+time01 time01
+# Basic test for time(2)
+times01 times01
+# Basic test for times(2)
+ulimit01 ulimit01
+# Basic test for ulimit(2)
+umask01 umask01
+# Basic test for umask(2)
+uname01 uname01
+# Basic test for uname(2)
+unlink05 unlink05
+# Basic test for unlink(2)
+unlink07 unlink07
+# unlink(2) negative testcases
+unlink08 unlink08
+# unlink(2) negative testcases
+wait02 wait02
+# Basic test for wait(2)
+write01 write01
+# Basic test for write(2)
+symlink01 symlink01
+# Make a Symbolic Link to a File
+# TEST CASES
+# 1. Create symbolic link with abnormal object name path
+# 2. Create symbolic link with normal object name path
+# 3. Create symbolic link with path to an existing object file
+# 4. Receive EEXIST error when creating an already existing symbolic link file.
+# 5. Receive ENAMETOOLONG error when creating symbolic link which exceeds PATH_MAX in length
+symlink02 symlink02
+# Basic test for symlink(2)
+readlink01A symlink01 -T readlink01
+# Reads Value of a Symbolic Link
+# TEST CASES
+# 1. Read a symbolic link file which points at no object file
+# 2. Read a symbolic link file which points at an object file
+# 3. Receive ENAMETOOLONG error when reading symbolic link which exceeds PATH_MAX in length
+# 4. Receive an EINVAL error when reading a file which is not a symbolic
+# link file.
+stat04 symlink01 -T stat04
+# Gets File Status Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Get object file status through symbolic link file
+# 2. Receive ENOENT error when accessing non-existent object file through symbolic link file
+# 3. Receive ELOOP error when nesting of symbolic links exceed maximum
+lstat01A symlink01 -T lstat01
+# Get file Status About a Symbolic Link File
+# TEST CASES
+# 1. Get symbolic link file status when pointing at no object file
+# 2. Get symbolic link file status when pointing at an object file
+# 3. Get object file status when argument is not a symbolic link
+# file.
+mkdir05A symlink01 -T mkdir05
+# Fail When Making a Directory File Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Receive EEXIST error when creating a directory through a symbolic link file
+rmdir03A symlink01 -T rmdir03
+# Fail When Removing a Directory File Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Receive ENOTDIR error when removing an existing directory through a symbolic link file
+chdir01A symlink01 -T chdir01
+# Changes Current Working DIrectory Location Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Change current working directory through a symbolic link file
+# 2. Receive ENOENT error when accessing non-existent directory through symbolic link file
+# 3. Receive ELOOP error when nesting of symbolic links exceed maximum
+link01 symlink01 -T link01
+# Creates a Link To a File Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Link an object file to a new file through symbolic link file
+# 2. Receive ENOENT error when accessing non-existent object file through symbolic link file
+# 3. Receive ELOOP error when nesting of symbolic links exceed maximum
+unlink01 symlink01 -T unlink01
+# Removes a Link To a File And Not Any Object File Which Maybe Pointed At
+# TEST CASES
+# 1. Delete a symbolic link file and not the object file which it points at
+chmod01A symlink01 -T chmod01
+# Change Object File Permissions Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Change file permissions of object file through a symbolic link file
+# 2. Receive ENOENT error when accessing non-existent directory through symbolic link file
+# 3. Receive ELOOP error when nesting of symbolic links exceed maximum
+utime01A symlink01 -T utime01
+# Set File Access And Modify Object File Times Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Change inode times of object file through a symbolic link file
+# 2. Receive ENOENT error when accessing non-existent directory through symbolic link file
+# 3. Receive ELOOP error when nesting of symbolic links exceed maximum
+rename01A symlink01 -T rename01
+# Rename a Symbolic Link File And Not Any Object File
+# TEST CASES
+# 1. Rename a symbolic link file which points at no object file
+# 2. Rename a symbolic link file which points at an object file without any object file alterations.
+# 3. Receive EXDEV when trying to rename a symbolic link file to an address outside of current file system
+open01A symlink01 -T open01
+# Create/Open a File For Reading Or Writing Indirectly From a Symbolic Link File
+# TEST CASES
+# 1. Create an object file through a symbolic link file
+# 2. Open an object file through a symbolic link file
+# 3. Receive EEXIST error when exclusively creating an object file through a symbolic link file
+# 4. Receive ENOENT error when accessing non-existent object file through symbolic link file
+# 5. Receive ELOOP error when nesting of symbolic links exceed maximum
+
diff --git a/runtest/smoketest b/runtest/smoketest
deleted file mode 100644
index 7f395936e..000000000
--- a/runtest/smoketest
+++ /dev/null
@@ -1,16 +0,0 @@
-# The purpose of this file is to have a quick integration test for various
-# test frameworks that integrate LTP testsuite.
-
-access01 access01
-chdir01 chdir01
-fork01 fork01
-time01 time01
-wait02 wait02
-write01 write01
-symlink01 symlink01
-stat04 symlink01 -T stat04
-utime01A symlink01 -T utime01
-rename01A symlink01 -T rename01
-splice02 splice02 -s 20
-route4-change-dst route-change-dst.sh
-shell_test01 echo "SUCCESS" | shell_pipe01.sh
diff --git a/runtest/syscalls b/runtest/syscalls
index 54b90d45b..a39ad2fa2 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -18,11 +18,9 @@ add_key01 add_key01
add_key02 add_key02
add_key03 add_key03
add_key04 add_key04
-add_key05 add_key05
adjtimex01 adjtimex01
adjtimex02 adjtimex02
-adjtimex03 adjtimex03
alarm02 alarm02
alarm03 alarm03
@@ -33,19 +31,13 @@ alarm07 alarm07
bind01 bind01
bind02 bind02
bind03 bind03
-bind04 bind04
-bind05 bind05
-bind06 bind06
bpf_map01 bpf_map01
bpf_prog01 bpf_prog01
bpf_prog02 bpf_prog02
bpf_prog03 bpf_prog03
-bpf_prog04 bpf_prog04
-bpf_prog05 bpf_prog05
brk01 brk01
-brk02 brk02
capget01 capget01
capget02 capget02
@@ -59,6 +51,8 @@ cacheflush01 cacheflush01
chdir01 chdir01
chdir01A symlink01 -T chdir01
+chdir02 chdir02
+chdir03 chdir03
chdir04 chdir04
chmod01 chmod01
@@ -92,18 +86,14 @@ clock_adjtime02 clock_adjtime02
clock_getres01 clock_getres01
clock_nanosleep01 clock_nanosleep01
clock_nanosleep02 clock_nanosleep02
-clock_nanosleep03 clock_nanosleep03
-clock_nanosleep04 clock_nanosleep04
+clock_nanosleep2_01 clock_nanosleep2_01
clock_gettime01 clock_gettime01
clock_gettime02 clock_gettime02
-clock_gettime03 clock_gettime03
-clock_gettime04 clock_gettime04
leapsec01 leapsec01
clock_settime01 clock_settime01
clock_settime02 clock_settime02
-clock_settime03 clock_settime03
clone01 clone01
clone02 clone02
@@ -115,19 +105,13 @@ clone07 clone07
clone08 clone08
clone09 clone09
-clone301 clone301
-clone302 clone302
-
close01 close01
close02 close02
-
-close_range01 close_range01
-close_range02 close_range02
+close08 close08
confstr01 confstr01
connect01 connect01
-connect02 connect02
creat01 creat01
creat03 creat03
@@ -202,7 +186,6 @@ fallocate02 fallocate02
fallocate03 fallocate03
fallocate04 fallocate04
fallocate05 fallocate05
-fallocate06 fallocate06
fsetxattr01 fsetxattr01
fsetxattr02 fsetxattr02
@@ -318,10 +301,6 @@ fcntl35 fcntl35
fcntl35_64 fcntl35_64
fcntl36 fcntl36
fcntl36_64 fcntl36_64
-fcntl37 fcntl37
-fcntl37_64 fcntl37_64
-fcntl38 fcntl38
-fcntl38_64 fcntl38_64
fdatasync01 fdatasync01
fdatasync02 fdatasync02
@@ -331,9 +310,6 @@ fgetxattr01 fgetxattr01
fgetxattr02 fgetxattr02
fgetxattr03 fgetxattr03
-finit_module01 finit_module01
-finit_module02 finit_module02
-
flistxattr01 flistxattr01
flistxattr02 flistxattr02
flistxattr03 flistxattr03
@@ -365,18 +341,6 @@ fpathconf01 fpathconf01
fremovexattr01 fremovexattr01
fremovexattr02 fremovexattr02
-fsconfig01 fsconfig01
-fsconfig02 fsconfig02
-
-fsmount01 fsmount01
-fsmount02 fsmount02
-
-fsopen01 fsopen01
-fsopen02 fsopen02
-
-fspick01 fspick01
-fspick02 fspick02
-
fstat02 fstat02
fstat02_64 fstat02_64
fstat03 fstat03
@@ -417,6 +381,9 @@ getcwd04 getcwd04
getdents01 getdents01
getdents02 getdents02
+getdents01_64 getdents01 -l
+getdents02_64 getdents02 -l
+
getdomainname01 getdomainname01
getdtablesize01 getdtablesize01
@@ -493,7 +460,6 @@ getrlimit02 getrlimit02
getrlimit03 getrlimit03
get_mempolicy01 get_mempolicy01
-get_mempolicy02 get_mempolicy02
get_robust_list01 get_robust_list01
getrusage01 getrusage01
@@ -525,9 +491,6 @@ getxattr03 getxattr03
getxattr04 getxattr04
getxattr05 getxattr05
-init_module01 init_module01
-init_module02 init_module02
-
#Needs tty device.
#ioctl01 ioctl01 -D /dev/tty0
#ioctl02 ioctl02 -D /dev/tty0
@@ -538,17 +501,9 @@ ioctl03 ioctl03
ioctl04 ioctl04
ioctl05 ioctl05
ioctl06 ioctl06
+
ioctl07 ioctl07
ioctl08 ioctl08
-ioctl09 ioctl09
-
-ioctl_loop01 ioctl_loop01
-ioctl_loop02 ioctl_loop02
-ioctl_loop03 ioctl_loop03
-ioctl_loop04 ioctl_loop04
-ioctl_loop05 ioctl_loop05
-ioctl_loop06 ioctl_loop06
-ioctl_loop07 ioctl_loop07
ioctl_ns01 ioctl_ns01
ioctl_ns02 ioctl_ns02
@@ -558,8 +513,6 @@ ioctl_ns05 ioctl_ns05
ioctl_ns06 ioctl_ns06
ioctl_ns07 ioctl_ns07
-ioctl_sg01 ioctl_sg01
-
inotify_init1_01 inotify_init1_01
inotify_init1_02 inotify_init1_02
@@ -572,7 +525,6 @@ inotify06 inotify06
inotify07 inotify07
inotify08 inotify08
inotify09 inotify09
-inotify10 inotify10
fanotify01 fanotify01
fanotify02 fanotify02
@@ -589,10 +541,6 @@ fanotify12 fanotify12
fanotify13 fanotify13
fanotify14 fanotify14
fanotify15 fanotify15
-fanotify16 fanotify16
-fanotify17 fanotify17
-fanotify18 fanotify18
-fanotify19 fanotify19
ioperm01 ioperm01
ioperm02 ioperm02
@@ -608,10 +556,6 @@ ioprio_set03 ioprio_set03
io_cancel01 io_cancel01
io_destroy01 io_destroy01
io_getevents01 io_getevents01
-
-io_pgetevents01 io_pgetevents01
-io_pgetevents02 io_pgetevents02
-
io_setup01 io_setup01
io_submit01 io_submit01
@@ -628,8 +572,10 @@ kcmp01 kcmp01
kcmp02 kcmp02
kcmp03 kcmp03
+kill01 kill01
kill02 kill02
kill03 kill03
+kill04 kill04
kill05 kill05
kill06 kill06
kill07 kill07
@@ -690,8 +636,6 @@ lstat01_64 lstat01_64
lstat02 lstat02
lstat02_64 lstat02_64
-mallinfo02 mallinfo02
-
mallopt01 mallopt01
mbind01 mbind01
@@ -762,9 +706,6 @@ mmap14 mmap14
#mmap11 mmap11 -i 30000
mmap15 mmap15
mmap16 mmap16
-mmap17 mmap17
-mmap18 mmap18
-mmap19 mmap19
modify_ldt01 modify_ldt01
modify_ldt02 modify_ldt02
@@ -777,9 +718,6 @@ mount04 mount04
mount05 mount05
mount06 mount06
-move_mount01 move_mount01
-move_mount02 move_mount02
-
move_pages01 move_pages01
move_pages02 move_pages02
move_pages03 move_pages03
@@ -816,8 +754,6 @@ msgctl01 msgctl01
msgctl02 msgctl02
msgctl03 msgctl03
msgctl04 msgctl04
-msgctl05 msgctl05
-msgctl06 msgctl06
msgstress01 msgstress01
msgstress02 msgstress02
msgstress03 msgstress03
@@ -827,12 +763,11 @@ msgctl12 msgctl12
msgget01 msgget01
msgget02 msgget02
msgget03 msgget03
-msgget04 msgget04
-msgget05 msgget05
msgrcv01 msgrcv01
msgrcv02 msgrcv02
msgrcv03 msgrcv03
+msgrcv04 msgrcv04
msgrcv05 msgrcv05
msgrcv06 msgrcv06
msgrcv07 msgrcv07
@@ -861,9 +796,6 @@ nanosleep01 nanosleep01
nanosleep02 nanosleep02
nanosleep04 nanosleep04
-name_to_handle_at01 name_to_handle_at01
-name_to_handle_at02 name_to_handle_at02
-
nftw01 nftw01
nftw6401 nftw6401
@@ -893,20 +825,8 @@ openat01 openat01
openat02 openat02
openat03 openat03
-openat201 openat201
-openat202 openat202
-openat203 openat203
-
-open_by_handle_at01 open_by_handle_at01
-open_by_handle_at02 open_by_handle_at02
-
-open_tree01 open_tree01
-open_tree02 open_tree02
-
mincore01 mincore01
mincore02 mincore02
-mincore03 mincore03
-mincore04 mincore04
madvise01 madvise01
madvise02 madvise02
@@ -928,10 +848,6 @@ pause03 pause03
personality01 personality01
personality02 personality02
-pidfd_open01 pidfd_open01
-pidfd_open02 pidfd_open02
-pidfd_open03 pidfd_open03
-
pidfd_send_signal01 pidfd_send_signal01
pidfd_send_signal02 pidfd_send_signal02
pidfd_send_signal03 pidfd_send_signal03
@@ -947,12 +863,9 @@ pipe08 pipe08
pipe09 pipe09
pipe10 pipe10
pipe11 pipe11
-pipe12 pipe12
-pipe13 pipe13
pipe2_01 pipe2_01
pipe2_02 pipe2_02
-pipe2_04 pipe2_04
pivot_root01 pivot_root01
@@ -1018,10 +931,6 @@ ptrace05 ptrace05
# Broken test; See: testcases/kernel/syscalls/ptrace/Makefile for more details.
#ptrace06 ptrace06
ptrace07 ptrace07
-ptrace08 ptrace08
-ptrace09 ptrace09
-ptrace10 ptrace10
-ptrace11 ptrace11
pwrite01 pwrite01
pwrite02 pwrite02
@@ -1051,7 +960,6 @@ quotactl03 quotactl03
quotactl04 quotactl04
quotactl05 quotactl05
quotactl06 quotactl06
-quotactl07 quotactl07
read01 read01
read02 read02
@@ -1089,8 +997,6 @@ recvmsg01 recvmsg01
recvmsg02 recvmsg02
recvmsg03 recvmsg03
-recvmmsg01 recvmmsg01
-
remap_file_pages01 remap_file_pages01
remap_file_pages02 remap_file_pages02
@@ -1152,6 +1058,7 @@ sched_get_priority_min01 sched_get_priority_min01
sched_get_priority_min02 sched_get_priority_min02
sched_getparam01 sched_getparam01
+sched_getparam02 sched_getparam02
sched_getparam03 sched_getparam03
sched_rr_get_interval01 sched_rr_get_interval01
@@ -1204,8 +1111,6 @@ semctl04 semctl04
semctl05 semctl05
semctl06 semctl06
semctl07 semctl07
-semctl08 semctl08
-semctl09 semctl09
semget01 semget01
semget02 semget02
@@ -1216,9 +1121,10 @@ semget06 semget06
semop01 semop01
semop02 semop02
semop03 semop03
+semop04 semop04
+semop05 semop05
send01 send01
-send02 send02
sendfile02 sendfile02
sendfile02_64 sendfile02_64
@@ -1240,14 +1146,11 @@ sendfile09_64 sendfile09_64
sendmsg01 sendmsg01
sendmsg02 sendmsg02
-sendmsg03 sendmsg03
sendmmsg01 sendmmsg01
-sendmmsg02 sendmmsg02
sendto01 sendto01
sendto02 sendto02
-sendto03 sendto03
set_mempolicy01 set_mempolicy01
set_mempolicy02 set_mempolicy02
@@ -1377,9 +1280,6 @@ setsockopt01 setsockopt01
setsockopt02 setsockopt02
setsockopt03 setsockopt03
setsockopt04 setsockopt04
-setsockopt05 setsockopt05
-setsockopt06 setsockopt06
-setsockopt07 setsockopt07
settimeofday01 settimeofday01
settimeofday02 settimeofday02
@@ -1404,9 +1304,6 @@ shmctl02 shmctl02
shmctl03 shmctl03
shmctl04 shmctl04
shmctl05 shmctl05
-shmctl06 shmctl06
-shmctl07 shmctl07
-shmctl08 shmctl08
shmdt01 shmdt01
shmdt02 shmdt02
@@ -1457,6 +1354,7 @@ socket02 socket02
socketcall01 socketcall01
socketcall02 socketcall02
socketcall03 socketcall03
+socketcall04 socketcall04
socketpair01 socketpair01
socketpair02 socketpair02
@@ -1464,7 +1362,7 @@ socketpair02 socketpair02
sockioctl01 sockioctl01
splice01 splice01
-splice02 splice02
+splice02 seq 1 20000 | splice02
splice03 splice03
splice04 splice04
splice05 splice05
@@ -1518,6 +1416,8 @@ symlink05 symlink05
symlinkat01 symlinkat01
sync01 sync01
+sync02 sync02
+sync03 sync03
syncfs01 syncfs01
@@ -1544,7 +1444,6 @@ sysfs06 sysfs06
sysinfo01 sysinfo01
sysinfo02 sysinfo02
-sysinfo03 sysinfo03
syslog01 syslog01
syslog02 syslog02
@@ -1564,6 +1463,7 @@ tgkill02 tgkill02
tgkill03 tgkill03
time01 time01
+time02 time02
times01 times01
times03 times03
@@ -1573,11 +1473,9 @@ times03 times03
timerfd01 timerfd01
timerfd02 timerfd02
timerfd03 timerfd03
-timerfd04 timerfd04
timerfd_create01 timerfd_create01
timerfd_gettime01 timerfd_gettime01
timerfd_settime01 timerfd_settime01
-timerfd_settime02 timerfd_settime02
timer_create01 timer_create01
timer_create02 timer_create02
@@ -1591,11 +1489,12 @@ timer_gettime01 timer_gettime01
timer_settime01 timer_settime01
timer_settime02 timer_settime02
-timer_settime03 timer_settime03
tkill01 tkill01
tkill02 tkill02
+truncate01 truncate01
+truncate01_64 truncate01_64
truncate02 truncate02
truncate02_64 truncate02_64
truncate03 truncate03
@@ -1611,6 +1510,7 @@ umask01 umask01
uname01 uname01
uname02 uname02
+uname03 uname03
uname04 uname04
unlink01 symlink01 -T unlink01
@@ -1653,7 +1553,7 @@ utime06 utime06
utimes01 utimes01
# Introduced from Kernel 2.6.22 onwards
-utimensat01 utimensat01
+utimensat01 utimensat_tests.sh
vfork01 vfork01
vfork02 vfork02
@@ -1665,7 +1565,6 @@ vhangup02 vhangup02
vmsplice01 vmsplice01
vmsplice02 vmsplice02
vmsplice03 vmsplice03
-vmsplice04 vmsplice04
wait01 wait01
wait02 wait02
@@ -1698,7 +1597,6 @@ write05 write05
writev01 writev01
writev02 writev02
-writev03 writev03
writev05 writev05
writev06 writev06
writev07 writev07
@@ -1718,6 +1616,7 @@ futex_wake02 futex_wake02
futex_wake03 futex_wake03
futex_wake04 futex_wake04
futex_wait_bitset01 futex_wait_bitset01
+futex_wait_bitset02 futex_wait_bitset02
memfd_create01 memfd_create01
memfd_create02 memfd_create02
@@ -1737,6 +1636,3 @@ statx06 statx06
statx07 statx07
membarrier01 membarrier01
-
-io_uring01 io_uring01
-io_uring02 io_uring02
diff --git a/runtest/syscalls-ipc b/runtest/syscalls-ipc
index 68fff4038..54d8622d4 100644
--- a/runtest/syscalls-ipc
+++ b/runtest/syscalls-ipc
@@ -2,8 +2,6 @@ msgctl01 msgctl01
msgctl02 msgctl02
msgctl03 msgctl03
msgctl04 msgctl04
-msgctl05 msgctl05
-msgctl06 msgctl06
msgstress01 msgstress01
msgstress02 msgstress02
msgstress03 msgstress03
@@ -13,12 +11,11 @@ msgctl12 msgctl12
msgget01 msgget01
msgget02 msgget02
msgget03 msgget03
-msgget04 msgget04
-msgget05 msgget05
msgrcv01 msgrcv01
msgrcv02 msgrcv02
msgrcv03 msgrcv03
+msgrcv04 msgrcv04
msgrcv05 msgrcv05
msgrcv06 msgrcv06
msgrcv07 msgrcv07
@@ -36,8 +33,6 @@ semctl04 semctl04
semctl05 semctl05
semctl06 semctl06
semctl07 semctl07
-semctl08 semctl08
-semctl09 semctl09
semget01 semget01
semget02 semget02
@@ -48,6 +43,8 @@ semget06 semget06
semop01 semop01
semop02 semop02
semop03 semop03
+semop04 semop04
+semop05 semop05
shmat01 shmat01
shmat02 shmat02
@@ -57,9 +54,6 @@ shmctl02 shmctl02
shmctl03 shmctl03
shmctl04 shmctl04
shmctl05 shmctl05
-shmctl06 shmctl06
-shmctl07 shmctl07
-shmctl08 shmctl08
shmdt01 shmdt01
shmdt02 shmdt02
diff --git a/scenario_groups/Makefile b/scenario_groups/Makefile
index fcbc92708..2978675d9 100644
--- a/scenario_groups/Makefile
+++ b/scenario_groups/Makefile
@@ -31,7 +31,7 @@ UNWANTED_FILES := Makefile
INSTALL_MODE := 00644
-INSTALL_TARGETS := $(filter-out $(UNWANTED_FILES),$(notdir $(patsubst $(abs_srcdir)/%,%,$(sort $(wildcard $(abs_srcdir)/*)))))
+INSTALL_TARGETS := $(filter-out $(UNWANTED_FILES),$(notdir $(patsubst $(abs_srcdir)/%,%,$(wildcard $(abs_srcdir)/*))))
MAKE_TARGETS :=
diff --git a/testcases/commands/.gitignore b/testcases/commands/.gitignore
index ed5e13e29..0ed343881 100644
--- a/testcases/commands/.gitignore
+++ b/testcases/commands/.gitignore
@@ -2,4 +2,3 @@
/ldd/datafiles/*.obj.so
/eject/eject_check_tray
/insmod/ltp_insmod01.ko
-/lsmod/ltp_lsmod01.ko
diff --git a/testcases/commands/cpio/cpio_tests.sh b/testcases/commands/cpio/cpio_tests.sh
index a98b7eca7..a1469d873 100755
--- a/testcases/commands/cpio/cpio_tests.sh
+++ b/testcases/commands/cpio/cpio_tests.sh
@@ -1,29 +1,13 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2003-2021
#
# Test basic functionality of cpio command
TST_TESTFUNC=cpio_test
TST_NEEDS_TMPDIR=1
TST_NEEDS_CMDS="cpio"
-TST_SETUP="setup"
. tst_test.sh
-
-setup()
-{
- if ! cpio --help 2>&1 | grep -q -- '-o.*Create'; then
- tst_brk TCONF "-o flag not supported"
- fi
-
- ARCHIVE_FORMAT=
-
- if cpio 2>&1 | grep -q 'BusyBox'; then
- ARCHIVE_FORMAT="-H newc"
- fi
-}
-
cpio_test()
{
ROD mkdir "dir"
@@ -32,7 +16,7 @@ cpio_test()
done
ROD find dir -type f > filelist
- EXPECT_PASS cpio -o $ARCHIVE_FORMAT \> cpio.out \< filelist
+ EXPECT_PASS cpio -o \> cpio.out \< filelist
ROD mv "dir" "dir_orig"
ROD mkdir "dir"
EXPECT_PASS cpio -i \< cpio.out
diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index b821452e6..02aeec7b4 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -39,7 +39,7 @@ setup()
{
tst_mkfs
tst_mount
- DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk 'NR==1{print $5}')
+ DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk '{print $5}')
}
df_test()
@@ -80,10 +80,10 @@ df_verify()
if [ $? -ne 0 ]; then
grep -q -E "unrecognized option | invalid option" output
if [ $? -eq 0 ]; then
- tst_res TCONF "'$@' not supported."
+ tst_res TCONF "'$1' not supported."
return 32
else
- tst_res TFAIL "'$@' failed."
+ tst_res TFAIL "'$1' failed."
cat output
return 1
fi
@@ -101,8 +101,8 @@ df_check()
local free=$(stat -f mntpoint --printf=%f)
local used=$((total-free))
local bsize=$(stat -f mntpoint --printf=%s)
- total=$((($total * $bsize + 512)/ 1024))
- used=$((($used * $bsize + 512) / 1024))
+ total=$(($total * $bsize / 1024))
+ used=$(($used * $bsize / 1024))
fi
grep ${TST_DEVICE} output | grep -q "${total}.*${used}"
diff --git a/testcases/commands/insmod/.gitignore b/testcases/commands/insmod/.gitignore
deleted file mode 100644
index 0e19fb3fd..000000000
--- a/testcases/commands/insmod/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.ko
-*.mod.c
-*.ko.cmd
-*.mod.cmd
-*.mod.o.cmd
-*.o.cmd
-.built-in.a.cmd
-Module.symvers
-modules.order
diff --git a/testcases/commands/ld/ld01.sh b/testcases/commands/ld/ld01.sh
index 0a598ec3a..a05627f9d 100755
--- a/testcases/commands/ld/ld01.sh
+++ b/testcases/commands/ld/ld01.sh
@@ -27,7 +27,7 @@ test1()
{
EXPECT_FAIL $LD x.o y.o 2\> ld.out
- if grep -q "[xy]\.o.*No such file or directory" ld.out; then
+ if grep -q "$LD:.*[xy]\.o.*No such file or directory" ld.out; then
tst_res TPASS "Missing files were reported"
else
tst_res TFAIL "Missing files were not reported"
@@ -39,7 +39,7 @@ test2()
{
EXPECT_FAIL $CC x.o y.o 2\> cc.out
- if grep -q "[xy]\.o.*No such file or directory" cc.out; then
+ if grep -q "$CC:.*[xy]\.o.*No such file or directory" cc.out; then
tst_res TPASS "Missing files were reported"
else
tst_res TFAIL "Missing files were not reported"
diff --git a/testcases/commands/ldd/datafiles/Makefile b/testcases/commands/ldd/datafiles/Makefile
index 01c352052..d8bcf5c06 100644
--- a/testcases/commands/ldd/datafiles/Makefile
+++ b/testcases/commands/ldd/datafiles/Makefile
@@ -21,7 +21,7 @@ CPPFLAGS += -fpic
INSTALL_TARGETS := ldd*.so lddfile.out
-LDD_C_FILES := $(sort $(wildcard $(abs_srcdir)/lddfile*.c))
+LDD_C_FILES := $(wildcard $(abs_srcdir)/lddfile*.c)
LDD_SO_FILES := $(patsubst $(abs_srcdir)/%.c,%.obj.so,$(LDD_C_FILES))
MAKE_TARGETS := lddfile.out
CLEAN_TARGETS += *.obj $(LDD_SO_FILES)
diff --git a/testcases/commands/lsmod/.gitignore b/testcases/commands/lsmod/.gitignore
deleted file mode 100644
index 0e19fb3fd..000000000
--- a/testcases/commands/lsmod/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.ko
-*.mod.c
-*.ko.cmd
-*.mod.cmd
-*.mod.o.cmd
-*.o.cmd
-.built-in.a.cmd
-Module.symvers
-modules.order
diff --git a/testcases/commands/lsmod/Makefile b/testcases/commands/lsmod/Makefile
index 8fc3b1436..2af91b3de 100644
--- a/testcases/commands/lsmod/Makefile
+++ b/testcases/commands/lsmod/Makefile
@@ -13,25 +13,10 @@
# GNU General Public License for more details.
#
-ifneq ($(KERNELRELEASE),)
-
-obj-m := ltp_lsmod01.o
-
-else
-
top_srcdir ?= ../../..
-include $(top_srcdir)/include/mk/testcases.mk
-
-REQ_VERSION_MAJOR := 2
-REQ_VERSION_PATCH := 6
-MAKE_TARGETS := ltp_lsmod01.ko
-
include $(top_srcdir)/include/mk/env_pre.mk
INSTALL_TARGETS := lsmod01.sh
-include $(top_srcdir)/include/mk/module.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-endif
diff --git a/testcases/commands/lsmod/lsmod01.sh b/testcases/commands/lsmod/lsmod01.sh
index 38182a657..0f5b6aaae 100755
--- a/testcases/commands/lsmod/lsmod01.sh
+++ b/testcases/commands/lsmod/lsmod01.sh
@@ -1,49 +1,18 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2016-2021
# Copyright (c) 2015 Fujitsu Ltd.
# Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
#
# Test basic functionality of lsmod command.
-TST_CLEANUP=cleanup
-TST_SETUP=setup
TST_TESTFUNC=lsmod_test
TST_NEEDS_TMPDIR=1
TST_NEEDS_CMDS="lsmod"
. tst_test.sh
-module_inserted=
-
-setup()
-{
- if [ -z "$(cat /proc/modules)" ]; then
- tst_res TINFO "Loading dummy kernel module"
- tst_require_module "ltp_lsmod01.ko"
- tst_require_root
- tst_require_cmds insmod
- ROD insmod "$TST_MODPATH"
-
- module_inserted=1
- fi
-}
-
-cleanup()
-{
- if [ "$module_inserted" = 1 ]; then
- tst_res TINFO "Unloading dummy kernel module"
- rmmod ltp_lsmod01
- if [ $? -ne 0 ]; then
- tst_res TWARN "rmmod failed"
- fi
- fi
-}
-
lsmod_matches_proc_modules()
{
- lsmod_output=$(lsmod \
- | awk '!/Module/{print $1, $2, ($3==-2) ? "-" : $3}' \
- | sort)
+ lsmod_output=$(lsmod | awk '!/Module/{print $1, $2, $3}' | sort)
if [ -z "$lsmod_output" ]; then
tst_brk TBROK "Failed to parse the output from lsmod"
fi
diff --git a/testcases/commands/lsmod/ltp_lsmod01.c b/testcases/commands/lsmod/ltp_lsmod01.c
deleted file mode 100644
index 19f9d9145..000000000
--- a/testcases/commands/lsmod/ltp_lsmod01.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright (c) 2016 Fujitsu Ltd.
- * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * Description:
- * This is a kernel loadable module programme used by lssmod01.sh
- * testcase which inserts this module for test of lsmod command.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-
-static int test_init(void)
-{
- return 0;
-}
-
-static void test_exit(void)
-{
-
-}
-
-MODULE_LICENSE("GPL");
-
-module_init(test_init);
-module_exit(test_exit);
diff --git a/testcases/commands/mkfs/mkfs01.sh b/testcases/commands/mkfs/mkfs01.sh
index 17c7fb9e4..90368190d 100755
--- a/testcases/commands/mkfs/mkfs01.sh
+++ b/testcases/commands/mkfs/mkfs01.sh
@@ -69,11 +69,11 @@ mkfs_verify_size()
# 1k-block size should be devided by this argument for ntfs verification.
if [ "$1" = "ntfs" ]; then
local rate=1024/512
- if [ $blocknum -lt "$(($2/$rate*8/10))" ]; then
+ if [ $blocknum -lt "$(($2/$rate*9/10))" ]; then
return 1
fi
else
- if [ $blocknum -lt "$(($2*8/10))" ]; then
+ if [ $blocknum -lt "$(($2*9/10))" ]; then
return 1
fi
fi
@@ -96,21 +96,18 @@ mkfs_test()
if [ "$fs_type" = "xfs" ] || [ "$fs_type" = "btrfs" ]; then
fs_op="$fs_op -f"
fi
- if [ "$fs_type" = "ext3" ] || [ "$fs_type" = "ext4" ]; then
- fs_op="$fs_op -b 1024"
- fi
local mkfs_cmd="mkfs $mkfs_op $fs_op $device $size"
echo ${fs_op} | grep -q "\-c"
if [ $? -eq 0 ] && [ "$fs_type" = "ntfs" ]; then
- tst_res TCONF "'$mkfs_cmd' not supported."
+ tst_res TCONF "'${mkfs_cmd}' not supported."
return
fi
if [ -n "$size" ]; then
if [ "$fs_type" = "xfs" ] || [ "$fs_type" = "btrfs" ]; then
- tst_res TCONF "'$mkfs_cmd' not supported."
+ tst_res TCONF "'${mkfs_cmd}' not supported."
return
fi
fi
@@ -119,10 +116,10 @@ mkfs_test()
if [ $? -ne 0 ]; then
grep -q -E "unknown option | invalid option" temp
if [ $? -eq 0 ]; then
- tst_res TCONF "'$mkfs_cmd' not supported."
+ tst_res TCONF "'${mkfs_cmd}' not supported."
return
else
- tst_res TFAIL "'$mkfs_cmd' failed."
+ tst_res TFAIL "'${mkfs_cmd}' failed."
cat temp
return
fi
@@ -131,8 +128,7 @@ mkfs_test()
if [ -n "$device" ]; then
mkfs_verify_type "$fs_type" "$device"
if [ $? -ne 0 ]; then
- tst_res TFAIL "'$mkfs_cmd' failed, unexpected type."
- cat temp
+ tst_res TFAIL "'${mkfs_cmd}' failed, not expected."
return
fi
fi
@@ -140,13 +136,12 @@ mkfs_test()
if [ -n "$size" ]; then
mkfs_verify_size "$fs_type" "$size"
if [ $? -ne 0 ]; then
- tst_res TFAIL "'$mkfs_cmd' failed, unexpected size."
- cat temp
+ tst_res TFAIL "'${mkfs_cmd}' failed, not expected."
return
fi
fi
- tst_res TPASS "'$mkfs_cmd' passed."
+ tst_res TPASS "'${mkfs_cmd}' passed."
}
test1()
diff --git a/testcases/commands/nm/nm01.sh b/testcases/commands/nm/nm01.sh
index 873126d20..fd9d3d922 100755
--- a/testcases/commands/nm/nm01.sh
+++ b/testcases/commands/nm/nm01.sh
@@ -47,7 +47,7 @@ test2()
{
EXPECT_PASS $NM -f posix -g $TST_DATAROOT/f1 \> nm.out
- if grep -q "^[^ ]\+ [abdft]" nm.out; then
+ if grep -q "\w [a,b,d,f,t]" nm.out; then
tst_res TFAIL "Got internal symbols with -g"
cat nm.out
else
diff --git a/testcases/commands/shell/Makefile b/testcases/commands/shell/Makefile
deleted file mode 100644
index c696ec35a..000000000
--- a/testcases/commands/shell/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2021
-
-top_srcdir ?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/shell/shell_pipe01.sh b/testcases/commands/shell/shell_pipe01.sh
deleted file mode 100755
index 3c8ef49fb..000000000
--- a/testcases/commands/shell/shell_pipe01.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-
-TST_TESTFUNC=do_test
-
-. tst_test.sh
-
-do_test()
-{
- tst_res TINFO "expecting SUCCESS string passed from stdin"
-
- read line
- EXPECT_PASS [ "$line" = "SUCCESS" ]
-}
-
-tst_run
diff --git a/testcases/commands/unzip/unzip01.sh b/testcases/commands/unzip/unzip01.sh
index c3bb75730..750718de4 100755
--- a/testcases/commands/unzip/unzip01.sh
+++ b/testcases/commands/unzip/unzip01.sh
@@ -12,12 +12,6 @@ TST_NEEDS_TMPDIR=1
TST_NEEDS_CMDS="unzip"
. tst_test.sh
-EXTRACT_MATCH="extracting"
-
-if unzip 2>&1 | grep -q 'BusyBox'; then
- EXTRACT_MATCH="inflating"
-fi
-
setup()
{
cat > unzip_exp.out <<EOF
@@ -27,15 +21,15 @@ Archive: $TST_DATAROOT/test.zip
creating: dir/d2/
creating: dir/d3/
creating: dir/d4/
- $EXTRACT_MATCH: dir/d1/f1
- $EXTRACT_MATCH: dir/d1/f2
- $EXTRACT_MATCH: dir/d1/f3
+ extracting: dir/d1/f1
+ extracting: dir/d1/f2
+ extracting: dir/d1/f3
creating: dir/d2/d1/
creating: dir/d2/d2/
creating: dir/d2/d3/
- $EXTRACT_MATCH: dir/d2/f1
- $EXTRACT_MATCH: dir/d2/f2
- $EXTRACT_MATCH: dir/d2/f3
+ extracting: dir/d2/f1
+ extracting: dir/d2/f2
+ extracting: dir/d2/f3
creating: dir/d3/d1/
creating: dir/d3/d2/
creating: dir/d3/d3/
diff --git a/testcases/cve/Makefile b/testcases/cve/Makefile
index 63b1d7525..da44fff60 100644
--- a/testcases/cve/Makefile
+++ b/testcases/cve/Makefile
@@ -45,6 +45,6 @@ endif
cve-2017-17052: CFLAGS += -pthread
cve-2017-17053: CFLAGS += -pthread
-cve-2015-3290: CFLAGS += -pthread -fomit-frame-pointer
+cve-2015-3290: CFLAGS += -pthread
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/cve/cve-2017-17052.c b/testcases/cve/cve-2017-17052.c
index b97815708..361ed66be 100644
--- a/testcases/cve/cve-2017-17052.c
+++ b/testcases/cve/cve-2017-17052.c
@@ -112,7 +112,7 @@ static void run(void)
if (run == RUNS)
tst_res(TPASS, "kernel survived %d runs", run);
else
- tst_res(TFAIL, "something strange happened");
+ tst_res(TBROK, "something strange happened");
}
static struct tst_test test = {
diff --git a/testcases/cve/cve-2017-17053.c b/testcases/cve/cve-2017-17053.c
index a4c418986..08a08211d 100644
--- a/testcases/cve/cve-2017-17053.c
+++ b/testcases/cve/cve-2017-17053.c
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <stdio.h>
+#include "tst_taint.h"
#include "lapi/syscalls.h"
#define EXEC_USEC 5000000
@@ -84,6 +85,8 @@ static void install_sighandler(void)
static void setup(void)
{
+ tst_taint_init(TST_TAINT_W | TST_TAINT_D);
+
shm = SAFE_MMAP(NULL, sizeof(struct shm_data),
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
@@ -151,7 +154,6 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.test_all = run,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
.tags = (const struct tst_tag[]) {
{"linux-git", "ccd5b3235180"},
{"CVE", "2017-17053"},
diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c
index a387b3205..db00e1811 100644
--- a/testcases/cve/meltdown.c
+++ b/testcases/cve/meltdown.c
@@ -175,7 +175,7 @@ readbit(int fd, unsigned long addr, char bit)
for (i = 0; i < CYCLES; i++) {
ret = pread(fd, buf, sizeof(buf), 0);
if (ret < 0)
- tst_res(TFAIL | TERRNO, "can't read fd");
+ tst_res(TBROK | TERRNO, "can't read fd");
clflush_target();
@@ -304,7 +304,7 @@ static void setup(void)
memset(target_array, 1, sizeof(target_array));
if (set_signal() < 0)
- tst_res(TFAIL | TERRNO, "set_signal");
+ tst_res(TBROK | TERRNO, "set_signal");
}
#define READ_SIZE 32
@@ -320,7 +320,7 @@ static void run(void)
expected_len = pread(spec_fd, expected, sizeof(expected), 0);
if (expected_len < 0)
- tst_res(TFAIL | TERRNO, "can't read test fd");
+ tst_res(TBROK | TERRNO, "can't read test fd");
/* read address of saved_cmdline_addr */
addr = saved_cmdline_addr;
diff --git a/testcases/cve/stack_clash.c b/testcases/cve/stack_clash.c
index cd7f148c2..ecbf5f6da 100644
--- a/testcases/cve/stack_clash.c
+++ b/testcases/cve/stack_clash.c
@@ -119,7 +119,7 @@ void dump_proc_self_maps(void)
static char buf[64];
static const char *cmd[] = {"cat", buf, NULL};
sprintf(buf, "/proc/%d/maps", getpid());
- tst_cmd(cmd, NULL, NULL, 0);
+ tst_run_cmd(cmd, NULL, NULL, 0);
}
void __attribute__((noinline)) preallocate_stack(unsigned long required)
diff --git a/testcases/kernel/connectors/Makefile b/testcases/kernel/connectors/Makefile
index 5f668f419..04d8a4b91 100644
--- a/testcases/kernel/connectors/Makefile
+++ b/testcases/kernel/connectors/Makefile
@@ -24,4 +24,6 @@ top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
+INSTALL_TARGETS := connector_test.sh
+
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/connectors/connector_test.sh b/testcases/kernel/connectors/connector_test.sh
new file mode 100644
index 000000000..f92e10b85
--- /dev/null
+++ b/testcases/kernel/connectors/connector_test.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ ! -f /proc/net/connector ];then
+ echo "Connectors 0 CONF : system doesn't support execution of the test"
+ exit 32
+fi
+
+$LTPROOT/testcases/bin/run_pec_test
+
diff --git a/testcases/kernel/connectors/pec/Makefile b/testcases/kernel/connectors/pec/Makefile
index d9a7f104e..fa0aa6828 100644
--- a/testcases/kernel/connectors/pec/Makefile
+++ b/testcases/kernel/connectors/pec/Makefile
@@ -24,6 +24,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-INSTALL_TARGETS := cn_pec.sh
+INSTALL_TARGETS := run_pec_test
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/connectors/pec/README b/testcases/kernel/connectors/pec/README
new file mode 100644
index 000000000..2d24257b8
--- /dev/null
+++ b/testcases/kernel/connectors/pec/README
@@ -0,0 +1,48 @@
+
+TEST SUITE:
+
+The directory pec contains the tests related to the process event connector.
+
+Process event connector is a netlink connector that reports process events
+to userspace. It sends events such as fork, exec, id change and exit.
+
+There are total 5 testcases.
+
+Note: the test can be run by root only.
+
+TESTS AIM:
+
+The aim of the tests is to test the functionality of process event connector.
+
+FILES DESCRIPTION:
+
+check_connector_enabled.c
+------------------
+This program is used to check if the kernel supports netlink connector.
+
+event_generator.c
+------------------
+This program is used to generate a specified process event (fork, exec, uid,
+gid or exit).
+
+run_pec_test
+------------------
+This script runs all the 5 testcases.
+
+pec_listener.c
+------------------
+This program is used to ilsten to process events received through the kernel
+connector and print them.
+
+Makefile
+------------------
+The usual makefile for this directory
+
+$LTPROOT/output/pec/*.log
+------------------
+The outputs of event_generator and pec_listeners.
+
+README:
+------------------
+The one you have gone through.
+
diff --git a/testcases/kernel/connectors/pec/cn_pec.sh b/testcases/kernel/connectors/pec/cn_pec.sh
deleted file mode 100755
index 9b85a5c81..000000000
--- a/testcases/kernel/connectors/pec/cn_pec.sh
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2008 FUJITSU LIMITED
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-#
-# Process event connector is a netlink connector that reports process events
-# to userspace. It sends events such as fork, exec, id change and exit.
-
-TST_OPTS="n:"
-TST_SETUP=setup
-TST_TESTFUNC=test
-TST_PARSE_ARGS=parse_args
-TST_USAGE=usage
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_TEST_DATA="fork exec exit uid gid"
-
-. tst_test.sh
-
-num_events=10
-
-usage()
-{
- cat << EOF
-usage: $0 [-n <nevents>]
-
-OPTIONS
--n The number of evetns to generate per test (default 10)
-EOF
-}
-
-parse_args()
-{
- case $1 in
- n) num_events=$2;;
- esac
-}
-
-# Find a free file handle
-free_fd()
-{
- local fd
-
- for fd in $(seq 200); do
- # Sapwn a new sh, because redirecting to a non existing file handle
- # will trigger a syntax error.
- sh -c ": 2>/dev/null >&$fd || : 2>/dev/null <&$fd" 2>/dev/null
- if [ $? -ne 0 ]; then
- echo $fd
- return
- fi
- done
-}
-
-setup()
-{
- if ! grep -q cn_proc /proc/net/connector; then
- tst_brk TCONF "Process Event Connector is not supported or kernel < 2.6.26"
- fi
-
- tst_res TINFO "Test process events connector"
-}
-
-test()
-{
- local event=$2
- local expected_events lis_rc pid fd_act failed act_nevents exp act
-
- tst_res TINFO "Testing $2 event (nevents=$num_events)"
-
- pec_listener >lis_$event.log 2>lis_$event.err &
- pid=$!
- # wait for pec_listener to start listening
- tst_sleep 100ms
-
- ROD event_generator -n $num_events -e $event \>gen_$event.log 2\>gen_$event.err
-
- kill -s INT $pid 2> /dev/null
- wait $pid
- lis_rc=$?
-
- if [ ! -s gen_$event.log ]; then
- tst_brk TBROK "failed to generate process events: $(cat gen_$event.err)"
- fi
-
- if [ $lis_rc -ne 0 ]; then
- tst_brk TBROK "failed to execute the listener: $(cat lis_$event.err)"
- fi
-
- # The listener writes the same messages as the generator, but it can
- # also see more events (e.g. for testing exit, a fork is generated).
- # So: The events generated by the generator have to be in the same order
- # as the events printed by the listener, but my interleaved with other
- # messages. To correctly compare them, we have to open both logs
- # and iterate over both of them at the same time, skipping messages
- # in the listener log, that are not of interest.
- # Because some messages may be multiple times in the listener log,
- # we have to open it only once!
- # This however does not check, if the listener sees more messages,
- # than expected.
-
- fd_act=$(free_fd)
- [ -z "$fd_act" ] && tst_brk TBROK "No free filehandle found"
- eval "exec ${fd_act}<lis_$event.log"
-
- failed=0
- act_nevents=0
- while read -r exp; do
- local found=0
- act_nevents=$((act_nevents + 1))
- while read -r act; do
- if [ "$exp" = "$act" ]; then
- found=1
- break
- fi
- done <&${fd_act}
- if [ $found -ne 1 ]; then
- failed=1
- tst_res TFAIL "Event was not detected by the event listener: $exp"
- break
- fi
- done <gen_$event.log
-
- eval "exec ${fd_act}<&-"
-
- if [ $failed -eq 0 ]; then
- if [ $act_nevents -ne $num_events ]; then
- tst_res TBROK "Expected $num_events, but $act_nevents generated"
- else
- tst_res TPASS "All events detected"
- fi
- else
- # TFAIL message is already printed in the loop above
- cat lis_$event.log
- fi
-}
-
-tst_run
diff --git a/testcases/kernel/connectors/pec/event_generator.c b/testcases/kernel/connectors/pec/event_generator.c
index 62e341268..cfa6b0dcc 100644
--- a/testcases/kernel/connectors/pec/event_generator.c
+++ b/testcases/kernel/connectors/pec/event_generator.c
@@ -1,12 +1,24 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2008 FUJITSU LIMITED
- * Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
- *
- * Author: Li Zefan <lizf@cn.fujitsu.com>
- *
- * Generate a specified process event (fork, exec, uid, gid or exit).
- */
+/******************************************************************************/
+/* */
+/* Copyright (c) 2008 FUJITSU LIMITED */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/* Author: Li Zefan <lizf@cn.fujitsu.com> */
+/* */
+/******************************************************************************/
#include <unistd.h>
#include <string.h>
@@ -16,13 +28,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-
-extern struct tst_test *tst_test;
-static struct tst_test test = {
- .forks_child = 1
-};
+#include "test.h"
#define DEFAULT_EVENT_NUM 1
@@ -35,12 +41,11 @@ const char *ltp_user = "nobody";
char **exec_argv;
void (*gen_event) (void);
-static void usage(int status) LTP_ATTRIBUTE_NORETURN;
/*
* Show the usage
*
- * @param status the exit status
+ * @status: the exit status
*/
static void usage(int status)
{
@@ -56,8 +61,8 @@ static void usage(int status)
* Generate exec event.
*
* We can't just exec nr_event times, because the current process image
- * will be replaced with the new process image, so we use environment
- * variable as event counters, as it will be inherited after exec.
+ * will be replaced with the new process image, so we use enviroment
+ * viriable as event counters, as it will be inherited after exec.
*/
static void gen_exec(void)
{
@@ -84,8 +89,7 @@ static void gen_exec(void)
printf("exec pid: %d\n", getpid());
fflush(stdout);
- /* Note: This expects the full path to self in exec_argv[0]! */
- SAFE_EXECVP(exec_argv[0], exec_argv);
+ execv(exec_argv[0], exec_argv);
}
/*
@@ -93,8 +97,19 @@ static void gen_exec(void)
*/
static inline void gen_fork(void)
{
- /* The actual fork is already done in main */
- printf("fork parent: %d, child: %d\n", getppid(), getpid());
+ pid_t pid;
+ int status;
+
+ pid = fork();
+ if (pid == 0) {
+ printf("fork parent: %d, child: %d\n", getppid(), getpid());
+ exit(0);
+ } else if (pid < 0) {
+ fprintf(stderr, "fork() failed\n");
+ exit(1);
+ } else { /* Parent should wait for the child */
+ wait(&status);
+ }
}
/**
@@ -102,10 +117,16 @@ static inline void gen_fork(void)
*/
static inline void gen_exit(void)
{
- /* exit_signal will always be SIGCHLD, if the process terminates cleanly */
- printf("exit pid: %d exit_code: %d exit_signal: %d\n",
- getpid(), 0, SIGCHLD);
- /* exit is called by main already */
+ pid_t pid;
+
+ pid = fork();
+ if (pid == 0) {
+ printf("exit pid: %d exit_code: %d\n", getpid(), 0);
+ exit(0);
+ } else if (pid < 0) {
+ fprintf(stderr, "fork() failed\n");
+ exit(1);
+ }
}
/*
@@ -113,8 +134,8 @@ static inline void gen_exit(void)
*/
static inline void gen_uid(void)
{
- SAFE_SETUID(ltp_uid);
- printf("uid pid: %d euid: %d ruid: %d\n", getpid(), ltp_uid, ltp_uid);
+ setuid(ltp_uid);
+ printf("uid pid: %d euid: %d\n", getpid(), ltp_uid);
}
/*
@@ -122,15 +143,15 @@ static inline void gen_uid(void)
*/
static inline void gen_gid(void)
{
- SAFE_SETGID(ltp_gid);
- printf("gid pid: %d egid: %d rgid: %u\n", getpid(), ltp_gid, ltp_gid);
+ setgid(ltp_gid);
+ printf("gid pid: %d egid: %d\n", getpid(), ltp_gid);
}
/*
* Read option from user input.
*
- * @param argc number of arguments
- * @param argv argument list
+ * @argc: number of arguments
+ * @argv: argument list
*/
static void process_options(int argc, char **argv)
{
@@ -184,8 +205,6 @@ int main(int argc, char **argv)
unsigned long i;
struct passwd *ent;
- tst_test = &test;
-
process_options(argc, argv);
ent = getpwnam(ltp_user);
@@ -196,6 +215,8 @@ int main(int argc, char **argv)
ltp_uid = ent->pw_uid;
ltp_gid = ent->pw_gid;
+ signal(SIGCHLD, SIG_IGN);
+
/* special processing for gen_exec, see comments above gen_exec() */
if (gen_event == gen_exec) {
exec_argv = argv;
@@ -207,26 +228,8 @@ int main(int argc, char **argv)
}
/* other events */
- for (i = 0; i < nr_event; i++) {
- pid_t pid;
- int status;
-
- pid = SAFE_FORK();
- if (pid == 0) {
- gen_event();
- exit(0);
- } else {
- if (pid != SAFE_WAITPID(pid, &status, 0)) {
- fprintf(stderr,
- "Child process did not terminate as expected\n");
- return 1;
- }
- if (WEXITSTATUS(status) != 0) {
- fprintf(stderr, "Child process did not terminate with 0\n");
- return 1;
- }
- }
- }
+ for (i = 0; i < nr_event; i++)
+ gen_event();
return 0;
}
diff --git a/testcases/kernel/connectors/pec/pec_listener.c b/testcases/kernel/connectors/pec/pec_listener.c
index 7844dc905..960405996 100644
--- a/testcases/kernel/connectors/pec/pec_listener.c
+++ b/testcases/kernel/connectors/pec/pec_listener.c
@@ -1,12 +1,24 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2008 FUJITSU LIMITED
- *
- * Author: Li Zefan <lizf@cn.fujitsu.com>
- *
- * Listen to process events received through the kernel connector
- * and print them.
- */
+/******************************************************************************/
+/* */
+/* Copyright (c) 2008 FUJITSU LIMITED */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/* Author: Li Zefan <lizf@cn.fujitsu.com> */
+/* */
+/******************************************************************************/
#include <sys/socket.h>
#include <sys/poll.h>
@@ -58,7 +70,7 @@ struct nlmsghdr *nlhdr;
/*
* Handler for signal int. Set exit flag.
*
- * @param signo the signal number, not used
+ * @signo: the signal number, not used
*/
static void sigint_handler(int __attribute__ ((unused)) signo)
{
@@ -68,9 +80,9 @@ static void sigint_handler(int __attribute__ ((unused)) signo)
/*
* Send netlink package.
*
- * @param sd socket descriptor
- * @param to the destination sockaddr
- * @param cnmsg the pec control message
+ * @sd: socket descripor
+ * @to: the destination sockaddr
+ * @cnmsg: the pec control message
*/
static int netlink_send(int sd, struct sockaddr_nl *to, struct cn_msg *cnmsg)
{
@@ -105,8 +117,8 @@ static int netlink_send(int sd, struct sockaddr_nl *to, struct cn_msg *cnmsg)
/*
* Receive package from netlink.
*
- * @param sd socket descriptor
- * @param from source sockaddr
+ * @sd: socket descripor
+ * @from: source sockaddr
*/
static int netlink_recv(int sd, struct sockaddr_nl *from)
{
@@ -134,9 +146,9 @@ static int netlink_recv(int sd, struct sockaddr_nl *from)
/*
* Send control message to PEC.
*
- * @param sd socket descriptor
- * @param to the destination sockaddr
- * @param op control flag
+ * @sd: socket descriptor
+ * @to: the destination sockaddr
+ * @op: control flag
*/
static int control_pec(int sd, struct sockaddr_nl *to, enum proc_cn_mcast_op op)
{
@@ -165,7 +177,7 @@ static int control_pec(int sd, struct sockaddr_nl *to, enum proc_cn_mcast_op op)
/*
* Process PEC event.
*
- * @param nlhdr the netlink package
+ * @nlhdr: the netlinke pacakge
*/
static void process_event(struct nlmsghdr *nlhdr)
{
@@ -210,7 +222,7 @@ static void process_event(struct nlmsghdr *nlhdr)
}
}
-int main(void)
+int main(int argc, char **argv)
{
int ret;
int sd;
@@ -311,7 +323,7 @@ int main(void)
while (fsync(STDOUT_FILENO) == -1) {
if (errno != EIO)
break;
- /* retry once every 10 seconds */
+ /* retry once every 10 secodns */
sleep(10);
}
diff --git a/testcases/kernel/connectors/pec/run_pec_test b/testcases/kernel/connectors/pec/run_pec_test
new file mode 100755
index 000000000..272948575
--- /dev/null
+++ b/testcases/kernel/connectors/pec/run_pec_test
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+################################################################################
+## ##
+## Copyright (c) 2008 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Li Zefan <lizf@cn.fujitsu.com> ##
+## ##
+################################################################################
+
+NUM_EVENTS=1
+EVENT_TEST_CASES=( "fork" "exec" "exit" "uid" "gid" )
+
+cd $LTPROOT/testcases/bin
+
+export TCID="pec01"
+export TST_TOTAL=5
+export TST_COUNT=1
+
+exit_status=0
+
+if [ $(id -u) != 0 ]; then
+ tst_brkm TCONF ignored "Test must be run as root"
+ exit 0;
+fi
+
+grep cn_proc /proc/net/connector > /dev/null
+if [ $? -ne 0 ]; then
+ tst_brkm TCONF ignored "Process Event Connector is not supported or kernel is below 2.6.26"
+ exit 0;
+fi
+
+# Run a test case
+#
+# $1: the test number
+# $2: type of event
+run_case()
+{
+ export TST_COUNT=$1
+
+ log="$LTPROOT/output/log"
+ mkdir -p $log 2> /dev/null
+
+ pec_listener > "$log/listener_$1.log" 2>&1 &
+ pid=$!
+ # Wait for pec_listener to start listening
+ sleep $((1*NUM_EVENTS))
+
+ event_generator -e $2 > "$log/generator_$1.log"
+ ret1=$?
+
+ # Sleep until pec_listener has seen and handled all of
+ # the generated events
+ sleep $((1*NUM_EVENTS))
+ kill -s SIGINT $pid 2> /dev/null
+ wait $pid
+ ret2=$?
+
+ if [ $ret1 -ne 0 -o ! -s "$log/generator_$1.log" ]; then
+ tst_resm TFAIL "failed to generate process events"
+ exit_status=1
+ return 1
+ fi
+
+ if [ $ret2 -eq 2 ]; then
+ tst_brkm TCONF NULL "connector may not be supported"
+ exit 0
+ fi
+
+ if [ $ret2 -ne 0 ]; then
+ tst_resm TFAIL "failed to listen process events"
+ exit_status=1
+ return 1
+ fi
+
+ event="`cat $log/generator_$1.log`"
+ cat "$log/listener_$1.log" | grep "$event" > /dev/null
+ if [ $? -eq 0 ]; then
+ tst_resm TPASS "get event - $event"
+ else
+ tst_resm TFAIL "expected event - $event"
+ exit_status=1
+ fi
+}
+
+i=1;
+for CASE in "${EVENT_TEST_CASES[@]}" ; do
+ run_case $i $CASE
+ ((i++))
+done
+
+exit $exit_status
+
diff --git a/testcases/kernel/containers/README b/testcases/kernel/containers/README
index c99cacd98..f719a6543 100644
--- a/testcases/kernel/containers/README
+++ b/testcases/kernel/containers/README
@@ -20,9 +20,8 @@
CONTAINER TESTS AUTOMATION SUITE
----------------------------
-The tests requires the Kernel to be compiled with the following configs
+The tests requires the Kernel to be compiled with the following config's
-CONFIG_DUMMY=y(or =m)
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
diff --git a/testcases/kernel/containers/libclone/Makefile b/testcases/kernel/containers/libclone/Makefile
index 13af52b67..d78570db7 100644
--- a/testcases/kernel/containers/libclone/Makefile
+++ b/testcases/kernel/containers/libclone/Makefile
@@ -22,6 +22,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-INTERNAL_LIB := libclone.a
+LIB := libclone.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/kernel/containers/netns/netns_breakns.sh b/testcases/kernel/containers/netns/netns_breakns.sh
index 1ce5d37ef..c7aa2c34c 100755
--- a/testcases/kernel/containers/netns/netns_breakns.sh
+++ b/testcases/kernel/containers/netns/netns_breakns.sh
@@ -1,8 +1,23 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020
+#==============================================================================
# Copyright (c) 2015 Red Hat, Inc.
#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of version 2 the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Written by Matus Marhefka <mmarhefk@redhat.com>
+#
+#==============================================================================
+#
# SYNOPSIS:
# netns_breakns.sh <NS_EXEC_PROGRAM> <IP_VERSION> <COMM_TYPE>
#
@@ -25,28 +40,34 @@
# device which is not inside the network namespace referred to by NS_HANDLE0:
# 1. using netlink (ip command).
# 2. using ioctl (ifconfig command).
+#==============================================================================
-TST_POS_ARGS=3
-TST_SETUP=do_setup
-TST_TESTFUNC=do_test
+TCID="netns_breakns_$1_$2_$3"
+TST_TOTAL=2
. netns_helper.sh
-PROG=$1
-IP_VER=$2
-COM_TYPE=$3
+# SETUP
+netns_setup $1 $2 $3 "192.168.0.2" "192.168.0.3" "fd00::2" "fd00::3"
+tst_resm TINFO "NS interaction: $1 | devices setup: $3"
+
+
+# TEST CASE #1
+$NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP1/$NETMASK dev veth1 2>/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TPASS "controlling device over netlink"
+else
+ tst_resm TFAIL "controlling device over netlink"
+fi
-do_setup()
-{
- netns_setup $PROG $IP_VER $COM_TYPE "192.168.0.2" "192.168.0.3" "fd00::2" "fd00::3"
- tst_res TINFO "NS interaction: $PROG | devices setup: $COM_TYPE"
-}
-do_test()
-{
- EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP1/$NETMASK dev veth1
+# TEST CASE #2
+tst_require_cmds ifconfig
+$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK 2>/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TPASS "controlling device over ioctl"
+else
+ tst_resm TFAIL "controlling device over ioctl"
+fi
- tst_require_cmds ifconfig
- EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK
-}
-tst_run
+tst_exit
diff --git a/testcases/kernel/containers/netns/netns_comm.sh b/testcases/kernel/containers/netns/netns_comm.sh
index ccb8b47b1..15991e2a6 100755
--- a/testcases/kernel/containers/netns/netns_comm.sh
+++ b/testcases/kernel/containers/netns/netns_comm.sh
@@ -1,8 +1,23 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020
+#==============================================================================
# Copyright (c) 2015 Red Hat, Inc.
#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of version 2 the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Written by Matus Marhefka <mmarhefk@redhat.com>
+#
+#==============================================================================
+#
# SYNOPSIS:
# netns_comm.sh <NS_EXEC_PROGRAM> <IP_VERSION> <COMM_TYPE>
#
@@ -28,43 +43,56 @@
# one device)
# 3. communication over the lo (localhost) device in a separate
# network namespace
+#==============================================================================
-TST_POS_ARGS=3
-TST_SETUP=do_setup
-TST_TESTFUNC=do_test
+TCID="netns_comm_$1_$2_$3"
+TST_TOTAL=3
. netns_helper.sh
-PROG=$1
-IP_VER=$2
-COM_TYPE=$3
+# SETUP
+netns_setup $1 $2 $3 "192.168.0.2" "192.168.0.3" "fd00::2" "fd00::3"
+tst_resm TINFO "NS interaction: $1 | devices setup: $3"
+
+
+# TEST CASE #1
+$NS_EXEC $NS_HANDLE0 $NS_TYPE $tping -q -c2 -I veth0 $IP1 1>/dev/null
+if [ $? -eq 0 ]; then
+ tst_resm TPASS "configuration and communication over veth0"
+else
+ tst_resm TFAIL "configuration and communication over veth0"
+fi
+
-do_setup()
-{
- netns_setup $PROG $IP_VER $COM_TYPE "192.168.0.2" "192.168.0.3" "fd00::2" "fd00::3"
- tst_res TINFO "NS interaction: $PROG | devices setup: $COM_TYPE"
-}
+# TEST CASE #2
+$NS_EXEC $NS_HANDLE1 $NS_TYPE $tping -q -c2 -I veth1 $IP0 1>/dev/null
+if [ $? -eq 0 ]; then
+ tst_resm TPASS "configuration and communication over veth1"
+else
+ tst_resm TFAIL "configuration and communication over veth1"
+fi
-do_test()
-{
- EXPECT_PASS $NS_EXEC $NS_HANDLE0 $NS_TYPE $tping -q -c2 -I veth0 $IP1 1>/dev/null
- EXPECT_PASS $NS_EXEC $NS_HANDLE1 $NS_TYPE $tping -q -c2 -I veth1 $IP0 1>/dev/null
+# TEST CASE #3
+case "$2" in
+ipv4) IP_LO="127.0.0.1" ;;
+ipv6) IP_LO="::1" ;;
+esac
+case "$3" in
+netlink)
+ $NS_EXEC $NS_HANDLE0 $NS_TYPE ip link set dev lo up || \
+ tst_brkm TBROK "enabling lo device failed"
+ ;;
+ioctl)
+ $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig lo up || \
+ tst_brkm TBROK "enabling lo device failed"
+ ;;
+esac
+$NS_EXEC $NS_HANDLE0 $NS_TYPE $tping -q -c2 -I lo $IP_LO 1>/dev/null
+if [ $? -eq 0 ]; then
+ tst_resm TPASS "configuration and communication over localhost"
+else
+ tst_resm TFAIL "configuration and communication over localhost"
+fi
- case "$IP_VER" in
- ipv4) ip_lo="127.0.0.1" ;;
- ipv6) ip_lo="::1" ;;
- esac
- case "$COM_TYPE" in
- netlink)
- $NS_EXEC $NS_HANDLE0 $NS_TYPE ip link set dev lo up || \
- tst_brk TBROK "enabling lo device failed"
- ;;
- ioctl)
- $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig lo up || \
- tst_brk TBROK "enabling lo device failed"
- ;;
- esac
- EXPECT_PASS $NS_EXEC $NS_HANDLE0 $NS_TYPE $tping -q -c2 -I lo $ip_lo 1>/dev/null
-}
-tst_run
+tst_exit
diff --git a/testcases/kernel/containers/netns/netns_helper.h b/testcases/kernel/containers/netns/netns_helper.h
new file mode 100644
index 000000000..8b876454f
--- /dev/null
+++ b/testcases/kernel/containers/netns/netns_helper.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) International Business Machines Corp., 2008
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Veerendra C <vechandr@in.ibm.com>
+ *
+ * Net namespaces were introduced around 2.6.25. Kernels before that,
+ * assume they are not enabled. Kernels after that, check for -EINVAL
+ * when trying to use CLONE_NEWNET and CLONE_NEWNS.
+ ***************************************************************************/
+
+#define _GNU_SOURCE
+#include <sched.h>
+#include "config.h"
+#include "libclone.h"
+#include "lapi/syscalls.h"
+#include "test.h"
+#include "safe_macros.h"
+
+#ifndef CLONE_NEWNS
+#define CLONE_NEWNS -1
+#endif
+
+static void check_iproute(unsigned int spe_ipver)
+{
+ FILE *ipf;
+ int n;
+ unsigned int ipver = 0;
+
+ ipf = popen("ip -V", "r");
+ if (ipf == NULL)
+ tst_brkm(TCONF, NULL,
+ "Failed while opening pipe for iproute check");
+
+ n = fscanf(ipf, "ip utility, iproute2-ss%u", &ipver);
+ if (n < 1) {
+ tst_brkm(TCONF, NULL,
+ "Failed while obtaining version for iproute check");
+ }
+ if (ipver < spe_ipver) {
+ tst_brkm(TCONF, NULL, "The commands in iproute tools do "
+ "not support required objects");
+ }
+
+ pclose(ipf);
+}
+
+static int dummy(void *arg)
+{
+ (void) arg;
+ return 0;
+}
+
+static void check_netns(void)
+{
+ int pid, status;
+ /* Checking if the kernel supports unshare with netns capabilities. */
+ if (CLONE_NEWNS == -1)
+ tst_brkm(TCONF | TERRNO, NULL, "CLONE_NEWNS (%d) not supported",
+ CLONE_NEWNS);
+
+ pid = do_clone_unshare_test(T_UNSHARE, CLONE_NEWNET | CLONE_NEWNS,
+ dummy, NULL);
+ if (pid == -1)
+ tst_brkm(TCONF | TERRNO, NULL,
+ "unshare syscall smoke test failed");
+
+ SAFE_WAIT(NULL, &status);
+}
diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
index 1f97ec4d4..c765a0cb9 100755
--- a/testcases/kernel/containers/netns/netns_helper.sh
+++ b/testcases/kernel/containers/netns/netns_helper.sh
@@ -1,50 +1,84 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2014-2020
+#==============================================================================
+# Copyright (c) Linux Test Project, 2014
# Copyright (c) 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#==============================================================================
+. test.sh
TST_CLEANUP=netns_ns_exec_cleanup
-TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="ip modprobe"
-. tst_test.sh
# Set to 1 only for test cases using ifconfig (ioctl).
USE_IFCONFIG=0
-# Variables which can be used in test cases (set by netns_setup() function):
+##
+# Variables which can be used in test cases (set by netns_setup() function):
+###############################################################################
# Use in test cases to execute commands inside a namespace. Set to 'ns_exec' or
# 'ip netns exec' command according to NS_EXEC_PROGRAM argument specified in
# netns_setup() function call.
-NS_EXEC=
+NS_EXEC=""
# Set to "net" for ns_create/ns_exec as their options requires
# to specify a namespace type. Empty for ip command.
-NS_TYPE=
+NS_TYPE=""
# IP addresses of veth0 (IP0) and veth1 (IP1) devices (ipv4/ipv6 variant
# is determined according to the IP_VERSION argument specified in netns_setup()
# function call.
-IP0=
-IP1=
-NETMASK=
+IP0=""
+IP1=""
+NETMASK=""
# 'ping' or 'ping6' according to the IP_VERSION argument specified
# in netns_setup() function call.
-tping=
+tping=""
# Network namespaces handles for manipulating and executing commands inside
# namespaces. For 'ns_exec' handles are PIDs of daemonized processes running
# in namespaces.
-NS_HANDLE0=
-NS_HANDLE1=
+NS_HANDLE0=""
+NS_HANDLE1=""
# Adds "inet6 add" to the 'ifconfig' arguments which is required for the ipv6
# version. Always use with 'ifconfig', even if ipv4 version of a test case is
# used, in which case IFCONF_IN6_ARG will be empty string. Usage:
# ifconfig <device> $IFCONF_IN6_ARG IP/NETMASK
-IFCONF_IN6_ARG=
+IFCONF_IN6_ARG=""
+###############################################################################
+
+
+tst_check_iproute()
+{
+ local cur_ipver="$(ip -V)"
+ local spe_ipver="$1"
+ cur_ipver=${cur_ipver##*s}
+
+ if [ -z $cur_ipver ] || [ -z $spe_ipver ]; then
+ tst_brkm TBROK "don't obtain valid iproute version"
+ fi
+
+ if [ $cur_ipver -lt $spe_ipver ]; then
+ tst_brkm TCONF \
+ "The commands in iproute tools do not support required objects"
+ fi
+}
+
+##
# Sets up global variables which can be used in test cases (documented above),
# creates two network namespaces and a pair of virtual ethernet devices, each
# device in one namespace. Each device is then enabled and assigned an IP
@@ -72,9 +106,11 @@ IFCONF_IN6_ARG=
# * IP6_VETH0, IP6_VETH1
# IPv6 addresses for veth0 and veth1 devices.
#
-# On success function returns, on error tst_brk is called and TC is terminated.
+# On success function returns, on error tst_brkm is called and TC is terminated.
netns_setup()
{
+ tst_require_root
+ tst_require_cmds ip modprobe
modprobe veth > /dev/null 2>&1
@@ -82,7 +118,7 @@ netns_setup()
ns_exec)
setns_check
if [ $? -eq 32 ]; then
- tst_brk TCONF "setns not supported"
+ tst_brkm TCONF "setns not supported"
fi
NS_TYPE="net"
netns_ns_exec_setup
@@ -93,7 +129,7 @@ netns_setup()
TST_CLEANUP=netns_ip_cleanup
;;
*)
- tst_brk TBROK \
+ tst_brkm TBROK \
"first argument must be a program used to enter a network namespace (ns_exec|ip)"
;;
esac
@@ -106,22 +142,22 @@ netns_setup()
tst_require_cmds ifconfig
;;
*)
- tst_brk TBROK \
+ tst_brkm TBROK \
"third argument must be a comm. type between kernel and user space (netlink|ioctl)"
;;
esac
if [ -z "$4" ]; then
- tst_brk TBROK "fourth argument must be the IPv4 address for veth0"
+ tst_brkm TBROK "fourth argument must be the IPv4 address for veth0"
fi
if [ -z "$5" ]; then
- tst_brk TBROK "fifth argument must be the IPv4 address for veth1"
+ tst_brkm TBROK "fifth argument must be the IPv4 address for veth1"
fi
if [ -z "$6" ]; then
- tst_brk TBROK "sixth argument must be the IPv6 address for veth0"
+ tst_brkm TBROK "sixth argument must be the IPv6 address for veth0"
fi
if [ -z "$7" ]; then
- tst_brk TBROK "seventh argument must be the IPv6 address for veth1"
+ tst_brkm TBROK "seventh argument must be the IPv6 address for veth1"
fi
case "$2" in
@@ -140,13 +176,14 @@ netns_setup()
NETMASK=64
;;
*)
- tst_brk TBROK "second argument must be an ip version (ipv4|ipv6)"
+ tst_brkm TBROK "second argument must be an ip version (ipv4|ipv6)"
;;
esac
netns_set_ip
}
+##
# Sets up NS_EXEC to use 'ns_exec', creates two network namespaces and stores
# their handles into NS_HANDLE0 and NS_HANDLE1 variables (in this case handles
# are PIDs of daemonized processes running in these namespaces). Virtual
@@ -157,18 +194,18 @@ netns_ns_exec_setup()
NS_HANDLE0=$(ns_create $NS_TYPE)
if [ $? -eq 1 ]; then
- tst_res TINFO "$NS_HANDLE0"
- tst_brk TBROK "unable to create a new network namespace"
+ tst_resm TINFO "$NS_HANDLE0"
+ tst_brkm TBROK "unable to create a new network namespace"
fi
NS_HANDLE1=$(ns_create $NS_TYPE)
if [ $? -eq 1 ]; then
- tst_res TINFO "$NS_HANDLE1"
- tst_brk TBROK "unable to create a new network namespace"
+ tst_resm TINFO "$NS_HANDLE1"
+ tst_brkm TBROK "unable to create a new network namespace"
fi
$NS_EXEC $NS_HANDLE0 $NS_TYPE ip link add veth0 type veth peer name veth1 || \
- tst_brk TBROK "unable to create veth pair devices"
+ tst_brkm TBROK "unable to create veth pair devices"
$NS_EXEC $NS_HANDLE0 $NS_TYPE ns_ifmove veth1 $NS_HANDLE1
ret=$?
@@ -177,20 +214,19 @@ netns_ns_exec_setup()
fi
if [ $ret -eq 32 ]; then
- tst_brk TCONF "IFLA_NET_NS_PID not supported"
+ tst_brkm TCONF "IFLA_NET_NS_PID not supported"
fi
- tst_brk TBROK "unable to add device veth1 to the separate network namespace"
+ tst_brkm TBROK "unable to add device veth1 to the separate network namespace"
}
+##
# Sets up NS_EXEC to use 'ip netns exec', creates two network namespaces
# and stores their handles into NS_HANDLE0 and NS_HANDLE1 variables. Virtual
# ethernet device is then created for each namespace.
netns_ip_setup()
{
- ip netns > /dev/null || \
- tst_brk TCONF "ip without netns support (required iproute2 >= ss111010 - v3.0.0)"
-
+ tst_check_iproute 111010
NS_EXEC="ip netns exec"
NS_HANDLE0=tst_net_ns0
@@ -200,23 +236,24 @@ netns_ip_setup()
ip netns del $NS_HANDLE1 2>/dev/null
ip netns add $NS_HANDLE0 || \
- tst_brk TBROK "unable to create a new network namespace"
+ tst_brkm TBROK "unable to create a new network namespace"
ip netns add $NS_HANDLE1 || \
- tst_brk TBROK "unable to create a new network namespace"
+ tst_brkm TBROK "unable to create a new network namespace"
$NS_EXEC $NS_HANDLE0 ip link add veth0 type veth peer name veth1 || \
- tst_brk TBROK "unable to create veth pair devices"
+ tst_brkm TBROK "unable to create veth pair devices"
$NS_EXEC $NS_HANDLE0 ip link set veth1 netns $NS_HANDLE1 || \
- tst_brk TBROK "unable to add device veth1 to the separate network namespace"
+ tst_brkm TBROK "unable to add device veth1 to the separate network namespace"
}
+##
# Enables virtual ethernet devices and assigns IP addresses for both
# of them (IPv4/IPv6 variant is decided by netns_setup() function).
netns_set_ip()
{
if [ -z "$NS_EXEC" ]; then
- tst_brk TBROK "netns_setup() function must be called first"
+ tst_brkm TBROK "netns_setup() function must be called first"
fi
# This applies only for ipv6 variant:
@@ -236,23 +273,23 @@ netns_set_ip()
case $USE_IFCONFIG in
1)
$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 $IFCONF_IN6_ARG $IP0/$NETMASK ||
- tst_brk TBROK "adding address to veth0 failed"
+ tst_brkm TBROK "adding address to veth0 failed"
$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK ||
- tst_brk TBROK "adding address to veth1 failed"
+ tst_brkm TBROK "adding address to veth1 failed"
$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 up ||
- tst_brk TBROK "enabling veth0 device failed"
+ tst_brkm TBROK "enabling veth0 device failed"
$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 up ||
- tst_brk TBROK "enabling veth1 device failed"
+ tst_brkm TBROK "enabling veth1 device failed"
;;
*)
$NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP0/$NETMASK dev veth0 ||
- tst_brk TBROK "adding address to veth0 failed"
+ tst_brkm TBROK "adding address to veth0 failed"
$NS_EXEC $NS_HANDLE1 $NS_TYPE ip address add $IP1/$NETMASK dev veth1 ||
- tst_brk TBROK "adding address to veth1 failed"
+ tst_brkm TBROK "adding address to veth1 failed"
$NS_EXEC $NS_HANDLE0 $NS_TYPE ip link set veth0 up ||
- tst_brk TBROK "enabling veth0 device failed"
+ tst_brkm TBROK "enabling veth0 device failed"
$NS_EXEC $NS_HANDLE1 $NS_TYPE ip link set veth1 up ||
- tst_brk TBROK "enabling veth1 device failed"
+ tst_brkm TBROK "enabling veth1 device failed"
;;
esac
}
diff --git a/testcases/kernel/containers/netns/netns_netlink.c b/testcases/kernel/containers/netns/netns_netlink.c
index 1e8e78fc5..47e8235d6 100644
--- a/testcases/kernel/containers/netns/netns_netlink.c
+++ b/testcases/kernel/containers/netns/netns_netlink.c
@@ -1,26 +1,33 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2014 Red Hat, Inc.
- * Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
- */
-
-/*\
- * [DESCRIPTION]
+/* Copyright (c) 2014 Red Hat, Inc.
*
- * Tests a netlink interface inside a new network namespace.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of version 2 the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * - Unshares a network namespace (so network related actions
- * have no effect on a real system).
- * - Forks a child which creates a NETLINK_ROUTE netlink socket
- * and listens to RTMGRP_LINK (network interface create/delete/up/down)
- * multicast group.
- * - Child then waits for parent approval to receive data from socket
- * - Parent creates a new TAP interface (dummy0) and immediately
- * removes it (which should generate some data in child's netlink socket).
- * Then it allows child to continue.
- * - As the child was listening to RTMGRP_LINK multicast group, it should
- * detect the new interface creation/deletion (by reading data from netlink
- * socket), if so, the test passes, otherwise it fails.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ ***********************************************************************
+ * File: netns_netlink.c
+ *
+ * Tests a netlink interface inside a new network namespace.
+ * Description:
+ * 1. Unshares a network namespace (so network related actions
+ * have no effect on a real system)
+ * 2. Forks a child which creates a NETLINK_ROUTE netlink socket
+ * and listens to RTMGRP_LINK (network interface create/delete/up/down)
+ * multicast group.
+ * 4. Child then waits for parent approval to receive data from socket
+ * 3. Parent creates a new TAP interface (dummy0) and immediately
+ * removes it (which should generate some data in child's netlink socket).
+ * Then it allows child to continue.
+ * 4. As the child was listening to RTMGRP_LINK multicast group, it should
+ * detect the new interface creation/deletion (by reading data from netlink
+ * socket), if so, the test passes, otherwise it fails.
*/
#define _GNU_SOURCE
@@ -33,43 +40,67 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <sched.h>
-
-#include "tst_test.h"
-#include "tst_safe_macros.h"
-#include "lapi/namespaces_constants.h"
+#include "netns_helper.h"
+#include "test.h"
+#include "safe_macros.h"
#define MAX_TRIES 1000
+#define IP_TUNTAP_MIN_VER 100519
+
+char *TCID = "netns_netlink";
+int TST_TOTAL = 1;
-static void child_func(void)
+static void cleanup(void)
+{
+ tst_rmdir();
+}
+
+static void setup(void)
+{
+ tst_require_root();
+ check_iproute(IP_TUNTAP_MIN_VER);
+ check_netns();
+ tst_tmpdir();
+ TST_CHECKPOINT_INIT(tst_rmdir);
+}
+
+int child_func(void)
{
int fd, len, event_found, tries;
struct sockaddr_nl sa;
char buffer[4096];
struct nlmsghdr *nlh;
- /* child will listen to a network interface create/delete/up/down events */
+ /* child will listen to a network interface create/delete/up/down
+ * events */
memset(&sa, 0, sizeof(sa));
sa.nl_family = AF_NETLINK;
sa.nl_groups = RTMGRP_LINK;
- fd = SAFE_SOCKET(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
- SAFE_BIND(fd, (struct sockaddr *) &sa, sizeof(sa));
+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ if (fd == -1) {
+ perror("socket");
+ return 1;
+ }
+ if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) == -1) {
+ perror("bind");
+ close(fd);
+ return 1;
+ }
/* waits for parent to create an interface */
- TST_CHECKPOINT_WAIT(0);
+ TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
- /*
- * To get rid of "resource temporarily unavailable" errors
- * when testing with -i option
- */
+ /* To get rid of "resource temporarily unavailable" errors
+ * when testing with -i option */
tries = 0;
event_found = 0;
nlh = (struct nlmsghdr *) buffer;
while (tries < MAX_TRIES) {
len = recv(fd, nlh, sizeof(buffer), MSG_DONTWAIT);
if (len > 0) {
- /* stop receiving only on interface create/delete event */
+ /* stop receiving only on interface create/delete
+ * event */
if (nlh->nlmsg_type == RTM_NEWLINK ||
nlh->nlmsg_type == RTM_DELLINK) {
event_found++;
@@ -80,47 +111,70 @@ static void child_func(void)
tries++;
}
- SAFE_CLOSE(fd);
+ close(fd);
- if (event_found)
- tst_res(TPASS, "interface changes detected");
- else
- tst_res(TFAIL, "failed to detect interface changes");
+ if (!event_found) {
+ perror("recv");
+ return 1;
+ }
- exit(0);
+ return 0;
}
-static void test_netns_netlink(void)
+static void test(void)
{
+ pid_t pid;
+ int status;
+
/* unshares the network namespace */
- SAFE_UNSHARE(CLONE_NEWNET);
+ if (unshare(CLONE_NEWNET) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "unshare failed");
- if (SAFE_FORK() == 0)
- child_func();
+ pid = tst_fork();
+ if (pid < 0) {
+ tst_brkm(TBROK | TERRNO, cleanup, "fork failed");
+ }
+ if (pid == 0) {
+ _exit(child_func());
+ }
/* creates TAP network interface dummy0 */
if (WEXITSTATUS(system("ip tuntap add dev dummy0 mode tap")))
- tst_brk(TBROK, "adding interface failed");
+ tst_brkm(TBROK, cleanup, "system() failed");
/* removes previously created dummy0 device */
if (WEXITSTATUS(system("ip tuntap del mode tap dummy0")))
- tst_brk(TBROK, "removing interface failed");
+ tst_brkm(TBROK, cleanup, "system() failed");
/* allow child to continue */
- TST_CHECKPOINT_WAKE(0);
+ TST_SAFE_CHECKPOINT_WAKE(cleanup, 0);
+
+
+ SAFE_WAITPID(cleanup, pid, &status, 0);
+ if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
+ tst_resm(TFAIL, "netlink interface fail");
+ return;
+ }
+ if (WIFSIGNALED(status)) {
+ tst_resm(TFAIL, "child was killed with signal %s",
+ tst_strsig(WTERMSIG(status)));
+ return;
+ }
- tst_reap_children();
+ tst_resm(TPASS, "netlink interface pass");
}
+int main(int argc, char *argv[])
+{
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
-static struct tst_test test = {
- .test_all = test_netns_netlink,
- .needs_checkpoints = 1,
- .needs_tmpdir = 1,
- .needs_root = 1,
- .forks_child = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_NET_NS=y",
- NULL
- },
-};
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ test();
+
+ cleanup();
+ tst_exit();
+}
diff --git a/testcases/kernel/containers/netns/netns_sysfs.sh b/testcases/kernel/containers/netns/netns_sysfs.sh
index 8125e2490..944a4c152 100755..100644
--- a/testcases/kernel/containers/netns/netns_sysfs.sh
+++ b/testcases/kernel/containers/netns/netns_sysfs.sh
@@ -1,61 +1,93 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020
+#==============================================================================
# Copyright (c) 2015 Red Hat, Inc.
#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of version 2 the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Written by Matus Marhefka <mmarhefk@redhat.com>
+#
+#==============================================================================
+#
# Tests that a separate network namespace cannot affect sysfs contents
# of the main namespace.
+#==============================================================================
-TST_NEEDS_DRIVERS="dummy"
-TST_CLEANUP=do_cleanup
-TST_SETUP=do_setup
-TST_TESTFUNC=do_test
-TST_NEEDS_TMPDIR=1
-. tst_test.sh
+TCID="netns_sysfs"
+TST_TOTAL=3
+NS_TYPE="net,mnt"
+DUMMYDEV_HOST="dummy_test0"
+DUMMYDEV="dummy_test1"
+. test.sh
-do_setup()
-{
- NS_TYPE="net,mnt"
- DUMMYDEV_HOST="dummy_test0"
- DUMMYDEV="dummy_test1"
-
- if tst_kvcmp -lt "2.6.35"; then
- tst_brk TCONF "sysfs is not mount namespace aware for kernels older than 2.6.35"
- fi
-
- setns_check
- if [ $? -eq 32 ]; then
- tst_brk TCONF "setns not supported"
- fi
-
- NS_HANDLE=$(ns_create $NS_TYPE)
- if [ $? -eq 1 ]; then
- tst_res TINFO "$NS_HANDLE"
- tst_brk TBROK "unable to create a new network namespace"
- fi
-
- ip link add $DUMMYDEV_HOST type dummy || \
- tst_brk TBROK "failed to add a new (host) dummy device"
-
- ns_exec $NS_HANDLE $NS_TYPE mount --make-rprivate /sys
- ns_exec $NS_HANDLE $NS_TYPE ip link add $DUMMYDEV type dummy || \
- tst_brk TBROK "failed to add a new dummy device"
- ns_exec $NS_HANDLE $NS_TYPE mount -t sysfs none /sys 2>/dev/null
-}
+if tst_kvcmp -lt "2.6.35"; then
+ tst_brkm TCONF "sysfs is not mount namespace aware for kernels older than 2.6.35"
+fi
-do_cleanup()
+setns_check
+if [ $? -eq 32 ]; then
+ tst_brkm TCONF "setns not supported"
+fi
+
+cleanup()
{
+ tst_rmdir
ip link del $DUMMYDEV_HOST 2>/dev/null
ip link del $DUMMYDEV 2>/dev/null
kill -9 $NS_HANDLE 2>/dev/null
}
+tst_tmpdir
+NS_HANDLE=$(ns_create $NS_TYPE)
+if [ $? -eq 1 ]; then
+ tst_resm TINFO "$NS_HANDLE"
+ tst_brkm TBROK "unable to create a new network namespace"
+fi
+TST_CLEANUP=cleanup
+
+ip link add $DUMMYDEV_HOST type dummy || \
+ tst_brkm TBROK "failed to add a new (host) dummy device"
+
+ns_exec $NS_HANDLE $NS_TYPE mount --make-rprivate /sys
+ns_exec $NS_HANDLE $NS_TYPE ip link add $DUMMYDEV type dummy || \
+ tst_brkm TBROK "failed to add a new dummy device"
+ns_exec $NS_HANDLE $NS_TYPE mount -t sysfs none /sys 2>/dev/null
+
+
+# TEST CASE #1
+ns_exec $NS_HANDLE $NS_TYPE test -e /sys/class/net/$DUMMYDEV
+if [ $? -eq 0 ]; then
+ tst_resm TPASS "sysfs in new namespace has $DUMMYDEV interface"
+else
+ tst_resm TFAIL "sysfs in new namespace does not have $DUMMYDEV interface"
+fi
+
+
+# TEST CASE #2
+ns_exec $NS_HANDLE $NS_TYPE test -e /sys/class/net/$DUMMYDEV_HOST
+if [ $? -ne 0 ]; then
+ tst_resm TPASS "sysfs in new namespace does not have $DUMMYDEV_HOST interface"
+else
+ tst_resm TFAIL "sysfs in new namespace contains $DUMMYDEV_HOST interface"
+fi
+
+
+# TEST CASE #3
+test -e /sys/class/net/$DUMMYDEV
+if [ $? -ne 0 ]; then
+ tst_resm TPASS "sysfs not affected by a separate namespace"
+else
+ tst_resm TFAIL "sysfs affected by a separate namespace"
+fi
-do_test()
-{
- EXPECT_PASS ns_exec $NS_HANDLE $NS_TYPE test -e /sys/class/net/$DUMMYDEV
- EXPECT_FAIL ns_exec $NS_HANDLE $NS_TYPE test -e /sys/class/net/$DUMMYDEV_HOST
- EXPECT_FAIL test -e /sys/class/net/$DUMMYDEV
-}
-tst_run
+tst_exit
diff --git a/testcases/kernel/containers/pidns/pidns02.c b/testcases/kernel/containers/pidns/pidns02.c
index 2bc9035d8..60367fd6d 100644
--- a/testcases/kernel/containers/pidns/pidns02.c
+++ b/testcases/kernel/containers/pidns/pidns02.c
@@ -89,7 +89,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int status;
diff --git a/testcases/kernel/containers/pidns/pidns04.c b/testcases/kernel/containers/pidns/pidns04.c
index 9ac0e5aca..0c50e4f60 100644
--- a/testcases/kernel/containers/pidns/pidns04.c
+++ b/testcases/kernel/containers/pidns/pidns04.c
@@ -105,7 +105,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int nbytes, status;
char readbuffer[80];
diff --git a/testcases/kernel/containers/pidns/pidns05.c b/testcases/kernel/containers/pidns/pidns05.c
index 79e146e36..8462243cd 100644
--- a/testcases/kernel/containers/pidns/pidns05.c
+++ b/testcases/kernel/containers/pidns/pidns05.c
@@ -192,7 +192,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int ret, nbytes, status;
char readbuffer[80];
diff --git a/testcases/kernel/containers/pidns/pidns06.c b/testcases/kernel/containers/pidns/pidns06.c
index d6623941a..6afcc81ee 100644
--- a/testcases/kernel/containers/pidns/pidns06.c
+++ b/testcases/kernel/containers/pidns/pidns06.c
@@ -124,7 +124,7 @@ int main(void)
TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWPID, kill_pid_in_childfun,
(void *)&pid));
if (TEST_RETURN == -1) {
- tst_brkm(TFAIL | TTERRNO, NULL, "clone failed");
+ tst_brkm(TFAIL | TERRNO, NULL, "clone failed");
} else if (wait(&status) == -1) {
tst_brkm(TFAIL | TERRNO, NULL, "wait failed");
}
diff --git a/testcases/kernel/containers/pidns/pidns10.c b/testcases/kernel/containers/pidns/pidns10.c
index b38b9fd18..291b054f4 100644
--- a/testcases/kernel/containers/pidns/pidns10.c
+++ b/testcases/kernel/containers/pidns/pidns10.c
@@ -86,7 +86,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int status;
pid_t pid;
diff --git a/testcases/kernel/containers/pidns/pidns12.c b/testcases/kernel/containers/pidns/pidns12.c
index 5fb13d2a6..d38f1a02a 100644
--- a/testcases/kernel/containers/pidns/pidns12.c
+++ b/testcases/kernel/containers/pidns/pidns12.c
@@ -117,7 +117,7 @@ static void setup(void)
* M A I N
***********************************************************************/
-int main(void)
+int main(int argc, char *argv[])
{
int status;
pid_t pid, cpid;
diff --git a/testcases/kernel/containers/pidns/pidns13.c b/testcases/kernel/containers/pidns/pidns13.c
index bdc1097fd..003bb61ea 100644
--- a/testcases/kernel/containers/pidns/pidns13.c
+++ b/testcases/kernel/containers/pidns/pidns13.c
@@ -1,126 +1,219 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2007
- * Copyright (c) SUSE LLC 2021
- *
- * History:
- * 23/10/08 Gowrishankar M Created test scenarion.
- * <gowrishankar.m@in.ibm.com>
- */
-
-/*\
- * [Description]
- *
- * The pidns13.c testcase checks container init, for async I/O
- * triggered by peer namespace process.
- *
- * [Algorithm]
- * * create a pipe in parent namespace
- * * create two PID namespace containers(cinit1 and cinit2)
- * * in cinit1, set pipe read end to send SIGUSR1 for asynchronous I/O
- * * let cinit2 trigger async I/O on pipe write end
- * * in signal info, check si_code to be POLL_IN and si_fd to be pipe read fd
- */
-
+* Copyright (c) International Business Machines Corp., 2007
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+* the GNU General Public License for more details.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+***************************************************************************
+* File: pidns13.c
+* *
+* * Description:
+* * The pidns13.c testcase checks container init, for async I/O
+* * triggered by peer namespace process.
+* *
+* * Test Assertion & Strategy:
+* * Create a pipe in parent namespace.
+* * Create two PID namespace containers(cinit1 and cinit2).
+* * In cinit1, set pipe read end to send SIGUSR1.
+* * for asynchronous I/O.
+* * Let cinit2 to trigger async I/O on pipe write end.
+* * In signal info, check si_code to be POLL_IN and si_fd to be pipe read fd.
+* *
+* * Usage: <for command-line>
+* * pidns13
+* *
+* * History:
+* * DATE NAME DESCRIPTION
+* * 23/10/08 Gowrishankar M Created test scenarion.
+* * <gowrishankar.m@in.ibm.com>
+*
+******************************************************************************/
#define _GNU_SOURCE 1
#include <sys/wait.h>
#include <sys/types.h>
#include <fcntl.h>
#include <signal.h>
+#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include "pidns_helper.h"
+#include "test.h"
-#include "tst_test.h"
-#include "tst_clone.h"
-#include "lapi/clone.h"
-
-static int pipe_fd[2];
+char *TCID = "pidns13";
+int TST_TOTAL = 1;
+int pipe_fd[2];
#define CHILD_PID 1
#define PARENT_PID 0
-static void child_signal_handler(int sig, siginfo_t *si,
- void *unused LTP_ATTRIBUTE_UNUSED)
+/*
+ * child_signal_handler() - dummy function for sigaction()
+ */
+static void child_signal_handler(int sig, siginfo_t * si, void *unused)
{
- tst_res(TWARN, "cinit(pid %d): Caught signal! sig=%d, si_fd=%d, si_code=%d",
- getpid(), sig, si->si_fd, si->si_code);
+ /* sigtimedwait() traps siginfo details, so this wont be called */
+ tst_resm(TWARN, "cinit(pid %d): control should have not reached here!",
+ getpid());
}
-static void child_fn(unsigned int cinit_no)
+/*
+ * child_fn() - Inside container
+ */
+int child_fn(void *arg)
{
struct sigaction sa;
sigset_t newset;
siginfo_t info;
struct timespec timeout;
pid_t pid, ppid;
- int flags;
+ intptr_t cinit_no = (intptr_t)arg;
- pid = tst_syscall(__NR_getpid);
+ /* Set process id and parent pid */
+ pid = getpid();
ppid = getppid();
- if (pid != CHILD_PID || ppid != PARENT_PID)
- tst_brk(TBROK, "cinit%u: pidns not created.", cinit_no);
+ if (pid != CHILD_PID || ppid != PARENT_PID) {
+ tst_resm(TBROK, "cinit%d: pidns is not created.", cinit_no);
+ }
if (cinit_no == 1) {
- SAFE_CLOSE(pipe_fd[1]);
+ /* in container 1 */
+ /* close pipe write descriptor */
+ if (close(pipe_fd[1]) == -1) {
+ tst_resm(TBROK, "cinit1: close(pipe_fd[1]) failed");
+ }
- sigemptyset(&newset);
- sigaddset(&newset, SIGUSR1);
- SAFE_SIGPROCMASK(SIG_BLOCK, &newset, NULL);
+ /* Let cinit1 to get SIGUSR1 on I/O availability */
+ if (fcntl(pipe_fd[0], F_SETOWN, pid) == -1) {
+ tst_resm(TBROK, "cinit1: fcntl(F_SETOWN) failed");
+ }
+
+ if (fcntl(pipe_fd[0], F_SETSIG, SIGUSR1) == -1) {
+ tst_resm(TBROK, "cinit1: fcntl(F_SETSIG) failed");
+ }
- SAFE_FCNTL(pipe_fd[0], F_SETOWN, pid);
- SAFE_FCNTL(pipe_fd[0], F_SETSIG, SIGUSR1);
- flags = SAFE_FCNTL(pipe_fd[0], F_GETFL);
- SAFE_FCNTL(pipe_fd[0], F_SETFL, flags | O_ASYNC);
+ if (fcntl(pipe_fd[0], F_SETFL,
+ fcntl(pipe_fd[0], F_GETFL) | O_ASYNC) == -1) {
+ tst_resm(TBROK, "cinit1: fcntl(F_SETFL) failed");
+ }
+ /* Set signal handler for SIGUSR1, also mask other signals */
sa.sa_flags = SA_SIGINFO;
sigfillset(&sa.sa_mask);
sa.sa_sigaction = child_signal_handler;
- SAFE_SIGACTION(SIGUSR1, &sa, NULL);
+ if (sigaction(SIGUSR1, &sa, NULL) == -1) {
+ tst_resm(TBROK, "cinit1: sigaction() failed");
+ }
- TST_CHECKPOINT_WAKE(1);
+ tst_resm(TINFO, "cinit1: setup handler for async I/O on pipe");
+ /* Set timeout for sigtimedwait */
timeout.tv_sec = 10;
timeout.tv_nsec = 0;
+ /* Set mask to wait for SIGUSR1 signal */
+ sigemptyset(&newset);
+ sigaddset(&newset, SIGUSR1);
+
+ /* Wait for SIGUSR1 */
if (sigtimedwait(&newset, &info, &timeout) != SIGUSR1) {
- tst_brk(TBROK | TERRNO,
- "cinit1: sigtimedwait() failed.");
+ tst_resm(TBROK, "cinit1: sigtimedwait() failed.");
}
+ /* Recieved SIGUSR1. Check details. */
if (info.si_fd == pipe_fd[0] && info.si_code == POLL_IN)
- tst_res(TPASS, "cinit1: si_fd is %d, si_code is %d",
- info.si_fd, info.si_code);
+ tst_resm(TPASS, "cinit1: si_fd is %d, si_code is %d",
+ info.si_fd, info.si_code);
else
- tst_res(TFAIL, "cinit1: si_fd is %d, si_code is %d",
- info.si_fd, info.si_code);
+ tst_resm(TFAIL, "cinit1: si_fd is %d, si_code is %d",
+ info.si_fd, info.si_code);
+
+ /* all done, close the descriptors opened */
+ close(pipe_fd[0]);
+
} else {
- SAFE_CLOSE(pipe_fd[0]);
+ /* in container 2 */
+ /* close pipe read descriptor */
+ if (close(pipe_fd[0]) == -1) {
+ tst_resm(TBROK, "cinit2: close(pipe_fd[0]) failed");
+ }
+
+ /* sleep for few seconds to avoid race with cinit1 */
+ sleep(2);
+
+ /* Write some data in pipe to SIGUSR1 cinit1 */
+ tst_resm(TINFO, "cinit2: writing some data in pipe");
+ if (write(pipe_fd[1], "test\n", 5) == -1) {
+ tst_resm(TBROK, "cinit2: write() failed");
+ }
- TST_CHECKPOINT_WAIT(1);
- SAFE_WRITE(pipe_fd[1], 1, "test\n", 5);
+ /* all done, close the descriptors opened */
+ close(pipe_fd[1]);
}
+ /* cleanup and exit */
exit(0);
}
-static void run(void)
+static void setup(void)
{
- const struct tst_clone_args cargs = { CLONE_NEWPID, SIGCHLD };
+ tst_require_root();
+ check_newpid();
+}
- SAFE_PIPE(pipe_fd);
+/***********************************************************************
+* M A I N
+***********************************************************************/
- if (!SAFE_CLONE(&cargs))
- child_fn(1);
+int main(int argc, char *argv[])
+{
+ int status;
+ pid_t cpid1, cpid2;
- if (!SAFE_CLONE(&cargs))
- child_fn(2);
+ setup();
- SAFE_CLOSE(pipe_fd[0]);
- SAFE_CLOSE(pipe_fd[1]);
-}
+ /* create pipe */
+ if (pipe(pipe_fd) == -1) {
+ tst_resm(TBROK, "parent: pipe creation failed");
+ }
+
+ /* Create container 1 */
+ cpid1 = ltp_clone_quick(CLONE_NEWPID | SIGCHLD, child_fn, (void*)(intptr_t)1);
-static struct tst_test test = {
- .test_all = run,
- .needs_root = 1,
- .needs_checkpoints = 1,
- .forks_child = 1,
-};
+ /* Create container 2 */
+ cpid2 = ltp_clone_quick(CLONE_NEWPID | SIGCHLD, child_fn, (void*)(intptr_t)2);
+ if (cpid1 < 0 || cpid2 < 0) {
+ tst_resm(TBROK, "parent: clone() failed.");
+ }
+
+ /* Close unwanted descriptors */
+ close(pipe_fd[0]);
+ close(pipe_fd[1]);
+
+ /* Wait for containers to exit */
+ if (waitpid(cpid2, &status, 0) < 0)
+ tst_resm(TWARN, "parent: waitpid(cpid2) failed.");
+
+ if (WIFSIGNALED(status) && WTERMSIG(status))
+ tst_resm(TWARN, "parent: cinit2 is terminated by signal(%s)",
+ strsignal(WTERMSIG(status)));
+
+ if (waitpid(cpid1, &status, 0) < 0)
+ tst_resm(TWARN, "parent: waitpid(cpid1) failed.");
+
+ if (WIFSIGNALED(status) && WTERMSIG(status))
+ tst_resm(TWARN, "parent: cinit1 is terminated by signal(%s)",
+ strsignal(WTERMSIG(status)));
+
+ /* Control won't reach below */
+ exit(0);
+
+}
diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
index 2ee61065a..6d4f20937 100644
--- a/testcases/kernel/containers/pidns/pidns16.c
+++ b/testcases/kernel/containers/pidns/pidns16.c
@@ -126,7 +126,7 @@ static void setup(void)
/***********************************************************************
* M A I N
***********************************************************************/
-int main()
+int main(int argc, char *argv[])
{
int status;
pid_t cpid;
diff --git a/testcases/kernel/containers/pidns/pidns17.c b/testcases/kernel/containers/pidns/pidns17.c
index cf0c5826f..79f112a55 100644
--- a/testcases/kernel/containers/pidns/pidns17.c
+++ b/testcases/kernel/containers/pidns/pidns17.c
@@ -131,7 +131,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int status;
pid_t pid;
@@ -143,7 +143,7 @@ int main(void)
/* Container creation on PID namespace */
TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWPID, child_fn, NULL));
if (TEST_RETURN == -1) {
- tst_brkm(TBROK | TTERRNO, NULL, "clone failed");
+ tst_brkm(TBROK | TERRNO, NULL, "clone failed");
}
sleep(1);
diff --git a/testcases/kernel/containers/pidns/pidns20.c b/testcases/kernel/containers/pidns/pidns20.c
index ec2c66bd3..8d1fb9d69 100644
--- a/testcases/kernel/containers/pidns/pidns20.c
+++ b/testcases/kernel/containers/pidns/pidns20.c
@@ -151,7 +151,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int status;
char buf[5];
diff --git a/testcases/kernel/containers/pidns/pidns30.c b/testcases/kernel/containers/pidns/pidns30.c
index 3f82834b2..5781b2493 100644
--- a/testcases/kernel/containers/pidns/pidns30.c
+++ b/testcases/kernel/containers/pidns/pidns30.c
@@ -236,7 +236,7 @@ static void setup(void)
check_newpid();
}
-int main(void)
+int main(int argc, char *argv[])
{
int status;
char buf[5];
diff --git a/testcases/kernel/containers/pidns/pidns31.c b/testcases/kernel/containers/pidns/pidns31.c
index fb8035d90..935b63533 100644
--- a/testcases/kernel/containers/pidns/pidns31.c
+++ b/testcases/kernel/containers/pidns/pidns31.c
@@ -248,7 +248,7 @@ static void setup(void)
* M A I N
***********************************************************************/
-int main(void)
+int main(int argc, char *argv[])
{
pid_t cpid;
mqd_t mqd;
diff --git a/testcases/kernel/containers/share/ns_create.c b/testcases/kernel/containers/share/ns_create.c
index d4259f38b..1d0339e71 100644
--- a/testcases/kernel/containers/share/ns_create.c
+++ b/testcases/kernel/containers/share/ns_create.c
@@ -30,6 +30,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
+#include <strings.h>
#include <errno.h>
#include "test.h"
#include "lapi/namespaces_constants.h"
diff --git a/testcases/kernel/containers/share/ns_ifmove.c b/testcases/kernel/containers/share/ns_ifmove.c
index 12642c6f4..f2a1b0f6a 100644
--- a/testcases/kernel/containers/share/ns_ifmove.c
+++ b/testcases/kernel/containers/share/ns_ifmove.c
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
int intf_index, pid, rtnetlink_socket;
if (argc != 3) {
- tst_resm(TINFO, "%s <INTERFACE_NAME> <NAMESPACE_PID>",
+ tst_resm(TINFO, "%s <INTERFACE_NAME> <NAMESPACE_PID>\n",
argv[0]);
return 1;
}
diff --git a/testcases/kernel/containers/sysvipc/sem_comm.c b/testcases/kernel/containers/sysvipc/sem_comm.c
index a2c354a08..09cc16362 100644
--- a/testcases/kernel/containers/sysvipc/sem_comm.c
+++ b/testcases/kernel/containers/sysvipc/sem_comm.c
@@ -27,6 +27,7 @@
#define _GNU_SOURCE
#include <sys/ipc.h>
+#include <sys/sem.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
@@ -34,7 +35,7 @@
#include "ipcns_helper.h"
#include "test.h"
#include "safe_macros.h"
-#include "lapi/sem.h"
+#include "lapi/semun.h"
#define TESTKEY 124426L
char *TCID = "sem_comm";
diff --git a/testcases/kernel/containers/timens/.gitignore b/testcases/kernel/containers/timens/.gitignore
deleted file mode 100644
index bcd2dd9dd..000000000
--- a/testcases/kernel/containers/timens/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-timens01
diff --git a/testcases/kernel/containers/timens/Makefile b/testcases/kernel/containers/timens/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/containers/timens/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/containers/timens/timens01.c b/testcases/kernel/containers/timens/timens01.c
deleted file mode 100644
index 3f6235ec3..000000000
--- a/testcases/kernel/containers/timens/timens01.c
+++ /dev/null
@@ -1,69 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
-
- Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
-
- */
-/*
-
- Basic test for timens_offsets error handling.
-
- After a call to unshare(CLONE_NEWTIME) a new timer namespace is created, the
- process that has called the unshare() can adjust offsets for CLOCK_MONOTONIC
- and CLOCK_BOOTTIME for its children by writing to the '/proc/self/timens_offsets'.
-
- */
-
-#define _GNU_SOURCE
-#include "lapi/namespaces_constants.h"
-#include "lapi/posix_clocks.h"
-#include "tst_test.h"
-
-static struct tcase {
- const char *desc;
- const char *offsets;
- int exp_err;
-} tcases[] = {
- {"Obvious garbage", "not an offset", EINVAL},
- {"Missing nanoseconds", "1 10", EINVAL},
- {"Negative nanoseconds", "1 10 -10", EINVAL},
- {"Nanoseconds > 1s", "1 10 1000000001", EINVAL},
- {"Unsupported CLOCK_REALTIME", "0 10 0", EINVAL},
- {"Mess on the second line", "1 10 0\na", EINVAL},
- {"Overflow kernel 64bit ns timer", "1 9223372036 0", ERANGE},
- {"Overflow kernel 64bit ns timer", "1 -9223372036 0", ERANGE},
-};
-
-static void verify_ns_clock(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int fd, ret;
-
- SAFE_UNSHARE(CLONE_NEWTIME);
-
- fd = SAFE_OPEN("/proc/self/timens_offsets", O_WRONLY);
- ret = write(fd, tc->offsets, strlen(tc->offsets));
-
- if (ret != -1) {
- tst_res(TFAIL, "%s returned %i", tc->desc, ret);
- return;
- }
-
- if (errno != tc->exp_err) {
- tst_res(TFAIL | TERRNO, "%s should fail with %s, got:",
- tc->desc, tst_strerrno(tc->exp_err));
- return;
- }
-
- tst_res(TPASS | TERRNO, "%s", tc->desc);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_ns_clock,
- .needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_TIME_NS=y",
- NULL
- }
-};
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index 4856f3372..90119e4ad 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -81,6 +81,8 @@ extern void cleanup(void)
/* Report exit status */
}
+volatile int timer_expired = 0;
+
int main(int argc, char *argv[])
{
@@ -117,14 +119,14 @@ int main(int argc, char *argv[])
((scriptpid = atoi(argv[3])) <= 0) ||
((num_cpus = atoi(argv[4])) <= 0) ||
(test_num = atoi(argv[5])) <= 0)
- tst_brkm(TBROK, cleanup, "Invalid input parameters");
+ tst_brkm(TBROK, cleanup, "Invalid input parameters\n");
if (test_num == 1)
myshares *= my_group_num;
else if (test_num == 3)
myshares = baseshares;
else
- tst_brkm(TBROK, cleanup, "Wrong Test num passed. Exiting.");
+ tst_brkm(TBROK, cleanup, "Wrong Test num passed. Exiting.\n");
sprintf(mygroup, "%s", argv[2]);
sprintf(mytaskfile, "%s", mygroup);
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 3c19a7719..dc1546e88 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -76,7 +76,9 @@ extern void cleanup(void)
/* Report exit status */
}
-int main(void)
+volatile int timer_expired = 0;
+
+int main(int argc, char *argv[])
{
int test_num;
@@ -134,10 +136,10 @@ int main(void)
sprintf(mygroup, "%s", mygroup_p);
} else {
tst_brkm(TBROK, cleanup,
- "Invalid other input parameters");
+ "Invalid other input parameters\n");
}
} else {
- tst_brkm(TBROK, cleanup, "Invalid test number passed");
+ tst_brkm(TBROK, cleanup, "Invalid test number passed\n");
}
sprintf(mytaskfile, "%s", mygroup);
@@ -242,7 +244,7 @@ int main(void)
break;
default:
tst_brkm(TBROK, cleanup,
- "Invalid test number passed");
+ "Invalid test number passed\n");
break;
} /* end switch */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index 63aec0d2a..92b451793 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -76,7 +76,9 @@ extern void cleanup(void)
/* Report exit status */
}
-int main(void)
+volatile int timer_expired = 0;
+
+int main(int argc, char *argv[])
{
int test_num, task_num, len, num_cpus;
@@ -130,10 +132,10 @@ int main(void)
sprintf(mygroup, "%s", mygroup_p);
} else {
tst_brkm(TBROK, cleanup,
- "Invalid other input parameters");
+ "Invalid other input parameters\n");
}
} else {
- tst_brkm(TBROK, cleanup, "Invalid test number passed");
+ tst_brkm(TBROK, cleanup, "Invalid test number passed\n");
}
sprintf(mytaskfile, "%s", mygroup);
@@ -233,7 +235,7 @@ int main(void)
break;
default:
tst_brkm(TBROK, cleanup,
- "Invalid test num passed");
+ "Invalid test num passed\n");
break;
} /* end switch */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
index 9a56d7b49..108e576e1 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
@@ -76,7 +76,9 @@ extern void cleanup(void)
/* Report exit status */
}
-int main(void)
+volatile int timer_expired = 0;
+
+int main(int argc, char *argv[])
{
int test_num;
@@ -133,10 +135,10 @@ int main(void)
sprintf(mygroup, "%s", mygroup_p);
} else {
tst_brkm(TBROK, cleanup,
- "Invalid other input parameters");
+ "Invalid other input parameters\n");
}
} else {
- tst_brkm(TBROK, cleanup, "Invalid test number passed");
+ tst_brkm(TBROK, cleanup, "Invalid test number passed\n");
}
sprintf(mytaskfile, "%s", mygroup);
@@ -243,7 +245,7 @@ int main(void)
break;
default:
tst_brkm(TBROK, cleanup,
- "Invalid test number passed");
+ "Invalid test number passed\n");
break;
} /* end switch */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
index 9370f7eb8..d7be1c80c 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -79,6 +79,8 @@ extern void cleanup(void)
tst_exit(); /* Report exit status */
}
+volatile int timer_expired = 0;
+
int main(int argc, char *argv[])
{
@@ -117,7 +119,7 @@ int main(int argc, char *argv[])
|| ((scriptpid = atoi(argv[3])) <= 0)
|| ((num_cpus = atoi(argv[4])) <= 0)
|| (test_num = atoi(argv[5])) <= 0) {
- tst_brkm(TBROK, cleanup, "Invalid input parameters");
+ tst_brkm(TBROK, cleanup, "Invalid input parameters\n");
}
if (test_num == 1) /* Test 01 & Test 02 */
@@ -126,7 +128,7 @@ int main(int argc, char *argv[])
myshares = baseshares;
else {
tst_brkm(TBROK, cleanup,
- "Wrong Test number passed. Exiting Test...");
+ "Wrong Test number passed. Exiting Test...\n");
}
sprintf(mygroup, "%s", argv[2]);
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
index a9b90d6b6..2a5cd4a11 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -78,6 +78,7 @@ extern void cleanup(void)
}
int migrate_task();
+volatile int timer_expired = 0;
int main(void)
{
@@ -138,10 +139,10 @@ int main(void)
sprintf(mygroup, "%s", mygroup_p);
} else {
tst_brkm(TBROK, cleanup,
- "Invalid other input parameters");
+ "Invalid other input parameters\n");
}
} else {
- tst_brkm(TBROK, cleanup, "Invalid test number passed");
+ tst_brkm(TBROK, cleanup, "Invalid test number passed\n");
}
sprintf(mytaskfile, "%s", mygroup);
@@ -240,7 +241,7 @@ with %u(shares) in %lu (s) INTERVAL\n", mygroup_num, task_num, delta_cpu_time,
break;
default:
tst_brkm(TBROK, cleanup,
- "Invalid test number passed");
+ "Invalid test number passed\n");
break;
} /* end switch */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index a81370085..8a80d6932 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -76,7 +76,9 @@ extern void cleanup(void)
tst_exit(); /* Report exit status */
}
-int main(void)
+volatile int timer_expired = 0;
+
+int main(int argc, char *argv[])
{
int test_num;
@@ -133,10 +135,10 @@ int main(void)
sprintf(mygroup, "%s", mygroup_p);
} else {
tst_brkm(TBROK, cleanup,
- "Invalid other input parameters");
+ "Invalid other input parameters\n");
}
} else {
- tst_brkm(TBROK, cleanup, "Invalid test number passed");
+ tst_brkm(TBROK, cleanup, "Invalid test number passed\n");
}
sprintf(mytaskfile, "%s", mygroup);
@@ -223,7 +225,7 @@ int main(void)
break;
default:
tst_brkm(TBROK, cleanup,
- "Invalid test number passed");
+ "Invalid test number passed\n");
break;
} /* end switch */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
index d166aa4d3..791a58dd2 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -77,7 +77,9 @@ extern void cleanup(void)
tst_exit(); /* Report exit status */
}
-int main(void)
+volatile int timer_expired = 0;
+
+int main(int argc, char *argv[])
{
int test_num;
@@ -134,10 +136,10 @@ int main(void)
sprintf(mygroup, "%s", mygroup_p);
} else {
tst_brkm(TBROK, cleanup,
- "Invalid other input parameters");
+ "Invalid other input parameters\n");
}
} else {
- tst_brkm(TBROK, cleanup, "Invalid test number passed");
+ tst_brkm(TBROK, cleanup, "Invalid test number passed\n");
}
/*
@@ -235,7 +237,7 @@ with %3u shares in %lu (s) INTERVAL\n", mygroup_num, task_num, delta_cpu_time,
break;
default:
tst_brkm(TBROK, cleanup,
- "Invalid test number passed");
+ "Invalid test number passed\n");
break;
} /* end switch */
diff --git a/testcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh b/testcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh
index 9ee1520be..d4807539c 100755
--- a/testcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh
+++ b/testcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh
@@ -208,7 +208,7 @@ PWD=`pwd`
RC=$?; # Return status of the task being waited
if [ $RC -ne 0 ]
then
- echo "Task $check_task exited abnormally with return value: $RC";
+ echo "Task $check_task exited abnormaly with return value: $RC";
echo TBROK "Test could'nt execute for expected duration";
fi
cd $PWD;
diff --git a/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh b/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
index 3fcba1491..443ee1474 100755
--- a/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
+++ b/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
@@ -135,7 +135,7 @@ usage ()
echo "RUNNING SETUP.....";
do_setup;
- # Trap the signal from any abnormally terminated task
+ # Trap the signal from any abnormaly terminated task
# and kill all others and let cleanup be called
trap 'echo "signal caught from task"; killall cpuctl_task_*;' SIGUSR1;
@@ -367,7 +367,7 @@ usage ()
# and they will return non zero exit status. So Test broke!!
if [ $RC -ne 0 ]
then
- echo "Task $i exited abnormally with return value: $RC";
+ echo "Task $i exited abnormaly with return value: $RC";
tst_resm TINFO "Test could not execute for the expected duration";
cleanup;
exit -1;
diff --git a/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh b/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
index bbbd2fbcb..67834ab6b 100755
--- a/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
+++ b/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
@@ -90,7 +90,7 @@ NUM_CPUS=`tst_ncpus`
echo "RUNNING SETUP.....";
do_setup;
- # Trap the signal from any abnormally terminated task
+ # Trap the signal from any abnormaly terminated task
# and kill all others and let cleanup be called
trap 'echo "signal caught from task"; killall cpuctl_task_*;' SIGUSR1;
@@ -294,7 +294,7 @@ NUM_CPUS=`tst_ncpus`
# and they will return non zero exit status. So Test broke!!
if [ $RC -ne 0 ]
then
- echo "Task $i exited abnormally with return value: $RC";
+ echo "Task $i exited abnormaly with return value: $RC";
tst_resm TINFO "Test could not execute for the expected duration";
cleanup;
exit -1;
diff --git a/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh
index 367c95d2b..67f3611d7 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh
@@ -128,8 +128,10 @@ test_cpus()
base_op_test "$CPUSET/1/cpuset.cpus" "0,1-$((nr_cpus-2))," "0-$((nr_cpus-2))"
fi
- if tst_kvcmp -ge "4.3"; then
+ if tst_kvcmp -lt "3.0 RHEL6:2.6.32"; then
base_op_test "$CPUSET/1/cpuset.cpus" "0-" "WRITE_ERROR"
+ else
+ base_op_test "$CPUSET/1/cpuset.cpus" "0-" "0"
fi
}
@@ -161,8 +163,10 @@ test_mems()
base_op_test "$CPUSET/1/cpuset.mems" "0,1-$((nr_mems-2))," "0-$((nr_mems-2))"
fi
- if tst_kvcmp -ge "4.3"; then
+ if tst_kvcmp -lt "3.0 RHEL6:2.6.32"; then
base_op_test "$CPUSET/1/cpuset.mems" "0-" "WRITE_ERROR"
+ else
+ base_op_test "$CPUSET/1/cpuset.mems" "0-" "0"
fi
}
diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
index f3ba1d5ca..935a41ed0 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
@@ -26,42 +26,19 @@
. test.sh
-cpu_string="`cat /sys/devices/system/cpu/online`"
NR_CPUS=`tst_ncpus`
-
if [ -f "/sys/devices/system/node/has_high_memory" ]; then
- mem_string="`cat /sys/devices/system/node/has_high_memory`"
+ N_NODES="`cat /sys/devices/system/node/has_high_memory`"
else
- mem_string="`cat /sys/devices/system/node/has_normal_memory`"
+ N_NODES="`cat /sys/devices/system/node/has_normal_memory`"
fi
-N_NODES="`echo $mem_string | tr ',' ' '`"
-count=0
-final_node=0
-for item in $N_NODES; do
- delta=1
- if [ "${item#*-*}" != "$item" ]; then
- delta=$((${item#*-*} - ${item%*-*} + 1))
- fi
- final_node=${item#*-*}
- count=$((count + $delta))
-done
-final_node=$((final_node + 1))
-N_NODES=$count
-
-final_cpu=0
-N_CPUS="`echo $cpu_string | tr ',' ' '`"
-for item in $N_CPUS; do
- final_cpu=${item#*-*}
-done
-final_cpu=$((final_cpu + 1))
+N_NODES=${N_NODES#*-*}
+N_NODES=$(($N_NODES + 1))
CPUSET="/dev/cpuset"
CPUSET_TMP="/tmp/cpuset_tmp"
-CLONE_CHILDREN="/dev/cpuset/cgroup.clone_children"
-CHILDREN_VALUE="0"
+
HOTPLUG_CPU="1"
-SCHED_LB="/dev/cpuset/cpuset.sched_load_balance"
-SCHED_LB_VALUE="0"
cpuset_log()
{
@@ -91,12 +68,6 @@ ncpus_check()
if [ $NR_CPUS -lt $1 ]; then
tst_brkm TCONF "The total of CPUs is less than $1"
fi
- # check online cpus whether match 0-num
- if [ $final_cpu -eq $NR_CPUS ]; then
- tst_resm TINFO "CPUs are numbered continuously starting at 0 ($cpu_string)"
- else
- tst_brkm TCONF "CPUs are not numbered continuously starting at 0 ($cpu_string)"
- fi
}
nnodes_check()
@@ -104,12 +75,6 @@ nnodes_check()
if [ $N_NODES -lt $1 ]; then
tst_brkm TCONF "The total of nodes is less than $1"
fi
- # check online nodes whether match 0-num
- if [ $final_node -eq $N_NODES ]; then
- tst_resm TINFO "Nodes are numbered continuously starting at 0 ($mem_string)"
- else
- tst_brkm TCONF "Nodes are not numbered continuously starting at 0 ($mem_string)"
- fi
}
user_check()
@@ -169,9 +134,6 @@ setup()
tst_brkm TFAIL "Could not mount cgroup filesystem with"\
" cpuset on $CPUSET..Exiting test"
fi
-
- CHILDREN_VALUE="`cat $CLONE_CHILDREN`"
- SCHED_LB_VALUE="`cat $SCHED_LB`"
}
# Write the cleanup function
@@ -182,9 +144,6 @@ cleanup()
return 0
}
- echo $CHILDREN_VALUE > $CLONE_CHILDREN
- echo $SCHED_LB_VALUE > $SCHED_LB
-
find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read subdir
do
while read pid
diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh
index 155e536de..e973de7b9 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh
@@ -86,11 +86,6 @@ root_cpu_hotplug_test()
return 1
fi
- # cpuset hotplug is asynchronous operation, we could end up reading a
- # stale value here. sleep is awful, but we can't do better.
- # See https://github.com/linux-test-project/ltp/issues/693
- sleep 1
-
root_cpus="`cat $CPUSET/cpuset.cpus`"
task_cpus="`cat /proc/$tst_pid/status | grep Cpus_allowed_list`"
@@ -160,11 +155,6 @@ general_cpu_hotplug_test()
return 1
fi
- # cpuset hotplug is asynchronous operation, we could end up reading a
- # stale value here. sleep is awful, but we can't do better.
- # See https://github.com/linux-test-project/ltp/issues/693
- sleep 1
-
cpus="`cat $path/cpuset.cpus`"
task_cpus="`cat /proc/$tst_pid/status | grep Cpus_allowed_list`"
diff --git a/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh
index 650972d4b..1b4f314f9 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh
@@ -23,7 +23,7 @@
################################################################################
export TCID="cpuset_inherit"
-export TST_TOTAL=33
+export TST_TOTAL=27
export TST_COUNT=1
. cpuset_funcs.sh
@@ -44,13 +44,10 @@ cfile_name=
base_op_write_and_test()
{
local write_file="$1"
- local inherit_value="$2"
- local write_string="$3"
- local expect_string="$4"
+ local write_string="$2"
+ local expect_string="$3"
local return_result=
- echo $inherit_value > $CLONE_CHILDREN
-
mkdir -p "$(dirname $write_file)" || {
tst_brkm TFAIL "Failed to mkdir -p $(basename $write_file)"
return 1
@@ -106,16 +103,13 @@ inherit_test()
test_cpus()
{
cfile_name="cpus"
- while read inherit cpus result
+ while read cpus result
do
- inherit_test "$CPUSET/1/cpuset.cpus" "$inherit" "$cpus" "$result"
+ inherit_test "$CPUSET/1/cpuset.cpus" "$cpus" "$result"
done <<- EOF
- 0 NULL EMPTY
- 0 0 EMPTY
- 0 $cpus_all EMPTY
- 1 NULL EMPTY
- 1 0 0
- 1 $cpus_all $cpu_string
+ NULL EMPTY
+ 0 EMPTY
+ $cpus_all EMPTY
EOF
# while read cpus result
}
@@ -123,16 +117,13 @@ test_cpus()
test_mems()
{
cfile_name="mems"
- while read inherit mems result
+ while read mems result
do
- inherit_test "$CPUSET/1/cpuset.mems" "$inherit" "$mems" "$result"
+ inherit_test "$CPUSET/1/cpuset.mems" "$mems" "$result"
done <<- EOF
- 0 NULL EMPTY
- 0 0 EMPTY
- 0 $mems_all EMPTY
- 1 NULL EMPTY
- 1 0 0
- 1 $mems_all $mem_string
+ NULL EMPTY
+ 0 EMPTY
+ $mems_all EMPTY
EOF
# while read mems result
}
@@ -144,12 +135,12 @@ test_three_result_similar_flags()
memory_migrate
do
cfile_name="$filename"
- while read inherit flags result
+ while read flags result
do
- inherit_test "$CPUSET/1/cpuset.$filename" "$inherit" "$flags" "$result"
+ inherit_test "$CPUSET/1/cpuset.$filename" "$flags" "$result"
done <<- EOF
- 0 0 0
- 0 1 0
+ 0 0
+ 1 0
EOF
# while read flags, result
done # for filename in flagfiles
@@ -161,12 +152,12 @@ test_spread_flags()
for filename in memory_spread_page memory_spread_slab
do
cfile_name="$filename"
- while read inherit flags result
+ while read flags result
do
- inherit_test "$CPUSET/1/cpuset.$filename" "$inherit" "$flags" "$result"
+ inherit_test "$CPUSET/1/cpuset.$filename" "$flags" "$result"
done <<- EOF
- 0 0 0
- 0 1 1
+ 0 0
+ 1 1
EOF
# while read flags, result
done # for filename in flagfiles
@@ -175,12 +166,12 @@ test_spread_flags()
test_sched_load_balance_flag()
{
cfile_name="sched_load_balance"
- while read inherit flag result
+ while read flag result
do
- inherit_test "$CPUSET/1/cpuset.sched_load_balance" "$inherit" "$flag" "$result"
+ inherit_test "$CPUSET/1/cpuset.sched_load_balance" "$flag" "$result"
done <<- EOF
- 0 0 1
- 0 1 1
+ 0 1
+ 1 1
EOF
# while read mems result
}
@@ -188,37 +179,37 @@ test_sched_load_balance_flag()
test_domain()
{
cfile_name="sched_relax_domain_level"
- while read inherit domain_level result
+ while read domain_level result
do
- inherit_test "$CPUSET/1/cpuset.sched_relax_domain_level" "$inherit" "$domain_level" "$result"
+ inherit_test "$CPUSET/1/cpuset.sched_relax_domain_level" "$domain_level" "$result"
done <<- EOF
- 0 -1 -1
- 0 0 -1
- 0 1 -1
- 0 2 -1
- 0 3 -1
- 0 4 -1
- 0 5 -1
+ -1 -1
+ 0 -1
+ 1 -1
+ 2 -1
+ 3 -1
+ 4 -1
+ 5 -1
EOF
# while read domain_level result
}
-# Case 1-6
+# Case 1-3
test_cpus
-# Case 7-12
+# Case 4-6
test_mems
-# Case 13-20
+# Case 7-14
test_three_result_similar_flags
-# Case 21-24
+# Case 15-18
test_spread_flags
-# Case 25-26
+# Case 19-20
test_sched_load_balance_flag
-# Case 27-33
+# Case 21-27
test_domain
exit $exit_status
diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile b/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile
index 1b6a40bea..069ebc38c 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile
+++ b/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile
@@ -27,6 +27,6 @@ include $(top_srcdir)/include/mk/testcases.mk
LDLIBS := -lm -lcontrollers -lltp $(LDLIBS)
-INTERNAL_LIB := libcpu_set.a
+LIB := libcpu_set.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c b/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c
index a687ad2ee..172e23714 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c
@@ -2093,11 +2093,11 @@ int cpuset_query(struct cpuset *cp, const char *relpath)
fullpath(buf, sizeof(buf), relpath);
- if (load_flag(buf, &cp->cpu_exclusive, "cpuset.cpu_exclusive") < 0)
+ if (load_flag(buf, &cp->cpu_exclusive, "cpu_exclusive") < 0)
goto err;
cp->cpu_exclusive_valid = 1;
- if (load_flag(buf, &cp->mem_exclusive, "cpuset.mem_exclusive") < 0)
+ if (load_flag(buf, &cp->mem_exclusive, "mem_exclusive") < 0)
goto err;
cp->mem_exclusive_valid = 1;
@@ -2105,60 +2105,60 @@ int cpuset_query(struct cpuset *cp, const char *relpath)
goto err;
cp->notify_on_release_valid = 1;
- if (exists_flag(buf, "cpuset.memory_migrate")) {
- if (load_flag(buf, &cp->memory_migrate, "cpuset.memory_migrate") < 0)
+ if (exists_flag(buf, "memory_migrate")) {
+ if (load_flag(buf, &cp->memory_migrate, "memory_migrate") < 0)
goto err;
cp->memory_migrate_valid = 1;
}
- if (exists_flag(buf, "cpuset.mem_hardwall")) {
- if (load_flag(buf, &cp->mem_hardwall, "cpuset.mem_hardwall") < 0)
+ if (exists_flag(buf, "mem_hardwall")) {
+ if (load_flag(buf, &cp->mem_hardwall, "mem_hardwall") < 0)
goto err;
cp->mem_hardwall_valid = 1;
}
- if (exists_flag(buf, "cpuset.memory_pressure_enabled")) {
+ if (exists_flag(buf, "memory_pressure_enabled")) {
if (load_flag
(buf, &cp->memory_pressure_enabled,
- "cpuset.memory_pressure_enabled") < 0)
+ "memory_pressure_enabled") < 0)
goto err;
cp->memory_pressure_enabled_valid = 1;
}
- if (exists_flag(buf, "cpuset.memory_spread_page")) {
+ if (exists_flag(buf, "memory_spread_page")) {
if (load_flag
- (buf, &cp->memory_spread_page, "cpuset.memory_spread_page") < 0)
+ (buf, &cp->memory_spread_page, "memory_spread_page") < 0)
goto err;
cp->memory_spread_page_valid = 1;
}
- if (exists_flag(buf, "cpuset.memory_spread_slab")) {
+ if (exists_flag(buf, "memory_spread_slab")) {
if (load_flag
- (buf, &cp->memory_spread_slab, "cpuset.memory_spread_slab") < 0)
+ (buf, &cp->memory_spread_slab, "memory_spread_slab") < 0)
goto err;
cp->memory_spread_slab_valid = 1;
}
- if (exists_flag(buf, "cpuset.sched_load_balance")) {
+ if (exists_flag(buf, "sched_load_balance")) {
if (load_flag
- (buf, &cp->sched_load_balance, "cpuset.sched_load_balance") < 0)
+ (buf, &cp->sched_load_balance, "sched_load_balance") < 0)
goto err;
cp->sched_load_balance_valid = 1;
}
- if (exists_flag(buf, "cpuset.sched_relax_domain_level")) {
+ if (exists_flag(buf, "sched_relax_domain_level")) {
if (load_number
(buf, &cp->sched_relax_domain_level,
- "cpuset.sched_relax_domain_level") < 0)
+ "sched_relax_domain_level") < 0)
goto err;
cp->sched_relax_domain_level_valid = 1;
}
- if (load_mask(buf, &cp->cpus, cpuset_cpus_nbits(), "cpuset.cpus") < 0)
+ if (load_mask(buf, &cp->cpus, cpuset_cpus_nbits(), "cpus") < 0)
goto err;
cp->cpus_valid = 1;
- if (load_mask(buf, &cp->mems, cpuset_mems_nbits(), "cpuset.mems") < 0)
+ if (load_mask(buf, &cp->mems, cpuset_mems_nbits(), "mems") < 0)
goto err;
cp->mems_valid = 1;
diff --git a/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c b/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c
index 125ebd1c7..8a6ec263e 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c
@@ -111,7 +111,7 @@ void usage(char *prog_name, int status)
void checkopt(int argc, char **argv)
{
- int c = '\0';
+ char c = '\0';
char *endptr = NULL;
long nr_cpus = 0;
long opt_value = 0;
diff --git a/testcases/kernel/controllers/freezer/vfork.c b/testcases/kernel/controllers/freezer/vfork.c
index 0b25e90c2..124a78363 100644
--- a/testcases/kernel/controllers/freezer/vfork.c
+++ b/testcases/kernel/controllers/freezer/vfork.c
@@ -21,7 +21,7 @@
*
* vfork <num> times, stopping after each vfork. TODO: Requires an external process
* to send SIGCONT to goto the next vfork. <num> SIGCONT signals must be
- * received before exiting.
+ * received before exitting.
*
* We can't do anything but execve or _exit in vfork'd processes
* so we use ptrace vfork'd processes in order to pause then during each
diff --git a/testcases/kernel/controllers/libcontrollers/Makefile b/testcases/kernel/controllers/libcontrollers/Makefile
index 9f8955e28..88918cf2d 100644
--- a/testcases/kernel/controllers/libcontrollers/Makefile
+++ b/testcases/kernel/controllers/libcontrollers/Makefile
@@ -24,6 +24,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-INTERNAL_LIB := libcontrollers.a
+LIB := libcontrollers.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.c b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
index e9917271c..75766fc19 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.c
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
@@ -35,17 +35,6 @@
#include "libcontrollers.h"
-char fullpath[PATH_MAX];
-int FLAG;
-volatile int timer_expired = 0;
-int retval;
-unsigned int num_line;
-unsigned int current_shares;
-unsigned int total_shares;
-unsigned int *shares_pointer;
-char target[LINE_MAX];
-struct dirent *dir_pointer;
-
/*
* Function: scan_shares_file()
* This function scans all the shares files under the mountpoint
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index 7d7b8324b..cdde9f9e6 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -42,16 +42,28 @@
#include <sys/types.h>
#include <unistd.h>
-extern char fullpath[PATH_MAX];
-extern int FLAG;
-extern volatile int timer_expired;
-extern int retval;
-extern unsigned int num_line;
-extern unsigned int current_shares;
-extern unsigned int total_shares;
-extern unsigned int *shares_pointer;
-extern char target[LINE_MAX];
-extern struct dirent *dir_pointer;
+#ifdef PATH_MAX
+char fullpath[PATH_MAX];
+#else
+char fullpath[1024]; /* Guess */
+#endif
+
+int FLAG;
+volatile int timer_expired;
+
+int retval;
+
+unsigned int num_line;//??
+
+unsigned int current_shares;
+
+unsigned int total_shares;
+
+unsigned int *shares_pointer;//??
+
+char target[LINE_MAX];
+
+struct dirent *dir_pointer;
enum{
GET_SHARES =1,
diff --git a/testcases/kernel/controllers/memcg/control/mem_process.c b/testcases/kernel/controllers/memcg/control/mem_process.c
index 6c1b36ca6..efe2fb3e3 100644
--- a/testcases/kernel/controllers/memcg/control/mem_process.c
+++ b/testcases/kernel/controllers/memcg/control/mem_process.c
@@ -101,20 +101,25 @@ void mem_map(void)
/*
* done: retrieve instructions from the named pipe
*/
-char action(int fd)
+char action(void)
{
char ch;
+ int fd;
+
+ if ((fd = open(STATUS_PIPE, O_RDONLY)) == -1)
+ err(6, "Error opening named pipe");
if (read(fd, &ch, 1) == -1)
err(7, "Error reading named pipe");
+ close(fd);
+
return ch;
}
int main(int argc, char **argv)
{
int ret;
- int fd;
char ch;
process_options(argc, argv);
@@ -124,18 +129,13 @@ int main(int argc, char **argv)
if (ret == -1 && errno != EEXIST)
errx(1, "Error creating named pipe");
- if ((fd = open(STATUS_PIPE, O_RDONLY)) == -1)
- err(6, "Error opening named pipe");
-
do {
- ch = action(fd);
+ ch = action();
if (ch == 'm')
mem_map();
} while (ch != 'x');
- close(fd);
-
remove(STATUS_PIPE);
return 0;
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh b/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh
index ce0885b73..d5034a514 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_failcnt.sh
@@ -1,39 +1,58 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
-MEMCG_TESTFUNC=test
-MEMCG_SHMMAX=1
-TST_TEST_DATA="--mmap-anon --mmap-file --shm"
-. memcg_lib.sh
+################################################################################
+## ##
+## Copyright (c) 2009 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software Foundation, ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Li Zefan <lizf@cn.fujitsu.com> ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com> ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak ##
+## <risrajak@linux.vnet.ibm.com ##
+## ##
+################################################################################
+
+TCID="memcg_failcnt"
+TST_TOTAL=3
-MEMORY_LIMIT=$PAGESIZE
-MEMORY_TO_ALLOCATE=$((MEMORY_LIMIT * 2))
+. memcg_lib.sh
-test()
+# Test memory.failcnt
+testcase_1()
{
- echo $MEMORY_LIMIT > memory.limit_in_bytes
-
- start_memcg_process $2 -s ${MEMORY_TO_ALLOCATE}
- echo $MEMCG_PROCESS_PID > tasks
-
- signal_memcg_process ${MEMORY_TO_ALLOCATE}
- signal_memcg_process ${MEMORY_TO_ALLOCATE}
+ echo $PAGESIZE > memory.limit_in_bytes
+ malloc_free_memory "--mmap-anon" $(($PAGESIZE*2))
+ test_failcnt "memory.failcnt"
+}
- stop_memcg_process
+testcase_2()
+{
+ echo $PAGESIZE > memory.limit_in_bytes
+ malloc_free_memory "--mmap-file" $(($PAGESIZE*2))
+ test_failcnt "memory.failcnt"
+}
- failcnt=$(cat memory.failcnt)
- if [ $failcnt -gt 0 ]; then
- tst_res TPASS "memory.failcnt is $failcnt, > 0 as expected"
- else
- tst_res TFAIL "memory.failcnt is $failcnt, <= 0 expected"
- fi
+testcase_3()
+{
+ echo $PAGESIZE > memory.limit_in_bytes
+ malloc_free_memory "--shm" $(($PAGESIZE*2))
+ test_failcnt "memory.failcnt"
}
-tst_run
+shmmax_setup
+LOCAL_CLEANUP=shmmax_cleanup
+run_tests
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_force_empty.sh b/testcases/kernel/controllers/memcg/functional/memcg_force_empty.sh
index 92ac25938..cb475acff 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_force_empty.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_force_empty.sh
@@ -1,25 +1,44 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
-
-MEMCG_TESTFUNC=test
-TST_CNT=6
+
+################################################################################
+## ##
+## Copyright (c) 2009 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software Foundation, ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Li Zefan <lizf@cn.fujitsu.com> ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com> ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak ##
+## <risrajak@linux.vnet.ibm.com ##
+## ##
+################################################################################
+
+TCID="memcg_force_empty"
+TST_TOTAL=6
. memcg_lib.sh
# Test memory.force_empty
-test1()
+testcase_1()
{
- start_memcg_process --mmap-anon -s $PAGESIZE
- echo $MEMCG_PROCESS_PID > tasks
- signal_memcg_process $PAGESIZE
- echo $MEMCG_PROCESS_PID > ../tasks
+ memcg_process --mmap-anon -s $PAGESIZE &
+ pid=$!
+ TST_CHECKPOINT_WAIT 0
+ echo $pid > tasks
+ signal_memcg_process $pid $PAGESIZE
+ echo $pid > ../tasks
# This expects that there is swap configured
EXPECT_PASS echo 1 \> memory.force_empty
@@ -27,31 +46,32 @@ test1()
stop_memcg_process $pid
}
-test2()
+testcase_2()
{
EXPECT_PASS echo 0 \> memory.force_empty
}
-test3()
+testcase_3()
{
EXPECT_PASS echo 1.0 \> memory.force_empty
}
-test4()
+testcase_4()
{
EXPECT_PASS echo 1xx \> memory.force_empty
}
-test5()
+testcase_5()
{
EXPECT_PASS echo xx \> memory.force_empty
}
-test6()
+testcase_6()
{
# writing to non-empty top mem cgroup's force_empty
# should return failure
EXPECT_FAIL echo 1 \> /dev/memcg/memory.force_empty
}
-tst_run
+run_tests
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index d9bb6d943..22ef4f5e2 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -1,140 +1,100 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2019 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-TST_NEEDS_CHECKPOINTS=1
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_NEEDS_CMDS="killall find kill"
-TST_CLEANUP=memcg_cleanup
-TST_SETUP=memcg_setup
-TST_TESTFUNC=memcg_testfunc
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Peng Haitao <penght@cn.fujitsu.com> ##
+## ##
+################################################################################
-MEMCG_SHMMAX=${MEMCG_SHMMAX:-0}
-MEMCG_TESTFUNC=${MEMCG_TESTFUNC:-memcg_no_testfunc}
+TST_NEEDS_CHECKPOINTS=1
+. test.sh
-. cgroup_lib.sh
+if [ "x$(grep -w memory /proc/cgroups | cut -f4)" != "x1" ]; then
+ tst_brkm TCONF "Kernel does not support the memory resource controller"
+fi
PAGESIZE=$(tst_getconf PAGESIZE)
if [ $? -ne 0 ]; then
- tst_brk TBROK "tst_getconf PAGESIZE failed"
+ tst_brkm TBROK "tst_getconf PAGESIZE failed"
fi
+# Check for dependencies
+tst_require_cmds killall
+
# Post 4.16 kernel updates stat in batch (> 32 pages) every time
-PAGESIZES=$(($PAGESIZE * 33))
+PAGESIZES=$(( $PAGESIZE * 33 ))
HUGEPAGESIZE=$(awk '/Hugepagesize/ {print $2}' /proc/meminfo)
[ -z $HUGEPAGESIZE ] && HUGEPAGESIZE=0
-HUGEPAGESIZE=$(($HUGEPAGESIZE * 1024))
+HUGEPAGESIZE=$(( $HUGEPAGESIZE * 1024 ))
+orig_memory_use_hierarchy=""
-orig_memory_use_hierarchy=
-orig_shmmax=
+MEMSW_USAGE_FLAG=0
+MEMSW_LIMIT_FLAG=0
-memcg_require_memsw()
-{
- if ! [ -e /dev/memcg/memory.limit_in_bytes ]; then
- tst_brk TBROK "/dev/memcg must be mounted before calling memcg_require_memsw"
- fi
- if ! [ -e /dev/memcg/memory.memsw.limit_in_bytes ]; then
- tst_brk TCONF "mem+swap is not enabled"
- fi
-}
+tst_tmpdir
+TMP_DIR="$PWD"
-memcg_require_hierarchy_disabled()
+cleanup()
{
- if [ ! -e "/dev/memcg/memory.use_hierarchy" ]; then
- tst_brk TBROK "/dev/memcg must be mounted before calling memcg_require_hierarchy_disabled"
- fi
- if [ $(cat /dev/memcg/memory.use_hierarchy) -eq 1 ]; then
- tst_brk TCONF "Test requires root cgroup memory.use_hierarchy=0"
+ if [ -n "$LOCAL_CLEANUP" ]; then
+ $LOCAL_CLEANUP
fi
-}
-memcg_setup()
-{
- if ! is_cgroup_subsystem_available_and_enabled "memory"; then
- tst_brk TCONF "Either kernel does not support Memory Resource Controller or feature not enabled"
- fi
+ killall -9 memcg_process 2> /dev/null
+ wait
- # Setup IPC
- LTP_IPC_PATH="/dev/shm/ltp_${TCID}_$$"
- LTP_IPC_SIZE=$PAGESIZE
- ROD_SILENT dd if=/dev/zero of="$LTP_IPC_PATH" bs="$LTP_IPC_SIZE" count=1
- ROD_SILENT chmod 600 "$LTP_IPC_PATH"
- export LTP_IPC_PATH
- # Setup IPC end
+ cd "$TMP_DIR"
- ROD mkdir /dev/memcg
- ROD mount -t cgroup -omemory memcg /dev/memcg
+ if [ -n "$TEST_ID" -a -d "/dev/memcg/$TEST_ID" ]; then
+ for i in "/dev/memcg/$TEST_ID/"*; do
+ if [ -d "$i" ]; then
+ rmdir "$i"
+ fi
+ done
- # The default value for memory.use_hierarchy is 0 and some of tests
- # (memcg_stat_test.sh and memcg_use_hierarchy_test.sh) expect it so
- # while there are distributions (RHEL7U0Beta for example) that sets
- # it to 1.
- # Note: If there are already subgroups created it is not possible,
- # to set this back to 0.
- # This seems to be the default for all systems using systemd.
- orig_memory_use_hierarchy=$(cat /dev/memcg/memory.use_hierarchy)
- if [ -z "$orig_memory_use_hierarchy" ];then
- tst_res TINFO "cat /dev/memcg/ failed"
- elif [ "$orig_memory_use_hierarchy" = "0" ];then
- orig_memory_use_hierarchy=""
- else
- echo 0 > /dev/memcg/memory.use_hierarchy 2>/dev/null
- if [ $? -ne 0 ];then
- tst_res TINFO "set /dev/memcg/memory.use_hierarchy to 0 failed"
- fi
- fi
-
- [ "$MEMCG_SHMMAX" = "1" ] && shmmax_setup
-}
-
-memcg_cleanup()
-{
- kill -9 $MEMCG_PROCESS_PID 2> /dev/null
-
- cd $TST_TMPDIR
- # In order to remove all subgroups, we have to remove them recursively
- if [ -e /dev/memcg/ltp_$$ ]; then
- ROD find /dev/memcg/ltp_$$ -depth -type d -delete
+ rmdir "/dev/memcg/$TEST_ID"
fi
- if [ -n "$orig_memory_use_hierarchy" ];then
- echo $orig_memory_use_hierarchy > /dev/memcg/memory.use_hierarchy
- if [ $? -ne 0 ];then
- tst_res TINFO "restore /dev/memcg/memory.use_hierarchy failed"
- fi
- orig_memory_use_hierarchy=""
- fi
-
- if [ -e "/dev/memcg" ]; then
+ if [ -d "/dev/memcg" ]; then
umount /dev/memcg
rmdir /dev/memcg
fi
- [ "$MEMCG_SHMMAX" = "1" ] && shmmax_cleanup
+ tst_rmdir
}
+TST_CLEANUP=cleanup
shmmax_setup()
{
tst_require_cmds bc
- tst_res TINFO "Setting shmmax"
-
- orig_shmmax=$(cat /proc/sys/kernel/shmmax)
- if [ $(echo "$orig_shmmax < $HUGEPAGESIZE" | bc) -eq 1 ]; then
+ shmmax=`cat /proc/sys/kernel/shmmax`
+ if [ $(echo "$shmmax < $HUGEPAGESIZE" |bc) -eq 1 ]; then
ROD echo "$HUGEPAGESIZE" \> /proc/sys/kernel/shmmax
fi
}
shmmax_cleanup()
{
- if [ -n "$orig_shmmax" ]; then
- echo "$orig_shmmax" > /proc/sys/kernel/shmmax
+ if [ -n "$shmmax" ]; then
+ echo "$shmmax" > /proc/sys/kernel/shmmax
fi
}
@@ -143,36 +103,27 @@ shmmax_cleanup()
# $2 - Expected size
check_mem_stat()
{
- local item_size
-
if [ -e $1 ]; then
- item_size=$(cat $1)
+ item_size=`cat $1`
else
- item_size=$(grep -w $1 memory.stat | cut -d " " -f 2)
+ item_size=`grep -w $1 memory.stat | cut -d " " -f 2`
fi
if [ "$2" = "$item_size" ]; then
- tst_res TPASS "$1 is $2 as expected"
+ tst_resm TPASS "$1 is $2 as expected"
else
- tst_res TFAIL "$1 is $item_size, $2 expected"
+ tst_resm TFAIL "$1 is $item_size, $2 expected"
fi
}
-start_memcg_process()
-{
- tst_res TINFO "Running memcg_process $@"
- memcg_process "$@" &
- MEMCG_PROCESS_PID=$!
- ROD tst_checkpoint wait 10000 0
-}
-
signal_memcg_process()
{
- local size=$1
- local path=$2
+ local pid=$1
+ local size=$2
+ local path=$3
local usage_start=$(cat ${path}memory.usage_in_bytes)
- kill -s USR1 $MEMCG_PROCESS_PID 2> /dev/null
+ kill -s USR1 $pid 2> /dev/null
if [ -z "$size" ]; then
return
@@ -180,7 +131,7 @@ signal_memcg_process()
local loops=100
- while kill -0 $MEMCG_PROCESS_PID 2> /dev/null; do
+ while kill -0 $pid 2> /dev/null; do
local usage=$(cat ${path}memory.usage_in_bytes)
local diff_a=$((usage_start - usage))
local diff_b=$((usage - usage_start))
@@ -193,32 +144,34 @@ signal_memcg_process()
loops=$((loops - 1))
if [ $loops -le 0 ]; then
- tst_brk TBROK "timed out on memory.usage_in_bytes"
+ tst_brkm TBROK "timeouted on memory.usage_in_bytes"
fi
done
}
stop_memcg_process()
{
- [ -z "$MEMCG_PROCESS_PID" ] && return
- kill -s INT $MEMCG_PROCESS_PID 2> /dev/null
- wait $MEMCG_PROCESS_PID
- MEMCG_PROCESS_PID=
+ local pid=$1
+ kill -s INT $pid 2> /dev/null
+ wait $pid
}
warmup()
{
- tst_res TINFO "Warming up pid: $MEMCG_PROCESS_PID"
- signal_memcg_process
- signal_memcg_process
+ local pid=$1
+
+ tst_resm TINFO "Warming up pid: $pid"
+ signal_memcg_process $pid
+ signal_memcg_process $pid
sleep 1
- if ! kill -0 $MEMCG_PROCESS_PID; then
- wait $MEMCG_PROCESS_PID
- tst_res TFAIL "Process $MEMCG_PROCESS_PID exited with $? after warm up"
+ kill -0 $pid
+ if [ $? -ne 0 ]; then
+ wait $pid
+ tst_resm TFAIL "Process $pid exited with $? after warm up"
return 1
else
- tst_res TINFO "Process is still here after warm up: $MEMCG_PROCESS_PID"
+ tst_resm TINFO "Process is still here after warm up: $pid"
fi
return 0
@@ -235,23 +188,86 @@ test_mem_stat()
local exp_stat_size=$5
local check_after_free=$6
- start_memcg_process $memtypes -s $size
+ tst_resm TINFO "Running memcg_process $memtypes -s $size"
+ memcg_process $memtypes -s $size &
+ TST_CHECKPOINT_WAIT 0
- if ! warmup; then
+ warmup $!
+ if [ $? -ne 0 ]; then
return
fi
- echo $MEMCG_PROCESS_PID > tasks
- signal_memcg_process $size
+ echo $! > tasks
+ signal_memcg_process $! $size
check_mem_stat $stat_name $exp_stat_size
- signal_memcg_process $size
+ signal_memcg_process $! $size
if $check_after_free; then
check_mem_stat $stat_name 0
fi
- stop_memcg_process
+ stop_memcg_process $!
+}
+
+# Run test cases which checks memory.max_usage_in_bytes after make
+# some memory allocation
+# $1 - the parameters of 'process', such as --shm
+# $2 - the -s parameter of 'process', such as 4096
+# $3 - item name
+# $4 - the expected size
+# $5 - check after free ?
+test_max_usage_in_bytes()
+{
+ tst_resm TINFO "Running memcg_process $1 -s $2"
+ memcg_process $1 -s $2 &
+ TST_CHECKPOINT_WAIT 0
+
+ warmup $!
+ if [ $? -ne 0 ]; then
+ return
+ fi
+
+ echo $! > tasks
+ signal_memcg_process $! $2
+ signal_memcg_process $! $2
+
+ check_mem_stat $3 $4
+
+ if [ $5 -eq 1 ]; then
+ echo 0 > $3
+ check_mem_stat $3 0
+ fi
+
+ stop_memcg_process $!
+}
+
+# make some memory allocation
+# $1 - the parameters of 'process', such as --shm
+# $2 - the -s parameter of 'process', such as 4096
+malloc_free_memory()
+{
+ tst_resm TINFO "Running memcg_process $1 -s $2"
+ memcg_process $1 -s $2 &
+ TST_CHECKPOINT_WAIT 0
+
+ echo $! > tasks
+ signal_memcg_process $! $2
+ signal_memcg_process $! $2
+
+ stop_memcg_process $!
+}
+
+# Test if failcnt > 0, which means page reclamation occured
+# $1 - item name in memcg
+test_failcnt()
+{
+ failcnt=`cat $1`
+ if [ $failcnt -gt 0 ]; then
+ tst_resm TPASS "$1 is $failcnt, > 0 as expected"
+ else
+ tst_resm TFAIL "$1 is $failcnt, <= 0 expected"
+ fi
}
# Test process will be killed due to exceed memory limit
@@ -261,27 +277,27 @@ test_mem_stat()
# $4 - use mem+swap limitation
test_proc_kill()
{
- local limit=$1
- local memtypes="$2"
- local size=$3
- local use_memsw=$4
- local tpk_iter
-
- echo $limit > memory.limit_in_bytes
- if [ $use_memsw -eq 1 ]; then
- memcg_require_memsw
- echo $limit > memory.memsw.limit_in_bytes
+ echo $1 > memory.limit_in_bytes
+ if [ $4 -eq 1 ]; then
+ if [ -e memory.memsw.limit_in_bytes ]; then
+ echo $1 > memory.memsw.limit_in_bytes
+ else
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
fi
- start_memcg_process $memtypes -s $size
- echo $MEMCG_PROCESS_PID > tasks
+ memcg_process $2 -s $3 &
+ pid=$!
+ TST_CHECKPOINT_WAIT 0
+ echo $pid > tasks
- signal_memcg_process $size
+ signal_memcg_process $pid $3
- local tpk_pid_exists=1
+ tpk_pid_exists=1
for tpk_iter in $(seq 20); do
- if [ ! -d "/proc/$MEMCG_PROCESS_PID" ] ||
- grep -q 'Z (zombie)' "/proc/$MEMCG_PROCESS_PID/status"; then
+ if [ ! -d "/proc/$pid" ] ||
+ grep -q 'Z (zombie)' "/proc/$pid/status"; then
tpk_pid_exists=0
break
fi
@@ -290,18 +306,18 @@ test_proc_kill()
done
if [ $tpk_pid_exists -eq 0 ]; then
- wait $MEMCG_PROCESS_PID
+ wait $pid
ret=$?
if [ $ret -eq 1 ]; then
- tst_res TFAIL "process $MEMCG_PROCESS_PID is killed by error"
+ tst_resm TFAIL "process $pid is killed by error"
elif [ $ret -eq 2 ]; then
- tst_res TPASS "Failed to lock memory"
+ tst_resm TPASS "Failed to lock memory"
else
- tst_res TPASS "process $MEMCG_PROCESS_PID is killed"
+ tst_resm TPASS "process $pid is killed"
fi
else
- stop_memcg_process
- tst_res TFAIL "process $MEMCG_PROCESS_PID is not killed"
+ stop_memcg_process $!
+ tst_resm TFAIL "process $pid is not killed"
fi
}
@@ -310,46 +326,229 @@ test_proc_kill()
# $2 - use mem+swap limitation
test_limit_in_bytes()
{
- local limit=$1
- local use_memsw=$2
- local elimit
-
- echo $limit > memory.limit_in_bytes
- if [ $use_memsw -eq 1 ]; then
- memcg_require_memsw
- echo $limit > memory.memsw.limit_in_bytes
- elimit=$(cat memory.memsw.limit_in_bytes)
+ echo $1 > memory.limit_in_bytes
+ if [ $2 -eq 1 ]; then
+ if [ -e memory.memsw.limit_in_bytes ]; then
+ echo $1 > memory.memsw.limit_in_bytes
+ limit=`cat memory.memsw.limit_in_bytes`
+ else
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
else
- elimit=$(cat memory.limit_in_bytes)
+ limit=`cat memory.limit_in_bytes`
fi
- # Kernels prior to 3.19 were rounding up,
- # but newer kernels are rounding down
- local limit_up=$(( PAGESIZE * (limit / PAGESIZE) ))
- local limit_down=$(( PAGESIZE * ((limit + PAGESIZE - 1) / PAGESIZE) ))
- if [ $limit_up -eq $elimit ] || [ $limit_down -eq $elimit ]; then
- tst_res TPASS "input=$limit, limit_in_bytes=$elimit"
+ # Kernels prior to 3.19 were rounding up but newer kernels
+ # are rounding down
+ if [ \( $(($PAGESIZE*($1/$PAGESIZE))) -eq $limit \) \
+ -o \( $(($PAGESIZE*(($1+$PAGESIZE-1)/$PAGESIZE))) -eq $limit \) ]; then
+ tst_resm TPASS "input=$1, limit_in_bytes=$limit"
else
- tst_res TFAIL "input=$limit, limit_in_bytes=$elimit"
+ tst_resm TFAIL "input=$1, limit_in_bytes=$limit"
fi
}
-memcg_testfunc()
+# Never used, so untested
+#
+# Test memory controller doesn't charge hugepage
+# $1 - the value of /proc/sys/vm/nr_hugepages
+# $2 - the parameters of 'process', --mmap-file or --shm
+# $3 - the -s parameter of 'process', such as $HUGEPAGESIZE
+# $4 - 0: expected failure, 1: expected success
+test_hugepage()
+{
+ TMP_FILE="$TMP_DIR/tmp"
+ nr_hugepages=`cat /proc/sys/vm/nr_hugepages`
+
+ mkdir /hugetlb
+ mount -t hugetlbfs none /hugetlb
+
+ echo $1 > /proc/sys/vm/nr_hugepages
+
+ memcg_process $2 --hugepage -s $3 > $TMP_FILE 2>&1 &
+ TST_CHECKPOINT_WAIT 0
+
+ signal_memcg_process $! $3
+
+ check_mem_stat "rss" 0
+
+ echo "TMP_FILE:"
+ cat $TMP_FILE
+
+ if [ $4 -eq 0 ]; then
+ test -s $TMP_FILE
+ if [ $? -eq 0 ]; then
+ tst_resm TPASS "allocate hugepage failed as expected"
+ else
+ signal_memcg_process $! $3
+ stop_memcg_process $!
+ tst_resm TFAIL "allocate hugepage should fail"
+ fi
+ else
+ test ! -s $TMP_FILE
+ if [ $? -eq 0 ]; then
+ signal_memcg_process $! $3
+ stop_memcg_process $!
+ tst_resm TPASS "allocate hugepage succeeded"
+ else
+ tst_resm TFAIL "allocate hugepage failed"
+ fi
+ fi
+
+ sleep 1
+ rm -rf $TMP_FILE
+ umount /hugetlb
+ rmdir /hugetlb
+ echo $nr_hugepages > /proc/sys/vm/nr_hugepages
+}
+
+# Test the memory charge won't move to subgroup
+# $1 - memory.limit_in_bytes in parent group
+# $2 - memory.limit_in_bytes in sub group
+test_subgroup()
+{
+ mkdir subgroup
+ echo $1 > memory.limit_in_bytes
+ echo $2 > subgroup/memory.limit_in_bytes
+
+ tst_resm TINFO "Running memcg_process --mmap-anon -s $PAGESIZES"
+ memcg_process --mmap-anon -s $PAGESIZES &
+ TST_CHECKPOINT_WAIT 0
+
+ warmup $! $PAGESIZES
+ if [ $? -ne 0 ]; then
+ return
+ fi
+
+ echo $! > tasks
+ signal_memcg_process $! $PAGESIZES
+ check_mem_stat "rss" $PAGESIZES
+
+ cd subgroup
+ echo $! > tasks
+ check_mem_stat "rss" 0
+
+ # cleanup
+ cd ..
+ echo $! > tasks
+ stop_memcg_process $!
+ rmdir subgroup
+}
+
+# Run test cases which test memory.move_charge_at_immigrate
+test_move_charge()
+{
+ local memtypes="$1"
+ local size=$2
+ local total_size=$3
+ local move_charge_mask=$4
+ local b_rss=$5
+ local b_cache=$6
+ local a_rss=$7
+ local a_cache=$8
+
+ mkdir subgroup_a
+
+ tst_resm TINFO "Running memcg_process $memtypes -s $size"
+ memcg_process $memtypes -s $size &
+ TST_CHECKPOINT_WAIT 0
+ warmup $!
+ if [ $? -ne 0 ]; then
+ rmdir subgroup_a
+ return
+ fi
+
+ echo $! > subgroup_a/tasks
+ signal_memcg_process $! $total_size "subgroup_a/"
+
+ mkdir subgroup_b
+ echo $move_charge_mask > subgroup_b/memory.move_charge_at_immigrate
+ echo $! > subgroup_b/tasks
+
+ cd subgroup_b
+ check_mem_stat "rss" $b_rss
+ check_mem_stat "cache" $b_cache
+ cd ../subgroup_a
+ check_mem_stat "rss" $a_rss
+ check_mem_stat "cache" $a_cache
+ cd ..
+ stop_memcg_process $!
+ rmdir subgroup_a subgroup_b
+}
+
+cleanup_test()
+{
+ TEST_ID="$1"
+
+ if [ -n "$orig_memory_use_hierarchy" ];then
+ echo $orig_memory_use_hierarchy > \
+ /dev/memcg/memory.use_hierarchy
+ if [ $? -ne 0 ];then
+ tst_resm TINFO "restore "\
+ "/dev/memcg/memory.use_hierarchy failed"
+ fi
+ orig_memory_use_hierarchy=""
+ fi
+
+ killall -9 memcg_process 2>/dev/null
+ wait
+
+ ROD cd "$TMP_DIR"
+
+ ROD rmdir "/dev/memcg/$TEST_ID"
+ TEST_ID=""
+ ROD umount /dev/memcg
+ ROD rmdir /dev/memcg
+}
+
+setup_test()
{
- ROD mkdir /dev/memcg/ltp_$$
- cd /dev/memcg/ltp_$$
+ TEST_ID="$1"
- if type ${MEMCG_TESTFUNC}1 > /dev/null 2>&1; then
- ${MEMCG_TESTFUNC}$1 $1 "$2"
+ ROD mkdir /dev/memcg
+ ROD mount -t cgroup -omemory memcg /dev/memcg
+
+ # The default value for memory.use_hierarchy is 0 and some of tests
+ # (memcg_stat_test.sh and memcg_use_hierarchy_test.sh) expect it so
+ # while there are distributions (RHEL7U0Beta for example) that sets
+ # it to 1.
+ orig_memory_use_hierarchy=$(cat /dev/memcg/memory.use_hierarchy)
+ if [ -z "$orig_memory_use_hierarchy" ];then
+ tst_resm TINFO "cat /dev/memcg/memory.use_hierarchy failed"
+ elif [ "$orig_memory_use_hierarchy" = "0" ];then
+ orig_memory_use_hierarchy=""
else
- ${MEMCG_TESTFUNC} $1 "$2"
+ echo 0 > /dev/memcg/memory.use_hierarchy
+ if [ $? -ne 0 ];then
+ tst_resm TINFO "set /dev/memcg/memory.use_hierarchy" \
+ "to 0 failed"
+ fi
fi
- cd $TST_TMPDIR
- ROD rmdir /dev/memcg/ltp_$$
+ ROD mkdir "/dev/memcg/$TEST_ID"
+ ROD cd "/dev/memcg/$TEST_ID"
}
-memcg_no_testfunc()
+# Run all the test cases
+run_tests()
{
- tst_brk TBROK "No testfunc specified, set MEMCG_TESTFUNC"
+ for i in $(seq 1 $TST_TOTAL); do
+
+ tst_resm TINFO "Starting test $i"
+
+ setup_test $i
+
+ if [ -e memory.memsw.limit_in_bytes ]; then
+ MEMSW_LIMIT_FLAG=1
+ fi
+
+ if [ -e memory.memsw.max_usage_in_bytes ]; then
+ MEMSW_USAGE_FLAG=1
+ fi
+
+ testcase_$i
+
+ cleanup_test $i
+ done
}
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_limit_in_bytes.sh b/testcases/kernel/controllers/memcg/functional/memcg_limit_in_bytes.sh
index 31892fd0e..fc7c6f2eb 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_limit_in_bytes.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_limit_in_bytes.sh
@@ -1,94 +1,103 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
-
-MEMCG_TESTFUNC=test
-MEMCG_SHMMAX=1
-TST_CNT=15
-. memcg_lib.sh
-TST_CLEANUP=cleanup
+################################################################################
+## ##
+## Copyright (c) 2009 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software Foundation, ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Li Zefan <lizf@cn.fujitsu.com> ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com> ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak ##
+## <risrajak@linux.vnet.ibm.com ##
+## ##
+################################################################################
+
+TCID="memcg_limit_in_bytes"
+TST_TOTAL=15
-cleanup()
-{
- memcg_cleanup
- swapon -a
-}
+. memcg_lib.sh
-test1()
+# Test mmap(locked) + alloc_mem > limit_in_bytes
+testcase_1()
{
- tst_res TINFO "Test mmap(locked) + alloc_mem > limit_in_bytes"
- test_proc_kill $PAGESIZE "--mmap-lock1" $((PAGESIZE * 2)) 0
+ test_proc_kill $PAGESIZE "--mmap-lock1" $((PAGESIZE*2)) 0
}
-test2()
+testcase_2()
{
- test_proc_kill $PAGESIZE "--mmap-lock2" $((PAGESIZE * 2)) 0
+ test_proc_kill $PAGESIZE "--mmap-lock2" $((PAGESIZE*2)) 0
}
-test3()
+# Test swapoff + alloc_mem > limit_in_bytes
+testcase_3()
{
- tst_res TINFO "Test swapoff + alloc_mem > limit_in_bytes"
swapoff -a
- test_proc_kill $PAGESIZE "--mmap-anon" $((PAGESIZE * 2)) 0
+ test_proc_kill $PAGESIZE "--mmap-anon" $((PAGESIZE*2)) 0
swapon -a
}
-test4()
+testcase_4()
{
swapoff -a
- test_proc_kill $PAGESIZE "--mmap-file" $((PAGESIZE * 2)) 0
+ test_proc_kill $PAGESIZE "--mmap-file" $((PAGESIZE*2)) 0
swapon -a
}
-test5()
+testcase_5()
{
swapoff -a
- test_proc_kill $PAGESIZE "--shm -k 18" $((PAGESIZE * 2)) 0
+ test_proc_kill $PAGESIZE "--shm -k 18" $((PAGESIZE*2)) 0
swapon -a
}
-test6()
+# Test limit_in_bytes == 0
+testcase_6()
{
- tst_res TINFO "Test limit_in_bytes == 0"
test_proc_kill 0 "--mmap-anon" $PAGESIZE 0
}
-test7()
+testcase_7()
{
test_proc_kill 0 "--mmap-file" $PAGESIZE 0
}
-test8()
+testcase_8()
{
test_proc_kill 0 "--shm -k 21" $PAGESIZE 0
}
-test9()
+# Test limit_in_bytes will be aligned to PAGESIZE
+testcase_9()
{
- tst_res TINFO "Test limit_in_bytes will be aligned to PAGESIZE"
- test_limit_in_bytes $((PAGESIZE - 1)) 0
+ test_limit_in_bytes $((PAGESIZE-1)) 0
}
-test10()
+testcase_10()
{
- test_limit_in_bytes $((PAGESIZE + 1)) 0
+ test_limit_in_bytes $((PAGESIZE+1)) 0
}
-test11()
+testcase_11()
{
test_limit_in_bytes 1 0
}
-test12()
+# Test invalid memory.limit_in_bytes
+testcase_12()
{
- tst_res TINFO "Test invalid memory.limit_in_bytes"
if tst_kvcmp -lt "2.6.31"; then
EXPECT_FAIL echo -1 \> memory.limit_in_bytes
else
@@ -96,19 +105,22 @@ test12()
fi
}
-test13()
+testcase_13()
{
EXPECT_FAIL echo 1.0 \> memory.limit_in_bytes
}
-test14()
+testcase_14()
{
EXPECT_FAIL echo 1xx \> memory.limit_in_bytes
}
-test15()
+testcase_15()
{
EXPECT_FAIL echo xx \> memory.limit_in_bytes
}
-tst_run
+shmmax_setup
+LOCAL_CLEANUP=shmmax_cleanup
+run_tests
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh
index 14daa4651..91112be20 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_max_usage_in_bytes_test.sh
@@ -1,77 +1,79 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+#
+# File : memcg_max_usage_in_bytes_test.sh
+# Description: Tests memory.max_usage_in_bytes.
+# Author: Peng Haitao <penght@cn.fujitsu.com>
+# History: 2012/01/17 - Created.
#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-MEMCG_TESTFUNC=test
-TST_CNT=4
+TCID="memcg_max_usage_in_bytes_test"
+TST_TOTAL=4
. memcg_lib.sh
-MEM_TO_ALLOC=$((PAGESIZE * 1024))
-MEM_LIMIT=$((MEM_TO_ALLOC * 2))
-
-# Run test cases which checks memory.[memsw.]max_usage_in_bytes after make
-# some memory allocation
-test_max_usage_in_bytes()
+# Test memory.max_usage_in_bytes
+testcase_1()
{
- local item="memory.max_usage_in_bytes"
- [ $1 -eq 1 ] && item="memory.memsw.max_usage_in_bytes"
- local check_after_reset=$2
- start_memcg_process --mmap-anon -s $MEM_TO_ALLOC
+ test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+ "memory.max_usage_in_bytes" $((PAGESIZE*1024)) 0
+}
- warmup
- if [ $? -ne 0 ]; then
+# Test memory.memsw.max_usage_in_bytes
+testcase_2()
+{
+ if [ "$MEMSW_USAGE_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
return
fi
- echo $MEMCG_PROCESS_PID > tasks
- signal_memcg_process $MEM_TO_ALLOC
- signal_memcg_process $MEM_TO_ALLOC
-
- check_mem_stat $item $MEM_TO_ALLOC
-
- if [ $check_after_reset -eq 1 ]; then
- echo 0 > $item
- check_mem_stat $item 0
- fi
-
- stop_memcg_process
+ echo $((PAGESIZE*2048)) > memory.limit_in_bytes
+ echo $((PAGESIZE*2048)) > memory.memsw.limit_in_bytes
+ test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+ "memory.memsw.max_usage_in_bytes" $((PAGESIZE*1024)) 0
}
-test1()
+# Test reset memory.max_usage_in_bytes
+testcase_3()
{
- tst_res TINFO "Test memory.max_usage_in_bytes"
- test_max_usage_in_bytes 0 0
+ test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+ "memory.max_usage_in_bytes" $((PAGESIZE*1024)) 1
}
-test2()
+# Test reset memory.memsw.max_usage_in_bytes
+testcase_4()
{
- tst_res TINFO "Test memory.memsw.max_usage_in_bytes"
- memcg_require_memsw
-
- echo $MEM_LIMIT > memory.limit_in_bytes
- echo $MEM_LIMIT > memory.memsw.limit_in_bytes
- test_max_usage_in_bytes 1 0
-}
+ if [ "$MEMSW_USAGE_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
-test3()
-{
- tst_res TINFO "Test reset memory.max_usage_in_bytes"
- test_max_usage_in_bytes 0 1
+ echo $((PAGESIZE*2048)) > memory.limit_in_bytes
+ echo $((PAGESIZE*2048)) > memory.memsw.limit_in_bytes
+ test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+ "memory.memsw.max_usage_in_bytes" $((PAGESIZE*1024)) 1
}
-test4()
-{
- tst_res TINFO "Test reset memory.memsw.max_usage_in_bytes"
- memcg_require_memsw
+run_tests
- echo $MEM_LIMIT > memory.limit_in_bytes
- echo $MEM_LIMIT > memory.memsw.limit_in_bytes
- test_max_usage_in_bytes 1 1
-}
+tst_exit
-tst_run
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_memsw_limit_in_bytes_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_memsw_limit_in_bytes_test.sh
index e9950a0df..ab3f8c845 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_memsw_limit_in_bytes_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_memsw_limit_in_bytes_test.sh
@@ -1,59 +1,82 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+#
+# File : memcg_memsw_limit_in_bytes_test.sh
+# Description: Tests memory.memsw.limit_in_bytes.
+# Author: Peng Haitao <penght@cn.fujitsu.com>
+# History: 2012/01/3 - Created.
#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-MEMCG_TESTFUNC=test
-TST_CNT=12
+TCID="memcg_memsw_limit_in_bytes_test"
+TST_TOTAL=12
. memcg_lib.sh
-test1()
+testcase_1()
{
test_proc_kill $PAGESIZE "--mmap-lock1" $((PAGESIZE*2)) 1
}
-test2()
+testcase_2()
{
test_proc_kill $PAGESIZE "--mmap-lock2" $((PAGESIZE*2)) 1
}
-test3()
+testcase_3()
{
test_proc_kill 0 "--mmap-anon" $PAGESIZE 1
}
-test4()
+testcase_4()
{
test_proc_kill 0 "--mmap-file" $PAGESIZE 1
}
-test5()
+testcase_5()
{
test_proc_kill 0 "--shm -k 21" $PAGESIZE 1
}
-test6()
+testcase_6()
{
- test_limit_in_bytes $((PAGESIZE - 1)) 1
+ test_limit_in_bytes $((PAGESIZE-1)) 1
}
-test7()
+testcase_7()
{
- test_limit_in_bytes $((PAGESIZE + 1)) 1
+ test_limit_in_bytes $((PAGESIZE+1)) 1
}
-test8()
+testcase_8()
{
test_limit_in_bytes 1 1
}
-test9()
+testcase_9()
{
- memcg_require_memsw
+ if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
echo 10M > memory.limit_in_bytes
@@ -64,28 +87,39 @@ test9()
fi
}
-test10()
+testcase_10()
{
- memcg_require_memsw
+ if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
echo 10M > memory.limit_in_bytes
EXPECT_FAIL echo 1.0 \> memory.memsw.limit_in_bytes
}
-test11()
+testcase_11()
{
- memcg_require_memsw
+ if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
echo 10M > memory.limit_in_bytes
EXPECT_FAIL echo 1xx \> memory.memsw.limit_in_bytes
}
-test12()
+testcase_12()
{
- memcg_require_memsw
+ if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
echo 10M > memory.limit_in_bytes
EXPECT_FAIL echo xx \> memory.memsw.limit_in_bytes
}
-tst_run
+run_tests
+
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_move_charge_at_immigrate_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_move_charge_at_immigrate_test.sh
index 272d77797..18c08644a 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_move_charge_at_immigrate_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_move_charge_at_immigrate_test.sh
@@ -1,83 +1,63 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2018 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+#
+# File : memcg_move_charge_at_immigrate_test.sh
+# Description: Tests memory.move_charge_at_immigrate.
+# Author: Peng Haitao <penght@cn.fujitsu.com>
+# History: 2012/01/16 - Created.
#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-MEMCG_TESTFUNC=test
-TST_CNT=4
+TCID="memcg_move_charge_at_immigrate_test"
+TST_TOTAL=4
. memcg_lib.sh
-
-# Run test cases which test memory.move_charge_at_immigrate
-test_move_charge()
-{
- local memtypes="$1"
- local size=$2
- local total_size=$3
- local move_charge_mask=$4
- local b_rss=$5
- local b_cache=$6
- local a_rss=$7
- local a_cache=$8
-
- mkdir subgroup_a
-
- start_memcg_process $memtypes -s $size
-
- warmup
- if [ $? -ne 0 ]; then
- rmdir subgroup_a
- return
- fi
-
- echo $MEMCG_PROCESS_PID > subgroup_a/tasks
- signal_memcg_process $total_size "subgroup_a/"
-
- mkdir subgroup_b
- echo $move_charge_mask > subgroup_b/memory.move_charge_at_immigrate
- echo $MEMCG_PROCESS_PID > subgroup_b/tasks
-
- cd subgroup_b
- check_mem_stat "rss" $b_rss
- check_mem_stat "cache" $b_cache
- cd ../subgroup_a
- check_mem_stat "rss" $a_rss
- check_mem_stat "cache" $a_cache
- cd ..
- stop_memcg_process
- rmdir subgroup_a subgroup_b
-}
-
-
-test1()
+# Test disable moving charges
+testcase_1()
{
- tst_res TINFO "Test disable moving charges"
test_move_charge "--mmap-anon" $PAGESIZES $PAGESIZES 0 0 0 $PAGESIZES 0
}
-test2()
+# Test move anon
+testcase_2()
{
- tst_res TINFO "Test move anon"
test_move_charge "--mmap-anon --shm --mmap-file" $PAGESIZES \
- $((PAGESIZES * 3)) 1 $PAGESIZES 0 0 $((PAGESIZES * 2))
+ $((PAGESIZES*3)) 1 $PAGESIZES 0 0 $((PAGESIZES*2))
}
-test3()
+# Test move file
+testcase_3()
{
- tst_res TINFO "Test move file"
test_move_charge "--mmap-anon --shm --mmap-file" $PAGESIZES \
- $((PAGESIZES * 3)) 2 0 $((PAGESIZES * 2)) $PAGESIZES 0
+ $((PAGESIZES*3)) 2 0 $((PAGESIZES*2)) $PAGESIZES 0
}
-test4()
+# Test move anon and file
+testcase_4()
{
- tst_res TINFO "Test move anon and file"
test_move_charge "--mmap-anon --shm" $PAGESIZES \
- $((PAGESIZES * 2)) 3 $PAGESIZES $PAGESIZES 0 0
+ $((PAGESIZES*2)) 3 $PAGESIZES $PAGESIZES 0 0
}
-tst_run
+run_tests
+
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_stat_rss.sh b/testcases/kernel/controllers/memcg/functional/memcg_stat_rss.sh
index 1a6128a6d..f6090edfd 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_stat_rss.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_stat_rss.sh
@@ -1,71 +1,89 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2018 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functinality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com
-MEMCG_TESTFUNC=test
-MEMCG_SHMMAX=1
-TST_CNT=10
+################################################################################
+## ##
+## Copyright (c) 2009 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software Foundation, ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Li Zefan <lizf@cn.fujitsu.com> ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com> ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak ##
+## <risrajak@linux.vnet.ibm.com ##
+## ##
+################################################################################
+
+TCID="memcg_stat_rss"
+TST_TOTAL=10
. memcg_lib.sh
# Test the management and counting of memory
-test1()
+testcase_1()
{
test_mem_stat "--mmap-anon" $PAGESIZES $PAGESIZES "rss" $PAGESIZES false
}
-test2()
+testcase_2()
{
test_mem_stat "--mmap-file" $PAGESIZE $PAGESIZE "rss" 0 false
}
-test3()
+testcase_3()
{
test_mem_stat "--shm -k 3" $PAGESIZE $PAGESIZE "rss" 0 false
}
-test4()
+testcase_4()
{
test_mem_stat "--mmap-anon --mmap-file --shm" \
- $PAGESIZES $((PAGESIZES * 3)) "rss" $PAGESIZES false
+ $PAGESIZES $((PAGESIZES*3)) "rss" $PAGESIZES false
}
-test5()
+testcase_5()
{
test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES "rss" $PAGESIZES false
}
-test6()
+testcase_6()
{
test_mem_stat "--mmap-anon" $PAGESIZES $PAGESIZES "rss" $PAGESIZES true
}
-test7()
+testcase_7()
{
test_mem_stat "--mmap-file" $PAGESIZE $PAGESIZE "rss" 0 true
}
-test8()
+testcase_8()
{
test_mem_stat "--shm -k 8" $PAGESIZE $PAGESIZE "rss" 0 true
}
-test9()
+testcase_9()
{
test_mem_stat "--mmap-anon --mmap-file --shm" \
- $PAGESIZES $((PAGESIZES * 3)) "rss" $PAGESIZES true
+ $PAGESIZES $((PAGESIZES*3)) "rss" $PAGESIZES true
}
-test10()
+testcase_10()
{
test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES "rss" $PAGESIZES true
}
-tst_run
+shmmax_setup
+LOCAL_CLEANUP=shmmax_cleanup
+run_tests
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_stat_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_stat_test.sh
index 925c4ecf8..09ee8bd8d 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_stat_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_stat_test.sh
@@ -1,116 +1,142 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2018 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+#
+# File : memcg_stat_test.sh
+# Description: Tests memory.stat.
+# Author: Peng Haitao <penght@cn.fujitsu.com>
+# History: 2012/01/16 - Created.
#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-MEMCG_TESTFUNC=test
-TST_CNT=8
+TCID="memcg_stat_test"
+TST_TOTAL=8
. memcg_lib.sh
-test1()
+# Test cache
+testcase_1()
{
- tst_res TINFO "Test cache"
test_mem_stat "--shm -k 3" $PAGESIZES $PAGESIZES "cache" $PAGESIZES false
}
-test2()
+# Test mapped_file
+testcase_2()
{
- tst_res TINFO "Test mapped_file"
test_mem_stat "--mmap-file" $PAGESIZES $PAGESIZES \
"mapped_file" $PAGESIZES false
}
-test3()
+# Test unevictable with MAP_LOCKED
+testcase_3()
{
- tst_res TINFO "Test unevictable with MAP_LOCKED"
- test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES \
- "unevictable" $PAGESIZES false
+ test_mem_stat "--mmap-lock1" $PAGESIZE $PAGESIZE \
+ "unevictable" $PAGESIZE false
}
-test4()
+# Test unevictable with mlock
+testcase_4()
{
- tst_res TINFO "Test unevictable with mlock"
- test_mem_stat "--mmap-lock2" $PAGESIZES $PAGESIZES \
- "unevictable" $PAGESIZES false
+ test_mem_stat "--mmap-lock2" $PAGESIZE $PAGESIZE \
+ "unevictable" $PAGESIZE false
}
-test5()
+# Test hierarchical_memory_limit with enabling hierarchical accounting
+testcase_5()
{
- tst_res TINFO "Test hierarchical_memory_limit with enabling hierarchical accounting"
echo 1 > memory.use_hierarchy
mkdir subgroup
- echo $PAGESIZES > memory.limit_in_bytes
- echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
+ echo $PAGESIZE > memory.limit_in_bytes
+ echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
cd subgroup
- check_mem_stat "hierarchical_memory_limit" $PAGESIZES
+ check_mem_stat "hierarchical_memory_limit" $PAGESIZE
cd ..
rmdir subgroup
}
-test6()
+# Test hierarchical_memory_limit with disabling hierarchical accounting
+testcase_6()
{
- tst_res TINFO "Test hierarchical_memory_limit with disabling hierarchical accounting"
- memcg_require_hierarchy_disabled
-
echo 0 > memory.use_hierarchy
mkdir subgroup
- echo $PAGESIZES > memory.limit_in_bytes
- echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
+ echo $PAGESIZE > memory.limit_in_bytes
+ echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
cd subgroup
- check_mem_stat "hierarchical_memory_limit" $((PAGESIZES * 2))
+ check_mem_stat "hierarchical_memory_limit" $((PAGESIZE*2))
cd ..
rmdir subgroup
}
-test7()
+# Test hierarchical_memsw_limit with enabling hierarchical accounting
+testcase_7()
{
- tst_res TINFO "Test hierarchical_memsw_limit with enabling hierarchical accounting"
- memcg_require_memsw
+ if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
- ROD echo 1 \> memory.use_hierarchy
+ echo 1 > memory.use_hierarchy
mkdir subgroup
- echo $PAGESIZES > memory.limit_in_bytes
- echo $PAGESIZES > memory.memsw.limit_in_bytes
- echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
- echo $((PAGESIZES * 2)) > subgroup/memory.memsw.limit_in_bytes
+ echo $PAGESIZE > memory.limit_in_bytes
+ echo $PAGESIZE > memory.memsw.limit_in_bytes
+ echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
+ echo $((PAGESIZE*2)) > subgroup/memory.memsw.limit_in_bytes
cd subgroup
- check_mem_stat "hierarchical_memsw_limit" $PAGESIZES
+ check_mem_stat "hierarchical_memsw_limit" $PAGESIZE
cd ..
rmdir subgroup
}
-test8()
+# Test hierarchical_memsw_limit with disabling hierarchical accounting
+testcase_8()
{
- tst_res TINFO "Test hierarchical_memsw_limit with disabling hierarchical accounting"
- memcg_require_memsw
- memcg_require_hierarchy_disabled
+ if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
- ROD echo 0 \> memory.use_hierarchy
+ echo 0 > memory.use_hierarchy
mkdir subgroup
- echo $PAGESIZES > memory.limit_in_bytes
- echo $PAGESIZES > memory.memsw.limit_in_bytes
- echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
- echo $((PAGESIZES * 2)) > subgroup/memory.memsw.limit_in_bytes
+ echo $PAGESIZE > memory.limit_in_bytes
+ echo $PAGESIZE > memory.memsw.limit_in_bytes
+ echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
+ echo $((PAGESIZE*2)) > subgroup/memory.memsw.limit_in_bytes
cd subgroup
- check_mem_stat "hierarchical_memsw_limit" $((PAGESIZES * 2))
+ check_mem_stat "hierarchical_memsw_limit" $((PAGESIZE*2))
cd ..
rmdir subgroup
}
-tst_run
+run_tests
+
+tst_exit
+
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh b/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh
index 9b23177a4..9b11f7b58 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_subgroup_charge.sh
@@ -1,63 +1,50 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functinality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com
-MEMCG_TESTFUNC=test
-TST_CNT=3
+################################################################################
+## ##
+## Copyright (c) 2009 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software Foundation, ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## Author: Li Zefan <lizf@cn.fujitsu.com> ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com> ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak ##
+## <risrajak@linux.vnet.ibm.com ##
+## ##
+################################################################################
+
+TCID="memcg_subgroup_charge"
+TST_TOTAL=3
. memcg_lib.sh
-# Test the memory charge won't move to subgroup
-# $1 - memory.limit_in_bytes in parent group
-# $2 - memory.limit_in_bytes in sub group
-test_subgroup()
+# Test that group and subgroup have no relationship
+testcase_1()
{
- mkdir subgroup
- echo $1 > memory.limit_in_bytes
- echo $2 > subgroup/memory.limit_in_bytes
-
- start_memcg_process --mmap-anon -s $PAGESIZES
-
- warmup
- if [ $? -ne 0 ]; then
- return
- fi
-
- echo $MEMCG_PROCESS_PID > tasks
- signal_memcg_process $PAGESIZES
- check_mem_stat "rss" $PAGESIZES
-
- cd subgroup
- echo $MEMCG_PROCESS_PID > tasks
- check_mem_stat "rss" 0
-
- # cleanup
- cd ..
- stop_memcg_process
- rmdir subgroup
-}
-
-test1()
-{
- tst_res TINFO "Test that group and subgroup have no relationship"
- test_subgroup $PAGESIZES $((2 * PAGESIZES))
+ test_subgroup $PAGESIZES $((2*PAGESIZES))
}
-test2()
+testcase_2()
{
test_subgroup $PAGESIZES $PAGESIZES
}
-test3()
+testcase_3()
{
test_subgroup $PAGESIZES 0
}
-tst_run
+run_tests
+tst_exit
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh
index e77d6bf2e..8e2e628dc 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_usage_in_bytes_test.sh
@@ -1,35 +1,58 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+#
+# File : memcg_usage_in_bytes_test.sh
+# Description: Tests memory.max_usage_in_bytes.
+# Author: Peng Haitao <penght@cn.fujitsu.com>
+# History: 2012/01/16 - Created.
#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-MEMCG_TESTFUNC=test
-TST_CNT=2
+TCID="memcg_usage_in_bytes_test"
+TST_TOTAL=2
. memcg_lib.sh
-MEM_TO_ALLOC=$((PAGESIZE * 1024))
-MEM_LIMIT=$((MEM_TO_ALLOC * 2))
-
-test1()
+# Test memory.usage_in_bytes
+testcase_1()
{
- tst_res TINFO "Test memory.usage_in_bytes"
- test_mem_stat "--mmap-anon" $MEM_TO_ALLOC $MEM_TO_ALLOC \
- "memory.usage_in_bytes" $MEM_TO_ALLOC false
+ test_mem_stat "--mmap-anon" $((PAGESIZE*1024)) $((PAGESIZE*1024)) \
+ "memory.usage_in_bytes" $((PAGESIZE*1024)) false
}
-test2()
+# Test memory.memsw.usage_in_bytes
+testcase_2()
{
- tst_res TINFO "Test memory.memsw.usage_in_bytes"
- memcg_require_memsw
+ if [ "$MEMSW_USAGE_FLAG" -eq 0 ]; then
+ tst_resm TCONF "mem+swap is not enabled"
+ return
+ fi
- echo $MEM_LIMIT > memory.limit_in_bytes
- echo $MEM_LIMIT > memory.memsw.limit_in_bytes
- test_mem_stat "--mmap-anon" $MEM_TO_ALLOC $MEM_TO_ALLOC \
- "memory.memsw.usage_in_bytes" $MEM_TO_ALLOC false
+ echo $((PAGESIZE*2048)) > memory.limit_in_bytes
+ echo $((PAGESIZE*2048)) > memory.memsw.limit_in_bytes
+ test_mem_stat "--mmap-anon" $((PAGESIZE*1024)) $((PAGESIZE*1024)) \
+ "memory.memsw.usage_in_bytes" $((PAGESIZE*1024)) false
}
-tst_run
+run_tests
+
+tst_exit
+
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_use_hierarchy_test.sh b/testcases/kernel/controllers/memcg/functional/memcg_use_hierarchy_test.sh
index 8be342499..4cf6b9fc2 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_use_hierarchy_test.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_use_hierarchy_test.sh
@@ -1,49 +1,62 @@
#! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+## ##
+## Copyright (c) 2012 FUJITSU LIMITED ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+#
+# File : memcg_use_hierarchy_test.sh
+# Description: Tests memory.use_hierarchy.
+# Author: Peng Haitao <penght@cn.fujitsu.com>
+# History: 2012/01/14 - Created.
#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
-MEMCG_TESTFUNC=test
-TST_CNT=3
+TCID="memcg_use_hierarchy_test"
+TST_TOTAL=3
. memcg_lib.sh
-test1()
+# test if one of the ancestors goes over its limit, the proces will be killed
+testcase_1()
{
- tst_res TINFO "test if one of the ancestors goes over its limit, the proces will be killed"
-
echo 1 > memory.use_hierarchy
echo $PAGESIZE > memory.limit_in_bytes
mkdir subgroup
cd subgroup
- test_proc_kill $((PAGESIZE * 3)) "--mmap-lock1" $((PAGESIZE * 2)) 0
+ test_proc_kill $((PAGESIZE*3)) "--mmap-lock1" $((PAGESIZE*2)) 0
cd ..
rmdir subgroup
}
-test2()
+# test Enabling will fail if the cgroup already has other cgroups
+testcase_2()
{
- tst_res TINFO "test Enabling will fail if the cgroup already has other cgroups"
-
- memcg_require_hierarchy_disabled
-
mkdir subgroup
EXPECT_FAIL echo 1 \> memory.use_hierarchy
rmdir subgroup
}
-test3()
+# test disabling will fail if the parent cgroup has enabled hierarchy.
+testcase_3()
{
- tst_res TINFO "test disabling will fail if the parent cgroup has enabled hierarchy"
-
- memcg_require_hierarchy_disabled
-
echo 1 > memory.use_hierarchy
mkdir subgroup
EXPECT_FAIL echo 0 \> subgroup/memory.use_hierarchy
@@ -51,4 +64,7 @@ test3()
rmdir subgroup
}
-tst_run
+run_tests
+
+tst_exit
+
diff --git a/testcases/kernel/controllers/memctl/run_memctl_test.sh b/testcases/kernel/controllers/memctl/run_memctl_test.sh
index 2e9620f60..fe171dfd0 100755
--- a/testcases/kernel/controllers/memctl/run_memctl_test.sh
+++ b/testcases/kernel/controllers/memctl/run_memctl_test.sh
@@ -114,7 +114,7 @@ echo "TEST $TEST_NUM: MEMORY CONTROLLER TESTING";
echo "RUNNING SETUP.....";
setup;
-# Trap the signal from any abnormally terminated task
+# Trap the signal from any abnormaly terminated task
# and kill all others and let cleanup be called
trap 'echo "signal caught from task"; killall memctl_task_*;\
cleanup; exit -1;' SIGUSR1;#??? may need changes here
@@ -253,7 +253,7 @@ case $TEST_NUM in
# and they will return non zero exit status. So Test broke!!
if [ $RC -ne 0 ]
then
- echo "Task $i exited abnormally with return value: $RC";
+ echo "Task $i exited abnormaly with return value: $RC";
tst_resm TINFO "Test could not execute for the expected duration";
cleanup;
exit -1;
diff --git a/testcases/kernel/crypto/.gitignore b/testcases/kernel/crypto/.gitignore
index 448f986a6..c5be01180 100644
--- a/testcases/kernel/crypto/.gitignore
+++ b/testcases/kernel/crypto/.gitignore
@@ -4,7 +4,6 @@ af_alg03
af_alg04
af_alg05
af_alg06
-af_alg07
pcrypt_aead01
crypto_user01
crypto_user02
diff --git a/testcases/kernel/crypto/Makefile b/testcases/kernel/crypto/Makefile
index 8175a346a..7cbdb72d1 100644
--- a/testcases/kernel/crypto/Makefile
+++ b/testcases/kernel/crypto/Makefile
@@ -21,6 +21,6 @@ CFLAGS += -D_GNU_SOURCE
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-af_alg02 af_alg07: CFLAGS += -pthread
+af_alg02: CFLAGS += -pthread
-af_alg07 crypto_user02: LDLIBS += -lrt
+crypto_user02: LDLIBS += -lrt
diff --git a/testcases/kernel/crypto/af_alg02.c b/testcases/kernel/crypto/af_alg02.c
index 31d30777c..fab0010c9 100644
--- a/testcases/kernel/crypto/af_alg02.c
+++ b/testcases/kernel/crypto/af_alg02.c
@@ -21,29 +21,14 @@
#include <pthread.h>
#include <errno.h>
-#define SALSA20_IV_SIZE 8
-#define SALSA20_MIN_KEY_SIZE 16
-
static void *verify_encrypt(void *arg)
{
- const uint8_t iv[SALSA20_IV_SIZE] = { 0 };
- const struct tst_alg_sendmsg_params params = {
- .encrypt = true,
- .iv = iv,
- .ivlen = SALSA20_IV_SIZE,
- };
char buf[16];
- int reqfd = tst_alg_setup_reqfd("skcipher", "salsa20", NULL,
- SALSA20_MIN_KEY_SIZE);
-
- /* Send a zero-length message to encrypt */
- tst_alg_sendmsg(reqfd, NULL, 0, &params);
+ int reqfd = tst_alg_setup_reqfd("skcipher", "salsa20", NULL, 16);
- /*
- * Read the zero-length encrypted data.
- * With the bug, the kernel crashed here.
- */
TST_CHECKPOINT_WAKE(0);
+
+ /* With the bug the kernel crashed here */
if (read(reqfd, buf, 16) == 0)
tst_res(TPASS, "Successfully \"encrypted\" an empty message");
else
diff --git a/testcases/kernel/crypto/af_alg05.c b/testcases/kernel/crypto/af_alg05.c
index e835b8a1f..df2b03546 100644
--- a/testcases/kernel/crypto/af_alg05.c
+++ b/testcases/kernel/crypto/af_alg05.c
@@ -35,11 +35,11 @@ static void run(void)
TEST(read(reqfd, buffer, 15));
if (TST_RET == 0)
- tst_res(TFAIL, "read() unexpectedly succeeded");
+ tst_res(TBROK, "read() unexpectedly succeeded");
else if (TST_ERR == EINVAL)
tst_res(TPASS, "read() expectedly failed with EINVAL");
else
- tst_res(TFAIL | TTERRNO, "read() failed with unexpected error");
+ tst_res(TBROK | TTERRNO, "read() failed with unexpected error");
close(reqfd);
}
diff --git a/testcases/kernel/crypto/af_alg07.c b/testcases/kernel/crypto/af_alg07.c
deleted file mode 100644
index ef13ad764..000000000
--- a/testcases/kernel/crypto/af_alg07.c
+++ /dev/null
@@ -1,135 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2019-8912
- *
- * Check for possible use-after-free in sockfs_setattr() on AF_ALG socket
- * closed by dup2() or dup3(). Unlike regular close(), dup*() syscalls don't
- * set sock->sk = NULL after closing the socket. Racing fchownat() against
- * dup2() may then result in sockfs_setattr() using the stale pointer and
- * writing into a block of released memory that may have been reused in the
- * mean time.
- *
- * The race window is small and it's hard to trigger a kernel crash but
- * fchownat() will return ENOENT as it should only when the bug is not
- * present. Race fixed specifically for af_alg in:
- *
- * commit 9060cb719e61b685ec0102574e10337fa5f445ea
- * Author: Mao Wenan <maowenan@huawei.com>
- * Date: Mon Feb 18 10:44:44 2019 +0800
- *
- * net: crypto set sk to NULL when af_alg_release.
- *
- * It was observed that the same bug is present on many other
- * protocols. A more general fix is in:
- *
- * commit ff7b11aa481f682e0e9711abfeb7d03f5cd612bf
- * Author: Eric Biggers <ebiggers@google.com>
- * Date: Thu Feb 21 14:13:56 2019 -0800
- *
- * net: socket: set sock->sk to NULL after calling proto_ops::release()
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <pwd.h>
-#include "lapi/fcntl.h"
-
-#include "tst_test.h"
-#include "tst_af_alg.h"
-#include "tst_fuzzy_sync.h"
-#include "tst_taint.h"
-
-static int fd = -1, sock = -1;
-static int uid, gid;
-static struct tst_fzsync_pair fzsync_pair;
-
-static void setup(void)
-{
- uid = getuid();
- gid = getgid();
-
- fd = SAFE_OPEN("tmpfile", O_RDWR | O_CREAT, 0644);
-
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- dup2(fd, sock);
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- sock = tst_alg_setup_reqfd("hash", "sha1", NULL, 0);
- tst_fzsync_start_race_a(&fzsync_pair);
- TEST(fchownat(sock, "", uid, gid, AT_EMPTY_PATH));
- tst_fzsync_end_race_a(&fzsync_pair);
- SAFE_CLOSE(sock);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
-
- if (TST_RET == -1 && TST_ERR == EBADF) {
- tst_fzsync_pair_add_bias(&fzsync_pair, 1);
- continue;
- }
-
- if (TST_RET == -1 && TST_ERR == ENOENT) {
- tst_res(TPASS | TTERRNO,
- "fchownat() failed successfully");
- return;
- }
-
- if (TST_RET == -1) {
- tst_brk(TBROK | TTERRNO,
- "fchownat() failed unexpectedly");
- }
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "Invalid fchownat() return value");
- }
- }
-
- tst_res(TFAIL, "fchownat() failed to fail, kernel may be vulnerable");
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzsync_pair);
-
- if (fd >= 0)
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .min_kver = "4.10.0",
- .min_cpus = 2,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "ff7b11aa481f"},
- {"linux-git", "9060cb719e61"},
- {"CVE", "2019-8912"},
- {}
- }
-};
diff --git a/testcases/kernel/crypto/crypto_user02.c b/testcases/kernel/crypto/crypto_user02.c
index a31c9f2b1..384e344f2 100644
--- a/testcases/kernel/crypto/crypto_user02.c
+++ b/testcases/kernel/crypto/crypto_user02.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2019 Google LLC
- * Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+ * Copyright 2019 Google LLC
*/
/*
@@ -27,65 +26,37 @@
#include "tst_crypto.h"
#include "tst_timer.h"
-/*
- * List of possible algorithms to use try (not exhaustive).
- * The algorithm has to be valid (i.e. the drivers must exists
- * and be a valid combination) and it has to be deleteable.
- * To be deletable it cannot be used by someone else.
- * The first algorithm, that fullfils the criteria is used for the test.
- */
-static const char * const ALGORITHM_CANDIDATES[] = {
- "hmac(sha1-generic)",
- "hmac(sha224-generic)",
- "hmac(sha256-generic)",
- "hmac(sha384-generic)",
- "hmac(md5-generic)"
-};
-
-static const char* algorithm = NULL;
static struct tst_crypto_session ses = TST_CRYPTO_SESSION_INIT;
-
static void setup(void)
{
- int rc;
- unsigned i;
- struct crypto_user_alg alg;
tst_crypto_open(&ses);
-
- /* find an algorithm, that is not in use */
- for (i = 0; i < ARRAY_SIZE(ALGORITHM_CANDIDATES); ++i) {
- memset(&alg, 0, sizeof(alg));
- strcpy(alg.cru_driver_name, ALGORITHM_CANDIDATES[i]);
-
- /* try to add it, to see if it is valid */
- rc = tst_crypto_add_alg(&ses, &alg);
- if (rc != 0)
- continue;
-
- /* it also has to be deletable */
- rc = tst_crypto_del_alg(&ses, &alg);
- if (rc == 0) {
- algorithm = ALGORITHM_CANDIDATES[i];
- break;
- }
- }
-
- if (!algorithm)
- tst_brk(TCONF, "No viable algorithm found");
}
static void run(void)
{
- struct crypto_user_alg alg = {};
+ struct crypto_user_alg alg = {
+ /*
+ * Any algorithm instantiated from a template can do here, but
+ * choose something that's commonly available.
+ */
+ .cru_driver_name = "hmac(sha256-generic)",
+ };
pid_t pid;
int status;
- strcpy(alg.cru_driver_name, algorithm);
+ /* Check whether the algorithm is supported before continuing. */
+ TEST(tst_crypto_add_alg(&ses, &alg));
+ if (TST_RET != 0 && TST_RET != -EEXIST) {
+ if (TST_RET == -ENOENT)
+ tst_brk(TCONF, "%s not supported", alg.cru_driver_name);
+
+ tst_brk(TBROK | TRERRNO,
+ "unexpected error checking for algorithm support");
+ }
tst_res(TINFO,
- "Starting crypto_user larval deletion test using algorithm %s. May crash buggy kernels.",
- algorithm);
+ "Starting crypto_user larval deletion test. May crash buggy kernels.");
tst_timer_start(CLOCK_MONOTONIC);
diff --git a/testcases/kernel/device-drivers/agp/kernel_space/Makefile b/testcases/kernel/device-drivers/agp/kernel_space/Makefile
index 5a10064f0..5357c135e 100644
--- a/testcases/kernel/device-drivers/agp/kernel_space/Makefile
+++ b/testcases/kernel/device-drivers/agp/kernel_space/Makefile
@@ -14,8 +14,8 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
endif
clean:
diff --git a/testcases/kernel/device-drivers/base/tbase/Makefile b/testcases/kernel/device-drivers/base/tbase/Makefile
index 5e5a40e61..6f7e5e2c1 100644
--- a/testcases/kernel/device-drivers/base/tbase/Makefile
+++ b/testcases/kernel/device-drivers/base/tbase/Makefile
@@ -13,8 +13,8 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
endif
clean:
diff --git a/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c b/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
index 17047c0d5..c7c8683a2 100644
--- a/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
+++ b/testcases/kernel/device-drivers/block/block_dev_kernel/ltp_block_dev.c
@@ -12,8 +12,6 @@
#include <linux/module.h>
#include <linux/device.h>
#include <linux/fs.h>
-#include <linux/genhd.h>
-#include <linux/blkdev.h>
MODULE_AUTHOR("Márton Németh <nm127@freemail.hu>");
MODULE_AUTHOR("Copyright (c) 2013 Oracle and/or its affiliates");
diff --git a/testcases/kernel/device-drivers/dev_sim_framework/kernel_space/Makefile b/testcases/kernel/device-drivers/dev_sim_framework/kernel_space/Makefile
index ccaf3f9ac..e7e7be607 100644
--- a/testcases/kernel/device-drivers/dev_sim_framework/kernel_space/Makefile
+++ b/testcases/kernel/device-drivers/dev_sim_framework/kernel_space/Makefile
@@ -13,8 +13,8 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
endif
clean:
diff --git a/testcases/kernel/device-drivers/drm/kernel_space/Makefile b/testcases/kernel/device-drivers/drm/kernel_space/Makefile
index 24b768d76..11e54d9be 100644
--- a/testcases/kernel/device-drivers/drm/kernel_space/Makefile
+++ b/testcases/kernel/device-drivers/drm/kernel_space/Makefile
@@ -11,7 +11,7 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif
clean:
diff --git a/testcases/kernel/device-drivers/include/Makefile b/testcases/kernel/device-drivers/include/Makefile
index 72d7293c2..c9810ba5e 100644
--- a/testcases/kernel/device-drivers/include/Makefile
+++ b/testcases/kernel/device-drivers/include/Makefile
@@ -13,9 +13,9 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
${CC} -Wall -o userBlockInclude userBlockInclude.c
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
endif
clean:
diff --git a/testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile b/testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile
index ae802f77c..3bc274dad 100644
--- a/testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile
+++ b/testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile
@@ -9,16 +9,16 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
- $(MAKE) -C $(KDIR) M=$(PWD) clean
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
rm -f modules.order
help:
- $(MAKE) -C $(KDIR) M=$(PWD) help
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) help
modules_install:
- $(MAKE) -C $(KDIR) M=$(PWD) modules_install
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
endif
diff --git a/testcases/kernel/device-drivers/nls/Makefile b/testcases/kernel/device-drivers/nls/Makefile
index a1fab20f8..172510fe8 100644
--- a/testcases/kernel/device-drivers/nls/Makefile
+++ b/testcases/kernel/device-drivers/nls/Makefile
@@ -12,12 +12,12 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
${CC} $(EXTRA_CFLAGS) -o userBlockNLS userBlockNLS.c
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
clean:
- $(MAKE) -C $(KDIR) M=$(PWD) clean
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
rm -f modules.order
rm -f userBlockNLS
diff --git a/testcases/kernel/device-drivers/pci/tpci_kernel/Makefile b/testcases/kernel/device-drivers/pci/tpci_kernel/Makefile
index 6e1284d6c..02496afb8 100644
--- a/testcases/kernel/device-drivers/pci/tpci_kernel/Makefile
+++ b/testcases/kernel/device-drivers/pci/tpci_kernel/Makefile
@@ -32,4 +32,4 @@ MAKE_TARGETS := ltp_tpci.ko
include $(top_srcdir)/include/mk/module.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-endif
+endif \ No newline at end of file
diff --git a/testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c b/testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c
index 5b48aa0c7..2cf8cefc8 100644
--- a/testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c
+++ b/testcases/kernel/device-drivers/pci/tpci_kernel/ltp_tpci.c
@@ -61,7 +61,7 @@ MODULE_LICENSE("GPL");
#define TFAIL 1
#define TSKIP 32
-static const struct pci_device_id ltp_pci_tbl[] = {
+static DEFINE_PCI_DEVICE_TABLE(ltp_pci_tbl) = {
{ PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID) },
{ 0, }
};
@@ -104,7 +104,7 @@ static int probe_pci_dev(unsigned int bus, unsigned int slot)
ltp_pci.dev = NULL;
}
- dev = pci_get_domain_bus_and_slot(0, bus, slot);
+ dev = pci_get_bus_and_slot(bus, slot);
if (!dev || !dev->driver)
return -ENODEV;
@@ -290,6 +290,7 @@ static int test_find_subsys(void)
*/
static int test_scan_bus(void)
{
+#ifdef CONFIG_HOTPLUG
int num;
struct pci_bus *bus = ltp_pci.bus;
@@ -306,6 +307,10 @@ static int test_scan_bus(void)
}
prk_info("success scan bus");
return TPASS;
+#else
+ prk_info("pci_rescan_bus() is not supported");
+ return TSKIP;
+#endif
}
/*
@@ -321,9 +326,6 @@ static int test_slot_scan(void)
prk_info("scan pci slot");
- if ((num % 8) != 0)
- return TPASS;
-
ret = pci_scan_slot(bus, num);
if (ret >= 0) {
prk_info("found '%d' devices from scan slot", ret);
@@ -359,6 +361,29 @@ static int test_bus_add_devices(void)
}
/*
+ * test_enable_bridges
+ * make call to pci_enable_bridges,
+ * use bus pointer from the ltp_pci
+ * structure
+ */
+static int test_enable_bridges(void)
+{
+ struct pci_bus *bus = ltp_pci.bus;
+
+ prk_info("enable bridges");
+
+ pci_enable_bridges(bus);
+
+ if (bus) {
+ prk_info("called enable bridges");
+ return TPASS;
+ }
+
+ prk_err("enable_bridges failed");
+ return TFAIL;
+}
+
+/*
* test_match_device
* make call to pci_match_device, returns a
* pci_device_id pointer
@@ -584,6 +609,9 @@ static int test_case(unsigned int cmd)
case BUS_ADD_DEVICES:
rc = test_bus_add_devices();
break;
+ case ENABLE_BRIDGES:
+ rc = test_enable_bridges();
+ break;
case MATCH_DEVICE:
rc = test_match_device();
break;
diff --git a/testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h b/testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h
index f7defb29f..f65c6fc22 100644
--- a/testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h
+++ b/testcases/kernel/device-drivers/pci/tpci_kernel/tpci.h
@@ -30,6 +30,7 @@ enum PCI_TCASES {
FIND_SUBSYS,
BUS_SCAN,
SLOT_SCAN,
+ ENABLE_BRIDGES,
BUS_ADD_DEVICES,
MATCH_DEVICE,
REG_DRIVER,
diff --git a/testcases/kernel/device-drivers/rtc/.gitignore b/testcases/kernel/device-drivers/rtc/.gitignore
index 0c0161eba..8412fe679 100644
--- a/testcases/kernel/device-drivers/rtc/.gitignore
+++ b/testcases/kernel/device-drivers/rtc/.gitignore
@@ -1,2 +1 @@
/rtc01
-/rtc02
diff --git a/testcases/kernel/device-drivers/rtc/rtc02.c b/testcases/kernel/device-drivers/rtc/rtc02.c
deleted file mode 100644
index ef83aad89..000000000
--- a/testcases/kernel/device-drivers/rtc/rtc02.c
+++ /dev/null
@@ -1,110 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Unisoc Communications Inc.
- */
-
-/*\
- * [Description]
- *
- * RTC device set time function test.
- *
- * [Algorithm]
- *
- * - Save RTC time
- * - Set RTC time
- * - Read the RTC time back
- * - Check if the set time and the read time are identical
- * - Restore RTC time
- */
-
-#include <stdio.h>
-#include "tst_rtctime.h"
-#include "tst_wallclock.h"
-#include "tst_test.h"
-
-static char *rtc_dev = "/dev/rtc";
-
-static char *rtctime_to_str(struct rtc_time *tm)
-{
- static char rtctime_buf[128];
-
- sprintf(rtctime_buf, "%04d-%02d-%02d %02d:%02d:%02d",
- tm->tm_year + 1900,
- tm->tm_mon + 1,
- tm->tm_mday,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec);
- return rtctime_buf;
-}
-
-static int rtc_tm_cmp(struct rtc_time *set_tm, struct rtc_time *read_tm)
-{
- return !((set_tm->tm_sec == read_tm->tm_sec)
- && (set_tm->tm_min == read_tm->tm_min)
- && (set_tm->tm_hour == read_tm->tm_hour)
- && (set_tm->tm_mday == read_tm->tm_mday)
- && (set_tm->tm_mon == read_tm->tm_mon)
- && (set_tm->tm_year == read_tm->tm_year));
-}
-
-static void set_rtc_test(void)
-{
- struct rtc_time read_tm;
- int ret;
-
- struct rtc_time set_tm = {
- .tm_sec = 30,
- .tm_min = 23,
- .tm_hour = 13,
- .tm_mday = 9,
- .tm_mon = 9,
- .tm_year = 120,
- };
-
- /* set rtc to 2020.10.9 13:23:30 */
- tst_res(TINFO, "To set RTC date/time is: %s", rtctime_to_str(&set_tm));
-
- ret = tst_rtc_settime(rtc_dev, &set_tm);
- if (ret != 0) {
- tst_res(TFAIL | TERRNO, "ioctl() RTC_SET_TIME");
- return;
- }
-
- /* Read current RTC Time */
- ret = tst_rtc_gettime(rtc_dev, &read_tm);
- if (ret != 0) {
- tst_res(TFAIL | TERRNO, "ioctl() RTC_RD_TIME");
- return;
- }
- tst_res(TINFO, "read RTC date/time is: %s", rtctime_to_str(&read_tm));
-
- if (rtc_tm_cmp(&set_tm, &read_tm)) {
- tst_res(TFAIL, "RTC SET TEST");
- return;
- }
- tst_res(TPASS, "The read RTC time is consistent with set time");
-
-}
-
-static void rtc_setup(void)
-{
- int exists = access(rtc_dev, F_OK);
-
- if (exists < 0)
- tst_brk(TCONF, "RTC device %s not available", rtc_dev);
-
- tst_rtc_clock_save(rtc_dev);
-}
-
-static void rtc_cleanup(void)
-{
- tst_rtc_clock_restore(rtc_dev);
-}
-
-static struct tst_test test = {
- .setup = rtc_setup,
- .test_all = set_rtc_test,
- .cleanup = rtc_cleanup,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/device-drivers/usb/tusb/Makefile b/testcases/kernel/device-drivers/usb/tusb/Makefile
index 4dcbca36c..9488cd563 100644
--- a/testcases/kernel/device-drivers/usb/tusb/Makefile
+++ b/testcases/kernel/device-drivers/usb/tusb/Makefile
@@ -13,17 +13,17 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
clean:
- $(MAKE) -C $(KDIR) M=$(PWD) clean
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
rm -f modules.order
help:
- $(MAKE) -C $(KDIR) M=$(PWD) help
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) help
modules_install:
- $(MAKE) -C $(KDIR) M=$(PWD) modules_install
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
endif
diff --git a/testcases/kernel/device-drivers/v4l/kernel_space/Makefile b/testcases/kernel/device-drivers/v4l/kernel_space/Makefile
index 549c37d5c..56e255b04 100644
--- a/testcases/kernel/device-drivers/v4l/kernel_space/Makefile
+++ b/testcases/kernel/device-drivers/v4l/kernel_space/Makefile
@@ -9,16 +9,16 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
- $(MAKE) -C $(KDIR) M=$(PWD) clean
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
rm -f modules.order
help:
- $(MAKE) -C $(KDIR) M=$(PWD) help
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) help
modules_install:
- $(MAKE) -C $(KDIR) M=$(PWD) modules_install
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
endif
diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
index ad9a9a2be..7f855ef37 100755
--- a/testcases/kernel/device-drivers/zram/zram01.sh
+++ b/testcases/kernel/device-drivers/zram/zram01.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2019-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
#
# Test creates several zram devices with different filesystems on them.
@@ -10,23 +10,23 @@ TST_CNT=7
TST_TESTFUNC="do_test"
TST_NEEDS_CMDS="awk bc dd"
. zram_lib.sh
-TST_SETUP="setup"
-check_space_for_btrfs()
-{
- local ram_size
+# Test will create the following number of zram devices:
+dev_num=4
+# This is a list of parameters for zram devices.
+# Number of items must be equal to 'dev_num' parameter.
+zram_max_streams="2 3 5 8"
- ram_size=$(awk '/MemTotal:/ {print $2}' /proc/meminfo)
- if [ "$ram_size" -lt 1048576 ]; then
- tst_res TINFO "not enough space for Btrfs"
- return 1
- fi
- return 0
-}
+FS_SIZE="402653184"
+FS_TYPE="btrfs"
+
+RAM_SIZE=$(awk '/MemTotal:/ {print $2}' /proc/meminfo)
+if [ "$RAM_SIZE" -lt 1048576 ]; then
+ tst_res TINFO "not enough space for Btrfs"
+ FS_SIZE="26214400"
+ FS_TYPE="ext2"
+fi
-# List of parameters for zram devices.
-# For each number the test creates own zram device.
-# NOTE about size:
# The zram sysfs node 'disksize' value can be either in bytes,
# or you can use mem suffixes. But in some old kernels, mem
# suffixes are not supported, for example, in RHEL6.6GA's kernel
@@ -34,71 +34,10 @@ check_space_for_btrfs()
# not support mem suffixes, in some newer kernels, they use
# memparse() which supports mem suffixes. So here we just use
# bytes to make sure everything works correctly.
-initialize_vars()
-{
- local fs limit size stream=-1
- dev_num=0
-
- for fs in $(tst_supported_fs); do
- [ "$fs" = "tmpfs" ] && continue
- size="26214400"
- limit="25M"
- if [ "$fs" = "btrfs" ]; then
- check_space_for_btrfs || continue
- size="402653184"
- limit="$((size/1024/1024))M"
- fi
-
- stream=$((stream+3))
- dev_num=$((dev_num+1))
- zram_filesystems="$zram_filesystems $fs"
- zram_mem_limits="$zram_mem_limits $limit"
- zram_sizes="$zram_sizes $size"
- zram_max_streams="$zram_max_streams $stream"
- done
-
- [ $dev_num -eq 0 ] && \
- tst_brk TCONF "no suitable filesystem"
-}
-
-setup()
-{
- initialize_vars
- zram_load
-}
-
-zram_makefs()
-{
- local i=0
- local fs
-
- for fs in $zram_filesystems; do
- tst_res TINFO "make $fs filesystem on /dev/zram$i"
- mkfs.$fs /dev/zram$i > err.log 2>&1
- if [ $? -ne 0 ]; then
- cat err.log
- tst_brk TFAIL "failed to make $fs on /dev/zram$i"
- fi
-
- i=$(($i + 1))
- done
-
- tst_res TPASS "zram_makefs succeeded"
-}
-
-zram_mount()
-{
- local i=0
-
- for i in $(seq 0 $(($dev_num - 1))); do
- tst_res TINFO "mount /dev/zram$i"
- mkdir zram$i
- ROD mount /dev/zram$i zram$i
- dev_mounted=$i
- done
-
- tst_res TPASS "mount of zram device(s) succeeded"
-}
+zram_sizes="26214400 26214400 26214400 $FS_SIZE"
+zram_mem_limits="25M 25M 25M $((FS_SIZE/1024/1024))M"
+zram_filesystems="ext3 ext4 xfs $FS_TYPE"
+zram_algs="lzo lzo lzo lzo"
zram_fill_fs()
{
diff --git a/testcases/kernel/device-drivers/zram/zram02.sh b/testcases/kernel/device-drivers/zram/zram02.sh
index f0421ce7f..f97cf646c 100755
--- a/testcases/kernel/device-drivers/zram/zram02.sh
+++ b/testcases/kernel/device-drivers/zram/zram02.sh
@@ -1,16 +1,18 @@
#!/bin/sh
# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2019-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
#
# Test checks that we can create swap zram device.
-TST_CNT=6
+TST_CNT=5
TST_TESTFUNC="do_test"
. zram_lib.sh
-# List of parameters for zram devices.
-# For each number the test creates own zram device.
+# Test will create the following number of zram devices:
+dev_num=1
+# This is a list of parameters for zram devices.
+# Number of items must be equal to 'dev_num' parameter.
zram_max_streams="2"
# The zram sysfs node 'disksize' value can be either in bytes,
@@ -23,44 +25,14 @@ zram_max_streams="2"
zram_sizes="107374182400" # 100GB
zram_mem_limits="1M"
-zram_makeswap()
-{
- tst_res TINFO "make swap with zram device(s)"
- tst_require_cmds mkswap swapon swapoff
- local i=0
-
- for i in $(seq 0 $(($dev_num - 1))); do
- ROD mkswap /dev/zram$i
- ROD swapon /dev/zram$i
- tst_res TINFO "done with /dev/zram$i"
- dev_makeswap=$i
- done
-
- tst_res TPASS "making zram swap succeeded"
-}
-
-zram_swapoff()
-{
- tst_require_cmds swapoff
- local i
-
- for i in $(seq 0 $dev_makeswap); do
- ROD swapoff /dev/zram$i
- done
- dev_makeswap=-1
-
- tst_res TPASS "swapoff completed"
-}
-
do_test()
{
case $1 in
1) zram_max_streams;;
- 2) zram_compress_alg;;
- 3) zram_set_disksizes;;
- 4) zram_set_memlimit;;
- 5) zram_makeswap;;
- 6) zram_swapoff;;
+ 2) zram_set_disksizes;;
+ 3) zram_set_memlimit;;
+ 4) zram_makeswap;;
+ 5) zram_swapoff;;
esac
}
diff --git a/testcases/kernel/device-drivers/zram/zram_lib.sh b/testcases/kernel/device-drivers/zram/zram_lib.sh
index fe9c915c3..68b933cc4 100755
--- a/testcases/kernel/device-drivers/zram/zram_lib.sh
+++ b/testcases/kernel/device-drivers/zram/zram_lib.sh
@@ -1,16 +1,14 @@
#!/bin/sh
# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2019-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
dev_makeswap=-1
dev_mounted=-1
TST_NEEDS_TMPDIR=1
-TST_NEEDS_ROOT=1
TST_SETUP="zram_load"
TST_CLEANUP="zram_cleanup"
-TST_NEEDS_DRIVERS="zram"
. tst_test.sh
zram_cleanup()
@@ -34,23 +32,7 @@ zram_cleanup()
zram_load()
{
- local tmp
-
- if [ -z "$dev_num" ]; then
- dev_num=0
- for tmp in $zram_max_streams; do
- dev_num=$((dev_num+1))
- done
- fi
-
- if [ $dev_num -le 0 ]; then
- tst_brk TBROK "dev_num must be > 0"
- fi
-
- tst_set_timeout $((dev_num*450))
-
tst_res TINFO "create '$dev_num' zram device(s)"
-
modprobe zram num_devices=$dev_num || \
tst_brk TBROK "failed to insert zram module"
@@ -58,9 +40,9 @@ zram_load()
if [ "$dev_num_created" -ne "$dev_num" ]; then
tst_brk TFAIL "unexpected num of devices: $dev_num_created"
+ else
+ tst_res TPASS "test succeeded"
fi
-
- tst_res TPASS "all zram devices successfully created"
}
zram_max_streams()
@@ -103,18 +85,15 @@ zram_compress_alg()
local i=0
tst_res TINFO "test that we can set compression algorithm"
- local algs="$(sed 's/[][]//g' /sys/block/zram0/comp_algorithm)"
+ local algs="$(cat /sys/block/zram0/comp_algorithm)"
tst_res TINFO "supported algs: $algs"
- local dev_max=$(($dev_num - 1))
-
- for i in $(seq 0 $dev_max); do
- for alg in $algs; do
- local sys_path="/sys/block/zram${i}/comp_algorithm"
- echo "$alg" > $sys_path || \
- tst_brk TFAIL "can't set '$alg' to $sys_path"
- tst_res TINFO "$sys_path = '$alg' ($i/$dev_max)"
- done
+ for alg in $zram_algs; do
+ local sys_path="/sys/block/zram${i}/comp_algorithm"
+ echo "$alg" > $sys_path || \
+ tst_brk TFAIL "can't set '$alg' to $sys_path"
+ i=$(($i + 1))
+ tst_res TINFO "$sys_path = '$alg' ($i/$dev_num)"
done
tst_res TPASS "test succeeded"
@@ -163,3 +142,71 @@ zram_set_memlimit()
tst_res TPASS "test succeeded"
}
+
+zram_makeswap()
+{
+ tst_res TINFO "make swap with zram device(s)"
+ tst_require_cmds mkswap swapon swapoff
+ local i=0
+
+ for i in $(seq 0 $(($dev_num - 1))); do
+ ROD mkswap /dev/zram$i
+ ROD swapon /dev/zram$i
+ tst_res TINFO "done with /dev/zram$i"
+ dev_makeswap=$i
+ done
+
+ tst_res TPASS "making zram swap succeeded"
+}
+
+zram_swapoff()
+{
+ tst_require_cmds swapoff
+ local i
+
+ for i in $(seq 0 $dev_makeswap); do
+ ROD swapoff /dev/zram$i
+ done
+ dev_makeswap=-1
+
+ tst_res TPASS "swapoff completed"
+}
+
+zram_makefs()
+{
+ tst_require_cmds mkfs
+ local i=0
+
+ for fs in $zram_filesystems; do
+ # if requested fs not supported default it to ext2
+ tst_supported_fs $fs 2> /dev/null || fs=ext2
+
+ tst_res TINFO "make $fs filesystem on /dev/zram$i"
+ mkfs.$fs /dev/zram$i > err.log 2>&1
+ if [ $? -ne 0 ]; then
+ cat err.log
+ tst_brk TFAIL "failed to make $fs on /dev/zram$i"
+ fi
+
+ i=$(($i + 1))
+ done
+
+ tst_res TPASS "zram_makefs succeeded"
+}
+
+zram_mount()
+{
+ local i=0
+
+ for i in $(seq 0 $(($dev_num - 1))); do
+ tst_res TINFO "mount /dev/zram$i"
+ mkdir zram$i
+ ROD mount /dev/zram$i zram$i
+ dev_mounted=$i
+ done
+
+ tst_res TPASS "mount of zram device(s) succeeded"
+}
+
+modinfo zram > /dev/null 2>&1 ||
+ tst_brk TCONF "zram not configured in kernel"
diff --git a/testcases/kernel/fs/fsstress/fsstress.c b/testcases/kernel/fs/fsstress/fsstress.c
index 42ee696a5..811e6ff14 100644
--- a/testcases/kernel/fs/fsstress/fsstress.c
+++ b/testcases/kernel/fs/fsstress/fsstress.c
@@ -280,7 +280,7 @@ void usage(void);
void write_freq(void);
void zero_freq(void);
-void sg_handler(int signum __attribute__((unused)))
+void sg_handler(int signum)
{
should_stop = 1;
}
@@ -2501,7 +2501,7 @@ void symlink_f(int opno, long r)
}
/* ARGSUSED */
-void sync_f(int opno, long r __attribute__((unused)))
+void sync_f(int opno, long r)
{
sync();
if (verbose)
diff --git a/testcases/kernel/fs/fsx-linux/fsx-linux.c b/testcases/kernel/fs/fsx-linux/fsx-linux.c
index 4a20f4da6..02f3eb827 100644
--- a/testcases/kernel/fs/fsx-linux/fsx-linux.c
+++ b/testcases/kernel/fs/fsx-linux/fsx-linux.c
@@ -43,7 +43,7 @@
#include <sys/param.h>
#include <limits.h>
#include <time.h>
-#include <string.h>
+#include <strings.h>
#include <sys/time.h>
#endif
#include <fcntl.h>
diff --git a/testcases/kernel/fs/ftest/Makefile b/testcases/kernel/fs/ftest/Makefile
index 7108272c2..1566c5c31 100644
--- a/testcases/kernel/fs/ftest/Makefile
+++ b/testcases/kernel/fs/ftest/Makefile
@@ -1,7 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
#
-# Copyright (C) 2009, Cisco Systems Inc.
-# Copyright (C) Ngie Cooper, July 2009
+# kernel/fs/ftest testcases Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Ngie Cooper, July 2009
+#
top_srcdir ?= ../../../..
@@ -11,4 +28,4 @@ FILTER_OUT_MAKE_TARGETS := libftest
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: libftest.o
+$(MAKE_TARGETS): %: %.o libftest.o
diff --git a/testcases/kernel/fs/inode/inode02.c b/testcases/kernel/fs/inode/inode02.c
index 43e406d54..85598b2fc 100644
--- a/testcases/kernel/fs/inode/inode02.c
+++ b/testcases/kernel/fs/inode/inode02.c
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
parent_pid = getpid();
if (sigset(SIGTERM, (void (*)())term) == SIG_ERR) {
- tst_resm(TBROK, "\tSIGTERM sigset set failed, errno=%d",
+ tst_resm(TBROK, "\tSIGTERM sigset set failed, errno=%d\n",
errno);
exit(1);
}
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
file_length = 8;
nchild = 5;
} else if (argc < 5) {
- tst_resm(TCONF, "Bad argument count.");
+ tst_resm(TCONF, "Bad argument count.\n");
printf
("\tinode02 max_depth max_breadth file_length #children\n\tdefault: inode02 6 5 8 5\n");
exit(1);
@@ -198,8 +198,8 @@ int main(int argc, char *argv[])
}
if (count != nchild) {
- tst_resm(TFAIL, "Wrong number of children waited on!");
- tst_resm(TFAIL, "Saw %d, expected %d", count, nchild);
+ tst_resm(TFAIL, "Wrong number of children waited on!\n");
+ tst_resm(TFAIL, "Saw %d, expected %d\n", count, nchild);
local_flag = FAILED;
}
@@ -837,7 +837,7 @@ void setup(void)
*/
void fail_exit(void)
{
- tst_brkm(TFAIL, tst_rmdir, "Test failed");
+ tst_brkm(TFAIL, tst_rmdir, "Test failed\n");
}
/*
@@ -872,7 +872,7 @@ void ok_exit(void)
*/
void forkfail(void)
{
- tst_brkm(TBROK, tst_rmdir, "Reason: %s", strerror(errno));
+ tst_brkm(TBROK, tst_rmdir, "Reason: %s\n", strerror(errno));
}
/*
@@ -884,7 +884,7 @@ void forkfail(void)
*/
void terror(char *message)
{
- tst_resm(TBROK, "Reason: %s:%s", message, strerror(errno));
+ tst_resm(TBROK, "Reason: %s:%s\n", message, strerror(errno));
return;
}
diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index 1d2ebe03e..9de3f7cdc 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -1,40 +1,27 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2003
-# Copyright (c) Linux Test Project, 2016-2021
# Written by Prakash Narayana (prakashn@us.ibm.com)
# and Michael Reed (mreed10@us.ibm.com)
+# Copyright (c) Linux Test Project, 2016-2019
#
# Test isofs on Linux system.
# It makes ISO9660 file system with different options and also
# mounts ISO9660 file system with different mount options.
-TST_NEEDS_CMDS="mount umount"
+TST_NEEDS_CMDS="mkisofs"
TST_NEEDS_TMPDIR=1
-TST_SETUP=setup
TST_TESTFUNC=do_test
-
. tst_test.sh
MAX_DEPTH=3
MAX_DIRS=4
-setup()
-{
- if tst_cmd_available mkisofs; then
- MKISOFS_CMD="mkisofs"
- elif tst_cmd_available genisoimage; then
- MKISOFS_CMD="genisoimage"
- else
- tst_brk TCONF "please install mkisofs or genisoimage"
- fi
-}
-
gen_fs_tree()
{
local cur_path="$1"
local cur_depth="$2"
- local i new_path
+ local new_path
[ "$cur_depth" -gt "$MAX_DEPTH" ] && return
@@ -46,11 +33,9 @@ gen_fs_tree()
done
}
-do_test()
-{
+do_test() {
local mnt_point="$PWD/mnt"
local make_file_sys_dir="$PWD/files"
- local mkisofs_opt mount_opt
mkdir -p -m 777 $mnt_point
mkdir -p $make_file_sys_dir
@@ -71,7 +56,7 @@ do_test()
"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -allow-leading-dots -R"
do
rm -f isofs.iso
- EXPECT_PASS $MKISOFS_CMD -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2\> /dev/null \
+ EXPECT_PASS mkisofs -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2\> /dev/null \
|| continue
for mount_opt in \
@@ -86,11 +71,14 @@ do_test()
"loop,check=relaxed,map=normal" \
"loop,block=512,unhide,session=2"
do
- EXPECT_PASS mount -t iso9660 -o $mount_opt isofs.iso $mnt_point \
- || continue
+ mount -t iso9660 -o $mount_opt isofs.iso $mnt_point
+ if [ $? -ne 0 ]; then
+ tst_res TFAIL "mount -t iso9660 -o $mount_opt isofs.iso $mnt_point"
+ continue
+ fi
- EXPECT_PASS ls -lR $mnt_point \> /dev/null
- EXPECT_PASS_BRK umount $mnt_point
+ ls -lR $mnt_point > /dev/null || tst_res TFAIL "ls -lR $mnt_point"
+ umount $mnt_point || tst_brk TFAIL "umount $mnt_point"
tst_res TPASS "mount/umount with \"$mount_opt\" options"
done
diff --git a/testcases/kernel/fs/lftest/lftest.c b/testcases/kernel/fs/lftest/lftest.c
index 1f363b7c6..9439b4cf0 100644
--- a/testcases/kernel/fs/lftest/lftest.c
+++ b/testcases/kernel/fs/lftest/lftest.c
@@ -1,12 +1,31 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2001, International Business Machines Corp.
- * Copyright (c) 2020, Joerg Vehlow <joerg.vehlow@aox-tech.de>
*
- * The purpose of this test is to verify the file size limitations
- * of a filesystem. It writes one buffer at a time and lseeks from
- * the beginning of the file to the end of the last write position.
- * The intent is to test lseek64.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * FILE : lftest.c
+ * DESCRIPTION : The purpose of this test is to verify the file size limitations of a filesystem.
+ * It writes one buffer at a time and lseeks from the beginning of the file to the
+ * end of the last write position. The intent is to test lseek64.
+ * HISTORY:
+ * 06/19/01 : Written by Jeff Martin(martinjn@us.ibm.com) to test large files on jfs.
+ * 07/12/01 : Added timing.
+ *
*/
#include <stdio.h>
@@ -17,63 +36,59 @@
#include <fcntl.h>
#include <time.h>
-#include "tst_test.h"
-
-static char *str_bufnum;
-static int bufnum = 100;
-static char buf[TST_MB];
+/* set write buffer size to whatever floats your boat. I usually use 1M */
+#define BSIZE 1048576L
+char buf[BSIZE];
-static void setup(void)
+int main(int argc, char *argv[])
{
- unsigned int i;
+ off_t i;
+ long bufnum;
+ off_t fd;
+ time_t time1, time2;
+ int writecnt = 0, seekcnt = 0, diff;
- if (str_bufnum) {
- if (tst_parse_int(str_bufnum, &bufnum, 0, INT_MAX)) {
- tst_brk(TBROK, "Invalid buffer count '%s'", str_bufnum);
- }
+ time1 = time(NULL);
+
+ if (argc != 2 || atoi(argv[1]) < 1) {
+ printf("usage:<# of %ld buffers to write>\n", BSIZE);
+ exit(3);
}
+ bufnum = strtol(argv[1], NULL, 0);
+ printf("Started building a %lu megabyte file @ %s\n", bufnum,
+ asctime(localtime(&time1)));
buf[0] = 'A';
- for (i = 1; i < ARRAY_SIZE(buf) - 1; i++)
+ for (i = 1; i < BSIZE; i++)
buf[i] = '0';
- buf[ARRAY_SIZE(buf) - 1] = 'Z';
-}
-
-static void run(void)
-{
- time_t time1, time2;
- int i, fd, diff;
-
- time1 = time(NULL);
- tst_res(TINFO, "started building a %d megabyte file", bufnum);
+ buf[BSIZE - 1] = 'Z';
if ((fd = creat("large_file", 0755)) == -1)
- tst_brk(TBROK | TERRNO, "creat() failed");
+ perror("lftest: ");
for (i = 0; i < bufnum; i++) {
- if (write(fd, buf, sizeof(buf)) == -1) {
- tst_brk(TFAIL | TERRNO, "write() failed");
+ if (write(fd, buf, BSIZE) == -1)
+ return -1;
+ else {
+ printf(".");
+ writecnt++;
+ fflush(stdout);
}
fsync(fd);
- if (lseek(fd, (i + 1) * sizeof(buf), 0) == -1)
- tst_brk(TFAIL | TERRNO, "lseek failed");
+ if (lseek(fd, (i + 1) * BSIZE, 0) == -1)
+ return -1;
+ else
+ seekcnt++;
}
close(fd);
time2 = time(NULL);
- tst_res(TINFO, "finished building a %d megabyte file", bufnum);
+ printf("\nFinished building a %lu megabyte file @ %s\n", bufnum,
+ asctime(localtime(&time2)));
diff = time2 - time1;
- tst_res(TINFO, "total time for test to run: %d minute(s) and %d seconds",
- diff / 60, diff % 60);
+ printf("Number of Writes: %d\n"
+ "Number of Seeks: %d\n"
+ "Total time for test to run: %d minute(s) and %d seconds\n",
+ writecnt, seekcnt, diff / 60, diff % 60);
- tst_res(TPASS, "test successfull");
+ return 0;
}
-
-static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"n:", &str_bufnum, "-n COUNT Number of megabytes to write (default 100)"},
- {}
- },
- .needs_tmpdir = 1,
- .setup = setup,
- .test_all = run
-};
diff --git a/testcases/kernel/fs/linktest/linktest.sh b/testcases/kernel/fs/linktest/linktest.sh
index 3386a445b..9d8c8b92a 100755
--- a/testcases/kernel/fs/linktest/linktest.sh
+++ b/testcases/kernel/fs/linktest/linktest.sh
@@ -3,36 +3,36 @@
# Copyright (c) International Business Machines Corp., 2000
# Copyright (c) Linux Test Project, 2012-2019
# Regression test for max links per file
+# linktest.sh <number of symlinks> <number of hardlinks>
# Author: Ngie Cooper <yaneurabeya@gmail.com>
TST_NEEDS_TMPDIR=1
+TST_POS_ARGS=2
TST_TESTFUNC=do_test
-TST_OPTS="a:s:"
-TST_PARSE_ARGS=parse_args
-TST_USAGE=usage
. tst_test.sh
-hard_links=1000
-soft_links=1000
+if [ $# -ne 2 ]; then
+ tst_res TBROK "usage: $0 {softlink count} {hardlink count}"
+ exit 1
+fi
-usage()
+validate_parameter()
{
- echo "Usage: linktest.sh {-a n} {-s n}"
- echo "-a n Hard link count"
- echo "-s n Soft link count"
+ if ! tst_is_int "$2"; then
+ tst_brk TBROK "$1 must be integer"
+ fi
+
+ if [ "$2" -lt 0 ]; then
+ tst_brk TBROK "$1 must be >= 0"
+ fi
}
-parse_args()
-{
- tst_is_int "$2" || tst_brk TBROK "-$1 must be integer ($2)"
- [ "$2" -ge 0 ] || tst_brk TBROK "-$1 must be >= 0 ($2)"
+validate_parameter "softlink count" $1
+validate_parameter "hardlink count" $2
- case $1 in
- a) hard_links=$2;;
- s) soft_links=$2;;
- esac
-}
+soft_links=$1
+hard_links=$2
do_link()
{
@@ -45,20 +45,20 @@ do_link()
local i=0
local rtype="TFAIL"
- tst_res TINFO "test $prefix_msg link, limit: $limit"
-
cd "${prefix}link.$$"
while [ $i -lt $limit ]; do
- if ! ln $ln_opts "$PWD/${prefix}file" ${prefix}file${i}; then
+ if ! ln ${ln_opts} "$PWD/${prefix}file" ${prefix}file${i}; then
lerrors=$((lerrors + 1))
fi
i=$((i + 1))
done
cd ..
- [ $lerrors -eq 0 ] && rtype="TPASS"
+ if [ $lerrors -eq 0 ]; then
+ rtype=TPASS
+ fi
- tst_res $rtype "errors: $lerrors"
+ tst_res $rtype "$prefix_msg link errors: $lerrors"
}
do_test()
@@ -66,8 +66,8 @@ do_test()
mkdir hlink.$$ slink.$$
touch hlink.$$/hfile slink.$$/sfile
- do_link "s" "-s" $soft_links "symbolic"
- do_link "h" "" $hard_links "hard"
+ do_link s "-s" $soft_links "symbolic"
+ do_link h "" $hard_links "hard"
rm -rf hlink.$$ slink.$$
}
diff --git a/testcases/kernel/fs/proc/proc01.c b/testcases/kernel/fs/proc/proc01.c
index a59e2b607..5c469edf4 100644
--- a/testcases/kernel/fs/proc/proc01.c
+++ b/testcases/kernel/fs/proc/proc01.c
@@ -63,7 +63,7 @@ static char *opt_maxmbytesstr;
static char *procpath = "/proc";
static const char selfpath[] = "/proc/self";
size_t buffsize = 1024;
-static unsigned long long maxbytes;
+static long long maxbytes;
unsigned long long total_read;
unsigned int total_obj;
@@ -85,7 +85,6 @@ static const struct mapping known_issues[] = {
{"open", "/proc/sal/init/data", EBUSY},
{"open", "/proc/sal/mca/data", EBUSY},
{"open", "/proc/fs/nfsd/pool_stats", ENODEV},
- {"read", "/proc/fs/nfsd/clients/*/ctl", EINVAL},
{"read", "/proc/acpi/event", EAGAIN},
{"read", "/proc/kmsg", EAGAIN},
{"read", "/proc/sal/cpe/event", EAGAIN},
@@ -97,11 +96,7 @@ static const struct mapping known_issues[] = {
{"read", "/proc/self/mem", EIO},
{"read", "/proc/self/task/[0-9]*/mem", EIO},
{"read", "/proc/self/attr/*", EINVAL},
- {"read", "/proc/self/attr/smack/*", EINVAL},
- {"read", "/proc/self/attr/apparmor/*", EINVAL},
{"read", "/proc/self/task/[0-9]*/attr/*", EINVAL},
- {"read", "/proc/self/task/[0-9]*/attr/smack/*", EINVAL},
- {"read", "/proc/self/task/[0-9]*/attr/apparmor/*", EINVAL},
{"read", "/proc/self/ns/*", EINVAL},
{"read", "/proc/self/task/[0-9]*/ns/*", EINVAL},
{"read", "/proc/ppc64/rtas/error_log", EINVAL},
@@ -374,7 +369,6 @@ static long readproc(const char *obj)
if ((statbuf.st_mode & S_IRUSR) == 0 &&
(statbuf.st_mode & S_IWUSR) != 0) {
tst_resm(TINFO, "%s: is write-only.", obj);
- (void)close(fd);
return 0;
}
@@ -383,7 +377,6 @@ static long readproc(const char *obj)
if (!strcmp(obj, error_nonblock[i])) {
tst_resm(TINFO, "%s: does not honor "
"O_NONBLOCK", obj);
- (void)close(fd);
return 0;
}
}
diff --git a/testcases/kernel/fs/quota_remount/quota_remount_test01.sh b/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
index e84716c03..04b7af922 100755
--- a/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
+++ b/testcases/kernel/fs/quota_remount/quota_remount_test01.sh
@@ -1,80 +1,126 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Jan Kara <jack@suse.cz>, 2008
-# Copyright (c) International Business Machines Corp., 2009
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2021
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-
-TST_NEEDS_CMDS="dd mkfs.ext3 mount quota quotacheck quotaon sed tail"
-TST_NEEDS_DRIVERS="quota_v2"
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP=do_setup
-TST_CLEANUP=do_clean
-TST_TESTFUNC=do_test
-TST_MIN_KVER="2.6.26"
-
-. tst_test.sh
-
-do_setup()
+################################################################################
+## ##
+## Copyright (c) Jan Kara <jack@suse.cz>, 2008 ##
+## Copyright (c) International Business Machines Corp., 2009 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+# ##
+# File : quota_remount_test01.sh ##
+# ##
+# Description: Test whether kernel properly supports remounting read-only ##
+# with quota. This feature was added in kernel 2.6.26. Please ##
+# see: http://kernelnewbies.org/Linux_2_6_26, and ##
+# http://git.kernel.org/git/?p=linux/kernel/git/torvalds/ ##
+# linux-2.6.git;a=commit; ##
+# h=0ff5af8340aa6be44220d7237ef4a654314cf795 ##
+# for more info. ##
+# ##
+# Author: Jan Kara <jack@suse.cz>, ##
+# ##
+# History: Sep 18 2008 - Created - Jan Kara <jack@suse.cz>. ##
+# Feb 17 2009 - Ported to LTP, ##
+# Subrata Modak <subrata@linux.vnet.ibm.com> ##
+################################################################################
+
+export TCID=quota_remount_test01
+export TST_TOTAL=1
+export TST_COUNT=0
+
+if [ -z $TMPDIR ]
+then
+ TMPDIR=/tmp
+fi
+MNTDIR=$TMPDIR/mnt
+
+if tst_kvcmp -lt "2.6.25"; then
+ tst_resm TCONF "Remounting with quotas enabled is not supported!"
+ tst_resm TCONF "You should have kernel 2.6.26 and above running....."
+ exit 32
+fi
+
+if [ ! -d /proc/sys/fs/quota ]; then
+ tst_resm TCONF "Quota not supported in kernel!"
+ exit 0
+fi
+
+if ! command -v quotacheck > /dev/null 2>&1; then
+ tst_resm TCONF "'quotacheck' not found"
+ exit 0
+fi
+
+if ! command -v quotaon > /dev/null 2>&1; then
+ tst_resm TCONF "'quotaon' not found"
+ exit 0
+fi
+
+die()
{
- if [ ! -d /proc/sys/fs/quota ]; then
- tst_brk TCONF "quota not supported in kernel"
- fi
-
- MNTDIR="mnt.$$"
- IMAGE="ltp-$$-fs-image"
- ROD dd if=/dev/zero of=$IMAGE bs=4096 count=8000 2>/dev/null
- ROD mkfs.ext3 -q -F -b 4096 $IMAGE
- mkdir $MNTDIR
+ echo >&2 $2
+ umount 2>/dev/null $MNTDIR
+ rm 2>/dev/null $IMAGE
+ rmdir 2>/dev/null $MNTDIR
+ tst_resm TFAIL "Quota on Remount Failed"
+ exit $1
}
-do_clean()
-{
- [ "$mounted" ] || return
- tst_umount $MNTDIR
- mounted=
-}
-
-get_blocks()
-{
- quota -f $MNTDIR -v -w | tail -n 1 | sed -e 's/ *[^ ]* *\([0-9]*\) .*/\1/'
-}
-
-do_test()
-{
- tst_res TINFO "testing quota on remount"
-
- local blocks newblocks
-
- ROD mount -t ext3 -o loop,usrquota,grpquota $IMAGE $MNTDIR
- mounted=1
-
- # some distros (CentOS 6.x, for example) doesn't permit creating
- # of quota files in a directory with SELinux file_t type
- if tst_selinux_enforced &&
- tst_cmd_available chcon && ! chcon -t tmp_t $MNTDIR; then
- tst_brk TCONF "could not change SELinux file type"
- fi
-
- ROD quotacheck -cug $MNTDIR
- ROD quotaon -ug $MNTDIR
- ROD echo "blah" />$MNTDIR/file
-
- blocks=$(get_blocks)
- ROD mount -o remount,ro $MNTDIR
- ROD mount -o remount,rw $MNTDIR
-
- ROD rm $MNTDIR/file
- newblocks=$(get_blocks)
-
- if [ $blocks -eq $newblocks ]; then
- tst_brk TFAIL "usage did not change after remount"
- fi
-
- tst_res TPASS "quota on remount passed"
-
- do_clean
-}
-
-tst_run
+cd $TMPDIR || die 2 "Cannot cd to $TMPDIR"
+IMAGE=ltp-$$-fs-image
+dd if=/dev/zero of=$IMAGE bs=4096 count=8000 2>/dev/null || die 2 "Cannot create filesystem image"
+mkfs.ext3 -q -F -b 4096 $IMAGE || die 2 "Could not create the filesystem"
+mkdir $MNTDIR || die 2 "Could not create the mountpoint"
+mount -t ext3 -o loop,usrquota,grpquota $IMAGE $MNTDIR || die 2 "Could not mount the filesystem"
+tst_resm TINFO "Successfully mounted the File System"
+
+# some distros (CentOS 6.x, for example) doesn't permit creating
+# of quota files in a directory with SELinux file_t type
+if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+ chcon -t tmp_t $MNTDIR || die 2 "Could not change SELinux file type"
+ tst_resm TINFO "Successfully changed SELinux file type"
+fi
+
+quotacheck -cug $MNTDIR || die 2 "Could not create quota files"
+tst_resm TINFO "Successfully Created Quota Files"
+
+quotaon -ug $MNTDIR || die 2 "Could not turn quota on"
+tst_resm TINFO "Successfully Turned on Quota"
+
+echo "blah" >$MNTDIR/file || die 2 "Could not write to the filesystem"
+tst_resm TINFO "Successfully wrote to the filesystem"
+
+# Get current quota usage
+BLOCKS=`quota -f $MNTDIR -v -w | tail -n 1 | sed -e 's/ *[^ ]* *\([0-9]*\) .*/\1/'`
+mount -o remount,ro $MNTDIR || die 1 "Could not remount read-only"
+tst_resm TINFO "Successfully Remounted Read-Only FS"
+
+mount -o remount,rw $MNTDIR || die 2 "Could not remount read-write"
+tst_resm TINFO "Successfully Remounted Read-Write FS"
+
+rm $MNTDIR/file
+# Get quota usage after removing the file
+NEWBLOCKS=`quota -f $MNTDIR -v -w | tail -n 1 | sed -e 's/ *[^ ]* *\([0-9]*\) .*/\1/'`
+# Has quota usage changed properly?
+if [ $BLOCKS -eq $NEWBLOCKS ]; then
+ die 1 "Usage did not change after remount"
+fi
+tst_resm TINFO "Usage successfully Changed after Remount"
+tst_resm TPASS "Quota on Remount Successfull"
+
+umount $MNTDIR || die 2 "Could not umount $MNTDIR"
+rmdir $MNTDIR || die 2 "Could not remove $MNTDIR"
+rm $IMAGE
+exit 0
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index a4123220a..47f853223 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -85,9 +85,26 @@ static char *blacklist[] = {
NULL, /* reserved for -e parameter */
"/sys/power/wakeup_count",
"/sys/kernel/debug/*",
- "/sys/devices/platform/*/eeprom",
- "/sys/devices/platform/*/nvmem",
- "/sys/*/cpu??*(?)/*", /* cpu* entries with 2 or more digits */
+};
+
+static struct tst_option options[] = {
+ {"v", &verbose,
+ "-v Print information about successful reads."},
+ {"q", &quiet,
+ "-q Don't print file read or open errors."},
+ {"d:", &root_dir,
+ "-d path Path to the directory to read from, defaults to /sys."},
+ {"e:", &blacklist[0],
+ "-e pattern Ignore files which match an 'extended' pattern, see fnmatch(3)."},
+ {"r:", &str_reads,
+ "-r count The number of times to schedule a file for reading."},
+ {"w:", &str_max_workers,
+ "-w count Set the worker count limit, the default is 15."},
+ {"W:", &str_worker_count,
+ "-W count Override the worker count. Ignores (-w) and the processor count."},
+ {"p", &drop_privs,
+ "-p Drop privileges; switch to the nobody user."},
+ {NULL, NULL, NULL}
};
static int queue_pop(struct queue *q, char *buf)
@@ -448,25 +465,7 @@ static void run(void)
}
static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"v", &verbose,
- "-v Print information about successful reads."},
- {"q", &quiet,
- "-q Don't print file read or open errors."},
- {"d:", &root_dir,
- "-d path Path to the directory to read from, defaults to /sys."},
- {"e:", &blacklist[0],
- "-e pattern Ignore files which match an 'extended' pattern, see fnmatch(3)."},
- {"r:", &str_reads,
- "-r count The number of times to schedule a file for reading."},
- {"w:", &str_max_workers,
- "-w count Set the worker count limit, the default is 15."},
- {"W:", &str_worker_count,
- "-W count Override the worker count. Ignores (-w) and the processor count."},
- {"p", &drop_privs,
- "-p Drop privileges; switch to the nobody user."},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = run,
diff --git a/testcases/kernel/fs/scsi/ltpfs/Makefile b/testcases/kernel/fs/scsi/ltpfs/Makefile
index 5f4030661..7c46a4c4d 100644
--- a/testcases/kernel/fs/scsi/ltpfs/Makefile
+++ b/testcases/kernel/fs/scsi/ltpfs/Makefile
@@ -14,9 +14,9 @@ KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
- $(MAKE) -C $(KDIR) M=$(PWD) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
${CC} $(CFLAGS) -o ltpfstest -lm main.c
-# $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
endif
clean:
diff --git a/testcases/kernel/hotplug/memory_hotplug/Makefile b/testcases/kernel/hotplug/memory_hotplug/Makefile
index 38a77a2ba..d1ba65e65 100644
--- a/testcases/kernel/hotplug/memory_hotplug/Makefile
+++ b/testcases/kernel/hotplug/memory_hotplug/Makefile
@@ -31,7 +31,6 @@ LDLIBS := $(filter-out -lltp,$(LDLIBS))
MAKE_TARGETS := memtoy
-memtoy: $(patsubst $(abs_srcdir)/%.c,%.o,$(sort $(wildcard $(abs_srcdir)/*.c)))
-
+memtoy: $(patsubst $(abs_srcdir)/%.c,%.o,$(wildcard $(abs_srcdir)/*.c))
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/hotplug/memory_hotplug/commands.c b/testcases/kernel/hotplug/memory_hotplug/commands.c
index 6655d3553..0b2586062 100644
--- a/testcases/kernel/hotplug/memory_hotplug/commands.c
+++ b/testcases/kernel/hotplug/memory_hotplug/commands.c
@@ -36,7 +36,6 @@
#include <sys/mman.h>
#include <ctype.h>
#include <errno.h>
-#include <fcntl.h>
#include <numa.h>
#include <numaif.h>
#include <stdarg.h>
@@ -51,7 +50,6 @@
#define CMD_SUCCESS 0
#define CMD_ERROR 1
-#define CMDBUFSZ 256
#ifndef __NR_migrate_pages
#define __NR_migrate_pages 0
@@ -79,11 +77,6 @@ static inline void nodemask_set(nodemask_t * mask, int node)
static char *whitespace = " \t";
-inline char *get_next_arg(char *args, char *nextarg)
-{
- return nextarg ? nextarg + strspn(nextarg, whitespace) : args + strnlen(args, CMDBUFSZ);
-}
-
/*
* =========================================================================
*/
@@ -169,7 +162,7 @@ static int get_range(char *args, range_t * range, char **nextarg)
range->offset = get_scaled_value(args, "offset");
if (range->offset == BOGUS_SIZE)
return CMD_ERROR;
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
/*
* <length> ... only if offset specified
@@ -183,7 +176,7 @@ static int get_range(char *args, range_t * range, char **nextarg)
return CMD_ERROR;
} else
range->length = 0; /* map to end of file */
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
}
}
@@ -692,7 +685,7 @@ static int anon_seg(char *args)
range.length = get_scaled_value(args, "size");
if (range.length == BOGUS_SIZE)
return CMD_ERROR;
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
if (*args != '\0') {
segflag = get_shared(args);
@@ -722,7 +715,7 @@ static int file_seg(char *args)
if (!required_arg(args, "<path-name>"))
return CMD_ERROR;
pathname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
/*
* offset, length are optional
@@ -744,68 +737,6 @@ static int file_seg(char *args)
}
/*
- * deletefile <file-name>
- */
-static int delete_file(char *args)
-{
- glctx_t *gcp = &glctx;
- char *filename, *nextarg;
-
- args += strspn(args, whitespace);
- if (!required_arg(args, "<file-name>"))
- return CMD_ERROR;
- filename = strtok_r(args, whitespace, &nextarg);
-
- if (remove(filename)) {
- fprintf(stderr, "%s: deletefile failed - %s\n",
- gcp->program_name, strerror(errno));
- return CMD_ERROR;
- }
-
- return CMD_SUCCESS;
-}
-
-/*
- * createfile <file-name> <size>[k|m|g|p]]
- */
-static int create_file(char *args)
-{
- glctx_t *gcp = &glctx;
- char *filename, *nextarg;
- size_t len;
- int fd;
-
- args += strspn(args, whitespace);
- if (!required_arg(args, "<file-name>"))
- return CMD_ERROR;
- filename = strtok_r(args, whitespace, &nextarg);
- args = nextarg + strspn(nextarg, whitespace);
-
- if (!required_arg(args, "<size>"))
- return CMD_ERROR;
- args = strtok_r(args, whitespace, &nextarg);
- len = get_scaled_value(args, "size");
- if (len == BOGUS_SIZE)
- return CMD_ERROR;
- args = get_next_arg(args, nextarg);
-
- fd = open(filename, O_RDWR | O_CREAT, 0600);
- if (fd < 0) {
- fprintf(stderr, "%s: createfile failed - %s\n",
- gcp->program_name, strerror(errno));
- return CMD_ERROR;
- }
-
- if (posix_fallocate(fd, 0, len)) {
- fprintf(stderr, "%s: createfile failed - %s\n",
- gcp->program_name, strerror(errno));
- return CMD_ERROR;
- }
- close(fd);
- return CMD_SUCCESS;
-}
-
-/*
* remove_seg: <seg-name> [<seg-name> ...]
*/
static int remove_seg(char *args)
@@ -842,7 +773,7 @@ static int touch_seg(char *args)
if (!required_arg(args, "<seg-name>"))
return CMD_ERROR;
segname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
/*
* offset, length are optional
@@ -873,7 +804,7 @@ static int unmap_seg(char *args)
if (!required_arg(args, "<seg-name>"))
return CMD_ERROR;
segname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
if (!segment_unmap(segname))
return CMD_ERROR;
@@ -897,7 +828,7 @@ static int map_seg(char *args)
if (!required_arg(args, "<seg-name>"))
return CMD_ERROR;
segname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
/*
* offset, length are optional
@@ -941,7 +872,7 @@ static int mbind_seg(char *args)
if (!required_arg(args, "<seg-name>"))
return CMD_ERROR;
segname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
/*
* offset, length are optional
@@ -956,7 +887,7 @@ static int mbind_seg(char *args)
if (policy < 0)
return CMD_ERROR;
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
if (*args == '+') {
flags = get_mbind_flags(++args, &nextarg);
if (flags == -1)
@@ -999,7 +930,7 @@ static int shmem_seg(char *args)
if (!required_arg(args, "<seg-name>"))
return CMD_ERROR;
segname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
if (!required_arg(args, "<size>"))
return CMD_ERROR;
@@ -1007,7 +938,7 @@ static int shmem_seg(char *args)
range.length = get_scaled_value(args, "size");
if (range.length == BOGUS_SIZE)
return CMD_ERROR;
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
if (!segment_register(SEGT_SHM, segname, &range, MAP_SHARED))
return CMD_ERROR;
@@ -1039,7 +970,7 @@ static int where_seg(char *args)
if (!required_arg(args, "<seg-name>"))
return CMD_ERROR;
segname = strtok_r(args, whitespace, &nextarg);
- args = get_next_arg(args, nextarg);
+ args = nextarg + strspn(nextarg, whitespace);
/*
* offset, length are optional
@@ -1109,10 +1040,6 @@ struct command {
"\tspecified offset into the file. <offset> and <length> may be\n"
"\tomitted and specified on the map command.\n"
"\t<seg-share> := private|shared - default = private\n"}, {
- .cmd_name = "createfile", .cmd_func = create_file, .cmd_help =
- "createfile <file-name> <size>[k|m|g|p]]",}, {
- .cmd_name = "deletefile", .cmd_func = delete_file, .cmd_help =
- "deletefile <file-name>"}, {
.cmd_name = "shm",.cmd_func = shmem_seg,.cmd_help =
"shm <seg-name> <seg-size>[k|m|g|p] - \n"
"\tdefine a shared memory segment of specified size.\n"
@@ -1196,6 +1123,7 @@ static int help_me(char *args)
/*
* =========================================================================
*/
+#define CMDBUFSZ 256
static bool unique_abbrev(char *cmd, size_t clen, struct command *cmdp)
{
diff --git a/testcases/kernel/hotplug/memory_hotplug/memtoy.c b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
index e647f86b6..8ac9600de 100644
--- a/testcases/kernel/hotplug/memory_hotplug/memtoy.c
+++ b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
@@ -447,6 +447,7 @@ int parse_command_line_args(int argc, char *argv[])
break;
}
}
+done:
return (error);
}
diff --git a/testcases/kernel/input/Makefile b/testcases/kernel/input/Makefile
index 032254444..5f1db9328 100644
--- a/testcases/kernel/input/Makefile
+++ b/testcases/kernel/input/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) SUSE 2015
+#
+# Copyright (c) SUSE 2015
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../..
@@ -9,4 +24,4 @@ FILTER_OUT_MAKE_TARGETS := input_helper
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: input_helper.o
+$(MAKE_TARGETS): %: %.o input_helper.o
diff --git a/testcases/kernel/input/input_helper.c b/testcases/kernel/input/input_helper.c
index a014861da..f6ae9c9b6 100644
--- a/testcases/kernel/input/input_helper.c
+++ b/testcases/kernel/input/input_helper.c
@@ -92,7 +92,7 @@ static int try_load_uinput(void)
tst_resm(TINFO, "Trying to load uinput kernel module");
- ret = tst_cmd(NULL, argv, NULL, NULL, TST_CMD_PASS_RETVAL);
+ ret = tst_run_cmd(NULL, argv, NULL, NULL, 1);
if (ret) {
tst_resm(TINFO, "Failed to load the uinput module");
return 0;
@@ -108,7 +108,7 @@ static void unload_uinput(void)
tst_resm(TINFO, "Unloading uinput kernel module");
- ret = tst_cmd(NULL, argv, NULL, NULL, TST_CMD_PASS_RETVAL);
+ ret = tst_run_cmd(NULL, argv, NULL, NULL, 1);
if (ret)
tst_resm(TWARN, "Failed to unload uinput module");
}
diff --git a/testcases/kernel/io/aio/aio02.c b/testcases/kernel/io/aio/aio02.c
index fbbfe27bf..e283afba9 100644
--- a/testcases/kernel/io/aio/aio02.c
+++ b/testcases/kernel/io/aio/aio02.c
@@ -18,7 +18,7 @@
#define AIO_MAXIO 32
#define AIO_BLKSIZE (64*1024)
-static int wait_count;
+static int wait_count = 0;
#define DESC_FLAGS_OPR(x, y) .desc = (x == IO_CMD_PWRITE ? "WRITE: " #y: "READ : " #y), \
.flags = y, .operation = x
@@ -54,11 +54,11 @@ struct testcase {
static void io_error(const char *func, int rc)
{
if (rc == -ENOSYS)
- tst_brk(TCONF, "AIO not in this kernel");
+ tst_brk(TCONF, "AIO not in this kernel\n");
else if (rc < 0)
- tst_brk(TFAIL, "%s: %s", func, strerror(-rc));
+ tst_brk(TFAIL, "%s: %s\n", func, strerror(-rc));
else
- tst_brk(TFAIL, "%s: error %d", func, rc);
+ tst_brk(TFAIL, "%s: error %d\n", func, rc);
}
/*
@@ -72,7 +72,7 @@ static void work_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
io_error("aio write", res2);
if (res != (long)iocb->u.c.nbytes)
- tst_brk(TFAIL, "write missed bytes expect %lu got %ld",
+ tst_brk(TFAIL, "write missed bytes expect %lu got %ld\n",
iocb->u.c.nbytes, res);
wait_count--;
@@ -155,7 +155,7 @@ static int io_tio(char *pathname, int flag, int operation)
offset += AIO_BLKSIZE;
break;
default:
- tst_res(TFAIL, "Command failed; opcode returned: %d", operation);
+ tst_res(TFAIL, "Command failed; opcode returned: %d\n", operation);
return -1;
break;
}
@@ -203,17 +203,10 @@ static int io_tio(char *pathname, int flag, int operation)
static void test_io(unsigned int n)
{
- int status, new_flags;
+ int status;
struct testcase *tc = testcases + n;
- new_flags = tc->flags;
-
- if ((tst_fs_type(".") == TST_TMPFS_MAGIC) && (tc->flags & O_DIRECT)) {
- tst_res(TINFO, "Drop O_DIRECT flag for tmpfs");
- new_flags &= ~O_DIRECT;
- }
-
- status = io_tio("file", new_flags, tc->operation);
+ status = io_tio("file", tc->flags, tc->operation);
if (status)
tst_res(TFAIL, "%s, status = %d", tc->desc, status);
else
diff --git a/testcases/kernel/io/direct_io/Makefile b/testcases/kernel/io/direct_io/Makefile
index 777f7b166..b522136ca 100644
--- a/testcases/kernel/io/direct_io/Makefile
+++ b/testcases/kernel/io/direct_io/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
@@ -15,4 +30,4 @@ INSTALL_TARGETS := test_dma_thread_diotest7.sh
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: diotest_routines.o
+$(MAKE_TARGETS): %: %.o diotest_routines.o
diff --git a/testcases/kernel/io/direct_io/diotest4.c b/testcases/kernel/io/direct_io/diotest4.c
index f3c9c19d7..bf200cd41 100644
--- a/testcases/kernel/io/direct_io/diotest4.c
+++ b/testcases/kernel/io/direct_io/diotest4.c
@@ -270,7 +270,6 @@ int main(int argc, char *argv[])
switch (fs_type) {
case TST_NFS_MAGIC:
case TST_BTRFS_MAGIC:
- case TST_FUSE_MAGIC:
tst_resm(TCONF, "%s supports odd count IO",
tst_fs_type_name(fs_type));
break;
@@ -443,7 +442,6 @@ int main(int argc, char *argv[])
switch (fs_type) {
case TST_NFS_MAGIC:
case TST_BTRFS_MAGIC:
- case TST_FUSE_MAGIC:
tst_resm(TCONF, "%s supports non-aligned buffer",
tst_fs_type_name(fs_type));
break;
diff --git a/testcases/kernel/io/disktest/Makefile b/testcases/kernel/io/disktest/Makefile
index 3a3a9cbf0..d10d98434 100644
--- a/testcases/kernel/io/disktest/Makefile
+++ b/testcases/kernel/io/disktest/Makefile
@@ -209,7 +209,7 @@ LDLIBS += -lpthread
MAKE_TARGETS := disktest
-OBJS := $(patsubst $(abs_srcdir)/%.c,%.o,$(sort $(wildcard $(abs_srcdir)/*.c)))
+OBJS := $(patsubst $(abs_srcdir)/%.c,%.o,$(wildcard $(abs_srcdir)/*.c))
disktest-$(VER):
mkdir -p "$@"
diff --git a/testcases/kernel/io/disktest/Makefile.linux b/testcases/kernel/io/disktest/Makefile.linux
index 0f3aab622..ea45b5a57 100644
--- a/testcases/kernel/io/disktest/Makefile.linux
+++ b/testcases/kernel/io/disktest/Makefile.linux
@@ -167,8 +167,8 @@ mandir=/usr/share/man
VER=`grep VER_STR main.h | awk -F\" '{print $$2}'`
GBLHDRS=main.h globals.h defs.h
-ALLHDRS=$(sort $(wildcard *.h))
-SRCS=$(sort $(wildcard *.c))
+ALLHDRS=$(wildcard *.h)
+SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=.o)
CFLAGS += -g -Wall -O -D"LINUX" -D"_THREAD_SAFE" -D"_GNU_SOURCE" -D"_LARGE_FILES" -D"_LARGEFILE64_SOURCE" -D"_FILE_OFFSET_BITS=64" $(RPM_OPT_FLAGS)
diff --git a/testcases/kernel/io/ltp-aiodio/dio_append.c b/testcases/kernel/io/ltp-aiodio/dio_append.c
index 3f0ed29d5..74446acd8 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_append.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_append.c
@@ -104,7 +104,7 @@ void dio_append(char *filename)
}
}
-int main(void)
+int main(int argc, char **argv)
{
char filename[PATH_MAX];
int pid[NUM_CHILDREN];
diff --git a/testcases/kernel/io/ltp-aiodio/dio_truncate.c b/testcases/kernel/io/ltp-aiodio/dio_truncate.c
index 7d466dc20..a2a201d64 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_truncate.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_truncate.c
@@ -133,7 +133,7 @@ void dio_append(char *filename, int fill)
close(fd);
}
-int main(void)
+int main(int argc, char **argv)
{
char filename[PATH_MAX];
int pid[NUM_CHILDREN];
diff --git a/testcases/kernel/ipc/pipeio/pipeio.c b/testcases/kernel/ipc/pipeio/pipeio.c
index ab5c2cf06..b9421cbea 100644
--- a/testcases/kernel/ipc/pipeio/pipeio.c
+++ b/testcases/kernel/ipc/pipeio/pipeio.c
@@ -47,12 +47,13 @@
#include <string.h>
#include <signal.h>
#include <sys/stat.h>
+#include <sys/sem.h>
#include "tlibio.h"
#include "test.h"
#include "safe_macros.h"
-#include "lapi/sem.h"
+#include "lapi/semun.h"
char *TCID = "pipeio";
int TST_TOTAL = 1;
diff --git a/testcases/kernel/ipc/semaphore/sem01.c b/testcases/kernel/ipc/semaphore/sem01.c
index 582624d60..5a4523836 100644
--- a/testcases/kernel/ipc/semaphore/sem01.c
+++ b/testcases/kernel/ipc/semaphore/sem01.c
@@ -40,7 +40,8 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/ipc.h>
-#include "lapi/sem.h"
+#include <sys/sem.h>
+#include "lapi/semun.h"
int verbose = 0;
int loops = 100;
diff --git a/testcases/kernel/ipc/semaphore/sem02.c b/testcases/kernel/ipc/semaphore/sem02.c
index 34b714bf0..81e77d66f 100644
--- a/testcases/kernel/ipc/semaphore/sem02.c
+++ b/testcases/kernel/ipc/semaphore/sem02.c
@@ -45,11 +45,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/sem.h>
#include <errno.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/ipc.h>
-#include "lapi/sem.h"
+#include "lapi/semun.h"
#include "test.h"
#define KEY IPC_PRIVATE
diff --git a/testcases/kernel/logging/kmsg/kmsg01.c b/testcases/kernel/logging/kmsg/kmsg01.c
index 34c6073c6..57eee949a 100644
--- a/testcases/kernel/logging/kmsg/kmsg01.c
+++ b/testcases/kernel/logging/kmsg/kmsg01.c
@@ -376,7 +376,7 @@ static void test_read_returns_first_message(void)
} else {
tst_res(TFAIL, "readers got different messages");
for (i = 0; i < NUM_READ_MSGS; i++)
- tst_res(TINFO, "msg%d: %lu", i, seqno[i]);
+ tst_res(TINFO, "msg%d: %lu\n", i, seqno[i]);
}
}
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index ff2910533..ce21ca70f 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -23,6 +23,7 @@
/ksm/ksm04
/ksm/ksm05
/ksm/ksm06
+/mem/mem01
/mem/mem02
/mmapstress/mmap-corruption01
/mmapstress/mmapstress01
@@ -64,7 +65,6 @@
/thp/thp01
/thp/thp02
/thp/thp03
-/thp/thp04
/tunable/max_map_count
/tunable/min_free_kbytes
/tunable/overcommit_memory
diff --git a/testcases/kernel/mem/cpuset/cpuset01.c b/testcases/kernel/mem/cpuset/cpuset01.c
index 66c18f6ab..853f7fe55 100644
--- a/testcases/kernel/mem/cpuset/cpuset01.c
+++ b/testcases/kernel/mem/cpuset/cpuset01.c
@@ -35,8 +35,6 @@
#ifdef HAVE_NUMA_V2
-static const struct tst_cgroup_group *cg;
-
volatile int end;
static int *nodes;
static int nnodes;
@@ -49,14 +47,15 @@ static long count_cpu(void);
static void test_cpuset(void)
{
- int child, i;
+ int child, i, status;
unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };
- char buf[BUFSIZ];
+ char mems[BUFSIZ], buf[BUFSIZ];
- SAFE_CGROUP_READ(cg, "cpuset.cpus", buf, sizeof(buf));
- SAFE_CGROUP_PRINT(cg, "cpuset.cpus", buf);
- SAFE_CGROUP_READ(cg, "cpuset.mems", buf, sizeof(buf));
- SAFE_CGROUP_PRINT(cg, "cpuset.mems", buf);
+ read_cpuset_files(CPATH, "cpus", buf);
+ write_cpuset_files(CPATH_NEW, "cpus", buf);
+ read_cpuset_files(CPATH, "mems", mems);
+ write_cpuset_files(CPATH_NEW, "mems", mems);
+ SAFE_FILE_PRINTF(CPATH_NEW "/tasks", "%d", getpid());
child = SAFE_FORK();
if (child == 0) {
@@ -70,30 +69,33 @@ static void test_cpuset(void)
exit(mem_hog_cpuset(ncpus > 1 ? ncpus : 1));
}
- SAFE_CGROUP_PRINTF(cg, "cpuset.mems", "%d", nodes[0]);
- SAFE_CGROUP_PRINTF(cg, "cpuset.mems", "%d", nodes[1]);
+ snprintf(buf, BUFSIZ, "%d", nodes[0]);
+ write_cpuset_files(CPATH_NEW, "mems", buf);
+ snprintf(buf, BUFSIZ, "%d", nodes[1]);
+ write_cpuset_files(CPATH_NEW, "mems", buf);
- tst_reap_children();
+ SAFE_WAITPID(child, &status, WUNTRACED | WCONTINUED);
+ if (WEXITSTATUS(status) != 0) {
+ tst_res(TFAIL, "child exit status is %d", WEXITSTATUS(status));
+ return;
+ }
tst_res(TPASS, "cpuset test pass");
}
static void setup(void)
{
- tst_cgroup_require("cpuset", NULL);
+ mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
ncpus = count_cpu();
if (get_allowed_nodes_arr(NH_MEMS | NH_CPUS, &nnodes, &nodes) < 0)
tst_brk(TBROK | TERRNO, "get_allowed_nodes_arr");
if (nnodes <= 1)
tst_brk(TCONF, "requires a NUMA system.");
-
- cg = tst_cgroup_get_test_group();
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
}
static void cleanup(void)
{
- tst_cgroup_cleanup();
+ umount_mem(CPATH, CPATH_NEW);
}
static void sighandler(int signo LTP_ATTRIBUTE_UNUSED)
@@ -181,7 +183,6 @@ static long count_cpu(void)
static struct tst_test test = {
.needs_root = 1,
- .forks_child = 1,
.setup = setup,
.cleanup = cleanup,
.test_all = test_cpuset,
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c
index 1783bfb12..a6ffab77b 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap01.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* Test Name: hugemmap01
*
* Test Description:
@@ -28,11 +39,18 @@
#include <sys/param.h>
#include "hugetlb.h"
+static struct tst_option options[] = {
+ {"H:", &Hopt, "-H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs"},
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static long *addr;
static int fildes;
static long beforetest;
static long aftertest;
static long hugepagesmapped;
+static long hugepages = 128;
static char TEMPFILE[MAXPATHLEN];
static void test_hugemmap(void)
@@ -71,32 +89,34 @@ static void test_hugemmap(void)
void setup(void)
{
- if (tst_hugepages == 0)
- tst_brk(TCONF, "Not enough hugepages for testing.");
+ save_nr_hugepages();
if (!Hopt)
Hopt = tst_get_tmpdir();
SAFE_MOUNT("none", Hopt, "hugetlbfs", 0, NULL);
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
+
snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", Hopt, getpid());
}
void cleanup(void)
{
unlink(TEMPFILE);
+ restore_nr_hugepages();
+
umount(Hopt);
}
static struct tst_test test = {
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"H:", &Hopt, "-H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs"},
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugemmap,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
index 0b27154af..26314d125 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* Test Name: hugemmap02
*
* Test Description: There is both a low hugepage region (at 2-3G for use by
@@ -34,6 +45,12 @@
#define LOW_ADDR 0x80000000
#define LOW_ADDR2 0x90000000
+static struct tst_option options[] = {
+ {"H:", &Hopt, "-H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs"},
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static char TEMPFILE[MAXPATHLEN];
static unsigned long *addr;
@@ -43,6 +60,7 @@ static unsigned long low_addr2 = LOW_ADDR2;
static unsigned long *addrlist[5];
static int fildes;
static int nfildes;
+static long hugepages = 128;
static void test_hugemmap(void)
{
@@ -118,32 +136,34 @@ static void test_hugemmap(void)
static void setup(void)
{
- if (tst_hugepages == 0)
- tst_brk(TCONF, "Not enough hugepages for testing.");
+ save_nr_hugepages();
if (!Hopt)
Hopt = tst_get_tmpdir();
SAFE_MOUNT("none", Hopt, "hugetlbfs", 0, NULL);
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
+
snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", Hopt, getpid());
}
static void cleanup(void)
{
unlink(TEMPFILE);
+ restore_nr_hugepages();
+
umount(Hopt);
}
static struct tst_test test = {
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"H:", &Hopt, "-H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs"},
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugemmap,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
index f63b41f28..35bae015b 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* Test Name: hugemmap04
*
* Test Description:
@@ -30,6 +41,12 @@
#include "lapi/abisize.h"
#include "hugetlb.h"
+static struct tst_option options[] = {
+ {"H:", &Hopt, "-H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs"},
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static char TEMPFILE[MAXPATHLEN];
static long *addr;
@@ -39,6 +56,7 @@ static long freepages;
static long beforetest;
static long aftertest;
static long hugepagesmapped;
+static long hugepages = 128;
static void test_hugemmap(void)
{
@@ -54,7 +72,7 @@ static void test_hugemmap(void)
tst_res(TINFO, "Size of huge pages is %d KB", huge_pagesize);
#ifdef TST_ABI32
- tst_res(TINFO, "Total amount of free huge pages is %ld",
+ tst_res(TINFO, "Total amount of free huge pages is %d",
freepages);
tst_res(TINFO, "Max number allowed for 1 mmap file in"
" 32-bits is 128");
@@ -89,32 +107,34 @@ static void test_hugemmap(void)
void setup(void)
{
- if (tst_hugepages == 0)
- tst_brk(TCONF, "Not enough hugepages for testing!");
+ save_nr_hugepages();
if (!Hopt)
Hopt = tst_get_tmpdir();
SAFE_MOUNT("none", Hopt, "hugetlbfs", 0, NULL);
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
+
snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", Hopt, getpid());
}
void cleanup(void)
{
unlink(TEMPFILE);
+ restore_nr_hugepages();
+
umount(Hopt);
}
static struct tst_test test = {
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"H:", &Hopt, "-H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs"},
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugemmap,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
index a8524b6f9..d80a636c8 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
@@ -51,20 +51,25 @@ static char path_sys_sz_huge[BUFSIZ];
#define SHM_HUGETLB 04000
#endif
-#define NR_HPAGES 2
#define MOUNT_DIR "hugemmap05"
#define TEST_FILE MOUNT_DIR "/file"
static unsigned long long shmmax;
static char *path, *pathover;
static int key = -1, shmid = -1, fd = -1;
-static int mounted, restore_shmmax, restore_overcomm_hgpgs;
-static long hugepagesize, nr_overcommit_hugepages;
-static long size = NR_HPAGES, length = (NR_HPAGES + NR_HPAGES/2) * 2;
+static int mounted, restore_shmmax, restore_nr_hgpgs, restore_overcomm_hgpgs;
+static long hugepagesize, nr_hugepages, nr_overcommit_hugepages;
+static long size = 128, length = 384;
char *opt_sysfs;
char *opt_alloc;
char *opt_shmid;
+static struct tst_option options[] = {
+ {"s", &opt_sysfs, "-s Setup hugepages from sysfs"},
+ {"m", &opt_shmid, "-m Reserve hugepages by shmget"},
+ {"a:", &opt_alloc, "-a Number of overcommint hugepages"},
+ {NULL, NULL, NULL}
+};
static void check_wr_bytes(void *addr);
static int checkproc(long act_val, char *string, long exp_val);
@@ -171,6 +176,11 @@ static void cleanup(void)
if (mounted)
tst_umount(MOUNT_DIR);
+ if (restore_nr_hgpgs) {
+ tst_res(TINFO, "restore nr_hugepages to %ld.", nr_hugepages);
+ SAFE_FILE_PRINTF(path, "%ld", nr_hugepages);
+ }
+
if (restore_shmmax)
SAFE_FILE_PRINTF(PATH_SHMMAX, "%llu", shmmax);
@@ -183,11 +193,7 @@ static void cleanup(void)
static void setup(void)
{
- unsigned long hpages;
-
- if (tst_hugepages != NR_HPAGES)
- tst_brk(TCONF, "Not enough hugepages for testing!");
-
+ check_hugepage();
hugepagesize = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
init_sys_sz_paths();
@@ -213,11 +219,12 @@ static void setup(void)
}
}
+ SAFE_FILE_SCANF(path, "%ld", &nr_hugepages);
+ tst_res(TINFO, "original nr_hugepages is %ld", nr_hugepages);
+
/* Reset. */
SAFE_FILE_PRINTF(path, "%ld", size);
- SAFE_FILE_SCANF(path, "%lu", &hpages);
- if (hpages != size)
- tst_brk(TCONF, "Not enough hugepages for testing!");
+ restore_nr_hgpgs = 1;
if (access(pathover, F_OK)) {
tst_brk(TCONF, "file %s does not exist in the system",
@@ -298,14 +305,8 @@ static void init_sys_sz_paths(void)
static struct tst_test test = {
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"s", &opt_sysfs, "-s Setup hugepages from sysfs"},
- {"m", &opt_shmid, "-m Reserve hugepages by shmget"},
- {"a:", &opt_alloc, "-a Number of overcommint hugepages"},
- {}
-},
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_overcommit,
- .request_hugepages = NR_HPAGES,
};
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
index ab2ccc40b..d66183479 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
@@ -1,7 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015-2017 Red Hat, Inc.
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
*
* There is a race condition if we map a same file on different processes.
@@ -28,6 +39,7 @@
#include "lapi/mmap.h"
static long hpage_size;
+static long hugepages;
struct mp {
char *addr;
@@ -39,9 +51,21 @@ struct mp {
static void setup(void)
{
- if (tst_hugepages != test.request_hugepages)
- tst_brk(TCONF, "System RAM is not enough to test.");
+ save_nr_hugepages();
+
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+
+ hugepages = (ARSZ + 1) * LOOP;
+
+ if (hugepages * SAFE_READ_MEMINFO("Hugepagesize:") > SAFE_READ_MEMINFO("MemTotal:"))
+ tst_brk(TCONF, "System RAM is not enough to test.");
+
+ set_sys_tune("nr_hugepages", hugepages, 1);
+}
+
+static void cleanup(void)
+{
+ restore_nr_hugepages();
}
static void *thr(void *arg)
@@ -122,7 +146,7 @@ static struct tst_test test = {
.needs_tmpdir = 1,
.test = do_mmap,
.setup = setup,
- .request_hugepages = (ARSZ + 1) * LOOP,
+ .cleanup = cleanup,
.tags = (const struct tst_tag[]) {
{"linux-git", "f522c3ac00a4"},
{"linux-git", "9119a41e9091"},
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
index f206522c0..712398e27 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat01.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* Copyright (c) Linux Test Project, 2001-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmat01 - test that shmat() works correctly
*
@@ -36,6 +47,13 @@ static size_t shm_size;
static int shm_id_1 = -1;
static void *addr;
+static long hugepages = 128;
+
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static struct tcase {
int *shmid;
void *addr;
@@ -149,12 +167,15 @@ static void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
shm_id_1 = shmget(shmkey++, shm_size,
@@ -167,18 +188,15 @@ static void setup(void)
static void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.tcnt = ARRAY_SIZE(tcases),
.test = verify_hugeshmat,
.setup = setup,
.cleanup = cleanup,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
index fcad8f5d9..945de584d 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmat02 - check for EINVAL and EACCES errors with hugetlb
*
@@ -39,6 +50,13 @@ static int shm_id_1 = -1;
static int shm_id_2 = -1;
static void *addr;
+static long hugepages = 128;
+
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
struct tcase {
int *shmid;
void *addr;
@@ -74,12 +92,15 @@ void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
@@ -94,18 +115,15 @@ void setup(void)
void cleanup(void)
{
rm_shm(shm_id_2);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.tcnt = ARRAY_SIZE(tcases),
.test = verify_hugeshmat,
.setup = setup,
.cleanup = cleanup,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
index 1f1d2613a..34fea5cd7 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat03.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmat03 - test for EACCES error
*
@@ -39,6 +50,13 @@ static void *addr;
static uid_t ltp_uid;
static char *ltp_user = "nobody";
+static long hugepages = 128;
+
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static void verify_hugeshmat(void)
{
int status;
@@ -69,12 +87,15 @@ static void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
shm_id_1 = shmget(shmkey, shm_size,
@@ -88,18 +109,15 @@ static void setup(void)
static void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.test_all = verify_hugeshmat,
.setup = setup,
.cleanup = cleanup,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
index e9bb9fbf7..c76e4167f 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -1,12 +1,23 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Linux Test Project, 2014-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmat04 - test for hugepage leak inspection.
*
* It is a regression test for shared hugepage leak, when over 1GB
- * shared memory was alocated in hugepage, the hugepage is not released
+ * shered memory was alocated in hugepage, the hugepage is not released
* though process finished.
*
* You need more than 2GB memory in test job
@@ -74,10 +85,7 @@ static void setup(void)
{
long mem_total, hpage_size, orig_hugepages;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "Not enough hugepages for testing.");
-
- orig_hugepages = get_sys_tune("nr_hugepages");
+ orig_hugepages = save_nr_hugepages();
mem_total = SAFE_READ_MEMINFO("MemTotal:");
SAFE_FILE_SCANF(PATH_SHMMAX, "%ld", &orig_shmmax);
SAFE_FILE_PRINTF(PATH_SHMMAX, "%ld", (long)SIZE);
@@ -92,13 +100,12 @@ static void setup(void)
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
hugepages = orig_hugepages + SIZE / hpage_size;
- tst_request_hugepages(hugepages);
- if (tst_hugepages != (unsigned long)hugepages)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ set_sys_tune("nr_hugepages", hugepages, 1);
}
static void cleanup(void)
{
+ restore_nr_hugepages();
if (orig_shmmax != -1)
SAFE_FILE_PRINTF(PATH_SHMMAX, "%ld", orig_shmmax);
}
@@ -111,5 +118,4 @@ static struct tst_test test = {
.test = test_hugeshmat,
.setup = setup,
.cleanup = cleanup,
- .request_hugepages = 1,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
index 7152e3363..587110ad3 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
@@ -1,8 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015-2017 Red Hat, Inc.
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* shmget()/shmat() fails to allocate huge pages shared memory segment
* with EINVAL if its size is not in the range [ N*HUGE_PAGE_SIZE - 4095,
@@ -30,16 +40,23 @@
static long page_size;
static long hpage_size;
+static long hugepages;
#define N 4
void setup(void)
{
- if (tst_hugepages != test.request_hugepages)
- tst_brk(TCONF, "Not enough hugepages for testing.");
-
+ save_nr_hugepages();
page_size = getpagesize();
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+
+ hugepages = N + 1;
+ set_sys_tune("nr_hugepages", hugepages, 1);
+}
+
+void cleanup(void)
+{
+ restore_nr_hugepages();
}
void shm_test(int size)
@@ -91,7 +108,7 @@ static struct tst_test test = {
.needs_tmpdir = 1,
.test_all = test_hugeshmat,
.setup = setup,
- .request_hugepages = N + 1,
+ .cleanup = cleanup,
.tags = (const struct tst_tag[]) {
{"linux-git", "091d0d55b286"},
{"linux-git", "af73e4d9506d"},
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
index b5b5496fd..f7ac881bc 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
@@ -1,7 +1,16 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
- * Copyright (c) Linux Test Project, 2004-2020
+ * Copyright (c) Linux Test Project, 2004-2017
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*/
/*
@@ -35,6 +44,8 @@
#include <limits.h>
#include "hugetlb.h"
+#define FIRST 0
+#define SECOND 1
#define N_ATTACH 4U
#define NEWMODE 0066
@@ -42,53 +53,72 @@ static size_t shm_size;
static int shm_id_1 = -1;
static struct shmid_ds buf;
static time_t save_time;
-static void *attach_to_parent;
+static int stat_time;
+static void *set_shared;
-static void stat_setup_1(void);
+static void stat_setup(void);
static void stat_cleanup(void);
-static void stat_setup_2(void);
static void set_setup(void);
static void func_stat(void);
static void func_set(void);
static void func_rmid(void);
static void *set_shmat(void);
+static long hugepages = 128;
+
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
struct tcase {
int cmd;
void (*func_test) (void);
void (*func_setup) (void);
} tcases[] = {
- {IPC_STAT, func_stat, stat_setup_1},
- {IPC_STAT, func_stat, stat_setup_2},
+ {IPC_STAT, func_stat, stat_setup},
+ {IPC_STAT, func_stat, stat_setup},
{IPC_SET, func_set, set_setup},
{IPC_RMID, func_rmid, NULL}
};
-static void test_hugeshmctl(unsigned int i)
+static void test_hugeshmctl(void)
{
+ unsigned int i;
+
+ /* initialize stat_time */
+ stat_time = FIRST;
+
/*
* Create a shared memory segment with read and write
* permissions. Do this here instead of in setup()
* so that looping (-i) will work correctly.
*/
- if (i == 0)
- shm_id_1 = shmget(shmkey, shm_size,
+ shm_id_1 = shmget(shmkey, shm_size,
SHM_HUGETLB | IPC_CREAT | IPC_EXCL | SHM_RW);
if (shm_id_1 == -1)
tst_brk(TBROK | TERRNO, "shmget #main");
- if (tcases[i].func_setup != NULL)
- (*tcases[i].func_setup) ();
-
- if (shmctl(shm_id_1, tcases[i].cmd, &buf) == -1) {
- tst_res(TFAIL | TERRNO, "shmctl #main");
- return;
+ for (i = 0; i < ARRAY_SIZE(tcases); i++) {
+ /*
+ * if needed, set up any required conditions by
+ * calling the appropriate setup function
+ */
+ if (tcases[i].func_setup != NULL)
+ (*tcases[i].func_setup) ();
+
+ if (shmctl(shm_id_1, tcases[i].cmd, &buf) == -1) {
+ tst_res(TFAIL | TERRNO, "shmctl #main");
+ continue;
+ }
+ (*tcases[i].func_test) ();
}
- (*tcases[i].func_test)();
}
/*
- * set_shmat() - Attach the shared memory and return the pointer.
+ * set_shmat() - Attach the shared memory and return the pointer. Use
+ * this seperate routine to avoid code duplication in
+ * stat_setup() below.
*/
void *set_shmat(void)
{
@@ -102,33 +132,35 @@ void *set_shmat(void)
}
/*
- * stat_setup_2() - Set up for the IPC_STAT command with shmctl().
- * Attach the shared memory to parent process and
- * some children will inherit the shared memory.
- */
-static void stat_setup_2(void)
-{
- if (!attach_to_parent)
- attach_to_parent = set_shmat();
- stat_setup_1();
-}
-
-/*
- * stat_setup_1() - Set up for the IPC_STAT command with shmctl().
- * some children will inherit or attatch the shared memory.
- * It deponds on whther we attach the shared memory
- * to parent process.
+ * stat_setup() - Set up for the IPC_STAT command with shmctl().
+ * Make things interesting by forking some children
+ * that will either attach or inherit the shared memory.
*/
-static void stat_setup_1(void)
+static void stat_setup(void)
{
unsigned int i;
void *test;
pid_t pid;
+ /*
+ * The first time through, let the children attach the memory.
+ * The second time through, attach the memory first and let
+ * the children inherit the memory.
+ */
+
+ if (stat_time == SECOND) {
+ /*
+ * use the global "set_shared" variable here so that
+ * it can be removed in the stat_func() routine.
+ */
+ set_shared = set_shmat();
+ }
+
for (i = 0; i < N_ATTACH; i++) {
switch (pid = SAFE_FORK()) {
case 0:
- test = (attach_to_parent == NULL) ? set_shmat() : attach_to_parent;
+ test = (stat_time == FIRST) ? set_shmat() : set_shared;
+
/* do an assignement for fun */
*(int *)test = i;
@@ -148,7 +180,6 @@ static void stat_setup_1(void)
}
}
-
/*
* func_stat() - check the functionality of the IPC_STAT command with shmctl()
* by looking at the pid of the creator, the segement size,
@@ -157,7 +188,6 @@ static void stat_setup_1(void)
static void func_stat(void)
{
pid_t pid;
- unsigned int num;
/* check perm, pid, nattach and size */
pid = getpid();
@@ -173,13 +203,12 @@ static void func_stat(void)
}
/*
- * The first case, only the children attach the memory, so
- * the attaches equal N_ATTACH. The second case, the parent
- * attaches the memory and the children inherit that memory
- * so the attaches equal N_ATTACH + 1.
+ * The first time through, only the children attach the memory, so
+ * the attaches equal N_ATTACH + stat_time (0). The second time
+ * through, the parent attaches the memory and the children inherit
+ * that memory so the attaches equal N_ATTACH + stat_time (1).
*/
- num = (attach_to_parent == NULL) ? 0 : 1;
- if (buf.shm_nattch != N_ATTACH + num) {
+ if (buf.shm_nattch != N_ATTACH + stat_time) {
tst_res(TFAIL, "# of attaches is incorrect - %lu",
(unsigned long)buf.shm_nattch);
goto fail;
@@ -192,7 +221,7 @@ static void func_stat(void)
}
tst_res(TPASS, "pid, size, # of attaches and mode are correct "
- "- pass #%d", num);
+ "- pass #%d", stat_time);
fail:
stat_cleanup();
@@ -217,12 +246,11 @@ static void stat_cleanup(void)
for (i = 0; i < N_ATTACH; i++)
SAFE_WAIT(&status);
- /* remove the parent's shared memory if we set*/
- if (attach_to_parent) {
- if (shmdt(attach_to_parent) == -1)
- tst_res(TFAIL | TERRNO, "shmdt in stat_cleanup()");
- attach_to_parent = NULL;
- }
+ /* remove the parent's shared memory the second time through */
+ if (stat_time == SECOND)
+ if (shmdt(set_shared) == -1)
+ tst_res(TBROK | TERRNO, "shmdt in stat_cleanup()");
+ stat_time++;
}
/*
@@ -244,7 +272,7 @@ static void func_set(void)
{
/* first stat the shared memory to get the new data */
if (shmctl(shm_id_1, IPC_STAT, &buf) == -1) {
- tst_res(TFAIL | TERRNO, "shmctl in func_set()");
+ tst_res(TBROK | TERRNO, "shmctl in func_set()");
return;
}
@@ -283,12 +311,15 @@ void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
}
@@ -296,19 +327,15 @@ void setup(void)
void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
.needs_root = 1,
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
- .test = test_hugeshmctl,
+ .test_all = test_hugeshmctl,
.needs_checkpoints = 1,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index e014edd94..ab7dc1e6e 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -1,7 +1,16 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
- * Copyright (c) Linux Test Project, 2004-2020
+ * Copyright (c) Linux Test Project, 2004-2017
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*/
/*
@@ -34,6 +43,13 @@ static int shm_id_2 = -1;
static int shm_id_3 = -1;
static struct shmid_ds buf;
+static long hugepages = 128;
+
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
struct tcase {
int *shmid;
int cmd;
@@ -50,34 +66,41 @@ struct tcase {
{&shm_id_2, -1, &buf, EINVAL},
};
-static void test_hugeshmctl(unsigned int i)
+static void test_hugeshmctl(void)
{
- TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
- if (TST_RET != -1) {
- tst_res(TFAIL, "shmctl succeeded unexpectedly");
- return;
- }
+ unsigned int i;
- if (TST_ERR == tcases[i].error) {
- tst_res(TPASS | TTERRNO, "shmctl failed as expected");
- return;
+ for (i = 0; i < ARRAY_SIZE(tcases); i++) {
+ TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "shmctl succeeded "
+ "unexpectedly");
+ continue;
+ }
+ if (TST_ERR == tcases[i].error) {
+ tst_res(TPASS | TTERRNO, "shmctl failed "
+ "as expected");
+ } else {
+ tst_res(TFAIL | TTERRNO, "shmctl failed "
+ "unexpectedly - expect errno = "
+ "%d, got", tcases[i].error);
+ }
}
-
- tst_res(TFAIL | TTERRNO,
- "shmctl failed unexpectedly - expect errno = %d, got",
- tcases[i].error);
}
static void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * (tst_hugepages / 2);
+ shm_size = hpage_size * (hugepages / 2);
update_shm_size(&shm_size);
shmkey = getipckey();
@@ -97,18 +120,14 @@ static void cleanup(void)
{
rm_shm(shm_id_1);
rm_shm(shm_id_2);
+ restore_nr_hugepages();
}
static struct tst_test test = {
- .test = test_hugeshmctl,
- .tcnt = ARRAY_SIZE(tcases),
.needs_root = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
- .request_hugepages = 128,
+ .test_all = test_hugeshmctl,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
index 8c485810d..480a51e4c 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
@@ -1,7 +1,16 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*/
/*
@@ -44,6 +53,13 @@ static struct shmid_ds buf;
static uid_t ltp_uid;
static char *ltp_user = "nobody";
+static long hugepages = 128;
+
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
struct tcase {
int *shmid;
int cmd;
@@ -101,12 +117,15 @@ void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
shm_id_1 = shmget(shmkey, shm_size,
@@ -121,18 +140,15 @@ void setup(void)
void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
.needs_tmpdir = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugeshmctl,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
index 571a4cf10..171868aeb 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmdt/hugeshmdt01.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmdt01 - check that largr shared memory is detached correctly
*
@@ -31,6 +42,7 @@
#include <setjmp.h>
#include <limits.h>
#include "hugetlb.h"
+#include "hugetlb.h"
static size_t shm_size;
static int shm_id_1 = -1;
@@ -39,6 +51,12 @@ static int *shared;
static int pass;
static sigjmp_buf env;
+static long hugepages = 128;
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static void check_functionality(void);
static void sighandler(int sig);
@@ -114,12 +132,15 @@ void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
@@ -141,16 +162,13 @@ void setup(void)
void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = hugeshmdt_test,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
index 470563653..1636260ce 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget01.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmget01 - test that shmget() correctly creates a large
* shared memory segment
@@ -14,10 +25,17 @@
#include <limits.h>
#include "hugetlb.h"
+#include "hugetlb.h"
static size_t shm_size;
static int shm_id_1 = -1;
+static long hugepages = 128;
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static void test_hugeshmget(void)
{
struct shmid_ds buf;
@@ -49,12 +67,15 @@ static void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
@@ -67,16 +88,13 @@ static void setup(void)
static void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugeshmget,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
index 323b5d6d1..e8de3251f 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
@@ -1,9 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmget02 - check for ENOENT, EEXIST and EINVAL errors
*
@@ -14,11 +24,19 @@
#include <limits.h>
#include "hugetlb.h"
+#include "hugetlb.h"
+
static size_t shm_size;
static int shm_id_1 = -1;
static int shm_nonexistent_key = -1;
static key_t shmkey2;
+static long hugepages = 128;
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static struct tcase {
int *skey;
int size_coe;
@@ -67,12 +85,15 @@ void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
@@ -86,17 +107,14 @@ void setup(void)
void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test = test_hugeshmget,
.tcnt = ARRAY_SIZE(tcases),
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
index 2053d0a98..f2ecc465d 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmget03 - test for ENOSPC error
*
@@ -13,6 +24,7 @@
#include <limits.h>
#include "hugetlb.h"
+#include "hugetlb.h"
/*
* The MAXIDS value is somewhat arbitrary and may need to be increased
@@ -26,7 +38,13 @@ static int shm_id_1 = -1;
static int num_shms;
static int shm_id_arr[MAXIDS];
+static long hugepages = 128;
static long orig_shmmni = -1;
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static void test_hugeshmget(void)
{
TEST(shmget(IPC_PRIVATE, shm_size,
@@ -46,11 +64,15 @@ static void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
SAFE_FILE_SCANF(PATH_SHMMNI, "%ld", &orig_shmmni);
- SAFE_FILE_PRINTF(PATH_SHMMNI, "%ld", tst_hugepages / 2);
+
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
+ SAFE_FILE_PRINTF(PATH_SHMMNI, "%ld", hugepages / 2);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
shm_size = hpage_size;
@@ -85,16 +107,13 @@ static void cleanup(void)
if (orig_shmmni != -1)
FILE_PRINTF(PATH_SHMMNI, "%ld", orig_shmmni);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugeshmget,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
index 60c86455c..824293fb8 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
@@ -1,8 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2004
* Copyright (c) Linux Test Project, 2004-2017
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ */
+
+/*
* DESCRIPTION
* hugeshmget05 - test for EACCES error
*
@@ -15,12 +26,19 @@
#include <sys/wait.h>
#include <limits.h>
#include "hugetlb.h"
+#include "hugetlb.h"
static size_t shm_size;
static int shm_id_1 = -1;
static uid_t ltp_uid;
static char *ltp_user = "nobody";
+static long hugepages = 128;
+static struct tst_option options[] = {
+ {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
+ {NULL, NULL, NULL}
+};
+
static void do_child(void);
static void test_hugeshmget(void)
@@ -31,7 +49,6 @@ static void test_hugeshmget(void)
switch (pid = fork()) {
case -1:
tst_brk(TBROK | TERRNO, "fork");
- break;
case 0:
/* set the user ID of the child to the non root user */
SAFE_SETUID(ltp_uid);
@@ -61,12 +78,15 @@ void setup(void)
{
long hpage_size;
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ save_nr_hugepages();
+ if (nr_opt)
+ hugepages = SAFE_STRTOL(nr_opt, 0, LONG_MAX);
+ limit_hugepages(&hugepages);
+ set_sys_tune("nr_hugepages", hugepages, 1);
hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- shm_size = hpage_size * tst_hugepages / 2;
+ shm_size = hpage_size * hugepages / 2;
update_shm_size(&shm_size);
shmkey = getipckey();
shm_id_1 = shmget(shmkey, shm_size,
@@ -81,16 +101,13 @@ void setup(void)
void cleanup(void)
{
rm_shm(shm_id_1);
+ restore_nr_hugepages();
}
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"s:", &nr_opt, "-s num Set the number of the been allocated hugepages"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = test_hugeshmget,
- .request_hugepages = 128,
};
diff --git a/testcases/kernel/mem/hugetlb/lib/Makefile b/testcases/kernel/mem/hugetlb/lib/Makefile
index 2e893429d..c5c55648f 100644
--- a/testcases/kernel/mem/hugetlb/lib/Makefile
+++ b/testcases/kernel/mem/hugetlb/lib/Makefile
@@ -21,6 +21,6 @@ top_srcdir ?= ../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
-INTERNAL_LIB := libhugetlb.a
+LIB := libhugetlb.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
index 1204f21d2..83b85f325 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -35,11 +35,52 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <sys/time.h>
+#include <sys/timeb.h>
#include <pwd.h>
#include "hugetlb.h"
-key_t shmkey;
+static long orig_hugepages = -1;
+
+long save_nr_hugepages(void)
+{
+ check_hugepage();
+
+ orig_hugepages = get_sys_tune("nr_hugepages");
+
+ return orig_hugepages;
+}
+
+void restore_nr_hugepages(void)
+{
+ if (orig_hugepages != -1)
+ set_sys_tune("nr_hugepages", orig_hugepages, 0);
+}
+
+void limit_hugepages(long *hpages)
+{
+ long mem_avail, max_hpages;
+
+ if (FILE_LINES_SCANF("/proc/meminfo",
+ "MemAvailable: %ld", &mem_avail)) {
+ /*
+ * Dropping caches and using "MemFree:" on kernel
+ * that doesn't have "MemAvailable:" in Meminfo
+ */
+ tst_res(TINFO, "MemAvailable: not found in /proc/meminfo");
+
+ SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
+ mem_avail = SAFE_READ_MEMINFO("MemFree:");
+ }
+
+ max_hpages = mem_avail / SAFE_READ_MEMINFO("Hugepagesize:");
+
+ if (*hpages > max_hpages) {
+ tst_res(TINFO, "Requested number of hugepages too large, "
+ "limiting to 80%% of the max hugepage count %ld",
+ max_hpages);
+ *hpages = max_hpages * 0.8;
+ }
+}
/*
* getipckey() - generates and returns a message key used by the "get"
@@ -52,7 +93,7 @@ int getipckey(void)
char *curdir = NULL;
size_t size = 0;
key_t ipc_key;
- struct timeval time_info;
+ struct timeb time_info;
curdir = getcwd(curdir, size);
if (curdir == NULL)
@@ -67,11 +108,11 @@ int getipckey(void)
* project identifier is a "random character" produced by
* generating a random number between 0 and 25 and then adding
* that to the ascii value of 'a'. The "seed" for the random
- * number is the microseconds value that is set in the timeval
- * structure after calling gettimeofday().
+ * number is the millisecond value that is set in the timeb
+ * structure after calling ftime().
*/
- gettimeofday(&time_info, NULL);
- srandom((unsigned int)time_info.tv_usec);
+ ftime(&time_info);
+ srandom((unsigned int)time_info.millitm);
ipc_key = ftok(curdir, ascii_a + random() % 26);
if (ipc_key == -1)
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index f75109f3e..66ad324ab 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -34,10 +34,17 @@
*/
#define MODE_MASK 0x01FF
-extern key_t shmkey; /* an IPC key generated by ftok() */
+key_t shmkey; /* an IPC key generated by ftok() */
int getipckey(void);
int getuserid(char *user);
void rm_shm(int shm_id);
+char *nr_opt;
+char *Hopt;
+void check_hugepage(void);
+long save_nr_hugepages(void);
+void restore_nr_hugepages(void);
+void limit_hugepages(long *hpages);
+
#endif /* hugetlb.h */
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 10712cf0c..a12c2231f 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -2,7 +2,6 @@
#define _MEM_H
#include "config.h"
#include "tst_test.h"
-#include "tst_cgroup.h"
#include "ksm_helper.h"
#if defined(__powerpc__) || defined(__powerpc64__)
@@ -38,7 +37,7 @@ static inline void clean_node(unsigned long *array)
#define MLOCK 2
#define KSM 3
-extern long overcommit;
+long overcommit;
void oom(int testcase, int lite, int retcode, int allow_sigkill);
void testoom(int mempolicy, int lite, int retcode, int allow_sigkill);
@@ -60,8 +59,24 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages);
void check_hugepage(void);
void write_memcg(void);
-/* cpuset/memcg - include/tst_cgroup.h */
-void write_cpusets(const struct tst_cgroup_group *cg, long nd);
+/* cpuset/memcg */
+
+#define CPATH "/dev/cpuset"
+#define CPATH_NEW CPATH "/1"
+#define MEMCG_PATH "/dev/cgroup"
+#define MEMCG_PATH_NEW MEMCG_PATH "/1"
+#define MEMCG_LIMIT MEMCG_PATH_NEW "/memory.limit_in_bytes"
+#define MEMCG_SW_LIMIT MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes"
+#if HAVE_SYS_EVENTFD_H
+#define PATH_OOMCTRL MEMCG_PATH_NEW "/memory.oom_control"
+#define PATH_EVTCTRL MEMCG_PATH_NEW "/cgroup.event_control"
+#endif
+
+void read_cpuset_files(char *prefix, char *filename, char *retbuf);
+void write_cpuset_files(char *prefix, char *filename, char *buf);
+void write_cpusets(long nd);
+void mount_mem(char *name, char *fs, char *options, char *path, char *path_new);
+void umount_mem(char *path, char *path_new);
/* shared */
unsigned int get_a_numa_node(void);
diff --git a/testcases/kernel/mem/ksm/ksm01.c b/testcases/kernel/mem/ksm/ksm01.c
index cd2c5c6ee..e78d3eee8 100644
--- a/testcases/kernel/mem/ksm/ksm01.c
+++ b/testcases/kernel/mem/ksm/ksm01.c
@@ -95,18 +95,10 @@ static void cleanup(void)
static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"n:", &opt_numstr, "-n Number of processes"},
- {"s:", &opt_sizestr, "-s Memory allocation size in MB"},
- {"u:", &opt_unitstr, "-u Memory allocation unit in MB"},
- {}
- },
+ .options = ksm_options,
.setup = setup,
.cleanup = cleanup,
- .save_restore = (const char * const[]) {
- "?/sys/kernel/mm/ksm/max_page_sharing",
- NULL,
- },
+ .save_restore = save_restore,
.test_all = verify_ksm,
.min_kver = "2.6.32",
};
diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
index 80017df66..3d4c19deb 100644
--- a/testcases/kernel/mem/ksm/ksm02.c
+++ b/testcases/kernel/mem/ksm/ksm02.c
@@ -59,8 +59,7 @@
#ifdef HAVE_NUMA_V2
#include <numaif.h>
-static const struct tst_cgroup_group *cg;
-static const struct tst_cgroup_group *cg_drain;
+static int cpuset_mounted;
static void verify_ksm(void)
{
@@ -79,10 +78,8 @@ static void verify_ksm(void)
}
create_same_memory(size, num, unit);
- write_cpusets(cg, node);
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
+ write_cpusets(node);
create_same_memory(size, num, unit);
- SAFE_CGROUP_PRINTF(cg_drain, "cgroup.procs", "%d", getpid());
}
static void cleanup(void)
@@ -91,7 +88,8 @@ static void cleanup(void)
FILE_PRINTF(PATH_KSM "merge_across_nodes",
"%d", merge_across_nodes);
- tst_cgroup_cleanup();
+ if (cpuset_mounted)
+ umount_mem(CPATH, CPATH_NEW);
}
static void setup(void)
@@ -107,26 +105,17 @@ static void setup(void)
SAFE_FILE_PRINTF(PATH_KSM "merge_across_nodes", "1");
}
- tst_cgroup_require("cpuset", NULL);
- cg = tst_cgroup_get_test_group();
- cg_drain = tst_cgroup_get_drain_group();
+ mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
+ cpuset_mounted = 1;
}
static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"n:", &opt_numstr, "-n Number of processes"},
- {"s:", &opt_sizestr, "-s Memory allocation size in MB"},
- {"u:", &opt_unitstr, "-u Memory allocation unit in MB"},
- {}
- },
+ .options = ksm_options,
.setup = setup,
.cleanup = cleanup,
- .save_restore = (const char * const[]) {
- "?/sys/kernel/mm/ksm/max_page_sharing",
- NULL,
- },
+ .save_restore = save_restore,
.test_all = verify_ksm,
.min_kver = "2.6.32",
};
diff --git a/testcases/kernel/mem/ksm/ksm03.c b/testcases/kernel/mem/ksm/ksm03.c
index 83b821c81..0e5131654 100644
--- a/testcases/kernel/mem/ksm/ksm03.c
+++ b/testcases/kernel/mem/ksm/ksm03.c
@@ -59,10 +59,11 @@
#include "mem.h"
#include "ksm_common.h"
-static const struct tst_cgroup_group *cg;
+static int memcg_mounted;
static void verify_ksm(void)
{
+ write_memcg();
create_same_memory(size, num, unit);
}
@@ -78,11 +79,8 @@ static void setup(void)
}
parse_ksm_options(opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);
-
- tst_cgroup_require("memory", NULL);
- cg = tst_cgroup_get_test_group();
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%lu", TESTMEM);
+ mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
+ memcg_mounted = 1;
}
static void cleanup(void)
@@ -90,24 +88,18 @@ static void cleanup(void)
if (access(PATH_KSM "merge_across_nodes", F_OK) == 0)
FILE_PRINTF(PATH_KSM "merge_across_nodes",
"%d", merge_across_nodes);
- tst_cgroup_cleanup();
+
+ if (memcg_mounted)
+ umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
}
static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"n:", &opt_numstr, "-n Number of processes"},
- {"s:", &opt_sizestr, "-s Memory allocation size in MB"},
- {"u:", &opt_unitstr, "-u Memory allocation unit in MB"},
- {}
- },
+ .options = ksm_options,
.setup = setup,
.cleanup = cleanup,
- .save_restore = (const char * const[]) {
- "?/sys/kernel/mm/ksm/max_page_sharing",
- NULL,
- },
+ .save_restore = save_restore,
.test_all = verify_ksm,
.min_kver = "2.6.32",
};
diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
index 65f7e6510..e393dbd40 100644
--- a/testcases/kernel/mem/ksm/ksm04.c
+++ b/testcases/kernel/mem/ksm/ksm04.c
@@ -59,7 +59,8 @@
#ifdef HAVE_NUMA_V2
#include <numaif.h>
-static const struct tst_cgroup_group *cg;
+static int cpuset_mounted;
+static int memcg_mounted;
static void verify_ksm(void)
{
@@ -69,7 +70,7 @@ static void verify_ksm(void)
node = get_a_numa_node();
set_node(nmask, node);
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%lu", TESTMEM);
+ write_memcg();
if (set_mempolicy(MPOL_BIND, nmask, MAXNODES) == -1) {
if (errno != ENOSYS)
@@ -80,7 +81,7 @@ static void verify_ksm(void)
}
create_same_memory(size, num, unit);
- write_cpusets(cg, node);
+ write_cpusets(node);
create_same_memory(size, num, unit);
}
@@ -90,7 +91,10 @@ static void cleanup(void)
FILE_PRINTF(PATH_KSM "merge_across_nodes",
"%d", merge_across_nodes);
- tst_cgroup_cleanup();
+ if (cpuset_mounted)
+ umount_mem(CPATH, CPATH_NEW);
+ if (memcg_mounted)
+ umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
}
static void setup(void)
@@ -106,27 +110,19 @@ static void setup(void)
parse_ksm_options(opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);
- tst_cgroup_require("memory", NULL);
- tst_cgroup_require("cpuset", NULL);
- cg = tst_cgroup_get_test_group();
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
+ mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
+ cpuset_mounted = 1;
+ mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
+ memcg_mounted = 1;
}
static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"n:", &opt_numstr, "-n Number of processes"},
- {"s:", &opt_sizestr, "-s Memory allocation size in MB"},
- {"u:", &opt_unitstr, "-u Memory allocation unit in MB"},
- {}
- },
+ .options = ksm_options,
.setup = setup,
.cleanup = cleanup,
- .save_restore = (const char * const[]) {
- "?/sys/kernel/mm/ksm/max_page_sharing",
- NULL,
- },
+ .save_restore = save_restore,
.test_all = verify_ksm,
.min_kver = "2.6.32",
};
diff --git a/testcases/kernel/mem/ksm/ksm05.c b/testcases/kernel/mem/ksm/ksm05.c
index 380bb0202..ca08f50ae 100644
--- a/testcases/kernel/mem/ksm/ksm05.c
+++ b/testcases/kernel/mem/ksm/ksm05.c
@@ -41,7 +41,7 @@
#include "tst_test.h"
#include "mem.h"
-#ifdef HAVE_DECL_MADV_MERGEABLE
+#ifdef HAVE_MADV_MERGEABLE
static int ksm_run_orig = -1;
static void sighandler(int sig);
diff --git a/testcases/kernel/mem/ksm/ksm06.c b/testcases/kernel/mem/ksm/ksm06.c
index 1c435586e..7f2f3c4ce 100644
--- a/testcases/kernel/mem/ksm/ksm06.c
+++ b/testcases/kernel/mem/ksm/ksm06.c
@@ -45,6 +45,15 @@ static int merge_across_nodes = -1;
static unsigned long nr_pages;
static char *n_opt;
+static struct tst_option ksm_options[] = {
+ {"n:", &n_opt, "-n x Allocate x pages memory per node"},
+ {NULL, NULL, NULL}
+};
+
+static const char * const save_restore[] = {
+ "?/sys/kernel/mm/ksm/max_page_sharing",
+ NULL,
+};
static void test_ksm(void)
{
@@ -88,16 +97,10 @@ static void cleanup(void)
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"n:", &n_opt, "-n x Allocate x pages memory per node"},
- {}
- },
+ .options = ksm_options,
.setup = setup,
.cleanup = cleanup,
- .save_restore = (const char * const[]) {
- "?/sys/kernel/mm/ksm/max_page_sharing",
- NULL,
- },
+ .save_restore = save_restore,
.test_all = test_ksm,
};
diff --git a/testcases/kernel/mem/ksm/ksm_common.h b/testcases/kernel/mem/ksm/ksm_common.h
index e6d5387c8..4cb569b61 100644
--- a/testcases/kernel/mem/ksm/ksm_common.h
+++ b/testcases/kernel/mem/ksm/ksm_common.h
@@ -14,6 +14,13 @@ int merge_across_nodes;
int size = 128, num = 3, unit = 1;
char *opt_sizestr, *opt_numstr, *opt_unitstr;
+struct tst_option ksm_options[] = {
+ {"n:", &opt_numstr, "-n Number of processes"},
+ {"s:", &opt_sizestr, "-s Memory allocation size in MB"},
+ {"u:", &opt_unitstr, "-u Memory allocation unit in MB"},
+ {NULL, NULL, NULL}
+};
+
static inline void parse_ksm_options(char *str_size, int *size,
char *str_num, int *num, char *str_unit, int *unit)
{
@@ -30,3 +37,8 @@ static inline void parse_ksm_options(char *str_size, int *size,
"the remainder of division of size by unit is "
"not zero.");
}
+
+static const char * const save_restore[] = {
+ "?/sys/kernel/mm/ksm/max_page_sharing",
+ NULL,
+};
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 9f946b5c9..456259792 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -52,7 +52,7 @@ static int alloc_mem(long int length, int testcase)
}
}
-#ifdef HAVE_DECL_MADV_MERGEABLE
+#ifdef HAVE_MADV_MERGEABLE
if (testcase == KSM && madvise(s, length, MADV_MERGEABLE) == -1)
return errno;
#endif
@@ -312,6 +312,13 @@ void check_hugepage(void)
tst_brk(TCONF, "Huge page is not supported.");
}
+void write_memcg(void)
+{
+ SAFE_FILE_PRINTF(MEMCG_LIMIT, "%ld", TESTMEM);
+
+ SAFE_FILE_PRINTF(MEMCG_PATH_NEW "/tasks", "%d", getpid());
+}
+
struct ksm_merge_data {
char data;
unsigned int mergeable_size;
@@ -361,7 +368,7 @@ static void create_ksm_child(int child_num, int size, int unit,
for (j = 0; j < total_unit; j++) {
memory[j] = SAFE_MMAP(NULL, unit * MB, PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-#ifdef HAVE_DECL_MADV_MERGEABLE
+#ifdef HAVE_MADV_MERGEABLE
if (madvise(memory[j], unit * MB, MADV_MERGEABLE) == -1)
tst_brk(TBROK|TERRNO, "madvise");
#endif
@@ -544,7 +551,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
for (i = 0; i < num_nodes; i++) {
memory[i] = SAFE_MMAP(NULL, length, PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-#ifdef HAVE_DECL_MADV_MERGEABLE
+#ifdef HAVE_MADV_MERGEABLE
if (madvise(memory[i], length, MADV_MERGEABLE) == -1)
tst_brk(TBROK|TERRNO, "madvise");
#endif
@@ -596,6 +603,7 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages)
/* THP */
/* cpuset/memcg */
+
static void gather_node_cpus(char *cpus, long nd)
{
int ncpus = 0;
@@ -629,11 +637,62 @@ static void gather_node_cpus(char *cpus, long nd)
cpus[strlen(cpus) - 1] = '\0';
}
-void write_cpusets(const struct tst_cgroup_group *cg, long nd)
+void read_cpuset_files(char *prefix, char *filename, char *retbuf)
+{
+ int fd;
+ char path[BUFSIZ];
+
+ /*
+ * try either '/dev/cpuset/XXXX' or '/dev/cpuset/cpuset.XXXX'
+ * please see Documentation/cgroups/cpusets.txt from kernel src
+ * for details
+ */
+ snprintf(path, BUFSIZ, "%s/%s", prefix, filename);
+ fd = open(path, O_RDONLY);
+ if (fd == -1) {
+ if (errno == ENOENT) {
+ snprintf(path, BUFSIZ, "%s/cpuset.%s",
+ prefix, filename);
+ fd = SAFE_OPEN(path, O_RDONLY);
+ } else
+ tst_brk(TBROK | TERRNO, "open %s", path);
+ }
+ if (read(fd, retbuf, BUFSIZ) < 0)
+ tst_brk(TBROK | TERRNO, "read %s", path);
+ close(fd);
+}
+
+void write_cpuset_files(char *prefix, char *filename, char *buf)
+{
+ int fd;
+ char path[BUFSIZ];
+
+ /*
+ * try either '/dev/cpuset/XXXX' or '/dev/cpuset/cpuset.XXXX'
+ * please see Documentation/cgroups/cpusets.txt from kernel src
+ * for details
+ */
+ snprintf(path, BUFSIZ, "%s/%s", prefix, filename);
+ fd = open(path, O_WRONLY);
+ if (fd == -1) {
+ if (errno == ENOENT) {
+ snprintf(path, BUFSIZ, "%s/cpuset.%s",
+ prefix, filename);
+ fd = SAFE_OPEN(path, O_WRONLY);
+ } else
+ tst_brk(TBROK | TERRNO, "open %s", path);
+ }
+ SAFE_WRITE(1, fd, buf, strlen(buf));
+ close(fd);
+}
+
+void write_cpusets(long nd)
{
+ char buf[BUFSIZ];
char cpus[BUFSIZ] = "";
- SAFE_CGROUP_PRINTF(cg, "cpuset.mems", "%ld", nd);
+ snprintf(buf, BUFSIZ, "%ld", nd);
+ write_cpuset_files(CPATH_NEW, "mems", buf);
gather_node_cpus(cpus, nd);
/*
@@ -642,12 +701,65 @@ void write_cpusets(const struct tst_cgroup_group *cg, long nd)
* the value of cpuset.cpus.
*/
if (strlen(cpus) != 0) {
- SAFE_CGROUP_PRINT(cg, "cpuset.cpus", cpus);
+ write_cpuset_files(CPATH_NEW, "cpus", cpus);
} else {
tst_res(TINFO, "No CPUs in the node%ld; "
"using only CPU0", nd);
- SAFE_CGROUP_PRINT(cg, "cpuset.cpus", "0");
+ write_cpuset_files(CPATH_NEW, "cpus", "0");
+ }
+
+ SAFE_FILE_PRINTF(CPATH_NEW "/tasks", "%d", getpid());
+}
+
+void umount_mem(char *path, char *path_new)
+{
+ FILE *fp;
+ int fd;
+ char s_new[BUFSIZ], s[BUFSIZ], value[BUFSIZ];
+
+ /* Move all processes in task to its parent node. */
+ sprintf(s, "%s/tasks", path);
+ fd = open(s, O_WRONLY);
+ if (fd == -1)
+ tst_res(TWARN | TERRNO, "open %s", s);
+
+ snprintf(s_new, BUFSIZ, "%s/tasks", path_new);
+ fp = fopen(s_new, "r");
+ if (fp == NULL)
+ tst_res(TWARN | TERRNO, "fopen %s", s_new);
+ if ((fd != -1) && (fp != NULL)) {
+ while (fgets(value, BUFSIZ, fp) != NULL)
+ if (write(fd, value, strlen(value) - 1)
+ != (ssize_t)strlen(value) - 1)
+ tst_res(TWARN | TERRNO, "write %s", s);
+ }
+ if (fd != -1)
+ close(fd);
+ if (fp != NULL)
+ fclose(fp);
+ if (rmdir(path_new) == -1)
+ tst_res(TWARN | TERRNO, "rmdir %s", path_new);
+ if (umount(path) == -1)
+ tst_res(TWARN | TERRNO, "umount %s", path);
+ if (rmdir(path) == -1)
+ tst_res(TWARN | TERRNO, "rmdir %s", path);
+}
+
+void mount_mem(char *name, char *fs, char *options, char *path, char *path_new)
+{
+ SAFE_MKDIR(path, 0777);
+ if (mount(name, path, fs, 0, options) == -1) {
+ if (errno == ENODEV) {
+ if (rmdir(path) == -1)
+ tst_res(TWARN | TERRNO, "rmdir %s failed",
+ path);
+ tst_brk(TCONF,
+ "file system %s is not configured in kernel",
+ fs);
+ }
+ tst_brk(TBROK | TERRNO, "mount %s", path);
}
+ SAFE_MKDIR(path_new, 0777);
}
/* shared */
diff --git a/testcases/kernel/mem/mem/mem01.c b/testcases/kernel/mem/mem/mem01.c
new file mode 100644
index 000000000..b8fa5b7a0
--- /dev/null
+++ b/testcases/kernel/mem/mem/mem01.c
@@ -0,0 +1,249 @@
+/*
+ * mem01.c - Basic memory and swapper stress test
+ *
+ * Copyright (C) 2001 Stephane Fillod <f4cfe@free.fr>
+ * Original idea from Rene Cougnenc
+ *
+ * Copyright (C) 2012 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/sysinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/user.h>
+#include <time.h>
+#include <limits.h>
+
+#include "lapi/abisize.h"
+#include "test.h"
+
+/* in KB */
+#define PROGRESS_LEAP 100
+
+/*
+ * TODO:
+ * - add option for growing direction, when doing linear touching
+ * - add option for touch running time (or infinite loop?)
+ * - make it multithreaded with random access to test r/w mm_sem
+ */
+
+char *TCID = "mem01";
+int TST_TOTAL = 1;
+
+static int m_opt = 0; /* memsize */
+static char *m_copt;
+
+static int r_opt = 0; /* random access versus linear */
+static int v_opt = 0; /* verbose progress indication */
+
+static void cleanup(void)
+{
+ tst_rmdir();
+ tst_exit();
+}
+
+static void setup(void)
+{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+}
+
+static void help(void)
+{
+ printf(" -m x size of malloc in MB (default from /proc/meminfo)\n");
+ printf(" -r random touching versus linear\n");
+ printf(" -v verbose progress indication\n");
+}
+
+/*
+ * return MemFree+SwapFree, from /proc/meminfo
+ * returned value is in bytes.
+ */
+size_t get_memsize(void)
+{
+ struct sysinfo info;
+ unsigned long long res;
+ unsigned long long freeswap;
+ unsigned long long freeram;
+ int ret;
+
+ ret = sysinfo(&info);
+ if (ret != 0) {
+ tst_resm(TFAIL,
+ "Could not retrieve memory information using sysinfo()");
+ cleanup();
+ }
+
+ freeram =
+ (unsigned long long)info.freeram *
+ (unsigned long long)info.mem_unit;
+ tst_resm(TINFO, "Free Mem:\t%llu Mb", freeram / 1024 / 1024);
+ res = freeram;
+
+ freeswap =
+ (unsigned long long)info.freeswap *
+ (unsigned long long)info.mem_unit;
+ tst_resm(TINFO, "Free Swap:\t%llu Mb", freeswap / 1024 / 1024);
+ res = res + freeswap;
+
+ tst_resm(TINFO, "Total Free:\t%llu Mb", res / 1024 / 1024);
+#if defined(__s390__)
+ if (res > 1 * 1024 * 1024 * 1024)
+ res = 500 * 1024 * 1024; /* s390's unique 31bit architecture needs smaller default */
+#elif defined(TST_ABI32)
+ if (res > 1 * 1024 * 1024 * 1024)
+ res = 1 * 1024 * 1024 * 1024;
+#elif defined(TST_ABI64)
+ if (res > (unsigned long long)3 * 1024 * 1024 * 1024)
+ res = (unsigned long long)3 *1024 * 1024 * 1024;
+#endif
+
+ /* Always reserve 16MB memory to avoid OOM Killer. */
+ res -= 16 * 1024 * 1024;
+ tst_resm(TINFO, "Total Tested:\t%llu Mb", res / 1024 / 1024);
+ return (size_t) res;
+}
+
+/*
+ * add the -m option whose parameter is the
+ * memory size (MB) to allocate.
+ */
+option_t options[] = {
+ {"m:", &m_opt, &m_copt}
+ ,
+ {"r", &r_opt, NULL}
+ ,
+ {"v", &v_opt, NULL}
+ ,
+ {NULL, NULL, NULL}
+};
+
+int main(int argc, char *argv[])
+{
+ size_t memsize = 0; /* at first in MB, limited to 4Gb on 32 bits */
+ int pagesize;
+
+ int i;
+ int lc;
+ char *p, *bigmalloc;
+ int loop_count; /* limited to 16Go on 32 bits systems */
+
+ pagesize = sysconf(_SC_PAGESIZE);
+
+ tst_parse_opts(argc, argv, options, help);
+
+ if (m_opt) {
+ memsize = (size_t) atoi(m_copt) * 1024 * 1024;
+
+ if (memsize < 1) {
+ tst_brkm(TBROK, cleanup, "Invalid arg for -m: %s",
+ m_copt);
+ }
+ }
+
+ if (r_opt)
+ srand(time(NULL));
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ if (!m_opt) {
+ /* find out by ourselves! */
+ memsize = get_memsize();
+ if (memsize < 1) {
+ tst_brkm(TBROK, cleanup,
+ "Unable to guess maxmemsize from /proc/meminfo");
+ }
+ }
+
+ /* Allocate (virtual) memory */
+ bigmalloc = p = malloc(memsize);
+
+ if (!p) {
+ tst_resm(TFAIL, "malloc - alloc of %zuMB failed",
+ memsize / 1024 / 1024);
+ cleanup();
+ }
+
+ /*
+ * Dirty all the pages, to force physical RAM allocation
+ * and exercise eventually the swapper
+ */
+ tst_resm(TINFO, "touching %zuMB of malloc'ed memory (%s)",
+ memsize / 1024 / 1024, r_opt ? "random" : "linear");
+
+ loop_count = memsize / pagesize;
+
+ for (i = 0; i < loop_count; i++) {
+ if (v_opt
+ && (i % (PROGRESS_LEAP * 1024 / pagesize) == 0)) {
+ printf(".");
+ fflush(stdout);
+ }
+ /*
+ * Make the page dirty,
+ * and make sure compiler won't optimize it away
+ * Touching more than one word per page is useless
+ * because of cache.
+ */
+ *(int *)p = 0xdeadbeef ^ i;
+
+ if (r_opt) {
+ p = bigmalloc +
+ (size_t) ((double)(memsize - sizeof(int)) *
+ rand() / (RAND_MAX + 1.0));
+ } else {
+ p += pagesize;
+ }
+ }
+
+ if (v_opt)
+ printf("\n");
+
+ /* This is not mandatory (except in a loop), but it exercise mm again */
+ free(bigmalloc);
+
+ /*
+ * seems that if the malloc'ed area was bad, we'd get SEGV (or kicked
+ * somehow by the OOM killer?), hence we can indicate a PASS.
+ */
+ tst_resm(TPASS, "malloc - alloc of %zuMB succeeded",
+ memsize / 1024 / 1024);
+
+ }
+
+ cleanup();
+
+ return 0;
+}
diff --git a/testcases/kernel/mem/mmapstress/mmap-corruption01.c b/testcases/kernel/mem/mmapstress/mmap-corruption01.c
index ccc0797d2..262bc97e7 100644
--- a/testcases/kernel/mem/mmapstress/mmap-corruption01.c
+++ b/testcases/kernel/mem/mmapstress/mmap-corruption01.c
@@ -67,7 +67,7 @@ char *usage = "-h hours -m minutes -s secs\n";
int anyfail(void)
{
- tst_brkm(TFAIL, tst_rmdir, "Test failed");
+ tst_brkm(TFAIL, tst_rmdir, "Test failed\n");
}
int main(int argc, char **argv)
diff --git a/testcases/kernel/mem/mmapstress/mmapstress01.c b/testcases/kernel/mem/mmapstress/mmapstress01.c
index 3b4b1ac24..d2df6122b 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress01.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress01.c
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
progname = *argv;
tst_tmpdir();
if (argc < 2) {
- tst_brkm(TBROK, NULL, "usage: %s %s", progname, usage);
+ tst_brkm(TBROK, NULL, "usage: %s %s\n", progname, usage);
}
while ((c = getopt(argc, argv, "S:omdlrf:p:t:")) != -1) {
diff --git a/testcases/kernel/mem/mmapstress/mmapstress02.c b/testcases/kernel/mem/mmapstress/mmapstress02.c
index 9ea73edee..d0e99ec58 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress02.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress02.c
@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
/***** LTP Port *****/
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_rmdir();
tst_exit();
}
diff --git a/testcases/kernel/mem/mmapstress/mmapstress05.c b/testcases/kernel/mem/mmapstress/mmapstress05.c
index e255a5049..a8e6a44a3 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress05.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress05.c
@@ -204,12 +204,12 @@ int main(int argc, char *argv[])
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_rmdir();
tst_exit();
}
int anyfail(void)
{
- tst_brkm(TFAIL, tst_rmdir, "Test failed");
+ tst_brkm(TFAIL, tst_rmdir, "Test failed\n");
}
diff --git a/testcases/kernel/mem/mmapstress/mmapstress06.c b/testcases/kernel/mem/mmapstress/mmapstress06.c
index 37b7edc84..133ba7479 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress06.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress06.c
@@ -104,13 +104,13 @@ int main(int argc, char *argv[])
/***** LTP Port *****/
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_exit();
}
int anyfail(void)
{
- tst_brkm(TFAIL, NULL, "Test failed");
+ tst_brkm(TFAIL, NULL, "Test failed\n");
}
/***** ** ** *****/
diff --git a/testcases/kernel/mem/mmapstress/mmapstress07.c b/testcases/kernel/mem/mmapstress/mmapstress07.c
index 101c159a0..f99bc09e8 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress07.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress07.c
@@ -313,12 +313,12 @@ static int checkchars(int fd, char val, int n)
/***** ** LTP Port ** *****/
int anyfail(void)
{
- tst_brkm(TFAIL, tst_rmdir, "Test failed");
+ tst_brkm(TFAIL, tst_rmdir, "Test failed\n");
}
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_rmdir();
tst_exit();
}
diff --git a/testcases/kernel/mem/mmapstress/mmapstress08.c b/testcases/kernel/mem/mmapstress/mmapstress08.c
index d4937271c..c5cf0fb9b 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress08.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress08.c
@@ -107,13 +107,13 @@ extern long sysconf(int name);
/***** LTP Port *****/
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_exit();
}
int anyfail(void)
{
- tst_brkm(TFAIL, NULL, "Test failed");
+ tst_brkm(TFAIL, NULL, "Test failed\n");
}
#else /* defined(__i386__) || defined(__x86_64__) */
diff --git a/testcases/kernel/mem/mmapstress/mmapstress09.c b/testcases/kernel/mem/mmapstress/mmapstress09.c
index 2c710df1e..59033b720 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress09.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress09.c
@@ -488,13 +488,13 @@ unsigned int initrand(void)
/***** LTP Port *****/
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_exit();
}
int anyfail(void)
{
- tst_brkm(TFAIL, NULL, "Test failed");
+ tst_brkm(TFAIL, NULL, "Test failed\n");
}
/***** ** ** *****/
diff --git a/testcases/kernel/mem/mmapstress/mmapstress10.c b/testcases/kernel/mem/mmapstress/mmapstress10.c
index 26ea98bc1..cf8403ef4 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress10.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress10.c
@@ -928,14 +928,14 @@ unsigned int initrand(void)
/***** LTP Port *****/
void ok_exit(void)
{
- tst_resm(TPASS, "Test passed");
+ tst_resm(TPASS, "Test passed\n");
tst_rmdir();
tst_exit();
}
int anyfail(void)
{
- tst_brkm(TFAIL, tst_rmdir, "Test failed");
+ tst_brkm(TFAIL, tst_rmdir, "Test failed\n");
}
/***** ** ** *****/
diff --git a/testcases/kernel/mem/mtest01/mtest01.c b/testcases/kernel/mem/mtest01/mtest01.c
index 9676ea4b5..446d26897 100644
--- a/testcases/kernel/mem/mtest01/mtest01.c
+++ b/testcases/kernel/mem/mtest01/mtest01.c
@@ -55,6 +55,14 @@ static char *dowrite;
static char *verbose;
static char *opt_chunksize, *opt_maxbytes, *opt_maxpercent;
+static struct tst_option mtest_options[] = {
+ {"c:", &opt_chunksize, "-c size of chunk in bytes to malloc on each pass"},
+ {"b:", &opt_maxbytes, "-b maximum number of bytes to allocate before stopping"},
+ {"p:", &opt_maxpercent, "-p percent of total memory used at which the program stops"},
+ {"w", &dowrite, "-w write to the memory after allocating"},
+ {"v", &verbose, "-v verbose"},
+ {NULL, NULL, NULL}
+};
static void parse_mtest_options(char *str_chunksize, int *chunksize,
char *str_maxbytes, long *maxbytes,
@@ -219,21 +227,14 @@ static void mem_test(void)
alloc_maxbytes / 1024, write_msg);
for (i = 0; i < pid_cntr; i++) {
- TST_PROCESS_STATE_WAIT(pid_list[i], 'T', 0);
+ TST_PROCESS_STATE_WAIT(pid_list[i], 'T');
kill(pid_list[i], SIGCONT);
}
}
static struct tst_test test = {
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"c:", &opt_chunksize, "-c size of chunk in bytes to malloc on each pass"},
- {"b:", &opt_maxbytes, "-b maximum number of bytes to allocate before stopping"},
- {"p:", &opt_maxpercent, "-p percent of total memory used at which the program stops"},
- {"w", &dowrite, "-w write to the memory after allocating"},
- {"v", &verbose, "-v verbose"},
- {}
- },
+ .options = mtest_options,
.setup = setup,
.cleanup = cleanup,
.test_all = mem_test,
diff --git a/testcases/kernel/mem/mtest05/mmstress.c b/testcases/kernel/mem/mtest05/mmstress.c
index 60d49417b..4d8efdb6b 100644
--- a/testcases/kernel/mem/mtest05/mmstress.c
+++ b/testcases/kernel/mem/mtest05/mmstress.c
@@ -289,8 +289,6 @@ int map_and_thread(char *tmpfile,
static pthread_t pthread_ids[NUMTHREAD];
/* contains ids of the threads created */
void * map_addr = NULL; /* address where the file is mapped */
- ssize_t written = 0;
- ssize_t bytes;
/* Create a file with permissions 0666, and open it with RDRW perms */
/* if the name is not a NULL */
@@ -301,38 +299,22 @@ int map_and_thread(char *tmpfile,
S_IRWXO | S_IRWXU | S_IRWXG))
== -1) {
perror("map_and_thread(): open()");
+ close(fd);
fflush(NULL);
return FAILED;
}
/* Write pagesize * pages_num bytes to the file */
empty_buf = malloc(pagesize * pages_num);
- if (!empty_buf) {
- perror("map_and_thread(): malloc()");
+ if (write(fd, empty_buf, pagesize * pages_num) !=
+ (pagesize * pages_num)) {
+ perror("map_and_thread(): write()");
+ free(empty_buf);
+ fflush(NULL);
remove_files(tmpfile, NULL);
close(fd);
- fflush(NULL);
return FAILED;
}
-
- /* Writing fewer bytes than required is not an error so retry if
- * fewer were written; if that happened due to some permanent
- * error like ENOSPC the following retry will fail and a proper
- * errno will be reported.
- */
- do {
- bytes = write(fd, empty_buf + written,
- pagesize * pages_num - written);
- if (bytes < 0) {
- perror("map_and_thread(): write()");
- free(empty_buf);
- fflush(NULL);
- close(fd);
- remove_files(tmpfile, NULL);
- return FAILED;
- }
- written += bytes;
- } while (written < pagesize * pages_num);
map_type = (fault_type == COW_FAULT) ? MAP_PRIVATE : MAP_SHARED;
/* Map the file, if the required fault type is COW_FAULT map the file */
@@ -706,7 +688,7 @@ int main(int argc, char **argv)
argv[0], optopt);
break;
default:
- tst_brkm(TBROK, NULL, "%s: getopt() failed!!!",
+ tst_brkm(TBROK, NULL, "%s: getopt() failed!!!\n",
argv[0]);
}
}
diff --git a/testcases/kernel/mem/mtest06/mmap1.c b/testcases/kernel/mem/mtest06/mmap1.c
index 10c47c35c..c5417444f 100644
--- a/testcases/kernel/mem/mtest06/mmap1.c
+++ b/testcases/kernel/mem/mtest06/mmap1.c
@@ -32,7 +32,11 @@
#include "tst_test.h"
#include "tst_safe_pthread.h"
-#define GIGABYTE (1L*1024*1024*1024)
+#ifdef TST_ABI32
+# define DISTANT_MMAP_SIZE (256*1024*1024)
+#else
+# define DISTANT_MMAP_SIZE (2L*1024*1024*1024)
+#endif
#define TEST_FILENAME "ashfile"
/* seconds remaining before reaching timeout */
@@ -61,6 +65,11 @@ static int mapcnt, unmapcnt;
/* stored sequence id before making read attempt */
static int br_map, br_unmap;
+static struct tst_option options[] = {
+ {"x:", &str_exec_time, "Exec time (hours)"},
+ {NULL, NULL, NULL}
+};
+
/* compare "before read" counters with "after read" counters */
static inline int was_area_mapped(int br_m, int br_u, int ar_m, int ar_u)
{
@@ -86,7 +95,7 @@ static void sig_handler(int signal, siginfo_t *info,
longjmp(jmpbuf, 1);
break;
default:
- tst_res(TFAIL, "Unexpected signal - %d, addr: %p, exiting",
+ tst_res(TFAIL, "Unexpected signal - %d, addr: %p, exiting\n",
signal, info->si_addr);
_exit(TBROK);
}
@@ -185,26 +194,17 @@ int mkfile(int size)
static void setup(void)
{
struct sigaction sigptr;
- size_t distant_mmap_size;
- size_t mem_total;
page_sz = getpagesize();
- mem_total = SAFE_READ_MEMINFO("MemTotal:");
- mem_total *= 1024;
-#ifdef TST_ABI32
- distant_mmap_size = 256*1024*1024;
-#else
- distant_mmap_size = (mem_total > 4 * GIGABYTE) ? 2 * GIGABYTE : mem_total / 2;
-#endif
/*
* Used as hint for mmap thread, so it doesn't interfere
* with other potential (temporary) mappings from libc
*/
- distant_area = SAFE_MMAP(0, distant_mmap_size, PROT_WRITE | PROT_READ,
+ distant_area = SAFE_MMAP(0, DISTANT_MMAP_SIZE, PROT_WRITE | PROT_READ,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- SAFE_MUNMAP(distant_area, distant_mmap_size);
- distant_area += distant_mmap_size / 2;
+ SAFE_MUNMAP(distant_area, (size_t)DISTANT_MMAP_SIZE);
+ distant_area += DISTANT_MMAP_SIZE / 2;
if (tst_parse_float(str_exec_time, &exec_time, 0, FLT_MAX)) {
tst_brk(TBROK, "Invalid number for exec_time '%s'",
@@ -258,9 +258,6 @@ static void run(void)
static struct tst_test test = {
.test_all = run,
.setup = setup,
- .options = (struct tst_option[]) {
- {"x:", &str_exec_time, "Exec time (hours)"},
- {}
- },
+ .options = options,
.needs_tmpdir = 1,
};
diff --git a/testcases/kernel/mem/mtest06/mmap3.c b/testcases/kernel/mem/mtest06/mmap3.c
index c18bd2f56..c83dd6fcf 100644
--- a/testcases/kernel/mem/mtest06/mmap3.c
+++ b/testcases/kernel/mem/mtest06/mmap3.c
@@ -179,14 +179,16 @@ static void cleanup(void)
}
}
+static struct tst_option options[] = {
+ {"l:", &str_loops, "-l uint Number of map-write-unmap loops"},
+ {"n:", &str_threads, "-n uint Number of worker threads"},
+ {"p", &map_private, "-p Turns on MAP_PRIVATE (default MAP_SHARED)"},
+ {"x:", &str_exec_time, "-x float Execution time in hours (default 24H)"},
+ {NULL, NULL, NULL}
+};
+
static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"l:", &str_loops, "-l uint Number of map-write-unmap loops"},
- {"n:", &str_threads, "-n uint Number of worker threads"},
- {"p", &map_private, "-p Turns on MAP_PRIVATE (default MAP_SHARED)"},
- {"x:", &str_exec_time, "-x float Execution time in hours (default 24H)"},
- {}
- },
+ .options = options,
.needs_tmpdir = 1,
.setup = setup,
.cleanup = cleanup,
diff --git a/testcases/kernel/mem/mtest07/mallocstress.c b/testcases/kernel/mem/mtest07/mallocstress.c
index fa7494e7d..83a216dbb 100644
--- a/testcases/kernel/mem/mtest07/mallocstress.c
+++ b/testcases/kernel/mem/mtest07/mallocstress.c
@@ -167,7 +167,7 @@ static void stress_malloc(void)
SAFE_PTHREAD_JOIN(thread_id[thread_index], &status);
if ((intptr_t)status != 0) {
- tst_res(TFAIL, "thread [%d] - exited with errors",
+ tst_res(TFAIL, "thread [%d] - exited with errors\n",
thread_index);
}
}
diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
index 939413744..ce0b34c31 100644
--- a/testcases/kernel/mem/oom/oom03.c
+++ b/testcases/kernel/mem/oom/oom03.c
@@ -36,17 +36,27 @@
#ifdef HAVE_NUMA_V2
-static const struct tst_cgroup_group *cg;
+static int memcg_mounted;
static void verify_oom(void)
{
#ifdef TST_ABI32
tst_brk(TCONF, "test is not designed for 32-bit system.");
#endif
+
+ SAFE_FILE_PRINTF(MEMCG_PATH_NEW "/tasks", "%d", getpid());
+ SAFE_FILE_PRINTF(MEMCG_LIMIT, "%ld", TESTMEM);
+
testoom(0, 0, ENOMEM, 1);
- if (SAFE_CGROUP_HAS(cg, "memory.swap.max")) {
- SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", TESTMEM);
+ if (access(MEMCG_SW_LIMIT, F_OK) == -1) {
+ if (errno == ENOENT)
+ tst_res(TCONF,
+ "memcg swap accounting is disabled");
+ else
+ tst_brk(TBROK | TERRNO, "access");
+ } else {
+ SAFE_FILE_PRINTF(MEMCG_SW_LIMIT, "%ld", TESTMEM);
testoom(0, 1, ENOMEM, 1);
}
@@ -63,18 +73,16 @@ static void setup(void)
{
overcommit = get_sys_tune("overcommit_memory");
set_sys_tune("overcommit_memory", 1, 1);
-
- tst_cgroup_require("memory", NULL);
- cg = tst_cgroup_get_test_group();
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%lu", TESTMEM);
+ mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
+ memcg_mounted = 1;
}
static void cleanup(void)
{
if (overcommit != -1)
set_sys_tune("overcommit_memory", overcommit, 0);
- tst_cgroup_cleanup();
+ if (memcg_mounted)
+ umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
}
static struct tst_test test = {
diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
index f84328f5b..7185ef973 100644
--- a/testcases/kernel/mem/oom/oom04.c
+++ b/testcases/kernel/mem/oom/oom04.c
@@ -36,25 +36,24 @@
#ifdef HAVE_NUMA_V2
-static const struct tst_cgroup_group *cg;
+static int cpuset_mounted;
static void verify_oom(void)
{
#ifdef TST_ABI32
tst_brk(TCONF, "test is not designed for 32-bit system.");
#endif
+
tst_res(TINFO, "OOM on CPUSET...");
testoom(0, 0, ENOMEM, 1);
- if (is_numa(NULL, NH_MEMS, 2) &&
- SAFE_CGROUP_HAS(cg, "cpuset.memory_migrate")) {
+ if (is_numa(NULL, NH_MEMS, 2)) {
/*
* Under NUMA system, the migration of cpuset's memory
* is in charge of cpuset.memory_migrate, we can write
* 1 to cpuset.memory_migrate to enable the migration.
*/
- SAFE_CGROUP_PRINT(cg, "cpuset.memory_migrate", "1");
-
+ write_cpuset_files(CPATH_NEW, "memory_migrate", "1");
tst_res(TINFO, "OOM on CPUSET with mem migrate:");
testoom(0, 0, ENOMEM, 1);
}
@@ -70,8 +69,8 @@ static void setup(void)
overcommit = get_sys_tune("overcommit_memory");
set_sys_tune("overcommit_memory", 1, 1);
- tst_cgroup_require("cpuset", NULL);
- cg = tst_cgroup_get_test_group();
+ mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
+ cpuset_mounted = 1;
/*
* Some nodes do not contain memory, so use
@@ -83,15 +82,15 @@ static void setup(void)
if (ret < 0)
tst_brk(TBROK, "Failed to get a memory node "
"using get_allowed_nodes()");
- write_cpusets(cg, memnode);
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
+ write_cpusets(memnode);
}
static void cleanup(void)
{
if (overcommit != -1)
set_sys_tune("overcommit_memory", overcommit, 0);
- tst_cgroup_cleanup();
+ if (cpuset_mounted)
+ umount_mem(CPATH, CPATH_NEW);
}
static struct tst_test test = {
diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c
index 9c9bba7f6..db24df6de 100644
--- a/testcases/kernel/mem/oom/oom05.c
+++ b/testcases/kernel/mem/oom/oom05.c
@@ -36,10 +36,13 @@
#ifdef HAVE_NUMA_V2
-static const struct tst_cgroup_group *cg;
+static int memcg_mounted;
+static int cpuset_mounted;
static void verify_oom(void)
{
+ int swap_acc_on = 1;
+
#ifdef TST_ABI32
tst_brk(TCONF, "test is not designed for 32-bit system.");
#endif
@@ -52,26 +55,30 @@ static void verify_oom(void)
* is in charge of cpuset.memory_migrate, we can write
* 1 to cpuset.memory_migrate to enable the migration.
*/
- if (is_numa(NULL, NH_MEMS, 2) &&
- SAFE_CGROUP_HAS(cg, "cpuset.memory_migrate")) {
- SAFE_CGROUP_PRINT(cg, "cpuset.memory_migrate", "1");
+ if (is_numa(NULL, NH_MEMS, 2)) {
+ write_cpuset_files(CPATH_NEW, "memory_migrate", "1");
tst_res(TINFO, "OOM on CPUSET & MEMCG with "
"cpuset.memory_migrate=1");
testoom(0, 0, ENOMEM, 1);
}
- if (SAFE_CGROUP_HAS(cg, "memory.swap.max")) {
+ if (access(MEMCG_SW_LIMIT, F_OK) == -1) {
+ if (errno == ENOENT) {
+ tst_res(TCONF, "memcg swap accounting is disabled");
+ swap_acc_on = 0;
+ } else
+ tst_brk(TBROK|TERRNO, "access");
+ }
+
+ if (swap_acc_on) {
tst_res(TINFO, "OOM on CPUSET & MEMCG with "
"special memswap limitation:");
- SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", TESTMEM);
+ SAFE_FILE_PRINTF(MEMCG_SW_LIMIT, "%ld", TESTMEM);
testoom(0, 0, ENOMEM, 1);
tst_res(TINFO, "OOM on CPUSET & MEMCG with "
"disabled memswap limitation:");
- if (TST_CGROUP_VER(cg, "memory") == TST_CGROUP_V1)
- SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%lu", ~0UL);
- else
- SAFE_CGROUP_PRINT(cg, "memory.swap.max", "max");
+ SAFE_FILE_PRINTF(MEMCG_SW_LIMIT, "-1");
testoom(0, 0, ENOMEM, 1);
}
}
@@ -86,9 +93,11 @@ void setup(void)
overcommit = get_sys_tune("overcommit_memory");
set_sys_tune("overcommit_memory", 1, 1);
- tst_cgroup_require("memory", NULL);
- tst_cgroup_require("cpuset", NULL);
- cg = tst_cgroup_get_test_group();
+ mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
+ memcg_mounted = 1;
+ mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
+ cpuset_mounted = 1;
+ write_memcg();
/*
* Some nodes do not contain memory, so use
@@ -100,17 +109,17 @@ void setup(void)
if (ret < 0)
tst_brk(TBROK, "Failed to get a memory node "
"using get_allowed_nodes()");
-
- write_cpusets(cg, memnode);
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%lu", TESTMEM);
+ write_cpusets(memnode);
}
void cleanup(void)
{
if (overcommit != -1)
set_sys_tune("overcommit_memory", overcommit, 0);
- tst_cgroup_cleanup();
+ if (cpuset_mounted)
+ umount_mem(CPATH, CPATH_NEW);
+ if (memcg_mounted)
+ umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
}
static struct tst_test test = {
diff --git a/testcases/kernel/mem/page/page01.c b/testcases/kernel/mem/page/page01.c
index 9c7f3d487..a5a11894f 100644
--- a/testcases/kernel/mem/page/page01.c
+++ b/testcases/kernel/mem/page/page01.c
@@ -89,7 +89,7 @@ char *argv[];
bd_arg(argv[2]);
} else {
printf("page01 [memory size (words)] [nchild]\n");
- tst_resm(TCONF, "\tBad arg count.");
+ tst_resm(TCONF, "\tBad arg count.\n");
exit(1);
}
@@ -121,18 +121,18 @@ char *argv[];
memory_pointer = malloc(memory_size * sizeof(int));
if (memory_pointer == 0) {
tst_resm(TBROK,
- "Cannot allocate memory - malloc failed.");
+ "Cannot allocate memory - malloc failed.\n");
if (i < 2) {
tst_resm(TBROK,
- "This should not happen for first two children.");
+ "This should not happen for first two children.\n");
tst_brkm(TFAIL, NULL,
- "Child %d - fail.",
+ "Child %d - fail.\n",
i);
} else {
tst_resm(TCONF,
- "This is ok for all but first two children.");
+ "This is ok for all but first two children.\n");
tst_brkm(TCONF, NULL,
- "Child %d - ok.", i);
+ "Child %d - ok.\n", i);
}
}
number_pointer = memory_pointer;
@@ -183,8 +183,8 @@ char *argv[];
}
if (count != nchild) {
- tst_resm(TWARN, "Wrong number of children waited on.");
- tst_resm(TWARN, "Count = %d, expected = %d.", count, nchild);
+ tst_resm(TWARN, "Wrong number of children waited on.\n");
+ tst_resm(TWARN, "Count = %d, expected = %d.\n", count, nchild);
}
anyfail();
@@ -195,7 +195,7 @@ char *argv[];
int bd_arg(str)
char *str;
{
- tst_resm(TCONF, "\tCannot parse %s as a number.", str);
+ tst_resm(TCONF, "\tCannot parse %s as a number.\n", str);
exit(1);
}
@@ -254,7 +254,7 @@ void ok_exit()
*/
void forkfail()
{
- tst_brkm(TBROK, tst_rmdir, "Reason: %s", strerror(errno));
+ tst_brkm(TBROK, tst_rmdir, "Reason: %s\n", strerror(errno));
}
/*
@@ -266,7 +266,7 @@ void forkfail()
*/
void terror(char *message)
{
- tst_resm(TBROK, "Reason: %s:%s", message, strerror(errno));
+ tst_resm(TBROK, "Reason: %s:%s\n", message, strerror(errno));
return;
}
@@ -279,6 +279,6 @@ void terror(char *message)
int instress()
{
tst_resm(TINFO, "System resource may be too low, fork() malloc()"
- " etc are likely to fail.");
+ " etc are likely to fail.\n");
return 1;
}
diff --git a/testcases/kernel/mem/page/page02.c b/testcases/kernel/mem/page/page02.c
index cc08ee317..08f159640 100644
--- a/testcases/kernel/mem/page/page02.c
+++ b/testcases/kernel/mem/page/page02.c
@@ -95,7 +95,7 @@ char *argv[];
bd_arg(argv[2]);
} else {
printf("page02 [memory size (words)] [nchild]\n");
- tst_resm(TCONF, "\tBad arg count.");
+ tst_resm(TCONF, "\tBad arg count.\n");
exit(1);
}
half_memory_size = memory_size / 2;
@@ -114,9 +114,9 @@ char *argv[];
if ((pid = fork()) == -1) {
tst_resm(TBROK,
"Fork failed (may be OK if under stress)");
- tst_resm(TINFO, "System resource may be too low.");
+ tst_resm(TINFO, "System resource may be too low.\n");
local_flag = PASSED;
- tst_brkm(TBROK, tst_rmdir, "Reason: %s",
+ tst_brkm(TBROK, tst_rmdir, "Reason: %s\n",
strerror(errno));
} else if (pid == 0) {
/********************************/
@@ -128,23 +128,23 @@ char *argv[];
memory_pointer = malloc(memory_size * sizeof(int));
if (memory_pointer == 0) {
- tst_resm(TBROK, "\tCannot malloc memory.");
+ tst_resm(TBROK, "\tCannot malloc memory.\n");
if (i < 2) {
tst_resm(TBROK,
- "\tThis should not happen to first two children.");
- tst_resm(TBROK, "\tChild %d - fail.",
+ "\tThis should not happen to first two children.\n");
+ tst_resm(TBROK, "\tChild %d - fail.\n",
i);
} else {
tst_resm(TBROK,
- "\tThis is ok for all but first two children.");
- tst_resm(TBROK, "\tChild %d - ok.",
+ "\tThis is ok for all but first two children.\n");
+ tst_resm(TBROK, "\tChild %d - ok.\n",
i);
kill(parent_pid, SIGUSR1);
_exit(0);
}
tst_resm(TBROK, "malloc fail");
tst_resm(TFAIL,
- "\tImpossible to allocate memory of size %d in process %d",
+ "\t\nImpossible to allocate memory of size %d in process %d\n",
memory_size, i);
kill(parent_pid, SIGUSR1);
tst_exit();
@@ -209,8 +209,8 @@ char *argv[];
}
if (count != nchild) {
- tst_resm(TFAIL, "\tWrong number of children waited on.");
- tst_resm(TFAIL, "\tCount = %d, expected = %d.",
+ tst_resm(TFAIL, "\tWrong number of children waited on.\n");
+ tst_resm(TFAIL, "\tCount = %d, expected = %d.\n",
count, nchild);
}
@@ -224,7 +224,7 @@ char *argv[];
int bd_arg(str)
char *str;
{
- tst_brkm(TCONF, NULL, "\tCannot parse %s as a number.", str);
+ tst_brkm(TCONF, NULL, "\tCannot parse %s as a number.\n", str);
}
int chld()
diff --git a/testcases/kernel/mem/shmt/shmt02.c b/testcases/kernel/mem/shmt/shmt02.c
index b33a042f9..2541452d4 100644
--- a/testcases/kernel/mem/shmt/shmt02.c
+++ b/testcases/kernel/mem/shmt/shmt02.c
@@ -67,7 +67,7 @@ int main(void)
if ((shmid = shmget(key, 16 * K_1, IPC_CREAT | 0666)) < 0) {
perror("shmget");
tst_brkm(TFAIL, NULL,
- "shmget Failed: shmid = %d, errno = %d",
+ "shmget Failed: shmid = %d, errno = %d\n",
shmid, errno);
}
@@ -79,7 +79,7 @@ int main(void)
if (cp == (char *)-1) {
perror("shmat");
- tst_resm(TFAIL, "shmat Failed: shmid = %d, errno = %d",
+ tst_resm(TFAIL, "shmat Failed: shmid = %d, errno = %d\n",
shmid, errno);
rm_shm(shmid);
tst_exit();
@@ -96,7 +96,7 @@ int main(void)
if (*cp != '1' || *(cp + 1) != '2') {
tst_resm(TFAIL,
- "Error in shared memory contents: shmid = %d",
+ "Error in shared memory contents: shmid = %d\n",
shmid);
}
@@ -113,7 +113,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
diff --git a/testcases/kernel/mem/shmt/shmt03.c b/testcases/kernel/mem/shmt/shmt03.c
index 08c27ce02..ceb08d578 100644
--- a/testcases/kernel/mem/shmt/shmt03.c
+++ b/testcases/kernel/mem/shmt/shmt03.c
@@ -68,7 +68,7 @@ int main(void)
if ((shmid = shmget(key, 16 * K_1, IPC_CREAT | 0666)) < 0) {
perror("shmget");
tst_brkm(TFAIL, NULL,
- "shmget Failed: shmid = %d, errno = %d",
+ "shmget Failed: shmid = %d, errno = %d\n",
shmid, errno);
}
@@ -78,7 +78,7 @@ int main(void)
if ((cp1 = shmat(shmid, NULL, 0)) == (char *)-1) {
perror("shmat");
- tst_resm(TFAIL, "shmat Failed: shmid = %d, errno = %d",
+ tst_resm(TFAIL, "shmat Failed: shmid = %d, errno = %d\n",
shmid, errno);
} else {
*cp1 = '1';
@@ -92,13 +92,13 @@ int main(void)
if ((cp2 = shmat(shmid, NULL, 0)) == (char *)-1) {
perror("shmat");
- tst_resm(TFAIL, "shmat Failed: shmid = %d, errno = %d",
+ tst_resm(TFAIL, "shmat Failed: shmid = %d, errno = %d\n",
shmid, errno);
} else {
second_attach = SUCCESSFUL;
if ((*cp2 != '1' || *(cp2 + 5 * K_1) != '2') &&
first_attach == SUCCESSFUL) {
- tst_resm(TFAIL, "Error: Shared memory contents");
+ tst_resm(TFAIL, "Error: Shared memory contents\n");
}
}
@@ -111,7 +111,7 @@ int main(void)
if (first_attach && second_attach) {
if (*cp2 != '1' || *(cp2 + 5 * K_1) != '2' ||
*cp1 != '1' || *(cp1 + 5 * K_1) != '2') {
- tst_resm(TFAIL, "Error: Shared memory contents");
+ tst_resm(TFAIL, "Error: Shared memory contents\n");
}
}
@@ -126,7 +126,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
diff --git a/testcases/kernel/mem/shmt/shmt04.c b/testcases/kernel/mem/shmt/shmt04.c
index c9a654e7d..b2682dac8 100644
--- a/testcases/kernel/mem/shmt/shmt04.c
+++ b/testcases/kernel/mem/shmt/shmt04.c
@@ -87,7 +87,7 @@ int main(void)
if ((shmid = shmget(key, SIZE, IPC_CREAT | 0666)) < 0) {
perror("shmget");
- tst_resm(TFAIL, "Error: shmget: shmid = %d, errno = %d",
+ tst_resm(TFAIL, "Error: shmget: shmid = %d, errno = %d\n",
shmid, errno);
/*
* kill the child if parent failed to do the attach
@@ -99,7 +99,7 @@ int main(void)
if (cp == (char *)-1) {
perror("shmat");
tst_resm(TFAIL,
- "Error: shmat: shmid = %d, errno = %d",
+ "Error: shmat: shmid = %d, errno = %d\n",
shmid, errno);
/* kill the child if parent failed to do the attch */
@@ -121,7 +121,7 @@ int main(void)
if (pid1 != pid) {
tst_resm(TFAIL, "Waited on the wrong child");
tst_resm(TFAIL,
- "Error: wait_status = %d, pid1= %d", status,
+ "Error: wait_status = %d, pid1= %d\n", status,
pid1);
}
}
@@ -155,7 +155,7 @@ int child(void)
if ((shmid = shmget(key, SIZE, 0)) < 0) {
perror("shmget:child process");
tst_resm(TFAIL,
- "Error: shmget: errno=%d, shmid=%d, child_pid=%d",
+ "Error: shmget: errno=%d, shmid=%d, child_pid=%d\n",
errno, shmid, chld_pid);
} else {
cp = shmat(shmid, NULL, 0);
@@ -163,20 +163,20 @@ int child(void)
if (cp == (char *)-1) {
perror("shmat:child process");
tst_resm(TFAIL,
- "Error: shmat: errno=%d, shmid=%d, child_pid=%d",
+ "Error: shmat: errno=%d, shmid=%d, child_pid=%d\n",
errno, shmid, chld_pid);
} else {
if (*cp != 'A') {
- tst_resm(TFAIL, "child: not A");
+ tst_resm(TFAIL, "child: not A\n");
}
if (*(cp + 1) != 'B') {
- tst_resm(TFAIL, "child: not B");
+ tst_resm(TFAIL, "child: not B\n");
}
if (*(cp + 2) != 'C') {
- tst_resm(TFAIL, "child: not C");
+ tst_resm(TFAIL, "child: not C\n");
}
if (*(cp + 8192) != 0) {
- tst_resm(TFAIL, "child: not 0");
+ tst_resm(TFAIL, "child: not 0\n");
}
}
@@ -190,7 +190,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
diff --git a/testcases/kernel/mem/shmt/shmt06.c b/testcases/kernel/mem/shmt/shmt06.c
index e88ac45c9..dd69de7e7 100644
--- a/testcases/kernel/mem/shmt/shmt06.c
+++ b/testcases/kernel/mem/shmt/shmt06.c
@@ -86,7 +86,7 @@ int main(void)
if ((shmid = shmget(key, SIZE, IPC_CREAT | 0666)) < 0) {
perror("shmget");
- tst_resm(TFAIL, "Error: shmget: shmid = %d, errno = %d",
+ tst_resm(TFAIL, "Error: shmget: shmid = %d, errno = %d\n",
shmid, errno);
/*
* kill the child if parent failed to do the attach
@@ -98,7 +98,7 @@ int main(void)
if (cp == (char *)-1) {
perror("shmat");
tst_resm(TFAIL,
- "Error: shmat: shmid = %d, errno = %d",
+ "Error: shmat: shmid = %d, errno = %d\n",
shmid, errno);
/* kill the child if parent failed to do the attch */
@@ -120,7 +120,7 @@ int main(void)
if (pid1 != pid) {
tst_resm(TFAIL, "Waited on the wrong child");
tst_resm(TFAIL,
- "Error: wait_status = %d, pid1= %d", status,
+ "Error: wait_status = %d, pid1= %d\n", status,
pid1);
}
}
@@ -153,7 +153,7 @@ int child(void)
if ((shmid = shmget(key, SIZE, 0)) < 0) {
perror("shmget:child process");
tst_resm(TFAIL,
- "Error: shmget: errno=%d, shmid=%d, child_pid=%d",
+ "Error: shmget: errno=%d, shmid=%d, child_pid=%d\n",
errno, shmid, chld_pid);
} else {
cp = shmat(shmid, NULL, 0);
@@ -161,20 +161,20 @@ int child(void)
if (cp == (char *)-1) {
perror("shmat:child process");
tst_resm(TFAIL,
- "Error: shmat: errno=%d, shmid=%d, child_pid=%d",
+ "Error: shmat: errno=%d, shmid=%d, child_pid=%d\n",
errno, shmid, chld_pid);
} else {
if (*cp != 'A') {
- tst_resm(TFAIL, "child: not A");
+ tst_resm(TFAIL, "child: not A\n");
}
if (*(cp + 1) != 'B') {
- tst_resm(TFAIL, "child: not B");
+ tst_resm(TFAIL, "child: not B\n");
}
if (*(cp + 2) != 'C') {
- tst_resm(TFAIL, "child: not C");
+ tst_resm(TFAIL, "child: not C\n");
}
if (*(cp + 8192) != 0) {
- tst_resm(TFAIL, "child: not 0");
+ tst_resm(TFAIL, "child: not 0\n");
}
}
@@ -187,20 +187,20 @@ int child(void)
if (cp == (char *)-1) {
perror("shmat:child process");
tst_resm(TFAIL,
- "Error: shmat: errno=%d, shmid=%d, child_pid=%d",
+ "Error: shmat: errno=%d, shmid=%d, child_pid=%d\n",
errno, shmid, chld_pid);
} else {
if (*cp != 'A') {
- tst_resm(TFAIL, "child: not A");
+ tst_resm(TFAIL, "child: not A\n");
}
if (*(cp + 1) != 'B') {
- tst_resm(TFAIL, "child: not B");
+ tst_resm(TFAIL, "child: not B\n");
}
if (*(cp + 2) != 'C') {
- tst_resm(TFAIL, "child: not C");
+ tst_resm(TFAIL, "child: not C\n");
}
if (*(cp + 8192) != 0) {
- tst_resm(TFAIL, "child: not 0");
+ tst_resm(TFAIL, "child: not 0\n");
}
}
}
@@ -213,7 +213,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
diff --git a/testcases/kernel/mem/shmt/shmt07.c b/testcases/kernel/mem/shmt/shmt07.c
index 064343f5d..e4aa9dc36 100644
--- a/testcases/kernel/mem/shmt/shmt07.c
+++ b/testcases/kernel/mem/shmt/shmt07.c
@@ -72,7 +72,7 @@ int main(void)
if ((shmid = shmget(key, SIZE, IPC_CREAT | 0666)) < 0) {
perror("shmget");
tst_brkm(TFAIL, NULL,
- "Error: shmget: shmid = %d, errno = %d",
+ "Error: shmget: shmid = %d, errno = %d\n",
shmid, errno);
}
cp = shmat(shmid, NULL, 0);
@@ -80,7 +80,7 @@ int main(void)
if (cp == (char *)-1) {
perror("shmat");
tst_resm(TFAIL,
- "Error: shmat: shmid = %d, errno = %d",
+ "Error: shmat: shmid = %d, errno = %d\n",
shmid, errno);
rm_shm(shmid);
tst_exit();
@@ -100,10 +100,10 @@ int main(void)
case 0:
if (*cp != '1') {
- tst_resm(TFAIL, "Error: not 1");
+ tst_resm(TFAIL, "Error: not 1\n");
}
if (*(cp + 1) != '2') {
- tst_resm(TFAIL, "Error: not 2");
+ tst_resm(TFAIL, "Error: not 2\n");
}
tst_exit();
}
@@ -124,7 +124,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
diff --git a/testcases/kernel/mem/shmt/shmt09.c b/testcases/kernel/mem/shmt/shmt09.c
index 347244115..5f8a08659 100644
--- a/testcases/kernel/mem/shmt/shmt09.c
+++ b/testcases/kernel/mem/shmt/shmt09.c
@@ -81,13 +81,13 @@ int main(void)
if ((unsigned long)sbrk(16384) >= (-4095UL)) {
perror("sbrk");
- tst_brkm(TFAIL, NULL, "Error: sbrk failed, errno = %d",
+ tst_brkm(TFAIL, NULL, "Error: sbrk failed, errno = %d\n",
errno);
}
if ((unsigned long)sbrk(-4097) >= (-4095UL)) {
perror("sbrk");
- tst_brkm(TFAIL, NULL, "Error: sbrk failed, errno = %d",
+ tst_brkm(TFAIL, NULL, "Error: sbrk failed, errno = %d\n",
errno);
}
@@ -95,7 +95,7 @@ int main(void)
perror("shmget");
tst_brkm(TFAIL,
NULL,
- "Error: shmget Failed, shmid = %d, errno = %d",
+ "Error: shmget Failed, shmid = %d, errno = %d\n",
shmid, errno);
}
@@ -103,7 +103,7 @@ int main(void)
if (c1 == (char *)-1) {
perror("shmat");
tst_resm(TFAIL,
- "Error: shmat Failed, shmid = %d, errno = %d",
+ "Error: shmat Failed, shmid = %d, errno = %d\n",
shmid, errno);
rm_shm(shmid);
tst_exit();
@@ -115,7 +115,7 @@ int main(void)
if ((unsigned long)sbrk(32 * K_1) >= (-4095UL)) {
perror("sbrk");
- tst_resm(TFAIL, "Error: sbrk failed, errno = %d", errno);
+ tst_resm(TFAIL, "Error: sbrk failed, errno = %d\n", errno);
rm_shm(shmid);
tst_exit();
}
@@ -135,7 +135,7 @@ int main(void)
if ((unsigned long)sbrk(-16000) >= (-4095UL)) {
perror("sbrk");
- tst_resm(TFAIL, "Error: sbrk failed, errno = %d", errno);
+ tst_resm(TFAIL, "Error: sbrk failed, errno = %d\n", errno);
rm_shm(shmid);
tst_exit();
}
@@ -152,7 +152,7 @@ int main(void)
if (c3 == (char *)-1) {
perror("shmat1");
tst_resm(TFAIL,
- "Error: shmat Failed, shmid = %d, errno = %d",
+ "Error: shmat Failed, shmid = %d, errno = %d\n",
shmid, errno);
rm_shm(shmid);
tst_exit();
@@ -164,7 +164,7 @@ int main(void)
#if defined (__ia64__) || defined(__mips__) || defined(__hppa__) || defined(__arm__) || defined(__aarch64__)
while ((vp = sbrk(INCREMENT)) != (void *)-1) ;
if (errno != ENOMEM) {
- tst_resm(TFAIL, "Error: sbrk failed, errno = %d", errno);
+ tst_resm(TFAIL, "Error: sbrk failed, errno = %d\n", errno);
rm_shm(shmid);
tst_exit();
}
@@ -192,7 +192,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
diff --git a/testcases/kernel/mem/shmt/shmt10.c b/testcases/kernel/mem/shmt/shmt10.c
index c63bb1592..9c4fcfffe 100644
--- a/testcases/kernel/mem/shmt/shmt10.c
+++ b/testcases/kernel/mem/shmt/shmt10.c
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
if ((shmid = shmget(key, SIZE, IPC_CREAT | 0666)) < 0) {
tst_resm(TFAIL, "shmget");
- tst_brkm(TFAIL, NULL, "Error: shmid = %d", shmid);
+ tst_brkm(TFAIL, NULL, "Error: shmid = %d\n", shmid);
}
pid = fork();
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
for (i = 0; i < iter; i++) {
if ((c1 = shmat(shmid, NULL, 0)) == (char *)-1) {
tst_resm(TFAIL,
- "Error shmat: iter %d, shmid = %d", i,
+ "Error shmat: iter %d, shmid = %d\n", i,
shmid);
break;
}
@@ -133,7 +133,7 @@ static int rm_shm(int shmid)
perror("shmctl");
tst_brkm(TFAIL,
NULL,
- "shmctl Failed to remove: shmid = %d, errno = %d",
+ "shmctl Failed to remove: shmid = %d, errno = %d\n",
shmid, errno);
}
return (0);
@@ -148,7 +148,7 @@ static int child(int iter)
if ((c1 = shmat(shmid, NULL, 0)) == (char *)-1) {
tst_brkm(TFAIL,
NULL,
- "Error:child proc: shmat: iter %d, shmid = %d",
+ "Error:child proc: shmat: iter %d, shmid = %d\n",
i, shmid);
}
if (shmdt(c1) < 0) {
diff --git a/testcases/kernel/mem/swapping/swapping01.c b/testcases/kernel/mem/swapping/swapping01.c
index 66fc65cbe..ff40c85c0 100644
--- a/testcases/kernel/mem/swapping/swapping01.c
+++ b/testcases/kernel/mem/swapping/swapping01.c
@@ -53,7 +53,7 @@
#define COE_SLIGHT_OVER 0.3
static void init_meminfo(void);
-static void do_alloc(int allow_raise);
+static void do_alloc(void);
static void check_swapping(void);
static long mem_available_init;
@@ -72,8 +72,7 @@ static void test_swapping(void)
switch (pid = SAFE_FORK()) {
case 0:
- do_alloc(0);
- do_alloc(1);
+ do_alloc();
exit(0);
default:
check_swapping();
@@ -96,27 +95,23 @@ static void init_meminfo(void)
tst_brk(TCONF, "Not enough available mem to test.");
if (swap_free_init < mem_over_max)
- tst_brk(TCONF, "Not enough swap space to test: swap_free_init(%ldkB) < mem_over_max(%ldkB)",
- swap_free_init, mem_over_max);
+ tst_brk(TCONF, "Not enough swap space to test.");
}
-static void do_alloc(int allow_raise)
+static void do_alloc(void)
{
long mem_count;
void *s;
- if (allow_raise == 1)
- tst_res(TINFO, "available physical memory: %ld MB",
- mem_available_init / 1024);
+ tst_res(TINFO, "available physical memory: %ld MB",
+ mem_available_init / 1024);
mem_count = mem_available_init + mem_over;
- if (allow_raise == 1)
- tst_res(TINFO, "try to allocate: %ld MB", mem_count / 1024);
+ tst_res(TINFO, "try to allocate: %ld MB", mem_count / 1024);
s = SAFE_MALLOC(mem_count * 1024);
memset(s, 1, mem_count * 1024);
- if ((allow_raise == 1) && (raise(SIGSTOP) == -1)) {
- tst_res(TINFO, "memory allocated: %ld MB", mem_count / 1024);
+ tst_res(TINFO, "memory allocated: %ld MB", mem_count / 1024);
+ if (raise(SIGSTOP) == -1)
tst_brk(TBROK | TERRNO, "kill");
- }
free(s);
}
@@ -132,16 +127,17 @@ static void check_swapping(void)
/* Still occupying memory, loop for a while */
i = 0;
- while (i < 30) {
+ while (i < 10) {
swap_free_now = SAFE_READ_MEMINFO("SwapFree:");
sleep(1);
- if (labs(swap_free_now - SAFE_READ_MEMINFO("SwapFree:")) < 10)
+ if (abs(swap_free_now - SAFE_READ_MEMINFO("SwapFree:")) < 512)
break;
i++;
}
- swapped = SAFE_READ_PROC_STATUS(pid, "VmSwap:");
+ swap_free_now = SAFE_READ_MEMINFO("SwapFree:");
+ swapped = swap_free_init - swap_free_now;
if (swapped > mem_over_max) {
kill(pid, SIGCONT);
tst_brk(TFAIL, "heavy swapping detected: "
diff --git a/testcases/kernel/mem/thp/Makefile b/testcases/kernel/mem/thp/Makefile
index 89abdc7cd..867dcf089 100644
--- a/testcases/kernel/mem/thp/Makefile
+++ b/testcases/kernel/mem/thp/Makefile
@@ -18,7 +18,6 @@
#
top_srcdir ?= ../../../..
-thp04: LDLIBS += -lrt
include $(top_srcdir)/include/mk/testcases.mk
include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
diff --git a/testcases/kernel/mem/thp/thp01.c b/testcases/kernel/mem/thp/thp01.c
index 2e75f85e3..db7256050 100644
--- a/testcases/kernel/mem/thp/thp01.c
+++ b/testcases/kernel/mem/thp/thp01.c
@@ -138,9 +138,4 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.test_all = thp_test,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "a7d6e4ecdb76"},
- {"CVE", "2011-0999"},
- {}
- }
};
diff --git a/testcases/kernel/mem/thp/thp04.c b/testcases/kernel/mem/thp/thp04.c
deleted file mode 100644
index 985394dc3..000000000
--- a/testcases/kernel/mem/thp/thp04.c
+++ /dev/null
@@ -1,172 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2017-1000405
- *
- * Check for the Huge Dirty Cow vulnerability which allows a userspace process
- * to overwrite the huge zero page. Race fixed in:
- *
- * commit a8f97366452ed491d13cf1e44241bc0b5740b1f0
- * Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
- * Date: Mon Nov 27 06:21:25 2017 +0300
- *
- * mm, thp: Do not make page table dirty unconditionally in touch_p[mu]d()
- *
- * More details see the following URL
- * https://medium.com/bindecy/huge-dirty-cow-cve-2017-1000405-110eca132de0
- *
- * On old kernel such as 4.9, it has fixed the Dirty Cow bug but a similar check
- * in huge_memory.c was forgotten. As a result, remote memory writes to ro regions
- * of memory backed by transparent huge pages cause an infinite loop in the kernel.
- * While in this state the process is stil SIGKILLable, but little else works.
- * It is also a regression test about kernel
- * commit 8310d48b125d("huge_memory.c: respect FOLL_FORCE/FOLL_COW for thp").
- */
-
-#include <sys/mman.h>
-
-#include "tst_test.h"
-#include "lapi/mmap.h"
-#include "tst_fuzzy_sync.h"
-
-static char *write_thp, *read_thp;
-static int *write_ptr, *read_ptr;
-static size_t thp_size;
-static int writefd = -1, readfd = -1;
-static struct tst_fzsync_pair fzsync_pair;
-
-static void *alloc_zero_page(void *baseaddr)
-{
- int i;
- void *ret;
-
- /* Find aligned chunk of address space. MAP_HUGETLB doesn't work. */
- for (i = 0; i < 16; i++, baseaddr += thp_size) {
- ret = mmap(baseaddr, thp_size, PROT_READ,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
- if (ret == baseaddr) {
- TEST(madvise(ret, thp_size, MADV_HUGEPAGE));
-
- if (TST_RET == -1 && TST_ERR == EINVAL) {
- tst_brk(TCONF | TTERRNO,
- "madvise(MADV_HUGEPAGE) not supported");
- }
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "madvise(MADV_HUGEPAGE) failed");
- }
-
- return ret;
- }
-
- if (ret != MAP_FAILED)
- SAFE_MUNMAP(ret, thp_size);
- }
-
- tst_brk(TBROK, "Cannot map huge zero page near the specified address");
- return NULL; /* Silence compiler warning */
-}
-
-static void setup(void)
-{
- size_t i;
-
- thp_size = tst_get_hugepage_size();
-
- if (!thp_size)
- tst_brk(TCONF, "Kernel does not support huge pages");
-
- write_thp = alloc_zero_page((void *)thp_size);
-
- for (i = 0; i < thp_size; i++) {
- if (write_thp[i])
- tst_brk(TCONF, "Huge zero page is pre-polluted");
- }
-
- /* leave a hole between read and write THP to prevent merge */
- read_thp = alloc_zero_page(write_thp + 2 * thp_size);
- write_ptr = (int *)(write_thp + thp_size - sizeof(int));
- read_ptr = (int *)(read_thp + thp_size - sizeof(int));
- writefd = SAFE_OPEN("/proc/self/mem", O_RDWR);
- readfd = SAFE_OPEN("/proc/self/mem", O_RDWR);
-
- fzsync_pair.exec_loops = 100000;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- int c;
-
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- madvise(write_thp, thp_size, MADV_DONTNEED);
- memcpy(&c, write_ptr, sizeof(c));
- SAFE_LSEEK(readfd, (off_t)write_ptr, SEEK_SET);
- SAFE_READ(1, readfd, &c, sizeof(int));
- tst_fzsync_end_race_b(&fzsync_pair);
- /* Wait for dirty page handling before next madvise() */
- usleep(10);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- int c = 0xdeadbeef;
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- /* Write into the main huge page */
- tst_fzsync_start_race_a(&fzsync_pair);
- SAFE_LSEEK(writefd, (off_t)write_ptr, SEEK_SET);
- madvise(write_thp, thp_size, MADV_DONTNEED);
- SAFE_WRITE(1, writefd, &c, sizeof(int));
- tst_fzsync_end_race_a(&fzsync_pair);
-
- /* Check the other huge zero page for pollution */
- madvise(read_thp, thp_size, MADV_DONTNEED);
-
- if (*read_ptr != 0) {
- tst_res(TFAIL, "Huge zero page was polluted");
- return;
- }
- }
-
- tst_res(TPASS, "Huge zero page is still clean");
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzsync_pair);
-
- if (readfd >= 0)
- SAFE_CLOSE(readfd);
-
- if (writefd >= 0)
- SAFE_CLOSE(writefd);
-
- if (read_thp)
- SAFE_MUNMAP(read_thp, thp_size);
- if (write_thp)
- SAFE_MUNMAP(write_thp, thp_size);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "a8f97366452e"},
- {"linux-git", "8310d48b125d"},
- {"CVE", "2017-1000405"},
- {}
- }
-};
diff --git a/testcases/kernel/mem/tunable/max_map_count.c b/testcases/kernel/mem/tunable/max_map_count.c
index 4f0ad0037..5b03a60ec 100644
--- a/testcases/kernel/mem/tunable/max_map_count.c
+++ b/testcases/kernel/mem/tunable/max_map_count.c
@@ -65,7 +65,7 @@ static void setup(void)
old_max_map_count = get_sys_tune("max_map_count");
old_overcommit = get_sys_tune("overcommit_memory");
- set_sys_tune("overcommit_memory", 0, 1);
+ set_sys_tune("overcommit_memory", 2, 1);
if (uname(&un) != 0)
tst_brk(TBROK | TERRNO, "uname error");
@@ -154,8 +154,13 @@ static void max_map_count_test(void)
* 1) use a safe maximum max_map_count value as upper-bound,
* we set it 65536 in this case, i.e., we don't test too big
* value;
- * 2) make sure total mapping isn't larger than
+ * 2) make sure total mapping isn't larger tha
* CommitLimit - Committed_AS
+ * and set overcommit_memory to 2, this could help mapping
+ * returns ENOMEM instead of triggering oom-killer when
+ * memory is tight. (When there are enough free memory,
+ * step 1) will be used first.
+ * Hope OOM-killer can be more stable oneday.
*/
memfree = SAFE_READ_MEMINFO("CommitLimit:") - SAFE_READ_MEMINFO("Committed_AS:");
/* 64 used as a bias to make sure no overflow happen */
@@ -164,9 +169,6 @@ static void max_map_count_test(void)
max_iters = MAX_MAP_COUNT;
max_maps = MAP_COUNT_DEFAULT;
- if (max_iters < max_maps)
- tst_brk(TCONF, "test requires more free memory");
-
while (max_maps <= max_iters) {
set_sys_tune("max_map_count", max_maps, 1);
diff --git a/testcases/kernel/mem/tunable/overcommit_memory.c b/testcases/kernel/mem/tunable/overcommit_memory.c
index ac875ab18..345764dfe 100644
--- a/testcases/kernel/mem/tunable/overcommit_memory.c
+++ b/testcases/kernel/mem/tunable/overcommit_memory.c
@@ -1,7 +1,17 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2012-2020 Linux Test Project
- * Copyright (c) 2012-2017 Red Hat, Inc.
+ * Copyright (C) 2012-2017 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * Descriptions:
*
* There are two tunables overcommit_memory and overcommit_ratio under
* /proc/sys/vm/, which can control memory overcommitment.
@@ -42,16 +52,12 @@
* the system is limited to CommitLimit(Swap+RAM*overcommit_ratio)
* commit_left(allocatable memory) = CommitLimit - Committed_AS
* a. less than commit_left: commit_left / 2, alloc should pass
- * b. overcommit limit: CommitLimit + TotalBatchSize, should fail
- * c. greater than commit_left: commit_left * 2, alloc should fail
+ * b. greater than commit_left: commit_left * 2, alloc should fail
+ * c. overcommit limit: CommitLimit, alloc should fail
* *note: CommitLimit is the current overcommit limit.
* Committed_AS is the amount of memory that system has used.
* it couldn't choose 'equal to commit_left' as a case, because
* commit_left rely on Committed_AS, but the Committed_AS is not stable.
- * *note2: TotalBatchSize is the total number of bytes, that can be
- * accounted for in the per cpu counters for the vm_committed_as
- * counter. Since the check used by malloc only looks at the
- * global counter of vm_committed_as, it can overallocate a bit.
*
* References:
* - Documentation/sysctl/vm.txt
@@ -70,6 +76,11 @@
#define EXPECT_FAIL 1
static char *R_opt;
+static struct tst_option options[] = {
+ {"R:", &R_opt, " -R n Percentage of overcommitting memory"},
+ {NULL, NULL, NULL}
+};
+
static long old_overcommit_memory = -1;
static long old_overcommit_ratio = -1;
static long overcommit_ratio;
@@ -77,13 +88,11 @@ static long sum_total;
static long free_total;
static long commit_limit;
static long commit_left;
-static long total_batch_size;
static int heavy_malloc(long size);
static void alloc_and_check(long size, int expect_result);
static void update_mem(void);
static void update_mem_commit(void);
-static void calculate_total_batch_size(void);
static void setup(void)
{
@@ -92,7 +101,8 @@ static void setup(void)
if (access(PATH_SYSVM "overcommit_memory", F_OK) == -1 ||
access(PATH_SYSVM "overcommit_ratio", F_OK) == -1)
- tst_brk(TCONF, "system doesn't support overcommit_memory");
+ tst_brk(TCONF, "The system "
+ "can't support to test %s", TCID);
if (R_opt)
overcommit_ratio = SAFE_STRTOL(R_opt, 0, LONG_MAX);
@@ -123,9 +133,6 @@ static void setup(void)
}
set_sys_tune("overcommit_ratio", overcommit_ratio, 1);
-
- calculate_total_batch_size();
- tst_res(TINFO, "TotalBatchSize is %ld kB", total_batch_size);
}
static void cleanup(void)
@@ -147,7 +154,7 @@ static void overcommit_memory_test(void)
update_mem_commit();
alloc_and_check(commit_left * 2, EXPECT_FAIL);
- alloc_and_check(commit_limit + total_batch_size, EXPECT_FAIL);
+ alloc_and_check(commit_limit, EXPECT_FAIL);
update_mem_commit();
alloc_and_check(commit_left / 2, EXPECT_PASS);
@@ -203,7 +210,7 @@ static void alloc_and_check(long size, int expect_result)
tst_res(TFAIL, "alloc passed, expected to fail");
break;
default:
- tst_brk(TBROK, "Invalid number parameter: %d",
+ tst_brk(TBROK, "Invaild numbler parameter: %d",
expect_result);
}
}
@@ -240,34 +247,9 @@ static void update_mem_commit(void)
}
}
-static void calculate_total_batch_size(void)
-{
- struct sysinfo info;
- long ncpus = tst_ncpus_conf();
- long pagesize = getpagesize();
- SAFE_SYSINFO(&info);
-
- /* see linux source mm/mm_init.c mm_compute_batch() (This is in pages) */
- long batch_size = MAX(ncpus * 2,
- MAX(32,
- MIN(INT32_MAX,
- (long)(info.totalram / pagesize) / ncpus / 256
- )
- )
- );
-
- /* there are ncpu separate counters, that can all grow up to
- * batch_size. So the maximum error for __vm_enough_memory is
- * batch_size * ncpus. */
- total_batch_size = (batch_size * ncpus * pagesize) / KB;
-}
-
static struct tst_test test = {
.needs_root = 1,
- .options = (struct tst_option[]) {
- {"R:", &R_opt, " -R n Percentage of overcommitting memory"},
- {}
- },
+ .options = options,
.setup = setup,
.cleanup = cleanup,
.test_all = overcommit_memory_test,
diff --git a/testcases/kernel/mem/vma/vma05.sh b/testcases/kernel/mem/vma/vma05.sh
index c94a4b96c..82f877b95 100755
--- a/testcases/kernel/mem/vma/vma05.sh
+++ b/testcases/kernel/mem/vma/vma05.sh
@@ -44,7 +44,7 @@ vma_report_check()
{
if [ $(uname -m) = "x86_64" ]; then
if LINE=$(grep "vsyscall" /proc/self/maps); then
- RIGHT="ffffffffff600000-ffffffffff601000[[:space:]][r-]-xp"
+ RIGHT="ffffffffff600000-ffffffffff601000[[:space:]]r-xp"
if echo "$LINE" | grep -q "$RIGHT"; then
tst_res TPASS "[vsyscall] reported correctly"
else
diff --git a/testcases/kernel/mem/vmtests/data_space.c b/testcases/kernel/mem/vmtests/data_space.c
index c0aa1bf0e..b873140b5 100644
--- a/testcases/kernel/mem/vmtests/data_space.c
+++ b/testcases/kernel/mem/vmtests/data_space.c
@@ -177,7 +177,7 @@ int runtest()
status);
#endif
if (status) {
- tst_resm(TFAIL, "\tTest failed, expected 0 exit.");
+ tst_resm(TFAIL, "\tTest failed, expected 0 exit.\n");
local_flag = FAILED;
}
++count;
@@ -188,7 +188,7 @@ int runtest()
*/
if (count != nchild) {
- tst_resm(TFAIL, "\tWrong # children waited on, count = %d",
+ tst_resm(TFAIL, "\tWrong # children waited on, count = %d\n",
count);
local_flag = FAILED;
}
@@ -298,7 +298,7 @@ int me;
if ((bits[chunk / 8] & (1 << (chunk % 8))) == 0) {
if (memcmp(buf, zero_buf, csize)) {
tst_resm(TFAIL,
- "\t%s[%d] bad verify @ %d (%p) for val %d count %d, should be 0x%x.",
+ "\t%s[%d] bad verify @ %d (%p) for val %d count %d, should be 0x%x.\n",
prog, me, chunk, buf, val,
count, val - 1);
tst_resm(TINFO, "\tPrev ");
@@ -315,7 +315,7 @@ int me;
++collide;
if (memcmp(buf, val_buf, csize)) {
tst_resm(TFAIL,
- "\t%s[%d] bad verify @ %d (%p) for val %d count %d.",
+ "\t%s[%d] bad verify @ %d (%p) for val %d count %d.\n",
prog, me, chunk, buf, val,
count);
tst_resm(TINFO, "\tPrev ");
@@ -486,14 +486,14 @@ int okexit(me)
int me;
{
kill(parent_pid, SIGUSR1);
- tst_resm(TINFO, "\tChild [%d] - cannot malloc buffer - exiting.", me);
+ tst_resm(TINFO, "\tChild [%d] - cannot malloc buffer - exiting.\n", me);
if (me) {
- tst_resm(TINFO, "\tThis is ok - probably swap space limit.");
+ tst_resm(TINFO, "\tThis is ok - probably swap space limit.\n");
tst_exit();
} else {
tst_brkm(TBROK,
NULL,
- "\tThis is not ok for first child - check parameters.");
+ "\tThis is not ok for first child - check parameters.\n");
}
return 0;
diff --git a/testcases/kernel/mem/vmtests/stack_space.c b/testcases/kernel/mem/vmtests/stack_space.c
index 26f1c6fa7..b27c2825d 100644
--- a/testcases/kernel/mem/vmtests/stack_space.c
+++ b/testcases/kernel/mem/vmtests/stack_space.c
@@ -103,14 +103,14 @@ char *argv[];
bd_arg(argv[i - 1]);
if (nchild > MAXCHILD) {
tst_brkm(TBROK, NULL,
- "Too many children, max is %d",
+ "Too many children, max is %d\n",
MAXCHILD);
}
if (sscanf(argv[i++], "%d", &csize) != 1)
bd_arg(argv[i - 1]);
if (csize > MAXSIZE) {
tst_brkm(TBROK, NULL,
- "Chunk size too large , max is %d",
+ "Chunk size too large , max is %d\n",
MAXSIZE);
}
if (sscanf(argv[i++], "%d", &iterations) != 1)
@@ -129,7 +129,7 @@ int bd_arg(str)
char *str;
{
tst_brkm(TCONF, NULL,
- "Bad argument - %s - could not parse as number.",
+ "Bad argument - %s - could not parse as number.\n",
str);
}
@@ -148,8 +148,8 @@ int runtest()
if (child < 0) {
tst_resm(TBROK,
"Fork failed (may be OK if under stress)");
- tst_resm(TINFO, "System resource may be too low.");
- tst_brkm(TBROK, tst_rmdir, "Reason: %s",
+ tst_resm(TINFO, "System resource may be too low.\n");
+ tst_brkm(TBROK, tst_rmdir, "Reason: %s\n",
strerror(errno));
}
@@ -166,7 +166,7 @@ int runtest()
status);
#endif
if (status) {
- tst_resm(TINFO, "\tFailed - expected 0 exit status.");
+ tst_resm(TINFO, "\tFailed - expected 0 exit status.\n");
local_flag = FAILED;
}
++count;
@@ -177,7 +177,7 @@ int runtest()
*/
if (count != nchild) {
- tst_resm(TINFO, "\tWrong # children waited on, count = %d",
+ tst_resm(TINFO, "\tWrong # children waited on, count = %d\n",
count);
local_flag = FAILED;
}
@@ -220,7 +220,7 @@ int dotest(int testers, int me)
zero_buf = (char *)(malloc(csize));
if (bits == 0 || val_buf == 0 || zero_buf == 0) {
- tst_brkm(TFAIL, NULL, "\tmalloc failed, pid: %d", getpid());
+ tst_brkm(TFAIL, NULL, "\tmalloc failed, pid: %d\n", getpid());
}
/*
@@ -266,7 +266,7 @@ int dotest(int testers, int me)
if ((bits[chunk / 8] & (1 << (chunk % 8))) == 0) {
if (memcmp(buf, zero_buf, csize)) {
tst_resm(TFAIL,
- "%s[%d] bad verify @ %d (%p) for val %d count %d, should be 0.",
+ "%s[%d] bad verify @ %d (%p) for val %d count %d, should be 0.\n",
prog, me, chunk, buf, val,
count);
tst_resm(TINFO, "Prev ");
@@ -283,7 +283,7 @@ int dotest(int testers, int me)
++collide;
if (memcmp(buf, val_buf, csize)) {
tst_resm(TFAIL,
- "%s[%d] bad verify @ %d (%p) for val %d count %d.",
+ "%s[%d] bad verify @ %d (%p) for val %d count %d.\n",
prog, me, chunk, buf, val,
count);
tst_resm(TINFO, "Prev ");
diff --git a/testcases/kernel/numa/Makefile b/testcases/kernel/numa/Makefile
index 00ba27360..48494e456 100644
--- a/testcases/kernel/numa/Makefile
+++ b/testcases/kernel/numa/Makefile
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-top_srcdir ?= ../../..
+top_srcdir := ../../..
include $(top_srcdir)/include/mk/testcases.mk
diff --git a/testcases/kernel/numa/README b/testcases/kernel/numa/README
index 4dd8564be..846d36dcd 100644
--- a/testcases/kernel/numa/README
+++ b/testcases/kernel/numa/README
@@ -26,27 +26,38 @@ Verifies the preferred node memory policy which will allocate memory from the no
testcase will use the support_numa process for the verfication.
TestCase3:
-Verifies the memory interleaving policy which will distribute the memory evenly among all nodes. This
+Verifies the preferred node memory policy which will allocate shared memory from the node we specify. This
testcase will use the support_numa process for the verfication.
TestCase4:
-Verifies the physical cpu affinity which runs the process support_numa on the specified physical cpu number.
+Verifies the memory interleaving policy which will distribute the memory evenly among all nodes. This
+testcase will use the support_numa process for the verfication.
TestCase5:
+Verifies the memory interleaving policy which will distribute the memory evenly among all nodes. This
+testcase will use the support_numa process for the verfication.
+
+TestCase6:
+Verifies the physical cpu affinity which runs the process support_numa on the specified physical cpu number.
+
+TestCase7:
Verifies the local allocation policy which always allocates memory from the local node. This testcase
will use the support_numa process for the verfication.
-TestCase6:
+TestCase8:
Verifies the memory interleaving policy which will distribute the memory evenly among all nodes. This
testcase will use memhog for the verfication.
-TestCase7:
+TestCase9:
Verifies the numa_node_size api with hardware checking.
-TestCase8:
+TestCase10:
+Verifieds the NUMA migratepages policy.
+
+TestCase11:
Verifies the hugepage memory allocated from the node we specify.
-TestCase9:
+TestCase12:
Verifies the preferred node policy with THP memory allocating from the node we specify.
Pre-requisites
diff --git a/testcases/kernel/numa/numa01.sh b/testcases/kernel/numa/numa01.sh
index 803545f13..1d626327d 100755
--- a/testcases/kernel/numa/numa01.sh
+++ b/testcases/kernel/numa/numa01.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2007
-# Copyright (c) Linux Test Project, 2016-2020
+# Copyright (c) Linux Test Project, 2016
# Author: Sivakumar Chinnaiah <Sivakumar.C@in.ibm.com>
#
# Test Basic functionality of numactl command.
@@ -12,10 +12,11 @@
# Test #5: Verifies localalloc
# Test #6: Verifies memhog
# Test #7: Verifies numa_node_size api
-# Test #8: Verifies hugepage alloacted on specified node
-# Test #9: Verifies THP memory allocated on preferred node
+# Test #8:Verifies Migratepages
+# Test #9:Verifies hugepage alloacted on specified node
+# Test #10:Verifies THP memory allocated on preferred node
-TST_CNT=9
+TST_CNT=10
TST_SETUP=setup
TST_TESTFUNC=test
TST_NEEDS_TMPDIR=1
@@ -24,35 +25,15 @@ TST_NEEDS_CMDS="awk bc numactl numastat"
. tst_test.sh
-# Awk the field matching the node value for numastat
-# $1 - Pid number
-# $2 - Node number
-get_node_index()
-{
- local pid=$1
- local nid="Node $2"
- echo $(numastat -p $pid | sed '3q;d' | awk -F '[[:space:]][[:space:]]+' \
- -v node="$nid" '{ for (i = 1; i <= NF; ++i) if($i==node) print i; exit }')
-}
-
-# Convert the value of given numa node from the `numastat -p` output,
-# multiply by size.
-# $1 - Pid number
-# $2 - Node number
-# $3 - Size for multiplication (e.g. 1024, $MB)
-get_mem_cur()
+# Extracts the value of given numa node from the `numastat -p` output.
+# $1 - Pid number.
+# $2 - Node number.
+extract_numastat_p()
{
local pid=$1
- local index=$(echo "$(get_node_index $pid $2)")
- local size=$3
- local numstat=$(numastat -p $pid |awk '/^Total/ {print $'$index'}')
+ local node=$(($2 + 2))
- if [ -z "$numstat" ]; then
- echo 0
- return
- fi
-
- echo $(echo "$numstat * $size" | bc)
+ echo $(numastat -p $pid |awk '/^Total/ {print $'$node'}')
}
check_for_support_numa()
@@ -91,7 +72,7 @@ setup()
# Verification of memory allocated on a node
test1()
{
- local mem_curr
+ Mem_curr=0
for node in $nodes_list; do
numactl --cpunodebind=$node --membind=$node support_numa alloc_1MB &
@@ -99,8 +80,8 @@ test1()
TST_RETRY_FUNC "check_for_support_numa $pid" 0
- mem_curr=$(get_mem_cur $pid $node $MB)
- if [ $(echo "$mem_curr < $MB" | bc) -eq 1 ]; then
+ Mem_curr=$(echo "$(extract_numastat_p $pid $node) * $MB" |bc)
+ if [ $(echo "$Mem_curr < $MB" | bc) -eq 1 ]; then
tst_res TFAIL \
"NUMA memory allocated in node$node is less than expected"
kill -CONT $pid >/dev/null 2>&1
@@ -116,16 +97,16 @@ test1()
# Verification of memory allocated on preferred node
test2()
{
- local mem_curr
- local cnt=1
+ Mem_curr=0
+ COUNTER=1
for node in $nodes_list; do
- if [ $cnt -eq $total_nodes ]; then #wrap up for last node
+ if [ $COUNTER -eq $total_nodes ]; then #wrap up for last node
Preferred_node=$(echo $nodes_list | cut -d ' ' -f 1)
else
# always next node is preferred node
- Preferred_node=$(echo $nodes_list | cut -d ' ' -f $((cnt+1)))
+ Preferred_node=$(echo $nodes_list | cut -d ' ' -f $((COUNTER+1)))
fi
numactl --cpunodebind=$node --preferred=$Preferred_node support_numa alloc_1MB &
@@ -133,15 +114,15 @@ test2()
TST_RETRY_FUNC "check_for_support_numa $pid" 0
- mem_curr=$(get_mem_cur $pid $Preferred_node $MB)
- if [ $(echo "$mem_curr < $MB" |bc ) -eq 1 ]; then
+ Mem_curr=$(echo "$(extract_numastat_p $pid $Preferred_node) * $MB" |bc)
+ if [ $(echo "$Mem_curr < $MB" |bc ) -eq 1 ]; then
tst_res TFAIL \
"NUMA memory allocated in node$Preferred_node is less than expected"
kill -CONT $pid >/dev/null 2>&1
return
fi
- cnt=$((cnt+1))
+ COUNTER=$((COUNTER+1))
kill -CONT $pid >/dev/null 2>&1
done
@@ -151,7 +132,7 @@ test2()
# Verification of memory interleaved on all nodes
test3()
{
- local mem_curr
+ Mem_curr=0
# Memory will be allocated using round robin on nodes.
Exp_incr=$(echo "$MB / $total_nodes" |bc)
@@ -161,9 +142,9 @@ test3()
TST_RETRY_FUNC "check_for_support_numa $pid" 0
for node in $nodes_list; do
- mem_curr=$(get_mem_cur $pid $node $MB)
+ Mem_curr=$(echo "$(extract_numastat_p $pid $node) * $MB" |bc)
- if [ $(echo "$mem_curr < $Exp_incr" |bc ) -eq 1 ]; then
+ if [ $(echo "$Mem_curr < $Exp_incr" |bc ) -eq 1 ]; then
tst_res TFAIL \
"NUMA interleave memory allocated in node$node is less than expected"
kill -CONT $pid >/dev/null 2>&1
@@ -210,7 +191,7 @@ test4()
# Verification of local node allocation
test5()
{
- local mem_curr
+ Mem_curr=0
for node in $nodes_list; do
numactl --cpunodebind=$node --localalloc support_numa alloc_1MB &
@@ -218,8 +199,8 @@ test5()
TST_RETRY_FUNC "check_for_support_numa $pid" 0
- mem_curr=$(get_mem_cur $pid $node $MB)
- if [ $(echo "$mem_curr < $MB" |bc ) -eq 1 ]; then
+ Mem_curr=$(echo "$(extract_numastat_p $pid $node) * $MB" |bc)
+ if [ $(echo "$Mem_curr < $MB" |bc ) -eq 1 ]; then
tst_res TFAIL \
"NUMA localnode memory allocated in node$node is less than expected"
kill -CONT $pid >/dev/null 2>&1
@@ -240,7 +221,7 @@ check_ltp_numa_test8_log()
# Verification of memhog with interleave policy
test6()
{
- local mem_curr
+ Mem_curr=0
# Memory will be allocated using round robin on nodes.
Exp_incr=$(echo "$MB / $total_nodes" |bc)
@@ -250,9 +231,9 @@ test6()
TST_RETRY_FUNC "check_ltp_numa_test8_log" 0
for node in $nodes_list; do
- mem_curr=$(get_mem_cur $pid $node $MB)
+ Mem_curr=$(echo "$(extract_numastat_p $pid $node) * $MB" |bc)
- if [ $(echo "$mem_curr < $Exp_incr" |bc ) -eq 1 ]; then
+ if [ $(echo "$Mem_curr < $Exp_incr" |bc ) -eq 1 ]; then
tst_res TFAIL \
"NUMA interleave memhog in node$node is less than expected"
kill -KILL $pid >/dev/null 2>&1
@@ -299,9 +280,45 @@ test7()
fi
}
-# Verification of hugepage memory allocated on a node
+# Verification of migratepages
test8()
{
+ Mem_curr=0
+ COUNTER=1
+
+ for node in $nodes_list; do
+
+ if [ $COUNTER -eq $total_nodes ]; then
+ Preferred_node=$(echo $nodes_list | cut -d ' ' -f 1)
+ else
+ Preferred_node=$(echo $nodes_list | cut -d ' ' -f $((COUNTER+1)))
+ fi
+
+ numactl --preferred=$node support_numa alloc_1MB &
+ pid=$!
+
+ TST_RETRY_FUNC "check_for_support_numa $pid" 0
+
+ migratepages $pid $node $Preferred_node
+
+ Mem_curr=$(echo "$(extract_numastat_p $pid $Preferred_node) * $MB" |bc)
+ if [ $(echo "$Mem_curr < $MB" |bc ) -eq 1 ]; then
+ tst_res TFAIL \
+ "NUMA migratepages is not working fine"
+ kill -CONT $pid >/dev/null 2>&1
+ return
+ fi
+
+ COUNTER=$((COUNTER+1))
+ kill -CONT $pid >/dev/null 2>&1
+ done
+
+ tst_res TPASS "NUMA MIGRATEPAGES policy"
+}
+
+# Verification of hugepage memory allocated on a node
+test9()
+{
Mem_huge=0
Sys_node=/sys/devices/system/node
@@ -325,8 +342,7 @@ test8()
pid=$!
TST_RETRY_FUNC "check_for_support_numa $pid" 0
- local index=$(echo "$(get_node_index $pid $node)")
- Mem_huge=$(echo $(numastat -p $pid |awk '/^Huge/ {print $'$index'}'))
+ Mem_huge=$(echo $(numastat -p $pid |awk '/^Huge/ {print $'$((node+2))'}'))
Mem_huge=$((${Mem_huge%.*} * 1024))
if [ "$Mem_huge" -lt "$HPAGE_SIZE" ]; then
@@ -345,22 +361,23 @@ test8()
}
# Verification of THP memory allocated on preferred node
-test9()
+test10()
{
- local mem_curr
- local cnt=1
+ Mem_curr=0
if ! grep -q '\[always\]' /sys/kernel/mm/transparent_hugepage/enabled; then
tst_res TCONF "THP is not supported/enabled"
return
fi
+ COUNTER=1
for node in $nodes_list; do
- if [ $cnt -eq $total_nodes ]; then #wrap up for last node
+
+ if [ $COUNTER -eq $total_nodes ]; then #wrap up for last node
Preferred_node=$(echo $nodes_list | cut -d ' ' -f 1)
else
# always next node is preferred node
- Preferred_node=$(echo $nodes_list | cut -d ' ' -f $((cnt+1)))
+ Preferred_node=$(echo $nodes_list | cut -d ' ' -f $((COUNTER+1)))
fi
numactl --cpunodebind=$node --preferred=$Preferred_node support_numa alloc_2HPSZ_THP &
@@ -368,15 +385,15 @@ test9()
TST_RETRY_FUNC "check_for_support_numa $pid" 0
- mem_curr=$(get_mem_cur $pid $Preferred_node 1024)
- if [ $(echo "$mem_curr < $HPAGE_SIZE * 2" |bc ) -eq 1 ]; then
+ Mem_curr=$(echo "$(extract_numastat_p $pid $Preferred_node) * 1024" |bc)
+ if [ $(echo "$Mem_curr < $HPAGE_SIZE * 2" |bc ) -eq 1 ]; then
tst_res TFAIL \
"NUMA memory allocated in node$Preferred_node is less than expected"
kill -CONT $pid >/dev/null 2>&1
return
fi
- cnt=$((cnt+1))
+ COUNTER=$((COUNTER+1))
kill -CONT $pid >/dev/null 2>&1
done
diff --git a/testcases/kernel/pty/.gitignore b/testcases/kernel/pty/.gitignore
index 7f1048483..131b8a077 100644
--- a/testcases/kernel/pty/.gitignore
+++ b/testcases/kernel/pty/.gitignore
@@ -2,6 +2,3 @@
/ptem01
/pty01
/pty02
-/pty03
-/pty04
-/pty05
diff --git a/testcases/kernel/pty/Makefile b/testcases/kernel/pty/Makefile
index 87d70ac1d..f9fc4f57e 100644
--- a/testcases/kernel/pty/Makefile
+++ b/testcases/kernel/pty/Makefile
@@ -24,7 +24,6 @@ top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/testcases.mk
-pty03 pty05: CFLAGS += -pthread
-pty03 pty05: LDLIBS += -lrt
+CPPFLAGS += -D_GNU_SOURCE
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/pty/hangup01.c b/testcases/kernel/pty/hangup01.c
index a71b4b44b..aac3955c9 100644
--- a/testcases/kernel/pty/hangup01.c
+++ b/testcases/kernel/pty/hangup01.c
@@ -20,7 +20,10 @@
/* 12/24/2002 Port to LTP robbiew@us.ibm.com */
/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -204,7 +207,7 @@ int child(int masterfd)
/*
* main test driver
*/
-int main(void)
+int main(int argc, char **argv)
{
int masterfd; /* master pty fd */
char *slavename;
diff --git a/testcases/kernel/pty/ptem01.c b/testcases/kernel/pty/ptem01.c
index 20ef5d0a7..68994d491 100644
--- a/testcases/kernel/pty/ptem01.c
+++ b/testcases/kernel/pty/ptem01.c
@@ -1,6 +1,6 @@
/*
+ *
* Copyright (c) International Business Machines Corp., 2002
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,20 +20,23 @@
/* 12/23/2002 Port to LTP robbiew@us.ibm.com */
/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
-#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
-#include <termios.h>
+#include <termio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/poll.h>
#include <sys/types.h>
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+/** LTP Port **/
#include "test.h"
#include "safe_macros.h"
-#include "lapi/ioctl.h"
char *TCID = "ptem01"; /* Test program identifier. */
int TST_TOTAL = 6; /* Total number of test cases. */
@@ -426,7 +429,7 @@ int test6(void)
/*
* main test driver
*/
-int main(void)
+int main(int argc, char **argv)
{
test1();
test2();
diff --git a/testcases/kernel/pty/pty01.c b/testcases/kernel/pty/pty01.c
index 666b221b0..d390ce717 100644
--- a/testcases/kernel/pty/pty01.c
+++ b/testcases/kernel/pty/pty01.c
@@ -20,7 +20,10 @@
/* 12/23/2002 Port to LTP robbiew@us.ibm.com */
/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
@@ -29,12 +32,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <termios.h>
+#include <termio.h>
#include <unistd.h>
+/** LTP Port **/
#include "test.h"
#include "safe_macros.h"
-#include "lapi/ioctl.h"
char *TCID = "pty01"; /* Test program identifier. */
int TST_TOTAL = 5; /* Total number of test cases. */
@@ -380,7 +383,7 @@ static void test5(void)
/*
* main test driver
*/
-int main(void)
+int main(int argc, char **argv)
{
test1();
test2();
diff --git a/testcases/kernel/pty/pty02.c b/testcases/kernel/pty/pty02.c
index 050a9f7ea..fc60b6256 100644
--- a/testcases/kernel/pty/pty02.c
+++ b/testcases/kernel/pty/pty02.c
@@ -12,11 +12,9 @@
* slave. This is simplified from a syzkaller-generated reproducer.
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <errno.h>
-#include <sys/ioctl.h>
-#include <termios.h>
+#include <termio.h>
#include "tst_test.h"
#include "lapi/termbits.h"
@@ -39,7 +37,7 @@ static void do_test(void)
if (TST_RET == -1) {
if (TST_ERR == EINVAL)
tst_brk(TCONF, "tcsetattr(, , EXTPROC | ICANON) is not supported");
- tst_brk(TBROK | TTERRNO, "tcsetattr() failed");
+ tst_brk(TBROK | TERRNO, "tcsetattr() failed");
}
if (unlockpt(ptmx) != 0)
diff --git a/testcases/kernel/pty/pty03.c b/testcases/kernel/pty/pty03.c
deleted file mode 100644
index 71bcb2eb6..000000000
--- a/testcases/kernel/pty/pty03.c
+++ /dev/null
@@ -1,160 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE
- *
- * CVE-2020-14416
- *
- * Test based on Syzkaller reproducer:
- * https://syzkaller.appspot.com/bug?id=680c24ff647dd7241998e19da52e8136d2fd3523
- *
- * The SLIP and SLCAN disciplines can have a race between write_wakeup and
- * close/hangup. This atleast allows the netdev private data (tty->disc_data)
- * to be set to NULL or possibly freed while a transmit operation is being
- * added to a workqueue.
- *
- * If the race condition exists, then the most likely result of running this
- * is a null pointer dereference.
- *
- * Note that we must set the line discipline to "mouse" first which, for
- * whatever reason, results in tty_wakeup being called during the close
- * operation.
- *
- * We also test a selection of other line disciplines, but only SLIP and SLCAN
- * are known to have the problem.
- *
- * Fixed by commit 0ace17d568241:
- * "can, slip: Protect tty->disc_data in write_wakeup and close with RCU"
- *
- * This is also regression test for commit:
- * dd42bf1197144 ("tty: Prevent ldisc drivers from re-using stale tty fields")
- */
-
-#define _GNU_SOURCE
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <termios.h>
-#include "lapi/ioctl.h"
-
-#include "tst_test.h"
-#include "tst_safe_stdio.h"
-#include "tst_fuzzy_sync.h"
-
-struct ldisc_info {
- int n;
- char *name;
-};
-
-static struct ldisc_info ldiscs[] = {
- {2, "mouse"},
-
- {1, "SLIP"},
- {3, "Async PPP"},
- {5, "AX25/KISS"},
- {13, "HDLC"},
- {14, "Sync PPP"},
- {17, "SLCAN"},
- {18, "PPS"},
- {20, "CAIF"},
- {21, "GSM"}
-};
-
-static struct tst_fzsync_pair fzp;
-static volatile int ptmx;
-
-static void *hangup(void *unused)
-{
- int i;
-
- while (tst_fzsync_run_b(&fzp)) {
- tst_fzsync_start_race_b(&fzp);
- for (i = 0; i < 10; i++) {
- if (tcflush(ptmx, TCIFLUSH))
- tst_brk(TBROK | TERRNO, "tcflush(ptmx, TCIFLUSH)");
- }
- tst_fzsync_end_race_b(&fzp);
- }
-
- return unused;
-}
-
-static int set_ldisc(int tty, struct ldisc_info *ldisc)
-{
- TEST(ioctl(tty, TIOCSETD, &ldisc->n));
-
- if (!TST_RET)
- return 0;
-
- if (TST_ERR == EINVAL) {
- tst_res(TCONF | TTERRNO,
- "You don't appear to have the %s TTY line discipline",
- ldisc->name);
- } else {
- tst_res(TFAIL | TTERRNO,
- "Failed to set the %s line discipline", ldisc->name);
- }
-
- return 1;
-}
-
-static void do_test(unsigned int n)
-{
- int pts;
- char pts_path[PATH_MAX];
- struct ldisc_info *ldisc = &ldiscs[n + 1];
-
- tst_res(TINFO, "Creating PTY with %s line discipline", ldisc->name);
-
- tst_fzsync_pair_reset(&fzp, hangup);
- while (tst_fzsync_run_a(&fzp)) {
- ptmx = SAFE_OPEN("/dev/ptmx", O_RDONLY);
- if (grantpt(ptmx))
- tst_brk(TBROK | TERRNO, "grantpt(ptmx)");
- if (unlockpt(ptmx))
- tst_brk(TBROK | TERRNO, "unlockpt(ptmx)");
- if (ptsname_r(ptmx, pts_path, sizeof(pts_path)))
- tst_brk(TBROK | TERRNO, "ptsname_r(ptmx, ...)");
- pts = SAFE_OPEN(pts_path, O_RDONLY);
-
- if (set_ldisc(pts, &ldiscs[0]))
- tst_brk(TCONF, "Need to set mouse discipline first");
- if (set_ldisc(pts, ldisc))
- return;
-
- tst_fzsync_start_race_a(&fzp);
- ioctl(pts, TIOCVHANGUP);
- tst_fzsync_end_race_a(&fzp);
-
- SAFE_CLOSE(pts);
- SAFE_CLOSE(ptmx);
- }
-
- tst_res(TPASS, "Did not crash with %s TTY discipline", ldisc->name);
-}
-
-static void setup(void)
-{
- fzp.min_samples = 20;
- fzp.exec_time_p = 0.1;
-
- tst_fzsync_pair_init(&fzp);
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzp);
-}
-
-static struct tst_test test = {
- .test = do_test,
- .tcnt = 9,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "0ace17d568241"},
- {"CVE", "2020-14416"},
- {"linux-git", "dd42bf1197144"},
- {}
- }
-};
diff --git a/testcases/kernel/pty/pty04.c b/testcases/kernel/pty/pty04.c
deleted file mode 100644
index 00b714c82..000000000
--- a/testcases/kernel/pty/pty04.c
+++ /dev/null
@@ -1,483 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE
- *
- * Test transmitting data over a PTY/TTY line discipline and reading from the
- * virtual netdev created by the line discipline. Also hangup the PTY while
- * data is in flight to try to cause a race between the netdev being deleted
- * and the discipline receive function writing to the netdev.
- *
- * For SLCAN we check stack data is not leaked in the frame padding
- * (CVE-2020-11494).
- *
- * Test flow:
- * 1. Create PTY with ldisc X which creates netdev Y
- * 2. Open raw packet socket and bind to netdev Y
- * 3. Send data on ptmx and read packets from socket
- * 4. Hangup while transmission in progress
- *
- * Note that not all line disciplines call unthrottle when they are ready to
- * read more bytes. So it is possible to fill all the write buffers causing
- * write to block forever (because once write sleeps it needs unthrottle to
- * wake it). So we write with O_NONBLOCK.
- *
- * Also the max buffer size for PTYs is 8192, so even if the protocol MTU is
- * greater everything may still be processed in 8129 byte chunks. At least
- * until we are in the netdev code which can have a bigger buffer. Of course
- * the MTU still decides exactly where the packet delimiter goes, this just
- * concerns choosing the best packet size to cause a race.
- *
- * Note on line discipline encapsulation formats:
- * - For SLIP frames we just write the data followed by a delimiter char
- * - SLCAN we write some ASCII described in drivers/net/can/slcan.c which is
- * converted to the actual frame by the kernel
- */
-
-#define _GNU_SOURCE
-#include "config.h"
-#include "tst_test.h"
-#include "tst_buffers.h"
-#include "lapi/tty.h"
-
-#if defined(HAVE_LINUX_IF_PACKET_H) && defined(HAVE_LINUX_IF_ETHER_H)
-
-#include <linux/if_packet.h>
-#include <linux/if_ether.h>
-#include <linux/tty.h>
-
-/*
- * define instead of including <linux/can.h> to support kernel headers
- * before change from v4.2-rc1
- * a2f11835994e ("can.h: make padding given by gcc explicit").
- */
-
-#define CAN_MTU (sizeof(struct can_frame))
-#define CAN_MAX_DLEN 8
-
-typedef uint32_t canid_t;
-
-struct can_frame {
- canid_t can_id;
- uint8_t can_dlc;
- uint8_t __pad;
- uint8_t __res0;
- uint8_t __res1;
- uint8_t data[CAN_MAX_DLEN] __attribute__((aligned(8)));
-};
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <termios.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include "lapi/ioctl.h"
-
-#include "tst_safe_stdio.h"
-
-#define str(s) #s
-#define SLCAN_FRAME "t00185f5f5f5f5f5f5f5f\r"
-
-struct ldisc_info {
- int n;
- char *name;
- int mtu;
-};
-
-static struct ldisc_info ldiscs[] = {
- {N_SLIP, "N_SLIP", 8192},
- {N_SLCAN, "N_SLCAN", CAN_MTU},
-};
-
-static int ptmx, pts, sk, mtu, no_check;
-
-static int set_ldisc(int tty, const struct ldisc_info *ldisc)
-{
- TEST(ioctl(tty, TIOCSETD, &ldisc->n));
-
- if (!TST_RET)
- return 0;
-
- if (TST_ERR == EINVAL) {
- tst_res(TCONF | TTERRNO,
- "You don't appear to have the %s TTY line discipline",
- ldisc->name);
- } else {
- tst_res(TFAIL | TTERRNO,
- "Failed to set the %s line discipline", ldisc->name);
- }
-
- return 1;
-}
-
-static int open_pty(const struct ldisc_info *ldisc)
-{
- char pts_path[PATH_MAX];
-
- ptmx = SAFE_OPEN("/dev/ptmx", O_RDWR);
- if (grantpt(ptmx))
- tst_brk(TBROK | TERRNO, "grantpt(ptmx)");
- if (unlockpt(ptmx))
- tst_brk(TBROK | TERRNO, "unlockpt(ptmx)");
- if (ptsname_r(ptmx, pts_path, sizeof(pts_path)))
- tst_brk(TBROK | TERRNO, "ptsname_r(ptmx, ...)");
-
- SAFE_FCNTL(ptmx, F_SETFL, O_NONBLOCK);
-
- tst_res(TINFO, "PTS path is %s", pts_path);
- pts = SAFE_OPEN(pts_path, O_RDWR);
-
- return set_ldisc(pts, ldisc);
-}
-
-static ssize_t try_async_write(int fd, const char *data, ssize_t size,
- ssize_t *done)
-{
- ssize_t off = done ? *done : 0;
- ssize_t ret = write(fd, data + off, size - off);
-
- if (ret < 0)
- return -(errno != EAGAIN);
-
- if (!done)
- return 1;
-
- *done += ret;
- return *done >= size;
-}
-
-static ssize_t try_async_read(int fd, char *data, ssize_t size,
- ssize_t *done)
-{
- ssize_t off = done ? *done : 0;
- ssize_t ret = read(fd, data + off, size - off);
-
- if (ret < 0)
- return -(errno != EAGAIN);
-
- if (!done)
- return 1;
-
- *done += ret;
- return *done >= size;
-}
-
-static ssize_t retry_async_write(int fd, const char *data, ssize_t size)
-{
- ssize_t done = 0;
-
- return TST_RETRY_FUNC(try_async_write(fd, data, size, &done),
- TST_RETVAL_NOTNULL);
-}
-
-static ssize_t retry_async_read(int fd, char *data, ssize_t size)
-{
- ssize_t done = 0;
-
- return TST_RETRY_FUNC(try_async_read(fd, data, size, &done),
- TST_RETVAL_NOTNULL);
-}
-
-static void do_pty(const struct ldisc_info *ldisc)
-{
- char *data;
- ssize_t ret;
- size_t len = 0;
-
- switch (ldisc->n) {
- case N_SLIP:
- len = mtu;
- break;
- case N_SLCAN:
- len = sizeof(SLCAN_FRAME) - 1;
- break;
- }
-
- data = tst_alloc(len);
-
- switch (ldisc->n) {
- case N_SLIP:
- memset(data, '_', len - 1);
- data[len - 1] = 0300;
- break;
- case N_SLCAN:
- memcpy(data, SLCAN_FRAME, len);
- break;
- }
-
- ret = retry_async_write(ptmx, data, len);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "Failed 1st write to PTY");
- tst_res(TPASS, "Wrote PTY %s %d (1)", ldisc->name, ptmx);
-
- ret = retry_async_write(ptmx, data, len);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "Failed 2nd write to PTY");
-
- if (tcflush(ptmx, TCIFLUSH))
- tst_brk(TBROK | TERRNO, "tcflush(ptmx, TCIFLUSH)");
-
- tst_res(TPASS, "Wrote PTY %s %d (2)", ldisc->name, ptmx);
-
- ret = retry_async_read(ptmx, data, len);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "Failed read of PTY");
-
- tst_res(TPASS, "Read PTY %s %d", ldisc->name, ptmx);
- TST_CHECKPOINT_WAKE(0);
-
- while (1) {
- if (retry_async_read(ptmx, data, len) < 0)
- break;
-
- if (retry_async_write(ptmx, data, len) < 0)
- break;
- }
-
- tst_res(TPASS, "Transmission on PTY interrupted by hangup");
-
- tst_free_all();
-}
-
-static void open_netdev(const struct ldisc_info *ldisc)
-{
- struct ifreq ifreq = { 0 };
- struct sockaddr_ll lla = { 0 };
-
- SAFE_IOCTL(pts, SIOCGIFNAME, ifreq.ifr_name);
- tst_res(TINFO, "Netdev is %s", ifreq.ifr_name);
-
- sk = SAFE_SOCKET(PF_PACKET, SOCK_RAW, 0);
-
- ifreq.ifr_mtu = ldisc->mtu;
- if (ioctl(sk, SIOCSIFMTU, &ifreq))
- tst_res(TWARN | TERRNO, "Failed to set netdev MTU to maximum");
- SAFE_IOCTL(sk, SIOCGIFMTU, &ifreq);
- mtu = ifreq.ifr_mtu;
- tst_res(TINFO, "Netdev MTU is %d (we set %d)", mtu, ldisc->mtu);
-
- SAFE_IOCTL(sk, SIOCGIFFLAGS, &ifreq);
- ifreq.ifr_flags |= IFF_UP | IFF_RUNNING;
- SAFE_IOCTL(sk, SIOCSIFFLAGS, &ifreq);
- SAFE_IOCTL(sk, SIOCGIFFLAGS, &ifreq);
-
- if (!(ifreq.ifr_flags & IFF_UP))
- tst_brk(TBROK, "Netdev did not come up");
-
- SAFE_IOCTL(sk, SIOCGIFINDEX, &ifreq);
-
- lla.sll_family = PF_PACKET;
- lla.sll_protocol = htons(ETH_P_ALL);
- lla.sll_ifindex = ifreq.ifr_ifindex;
- SAFE_BIND(sk, (struct sockaddr *)&lla, sizeof(struct sockaddr_ll));
-
- tst_res(TINFO, "Bound netdev %d to socket %d", ifreq.ifr_ifindex, sk);
-}
-
-static void check_data(const struct ldisc_info *ldisc,
- const char *data, ssize_t len)
-{
- ssize_t i = 0, j;
- struct can_frame frm;
-
- if (no_check)
- return;
-
- if (ldisc->n == N_SLCAN) {
- memcpy(&frm, data, len);
-
- if (frm.can_id != 1) {
- tst_res(TFAIL, "can_id = %d != 1",
- frm.can_id);
- no_check = 1;
- }
-
- if (frm.can_dlc != CAN_MAX_DLEN) {
- tst_res(TFAIL, "can_dlc = %d != " str(CAN_MAX_DLEN),
- frm.can_dlc);
- no_check = 1;
- }
-
- i = offsetof(struct can_frame, __pad);
- if (frm.__pad != frm.__res0 || frm.__res0 != frm.__res1) {
- tst_res_hexd(TFAIL, data + i,
- offsetof(struct can_frame, data) - i,
- "Padding bytes may contain stack data");
- no_check = 1;
- }
-
- i = offsetof(struct can_frame, data);
- }
-
- do {
- if (i >= len)
- return;
- } while (data[i++] == '_');
-
- j = i--;
-
- while (j < len && j - i < 65 && data[j++] != '_')
- ;
- j--;
-
- tst_res_hexd(TFAIL, data + i, j - i,
- "Corrupt data (max 64 of %ld bytes shown): data[%ld..%ld] = ",
- len, i, j);
- no_check = 1;
-
- if (no_check)
- tst_res(TINFO, "Will continue test without data checking");
-}
-
-static ssize_t try_sync_read(int fd, char *data, ssize_t size)
-{
- ssize_t ret, n = 0;
- int retry = mtu;
-
- while (retry--) {
- ret = read(fd, data + n, size - n);
-
- if (ret < 0)
- return ret;
-
- if ((n += ret) >= size)
- return ret;
- }
-
- tst_brk(TBROK | TERRNO, "Only read %zd of %zd bytes", n, size);
-
- return n;
-}
-
-static ssize_t try_sync_write(int fd, const char *data, ssize_t size)
-{
- ssize_t ret, n = 0;
- int retry = mtu;
-
- while (retry--) {
- ret = write(fd, data + n, size - n);
-
- if (ret < 0)
- return ret;
-
- if ((n += ret) >= size)
- return ret;
- }
-
- tst_brk(TBROK | TERRNO, "Only wrote %zd of %zd bytes", n, size);
-
- return n;
-}
-
-static void read_netdev(const struct ldisc_info *ldisc)
-{
- int rlen, plen = 0;
- char *data;
-
- switch (ldisc->n) {
- case N_SLIP:
- plen = mtu - 1;
- break;
- case N_SLCAN:
- plen = CAN_MTU;
- break;
- }
- data = tst_alloc(plen);
-
- tst_res(TINFO, "Reading from socket %d", sk);
-
- TEST(try_sync_read(sk, data, plen));
- if (TST_RET < 0)
- tst_brk(TBROK | TTERRNO, "Read netdev %s %d (1)", ldisc->name, sk);
- check_data(ldisc, data, plen);
- tst_res(TPASS, "Read netdev %s %d (1)", ldisc->name, sk);
-
- TEST(try_sync_read(sk, data, plen));
- if (TST_RET < 0)
- tst_brk(TBROK | TTERRNO, "Read netdev %s %d (2)", ldisc->name, sk);
- check_data(ldisc, data, plen);
- tst_res(TPASS, "Read netdev %s %d (2)", ldisc->name, sk);
-
- TEST(try_sync_write(sk, data, plen));
- if (TST_RET < 0)
- tst_brk(TBROK | TTERRNO, "Write netdev %s %d", ldisc->name, sk);
-
- tst_res(TPASS, "Write netdev %s %d", ldisc->name, sk);
-
- while (1) {
- if (try_sync_write(sk, data, plen) < 0)
- break;
-
- if ((rlen = try_sync_read(sk, data, plen)) < 0)
- break;
- check_data(ldisc, data, rlen);
- }
-
- tst_res(TPASS, "Data transmission on netdev interrupted by hangup");
-
- close(sk);
- tst_free_all();
-}
-
-static void do_test(unsigned int n)
-{
- struct ldisc_info *ldisc = &ldiscs[n];
-
- if (open_pty(ldisc))
- return;
-
- open_netdev(ldisc);
-
- if (!SAFE_FORK()) {
- read_netdev(ldisc);
- return;
- }
-
- if (!SAFE_FORK()) {
- do_pty(ldisc);
- return;
- }
-
- if (!SAFE_FORK()) {
- TST_CHECKPOINT_WAIT2(0, 100000);
- SAFE_IOCTL(pts, TIOCVHANGUP);
- tst_res(TINFO, "Sent hangup ioctl to PTS");
- SAFE_IOCTL(ptmx, TIOCVHANGUP);
- tst_res(TINFO, "Sent hangup ioctl to PTM");
- return;
- }
-
- tst_reap_children();
-}
-
-static void cleanup(void)
-{
- ioctl(pts, TIOCVHANGUP);
- ioctl(ptmx, TIOCVHANGUP);
- close(sk);
-
- tst_reap_children();
-}
-
-static struct tst_test test = {
- .test = do_test,
- .cleanup = cleanup,
- .tcnt = 2,
- .forks_child = 1,
- .needs_checkpoints = 1,
- .needs_root = 1,
- .tags = (const struct tst_tag[]){
- {"linux-git", "b9258a2cece4ec1f020715fe3554bc2e360f6264"},
- {"CVE", "CVE-2020-11494"},
- {}
- }
-};
-
-#else
-
-TST_TEST_TCONF("Need <linux/if_packet.h> and <linux/if_ether.h>");
-
-#endif
diff --git a/testcases/kernel/pty/pty05.c b/testcases/kernel/pty/pty05.c
deleted file mode 100644
index afef051c8..000000000
--- a/testcases/kernel/pty/pty05.c
+++ /dev/null
@@ -1,105 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2017-2636
- *
- * Check for race between flush_tx_queue() and n_hdlc_send_frames(). Kernel
- * crash fixed in:
- *
- * commit 82f2341c94d270421f383641b7cd670e474db56b
- * Author: Alexander Popov <alex.popov@linux.com>
- * Date: Tue Feb 28 19:54:40 2017 +0300
- *
- * tty: n_hdlc: get rid of racy n_hdlc.tbuf
- */
-
-#define _GNU_SOURCE
-#include <termios.h>
-#include "lapi/ioctl.h"
-#include "lapi/tty.h"
-
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-
-#define BUF_SIZE 1
-
-static struct tst_fzsync_pair fzsync_pair;
-static volatile int ptmx = -1;
-static char buf[BUF_SIZE];
-
-static void setup(void)
-{
- fzsync_pair.exec_loops = 100000;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- ioctl(ptmx, TCFLSH, TCIOFLUSH);
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- int ldisc = N_HDLC;
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- ptmx = SAFE_OPEN("/dev/ptmx", O_RDWR);
- TEST(ioctl(ptmx, TIOCSETD, &ldisc));
-
- if (TST_RET == -1 && TST_ERR == EINVAL) {
- tst_brk(TCONF, "HDLC line discipline not available");
- } else if (TST_RET == -1) {
- tst_brk(TBROK | TTERRNO, "Cannot set line discipline");
- } else if (TST_RET != 0) {
- tst_brk(TBROK | TTERRNO,
- "Invalid ioctl() return value %ld", TST_RET);
- }
-
- SAFE_IOCTL(ptmx, TCXONC, TCOOFF);
- SAFE_WRITE(1, ptmx, buf, BUF_SIZE);
-
- tst_fzsync_start_race_a(&fzsync_pair);
- ioctl(ptmx, TCXONC, TCOON);
- tst_fzsync_end_race_a(&fzsync_pair);
-
- SAFE_CLOSE(ptmx);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzsync_pair);
-
- if (ptmx >= 0)
- SAFE_CLOSE(ptmx);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "82f2341c94d27"},
- {"CVE", "2017-2636"},
- {}
- }
-};
diff --git a/testcases/kernel/sched/clisrv/Makefile b/testcases/kernel/sched/clisrv/Makefile
index f10aa39c6..af43b7efd 100644
--- a/testcases/kernel/sched/clisrv/Makefile
+++ b/testcases/kernel/sched/clisrv/Makefile
@@ -1,6 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2009, Cisco Systems Inc.
+#
+# kernel/sched/cliserv test suite Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, July 2009
+#
top_srcdir ?= ../../../..
@@ -13,6 +31,6 @@ INSTALL_TARGETS := data run_sched_cliserv.sh
MAKE_TARGETS := pthcli pthserv
-$(MAKE_TARGETS): %: readline.o writen.o
+$(MAKE_TARGETS): %: %.o readline.o writen.o
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/sched/eas/trace_parse.h b/testcases/kernel/sched/eas/trace_parse.h
index 732387e30..afce586a9 100644
--- a/testcases/kernel/sched/eas/trace_parse.h
+++ b/testcases/kernel/sched/eas/trace_parse.h
@@ -26,7 +26,7 @@ enum {
#define IRQ_CONTEXT_NMI 'z'
#define IRQ_CONTEXT_NMI_IN_HARD 'Z'
-struct trace_timestamp {
+struct timestamp {
unsigned int sec;
unsigned int usec;
};
@@ -79,7 +79,7 @@ struct trace_record {
unsigned char irq_context;
unsigned short preempt_depth;
- struct trace_timestamp ts;
+ struct timestamp ts;
unsigned int event_type;
void *event_data;
diff --git a/testcases/kernel/sched/hyperthreading/ht_affinity/Makefile b/testcases/kernel/sched/hyperthreading/ht_affinity/Makefile
index 6b64bd261..10fec96dc 100644
--- a/testcases/kernel/sched/hyperthreading/ht_affinity/Makefile
+++ b/testcases/kernel/sched/hyperthreading/ht_affinity/Makefile
@@ -28,6 +28,6 @@ INSTALL_TARGETS := smt_smp_affinity.sh
MAKE_TARGETS := ht_affinity
-$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(sort $(wildcard $(abs_srcdir)/*.c)))
+$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(wildcard $(abs_srcdir)/*.c))
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/sched/hyperthreading/ht_enabled/Makefile b/testcases/kernel/sched/hyperthreading/ht_enabled/Makefile
index 585ff1383..9c1e139d6 100644
--- a/testcases/kernel/sched/hyperthreading/ht_enabled/Makefile
+++ b/testcases/kernel/sched/hyperthreading/ht_enabled/Makefile
@@ -28,6 +28,6 @@ INSTALL_TARGETS := smt_smp_enabled.sh
MAKE_TARGETS := ht_enabled
-$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(sort $(wildcard $(abs_srcdir)/*.c)))
+$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(wildcard $(abs_srcdir)/*.c))
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/sched/hyperthreading/ht_enabled/ht_enabled.c b/testcases/kernel/sched/hyperthreading/ht_enabled/ht_enabled.c
index 90f37e554..72bce1f72 100644
--- a/testcases/kernel/sched/hyperthreading/ht_enabled/ht_enabled.c
+++ b/testcases/kernel/sched/hyperthreading/ht_enabled/ht_enabled.c
@@ -19,7 +19,7 @@
char *TCID = "smt_smp_enabled";
int TST_TOTAL = 1;
-int main(void)
+int main(int argc, char *argv[])
{
int ret_val = 1;
#if (!defined __x86_64__ && !defined __i386__)
diff --git a/testcases/kernel/sched/process_stress/process.c b/testcases/kernel/sched/process_stress/process.c
index a5ff80987..f23dcbb8a 100644
--- a/testcases/kernel/sched/process_stress/process.c
+++ b/testcases/kernel/sched/process_stress/process.c
@@ -40,10 +40,11 @@
#include <sys/msg.h>
#include <sys/resource.h>
#include <sys/select.h>
+#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include "lapi/sem.h"
+#include "lapi/semun.h"
/* indexes into environment variable array */
#define ADBG 0
diff --git a/testcases/kernel/sched/pthreads/pth_str01.c b/testcases/kernel/sched/pthreads/pth_str01.c
index 93843c22d..15e83600d 100644
--- a/testcases/kernel/sched/pthreads/pth_str01.c
+++ b/testcases/kernel/sched/pthreads/pth_str01.c
@@ -390,7 +390,7 @@ int doit(c_info * parent)
if ((rc =
pthread_create(&(info_p->threads[child]), &attr,
(void *)doit, (void *)info_p))) {
- tst_resm(TINFO, "pthread_create (doit): %s",
+ tst_resm(TINFO, "pthread_create (doit): %s\n",
strerror(rc));
testexit(3);
} else {
@@ -553,7 +553,7 @@ int main(int argc, char *argv[])
* Initialize node mutex.
*/
if ((rc = pthread_mutex_init(&node_mutex, NULL))) {
- tst_resm(TINFO, "pthread_mutex_init(node_mutex): %s",
+ tst_resm(TINFO, "pthread_mutex_init(node_mutex): %s\n",
strerror(rc));
testexit(7);
}
@@ -562,7 +562,7 @@ int main(int argc, char *argv[])
* Initialize node condition variable.
*/
if ((rc = pthread_cond_init(&node_condvar, NULL))) {
- tst_resm(TINFO, "pthread_cond_init(node_condvar): %s",
+ tst_resm(TINFO, "pthread_cond_init(node_condvar): %s\n",
strerror(rc));
testexit(8);
}
@@ -606,14 +606,14 @@ int main(int argc, char *argv[])
if ((rc = pthread_mutex_init(&child_info[ind].child_mutex,
NULL))) {
- tst_resm(TINFO, "pthread_mutex_init child_mutex: %s",
+ tst_resm(TINFO, "pthread_mutex_init child_mutex: %s\n",
strerror(rc));
testexit(13);
}
if ((rc = pthread_mutex_init(&child_info[ind].talk_mutex,
NULL))) {
- tst_resm(TINFO, "pthread_mutex_init talk_mutex: %s",
+ tst_resm(TINFO, "pthread_mutex_init talk_mutex: %s\n",
strerror(rc));
testexit(14);
}
@@ -628,7 +628,7 @@ int main(int argc, char *argv[])
if ((rc = pthread_cond_init(&child_info[ind].talk_condvar,
NULL))) {
- tst_resm(TINFO, "pthread_cond_init talk_condvar: %s",
+ tst_resm(TINFO, "pthread_cond_init talk_condvar: %s\n",
strerror(rc));
testexit(16);
}
@@ -644,7 +644,7 @@ int main(int argc, char *argv[])
"Creating root thread attributes via pthread_attr_init.");
if ((rc = pthread_attr_init(&attr))) {
- tst_resm(TINFO, "pthread_attr_init: %s", strerror(rc));
+ tst_resm(TINFO, "pthread_attr_init: %s\n", strerror(rc));
testexit(17);
}
@@ -655,7 +655,7 @@ int main(int argc, char *argv[])
*/
if ((rc = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE))
) {
- tst_resm(TINFO, "pthread_attr_setdetachstate: %s",
+ tst_resm(TINFO, "pthread_attr_setdetachstate: %s\n",
strerror(rc));
testexit(18);
}
@@ -663,7 +663,7 @@ int main(int argc, char *argv[])
tst_resm(TINFO, "Creating root thread via pthread_create.");
if ((rc = pthread_create(&root_thread, &attr, (void *)doit, NULL))) {
- tst_resm(TINFO, "pthread_create: %s", strerror(rc));
+ tst_resm(TINFO, "pthread_create: %s\n", strerror(rc));
testexit(19);
}
@@ -676,7 +676,7 @@ int main(int argc, char *argv[])
* Wait for the root child to exit.
*/
if ((rc = pthread_join(root_thread, NULL))) {
- tst_resm(TINFO, "pthread_join: %s", strerror(rc));
+ tst_resm(TINFO, "pthread_join: %s\n", strerror(rc));
testexit(20);
}
diff --git a/testcases/kernel/sched/sched_stress/Makefile b/testcases/kernel/sched/sched_stress/Makefile
index 4dbbf3477..60bdc6936 100644
--- a/testcases/kernel/sched/sched_stress/Makefile
+++ b/testcases/kernel/sched/sched_stress/Makefile
@@ -1,6 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2009, Cisco Systems Inc.
+#
+# kernel/sched/sched_stress testcases Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, July 2009
+#
top_srcdir ?= ../../../..
@@ -10,11 +28,11 @@ INSTALL_TARGETS := sched_stress.sh
LDLIBS += -lpthread
-MAKE_TARGETS := $(filter-out sched,$(patsubst $(abs_srcdir)/%.c,%,$(sort $(wildcard $(abs_srcdir)/*.c))))
+MAKE_TARGETS := $(filter-out sched,$(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*.c)))
RM += -r
-$(filter-out sched_datafile,$(MAKE_TARGETS)): %: sched.o
+$(filter-out sched_datafile,$(MAKE_TARGETS)): %: %.o sched.o
MAKE_TARGETS += sched_datafile
diff --git a/testcases/kernel/sched/tool/trace_sched.c b/testcases/kernel/sched/tool/trace_sched.c
index 85c4b23ad..71caf239a 100644
--- a/testcases/kernel/sched/tool/trace_sched.c
+++ b/testcases/kernel/sched/tool/trace_sched.c
@@ -52,7 +52,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <sys/time.h>
+#include <sys/timeb.h>
#include <unistd.h>
#include <string.h>
@@ -199,7 +199,7 @@ void *thread_func(void *args)
static int sched_policy; /* scheduling policy as set by user/default */
struct sched_param ssp; /* set schedule priority. */
struct sched_param gsp; /* gsp schedule priority. */
- struct timeval tptr; /* tptr.tv_usec will be used to seed srand. */
+ struct timeb tptr; /* tptr.millitm will be used to seed srand. */
thread_sched_t *locargptr = /* local ptr to the arguments. */
(thread_sched_t *) args;
@@ -215,8 +215,8 @@ void *thread_func(void *args)
ssp.sched_priority = 0;
else {
/* Set a random value between max_priority and min_priority */
- gettimeofday(&tptr, NULL);
- srand((unsigned int)tptr.tv_usec);
+ ftime(&tptr);
+ srand((tptr.millitm) % 1000);
set_priority = (min_priority + (int)((float)max_priority
* rand() / (RAND_MAX +
1.0)));
diff --git a/testcases/kernel/security/cap_bound/cap_bounds_rw.c b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
index 503853c5b..f715c703d 100644
--- a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
+++ b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
@@ -54,11 +54,11 @@ int check_remaining_caps(int lastdropped)
if (ret == -1) {
tst_brkm(TBROK,
NULL,
- "Failed to read bounding set during sanity check");
+ "Failed to read bounding set during sanity check\n");
}
if (ret == 1) {
tst_resm(TFAIL,
- "Bit %d should have been dropped but wasn't",
+ "Bit %d should have been dropped but wasn't\n",
i);
return i;
}
@@ -74,11 +74,11 @@ int check_remaining_caps(int lastdropped)
if (ret == -1) {
tst_brkm(TBROK,
NULL,
- "Failed to read bounding set during sanity check");
+ "Failed to read bounding set during sanity check\n");
}
if (ret == 0) {
tst_resm(TFAIL,
- "Bit %d wasn't yet dropped, but isn't in bounding set",
+ "Bit %d wasn't yet dropped, but isn't in bounding set\n",
i);
return -i;
}
@@ -107,7 +107,7 @@ int main(void)
#endif
if (ret != -1) {
tst_brkm(TFAIL, NULL,
- "prctl(PR_CAPBSET_DROP, -1) returned %d",
+ "prctl(PR_CAPBSET_DROP, -1) returned %d\n",
ret);
}
/* Ideally I'd check CAP_LAST_CAP+1, but userspace
@@ -123,9 +123,9 @@ int main(void)
ret = -1;
#endif
if (ret != -1) {
- tst_resm(TFAIL, "prctl(PR_CAPBSET_DROP, %d) returned %d",
+ tst_resm(TFAIL, "prctl(PR_CAPBSET_DROP, %d) returned %d\n",
max(INSANE, CAP_LAST_CAP + 1), ret);
- tst_resm(TINFO, " %d is should not exist",
+ tst_resm(TINFO, " %d is should not exist\n",
max(INSANE, CAP_LAST_CAP + 1));
tst_exit();
}
@@ -138,26 +138,26 @@ int main(void)
#endif
if (ret != 0) {
tst_resm(TFAIL,
- "prctl(PR_CAPBSET_DROP, %d) returned %d", i,
+ "prctl(PR_CAPBSET_DROP, %d) returned %d\n", i,
ret);
if (ret == -1)
- tst_resm(TINFO, "errno was %d", errno);
+ tst_resm(TINFO, "errno was %d\n", errno);
tst_exit();
}
ret = check_remaining_caps(i);
if (ret > 0) {
tst_brkm(TFAIL,
NULL,
- "after dropping bits 0..%d, %d was still in bounding set",
+ "after dropping bits 0..%d, %d was still in bounding set\n",
i, ret);
} else if (ret < 0) {
tst_brkm(TFAIL,
NULL,
- "after dropping bits 0..%d, %d was not in bounding set",
+ "after dropping bits 0..%d, %d was not in bounding set\n",
i, -ret);
}
}
- tst_resm(TPASS, "PR_CAPBSET_DROP tests passed");
+ tst_resm(TPASS, "PR_CAPBSET_DROP tests passed\n");
#else
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
diff --git a/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c b/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
index 5378907aa..feb7fbd3f 100644
--- a/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
+++ b/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
@@ -38,7 +38,7 @@
char *TCID = "cap_bounds_r";
int TST_TOTAL = 2;
-int main(void)
+int main(int argc, char *argv[])
{
#if HAVE_SYS_CAPABILITY_H
#if HAVE_DECL_PR_CAPBSET_READ && HAVE_DECL_PR_CAPBSET_DROP
@@ -52,7 +52,7 @@ int main(void)
/* make sure we have the capability now */
ret = prctl(PR_CAPBSET_READ, CAP_SYS_ADMIN);
if (ret != 1) {
- tst_brkm(TBROK, NULL, "Not starting with CAP_SYS_ADMIN");
+ tst_brkm(TBROK, NULL, "Not starting with CAP_SYS_ADMIN\n");
}
/* Make sure it's in pI */
@@ -60,21 +60,21 @@ int main(void)
if (!cur) {
tst_brkm(TBROK,
NULL,
- "Failed to create cap_sys_admin+i cap_t (errno %d)",
+ "Failed to create cap_sys_admin+i cap_t (errno %d)\n",
errno);
}
ret = cap_set_proc(cur);
if (ret) {
tst_brkm(TBROK,
NULL,
- "Failed to cap_set_proc with cap_sys_admin+i (ret %d errno %d)",
+ "Failed to cap_set_proc with cap_sys_admin+i (ret %d errno %d)\n",
ret, errno);
}
cap_free(cur);
cur = cap_get_proc();
ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_INHERITABLE, &f);
if (ret || f != CAP_SET) {
- tst_brkm(TBROK, NULL, "Failed to add CAP_SYS_ADMIN to pI");
+ tst_brkm(TBROK, NULL, "Failed to add CAP_SYS_ADMIN to pI\n");
}
cap_free(cur);
@@ -82,8 +82,8 @@ int main(void)
ret = prctl(PR_CAPBSET_DROP, CAP_SYS_ADMIN);
if (ret) {
tst_resm(TFAIL,
- "Failed to drop CAP_SYS_ADMIN from bounding set.");
- tst_resm(TINFO, "(ret=%d, errno %d)", ret, errno);
+ "Failed to drop CAP_SYS_ADMIN from bounding set.\n");
+ tst_resm(TINFO, "(ret=%d, errno %d)\n", ret, errno);
tst_exit();
}
@@ -93,22 +93,22 @@ int main(void)
if (ret || f != CAP_SET) {
tst_brkm(TFAIL,
NULL,
- "CAP_SYS_ADMIN not in pI after dropping from bounding set");
+ "CAP_SYS_ADMIN not in pI after dropping from bounding set\n");
}
tst_resm(TPASS,
- "CAP_SYS_ADMIN remains in pI after removing from bounding set");
+ "CAP_SYS_ADMIN remains in pI after removing from bounding set\n");
tmpcap = cap_dup(cur);
v[0] = CAP_SYS_ADMIN;
ret = cap_set_flag(tmpcap, CAP_INHERITABLE, 1, v, CAP_CLEAR);
if (ret) {
tst_brkm(TFAIL, NULL,
- "Failed to drop CAP_SYS_ADMIN from cap_t");
+ "Failed to drop CAP_SYS_ADMIN from cap_t\n");
}
ret = cap_set_proc(tmpcap);
if (ret) {
tst_brkm(TFAIL, NULL,
- "Failed to drop CAP_SYS_ADMIN from pI");
+ "Failed to drop CAP_SYS_ADMIN from pI\n");
}
cap_free(tmpcap);
/* test 2: can we put it back in pI? */
@@ -116,12 +116,12 @@ int main(void)
if (ret == 0) { /* success means pI was not bounded by X */
tst_brkm(TFAIL,
NULL,
- "Managed to put CAP_SYS_ADMIN back into pI though not in X");
+ "Managed to put CAP_SYS_ADMIN back into pI though not in X\n");
}
cap_free(cur);
tst_resm(TPASS,
- "Couldn't put CAP_SYS_ADMIN back into pI when not in bounding set");
+ "Couldn't put CAP_SYS_ADMIN back into pI when not in bounding set\n");
#else /* HAVE_LIBCAP */
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
diff --git a/testcases/kernel/security/cap_bound/check_pe.c b/testcases/kernel/security/cap_bound/check_pe.c
index 560d70ff0..c4453ecf8 100644
--- a/testcases/kernel/security/cap_bound/check_pe.c
+++ b/testcases/kernel/security/cap_bound/check_pe.c
@@ -49,33 +49,33 @@ int main(int argc, char *argv[])
int n;
if (argc != 2) {
- tst_brkm(TBROK, NULL, "Usage: check_pe [0|1]");
+ tst_brkm(TBROK, NULL, "Usage: check_pe [0|1]\n");
}
n = atoi(argv[1]);
if (n != 0 && n != 1) {
- tst_brkm(TBROK, NULL, "Usage: check_pe [0|1]");
+ tst_brkm(TBROK, NULL, "Usage: check_pe [0|1]\n");
}
cur = cap_get_proc();
ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_EFFECTIVE, &f);
if (ret) {
- tst_brkm(TBROK, NULL, "cap_get_flag failed (errno %d)",
+ tst_brkm(TBROK, NULL, "cap_get_flag failed (errno %d)\n",
errno);
}
cap_free(cur);
if (n == 1) {
if (f == CAP_SET) {
- tst_resm(TPASS, "cap is in pE");
+ tst_resm(TPASS, "cap is in pE\n");
tst_exit();
}
- tst_brkm(TFAIL, NULL, "cap is not in pE");
+ tst_brkm(TFAIL, NULL, "cap is not in pE\n");
}
if (f == CAP_CLEAR) {
- tst_resm(TPASS, "cap is not in pE");
+ tst_resm(TPASS, "cap is not in pE\n");
tst_exit();
}
- tst_resm(TFAIL, "Cap is in pE");
+ tst_resm(TFAIL, "Cap is in pE\n");
#else /* libcap */
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
diff --git a/testcases/kernel/security/cap_bound/exec_with_inh.c b/testcases/kernel/security/cap_bound/exec_with_inh.c
index 01b755808..13814798e 100644
--- a/testcases/kernel/security/cap_bound/exec_with_inh.c
+++ b/testcases/kernel/security/cap_bound/exec_with_inh.c
@@ -52,21 +52,21 @@ int main(int argc, char *argv[])
if (!cur) {
tst_brkm(TBROK,
NULL,
- "Failed to create cap_sys_admin+i cap_t (errno %d)",
+ "Failed to create cap_sys_admin+i cap_t (errno %d)\n",
errno);
}
ret = cap_set_proc(cur);
if (ret) {
tst_brkm(TBROK,
NULL,
- "Failed to cap_set_proc with cap_sys_admin+i (ret %d errno %d)",
+ "Failed to cap_set_proc with cap_sys_admin+i (ret %d errno %d)\n",
ret, errno);
}
cap_free(cur);
cur = cap_get_proc();
ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_INHERITABLE, &f);
if (ret || f != CAP_SET) {
- tst_brkm(TBROK, NULL, "Failed to add CAP_SYS_ADMIN to pI");
+ tst_brkm(TBROK, NULL, "Failed to add CAP_SYS_ADMIN to pI\n");
}
cap_free(cur);
@@ -74,14 +74,14 @@ int main(int argc, char *argv[])
ret = prctl(PR_CAPBSET_DROP, CAP_SYS_ADMIN);
if (ret) {
tst_resm(TFAIL,
- "Failed to drop CAP_SYS_ADMIN from bounding set.");
- tst_resm(TINFO, "(ret=%d, errno %d)", ret, errno);
+ "Failed to drop CAP_SYS_ADMIN from bounding set.\n");
+ tst_resm(TINFO, "(ret=%d, errno %d)\n", ret, errno);
tst_exit();
}
/* execute "check_pe 1" */
execl("check_pe", "check_pe", "1", NULL);
- tst_resm(TBROK, "Failed to execute check_pe (errno %d)", errno);
+ tst_resm(TBROK, "Failed to execute check_pe (errno %d)\n", errno);
#else /* HAVE_LIBCAP */
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
diff --git a/testcases/kernel/security/cap_bound/exec_without_inh.c b/testcases/kernel/security/cap_bound/exec_without_inh.c
index 10220e10e..0d13d48c3 100644
--- a/testcases/kernel/security/cap_bound/exec_without_inh.c
+++ b/testcases/kernel/security/cap_bound/exec_without_inh.c
@@ -38,7 +38,7 @@
char *TCID = "exec_without_inh";
int TST_TOTAL = 1;
-int main(void)
+int main(int argc, char *argv[])
{
#if HAVE_SYS_CAPABILITY_H
#if HAVE_DECL_PR_CAPBSET_DROP
@@ -59,7 +59,7 @@ int main(void)
if (ret) {
tst_brkm(TBROK,
NULL,
- "Failed to drop cap_sys_admin from pI");
+ "Failed to drop cap_sys_admin from pI\n");
}
} else if (ret) {
tst_brkm(TBROK | TERRNO, NULL, "Failed to add \
@@ -71,14 +71,14 @@ int main(void)
ret = prctl(PR_CAPBSET_DROP, CAP_SYS_ADMIN);
if (ret) {
tst_resm(TFAIL,
- "Failed to drop CAP_SYS_ADMIN from bounding set.");
- tst_resm(TINFO, "(ret=%d, errno %d)", ret, errno);
+ "Failed to drop CAP_SYS_ADMIN from bounding set.\n");
+ tst_resm(TINFO, "(ret=%d, errno %d)\n", ret, errno);
tst_exit();
}
/* execute "check_pe 0" */
execl("check_pe", "check_pe", "0", NULL);
- tst_resm(TBROK, "Failed to execute check_pe (errno %d)", errno);
+ tst_resm(TBROK, "Failed to execute check_pe (errno %d)\n", errno);
#else /* libcap */
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
diff --git a/testcases/kernel/security/dirtyc0w/dirtyc0w.c b/testcases/kernel/security/dirtyc0w/dirtyc0w.c
index 7924285a7..a0a81b6ed 100644
--- a/testcases/kernel/security/dirtyc0w/dirtyc0w.c
+++ b/testcases/kernel/security/dirtyc0w/dirtyc0w.c
@@ -4,8 +4,6 @@
*/
/*
- * CVE-2016-5195
- *
* This is a regression test for write race that allows unprivileged programs
* to change readonly files on the system.
*
@@ -47,8 +45,6 @@ static void setup(void)
{
struct passwd *pw;
- umask(0);
-
pw = SAFE_GETPWNAM("nobody");
nobody_uid = pw->pw_uid;
@@ -103,8 +99,7 @@ static struct tst_test test = {
.test_all = dirtyc0w_test,
.tags = (const struct tst_tag[]) {
{"linux-git", "4ceb5db9757a"},
- {"linux-git", "19be0eaffa3a"},
- {"CVE", "2016-5195"},
+ {"linux-git", "9be0eaffa3ac"},
{}
}
};
diff --git a/testcases/kernel/security/filecaps/inh_capped.c b/testcases/kernel/security/filecaps/inh_capped.c
index d273d0c80..4bbe184aa 100644
--- a/testcases/kernel/security/filecaps/inh_capped.c
+++ b/testcases/kernel/security/filecaps/inh_capped.c
@@ -50,7 +50,7 @@ int set_caps_from_text(char *capstr)
int ret;
if (!caps) {
- tst_resm(TFAIL, "Bad capability name: %s", capstr);
+ tst_resm(TFAIL, "Bad capability name: %s\n", capstr);
return 1;
}
ret = cap_set_proc(caps);
@@ -100,7 +100,7 @@ int main(void)
ret = set_caps_from_text("all=iep cap_sys_admin-ep+i cap_setpcap-e+ip");
debug_print_caps("final");
if (ret) {
- tst_resm(TPASS, "pI is properly capped");
+ tst_resm(TPASS, "pI is properly capped\n");
tst_exit();
}
diff --git a/testcases/kernel/security/filecaps/verify_caps_exec.c b/testcases/kernel/security/filecaps/verify_caps_exec.c
index 4cabcc542..3e6794102 100644
--- a/testcases/kernel/security/filecaps/verify_caps_exec.c
+++ b/testcases/kernel/security/filecaps/verify_caps_exec.c
@@ -80,7 +80,7 @@ static void drop_root(int keep_perms)
prctl(PR_SET_KEEPCAPS, 1);
ret = setresuid(1000, 1000, 1000);
if (ret) {
- tst_brkm(TFAIL | TERRNO, NULL, "Error dropping root privs");
+ tst_brkm(TFAIL | TERRNO, NULL, "Error dropping root privs\n");
tst_exit();
}
if (keep_perms) {
@@ -88,10 +88,10 @@ static void drop_root(int keep_perms)
int ret;
if (!cap)
tst_brkm(TBROK | TERRNO, NULL,
- "cap_from_text failed");
+ "cap_from_text failed\n");
ret = cap_set_proc(cap);
if (ret < 0)
- tst_brkm(TBROK | TERRNO, NULL, "cap_set_proc failed");
+ tst_brkm(TBROK | TERRNO, NULL, "cap_set_proc failed\n");
cap_free(cap);
}
}
@@ -104,15 +104,15 @@ static int perms_test(void)
drop_root(DROP_PERMS);
cap = cap_from_text("all=eip");
if (!cap) {
- tst_resm(TFAIL, "could not get cap from text for perms test");
+ tst_resm(TFAIL, "could not get cap from text for perms test\n");
return 1;
}
ret = cap_set_file(TSTPATH, cap);
if (ret) {
- tst_resm(TPASS, "could not set capabilities as non-root");
+ tst_resm(TPASS, "could not set capabilities as non-root\n");
ret = 0;
} else {
- tst_resm(TFAIL, "could set capabilities as non-root");
+ tst_resm(TFAIL, "could set capabilities as non-root\n");
ret = 1;
}
@@ -126,7 +126,7 @@ static void create_fifo(void)
ret = mkfifo(get_caps_fifo(), S_IRWXU | S_IRWXG | S_IRWXO);
if (ret == -1 && errno != EEXIST)
- tst_brkm(TFAIL | TERRNO, NULL, "failed creating %s",
+ tst_brkm(TFAIL | TERRNO, NULL, "failed creating %s\n",
get_caps_fifo());
}
@@ -146,7 +146,7 @@ static void read_from_fifo(char *buf)
memset(buf, 0, 200);
fd = open(get_caps_fifo(), O_RDONLY);
if (fd < 0)
- tst_brkm(TFAIL | TERRNO, NULL, "Failed opening fifo");
+ tst_brkm(TFAIL | TERRNO, NULL, "Failed opening fifo\n");
read(fd, buf, 199);
close(fd);
}
@@ -163,7 +163,7 @@ static int fork_drop_and_exec(int keepperms, cap_t expected_caps)
pid = fork();
if (pid < 0)
- tst_brkm(TFAIL | TERRNO, NULL, "%s: failed fork", __func__);
+ tst_brkm(TFAIL | TERRNO, NULL, "%s: failed fork\n", __func__);
if (pid == 0) {
drop_root(keepperms);
print_my_caps();
@@ -173,7 +173,7 @@ static int fork_drop_and_exec(int keepperms, cap_t expected_caps)
snprintf(buf, 200, "failed to run as %s\n", capstxt);
cap_free(capstxt);
write_to_fifo(buf);
- tst_brkm(TFAIL, NULL, "%s: exec failed", __func__);
+ tst_brkm(TFAIL, NULL, "%s: exec failed\n", __func__);
} else {
p = buf;
while (1) {
@@ -189,15 +189,15 @@ static int fork_drop_and_exec(int keepperms, cap_t expected_caps)
p = strchr(buf, '.');
if (!p)
tst_brkm(TFAIL, NULL,
- "got a bad message from print_caps");
+ "got a bad message from print_caps\n");
p += 1;
actual_caps = cap_from_text(p);
if (cap_compare(actual_caps, expected_caps) != 0) {
capstxt = cap_to_text(expected_caps, NULL);
tst_resm(TINFO,
- "Expected to run as .%s., ran as .%s..",
+ "Expected to run as .%s., ran as .%s..\n",
capstxt, p);
- tst_resm(TINFO, "those are not the same");
+ tst_resm(TINFO, "those are not the same\n");
cap_free(capstxt);
ret = -1;
}
@@ -251,13 +251,13 @@ static int caps_actually_set_test(void)
cap_set_flag(fcap, CAP_PERMITTED, 1, capvalue, CAP_SET);
ret = cap_set_file(TSTPATH, fcap);
if (ret) {
- tst_resm(TINFO, "%d", whichcap);
+ tst_resm(TINFO, "%d\n", whichcap);
continue;
}
ret = fork_drop_and_exec(DROP_PERMS, fcap);
if (ret) {
tst_resm(TINFO,
- "Failed CAP_PERMITTED=%d CAP_EFFECTIVE=0",
+ "Failed CAP_PERMITTED=%d CAP_EFFECTIVE=0\n",
whichcap);
if (!finalret)
finalret = ret;
@@ -273,13 +273,13 @@ static int caps_actually_set_test(void)
cap_set_flag(fcap, CAP_EFFECTIVE, 1, capvalue, CAP_SET);
ret = cap_set_file(TSTPATH, fcap);
if (ret) {
- tst_resm(TINFO, "%d", whichcap);
+ tst_resm(TINFO, "%d\n", whichcap);
continue;
}
ret = fork_drop_and_exec(DROP_PERMS, fcap);
if (ret) {
tst_resm(TINFO,
- "Failed CAP_PERMITTED=%d CAP_EFFECTIVE=1",
+ "Failed CAP_PERMITTED=%d CAP_EFFECTIVE=1\n",
whichcap);
if (!finalret)
finalret = ret;
@@ -300,7 +300,7 @@ static int caps_actually_set_test(void)
*/
ret = cap_set_proc(cap_fullpi);
if (ret)
- tst_resm(TINFO, "Could not fill pI. pI tests will fail.");
+ tst_resm(TINFO, "Could not fill pI. pI tests will fail.\n");
/*
* next try each bit in fI
@@ -330,13 +330,13 @@ static int caps_actually_set_test(void)
cap_set_flag(fcap, CAP_INHERITABLE, 1, capvalue, CAP_SET);
ret = cap_set_file(TSTPATH, fcap);
if (ret) {
- tst_resm(TINFO, "%d", whichcap);
+ tst_resm(TINFO, "%d\n", whichcap);
continue;
}
ret = fork_drop_and_exec(KEEP_PERMS, pcap);
if (ret) {
tst_resm(TINFO, "Failed with_perms CAP_INHERITABLE=%d "
- "CAP_EFFECTIVE=0", whichcap);
+ "CAP_EFFECTIVE=0\n", whichcap);
if (!finalret)
finalret = ret;
}
@@ -354,7 +354,7 @@ static int caps_actually_set_test(void)
cap_set_flag(pcap, CAP_EFFECTIVE, 1, capvalue, CAP_SET);
ret = cap_set_file(TSTPATH, fcap);
if (ret) {
- tst_resm(TINFO, "%d", whichcap);
+ tst_resm(TINFO, "%d\n", whichcap);
continue;
}
/* The actual result will be a full pI, with
@@ -366,7 +366,7 @@ static int caps_actually_set_test(void)
cap_free(cmpcap);
if (ret) {
tst_resm(TINFO, "Failed with_perms CAP_INHERITABLE=%d "
- "CAP_EFFECTIVE=1", whichcap);
+ "CAP_EFFECTIVE=1\n", whichcap);
if (!finalret)
finalret = ret;
}
@@ -411,9 +411,9 @@ int main(int argc, char *argv[])
case 1:
ret = caps_actually_set_test();
if (ret)
- tst_resm(TFAIL, "Some tests failed");
+ tst_resm(TFAIL, "Some tests failed\n");
else
- tst_resm(TPASS, "All tests passed");
+ tst_resm(TPASS, "All tests passed\n");
break;
default:
usage(argv[0]);
diff --git a/testcases/kernel/security/integrity/ima/README b/testcases/kernel/security/integrity/ima/README
new file mode 100644
index 000000000..a42d74519
--- /dev/null
+++ b/testcases/kernel/security/integrity/ima/README
@@ -0,0 +1,81 @@
+These testcases test the Integrity Measurement Architecture(IMA).
+
+Requirements
+------------
+
+A kernel with IMA configured, mount with i_version support, openssl
+and openssl-devel packages, and auditd, if enabled, with the integrity
+patch, are required to build and run the IMA testsuite.
+
+- Enabling IMA in .config will also enable CRYPTO, SECURITYFS, TCG_TPM,
+ and TPM_TIS.
+
+CONFIG_IMA=y
+CONFIG_IMA_MEASURE_PCR_IDX=10
+CONFIG_IMA_AUDIT=y
+CONFIG_IMA_LSM_RULES=y
+
+- Both sysfs and securityfs if not mounted, will be mounted.
+
+- The testsuite must be executed with root priveleges so that it
+ can access securityfs files, such as: security/ima/policy and
+ security/ima/ascii_runtime_measurement.
+
+- Both openssl and openssl-devel must be installed, to build the
+ testsuite. At runtime, if openssl is not installed, many of the
+ tests will skipped.
+
+- auditd, if enabled, requires the integrity patch, which is available
+ from https://www.redhat.com/archives/linux-audit/2009-March/msg00016.html.
+
+- In order to re-measure a file after it changes, the file system must
+ be mounted with i_version support(Bugzilla 471593).
+ [util-linux-ng-2.14.2-2.fc11.src.rpm]
+
+ Add 'iversion' in /etc/fstab as:
+ dev/hdb1 /home ext2 defaults,iversion 1 2
+
+ To mount the root partition with i_version support, 'iversion' must
+ be added on the remount line in /etc/rc.sysinit:
+ # Remount the root filesystem read-write.
+ update_boot_stage RCmountfs
+ if remount_needed ; then
+ action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw,iversion /
+ fi
+
+
+Dependency
+----------
+The testsuite is dependent on the default TCB policy being enabled, which
+measures all executables, all files mmapped for execute and all files
+open for read by root. For kernels 2.6.31 and greater, enable the
+trusted computing base(TCB) policy using the ima_tcb=1 boot parameter.
+If the TCB policy has been replaced, loading another measurement
+policy will fail, as the policy may only be replaced once per boot.
+Some of the policy dependency tests might also fail as well.
+
+ima_tpm.sh: test02, verifying the PCR-10 value, requires a hard reboot.
+[On Ubuntu, before running the ltp tests, disable /etc/init.d/kexec-load
+and reboot.]
+
+Run tests
+---------
+After doing 'make' and 'make install' from the top-level,
+- execute './ltp-full-<version>/runltp -f ima' to run the entire testsuite.
+- To run individual tests, cd into the IMA directory, and add testcases/bin
+ to PATH:
+ ./ltp-full-<version>/testcases/kernel/security/integrity/ima/tests/
+ and execute the individual scripts.
+
+System State after running the Testsuite
+----------------------------------------
+After running the testsuite, the default measurement policy has been
+replaced with an identical policy. If you want to install a different
+policy, such as an LSM specific one, a reboot is required.
+
+More Info to look at
+--------------------
+http://linux-ima.sourceforge.net/ is a good place to start.
+There's also IMA mailing lists
+http://sourceforge.net/projects/linux-ima
+--
diff --git a/testcases/kernel/security/integrity/ima/datafiles/Makefile b/testcases/kernel/security/integrity/ima/datafiles/Makefile
index 280175b17..a960f9d84 100644
--- a/testcases/kernel/security/integrity/ima/datafiles/Makefile
+++ b/testcases/kernel/security/integrity/ima/datafiles/Makefile
@@ -1,8 +1,6 @@
#
# testcases/kernel/security/integrity/ima/policy testcases Makefile.
#
-# Copyright (c) Linux Test Project, 2019-2020
-# Copyright (c) 2020 Microsoft Corporation
# Copyright (C) 2009, Cisco Systems Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -22,10 +20,12 @@
# Ngie Cooper, July 2009
#
-top_srcdir ?= ../../../../../..
+top_srcdir ?= ../../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-SUBDIRS := ima_kexec ima_keys ima_policy ima_selinux
+INSTALL_DIR := testcases/data/ima_policy
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
+INSTALL_TARGETS := measure*
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_kexec/Makefile b/testcases/kernel/security/integrity/ima/datafiles/ima_kexec/Makefile
deleted file mode 100644
index 5e0d632a7..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_kexec/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2020
-
-top_srcdir ?= ../../../../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_DIR := testcases/data/ima_kexec
-INSTALL_TARGETS := *.policy
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_kexec/kexec.policy b/testcases/kernel/security/integrity/ima/datafiles/ima_kexec/kexec.policy
deleted file mode 100644
index 58d66369e..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_kexec/kexec.policy
+++ /dev/null
@@ -1 +0,0 @@
-measure func=KEXEC_CMDLINE
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_keys/Makefile b/testcases/kernel/security/integrity/ima/datafiles/ima_keys/Makefile
deleted file mode 100644
index ac7ce33ab..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_keys/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2020
-
-top_srcdir ?= ../../../../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_DIR := testcases/data/ima_keys
-INSTALL_TARGETS := *.policy x509_ima.der
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_keys/keycheck.policy b/testcases/kernel/security/integrity/ima/datafiles/ima_keys/keycheck.policy
deleted file mode 100644
index 623162002..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_keys/keycheck.policy
+++ /dev/null
@@ -1 +0,0 @@
-measure func=KEY_CHECK keyrings=.ima|.evm|.builtin_trusted_keys|.blacklist|key_import_test template=ima-buf
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_keys/x509_ima.der b/testcases/kernel/security/integrity/ima/datafiles/ima_keys/x509_ima.der
deleted file mode 100644
index 92be058da..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_keys/x509_ima.der
+++ /dev/null
Binary files differ
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_policy/Makefile b/testcases/kernel/security/integrity/ima/datafiles/ima_policy/Makefile
deleted file mode 100644
index 953e21556..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_policy/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2020
-
-top_srcdir ?= ../../../../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_DIR := testcases/data/ima_policy
-INSTALL_TARGETS := *.policy-invalid *.policy
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_selinux/Makefile b/testcases/kernel/security/integrity/ima/datafiles/ima_selinux/Makefile
deleted file mode 100644
index 35088fdbc..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_selinux/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2021
-
-top_srcdir ?= ../../../../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_DIR := testcases/data/ima_selinux
-INSTALL_TARGETS := *.policy
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_selinux/selinux.policy b/testcases/kernel/security/integrity/ima/datafiles/ima_selinux/selinux.policy
deleted file mode 100644
index 7cbe9352d..000000000
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_selinux/selinux.policy
+++ /dev/null
@@ -1 +0,0 @@
-measure func=CRITICAL_DATA label=selinux
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy b/testcases/kernel/security/integrity/ima/datafiles/measure.policy
index 9976ddf2d..9976ddf2d 100644
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy
+++ b/testcases/kernel/security/integrity/ima/datafiles/measure.policy
diff --git a/testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy-invalid b/testcases/kernel/security/integrity/ima/datafiles/measure.policy-invalid
index 04dff89cf..04dff89cf 100644
--- a/testcases/kernel/security/integrity/ima/datafiles/ima_policy/measure.policy-invalid
+++ b/testcases/kernel/security/integrity/ima/datafiles/measure.policy-invalid
diff --git a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
index 04d106662..98893b99a 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
@@ -1,15 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2009
- * Copyright (c) 2016-2019 Petr Vorel <pvorel@suse.cz>
- *
- * Authors: Mimi Zohar <zohar@us.ibm.com>
- *
- * Calculate a SHA1 boot aggregate value based on the TPM 1.2
- * binary_bios_measurements.
- */
-
-#include "config.h"
+* Copyright (c) International Business Machines Corp., 2009
+*
+* Authors:
+* Mimi Zohar <zohar@us.ibm.com>
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation, version 2 of the
+* License.
+*
+* File: ima_boot_aggregate.c
+*
+* Calculate a SHA1 boot aggregate value based on the TPM
+* binary_bios_measurements.
+*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -19,8 +23,10 @@
#include <unistd.h>
#include <limits.h>
-#include "tst_test.h"
-#include "tst_safe_stdio.h"
+#include "config.h"
+#include "test.h"
+
+char *TCID = "ima_boot_aggregate";
#if HAVE_LIBCRYPTO
#include <openssl/sha.h>
@@ -30,24 +36,7 @@
#define MAX_EVENT_DATA_SIZE (MAX_EVENT_SIZE - EVENT_HEADER_SIZE)
#define NUM_PCRS 8 /* PCR registers 0-7 in boot aggregate */
-static char *debug;
-static char *file;
-
-static unsigned char boot_aggregate[SHA_DIGEST_LENGTH];
-
-static struct {
- struct {
- u_int32_t pcr;
- u_int32_t type;
- u_int8_t digest[SHA_DIGEST_LENGTH];
- u_int32_t len;
- } header __attribute__ ((packed));
- char *data;
-} event;
-
-static struct {
- unsigned char digest[SHA_DIGEST_LENGTH];
-} pcr[NUM_PCRS];
+int TST_TOTAL = 1;
static void display_sha1_digest(unsigned char *pcr)
{
@@ -58,24 +47,45 @@ static void display_sha1_digest(unsigned char *pcr)
printf("\n");
}
-static void do_test(void)
+int main(int argc, char *argv[])
{
+ unsigned char boot_aggregate[SHA_DIGEST_LENGTH];
+ struct {
+ struct {
+ u_int32_t pcr;
+ u_int32_t type;
+ u_int8_t digest[SHA_DIGEST_LENGTH];
+ u_int32_t len;
+ } header __attribute__ ((packed));
+ char *data;
+ } event;
+ struct {
+ unsigned char digest[SHA_DIGEST_LENGTH];
+ } pcr[NUM_PCRS];
FILE *fp;
- SHA_CTX c;
int i;
+ int debug = 0;
+ SHA_CTX c;
- if (!file)
- tst_brk(TBROK, "missing binary_bios_measurement file, specify with -f");
-
- fp = SAFE_FOPEN(file, "r");
+ if (argc != 2) {
+ printf("format: %s binary_bios_measurement file\n", argv[0]);
+ return 1;
+ }
+ fp = fopen(argv[1], "r");
+ if (!fp) {
+ perror("unable to open pcr file\n");
+ return 1;
+ }
/* Initialize psuedo PCR registers 0 - 7 */
for (i = 0; i < NUM_PCRS; i++)
memset(&pcr[i].digest, 0, SHA_DIGEST_LENGTH);
event.data = malloc(MAX_EVENT_DATA_SIZE);
- if (!event.data)
- tst_brk(TBROK, "cannot allocate memory");
+ if (!event.data) {
+ printf("Cannot allocate memory\n");
+ return 1;
+ }
/* Extend the pseudo PCRs with the event digest */
while (fread(&event, sizeof(event.header), 1, fp)) {
@@ -95,14 +105,13 @@ static void do_test(void)
#if MAX_EVENT_DATA_SIZE < USHRT_MAX
if (event.header.len > MAX_EVENT_DATA_SIZE) {
- tst_res(TWARN, "error event too long");
+ printf("Error event too long\n");
break;
}
#endif
fread(event.data, event.header.len, 1, fp);
}
-
- SAFE_FCLOSE(fp);
+ fclose(fp);
free(event.data);
/* Extend the boot aggregate with the pseudo PCR digest values */
@@ -117,23 +126,14 @@ static void do_test(void)
}
SHA1_Final(boot_aggregate, &c);
- printf("sha1:");
+ printf("boot_aggregate:");
display_sha1_digest(boot_aggregate);
- tst_res(TPASS, "found sha1 hash");
+ tst_exit();
}
-static struct tst_option options[] = {
- {"d", &debug, "-d enable debug"},
- {"f:", &file, "-f x binary_bios_measurement file (required)\n"},
- {NULL, NULL, NULL}
-};
-
-static struct tst_test test = {
- .needs_root = 1,
- .test_all = do_test,
- .options = options,
-};
-
#else
-TST_TEST_TCONF("libcrypto and openssl development packages required");
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "test requires libcrypto and openssl development packages");
+}
#endif
diff --git a/testcases/kernel/security/integrity/ima/src/ima_mmap.c b/testcases/kernel/security/integrity/ima/src/ima_mmap.c
index e5dafb525..0875aaeaf 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_mmap.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_mmap.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2010-2020
* Copyright (c) International Business Machines Corp., 2009
*
* Authors:
@@ -16,6 +15,12 @@ static char *filename;
static void *file;
static int fd;
+static struct tst_option options[] = {
+ {"f:", &filename,
+ "-f file File to mmap"},
+ {NULL, NULL, NULL}
+};
+
static void cleanup(void)
{
if (file)
@@ -28,7 +33,7 @@ static void cleanup(void)
static void run(void)
{
if (!filename)
- tst_brk(TBROK, "missing filename (-f filename)");
+ tst_brk(TBROK, "Usage: %s -f filename", TCID);
fd = SAFE_OPEN(filename, O_CREAT | O_RDWR, S_IRWXU);
@@ -42,10 +47,7 @@ static void run(void)
}
static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"f:", &filename, "-f file File to mmap"},
- {}
- },
+ .options = options,
.test_all = run,
.cleanup = cleanup,
};
diff --git a/testcases/kernel/security/integrity/ima/README.md b/testcases/kernel/security/integrity/ima/tests/README.md
index 5b261a191..16a1f48c3 100644
--- a/testcases/kernel/security/integrity/ima/README.md
+++ b/testcases/kernel/security/integrity/ima/tests/README.md
@@ -1,77 +1,29 @@
-# IMA + EVM testing
+IMA + EVM testing
+=================
-## IMA tests
+IMA tests
+---------
-Mandatory kernel configuration for IMA:
-```
-CONFIG_INTEGRITY=y
-CONFIG_IMA=y
-```
-
-### IMA measurement tests
`ima_measurements.sh` require builtin IMA tcb policy to be loaded
(`ima_policy=tcb` kernel parameter).
Although a custom policy, loaded via dracut, systemd or manually from user
space, may contain equivalent measurement tcb rules, detecting them would
require `IMA_READ_POLICY=y` therefore ignore this option.
-### IMA key test
-The measuring keys test (first test) in `ima_keys.sh` requires a readable IMA
-policy, as well as a loaded measure policy with `func=KEY_CHECK keyrings=...`.
-
-The certificate import test (second test) requires measure policy with
-`func=KEY_CHECK keyrings=key_import_test`.
-
-For example of valid policy for both tests on all supported kernels see `keycheck.policy`.
-
-If the IMA key tests are executed on kernel v5.6 through v5.10,
-`ima-buf` template should be specified in the IMA policy rule for
-key measurement, e.g.:
-```
-measure func=KEY_CHECK keyrings=key_import_test template=ima-buf
-```
-
-Executing on kernel v5.11 or later, `template=ima-buf` is optional in the IMA
-policy rule for key measurement, e.g.:
-```
-measure func=KEY_CHECK keyrings=key_import_test
-```
-
-As well as what's required for the IMA tests, key tests require reading the IMA
-policy allowed in the kernel configuration:
-```
-CONFIG_IMA_READ_POLICY=y
-```
-
-### IMA kexec test
-
-`ima_kexec.sh` requires loaded policy which contains `measure func=KEXEC_CMDLINE`,
-see example in `kexec.policy`.
-
-The test attempts to kexec the existing running kernel image.
-To kexec a different kernel image export `IMA_KEXEC_IMAGE=<pathname>`.
-
-### IMA SELinux test
-
-To enable IMA to measure SELinux state and policy, `ima_selinux.sh`
-requires a readable IMA policy, as well as a loaded measure policy with
-`measure func=CRITICAL_DATA label=selinux`,
-see example in `selinux.policy`.
-
-As well as what's required for the IMA tests, SELinux tests require SELinux enabled
-and reading the IMA policy allowed in the kernel configuration:
+Mandatory kernel configuration for IMA:
```
-CONFIG_SECURITY_SELINUX=y
-CONFIG_IMA_READ_POLICY=y
+CONFIG_INTEGRITY=y
+CONFIG_IMA=y
```
-## EVM tests
+EVM tests
+---------
`evm_overlay.sh` requires a builtin IMA appraise tcb policy (e.g. `ima_policy=appraise_tcb`
kernel parameter) which appraises the integrity of all files owned by root and EVM setup.
Again, for simplicity ignore possibility to load requires rules via custom policy.
-Mandatory kernel configuration for EVM tests:
+Mandatory kernel configuration for IMA & EVM:
```
CONFIG_INTEGRITY=y
CONFIG_INTEGRITY_SIGNATURE=y
@@ -83,7 +35,7 @@ CONFIG_TRUSTED_KEYS=y
CONFIG_ENCRYPTED_KEYS=y
```
-Example of preparing environment on for EVM on openSUSE:
+Example of installing IMA + EVM on openSUSE:
* Boot install system with `ima_policy=tcb|appraise_tcb ima_appraise=fix evm=fix` kernel parameters
(for IMA measurement, IMA appraisal and EVM protection)
diff --git a/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh b/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh
index 9d86778b6..ac209e430 100755
--- a/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh
+++ b/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh
@@ -19,7 +19,7 @@ setup()
[ -f "$EVM_FILE" ] || tst_brk TCONF "EVM not enabled in kernel"
[ $(cat $EVM_FILE) -eq 1 ] || tst_brk TCONF "EVM not enabled for this boot"
- require_ima_policy_cmdline "appraise_tcb"
+ check_ima_policy "appraise_tcb"
lower="$TST_MNTPOINT/lower"
upper="$TST_MNTPOINT/upper"
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh b/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh
deleted file mode 100755
index 30bbd066e..000000000
--- a/testcases/kernel/security/integrity/ima/tests/ima_kexec.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Microsoft Corporation
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-# Author: Lachlan Sneff <t-josne@linux.microsoft.com>
-#
-# Verify that kexec cmdline is measured correctly.
-# Test attempts to kexec the existing running kernel image.
-# To kexec a different kernel image export IMA_KEXEC_IMAGE=<pathname>.
-
-TST_NEEDS_CMDS="grep kexec sed"
-TST_CNT=3
-TST_NEEDS_DEVICE=1
-TST_SETUP="setup"
-
-. ima_setup.sh
-
-IMA_KEXEC_IMAGE="${IMA_KEXEC_IMAGE:-/boot/vmlinuz-$(uname -r)}"
-REQUIRED_POLICY='^measure.*func=KEXEC_CMDLINE'
-
-measure()
-{
- local cmdline="$1"
- local algorithm digest expected_digest found
-
- printf "$cmdline" > file1
- grep "kexec-cmdline" $ASCII_MEASUREMENTS > file2
-
- while read found
- do
- algorithm=$(echo "$found" | cut -d' ' -f4 | cut -d':' -f1)
- digest=$(echo "$found" | cut -d' ' -f4 | cut -d':' -f2)
-
- expected_digest=$(compute_digest $algorithm file1)
-
- if [ "$digest" = "$expected_digest" ]; then
- return 0
- fi
- done < file2
-
- return 1
-}
-
-setup()
-{
- tst_res TINFO "using kernel $IMA_KEXEC_IMAGE"
-
- if [ ! -f "$IMA_KEXEC_IMAGE" ]; then
- tst_brk TCONF "kernel image not found, specify path in \$IMA_KEXEC_IMAGE"
- fi
-
- if check_policy_readable; then
- require_ima_policy_content "$REQUIRED_POLICY"
- policy_readable=1
- fi
-}
-
-kexec_failure_hint()
-{
- local sb_enabled
-
- if tst_cmd_available bootctl; then
- if bootctl status 2>/dev/null | grep -qi 'Secure Boot: enabled'; then
- sb_enabled=1
- fi
- elif tst_cmd_available dmesg; then
- if dmesg | grep -qi 'Secure boot enabled'; then
- sb_enabled=1
- fi
- fi
- if [ "$sb_enabled" ]; then
- tst_res TWARN "secure boot is enabled, kernel image may not be signed"
- fi
-
- if check_ima_policy_content '^appraise.*func=KEXEC_KERNEL_CHECK'; then
- tst_res TWARN "'func=KEXEC_KERNEL_CHECK' appraise policy loaded, kernel image may not be signed"
- fi
-}
-
-kexec_test()
-{
- local param="$1"
- local cmdline="$2"
- local res=TFAIL
- local kexec_cmd
-
- kexec_cmd="$param=$cmdline"
- if [ "$param" = '--reuse-cmdline' ]; then
- cmdline="$(sed 's/BOOT_IMAGE=[^ ]* //' /proc/cmdline)"
- kexec_cmd="$param"
- fi
-
- kexec_cmd="kexec -s -l $IMA_KEXEC_IMAGE $kexec_cmd"
- tst_res TINFO "testing $kexec_cmd"
- if ! $kexec_cmd 2>err; then
- kexec_failure_hint
- tst_brk TBROK "kexec failed: $(cat err)"
- fi
-
- ROD kexec -su
- if ! measure "$cmdline"; then
- if [ "$policy_readable" != 1 ]; then
- tst_res TWARN "policy not readable, it might not contain required policy '$REQUIRED_POLICY'"
- res=TBROK
- fi
- tst_brk $res "unable to find a correct measurement"
- fi
- tst_res TPASS "kexec cmdline was measured correctly"
-}
-
-test()
-{
- case $1 in
- 1) kexec_test '--reuse-cmdline';;
- 2) kexec_test '--append' 'foo';;
- 3) kexec_test '--command-line' 'bar';;
- esac
-}
-
-tst_run
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_keys.sh b/testcases/kernel/security/integrity/ima/tests/ima_keys.sh
deleted file mode 100755
index 3476b8007..000000000
--- a/testcases/kernel/security/integrity/ima/tests/ima_keys.sh
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Microsoft Corporation
-# Copyright (c) 2020-2021 Petr Vorel <pvorel@suse.cz>
-# Author: Lachlan Sneff <t-josne@linux.microsoft.com>
-#
-# Verify that keys are measured correctly based on policy.
-
-TST_NEEDS_CMDS="cmp cut grep sed xxd"
-TST_CNT=2
-TST_NEEDS_DEVICE=1
-TST_SETUP=setup
-TST_CLEANUP=cleanup
-
-. ima_setup.sh
-
-FUNC_KEYCHECK='func=KEY_CHECK'
-REQUIRED_POLICY="^measure.*$FUNC_KEYCHECK"
-
-setup()
-{
- require_ima_policy_content "$REQUIRED_POLICY" '-E' > $TST_TMPDIR/policy.txt
- require_valid_policy_template
-}
-
-cleanup()
-{
- tst_is_num $KEYRING_ID && keyctl clear $KEYRING_ID
-}
-
-
-require_valid_policy_template()
-{
- while read line; do
- if echo $line | grep -q 'template=' && ! echo $line | grep -q 'template=ima-buf'; then
- tst_brk TCONF "only template=ima-buf can be specified for KEY_CHECK"
- fi
- done < $TST_TMPDIR/policy.txt
-}
-
-check_keys_policy()
-{
- local pattern="$1"
-
- if ! grep -E "$pattern" $TST_TMPDIR/policy.txt; then
- tst_res TCONF "IMA policy must specify $pattern, $FUNC_KEYCHECK"
- return 1
- fi
- return 0
-}
-
-# Based on https://lkml.org/lkml/2019/12/13/564.
-# (450d0fd51564 - "IMA: Call workqueue functions to measure queued keys")
-test1()
-{
- local keycheck_lines i keyrings templates
- local pattern='keyrings=[^[:space:]]+'
- local test_file="file.txt" tmp_file="file2.txt"
-
- tst_res TINFO "verify key measurement for keyrings and templates specified in IMA policy"
-
- check_keys_policy "$pattern" > $tmp_file || return
- keycheck_lines=$(cat $tmp_file)
- keyrings=$(for i in $keycheck_lines; do echo "$i" | grep "keyrings" | \
- sed "s/\./\\\./g" | cut -d'=' -f2; done | sed ':a;N;$!ba;s/\n/|/g')
- if [ -z "$keyrings" ]; then
- tst_res TCONF "IMA policy has a keyring key-value specifier, but no specified keyrings"
- return
- fi
-
- templates=$(for i in $keycheck_lines; do echo "$i" | grep "template" | \
- cut -d'=' -f2; done | sed ':a;N;$!ba;s/\n/|/g')
-
- tst_res TINFO "keyrings: '$keyrings'"
- tst_res TINFO "templates: '$templates'"
-
- grep -E "($templates).*($keyrings)" $ASCII_MEASUREMENTS | while read line
- do
- local digest expected_digest algorithm
-
- digest=$(echo "$line" | cut -d' ' -f4 | cut -d':' -f2)
- algorithm=$(echo "$line" | cut -d' ' -f4 | cut -d':' -f1)
- keyring=$(echo "$line" | cut -d' ' -f5)
-
- echo "$line" | cut -d' ' -f6 | xxd -r -p > $test_file
-
- if ! expected_digest="$(compute_digest $algorithm $test_file)"; then
- tst_res TCONF "cannot compute digest for $algorithm"
- return
- fi
-
- if [ "$digest" != "$expected_digest" ]; then
- tst_res TFAIL "incorrect digest was found for $keyring keyring"
- return
- fi
- done
-
- tst_res TPASS "specified keyrings were measured correctly"
-}
-
-# Create a new keyring, import a certificate into it, and verify
-# that the certificate is measured correctly by IMA.
-test2()
-{
- tst_require_cmds keyctl openssl
-
- require_evmctl "1.3.2"
-
- local cert_file="$TST_DATAROOT/x509_ima.der"
- local keyring_name="key_import_test"
- local pattern="keyrings=[^[:space:]]*$keyring_name"
- local temp_file="file.txt"
-
- tst_res TINFO "verify measurement of certificate imported into a keyring"
-
- check_keys_policy "$pattern" >/dev/null || return
-
- KEYRING_ID=$(keyctl newring $keyring_name @s) || \
- tst_brk TBROK "unable to create a new keyring"
-
- if ! tst_is_num $KEYRING_ID; then
- tst_brk TBROK "unable to parse the new keyring id ('$KEYRING_ID')"
- fi
-
- evmctl import $cert_file $KEYRING_ID > /dev/null || \
- tst_brk TBROK "unable to import a certificate into $keyring_name keyring"
-
- grep $keyring_name $ASCII_MEASUREMENTS | tail -n1 | cut -d' ' -f6 | \
- xxd -r -p > $temp_file
-
- if [ ! -s $temp_file ]; then
- tst_res TFAIL "keyring $keyring_name not found in $ASCII_MEASUREMENTS"
- return
- fi
-
- if ! openssl x509 -in $temp_file -inform der > /dev/null; then
- tst_res TFAIL "logged certificate is not a valid x509 certificate"
- return
- fi
-
- if cmp -s $temp_file $cert_file; then
- tst_res TPASS "logged certificate matches the original"
- else
- tst_res TFAIL "logged certificate does not match original"
- fi
-}
-
-tst_run
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
index 1927e937c..714d69948 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
@@ -1,12 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018-2019 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
#
# Verify that measurements are added to the measurement list based on policy.
-TST_NEEDS_CMDS="awk cut sed"
+TST_NEEDS_CMDS="awk cut"
TST_SETUP="setup"
TST_CNT=3
TST_NEEDS_DEVICE=1
@@ -15,27 +15,111 @@ TST_NEEDS_DEVICE=1
setup()
{
- require_ima_policy_cmdline "tcb"
+ check_ima_policy "tcb"
TEST_FILE="$PWD/test.txt"
POLICY="$IMA_DIR/policy"
[ -f "$POLICY" ] || tst_res TINFO "not using default policy"
+ DIGEST_INDEX=
+
+ local template="$(tail -1 $ASCII_MEASUREMENTS | cut -d' ' -f 3)"
+ local i
+
+ # parse digest index
+ # https://www.kernel.org/doc/html/latest/security/IMA-templates.html#use
+ case "$template" in
+ ima|ima-ng|ima-sig) DIGEST_INDEX=4 ;;
+ *)
+ # using ima_template_fmt kernel parameter
+ local IFS="|"
+ i=4
+ for word in $template; do
+ if [ "$word" = 'd' -o "$word" = 'd-ng' ]; then
+ DIGEST_INDEX=$i
+ break
+ fi
+ i=$((i+1))
+ done
+ esac
+
+ [ -z "$DIGEST_INDEX" ] && tst_brk TCONF \
+ "Cannot find digest index (template: '$template')"
+}
+
+# TODO: find support for rmd128 rmd256 rmd320 wp256 wp384 tgr128 tgr160
+compute_digest()
+{
+ local algorithm="$1"
+ local file="$2"
+ local digest
+
+ digest="$(${algorithm}sum $file 2>/dev/null | cut -f1 -d ' ')"
+ if [ -n "$digest" ]; then
+ echo "$digest"
+ return 0
+ fi
+
+ digest="$(openssl $algorithm $file 2>/dev/null | cut -f2 -d ' ')"
+ if [ -n "$digest" ]; then
+ echo "$digest"
+ return 0
+ fi
+
+ # uncommon ciphers
+ local arg="$algorithm"
+ case "$algorithm" in
+ tgr192) arg="tiger" ;;
+ wp512) arg="whirlpool" ;;
+ esac
+
+ digest="$(rdigest --$arg $file 2>/dev/null | cut -f1 -d ' ')"
+ if [ -n "$digest" ]; then
+ echo "$digest"
+ return 0
+ fi
+ return 1
}
ima_check()
{
- local algorithm digest expected_digest line tmp
+ local delimiter=':'
+ local algorithm digest expected_digest line
# need to read file to get updated $ASCII_MEASUREMENTS
cat $TEST_FILE > /dev/null
line="$(grep $TEST_FILE $ASCII_MEASUREMENTS | tail -1)"
+ if [ -z "$line" ]; then
+ tst_res TFAIL "cannot find measurement record for '$TEST_FILE'"
+ return
+ fi
+ tst_res TINFO "measurement record: '$line'"
+
+ digest=$(echo "$line" | cut -d' ' -f $DIGEST_INDEX)
+ if [ -z "$digest" ]; then
+ tst_res TFAIL "cannot find digest (index: $DIGEST_INDEX)"
+ return
+ fi
- if tmp=$(get_algorithm_digest "$line"); then
- algorithm=$(echo "$tmp" | cut -d'|' -f1)
- digest=$(echo "$tmp" | cut -d'|' -f2)
+ if [ "${digest#*$delimiter}" != "$digest" ]; then
+ algorithm=$(echo "$digest" | cut -d $delimiter -f 1)
+ digest=$(echo "$digest" | cut -d $delimiter -f 2)
else
- tst_res TBROK "failed to get algorithm/digest for '$TEST_FILE': $tmp"
+ case "${#digest}" in
+ 32) algorithm="md5" ;;
+ 40) algorithm="sha1" ;;
+ *)
+ tst_res TFAIL "algorithm must be either md5 or sha1 (digest: '$digest')"
+ return ;;
+ esac
+ fi
+ if [ -z "$algorithm" ]; then
+ tst_res TFAIL "cannot find algorithm"
+ return
+ fi
+ if [ -z "$digest" ]; then
+ tst_res TFAIL "cannot find digest"
+ return
fi
tst_res TINFO "computing digest for $algorithm algorithm"
@@ -104,7 +188,7 @@ test3()
# Default policy does not measure user files
tst_res TINFO "verify not measuring user files"
- tst_check_cmds sudo || return
+ tst_check_cmds sudo
if ! id $user >/dev/null 2>/dev/null; then
tst_res TCONF "missing system user $user (wrong installation)"
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_policy.sh b/testcases/kernel/security/integrity/ima/tests/ima_policy.sh
index 244cf081d..c115a5aae 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_policy.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_policy.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
#
# Test replacing the default integrity measurement policy.
@@ -23,6 +23,7 @@ check_policy_writable()
setup()
{
+ IMA_POLICY="$IMA_DIR/policy"
check_policy_writable
VALID_POLICY="$TST_DATAROOT/measure.policy"
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh b/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
deleted file mode 100755
index c2af0e298..000000000
--- a/testcases/kernel/security/integrity/ima/tests/ima_selinux.sh
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2021 Microsoft Corporation
-# Author: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
-#
-# Verify measurement of SELinux policy hash and state.
-#
-# Relevant kernel commits:
-# * fdd1ffe8a812 ("selinux: include a consumer of the new IMA critical data hook")
-# * 2554a48f4437 ("selinux: measure state and policy capabilities")
-
-TST_NEEDS_CMDS="awk cut grep tail"
-TST_CNT=2
-TST_NEEDS_DEVICE=1
-TST_SETUP="setup"
-
-. ima_setup.sh
-
-FUNC_CRITICAL_DATA='func=CRITICAL_DATA'
-REQUIRED_POLICY="^measure.*$FUNC_CRITICAL_DATA"
-
-setup()
-{
- SELINUX_DIR=$(tst_get_selinux_dir)
- [ "$SELINUX_DIR" ] || tst_brk TCONF "SELinux is not enabled"
-
- require_ima_policy_content "$REQUIRED_POLICY" '-E' > $TST_TMPDIR/policy.txt
-}
-
-# Format of the measured SELinux state data.
-#
-# initialized=1;enforcing=0;checkreqprot=1;
-# network_peer_controls=1;open_perms=1;extended_socket_class=1;
-# always_check_network=0;cgroup_seclabel=1;nnp_nosuid_transition=1;
-# genfs_seclabel_symlinks=0;
-validate_policy_capabilities()
-{
- local measured_cap measured_value expected_value
- local inx=7
-
- # Policy capabilities flags start from "network_peer_controls"
- # in the measured SELinux state at offset 7 for 'awk'
- while [ $inx -lt 20 ]; do
- measured_cap=$(echo $1 | awk -F'[=;]' -v inx="$inx" '{print $inx}')
- inx=$(($inx + 1))
-
- measured_value=$(echo $1 | awk -F'[=;]' -v inx="$inx" '{print $inx}')
- expected_value=$(cat "$SELINUX_DIR/policy_capabilities/$measured_cap")
- if [ "$measured_value" != "$expected_value" ]; then
- tst_res TFAIL "$measured_cap: expected: $expected_value, got: $digest"
- return
- fi
-
- inx=$(($inx + 1))
- done
-
- tst_res TPASS "SELinux state measured correctly"
-}
-
-# Trigger measurement of SELinux constructs and verify that
-# the measured SELinux policy hash matches the hash of the policy
-# loaded in kernel memory for SELinux.
-test1()
-{
- local policy_digest expected_policy_digest algorithm
- local data_source_name="selinux"
- local pattern="data_sources=[^[:space:]]*$data_source_name"
- local tmp_file="$TST_TMPDIR/selinux_policy_tmp_file.txt"
-
- tst_res TINFO "verifying SELinux policy hash measurement"
-
- # Trigger a measurement by changing SELinux state
- tst_update_selinux_state
-
- # Verify SELinux policy hash is measured and then validate that
- # the measured policy hash matches the hash of the policy currently
- # in kernel memory for SELinux
- line=$(grep -E "selinux-policy-hash" $ASCII_MEASUREMENTS | tail -1)
- if [ -z "$line" ]; then
- tst_res TFAIL "SELinux policy hash not measured"
- return
- fi
-
- algorithm=$(echo "$line" | cut -d' ' -f4 | cut -d':' -f1)
- policy_digest=$(echo "$line" | cut -d' ' -f6)
-
- expected_policy_digest="$(compute_digest $algorithm $SELINUX_DIR/policy)" || \
- tst_brk TCONF "cannot compute digest for $algorithm"
-
- if [ "$policy_digest" != "$expected_policy_digest" ]; then
- tst_res TFAIL "Digest mismatch: expected: $expected_policy_digest, got: $policy_digest"
- return
- fi
-
- tst_res TPASS "SELinux policy hash measured correctly"
-}
-
-# Trigger measurement of SELinux constructs and verify that
-# the measured SELinux state matches the current SELinux
-# configuration.
-test2()
-{
- tst_check_cmds xxd || return
-
- local measured_data state_file="$TST_TMPDIR/selinux_state.txt"
- local data_source_name="selinux"
- local pattern="data_sources=[^[:space:]]*$data_source_name"
- local tmp_file="$TST_TMPDIR/selinux_state_tmp_file.txt"
- local digest expected_digest algorithm
- local initialized_value
- local enforced_value expected_enforced_value
- local checkreqprot_value expected_checkreqprot_value
-
- tst_res TINFO "verifying SELinux state measurement"
-
- # Trigger a measurement by changing SELinux state
- tst_update_selinux_state
-
- # Verify SELinux state is measured and then validate the measured
- # state matches that currently set for SELinux
- line=$(grep -E "selinux-state" $ASCII_MEASUREMENTS | tail -1)
- if [ -z "$line" ]; then
- tst_res TFAIL "SELinux state not measured"
- return
- fi
-
- digest=$(echo "$line" | cut -d' ' -f4 | cut -d':' -f2)
- algorithm=$(echo "$line" | cut -d' ' -f4 | cut -d':' -f1)
-
- echo "$line" | cut -d' ' -f6 | xxd -r -p > $state_file
-
- expected_digest="$(compute_digest $algorithm $state_file)" || \
- tst_brk TCONF "cannot compute digest for $algorithm"
-
- if [ "$digest" != "$expected_digest" ]; then
- tst_res TFAIL "digest mismatch: expected: $expected_digest, got: $digest"
- return
- fi
-
- # SELinux state is measured as the following string
- # initialized=1;enforcing=0;checkreqprot=1;
- # Value of 0 indicates the state is ON, and 1 indicates OFF
- #
- # enforce and checkreqprot measurement can be verified by
- # comparing the value of the file "enforce" and "checkreqprot"
- # respectively in the SELinux directory.
- # "initialized" is an internal state and should be set to 1
- # if enforce and checkreqprot are measured correctly.
- measured_data=$(cat $state_file)
- enforced_value=$(echo $measured_data | awk -F'[=;]' '{print $4}')
- expected_enforced_value=$(cat $SELINUX_DIR/enforce)
- if [ "$expected_enforced_value" != "$enforced_value" ]; then
- tst_res TFAIL "enforce: expected: $expected_enforced_value, got: $enforced_value"
- return
- fi
-
- checkreqprot_value=$(echo $measured_data | awk -F'[=;]' '{print $6}')
- expected_checkreqprot_value=$(cat $SELINUX_DIR/checkreqprot)
- if [ "$expected_checkreqprot_value" != "$checkreqprot_value" ]; then
- tst_res TFAIL "checkreqprot: expected: $expected_checkreqprot_value, got: $checkreqprot_value"
- return
- fi
-
- initialized_value=$(echo $measured_data | awk -F'[=;]' '{print $2}')
- if [ "$initialized_value" != "1" ]; then
- tst_res TFAIL "initialized: expected 1, got: $initialized_value"
- return
- fi
-
- validate_policy_capabilities $measured_data
-}
-
-tst_run
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
index 565f0bc3e..422ec0b47 100644
--- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018-2019 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
TST_TESTFUNC="test"
@@ -11,89 +11,13 @@ TST_CLEANUP_CALLER="$TST_CLEANUP"
TST_CLEANUP="ima_cleanup"
TST_NEEDS_ROOT=1
-# TST_NEEDS_DEVICE can be unset, therefore specify explicitly
-TST_NEEDS_TMPDIR=1
-
. tst_test.sh
SYSFS="/sys"
UMOUNT=
TST_FS_TYPE="ext3"
-# TODO: find support for rmd128 rmd256 rmd320 wp256 wp384 tgr128 tgr160
-compute_digest()
-{
- local algorithm="$1"
- local file="$2"
- local digest
-
- digest="$(${algorithm}sum $file 2>/dev/null | cut -f1 -d ' ')"
- if [ -n "$digest" ]; then
- echo "$digest"
- return 0
- fi
-
- digest="$(openssl $algorithm $file 2>/dev/null | cut -f2 -d ' ')"
- if [ -n "$digest" ]; then
- echo "$digest"
- return 0
- fi
-
- # uncommon ciphers
- local arg="$algorithm"
- case "$algorithm" in
- tgr192) arg="tiger" ;;
- wp512) arg="whirlpool" ;;
- esac
-
- digest="$(rdigest --$arg $file 2>/dev/null | cut -f1 -d ' ')"
- if [ -n "$digest" ]; then
- echo "$digest"
- return 0
- fi
- return 1
-}
-
-check_policy_readable()
-{
- if [ ! -f $IMA_POLICY ]; then
- tst_res TINFO "missing $IMA_POLICY (reboot or CONFIG_IMA_WRITE_POLICY=y required)"
- return 1
- fi
- cat $IMA_POLICY > /dev/null 2>/dev/null
-}
-
-require_policy_readable()
-{
- if [ ! -f $IMA_POLICY ]; then
- tst_brk TCONF "missing $IMA_POLICY (reboot or CONFIG_IMA_WRITE_POLICY=y required)"
- fi
- if ! check_policy_readable; then
- tst_brk TCONF "cannot read IMA policy (CONFIG_IMA_READ_POLICY=y required)"
- fi
-}
-
-check_ima_policy_content()
-{
- local pattern="$1"
- local grep_params="${2--q}"
-
- check_policy_readable || return 1
- grep $grep_params "$pattern" $IMA_POLICY
-}
-
-require_ima_policy_content()
-{
- local pattern="$1"
- local grep_params="${2--q}"
-
- require_policy_readable
- if ! grep $grep_params "$pattern" $IMA_POLICY; then
- tst_brk TCONF "IMA policy does not specify '$pattern'"
- fi
-}
-
-check_ima_policy_cmdline()
+check_ima_policy()
{
local policy="$1"
local i
@@ -101,18 +25,10 @@ check_ima_policy_cmdline()
grep -q "ima_$policy" /proc/cmdline && return
for i in $(cat /proc/cmdline); do
if echo "$i" | grep -q '^ima_policy='; then
- echo "$i" | grep -q -e "|[ ]*$policy" -e "$policy[ ]*|" -e "=$policy" && return 0
+ echo "$i" | grep -q -e "|[ ]*$policy" -e "$policy[ ]*|" -e "=$policy" && return
fi
done
- return 1
-}
-
-require_ima_policy_cmdline()
-{
- local policy="$1"
-
- check_ima_policy_cmdline $policy || \
- tst_brk TCONF "IMA measurement tests require builtin IMA $policy policy (e.g. ima_policy=$policy kernel parameter)"
+ tst_brk TCONF "IMA measurement tests require builtin IMA $policy policy (e.g. ima_policy=$policy kernel parameter)"
}
mount_helper()
@@ -145,7 +61,7 @@ mount_loop_device()
print_ima_config()
{
- local config="${KCONFIG_PATH:-/boot/config-$(uname -r)}"
+ local config="/boot/config-$(uname -r)"
local i
if [ -r "$config" ]; then
@@ -166,12 +82,6 @@ ima_setup()
[ -d "$IMA_DIR" ] || tst_brk TCONF "IMA not enabled in kernel"
ASCII_MEASUREMENTS="$IMA_DIR/ascii_runtime_measurements"
BINARY_MEASUREMENTS="$IMA_DIR/binary_runtime_measurements"
- IMA_POLICY="$IMA_DIR/policy"
-
- # hack to support running tests locally from ima/tests directory
- if [ ! -d "$TST_DATAROOT" ]; then
- TST_DATAROOT="$LTPROOT/../datafiles/$TST_ID/"
- fi
print_ima_config
@@ -199,119 +109,6 @@ ima_cleanup()
fi
}
-set_digest_index()
-{
- DIGEST_INDEX=
-
- local template="$(tail -1 $ASCII_MEASUREMENTS | cut -d' ' -f 3)"
- local i word
-
- # parse digest index
- # https://www.kernel.org/doc/html/latest/security/IMA-templates.html#use
- case "$template" in
- ima|ima-ng|ima-sig) DIGEST_INDEX=4 ;;
- *)
- # using ima_template_fmt kernel parameter
- local IFS="|"
- i=4
- for word in $template; do
- if [ "$word" = 'd' -o "$word" = 'd-ng' ]; then
- DIGEST_INDEX=$i
- break
- fi
- i=$((i+1))
- done
- esac
-
- [ -z "$DIGEST_INDEX" ] && tst_brk TCONF \
- "Cannot find digest index (template: '$template')"
-}
-
-get_algorithm_digest()
-{
- local line="$1"
- local delimiter=':'
- local algorithm digest
-
- if [ -z "$line" ]; then
- echo "measurement record not found"
- return 1
- fi
-
- [ -z "$DIGEST_INDEX" ] && set_digest_index
- digest=$(echo "$line" | cut -d' ' -f $DIGEST_INDEX)
- if [ -z "$digest" ]; then
- echo "digest not found (index: $DIGEST_INDEX, line: '$line')"
- return 1
- fi
-
- if [ "${digest#*$delimiter}" != "$digest" ]; then
- algorithm=$(echo "$digest" | cut -d $delimiter -f 1)
- digest=$(echo "$digest" | cut -d $delimiter -f 2)
- else
- case "${#digest}" in
- 32) algorithm="md5" ;;
- 40) algorithm="sha1" ;;
- *)
- echo "algorithm must be either md5 or sha1 (digest: '$digest')"
- return 1 ;;
- esac
- fi
- if [ -z "$algorithm" ]; then
- echo "algorithm not found"
- return 1
- fi
- if [ -z "$digest" ]; then
- echo "digest not found"
- return 1
- fi
-
- echo "$algorithm|$digest"
-}
-
-# check_evmctl REQUIRED_TPM_VERSION
-# return: 0: evmctl is new enough, 1: version older than required (or version < v0.9)
-check_evmctl()
-{
- local required="$1"
-
- local r1="$(echo $required | cut -d. -f1)"
- local r2="$(echo $required | cut -d. -f2)"
- local r3="$(echo $required | cut -d. -f3)"
- [ -z "$r3" ] && r3=0
-
- tst_is_int "$r1" || tst_brk TBROK "required major version not int ($v1)"
- tst_is_int "$r2" || tst_brk TBROK "required minor version not int ($v2)"
- tst_is_int "$r3" || tst_brk TBROK "required patch version not int ($v3)"
-
- tst_check_cmds evmctl || return 1
-
- local v="$(evmctl --version | cut -d' ' -f2)"
- [ -z "$v" ] && return 1
- tst_res TINFO "evmctl version: $v"
-
- local v1="$(echo $v | cut -d. -f1)"
- local v2="$(echo $v | cut -d. -f2)"
- local v3="$(echo $v | cut -d. -f3)"
- [ -z "$v3" ] && v3=0
-
- if [ $v1 -lt $r1 ] || [ $v1 -eq $r1 -a $v2 -lt $r2 ] || \
- [ $v1 -eq $r1 -a $v2 -eq $r2 -a $v3 -lt $r3 ]; then
- return 1
- fi
- return 0
-}
-
-# require_evmctl REQUIRED_TPM_VERSION
-require_evmctl()
-{
- local required="$1"
-
- if ! check_evmctl $required; then
- tst_brk TCONF "evmctl >= $required required"
- fi
-}
-
# loop device is needed to use only for tmpfs
TMPDIR="${TMPDIR:-/tmp}"
if [ "$(df -T $TMPDIR | tail -1 | awk '{print $2}')" != "tmpfs" -a -n "$TST_NEEDS_DEVICE" ]; then
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh b/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
index 71083efd8..b378ec378 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
@@ -1,290 +1,98 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
#
# Verify the boot and PCR aggregates.
TST_CNT=2
-TST_NEEDS_CMDS="awk cut tail"
-TST_SETUP="setup"
+TST_NEEDS_CMDS="awk cut ima_boot_aggregate"
. ima_setup.sh
-EVMCTL_REQUIRED='1.3.1'
-ERRMSG_EVMCTL="=> install evmctl >= $EVMCTL_REQUIRED"
-ERRMSG_TPM="TPM hardware support not enabled in kernel or no TPM chip found"
-
-setup()
-{
- local config="${KCONFIG_PATH:-/boot/config-$(uname -r)}"
- local line tmp
-
- read line < $ASCII_MEASUREMENTS
- if tmp=$(get_algorithm_digest "$line"); then
- ALGORITHM=$(echo "$tmp" | cut -d'|' -f1)
- DIGEST=$(echo "$tmp" | cut -d'|' -f2)
- else
- tst_brk TBROK "failed to get algorithm/digest: $tmp"
- fi
- tst_res TINFO "used algorithm: $ALGORITHM"
-
- TPM_VERSION="$(get_tpm_version)"
- if [ -z "$TPM_VERSION" ]; then
- tst_res TINFO "$ERRMSG_TPM, testing TPM-bypass"
- else
- tst_res TINFO "TPM major version: $TPM_VERSION"
- fi
-
- if ! check_evmctl $EVMCTL_REQUIRED; then
- if [ "$ALGORITHM" != "sha1" ]; then
- tst_brk TCONF "algorithm not sha1 ($ALGORITHM) $ERRMSG_EVMCTL"
- fi
- MISSING_EVMCTL=1
- fi
-
- if [ -r "$config" ]; then
- tst_res TINFO "TPM kernel config:"
- for i in $(grep -e ^CONFIG_.*_TPM -e ^CONFIG_TCG $config); do
- tst_res TINFO "$i"
- done
- fi
-}
-
-# prints major version: 1: TPM 1.2, 2: TPM 2.0
-# or nothing on TPM-bypass (no TPM device)
-# WARNING: Detecting TPM 2.0 can fail due kernel not exporting TPM 2.0 files.
-get_tpm_version()
+test1()
{
- if [ -f /sys/class/tpm/tpm0/tpm_version_major ]; then
- cat /sys/class/tpm/tpm0/tpm_version_major
- return
- fi
+ tst_res TINFO "verify boot aggregate"
- if [ -f /sys/class/tpm/tpm0/device/caps -o \
- -f /sys/class/misc/tpm0/device/caps ]; then
- echo 1
- return
- fi
+ local zero="0000000000000000000000000000000000000000"
+ local tpm_bios="$SECURITYFS/tpm0/binary_bios_measurements"
+ local ima_measurements="$ASCII_MEASUREMENTS"
+ local boot_aggregate boot_hash line
- if [ -c /dev/tpmrm0 -a -c /dev/tpm0 ]; then
- echo 2
- return
- fi
+ # IMA boot aggregate
+ read line < $ima_measurements
+ boot_hash=$(echo $line | awk '{print $(NF-1)}' | cut -d':' -f2)
- if [ ! -d /sys/class/tpm/tpm0/ -a ! -d /sys/class/misc/tpm0/ ]; then
- return
- fi
+ if [ ! -f "$tpm_bios" ]; then
+ tst_res TINFO "TPM Hardware Support not enabled in kernel or no TPM chip found"
- tst_require_cmds dmesg
- if dmesg | grep -q 'activating TPM-bypass'; then
- return
- elif dmesg | grep -q '1\.2 TPM (device-id'; then
- echo 1
- return
- elif dmesg | grep -q '2\.0 TPM (device-id'; then
- echo 2
- return
+ if [ "${boot_hash}" = "${zero}" ]; then
+ tst_res TPASS "bios boot aggregate is 0"
+ else
+ tst_res TFAIL "bios boot aggregate is not 0"
+ fi
+ else
+ boot_aggregate=$(ima_boot_aggregate $tpm_bios | grep "boot_aggregate:" | cut -d':' -f2)
+ if [ "${boot_hash}" = "${boot_aggregate}" ]; then
+ tst_res TPASS "bios aggregate matches IMA boot aggregate"
+ else
+ tst_res TFAIL "bios aggregate does not match IMA boot aggregate"
+ fi
fi
}
-read_pcr_tpm1()
+# Probably cleaner to programmatically read the PCR values directly
+# from the TPM, but that would require a TPM library. For now, use
+# the PCR values from /sys/devices.
+validate_pcr()
{
- local pcrs_path="/sys/class/tpm/tpm0/device/pcrs"
- local evmctl_required="1.1"
- local hash pcr
+ tst_res TINFO "verify PCR (Process Control Register)"
- if [ ! -f "$pcrs_path" ]; then
- pcrs_path="/sys/class/misc/tpm0/device/pcrs"
- elif ! check_evmctl $evmctl_required; then
- echo "evmctl >= $evmctl_required required"
- return 32
- fi
+ local dev_pcrs="$1"
+ local pcr hash aggregate_pcr
- if [ ! -f "$pcrs_path" ]; then
- echo "missing PCR file $pcrs_path ($ERRMSG_TPM)"
- return 32
+ aggregate_pcr="$(evmctl -v ima_measurement $BINARY_MEASUREMENTS 2>&1 | \
+ grep 'HW PCR-10:' | awk '{print $3}')"
+ if [ -z "$aggregate_pcr" ]; then
+ tst_res TFAIL "failed to get PCR-10"
+ return 1
fi
while read line; do
pcr="$(echo $line | cut -d':' -f1)"
- hash="$(echo $line | cut -d':' -f2 | awk '{ gsub (" ", "", $0); print tolower($0) }')"
- echo "$pcr: $hash"
- done < $pcrs_path
-
- return 0
-}
-
-# NOTE: TPM 1.2 would require to use tss1pcrread which is not fully adopted
-# by distros yet.
-read_pcr_tpm2()
-{
- local pcrmax=23
- local pcrread="tsspcrread -halg $ALGORITHM"
- local i pcr
-
- if ! tst_cmd_available tsspcrread; then
- echo "tsspcrread not found"
- return 32
- fi
-
- for i in $(seq 0 $pcrmax); do
- pcr=$($pcrread -ha "$i" -ns)
- if [ $? -ne 0 ]; then
- echo "tsspcrread failed: $pcr"
- return 1
+ if [ "${pcr}" = "PCR-10" ]; then
+ hash="$(echo $line | cut -d':' -f2 | awk '{ gsub (" ", "", $0); print tolower($0) }')"
+ [ "${hash}" = "${aggregate_pcr}" ]
+ return $?
fi
- printf "PCR-%02d: %s\n" $i "$pcr"
- done
-
- return 0
-}
-
-get_pcr10_aggregate()
-{
- local cmd="evmctl -vv ima_measurement $BINARY_MEASUREMENTS"
- local msg="$ERRMSG_EVMCTL"
- local res=TCONF
- local pcr ret
-
- if [ -z "$MISSING_EVMCTL" ]; then
- msg=
- res=TFAIL
- fi
-
- $cmd > hash.txt 2>&1
- ret=$?
- if [ $ret -ne 0 -a -z "$MISSING_EVMCTL" ]; then
- tst_res TFAIL "evmctl failed, trying with --ignore-violations"
- cmd="$cmd --ignore-violations"
- $cmd > hash.txt 2>&1
- ret=$?
- elif [ $ret -ne 0 -a "$MISSING_EVMCTL" = 1 ]; then
- tst_brk TFAIL "evmctl failed $msg"
- fi
-
- [ $ret -ne 0 ] && tst_res TWARN "evmctl failed, trying to continue $msg"
-
- pcr=$(grep -E "^($ALGORITHM: )*PCRAgg(.*10)*:" hash.txt | tail -1 \
- | awk '{print $NF}')
-
- if [ -z "$pcr" ]; then
- tst_res $res "failed to find aggregate PCR-10 $msg"
- tst_res TINFO "hash file:"
- cat hash.txt >&2
- return
- fi
-
- echo "$pcr"
-}
-
-test1_tpm_bypass_mode()
-{
- local zero=$(echo $DIGEST | awk '{gsub(/./, "0")}; {print}')
-
- if [ "$DIGEST" = "$zero" ]; then
- tst_res TPASS "bios boot aggregate is $zero"
- else
- tst_res TFAIL "bios boot aggregate is not $zero ($DIGEST), kernel didn't export TPM 2.0 files for TPM device?"
- return 1
- fi
-}
-
-test1_hw_tpm()
-{
- local tpm_bios="$SECURITYFS/tpm0/binary_bios_measurements"
- local cmd="evmctl ima_boot_aggregate -v"
- local boot_aggregate
-
- if [ -z "$TPM_VERSION" ]; then
- tst_res TWARN "TPM-bypass failed, trying to test TPM device (unknown TPM version)"
- MAYBE_TPM2=1
- fi
-
- if [ "$MISSING_EVMCTL" = 1 ]; then
- if [ ! -f "$tpm_bios" ]; then
- tst_res TCONF "missing $tpm_bios $ERRMSG_EVMCTL"
- return
- fi
- tst_check_cmds ima_boot_aggregate || return
- cmd="ima_boot_aggregate -f $tpm_bios"
- fi
- tst_res TINFO "using command: $cmd"
-
- boot_aggregate=$($cmd | grep "$ALGORITHM:" | cut -d':' -f2)
- if [ -z "$boot_aggregate" ]; then
- tst_res TFAIL "failed to get boot aggregate"
- return
- fi
- tst_res TINFO "IMA boot aggregate: '$boot_aggregate'"
-
- if [ "$DIGEST" = "$boot_aggregate" ]; then
- tst_res TPASS "bios boot aggregate matches IMA boot aggregate"
- else
- tst_res TFAIL "bios boot aggregate does not match IMA boot aggregate ($DIGEST)"
- fi
-}
-
-test1()
-{
- tst_res TINFO "verify boot aggregate"
-
- # deliberately try test1_hw_tpm() if test1_tpm_bypass_mode() fails
- [ -z "$TPM_VERSION" ] && test1_tpm_bypass_mode || test1_hw_tpm
+ done < $dev_pcrs
+ return 1
}
test2()
{
- local hash pcr_aggregate out ret
-
tst_res TINFO "verify PCR values"
+ tst_check_cmds evmctl
- if [ "$MAYBE_TPM2" = 1 ]; then
- tst_res TINFO "TPM version not detected ($ERRMSG_TPM), assume TPM 2"
- TPM_VERSION=2
- fi
-
- if [ -z "$TPM_VERSION" ]; then
- tst_brk TCONF "TPM version not detected ($ERRMSG_TPM)"
- fi
-
- if [ "$ALGORITHM" = "sha1" -a "$MISSING_EVMCTL" = 1 ]; then
- tst_check_cmds evmctl || return 1
- fi
+ tst_res TINFO "evmctl version: $(evmctl --version)"
- out=$(read_pcr_tpm$TPM_VERSION)
- ret=$?
-
- if [ $ret -ne 0 ]; then
- case "$ret" in
- 1) tst_res TFAIL "$out";;
- 32) tst_res TCONF "$out";;
- *) tst_brk TBROK "unsupported return type '$1'";;
- esac
- return
- fi
-
- hash=$(echo "$out" | grep "^PCR-10" | cut -d' ' -f2)
-
- if [ -z "$out" ]; then
- tst_res TFAIL "PCR-10 hash not found"
- return
- fi
-
- tst_res TINFO "real PCR-10: '$hash'"
-
- get_pcr10_aggregate > tmp.txt
- pcr_aggregate="$(cat tmp.txt)"
- if [ -z "$pcr_aggregate" ]; then
- return
+ local pcrs_path="/sys/class/tpm/tpm0/device/pcrs"
+ if [ -f "$pcrs_path" ]; then
+ tst_res TINFO "new PCRS path, evmctl >= 1.1 required"
+ else
+ pcrs_path="/sys/class/misc/tpm0/device/pcrs"
fi
- tst_res TINFO "aggregate PCR-10: '$pcr_aggregate'"
- if [ "$hash" = "$pcr_aggregate" ]; then
- tst_res TPASS "aggregate PCR value matches real PCR value"
+ if [ -f "$pcrs_path" ]; then
+ validate_pcr $pcrs_path
+ if [ $? -eq 0 ]; then
+ tst_res TPASS "aggregate PCR value matches real PCR value"
+ else
+ tst_res TFAIL "aggregate PCR value does not match real PCR value"
+ fi
else
- tst_res TFAIL "aggregate PCR value does not match real PCR value"
+ tst_res TCONF "TPM Hardware Support not enabled in kernel or no TPM chip found"
fi
}
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
index b3151a149..77ea494e5 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
# Author: Mimi Zohar <zohar@linux.ibm.com>
#
# Test whether ToMToU and open_writer violations invalidatethe PCR and are logged.
@@ -19,11 +19,13 @@ setup()
FILE="test.txt"
IMA_VIOLATIONS="$SECURITYFS/ima/violations"
LOG="/var/log/messages"
- PRINTK_RATE_LIMIT=
+ PRINTK_RATE_LIMIT="0"
if status_daemon auditd; then
LOG="/var/log/audit/audit.log"
- elif tst_check_cmds sysctl; then
+ else
+ tst_check_cmds sysctl
+
PRINTK_RATE_LIMIT=`sysctl -n kernel.printk_ratelimit`
sysctl -wq kernel.printk_ratelimit=0
fi
@@ -34,7 +36,7 @@ setup()
cleanup()
{
- [ "$PRINTK_RATE_LIMIT" ] && \
+ [ "$PRINTK_RATE_LIMIT" != "0" ] && \
sysctl -wq kernel.printk_ratelimit=$PRINTK_RATE_LIMIT
}
@@ -62,7 +64,7 @@ close_file_write()
get_count()
{
local search="$1"
- echo $(grep -c "$search.*$FILE" $LOG)
+ echo $(grep -c "${search}.*${FILE}" $LOG)
}
validate()
diff --git a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
index 369df2b22..058d7f982 100644
--- a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
+++ b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
@@ -227,9 +227,6 @@ static void setup(int argc, char *argv[])
tst_tmpdir();
- /* fix for hsym user with umask 0077 */
- umask(0);
-
init_base_dirs();
init_files_dirs();
@@ -237,7 +234,7 @@ static void setup(int argc, char *argv[])
static int test_run(void)
{
- tst_resm(TINFO, " --- HARDLINKS AND SYMLINKS RESTRICTIONS TEST ---");
+ tst_resm(TINFO, " --- HARDLINKS AND SYMLINKS RESTRICTIONS TEST ---\n");
int result_slink = 0,
result_hlink = 0,
@@ -259,8 +256,8 @@ static int test_run(void)
}
/* final results */
- tst_resm(TINFO, "All test-cases have been completed, summary:"
- " - symlinks test:\t%s"
+ tst_resm(TINFO, "All test-cases have been completed, summary:\n"
+ " - symlinks test:\t%s\n"
" - hardlinks test:\t%s",
(result_slink == 1) ? "FAIL" : "PASS",
(result_hlink == 1) ? "FAIL" : "PASS");
diff --git a/testcases/kernel/security/tomoyo/tomoyo_accept_test.c b/testcases/kernel/security/tomoyo/tomoyo_accept_test.c
index 335818a25..7b69c7343 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_accept_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_accept_test.c
@@ -112,7 +112,7 @@ static void test(int rw_loop, int truncate_loop, int append_loop,
}
}
-int main(void)
+int main(int argc, char *argv[])
{
tomoyo_test_init();
fprintf(profile_fp, "255-PREFERENCE::learning={ verbose=no }\n");
diff --git a/testcases/kernel/security/tomoyo/tomoyo_file_test.c b/testcases/kernel/security/tomoyo/tomoyo_file_test.c
index 003f47720..010802e87 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_file_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_file_test.c
@@ -279,7 +279,7 @@ static void set_file_enforce(int enforce)
}
}
-int main(void)
+int main(int argc, char *argv[])
{
tomoyo_test_init();
diff --git a/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c b/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c
index e6e3bb087..5c1a3ca14 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c
@@ -169,7 +169,7 @@ static const unsigned char compressed_ext2_image_sample[1350] = {
0x14, 0x08, 0x00, 0x00, 0x10, 0x00
};
-int main(void)
+int main(int argc, char *argv[])
{
char c = 0;
tomoyo_test_init();
diff --git a/testcases/kernel/security/tomoyo/tomoyo_new_file_test.c b/testcases/kernel/security/tomoyo/tomoyo_new_file_test.c
index eb912d726..16427d29d 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_new_file_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_new_file_test.c
@@ -613,7 +613,7 @@ static void stage_file_test(void)
close(fd);
}
-int main(void)
+int main(int argc, char *argv[])
{
tomoyo_test_init();
fprintf(domain_fp, "%s /bin/true\n", self_domain);
diff --git a/testcases/kernel/security/tomoyo/tomoyo_new_test.c b/testcases/kernel/security/tomoyo/tomoyo_new_test.c
index a1ab259e5..57c340b60 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_new_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_new_test.c
@@ -610,7 +610,7 @@ static struct test_struct {
NULL}
};
-int main(void)
+int main(int argc, char *argv[])
{
int i;
tomoyo_test_init();
diff --git a/testcases/kernel/security/tomoyo/tomoyo_policy_io_test.c b/testcases/kernel/security/tomoyo/tomoyo_policy_io_test.c
index b1897a0fc..afbe95313 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_policy_io_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_policy_io_test.c
@@ -187,7 +187,7 @@ static void stage_policy_io_test(void)
}
}
-int main(void)
+int main(int argc, char *argv[])
{
tomoyo_test_init();
stage_policy_io_test();
diff --git a/testcases/kernel/security/tomoyo/tomoyo_policy_memory_test.c b/testcases/kernel/security/tomoyo/tomoyo_policy_memory_test.c
index a6620ba30..4526d722c 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_policy_memory_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_policy_memory_test.c
@@ -346,7 +346,7 @@ static void exception_policy_test(const unsigned int before)
}
}
-int main(void)
+int main(int argc, char *argv[])
{
unsigned int before;
mount("/proc", "/proc/", "proc", 0, NULL);
diff --git a/testcases/kernel/security/tomoyo/tomoyo_rewrite_test.c b/testcases/kernel/security/tomoyo/tomoyo_rewrite_test.c
index 7bc22c39b..3e001b2d6 100644
--- a/testcases/kernel/security/tomoyo/tomoyo_rewrite_test.c
+++ b/testcases/kernel/security/tomoyo/tomoyo_rewrite_test.c
@@ -160,7 +160,7 @@ static void stage_rewrite_test(void)
printf("\n\n");
}
-int main(void)
+int main(int argc, char *argv[])
{
tomoyo_test_init();
stage_rewrite_test();
diff --git a/testcases/kernel/security/umip/umip_basic_test.c b/testcases/kernel/security/umip/umip_basic_test.c
index d581c5bf1..1baa26c52 100644
--- a/testcases/kernel/security/umip/umip_basic_test.c
+++ b/testcases/kernel/security/umip/umip_basic_test.c
@@ -129,23 +129,6 @@ static void verify_umip_instruction(unsigned int n)
return;
} else
tst_res(TINFO, "Linux kernel version is before than v5.4");
- break;
- case 2:
- case 4:
- /* after Linux kernel v5.10 mainline, SLDT and STR will return
- dummy value and not trigger SIGSEGV due to kernel code change */
- if ((tst_kvercmp(5, 10, 0)) >= 0) {
- tst_res(TINFO, "Linux kernel version is v5.10 or higher");
- if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
- tst_res(TFAIL, "Got SIGSEGV");
- return;
- }
- tst_res(TPASS, "Didn't receive SIGSEGV, child exited with %s",
- tst_strstatus(status));
- return;
- } else
- tst_res(TINFO, "Linux kernel version is earlier than v5.10");
- break;
}
if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
@@ -188,7 +171,7 @@ static struct tst_test test = {
.forks_child = 1,
.test = verify_umip_instruction,
.needs_kconfigs = (const char *[]){
- "CONFIG_X86_INTEL_UMIP=y | CONFIG_X86_UMIP=y",
+ "CONFIG_X86_INTEL_UMIP=y",
NULL
},
.needs_root = 1,
diff --git a/testcases/kernel/sound/.gitignore b/testcases/kernel/sound/.gitignore
index e33480fb6..33692e690 100644
--- a/testcases/kernel/sound/.gitignore
+++ b/testcases/kernel/sound/.gitignore
@@ -1,2 +1 @@
snd_timer01
-/snd_seq01
diff --git a/testcases/kernel/sound/Makefile b/testcases/kernel/sound/Makefile
index 5c728ef36..9abcc2b27 100644
--- a/testcases/kernel/sound/Makefile
+++ b/testcases/kernel/sound/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
-top_srcdir ?= ../../..
+top_srcdir := ../../..
include $(top_srcdir)/include/mk/testcases.mk
@@ -8,7 +8,5 @@ CPPFLAGS += -D_GNU_SOURCE
snd_timer01: CFLAGS+=-pthread
snd_timer01: LDLIBS+=-lrt
-snd_seq01: CFLAGS += -pthread
-snd_seq01: LDLIBS += -lrt
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/sound/snd_seq01.c b/testcases/kernel/sound/snd_seq01.c
deleted file mode 100644
index c56752230..000000000
--- a/testcases/kernel/sound/snd_seq01.c
+++ /dev/null
@@ -1,133 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2018 SUSE LLC <nstange@suse.de>
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2018-7566
- *
- * Test for race condition when initializing client pool on /dev/snd/seq
- * Kernel crash fixed in:
- *
- * commit d15d662e89fc667b90cd294b0eb45694e33144da
- * Author: Takashi Iwai <tiwai@suse.de>
- * Date: Mon Feb 12 15:20:51 2018 +0100
- *
- * ALSA: seq: Fix racy pool initializations
- */
-
-#include <linux/types.h>
-#include <time.h>
-#include <sound/asound.h>
-#include <sound/asequencer.h>
-
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-
-static int fd = -1;
-static int client_id;
-static struct snd_seq_remove_events rminfo = {
- .remove_mode = SNDRV_SEQ_REMOVE_OUTPUT
-};
-static struct snd_seq_event ssev = {
- .flags = SNDRV_SEQ_TIME_STAMP_TICK | SNDRV_SEQ_TIME_MODE_REL,
- .queue = 0,
- .type = SNDRV_SEQ_EVENT_USR0,
- .time = { .tick = 10 }
-};
-
-static struct tst_fzsync_pair fzsync_pair;
-
-static void reinit_pool(int pool_size)
-{
- struct snd_seq_client_pool pconf = {
- .output_pool = pool_size,
- .client = client_id
- };
-
- ioctl(fd, SNDRV_SEQ_IOCTL_SET_CLIENT_POOL, &pconf);
-}
-
-static void race_ioctl(void)
-{
- reinit_pool(512);
-}
-
-static void race_write(void)
-{
- TEST(write(fd, &ssev, sizeof(ssev)));
-}
-
-void (*testfunc_list[])(void) = {race_ioctl, race_write};
-
-static void setup(void)
-{
- struct snd_seq_queue_info qconf = { .queue = 0 };
-
- errno = 0;
- fd = open("/dev/snd/seq", O_RDWR);
-
- if (fd == -1 && (errno == ENOENT || errno == EACCES))
- tst_brk(TCONF | TERRNO, "Cannot open /dev/snd/seq");
-
- if (fd < 0)
- tst_brk(TBROK | TERRNO, "Cannot open /dev/snd/seq");
-
- SAFE_IOCTL(fd, SNDRV_SEQ_IOCTL_CLIENT_ID, &client_id);
- SAFE_IOCTL(fd, SNDRV_SEQ_IOCTL_CREATE_QUEUE, &qconf);
- ssev.dest.client = client_id;
-
- fzsync_pair.exec_loops = 1000000;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void cleanup(void)
-{
- if (fd >= 0)
- SAFE_CLOSE(fd);
- tst_fzsync_pair_cleanup(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- reinit_pool(10);
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(unsigned int n)
-{
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- reinit_pool(5);
- SAFE_IOCTL(fd, SNDRV_SEQ_IOCTL_REMOVE_EVENTS, &rminfo);
- tst_fzsync_start_race_a(&fzsync_pair);
- testfunc_list[n]();
- tst_fzsync_end_race_a(&fzsync_pair);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(testfunc_list),
- .setup = setup,
- .cleanup = cleanup,
- .timeout = 120,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "d15d662e89fc"},
- {"CVE", "2018-7566"},
- {}
- }
-};
diff --git a/testcases/kernel/sound/snd_timer01.c b/testcases/kernel/sound/snd_timer01.c
index 51591c18e..e339ec862 100644
--- a/testcases/kernel/sound/snd_timer01.c
+++ b/testcases/kernel/sound/snd_timer01.c
@@ -18,6 +18,7 @@
#include "config.h"
#include "tst_test.h"
+#include "tst_taint.h"
#include "tst_fuzzy_sync.h"
#include "tst_safe_macros.h"
#include "tst_safe_pthread.h"
@@ -70,6 +71,7 @@ static void setup(void)
tst_brk(TCONF, "The file '/dev/snd/timer' is not exist");
tst_fzsync_pair_init(&fzsync_pair);
+ tst_taint_init(TST_TAINT_W | TST_TAINT_D);
snd_fd = SAFE_OPEN("/dev/snd/timer",
O_RDONLY|O_CREAT|O_NOCTTY|O_SYNC|O_LARGEFILE, 0);
}
@@ -138,7 +140,6 @@ static struct tst_test test = {
.test_all = run,
.setup = setup,
.cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
.tags = (const struct tst_tag[]) {
{"linux-git", "d11662f4f798"},
{"linux-git", "ba3021b2c79b"},
diff --git a/testcases/kernel/syscalls/Makefile b/testcases/kernel/syscalls/Makefile
index c6dc8d9e7..45a00cf7d 100644
--- a/testcases/kernel/syscalls/Makefile
+++ b/testcases/kernel/syscalls/Makefile
@@ -1,8 +1,22 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# testcases/kernel/syscalls Makefile.
#
# Copyright (C) 2009, Cisco Systems Inc.
#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, July 2009
#
diff --git a/testcases/kernel/syscalls/abort/Makefile b/testcases/kernel/syscalls/abort/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/abort/Makefile
+++ b/testcases/kernel/syscalls/abort/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/abort/abort01.c b/testcases/kernel/syscalls/abort/abort01.c
index aa9ca3a2d..386a22f26 100644
--- a/testcases/kernel/syscalls/abort/abort01.c
+++ b/testcases/kernel/syscalls/abort/abort01.c
@@ -5,17 +5,12 @@
* 01/02/2003 Port to LTP avenkat@us.ibm.com
* 11/11/2002: Ported to LTP Suite by Ananda
* 06/30/2001 Port to Linux nsharoff@us.ibm.com
- */
-
-/*\
- * [Description]
*
- * Checks that process which called abort() gets killed by SIGIOT and dumps core.
+ * ALGORITHM
+ * Fork child. Have child abort, check return status.
*
- * [Algorithm]
- * - Fork child.
- * - Child calls abort.
- * - Parent checks return status.
+ * RESTRICTIONS
+ * The ulimit for core file size must be greater than 0.
*/
#include <sys/types.h>
@@ -67,7 +62,7 @@ void verify_abort(void)
tst_res(TFAIL, "abort() raised %s", tst_strsig(sig));
}
-#define MIN_RLIMIT_CORE (512 * 1024)
+#define MIN_RLIMIT_CORE (1024 * 1024)
static void setup(void)
{
@@ -75,15 +70,6 @@ static void setup(void)
/* make sure we get core dumps */
SAFE_GETRLIMIT(RLIMIT_CORE, &rlim);
-
- if (rlim.rlim_max < MIN_RLIMIT_CORE) {
- if (geteuid() != 0) {
- tst_brk(TCONF, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)",
- rlim.rlim_max, MIN_RLIMIT_CORE);
- }
- tst_res(TINFO, "Raising rlim_max to %i", MIN_RLIMIT_CORE);
- rlim.rlim_max = MIN_RLIMIT_CORE;
- }
if (rlim.rlim_cur < MIN_RLIMIT_CORE) {
rlim.rlim_cur = MIN_RLIMIT_CORE;
SAFE_SETRLIMIT(RLIMIT_CORE, &rlim);
diff --git a/testcases/kernel/syscalls/accept/Makefile b/testcases/kernel/syscalls/accept/Makefile
index 516a2e0b8..0910871c7 100644
--- a/testcases/kernel/syscalls/accept/Makefile
+++ b/testcases/kernel/syscalls/accept/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/accept/accept01.c b/testcases/kernel/syscalls/accept/accept01.c
index 52234b792..4e30906f2 100644
--- a/testcases/kernel/syscalls/accept/accept01.c
+++ b/testcases/kernel/syscalls/accept/accept01.c
@@ -3,11 +3,9 @@
/*
* Copyright (c) International Business Machines Corp., 2001
* 07/2001 Ported by Wayne Boyer
- */
-
-/*\
- * [Description]
- * Verify that accept() returns the proper errno for various failure cases.
+ *
+ * Description:
+ * Verify that accept() returns the proper errno for various failure cases
*/
#include <stdio.h>
@@ -97,8 +95,21 @@ void verify_accept(unsigned int nr)
{
struct test_case *tcase = &tcases[nr];
- TST_EXP_FAIL(accept(*tcase->fd, tcase->sockaddr, &tcase->salen),
- tcase->experrno, "%s", tcase->desc);
+ TEST(accept(*tcase->fd, tcase->sockaddr, &tcase->salen));
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "%s: returned %li, expected -1",
+ tcase->desc, TST_RET);
+ return;
+ }
+
+ if (TST_ERR != tcase->experrno) {
+ tst_res(TFAIL | TTERRNO, "%s: expected errno %s, got ",
+ tcase->desc, tst_strerrno(tcase->experrno));
+ return;
+ }
+
+ tst_res(TPASS | TTERRNO, "%s successful", tcase->desc);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/accept/accept02.c b/testcases/kernel/syscalls/accept/accept02.c
index 12a1e3ca3..37ab8b64f 100644
--- a/testcases/kernel/syscalls/accept/accept02.c
+++ b/testcases/kernel/syscalls/accept/accept02.c
@@ -3,10 +3,7 @@
* Copyright (c) 2019 SUSE LLC
* Author: Christian Amann <camann@suse.com>
*/
-/*\
- * [Description]
- *
- * Test for CVE-2017-8890
+/* Test for CVE-2017-8890
*
* In Kernels up to 4.10.15 missing commit 657831ff the multicast
* group information of a socket gets copied over to a newly created
diff --git a/testcases/kernel/syscalls/accept4/Makefile b/testcases/kernel/syscalls/accept4/Makefile
index 6d5002ab6..504042e11 100644
--- a/testcases/kernel/syscalls/accept4/Makefile
+++ b/testcases/kernel/syscalls/accept4/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) International Business Machines Corp., 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c
index aaab20c2c..29e18f27d 100644
--- a/testcases/kernel/syscalls/accept4/accept4_01.c
+++ b/testcases/kernel/syscalls/accept4/accept4_01.c
@@ -2,9 +2,9 @@
/*
* Copyright (C) 2008, Linux Foundation,
- * Copyright (c) 2020 Petr Vorel <petr.vorel@gmail.com>
* written by Michael Kerrisk <mtk.manpages@gmail.com>
* Initial Porting to LTP by Subrata <subrata@linux.vnet.ibm.com>
+ *
*/
#define _GNU_SOURCE
@@ -17,7 +17,6 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <linux/net.h>
#include "tst_test.h"
#include "lapi/fcntl.h"
@@ -25,17 +24,25 @@
#define PORT_NUM 33333
-static const char *variant_desc[] = {
- "libc accept4()",
- "__NR_accept4 syscall",
- "__NR_socketcall SYS_ACCEPT4 syscall"};
+#ifndef SOCK_CLOEXEC
+# define SOCK_CLOEXEC O_CLOEXEC
+#endif
+#ifndef SOCK_NONBLOCK
+# define SOCK_NONBLOCK O_NONBLOCK
+#endif
+
+#if defined(SYS_ACCEPT4) /* the socketcall() number */
+#define USE_SOCKETCALL 1
+#endif
static struct sockaddr_in *conn_addr, *accept_addr;
static int listening_fd;
-static int socketcall_accept4(int fd, struct sockaddr *sockaddr, socklen_t
- *addrlen, int flags)
+#if !(__GLIBC_PREREQ(2, 10))
+static int
+accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
{
+#if USE_SOCKETCALL
long args[6];
args[0] = fd;
@@ -44,7 +51,11 @@ static int socketcall_accept4(int fd, struct sockaddr *sockaddr, socklen_t
args[3] = flags;
return tst_syscall(__NR_socketcall, SYS_ACCEPT4, args);
+#else
+ return tst_syscall(__NR_accept4, fd, sockaddr, addrlen, flags);
+#endif
}
+#endif
static int create_listening_socket(void)
{
@@ -69,8 +80,6 @@ static int create_listening_socket(void)
static void setup(void)
{
- tst_res(TINFO, "Testing variant: %s", variant_desc[tst_variant]);
-
memset(conn_addr, 0, sizeof(*conn_addr));
conn_addr->sin_family = AF_INET;
conn_addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
@@ -97,7 +106,6 @@ static struct test_case {
static void verify_accept4(unsigned int nr)
{
struct test_case *tcase = &tcases[nr];
- int flags = tcase->cloexec | tcase->nonblock;
int connfd, acceptfd;
int fdf, flf, fdf_pass, flf_pass, fd_cloexec, fd_nonblock;
socklen_t addrlen;
@@ -106,25 +114,20 @@ static void verify_accept4(unsigned int nr)
SAFE_CONNECT(connfd, (struct sockaddr *)conn_addr, sizeof(*conn_addr));
addrlen = sizeof(*accept_addr);
- switch (tst_variant) {
- case 0:
- TEST(accept4(listening_fd, (struct sockaddr *)accept_addr,
- &addrlen, flags));
- break;
- case 1:
- TEST(tst_syscall(__NR_accept4, listening_fd,
- (struct sockaddr *)accept_addr,
- &addrlen, flags));
- break;
- case 2:
- TEST(socketcall_accept4(listening_fd, (struct sockaddr *)accept_addr,
- &addrlen, flags));
- break;
+#if !(__GLIBC_PREREQ(2, 10))
+ TEST(accept4_01(listening_fd, (struct sockaddr *)accept_addr, &addrlen,
+ tcase->cloexec | tcase->nonblock));
+#else
+ TEST(accept4(listening_fd, (struct sockaddr *)accept_addr, &addrlen,
+ tcase->cloexec | tcase->nonblock));
+#endif
+ if (TST_RET == -1) {
+ if (TST_ERR == ENOSYS)
+ tst_brk(TCONF, "syscall __NR_accept4 not supported");
+ else
+ tst_brk(TBROK | TTERRNO, "accept4 failed");
}
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "accept4 failed");
-
acceptfd = TST_RET;
/* Test to see if O_CLOEXEC is as expected */
@@ -158,7 +161,6 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcases),
.setup = setup,
.cleanup = cleanup,
- .test_variants = 3,
.test = verify_accept4,
.bufs = (struct tst_buffers []) {
{&conn_addr, .size = sizeof(*conn_addr)},
diff --git a/testcases/kernel/syscalls/access/Makefile b/testcases/kernel/syscalls/access/Makefile
index 5d89a6c05..06aaf9feb 100644
--- a/testcases/kernel/syscalls/access/Makefile
+++ b/testcases/kernel/syscalls/access/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/access/access01.c b/testcases/kernel/syscalls/access/access01.c
index c9a076dfe..1b73058d4 100644
--- a/testcases/kernel/syscalls/access/access01.c
+++ b/testcases/kernel/syscalls/access/access01.c
@@ -231,15 +231,46 @@ static struct tcase {
{DNAME_WX"/"FNAME_X, W_OK, "W_OK", EACCES, 1}
};
-static void access_test(struct tcase *tc, const char *user)
+static void verify_success(struct tcase *tc, const char *user)
{
- if (tc->exp_errno) {
- TST_EXP_FAIL(access(tc->fname, tc->mode), tc->exp_errno,
- "access(%s, %s) as %s", tc->fname, tc->name, user);
- } else {
- TST_EXP_PASS(access(tc->fname, tc->mode),
- "access(%s, %s) as %s", tc->fname, tc->name, user);
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TTERRNO,
+ "access(%s, %s) as %s failed unexpectedly",
+ tc->fname, tc->name, user);
+ return;
+ }
+
+ tst_res(TPASS, "access(%s, %s) as %s", tc->fname, tc->name, user);
+}
+
+static void verify_failure(struct tcase *tc, const char *user)
+{
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "access(%s, %s) as %s succeded unexpectedly",
+ tc->fname, tc->name, user);
+ return;
+ }
+
+ if (TST_ERR != tc->exp_errno) {
+ tst_res(TFAIL | TTERRNO,
+ "access(%s, %s) as %s should fail with %s",
+ tc->fname, tc->name, user,
+ tst_strerrno(tc->exp_errno));
+ return;
}
+
+ tst_res(TPASS | TTERRNO, "access(%s, %s) as %s",
+ tc->fname, tc->name, user);
+}
+
+static void access_test(struct tcase *tc, const char *user)
+{
+ TEST(access(tc->fname, tc->mode));
+
+ if (tc->exp_errno)
+ verify_failure(tc, user);
+ else
+ verify_success(tc, user);
}
static void verify_access(unsigned int n)
diff --git a/testcases/kernel/syscalls/access/access02.c b/testcases/kernel/syscalls/access/access02.c
index bf636f9f4..db1d350bf 100644
--- a/testcases/kernel/syscalls/access/access02.c
+++ b/testcases/kernel/syscalls/access/access02.c
@@ -59,11 +59,13 @@ static void access_test(struct tcase *tc, const char *user)
struct stat stat_buf;
char command[64];
- TST_EXP_PASS_SILENT(access(tc->pathname, tc->mode),
- "access(%s, %s) as %s", tc->pathname, tc->name, user);
+ TEST(access(tc->pathname, tc->mode));
- if (!TST_PASS)
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TTERRNO, "access(%s, %s) as %s failed",
+ tc->pathname, tc->name, user);
return;
+ }
switch (tc->mode) {
case F_OK:
diff --git a/testcases/kernel/syscalls/access/access03.c b/testcases/kernel/syscalls/access/access03.c
index ae3f676b1..612256c17 100644
--- a/testcases/kernel/syscalls/access/access03.c
+++ b/testcases/kernel/syscalls/access/access03.c
@@ -26,13 +26,34 @@ static struct tcase {
{(void *)-1, X_OK, "X_OK"},
};
+static void access_test(struct tcase *tc, const char *user)
+{
+ TEST(access(tc->addr, tc->mode));
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "access(%p, %s) as %s succeeded unexpectedly",
+ tc->addr, tc->name, user);
+ return;
+ }
+
+ if (TST_ERR != EFAULT) {
+ tst_res(TFAIL | TTERRNO,
+ "access(%p, %s) as %s should fail with EFAULT",
+ tc->addr, tc->name, user);
+ return;
+ }
+
+ tst_res(TPASS | TTERRNO, "access(%p, %s) as %s",
+ tc->addr, tc->name, user);
+}
+
static void verify_access(unsigned int n)
{
struct tcase *tc = &tcases[n];
pid_t pid;
- TST_EXP_FAIL(access(tc->addr, tc->mode), EFAULT,
- "invalid address as root");
+ /* test as root */
+ access_test(tc, "root");
/* test as nobody */
pid = SAFE_FORK();
@@ -40,8 +61,7 @@ static void verify_access(unsigned int n)
SAFE_WAITPID(pid, NULL, 0);
} else {
SAFE_SETUID(uid);
- TST_EXP_FAIL(access(tc->addr, tc->mode), EFAULT,
- "invalid address as nobody");
+ access_test(tc, "nobody");
}
}
diff --git a/testcases/kernel/syscalls/access/access04.c b/testcases/kernel/syscalls/access/access04.c
index 2d6dd70e8..328be1b73 100644
--- a/testcases/kernel/syscalls/access/access04.c
+++ b/testcases/kernel/syscalls/access/access04.c
@@ -58,8 +58,21 @@ static struct tcase {
static void access_test(struct tcase *tc, const char *user)
{
- TST_EXP_FAIL(access(tc->pathname, tc->mode), tc->exp_errno,
- "access as %s", user);
+ TEST(access(tc->pathname, tc->mode));
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "access as %s succeeded unexpectedly", user);
+ return;
+ }
+
+ if (tc->exp_errno != TST_ERR) {
+ tst_res(TFAIL | TTERRNO,
+ "access as %s should fail with %s",
+ user, tst_strerrno(tc->exp_errno));
+ return;
+ }
+
+ tst_res(TPASS | TTERRNO, "access as %s failed expectedly", user);
}
static void verify_access(unsigned int n)
diff --git a/testcases/kernel/syscalls/acct/Makefile b/testcases/kernel/syscalls/acct/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/acct/Makefile
+++ b/testcases/kernel/syscalls/acct/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/acct/acct01.c b/testcases/kernel/syscalls/acct/acct01.c
index 1f88e5307..c161d2a2c 100644
--- a/testcases/kernel/syscalls/acct/acct01.c
+++ b/testcases/kernel/syscalls/acct/acct01.c
@@ -7,11 +7,6 @@
/* 12/03/2002 Port to LTP robbiew@us.ibm.com */
/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
-/*\
- * [DOCUMENTATION]
- * Verify that acct() returns proper errno on failure.
- */
-
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
diff --git a/testcases/kernel/syscalls/acct/acct02.c b/testcases/kernel/syscalls/acct/acct02.c
index b8eb1aad4..2f1290fa2 100644
--- a/testcases/kernel/syscalls/acct/acct02.c
+++ b/testcases/kernel/syscalls/acct/acct02.c
@@ -3,9 +3,7 @@
* Copyright (c) SUSE LLC, 2019
* Author: Christian Amann <camann@suse.com>
*/
-/*\
- * [DOCUMENTATION]
- *
+/*
* This tests if the kernel writes correct data to the
* process accounting file.
*
@@ -51,27 +49,25 @@ static union acct_union {
struct acct_v3 v3;
} acct_struct;
-#define ACCT_V3 "CONFIG_BSD_PROCESS_ACCT_V3"
-
static int acct_version_is_3(void)
{
- struct tst_kconfig_var kconfig = {
- .id = ACCT_V3,
- .id_len = sizeof(ACCT_V3)-1,
+ const char *kconfig_acct_v3[] = {
+ "CONFIG_BSD_PROCESS_ACCT_V3",
+ NULL
};
- tst_kconfig_read(&kconfig, 1);
+ struct tst_kconfig_res results[1];
- tst_res(TINFO, ACCT_V3 "=%c", kconfig.choice);
+ tst_kconfig_read(kconfig_acct_v3, results, 1);
- return kconfig.choice == 'y';
+ return results[0].match == 'y';
}
static void run_command(void)
{
const char *const cmd[] = {COMMAND, NULL};
- rc = tst_cmd(cmd, NULL, NULL, TST_CMD_PASS_RETVAL) << 8;
+ rc = tst_run_cmd(cmd, NULL, NULL, 1) << 8;
}
static int verify_acct(void *acc, int elap_time)
@@ -145,7 +141,7 @@ static int verify_acct(void *acc, int elap_time)
ret = 1;
}
- if (ACCT_MEMBER_V3(ac_version) != (char)(3 | ACCT_BYTEORDER)) {
+ if (ACCT_MEMBER_V3(ac_version) != (3 | ACCT_BYTEORDER)) {
tst_res(TINFO, "ac_version != 3 (%d)",
ACCT_MEMBER_V3(ac_version));
ret = 1;
@@ -254,12 +250,14 @@ static void cleanup(void)
acct(NULL);
}
+static const char *kconfigs[] = {
+ "CONFIG_BSD_PROCESS_ACCT",
+ NULL
+};
+
static struct tst_test test = {
.test_all = run,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_BSD_PROCESS_ACCT",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.setup = setup,
.cleanup = cleanup,
.needs_tmpdir = 1,
diff --git a/testcases/kernel/syscalls/add_key/.gitignore b/testcases/kernel/syscalls/add_key/.gitignore
index f57dc2228..b9a04214d 100644
--- a/testcases/kernel/syscalls/add_key/.gitignore
+++ b/testcases/kernel/syscalls/add_key/.gitignore
@@ -2,4 +2,3 @@
/add_key02
/add_key03
/add_key04
-/add_key05
diff --git a/testcases/kernel/syscalls/add_key/Makefile b/testcases/kernel/syscalls/add_key/Makefile
index 0f51e0bc2..c3e9ac15f 100644
--- a/testcases/kernel/syscalls/add_key/Makefile
+++ b/testcases/kernel/syscalls/add_key/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/add_key/add_key01.c b/testcases/kernel/syscalls/add_key/add_key01.c
index 1983e2538..4fe97dac6 100644
--- a/testcases/kernel/syscalls/add_key/add_key01.c
+++ b/testcases/kernel/syscalls/add_key/add_key01.c
@@ -4,118 +4,23 @@
* Porting from Crackerjack to LTP is done by
* Manas Kumar Nayak maknayak@in.ibm.com>
*
- * This case test various key type can support how many long
- * bytes payload.
- * keyring: 0 bytes
- * user/logon: 32767 bytes
- * big_key: 1M -1byte
- *
- * The tests needs root because larger keys are over limit for unpriviledged
- * user by default.
+ * Basic test for the add_key() syscall.
*/
+#include <errno.h>
+
#include "tst_test.h"
#include "lapi/keyctl.h"
-static char *keyring_buf, *keyring_buf1;
-static char *user_buf, *user_buf1;
-static char *logon_buf, *logon_buf1;
-static char *big_key_buf, *big_key_buf1;
-static unsigned int logon_nsup, big_key_nsup;
-
-struct tcase {
- const char *type;
- const char *desc;
- char **buf;
- size_t plen;
- int pass_flag;
- char *message;
-} tcases[] = {
- {"keyring", "abc", &keyring_buf, 0, 1,
- "The key type is keyrings and plen is 0"},
-
- {"keyring", "bcd", &keyring_buf, 1, 0,
- "the key type is keyrings and plen is 1"},
-
- {"user", "cde", &user_buf, 32767, 1,
- "The key type is user and plen is 32767"},
-
- {"user", "def", &user_buf1, 32768, 0,
- "The key type is user and plen is 32768"},
-
- {"logon", "ef:g", &logon_buf, 32767, 1,
- "The key type is logon and plen is 32767"},
-
- {"logon", "fg:h", &logon_buf1, 32768, 0,
- "The key type is logon and plen is 32768"},
-
- {"big_key", "ghi", &big_key_buf, (1 << 20) - 1, 1,
- "The key type is big_key and plen is 1048575"},
-
- {"big_key", "hij", &big_key_buf1, 1 << 20, 0,
- "The key type is big_key and plen is 1048576"},
-};
-
-static void verify_add_key(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- tst_res(TINFO, "%s", tc->message);
-
- if (!strcmp(tc->type, "logon") && logon_nsup) {
- tst_res(TCONF, "skipping unsupported logon key");
- return;
- }
- if (!strcmp(tc->type, "big_key") && big_key_nsup) {
- tst_res(TCONF, "skipping unsupported big_key key");
- return;
- }
-
- TEST(add_key(tc->type, tc->desc, *tc->buf, tc->plen, KEY_SPEC_THREAD_KEYRING));
- if (tc->pass_flag) {
- if (TST_RET == -1)
- tst_res(TFAIL | TTERRNO, "add_key call failed unexpectedly");
- else
- tst_res(TPASS, "add_key call succeeded as expected");
- } else {
- if (TST_RET == -1) {
- if (TST_ERR == EINVAL)
- tst_res(TPASS | TTERRNO, "add_key call failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "add_key call failed expected EINVAL but got");
- } else {
- tst_res(TFAIL, "add_key call succeeded unexpectedly");
- }
- }
-}
-
-static void setup(void)
+static void verify_add_key(void)
{
- char buf[64];
-
- TEST(add_key("logon", "test:sup_logon", buf, sizeof(buf), KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1)
- logon_nsup = 1;
-
- TEST(add_key("big_key", "sup_big_key", buf, sizeof(buf), KEY_SPEC_THREAD_KEYRING));
+ TEST(add_key("keyring", "wjkey", NULL, 0, KEY_SPEC_THREAD_KEYRING));
if (TST_RET == -1)
- big_key_nsup = 1;
+ tst_res(TFAIL | TTERRNO, "add_key call failed");
+ else
+ tst_res(TPASS, "add_key call succeeded");
}
static struct tst_test test = {
- .setup = setup,
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_add_key,
- .needs_root = 1,
- .bufs = (struct tst_buffers []) {
- {&keyring_buf, .size = 1},
- {&keyring_buf1, .size = 1},
- {&user_buf, .size = 32767},
- {&user_buf1, .size = 32768},
- {&logon_buf, .size = 32767},
- {&logon_buf1, .size = 32768},
- {&big_key_buf, .size = (1 << 20) - 1},
- {&big_key_buf1, .size = 1 << 20},
- {}
- }
+ .test_all = verify_add_key,
};
diff --git a/testcases/kernel/syscalls/add_key/add_key02.c b/testcases/kernel/syscalls/add_key/add_key02.c
index 98dd5b905..159234f67 100644
--- a/testcases/kernel/syscalls/add_key/add_key02.c
+++ b/testcases/kernel/syscalls/add_key/add_key02.c
@@ -40,7 +40,6 @@ struct tcase {
{ "rxrpc_s", 8 },
{ "user", 64 },
{ "logon", 64 },
- { "big_key", 64 },
};
static void verify_add_key(unsigned int i)
diff --git a/testcases/kernel/syscalls/add_key/add_key05.c b/testcases/kernel/syscalls/add_key/add_key05.c
deleted file mode 100644
index 2be1b7014..000000000
--- a/testcases/kernel/syscalls/add_key/add_key05.c
+++ /dev/null
@@ -1,245 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- *
- * Test unprivileged user can support the number of keys and the
- * number of bytes consumed in payloads of the keys. The default
- * value is 200 and 20000.
- *
- * This is also a regression test for
- * commit a08bf91ce28e ("KEYS: allow reaching the keys quotas exactly")
- * commit 2e356101e72a ("KEYS: reaching the keys quotas correctly")
- *
- * If you run this test with -i > 5 then expect to see some sporadic failures
- * where add_key fails with EDQUOT. Keys are freed asynchronously and we only
- * create up to 10 users to avoid race conditions.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include "tst_test.h"
-#include "lapi/keyctl.h"
-
-#define MAX_USERS 10
-
-static char *user_buf;
-static uid_t ltpuser[MAX_USERS];
-
-static unsigned int usern;
-static unsigned int useri;
-
-static void add_user(char n)
-{
- char username[] = "ltp_add_key05_n";
- const char *const cmd_useradd[] = {"useradd", username, NULL};
- struct passwd *pw;
-
- username[sizeof(username) - 2] = '0' + n;
-
- SAFE_CMD(cmd_useradd, NULL, NULL);
- pw = SAFE_GETPWNAM(username);
- ltpuser[(unsigned int)n] = pw->pw_uid;
-
- tst_res(TINFO, "Created user %s", pw->pw_name);
-}
-
-static void clean_user(char n)
-{
- char username[] = "ltp_add_key05_n";
- const char *const cmd_userdel[] = {"userdel", "-r", username, NULL};
-
- username[sizeof(username) - 2] = '0' + n;
-
- if (tst_cmd(cmd_userdel, NULL, NULL, TST_CMD_PASS_RETVAL))
- tst_res(TWARN | TERRNO, "'userdel -r %s' failed", username);
-}
-
-static inline void parse_proc_key_users(int *used_key, int *max_key, int *used_bytes, int *max_bytes)
-{
- unsigned int val[4];
- char fmt[1024];
-
- sprintf(fmt, "%5u: %%*5d %%*d/%%*d %%d/%%d %%d/%%d", ltpuser[useri]);
- SAFE_FILE_LINES_SCANF("/proc/key-users", fmt, &val[0], &val[1], &val[2], &val[3]);
-
- if (used_key)
- *used_key = val[0];
- if (max_key)
- *max_key = val[1];
- if (used_bytes)
- *used_bytes = val[2];
- if (max_bytes)
- *max_bytes = val[3];
-}
-
-static void verify_max_bytes(void)
-{
- char *buf;
- int plen, invalid_plen, delta;
- int used_bytes, max_bytes, tmp_used_bytes;
-
- tst_res(TINFO, "test max bytes under unprivileged user");
-
- parse_proc_key_users(NULL, NULL, &tmp_used_bytes, NULL);
- TEST(add_key("user", "test2", user_buf, 64, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "add key test2 failed");
- return;
- }
- parse_proc_key_users(NULL, NULL, &used_bytes, &max_bytes);
-
- /*
- * Compute delta between default datalen(in key_alloc) and actual
- * datlen(in key_payload_reserve).
- * more info see kernel code: security/keys/key.c
- */
- delta = used_bytes - tmp_used_bytes - strlen("test2") - 1 - 64;
- invalid_plen = max_bytes - used_bytes - delta - strlen("test_xxx");
- buf = tst_alloc(invalid_plen);
-
- TEST(add_key("user", "test_inv", buf, invalid_plen, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET != -1) {
- tst_res(TFAIL, "add_key(test_inv) succeeded unexpectedltly");
- return;
- }
- if (TST_ERR == EDQUOT)
- tst_res(TPASS | TTERRNO, "add_key(test_inv) failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "add_key(test_inv) failed expected EDQUOT got");
-
- /*Reset delta*/
- TEST(add_key("user", "test3", user_buf, 64, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "add key test3 failed");
- return;
- }
- TEST(add_key("user", "test4", user_buf, 64, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "add key test4 failed");
- return;
- }
- parse_proc_key_users(NULL, NULL, &used_bytes, &max_bytes);
- plen = max_bytes - used_bytes - delta - strlen("test_xxx") - 1;
- TEST(add_key("user", "test_max", buf, plen, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "add_key(test_max) failed unexpectedly");
- return;
- }
-
- tst_res(TPASS, "add_key(test_max) succeeded as expected");
- parse_proc_key_users(NULL, NULL, &tmp_used_bytes, &max_bytes);
- if (tmp_used_bytes == max_bytes)
- tst_res(TPASS, "allow reaching the max bytes exactly");
- else
- tst_res(TFAIL, "max used bytes %u, key allow max bytes %u", tmp_used_bytes, max_bytes);
-}
-
-static void verify_max_keys(void)
-{
- int i, used_key, max_key;
- char desc[10];
-
- tst_res(TINFO, "test max keys under unprivileged user");
- parse_proc_key_users(&used_key, &max_key, NULL, NULL);
-
- for (i = used_key + 1; i <= max_key; i++) {
- sprintf(desc, "abc%d", i);
- TEST(add_key("user", desc, user_buf, 64, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "add keyring key(%s) failed", desc);
- goto count;
- }
- }
-
- TEST(add_key("user", "test_invalid_key", user_buf, 64, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET != -1) {
- tst_res(TFAIL, "add keyring key(test_invalid_key) succeeded unexpectedly");
- goto count;
- }
- if (TST_ERR == EDQUOT)
- tst_res(TPASS | TTERRNO, "add_key(test_invalid_key) failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "add_key(test_invalid_key) failed expected EDQUOT got");
-
-count:
- parse_proc_key_users(&used_key, &max_key, NULL, NULL);
- if (used_key == max_key)
- tst_res(TPASS, "allow reaching the max key(%u) exactly", max_key);
- else
- tst_res(TFAIL, "max used key %u, key allow max key %u", used_key, max_key);
-}
-
-static void do_test(unsigned int n)
-{
- if (usern < MAX_USERS)
- add_user(usern++);
-
- if (useri >= MAX_USERS) {
- sleep(1);
- useri = 0;
- }
-
- if (!SAFE_FORK()) {
- SAFE_SETUID(ltpuser[useri]);
- tst_res(TINFO, "User: %d, UID: %d", useri, ltpuser[useri]);
- TEST(add_key("user", "test1", user_buf, 64, KEY_SPEC_THREAD_KEYRING));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "add key test1 failed");
- return;
- }
-
- if (n)
- verify_max_keys();
- else
- verify_max_bytes();
- }
-
- tst_reap_children();
- useri++;
-
- return;
-}
-
-static void setup(void)
-{
- SAFE_FILE_PRINTF("/proc/sys/kernel/keys/gc_delay", "1");
- SAFE_FILE_PRINTF("/proc/sys/kernel/keys/maxkeys", "200");
- SAFE_FILE_PRINTF("/proc/sys/kernel/keys/maxbytes", "20000");
-}
-
-static void cleanup(void)
-{
- while (usern--)
- clean_user(usern);
-}
-
-static struct tst_test test = {
- .test = do_test,
- .tcnt = 2,
- .needs_root = 1,
- .forks_child = 1,
- .setup = setup,
- .cleanup = cleanup,
- .save_restore = (const char * const[]) {
- "?/proc/sys/kernel/keys/gc_delay",
- "?/proc/sys/kernel/keys/maxkeys",
- "?/proc/sys/kernel/keys/maxbytes",
- NULL,
- },
- .bufs = (struct tst_buffers []) {
- {&user_buf, .size = 64},
- {}
- },
- .needs_cmds = (const char *const []) {
- "useradd",
- "userdel",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "a08bf91ce28"},
- {"linux-git", "2e356101e72"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/adjtimex/.gitignore b/testcases/kernel/syscalls/adjtimex/.gitignore
index bb3508855..d0c6dea83 100644
--- a/testcases/kernel/syscalls/adjtimex/.gitignore
+++ b/testcases/kernel/syscalls/adjtimex/.gitignore
@@ -1,3 +1,2 @@
/adjtimex01
/adjtimex02
-/adjtimex03
diff --git a/testcases/kernel/syscalls/adjtimex/Makefile b/testcases/kernel/syscalls/adjtimex/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/adjtimex/Makefile
+++ b/testcases/kernel/syscalls/adjtimex/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/adjtimex/adjtimex03.c b/testcases/kernel/syscalls/adjtimex/adjtimex03.c
deleted file mode 100644
index 263391c90..000000000
--- a/testcases/kernel/syscalls/adjtimex/adjtimex03.c
+++ /dev/null
@@ -1,85 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Zilogic Systems Pvt. Ltd, 2020. All Rights Reserved.
- * Email: <code@zilogic.com>
- *
- * Based on testcases/kernel/syscalls/adjtimex/adjtimex01.c
- * Copyright (c) Wipro Technologies Ltd, 2002.
- *
- * CVE-2018-11508
- *
- * Test 4-byte kernel data leak via adjtimex
- *
- * On calling the adjtimex() function call with invalid mode (let's say
- * 0x8000), ideally all the parameters should return with null data. But,
- * when we read the last parameter we will receive 4 bytes of kernel data.
- * This proves that there are 4 bytes of info leaked. The bug was fixed in
- * Kernel Version 4.16.9. Therefore, the below test case will only be
- * applicable for the kernel version 4.16.9 and above.
- *
- * So basically, this test shall check whether there is any data leak.
- * To test that, Pass struct timex buffer filled with zero with
- * some INVALID mode to the system call adjtimex. Passing an invalid
- * parameters will not call do_adjtimex() and before that, it shall throw
- * an error(On error test shall not break). Therefore, none of the parameters
- * will get initialized.
- *
- * On reading the last attribute tai of the struct, if the attribute is non-
- * zero the test is considered to have failed, else the test is considered
- * to have passed.
- */
-
-#include <errno.h>
-#include <sys/timex.h>
-#include "tst_test.h"
-
-#define ADJ_ADJTIME 0x8000
-#define LOOPS 10
-
-static struct timex *buf;
-
-void verify_adjtimex(void)
-{
- int i;
- int data_leak = 0;
-
- for (i = 0; i < LOOPS; i++) {
- memset(buf, 0, sizeof(struct timex));
- buf->modes = ADJ_ADJTIME; /* Invalid mode */
- TEST(adjtimex(buf));
- if ((TST_RET == -1) && (TST_ERR == EINVAL)) {
- tst_res(TINFO,
- "expecting adjtimex() to fail with EINVAL"
- " with mode 0x%x", ADJ_ADJTIME);
- } else {
- tst_brk(TBROK | TERRNO,
- "adjtimex(): Unexpeceted error,"
- "expecting EINVAL with mode 0x%x",
- ADJ_ADJTIME);
- }
-
- tst_res(TINFO, "tai : 0x%08x", buf->tai);
-
- if (buf->tai != 0) {
- data_leak = 1;
- break;
- }
- }
- if (data_leak != 0)
- tst_res(TFAIL, "Data leak observed");
- else
- tst_res(TPASS, "Data leak not observed");
-}
-
-static struct tst_test test = {
- .test_all = verify_adjtimex,
- .bufs = (struct tst_buffers []) {
- {&buf, .size = sizeof(*buf)},
- {},
- },
- .tags = (const struct tst_tag[]) {
- {"CVE", "2018-11508"},
- {"linux-git", "0a0b98734479"},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/alarm/Makefile b/testcases/kernel/syscalls/alarm/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/alarm/Makefile
+++ b/testcases/kernel/syscalls/alarm/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/bind/.gitignore b/testcases/kernel/syscalls/bind/.gitignore
index c85774441..4ebea9ee7 100644
--- a/testcases/kernel/syscalls/bind/.gitignore
+++ b/testcases/kernel/syscalls/bind/.gitignore
@@ -1,6 +1,3 @@
/bind01
/bind02
/bind03
-/bind04
-/bind05
-/bind06
diff --git a/testcases/kernel/syscalls/bind/Makefile b/testcases/kernel/syscalls/bind/Makefile
index 00db0e7ff..bd617d806 100644
--- a/testcases/kernel/syscalls/bind/Makefile
+++ b/testcases/kernel/syscalls/bind/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-bind04 bind05: CFLAGS += -pthread
-bind06: CFLAGS += -pthread
-bind06: LDLIBS += -lrt
-
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/bind/bind01.c b/testcases/kernel/syscalls/bind/bind01.c
index c008819a8..2054996ac 100644
--- a/testcases/kernel/syscalls/bind/bind01.c
+++ b/testcases/kernel/syscalls/bind/bind01.c
@@ -47,14 +47,14 @@ void verify_bind(unsigned int nr)
{
struct test_case *tcase = &tcases[nr];
- if (tcase->experrno) {
- TST_EXP_FAIL(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen),
- tcase->experrno, "%s", tcase->desc);
+ TEST(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen));
+ if (TST_RET != tcase->retval && TST_ERR != tcase->experrno) {
+ tst_res(TFAIL, "%s ; returned"
+ " %ld (expected %d), errno %d (expected"
+ " %d)", tcase->desc, TST_RET, tcase->retval,
+ TST_ERR, tcase->experrno);
} else {
- TST_EXP_PASS(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen),
- "%s", tcase->desc);
- SAFE_CLOSE(inet_socket);
- inet_socket = SAFE_SOCKET(PF_INET, SOCK_STREAM, 0);
+ tst_res(TPASS, "%s successful", tcase->desc);
}
}
diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c
index a997157d6..65944cbe3 100644
--- a/testcases/kernel/syscalls/bind/bind02.c
+++ b/testcases/kernel/syscalls/bind/bind02.c
@@ -36,9 +36,16 @@ static void run(void)
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(TCP_PRIVILEGED_PORT);
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
- TST_EXP_FAIL(bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)),
- EACCES, "bind()");
+ TEST(bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)));
SAFE_CLOSE(sockfd);
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "bind() returned %li, expected -1", TST_RET);
+ } else if (TST_ERR == EACCES) {
+ tst_res(TPASS | TTERRNO, "bind() failed as expected");
+ } else {
+ tst_res(TFAIL | TTERRNO, "Unexpected error");
+ }
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/bind/bind03.c b/testcases/kernel/syscalls/bind/bind03.c
index c2661fbcd..dda5ca374 100644
--- a/testcases/kernel/syscalls/bind/bind03.c
+++ b/testcases/kernel/syscalls/bind/bind03.c
@@ -21,37 +21,16 @@
#define SNAME_B "socket.2"
static int sock1, sock2;
-static struct sockaddr_un sun1, sun2;
-static void run(void)
+void run(void)
{
- /*
- * Once a STREAM UNIX domain socket has been bound, it can't be
- * rebound.
- */
- TST_EXP_FAIL(bind(sock1, (struct sockaddr *)&sun2, sizeof(sun2)),
- EINVAL, "re-bind() socket");
-
- /*
- * Since a socket is already bound to the pathname, it can't be bound
- * to a second socket. Expected error is EADDRINUSE.
- */
- TST_EXP_FAIL(bind(sock2, (struct sockaddr *)&sun1, sizeof(sun1)),
- EADDRINUSE, "bind() with bound pathname");
-
- /*
- * Kernel is buggy since it creates the node in fileystem first, then
- * locks the socket and does all the checks and the node is not removed
- * in the error path. For now we will unlink the node here so that the
- * test works fine when the run() function is executed in a loop.
- */
- unlink(SNAME_B);
-}
+ struct sockaddr_un sun1;
+ struct sockaddr_un sun2;
-static void setup(void)
-{
sock1 = SAFE_SOCKET(PF_UNIX, SOCK_STREAM, 0);
- sock2 = SAFE_SOCKET(PF_UNIX, SOCK_STREAM, 0);
+
+ memset(&sun1, 0, sizeof(sun1));
+ memset(&sun2, 0, sizeof(sun2));
sun1.sun_family = AF_UNIX;
sun2.sun_family = AF_UNIX;
@@ -67,16 +46,49 @@ static void setup(void)
}
SAFE_BIND(sock1, (struct sockaddr *)&sun1, sizeof(sun1));
+
+ /*
+ * Once a STREAM UNIX domain socket has been bound, it can't be
+ * rebound.
+ */
+ if (bind(sock1, (struct sockaddr *)&sun2, sizeof(sun2)) == 0) {
+ tst_res(TFAIL, "re-binding of socket succeeded");
+ return;
+ }
+
+ if (errno != EINVAL) {
+ tst_res(TFAIL | TERRNO, "expected EINVAL");
+ return;
+ }
+
+ tst_res(TPASS, "bind() failed with EINVAL as expected");
+
+ sock2 = SAFE_SOCKET(PF_UNIX, SOCK_STREAM, 0);
+
+ /*
+ * Since a socket is already bound to the pathname, it can't be bound
+ * to a second socket. Expected error is EADDRINUSE.
+ */
+ if (bind(sock2, (struct sockaddr *)&sun1, sizeof(sun1)) == 0) {
+ tst_res(TFAIL, "bind() succeeded with already bound pathname!");
+ return;
+ }
+
+ if (errno != EADDRINUSE) {
+ tst_res(TFAIL | TERRNO, "expected to fail with EADDRINUSE");
+ return;
+ }
+
+ tst_res(TPASS, "bind() failed with EADDRINUSE as expected");
}
static void cleanup(void)
{
- SAFE_CLOSE(sock1);
- SAFE_CLOSE(sock2);
+ close(sock1);
+ close(sock2);
}
static struct tst_test test = {
- .setup = setup,
.cleanup = cleanup,
.test_all = run,
.needs_tmpdir = 1,
diff --git a/testcases/kernel/syscalls/bind/bind04.c b/testcases/kernel/syscalls/bind/bind04.c
deleted file mode 100644
index de43b6c13..000000000
--- a/testcases/kernel/syscalls/bind/bind04.c
+++ /dev/null
@@ -1,168 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Martin Doucha <mdoucha@suse.cz>
- */
-
-/*
- * Create and bind socket for various standard stream protocols.
- * Then connect to it and send some test data.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <pthread.h>
-
-#include "tst_test.h"
-#include "tst_net.h"
-#include "tst_safe_pthread.h"
-#include "libbind.h"
-
-static struct sockaddr_un unix_addr = {
- .sun_family = AF_UNIX,
- .sun_path = MAIN_SOCKET_FILE
-};
-static struct sockaddr_un abstract_addr = {
- .sun_family = AF_UNIX,
- .sun_path = ABSTRACT_SOCKET_PATH
-};
-static struct sockaddr_in ipv4_addr;
-static struct sockaddr_in ipv4_any_addr;
-static struct sockaddr_in6 ipv6_addr;
-static struct sockaddr_in6 ipv6_any_addr;
-
-static struct test_case testcase_list[] = {
- /* UNIX sockets */
- {SOCK_STREAM, 0, (struct sockaddr *)&unix_addr, sizeof(unix_addr),
- "AF_UNIX pathname stream"},
- {SOCK_SEQPACKET, 0, (struct sockaddr *)&unix_addr, sizeof(unix_addr),
- "AF_UNIX pathname seqpacket"},
- {SOCK_STREAM, 0, (struct sockaddr *)&abstract_addr,
- sizeof(abstract_addr), "AF_UNIX abstract stream"},
- {SOCK_SEQPACKET, 0, (struct sockaddr *)&abstract_addr,
- sizeof(abstract_addr), "AF_UNIX abstract seqpacket"},
-
- /* IPv4 sockets */
- {SOCK_STREAM, 0, (struct sockaddr *)&ipv4_addr, sizeof(ipv4_addr),
- "IPv4 loop TCP variant 1"},
- {SOCK_STREAM, IPPROTO_TCP, (struct sockaddr *)&ipv4_addr,
- sizeof(ipv4_addr), "IPv4 loop TCP variant 2"},
- {SOCK_STREAM, IPPROTO_SCTP, (struct sockaddr *)&ipv4_addr,
- sizeof(ipv4_addr), "IPv4 loop SCTP"},
- {SOCK_STREAM, 0, (struct sockaddr *)&ipv4_any_addr,
- sizeof(ipv4_any_addr), "IPv4 any TCP variant 1"},
- {SOCK_STREAM, IPPROTO_TCP, (struct sockaddr *)&ipv4_any_addr,
- sizeof(ipv4_any_addr), "IPv4 any TCP variant 2"},
- {SOCK_STREAM, IPPROTO_SCTP, (struct sockaddr *)&ipv4_any_addr,
- sizeof(ipv4_any_addr), "IPv4 any SCTP"},
-
- /* IPv6 sockets */
- {SOCK_STREAM, 0, (struct sockaddr *)&ipv6_addr, sizeof(ipv6_addr),
- "IPv6 loop TCP variant 1"},
- {SOCK_STREAM, IPPROTO_TCP, (struct sockaddr *)&ipv6_addr,
- sizeof(ipv6_addr), "IPv6 loop TCP variant 2"},
- {SOCK_STREAM, IPPROTO_SCTP, (struct sockaddr *)&ipv6_addr,
- sizeof(ipv6_addr), "IPv6 loop SCTP"},
- {SOCK_STREAM, 0, (struct sockaddr *)&ipv6_any_addr,
- sizeof(ipv6_any_addr), "IPv6 any TCP variant 1"},
- {SOCK_STREAM, IPPROTO_TCP, (struct sockaddr *)&ipv6_any_addr,
- sizeof(ipv6_any_addr), "IPv6 any TCP variant 2"},
- {SOCK_STREAM, IPPROTO_SCTP, (struct sockaddr *)&ipv6_any_addr,
- sizeof(ipv6_any_addr), "IPv6 any SCTP"}
-};
-
-static void setup(void)
-{
- srand(time(0));
-
- tst_init_sockaddr_inet(&ipv4_addr, IPV4_ADDRESS, 0);
- tst_init_sockaddr_inet_bin(&ipv4_any_addr, INADDR_ANY, 0);
- tst_init_sockaddr_inet6_bin(&ipv6_addr, &in6addr_loopback, 0);
- tst_init_sockaddr_inet6_bin(&ipv6_any_addr, &in6addr_any, 0);
-}
-
-static void *peer_thread(void *tc_ptr)
-{
- const struct test_case *tc = tc_ptr;
- int sock;
- unsigned int request;
- const char *response;
-
- sock = SAFE_SOCKET(tc->address->sa_family, tc->type, tc->protocol);
- SAFE_CONNECT(sock, tc->address, tc->addrlen);
- SAFE_READ(1, sock, &request, sizeof(request));
-
- if (request < ARRAY_SIZE(testcase_list))
- response = testcase_list[request].description;
- else
- response = "Invalid request value";
-
- SAFE_WRITE(1, sock, response, strlen(response) + 1);
- SAFE_CLOSE(sock);
- return NULL;
-}
-
-static void test_bind(unsigned int n)
-{
- struct test_case tc_copy, *tc = testcase_list + n;
- struct sockaddr_storage listen_addr, remote_addr;
- struct sockaddr_un *tmp_addr;
- socklen_t remote_len = sizeof(struct sockaddr_storage);
- int listen_sock, sock, size;
- unsigned int rand_index;
- pthread_t thread_id;
- char buffer[BUFFER_SIZE];
- const char *exp_data;
-
- tst_res(TINFO, "Testing %s", tc->description);
- listen_sock = SAFE_SOCKET(tc->address->sa_family, tc->type,
- tc->protocol);
-
- TST_EXP_PASS_SILENT(bind(listen_sock, tc->address, tc->addrlen), "bind()");
-
- if (!TST_PASS) {
- SAFE_CLOSE(listen_sock);
- return;
- }
-
- /*
- * IPv4/IPv6 tests use wildcard addresses, resolve a valid connection
- * address for peer thread
- */
- memcpy(&tc_copy, tc, sizeof(struct test_case));
- tc_copy.addrlen = tst_get_connect_address(listen_sock, &listen_addr);
- tc_copy.address = (struct sockaddr *)&listen_addr;
-
- SAFE_LISTEN(listen_sock, 1);
- SAFE_PTHREAD_CREATE(&thread_id, NULL, peer_thread, &tc_copy);
- sock = SAFE_ACCEPT(listen_sock, (struct sockaddr *)&remote_addr,
- &remote_len);
-
- rand_index = rand() % ARRAY_SIZE(testcase_list);
- SAFE_WRITE(1, sock, &rand_index, sizeof(rand_index));
-
- size = SAFE_READ(0, sock, buffer, BUFFER_SIZE - 1);
- buffer[size] = '\0';
- exp_data = testcase_list[rand_index].description;
-
- if (!strcmp(buffer, exp_data))
- tst_res(TPASS, "Communication successful");
- else
- tst_res(TFAIL, "Received invalid data. Expected: \"%s\". "
- "Received: \"%s\"", exp_data, buffer);
-
- SAFE_CLOSE(sock);
- SAFE_CLOSE(listen_sock);
- pthread_join(thread_id, NULL);
- tmp_addr = (struct sockaddr_un *)tc->address;
-
- if (tc->address->sa_family == AF_UNIX && tmp_addr->sun_path[0])
- SAFE_UNLINK(tmp_addr->sun_path);
-}
-
-static struct tst_test test = {
- .test = test_bind,
- .tcnt = ARRAY_SIZE(testcase_list),
- .needs_tmpdir = 1,
- .setup = setup,
-};
diff --git a/testcases/kernel/syscalls/bind/bind05.c b/testcases/kernel/syscalls/bind/bind05.c
deleted file mode 100644
index c43593fe1..000000000
--- a/testcases/kernel/syscalls/bind/bind05.c
+++ /dev/null
@@ -1,185 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Martin Doucha <mdoucha@suse.cz>
- */
-
-/*
- * Create and bind socket for various standard datagram protocols.
- * Then connect to it and send some test data.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <pthread.h>
-
-#include "tst_test.h"
-#include "tst_net.h"
-#include "tst_safe_pthread.h"
-#include "libbind.h"
-
-static struct sockaddr_un unix_addr = {
- .sun_family = AF_UNIX,
- .sun_path = MAIN_SOCKET_FILE
-};
-static struct sockaddr_un abstract_addr = {
- .sun_family = AF_UNIX,
- .sun_path = ABSTRACT_SOCKET_PATH
-};
-static struct sockaddr_un peer_addr = {
- .sun_family = AF_UNIX,
- .sun_path = PEER_SOCKET_FILE
-};
-static struct sockaddr_in ipv4_addr;
-static struct sockaddr_in ipv4_any_addr;
-static struct sockaddr_in6 ipv6_addr;
-static struct sockaddr_in6 ipv6_any_addr;
-
-static struct test_case testcase_list[] = {
- /* UNIX sockets */
- {SOCK_DGRAM, 0, (struct sockaddr *)&unix_addr, sizeof(unix_addr),
- "AF_UNIX pathname datagram"},
- {SOCK_DGRAM, 0, (struct sockaddr *)&abstract_addr,
- sizeof(abstract_addr), "AF_UNIX abstract datagram"},
-
- /* IPv4 sockets */
- {SOCK_DGRAM, 0, (struct sockaddr *)&ipv4_addr, sizeof(ipv4_addr),
- "IPv4 loop UDP variant 1"},
- {SOCK_DGRAM, IPPROTO_UDP, (struct sockaddr *)&ipv4_addr,
- sizeof(ipv4_addr), "IPv4 loop UDP variant 2"},
- {SOCK_DGRAM, IPPROTO_UDPLITE, (struct sockaddr *)&ipv4_addr,
- sizeof(ipv4_addr), "IPv4 loop UDP-Lite"},
- {SOCK_DGRAM, 0, (struct sockaddr *)&ipv4_any_addr,
- sizeof(ipv4_any_addr), "IPv4 any UDP variant 1"},
- {SOCK_DGRAM, IPPROTO_UDP, (struct sockaddr *)&ipv4_any_addr,
- sizeof(ipv4_any_addr), "IPv4 any UDP variant 2"},
- {SOCK_DGRAM, IPPROTO_UDPLITE, (struct sockaddr *)&ipv4_any_addr,
- sizeof(ipv4_any_addr), "IPv4 any UDP-Lite"},
-
- /* IPv6 sockets */
- {SOCK_DGRAM, 0, (struct sockaddr *)&ipv6_addr, sizeof(ipv6_addr),
- "IPv6 loop UDP variant 1"},
- {SOCK_DGRAM, IPPROTO_UDP, (struct sockaddr *)&ipv6_addr,
- sizeof(ipv6_addr), "IPv6 loop UDP variant 2"},
- {SOCK_DGRAM, IPPROTO_UDPLITE, (struct sockaddr *)&ipv6_addr,
- sizeof(ipv6_addr), "IPv6 loop UDP-Lite"},
- {SOCK_DGRAM, 0, (struct sockaddr *)&ipv6_any_addr,
- sizeof(ipv6_any_addr), "IPv6 any UDP variant 1"},
- {SOCK_DGRAM, IPPROTO_UDP, (struct sockaddr *)&ipv6_any_addr,
- sizeof(ipv6_any_addr), "IPv6 any UDP variant 2"},
- {SOCK_DGRAM, IPPROTO_UDPLITE, (struct sockaddr *)&ipv6_any_addr,
- sizeof(ipv6_any_addr), "IPv6 any UDP-Lite"}
-};
-
-static void setup(void)
-{
- srand(time(0));
-
- tst_init_sockaddr_inet(&ipv4_addr, IPV4_ADDRESS, 0);
- tst_init_sockaddr_inet_bin(&ipv4_any_addr, INADDR_ANY, 0);
- tst_init_sockaddr_inet6_bin(&ipv6_addr, &in6addr_loopback, 0);
- tst_init_sockaddr_inet6_bin(&ipv6_any_addr, &in6addr_any, 0);
-}
-
-static void *peer_thread(void *tc_ptr)
-{
- const struct test_case *tc = tc_ptr;
- int sock;
- unsigned int request = 0;
- const char *response;
-
- sock = SAFE_SOCKET(tc->address->sa_family, tc->type, tc->protocol);
-
- /*
- * Both sides of AF_UNIX/SOCK_DGRAM socket must be bound for
- * bidirectional communication
- */
- if (tc->address->sa_family == AF_UNIX)
- SAFE_BIND(sock, (struct sockaddr *)&peer_addr,
- sizeof(struct sockaddr_un));
-
- SAFE_CONNECT(sock, tc->address, tc->addrlen);
- SAFE_WRITE(1, sock, &request, sizeof(request));
- SAFE_READ(1, sock, &request, sizeof(request));
-
- if (request < ARRAY_SIZE(testcase_list))
- response = testcase_list[request].description;
- else
- response = "Invalid request value";
-
- SAFE_WRITE(1, sock, response, strlen(response) + 1);
- SAFE_CLOSE(sock);
-
- if (tc->address->sa_family == AF_UNIX)
- SAFE_UNLINK(PEER_SOCKET_FILE);
-
- return NULL;
-}
-
-static void test_bind(unsigned int n)
-{
- struct test_case tc_copy, *tc = testcase_list + n;
- struct sockaddr_storage listen_addr, remote_addr;
- struct sockaddr_un *tmp_addr;
- socklen_t remote_len = sizeof(struct sockaddr_storage);
- int sock, size;
- unsigned int rand_index;
- pthread_t thread_id;
- char buffer[BUFFER_SIZE];
- const char *exp_data;
-
- tst_res(TINFO, "Testing %s", tc->description);
- sock = SAFE_SOCKET(tc->address->sa_family, tc->type, tc->protocol);
-
- TST_EXP_PASS_SILENT(bind(sock, tc->address, tc->addrlen), "bind()");
-
- if (!TST_PASS) {
- SAFE_CLOSE(sock);
- return;
- }
-
- /*
- * IPv4/IPv6 tests use wildcard addresses, resolve a valid connection
- * address for peer thread
- */
- memcpy(&tc_copy, tc, sizeof(struct test_case));
- tc_copy.addrlen = tst_get_connect_address(sock, &listen_addr);
- tc_copy.address = (struct sockaddr *)&listen_addr;
-
- SAFE_PTHREAD_CREATE(&thread_id, NULL, peer_thread, &tc_copy);
- size = recvfrom(sock, &rand_index, sizeof(rand_index), 0,
- (struct sockaddr *)&remote_addr, &remote_len);
-
- if (size != sizeof(rand_index)) {
- SAFE_CLOSE(sock);
- tst_brk(TBROK | TERRNO, "Error while waiting for connection");
- }
-
- rand_index = rand() % ARRAY_SIZE(testcase_list);
- SAFE_SENDTO(1, sock, &rand_index, sizeof(rand_index), 0,
- (struct sockaddr *)&remote_addr, remote_len);
-
- size = SAFE_READ(0, sock, buffer, BUFFER_SIZE - 1);
- buffer[size] = '\0';
- exp_data = testcase_list[rand_index].description;
-
- if (!strcmp(buffer, exp_data))
- tst_res(TPASS, "Communication successful");
- else
- tst_res(TFAIL, "Received invalid data. Expected: \"%s\". "
- "Received: \"%s\"", exp_data, buffer);
-
- SAFE_CLOSE(sock);
- pthread_join(thread_id, NULL);
- tmp_addr = (struct sockaddr_un *)tc->address;
-
- if (tc->address->sa_family == AF_UNIX && tmp_addr->sun_path[0])
- SAFE_UNLINK(tmp_addr->sun_path);
-}
-
-static struct tst_test test = {
- .test = test_bind,
- .tcnt = ARRAY_SIZE(testcase_list),
- .needs_tmpdir = 1,
- .setup = setup,
-};
diff --git a/testcases/kernel/syscalls/bind/bind06.c b/testcases/kernel/syscalls/bind/bind06.c
deleted file mode 100644
index 017e0fc89..000000000
--- a/testcases/kernel/syscalls/bind/bind06.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2018-18559
- *
- * Test for race condition vulnerability in bind() on AF_PACKET socket.
- * Fixed in:
- *
- * commit 15fe076edea787807a7cdc168df832544b58eba6
- * Author: Eric Dumazet <edumazet@google.com>
- * Date: Tue Nov 28 08:03:30 2017 -0800
- *
- * net/packet: fix a race in packet_bind() and packet_notifier()
- */
-
-#define _GNU_SOURCE
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <linux/if_packet.h>
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <sched.h>
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-
-static volatile int fd = -1;
-static struct sockaddr_ll addr1, addr2;
-static struct tst_fzsync_pair fzsync_pair;
-
-static void setup(void)
-{
- int real_uid = getuid();
- int real_gid = getgid();
- struct ifreq ifr;
-
- SAFE_UNSHARE(CLONE_NEWUSER);
- SAFE_UNSHARE(CLONE_NEWNET);
- SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
- SAFE_FILE_PRINTF("/proc/self/uid_map", "0 %d 1\n", real_uid);
- SAFE_FILE_PRINTF("/proc/self/gid_map", "0 %d 1\n", real_gid);
-
- fd = SAFE_SOCKET(AF_PACKET, SOCK_DGRAM, PF_PACKET);
- strcpy(ifr.ifr_name, "lo");
- SAFE_IOCTL(fd, SIOCGIFINDEX, &ifr);
- SAFE_CLOSE(fd);
-
- addr1.sll_family = AF_PACKET;
- addr1.sll_ifindex = ifr.ifr_ifindex;
- addr2.sll_family = AF_PACKET;
-
- fzsync_pair.exec_loops = 10000;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzsync_pair);
-}
-
-static void do_bind(void)
-{
- SAFE_BIND(fd, (struct sockaddr *)&addr1, sizeof(addr1));
- SAFE_BIND(fd, (struct sockaddr *)&addr2, sizeof(addr2));
-}
-
-static void *thread_run(void *arg)
-{
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- do_bind();
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- struct ifreq ifr;
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
- strcpy(ifr.ifr_name, "lo");
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- fd = SAFE_SOCKET(AF_PACKET, SOCK_DGRAM, PF_PACKET);
- ifr.ifr_flags = 0;
- ioctl(fd, SIOCSIFFLAGS, &ifr);
- ifr.ifr_flags = IFF_UP;
- tst_fzsync_start_race_a(&fzsync_pair);
- ioctl(fd, SIOCSIFFLAGS, &ifr);
- tst_fzsync_end_race_a(&fzsync_pair);
- SAFE_CLOSE(fd);
- }
-
- tst_res(TPASS, "Nothing bad happened (yet)");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .timeout = 600,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_USER_NS=y",
- "CONFIG_NET_NS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "15fe076edea7"},
- {"CVE", "2018-18559"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/bind/libbind.h b/testcases/kernel/syscalls/bind/libbind.h
deleted file mode 100644
index 58f1bb7e1..000000000
--- a/testcases/kernel/syscalls/bind/libbind.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 Martin Doucha <mdoucha@suse.cz>
- */
-
-/*
- * Common settings and data types for bind() connection tests
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-
-#define MAIN_SOCKET_FILE "test.sock"
-#define ABSTRACT_SOCKET_PATH "\0test.sock"
-#define PEER_SOCKET_FILE "peer.sock"
-#define IPV4_ADDRESS "127.0.0.1"
-#define BUFFER_SIZE 128
-
-struct test_case {
- int type, protocol;
- struct sockaddr *address;
- socklen_t addrlen;
- const char *description;
-};
diff --git a/testcases/kernel/syscalls/bpf/.gitignore b/testcases/kernel/syscalls/bpf/.gitignore
index 42365cef5..3c33a844b 100644
--- a/testcases/kernel/syscalls/bpf/.gitignore
+++ b/testcases/kernel/syscalls/bpf/.gitignore
@@ -2,5 +2,3 @@ bpf_map01
bpf_prog01
bpf_prog02
bpf_prog03
-bpf_prog04
-bpf_prog05
diff --git a/testcases/kernel/syscalls/bpf/Makefile b/testcases/kernel/syscalls/bpf/Makefile
index 4305dfcf0..990c8c83c 100644
--- a/testcases/kernel/syscalls/bpf/Makefile
+++ b/testcases/kernel/syscalls/bpf/Makefile
@@ -5,9 +5,6 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-FILTER_OUT_MAKE_TARGETS := bpf_common
CFLAGS += -D_GNU_SOURCE
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-$(MAKE_TARGETS): %: bpf_common.o
diff --git a/testcases/kernel/syscalls/bpf/bpf_common.c b/testcases/kernel/syscalls/bpf/bpf_common.c
deleted file mode 100644
index ba0829a75..000000000
--- a/testcases/kernel/syscalls/bpf/bpf_common.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2019-2020 Linux Test Project
- */
-
-#define TST_NO_DEFAULT_MAIN
-#include "tst_test.h"
-#include "bpf_common.h"
-
-void rlimit_bump_memlock(void)
-{
- struct rlimit memlock_r;
-
- SAFE_GETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
- memlock_r.rlim_cur += BPF_MEMLOCK_ADD;
- tst_res(TINFO, "Raising RLIMIT_MEMLOCK to %ld",
- (long)memlock_r.rlim_cur);
-
- if (memlock_r.rlim_cur <= memlock_r.rlim_max) {
- SAFE_SETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
- } else if ((geteuid() == 0)) {
- memlock_r.rlim_max += BPF_MEMLOCK_ADD;
- SAFE_SETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
- } else {
- tst_res(TINFO, "Can't raise RLIMIT_MEMLOCK, test may fail "
- "due to lack of max locked memory");
- }
-}
-
-int bpf_map_create(union bpf_attr *const attr)
-{
- int ret;
-
- ret = TST_RETRY_FUNC(bpf(BPF_MAP_CREATE, attr, sizeof(*attr)),
- TST_RETVAL_GE0);
-
- if (ret == -1) {
- if (errno == EPERM) {
- tst_res(TCONF, "Hint: check also /proc/sys/kernel/unprivileged_bpf_disabled");
- tst_brk(TCONF | TERRNO,
- "bpf() requires CAP_SYS_ADMIN on this system");
- } else {
- tst_brk(TBROK | TERRNO, "Failed to create array map");
- }
- }
-
- return ret;
-}
-
-int bpf_map_array_create(const uint32_t max_entries)
-{
- union bpf_attr map_attr = {
- .map_type = BPF_MAP_TYPE_ARRAY,
- .key_size = 4,
- .value_size = 8,
- .max_entries = max_entries,
- .map_flags = 0
- };
-
- return bpf_map_create(&map_attr);
-}
-
-void bpf_map_array_get(const int map_fd,
- const uint32_t *const array_indx,
- uint64_t *const array_val)
-{
- union bpf_attr elem_attr = {
- .map_fd = map_fd,
- .key = ptr_to_u64(array_indx),
- .value = ptr_to_u64(array_val),
- .flags = 0
- };
- const int ret = bpf(BPF_MAP_LOOKUP_ELEM, &elem_attr, sizeof(elem_attr));
-
- if (ret) {
- tst_brk(TBROK | TTERRNO,
- "Failed array map lookup: fd=%i [%"PRIu32"]",
- map_fd, *array_indx);
- }
-}
-
-void bpf_init_prog_attr(union bpf_attr *const attr,
- const struct bpf_insn *const prog,
- const size_t prog_size, char *const log_buf,
- const size_t log_size)
-{
- static struct bpf_insn *buf;
- static size_t buf_size;
- const size_t prog_len = prog_size / sizeof(*prog);
-
- /* all guarded buffers will be free()d automatically by LTP library */
- if (!buf || prog_size > buf_size) {
- buf = tst_alloc(prog_size);
- buf_size = prog_size;
- }
-
- memcpy(buf, prog, prog_size);
- memset(attr, 0, sizeof(*attr));
- attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
- attr->insns = ptr_to_u64(buf);
- attr->insn_cnt = prog_len;
- attr->license = ptr_to_u64("GPL");
- attr->log_buf = ptr_to_u64(log_buf);
- attr->log_size = log_size;
- attr->log_level = 1;
-}
-
-int bpf_load_prog(union bpf_attr *const attr, const char *const log)
-{
- const int ret = TST_RETRY_FUNC(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)),
- TST_RETVAL_GE0);
-
- if (ret >= 0) {
- tst_res(TPASS, "Loaded program");
- return ret;
- }
-
- if (ret != -1)
- tst_brk(TBROK, "Invalid bpf() return value: %d", ret);
-
- if (log[0] != 0)
- tst_brk(TBROK | TERRNO, "Failed verification: %s", log);
-
- tst_brk(TBROK | TERRNO, "Failed to load program");
- return ret;
-}
-
-void bpf_run_prog(const int prog_fd,
- const char *const msg, const size_t msg_len)
-{
- int sk[2];
-
- SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
- SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
- &prog_fd, sizeof(prog_fd));
-
- SAFE_WRITE(1, sk[0], msg, msg_len);
-
- SAFE_CLOSE(sk[0]);
- SAFE_CLOSE(sk[1]);
-}
diff --git a/testcases/kernel/syscalls/bpf/bpf_common.h b/testcases/kernel/syscalls/bpf/bpf_common.h
index 39764ba1f..f700bede2 100644
--- a/testcases/kernel/syscalls/bpf/bpf_common.h
+++ b/testcases/kernel/syscalls/bpf/bpf_common.h
@@ -1,63 +1,47 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
- * Copyright (c) 2019-2020 Linux Test Project
+ * Copyright (c) 2019 Linux Test Project
*/
#ifndef LTP_BPF_COMMON_H
#define LTP_BPF_COMMON_H
-#include <sys/types.h>
-#include <inttypes.h>
-
-#include "lapi/bpf.h"
-#include "lapi/socket.h"
-
-#define BPF_MEMLOCK_ADD (2*1024*1024)
-
-/* map[array_indx] = reg_to_save
- *
- * Inserts the following instructions
- *
- * r1 = map_fd
- * r2 = fp
- * r2 = r2 - 4
- * r2 = array_indx
- * call map_lookup_elem(r1, r2)
- * if r0 != 0 goto pc+1
- * exit
- * *r0 = reg_to_save
- *
- */
-#define BPF_MAP_ARRAY_STX(map_fd, array_indx, reg_to_save)\
- BPF_LD_MAP_FD(BPF_REG_1, map_fd), \
- BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), \
- BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4), \
- BPF_ST_MEM(BPF_W, BPF_REG_2, 0, array_indx), \
- BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), \
- BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), \
- BPF_EXIT_INSN(), \
- BPF_STX_MEM(BPF_DW, BPF_REG_0, reg_to_save, 0)
-
-void rlimit_bump_memlock(void);
-
-int bpf_map_create(union bpf_attr *const attr)
- __attribute__((nonnull, warn_unused_result));
-int bpf_map_array_create(const uint32_t max_entries)
- __attribute__((warn_unused_result));
-void bpf_map_array_get(const int map_fd,
- const uint32_t *const array_indx,
- uint64_t *const array_val)
- __attribute__((nonnull));
-
-void bpf_init_prog_attr(union bpf_attr *const attr,
- const struct bpf_insn *const prog,
- const size_t prog_size,
- char *const log_buf, const size_t log_size)
- __attribute__((nonnull));
-int bpf_load_prog(union bpf_attr *const attr, const char *const log)
- __attribute__((nonnull, warn_unused_result));
-void bpf_run_prog(const int prog_fd,
- const char *const msg, const size_t msg_len)
- __attribute__((nonnull));
+#define BPF_MEMLOCK_ADD (256*1024)
+
+void rlimit_bump_memlock(void)
+{
+ struct rlimit memlock_r;
+
+ SAFE_GETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
+ memlock_r.rlim_cur += BPF_MEMLOCK_ADD;
+ tst_res(TINFO, "Raising RLIMIT_MEMLOCK to %ld",
+ (long)memlock_r.rlim_cur);
+
+ if (memlock_r.rlim_cur <= memlock_r.rlim_max) {
+ SAFE_SETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
+ } else if ((geteuid() == 0)) {
+ memlock_r.rlim_max += BPF_MEMLOCK_ADD;
+ SAFE_SETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
+ } else {
+ tst_res(TINFO, "Can't raise RLIMIT_MEMLOCK, test may fail "
+ "due to lack of max locked memory");
+ }
+}
+
+int bpf_map_create(union bpf_attr *attr)
+{
+ TEST(bpf(BPF_MAP_CREATE, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ if (TST_ERR == EPERM) {
+ tst_res(TCONF, "Hint: check also /proc/sys/kernel/unprivileged_bpf_disabled");
+ tst_brk(TCONF | TTERRNO,
+ "bpf() requires CAP_SYS_ADMIN on this system");
+ } else {
+ tst_brk(TBROK | TTERRNO, "Failed to create array map");
+ }
+ }
+
+ return TST_RET;
+}
#endif
diff --git a/testcases/kernel/syscalls/bpf/bpf_map01.c b/testcases/kernel/syscalls/bpf/bpf_map01.c
index 94f9b7873..69473cd04 100644
--- a/testcases/kernel/syscalls/bpf/bpf_map01.c
+++ b/testcases/kernel/syscalls/bpf/bpf_map01.c
@@ -16,6 +16,7 @@
#include "config.h"
#include "tst_test.h"
+#include "lapi/bpf.h"
#include "bpf_common.h"
#define VAL_SZ 1024
@@ -82,7 +83,7 @@ void run(unsigned int n)
if (i < VAL_SZ)
tst_res(TPASS, "Preallocated array map lookup");
} else {
- tst_res(TFAIL | TTERRNO, "Prellocated array map lookup");
+ tst_res(TFAIL | TERRNO, "Prellocated array map lookup");
}
break;
}
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog01.c b/testcases/kernel/syscalls/bpf/bpf_prog01.c
index e2fc80a9f..46a909fe2 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog01.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog01.c
@@ -25,69 +25,123 @@
#include "config.h"
#include "tst_test.h"
+#include "lapi/socket.h"
+#include "lapi/bpf.h"
#include "bpf_common.h"
const char MSG[] = "Ahoj!";
static char *msg;
+/*
+ * The following is a byte code template. We copy it to a guarded buffer and
+ * substitute the runtime value of our map file descriptor.
+ *
+ * r0 - r10 = registers 0 to 10
+ * r0 = return code
+ * r1 - r5 = scratch registers, used for function arguments
+ * r6 - r9 = registers preserved across function calls
+ * fp/r10 = stack frame pointer
+ */
+const struct bpf_insn PROG[] = {
+ /* Load the map FD into r1 (place holder) */
+ BPF_LD_MAP_FD(BPF_REG_1, 0),
+ /* Put (key = 0) on stack and key ptr into r2 */
+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), /* r2 = fp */
+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), /* r2 = r2 - 8 */
+ BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), /* *r2 = 0 */
+ /* r0 = bpf_map_lookup_elem(r1, r2) */
+ BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
+ /* if r0 == 0 goto exit */
+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 3),
+ /* Set map[0] = 1 */
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), /* r1 = r0 */
+ BPF_ST_MEM(BPF_DW, BPF_REG_1, 0, 1), /* *r1 = 1 */
+ BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */
+ BPF_EXIT_INSN(), /* return r0 */
+};
+
+static struct bpf_insn *prog;
static char *log;
static union bpf_attr *attr;
int load_prog(int fd)
{
- /*
- * The following is a byte code template. We copy it to a guarded buffer and
- * substitute the runtime value of our map file descriptor.
- *
- * r0 - r10 = registers 0 to 10
- * r0 = return code
- * r1 - r5 = scratch registers, used for function arguments
- * r6 - r9 = registers preserved across function calls
- * fp/r10 = stack frame pointer
- */
- struct bpf_insn PROG[] = {
- /* Load the map FD into r1 (place holder) */
- BPF_LD_MAP_FD(BPF_REG_1, fd),
- /* Put (key = 0) on stack and key ptr into r2 */
- BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), /* r2 = fp */
- BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), /* r2 = r2 - 8 */
- BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), /* *r2 = 0 */
- /* r0 = bpf_map_lookup_elem(r1, r2) */
- BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
- /* if r0 == 0 goto exit */
- BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 3),
- /* Set map[0] = 1 */
- BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), /* r1 = r0 */
- BPF_ST_MEM(BPF_DW, BPF_REG_1, 0, 1), /* *r1 = 1 */
- BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */
- BPF_EXIT_INSN(), /* return r0 */
- };
-
- bpf_init_prog_attr(attr, PROG, sizeof(PROG), log, BUFSIZ);
- return bpf_load_prog(attr, log);
+ prog[0] = BPF_LD_MAP_FD(BPF_REG_1, fd);
+
+ memset(attr, 0, sizeof(*attr));
+ attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+ attr->insns = ptr_to_u64(prog);
+ attr->insn_cnt = ARRAY_SIZE(PROG);
+ attr->license = ptr_to_u64("GPL");
+ attr->log_buf = ptr_to_u64(log);
+ attr->log_size = BUFSIZ;
+ attr->log_level = 1;
+
+ TEST(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ if (log[0] != 0) {
+ tst_brk(TFAIL | TTERRNO,
+ "Failed verification: %s",
+ log);
+ } else {
+ tst_brk(TFAIL | TTERRNO, "Failed to load program");
+ }
+ } else {
+ tst_res(TPASS, "Loaded program");
+ }
+
+ return TST_RET;
}
void setup(void)
{
rlimit_bump_memlock();
+ memcpy(prog, PROG, sizeof(PROG));
memcpy(msg, MSG, sizeof(MSG));
}
void run(void)
{
int map_fd, prog_fd;
+ int sk[2];
uint32_t key = 0;
uint64_t val;
- map_fd = bpf_map_array_create(1);
+ memset(attr, 0, sizeof(*attr));
+ attr->map_type = BPF_MAP_TYPE_ARRAY;
+ attr->key_size = 4;
+ attr->value_size = 8;
+ attr->max_entries = 1;
+
+ TEST(bpf(BPF_MAP_CREATE, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ if (TST_ERR == EPERM) {
+ tst_brk(TCONF | TTERRNO,
+ "bpf() requires CAP_SYS_ADMIN on this system");
+ } else {
+ tst_brk(TBROK | TTERRNO, "Failed to create array map");
+ }
+ }
+ map_fd = TST_RET;
+
prog_fd = load_prog(map_fd);
- bpf_run_prog(prog_fd, msg, sizeof(MSG));
- SAFE_CLOSE(prog_fd);
+ SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
+ SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
+ &prog_fd, sizeof(prog_fd));
+
+ SAFE_WRITE(1, sk[0], msg, sizeof(MSG));
- bpf_map_array_get(map_fd, &key, &val);
- if (val != 1) {
+ memset(attr, 0, sizeof(*attr));
+ attr->map_fd = map_fd;
+ attr->key = ptr_to_u64(&key);
+ attr->value = ptr_to_u64(&val);
+
+ TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TTERRNO, "array map lookup");
+ } else if (val != 1) {
tst_res(TFAIL,
"val = %lu, but should be val = 1",
val);
@@ -95,7 +149,10 @@ void run(void)
tst_res(TPASS, "val = 1");
}
+ SAFE_CLOSE(prog_fd);
SAFE_CLOSE(map_fd);
+ SAFE_CLOSE(sk[0]);
+ SAFE_CLOSE(sk[1]);
}
static struct tst_test test = {
@@ -104,6 +161,7 @@ static struct tst_test test = {
.min_kver = "3.19",
.bufs = (struct tst_buffers []) {
{&log, .size = BUFSIZ},
+ {&prog, .size = sizeof(PROG)},
{&attr, .size = sizeof(*attr)},
{&msg, .size = sizeof(MSG)},
{},
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog02.c b/testcases/kernel/syscalls/bpf/bpf_prog02.c
index b40ea0f1d..acff1884a 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog02.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog02.c
@@ -21,6 +21,8 @@
#include "config.h"
#include "tst_test.h"
#include "tst_capability.h"
+#include "lapi/socket.h"
+#include "lapi/bpf.h"
#include "bpf_common.h"
#define A64INT (((uint64_t)1) << 60)
@@ -35,6 +37,7 @@ static union bpf_attr *attr;
static int load_prog(int fd)
{
+ static struct bpf_insn *prog;
struct bpf_insn insn[] = {
BPF_MOV64_IMM(BPF_REG_6, 1), /* 0: r6 = 1 */
@@ -64,8 +67,31 @@ static int load_prog(int fd)
BPF_EXIT_INSN(), /* 26: return r0 */
};
- bpf_init_prog_attr(attr, insn, sizeof(insn), log, BUFSIZ);
- return bpf_load_prog(attr, log);
+ if (!prog)
+ prog = tst_alloc(sizeof(insn));
+ memcpy(prog, insn, sizeof(insn));
+
+ memset(attr, 0, sizeof(*attr));
+ attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+ attr->insns = ptr_to_u64(prog);
+ attr->insn_cnt = ARRAY_SIZE(insn);
+ attr->license = ptr_to_u64("GPL");
+ attr->log_buf = ptr_to_u64(log);
+ attr->log_size = BUFSIZ;
+ attr->log_level = 1;
+
+ TEST(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ if (log[0] != 0) {
+ tst_res(TINFO, "Verification log:");
+ fputs(log, stderr);
+ tst_brk(TBROK | TTERRNO, "Failed verification");
+ } else {
+ tst_brk(TBROK | TTERRNO, "Failed to load program");
+ }
+ }
+
+ return TST_RET;
}
static void setup(void)
@@ -77,33 +103,67 @@ static void setup(void)
static void run(void)
{
int map_fd, prog_fd;
+ int sk[2];
+
+ memset(attr, 0, sizeof(*attr));
+ attr->map_type = BPF_MAP_TYPE_ARRAY;
+ attr->key_size = 4;
+ attr->value_size = 8;
+ attr->max_entries = 2;
+
+ map_fd = bpf_map_create(attr);
- map_fd = bpf_map_array_create(2);
prog_fd = load_prog(map_fd);
- bpf_run_prog(prog_fd, msg, sizeof(MSG));
- SAFE_CLOSE(prog_fd);
- *key = 0;
- bpf_map_array_get(map_fd, key, val);
+ SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
+ SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
+ &prog_fd, sizeof(prog_fd));
+
+ SAFE_WRITE(1, sk[0], msg, sizeof(MSG));
+
+ memset(attr, 0, sizeof(*attr));
+ attr->map_fd = map_fd;
+ attr->key = ptr_to_u64(key);
+ attr->value = ptr_to_u64(val);
+ *key = 0;
+
+ TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TTERRNO, "array map lookup");
+ goto exit;
+ }
+
if (*val != A64INT + 1) {
tst_res(TFAIL,
"val = %"PRIu64", but should be val = %"PRIu64" + 1",
*val, A64INT);
- } else {
- tst_res(TPASS, "val = %"PRIu64" + 1", A64INT);
+ goto exit;
}
+ tst_res(TPASS, "val = %"PRIu64" + 1", A64INT);
+
*key = 1;
- bpf_map_array_get(map_fd, key, val);
+
+ TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TTERRNO, "array map lookup");
+ goto exit;
+ }
+
if (*val != A64INT - 1) {
tst_res(TFAIL,
"val = %"PRIu64", but should be val = %"PRIu64" - 1",
*val, A64INT);
- } else {
- tst_res(TPASS, "val = %"PRIu64" - 1", A64INT);
+ goto exit;
}
+ tst_res(TPASS, "val = %"PRIu64" - 1", A64INT);
+
+exit:
+ SAFE_CLOSE(prog_fd);
SAFE_CLOSE(map_fd);
+ SAFE_CLOSE(sk[0]);
+ SAFE_CLOSE(sk[1]);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog03.c b/testcases/kernel/syscalls/bpf/bpf_prog03.c
index 35bb841c7..d79815961 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog03.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog03.c
@@ -26,12 +26,12 @@
#include "config.h"
#include "tst_test.h"
#include "tst_capability.h"
+#include "lapi/socket.h"
+#include "lapi/bpf.h"
#include "bpf_common.h"
#define LOG_SIZE (1024 * 1024)
-#define CHECK_BPF_RET(x) ((x) >= 0 || ((x) == -1 && errno != EPERM))
-
static const char MSG[] = "Ahoj!";
static char *msg;
@@ -42,8 +42,7 @@ static union bpf_attr *attr;
static int load_prog(int fd)
{
- int ret;
-
+ static struct bpf_insn *prog;
struct bpf_insn insn[] = {
BPF_LD_MAP_FD(BPF_REG_1, fd),
@@ -86,24 +85,31 @@ static int load_prog(int fd)
BPF_EXIT_INSN()
};
- bpf_init_prog_attr(attr, insn, sizeof(insn), log, LOG_SIZE);
- ret = TST_RETRY_FUNC(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)),
- CHECK_BPF_RET);
-
- if (ret < -1)
- tst_brk(TBROK, "Invalid bpf() return value %d", ret);
+ if (!prog)
+ prog = tst_alloc(sizeof(insn));
+ memcpy(prog, insn, sizeof(insn));
- if (ret >= 0) {
+ memset(attr, 0, sizeof(*attr));
+ attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+ attr->insns = ptr_to_u64(prog);
+ attr->insn_cnt = ARRAY_SIZE(insn);
+ attr->license = ptr_to_u64("GPL");
+ attr->log_buf = ptr_to_u64(log);
+ attr->log_size = LOG_SIZE;
+ attr->log_level = 1;
+
+ TEST(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)));
+ if (TST_RET == -1) {
+ if (log[0] != 0)
+ tst_res(TPASS | TTERRNO, "Failed verification");
+ else
+ tst_brk(TBROK | TTERRNO, "Failed to load program");
+ } else {
tst_res(TINFO, "Verification log:");
fputs(log, stderr);
- return ret;
}
- if (log[0] == 0)
- tst_brk(TBROK | TERRNO, "Failed to load program");
-
- tst_res(TPASS | TERRNO, "Failed verification");
- return ret;
+ return TST_RET;
}
static void setup(void)
@@ -115,8 +121,15 @@ static void setup(void)
static void run(void)
{
int map_fd, prog_fd;
+ int sk[2];
- map_fd = bpf_map_array_create(32);
+ memset(attr, 0, sizeof(*attr));
+ attr->map_type = BPF_MAP_TYPE_ARRAY;
+ attr->key_size = 4;
+ attr->value_size = 8;
+ attr->max_entries = 32;
+
+ map_fd = bpf_map_create(attr);
memset(attr, 0, sizeof(*attr));
attr->map_fd = map_fd;
@@ -134,12 +147,27 @@ static void run(void)
tst_res(TFAIL, "Loaded bad eBPF, now we will run it and maybe crash");
- bpf_run_prog(prog_fd, msg, sizeof(MSG));
- SAFE_CLOSE(prog_fd);
+ SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
+ SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
+ &prog_fd, sizeof(prog_fd));
+
+ SAFE_WRITE(1, sk[0], msg, sizeof(MSG));
+ memset(attr, 0, sizeof(*attr));
+ attr->map_fd = map_fd;
+ attr->key = ptr_to_u64(key);
+ attr->value = ptr_to_u64(val);
*key = 0;
- bpf_map_array_get(map_fd, key, val);
- tst_res(TINFO, "Pointer offset was 0x%"PRIx64, *val);
+
+ TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+ if (TST_RET == -1)
+ tst_res(TFAIL | TTERRNO, "array map lookup");
+ else
+ tst_res(TINFO, "Pointer offset was 0x%"PRIx64, *val);
+
+ SAFE_CLOSE(sk[0]);
+ SAFE_CLOSE(sk[1]);
+ SAFE_CLOSE(prog_fd);
exit:
SAFE_CLOSE(map_fd);
}
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog04.c b/testcases/kernel/syscalls/bpf/bpf_prog04.c
deleted file mode 100644
index ebee26cbc..000000000
--- a/testcases/kernel/syscalls/bpf/bpf_prog04.c
+++ /dev/null
@@ -1,129 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (c) 2018 Jann Horn <jannh@google.com>
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE 2018-18445
- *
- * Check that eBPF verifier correctly handles 32-bit arithmetic, in particular
- * the right bit shift instruction. It is an error if the BPF program passes
- * verification regardless of whether it then causes any actual damage. Kernel
- * bug fixed in:
- *
- * commit b799207e1e1816b09e7a5920fbb2d5fcf6edd681
- * Author: Jann Horn <jannh@google.com>
- * Date: Fri Oct 5 18:17:59 2018 +0200
- *
- * bpf: 32-bit RSH verification must truncate input before the ALU op
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#include "config.h"
-#include "tst_test.h"
-#include "tst_taint.h"
-#include "tst_capability.h"
-#include "bpf_common.h"
-
-#define BUFSIZE 8192
-#define CHECK_BPF_RET(x) ((x) >= 0 || ((x) == -1 && errno != EACCES))
-
-static const char MSG[] = "Ahoj!";
-static char *msg;
-
-static char *log;
-static union bpf_attr *attr;
-
-static int load_prog(int fd)
-{
- int ret;
- struct bpf_insn insn[] = {
- BPF_MOV64_IMM(BPF_REG_8, 2),
- BPF_ALU64_IMM(BPF_LSH, BPF_REG_8, 31),
- BPF_ALU32_IMM(BPF_RSH, BPF_REG_8, 31),
- BPF_ALU32_IMM(BPF_SUB, BPF_REG_8, 2),
-
- // store r8 into map
- BPF_LD_MAP_FD(BPF_REG_1, fd),
- BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
- BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4),
- BPF_ST_MEM(BPF_W, BPF_REG_2, 0, 0),
- BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
- BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1),
- BPF_EXIT_INSN(),
- BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_8),
- BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_8, 0),
-
- BPF_MOV64_IMM(BPF_REG_0, 0),
- BPF_EXIT_INSN()
- };
-
- bpf_init_prog_attr(attr, insn, sizeof(insn), log, BUFSIZE);
- ret = TST_RETRY_FUNC(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)),
- CHECK_BPF_RET);
-
- if (ret >= 0) {
- tst_res(TINFO, "Verification log:");
- fputs(log, stderr);
- return ret;
- }
-
- if (ret < -1)
- tst_brk(TBROK, "Invalid bpf() return value %d", ret);
-
- if (!*log)
- tst_brk(TBROK | TERRNO, "Failed to load BPF program");
-
- tst_res(TPASS | TERRNO, "BPF program failed verification");
- return ret;
-}
-
-static void setup(void)
-{
- rlimit_bump_memlock();
- memcpy(msg, MSG, sizeof(MSG));
-}
-
-static void run(void)
-{
- int map_fd, prog_fd;
-
- map_fd = bpf_map_array_create(1);
- prog_fd = load_prog(map_fd);
-
- if (prog_fd >= 0) {
- tst_res(TFAIL, "Malicious eBPF code passed verification. "
- "Now let's try crashing the kernel.");
- bpf_run_prog(prog_fd, msg, sizeof(MSG));
- }
-
- if (prog_fd >= 0)
- SAFE_CLOSE(prog_fd);
-
- SAFE_CLOSE(map_fd);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .min_kver = "3.18",
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
- {}
- },
- .bufs = (struct tst_buffers []) {
- {&log, .size = BUFSIZE},
- {&attr, .size = sizeof(*attr)},
- {&msg, .size = sizeof(MSG)},
- {}
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "b799207e1e18"},
- {"CVE", "2018-18445"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog05.c b/testcases/kernel/syscalls/bpf/bpf_prog05.c
deleted file mode 100644
index b2792c505..000000000
--- a/testcases/kernel/syscalls/bpf/bpf_prog05.c
+++ /dev/null
@@ -1,178 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (c) 2021 SUSE LLC <rpalethorpe@suse.com>
- */
-
-/*\
- * [Description]
- *
- * Compare the effects of 32-bit div/mod by zero with the "expected"
- * behaviour.
- *
- * The commit "bpf: fix subprog verifier bypass by div/mod by 0
- * exception", changed div/mod by zero from exiting the current
- * program to setting the destination register to zero (div) or
- * leaving it untouched (mod).
- *
- * This solved one verfier bug which allowed dodgy pointer values, but
- * it turned out that the source register was being 32-bit truncated
- * when it should not be. Also the destination register for mod was
- * not being truncated when it should be.
- *
- * So then we have the following two fixes:
- * "bpf: Fix 32 bit src register truncation on div/mod"
- * "bpf: Fix truncation handling for mod32 dst reg wrt zero"
- *
- * Testing for all of these issues is a problem. Not least because
- * division by zero is undefined, so in theory any result is
- * acceptable so long as the verifier and runtime behaviour
- * match.
- *
- * However to keep things simple we just check if the source and
- * destination register runtime values match the current upstream
- * behaviour at the time of writing.
- *
- * If the test fails you may have one or more of the above patches
- * missing. In this case it is possible that you are not vulnerable
- * depending on what other backports and fixes have been applied. If
- * upstream changes the behaviour of division by zero, then the test
- * will need updating.
- *
- * Note that we use r6 as the src register and r7 as the dst. w6 and
- * w7 are the same registers treated as 32bit.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "tst_test.h"
-#include "tst_taint.h"
-#include "tst_capability.h"
-#include "bpf_common.h"
-
-#define BUFSIZE 8192
-
-static const char MSG[] = "Ahoj!";
-static char *msg;
-
-static int map_fd;
-static uint32_t *key;
-static uint64_t *val;
-static char *log;
-static union bpf_attr *attr;
-
-static int load_prog(void)
-{
- const struct bpf_insn prog_insn[] = {
- /* r6 = 1 << 32
- * r7 = -1
- */
- BPF_LD_IMM64(BPF_REG_6, 1ULL << 32),
- BPF_MOV64_IMM(BPF_REG_7, -1LL),
-
- /* w7 /= w6 */
- BPF_ALU32_REG(BPF_DIV, BPF_REG_7, BPF_REG_6),
-
- /* map[1] = r6
- * map[2] = r7
- */
- BPF_MAP_ARRAY_STX(map_fd, 0, BPF_REG_6),
- BPF_MAP_ARRAY_STX(map_fd, 1, BPF_REG_7),
-
- /* r6 = 1 << 32
- * r7 = -1
- */
- BPF_LD_IMM64(BPF_REG_6, 1ULL << 32),
- BPF_MOV64_IMM(BPF_REG_7, -1LL),
-
- /* w7 %= w6 */
- BPF_ALU32_REG(BPF_MOD, BPF_REG_7, BPF_REG_6),
-
- /* map[3] = r6
- * map[4] = r7
- */
- BPF_MAP_ARRAY_STX(map_fd, 2, BPF_REG_6),
- BPF_MAP_ARRAY_STX(map_fd, 3, BPF_REG_7),
-
- /* exit(0) */
- BPF_MOV64_IMM(BPF_REG_0, 0),
- BPF_EXIT_INSN()
- };
-
- bpf_init_prog_attr(attr, prog_insn, sizeof(prog_insn), log, BUFSIZE);
-
- return bpf_load_prog(attr, log);
-}
-
-static void expect_reg_val(const char *const reg_name,
- const uint64_t expected_val)
-{
- bpf_map_array_get(map_fd, key, val);
-
- (*key)++;
-
- if (*val != expected_val) {
- tst_res(TFAIL,
- "%s = %"PRIu64", but should be %"PRIu64,
- reg_name, *val, expected_val);
- } else {
- tst_res(TPASS, "%s = %"PRIu64, reg_name, *val);
- }
-}
-
-static void setup(void)
-{
- rlimit_bump_memlock();
- memcpy(msg, MSG, sizeof(MSG));
-}
-
-static void run(void)
-{
- int prog_fd;
-
- map_fd = bpf_map_array_create(4);
- prog_fd = load_prog();
- bpf_run_prog(prog_fd, msg, sizeof(MSG));
- SAFE_CLOSE(prog_fd);
-
- *key = 0;
-
- tst_res(TINFO, "Check w7(-1) /= w6(0) [r7 = -1, r6 = 1 << 32]");
- expect_reg_val("src(r6)", 1ULL << 32);
- expect_reg_val("dst(r7)", 0);
-
- tst_res(TINFO, "Check w7(-1) %%= w6(0) [r7 = -1, r6 = 1 << 32]");
- expect_reg_val("src(r6)", 1ULL << 32);
- expect_reg_val("dst(r7)", (uint32_t)-1);
-
- SAFE_CLOSE(map_fd);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .min_kver = "3.18",
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
- {}
- },
- .bufs = (struct tst_buffers []) {
- {&key, .size = sizeof(*key)},
- {&val, .size = sizeof(*val)},
- {&log, .size = BUFSIZE},
- {&attr, .size = sizeof(*attr)},
- {&msg, .size = sizeof(MSG)},
- {}
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "f6b1b3bf0d5f"},
- {"linux-git", "468f6eafa6c4"},
- {"linux-git", "e88b2c6e5a4d"},
- {"linux-git", "9b00f1b78809"},
- {"CVE", "CVE-2021-3444"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/brk/.gitignore b/testcases/kernel/syscalls/brk/.gitignore
index 60e16e591..b16ea36c7 100644
--- a/testcases/kernel/syscalls/brk/.gitignore
+++ b/testcases/kernel/syscalls/brk/.gitignore
@@ -1,2 +1 @@
/brk01
-/brk02
diff --git a/testcases/kernel/syscalls/brk/Makefile b/testcases/kernel/syscalls/brk/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/brk/Makefile
+++ b/testcases/kernel/syscalls/brk/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/brk/brk01.c b/testcases/kernel/syscalls/brk/brk01.c
index a9b89bce5..c50791d40 100644
--- a/testcases/kernel/syscalls/brk/brk01.c
+++ b/testcases/kernel/syscalls/brk/brk01.c
@@ -31,9 +31,12 @@ void verify_brk(void)
break;
}
- TST_EXP_PASS_SILENT(brk((void *)new_brk), "brk()");
- if (!TST_PASS)
+ TEST(brk((void *)new_brk));
+
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TERRNO, "brk() failed");
return;
+ }
cur_brk = (uintptr_t)sbrk(0);
diff --git a/testcases/kernel/syscalls/brk/brk02.c b/testcases/kernel/syscalls/brk/brk02.c
deleted file mode 100644
index 11e803cb4..000000000
--- a/testcases/kernel/syscalls/brk/brk02.c
+++ /dev/null
@@ -1,60 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Liam R. Howlett <liam.howlett@oracle.com>
- */
-
-/*\
- * [Description]
- * Expand brk() by at least 2 pages to ensure there is a newly created VMA
- * and not expanding the original due to multiple anon pages. mprotect() that
- * new VMA then brk() back to the original address therefore causing a munmap of
- * at least one full VMA.
- */
-
-#include <unistd.h>
-#include <sys/mman.h>
-#include "tst_test.h"
-
-void brk_down_vmas(void)
-{
- void *brk_addr = sbrk(0);
-
- if (brk_addr == (void *) -1)
- tst_brk(TBROK, "sbrk() failed");
-
- unsigned long page_size = getpagesize();
- void *addr = brk_addr + page_size;
-
- if (brk(addr)) {
- tst_res(TFAIL | TERRNO, "Cannot expand brk() by page size");
- return;
- }
-
- addr += page_size;
- if (brk(addr)) {
- tst_res(TFAIL | TERRNO, "Cannot expand brk() by 2x page size");
- return;
- }
-
- if (mprotect(addr - page_size, page_size, PROT_READ)) {
- tst_res(TFAIL | TERRNO, "Cannot mprotect new VMA");
- return;
- }
-
- addr += page_size;
- if (brk(addr)) {
- tst_res(TFAIL | TERRNO, "Cannot expand brk() after mprotect");
- return;
- }
-
- if (brk(brk_addr)) {
- tst_res(TFAIL | TERRNO, "Cannot restore brk() to start address");
- return;
- }
-
- tst_res(TPASS, "munmap at least two VMAs of brk() passed");
-}
-
-static struct tst_test test = {
- .test_all = brk_down_vmas,
-};
diff --git a/testcases/kernel/syscalls/cacheflush/Makefile b/testcases/kernel/syscalls/cacheflush/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/cacheflush/Makefile
+++ b/testcases/kernel/syscalls/cacheflush/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/cacheflush/cacheflush01.c b/testcases/kernel/syscalls/cacheflush/cacheflush01.c
index 3daaff624..29cf2014a 100644
--- a/testcases/kernel/syscalls/cacheflush/cacheflush01.c
+++ b/testcases/kernel/syscalls/cacheflush/cacheflush01.c
@@ -1,60 +1,157 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
+/******************************************************************************/
+/* Copyright (c) Maxin John <maxin.john@gmail.com>, 2009 */
+/* LKML Reference: http://lkml.org/lkml/2009/4/9/203 */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/******************************************************************************/
+/******************************************************************************/
+/* */
+/* File: cacheflush01.c */
+/* */
+/* Description: The cacheflush_check() syscall */
+/* Tests EINVAL error of cacheflush system call. */
+/* Its expected behaviour is cacheflush() should return -EINVAL */
+/* when cache parameter is not one of ICACHE, DCACHE, or BCACHE. */
+/* */
+/* Usage: <for command-line> */
+/* cacheflush01 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 1 */
+/* */
+/* Test Name: cacheflush01 */
+/******************************************************************************/
-#include "tst_test.h"
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "test.h"
#include "lapi/syscalls.h"
#if __NR_cacheflush != __LTP__NR_INVALID_SYSCALL
-
#include <asm/cachectl.h>
-
-/*
- * m68k does not have these constants
- */
-
+#else
#ifndef ICACHE
-# define ICACHE (1<<0)
+#define ICACHE (1<<0) /* flush instruction cache */
#endif
-
#ifndef DCACHE
-# define DCACHE (1<<1)
+#define DCACHE (1<<1) /* writeback and flush data cache */
#endif
-
#ifndef BCACHE
-# define BCACHE (ICACHE|DCACHE)
+#define BCACHE (ICACHE|DCACHE) /* flush both caches */
+#endif
#endif
-#define CACHE_DESC(x) .cache = x, .desc = #x
+char *TCID = "cacheflush01";
+int TST_TOTAL = 1;
-static struct test_case_t {
- int cache;
- const char *desc;
-} test_cases[] = {
- { CACHE_DESC(ICACHE) },
- { CACHE_DESC(DCACHE) },
- { CACHE_DESC(BCACHE) },
-};
+/* Extern Global Functions */
+/******************************************************************************/
+/* */
+/* Function: cleanup */
+/* */
+/* Description: Performs all one time clean up for this test on successful */
+/* completion, premature exit or failure. Closes all temporary */
+/* files, removes all temporary directories exits the test with */
+/* appropriate return code by calling tst_exit() function. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */
+/* On success - Exits calling tst_exit(). With '0' return code. */
+/* */
+/******************************************************************************/
+void cleanup(void)
+{
-static char *addr;
+ tst_rmdir();
+}
-static void setup(void)
+/* Local Functions */
+/******************************************************************************/
+/* */
+/* Function: setup */
+/* */
+/* Description: Performs all one time setup for this test. This function is */
+/* typically used to capture signals, create temporary dirs */
+/* and temporary files that may be used in the course of this */
+/* test. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits by calling cleanup(). */
+/* On success - returns 0. */
+/* */
+/******************************************************************************/
+void setup(void)
{
- addr = SAFE_MALLOC(getpagesize());
+ /* Capture signals if any */
+ /* Create temporary directories */
+ TEST_PAUSE;
+ tst_tmpdir();
}
-static void test_cacheflush(unsigned int i)
+int main(int ac, char **av)
{
- struct test_case_t *tc = &test_cases[i];
- TST_EXP_PASS(tst_syscall(__NR_cacheflush, addr, getpagesize(), tc->cache),
- "%s", tc->desc);
-}
+ char *addr = NULL;
-static struct tst_test test = {
- .setup = setup,
- .test = test_cacheflush,
- .tcnt = ARRAY_SIZE(test_cases),
-};
+ tst_parse_opts(ac, av, NULL, NULL);
-#else
- TST_TEST_TCONF("system doesn't support cacheflush()");
-#endif
+ setup();
+
+ tst_count = 0;
+ /* Create some user address range */
+ addr = malloc(getpagesize());
+ if (addr == NULL) {
+ tst_brkm(TFAIL | TTERRNO, cleanup, "malloc failed");
+ }
+
+ /* Invokes cacheflush() with proper parameters */
+ TEST(ltp_syscall(__NR_cacheflush, addr, getpagesize(), ICACHE));
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "passed with no errno");
+ } else {
+ tst_resm(TFAIL, "failed with unexpected errno");
+ }
+
+ TEST(ltp_syscall(__NR_cacheflush, addr, getpagesize(), DCACHE));
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "passed with no errno");
+ } else {
+ tst_resm(TFAIL, "failed with unexpected errno");
+ }
+
+ TEST(ltp_syscall(__NR_cacheflush, addr, getpagesize(), BCACHE));
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "passed with no errno");
+ } else {
+ tst_resm(TFAIL, "failed with unexpected errno");
+ }
+
+ cleanup();
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/capget/Makefile b/testcases/kernel/syscalls/capget/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/capget/Makefile
+++ b/testcases/kernel/syscalls/capget/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/capget/capget01.c b/testcases/kernel/syscalls/capget/capget01.c
index 6c17a7c7c..f3767594b 100644
--- a/testcases/kernel/syscalls/capget/capget01.c
+++ b/testcases/kernel/syscalls/capget/capget01.c
@@ -20,20 +20,25 @@ static struct tcase {
int version;
char *message;
} tcases[] = {
- {0x19980330, "LINUX_CAPABILITY_VERSION_1"},
- {0x20071026, "LINUX_CAPABILITY_VERSION_2"},
- {0x20080522, "LINUX_CAPABILITY_VERSION_3"},
+ {0x19980330, "Test on LINUX_CAPABILITY_VERSION_1"},
+ {0x20071026, "Test on LINUX_CAPABILITY_VERSION_2"},
+ {0x20080522, "Test on LINUX_CAPABILITY_VERSION_3"},
};
static void verify_capget(unsigned int n)
{
struct tcase *tc = &tcases[n];
+ tst_res(TINFO, "%s", tc->message);
+
hdr->version = tc->version;
hdr->pid = pid;
-
- TST_EXP_PASS(tst_syscall(__NR_capget, hdr, data),
- "capget() with %s", tc->message);
+ TEST(tst_syscall(__NR_capget, hdr, data));
+ if (TST_RET == 0)
+ tst_res(TPASS, "capget() returned %ld", TST_RET);
+ else
+ tst_res(TFAIL | TTERRNO, "Test Failed, capget() returned %ld",
+ TST_RET);
if (data[0].effective & 1 << CAP_NET_RAW)
tst_res(TFAIL, "capget() gets CAP_NET_RAW unexpectedly in pE");
diff --git a/testcases/kernel/syscalls/capget/capget02.c b/testcases/kernel/syscalls/capget/capget02.c
index f4a2b471c..e770ea0a9 100644
--- a/testcases/kernel/syscalls/capget/capget02.c
+++ b/testcases/kernel/syscalls/capget/capget02.c
@@ -31,11 +31,11 @@ static struct tcase {
int flag;
char *message;
} tcases[] = {
- {0x20080522, 0, EFAULT, 1, "bad address header"},
- {0x20080522, 0, EFAULT, 2, "bad address data"},
- {0, 0, EINVAL, 0, "bad version"},
- {0x20080522, -1, EINVAL, 0, "bad pid"},
- {0x20080522, 1, ESRCH, 0, "unused pid"},
+ {0x20080522, 0, EFAULT, 1, "Test bad address header"},
+ {0x20080522, 0, EFAULT, 2, "Test bad address data"},
+ {0, 0, EINVAL, 0, "Test bad version"},
+ {0x20080522, -1, EINVAL, 0, "Test bad pid"},
+ {0x20080522, 1, ESRCH, 0, "Test unused pid"},
};
static void verify_capget(unsigned int n)
@@ -48,15 +48,25 @@ static void verify_capget(unsigned int n)
else
header->pid = tc->pid;
+ tst_res(TINFO, "%s", tc->message);
+
/*
* header must not be NULL. data may be NULL only when the user is
* trying to determine the preferred capability version format
* supported by the kernel. So use tst_get_bad_addr() to get
* this error.
*/
- TST_EXP_FAIL(tst_syscall(__NR_capget, tc->flag - 1 ? header : NULL,
- tc->flag - 2 ? data : bad_data),
- tc->exp_err, "capget() with %s", tc->message);
+ TEST(tst_syscall(__NR_capget, tc->flag - 1 ? header : NULL,
+ tc->flag - 2 ? data : bad_data));
+ if (TST_RET == 0) {
+ tst_res(TFAIL, "capget() succeed unexpectedly");
+ return;
+ }
+ if (TST_ERR == tc->exp_err)
+ tst_res(TPASS | TTERRNO, "capget() failed as expected");
+ else
+ tst_res(TFAIL | TTERRNO, "capget() expected %s got ",
+ tst_strerrno(tc->exp_err));
/*
* When an unsupported version value is specified, it will
diff --git a/testcases/kernel/syscalls/capset/Makefile b/testcases/kernel/syscalls/capset/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/capset/Makefile
+++ b/testcases/kernel/syscalls/capset/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/capset/capset01.c b/testcases/kernel/syscalls/capset/capset01.c
index a323fc5be..f8540539d 100644
--- a/testcases/kernel/syscalls/capset/capset01.c
+++ b/testcases/kernel/syscalls/capset/capset01.c
@@ -20,24 +20,29 @@ static struct tcase {
int version;
char *message;
} tcases[] = {
- {0x19980330, "LINUX_CAPABILITY_VERSION_1"},
- {0x20071026, "LINUX_CAPABILITY_VERSION_2"},
- {0x20080522, "LINUX_CAPABILITY_VERSION_3"},
+ {0x19980330, "Test on LINUX_CAPABILITY_VERSION_1"},
+ {0x20071026, "Test on LINUX_CAPABILITY_VERSION_2"},
+ {0x20080522, "Test on LINUX_CAPABILITY_VERSION_3"},
};
static void verify_capset(unsigned int n)
{
struct tcase *tc = &tcases[n];
+ tst_res(TINFO, "%s", tc->message);
header->version = tc->version;
header->pid = pid;
- TEST(tst_syscall(__NR_capget, header, data));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "capget() failed");
+ if (tst_syscall(__NR_capget, header, data) == -1) {
+ tst_res(TFAIL | TTERRNO, "capget() failed");
+ return;
+ }
- TST_EXP_PASS(tst_syscall(__NR_capset, header, data),
- "capset() with %s", tc->message);
+ TEST(tst_syscall(__NR_capset, header, data));
+ if (TST_RET == 0)
+ tst_res(TPASS, "capset() returned %ld", TST_RET);
+ else
+ tst_res(TFAIL | TTERRNO, "Test Failed, capset() returned %ld", TST_RET);
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/capset/capset02.c b/testcases/kernel/syscalls/capset/capset02.c
index 5173be09b..a6c4f29a0 100644
--- a/testcases/kernel/syscalls/capset/capset02.c
+++ b/testcases/kernel/syscalls/capset/capset02.c
@@ -43,12 +43,12 @@ static struct tcase {
int flag;
char *message;
} tcases[] = {
- {0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 1, "bad address header"},
- {0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 2, "bad address data"},
- {0, 0, CAP1, CAP1, CAP1, EINVAL, 0, "bad version"},
- {0x20080522, 0, CAP2, CAP1, CAP1, EPERM, 0, "bad value data(when pE is not in pP)"},
- {0x20080522, 0, CAP1, CAP2, CAP1, EPERM, 0, "bad value data(when pP is not in old pP)"},
- {0x20080522, 0, CAP1, CAP1, CAP2, EPERM, 0, "bad value data(when pI is not in bounding set or old pI)"},
+ {0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 1, "Test bad address header"},
+ {0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 2, "Test bad address data"},
+ {0, 0, CAP1, CAP1, CAP1, EINVAL, 0, "Test bad version"},
+ {0x20080522, 0, CAP2, CAP1, CAP1, EPERM, 0, "Test bad value data(when pE is not in pP)"},
+ {0x20080522, 0, CAP1, CAP2, CAP1, EPERM, 0, "Test bad value data(when pP is not in old pP)"},
+ {0x20080522, 0, CAP1, CAP1, CAP2, EPERM, 0, "Test bad value data(when pI is not in bounding set or old pI)"},
};
static void verify_capset(unsigned int n)
@@ -62,9 +62,19 @@ static void verify_capset(unsigned int n)
data->permitted = tc->permitted;
data->inheritable = tc->inheritable;
- TST_EXP_FAIL(tst_syscall(__NR_capset, tc->flag - 1 ? header : bad_addr,
- tc->flag - 2 ? data : bad_addr),
- tc->exp_err, "capset() with %s", tc->message);
+ tst_res(TINFO, "%s", tc->message);
+
+ TEST(tst_syscall(__NR_capset, tc->flag - 1 ? header : bad_addr,
+ tc->flag - 2 ? data : bad_addr));
+ if (TST_RET == 0) {
+ tst_res(TFAIL, "capset() succeed unexpectedly");
+ return;
+ }
+ if (TST_ERR == tc->exp_err)
+ tst_res(TPASS | TTERRNO, "capset() failed as expected");
+ else
+ tst_res(TFAIL | TTERRNO, "capset() expected %s got ",
+ tst_strerrno(tc->exp_err));
/*
* When an unsupported version value is specified, it will
* return the kernel preferred value of _LINUX_CAPABILITY_VERSION_?.
diff --git a/testcases/kernel/syscalls/capset/capset03.c b/testcases/kernel/syscalls/capset/capset03.c
index 074ab1f50..d5754753d 100644
--- a/testcases/kernel/syscalls/capset/capset03.c
+++ b/testcases/kernel/syscalls/capset/capset03.c
@@ -23,7 +23,15 @@ static void verify_capset(void)
{
tst_res(TINFO, "Test bad value data(when pI is not old pP or old pI without CAP_SETPCAP)");
data[0].inheritable = CAP2;
- TST_EXP_FAIL(tst_syscall(__NR_capset, header, data), EPERM, "capset()");
+ TEST(tst_syscall(__NR_capset, header, data));
+ if (TST_RET == 0) {
+ tst_res(TFAIL, "capset succeed unexpectedly");
+ return;
+ }
+ if (TST_ERR == EPERM)
+ tst_res(TPASS | TTERRNO, "capset() failed as expected");
+ else
+ tst_res(TFAIL | TTERRNO, "capset expected EPERM, bug got");
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/capset/capset04.c b/testcases/kernel/syscalls/capset/capset04.c
index f929be555..81ad7a35f 100644
--- a/testcases/kernel/syscalls/capset/capset04.c
+++ b/testcases/kernel/syscalls/capset/capset04.c
@@ -24,11 +24,18 @@ static void verify_capset(void)
if (!child_pid)
pause();
- tst_res(TINFO, "Test capset() for a different process");
-
header->pid = child_pid;
- TST_EXP_FAIL(tst_syscall(__NR_capset, header, data), EPERM, "capset()");
+ TEST(tst_syscall(__NR_capset, header, data));
+ if (TST_RET == 0) {
+ tst_res(TFAIL, "capset succeed unexpectedly");
+ return;
+ }
+
+ if (TST_ERR == EPERM)
+ tst_res(TPASS, "capset can't modify other process capabilities");
+ else
+ tst_res(TFAIL | TTERRNO, "capset expected EPERM, bug got");
SAFE_KILL(child_pid, SIGTERM);
SAFE_WAIT(NULL);
diff --git a/testcases/kernel/syscalls/chdir/.gitignore b/testcases/kernel/syscalls/chdir/.gitignore
index 1b15eb6b9..c1e4b9d07 100644
--- a/testcases/kernel/syscalls/chdir/.gitignore
+++ b/testcases/kernel/syscalls/chdir/.gitignore
@@ -1,2 +1,4 @@
/chdir01
+/chdir02
+/chdir03
/chdir04
diff --git a/testcases/kernel/syscalls/chdir/Makefile b/testcases/kernel/syscalls/chdir/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/chdir/Makefile
+++ b/testcases/kernel/syscalls/chdir/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/chdir/chdir01.c b/testcases/kernel/syscalls/chdir/chdir01.c
index aa25adf6a..81cf7c564 100644
--- a/testcases/kernel/syscalls/chdir/chdir01.c
+++ b/testcases/kernel/syscalls/chdir/chdir01.c
@@ -1,147 +1,181 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
- * Check that the chdir() syscall returns correct value and error code
- * in various situations when called with root privileges
+ * NAME
+ * chdir01.c
+ *
+ * DESCRIPTION
+ * Check proper operation of chdir(): tests whether the
+ * system call can it change the current, working directory, and find a
+ * file there? Will it fail on a non-directory entry ?
+ *
+ * ALGORITHM
+ * Make a directory "Testdirectory", and create a file in it. cd into
+ * the directory and read the entry. It should be the file just
+ * created.
+ *
+ * USAGE: <for command-line>
+ * chdir01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * None
*/
#include <stdio.h>
-#include <stdlib.h>
#include <sys/types.h>
-#include <unistd.h>
-#include <pwd.h>
-
-#include "tst_test.h"
-
-#define MNTPOINT "mntpoint"
-
-#define FILE_NAME "testfile"
-#define DIR_NAME "subdir"
-#define BLOCKED_NAME "keep_out"
-#define LINK_NAME1 "symloop"
-#define LINK_NAME2 "symloop2"
-
-static char *workdir;
-static int skip_symlinks, skip_blocked;
-static struct passwd *ltpuser;
-
-static struct test_case {
- const char *name;
- int root_ret, root_err, nobody_ret, nobody_err;
-} testcase_list[] = {
- {FILE_NAME, -1, ENOTDIR, -1, ENOTDIR},
- {BLOCKED_NAME, 0, 0, -1, EACCES},
- {DIR_NAME, 0, 0, 0, 0},
- {".", 0, 0, 0, 0},
- {"..", 0, 0, 0, 0},
- {"/", 0, 0, 0, 0},
- {"missing", -1, ENOENT, -1, ENOENT},
- {LINK_NAME1, -1, ELOOP, -1, ELOOP},
-};
-
-static void setup(void)
+#include <dirent.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include<sys/stat.h>
+#include "test.h"
+#include "safe_macros.h"
+
+char *TCID = "chdir01";
+int TST_TOTAL = 2;
+
+void setup(void);
+void cleanup(void);
+static void checknames(char **, int, DIR *);
+
+char testdir[40] = "";
+
+int main(int ac, char **av)
{
- char *cwd;
+ DIR *ddir, *opendir();
int fd;
- struct stat statbuf;
-
- cwd = SAFE_GETCWD(NULL, 0);
- workdir = SAFE_MALLOC(strlen(cwd) + strlen(MNTPOINT) + 2);
- sprintf(workdir, "%s/%s", cwd, MNTPOINT);
- free(cwd);
- SAFE_CHDIR(workdir);
-
- mode_t sys_umask = umask(0);
- SAFE_MKDIR(DIR_NAME, 0755);
- SAFE_MKDIR(BLOCKED_NAME, 0644);
- umask(sys_umask);
-
- /* FAT and NTFS override file and directory permissions */
- SAFE_STAT(BLOCKED_NAME, &statbuf);
- skip_blocked = statbuf.st_mode & 0111;
- skip_symlinks = 0;
- TEST(symlink(LINK_NAME1, LINK_NAME2));
-
- if (!TST_RET)
- SAFE_SYMLINK(LINK_NAME2, LINK_NAME1);
- else if (TST_RET == -1 && (TST_ERR == EPERM || TST_ERR == ENOSYS))
- skip_symlinks = 1;
- else
- tst_brk(TBROK | TTERRNO, "Cannot create symlinks");
-
- fd = SAFE_CREAT(FILE_NAME, 0644);
- SAFE_CLOSE(fd);
-
- if (!ltpuser)
- ltpuser = SAFE_GETPWNAM("nobody");
-}
+ char *filname = "chdirtest";
+ char *filenames[3];
-static void check_result(const char *user, const char *name, int retval,
- int experr)
-{
- if (TST_RET != retval) {
- tst_res(TFAIL | TTERRNO,
- "%s: chdir(\"%s\") returned unexpected value %ld",
- user, name, TST_RET);
- return;
- }
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ SAFE_CHDIR(cleanup, testdir);
+
+ fd = SAFE_CREAT(cleanup, filname, 0000);
+ SAFE_CLOSE(cleanup, fd);
+ if ((ddir = opendir(".")) == NULL)
+ tst_brkm(TBROK | TERRNO, cleanup, "opendir(.) failed");
+
+ filenames[0] = ".";
+ filenames[1] = "..";
+ filenames[2] = filname;
+ checknames(filenames, sizeof(filenames) / sizeof(filenames[0]),
+ ddir);
+ closedir(ddir);
+
+ TEST(chdir(filname));
- if (TST_RET != 0 && TST_ERR != experr) {
- tst_res(TFAIL | TTERRNO,
- "%s: chdir(\"%s\") returned unexpected error", user,
- name);
- return;
+ if (TEST_RETURN != -1)
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ else if (TEST_ERRNO != ENOTDIR)
+ tst_resm(TFAIL | TTERRNO,
+ "failed unexpectedly; wanted ENOTDIR");
+ else
+ tst_resm(TPASS, "failed as expected with ENOTDIR");
+
+ SAFE_UNLINK(cleanup, filname);
+
+ SAFE_CHDIR(cleanup, "..");
+
+ /* ELOOP */
+ SAFE_SYMLINK(cleanup, "test_eloop1", "test_eloop2");
+ SAFE_SYMLINK(cleanup, "test_eloop2", "test_eloop1");
+
+ TEST(chdir("test_eloop1"));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ } else if (TEST_ERRNO != ELOOP) {
+ tst_resm(TFAIL | TTERRNO,
+ "failed unexpectedly; wanted ELOOP");
+ } else {
+ tst_resm(TPASS, "failed as expected with ELOOP");
+ }
+
+ SAFE_UNLINK(cleanup, "test_eloop1");
+ SAFE_UNLINK(cleanup, "test_eloop2");
}
+ cleanup();
+
+ tst_exit();
- tst_res(TPASS | TTERRNO, "%s: chdir(\"%s\") returned correct value",
- user, name);
}
-static void run(unsigned int n)
+void setup(void)
{
- struct test_case *tc = testcase_list + n;
- if (tc->root_err == ELOOP && skip_symlinks) {
- tst_res(TCONF, "Skipping symlink loop test, not supported");
- return;
- }
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- /* Reset current directory to mountpoint */
- SAFE_CHDIR(workdir);
+ umask(0);
- TEST(chdir(tc->name));
- check_result("root", tc->name, tc->root_ret, tc->root_err);
+ TEST_PAUSE;
- if (tc->nobody_err == EACCES && skip_blocked) {
- tst_res(TCONF, "Skipping unprivileged permission test, "
- "FS mangles dir mode");
- return;
- }
+ tst_tmpdir();
- SAFE_CHDIR(workdir);
- SAFE_SETEUID(ltpuser->pw_uid);
- TEST(chdir(tc->name));
- SAFE_SETEUID(0);
- check_result("nobody", tc->name, tc->nobody_ret, tc->nobody_err);
+ sprintf(testdir, "Testdir.%d", getpid());
+
+ SAFE_MKDIR(cleanup, testdir, 0700);
}
-static void cleanup(void)
+void cleanup(void)
{
- free(workdir);
+ tst_rmdir();
}
-static struct tst_test test = {
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .test = run,
- .tcnt = ARRAY_SIZE(testcase_list),
- .setup = setup,
- .cleanup = cleanup
-};
+void checknames(char **pfilnames, int fnamecount, DIR * ddir)
+{
+ struct dirent *dir;
+ int i, found;
+
+ found = 0;
+ while ((dir = readdir(ddir)) != NULL) {
+ for (i = 0; i < fnamecount; i++) {
+ /*
+ * if dir->d_name is not null terminated it is a bug
+ * anyway
+ */
+ if (strcmp(pfilnames[i], dir->d_name) == 0) {
+ tst_resm(TINFO, "Found file %s", dir->d_name);
+ found++;
+ }
+ }
+ }
+ if (found < fnamecount) {
+ tst_brkm(TFAIL, cleanup,
+ "Some files do not exist, but they must exist");
+ }
+}
diff --git a/testcases/kernel/syscalls/chdir/chdir02.c b/testcases/kernel/syscalls/chdir/chdir02.c
new file mode 100644
index 000000000..6fc251c5f
--- /dev/null
+++ b/testcases/kernel/syscalls/chdir/chdir02.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
+ */
+/* $Id: chdir02.c,v 1.6 2009/08/28 11:32:19 vapier Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : chdir02
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for chdir(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) chdir(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the chdir(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * chdir(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+
+void setup();
+void cleanup();
+
+char *TCID = "chdir02";
+int TST_TOTAL = 1;
+
+char *dirs[2] = { "/", "/tmp" };
+
+int main(int ac, char **av)
+{
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(chdir(dirs[lc % 2]));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "chdir(%s) failed",
+ dirs[lc % 2]);
+ } else {
+ tst_resm(TPASS, "chdir(%s) returned %ld",
+ dirs[lc % 2], TEST_RETURN);
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/chdir/chdir03.c b/testcases/kernel/syscalls/chdir/chdir03.c
new file mode 100644
index 000000000..5beabdb1c
--- /dev/null
+++ b/testcases/kernel/syscalls/chdir/chdir03.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * DESCRIPTION
+ * Testcase for testing that chdir(2) sets EACCES errno
+ *
+ * ALGORITHM
+ * 1. running as root, create a directory with perm 700
+ * 2. create a child process, sets its uid to nobody
+ * 3. this child attempts to chdir(2) to the directory created in 1
+ * and expects to get an EACCES.
+ */
+
+#include <pwd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include "tst_test.h"
+
+#define DIRNAME "chdir03_dir"
+
+static uid_t nobody_uid;
+
+void verify_chdir(void)
+{
+ pid_t pid;
+
+ pid = SAFE_FORK();
+ if (!pid) {
+ SAFE_SETUID(nobody_uid);
+
+ TEST(chdir(DIRNAME));
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "chdir() succeeded unexpectedly");
+ return;
+ }
+
+ if (TST_ERR != EACCES) {
+ tst_res(TFAIL | TTERRNO,
+ "chdir() should fail with EACCES");
+ return;
+ }
+
+ tst_res(TPASS | TTERRNO, "chdir() failed expectedly");
+ }
+}
+
+void setup(void)
+{
+ struct passwd *pw;
+
+ pw = SAFE_GETPWNAM("nobody");
+ nobody_uid = pw->pw_uid;
+
+ SAFE_MKDIR(DIRNAME, 0700);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .test_all = verify_chdir,
+ .needs_tmpdir = 1,
+ .needs_root = 1,
+ .forks_child = 1,
+};
diff --git a/testcases/kernel/syscalls/chdir/chdir04.c b/testcases/kernel/syscalls/chdir/chdir04.c
index cdbb29668..f0420e4c9 100644
--- a/testcases/kernel/syscalls/chdir/chdir04.c
+++ b/testcases/kernel/syscalls/chdir/chdir04.c
@@ -1,42 +1,162 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * chdir04.c
+ *
+ * DESCRIPTION
+ * Testcase to test whether chdir(2) sets errno correctly.
+ *
+ * ALGORITHM
+ * 1. Test for ENAMETOOLONG:
+ * Create a bad directory name with length more than
+ *
+ * VFS_MAXNAMELEN (Linux kernel variable), and attempt to
+ * chdir(2) to it.
+ *
+ * 2. Test for ENOENT:
+ * Attempt to chdir(2) on a non-existent directory
+ *
+ * 3. Test for EFAULT:
+ * Pass an address which lies outside the address space of the
+ * process, and expect an EFAULT.
*
- * Testcase to test whether chdir(2) sets errno correctly.
+ * USAGE: <for command-line>
+ * chdir04 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * NONE
*/
+#include <stdio.h>
#include <errno.h>
-#include "tst_test.h"
-
-static char long_dir[] = "abcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz";
-static char noexist_dir[] = "noexistdir";
-
-static struct tcase {
- char *dir;
- int exp_errno;
-} tcases[] = {
- {long_dir, ENAMETOOLONG},
- {noexist_dir, ENOENT},
- {0, EFAULT}, // bad_addr
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include "test.h"
+
+char *TCID = "chdir04";
+
+char bad_dir[] =
+ "abcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz";
+
+char noexist_dir[] = "/tmp/noexistdir";
+
+struct test_case_t {
+ char *dname;
+ int error;
+} TC[] = {
+ /*
+ * to test whether chdir() is setting ENAMETOOLONG if the
+ * directory is more than VFS_MAXNAMELEN
+ */
+ {
+ bad_dir, ENAMETOOLONG},
+ /*
+ * to test whether chdir() is setting ENOENT if the
+ * directory is not existing.
+ */
+ {
+ noexist_dir, ENOENT},
+ /*
+ * to test whether chdir() is setting EFAULT if the
+ * directory is an invalid address.
+ */
+ {
+ (void *)-1, EFAULT}
};
-static void verify_chdir(unsigned int i)
+int TST_TOTAL = ARRAY_SIZE(TC);
+
+int flag;
+#define FAILED 1
+
+void setup(void);
+void cleanup(void);
+
+char *bad_addr = 0;
+
+int main(int ac, char **av)
{
- TST_EXP_FAIL(chdir(tcases[i].dir), tcases[i].exp_errno, "chdir()");
+ int lc;
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ TEST(chdir(TC[i].dname));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error)
+ tst_resm(TPASS | TTERRNO, "failed as expected");
+ else {
+ tst_resm(TFAIL | TTERRNO,
+ "didn't fail as expected (expected %d)",
+ TC[i].error);
+ }
+ }
+ }
+ cleanup();
+
+ tst_exit();
+
}
-static void setup(void)
+void setup(void)
{
- tcases[2].dir = tst_get_bad_addr(NULL);
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+#ifdef UCLINUX
+ bad_addr = mmap(0, 1, PROT_NONE,
+ MAP_PRIVATE_EXCEPT_UCLINUX | MAP_ANONYMOUS, 0, 0);
+ if (bad_addr == MAP_FAILED)
+ tst_brkm(TBROK | TERRNO, cleanup, "mmap() failed");
+ TC[2].dname = bad_addr;
+#endif
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .test = verify_chdir,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
-};
+void cleanup(void)
+{
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/chmod/Makefile b/testcases/kernel/syscalls/chmod/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/chmod/Makefile
+++ b/testcases/kernel/syscalls/chmod/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/chmod/chmod01.c b/testcases/kernel/syscalls/chmod/chmod01.c
index 55ddf8a73..14002f23f 100644
--- a/testcases/kernel/syscalls/chmod/chmod01.c
+++ b/testcases/kernel/syscalls/chmod/chmod01.c
@@ -122,7 +122,7 @@ int main(int ac, char **av)
"stat(%s) failed", TESTFILE);
stat_buf.st_mode &= ~S_IFREG;
- if (stat_buf.st_mode == (unsigned int)mode)
+ if (stat_buf.st_mode == mode)
tst_resm(TPASS, "Functionality of "
"chmod(%s, %#o) successful",
TESTFILE, mode);
diff --git a/testcases/kernel/syscalls/chown/Makefile b/testcases/kernel/syscalls/chown/Makefile
index 1a66088e3..6c8544a7d 100644
--- a/testcases/kernel/syscalls/chown/Makefile
+++ b/testcases/kernel/syscalls/chown/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/chown/chown01.c b/testcases/kernel/syscalls/chown/chown01.c
index 767a2ad5c..2e42153d6 100644
--- a/testcases/kernel/syscalls/chown/chown01.c
+++ b/testcases/kernel/syscalls/chown/chown01.c
@@ -1,46 +1,179 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- * AUTHOR: William Roske
- * CO-PILOT: Dave Fenner
- */
-
-/*\
- * [Description]
*
- * Basic test for chown(). Calls chown() on a file and expects it to pass.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
+/* $Id: chown01.c,v 1.6 2009/08/28 11:59:17 vapier Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : chown01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for chown(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) chown(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the chown(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * chown(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
+#include "test.h"
+#include "safe_macros.h"
+#include "compat_16.h"
-#include "tst_test.h"
-#include "compat_tst_16.h"
+TCID_DEFINE(chown01);
+int TST_TOTAL = 1;
-#define FILENAME "chown01_testfile"
+char fname[255];
+int uid, gid;
-static int uid, gid;
+static void setup(void);
+static void cleanup(void);
-static void run(void)
+int main(int ac, char **av)
{
- TST_EXP_PASS(CHOWN(FILENAME, uid, gid), "chown(%s,%d,%d)",
- FILENAME, uid, gid);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(CHOWN(cleanup, fname, uid, gid));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "chown(%s, %d,%d) failed",
+ fname, uid, gid);
+ } else {
+ tst_resm(TPASS, "chown(%s, %d,%d) returned %ld",
+ fname, uid, gid, TEST_RETURN);
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- UID16_CHECK((uid = geteuid()), "chown");
- GID16_CHECK((gid = getegid()), "chown");
- SAFE_FILE_PRINTF(FILENAME, "davef");
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ UID16_CHECK((uid = geteuid()), "chown", cleanup)
+ GID16_CHECK((gid = getegid()), "chown", cleanup)
+
+ sprintf(fname, "t_%d", getpid());
+
+ SAFE_FILE_PRINTF(cleanup, fname, "davef");
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .test_all = run,
-};
+static void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/chown/chown02.c b/testcases/kernel/syscalls/chown/chown02.c
index a92a1fd2d..a459f092b 100644
--- a/testcases/kernel/syscalls/chown/chown02.c
+++ b/testcases/kernel/syscalls/chown/chown02.c
@@ -1,79 +1,283 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * Test Name: chown02
+ *
+ * Test Description:
+ * Verify that, when chown(2) invoked by super-user to change the owner and
+ * group of a file specified by path to any numeric owner(uid)/group(gid)
+ * values,
+ * - clears setuid and setgid bits set on an executable file.
+ * - preserves setgid bit set on a non-group-executable file.
+ *
+ * Expected Result:
+ * chown(2) should return 0 and the ownership set on the file should match
+ * the numeric values contained in owner and group respectively.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * chown02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS:
+ * This test should be run by 'super-user' (root) only.
*
- * Verify that chown(2) invoked by super-user:
- * - clears setuid and setgid bits set on an executable file
- * - preserves setgid bit set on a non-group-executable file
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
-#include "tst_test.h"
-#include "compat_tst_16.h"
-#include "tst_safe_macros.h"
+#include "test.h"
+#include "safe_macros.h"
+#include "compat_16.h"
+#define FILE_MODE (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
#define NEW_PERMS1 (S_IFREG|S_IRWXU|S_IRWXG|S_ISUID|S_ISGID)
#define NEW_PERMS2 (S_IFREG|S_IRWXU|S_ISGID)
#define EXP_PERMS (S_IFREG|S_IRWXU|S_IRWXG)
#define TESTFILE1 "testfile1"
#define TESTFILE2 "testfile2"
+TCID_DEFINE(chown02);
+
+int setup1(); /* Test specific setup functions */
+int setup2();
+
struct test_case_t {
- const char *filename;
- mode_t set_mode;
- mode_t exp_mode;
-} tc[] = {
- {TESTFILE1, NEW_PERMS1, EXP_PERMS},
- {TESTFILE2, NEW_PERMS2, NEW_PERMS2}
-};
-
-static void run(unsigned int i)
+ char *pathname;
+ uid_t user_id;
+ gid_t group_id;
+ int test_flag;
+ int (*setupfunc) ();
+} test_cases[] = {
+ /* setuid/setgid bits cleared */
+ {
+ TESTFILE1, 700, 701, 1, setup1},
+ /* setgid bit not cleared */
+ {
+TESTFILE2, 700, 701, 2, setup2},};
+
+int TST_TOTAL = ARRAY_SIZE(test_cases);
+
+void setup(); /* setup function for the test */
+void cleanup(); /* cleanup function for the test */
+
+int main(int ac, char **av)
{
- uid_t uid;
- gid_t gid;
+ struct stat stat_buf; /* stat(2) struct contents */
+ int lc;
+ int i;
+ uid_t user_id; /* user id of the user set for testfile */
+ gid_t group_id; /* group id of the user set for testfile */
+ int test_flag; /* test condition specific flag variable */
+ char *file_name; /* ptr. for test file name */
- UID16_CHECK((uid = geteuid()), "chown");
- GID16_CHECK((gid = getegid()), "chown");
+ tst_parse_opts(ac, av, NULL, NULL);
- SAFE_CHMOD(tc[i].filename, tc[i].set_mode);
+ setup();
- TST_EXP_PASS(CHOWN(tc[i].filename, uid, gid));
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- struct stat stat_buf;
- SAFE_STAT(tc[i].filename, &stat_buf);
+ tst_count = 0;
- if (stat_buf.st_uid != uid || stat_buf.st_gid != gid) {
- tst_res(TFAIL, "%s: owner set to (uid=%d, gid=%d), expected (uid=%d, gid=%d)",
- tc[i].filename, stat_buf.st_uid, stat_buf.st_gid, uid, gid);
- }
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ file_name = test_cases[i].pathname;
+ user_id = test_cases[i].user_id;
+ group_id = test_cases[i].group_id;
+ test_flag = test_cases[i].test_flag;
- if (stat_buf.st_mode != tc[i].exp_mode) {
- tst_res(TFAIL, "%s: wrong mode permissions %#o, expected %#o",
- tc[i].filename, stat_buf.st_mode, tc[i].exp_mode);
+ /*
+ * Call chown(2) with different user id and
+ * group id (numeric values) to set it on testfile.
+ */
+ TEST(CHOWN(cleanup, file_name, user_id, group_id));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO,
+ "chown(%s, ..) failed", file_name);
+ continue;
+ }
+
+ /*
+ * Get the testfile information using stat(2).
+ */
+ if (stat(file_name, &stat_buf) < 0) {
+ tst_brkm(TFAIL, cleanup, "stat(2) of "
+ "%s failed, errno:%d",
+ file_name, TEST_ERRNO);
+ }
+
+ /*
+ * Check for expected Ownership ids
+ * set on testfile.
+ */
+ if (stat_buf.st_uid != user_id ||
+ stat_buf.st_gid != group_id) {
+ tst_brkm(TFAIL, cleanup, "%s: incorrect"
+ " ownership set, Expected %d "
+ "%d", file_name,
+ user_id, group_id);
+ }
+
+ /*
+ * Verify that S_ISUID/S_ISGID bits set on the
+ * testfile(s) in setup()s are cleared by
+ * chown().
+ */
+ if (test_flag == 1 &&
+ (stat_buf.st_mode & (S_ISUID | S_ISGID)) != 0) {
+ tst_resm(TFAIL,
+ "%s: incorrect mode "
+ "permissions %#o, Expected "
+ "%#o", file_name, NEW_PERMS1,
+ EXP_PERMS);
+ } else if (test_flag == 2
+ && (stat_buf.st_mode & S_ISGID) == 0) {
+ tst_resm(TFAIL,
+ "%s: Incorrect mode "
+ "permissions %#o, Expected "
+ "%#o", file_name,
+ stat_buf.st_mode, NEW_PERMS2);
+ } else {
+ tst_resm(TPASS,
+ "chown(%s, ..) succeeded",
+ file_name);
+ }
+ }
}
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * void
+ * setup() - performs all ONE TIME setup for this test.
+ * Create a temporary directory and change directory to it.
+ * Create a test file under temporary directory and close it
+ */
+void setup(void)
+{
+ int i;
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ /* call iividual setup functions */
+ for (i = 0; i < TST_TOTAL; i++)
+ test_cases[i].setupfunc();
}
-static void setup(void)
+/*
+ * int
+ * setup1() - Setup function for chown(2) to verify setuid/setgid bits
+ * set on an executable file will not be cleared.
+ * Creat a testfile and set setuid/setgid bits on the mode of file.$
+ */
+int setup1(void)
{
- unsigned int i;
+ int fd; /* File descriptor for testfile1 */
+
+ /* Creat a testfile and close it */
+ if ((fd = open(TESTFILE1, O_RDWR | O_CREAT, FILE_MODE)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "open(%s, O_RDWR|O_CREAT, %o) failed",
+ TESTFILE1, FILE_MODE);
+ SAFE_CLOSE(cleanup, fd);
- for (i = 0; i < ARRAY_SIZE(tc); i++)
- SAFE_TOUCH(tc[i].filename, tc[i].set_mode, NULL);
+ /* Set setuid/setgid bits on the test file created */
+ SAFE_CHMOD(cleanup, TESTFILE1, NEW_PERMS1);
+ return 0;
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .needs_root = 1,
- .needs_tmpdir = 1,
- .setup = setup,
- .test = run,
-};
+/*
+ * int
+ * setup2() - Setup function for chown(2) to verify setgid bit set
+ * set on non-group executable file will not be cleared.
+ * Creat a testfile and set setgid bit on the mode of file.
+ */
+int setup2(void)
+{
+ int fd; /* File descriptor for testfile2 */
+
+ /* Creat a testfile and close it */
+ if ((fd = open(TESTFILE2, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "open(%s, O_RDWR|O_CREAT, %o) failed",
+ TESTFILE2, FILE_MODE);
+ }
+ /* Set setgid bit on the test file created */
+ if (fchmod(fd, NEW_PERMS2) != 0)
+ tst_brkm(TBROK | TERRNO, cleanup, "fchmod failed");
+ SAFE_CLOSE(cleanup, fd);
+ return 0;
+}
+
+/*
+ * void
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ * Remove the test directory and testfile created in the setup.
+ */
+void cleanup(void)
+{
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/chown/chown03.c b/testcases/kernel/syscalls/chown/chown03.c
index ff6e904be..2c7bcfe7d 100644
--- a/testcases/kernel/syscalls/chown/chown03.c
+++ b/testcases/kernel/syscalls/chown/chown03.c
@@ -1,20 +1,72 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * Test Name: chown03
+ *
+ * Test Description:
+ * Verify that, chown(2) succeeds to change the group of a file specified
+ * by path when called by non-root user with the following constraints,
+ * - euid of the process is equal to the owner of the file.
+ * - the intended gid is either egid, or one of the supplementary gids
+ * of the process.
+ * Also, verify that chown() clears the setuid/setgid bits set on the file.
+ *
+ * Expected Result:
+ * chown(2) should return 0 and the ownership set on the file should match
+ * the numeric values contained in owner and group respectively.
*
- * Verify that, chown(2) succeeds to change the group of a file specified
- * by path when called by non-root user with the following constraints:
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
*
- * - euid of the process is equal to the owner of the file.
- * - the intended gid is either egid, or one of the supplementary gids
- * of the process.
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * chown03 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS:
*
- * Also verify that chown() clears the setuid/setgid bits set on the file.
*/
#include <stdio.h>
@@ -28,76 +80,123 @@
#include <grp.h>
#include <pwd.h>
-#include "tst_test.h"
-#include "compat_tst_16.h"
+#include "test.h"
+#include "safe_macros.h"
+#include "compat_16.h"
-#define FILE_MODE (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
-#define NEW_PERMS (S_IFREG|S_IRWXU|S_IRWXG|S_ISUID|S_ISGID)
-#define FILENAME "chown03_testfile"
+#define FILE_MODE (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
+#define NEW_PERMS (S_IFREG|S_IRWXU|S_IRWXG|S_ISUID|S_ISGID)
+#define TESTFILE "testfile"
-static struct passwd *ltpuser;
+TCID_DEFINE(chown03);
+int TST_TOTAL = 1; /* Total number of test conditions */
+char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
-static void check_owner(struct stat *s, uid_t exp_uid, gid_t exp_gid)
-{
- if (s->st_uid != exp_uid || s->st_gid != exp_gid)
- tst_res(TFAIL, "%s: wrong owner set to (uid=%d, gid=%d),"
- " expected (uid=%d, gid=%d)",
- FILENAME, s->st_uid, s->st_gid, exp_uid, exp_gid);
-}
+void setup(); /* setup function for the test */
+void cleanup(); /* cleanup function for the test */
-static void check_mode(struct stat *s, mode_t exp_mode)
+int main(int ac, char **av)
{
- if (s->st_mode != exp_mode)
- tst_res(TFAIL, "%s: wrong mode permissions %#o, expected %#o",
- FILENAME, s->st_mode, exp_mode);
+ struct stat stat_buf; /* stat(2) struct contents */
+ int lc;
+ uid_t user_id; /* Owner id of the test file. */
+ gid_t group_id; /* Group id of the test file. */
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ UID16_CHECK((user_id = geteuid()), "chown", cleanup)
+ GID16_CHECK((group_id = getegid()), "chown", cleanup)
+
+ TEST(CHOWN(cleanup, TESTFILE, -1, group_id));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "chown(%s, ..) failed",
+ TESTFILE);
+ continue;
+ }
+
+ if (stat(TESTFILE, &stat_buf) == -1)
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "stat failed");
+
+ if (stat_buf.st_uid != user_id ||
+ stat_buf.st_gid != group_id)
+ tst_resm(TFAIL, "%s: Incorrect ownership"
+ "set to %d %d, Expected %d %d",
+ TESTFILE, stat_buf.st_uid,
+ stat_buf.st_gid, user_id, group_id);
+
+ if (stat_buf.st_mode !=
+ (NEW_PERMS & ~(S_ISUID | S_ISGID)))
+ tst_resm(TFAIL, "%s: incorrect mode permissions"
+ " %#o, Expected %#o", TESTFILE,
+ stat_buf.st_mode,
+ NEW_PERMS & ~(S_ISUID | S_ISGID));
+ else
+ tst_resm(TPASS, "chown(%s, ..) was successful",
+ TESTFILE);
+ }
+
+ cleanup();
+ tst_exit();
}
-static void run(void)
+/*
+ * void
+ * setup() - performs all ONE TIME setup for this test.
+ * Create a temporary directory and change directory to it.
+ * Create a test file under temporary directory and close it
+ * Change the group ownership on testfile.
+ */
+void setup(void)
{
- SAFE_SETEUID(0);
- SAFE_CHOWN(FILENAME, -1, 0);
- SAFE_CHMOD(FILENAME, NEW_PERMS);
- SAFE_SETEUID(ltpuser->pw_uid);
-
- uid_t uid;
- gid_t gid;
- UID16_CHECK((uid = geteuid()), "chown");
- GID16_CHECK((gid = getegid()), "chown");
-
- struct stat stat_buf;
- SAFE_STAT(FILENAME, &stat_buf);
- check_owner(&stat_buf, uid, 0);
- check_mode(&stat_buf, NEW_PERMS);
-
- TST_EXP_PASS(CHOWN(FILENAME, -1, gid), "chown(%s, %d, %d)",
- FILENAME, -1, gid);
- SAFE_STAT(FILENAME, &stat_buf);
- check_owner(&stat_buf, uid, gid);
- check_mode(&stat_buf, NEW_PERMS & ~(S_ISUID | S_ISGID));
-}
+ int fd; /* file handler for testfile */
-static void setup(void)
-{
- int fd;
+ TEST_PAUSE;
+
+ tst_require_root();
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ tst_tmpdir();
+
+ ltpuser = getpwnam(nobody_uid);
+ if (ltpuser == NULL)
+ tst_brkm(TBROK | TERRNO, NULL, "getpwnam(\"nobody\") failed");
+ SAFE_SETEGID(NULL, ltpuser->pw_gid);
+ SAFE_SETEUID(NULL, ltpuser->pw_uid);
+
+ /* Create a test file under temporary directory */
+ if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "open(%s, O_RDWR|O_CREAT, %o) failed", TESTFILE,
+ FILE_MODE);
- ltpuser = SAFE_GETPWNAM("nobody");
- SAFE_SETEGID(ltpuser->pw_gid);
- SAFE_SETEUID(ltpuser->pw_uid);
+ SAFE_SETEUID(cleanup, 0);
- fd = SAFE_OPEN(FILENAME, O_RDWR | O_CREAT, FILE_MODE);
- SAFE_CLOSE(fd);
+ SAFE_FCHOWN(cleanup, fd, -1, 0);
+
+ SAFE_FCHMOD(cleanup, fd, NEW_PERMS);
+
+ SAFE_SETEUID(cleanup, ltpuser->pw_uid);
+
+ SAFE_CLOSE(cleanup, fd);
}
-static void cleanup(void)
+void cleanup(void)
{
- SAFE_SETEGID(0);
- SAFE_SETEUID(0);
-}
+ if (setegid(0) == -1)
+ tst_resm(TWARN | TERRNO, "setegid(0) failed");
+ if (seteuid(0) == -1)
+ tst_resm(TWARN | TERRNO, "seteuid(0) failed");
+
+ tst_rmdir();
-static struct tst_test test = {
- .needs_root = 1,
- .needs_tmpdir = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test_all = run,
-};
+}
diff --git a/testcases/kernel/syscalls/chown/chown05.c b/testcases/kernel/syscalls/chown/chown05.c
index ebb9e9b7c..840558c08 100644
--- a/testcases/kernel/syscalls/chown/chown05.c
+++ b/testcases/kernel/syscalls/chown/chown05.c
@@ -1,55 +1,173 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * Test Name: chown05
+ *
+ * Test Description:
+ * Verify that, chown(2) succeeds to change the owner and group of a file
+ * specified by path to any numeric owner(uid)/group(gid) values when invoked
+ * by super-user.
+ *
+ * Expected Result:
+ * chown(2) should return 0 and the ownership set on the file should match
+ * the numeric values contained in owner and group respectively.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
*
- * Verify that, chown(2) succeeds to change the owner and group of a file
- * specified by path to any numeric owner(uid)/group(gid) values when invoked
- * by super-user.
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * chown05 [-c n] [-e] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS:
+ * This test should be run by 'super-user' (root) only.
*/
-#include "tst_test.h"
-#include "compat_tst_16.h"
-#include "tst_safe_macros.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+
+#include "test.h"
+#include "safe_macros.h"
+#include "compat_16.h"
-#define FILE_MODE (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
-#define TESTFILE "testfile"
+#define FILE_MODE (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
+#define TESTFILE "testfile"
+
+TCID_DEFINE(chown05);
struct test_case_t {
- uid_t uid;
- gid_t gid;
-} tc[] = {
- {700, 701},
- {702, 701},
- {702, 703},
- {704, 705}
-};
-
-static void run(unsigned int i)
+ uid_t user_id;
+ gid_t group_id;
+} test_cases[] = {
+ {
+ 700, 701}, {
+ 702, -1}, {
+ 703, 701}, {
+ -1, 704}, {
+703, 705},};
+
+int TST_TOTAL = ARRAY_SIZE(test_cases);
+
+void setup(); /* setup function for the test */
+void cleanup(); /* cleanup function for the test */
+
+int main(int ac, char **av)
{
- struct stat stat_buf;
- TST_EXP_PASS(CHOWN(TESTFILE, tc[i].uid, tc[i].gid));
+ struct stat stat_buf; /* stat(2) struct contents */
+ int lc;
+ int i;
+ uid_t user_id; /* user id of the user set for testfile */
+ gid_t group_id; /* group id of the user set for testfile */
- SAFE_STAT(TESTFILE, &stat_buf);
- if (stat_buf.st_uid != tc[i].uid || stat_buf.st_gid != tc[i].gid) {
- tst_res(TFAIL, "%s: incorrect ownership set, expected %d %d",
- TESTFILE, tc[i].uid, tc[i].gid);
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+ user_id = test_cases[i].user_id;
+ group_id = test_cases[i].group_id;
+
+ TEST(CHOWN(cleanup, TESTFILE, user_id, group_id));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "chown failed");
+ continue;
+ }
+ if (stat(TESTFILE, &stat_buf) == -1)
+ tst_brkm(TFAIL, cleanup, "stat failed");
+ if (user_id == -1)
+ user_id = test_cases[i - 1].user_id;
+ if (group_id == -1)
+ group_id = test_cases[i - 1].group_id;
+
+ if (stat_buf.st_uid != user_id ||
+ stat_buf.st_gid != group_id)
+ tst_resm(TFAIL, "%s: incorrect "
+ "ownership set, Expected %d "
+ "%d", TESTFILE, user_id,
+ group_id);
+ else
+ tst_resm(TPASS, "chown succeeded");
+ }
}
+
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
- SAFE_TOUCH(TESTFILE, FILE_MODE, NULL);
+ int fd;
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "opening %s failed",
+ TESTFILE);
+ SAFE_CLOSE(cleanup, fd);
+
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .needs_root = 1,
- .needs_tmpdir = 1,
- .setup = setup,
- .test = run,
-};
+void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/chroot/Makefile b/testcases/kernel/syscalls/chroot/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/chroot/Makefile
+++ b/testcases/kernel/syscalls/chroot/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/clock_adjtime/Makefile b/testcases/kernel/syscalls/clock_adjtime/Makefile
index e49cb9b35..79f671f1c 100644
--- a/testcases/kernel/syscalls/clock_adjtime/Makefile
+++ b/testcases/kernel/syscalls/clock_adjtime/Makefile
@@ -7,4 +7,4 @@ include $(top_srcdir)/include/mk/testcases.mk
LDLIBS+=-lrt
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk \ No newline at end of file
diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h
index 7577ab24d..d7f553a3a 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h
@@ -4,9 +4,6 @@
* Author: Rafael David Tinoco <rafael.tinoco@linaro.org>
*/
-#ifndef CLOCK_ADJTIME_H__
-#define CLOCK_ADJTIME_H__
-
#include "config.h"
#include "tst_test.h"
#include "tst_timer.h"
@@ -17,238 +14,45 @@
#include <pwd.h>
#include <sys/timex.h>
#include <sys/types.h>
-#include <asm/posix_types.h>
#include "lapi/timex.h"
-struct __kernel_old_timex {
- unsigned int modes; /* mode selector */
- __kernel_long_t offset; /* time offset (usec) */
- __kernel_long_t freq; /* frequency offset (scaled ppm) */
- __kernel_long_t maxerror;/* maximum error (usec) */
- __kernel_long_t esterror;/* estimated error (usec) */
- int status; /* clock command/status */
- __kernel_long_t constant;/* pll time constant */
- __kernel_long_t precision;/* clock precision (usec) (read only) */
- __kernel_long_t tolerance;/* clock frequency tolerance (ppm)
- * (read only)
- */
- struct __kernel_old_timeval time; /* (read only, except for ADJ_SETOFFSET) */
- __kernel_long_t tick; /* (modified) usecs between clock ticks */
-
- __kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */
- __kernel_long_t jitter; /* pps jitter (us) (ro) */
- int shift; /* interval duration (s) (shift) (ro) */
- __kernel_long_t stabil; /* pps stability (scaled ppm) (ro) */
- __kernel_long_t jitcnt; /* jitter limit exceeded (ro) */
- __kernel_long_t calcnt; /* calibration intervals (ro) */
- __kernel_long_t errcnt; /* calibration errors (ro) */
- __kernel_long_t stbcnt; /* stability limit exceeded (ro) */
-
- int tai; /* TAI offset (ro) */
-
- int :32; int :32; int :32; int :32;
- int :32; int :32; int :32; int :32;
- int :32; int :32; int :32;
-};
-
-#ifndef HAVE_STRUCT___KERNEL_TIMEX_TIMEVAL
-struct __kernel_timex_timeval {
- __kernel_time64_t tv_sec;
- long long tv_usec;
-};
-#endif
-
-#ifndef HAVE_STRUCT___KERNEL_TIMEX
-struct __kernel_timex {
- unsigned int modes; /* mode selector */
- int :32; /* pad */
- long long offset; /* time offset (usec) */
- long long freq; /* frequency offset (scaled ppm) */
- long long maxerror;/* maximum error (usec) */
- long long esterror;/* estimated error (usec) */
- int status; /* clock command/status */
- int :32; /* pad */
- long long constant;/* pll time constant */
- long long precision;/* clock precision (usec) (read only) */
- long long tolerance;/* clock frequency tolerance (ppm)
- * (read only)
- */
- struct __kernel_timex_timeval time; /* (read only, except for ADJ_SETOFFSET) */
- long long tick; /* (modified) usecs between clock ticks */
-
- long long ppsfreq;/* pps frequency (scaled ppm) (ro) */
- long long jitter; /* pps jitter (us) (ro) */
- int shift; /* interval duration (s) (shift) (ro) */
- int :32; /* pad */
- long long stabil; /* pps stability (scaled ppm) (ro) */
- long long jitcnt; /* jitter limit exceeded (ro) */
- long long calcnt; /* calibration intervals (ro) */
- long long errcnt; /* calibration errors (ro) */
- long long stbcnt; /* stability limit exceeded (ro) */
-
- int tai; /* TAI offset (ro) */
-
- int :32; int :32; int :32; int :32;
- int :32; int :32; int :32; int :32;
- int :32; int :32; int :32;
-};
-#endif
-
-enum tst_timex_type {
- TST_KERN_OLD_TIMEX,
- TST_KERN_TIMEX
-};
-
-struct tst_timex {
- enum tst_timex_type type;
- union tx{
- struct __kernel_old_timex kern_old_timex;
- struct __kernel_timex kern_timex;
- } tx;
-};
-
-static inline void *tst_timex_get(struct tst_timex *t)
-{
- switch (t->type) {
- case TST_KERN_OLD_TIMEX:
- return &t->tx.kern_old_timex;
- case TST_KERN_TIMEX:
- return &t->tx.kern_timex;
- default:
- tst_brk(TBROK, "Invalid type: %d", t->type);
- return NULL;
- }
-}
-
-static inline int sys_clock_adjtime(clockid_t clk_id, void *timex)
-{
- return tst_syscall(__NR_clock_adjtime, clk_id, timex);
-}
-
-static inline int sys_clock_adjtime64(clockid_t clk_id, void *timex)
-{
- return tst_syscall(__NR_clock_adjtime64, clk_id, timex);
-}
-
-#define TIMEX_SHOW(tx, mode, fmt) \
- tst_res(TINFO, "%s\n" \
- " mode: %u\n" \
- " offset: "fmt"\n" \
- " frequency: "fmt"\n" \
- " maxerror: "fmt"\n" \
- " esterror: "fmt"\n" \
- " status: %d (0x%x)\n" \
- " time_constant: "fmt"\n" \
- " precision: "fmt"\n" \
- " tolerance: "fmt"\n" \
- " tick: "fmt"\n" \
- " raw time: "fmt"(s) "fmt"(us)", \
- mode, \
- tx.modes, \
- tx.offset, \
- tx.freq, \
- tx.maxerror, \
- tx.esterror, \
- tx.status, \
- tx.status, \
- tx.constant, \
- tx.precision, \
- tx.tolerance, \
- tx.tick, \
- tx.time.tv_sec, \
- tx.time.tv_usec)
+static int sys_clock_adjtime(clockid_t, struct timex *);
+static void timex_show(char *, struct timex);
-static inline void timex_show(const char *mode, struct tst_timex *timex)
+/*
+ * bad pointer w/ libc causes SIGSEGV signal, call syscall directly
+ */
+static int sys_clock_adjtime(clockid_t clk_id, struct timex *txc)
{
- switch (timex->type) {
- case TST_KERN_OLD_TIMEX:
- TIMEX_SHOW(timex->tx.kern_old_timex, mode, "%ld");
- return;
- case TST_KERN_TIMEX:
- TIMEX_SHOW(timex->tx.kern_timex, mode, "%lld");
- return;
- default:
- tst_brk(TBROK, "Invalid type: %d", timex->type);
- }
-}
-
-#undef TIMEX_SHOW
-
-#define ADJ_MODES 0
-
-#define SELECT_FIELD(tx, field) \
-{ \
- switch (field) { \
- case ADJ_MODES: \
- return &tx.modes; \
- case ADJ_OFFSET: \
- return &tx.offset; \
- case ADJ_FREQUENCY: \
- return &tx.freq; \
- case ADJ_MAXERROR: \
- return &tx.maxerror; \
- case ADJ_ESTERROR: \
- return &tx.esterror; \
- case ADJ_TIMECONST: \
- return &tx.constant; \
- case ADJ_TICK: \
- return &tx.tick; \
- case ADJ_STATUS: \
- return &tx.status; \
- default: \
- tst_brk(TBROK, "Invalid type: %d", timex->type); \
- return NULL; \
- } \
+ return tst_syscall(__NR_clock_adjtime, clk_id, txc);
}
-static inline void *timex_get_field(struct tst_timex *timex, unsigned int field)
+static void timex_show(char *given, struct timex txc)
{
- switch (timex->type) {
- case TST_KERN_OLD_TIMEX:
- SELECT_FIELD(timex->tx.kern_old_timex, field);
- case TST_KERN_TIMEX:
- SELECT_FIELD(timex->tx.kern_timex, field);
- default:
- tst_brk(TBROK, "Invalid type: %d", timex->type);
- return NULL;
- }
-}
-
-#undef SELECT_FIELD
-
-#define TIMEX_GET_SET_FIELD_TYPE(type_libc, type_kern) \
-static inline type_kern \
-timex_get_field_##type_libc(struct tst_timex *timex, unsigned int field) \
-{ \
- switch (timex->type) { \
- case TST_KERN_OLD_TIMEX: \
- return *((type_libc*)timex_get_field(timex, field)); \
- case TST_KERN_TIMEX: \
- return *((type_kern*)timex_get_field(timex, field)); \
- default: \
- tst_res(TFAIL, "Invalid type: %d", timex->type); \
- return 0; \
- } \
-} \
- \
-static inline void \
-timex_set_field_##type_libc(struct tst_timex *timex, unsigned int field, \
- type_kern value) \
-{ \
- switch (timex->type) { \
- case TST_KERN_OLD_TIMEX: \
- *((type_libc*)timex_get_field(timex, field)) = value; \
- return; \
- case TST_KERN_TIMEX: \
- *((type_kern*)timex_get_field(timex, field)) = value; \
- return; \
- default: \
- tst_res(TFAIL, "Invalid type: %d", timex->type); \
- } \
+ tst_res(TINFO, "%s\n"
+ " mode: %d\n"
+ " offset: %ld\n"
+ " frequency: %ld\n"
+ " maxerror: %ld\n"
+ " esterror: %ld\n"
+ " status: %d (0x%x)\n"
+ " time_constant: %ld\n"
+ " precision: %ld\n"
+ " tolerance: %ld\n"
+ " tick: %ld\n"
+ " raw time: %d(s) %d(us)",
+ given,
+ txc.modes,
+ txc.offset,
+ txc.freq,
+ txc.maxerror,
+ txc.esterror,
+ txc.status,
+ txc.status,
+ txc.constant,
+ txc.precision,
+ txc.tolerance,
+ txc.tick,
+ (int)txc.time.tv_sec,
+ (int)txc.time.tv_usec);
}
-
-TIMEX_GET_SET_FIELD_TYPE(uint, uint);
-TIMEX_GET_SET_FIELD_TYPE(long, long long);
-
-#undef TIMEX_GET_SET_FIELD_TYPE
-#endif
diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
index aff374a2c..1262d34fa 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
@@ -57,12 +57,13 @@
#include "clock_adjtime.h"
static long hz;
-static struct tst_timex saved, ttxc;
+static struct timex saved, ttxc;
static int supported;
struct test_case {
unsigned int modes;
long highlimit;
+ long *ptr;
long delta;
};
@@ -79,99 +80,84 @@ struct test_case tc[] = {
{
.modes = ADJ_OFFSET,
.highlimit = 500000,
+ .ptr = &ttxc.offset,
.delta = 10000,
},
{
.modes = ADJ_FREQUENCY,
+ .ptr = &ttxc.freq,
.delta = 100,
},
{
.modes = ADJ_MAXERROR,
+ .ptr = &ttxc.maxerror,
.delta = 100,
},
{
.modes = ADJ_ESTERROR,
+ .ptr = &ttxc.esterror,
.delta = 100,
},
{
.modes = ADJ_TIMECONST,
+ .ptr = &ttxc.constant,
.delta = 1,
},
{
.modes = ADJ_TICK,
.highlimit = 1100000,
+ .ptr = &ttxc.tick,
.delta = 1000,
},
};
-static struct test_variants {
- int (*clock_adjtime)(clockid_t clk_id, void *timex);
- enum tst_timex_type type;
- char *desc;
-} variants[] = {
-#if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL)
- {.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL)
- {.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
static void verify_clock_adjtime(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
- struct tst_timex verify;
- long long val;
- int rval;
+ long ptroff, *ptr = NULL;
+ struct timex verify;
- memset(&ttxc, 0, sizeof(ttxc));
- memset(&verify, 0, sizeof(verify));
+ memset(&ttxc, 0, sizeof(struct timex));
+ memset(&verify, 0, sizeof(struct timex));
- ttxc.type = verify.type = tv->type;
-
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&ttxc));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
+ SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &ttxc);
+ timex_show("GET", ttxc);
- timex_show("GET", &ttxc);
+ ttxc.modes = tc[i].modes;
- timex_set_field_uint(&ttxc, ADJ_MODES, tc[i].modes);
+ if (tc[i].ptr && tc[i].delta) {
- if (tc[i].delta) {
- val = timex_get_field_long(&ttxc, tc[i].modes);
- val += tc[i].delta;
+ *tc[i].ptr += tc[i].delta;
/* fix limits, if existent, so no errors occur */
- if (tc[i].highlimit && val >= tc[i].highlimit)
- val = tc[i].highlimit;
- timex_set_field_long(&ttxc, tc[i].modes, val);
+ if (tc[i].highlimit) {
+ if (*tc[i].ptr >= tc[i].highlimit)
+ *tc[i].ptr = tc[i].highlimit;
+ }
}
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&ttxc));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
+ SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &ttxc);
+ timex_show("SET", ttxc);
- timex_show("SET", &ttxc);
+ if (tc[i].ptr) {
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&verify));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
+ /* adjtimex field being tested so we can verify later */
+
+ ptroff = (long) tc[i].ptr - (long) &ttxc;
+ ptr = (void *) &verify + ptroff;
}
- timex_show("VERIFY", &verify);
+ TEST(sys_clock_adjtime(CLOCK_REALTIME, &verify));
+ timex_show("VERIFY", verify);
- if (tc[i].delta &&
- timex_get_field_long(&ttxc, tc[i].modes) !=
- timex_get_field_long(&verify, tc[i].modes)) {
+ if (tc[i].ptr && *tc[i].ptr != *ptr) {
tst_res(TFAIL, "clock_adjtime(): could not set value (mode=%x)",
- tc[i].modes);
+ tc[i].modes);
+ }
+
+ if (TST_RET < 0) {
+ tst_res(TFAIL | TTERRNO, "clock_adjtime(): mode=%x, returned "
+ "error", tc[i].modes);
}
tst_res(TPASS, "clock_adjtime(): success (mode=%x)", tc[i].modes);
@@ -179,24 +165,15 @@ static void verify_clock_adjtime(unsigned int i)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
size_t i;
int rval;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
-
- saved.type = tv->type;
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
-
+ rval = SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
supported = 1;
if (rval != TIME_OK && rval != TIME_ERROR) {
- timex_show("SAVE_STATUS", &saved);
- tst_brk(TBROK | TERRNO, "clock has on-going leap changes, "
+ timex_show("SAVE_STATUS", saved);
+ tst_brk(TBROK | TTERRNO, "clock has on-going leap changes, "
"returned: %i", rval);
}
@@ -211,7 +188,7 @@ static void setup(void)
/* fix usec as being test default resolution */
- if (timex_get_field_uint(&saved, ADJ_MODES) & ADJ_NANO) {
+ if (saved.modes & ADJ_NANO) {
if (tc[i].modes == ADJ_OFFSET) {
tc[i].highlimit *= 1000;
tc[i].delta *= 1000;
@@ -222,29 +199,21 @@ static void setup(void)
static void cleanup(void)
{
- struct test_variants *tv = &variants[tst_variant];
- unsigned int modes = ADJ_ALL;
- int rval;
-
if (supported == 0)
return;
+ saved.modes = ADJ_ALL;
+
/* restore clock resolution based on original status flag */
- if (timex_get_field_uint(&saved, ADJ_STATUS) & STA_NANO)
- modes |= ADJ_NANO;
+ if (saved.status & STA_NANO)
+ saved.modes |= ADJ_NANO;
else
- modes |= ADJ_MICRO;
-
- timex_set_field_uint(&saved, ADJ_MODES, modes);
+ saved.modes |= ADJ_MICRO;
/* restore original clock flags */
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
+ SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
}
static struct tst_test test = {
@@ -252,7 +221,6 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
.needs_root = 1,
.restore_wallclock = 1,
};
diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
index 2df9099d5..ba8eae54f 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
@@ -58,9 +58,8 @@
#include "clock_adjtime.h"
static long hz;
-static struct tst_timex saved, ttxc;
+static struct timex saved, ttxc;
static int supported;
-static void *bad_addr;
static void cleanup(void);
@@ -69,6 +68,7 @@ struct test_case {
unsigned int modes;
long lowlimit;
long highlimit;
+ long *ptr;
long delta;
int exp_err;
int droproot;
@@ -92,6 +92,7 @@ struct test_case tc[] = {
.clktype = CLOCK_REALTIME,
.modes = ADJ_TICK,
.lowlimit = 900000,
+ .ptr = &ttxc.tick,
.delta = 1,
.exp_err = EINVAL,
},
@@ -99,6 +100,7 @@ struct test_case tc[] = {
.clktype = CLOCK_REALTIME,
.modes = ADJ_TICK,
.highlimit = 1100000,
+ .ptr = &ttxc.tick,
.delta = 1,
.exp_err = EINVAL,
},
@@ -110,39 +112,19 @@ struct test_case tc[] = {
},
};
-static struct test_variants {
- int (*clock_adjtime)(clockid_t clk_id, void *timex);
- enum tst_timex_type type;
- char *desc;
-} variants[] = {
-#if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL)
- {.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL)
- {.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
static void verify_clock_adjtime(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
uid_t whoami = 0;
- struct tst_timex *txcptr = &ttxc;
+ struct timex *txcptr;
struct passwd *nobody;
static const char name[] = "nobody";
- int rval;
- memset(txcptr, 0, sizeof(*txcptr));
+ txcptr = &ttxc;
- txcptr->type = tv->type;
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(txcptr));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
+ memset(txcptr, 0, sizeof(struct timex));
- timex_show("GET", txcptr);
+ SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, txcptr);
+ timex_show("GET", *txcptr);
if (tc[i].droproot) {
nobody = SAFE_GETPWNAM(name);
@@ -150,23 +132,24 @@ static void verify_clock_adjtime(unsigned int i)
SAFE_SETEUID(whoami);
}
- timex_set_field_uint(txcptr, ADJ_MODES, tc[i].modes);
+ txcptr->modes = tc[i].modes;
+
+ if (tc[i].ptr) {
- if (tc[i].delta) {
if (tc[i].lowlimit)
- timex_set_field_long(&ttxc, tc[i].modes, tc[i].lowlimit - tc[i].delta);
+ *tc[i].ptr = tc[i].lowlimit - tc[i].delta;
if (tc[i].highlimit)
- timex_set_field_long(&ttxc, tc[i].modes, tc[i].highlimit + tc[i].delta);
+ *tc[i].ptr = tc[i].highlimit + tc[i].delta;
}
/* special case: EFAULT for bad addresses */
- if (tc[i].exp_err == EFAULT) {
- TEST(tv->clock_adjtime(tc[i].clktype, bad_addr));
- } else {
- TEST(tv->clock_adjtime(tc[i].clktype, tst_timex_get(txcptr)));
- timex_show("TEST", txcptr);
- }
+ if (tc[i].exp_err == EFAULT)
+ txcptr = tst_get_bad_addr(cleanup);
+
+ TEST(sys_clock_adjtime(tc[i].clktype, txcptr));
+ if (txcptr && tc[i].exp_err != EFAULT)
+ timex_show("TEST", *txcptr);
if (TST_RET >= 0) {
tst_res(TFAIL, "clock_adjtime(): passed unexpectedly (mode=%x, "
@@ -190,26 +173,15 @@ static void verify_clock_adjtime(unsigned int i)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
size_t i;
int rval;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
-
- bad_addr = tst_get_bad_addr(NULL);
-
- saved.type = tv->type;
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
-
+ rval = SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
supported = 1;
if (rval != TIME_OK && rval != TIME_ERROR) {
- timex_show("SAVE_STATUS", &saved);
- tst_brk(TBROK | TERRNO, "clock has on-going leap changes, "
+ timex_show("SAVE_STATUS", saved);
+ tst_brk(TBROK | TTERRNO, "clock has on-going leap changes, "
"returned: %i", rval);
}
@@ -227,29 +199,21 @@ static void setup(void)
static void cleanup(void)
{
- struct test_variants *tv = &variants[tst_variant];
- unsigned int modes = ADJ_ALL;
- int rval;
-
if (supported == 0)
return;
+ saved.modes = ADJ_ALL;
+
/* restore clock resolution based on original status flag */
- if (timex_get_field_uint(&saved, ADJ_STATUS) & STA_NANO)
- modes |= ADJ_NANO;
+ if (saved.status & STA_NANO)
+ saved.modes |= ADJ_NANO;
else
- modes |= ADJ_MICRO;
-
- timex_set_field_uint(&saved, ADJ_MODES, modes);
+ saved.modes |= ADJ_MICRO;
/* restore original clock flags */
- rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
- if (rval < 0) {
- tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
- return;
- }
+ SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
}
static struct tst_test test = {
@@ -257,7 +221,6 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
.needs_root = 1,
.restore_wallclock = 1,
};
diff --git a/testcases/kernel/syscalls/clock_getres/Makefile b/testcases/kernel/syscalls/clock_getres/Makefile
index 34c144fb6..4e1b61282 100644
--- a/testcases/kernel/syscalls/clock_getres/Makefile
+++ b/testcases/kernel/syscalls/clock_getres/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
index 84a0feb34..fcdf53b9c 100644
--- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
+++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
@@ -12,9 +12,12 @@
#include <errno.h>
-#include "tst_timer.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
#include "lapi/posix_clocks.h"
+static struct timespec *res;
+
static struct test_case {
char *name;
clockid_t clk_id;
@@ -34,39 +37,29 @@ static struct test_case {
{"-1", -1, -1, EINVAL},
};
-static struct tst_ts *tspec, *nspec = NULL;
-
-static struct test_variants {
- int (*func)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- struct tst_ts **spec;
- char *desc;
-} variants[] = {
- { .func = libc_clock_getres, .type = TST_LIBC_TIMESPEC, .spec = &tspec, .desc = "vDSO or syscall with libc spec"},
- { .func = libc_clock_getres, .type = TST_LIBC_TIMESPEC, .spec = &nspec, .desc = "vDSO or syscall with libc spec with NULL res"},
-
-#if (__NR_clock_getres != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_clock_getres, .type = TST_KERN_OLD_TIMESPEC, .spec = &tspec, .desc = "syscall with old kernel spec"},
- { .func = sys_clock_getres, .type = TST_KERN_OLD_TIMESPEC, .spec = &nspec, .desc = "syscall with old kernel spec with NULL res"},
-#endif
-
-#if (__NR_clock_getres_time64 != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_clock_getres64, .type = TST_KERN_TIMESPEC, .spec = &tspec, .desc = "syscall time64 with kernel spec"},
- { .func = sys_clock_getres64, .type = TST_KERN_TIMESPEC, .spec = &nspec, .desc = "syscall time64 with kernel spec with NULL res"},
-#endif
-};
+static const char *variant_desc[] = {
+ "default (vdso or syscall)",
+ "syscall",
+ "syscall with NULL res parameter" };
static void setup(void)
{
- tspec->type = variants[tst_variant].type;
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
+ tst_res(TINFO, "Testing variant: %s", variant_desc[tst_variant]);
}
static void do_test(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
-
- TEST(tv->func(tcase[i].clk_id, tst_ts_get(*tv->spec)));
+ switch (tst_variant) {
+ case 0:
+ TEST(clock_getres(tcase[i].clk_id, res));
+ break;
+ case 1:
+ TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id, res));
+ break;
+ case 2:
+ TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id, NULL));
+ break;
+ }
if (TST_RET != tcase[i].ret) {
if (TST_ERR == EINVAL) {
@@ -91,10 +84,10 @@ static void do_test(unsigned int i)
static struct tst_test test = {
.test = do_test,
.tcnt = ARRAY_SIZE(tcase),
- .test_variants = ARRAY_SIZE(variants),
+ .test_variants = 3,
.setup = setup,
.bufs = (struct tst_buffers []) {
- {&tspec, .size = sizeof(*tspec)},
+ {&res, .size = sizeof(*res)},
{},
}
};
diff --git a/testcases/kernel/syscalls/clock_gettime/.gitignore b/testcases/kernel/syscalls/clock_gettime/.gitignore
index 304eedab6..ba471c859 100644
--- a/testcases/kernel/syscalls/clock_gettime/.gitignore
+++ b/testcases/kernel/syscalls/clock_gettime/.gitignore
@@ -1,5 +1,3 @@
clock_gettime01
clock_gettime02
-clock_gettime03
-clock_gettime04
leapsec01
diff --git a/testcases/kernel/syscalls/clock_gettime/Makefile b/testcases/kernel/syscalls/clock_gettime/Makefile
index e7f5e9e75..79f671f1c 100644
--- a/testcases/kernel/syscalls/clock_gettime/Makefile
+++ b/testcases/kernel/syscalls/clock_gettime/Makefile
@@ -3,11 +3,8 @@
top_srcdir ?= ../../../..
-LTPLIBS = ltpvdso
-
include $(top_srcdir)/include/mk/testcases.mk
LDLIBS+=-lrt
-clock_gettime04: LTPLDLIBS = -lltpvdso
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk \ No newline at end of file
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c
index be9573afc..d365823b2 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c
@@ -17,16 +17,22 @@
*/
#include "config.h"
-#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
struct test_case {
clockid_t clktype;
int allow_inval;
};
-static struct test_case tc[] = {
+struct tmpfunc {
+ int (*func)(clockid_t clk_id, struct timespec *tp);
+ char *desc;
+};
+
+struct test_case tc[] = {
{
.clktype = CLOCK_REALTIME,
},
@@ -57,57 +63,73 @@ static struct test_case tc[] = {
},
};
-static struct tst_ts spec;
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+static int sys_clock_gettime(clockid_t clk_id, struct timespec *tp)
+{
+ return tst_syscall(__NR_clock_gettime, clk_id, tp);
+}
-static void setup(void)
+static int check_spec(struct timespec *spec)
{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
+ return (spec->tv_nsec != 0 || spec->tv_sec != 0) ? 1 : 0;
}
static void verify_clock_gettime(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
- int ret;
+ size_t sz;
+ struct timespec spec;
+
+ /*
+ * check clock_gettime() syscall AND libc (or vDSO) functions
+ */
+ struct tmpfunc tf[] = {
+ { .func = sys_clock_gettime, .desc = "syscall" },
+ { .func = clock_gettime, .desc = "vDSO or syscall" },
+ };
+
+ for (sz = 0; sz < ARRAY_SIZE(tf); sz++) {
- memset(&spec, 0, sizeof(spec));
- spec.type = tv->ts_type;
+ memset(&spec, 0, sizeof(struct timespec));
- TEST(tv->clock_gettime(tc[i].clktype, tst_ts_get(&spec)));
+ TEST(tf[sz].func(tc[i].clktype, &spec));
+
+ if (TST_RET == -1) {
+
+ /* errors: allow unsupported clock types */
+
+ if (tc[i].allow_inval && TST_ERR == EINVAL) {
+
+ tst_res(TPASS, "clock_gettime(2): unsupported "
+ "clock %s (%s) failed as "
+ "expected",
+ tst_clock_name(tc[i].clktype),
+ tf[sz].desc);
+
+ } else {
+
+ tst_res(TFAIL | TTERRNO, "clock_gettime(2): "
+ "clock %s (%s) failed "
+ "unexpectedly",
+ tst_clock_name(tc[i].clktype),
+ tf[sz].desc);
+ }
- if (TST_RET == -1) {
- /* errors: allow unsupported clock types */
- if (tc[i].allow_inval && TST_ERR == EINVAL) {
- tst_res(TPASS, "clock_gettime(2): unsupported clock %s failed as expected",
- tst_clock_name(tc[i].clktype));
} else {
- tst_res(TFAIL | TTERRNO, "clock_gettime(2): clock %s failed unexpectedly",
- tst_clock_name(tc[i].clktype));
- }
- } else {
- /* success: also check if timespec was changed */
- ret = tst_ts_valid(&spec);
- if (!ret) {
- tst_res(TPASS, "clock_gettime(2): clock %s passed",
- tst_clock_name(tc[i].clktype));
- } else if (ret == -1) {
- tst_res(TFAIL, "clock_gettime(2): clock %s passed, unchanged timespec",
- tst_clock_name(tc[i].clktype));
- } else if (ret == -2) {
- tst_res(TFAIL, "clock_gettime(2): clock %s passed, Corrupted timespec",
- tst_clock_name(tc[i].clktype));
+ /* success: also check if timespec was changed */
+
+ if (check_spec(&spec)) {
+ tst_res(TPASS, "clock_gettime(2): clock %s "
+ "(%s) passed",
+ tst_clock_name(tc[i].clktype),
+ tf[sz].desc);
+ } else {
+
+ tst_res(TFAIL, "clock_gettime(2): clock %s "
+ "(%s) passed, unchanged "
+ "timespec",
+ tst_clock_name(tc[i].clktype),
+ tf[sz].desc);
+ }
}
}
}
@@ -115,7 +137,5 @@ static void verify_clock_gettime(unsigned int i)
static struct tst_test test = {
.test = verify_clock_gettime,
.tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
.needs_root = 1,
};
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c
index 1159dbd13..b4bc6e2d5 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c
@@ -19,19 +19,18 @@
*/
#include "config.h"
-#include "time64_variants.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
-static void *bad_addr;
-
struct test_case {
clockid_t clktype;
int exp_err;
int allow_inval;
};
-static struct test_case tc[] = {
+struct test_case tc[] = {
{
.clktype = MAX_CLOCKS,
.exp_err = EINVAL,
@@ -82,63 +81,52 @@ static struct test_case tc[] = {
},
};
-static struct tst_ts spec;
-
/*
* bad pointer w/ libc causes SIGSEGV signal, call syscall directly
*/
-static struct time64_variants variants[] = {
-#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
+static int sys_clock_gettime(clockid_t clk_id, struct timespec *tp)
{
- tst_res(TINFO, "Testing variant: %d: %s", tst_variant, variants[tst_variant].desc);
-
- bad_addr = tst_get_bad_addr(NULL);
+ return tst_syscall(__NR_clock_gettime, clk_id, tp);
}
static void verify_clock_gettime(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
- void *ts;
+ struct timespec spec, *specptr;
+
+ specptr = &spec;
/* bad pointer cases */
- if (tc[i].exp_err == EFAULT) {
- ts = bad_addr;
- } else {
- spec.type = tv->ts_type;
- ts = tst_ts_get(&spec);
- }
+ if (tc[i].exp_err == EFAULT)
+ specptr = tst_get_bad_addr(NULL);
- TEST(tv->clock_gettime(tc[i].clktype, ts));
+ TEST(sys_clock_gettime(tc[i].clktype, specptr));
- if (TST_RET != -1) {
- tst_res(TFAIL, "clock_gettime(2): clock %s passed unexpectedly",
- tst_clock_name(tc[i].clktype));
- return;
- }
+ if (TST_RET == -1) {
+
+ if ((tc[i].exp_err == TST_ERR) ||
+ (tc[i].allow_inval && TST_ERR == EINVAL)) {
+
+ tst_res(TPASS | TTERRNO, "clock_gettime(2): "
+ "clock %s failed as expected",
+ tst_clock_name(tc[i].clktype));
+
+ } else {
+
+ tst_res(TFAIL | TTERRNO, "clock_gettime(2): "
+ "clock %s failed unexpectedly",
+ tst_clock_name(tc[i].clktype));
+ }
- if ((tc[i].exp_err == TST_ERR) ||
- (tc[i].allow_inval && TST_ERR == EINVAL)) {
- tst_res(TPASS | TTERRNO, "clock_gettime(2): clock %s failed as expected",
- tst_clock_name(tc[i].clktype));
} else {
- tst_res(TFAIL | TTERRNO, "clock_gettime(2): clock %s failed unexpectedly",
- tst_clock_name(tc[i].clktype));
+
+ tst_res(TFAIL, "clock_gettime(2): clock %s passed"
+ " unexcpectedly",
+ tst_clock_name(tc[i].clktype));
}
}
static struct tst_test test = {
.test = verify_clock_gettime,
.tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
.needs_root = 1,
};
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
deleted file mode 100644
index 83e97d907..000000000
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
+++ /dev/null
@@ -1,138 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*
- * [Description]
- *
- * After a call to unshare(CLONE_NEWTIME) a new timer namespace is created, the
- * process that has called the unshare() can adjust offsets for CLOCK_MONOTONIC
- * and CLOCK_BOOTTIME for its children by writing to the '/proc/self/timens_offsets'.
- *
- * The child processes also switch to the initial parent namespace and checks
- * that the offset is set to 0.
- */
-
-#define _GNU_SOURCE
-#include "time64_variants.h"
-#include "tst_safe_clocks.h"
-#include "tst_timer.h"
-#include "lapi/namespaces_constants.h"
-
-static struct tcase {
- int clk_id;
- int clk_off;
- int off;
-} tcases[] = {
- {CLOCK_MONOTONIC, CLOCK_MONOTONIC, 10},
- {CLOCK_BOOTTIME, CLOCK_BOOTTIME, 10},
-
- {CLOCK_MONOTONIC, CLOCK_MONOTONIC, -10},
- {CLOCK_BOOTTIME, CLOCK_BOOTTIME, -10},
-
- {CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC, 100},
- {CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC, 100},
-};
-
-static struct tst_ts now, then, parent_then;
-static int parent_ns;
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void child(struct time64_variants *tv, struct tcase *tc)
-{
- long long diff;
-
- if (tv->clock_gettime(tc->clk_id, tst_ts_get(&then))) {
- tst_res(TFAIL | TERRNO, "clock_gettime(%s) failed",
- tst_clock_name(tc->clk_id));
- return;
- }
-
- SAFE_SETNS(parent_ns, CLONE_NEWTIME);
-
- if (tv->clock_gettime(tc->clk_id, tst_ts_get(&parent_then))) {
- tst_res(TFAIL | TERRNO, "clock_gettime(%s) failed",
- tst_clock_name(tc->clk_id));
- return;
- }
-
- diff = tst_ts_diff_ms(then, now);
-
- if (diff - tc->off * 1000 > 10) {
- tst_res(TFAIL, "Wrong offset (%s) read %llims",
- tst_clock_name(tc->clk_id), diff);
- } else {
- tst_res(TPASS, "Offset (%s) is correct %llims",
- tst_clock_name(tc->clk_id), diff);
- }
-
- diff = tst_ts_diff_ms(parent_then, now);
-
- if (diff > 10) {
- tst_res(TFAIL, "Wrong offset (%s) read %llims",
- tst_clock_name(tc->clk_id), diff);
- } else {
- tst_res(TPASS, "Offset (%s) is correct %llims",
- tst_clock_name(tc->clk_id), diff);
- }
-}
-
-static void verify_ns_clock(unsigned int n)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct tcase *tc = &tcases[n];
-
- SAFE_UNSHARE(CLONE_NEWTIME);
-
- SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
- tc->clk_off, tc->off);
-
- if (tv->clock_gettime(tc->clk_id, tst_ts_get(&now))) {
- tst_res(TFAIL | TERRNO, "%d clock_gettime(%s) failed",
- __LINE__, tst_clock_name(tc->clk_id));
- return;
- }
-
- if (!SAFE_FORK())
- child(tv, tc);
-}
-
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
-
- now.type = then.type = parent_then.type = tv->ts_type;
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
- parent_ns = SAFE_OPEN("/proc/self/ns/time_for_children", O_RDONLY);
-}
-
-static void cleanup(void)
-{
- SAFE_CLOSE(parent_ns);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_ns_clock,
- .test_variants = ARRAY_SIZE(variants),
- .needs_root = 1,
- .forks_child = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_TIME_NS=y",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
deleted file mode 100644
index a8d2c5b38..000000000
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
+++ /dev/null
@@ -1,186 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar<viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Check time difference between successive readings and report a bug if
- * difference found to be over 5 ms.
- *
- * This test reports a s390x BUG which has been fixed in:
- *
- * commit 5b43bd184530af6b868d8273b0a743a138d37ee8
- * Author: Heiko Carstens <hca@linux.ibm.com>
- * Date: Wed Mar 24 20:23:55 2021 +0100
- *
- * s390/vdso: fix initializing and updating of vdso_data
- */
-
-#include "config.h"
-#include "parse_vdso.h"
-#include "time64_variants.h"
-#include "tst_timer.h"
-#include "tst_safe_clocks.h"
-
-clockid_t clks[] = {
- CLOCK_REALTIME,
- CLOCK_REALTIME_COARSE,
- CLOCK_MONOTONIC,
- CLOCK_MONOTONIC_COARSE,
- CLOCK_MONOTONIC_RAW,
- CLOCK_BOOTTIME,
-};
-
-static gettime_t ptr_vdso_gettime, ptr_vdso_gettime64;
-static long long delta = 5;
-
-static inline int do_vdso_gettime(gettime_t vdso, clockid_t clk_id, void *ts)
-{
- if (!vdso) {
- errno = ENOSYS;
- return -1;
- }
-
- return vdso(clk_id, ts);
-}
-
-static inline int vdso_gettime(clockid_t clk_id, void *ts)
-{
- return do_vdso_gettime(ptr_vdso_gettime, clk_id, ts);
-}
-
-static inline int vdso_gettime64(clockid_t clk_id, void *ts)
-{
- return do_vdso_gettime(ptr_vdso_gettime64, clk_id, ts);
-}
-
-static inline int my_gettimeofday(clockid_t clk_id, void *ts)
-{
- struct timeval tval;
-
- if (clk_id != CLOCK_REALTIME)
- tst_brk(TBROK, "%s: Invalid clk_id, exiting", tst_clock_name(clk_id));
-
- if (gettimeofday(&tval, NULL) < 0)
- tst_brk(TBROK | TERRNO, "gettimeofday() failed");
-
- /*
- * The array defines the type to TST_LIBC_TIMESPEC and so we can cast
- * this into struct timespec.
- */
- *((struct timespec *)ts) = tst_timespec_from_us(tst_timeval_to_us(tval));
- return 0;
-}
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
- { .clock_gettime = vdso_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "vDSO with old kernel spec"},
-#endif
-
-#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
- { .clock_gettime = vdso_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "vDSO time64 with kernel spec"},
-#endif
- { .clock_gettime = my_gettimeofday, .ts_type = TST_LIBC_TIMESPEC, .desc = "gettimeofday"},
-};
-
-static void setup(void)
-{
- if (tst_is_virt(VIRT_ANY)) {
- tst_res(TINFO, "Running in a virtual machine, multiply the delta by 10.");
- delta *= 10;
- }
-
- find_clock_gettime_vdso(&ptr_vdso_gettime, &ptr_vdso_gettime64);
-}
-
-static void run(unsigned int i)
-{
- struct tst_ts ts;
- long long start, end = 0, diff, slack;
- struct time64_variants *tv;
- int count = 10000, ret;
- unsigned int j;
-
- do {
- for (j = 0; j < ARRAY_SIZE(variants); j++) {
- /* Refresh time in start */
- start = end;
-
- tv = &variants[j];
- ts.type = tv->ts_type;
-
- /* Do gettimeofday() test only for CLOCK_REALTIME */
- if (tv->clock_gettime == my_gettimeofday && clks[i] != CLOCK_REALTIME)
- continue;
-
- ret = tv->clock_gettime(clks[i], tst_ts_get(&ts));
- if (ret) {
- /*
- * _vdso_gettime() sets error to ENOSYS if vdso
- * isn't available.
- */
- if (errno == ENOSYS)
- continue;
-
- tst_res(TFAIL | TERRNO, "%s: clock_gettime() failed (%d)",
- tst_clock_name(clks[i]), j);
- return;
- }
-
- end = tst_ts_to_ns(ts);
-
- /* Skip comparison on first traversal */
- if (count == 10000 && !j)
- continue;
-
- /*
- * gettimeofday() doesn't capture time less than 1 us,
- * add 999 to it.
- */
- if (tv->clock_gettime == my_gettimeofday)
- slack = 999;
- else
- slack = 0;
-
- diff = end + slack - start;
- if (diff < 0) {
- tst_res(TFAIL, "%s: Time travelled backwards (%d): %lld ns",
- tst_clock_name(clks[i]), j, diff);
- return;
- }
-
- diff /= 1000000;
-
- if (diff >= delta) {
- tst_res(TFAIL, "%s(%s): Difference between successive readings greater than %lld ms (%d): %lld",
- tst_clock_name(clks[i]), tv->desc, delta, j, diff);
- return;
- }
- }
- } while (--count);
-
- tst_res(TPASS, "%s: Difference between successive readings is reasonable for following variants:",
- tst_clock_name(clks[i]));
- for (j = 0; j < ARRAY_SIZE(variants); j++) {
- if (variants[j].clock_gettime == my_gettimeofday && clks[i] != CLOCK_REALTIME)
- continue;
- tst_res(TINFO, "\t- %s", variants[j].desc);
- }
-}
-
-static struct tst_test test = {
- .test = run,
- .setup = setup,
- .tcnt = ARRAY_SIZE(clks),
- .tags = (const struct tst_tag[]) {
- {"linux-git", "5b43bd184530"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/clock_nanosleep/.gitignore b/testcases/kernel/syscalls/clock_nanosleep/.gitignore
index 1ab03a335..6714ff468 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/.gitignore
+++ b/testcases/kernel/syscalls/clock_nanosleep/.gitignore
@@ -1,4 +1,2 @@
/clock_nanosleep01
/clock_nanosleep02
-/clock_nanosleep03
-/clock_nanosleep04
diff --git a/testcases/kernel/syscalls/clock_nanosleep/Makefile b/testcases/kernel/syscalls/clock_nanosleep/Makefile
index 262eef71b..71ebae98b 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/Makefile
+++ b/testcases/kernel/syscalls/clock_nanosleep/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
index 382497918..d1fb0ee66 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
@@ -6,21 +6,13 @@
* Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
* Copyright (c) 2016 Linux Test Project
*/
-/*
- * test status of errors on man page
- * EINTR v (function was interrupted by a signal)
- * EINVAL v (invalid tv_nsec, etc.)
- * ENOTSUP v (sleep not supported against the specified clock_id)
- * EFAULT v (Invalid request pointer)
- * EFAULT V (Invalid remain pointer when interrupted by a signal)
- */
#include <limits.h>
-#include "time64_variants.h"
-#include "tst_safe_clocks.h"
+#include "lapi/syscalls.h"
#include "tst_sig_proc.h"
#include "tst_timer.h"
+#include "tst_test.h"
static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
{
@@ -29,151 +21,78 @@ static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
enum test_type {
NORMAL,
SEND_SIGINT,
- BAD_TS_ADDR_REQ,
- BAD_TS_ADDR_REM,
};
#define TYPE_NAME(x) .ttype = x, .desc = #x
-static void *bad_addr;
-
struct test_case {
clockid_t clk_id; /* clock_* clock type parameter */
int ttype; /* test type (enum) */
const char *desc; /* test description (name) */
int flags; /* clock_nanosleep flags parameter */
- long tv_sec;
- long tv_nsec;
+ struct timespec rq;
int exp_ret;
int exp_err;
};
+/*
+ * test status of errors on man page
+ * EINTR v (function was interrupted by a signal)
+ * EINVAL v (invalid tv_nsec, etc.)
+ */
+
static struct test_case tcase[] = {
{
TYPE_NAME(NORMAL),
.clk_id = CLOCK_REALTIME,
.flags = 0,
- .tv_sec = 0,
- .tv_nsec = -1,
- .exp_ret = -1,
- .exp_err = EINVAL,
+ .rq = (struct timespec) {.tv_sec = 0, .tv_nsec = -1},
+ .exp_ret = EINVAL,
+ .exp_err = 0,
},
{
TYPE_NAME(NORMAL),
.clk_id = CLOCK_REALTIME,
.flags = 0,
- .tv_sec = 0,
- .tv_nsec = 1000000000,
- .exp_ret = -1,
- .exp_err = EINVAL,
+ .rq = (struct timespec) {.tv_sec = 0, .tv_nsec = 1000000000},
+ .exp_ret = EINVAL,
+ .exp_err = 0,
},
{
TYPE_NAME(NORMAL),
.clk_id = CLOCK_THREAD_CPUTIME_ID,
.flags = 0,
- .tv_sec = 0,
- .tv_nsec = 500000000,
- .exp_ret = -1,
- .exp_err = ENOTSUP,
+ .rq = (struct timespec) {.tv_sec = 0, .tv_nsec = 500000000},
+ .exp_ret = EINVAL,
+ .exp_err = 0,
},
{
TYPE_NAME(SEND_SIGINT),
.clk_id = CLOCK_REALTIME,
.flags = 0,
- .tv_sec = 10,
- .tv_nsec = 0,
- .exp_ret = -1,
- .exp_err = EINTR,
- },
- {
- TYPE_NAME(BAD_TS_ADDR_REQ),
- .clk_id = CLOCK_REALTIME,
- .flags = 0,
- .exp_ret = -1,
- .exp_err = EFAULT,
- },
- {
- TYPE_NAME(BAD_TS_ADDR_REM),
- .clk_id = CLOCK_REALTIME,
- .flags = 0,
- .tv_sec = 10,
- .tv_nsec = 0,
- .exp_ret = -1,
- .exp_err = EFAULT,
+ .rq = (struct timespec) {.tv_sec = 10, .tv_nsec = 0},
+ .exp_ret = EINTR,
+ .exp_err = 0,
},
};
-static struct tst_ts *rq;
-static struct tst_ts *rm;
-
-static struct time64_variants variants[] = {
- { .clock_nanosleep = libc_clock_nanosleep, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL)
- { .clock_nanosleep = sys_clock_nanosleep, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_nanosleep_time64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_nanosleep = sys_clock_nanosleep64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
void setup(void)
{
- rq->type = variants[tst_variant].ts_type;
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
SAFE_SIGNAL(SIGINT, sighandler);
- bad_addr = tst_get_bad_addr(NULL);
}
static void do_test(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
struct test_case *tc = &tcase[i];
+ struct timespec rm = {0};
pid_t pid = 0;
- void *request, *remain;
-
- memset(rm, 0, sizeof(*rm));
- rm->type = rq->type;
tst_res(TINFO, "case %s", tc->desc);
- if (tc->ttype == SEND_SIGINT || tc->ttype == BAD_TS_ADDR_REM)
+ if (tc->ttype == SEND_SIGINT)
pid = create_sig_proc(SIGINT, 40, 500000);
- tst_ts_set_sec(rq, tc->tv_sec);
- tst_ts_set_nsec(rq, tc->tv_nsec);
-
- if (tc->ttype == BAD_TS_ADDR_REQ)
- request = bad_addr;
- else
- request = tst_ts_get(rq);
-
- if (tc->ttype == BAD_TS_ADDR_REM)
- remain = bad_addr;
- else
- remain = tst_ts_get(rm);
-
- TEST(tv->clock_nanosleep(tc->clk_id, tc->flags, request, remain));
-
- if (tv->clock_nanosleep == libc_clock_nanosleep) {
- /*
- * The return value and error number are differently set for
- * libc syscall as compared to kernel syscall.
- */
- if (TST_RET) {
- TST_ERR = TST_RET;
- TST_RET = -1;
- }
-
- /*
- * nsleep isn't implemented by kernelf or
- * CLOCK_THREAD_CPUTIME_ID and it returns ENOTSUP, but libc
- * changes that error value to EINVAL.
- */
- if (tc->clk_id == CLOCK_THREAD_CPUTIME_ID)
- tc->exp_err = EINVAL;
- }
+ TEST(clock_nanosleep(tc->clk_id, tc->flags, &tc->rq, &rm));
if (pid) {
SAFE_KILL(pid, SIGTERM);
@@ -181,13 +100,15 @@ static void do_test(unsigned int i)
}
if (tc->ttype == SEND_SIGINT) {
- long long expect_ms = tst_ts_to_ms(*rq);
- long long remain_ms = tst_ts_to_ms(*rm);
+ long long expect_ms = tst_timespec_to_ms(tc->rq);
+ long long remain_ms = tst_timespec_to_ms(rm);
- if (tst_ts_valid(rm)) {
+ tst_res(TINFO, "remain time: %lds %ldns", rm.tv_sec, rm.tv_nsec);
+
+ if (!rm.tv_sec && !rm.tv_nsec) {
tst_res(TFAIL | TTERRNO,
"The clock_nanosleep() haven't updated"
- " timespec or it's not valid");
+ " timestamp with remaining time");
return;
}
@@ -197,29 +118,22 @@ static void do_test(unsigned int i)
remain_ms, expect_ms);
return;
}
-
- tst_res(TPASS, "Timespec updated correctly");
}
- if ((TST_RET != tc->exp_ret) || (TST_ERR != tc->exp_err)) {
+ if (TST_RET != tc->exp_ret) {
tst_res(TFAIL | TTERRNO, "returned %ld, expected %d,"
" expected errno: %s (%d)", TST_RET,
tc->exp_ret, tst_strerrno(tc->exp_err), tc->exp_err);
return;
}
- tst_res(TPASS | TTERRNO, "clock_nanosleep() failed with");
+ tst_res(TPASS, "returned %s (%ld)",
+ tst_strerrno(TST_RET), TST_RET);
}
static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcase),
.test = do_test,
- .test_variants = ARRAY_SIZE(variants),
.setup = setup,
.forks_child = 1,
- .bufs = (struct tst_buffers []) {
- {&rq, .size = sizeof(*rq)},
- {&rm, .size = sizeof(*rm)},
- {},
- }
};
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c
index feb3e4791..a79ef5e90 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
@@ -14,7 +27,7 @@
int sample_fn(int clk_id, long long usec)
{
- struct timespec t = tst_timespec_from_us(usec);
+ struct timespec t = tst_us_to_timespec(usec);
tst_timer_start(clk_id);
TEST(clock_nanosleep(clk_id, 0, &t, NULL));
@@ -22,7 +35,7 @@ int sample_fn(int clk_id, long long usec)
tst_timer_sample();
if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TFAIL | TERRNO,
"nanosleep() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
deleted file mode 100644
index 5bd91fa61..000000000
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
+++ /dev/null
@@ -1,111 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
- * [Description]
- *
- * Test that clock_nanosleep() adds correctly an offset with absolute timeout
- * and CLOCK_MONOTONIC inside of a timer namespace.
- *
- * After a call to unshare(CLONE_NEWTIME) a new timer namespace is created, the
- * process that has called the unshare() can adjust offsets for CLOCK_MONOTONIC
- * and CLOCK_BOOTTIME for its children by writing to the '/proc/self/timens_offsets'.
- */
-
-#include <stdlib.h>
-#include "time64_variants.h"
-#include "tst_safe_clocks.h"
-#include "tst_timer.h"
-#include "lapi/namespaces_constants.h"
-
-#define OFFSET_S 10
-#define SLEEP_US 100000
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .clock_nanosleep = libc_clock_nanosleep, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .clock_nanosleep = sys_clock_nanosleep, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_nanosleep_time64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .clock_nanosleep = sys_clock_nanosleep64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void do_clock_gettime(struct time64_variants *tv, struct tst_ts *ts)
-{
- int ret;
-
- ret = tv->clock_gettime(CLOCK_MONOTONIC, tst_ts_get(ts));
- if (ret == -1)
- tst_brk(TBROK | TERRNO, "clock_settime(CLOCK_MONOTONIC) failed");
-}
-
-static void verify_clock_nanosleep(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct tst_ts start, end, sleep_abs;
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
-
- start.type = end.type = sleep_abs.type = tv->ts_type;
-
- SAFE_UNSHARE(CLONE_NEWTIME);
-
- SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0", CLOCK_MONOTONIC, OFFSET_S);
-
- do_clock_gettime(tv, &start);
-
- sleep_abs = tst_ts_add_us(start, 1000000 * OFFSET_S + SLEEP_US);
-
- if (!SAFE_FORK()) {
- TEST(tv->clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, tst_ts_get(&sleep_abs), NULL));
- /*
- * The return value and error number are differently set for
- * libc syscall as compared to kernel syscall.
- */
- if ((tv->clock_nanosleep == libc_clock_nanosleep) && TST_RET) {
- TST_ERR = TST_RET;
- TST_RET = -1;
- }
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "clock_nanosleep(2) failed for clock %s",
- tst_clock_name(CLOCK_MONOTONIC));
- }
-
- exit(0);
- }
-
- SAFE_WAIT(NULL);
-
- do_clock_gettime(tv, &end);
-
- long long diff = tst_ts_diff_us(end, start);
-
- if (diff > 5 * SLEEP_US) {
- tst_res(TFAIL, "clock_nanosleep() slept too long %lli", diff);
- return;
- }
-
- if (diff < SLEEP_US) {
- tst_res(TFAIL, "clock_nanosleep() slept too short %lli", diff);
- return;
- }
-
- tst_res(TPASS, "clock_nanosleep() slept correctly %lli", diff);
-}
-
-static struct tst_test test = {
- .test_all = verify_clock_nanosleep,
- .test_variants = ARRAY_SIZE(variants),
- .needs_root = 1,
- .forks_child = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_TIME_NS=y",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c
deleted file mode 100644
index c5aeed505..000000000
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) M. Koehrer <mathias_koehrer@arcor.de>, 2009
- * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
- */
-
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-#include "time64_variants.h"
-#include "tst_safe_clocks.h"
-#include "tst_timer.h"
-
-static clockid_t tcase[] = {
- CLOCK_MONOTONIC,
- CLOCK_REALTIME,
-};
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .clock_nanosleep = libc_clock_nanosleep, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .clock_nanosleep = sys_clock_nanosleep, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_nanosleep_time64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .clock_nanosleep = sys_clock_nanosleep64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-void setup(void)
-{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-}
-
-static void do_test(unsigned int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct tst_ts ts = {.type = tv->ts_type};
-
- TEST(tv->clock_gettime(tcase[i], tst_ts_get(&ts)));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "clock_gettime(2) failed for clock %s",
- tst_clock_name(tcase[i]));
- return;
- }
-
- ts = tst_ts_add_us(ts, 10000);
-
- TEST(tv->clock_nanosleep(tcase[i], TIMER_ABSTIME, tst_ts_get(&ts), NULL));
-
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "clock_nanosleep(2) failed for clock %s",
- tst_clock_name(tcase[i]));
- }
-
- tst_res(TPASS, "clock_nanosleep(2) passed for clock %s",
- tst_clock_name(tcase[i]));
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcase),
- .test = do_test,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
-};
diff --git a/testcases/kernel/syscalls/clock_nanosleep2/.gitignore b/testcases/kernel/syscalls/clock_nanosleep2/.gitignore
new file mode 100644
index 000000000..5be9cd0e8
--- /dev/null
+++ b/testcases/kernel/syscalls/clock_nanosleep2/.gitignore
@@ -0,0 +1 @@
+/clock_nanosleep2_01
diff --git a/testcases/kernel/syscalls/clock_nanosleep2/Makefile b/testcases/kernel/syscalls/clock_nanosleep2/Makefile
new file mode 100644
index 000000000..71ebae98b
--- /dev/null
+++ b/testcases/kernel/syscalls/clock_nanosleep2/Makefile
@@ -0,0 +1,25 @@
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+LDLIBS += -lpthread -lrt
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c b/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
new file mode 100644
index 000000000..d82d74d2d
--- /dev/null
+++ b/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) M. Koehrer <mathias_koehrer@arcor.de>, 2009
+ * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+#define NSEC_IN_SEC 1000000000
+
+const clockid_t CLOCK_TO_USE = CLOCK_MONOTONIC;
+static int clock_nanosleep2(clockid_t clock_id, int flags,
+ const struct timespec *req, struct timespec *rem)
+{
+ return tst_syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
+}
+
+static void verify_clock_nanosleep2(void)
+{
+ struct timespec ts;
+
+ clock_gettime(CLOCK_TO_USE, &ts);
+ ts.tv_nsec += NSEC_IN_SEC/10;
+ if (ts.tv_nsec >= NSEC_IN_SEC) {
+ ts.tv_sec += 1;
+ ts.tv_nsec %= NSEC_IN_SEC;
+ }
+
+ TEST(clock_nanosleep2(CLOCK_TO_USE, TIMER_ABSTIME, &ts, NULL));
+
+ if (TST_RET)
+ tst_res(TFAIL | TTERRNO, "clock_nanosleep2() failed");
+ else
+ tst_res(TPASS, "clock_nanosleep2() passed");
+}
+
+static struct tst_test test = {
+ .test_all = verify_clock_nanosleep2,
+};
diff --git a/testcases/kernel/syscalls/clock_settime/.gitignore b/testcases/kernel/syscalls/clock_settime/.gitignore
index b66169b3e..281217550 100644
--- a/testcases/kernel/syscalls/clock_settime/.gitignore
+++ b/testcases/kernel/syscalls/clock_settime/.gitignore
@@ -1,3 +1,2 @@
clock_settime01
clock_settime02
-clock_settime03
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime01.c b/testcases/kernel/syscalls/clock_settime/clock_settime01.c
index 19bddbcd3..62d349154 100644
--- a/testcases/kernel/syscalls/clock_settime/clock_settime01.c
+++ b/testcases/kernel/syscalls/clock_settime/clock_settime01.c
@@ -14,63 +14,33 @@
*/
#include "config.h"
-#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
#define DELTA_SEC 10
#define DELTA_US (long long) (DELTA_SEC * 1000000)
#define DELTA_EPS (long long) (DELTA_US * 0.1)
-static struct tst_ts *begin, *change, *end;
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .clock_settime = libc_clock_settime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_clock_settime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
-{
- begin->type = change->type = end->type = variants[tst_variant].ts_type;
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-}
-
-static void do_clock_gettime(struct time64_variants *tv, struct tst_ts *ts)
-{
- int ret;
-
- ret = tv->clock_gettime(CLOCK_REALTIME, tst_ts_get(ts));
- if (ret == -1)
- tst_brk(TBROK | TERRNO, "clock_settime(CLOCK_REALTIME) failed");
-}
+static struct timespec *begin, *change, *end;
static void verify_clock_settime(void)
{
- struct time64_variants *tv = &variants[tst_variant];
long long elapsed;
/* test 01: move forward */
- do_clock_gettime(tv, begin);
- *change = tst_ts_add_us(*begin, DELTA_US);
+ SAFE_CLOCK_GETTIME(CLOCK_REALTIME, begin);
- TEST(tv->clock_settime(CLOCK_REALTIME, tst_ts_get(change)));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "clock_settime(2) failed for clock %s",
- tst_clock_name(CLOCK_REALTIME));
- return;
- }
+ *change = tst_timespec_add_us(*begin, DELTA_US);
- do_clock_gettime(tv, end);
+ if (clock_settime(CLOCK_REALTIME, change) != 0)
+ tst_brk(TBROK | TTERRNO, "could not set realtime change");
- elapsed = tst_ts_diff_us(*end, *begin);
+ SAFE_CLOCK_GETTIME(CLOCK_REALTIME, end);
+
+ elapsed = tst_timespec_diff_us(*end, *begin);
if (elapsed >= DELTA_US && elapsed < (DELTA_US + DELTA_EPS))
tst_res(TPASS, "clock_settime(2): was able to advance time");
@@ -78,20 +48,17 @@ static void verify_clock_settime(void)
tst_res(TFAIL, "clock_settime(2): could not advance time");
/* test 02: move backward */
- do_clock_gettime(tv, begin);
- *change = tst_ts_sub_us(*begin, DELTA_US);
+ SAFE_CLOCK_GETTIME(CLOCK_REALTIME, begin);
- TEST(tv->clock_settime(CLOCK_REALTIME, tst_ts_get(change)));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "clock_settime(2) failed for clock %s",
- tst_clock_name(CLOCK_REALTIME));
- return;
- }
+ *change = tst_timespec_sub_us(*begin, DELTA_US);
+
+ if (clock_settime(CLOCK_REALTIME, change) != 0)
+ tst_brk(TBROK | TTERRNO, "could not set realtime change");
- do_clock_gettime(tv, end);
+ SAFE_CLOCK_GETTIME(CLOCK_REALTIME, end);
- elapsed = tst_ts_diff_us(*end, *begin);
+ elapsed = tst_timespec_diff_us(*end, *begin);
if (~(elapsed) <= DELTA_US && ~(elapsed) > (DELTA_US - DELTA_EPS))
tst_res(TPASS, "clock_settime(2): was able to recede time");
@@ -101,8 +68,6 @@ static void verify_clock_settime(void)
static struct tst_test test = {
.test_all = verify_clock_settime,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
.needs_root = 1,
.restore_wallclock = 1,
.bufs = (struct tst_buffers []) {
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime02.c b/testcases/kernel/syscalls/clock_settime/clock_settime02.c
index 88d449245..e16e9061a 100644
--- a/testcases/kernel/syscalls/clock_settime/clock_settime02.c
+++ b/testcases/kernel/syscalls/clock_settime/clock_settime02.c
@@ -9,21 +9,19 @@
*/
#include "config.h"
-#include "time64_variants.h"
+#include "tst_test.h"
+#include "lapi/syscalls.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
#define DELTA_SEC 10
#define NSEC_PER_SEC (1000000000L)
-static void *bad_addr;
-
struct test_case {
clockid_t type;
+ struct timespec newtime;
int exp_err;
int replace;
- long tv_sec;
- long tv_nsec;
};
struct test_case tc[] = {
@@ -31,29 +29,24 @@ struct test_case tc[] = {
.type = CLOCK_REALTIME,
.exp_err = EFAULT,
.replace = 1,
- .tv_sec = 0,
- .tv_nsec = 0,
},
{ /* case 02: REALTIME: tv_sec = -1 */
.type = CLOCK_REALTIME,
+ .newtime.tv_sec = -1,
.exp_err = EINVAL,
.replace = 1,
- .tv_sec = -1,
- .tv_nsec = 0,
},
{ /* case 03: REALTIME: tv_nsec = -1 */
.type = CLOCK_REALTIME,
+ .newtime.tv_nsec = -1,
.exp_err = EINVAL,
.replace = 1,
- .tv_sec = 0,
- .tv_nsec = -1,
},
{ /* case 04: REALTIME: tv_nsec = 1s+1 */
.type = CLOCK_REALTIME,
+ .newtime.tv_nsec = NSEC_PER_SEC + 1,
.exp_err = EINVAL,
.replace = 1,
- .tv_sec = 0,
- .tv_nsec = NSEC_PER_SEC + 1,
},
{ /* case 05: MONOTONIC */
.type = CLOCK_MONOTONIC,
@@ -90,77 +83,64 @@ struct test_case tc[] = {
},
};
-static struct tst_ts spec;
-
-static struct time64_variants variants[] = {
-#if (__NR_clock_settime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
+/*
+ * Some tests may cause libc to segfault when passing bad arguments.
+ */
+static int sys_clock_settime(clockid_t clk_id, struct timespec *tp)
{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-
- bad_addr = tst_get_bad_addr(NULL);
+ return tst_syscall(__NR_clock_settime, clk_id, tp);
}
static void verify_clock_settime(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
- void *ts;
+ struct timespec spec, *specptr;
- spec.type = tv->ts_type;
+ specptr = &spec;
if (tc[i].replace == 0) {
- TEST(tv->clock_gettime(CLOCK_REALTIME, tst_ts_get(&spec)));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "clock_gettime(2) failed for clock %s",
- tst_clock_name(CLOCK_REALTIME));
- return;
- }
+
+ SAFE_CLOCK_GETTIME(CLOCK_REALTIME, specptr);
/* add 1 sec to wall clock */
- spec = tst_ts_add_us(spec, 1000000);
+ specptr->tv_sec += 1;
+
} else {
+
/* use given time spec */
- tst_ts_set_sec(&spec, tc[i].tv_sec);
- tst_ts_set_nsec(&spec, tc[i].tv_nsec);
+ *specptr = tc[i].newtime;
}
/* bad pointer case */
if (tc[i].exp_err == EFAULT)
- ts = bad_addr;
- else
- ts = tst_ts_get(&spec);
+ specptr = tst_get_bad_addr(NULL);
- TEST(tv->clock_settime(tc[i].type, ts));
+ TEST(sys_clock_settime(tc[i].type, specptr));
- if (TST_RET != -1) {
- tst_res(TFAIL | TTERRNO, "clock_settime(2): clock %s passed unexpectedly, expected %s",
+ if (TST_RET == -1) {
+
+ if (tc[i].exp_err == TST_ERR) {
+ tst_res(TPASS | TTERRNO,
+ "clock_settime(%s): failed as expected",
+ tst_clock_name(tc[i].type));
+ return;
+ }
+
+ tst_res(TFAIL | TTERRNO, "clock_settime(2): clock %s "
+ "expected to fail with %s",
tst_clock_name(tc[i].type),
tst_strerrno(tc[i].exp_err));
- return;
- }
- if (tc[i].exp_err == TST_ERR) {
- tst_res(TPASS | TTERRNO, "clock_settime(%s): failed as expected",
- tst_clock_name(tc[i].type));
return;
}
- tst_res(TFAIL | TTERRNO, "clock_settime(2): clock %s " "expected to fail with %s",
- tst_clock_name(tc[i].type), tst_strerrno(tc[i].exp_err));
+ tst_res(TFAIL | TTERRNO, "clock_settime(2): clock %s passed "
+ "unexpectedly, expected %s",
+ tst_clock_name(tc[i].type),
+ tst_strerrno(tc[i].exp_err));
}
static struct tst_test test = {
.test = verify_clock_settime,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
.tcnt = ARRAY_SIZE(tc),
.needs_root = 1,
.restore_wallclock = 1,
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime03.c b/testcases/kernel/syscalls/clock_settime/clock_settime03.c
deleted file mode 100644
index c25277d92..000000000
--- a/testcases/kernel/syscalls/clock_settime/clock_settime03.c
+++ /dev/null
@@ -1,112 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar<viresh.kumar@linaro.org>
- *
- * Check Year 2038 related vulnerabilities.
- */
-
-#include <signal.h>
-#include "config.h"
-#include "time64_variants.h"
-#include "tst_timer.h"
-#include "tst_safe_clocks.h"
-
-#define TIMER_DELTA 3
-#define ALLOWED_DELTA (50 * 1000) /* 50 ms */
-
-static struct tst_ts start, end;
-static struct tst_its its;
-
-static struct time64_variants variants[] = {
-#if (__NR_clock_settime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .timer_settime = sys_timer_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .timer_settime = sys_timer_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- start.type = end.type = its.type = tv->ts_type;
-
- /* Check if the kernel is y2038 safe */
- if (tv->ts_type == TST_KERN_OLD_TIMESPEC &&
- sizeof(start.ts.kern_old_ts.tv_sec) == 4) {
- tst_brk(TCONF, "Not Y2038 safe to run test");
- }
-}
-
-static void run(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- unsigned long long time = 0x7FFFFFFE; /* Time just before y2038 */
- struct sigevent ev = {
- .sigev_notify = SIGEV_SIGNAL,
- .sigev_signo = SIGABRT,
- };
- long long diff;
- kernel_timer_t timer;
- sigset_t set;
- int sig, ret;
-
- SAFE_SIGEMPTYSET(&set);
- SAFE_SIGADDSET(&set, SIGABRT);
- SAFE_SIGPROCMASK(SIG_BLOCK, &set, NULL);
-
- TEST(tst_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer));
- if (TST_RET != 0)
- tst_brk(TBROK | TTERRNO, "timer_create() failed");
-
- tst_ts_set_sec(&start, time);
- tst_ts_set_nsec(&start, 0);
-
- ret = tv->clock_settime(CLOCK_REALTIME, tst_ts_get(&start));
- if (ret == -1)
- tst_brk(TBROK | TERRNO, "clock_settime() failed");
-
- tst_its_set_interval_sec(&its, 0);
- tst_its_set_interval_nsec(&its, 0);
- tst_its_set_value_sec(&its, time + TIMER_DELTA);
- tst_its_set_value_nsec(&its, 0);
-
- TEST(tv->timer_settime(timer, TIMER_ABSTIME, tst_its_get(&its), NULL));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "timer_settime() failed");
-
- SAFE_SIGWAIT(&set, &sig);
-
- ret = tv->clock_gettime(CLOCK_REALTIME, tst_ts_get(&end));
- if (ret == -1)
- tst_brk(TBROK | TERRNO, "clock_gettime() failed");
-
- if (sig != SIGABRT) {
- tst_res(TFAIL, "clock_settime(): Y2038 test failed");
- return;
- }
-
- diff = tst_ts_diff_ms(end, start);
-
- if (diff < TIMER_DELTA * 1000) {
- tst_res(TFAIL, "Timer expired too soon, after %llims", diff);
- return;
- }
-
- if (diff > TIMER_DELTA * 1000 + ALLOWED_DELTA)
- tst_res(TINFO, "Time expired too late, after %llims", diff);
- else
- tst_res(TPASS, "clock_settime(): Y2038 test passed");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_root = 1,
- .restore_wallclock = 1,
-};
diff --git a/testcases/kernel/syscalls/clone/Makefile b/testcases/kernel/syscalls/clone/Makefile
index 1957711b0..2ded37c00 100644
--- a/testcases/kernel/syscalls/clone/Makefile
+++ b/testcases/kernel/syscalls/clone/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
index 3de1fe9bb..aace30806 100644
--- a/testcases/kernel/syscalls/clone/clone08.c
+++ b/testcases/kernel/syscalls/clone/clone08.c
@@ -16,7 +16,6 @@
#include "tst_test.h"
#include "clone_platform.h"
#include "lapi/syscalls.h"
-#include "lapi/futex.h"
static pid_t ptid, ctid, tgid;
static void *child_stack;
@@ -160,7 +159,7 @@ static void test_clone_stopped(int t)
child = clone_child(&test_cases[t]);
- TST_PROCESS_STATE_WAIT(child, 'T', 0);
+ TST_PROCESS_STATE_WAIT(child, 'T');
stopped_flag = 0;
diff --git a/testcases/kernel/syscalls/clone3/.gitignore b/testcases/kernel/syscalls/clone3/.gitignore
deleted file mode 100644
index 604cb903e..000000000
--- a/testcases/kernel/syscalls/clone3/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-clone301
-clone302
diff --git a/testcases/kernel/syscalls/clone3/Makefile b/testcases/kernel/syscalls/clone3/Makefile
deleted file mode 100644
index 18896b6f2..000000000
--- a/testcases/kernel/syscalls/clone3/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/clone3/clone301.c b/testcases/kernel/syscalls/clone3/clone301.c
deleted file mode 100644
index 7ac4bb5a3..000000000
--- a/testcases/kernel/syscalls/clone3/clone301.c
+++ /dev/null
@@ -1,185 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic clone3() test.
- */
-
-#define _GNU_SOURCE
-
-#include <stdlib.h>
-#include <sys/wait.h>
-
-#include "tst_test.h"
-#include "lapi/clone.h"
-#include "lapi/pidfd_send_signal.h"
-
-#define CHILD_SIGNAL SIGUSR1
-#define DATA 777
-
-static int pidfd, child_tid, parent_tid, parent_received_signal;
-static volatile int child_received_signal, child_data;
-static struct clone_args *args;
-
-static struct tcase {
- uint64_t flags;
- int exit_signal;
-} tcases[] = {
- {0, SIGCHLD},
- {0, SIGUSR2},
- {CLONE_FS, SIGCHLD},
- {CLONE_NEWPID, SIGCHLD},
- {CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_PIDFD, SIGCHLD},
-};
-
-static void parent_rx_signal(int sig)
-{
- parent_received_signal = sig;
-}
-
-static void child_rx_signal(int sig, siginfo_t *info, void *ucontext)
-{
- (void) ucontext;
-
- child_received_signal = sig;
- child_data = info->si_value.sival_int;
-}
-
-static struct sigaction psig_action = {
- .sa_handler = parent_rx_signal,
-};
-
-static struct sigaction csig_action = {
- .sa_sigaction = child_rx_signal,
- .sa_flags = SA_SIGINFO,
-};
-
-static siginfo_t uinfo = {
- .si_signo = CHILD_SIGNAL,
- .si_code = SI_QUEUE,
- .si_value.sival_int = DATA,
-};
-
-
-static void do_child(int clone_pidfd)
-{
- int count = 1000;
-
- if (clone_pidfd) {
- child_received_signal = 0;
- child_data = 0;
-
- SAFE_SIGACTION(CHILD_SIGNAL, &csig_action, NULL);
-
- TST_CHECKPOINT_WAKE(0);
-
- while (child_received_signal != CHILD_SIGNAL && --count)
- usleep(100);
-
- if (!child_received_signal) {
- tst_res(TFAIL, "Child haven't got signal");
- exit(0);
- }
-
- if (child_received_signal != CHILD_SIGNAL) {
- tst_res(TFAIL, "Child got %s (%i) signal expected %s",
- tst_strsig(child_received_signal),
- child_received_signal,
- tst_strsig(CHILD_SIGNAL));
- exit(0);
- }
-
- tst_res(TPASS, "Child got correct signal %s",
- tst_strsig(CHILD_SIGNAL));
-
- if (child_data != DATA) {
- tst_res(TFAIL, "Child got wrong si_value=%i expected %i",
- child_data, DATA);
- } else {
- tst_res(TPASS, "Child got correct si_value");
- }
- }
-
- exit(0);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int status, clone_pidfd = tc->flags & CLONE_PIDFD;
- pid_t pid;
-
- args->flags = tc->flags;
- args->pidfd = (uint64_t)(&pidfd);
- args->child_tid = (uint64_t)(&child_tid);
- args->parent_tid = (uint64_t)(&parent_tid);
- args->exit_signal = tc->exit_signal;
- args->stack = 0;
- args->stack_size = 0;
- args->tls = 0;
-
- parent_received_signal = 0;
- SAFE_SIGACTION(tc->exit_signal, &psig_action, NULL);
-
- TEST(pid = clone3(args, sizeof(*args)));
- if (pid < 0) {
- tst_res(TFAIL | TTERRNO, "clone3() failed (%d)", n);
- return;
- }
-
- if (!pid)
- do_child(clone_pidfd);
-
- /* Need to send signal to child process */
- if (clone_pidfd) {
- TST_CHECKPOINT_WAIT(0);
-
- TEST(pidfd_send_signal(pidfd, CHILD_SIGNAL, &uinfo, 0));
- if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO, "pidfd_send_signal() failed");
- return;
- }
- }
-
- SAFE_WAITPID(pid, &status, __WALL);
-
- if (!parent_received_signal) {
- tst_res(TFAIL, "Parent haven't got signal");
- return;
- }
-
- if (parent_received_signal != tc->exit_signal) {
- tst_res(TFAIL, "Parent got %s (%i) signal expected %s",
- tst_strsig(parent_received_signal),
- parent_received_signal,
- tst_strsig(tc->exit_signal));
- return;
- }
-
- tst_res(TPASS, "Parent got correct signal %s",
- tst_strsig(parent_received_signal));
-}
-
-static void setup(void)
-{
- clone3_supported_by_kernel();
-
- uinfo.si_pid = getpid();
- uinfo.si_uid = getuid();
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_root = 1,
- .needs_checkpoints = 1,
- .bufs = (struct tst_buffers []) {
- {&args, .size = sizeof(*args)},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/clone3/clone302.c b/testcases/kernel/syscalls/clone3/clone302.c
deleted file mode 100644
index 08d6417ce..000000000
--- a/testcases/kernel/syscalls/clone3/clone302.c
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic clone3() test to check various failures.
- */
-
-#define _GNU_SOURCE
-
-#include <stdlib.h>
-
-#include "tst_test.h"
-#include "lapi/clone.h"
-
-static struct clone_args *valid_args, *invalid_args;
-unsigned long stack;
-static int *invalid_address;
-
-static struct tcase {
- const char *name;
- struct clone_args **args;
- size_t size;
- uint64_t flags;
- int **pidfd;
- int exit_signal;
- unsigned long stack;
- unsigned long stack_size;
- unsigned long tls;
- int exp_errno;
-} tcases[] = {
- {"invalid args", &invalid_args, sizeof(*valid_args), 0, NULL, SIGCHLD, 0, 0, 0, EFAULT},
- {"zero size", &valid_args, 0, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"short size", &valid_args, sizeof(*valid_args) - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"extra size", &valid_args, sizeof(*valid_args) + 1, 0, NULL, SIGCHLD, 0, 0, 0, EFAULT},
- {"sighand-no-VM", &valid_args, sizeof(*valid_args), CLONE_SIGHAND, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"thread-no-sighand", &valid_args, sizeof(*valid_args), CLONE_THREAD, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"fs-newns", &valid_args, sizeof(*valid_args), CLONE_FS | CLONE_NEWNS, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"invalid pidfd", &valid_args, sizeof(*valid_args), CLONE_PIDFD, &invalid_address, SIGCHLD, 0, 0, 0, EFAULT},
- {"invalid signal", &valid_args, sizeof(*valid_args), 0, NULL, CSIGNAL + 1, 0, 0, 0, EINVAL},
- {"zero-stack-size", &valid_args, sizeof(*valid_args), 0, NULL, SIGCHLD, (unsigned long)&stack, 0, 0, EINVAL},
- {"invalid-stack", &valid_args, sizeof(*valid_args), 0, NULL, SIGCHLD, 0, 4, 0, EINVAL},
- /*
- * Don't test CLONE_CHILD_SETTID and CLONE_PARENT_SETTID:
- * When the parent tid is written to the memory location for
- * CLONE_PARENT_SETTID we're past the point of no return of process
- * creation, i.e. the return value from put_user() isn't checked and
- * can't be checked anymore so you'd never receive EFAULT for a bogus
- * parent_tid memory address.
- *
- * https://lore.kernel.org/linux-m68k/20200627122332.ki2otaiw3v7wndbl@wittgenstein/T/#u
- */
-};
-
-static void setup(void)
-{
- clone3_supported_by_kernel();
-
- void *p = tst_get_bad_addr(NULL);
-
- invalid_args = p;
- invalid_address = p;
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- struct clone_args *args = *tc->args;
-
- if (args == valid_args) {
- args->flags = tc->flags;
- if (tc->pidfd)
- args->pidfd = (uint64_t)(*tc->pidfd);
- else
- args->pidfd = 0;
- args->exit_signal = tc->exit_signal;
- args->stack = tc->stack;
- args->stack_size = tc->stack_size;
- args->tls = tc->tls;
- }
-
- TEST(clone3(args, tc->size));
-
- if (!TST_RET)
- exit(EXIT_SUCCESS);
-
- if (TST_RET >= 0) {
- tst_res(TFAIL, "%s: clone3() passed unexpectedly", tc->name);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: clone3() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: clone3() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_tmpdir = 1,
- .bufs = (struct tst_buffers []) {
- {&valid_args, .size = sizeof(*valid_args)},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/close/.gitignore b/testcases/kernel/syscalls/close/.gitignore
index 07d25bccf..11cfd8553 100644
--- a/testcases/kernel/syscalls/close/.gitignore
+++ b/testcases/kernel/syscalls/close/.gitignore
@@ -1,2 +1,3 @@
/close01
/close02
+/close08
diff --git a/testcases/kernel/syscalls/close/Makefile b/testcases/kernel/syscalls/close/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/close/Makefile
+++ b/testcases/kernel/syscalls/close/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/close/close01.c b/testcases/kernel/syscalls/close/close01.c
index f2d30a693..c734ff7d2 100644
--- a/testcases/kernel/syscalls/close/close01.c
+++ b/testcases/kernel/syscalls/close/close01.c
@@ -1,57 +1,124 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
- *
- * Test that closing a file/pipe/socket works correctly.
+/*
+ * DESCRIPTION
+ * Test that closing a regular file and a pipe works correctly
*/
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
-#define FILENAME "close01_testfile"
+void cleanup(void);
+void setup(void);
-static int get_fd_file(void)
-{
- return SAFE_OPEN(FILENAME, O_RDWR | O_CREAT, 0700);
-}
+char *TCID = "close01";
+int TST_TOTAL = 2;
-static int get_fd_pipe(void)
-{
- int pipefildes[2];
- SAFE_PIPE(pipefildes);
- SAFE_CLOSE(pipefildes[1]);
- return pipefildes[0];
-}
+char fname[40] = "";
-static int get_fd_socket(void)
-{
- return SAFE_SOCKET(AF_INET, SOCK_STREAM, 0);
-}
+int fild, newfd, pipefildes[2];
struct test_case_t {
- int (*get_fd) ();
+ int *fd;
char *type;
-} tc[] = {
- {get_fd_file, "file"},
- {get_fd_pipe, "pipe"},
- {get_fd_socket, "socket"}
+} TC[] = {
+ /* file descriptor for a regular file */
+ {
+ &newfd, "file"},
+ /* file descriptor for a pipe */
+ {
+ &pipefildes[0], "pipe"}
};
-static void run(unsigned int i)
+int main(int ac, char **av)
+{
+
+ int i;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ if ((fild = creat(fname, 0777)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "can't open file %s",
+ fname);
+
+ if ((newfd = dup(fild)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "can't dup the file des");
+
+ SAFE_PIPE(cleanup, pipefildes);
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ TEST(close(*TC[i].fd));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "call failed unexpectedly");
+ continue;
+ }
+
+ if (close(*TC[i].fd) == -1) {
+ tst_resm(TPASS, "%s appears closed",
+ TC[i].type);
+ } else {
+ tst_resm(TFAIL, "%s close succeeded on"
+ "second attempt", TC[i].type);
+ }
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+void setup(void)
{
- TST_EXP_PASS(close(tc[i].get_fd()), "close a %s fd", tc[i].type);
+ int mypid;
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ umask(0);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ mypid = getpid();
+ sprintf(fname, "fname.%d", mypid);
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .needs_tmpdir = 1,
- .test = run,
-};
+void cleanup(void)
+{
+ close(fild);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/close/close02.c b/testcases/kernel/syscalls/close/close02.c
index d317cc63b..ddda5d9ec 100644
--- a/testcases/kernel/syscalls/close/close02.c
+++ b/testcases/kernel/syscalls/close/close02.c
@@ -1,25 +1,121 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * close02.c
+ *
+ * DESCRIPTION
+ * Check that an invalid file descriptor returns EBADF
+ *
+ * ALGORITHM
+ * loop if that option is specified
+ * call close using the TEST macro and passing in an invalid fd
+ * if the call succeedes
+ * issue a FAIL message
+ * else
+ * log the errno
+ * if the errno == EBADF
+ * issue a PASS message
+ * else
+ * issue a FAIL message
+ * cleanup
+ *
+ * USAGE: <for command-line>
+ * close02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * Call close(-1) and expects it to return EBADF.
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * None
*/
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
-#include "tst_test.h"
+#include "test.h"
+
+void cleanup(void);
+void setup(void);
+
+char *TCID = "close02";
+int TST_TOTAL = 1;
+
+int main(int ac, char **av)
+{
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ /* The following loop checks looping state if -i option given */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
-static void run(void)
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ TEST(close(-1));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "Closed a non existent fildes");
+ } else {
+ if (TEST_ERRNO != EBADF) {
+ tst_resm(TFAIL, "close() FAILED to set errno "
+ "to EBADF on an invalid fd, got %d",
+ errno);
+ } else {
+ tst_resm(TPASS, "call returned EBADF");
+ }
+ }
+ }
+ cleanup();
+
+ tst_exit();
+
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
+void setup(void)
{
- TST_EXP_FAIL(close(-1), EBADF);
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ umask(0);
+
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .test_all = run,
-};
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/close/close08.c b/testcases/kernel/syscalls/close/close08.c
new file mode 100644
index 000000000..ccdefa173
--- /dev/null
+++ b/testcases/kernel/syscalls/close/close08.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
+ */
+/* $Id: close08.c,v 1.6 2009/10/13 14:00:46 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : close08
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for close(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) close(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the close(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * close(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+#include "safe_macros.h"
+
+void setup();
+void cleanup();
+
+char *TCID = "close08";
+int TST_TOTAL = 1;
+
+char fname[255];
+int fd;
+
+int main(int ac, char **av)
+{
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1) {
+ tst_brkm(TBROK | TTERRNO, cleanup,
+ "open(%s, O_RDWR|O_CREAT,0700) failed", fname);
+ }
+ TEST(close(fd));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "close(%s) failed", fname);
+ } else {
+ tst_resm(TPASS, "close(%s) returned %ld", fname,
+ TEST_RETURN);
+ }
+
+ SAFE_UNLINK(cleanup, fname);
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ sprintf(fname, "tfile_%d", getpid());
+}
+
+void cleanup(void)
+{
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/close_range/.gitignore b/testcases/kernel/syscalls/close_range/.gitignore
deleted file mode 100644
index 4b8bab442..000000000
--- a/testcases/kernel/syscalls/close_range/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-close_range01
-close_range02 \ No newline at end of file
diff --git a/testcases/kernel/syscalls/close_range/Makefile b/testcases/kernel/syscalls/close_range/Makefile
deleted file mode 100644
index dc6413b10..000000000
--- a/testcases/kernel/syscalls/close_range/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019-2021 Linux Test Project
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-CFLAGS += -D_GNU_SOURCE
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/close_range/close_range01.c b/testcases/kernel/syscalls/close_range/close_range01.c
deleted file mode 100644
index 5e2de4d1e..000000000
--- a/testcases/kernel/syscalls/close_range/close_range01.c
+++ /dev/null
@@ -1,209 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Taken from the kernel self tests, which in turn were based on
- * a Syzkaller reproducer.
- *
- * Self test author and close_range author:
- * Christian Brauner <christian.brauner@ubuntu.com>
- *
- * LTP Author: Richard Palethorpe <rpalethorpe@suse.com>
- * Copyright (c) 2021 SUSE LLC, other copyrights may apply.
- */
-/*\
- * [Description]
- *
- * We check that close_range()
- *
- * - closes FDs
- * - UNSHARES some FDs before closing them
- * - it sets CLOEXEC (in both cloned process and parent)
- * - combination of CLOEXEC and UNSHARE.
- *
- * The final test is the actual bug reproducer. Note that we call
- * clone directly to share the file table.
- */
-
-#include <stdlib.h>
-
-#include "tst_test.h"
-#include "tst_clone.h"
-
-#include "lapi/clone.h"
-#include "lapi/close_range.h"
-
-static int fd[3];
-
-static inline void do_close_range(unsigned int fd, unsigned int max_fd,
- unsigned int flags)
-{
- int ret = close_range(fd, max_fd, flags);
-
- if (!ret)
- return;
-
- if (errno == EINVAL) {
- if (flags & CLOSE_RANGE_UNSHARE)
- tst_brk(TCONF | TERRNO, "No CLOSE_RANGE_UNSHARE");
- if (flags & CLOSE_RANGE_CLOEXEC)
- tst_brk(TCONF | TERRNO, "No CLOSE_RANGE_CLOEXEC");
- }
-
- tst_brk(TBROK | TERRNO, "close_range(%d, %d, %d)", fd, max_fd, flags);
-}
-
-static void setup(void)
-{
- struct rlimit nfd;
-
- SAFE_GETRLIMIT(RLIMIT_NOFILE, &nfd);
-
- if (nfd.rlim_max < 1000) {
- tst_brk(TCONF, "NOFILE limit max too low: %lu < 1000",
- nfd.rlim_max);
- }
-
- nfd.rlim_cur = nfd.rlim_max;
- SAFE_SETRLIMIT(RLIMIT_NOFILE, &nfd);
-}
-
-static void check_cloexec(int i, int expected)
-{
- int present = SAFE_FCNTL(fd[i], F_GETFD) & FD_CLOEXEC;
-
- if (expected && !present)
- tst_res(TFAIL, "fd[%d] flags do not contain FD_CLOEXEC", i);
-
- if (!expected && present)
- tst_res(TFAIL, "fd[%d] flags contain FD_CLOEXEC", i);
-}
-
-static void check_closed(int min)
-{
- int i;
-
- for (i = min; i < 3; i++) {
- if (fcntl(fd[i], F_GETFD) > -1)
- tst_res(TFAIL, "fd[%d] is still open", i);
- }
-}
-
-static void child(unsigned int n)
-{
- switch (n) {
- case 0:
- SAFE_DUP2(fd[1], fd[2]);
- do_close_range(3, ~0U, 0);
- check_closed(0);
- break;
- case 1:
- SAFE_DUP2(fd[1], fd[2]);
- do_close_range(3, ~0U, CLOSE_RANGE_UNSHARE);
- check_closed(0);
- break;
- case 2:
- do_close_range(3, ~0U, CLOSE_RANGE_CLOEXEC);
- check_cloexec(0, 1);
- check_cloexec(1, 1);
-
- SAFE_DUP2(fd[1], fd[2]);
- check_cloexec(2, 0);
- break;
- case 3:
- do_close_range(3, ~0U,
- CLOSE_RANGE_CLOEXEC | CLOSE_RANGE_UNSHARE);
- check_cloexec(0, 1);
- check_cloexec(1, 1);
-
- SAFE_DUP2(fd[1], fd[2]);
- check_cloexec(2, 0);
- break;
- }
-
- exit(0);
-}
-
-static void run(unsigned int n)
-{
- const struct tst_clone_args args = {
- .flags = CLONE_FILES,
- .exit_signal = SIGCHLD,
- };
-
- switch (n) {
- case 0:
- tst_res(TINFO, "Plain close range");
- do_close_range(3, ~0U, 0);
- break;
- case 1:
- tst_res(TINFO, "Set UNSHARE and close range");
- do_close_range(3, ~0U, CLOSE_RANGE_UNSHARE);
- break;
- case 2:
- tst_res(TINFO, "Set CLOEXEC on range");
- do_close_range(3, ~0U, CLOSE_RANGE_CLOEXEC);
- break;
- case 3:
- tst_res(TINFO, "Set UNSHARE and CLOEXEC on range");
- do_close_range(3, ~0U,
- CLOSE_RANGE_CLOEXEC | CLOSE_RANGE_UNSHARE);
- break;
- }
-
- fd[0] = SAFE_OPEN("mnt/tmpfile", O_RDWR | O_CREAT, 0644);
- fd[1] = SAFE_DUP2(fd[0], 1000);
- fd[2] = 42;
-
- if (!SAFE_CLONE(&args))
- child(n);
-
- tst_reap_children();
-
- switch (n) {
- case 0:
- check_closed(0);
- break;
- case 1:
- check_cloexec(0, 0);
- check_cloexec(1, 0);
- check_cloexec(2, 0);
- break;
- case 2:
- check_cloexec(0, 1);
- check_cloexec(1, 1);
- check_cloexec(2, 0);
- break;
- case 3:
- check_cloexec(0, 0);
- check_cloexec(1, 0);
- check_closed(2);
- break;
- }
-
- do_close_range(3, ~0U, 0);
- check_closed(0);
-
- if (tst_taint_check())
- tst_res(TFAIL, "Kernel tainted");
- else
- tst_res(TPASS, "No kernel taints");
-}
-
-static struct tst_test test = {
- .tcnt = 4,
- .forks_child = 1,
- .mount_device = 1,
- .mntpoint = "mnt",
- .all_filesystems = 1,
- .needs_root = 1,
- .test = run,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
- {}
- },
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .setup = setup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "fec8a6a69103"},
- {},
- },
-};
diff --git a/testcases/kernel/syscalls/close_range/close_range02.c b/testcases/kernel/syscalls/close_range/close_range02.c
deleted file mode 100644
index bd46936bb..000000000
--- a/testcases/kernel/syscalls/close_range/close_range02.c
+++ /dev/null
@@ -1,114 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2021 SUSE LLC
- */
-/*\
- * [Description]
- *
- * - First check close_range works on a valid range.
- * - Then check close_range does not accept invalid paramters.
- * - Then check it accepts a large lower fd.
- * - Finally check CLOEXEC works
- *
- */
-
-#include <stdlib.h>
-
-#include "tst_test.h"
-#include "tst_clone.h"
-#include "lapi/fcntl.h"
-#include "lapi/close_range.h"
-#include "lapi/clone.h"
-
-static int try_close_range(int fd, int flags)
-{
- int res;
-
- TEST(close_range(fd, fd, flags));
-
- if (TST_RET == -1 && TST_ERR == EINVAL)
- res = TCONF;
- else if (TST_RET == -1)
- res = TFAIL;
- else
- res = TPASS;
-
- return res;
-}
-
-static void run(unsigned int n)
-{
- const struct tst_clone_args args = {
- .flags = CLONE_FILES,
- .exit_signal = SIGCHLD,
- };
- int fd = -1, res;
-
- switch (n) {
- case 0:
- fd = SAFE_OPEN("/", O_PATH);
- SAFE_DUP2(fd, 100);
-
- TST_EXP_PASS(close_range(fd, 100, 0),
- "close_range(%d, 100, 0)", fd);
- TST_EXP_FAIL(fcntl(fd, F_GETFD), EBADF,
- "fcntl(%d, F_GETFD)", fd);
- TST_EXP_FAIL(fcntl(100, F_GETFD), EBADF);
- break;
- case 1:
- TST_EXP_FAIL(close_range(4, 3, 0), EINVAL);
- break;
- case 2:
- TST_EXP_FAIL(close_range(3, ~0U, ~0U), EINVAL);
- break;
- case 3:
- TST_EXP_PASS(close_range(~0U, ~0U, 0));
- break;
- case 4:
- fd = SAFE_OPEN("/", O_PATH);
-
- res = try_close_range(fd, CLOSE_RANGE_CLOEXEC);
- tst_res(res | TTERRNO,
- "close_range(%d, %d, CLOSE_RANGE_CLOEXEC)", fd, fd);
-
- if (res != TPASS)
- break;
-
- TST_EXP_FD_SILENT(fcntl(fd, F_GETFD), "fcntl(%d, F_GETFD)", fd);
- if (TST_RET & FD_CLOEXEC)
- tst_res(TPASS, "FD_CLOEXEC was set on %d", fd);
- else
- tst_res(TFAIL, "FD_CLOEXEC not set on %d", fd);
- break;
- case 5:
- fd = SAFE_OPEN("/", O_PATH);
-
- if (!SAFE_CLONE(&args)) {
- res = try_close_range(fd, CLOSE_RANGE_UNSHARE);
- tst_res(res | TTERRNO,
- "close_range(%d, %d, CLOSE_RANGE_UNSHARE)",
- fd, fd);
-
- if (res != TPASS)
- exit(0);
-
- TST_EXP_FAIL(fcntl(fd, F_GETFD), EBADF,
- "fcntl(%d, F_GETFD)", fd);
- exit(0);
- }
-
- tst_reap_children();
-
- TST_EXP_PASS(fcntl(fd, F_GETFD), "%d is open", fd);
- }
-
- if (fd > -1)
- TST_EXP_PASS_SILENT(close_range(fd, fd, 0),
- "close_range(%d, %d, 0)", fd, fd);
-}
-
-static struct tst_test test = {
- .tcnt = 6,
- .forks_child = 1,
- .test = run,
-};
diff --git a/testcases/kernel/syscalls/cma/Makefile b/testcases/kernel/syscalls/cma/Makefile
index 159d5651c..45a3bbc59 100644
--- a/testcases/kernel/syscalls/cma/Makefile
+++ b/testcases/kernel/syscalls/cma/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv02.c b/testcases/kernel/syscalls/cma/process_vm_readv02.c
index ac53ed226..68e1bea97 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv02.c
@@ -137,7 +137,7 @@ static void child_invoke(void)
TEST(ltp_syscall(__NR_process_vm_readv, pids[0],
&local, 1UL, &remote, 1UL, 0UL));
if (TEST_RETURN != len)
- tst_brkm(TFAIL | TTERRNO, tst_exit, "process_vm_readv");
+ tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
if (strncmp(lp, tst_string, len) != 0)
tst_brkm(TFAIL, tst_exit, "child 1: expected string: %s, "
"received string: %256s", tst_string, lp);
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c
index 561146e5e..f09dfb0e4 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c
@@ -183,7 +183,7 @@ static long *fetch_remote_addrs(void)
TEST(ltp_syscall(__NR_process_vm_readv, pids[0], &local,
1UL, &remote, 1UL, 0UL));
if (TEST_RETURN != len)
- tst_brkm(TFAIL | TTERRNO, tst_exit, "process_vm_readv");
+ tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
return local.iov_base;
}
@@ -217,13 +217,13 @@ static void child_invoke(int *bufsz_arr)
(unsigned long)NUM_LOCAL_VECS, remote,
(unsigned long)nr_iovecs, 0UL));
if (TEST_RETURN != bufsz)
- tst_brkm(TBROK | TTERRNO, tst_exit, "process_vm_readv");
+ tst_brkm(TBROK | TERRNO, tst_exit, "process_vm_readv");
/* verify every byte */
count = 0;
nr_error = 0;
for (i = 0; i < NUM_LOCAL_VECS; i++) {
- for (j = 0; j < (int)local[i].iov_len; j++) {
+ for (j = 0; j < local[i].iov_len; j++) {
expect = count % 256;
actual = ((unsigned char *)local[i].iov_base)[j];
if (expect != actual) {
diff --git a/testcases/kernel/syscalls/cma/process_vm_writev02.c b/testcases/kernel/syscalls/cma/process_vm_writev02.c
index ea2ca63d1..2e7a8d60b 100644
--- a/testcases/kernel/syscalls/cma/process_vm_writev02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_writev02.c
@@ -174,7 +174,7 @@ static void child_write(void)
TEST(ltp_syscall(__NR_process_vm_writev, pids[0], &local,
1UL, &remote, 1UL, 0UL));
if (TEST_RETURN != bufsz)
- tst_brkm(TFAIL | TTERRNO, tst_exit, "process_vm_readv");
+ tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/confstr/Makefile b/testcases/kernel/syscalls/confstr/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/confstr/Makefile
+++ b/testcases/kernel/syscalls/confstr/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/connect/.gitignore b/testcases/kernel/syscalls/connect/.gitignore
index 0a3fc90bf..b425169a8 100644
--- a/testcases/kernel/syscalls/connect/.gitignore
+++ b/testcases/kernel/syscalls/connect/.gitignore
@@ -1,2 +1 @@
/connect01
-/connect02
diff --git a/testcases/kernel/syscalls/connect/Makefile b/testcases/kernel/syscalls/connect/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/connect/Makefile
+++ b/testcases/kernel/syscalls/connect/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/connect/connect02.c b/testcases/kernel/syscalls/connect/connect02.c
deleted file mode 100644
index e20214e24..000000000
--- a/testcases/kernel/syscalls/connect/connect02.c
+++ /dev/null
@@ -1,139 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2017 Christoph Paasch <cpaasch@apple.com>
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2018-9568
- *
- * Test that connect() to AF_UNSPEC address correctly converts IPV6 socket
- * to IPV4 listen socket when IPV6_ADDRFORM is set to AF_INET.
- * Kernel memory corruption fixed in:
- *
- * commit 9d538fa60bad4f7b23193c89e843797a1cf71ef3
- * Author: Christoph Paasch <cpaasch@apple.com>
- * Date: Tue Sep 26 17:38:50 2017 -0700
- *
- * net: Set sk_prot_creator when cloning sockets to the right proto
- *
- *
- * Note: This test also detects setsockopt(IP_ADDRFORM) breakage caused by
- * kernel commit b6f6118901d1. This bug is unrelated to CVE-2018-9568.
- * Fixed in:
- *
- * commit 82c9ae440857840c56e05d4fb1427ee032531346
- * Author: John Haxby <john.haxby@oracle.com>
- * Date: Sat Apr 18 16:30:49 2020 +0100
- *
- * ipv6: fix restrict IPV6_ADDRFORM operation
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-
-#include "tst_test.h"
-#include "tst_net.h"
-
-static int listenfd = -1, fd = -1, confd1 = -1, confd2 = -1, confd3 = -1;
-static struct sockaddr_in6 bind_addr;
-static struct sockaddr_in bind_addr4, client_addr;
-static struct sockaddr reset_addr;
-
-static void setup(void)
-{
- socklen_t size = sizeof(bind_addr);
-
- tst_init_sockaddr_inet6_bin(&bind_addr, &in6addr_any, 0);
- tst_init_sockaddr_inet_bin(&bind_addr4, INADDR_ANY, 0);
- memset(&reset_addr, 0, sizeof(reset_addr));
- reset_addr.sa_family = AF_UNSPEC;
-
- listenfd = SAFE_SOCKET(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
- SAFE_BIND(listenfd, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
- SAFE_LISTEN(listenfd, 5);
- SAFE_GETSOCKNAME(listenfd, (struct sockaddr *)&bind_addr, &size);
- tst_init_sockaddr_inet(&client_addr, "127.0.0.1",
- htons(bind_addr.sin6_port));
-}
-
-static void cleanup(void)
-{
- if (confd3 >= 0)
- SAFE_CLOSE(confd3);
-
- if (confd2 >= 0)
- SAFE_CLOSE(confd2);
-
- if (confd1 >= 0)
- SAFE_CLOSE(confd1);
-
- if (fd >= 0)
- SAFE_CLOSE(fd);
-
- if (listenfd >= 0)
- SAFE_CLOSE(listenfd);
-}
-
-static void run(void)
-{
- int i, addrlen, optval = AF_INET;
- struct sockaddr_storage client_addr2;
-
- for (i = 0; i < 1000; i++) {
- confd1 = SAFE_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- SAFE_CONNECT(confd1, (struct sockaddr *)&client_addr,
- sizeof(client_addr));
-
- fd = SAFE_ACCEPT(listenfd, NULL, NULL);
- TEST(setsockopt(fd, SOL_IPV6, IPV6_ADDRFORM, &optval,
- sizeof(optval)));
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO,
- "setsockopt(IPV6_ADDRFORM) failed");
- return;
- }
-
- if (TST_RET != 0)
- tst_brk(TBROK | TTERRNO, "setsockopt(IPV6_ADDRFORM) "
- "returned invalid value");
-
- SAFE_CONNECT(fd, (struct sockaddr *)&reset_addr,
- sizeof(reset_addr));
- SAFE_BIND(fd, (struct sockaddr *)&bind_addr4,
- sizeof(bind_addr4));
- SAFE_LISTEN(fd, 5);
-
- addrlen = tst_get_connect_address(fd, &client_addr2);
- confd2 = SAFE_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- SAFE_CONNECT(confd2, (struct sockaddr *)&client_addr2, addrlen);
- confd3 = SAFE_ACCEPT(fd, NULL, NULL);
-
- SAFE_CLOSE(confd3);
- SAFE_CLOSE(confd2);
- SAFE_CLOSE(confd1);
- SAFE_CLOSE(fd);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "9d538fa60bad"},
- {"linux-git", "82c9ae440857"},
- {"CVE", "2018-9568"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/copy_file_range/Makefile b/testcases/kernel/syscalls/copy_file_range/Makefile
index a77363313..0143bdec8 100644
--- a/testcases/kernel/syscalls/copy_file_range/Makefile
+++ b/testcases/kernel/syscalls/copy_file_range/Makefile
@@ -1,5 +1,16 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Linux Test Project, 2017
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
index bc27fbe57..c09766fe6 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
@@ -78,11 +78,7 @@ static struct tcase {
{&fd_chrdev, 0, EINVAL, CONTSIZE, "char device", 0},
{&fd_fifo, 0, EINVAL, CONTSIZE, "fifo", 0},
{&fd_pipe[0], 0, EINVAL, CONTSIZE, "pipe", 0},
-#ifdef TST_ABI64
- {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length", 1},
-#else
- {&fd_copy, 0, EFBIG, ULLONG_MAX, "max length", 1},
-#endif
+ {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length lenght", 1},
{&fd_copy, 0, EFBIG, MIN_OFF, "max file size", 1},
};
@@ -91,7 +87,7 @@ static int run_command(char *command, char *option, char *file)
const char *const cmd[] = {command, option, file, NULL};
int ret;
- ret = tst_cmd(cmd, NULL, NULL, TST_CMD_PASS_RETVAL);
+ ret = tst_run_cmd(cmd, NULL, NULL, 1);
switch (ret) {
case 0:
return 0;
diff --git a/testcases/kernel/syscalls/creat/Makefile b/testcases/kernel/syscalls/creat/Makefile
index 2472c8423..a8b112adc 100644
--- a/testcases/kernel/syscalls/creat/Makefile
+++ b/testcases/kernel/syscalls/creat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/delete_module/.gitignore b/testcases/kernel/syscalls/delete_module/.gitignore
index 1a774a6d5..8ffd4256e 100644
--- a/testcases/kernel/syscalls/delete_module/.gitignore
+++ b/testcases/kernel/syscalls/delete_module/.gitignore
@@ -1,12 +1,5 @@
/delete_module01
/delete_module02
/delete_module03
-/*.ko
-/*.mod.c
-/*.ko.cmd
-/*.mod.cmd
-/*.mod.o.cmd
-/*.o.cmd
-/.built-in.a.cmd
-/Module.symvers
-/modules.order
+/dummy_del_mod.ko
+/dummy_del_mod_dep.ko
diff --git a/testcases/kernel/syscalls/delete_module/delete_module01.c b/testcases/kernel/syscalls/delete_module/delete_module01.c
index 8fb559f0c..e5cb53cc9 100644
--- a/testcases/kernel/syscalls/delete_module/delete_module01.c
+++ b/testcases/kernel/syscalls/delete_module/delete_module01.c
@@ -14,9 +14,9 @@
*/
#include <errno.h>
+#include "old_module.h"
#include "lapi/syscalls.h"
#include "tst_test.h"
-#include "tst_module.h"
#define MODULE_NAME "dummy_del_mod"
#define MODULE_NAME_KO "dummy_del_mod.ko"
@@ -26,7 +26,7 @@ static int module_loaded;
static void do_delete_module(void)
{
if (module_loaded == 0) {
- tst_module_load(MODULE_NAME_KO, NULL);
+ tst_module_load(NULL, MODULE_NAME_KO, NULL);
module_loaded = 1;
}
@@ -44,7 +44,7 @@ static void do_delete_module(void)
static void cleanup(void)
{
if (module_loaded == 1)
- tst_module_unload(MODULE_NAME_KO);
+ tst_module_unload(NULL, MODULE_NAME_KO);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/delete_module/delete_module03.c b/testcases/kernel/syscalls/delete_module/delete_module03.c
index 7178e8ef1..8bd51be07 100644
--- a/testcases/kernel/syscalls/delete_module/delete_module03.c
+++ b/testcases/kernel/syscalls/delete_module/delete_module03.c
@@ -14,7 +14,7 @@
#include <errno.h>
#include "tst_test.h"
-#include "tst_module.h"
+#include "old_module.h"
#include "lapi/syscalls.h"
#define DUMMY_MOD "dummy_del_mod"
@@ -43,7 +43,7 @@ static void do_delete_module(void)
* insmod DUMMY_MOD_KO again in case running
* with -i option
*/
- tst_module_load(DUMMY_MOD_KO, NULL);
+ tst_module_load(NULL, DUMMY_MOD_KO, NULL);
dummy_mod_loaded = 1;
}
}
@@ -51,11 +51,11 @@ static void do_delete_module(void)
static void setup(void)
{
/* Load first kernel module */
- tst_module_load(DUMMY_MOD_KO, NULL);
+ tst_module_load(NULL, DUMMY_MOD_KO, NULL);
dummy_mod_loaded = 1;
/* Load dependant kernel module */
- tst_module_load(DUMMY_MOD_DEP_KO, NULL);
+ tst_module_load(NULL, DUMMY_MOD_DEP_KO, NULL);
dummy_mod_dep_loaded = 1;
}
@@ -63,11 +63,11 @@ static void cleanup(void)
{
/* Unload dependent kernel module */
if (dummy_mod_dep_loaded == 1)
- tst_module_unload(DUMMY_MOD_DEP_KO);
+ tst_module_unload(NULL, DUMMY_MOD_DEP_KO);
/* Unload first kernel module */
if (dummy_mod_loaded == 1)
- tst_module_unload(DUMMY_MOD_KO);
+ tst_module_unload(NULL, DUMMY_MOD_KO);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/dup/Makefile b/testcases/kernel/syscalls/dup/Makefile
index fd64eb453..cf4ac2376 100644
--- a/testcases/kernel/syscalls/dup/Makefile
+++ b/testcases/kernel/syscalls/dup/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/dup/dup01.c b/testcases/kernel/syscalls/dup/dup01.c
index 74e24cc02..5c82ebefc 100644
--- a/testcases/kernel/syscalls/dup/dup01.c
+++ b/testcases/kernel/syscalls/dup/dup01.c
@@ -1,44 +1,187 @@
-// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- * Copyright (c) 2020 SUSE LLC
*
- * 03/30/1992 AUTHOR: William Roske CO-PILOT: Dave Fenner
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
+/* $Id: dup01.c,v 1.6 2009/10/13 14:00:46 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : dup01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for dup(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) dup(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the dup(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * dup(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+#include "safe_macros.h"
+
+void setup();
+void cleanup();
-#include "tst_test.h"
+char *TCID = "dup01";
+int TST_TOTAL = 1;
-static int fd;
+char filename[255];
+int fd;
-static void verify_dup(void)
+int main(int ac, char **av)
{
- TEST(dup(fd));
-
- if (TST_RET < -1) {
- tst_res(TFAIL, "Invalid dup() return value %ld", TST_RET);
- } else if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "dup(%d) Failed", fd);
- } else {
- tst_res(TPASS, "dup(%d) returned %ld", fd, TST_RET);
- SAFE_CLOSE(TST_RET);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ /*
+ * Call dup(2)
+ */
+ TEST(dup(fd));
+
+ /* check return code */
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s",
+ filename, TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TPASS, "dup(%s) returned %ld",
+ filename, TEST_RETURN);
+
+ /* close the new file so loops do not open too many files */
+ SAFE_CLOSE(cleanup, TEST_RETURN);
+ }
+
}
+
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
- fd = SAFE_OPEN("dupfile", O_RDWR | O_CREAT, 0700);
+ fd = -1;
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ sprintf(filename, "dupfile");
+ if ((fd = open(filename, O_RDWR | O_CREAT, 0700)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "open failed");
}
-static void cleanup(void)
+void cleanup(void)
{
- if (fd > 0)
- SAFE_CLOSE(fd);
-}
+ if (fd != -1)
+ if (close(fd) == -1)
+ tst_resm(TWARN | TERRNO, "closing %s failed", filename);
+
+ tst_rmdir();
-static struct tst_test test = {
- .test_all = verify_dup,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
-};
+}
diff --git a/testcases/kernel/syscalls/dup/dup02.c b/testcases/kernel/syscalls/dup/dup02.c
index 528bcdbc1..c0919ef09 100644
--- a/testcases/kernel/syscalls/dup/dup02.c
+++ b/testcases/kernel/syscalls/dup/dup02.c
@@ -1,58 +1,179 @@
-// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- * Copyright (c) 2020 SUSE LLC
*
- * 03/30/1992 AUTHOR: Richard Logan CO-PILOT: William Roske
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
*
- */
-/*\
- * [Description]
- * Negative test for dup(2) with bad fds.
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
- * [Algorithm]
- * Call dup(2) with invalid argument and make sure it returns -1 with errno set
- * to EBADF.
*/
+/* $Id: dup02.c,v 1.6 2009/10/13 14:00:46 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : dup02
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Negative test for dup(2) with bad fd.
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 2
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : Richard Logan
+ *
+ * CO-PILOT : William Roske
+ *
+ * DATE STARTED : 06/94
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1-?.) dup(2) returns -1 with errno set to EBADF...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ * Standard tst_res formatted output
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Loop through the test cases
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * if doing functional check
+ * check if errno set correctly, report results
+ * Otherwise, Issue a FAIL message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+#include "safe_macros.h"
+
+void setup();
+void cleanup();
-#include "tst_test.h"
+char *TCID = "dup02";
+int TST_TOTAL = 2;
-static struct tcase {
- int fd;
- int expected_errno;
-} tcases[] = {
- {-1, EBADF},
- {1500, EBADF},
-};
+int Fds[] = { -1, 1500 };
-static void run(unsigned int n)
+int main(int ac, char **av)
{
- struct tcase *tc = &tcases[n];
+ int lc;
+ int nfds = sizeof(Fds) / sizeof(int);
+ int ind;
- TEST(dup(tc->fd));
+ tst_parse_opts(ac, av, NULL, NULL);
- if (TST_RET < -1) {
- tst_res(TFAIL | TTERRNO, "Invalid dup() return value %ld",
- TST_RET);
- return;
- }
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
- if (TST_RET == -1) {
- if (tc->expected_errno == TST_ERR) {
- tst_res(TPASS | TTERRNO, "dup(%d) failed as expected",
- tc->fd);
- } else {
- tst_res(TFAIL | TTERRNO, "dup(%d) failed unexpectedly",
- tc->fd);
+ for (ind = 0; ind < nfds; ind++) {
+
+ TEST(dup(Fds[ind]));
+
+ if (TEST_RETURN == -1) {
+ if (TEST_ERRNO == EBADF)
+ tst_resm(TPASS,
+ "dup failed as expected "
+ "with EBADF");
+ else
+ tst_resm(TFAIL | TTERRNO,
+ "dup failed unexpectedly");
+ } else {
+ tst_resm(TFAIL, "dup succeeded unexpectedly");
+
+ SAFE_CLOSE(cleanup, TEST_RETURN);
+ }
}
- return;
}
- tst_res(TFAIL, "dup(%d) succeeded unexpectedly", tc->fd);
- SAFE_CLOSE(TST_RET);
+ cleanup();
+ tst_exit();
+}
+
+void setup(void)
+{
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
-};
+void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/dup/dup03.c b/testcases/kernel/syscalls/dup/dup03.c
index 0e99813f4..e41c9e445 100644
--- a/testcases/kernel/syscalls/dup/dup03.c
+++ b/testcases/kernel/syscalls/dup/dup03.c
@@ -1,75 +1,212 @@
-// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- * Copyright (c) 2020 SUSE LLC
*
- */
-/*\
- * [Description]
- * Negative test for dup(2) (too many fds).
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
- * [Algorithm]
- * Open the maximum allowed number of file descriptors and then try to call
- * dup() once more and verify it fails with EMFILE.
*/
+/* $Id: dup03.c,v 1.5 2009/10/13 14:00:46 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : dup03
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Negative test for dup(2) (too many fds)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ *
+ * DATE STARTED : 06/94
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) dup(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
#include <stdlib.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
-int *fd;
-int nfds;
+void setup();
+void cleanup();
-static void run(void)
+char *TCID = "dup03";
+int TST_TOTAL = 1;
+
+char filename[255];
+int *fd = NULL;
+int nfds = 0;
+
+int main(int ac, char **av)
{
- TEST(dup(fd[0]));
+ int lc;
- if (TST_RET < -1) {
- tst_res(TFAIL, "Invalid dup() return value %ld", TST_RET);
- return;
- }
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(dup(fd[0]));
+
+ if (TEST_RETURN == -1) {
+ if (TEST_ERRNO == EMFILE)
+ tst_resm(TPASS,
+ "dup failed as expected with "
+ "EMFILE");
+ else
+ tst_resm(TFAIL | TTERRNO,
+ "dup failed unexpectedly");
+ } else {
+ tst_resm(TFAIL, "dup succeeded unexpectedly");
+
+ SAFE_CLOSE(cleanup, TEST_RETURN);
+ }
- if (TST_RET == -1) {
- if (TST_ERR == EMFILE)
- tst_res(TPASS | TTERRNO, "dup() failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "dup() failed unexpectedly");
- return;
}
- tst_res(TFAIL, "dup() succeeded unexpectedly");
- SAFE_CLOSE(TST_RET);
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
long maxfds;
maxfds = sysconf(_SC_OPEN_MAX);
- if (maxfds == -1)
- tst_brk(TBROK, "sysconf(_SC_OPEN_MAX) failed");
+ /*
+ * Read the errors section if you're so inclined to determine
+ * why == -1 matters for errno.
+ */
+ if (maxfds < 1)
+ tst_brkm((maxfds == -1 ? TBROK | TERRNO : TBROK), NULL,
+ "sysconf(_SC_OPEN_MAX) failed");
- fd = SAFE_MALLOC(maxfds * sizeof(int));
+ fd = malloc(maxfds * sizeof(int));
+ if (fd == NULL)
+ tst_brkm(TBROK | TERRNO, NULL, "malloc failed");
+ fd[0] = -1;
- fd[0] = SAFE_OPEN("dupfile", O_RDWR | O_CREAT, 0700);
+ tst_sig(FORK, DEF_HANDLER, cleanup);
- for (nfds = 1; nfds < maxfds; nfds++) {
- fd[nfds] = SAFE_DUP(fd[0]);
- if (fd[nfds] >= maxfds - 1)
- break;
- }
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ sprintf(filename, "dupfile");
+ for (nfds = 1; nfds <= maxfds; nfds++)
+ if ((fd[nfds - 1] =
+ open(filename, O_RDWR | O_CREAT, 0700)) == -1) {
+ if (errno == EMFILE)
+ break;
+ else
+ tst_brkm(TBROK | TBROK, cleanup, "open failed");
+ nfds--;
+ }
+
+ if (nfds == 0)
+ tst_brkm(TBROK, cleanup, "unable to open at least one file");
+ if (nfds > maxfds)
+ tst_brkm(TBROK, cleanup,
+ "unable to open enough files to use all file descriptors, "
+ "tried %ld", maxfds);
}
-static void cleanup(void)
+void cleanup(void)
{
int i;
- for (i = 0; i < nfds; i++)
- SAFE_CLOSE(fd[i]);
-}
+ for (i = 0; i <= nfds; i++)
+ close(fd[i]);
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/dup/dup04.c b/testcases/kernel/syscalls/dup/dup04.c
index 0b1827c68..1414b2a9e 100644
--- a/testcases/kernel/syscalls/dup/dup04.c
+++ b/testcases/kernel/syscalls/dup/dup04.c
@@ -144,7 +144,7 @@ int main(int ac, char **av)
TEST(dup(fd[0]));
if (TEST_RETURN == -1)
- tst_resm(TFAIL | TTERRNO,
+ tst_resm(TFAIL | TERRNO,
"dup of read side of pipe failed");
else {
tst_resm(TPASS,
diff --git a/testcases/kernel/syscalls/dup2/Makefile b/testcases/kernel/syscalls/dup2/Makefile
index 28fc158e4..6396091d8 100644
--- a/testcases/kernel/syscalls/dup2/Makefile
+++ b/testcases/kernel/syscalls/dup2/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/dup2/dup202.c b/testcases/kernel/syscalls/dup2/dup202.c
index c87769fa9..15443ef3d 100644
--- a/testcases/kernel/syscalls/dup2/dup202.c
+++ b/testcases/kernel/syscalls/dup2/dup202.c
@@ -108,7 +108,7 @@ int main(int ac, char **av)
TEST(dup2(ofd, *TC[i].nfd));
if (TEST_RETURN == -1) {
- tst_resm(TFAIL | TTERRNO,
+ tst_resm(TFAIL | TERRNO,
"call failed unexpectedly");
continue;
}
diff --git a/testcases/kernel/syscalls/dup2/dup204.c b/testcases/kernel/syscalls/dup2/dup204.c
index a357bc17e..c864f9866 100644
--- a/testcases/kernel/syscalls/dup2/dup204.c
+++ b/testcases/kernel/syscalls/dup2/dup204.c
@@ -119,7 +119,7 @@ void cleanup(void)
{
int i;
- for (i = 0; i < (int)ARRAY_SIZE(fd); i++) {
+ for (i = 0; i < ARRAY_SIZE(fd); i++) {
close(fd[i]);
close(nfd[i]);
}
diff --git a/testcases/kernel/syscalls/dup3/Makefile b/testcases/kernel/syscalls/dup3/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/dup3/Makefile
+++ b/testcases/kernel/syscalls/dup3/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/epoll/Makefile b/testcases/kernel/syscalls/epoll/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/epoll/Makefile
+++ b/testcases/kernel/syscalls/epoll/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/epoll/epoll-ltp.c b/testcases/kernel/syscalls/epoll/epoll-ltp.c
index 8b04f5326..12504ab95 100644
--- a/testcases/kernel/syscalls/epoll/epoll-ltp.c
+++ b/testcases/kernel/syscalls/epoll/epoll-ltp.c
@@ -299,7 +299,7 @@ int test_epoll_create(unsigned int num_rand_attempts)
/*
* RES_FAIL_* indicates a FAIL result
* In brief, there are two things that can go wrong in a
- * failure. The return value (result = epoll_ctl(...)) and
+ * failiure. The return value (result = epoll_ctl(...)) and
* the errno value may not match expectations. In this notation,
* MIS -> mismatch, MAT -> match, BAD -> bad, and IGN -> ignored.
*
@@ -347,7 +347,7 @@ static const char *result_strings[] = {
/****************************************************************************************/
/* This macro helps keep the code below understandable. It prints out the
- failure message passed to it plus the parameters to the system call. */
+ failiure message passed to it plus the parameters to the system call. */
#define EPOLL_CTL_TEST_RESULTS_SHOW_PARAMS 1
#if EPOLL_CTL_TEST_RESULTS_SHOW_PARAMS
#define EPOLL_CTL_TEST_FAIL(msg , ...) \
@@ -549,7 +549,7 @@ int test_epoll_ctl(int epoll_fd)
for (index = 1;
index < 64;
index++) {
- if ((int)ev_ptr->events != epoll_events[index]) {
+ if (ev_ptr->events != epoll_events[index]) {
expected_errno
=
EINVAL;
@@ -649,7 +649,8 @@ int test_epoll_ctl(int epoll_fd)
RES_PASS_RETV_MAT_ERRNO_IGN)))
{
if (result >
- (int)(sizeof(result_strings) /
+ (sizeof
+ (result_strings) /
sizeof(const char
*))) {
/* Returned a result which has no corresponding text description */
@@ -659,7 +660,7 @@ int test_epoll_ctl(int epoll_fd)
if (result == -1) /* Segfault during epoll_ctl call */
EPOLL_CTL_TEST_FAIL
("Test arguments caused abnormal exit.");
- else /* The 'normal' failure */
+ else /* The 'normal' failiure */
EPOLL_CTL_TEST_FAIL
((result_strings[result]));
}
@@ -685,7 +686,7 @@ int test_epoll_ctl(int epoll_fd)
return (num_epoll_ctl_test_fails / num_epoll_ctl_test_calls);
}
-int main(void)
+int main(int argc, char **argv)
{
int epoll_fd;
struct timeval tv;
diff --git a/testcases/kernel/syscalls/epoll2/examples/Makefile b/testcases/kernel/syscalls/epoll2/examples/Makefile
new file mode 100644
index 000000000..ade66341c
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/examples/Makefile
@@ -0,0 +1,52 @@
+#
+# epoll ( Efficent event polling implementation )
+# Copyright (C) 2001,...,2002 Davide Libenzi
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Davide Libenzi <davidel@xmailserver.org>
+#
+#
+
+OUTDIR = ../bin
+SRCDIR = .
+INCLUDE = -I- -I. -I../include -I/usr/src/linux/include
+LIBS = -L../lib -lepoll -lpcl
+
+
+ifeq ($(EPOLLCFG), release)
+CFLAGS = -O3 $(INCLUDE) -DUNIX
+else
+CFLAGS = -g $(INCLUDE) -DUNIX -D_DEBUG
+endif
+
+SOURCES = $(SRCDIR)/epoll-test.c
+
+MKDEP = mkdep -f
+
+
+all: blaster httpd pipetest
+
+.depend: $(SOURCES)
+ $(MKDEP) $(CFLAGS) $(SOURCES)
+
+blaster: $(SOURCES)
+ $(CC) $(CFLAGS) -DHTTP_BLASTER -o $(OUTDIR)/epoll-blaster $(SOURCES) $(LIBS)
+
+httpd: $(SOURCES)
+ $(CC) $(CFLAGS) -DDPHTTPD -o $(OUTDIR)/epoll-httpd $(SOURCES) $(LIBS)
+
+pipetest: $(SOURCES)
+ $(CC) $(CFLAGS) -DPIPETESTER -o $(OUTDIR)/epoll-pipetest $(SOURCES) $(LIBS)
+
+distclean: clean
+ @rm -f .depend
+
+clean:
+ @rm -f *~ $(OUTDIR)/epoll-blaster $(OUTDIR)/epoll-httpd $(OUTDIR)/epoll-pipetest
+
+#include .depend
+
diff --git a/testcases/kernel/syscalls/epoll2/examples/epoll-test.c b/testcases/kernel/syscalls/epoll2/examples/epoll-test.c
new file mode 100644
index 000000000..2b2faac30
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/examples/epoll-test.c
@@ -0,0 +1,996 @@
+/*
+ * EpollTest by Davide Libenzi ( Epoll functionality tester )
+ * Copyright (C) 2003 Davide Libenzi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Davide Libenzi <davidel@xmailserver.org>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <ctype.h>
+#include <time.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sched.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/select.h>
+#include <sys/wait.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <syslog.h>
+#include <glob.h>
+#include <semaphore.h>
+
+/*
+ * You need the Portable Coroutine Library (PCL) to build this source.
+ * You can find a copy of PCL source code at :
+ *
+ * http://www.xmailserver.org/libpcl.html
+ */
+#include <pcl.h>
+
+#include "epoll.h"
+#include "dbllist.h"
+
+#define CO_STD_STACK_SIZE (2 * 4096)
+#define STD_SCHED_TIMEOUT 1000
+/* you might need to increase "net.ipv4.tcp_max_syn_backlog" to use this value */
+#define STD_LISTEN_SIZE 2048
+#define DATA_BUFFER_SIZE 2048
+#define MIN_AHEAD_SPACE (DATA_BUFFER_SIZE / 12)
+#define STD_MESSAGE_SIZE 128
+#define STD_SERVER_PORT 8080
+#define MAX_DEFAULT_FDS 20000
+
+struct eph_conn {
+ struct list_head lnk;
+ int sfd;
+ unsigned int events, revents;
+ coroutine_t co;
+ int nbytes, rindex;
+ char buffer[DATA_BUFFER_SIZE];
+};
+
+static int kdpfd;
+static struct list_head close_list;
+static struct epoll_event *events;
+static int maxfds, numfds = 0;
+static int chash_size;
+static struct list_head *chash;
+static int msgsize = STD_MESSAGE_SIZE, port = STD_SERVER_PORT,
+ maxsfd = MAX_DEFAULT_FDS, stksize = CO_STD_STACK_SIZE;
+struct sockaddr_in saddr;
+static volatile unsigned long httpresp = 0;
+static int nreqsess = 1;
+static char httpreq[512] = "";
+
+int eph_socket(int domain, int type, int protocol)
+{
+ int sfd = socket(domain, type, protocol), flags = 1;
+
+ if (sfd == -1)
+ return -1;
+ if (ioctl(sfd, FIONBIO, &flags) &&
+ ((flags = fcntl(sfd, F_GETFL, 0)) < 0 ||
+ fcntl(sfd, F_SETFL, flags | O_NONBLOCK) < 0)) {
+ close(sfd);
+ return -1;
+ }
+ return sfd;
+}
+
+int eph_close(int sfd)
+{
+ close(sfd);
+ return 0;
+}
+
+static int eph_new_conn(int sfd, void *func)
+{
+ struct eph_conn *conn = malloc(sizeof(struct eph_conn));
+ struct epoll_event ev;
+
+ if (!conn)
+ return -1;
+
+ memset(conn, 0, sizeof(*conn));
+ DBL_INIT_LIST_HEAD(&conn->lnk);
+ conn->sfd = sfd;
+ conn->events = 0;
+ conn->revents = 0;
+ conn->nbytes = conn->rindex = 0;
+ if (!(conn->co = co_create(func, conn, NULL, stksize))) {
+ free(conn);
+ return -1;
+ }
+
+ DBL_LIST_ADDT(&conn->lnk, &chash[sfd % chash_size]);
+
+ ev.events = 0;
+ ev.data.ptr = conn;
+ if (epoll_ctl(kdpfd, EPOLL_CTL_ADD, sfd, &ev) < 0) {
+ fprintf(stderr, "epoll set insertion error: fd=%d\n", sfd);
+
+ DBL_LIST_DEL(&conn->lnk);
+ co_delete(conn->co);
+ free(conn);
+ return -1;
+ }
+
+ ++numfds;
+
+ co_call(conn->co);
+
+ return 0;
+}
+
+static void eph_exit_conn(struct eph_conn *conn)
+{
+ struct epoll_event ev;
+
+ if (epoll_ctl(kdpfd, EPOLL_CTL_DEL, conn->sfd, &ev) < 0) {
+ fprintf(stderr, "epoll set deletion error: fd=%d\n", conn->sfd);
+
+ }
+
+ DBL_LIST_DEL(&conn->lnk);
+ DBL_LIST_ADDT(&conn->lnk, &close_list);
+
+ eph_close(conn->sfd);
+ conn->sfd = -1;
+
+ --numfds;
+
+ co_exit();
+}
+
+static void eph_free_conns(void)
+{
+ struct eph_conn *conn;
+
+ while (!DBL_LIST_EMTPY(&close_list)) {
+ conn = DBL_LIST_ENTRY(close_list.pNext, struct eph_conn, lnk);
+
+ DBL_LIST_DEL(&conn->lnk);
+ free(conn);
+ }
+}
+
+static int eph_mod_conn(struct eph_conn *conn, unsigned int events)
+{
+ struct epoll_event ev;
+
+ ev.events = events;
+ ev.data.ptr = conn;
+ if (epoll_ctl(kdpfd, EPOLL_CTL_MOD, conn->sfd, &ev) < 0) {
+ fprintf(stderr, "epoll set modify error: fd=%d\n", conn->sfd);
+ return -1;
+ }
+ return 0;
+}
+
+int eph_connect(struct eph_conn *conn, const struct sockaddr *serv_addr,
+ socklen_t addrlen)
+{
+
+ if (connect(conn->sfd, serv_addr, addrlen) == -1) {
+ if (errno != EWOULDBLOCK && errno != EINPROGRESS)
+ return -1;
+ if (!(conn->events & EPOLLOUT)) {
+ conn->events = EPOLLOUT | EPOLLERR | EPOLLHUP;
+ if (eph_mod_conn(conn, conn->events) < 0)
+ return -1;
+ }
+ co_resume();
+ if (conn->revents & (EPOLLERR | EPOLLHUP))
+ return -1;
+ }
+ return 0;
+}
+
+int eph_read(struct eph_conn *conn, char *buf, int nbyte)
+{
+ int n;
+
+ while ((n = read(conn->sfd, buf, nbyte)) < 0) {
+ if (errno == EINTR)
+ continue;
+ if (errno != EAGAIN && errno != EWOULDBLOCK)
+ return -1;
+ if (!(conn->events & EPOLLIN)) {
+ conn->events = EPOLLIN | EPOLLERR | EPOLLHUP;
+ if (eph_mod_conn(conn, conn->events) < 0)
+ return -1;
+ }
+ co_resume();
+ }
+ return n;
+}
+
+int eph_write(struct eph_conn *conn, char const *buf, int nbyte)
+{
+ int n;
+
+ while ((n = write(conn->sfd, buf, nbyte)) < 0) {
+ if (errno == EINTR)
+ continue;
+ if (errno != EAGAIN && errno != EWOULDBLOCK)
+ return -1;
+ if (!(conn->events & EPOLLOUT)) {
+ conn->events = EPOLLOUT | EPOLLERR | EPOLLHUP;
+ if (eph_mod_conn(conn, conn->events) < 0)
+ return -1;
+ }
+ co_resume();
+ }
+ return n;
+}
+
+int eph_accept(struct eph_conn *conn, struct sockaddr *addr, int *addrlen)
+{
+ int sfd, flags = 1;
+
+ while ((sfd = accept(conn->sfd, addr, (socklen_t *) addrlen)) < 0) {
+ if (errno == EINTR)
+ continue;
+ if (errno != EAGAIN && errno != EWOULDBLOCK)
+ return -1;
+ if (!(conn->events & EPOLLIN)) {
+ conn->events = EPOLLIN | EPOLLERR | EPOLLHUP;
+ if (eph_mod_conn(conn, conn->events) < 0)
+ return -1;
+ }
+ co_resume();
+ }
+ if (ioctl(sfd, FIONBIO, &flags) &&
+ ((flags = fcntl(sfd, F_GETFL, 0)) < 0 ||
+ fcntl(sfd, F_SETFL, flags | O_NONBLOCK) < 0)) {
+ close(sfd);
+ return -1;
+ }
+ return sfd;
+}
+
+static int eph_create_conn(int domain, int type, int protocol, void *func)
+{
+ int sfd = eph_socket(domain, type, protocol);
+
+ return sfd != -1 ? eph_new_conn(sfd, func) : -1;
+}
+
+static int eph_read_data(struct eph_conn *conn)
+{
+ int nbytes;
+
+ if (conn->rindex && conn->rindex < conn->nbytes) {
+ memmove(conn->buffer, conn->buffer + conn->rindex,
+ conn->nbytes - conn->rindex);
+ conn->nbytes -= conn->rindex;
+ } else
+ conn->nbytes = 0;
+
+ conn->rindex = 0;
+
+ if ((nbytes = eph_read(conn, conn->buffer + conn->nbytes,
+ sizeof(conn->buffer) - conn->nbytes)) <= 0)
+ return -1;
+
+ conn->nbytes += nbytes;
+
+ return 0;
+}
+
+static int eph_write_data(struct eph_conn *conn, char const *buf, int nbyte)
+{
+ int wbytes, wcurr;
+
+ for (wbytes = 0; wbytes < nbyte;) {
+ if ((wcurr = eph_write(conn, buf + wbytes, nbyte - wbytes)) < 0)
+ break;
+ wbytes += wcurr;
+ }
+
+ return wbytes;
+}
+
+static char *eph_read_line(struct eph_conn *conn)
+{
+ char *nline, *line;
+
+ for (;;) {
+ if (conn->nbytes > conn->rindex) {
+ if ((nline = memchr(conn->buffer + conn->rindex, '\n',
+ conn->nbytes - conn->rindex))) {
+ line = conn->buffer + conn->rindex;
+ conn->rindex += (nline - line) + 1;
+ for (; nline > line && nline[-1] == '\r';
+ nline--) ;
+ *nline = '\0';
+ return line;
+ }
+ }
+ if (eph_read_data(conn) < 0)
+ break;
+ }
+ return NULL;
+}
+
+static int eph_parse_request(struct eph_conn *conn)
+{
+ char *line;
+
+ if (!(line = eph_read_line(conn)))
+ return -1;
+
+ for (;;) {
+ if (!(line = eph_read_line(conn)))
+ return -1;
+
+ if (*line == '\0')
+ break;
+ }
+
+ return 0;
+}
+
+static int eph_send_response(struct eph_conn *conn)
+{
+ static int resplen = -1;
+ static char *resp = NULL;
+
+ if (resp == NULL) {
+ msgsize = ((msgsize + 63) / 64) * 64;
+
+ resp = malloc(msgsize + 256);
+
+ sprintf(resp,
+ "HTTP/1.1 200 OK\r\n"
+ "Server: dp server\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Length: %d\r\n" "\r\n", msgsize);
+
+ while (msgsize > 0) {
+ strcat(resp,
+ "01234567890123\r\n"
+ "01234567890123\r\n"
+ "01234567890123\r\n" "01234567890123\r\n");
+ msgsize -= 64;
+ }
+
+ resplen = strlen(resp);
+ }
+
+ if (eph_write_data(conn, resp, resplen) != resplen)
+ return -1;
+
+ return 0;
+}
+
+static void *eph_httpd(void *data)
+{
+ struct eph_conn *conn = (struct eph_conn *)data;
+
+ while (eph_parse_request(conn) == 0) {
+ eph_send_response(conn);
+
+ }
+
+ eph_exit_conn(conn);
+ return data;
+}
+
+static void *eph_acceptor(void *data)
+{
+ struct eph_conn *conn = (struct eph_conn *)data;
+ struct sockaddr_in addr;
+ int sfd, addrlen = sizeof(addr);
+
+ while ((sfd =
+ eph_accept(conn, (struct sockaddr *)&addr, &addrlen)) != -1) {
+ if (eph_new_conn(sfd, eph_httpd) < 0) {
+ eph_close(sfd);
+
+ }
+ }
+ eph_exit_conn(conn);
+ return data;
+}
+
+static struct eph_conn *eph_find(int sfd)
+{
+ struct list_head *head = &chash[sfd % chash_size], *lnk;
+ struct eph_conn *conn;
+
+ DBL_LIST_FOR_EACH(lnk, head) {
+ conn = DBL_LIST_ENTRY(lnk, struct eph_conn, lnk);
+
+ if (conn->sfd == sfd)
+ return conn;
+ }
+ return NULL;
+}
+
+static int eph_runqueue(void)
+{
+ int i;
+ struct list_head *head, *lnk;
+ struct eph_conn *conn;
+
+ for (i = 0; i < chash_size; i++) {
+ head = &chash[i];
+ for (lnk = head->pNext; lnk != head;) {
+ conn = DBL_LIST_ENTRY(lnk, struct eph_conn, lnk);
+
+ lnk = lnk->pNext;
+ co_call(conn->co);
+ }
+ }
+ return 0;
+}
+
+unsigned long long eph_mstics(void)
+{
+
+ struct timeval tv;
+
+ if (gettimeofday(&tv, NULL) != 0)
+ return (0);
+
+ return (1000 * (unsigned long long)tv.tv_sec +
+ (unsigned long long)tv.tv_usec / 1000);
+
+}
+
+int eph_init(void)
+{
+ int i;
+
+ if (!
+ (events = malloc(maxsfd * sizeof(struct epoll_event)))) {
+ perror("malloc()");
+ return -1;
+ }
+
+ if ((kdpfd = epoll_create(maxsfd)) < 0) {
+ perror("epoll_create");
+ return -1;
+ }
+
+ if (!
+ (chash = malloc(maxsfd * sizeof(struct list_head)))) {
+ perror("malloc()");
+ free(events);
+ close(kdpfd);
+ return -1;
+ }
+
+ maxfds = maxsfd;
+ chash_size = maxfds;
+ for (i = 0; i < maxfds; i++)
+ DBL_INIT_LIST_HEAD(&chash[i]);
+
+ DBL_INIT_LIST_HEAD(&close_list);
+
+ return 0;
+}
+
+int eph_cleanup(void)
+{
+
+ free(events);
+ free(chash);
+ close(kdpfd);
+ return 0;
+}
+
+static int eph_scheduler(int loop, unsigned int timeout)
+{
+ int i, nfds;
+ struct eph_conn *conn;
+ struct epoll_event *cevents;
+
+ do {
+ nfds = epoll_wait(kdpfd, events, maxfds, timeout);
+
+ for (i = 0, cevents = events; i < nfds; i++, cevents++) {
+ conn = cevents->data.ptr;
+ if (conn->sfd != -1) {
+ conn->revents = cevents->events;
+
+ if (conn->revents & conn->events)
+ co_call(conn->co);
+ }
+ }
+#if 0
+ if (nfds <= 0)
+ eph_runqueue();
+#endif
+ eph_free_conns();
+ } while (loop);
+
+ return 0;
+}
+
+#if defined(DPHTTPD)
+
+void eph_usage(char const *prgname)
+{
+
+ fprintf(stderr,
+ "use: %s [--msgsize nbytes (%d)] [--port nbr (%d)] [--maxfds nfds (%d)]\n\t[--stksize bytes (%d)]\n",
+ prgname, msgsize, port, maxsfd, stksize);
+
+}
+
+int main(int argc, char *argv[])
+{
+ int i, sfd, flags = 1;
+ struct linger ling = { 0, 0 };
+ struct sockaddr_in addr;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--msgsize") == 0) {
+ if (++i < argc)
+ msgsize = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--port") == 0) {
+ if (++i < argc)
+ port = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--maxfds") == 0) {
+ if (++i < argc)
+ maxsfd = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--stksize") == 0) {
+ if (++i < argc)
+ stksize = atoi(argv[i]);
+ continue;
+ }
+
+ eph_usage(argv[0]);
+ return 1;
+ }
+
+ if (eph_init() == -1) {
+
+ return 2;
+ }
+
+ if ((sfd = eph_socket(AF_INET, SOCK_STREAM, 0)) == -1) {
+
+ eph_cleanup();
+ return 3;
+ }
+
+ setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags));
+ setsockopt(sfd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ if (bind(sfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
+
+ eph_close(sfd);
+ eph_cleanup();
+ return 4;
+ }
+
+ listen(sfd, STD_LISTEN_SIZE);
+
+ if (eph_new_conn(sfd, (void *)eph_acceptor) == -1) {
+
+ eph_close(sfd);
+ eph_cleanup();
+ return 5;
+ }
+
+ do {
+ eph_scheduler(0, STD_SCHED_TIMEOUT);
+ } while (numfds);
+
+ eph_cleanup();
+ return 0;
+}
+
+#endif /* #if defined(DPHTTPD) */
+
+#if defined(HTTP_BLASTER)
+
+static void *eph_http_session(void *data)
+{
+ int i, rlen = strlen(httpreq), ava;
+ struct eph_conn *conn = (struct eph_conn *)data;
+
+ if (eph_connect(conn, (struct sockaddr *)&saddr, sizeof(saddr)) == 0) {
+ for (i = 0; i < nreqsess; i++) {
+ if (eph_write_data(conn, httpreq, rlen) == rlen) {
+ static char const *clent = "Content-Length:";
+ int length = -1, clens = strlen(clent);
+ char *line;
+ static char buf[2048];
+
+ while ((line = eph_read_line(conn))) {
+ if (*line == '\0')
+ break;
+ if (strncasecmp(line, clent, clens) ==
+ 0) {
+ for (line += clens;
+ *line == ' '; line++) ;
+ length = atoi(line);
+ }
+ }
+ if (length < 0)
+ goto sess_out;
+ if ((ava = conn->nbytes - conn->rindex) > 0) {
+ if (ava > length)
+ ava = length;
+ length -= ava;
+ conn->rindex += ava;
+ }
+ ++httpresp;
+ while (length > 0) {
+ int rsiz =
+ length >
+ sizeof(buf) ? sizeof(buf) : length;
+
+ if ((rsiz =
+ eph_read(conn, buf, rsiz)) <= 0)
+ goto sess_out;
+ length -= rsiz;
+ }
+ } else
+ goto sess_out;
+ }
+ }
+sess_out:
+ eph_exit_conn(conn);
+ return data;
+}
+
+void eph_usage(char const *prgname)
+{
+
+ fprintf(stderr,
+ "use: %s --server serv --port nprt --numconns ncon [--nreq nreq (%d)]\n"
+ "[--maxconns ncon] [--url url ('/')] [--stksize bytes (%d)]\n",
+ prgname, nreqsess, stksize);
+
+}
+
+int main(int argc, char *argv[])
+{
+ int i, nconns = 0, totconns = 0, maxconns = 0;
+ unsigned long resplast;
+ unsigned long long tinit, tlast, tcurr;
+ struct hostent *he;
+ char const *server = NULL, *url = "/";
+ struct in_addr inadr;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--server") == 0) {
+ if (++i < argc)
+ server = argv[i];
+ continue;
+ }
+ if (strcmp(argv[i], "--port") == 0) {
+ if (++i < argc)
+ port = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--maxconns") == 0) {
+ if (++i < argc)
+ maxconns = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--numconns") == 0) {
+ if (++i < argc) {
+ nconns = atoi(argv[i]);
+ if (nconns > maxsfd)
+ maxsfd = nconns + nconns >> 1 + 1;
+ }
+ continue;
+ }
+ if (strcmp(argv[i], "--nreq") == 0) {
+ if (++i < argc)
+ nreqsess = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--url") == 0) {
+ if (++i < argc)
+ url = argv[i];
+ continue;
+ }
+ if (strcmp(argv[i], "--stksize") == 0) {
+ if (++i < argc)
+ stksize = atoi(argv[i]);
+ continue;
+ }
+
+ eph_usage(argv[0]);
+ return 1;
+ }
+
+ if (!server || !nconns) {
+ eph_usage(argv[0]);
+ return 2;
+ }
+
+ sprintf(httpreq,
+ "GET %s HTTP/1.1\r\n"
+ "Host: %s\r\n" "Connection: keepalive\r\n" "\r\n", url, server);
+
+ if (inet_aton(server, &inadr) == 0) {
+ if ((he = gethostbyname(server)) == NULL) {
+ fprintf(stderr, "unable to resolve: %s\n", server);
+ return (-1);
+ }
+
+ memcpy(&inadr.s_addr, he->h_addr_list[0], he->h_length);
+ }
+ saddr.sin_family = AF_INET;
+ saddr.sin_port = htons(port);
+ memcpy(&saddr.sin_addr, &inadr.s_addr, 4);
+
+ if (eph_init() == -1) {
+
+ return 2;
+ }
+
+ resplast = 0;
+ tinit = tlast = eph_mstics();
+
+ for (; numfds || (!maxconns || totconns < maxconns);) {
+ int nfds = numfds, errs = 0, diffconns = nconns - numfds;
+
+ while (numfds < nconns && (!maxconns || totconns < maxconns)) {
+ eph_create_conn(AF_INET, SOCK_STREAM, 0,
+ eph_http_session);
+ if (nfds == numfds) {
+ ++errs;
+ if (errs > 32) {
+ fprintf(stderr,
+ "unable to connect: server=%s errors=%d\n",
+ server, errs);
+ goto main_exit;
+ }
+ } else
+ ++totconns;
+ nfds = numfds;
+ }
+
+ eph_scheduler(0, STD_SCHED_TIMEOUT);
+
+ tcurr = eph_mstics();
+ if ((tcurr - tlast) >= 1000) {
+ printf
+ ("rate = %lu avg = %lu totconns = %d diff = %d resp = %ld nfds = %d\n",
+ (unsigned long)((1000 * (httpresp - resplast)) /
+ (tcurr - tlast)),
+ (unsigned long)((1000 * httpresp) /
+ (tcurr - tinit)), totconns,
+ diffconns, httpresp, numfds);
+
+ tlast = tcurr;
+ resplast = httpresp;
+ }
+ }
+
+main_exit:
+ eph_cleanup();
+ return 0;
+}
+
+#endif /* #if defined(HTTP_BLASTER) */
+
+#if defined(PIPETESTER)
+
+int eph_createcgi(char **args, void *func)
+{
+ int fds[2], flags = 1;
+ pid_t chpid;
+
+ if (pipe(fds)) {
+ perror("pipe");
+ return -1;
+ }
+ chpid = fork();
+ if (chpid == -1) {
+ perror("fork");
+ close(fds[0]), close(fds[1]);
+ return -1;
+ } else if (chpid == 0) {
+ close(fds[0]);
+ dup2(fds[1], 1);
+ close(fds[1]);
+ execvp(args[0], args);
+ perror("exec");
+ exit(1);
+ }
+ close(fds[1]);
+ if (ioctl(fds[0], FIONBIO, &flags) &&
+ ((flags = fcntl(fds[0], F_GETFL, 0)) < 0 ||
+ fcntl(fds[0], F_SETFL, flags | O_NONBLOCK) < 0)) {
+ close(fds[0]);
+ return -1;
+ }
+ fprintf(stdout, "child-run=%d fd=%d\n", chpid, fds[0]), fflush(stdout);
+ return eph_new_conn(fds[0], func);
+}
+
+int eph_createpipetest(int size, int tsleep, int ttime, void *func)
+{
+ int fds[2], flags = 1;
+ pid_t chpid;
+
+ if (pipe(fds)) {
+ perror("pipe");
+ return -1;
+ }
+ chpid = fork();
+ if (chpid == -1) {
+ perror("fork");
+ close(fds[0]), close(fds[1]);
+ return -1;
+ } else if (chpid == 0) {
+ int i;
+ char *buff = malloc(size + 1);
+ close(fds[0]);
+ dup2(fds[1], 1);
+ close(fds[1]);
+
+ srand(getpid() * time(NULL));
+ for (i = 0; i < (size - 1); i++) {
+ if (i && !(i % 64))
+ buff[i] = '\n';
+ else
+ buff[i] = '0' + (rand() % 10);
+ }
+ buff[i++] = '\n';
+ buff[i] = '\0';
+ ttime += (ttime * rand()) / RAND_MAX - (ttime >> 1);
+ ttime *= 1000;
+ while (ttime > 0) {
+ usleep(tsleep * 1000);
+ fputs(buff, stdout), fflush(stdout);
+ ttime -= tsleep;
+ }
+ free(buff);
+ exit(0);
+ }
+ close(fds[1]);
+ if (ioctl(fds[0], FIONBIO, &flags) &&
+ ((flags = fcntl(fds[0], F_GETFL, 0)) < 0 ||
+ fcntl(fds[0], F_SETFL, flags | O_NONBLOCK) < 0)) {
+ close(fds[0]);
+ return -1;
+ }
+ fprintf(stdout, "child-run=%d fd=%d\n", chpid, fds[0]), fflush(stdout);
+ return eph_new_conn(fds[0], func);
+}
+
+static void *eph_pipe_session(void *data)
+{
+ struct eph_conn *conn = (struct eph_conn *)data;
+ int nbytes, totbytes = 0;
+ char buff[257];
+
+ while ((nbytes = eph_read(conn, buff, sizeof(buff))) > 0) {
+ fprintf(stdout, "[%p] %d bytes readed\n", conn, nbytes),
+ fflush(stdout);
+ totbytes += nbytes;
+ }
+ fprintf(stdout, "[%p] exit - totbytes=%d\n", conn, totbytes),
+ fflush(stdout);
+ eph_exit_conn(conn);
+ return data;
+}
+
+void eph_sigchld(int sig)
+{
+ int status;
+ pid_t pid;
+
+ while ((pid = waitpid(0, &status, WNOHANG)) > 0) {
+ fprintf(stdout, "child-dead=%d\n", pid), fflush(stdout);
+ }
+ signal(SIGCHLD, eph_sigchld);
+}
+
+void eph_usage(char const *prgname)
+{
+
+ fprintf(stderr,
+ "use: %s [--ncgis ncgi] [--cgi cgi] [--stksize bytes (%d)]\n",
+ prgname, stksize);
+
+}
+
+int main(int argc, char *argv[])
+{
+ int i, ncgis = 8;
+ char *cgi = NULL;
+ char *args[16];
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--ncgis") == 0) {
+ if (++i < argc)
+ ncgis = atoi(argv[i]);
+ continue;
+ }
+ if (strcmp(argv[i], "--cgi") == 0) {
+ if (++i < argc)
+ cgi = argv[i];
+ continue;
+ }
+ if (strcmp(argv[i], "--stksize") == 0) {
+ if (++i < argc)
+ stksize = atoi(argv[i]);
+ continue;
+ }
+
+ eph_usage(argv[0]);
+ return 1;
+ }
+
+ signal(SIGCHLD, eph_sigchld);
+ signal(SIGPIPE, SIG_IGN);
+
+ if (eph_init() == -1) {
+
+ return 2;
+ }
+
+ if (cgi) {
+ args[0] = cgi;
+ args[1] = NULL;
+
+ for (i = 0; i < ncgis; i++)
+ eph_createcgi(args, eph_pipe_session);
+ } else {
+ for (i = 0; i < ncgis; i++)
+ eph_createpipetest(256, 250, 8, eph_pipe_session);
+ }
+
+ while (numfds > 0)
+ eph_scheduler(0, STD_SCHED_TIMEOUT);
+
+ eph_cleanup();
+ return 0;
+}
+
+#endif /* #if defined(PIPETESTER) */
diff --git a/testcases/kernel/syscalls/epoll2/include/dbllist.h b/testcases/kernel/syscalls/epoll2/include/dbllist.h
new file mode 100644
index 000000000..30d179183
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/include/dbllist.h
@@ -0,0 +1,98 @@
+
+#ifndef _DBLLISTS_H
+#define _DBLLISTS_H
+
+
+
+#define DBL_LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define DBL_LIST_HEAD(name) struct list_head name = DBL_LIST_HEAD_INIT(name)
+
+#define DBL_INIT_LIST_HEAD(ptr) \
+do { \
+ (ptr)->pNext = (ptr)->pPrev = (ptr); \
+} while (0)
+
+#define DBL_LIST_ADD(newi, prev, next) \
+do { \
+ struct list_head *pPrev = prev; \
+ struct list_head *pNext = next; \
+ (pNext)->pPrev = newi; \
+ (newi)->pNext = pNext; \
+ (newi)->pPrev = pPrev; \
+ (pPrev)->pNext = newi; \
+} while (0)
+
+#define DBL_LIST_ADDH(new, head) DBL_LIST_ADD(new, head, (head)->pNext)
+
+#define DBL_LIST_ADDT(new, head) DBL_LIST_ADD(new, (head)->pPrev, head)
+
+#define DBL_LIST_UNLINK(prev, next) \
+do { \
+ struct list_head *pPrev = prev; \
+ struct list_head *pNext = next; \
+ (next)->pPrev = pPrev; \
+ (prev)->pNext = pNext; \
+} while (0)
+
+#define DBL_LIST_DEL(entry) \
+do { \
+ DBL_LIST_UNLINK((entry)->pPrev, (entry)->pNext); \
+ DBL_INIT_LIST_HEAD(entry); \
+} while (0)
+
+#define DBL_LIST_EMTPY(head) ((head)->pNext == head)
+
+#define DBL_LIST_SPLICE(list, head) \
+do { \
+ struct list_head * first = (list)->pNext; \
+ if (first != list) { \
+ struct list_head * last = (list)->pPrev; \
+ struct list_head * at = (head)->pNext; \
+ (first)->pPrev = head; \
+ (head)->pNext = first; \
+ (last)->pNext = at; \
+ (at)->pPrev = last; \
+ } \
+} while (0)
+
+#define DBL_HEAD_COPY(oldh, newh) \
+do { \
+ *(oldh) = (*newh); \
+ (newh)->pNext->pPrev = (oldh); \
+ (newh)->pPrev->pNext = (oldh); \
+} while (0)
+
+#define DBL_ITEM_IN_LIST(ptr) (((ptr)->pPrev != (ptr)) && ((ptr)->pNext != (ptr)))
+
+#define DBL_LIST_FIRST(head) (((head)->pNext != (head)) ? (head)->pNext: NULL)
+
+#define DBL_LIST_LAST(head) (((head)->pPrev != (head)) ? (head)->pPrev: NULL)
+
+#define DBL_LIST_ENTRY(ptr, type, member) ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))
+
+#define DBL_LIST_FOR_EACH(pos, head) for (pos = (head)->pNext; pos != (head); pos = (pos)->pNext)
+
+#define DBL_END_OF_LIST(pos, head) ((pos) == (head))
+
+#define DBL_LIST_NEXT(pos, head) (((pos)->pNext != (head)) ? (pos)->pNext: NULL)
+
+#define DBL_LIST_PREV(pos, head) (((pos)->pPrev != (head)) ? (pos)->pPrev: NULL)
+
+
+
+
+
+
+
+struct list_head
+{
+ struct list_head *pNext;
+ struct list_head *pPrev;
+};
+
+
+
+
+
+#endif
diff --git a/testcases/kernel/syscalls/epoll2/include/epoll.h b/testcases/kernel/syscalls/epoll2/include/epoll.h
new file mode 100644
index 000000000..8cc5e7ef0
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/include/epoll.h
@@ -0,0 +1,123 @@
+/* Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_EPOLL_H
+#define _SYS_EPOLL_H 1
+
+#include <stdint.h>
+#include <sys/types.h>
+
+
+enum EPOLL_EVENTS
+ {
+ EPOLLIN = 0x001,
+#define EPOLLIN EPOLLIN
+ EPOLLPRI = 0x002,
+#define EPOLLPRI EPOLLPRI
+ EPOLLOUT = 0x004,
+#define EPOLLOUT EPOLLOUT
+ EPOLLRDNORM = 0x040,
+#define EPOLLRDNORM EPOLLRDNORM
+ EPOLLRDBAND = 0x080,
+#define EPOLLRDBAND EPOLLRDBAND
+ EPOLLWRNORM = 0x100,
+#define EPOLLWRNORM EPOLLWRNORM
+ EPOLLWRBAND = 0x200,
+#define EPOLLWRBAND EPOLLWRBAND
+ EPOLLMSG = 0x400,
+#define EPOLLMSG EPOLLMSG
+ EPOLLERR = 0x008,
+#define EPOLLERR EPOLLERR
+ EPOLLHUP = 0x010,
+#define EPOLLHUP EPOLLHUP
+ EPOLLONESHOT = (1 << 30),
+#define EPOLLONESHOT EPOLLONESHOT
+ EPOLLET = (1 << 31)
+#define EPOLLET EPOLLET
+
+ };
+
+
+/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
+#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */
+#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */
+#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */
+
+
+/*
+ * On x86-64 make the 64bit structure have the same alignment as the
+ * 32bit structure. This makes 32bit emulation easier.
+ */
+#ifdef __x86_64__
+#define EPOLL_PACKED __attribute__((packed))
+#else
+#define EPOLL_PACKED
+#endif
+
+
+typedef union epoll_data
+{
+ void *ptr;
+ int fd;
+ uint32_t u32;
+ uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event
+{
+ uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+} EPOLL_PACKED;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Creates an epoll instance. Returns an fd for the new instance.
+ The "size" parameter is a hint specifying the number of file
+ descriptors to be associated with the new instance. The fd
+ returned by epoll_create() should be closed with close(). */
+extern int epoll_create (int __size) __THROW;
+
+
+/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
+ -1 in case of error ( the "errno" variable will contain the
+ specific error code ) The "op" parameter is one of the EPOLL_CTL_*
+ constants defined above. The "fd" parameter is the target of the
+ operation. The "event" parameter describes which events the caller
+ is interested in and any associated user data. */
+extern int epoll_ctl (int __epfd, int __op, int __fd,
+ struct epoll_event *__event) __THROW;
+
+
+/* Wait for events on an epoll instance "epfd". Returns the number of
+ triggered events returned in "events" buffer. Or -1 in case of
+ error with the "errno" variable set to the specific error code. The
+ "events" parameter is a buffer that will contain triggered
+ events. The "maxevents" is the maximum number of events to be
+ returned ( usually size of "events" ). The "timeout" parameter
+ specifies the maximum wait time in milliseconds (-1 == infinite). */
+extern int epoll_wait (int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout) __THROW;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/epoll.h */
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll.4 b/testcases/kernel/syscalls/epoll2/man/epoll.4
new file mode 100644
index 000000000..e9d531bab
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll.4
@@ -0,0 +1,373 @@
+.\"
+.\" epoll by Davide Libenzi ( efficient event notification retrieval )
+.\" Copyright (C) 2003 Davide Libenzi
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program; if not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" Davide Libenzi <davidel@xmailserver.org>
+.\"
+.\"
+.TH EPOLL 4 "23 October 2002" Linux "Linux Programmer's Manual"
+.SH NAME
+epoll \- I/O event notification facility
+.SH SYNOPSIS
+.B #include <sys/epoll.h>
+.SH DESCRIPTION
+.B epoll
+is a variant of$
+.BR poll (2)
+that can be used either as Edge or Level Triggered interface and scales
+well to large numbers of watched fds. Three system calls are provided to
+set up and control an
+.B epoll
+set:$
+.BR epoll_create (2) ,
+.BR epoll_ctl (2) ,
+.BR epoll_wait (2) .
+
+An
+.B epoll
+set is connected to a file descriptor created by
+.BR epoll_create (2) .
+Interest for certain file descriptors is then registered via$
+.BR epoll_ctl(2) .
+Finally, the actual wait is started by$
+.BR epoll_wait (2) .
+
+.SH NOTES
+The
+.B epoll
+event distribution interface is able to behave both as Edge Triggered
+( ET ) and Level Triggered ( LT ). The difference between ET and LT
+event distribution mechanism can be described as follows. Suppose that
+this scenario happens :
+.TP
+.B 1
+The file descriptor that represent the read side of a pipe (
+.B RFD
+) is added inside the
+.B epoll
+device.
+.TP
+.B 2
+Pipe writer writes 2Kb of data on the write side of the pipe.
+.TP
+.B 3
+A call to
+.BR epoll_wait (2)
+is done that will return
+.B RFD
+as ready file descriptor.
+.TP
+.B 4
+The pipe reader reads 1Kb of data from
+.BR RFD .
+.TP
+.B 5
+A call to
+.BR epoll_wait (2)
+is done.
+.PP
+
+If the
+.B RFD
+file descriptor has been added to the
+.B epoll
+interface using the
+.B EPOLLET
+flag, the call to
+.BR epoll_wait (2)
+done in step
+.B 5
+will probably hang because of the available data still present in the file
+input buffers and the remote peer might be expecting a response based on the
+data it already sent. The reason for this is that Edge Triggered event
+distribution delivers events only when events happens on the monitored file.
+So, in step
+.B 5
+the caller might end up waiting for some data that is already present inside
+the input buffer. In the above example, an event on
+.B RFD
+will be generated because of the write done in
+.B 2
+, and the event is consumed in
+.BR 3 .
+Since the read operation done in
+.B 4
+does not consume the whole buffer data, the call to
+.BR epoll_wait (2)
+done in step
+.B 5
+might lock indefinitely. The
+.B epoll
+interface, when used with the
+.B EPOLLET
+flag ( Edge Triggered )
+should use non-blocking file descriptors to avoid having a blocking
+read or write starve the task that is handling multiple file descriptors.
+The suggested way to use
+.B epoll
+as an Edge Triggered (
+.B EPOLLET
+) interface is below, and possible pitfalls to avoid follow.
+.SR
+.TP$
+.B i
+with non-blocking file descriptors
+.TP$
+.B ii
+by going to wait for an event only after
+.BR read (2)
+or$
+.BR write (2)
+return EAGAIN
+.SE
+.PP
+On the contrary, when used as a Level Triggered interface,
+.B epoll
+is by all means a faster
+.BR poll (2),
+and can be used wherever the latter is used since it shares the
+same semantics. Since even with the Edge Triggered
+.B epoll
+multiple events can be generated up on receival of multiple chunks of data,
+the caller has the option to specify the
+.B EPOLLONESHOT
+flag, to tell
+.B epoll
+to disable the associated file descriptor after the receival of an event with
+.BR epoll_wait (2).
+When the
+.B EPOLLONESHOT
+flag is specified, it is caller responsibility to rearm the file descriptor using
+.BR epoll_ctl (2)
+with
+.BR EPOLL_CTL_MOD.
+
+.SH EXAMPLE FOR SUGGESTED USAGE
+
+While the usage of
+.B epoll
+when employed like a Level Triggered interface does have the same
+semantics of
+.BR poll (2),
+an Edge Triggered usage requires more clarifiction to avoid stalls
+in the application event loop. In this example, listener is a
+non-blocking socket on which
+.BR listen (2)
+has been called. The function do_use_fd() uses the new ready
+file descriptor until EAGAIN is returned by either
+.BR read (2)
+or
+.BR write (2).
+An event driven state machine application should, after having received
+EAGAIN, record its current state so that at the next call to do_use_fd()
+it will continue to
+.BR read (2)
+or
+.BR write (2)
+from where it stopped before. $
+
+.nf
+struct epoll_event ev, *events;
+
+for(;;) {
+ nfds = epoll_wait(kdpfd, events, maxevents, -1);
+
+ for(n = 0; n < nfds; ++n) {
+ if(events[n].data.fd == listener) {
+ client = accept(listener, (struct sockaddr *) &local,
+ &addrlen);
+ if(client < 0){
+ perror("accept");
+ continue;
+ }
+ setnonblocking(client);
+ ev.events = EPOLLIN | EPOLLET;
+ ev.data.fd = client;
+ if (epoll_ctl(kdpfd, EPOLL_CTL_ADD, client, &ev) < 0) {
+ fprintf(stderr, "epoll set insertion error: fd=%d\n",
+ client);
+ return -1;
+ }
+ }
+ else
+ do_use_fd(events[n].data.fd);
+ }
+}
+.fi
+
+When used as an Edge triggered interface, for performance reasons, it is
+possible to add the file descriptor inside the epoll interface (
+.B EPOLL_CTL_ADD
+) once by specifying (
+.BR EPOLLIN | EPOLLOUT
+). This allows you to avoid
+continuously switching between
+.B EPOLLIN
+and
+.B EPOLLOUT
+calling
+.BR epoll_ctl (2)
+with
+.BR EPOLL_CTL_MOD .
+
+.SH QUESTIONS AND ANSWERS (from linux-kernel)
+
+.SR
+.TP$
+.B Q1$
+What happens if you add the same fd to an epoll_set twice?
+.TP
+.B A1$
+You will probably get EEXIST. However, it is possible that two
+threads may add the same fd twice. This is a harmless condition.
+.TP
+.B Q2$
+Can two
+.B epoll
+sets wait for the same fd? If so, are events reported
+to both
+.B epoll
+sets fds?
+.TP
+.B A2
+Yes. However, it is not recommended. Yes it would be reported to both.
+.TP
+.B Q3
+Is the
+.B epoll
+fd itself poll/epoll/selectable?
+.TP
+.B A3
+Yes.
+.TP
+.B Q4$
+What happens if the
+.B epoll
+fd is put into its own fd set?
+.TP
+.B A4
+It will fail. However, you can add an
+.B epoll
+fd inside another epoll fd set.$
+.TP
+.B Q5
+Can I send the
+.B epoll
+fd over a unix-socket to another process?
+.TP
+.B A5
+No.
+.TP
+.B Q6
+Will the close of an fd cause it to be removed from all
+.B epoll
+sets automatically?
+.TP
+.B A6
+Yes.
+.TP
+.B Q7$
+If more than one event comes in between
+.BR epoll_wait (2)
+calls, are they combined or reported separately?
+.TP
+.B A7
+They will be combined.
+.TP
+.B Q8
+Does an operation on an fd affect the already collected but not yet reported
+events?
+.TP
+.B A8
+You can do two operations on an existing fd. Remove would be meaningless for
+this case. Modify will re-read available I/O.
+.TP
+.B Q9
+Do I need to continuously read/write an fd until EAGAIN when using the
+.B EPOLLET
+flag ( Edge Triggered behaviour ) ?
+.TP
+.B A9
+No you don't. Receiving an event from
+.BR epoll_wait (2)
+should suggest to you that such file descriptor is ready for the requested I/O
+operation. You have simply to consider it ready until you will receive the
+next EAGAIN. When and how you will use such file descriptor is entirely up
+to you. Also, the condition that the read/write I/O space is exhausted can
+be detected by checking the amount of data read/write from/to the target
+file descriptor. For example, if you call
+.BR read (2)
+by asking to read a certain amount of data and
+.BR read (2)
+returns a lower number of bytes, you can be sure to have exhausted the read
+I/O space for such file descriptor. Same is valid when writing using the
+.BR write (2)
+function.
+.SE
+
+.SH POSSIBLE PITFALLS AND WAYS TO AVOID THEM
+.SR
+.TP
+.B o Starvation ( Edge Triggered )
+.PP
+If there is a large amount of I/O space, it is possible that by trying to drain
+it the other files will not get processed causing starvation. This
+is not specific to
+.BR epoll .
+.PP
+.PP
+The solution is to maintain a ready list and mark the file descriptor as ready
+in its associated data structure, thereby allowing the application to
+remember which files need to be processed but still round robin amongst
+all the ready files. This also supports ignoring subsequent events you
+receive for fd's that are already ready.
+.PP
+
+.TP
+.B o If using an event cache... $
+.PP
+If you use an event cache or store all the fd's returned from
+.BR epoll_wait (2),
+then make sure to provide a way to mark its closure dynamically (ie- caused by$
+a previous event's processing). Suppose you receive 100 events from$
+.BR epoll_wait (2),
+and in eventi #47 a condition causes event #13 to be closed.$
+If you remove the structure and close() the fd for event #13, then your$
+event cache might still say there are events waiting for that fd causing$
+confusion.
+.PP
+.PP$
+One solution for this is to call, during the processing of event 47,
+.BR epoll_ctl ( EPOLL_CTL_DEL )
+to delete fd 13 and close(), then mark its associated
+data structure as removed and link it to a cleanup list. If you find another
+event for fd 13 in your batch processing, you will discover the fd had been
+previously removed and there will be no confusion.
+.PP
+
+.SE
+.SH CONFORMING TO
+.BR epoll (4)
+is a new API introduced in Linux kernel
+.BR 2.5.44 .
+Its interface should be finalized in Linux kernel
+.BR 2.5.66 .
+.SH "SEE ALSO"
+.BR epoll_create (2)
+.BR epoll_ctl (2)
+.BR epoll_wait (2)
+
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll.ps b/testcases/kernel/syscalls/epoll2/man/epoll.ps
new file mode 100644
index 000000000..eb88411e4
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll.ps
@@ -0,0 +1,604 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Mon Feb 16 19:03:38 2004
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 3
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 130.68<45504f4c4c283429204c696e7578>72 48 R
+<50726f6772616d6d657227>2.5 E 2.5<734d>-.55 G 130.68
+<616e75616c2045504f4c4c283429>-2.5 F/F1 10.95/Times-Bold@0 SF -.219
+<4e41>72 84 S<4d45>.219 E F0<65706f6c6c20ad20492f4f2065>108 96 Q -.15
+<7665>-.25 G<6e74206e6f74698c636174696f6e2066>.15 E<6163696c697479>-.1 E
+F1<53594e4f50534953>72 112.8 Q/F2 10/Times-Bold@0 SF
+<23696e636c756465203c7379732f65706f6c6c2e683e>108 124.8 Q F1
+<4445534352495054494f4e>72 141.6 Q F2<65706f6c6c>108 153.6 Q F0 .521
+<697320612076>3.021 F .521<617269616e74206f66>-.25 F F2<706f6c6c>3.021 E
+F0 .521<28322920746861742063616e2062652075736564206569746865722061732045
+646765206f72204c65>B -.15<7665>-.25 G 3.021<6c54>.15 G .521
+<726967676572656420696e74657266>-3.371 F .521
+<61636520616e64207363616c65732077656c6c20746f>-.1 F<6c6172>108 165.6 Q
+.103<6765206e756d62657273206f662077>-.18 F .103<617463686564206664732e20
+54687265652073797374656d2063616c6c73206172652070726f>-.1 F .103
+<766964656420746f2073657420757020616e6420636f6e74726f6c20616e>-.15 F F2
+<65706f6c6c>2.604 E F0<7365743a>2.604 E F2<65706f6c6c5f6372>2.604 E
+<652d>-.18 E<617465>108 177.6 Q F0<283229>A F2 2.5<2c65>C
+<706f6c6c5f63746c>-2.5 E F0<283229>A F2 2.5<2c65>C<706f6c6c5f77616974>
+-2.5 E F0<283229>A F2<2e>A F0<416e>108 201.6 Q F2<65706f6c6c>2.712 E F0
+.212<73657420697320636f6e6e656374656420746f2061208c6c652064657363726970
+746f722063726561746564206279>2.712 F F2<65706f6c6c5f6372>2.712 E
+<65617465>-.18 E F0<283229>A F2<2e>A F0 .212<496e74657265737420666f7220
+6365727461696e208c6c652064657363726970746f7273>5.212 F
+<6973207468656e207265>108 213.6 Q<676973746572656420766961>-.15 E F2
+<65706f6c6c5f63746c283229>2.5 E F0 5<2e46>C<696e616c6c79>-5 E 2.5<2c74>
+-.65 G<68652061637475616c2077>-2.5 E<6169742069732073746172746564206279>
+-.1 E F2<65706f6c6c5f77616974>2.5 E F0<283229>A F2<2e>A F1<4e4f>72 242.4
+Q<544553>-.438 E F0<546865>108 254.4 Q F2<65706f6c6c>2.679 E F0 -2.15
+-.25<65762065>2.679 H .179<6e742064697374726962>.25 F .179
+<7574696f6e20696e74657266>-.2 F .179
+<6163652069732061626c6520746f2062656861>-.1 F .479 -.15<76652062>-.2 H
+.18<6f746820617320456467652054>.15 F .18
+<72696767657265642028204554202920616e64204c65>-.35 F -.15<7665>-.25 G
+2.68<6c54>.15 G .18<72696767657265642028>-3.03 F 2.71 -.92<4c542029>108
+266.4 T 3.37<2e54>.92 G .87<686520646966>-3.37 F .87
+<666572656e6365206265747765656e20455420616e64204c>-.25 F 3.37<5465>-.92
+G -.15<7665>-3.62 G .87<6e742064697374726962>.15 F .87<7574696f6e206d65
+6368616e69736d2063616e2062652064657363726962656420617320666f6c6c6f>-.2 F
+.87<77732e205375702d>-.25 F
+<706f736520746861742074686973207363656e6172696f2068617070656e73203a>108
+278.4 Q F2<31>108 295.2 Q F0<546865208c6c652064657363726970746f72207468
+617420726570726573656e742074686520726561642073696465206f6620612070697065
+2028>31 E F2<524644>2.5 E F0 2.5<2969>2.5 G 2.5<7361>-2.5 G
+<6464656420696e7369646520746865>-2.5 E F2<65706f6c6c>2.5 E F0<6465>2.5 E
+<766963652e>-.25 E F2<32>108 312 Q F0<5069706520777269746572207772697465
+7320324b62206f662064617461206f6e207468652077726974652073696465206f662074
+686520706970652e>31 E F2<33>108 328.8 Q F0 2.5<4163>31 G<616c6c20746f>
+-2.5 E F2<65706f6c6c5f77616974>2.5 E F0
+<28322920697320646f6e6520746861742077696c6c2072657475726e>A F2<524644>
+2.5 E F0<6173207265616479208c6c652064657363726970746f72>2.5 E<2e>-.55 E
+F2<34>108 345.6 Q F0<54686520706970652072656164657220726561647320314b62
+206f6620646174612066726f6d>31 E F2<524644>2.5 E F0<2e>A F2<35>108 362.4
+Q F0 2.5<4163>31 G<616c6c20746f>-2.5 E F2<65706f6c6c5f77616974>2.5 E F0
+<28322920697320646f6e652e>A 1.677<496620746865>108 391.2 R F2<524644>
+4.177 E F0 1.678<8c6c652064657363726970746f7220686173206265656e20616464
+656420746f20746865>4.177 F F2<65706f6c6c>4.178 E F0<696e74657266>4.178 E
+1.678<616365207573696e6720746865>-.1 F F2<45504f4c4c4554>4.178 E F0
+1.678<8d61672c207468652063616c6c20746f>4.178 F F2<65706f6c6c5f77616974>
+108 403.2 Q F0 .602<28322920646f6e6520696e2073746570>B F2<35>3.102 E F0
+.602
+<77696c6c2070726f6261626c792068616e672062656361757365206f66207468652061>
+3.102 F -.25<7661>-.2 G .601<696c61626c652064617461207374696c6c20707265
+73656e7420696e20746865208c6c6520696e707574>.25 F -.2<6275>108 415.2 S
+-.25<6666>.2 G .289
+<65727320616e64207468652072656d6f74652070656572206d696768742062652065>
+.25 F .289<7870656374696e67206120726573706f6e7365206261736564206f6e2074
+6865206461746120697420616c72656164792073656e742e2054686520726561736f6e20
+666f72>-.15 F .965<74686973206973207468617420456467652054>108 427.2 R
+.965<72696767657265642065>-.35 F -.15<7665>-.25 G .965
+<6e742064697374726962>.15 F .965<7574696f6e2064656c69>-.2 F -.15<7665>
+-.25 G .965<72732065>.15 F -.15<7665>-.25 G .965
+<6e7473206f6e6c79207768656e2065>.15 F -.15<7665>-.25 G .964
+<6e74732068617070656e73206f6e20746865206d6f6e69746f726564>.15 F 3.704
+<8c6c652e20536f2c>108 439.2 R 1.204<696e2073746570>3.704 F F2<35>3.704 E
+F0 1.204<7468652063616c6c6572206d6967687420656e642075702077>3.704 F
+1.204<616974696e6720666f7220736f6d652064617461207468617420697320616c7265
+6164792070726573656e7420696e736964652074686520696e707574>-.1 F -.2<6275>
+108 451.2 S -.25<6666>.2 G<6572>.25 E 3.165<2e49>-.55 G 3.165<6e74>
+-3.165 G .665<68652061626f>-3.165 F .965 -.15<7665206578>-.15 H .665
+<616d706c652c20616e2065>.15 F -.15<7665>-.25 G .665<6e74206f6e>.15 F F2
+<524644>3.165 E F0 .665<77696c6c2062652067656e65726174656420626563617573
+65206f662074686520777269746520646f6e6520696e>3.165 F F2<32>3.164 E F0
+3.164<2c61>3.164 G .664<6e6420746865>-3.164 F -2.15 -.25<65762065>108
+463.2 T .049<6e7420697320636f6e73756d656420696e>.25 F F2<33>2.549 E F0
+5.049<2e53>C .049
+<696e6365207468652072656164206f7065726174696f6e20646f6e6520696e>-5.049 F
+F2<34>2.549 E F0 .049
+<646f6573206e6f7420636f6e73756d65207468652077686f6c652062>2.549 F<7566>
+-.2 E .049<66657220646174612c207468652063616c6c>-.25 F<746f>108 475.2 Q
+F2<65706f6c6c5f77616974>2.604 E F0 .103
+<28322920646f6e6520696e2073746570>B F2<35>2.603 E F0 .103
+<6d69676874206c6f636b20696e64658c6e6974656c79>2.603 F 2.603<2e54>-.65 G
+<6865>-2.603 E F2<65706f6c6c>2.603 E F0<696e74657266>2.603 E .103
+<6163652c207768656e2075736564207769746820746865>-.1 F F2<45504f4c4c4554>
+2.603 E F0 .945<8d6167202820456467652054>108 487.2 R .945<72696767657265
+6420292073686f756c6420757365206e6f6e2d626c6f636b696e67208c6c652064657363
+726970746f727320746f2061>-.35 F -.2<766f>-.2 G .945<6964206861>.2 F .946
+<76696e67206120626c6f636b696e672072656164206f72207772697465>-.2 F
+<7374617276>108 499.2 Q 3.141<6574>-.15 G .641<6865207461736b2074686174
+2069732068616e646c696e67206d756c7469706c65208c6c652064657363726970746f72
+732e>-3.141 F .641<546865207375676765737465642077>5.641 F .64
+<617920746f20757365>-.1 F F2<65706f6c6c>3.14 E F0 .64
+<617320616e20456467652054>3.14 F<7269672d>-.35 E<67657265642028>108
+511.2 Q F2<45504f4c4c4554>2.5 E F0 2.5<2969>2.5 G<6e74657266>-2.5 E
+<6163652069732062656c6f>-.1 E 1.3 -.65<772c2061>-.25 H
+<6e6420706f737369626c652070697466>.65 E<616c6c7320746f2061>-.1 E -.2
+<766f>-.2 G<696420666f6c6c6f>.2 E -.65<772e>-.25 G F2<69>108 528 Q F0
+<77697468206e6f6e2d626c6f636b696e67208c6c652064657363726970746f7273>
+33.22 E F2<6969>108 544.8 Q F0<627920676f696e6720746f2077>30.44 E
+<61697420666f7220616e2065>-.1 E -.15<7665>-.25 G
+<6e74206f6e6c79206166746572>.15 E F2 -.18<7265>2.5 G<6164>.18 E F0
+<283229206f72>A F2<7772697465>2.5 E F0<2832292072657475726e204541>A
+<4741494e>-.4 E .171<4f6e2074686520636f6e7472617279>108 561.6 R 2.671
+<2c77>-.65 G .171<68656e20757365642061732061204c65>-2.671 F -.15<7665>
+-.25 G 2.671<6c54>.15 G .171<726967676572656420696e74657266>-3.021 F
+<6163652c>-.1 E F2<65706f6c6c>2.671 E F0 .172
+<697320627920616c6c206d65616e7320612066>2.672 F<6173746572>-.1 E F2
+<706f6c6c>2.672 E F0 .172<2832292c20616e642063616e206265>B 1.204
+<75736564207768657265>108 573.6 R -.15<7665>-.25 G 3.704<7274>.15 G
+1.204<6865206c617474657220697320757365642073696e636520697420736861726573
+207468652073616d652073656d616e746963732e2053696e63652065>-3.704 F -.15
+<7665>-.25 G 3.703<6e77>.15 G 1.203<6974682074686520456467652054>-3.703
+F<7269676765726564>-.35 E F2<65706f6c6c>108 585.6 Q F0 .068
+<6d756c7469706c652065>2.568 F -.15<7665>-.25 G .068
+<6e74732063616e2062652067656e657261746564207570206f6e207265636569>.15 F
+-.25<7661>-.25 G 2.568<6c6f>.25 G 2.568<666d>-2.568 G .069<756c7469706c
+65206368756e6b73206f6620646174612c207468652063616c6c65722068617320746865
+206f7074696f6e20746f>-2.568 F .529<7370656369667920746865>108 597.6 R F2
+<45504f4c4c4f4e4553484f>3.029 E<54>-.4 E F0 .529
+<8d61672c20746f2074656c6c>3.029 F F2<65706f6c6c>3.029 E F0 .528<746f2064
+697361626c6520746865206173736f636961746564208c6c652064657363726970746f72
+20616674657220746865207265636569>3.029 F -.25<7661>-.25 G<6c>.25 E .112
+<6f6620616e2065>108 609.6 R -.15<7665>-.25 G .112<6e742077697468>.15 F
+F2<65706f6c6c5f77616974>2.612 E F0 2.612<2832292e205768656e>B<746865>
+2.613 E F2<45504f4c4c4f4e4553484f>2.613 E<54>-.4 E F0 .113<8d6167206973
+2073706563698c65642c2069742069732063616c6c657220726573706f6e736962696c69
+747920746f>2.613 F
+<726561726d20746865208c6c652064657363726970746f72207573696e67>108 621.6
+Q F2<65706f6c6c5f63746c>2.5 E F0<2832292077697468>A F2
+<45504f4c4c5f43544c5f4d4f44>2.5 E<2e>-.2 E F1
+<4558414d504c4520464f522053554747455354454420555341>72 650.4 Q<4745>
+-.602 E F0 .419<5768696c6520746865207573616765206f66>108 662.4 R F2
+<65706f6c6c>2.919 E F0 .418<7768656e20656d706c6f>2.918 F .418
+<796564206c696b>-.1 F 2.918<65614c>-.1 G -2.15 -.25<65762065>-2.918 H
+2.918<6c54>.25 G .418<726967676572656420696e74657266>-3.268 F .418
+<61636520646f6573206861>-.1 F .718 -.15<76652074>-.2 H .418
+<68652073616d652073656d616e74696373206f66>.15 F F2<706f6c6c>108 674.4 Q
+F0 .582<2832292c20616e20456467652054>B .582<7269676765726564207573616765
+207265717569726573206d6f726520636c6172698c6374696f6e20746f2061>-.35 F
+-.2<766f>-.2 G .583
+<6964207374616c6c7320696e20746865206170706c69636174696f6e2065>.2 F -.15
+<7665>-.25 G .583<6e74206c6f6f702e20496e>.15 F 3.618<746869732065>108
+686.4 R 3.617<78616d706c652c206c697374656e65722069732061206e6f6e2d626c6f
+636b696e6720736f636b>-.15 F 3.617<6574206f6e207768696368>-.1 F F2
+<6c697374656e>6.117 E F0 3.617
+<28322920686173206265656e2063616c6c65642e205468652066756e6374696f6e>B
+.218<646f5f7573655f66642829207573657320746865206e65>108 698.4 R 2.718
+<7772>-.25 G .218
+<65616479208c6c652064657363726970746f7220756e74696c204541>-2.718 F .218
+<4741494e2069732072657475726e656420627920656974686572>-.4 F F2 -.18
+<7265>2.718 G<6164>.18 E F0 .218<283229206f72>B F2<7772697465>2.719 E F0
+2.719<2832292e20416e>B -2.15 -.25<65762065>108 710.4 T 1.073
+<6e7420647269>.25 F -.15<7665>-.25 G 3.573<6e73>.15 G 1.072<74617465206d
+616368696e65206170706c69636174696f6e2073686f756c642c206166746572206861>
+-3.573 F 1.072<76696e67207265636569>-.2 F -.15<7665>-.25 G 3.572<6445>
+.15 G -.4<4147>-3.572 G 1.072
+<41494e2c207265636f7264206974732063757272656e7420737461746520736f>.4 F
+<7468617420617420746865206e65>108 722.4 Q<78742063616c6c20746f20646f5f75
+73655f666428292069742077696c6c20636f6e74696e756520746f>-.15 E F2 -.18
+<7265>2.5 G<6164>.18 E F0<283229206f72>A F2<7772697465>2.5 E F0
+<2832292066726f6d2077686572652069742073746f70706564206265666f72652e>A
+174.005<4c696e7578203233>72 768 R<4f63746f6265722032303032>2.5 E<31>
+195.395 E 0 Cg EP
+%%Page: 2 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 130.68<45504f4c4c283429204c696e7578>72 48 R
+<50726f6772616d6d657227>2.5 E 2.5<734d>-.55 G 130.68
+<616e75616c2045504f4c4c283429>-2.5 F<7374727563742065706f6c6c5f65>108 84
+Q -.15<7665>-.25 G<6e742065>.15 E 1.3 -.65<762c202a>-.25 H -2.15 -.25
+<65762065>.65 H<6e74733b>.25 E<666f72283b3b29207b>108 108 Q
+<6e666473203d2065706f6c6c5f77>118 120 Q<616974286b647066642c2065>-.1 E
+-.15<7665>-.25 G<6e74732c206d6178>.15 E -2.15 -.25<65762065>-.15 H
+<6e74732c202d31293b>.25 E
+<666f72286e203d20303b206e203c206e6664733b202b2b6e29207b>118 144 Q
+<69662865>128 156 Q -.15<7665>-.25 G
+<6e74735b6e5d2e646174612e6664203d3d206c697374656e657229207b>.15 E
+<636c69656e74203d20616363657074286c697374656e6572>138 168 Q 2.5<2c28>-.4
+G<73747275637420736f636b61646472202a2920266c6f63616c2c>-2.5 E
+<26616464726c656e293b>178 180 Q<696628636c69656e74203c2030297b>138 192 Q
+<706572726f72282261636365707422293b>148 204 Q<636f6e74696e75653b>148 216
+Q<7d>138 228 Q<7365746e6f6e626c6f636b696e6728636c69656e74293b>138 240 Q
+-.25<6576>138 252 S<2e65>-.4 E -.15<7665>-.25 G
+<6e7473203d2045504f4c4c494e207c2045504f4c4c4554>.15 E<3b>-.55 E -.25
+<6576>138 264 S<2e646174612e6664203d20636c69656e743b>-.4 E<696620286570
+6f6c6c5f63746c286b647066642c2045504f4c4c5f43544c5f4144442c20636c69656e74
+2c202665>138 276 Q<7629203c203029207b>-.25 E
+<667072696e746628737464657272>148 288 Q 2.5<2c22>-.4 G
+<65706f6c6c2073657420696e73657274696f6e206572726f723a2066643d2564302c>
+-2.5 E<636c69656e74293b>168 300 Q<72657475726e202d313b>148 312 Q<7d>138
+324 Q<7d>128 336 Q<656c7365>128 348 Q<646f5f7573655f66642865>138 360 Q
+-.15<7665>-.25 G<6e74735b6e5d2e646174612e6664293b>.15 E<7d>118 372 Q<7d>
+108 384 Q .505<5768656e207573656420617320616e20456467652074726967676572
+656420696e74657266>108 408 R .505<6163652c20666f7220706572666f726d616e63
+6520726561736f6e732c20697420697320706f737369626c6520746f2061646420746865
+208c6c652064657363726970746f72>-.1 F 1.206
+<696e73696465207468652065706f6c6c20696e74657266>108 420 R 1.206
+<6163652028>-.1 F/F1 10/Times-Bold@0 SF<45504f4c4c5f43544c5f414444>3.706
+E F0 3.705<296f>3.705 G 1.205<6e63652062792073706563696679696e672028>
+-3.705 F F1<45504f4c4c494e>3.705 E F0<7c>A F1<45504f4c4c4f5554>A F0
+1.205<292e2054686973>3.705 F<616c6c6f>108 432 Q 1.831
+<777320796f7520746f2061>-.25 F -.2<766f>-.2 G 1.832
+<696420636f6e74696e756f75736c7920737769746368696e67206265747765656e>.2 F
+F1<45504f4c4c494e>4.332 E F0<616e64>4.332 E F1<45504f4c4c4f5554>4.332 E
+F0<63616c6c696e67>4.332 E F1<65706f6c6c5f63746c>4.332 E F0<283229>A
+<77697468>108 444 Q F1<45504f4c4c5f43544c5f4d4f44>2.5 E F0<2e>A/F2 10.95
+/Times-Bold@0 SF -.11<5155>72 472.8 S
+<455354494f4e5320414e4420414e535745525320286672>.11 E
+<6f6d206c696e75782d6b>-.197 E<6572>-.11 E<6e656c29>-.164 E F1<5131>108
+484.8 Q F0<576861742068617070656e7320696620796f752061646420746865207361
+6d6520666420746f20616e2065706f6c6c5f7365742074776963653f>23.22 E F1
+<4131>108 501.6 Q F0 -1.1<596f>23.78 G 4.107<7577>1.1 G 1.607
+<696c6c2070726f6261626c792067657420454558495354>-4.107 F 4.106<2e48>-.74
+G -.25<6f77>-4.106 G -2.15 -.25<65762065>.25 H 2.406 -.4<722c2069>.25 H
+4.106<7469>.4 G 4.106<7370>-4.106 G 1.606
+<6f737369626c652074686174207477>-4.106 F 4.106<6f74>-.1 G 1.606
+<687265616473206d617920616464207468652073616d65206664>-4.106 F<74776963
+652e20546869732069732061206861726d6c65737320636f6e646974696f6e2e>144
+513.6 Q F1<5132>108 530.4 Q F0<43616e207477>23.22 E<6f>-.1 E F1
+<65706f6c6c>2.5 E F0<736574732077>2.5 E
+<61697420666f72207468652073616d652066643f20496620736f2c206172652065>-.1
+E -.15<7665>-.25 G<6e7473207265706f7274656420746f20626f7468>.15 E F1
+<65706f6c6c>2.5 E F0<73657473206664733f>2.5 E F1<4132>108 547.2 Q F0 -1
+<5965>23.78 G<732e20486f>1 E<7765>-.25 E -.15<7665>-.25 G .8 -.4
+<722c2069>.15 H 2.5<7469>.4 G 2.5<736e>-2.5 G
+<6f74207265636f6d6d656e6465642e2059>-2.5 E<65732069742077>-1 E
+<6f756c64206265207265706f7274656420746f20626f74682e>-.1 E F1<5133>108
+564 Q F0<497320746865>23.22 E F1<65706f6c6c>2.5 E F0
+<666420697473656c6620706f6c6c2f65706f6c6c2f73656c65637461626c653f>2.5 E
+F1<4133>108 580.8 Q F0 -1<5965>23.78 G<732e>1 E F1<5134>108 597.6 Q F0
+<576861742068617070656e7320696620746865>23.22 E F1<65706f6c6c>2.5 E F0
+<66642069732070757420696e746f20697473206f>2.5 E<776e206664207365743f>
+-.25 E F1<4134>108 614.4 Q F0<49742077696c6c2066>23.78 E<61696c2e20486f>
+-.1 E<7765>-.25 E -.15<7665>-.25 G .8 -.4<722c2079>.15 H
+<6f752063616e2061646420616e>.4 E F1<65706f6c6c>2.5 E F0
+<666420696e7369646520616e6f746865722065706f6c6c206664207365742e>2.5 E F1
+<5135>108 631.2 Q F0<43616e20492073656e6420746865>23.22 E F1<65706f6c6c>
+2.5 E F0<6664206f>2.5 E -.15<7665>-.15 G 2.5<726175>.15 G
+<6e69782d736f636b>-2.5 E<657420746f20616e6f746865722070726f636573733f>
+-.1 E F1<4135>108 648 Q F0<4e6f2e>23.78 E F1<5136>108 664.8 Q F0 -.4
+<5769>23.22 G<6c6c2074686520636c6f7365206f6620616e2066642063617573652069
+7420746f2062652072656d6f>.4 E -.15<7665>-.15 G 2.5<6466>.15 G
+<726f6d20616c6c>-2.5 E F1<65706f6c6c>2.5 E F0
+<73657473206175746f6d61746963616c6c793f>2.5 E F1<4136>108 681.6 Q F0 -1
+<5965>23.78 G<732e>1 E F1<5137>108 698.4 Q F0 .258
+<4966206d6f7265207468616e206f6e652065>23.22 F -.15<7665>-.25 G .258
+<6e7420636f6d657320696e206265747765656e>.15 F F1<65706f6c6c5f77616974>
+2.758 E F0 .258<2832292063616c6c732c2061726520746865>B 2.758<7963>-.15 G
+.258<6f6d62696e6564206f72207265706f7274656420736570612d>-2.758 F
+<726174656c793f>144 710.4 Q 174.005<4c696e7578203233>72 768 R
+<4f63746f6265722032303032>2.5 E<32>195.395 E 0 Cg EP
+%%Page: 3 3
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 130.68<45504f4c4c283429204c696e7578>72 48 R
+<50726f6772616d6d657227>2.5 E 2.5<734d>-.55 G 130.68
+<616e75616c2045504f4c4c283429>-2.5 F/F1 10/Times-Bold@0 SF<4137>108 84 Q
+F0<546865>23.78 E 2.5<7977>-.15 G<696c6c20626520636f6d62696e65642e>-2.5
+E F1<5138>108 100.8 Q F0
+<446f657320616e206f7065726174696f6e206f6e20616e206664206166>23.22 E
+<666563742074686520616c726561647920636f6c6c65637465642062>-.25 E
+<7574206e6f7420796574207265706f727465642065>-.2 E -.15<7665>-.25 G
+<6e74733f>.15 E F1<4138>108 117.6 Q F0 -1.1<596f>23.78 G 2.814<7563>1.1
+G .314<616e20646f207477>-2.814 F 2.814<6f6f>-.1 G .314
+<7065726174696f6e73206f6e20616e2065>-2.814 F .314
+<78697374696e672066642e2052656d6f>-.15 F .614 -.15<76652077>-.15 H .313<
+6f756c64206265206d65616e696e676c65737320666f72207468697320636173652e204d
+6f64696679>.05 F<77696c6c2072652d726561642061>144 129.6 Q -.25<7661>-.2
+G<696c61626c6520492f4f2e>.25 E F1<5139>108 146.4 Q F0 .367<446f2049206e
+65656420746f20636f6e74696e756f75736c7920726561642f777269746520616e206664
+20756e74696c204541>23.22 F .368<4741494e207768656e207573696e6720746865>
+-.4 F F1<45504f4c4c4554>2.868 E F0 .368<8d616720282045646765>2.868 F
+-.35<5472>144 158.4 S<696767657265642062656861>.35 E<76696f75722029203f>
+-.2 E F1<4139>108 175.2 Q F0 .273<4e6f20796f7520646f6e27>23.78 F .273
+<742e205265636569>-.18 F .273<76696e6720616e2065>-.25 F -.15<7665>-.25 G
+.273<6e742066726f6d>.15 F F1<65706f6c6c5f77616974>2.773 E F0 .272<283229
+2073686f756c64207375676765737420746f20796f7520746861742073756368208c6c65
+20646573637269702d>B 1.029<746f7220697320726561647920666f72207468652072
+657175657374656420492f4f206f7065726174696f6e2e2059>144 187.2 R 1.029
+<6f75206861>-1.1 F 1.329 -.15<76652073>-.2 H 1.03<696d706c7920746f20636f
+6e736964657220697420726561647920756e74696c20796f752077696c6c>.15 F
+<7265636569>144 199.2 Q 1.038 -.15<76652074>-.25 H .738<6865206e65>.15 F
+.738<7874204541>-.15 F .738<4741494e2e205768656e20616e6420686f>-.4 F
+3.238<7779>-.25 G .737<6f752077696c6c207573652073756368208c6c6520646573
+63726970746f7220697320656e746972656c7920757020746f20796f752e>-3.238 F
+1.489<416c736f2c2074686520636f6e646974696f6e2074686174207468652072656164
+2f777269746520492f4f2073706163652069732065>144 211.2 R 1.49<786861757374
+65642063616e20626520646574656374656420627920636865636b696e6720746865>
+-.15 F 1.134<616d6f756e74206f66206461746120726561642f77726974652066726f
+6d2f746f2074686520746172>144 223.2 R 1.133
+<676574208c6c652064657363726970746f72>-.18 F 3.633<2e46>-.55 G 1.133
+<6f722065>-3.783 F 1.133<78616d706c652c20696620796f752063616c6c>-.15 F
+F1 -.18<7265>3.633 G<6164>.18 E F0 1.133<283229206279>B .686<61736b696e
+6720746f20726561642061206365727461696e20616d6f756e74206f6620646174612061
+6e64>144 235.2 R F1 -.18<7265>3.187 G<6164>.18 E F0 .687
+<2832292072657475726e732061206c6f>B .687
+<776572206e756d626572206f662062797465732c20796f752063616e206265>-.25 F
+.009<7375726520746f206861>144 247.2 R .309 -.15<7665206578>-.2 H .009<68
+61757374656420746865207265616420492f4f20737061636520666f722073756368208c
+6c652064657363726970746f72>.15 F 2.509<2e53>-.55 G .009
+<616d652069732076>-2.509 F .008
+<616c6964207768656e2077726974696e67207573696e67>-.25 F<746865>144 259.2
+Q F1<7772697465>2.5 E F0<2832292066756e6374696f6e2e>A/F2 10.95
+/Times-Bold@0 SF<504f535349424c452050495446>72 288 Q
+<414c4c5320414e442057>-.986 E -1.095<4159>-1.314 G 2.738<5354>1.095 G
+2.738<4f41>-2.935 G -.493<564f>-4.326 G<4944205448454d>.493 E F1 2.5
+<6f53>108 300 S<746172>-2.5 E -.1<7661>-.1 G<74696f6e202820456467652054>
+.1 E<726967676572>-.74 E<65642029>-.18 E F0 .15
+<49662074686572652069732061206c6172>108 316.8 R .15<676520616d6f756e7420
+6f6620492f4f2073706163652c20697420697320706f737369626c652074686174206279
+20747279696e6720746f20647261696e20697420746865206f74686572208c6c65732077
+696c6c206e6f74206765742070726f2d>-.18 F
+<6365737365642063617573696e67207374617276>108 328.8 Q
+<6174696f6e2e2054686973206973206e6f742073706563698c6320746f>-.25 E F1
+<65706f6c6c>2.5 E F0<2e>A .284<54686520736f6c7574696f6e20697320746f206d
+61696e7461696e2061207265616479206c69737420616e64206d61726b20746865208c6c
+652064657363726970746f7220617320726561647920696e20697473206173736f636961
+7465642064617461207374727563747572652c>108 350.4 R 2.407
+<7468657265627920616c6c6f>108 362.4 R 2.407<77696e6720746865206170706c69
+636174696f6e20746f2072656d656d626572207768696368208c6c6573206e6565642074
+6f2062652070726f6365737365642062>-.25 F 2.408
+<7574207374696c6c20726f756e6420726f62696e>-.2 F 1.62<616d6f6e6773742061
+6c6c20746865207265616479208c6c65732e205468697320616c736f20737570706f7274
+732069676e6f72696e672073756273657175656e742065>108 374.4 R -.15<7665>
+-.25 G 1.619<6e747320796f75207265636569>.15 F 1.919 -.15<76652066>-.25 H
+1.619<6f7220666427>.15 F 4.119<7374>-.55 G 1.619<68617420617265>-4.119 F
+<616c7265616479207265616479>108 386.4 Q<2e>-.65 E F1 2.5<6f49>108 420 S
+2.5<6675>-2.5 G<73696e6720616e2065>-2.5 E -.1<7665>-.15 G
+<6e742063616368652e2e2e>.1 E F0 .156<496620796f752075736520616e2065>108
+436.8 R -.15<7665>-.25 G .156
+<6e74206361636865206f722073746f726520616c6c2074686520666427>.15 F 2.657
+<7372>-.55 G .157<657475726e65642066726f6d>-2.657 F F1
+<65706f6c6c5f77616974>2.657 E F0 .157<2832292c207468656e206d616b>B 2.657
+<6573>-.1 G .157<75726520746f2070726f>-2.657 F .157<7669646520612077>
+-.15 F<6179>-.1 E 1.32<746f206d61726b2069747320636c6f737572652064796e61
+6d6963616c6c79202869652d20636175736564206279206120707265>108 448.8 R
+1.319<76696f75732065>-.25 F -.15<7665>-.25 G<6e7427>.15 E 3.819<7370>
+-.55 G 1.319<726f63657373696e67292e20537570706f736520796f75207265636569>
+-3.819 F 1.619 -.15<76652031>-.25 H<3030>.15 E -2.15 -.25<65762065>108
+460.8 T .398<6e74732066726f6d>.25 F F1<65706f6c6c5f77616974>2.898 E F0
+.399<2832292c20616e6420696e2065>B -.15<7665>-.25 G .399
+<6e746920233437206120636f6e646974696f6e206361757365732065>.15 F -.15
+<7665>-.25 G .399<6e742023313320746f20626520636c6f7365642e>.15 F .399
+<496620796f752072656d6f>5.399 F .699 -.15<76652074>-.15 H<6865>.15 E
+.355
+<73747275637475726520616e6420636c6f736528292074686520666420666f722065>
+108 472.8 R -.15<7665>-.25 G .354
+<6e74202331332c207468656e20796f75722065>.15 F -.15<7665>-.25 G .354<6e74
+206361636865206d69676874207374696c6c20736179207468657265206172652065>.15
+F -.15<7665>-.25 G .354<6e74732077>.15 F .354<616974696e6720666f72>-.1 F
+<746861742066642063617573696e6720636f6e667573696f6e2e>108 484.8 Q .365<
+4f6e6520736f6c7574696f6e20666f72207468697320697320746f2063616c6c2c206475
+72696e67207468652070726f63657373696e67206f662065>108 506.4 R -.15<7665>
+-.25 G .365<6e742034372c>.15 F F1<65706f6c6c5f63746c>2.865 E F0<28>A F1
+<45504f4c4c5f43544c5f44454c>A F0 2.865<2974>C 2.865<6f64>-2.865 G
+<656c657465>-2.865 E .153<666420313320616e6420636c6f736528292c207468656e
+206d61726b20697473206173736f63696174656420646174612073747275637475726520
+61732072656d6f>108 518.4 R -.15<7665>-.15 G 2.652<6461>.15 G .152<6e6420
+6c696e6b20697420746f206120636c65616e7570206c6973742e20496620796f75208c6e
+64>-2.652 F .2<616e6f746865722065>108 530.4 R -.15<7665>-.25 G .2<6e7420
+666f7220666420313320696e20796f75722062617463682070726f63657373696e672c20
+796f752077696c6c20646973636f>.15 F -.15<7665>-.15 G 2.701<7274>.15 G
+.201<686520666420686164206265656e20707265>-2.701 F .201
+<76696f75736c792072656d6f>-.25 F -.15<7665>-.15 G 2.701<6461>.15 G<6e64>
+-2.701 E<74686572652077696c6c206265206e6f20636f6e667573696f6e2e>108
+542.4 Q F2<434f4e464f524d494e472054>72 576 Q<4f>-.197 E F1<65706f6c6c>
+108 588 Q F0 .726<2834292069732061206e65>B 3.226<7741>-.25 G .725
+<504920696e74726f647563656420696e204c696e7578206b>-3.226 F<65726e656c>
+-.1 E F1<322e352e3434>3.225 E F0 5.725<2e49>C .725<747320696e74657266>
+-5.725 F .725
+<6163652073686f756c64206265208c6e616c697a656420696e204c696e7578206b>-.1
+F<65726e656c>-.1 E F1<322e352e3636>108 600 Q F0<2e>A F2
+<53454520414c534f>72 616.8 Q F1<65706f6c6c5f6372>108 628.8 Q<65617465>
+-.18 E F0<283229>A F1<65706f6c6c5f63746c>2.5 E F0<283229>A F1
+<65706f6c6c5f77616974>2.5 E F0<283229>A 174.005<4c696e7578203233>72 768
+R<4f63746f6265722032303032>2.5 E<33>195.395 E 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll.txt b/testcases/kernel/syscalls/epoll2/man/epoll.txt
new file mode 100644
index 000000000..5762037ce
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll.txt
@@ -0,0 +1,225 @@
+EPOLL(4) Linux Programmer's Manual EPOLL(4)
+
+
+
+NAME
+ epoll - I/O event notification facility
+
+SYNOPSIS
+ #include <sys/epoll.h>
+
+DESCRIPTION
+ epoll is a variant of poll(2) that can be used either as Edge or Level
+ Triggered interface and scales well to large numbers of watched fds.
+ Three system calls are provided to set up and control an epoll set:
+ epoll_create(2), epoll_ctl(2), epoll_wait(2).
+
+ An epoll set is connected to a file descriptor created by epoll_cre-
+ ate(2). Interest for certain file descriptors is then registered via
+ epoll_ctl(2). Finally, the actual wait is started by epoll_wait(2).
+
+
+NOTES
+ The epoll event distribution interface is able to behave both as Edge
+ Triggered ( ET ) and Level Triggered ( LT ). The difference between ET
+ and LT event distribution mechanism can be described as follows. Sup-
+ pose that this scenario happens :
+
+ 1 The file descriptor that represent the read side of a pipe ( RFD
+ ) is added inside the epoll device.
+
+ 2 Pipe writer writes 2Kb of data on the write side of the pipe.
+
+ 3 A call to epoll_wait(2) is done that will return RFD as ready
+ file descriptor.
+
+ 4 The pipe reader reads 1Kb of data from RFD.
+
+ 5 A call to epoll_wait(2) is done.
+
+
+ If the RFD file descriptor has been added to the epoll interface using
+ the EPOLLET flag, the call to epoll_wait(2) done in step 5 will proba-
+ bly hang because of the available data still present in the file input
+ buffers and the remote peer might be expecting a response based on the
+ data it already sent. The reason for this is that Edge Triggered event
+ distribution delivers events only when events happens on the monitored
+ file. So, in step 5 the caller might end up waiting for some data that
+ is already present inside the input buffer. In the above example, an
+ event on RFD will be generated because of the write done in 2 , and the
+ event is consumed in 3. Since the read operation done in 4 does not
+ consume the whole buffer data, the call to epoll_wait(2) done in step 5
+ might lock indefinitely. The epoll interface, when used with the EPOL-
+ LET flag ( Edge Triggered ) should use non-blocking file descriptors to
+ avoid having a blocking read or write starve the task that is handling
+ multiple file descriptors. The suggested way to use epoll as an Edge
+ Triggered ( EPOLLET ) interface is below, and possible pitfalls to
+ avoid follow.
+
+ i with non-blocking file descriptors
+
+ ii by going to wait for an event only after read(2) or write(2)
+ return EAGAIN
+
+ On the contrary, when used as a Level Triggered interface, epoll is by
+ all means a faster poll(2), and can be used wherever the latter is used
+ since it shares the same semantics. Since even with the Edge Triggered
+ epoll multiple events can be generated up on receival of multiple
+ chunks of data, the caller has the option to specify the EPOLLONESHOT
+ flag, to tell epoll to disable the associated file descriptor after the
+ receival of an event with epoll_wait(2). When the EPOLLONESHOT flag is
+ specified, it is caller responsibility to rearm the file descriptor
+ using epoll_ctl(2) with EPOLL_CTL_MOD.
+
+
+EXAMPLE FOR SUGGESTED USAGE
+ While the usage of epoll when employed like a Level Triggered interface
+ does have the same semantics of poll(2), an Edge Triggered usage
+ requires more clarifiction to avoid stalls in the application event
+ loop. In this example, listener is a non-blocking socket on which lis-
+ ten(2) has been called. The function do_use_fd() uses the new ready
+ file descriptor until EAGAIN is returned by either read(2) or write(2).
+ An event driven state machine application should, after having received
+ EAGAIN, record its current state so that at the next call to
+ do_use_fd() it will continue to read(2) or write(2) from where it
+ stopped before.
+
+ struct epoll_event ev, *events;
+
+ for(;;) {
+ nfds = epoll_wait(kdpfd, events, maxevents, -1);
+
+ for(n = 0; n < nfds; ++n) {
+ if(events[n].data.fd == listener) {
+ client = accept(listener, (struct sockaddr *) &local,
+ &addrlen);
+ if(client < 0){
+ perror("accept");
+ continue;
+ }
+ setnonblocking(client);
+ ev.events = EPOLLIN | EPOLLET;
+ ev.data.fd = client;
+ if (epoll_ctl(kdpfd, EPOLL_CTL_ADD, client, &ev) < 0) {
+ fprintf(stderr, "epoll set insertion error: fd=%d0,
+ client);
+ return -1;
+ }
+ }
+ else
+ do_use_fd(events[n].data.fd);
+ }
+ }
+
+ When used as an Edge triggered interface, for performance reasons, it
+ is possible to add the file descriptor inside the epoll interface (
+ EPOLL_CTL_ADD ) once by specifying ( EPOLLIN|EPOLLOUT ). This allows
+ you to avoid continuously switching between EPOLLIN and EPOLLOUT call-
+ ing epoll_ctl(2) with EPOLL_CTL_MOD.
+
+
+QUESTIONS AND ANSWERS (from linux-kernel)
+ Q1 What happens if you add the same fd to an epoll_set twice?
+
+ A1 You will probably get EEXIST. However, it is possible that two
+ threads may add the same fd twice. This is a harmless condition.
+
+ Q2 Can two epoll sets wait for the same fd? If so, are events
+ reported to both epoll sets fds?
+
+ A2 Yes. However, it is not recommended. Yes it would be reported to
+ both.
+
+ Q3 Is the epoll fd itself poll/epoll/selectable?
+
+ A3 Yes.
+
+ Q4 What happens if the epoll fd is put into its own fd set?
+
+ A4 It will fail. However, you can add an epoll fd inside another
+ epoll fd set.
+
+ Q5 Can I send the epoll fd over a unix-socket to another process?
+
+ A5 No.
+
+ Q6 Will the close of an fd cause it to be removed from all epoll
+ sets automatically?
+
+ A6 Yes.
+
+ Q7 If more than one event comes in between epoll_wait(2) calls, are
+ they combined or reported separately?
+
+ A7 They will be combined.
+
+ Q8 Does an operation on an fd affect the already collected but not
+ yet reported events?
+
+ A8 You can do two operations on an existing fd. Remove would be
+ meaningless for this case. Modify will re-read available I/O.
+
+ Q9 Do I need to continuously read/write an fd until EAGAIN when
+ using the EPOLLET flag ( Edge Triggered behaviour ) ?
+
+ A9 No you don't. Receiving an event from epoll_wait(2) should sug-
+ gest to you that such file descriptor is ready for the requested
+ I/O operation. You have simply to consider it ready until you
+ will receive the next EAGAIN. When and how you will use such
+ file descriptor is entirely up to you. Also, the condition that
+ the read/write I/O space is exhausted can be detected by check-
+ ing the amount of data read/write from/to the target file
+ descriptor. For example, if you call read(2) by asking to read a
+ certain amount of data and read(2) returns a lower number of
+ bytes, you can be sure to have exhausted the read I/O space for
+ such file descriptor. Same is valid when writing using the
+ write(2) function.
+
+
+POSSIBLE PITFALLS AND WAYS TO AVOID THEM
+ o Starvation ( Edge Triggered )
+
+ If there is a large amount of I/O space, it is possible that by trying
+ to drain it the other files will not get processed causing starvation.
+ This is not specific to epoll.
+
+
+ The solution is to maintain a ready list and mark the file descriptor
+ as ready in its associated data structure, thereby allowing the appli-
+ cation to remember which files need to be processed but still round
+ robin amongst all the ready files. This also supports ignoring subse-
+ quent events you receive for fd's that are already ready.
+
+
+
+ o If using an event cache...
+
+ If you use an event cache or store all the fd's returned from
+ epoll_wait(2), then make sure to provide a way to mark its closure
+ dynamically (ie- caused by a previous event's processing). Suppose you
+ receive 100 events from epoll_wait(2), and in eventi #47 a condition
+ causes event #13 to be closed. If you remove the structure and close()
+ the fd for event #13, then your event cache might still say there are
+ events waiting for that fd causing confusion.
+
+
+ One solution for this is to call, during the processing of event 47,
+ epoll_ctl(EPOLL_CTL_DEL) to delete fd 13 and close(), then mark its
+ associated data structure as removed and link it to a cleanup list. If
+ you find another event for fd 13 in your batch processing, you will
+ discover the fd had been previously removed and there will be no confu-
+ sion.
+
+
+
+CONFORMING TO
+ epoll(4) is a new API introduced in Linux kernel 2.5.44. Its interface
+ should be finalized in Linux kernel 2.5.66.
+
+SEE ALSO
+ epoll_create(2) epoll_ctl(2) epoll_wait(2)
+
+
+
+
+Linux 23 October 2002 EPOLL(4)
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_create.2 b/testcases/kernel/syscalls/epoll2/man/epoll_create.2
new file mode 100644
index 000000000..5adf957b3
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_create.2
@@ -0,0 +1,71 @@
+.\"
+.\" epoll by Davide Libenzi ( efficient event notification retrieval )
+.\" Copyright (C) 2003 Davide Libenzi
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program; if not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" Davide Libenzi <davidel@xmailserver.org>
+.\"
+.\"
+.TH EPOLL_CREATE 2 "23 October 2002" Linux "Linux Programmer's Manual"
+.SH NAME
+epoll_create \- open an
+.B epoll
+file descriptor
+.SH SYNOPSIS
+.B #include <sys/epoll.h>
+.sp
+.BR "int epoll_create(int " size )
+.SH DESCRIPTION
+Open an
+.B epoll
+file descriptor by requesting the kernel allocate
+an event backing store dimensioned for
+.I size
+descriptors. The
+.I size
+is not the maximum size of the backing store but
+just a hint to the kernel about how to dimension internal structures.
+The returned file descriptor will be used for all the subsequent calls to the
+.B epoll
+interface. The file descriptor returned by
+.BR epoll_create (2)
+must be closed by using
+.BR close (2).
+.SH "RETURN VALUE"
+When successful,
+.BR epoll_create (2)
+returns a positive integer identifying the descriptor.
+When an error occurs,$
+.BR epoll_create (2)
+returns -1 and
+.I errno
+is set appropriately.
+.SH ERRORS
+.TP
+.B ENOMEM
+There was insufficient memory to create the kernel object.
+.SH CONFORMING TO
+.BR epoll_create (2)
+is a new API introduced in Linux kernel
+.BR 2.5.44 .
+The interface should be finalized by Linux kernel
+.BR 2.5.66 .
+.SH "SEE ALSO"
+.BR epoll (4)
+.BR epoll_ctl (2)
+.BR epoll_wait (2)
+.BR close (2)
+
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_create.ps b/testcases/kernel/syscalls/epoll2/man/epoll_create.ps
new file mode 100644
index 000000000..f2ef7fbea
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_create.ps
@@ -0,0 +1,270 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Mon Feb 16 19:03:38 2004
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 1
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
+/Times-Roman@0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF<45504f4c4c5f43524541>72 48 Q 87.9
+<5445283229204c696e7578>-1.11 F<50726f6772616d6d657227>2.5 E 2.5<734d>
+-.55 G 87.9<616e75616c2045504f4c4c5f43524541>-2.5 F<5445283229>-1.11 E
+/F1 10.95/Times-Bold@0 SF -.219<4e41>72 84 S<4d45>.219 E F0
+<65706f6c6c5f63726561746520ad206f70656e20616e>108 96 Q/F2 10
+/Times-Bold@0 SF<65706f6c6c>2.5 E F0<8c6c652064657363726970746f72>2.5 E
+F1<53594e4f50534953>72 112.8 Q F2
+<23696e636c756465203c7379732f65706f6c6c2e683e>108 124.8 Q
+<696e742065706f6c6c5f6372>108 148.8 Q<6561746528696e74>-.18 E F0
+<73697a65>2.5 E F2<29>A F1<4445534352495054494f4e>72 165.6 Q F0 .476
+<4f70656e20616e>108 177.6 R F2<65706f6c6c>2.976 E F0 .476
+<8c6c652064657363726970746f722062792072657175657374696e6720746865206b>
+2.976 F .476<65726e656c20616c6c6f6361746520616e2065>-.1 F -.15<7665>-.25
+G .475<6e74206261636b696e672073746f72652064696d656e73696f6e656420666f72>
+.15 F/F3 10/Times-Italic@0 SF<73697a65>3.315 E F0 .177
+<64657363726970746f72732e20546865>108 189.6 R F3<73697a65>3.017 E F0
+.177<6973206e6f7420746865206d6178696d756d2073697a65206f6620746865206261
+636b696e672073746f72652062>2.857 F .178
+<7574206a75737420612068696e7420746f20746865206b>-.2 F .178
+<65726e656c2061626f757420686f>-.1 F 2.678<7774>-.25 G<6f>-2.678 E .893
+<64696d656e73696f6e20696e7465726e616c20737472756374757265732e>108 201.6
+R .892<5468652072657475726e6564208c6c652064657363726970746f722077696c6c
+206265207573656420666f7220616c6c207468652073756273657175656e742063616c6c
+7320746f20746865>5.893 F F2<65706f6c6c>108 213.6 Q F0<696e74657266>2.5 E
+<6163652e20546865208c6c652064657363726970746f722072657475726e6564206279>
+-.1 E F2<65706f6c6c5f6372>2.5 E<65617465>-.18 E F0
+<283229206d75737420626520636c6f736564206279207573696e67>A F2<636c6f7365>
+2.5 E F0<2832292e>A F1<52455455524e2056>72 230.4 Q<414c5545>-1.478 E F0
+2.249<5768656e207375636365737366756c2c>108 242.4 R F2<65706f6c6c5f6372>
+4.749 E<65617465>-.18 E F0 2.249
+<2832292072657475726e73206120706f73697469>B 2.549 -.15<76652069>-.25 H
+<6e7465>.15 E 2.249
+<676572206964656e74696679696e67207468652064657363726970746f72>-.15 F
+7.249<2e57>-.55 G 2.25<68656e20616e206572726f72>-7.249 F<6f63637572732c>
+108 254.4 Q F2<65706f6c6c5f6372>2.5 E<65617465>-.18 E F0
+<2832292072657475726e73202d3120616e64>A F3<6572726e6f>2.69 E F0
+<69732073657420617070726f7072696174656c79>2.68 E<2e>-.65 E F1<455252>72
+271.2 Q<4f5253>-.329 E F2<454e4f4d454d>108 283.2 Q F0<54686572652077>144
+295.2 Q<617320696e737566>-.1 E
+<8c6369656e74206d656d6f727920746f2063726561746520746865206b>-.25 E
+<65726e656c206f626a6563742e>-.1 E F1<434f4e464f524d494e472054>72 312 Q
+<4f>-.197 E F2<65706f6c6c5f6372>108 324 Q<65617465>-.18 E F0 .065
+<2832292069732061206e65>B 2.565<7741>-.25 G .065
+<504920696e74726f647563656420696e204c696e7578206b>-2.565 F<65726e656c>
+-.1 E F2<322e352e3434>2.565 E F0 5.065<2e54>C .065<686520696e74657266>
+-5.065 F .065
+<6163652073686f756c64206265208c6e616c697a6564206279204c696e7578>-.1 F
+-.1<6b65>108 336 S<726e656c>.1 E F2<322e352e3636>2.5 E F0<2e>A F1
+<53454520414c534f>72 352.8 Q F2<65706f6c6c>108 364.8 Q F0<283429>A F2
+<65706f6c6c5f63746c>2.5 E F0<283229>A F2<65706f6c6c5f77616974>2.5 E F0
+<283229>A F2<636c6f7365>2.5 E F0<283229>A 174.005<4c696e7578203233>72
+768 R<4f63746f6265722032303032>2.5 E<31>195.395 E 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_create.txt b/testcases/kernel/syscalls/epoll2/man/epoll_create.txt
new file mode 100644
index 000000000..245408c63
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_create.txt
@@ -0,0 +1,40 @@
+EPOLL_CREATE(2) Linux Programmer's Manual EPOLL_CREATE(2)
+
+
+
+NAME
+ epoll_create - open an epoll file descriptor
+
+SYNOPSIS
+ #include <sys/epoll.h>
+
+ int epoll_create(int size)
+
+DESCRIPTION
+ Open an epoll file descriptor by requesting the kernel allocate an
+ event backing store dimensioned for size descriptors. The size is not
+ the maximum size of the backing store but just a hint to the kernel
+ about how to dimension internal structures. The returned file descrip-
+ tor will be used for all the subsequent calls to the epoll interface.
+ The file descriptor returned by epoll_create(2) must be closed by using
+ close(2).
+
+RETURN VALUE
+ When successful, epoll_create(2) returns a positive integer identifying
+ the descriptor. When an error occurs, epoll_create(2) returns -1 and
+ errno is set appropriately.
+
+ERRORS
+ ENOMEM There was insufficient memory to create the kernel object.
+
+CONFORMING TO
+ epoll_create(2) is a new API introduced in Linux kernel 2.5.44. The
+ interface should be finalized by Linux kernel 2.5.66.
+
+SEE ALSO
+ epoll(4) epoll_ctl(2) epoll_wait(2) close(2)
+
+
+
+
+Linux 23 October 2002 EPOLL_CREATE(2)
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_ctl.2 b/testcases/kernel/syscalls/epoll2/man/epoll_ctl.2
new file mode 100644
index 000000000..2f7a1c714
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_ctl.2
@@ -0,0 +1,192 @@
+.\"
+.\" epoll by Davide Libenzi ( efficient event notification retrieval )
+.\" Copyright (C) 2003 Davide Libenzi
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program; if not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" Davide Libenzi <davidel@xmailserver.org>
+.\"
+.\"
+.TH EPOLL_CTL 2 "23 October 2002" Linux "Linux Programmer's Manual"
+.SH NAME
+epoll_ctl \- control interface for an
+.B epoll
+descriptor
+.SH SYNOPSIS
+.B #include <sys/epoll.h>
+.sp
+.BR "int epoll_ctl(int " epfd ", int " op ", int " fd ", struct epoll_event *" event )
+.SH DESCRIPTION
+Control an
+.B epoll
+descriptor,
+.IR epfd ,
+by requesting the operation
+.IR op
+be performed on the target file descriptor,
+.IR fd .
+The
+.IR event
+describes the object linked to the file descriptor
+.IR fd .
+The
+.B struct epoll_event
+is defined as :
+.sp
+.nf
+
+ typedef union epoll_data {
+ void *ptr;
+ int fd;
+ __uint32_t u32;
+ __uint64_t u64;
+ } epoll_data_t;
+
+ struct epoll_event {
+ __uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+ };
+
+.fi
+
+The
+.I events
+member is a bit set composed using the following available event
+types :
+.TP
+.B EPOLLIN
+The associated file is available for
+.BR read (2)
+operations.
+.TP
+.B EPOLLOUT
+The associated file is available for
+.BR write (2)
+operations.
+.TP
+.B EPOLLPRI
+There is urgent data available for
+.BR read (2)
+operations.
+.TP
+.B EPOLLERR
+Error condition happened on the associated file descriptor.
+.TP
+.B EPOLLHUP
+Hang up happened on the associated file descriptor.
+.TP
+.B EPOLLET
+Sets the Edge Triggered behaviour for the associated file descriptor.
+The default behaviour for
+.B epoll
+is Level Triggered. See
+.BR epoll (4)
+for more detailed informations about Edge and Level Triggered event
+distribution architectures.
+.TP
+.B EPOLLONESHOT
+Sets the One-Shot behaviour for the associated file descriptor. It means
+that after an event is pulled out with
+.BR epoll_wait (2)
+the associated file descriptor is internally disabled and no other events
+will be reported by the
+.B epoll
+interface. The user must call
+.BR epoll_ctl (2)
+with
+.B EPOLL_CTL_MOD
+to re-enable the file descriptor with a new event mask.
+.PP
+.sp
+The
+.B epoll
+interface supports all file descriptors that support
+.BR poll (2).
+Valid values for the
+.IR op
+parameter are :
+.SR
+.TP
+.B EPOLL_CTL_ADD
+Add the target file descriptor
+.I fd
+to the
+.B epoll
+descriptor
+.I epfd
+and associate the event
+.I event
+with the internal file linked to
+.IR fd .
+.TP
+.B EPOLL_CTL_MOD
+Change the event
+.I event
+associated to the target file descriptor
+.IR fd .
+.TP
+.B EPOLL_CTL_DEL
+Remove the target file descriptor
+.I fd
+from the
+.B epoll
+file descriptor,
+.IR epfd .
+.SE
+.SH "RETURN VALUE"
+When successful,$
+.BR epoll_ctl (2)
+returns zero. When an error occurs,$
+.BR epoll_ctl (2)
+returns \-1 and
+.I errno
+is set appropriately.
+.SH ERRORS
+.TP
+.B EBADF
+The
+.I epfd
+file descriptor is not a valid file descriptor.
+.TP
+.B EPERM
+The target file
+.I fd
+is not supported by
+.BR epoll .
+.TP
+.B EINVAL
+The supplied file descriptor,
+.IR epfd ,
+is not an
+.B epoll
+file descriptor, or the requested operation
+.I op
+is not supported by this interface.
+.TP
+.B ENOMEM
+There was insufficient memory to handle the requested
+.I op
+control operation.
+.SH CONFORMING TO
+.BR epoll_ctl (2)
+is a new API introduced in Linux kernel
+.BR 2.5.44 .$
+The interface should be finalized by Linux kernel$
+.BR 2.5.66 .
+.SH "SEE ALSO"
+.BR epoll (4)
+.BR epoll_create (2)
+.BR epoll_wait (2)
+
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_ctl.ps b/testcases/kernel/syscalls/epoll2/man/epoll_ctl.ps
new file mode 100644
index 000000000..44002c7d1
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_ctl.ps
@@ -0,0 +1,362 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Mon Feb 16 19:03:38 2004
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 2
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
+/Times-Roman@0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 106.79<45504f4c4c5f43544c283229204c696e7578>72
+48 R<50726f6772616d6d657227>2.5 E 2.5<734d>-.55 G 106.79
+<616e75616c2045504f4c4c5f43544c283229>-2.5 F/F1 10.95/Times-Bold@0 SF
+-.219<4e41>72 84 S<4d45>.219 E F0
+<65706f6c6c5f63746c20ad20636f6e74726f6c20696e74657266>108 96 Q
+<61636520666f7220616e>-.1 E/F2 10/Times-Bold@0 SF<65706f6c6c>2.5 E F0
+<64657363726970746f72>2.5 E F1<53594e4f50534953>72 112.8 Q F2
+<23696e636c756465203c7379732f65706f6c6c2e683e>108 124.8 Q
+<696e742065706f6c6c5f63746c28696e74>108 148.8 Q F0<65706664>2.5 E F2 2.5
+<2c69>C<6e74>-2.5 E F0<6f70>2.5 E F2 2.5<2c69>C<6e74>-2.5 E F0<6664>2.5
+E F2 2.5<2c73>C<74727563742065706f6c6c5f65>-2.5 E -.1<7665>-.15 G
+<6e74202a>.1 E F0 -2.15 -.25<65762065>D<6e74>.25 E F2<29>A F1
+<4445534352495054494f4e>72 165.6 Q F0 .403<436f6e74726f6c20616e>108
+177.6 R F2<65706f6c6c>2.903 E F0<64657363726970746f72>2.903 E<2c>-.4 E
+/F3 10/Times-Italic@0 SF<65706664>2.903 E F0 2.903<2c62>.77 G 2.903
+<7972>-2.903 G .403<657175657374696e6720746865206f7065726174696f6e>
+-2.903 F F3<6f70>2.902 E F0 .402
+<626520706572666f726d6564206f6e2074686520746172>2.902 F .402
+<676574208c6c652064657363726970746f72>-.18 F<2c>-.4 E F3<6664>108 189.6
+Q F0 5<2e54>.77 G<6865>-5 E F3 -.15<6576>2.5 G<656e74>.15 E F0
+<64657363726962657320746865206f626a656374206c696e6b>2.5 E
+<656420746f20746865208c6c652064657363726970746f72>-.1 E F3<6664>2.5 E F0
+5<2e54>.77 G<6865>-5 E F2<7374727563742065706f6c6c5f65>2.5 E -.1<7665>
+-.15 G<6e74>.1 E F0<69732064658c6e6564206173203a>2.5 E
+<7479706564656620756e696f6e2065706f6c6c5f64617461207b>144 225.6 Q -.2
+<766f>180 237.6 S<6964202a7074723b>.2 E<696e742066643b>180 249.6 Q
+<5f5f75696e7433325f74207533323b>180 261.6 Q
+<5f5f75696e7436345f74207536343b>180 273.6 Q 2.5<7d65>144 285.6 S
+<706f6c6c5f646174615f743b>-2.5 E<7374727563742065706f6c6c5f65>144 309.6
+Q -.15<7665>-.25 G<6e74207b>.15 E<5f5f75696e7433325f742065>180 321.6 Q
+-.15<7665>-.25 G 31.73<6e74733b202f2a>.15 F<45706f6c6c2065>2.5 E -.15
+<7665>-.25 G<6e7473202a2f>.15 E<65706f6c6c5f646174615f7420646174613b>180
+333.6 Q<2f2a205573657220646174612076>.62 E<61726961626c65202a2f>-.25 E
+<7d3b>144 345.6 Q<546865>108 381.6 Q F3 -.15<6576>2.5 G<656e7473>.15 E
+F0<6d656d6265722069732061206269742073657420636f6d706f736564207573696e67
+2074686520666f6c6c6f>2.77 E<77696e672061>-.25 E -.25<7661>-.2 G
+<696c61626c652065>.25 E -.15<7665>-.25 G<6e74207479706573203a>.15 E F2
+<45504f4c4c494e>108 398.4 Q F0
+<546865206173736f636961746564208c6c652069732061>144 410.4 Q -.25<7661>
+-.2 G<696c61626c6520666f72>.25 E F2 -.18<7265>2.5 G<6164>.18 E F0
+<283229206f7065726174696f6e732e>A F2<45504f4c4c4f5554>108 427.2 Q F0
+<546865206173736f636961746564208c6c652069732061>144 439.2 Q -.25<7661>
+-.2 G<696c61626c6520666f72>.25 E F2<7772697465>2.5 E F0
+<283229206f7065726174696f6e732e>A F2<45504f4c4c505249>108 456 Q F0
+<5468657265206973207572>144 468 Q<67656e7420646174612061>-.18 E -.25
+<7661>-.2 G<696c61626c6520666f72>.25 E F2 -.18<7265>2.5 G<6164>.18 E F0
+<283229206f7065726174696f6e732e>A F2<45504f4c4c455252>108 484.8 Q F0<45
+72726f7220636f6e646974696f6e2068617070656e6564206f6e20746865206173736f63
+6961746564208c6c652064657363726970746f72>144 496.8 Q<2e>-.55 E F2
+<45504f4c4c485550>108 513.6 Q F0<48616e672075702068617070656e6564206f6e
+20746865206173736f636961746564208c6c652064657363726970746f72>144 525.6 Q
+<2e>-.55 E F2<45504f4c4c4554>108 542.4 Q F0 1.409
+<536574732074686520456467652054>144 554.4 R 1.409
+<72696767657265642062656861>-.35 F 1.409<76696f757220666f72207468652061
+73736f636961746564208c6c652064657363726970746f72>-.2 F 6.409<2e54>-.55 G
+1.41<686520646566>-6.409 F 1.41<61756c742062656861>-.1 F 1.41
+<76696f757220666f72>-.2 F F2<65706f6c6c>144 566.4 Q F0 .6<6973204c65>3.1
+F -.15<7665>-.25 G 3.1<6c54>.15 G .6<72696767657265642e20536565>-3.45 F
+F2<65706f6c6c>3.1 E F0 .6<28342920666f72206d6f72652064657461696c65642069
+6e666f726d6174696f6e732061626f7574204564676520616e64204c65>B -.15<7665>
+-.25 G 3.1<6c54>.15 G<7269672d>-3.45 E<67657265642065>144 578.4 Q -.15
+<7665>-.25 G<6e742064697374726962>.15 E
+<7574696f6e20617263686974656374757265732e>-.2 E F2
+<45504f4c4c4f4e4553484f>108 595.2 Q<54>-.4 E F0 .121
+<5365747320746865204f6e652d53686f742062656861>144 607.2 R .121<76696f75
+7220666f7220746865206173736f636961746564208c6c652064657363726970746f72>
+-.2 F 2.621<2e49>-.55 G 2.621<746d>-2.621 G .121
+<65616e73207468617420616674657220616e2065>-2.621 F -.15<7665>-.25 G .122
+<6e742069732070756c6c6564>.15 F .341<6f75742077697468>144 619.2 R F2
+<65706f6c6c5f77616974>2.841 E F0 .341<28322920746865206173736f6369617465
+64208c6c652064657363726970746f7220697320696e7465726e616c6c79206469736162
+6c656420616e64206e6f206f746865722065>B -.15<7665>-.25 G .34
+<6e74732077696c6c>.15 F .942<6265207265706f7274656420627920746865>144
+631.2 R F2<65706f6c6c>3.442 E F0<696e74657266>3.442 E .942
+<6163652e205468652075736572206d7573742063616c6c>-.1 F F2
+<65706f6c6c5f63746c>3.443 E F0 .943<2832292077697468>B F2
+<45504f4c4c5f43544c5f4d4f44>3.443 E F0<746f>3.443 E<72652d656e61626c6520
+746865208c6c652064657363726970746f7220776974682061206e65>144 643.2 Q 2.5
+<7765>-.25 G -.15<7665>-2.75 G<6e74206d61736b2e>.15 E<546865>108 672 Q
+F2<65706f6c6c>2.5 E F0<696e74657266>2.5 E<61636520737570706f72747320616c
+6c208c6c652064657363726970746f7273207468617420737570706f7274>-.1 E F2
+<706f6c6c>2.5 E F0 2.5<2832292e2056>B<616c69642076>-1.11 E
+<616c75657320666f7220746865>-.25 E F3<6f70>2.5 E F0
+<706172616d6574657220617265203a>2.5 E F2<45504f4c4c5f43544c5f414444>108
+688.8 Q F0 .224<4164642074686520746172>144 700.8 R .224
+<676574208c6c652064657363726970746f72>-.18 F F3<6664>4.694 E F0 .224
+<746f20746865>3.494 F F2<65706f6c6c>2.724 E F0<64657363726970746f72>
+2.724 E F3<65706664>2.913 E F0 .223
+<616e64206173736f6369617465207468652065>3.493 F -.15<7665>-.25 G<6e74>
+.15 E F3 -.15<6576>2.723 G<656e74>.15 E F0 .223<7769746820746865>3.403 F
+<696e7465726e616c208c6c65206c696e6b>144 712.8 Q<656420746f>-.1 E F3
+<6664>2.5 E F0<2e>.77 E 174.005<4c696e7578203233>72 768 R
+<4f63746f6265722032303032>2.5 E<31>195.395 E 0 Cg EP
+%%Page: 2 2
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF 106.79<45504f4c4c5f43544c283229204c696e7578>72
+48 R<50726f6772616d6d657227>2.5 E 2.5<734d>-.55 G 106.79
+<616e75616c2045504f4c4c5f43544c283229>-2.5 F/F1 10/Times-Bold@0 SF
+<45504f4c4c5f43544c5f4d4f44>108 84 Q F0<4368616e6765207468652065>144 96
+Q -.15<7665>-.25 G<6e74>.15 E/F2 10/Times-Italic@0 SF -.15<6576>2.5 G
+<656e74>.15 E F0<6173736f63696174656420746f2074686520746172>3.18 E
+<676574208c6c652064657363726970746f72>-.18 E F2<6664>2.5 E F0<2e>.77 E
+F1<45504f4c4c5f43544c5f44454c>108 112.8 Q F0<52656d6f>144 124.8 Q .3
+-.15<76652074>-.15 H<686520746172>.15 E
+<676574208c6c652064657363726970746f72>-.18 E F2<6664>4.47 E F0
+<66726f6d20746865>3.27 E F1<65706f6c6c>2.5 E F0
+<8c6c652064657363726970746f72>2.5 E<2c>-.4 E F2<65706664>2.5 E F0<2e>.77
+E/F3 10.95/Times-Bold@0 SF<52455455524e2056>72 141.6 Q<414c5545>-1.478 E
+F0 .628<5768656e207375636365737366756c2c>108 153.6 R F1
+<65706f6c6c5f63746c>3.128 E F0 .628<2832292072657475726e73207a65726f2e20
+5768656e20616e206572726f72206f63637572732c>B F1<65706f6c6c5f63746c>3.129
+E F0 .629<2832292072657475726e7320ad3120616e64>B F2<6572726e6f>3.319 E
+F0 .629<697320736574>3.309 F<617070726f7072696174656c79>108 165.6 Q<2e>
+-.65 E F3<455252>72 182.4 Q<4f5253>-.329 E F1<4542>108 194.4 Q<414446>
+-.3 E F0<546865>144 206.4 Q F2<65706664>2.69 E F0
+<8c6c652064657363726970746f72206973206e6f7420612076>3.27 E
+<616c6964208c6c652064657363726970746f72>-.25 E<2e>-.55 E F1<455045524d>
+108 223.2 Q F0<54686520746172>144 235.2 Q<676574208c6c65>-.18 E F2<6664>
+4.47 E F0<6973206e6f7420737570706f72746564206279>3.27 E F1<65706f6c6c>
+2.5 E F0<2e>A F1<45494e56>108 252 Q<414c>-1.35 E F0 .822
+<54686520737570706c696564208c6c652064657363726970746f72>144 264 R<2c>-.4
+E F2<65706664>3.322 E F0 3.322<2c69>.77 G 3.322<736e>-3.322 G .822
+<6f7420616e>-3.322 F F1<65706f6c6c>3.322 E F0 .822
+<8c6c652064657363726970746f72>3.322 F 3.322<2c6f>-.4 G 3.322<7274>-3.322
+G .822<686520726571756573746564206f7065726174696f6e>-3.322 F F2<6f70>
+3.551 E F0<6973>3.511 E
+<6e6f7420737570706f72746564206279207468697320696e74657266>144 276 Q
+<6163652e>-.1 E F1<454e4f4d454d>108 292.8 Q F0<54686572652077>144 304.8
+Q<617320696e737566>-.1 E<8c6369656e74206d656d6f727920746f2068616e646c65
+2074686520726571756573746564>-.25 E F2<6f70>2.73 E F0
+<636f6e74726f6c206f7065726174696f6e2e>2.69 E F3
+<434f4e464f524d494e472054>72 321.6 Q<4f>-.197 E F1<65706f6c6c5f63746c>
+108 333.6 Q F0 1.025<2832292069732061206e65>B 3.525<7741>-.25 G 1.025
+<504920696e74726f647563656420696e204c696e7578206b>-3.525 F<65726e656c>
+-.1 E F1<322e352e3434>3.525 E F0 6.025<2e54>C 1.025<686520696e74657266>
+-6.025 F 1.025
+<6163652073686f756c64206265208c6e616c697a6564206279204c696e7578>-.1 F
+-.1<6b65>108 345.6 S<726e656c>.1 E F1<322e352e3636>2.5 E F0<2e>A F3
+<53454520414c534f>72 362.4 Q F1<65706f6c6c>108 374.4 Q F0<283429>A F1
+<65706f6c6c5f6372>2.5 E<65617465>-.18 E F0<283229>A F1
+<65706f6c6c5f77616974>2.5 E F0<283229>A 174.005<4c696e7578203233>72 768
+R<4f63746f6265722032303032>2.5 E<32>195.395 E 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_ctl.txt b/testcases/kernel/syscalls/epoll2/man/epoll_ctl.txt
new file mode 100644
index 000000000..c2723054e
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_ctl.txt
@@ -0,0 +1,108 @@
+EPOLL_CTL(2) Linux Programmer's Manual EPOLL_CTL(2)
+
+
+
+NAME
+ epoll_ctl - control interface for an epoll descriptor
+
+SYNOPSIS
+ #include <sys/epoll.h>
+
+ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
+
+DESCRIPTION
+ Control an epoll descriptor, epfd, by requesting the operation op be
+ performed on the target file descriptor, fd. The event describes the
+ object linked to the file descriptor fd. The struct epoll_event is
+ defined as :
+
+
+ typedef union epoll_data {
+ void *ptr;
+ int fd;
+ __uint32_t u32;
+ __uint64_t u64;
+ } epoll_data_t;
+
+ struct epoll_event {
+ __uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+ };
+
+
+ The events member is a bit set composed using the following available
+ event types :
+
+ EPOLLIN
+ The associated file is available for read(2) operations.
+
+ EPOLLOUT
+ The associated file is available for write(2) operations.
+
+ EPOLLPRI
+ There is urgent data available for read(2) operations.
+
+ EPOLLERR
+ Error condition happened on the associated file descriptor.
+
+ EPOLLHUP
+ Hang up happened on the associated file descriptor.
+
+ EPOLLET
+ Sets the Edge Triggered behaviour for the associated file
+ descriptor. The default behaviour for epoll is Level Triggered.
+ See epoll(4) for more detailed informations about Edge and Level
+ Triggered event distribution architectures.
+
+ EPOLLONESHOT
+ Sets the One-Shot behaviour for the associated file descriptor.
+ It means that after an event is pulled out with epoll_wait(2)
+ the associated file descriptor is internally disabled and no
+ other events will be reported by the epoll interface. The user
+ must call epoll_ctl(2) with EPOLL_CTL_MOD to re-enable the file
+ descriptor with a new event mask.
+
+
+ The epoll interface supports all file descriptors that support poll(2).
+ Valid values for the op parameter are :
+
+ EPOLL_CTL_ADD
+ Add the target file descriptor fd to the epoll descriptor epfd
+ and associate the event event with the internal file linked to
+ fd.
+
+ EPOLL_CTL_MOD
+ Change the event event associated to the target file descriptor
+ fd.
+
+ EPOLL_CTL_DEL
+ Remove the target file descriptor fd from the epoll file
+ descriptor, epfd.
+
+RETURN VALUE
+ When successful, epoll_ctl(2) returns zero. When an error occurs,
+ epoll_ctl(2) returns -1 and errno is set appropriately.
+
+ERRORS
+ EBADF The epfd file descriptor is not a valid file descriptor.
+
+ EPERM The target file fd is not supported by epoll.
+
+ EINVAL The supplied file descriptor, epfd, is not an epoll file
+ descriptor, or the requested operation op is not supported by
+ this interface.
+
+ ENOMEM There was insufficient memory to handle the requested op control
+ operation.
+
+CONFORMING TO
+ epoll_ctl(2) is a new API introduced in Linux kernel 2.5.44. The
+ interface should be finalized by Linux kernel 2.5.66.
+
+SEE ALSO
+ epoll(4) epoll_create(2) epoll_wait(2)
+
+
+
+
+Linux 23 October 2002 EPOLL_CTL(2)
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_wait.2 b/testcases/kernel/syscalls/epoll2/man/epoll_wait.2
new file mode 100644
index 000000000..75b367011
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_wait.2
@@ -0,0 +1,124 @@
+.\"
+.\" epoll by Davide Libenzi ( efficient event notification retrieval )
+.\" Copyright (C) 2003 Davide Libenzi
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program; if not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+.\"
+.\" Davide Libenzi <davidel@xmailserver.org>
+.\"
+.\"
+.TH EPOLL_WAIT 2 "23 October 2002" Linux "Linux Programmer's Manual"
+.SH NAME
+epoll_wait \- wait for an I/O event on an
+.B epoll
+file descriptor
+.SH SYNOPSIS
+.B #include <sys/epoll.h>
+.sp
+.BR "int epoll_wait(int " epfd ", struct epoll_event * " events ", int " maxevents ", int " timeout)
+.SH DESCRIPTION
+Wait for events on the
+.B epoll
+file descriptor
+.I epfd
+for a maximum time of
+.I timeout
+milliseconds. The memory area pointed to by
+.I events
+will contain the events that will be available for the caller.
+Up to
+.I maxevents
+are returned by
+.BR epoll_wait (2).
+The
+.I maxevents
+parameter must be greater than zero. Specifying a
+.I timeout
+of \-1 makes
+.BR epoll_wait (2)
+wait indefinitely, while specifying a
+.I timeout
+equal to zero makes
+.BR epoll_wait (2)
+to return immediately even if no events are available ( return code equal to zero ).
+The
+.B struct epoll_event
+is defined as :
+.sp
+.nf
+
+ typedef union epoll_data {
+ void *ptr;
+ int fd;
+ __uint32_t u32;
+ __uint64_t u64;
+ } epoll_data_t;
+
+ struct epoll_event {
+ __uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+ };
+
+.fi
+
+The
+.I data
+of each returned structure will contain the same data the user set with a
+.BR epoll_ctl (2)
+.IR ( EPOLL_CTL_ADD , EPOLL_CTL_MOD )
+while the
+.I events
+member will contain the returned event bit field.
+.SH "RETURN VALUE"
+When successful,$
+.BR epoll_wait (2)
+returns the number of file descriptors ready for the requested I/O, or zero
+if no file descriptor became ready during the requested
+.I timeout
+milliseconds. When an error occurs,$
+.BR epoll_wait (2)
+returns \-1 and
+.I errno
+is set appropriately.
+.SH ERRORS
+.TP
+.B EBADF
+.I epfd
+is not a valid file descriptor.
+.TP
+.B EINVAL
+The supplied file descriptor,
+.IR epfd ,
+is not an
+.B epoll
+file descriptor, or the
+.I maxevents
+parameter is less than or equal to zero.
+.TP
+.B EFAULT
+The memory area pointed to by
+.I events
+is not accessible with write permissions.
+.SH CONFORMING TO
+.BR epoll_wait (2)
+is a new API introduced in Linux kernel
+.BR 2.5.44 .
+The interface should be finalized by Linux kernel
+.BR 2.5.66 .
+.SH "SEE ALSO"
+.BR epoll (4)
+.BR epoll_create (2)
+.BR epoll_ctl (2)
+
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_wait.ps b/testcases/kernel/syscalls/epoll2/man/epoll_wait.ps
new file mode 100644
index 000000000..2f9526730
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_wait.ps
@@ -0,0 +1,314 @@
+%!PS-Adobe-3.0
+%%Creator: groff version 1.18.1
+%%CreationDate: Mon Feb 16 19:03:38 2004
+%%DocumentNeededResources: font Times-Roman
+%%+ font Times-Bold
+%%+ font Times-Italic
+%%DocumentSuppliedResources: procset grops 1.18 1
+%%Pages: 1
+%%PageOrder: Ascend
+%%Orientation: Portrait
+%%EndComments
+%%BeginProlog
+%%BeginResource: procset grops 1.18 1
+/setpacking where{
+pop
+currentpacking
+true setpacking
+}if
+/grops 120 dict dup begin
+/SC 32 def
+/A/show load def
+/B{0 SC 3 -1 roll widthshow}bind def
+/C{0 exch ashow}bind def
+/D{0 exch 0 SC 5 2 roll awidthshow}bind def
+/E{0 rmoveto show}bind def
+/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
+/G{0 rmoveto 0 exch ashow}bind def
+/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/I{0 exch rmoveto show}bind def
+/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
+/K{0 exch rmoveto 0 exch ashow}bind def
+/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/M{rmoveto show}bind def
+/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
+/O{rmoveto 0 exch ashow}bind def
+/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/Q{moveto show}bind def
+/R{moveto 0 SC 3 -1 roll widthshow}bind def
+/S{moveto 0 exch ashow}bind def
+/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
+/SF{
+findfont exch
+[exch dup 0 exch 0 exch neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/MF{
+findfont
+[5 2 roll
+0 3 1 roll
+neg 0 0]makefont
+dup setfont
+[exch/setfont cvx]cvx bind def
+}bind def
+/level0 0 def
+/RES 0 def
+/PL 0 def
+/LS 0 def
+/MANUAL{
+statusdict begin/manualfeed true store end
+}bind def
+/PLG{
+gsave newpath clippath pathbbox grestore
+exch pop add exch pop
+}bind def
+/BP{
+/level0 save def
+1 setlinecap
+1 setlinejoin
+72 RES div dup scale
+LS{
+90 rotate
+}{
+0 PL translate
+}ifelse
+1 -1 scale
+}bind def
+/EP{
+level0 restore
+showpage
+}bind def
+/DA{
+newpath arcn stroke
+}bind def
+/SN{
+transform
+.25 sub exch .25 sub exch
+round .25 add exch round .25 add exch
+itransform
+}bind def
+/DL{
+SN
+moveto
+SN
+lineto stroke
+}bind def
+/DC{
+newpath 0 360 arc closepath
+}bind def
+/TM matrix def
+/DE{
+TM currentmatrix pop
+translate scale newpath 0 0 .5 0 360 arc closepath
+TM setmatrix
+}bind def
+/RC/rcurveto load def
+/RL/rlineto load def
+/ST/stroke load def
+/MT/moveto load def
+/CL/closepath load def
+/Fr{
+setrgbcolor fill
+}bind def
+/Fk{
+setcmykcolor fill
+}bind def
+/Fg{
+setgray fill
+}bind def
+/FL/fill load def
+/LW/setlinewidth load def
+/Cr/setrgbcolor load def
+/Ck/setcmykcolor load def
+/Cg/setgray load def
+/RE{
+findfont
+dup maxlength 1 index/FontName known not{1 add}if dict begin
+{
+1 index/FID ne{def}{pop pop}ifelse
+}forall
+/Encoding exch def
+dup/FontName exch def
+currentdict end definefont pop
+}bind def
+/DEFS 0 def
+/EBEGIN{
+moveto
+DEFS begin
+}bind def
+/EEND/end load def
+/CNT 0 def
+/level1 0 def
+/PBEGIN{
+/level1 save def
+translate
+div 3 1 roll div exch scale
+neg exch neg exch translate
+0 setgray
+0 setlinecap
+1 setlinewidth
+0 setlinejoin
+10 setmiterlimit
+[]0 setdash
+/setstrokeadjust where{
+pop
+false setstrokeadjust
+}if
+/setoverprint where{
+pop
+false setoverprint
+}if
+newpath
+/CNT countdictstack def
+userdict begin
+/showpage{}def
+}bind def
+/PEND{
+clear
+countdictstack CNT sub{end}repeat
+level1 restore
+}bind def
+end def
+/setpacking where{
+pop
+setpacking
+}if
+%%EndResource
+%%IncludeResource: font Times-Roman
+%%IncludeResource: font Times-Bold
+%%IncludeResource: font Times-Italic
+grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
+def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
+/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
+/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
+/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
+/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
+/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
+/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
+/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
+/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
+/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
+/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
+/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
+/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
+/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
+/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
+/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
+/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
+/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
+/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
+/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
+/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
+/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
+/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
+/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
+/Times-Roman@0 ENC0/Times-Roman RE
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+BP
+%%EndPageSetup
+/F0 10/Times-Roman@0 SF<45504f4c4c5f57>72 48 Q 100.78
+<414954283229204c696e7578>-1.2 F<50726f6772616d6d657227>2.5 E 2.5<734d>
+-.55 G 100.78<616e75616c2045504f4c4c5f57>-2.5 F<414954283229>-1.2 E/F1
+10.95/Times-Bold@0 SF -.219<4e41>72 84 S<4d45>.219 E F0<65706f6c6c5f77>
+108 96 Q<61697420ad2077>-.1 E<61697420666f7220616e20492f4f2065>-.1 E
+-.15<7665>-.25 G<6e74206f6e20616e>.15 E/F2 10/Times-Bold@0 SF
+<65706f6c6c>2.5 E F0<8c6c652064657363726970746f72>2.5 E F1
+<53594e4f50534953>72 112.8 Q F2
+<23696e636c756465203c7379732f65706f6c6c2e683e>108 124.8 Q
+<696e742065706f6c6c5f7761697428696e74>108 148.8 Q F0<65706664>2.5 E F2
+2.5<2c73>C<74727563742065706f6c6c5f65>-2.5 E -.1<7665>-.15 G<6e74202a>.1
+E F0 -2.15 -.25<65762065>2.5 H<6e7473>.25 E F2 2.5<2c69>C<6e74>-2.5 E F0
+<6d6178>2.5 E -2.15 -.25<65762065>-.15 H<6e7473>.25 E F2 2.5<2c69>C
+<6e74>-2.5 E F0<74696d656f757429>2.5 E F1<4445534352495054494f4e>72
+165.6 Q F0 -.8<5761>108 177.6 S .283<697420666f722065>.8 F -.15<7665>
+-.25 G .283<6e7473206f6e20746865>.15 F F2<65706f6c6c>2.783 E F0 .282
+<8c6c652064657363726970746f72>2.783 F/F3 10/Times-Italic@0 SF<65706664>
+2.972 E F0 .282<666f722061206d6178696d756d2074696d65206f66>3.552 F F3
+<74696d656f7574>2.912 E F0 .282
+<6d696c6c697365636f6e64732e20546865206d656d6f7279>3.462 F .633
+<6172656120706f696e74656420746f206279>108 189.6 R F3 -.15<6576>3.133 G
+<656e7473>.15 E F0 .634<77696c6c20636f6e7461696e207468652065>3.403 F
+-.15<7665>-.25 G .634<6e747320746861742077696c6c2062652061>.15 F -.25
+<7661>-.2 G .634<696c61626c6520666f72207468652063616c6c6572>.25 F 5.634
+<2e55>-.55 G 3.134<7074>-5.634 G<6f>-3.134 E F3<6d617865>3.514 E
+<76656e7473>-.15 E F0<617265>3.404 E .122<72657475726e6564206279>108
+201.6 R F2<65706f6c6c5f77616974>2.622 E F0 2.622<2832292e20546865>B F3
+<6d617865>3.002 E<76656e7473>-.15 E F0 .121<706172616d65746572206d757374
+2062652067726561746572207468616e207a65726f2e2053706563696679696e672061>
+2.892 F F3<74696d656f7574>2.751 E F0 .121<6f6620ad31>3.301 F<6d616b>108
+213.6 Q<6573>-.1 E F2<65706f6c6c5f77616974>3.993 E F0 1.493<2832292077>B
+1.493<61697420696e64658c6e6974656c79>-.1 F 3.993<2c77>-.65 G 1.493
+<68696c652073706563696679696e672061>-3.993 F F3<74696d656f7574>4.123 E
+F0 1.493<657175616c20746f207a65726f206d616b>4.673 F<6573>-.1 E F2
+<65706f6c6c5f77616974>3.993 E F0 1.494<28322920746f>B .509
+<72657475726e20696d6d6564696174656c792065>108 225.6 R -.15<7665>-.25 G
+3.009<6e69>.15 G 3.009<666e>-3.009 G 3.009<6f65>-3.009 G -.15<7665>
+-3.259 G .509<6e7473206172652061>.15 F -.25<7661>-.2 G .509<696c61626c65
+20282072657475726e20636f646520657175616c20746f207a65726f20292e>.25 F
+<546865>5.509 E F2 .508<7374727563742065706f6c6c5f65>3.009 F -.1<7665>
+-.15 G<6e74>.1 E F0<6973>3.008 E<64658c6e6564206173203a>108 237.6 Q
+<7479706564656620756e696f6e2065706f6c6c5f64617461207b>144 273.6 Q -.2
+<766f>180 285.6 S<6964202a7074723b>.2 E<696e742066643b>180 297.6 Q
+<5f5f75696e7433325f74207533323b>180 309.6 Q
+<5f5f75696e7436345f74207536343b>180 321.6 Q 2.5<7d65>144 333.6 S
+<706f6c6c5f646174615f743b>-2.5 E<7374727563742065706f6c6c5f65>144 357.6
+Q -.15<7665>-.25 G<6e74207b>.15 E<5f5f75696e7433325f742065>180 369.6 Q
+-.15<7665>-.25 G 31.73<6e74733b202f2a>.15 F<45706f6c6c2065>2.5 E -.15
+<7665>-.25 G<6e7473202a2f>.15 E<65706f6c6c5f646174615f7420646174613b>180
+381.6 Q<2f2a205573657220646174612076>.62 E<61726961626c65202a2f>-.25 E
+<7d3b>144 393.6 Q<546865>108 429.6 Q F3<64617461>6.518 E F0 3.668<6f6620
+656163682072657475726e6564207374727563747572652077696c6c20636f6e7461696e
+207468652073616d6520646174612074686520757365722073657420776974682061>
+6.428 F F2<65706f6c6c5f63746c>6.169 E F0<283229>A F3<28>108 441.6 Q F0
+<45504f4c4c5f43544c5f414444>.32 E F3<2c>A F0<45504f4c4c5f43544c5f4d4f44>
+A F3<29>.34 E F0 1.751<7768696c6520746865>4.251 F F3 -.15<6576>4.251 G
+<656e7473>.15 E F0 1.751
+<6d656d6265722077696c6c20636f6e7461696e207468652072657475726e65642065>
+4.521 F -.15<7665>-.25 G 1.751<6e7420626974>.15 F<8c656c642e>108 453.6 Q
+F1<52455455524e2056>72 470.4 Q<414c5545>-1.478 E F0 .096
+<5768656e207375636365737366756c2c>108 482.4 R F2<65706f6c6c5f77616974>
+2.596 E F0 .097<2832292072657475726e7320746865206e756d626572206f66208c6c
+652064657363726970746f727320726561647920666f7220746865207265717565737465
+6420492f4f2c206f72207a65726f206966>B 3.047<6e6f208c6c652064657363726970
+746f7220626563616d6520726561647920647572696e6720746865207265717565737465
+64>108 494.4 R F3<74696d656f7574>5.677 E F0 5.547
+<6d696c6c697365636f6e64732e205768656e>6.227 F 3.047
+<616e206572726f72206f63637572732c>5.547 F F2<65706f6c6c5f77616974>108
+506.4 Q F0<2832292072657475726e7320ad3120616e64>A F3<6572726e6f>2.69 E
+F0<69732073657420617070726f7072696174656c79>2.68 E<2e>-.65 E F1<455252>
+72 523.2 Q<4f5253>-.329 E F2<4542>108 535.2 Q<414446>-.3 E F3<65706664>
+144.19 547.2 Q F0<6973206e6f7420612076>3.27 E
+<616c6964208c6c652064657363726970746f72>-.25 E<2e>-.55 E F2<45494e56>108
+564 Q<414c>-1.35 E F0 .158
+<54686520737570706c696564208c6c652064657363726970746f72>144 576 R<2c>-.4
+E F3<65706664>2.658 E F0 2.658<2c69>.77 G 2.658<736e>-2.658 G .158
+<6f7420616e>-2.658 F F2<65706f6c6c>2.658 E F0 .158
+<8c6c652064657363726970746f72>2.658 F 2.658<2c6f>-.4 G 2.658<7274>-2.658
+G<6865>-2.658 E F3<6d617865>3.038 E<76656e7473>-.15 E F0 .159
+<706172616d65746572206973206c657373>2.928 F
+<7468616e206f7220657175616c20746f207a65726f2e>144 588 Q F2<4546>108
+604.8 Q -.5<4155>-.9 G -.92<4c54>.5 G F0
+<546865206d656d6f7279206172656120706f696e74656420746f206279>144 616.8 Q
+F3 -.15<6576>2.5 G<656e7473>.15 E F0<6973206e6f742061636365737369626c65
+2077697468207772697465207065726d697373696f6e732e>2.77 E F1
+<434f4e464f524d494e472054>72 633.6 Q<4f>-.197 E F2<65706f6c6c5f77616974>
+108 645.6 Q F0 .539<2832292069732061206e65>B 3.039<7741>-.25 G .539
+<504920696e74726f647563656420696e204c696e7578206b>-3.039 F<65726e656c>
+-.1 E F2<322e352e3434>3.039 E F0 5.539<2e54>C .539<686520696e74657266>
+-5.539 F .538
+<6163652073686f756c64206265208c6e616c697a6564206279204c696e7578>-.1 F
+-.1<6b65>108 657.6 S<726e656c>.1 E F2<322e352e3636>2.5 E F0<2e>A F1
+<53454520414c534f>72 674.4 Q F2<65706f6c6c>108 686.4 Q F0<283429>A F2
+<65706f6c6c5f6372>2.5 E<65617465>-.18 E F0<283229>A F2
+<65706f6c6c5f63746c>2.5 E F0<283229>A 174.005<4c696e7578203233>72 768 R
+<4f63746f6265722032303032>2.5 E<31>195.395 E 0 Cg EP
+%%Trailer
+end
+%%EOF
diff --git a/testcases/kernel/syscalls/epoll2/man/epoll_wait.txt b/testcases/kernel/syscalls/epoll2/man/epoll_wait.txt
new file mode 100644
index 000000000..41773bf9d
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/epoll_wait.txt
@@ -0,0 +1,68 @@
+EPOLL_WAIT(2) Linux Programmer's Manual EPOLL_WAIT(2)
+
+
+
+NAME
+ epoll_wait - wait for an I/O event on an epoll file descriptor
+
+SYNOPSIS
+ #include <sys/epoll.h>
+
+ int epoll_wait(int epfd, struct epoll_event * events, int maxevents,
+ int timeout)
+
+DESCRIPTION
+ Wait for events on the epoll file descriptor epfd for a maximum time of
+ timeout milliseconds. The memory area pointed to by events will contain
+ the events that will be available for the caller. Up to maxevents are
+ returned by epoll_wait(2). The maxevents parameter must be greater
+ than zero. Specifying a timeout of -1 makes epoll_wait(2) wait indefi-
+ nitely, while specifying a timeout equal to zero makes epoll_wait(2) to
+ return immediately even if no events are available ( return code equal
+ to zero ). The struct epoll_event is defined as :
+
+
+ typedef union epoll_data {
+ void *ptr;
+ int fd;
+ __uint32_t u32;
+ __uint64_t u64;
+ } epoll_data_t;
+
+ struct epoll_event {
+ __uint32_t events; /* Epoll events */
+ epoll_data_t data; /* User data variable */
+ };
+
+
+ The data of each returned structure will contain the same data the user
+ set with a epoll_ctl(2) (EPOLL_CTL_ADD,EPOLL_CTL_MOD) while the events
+ member will contain the returned event bit field.
+
+RETURN VALUE
+ When successful, epoll_wait(2) returns the number of file descriptors
+ ready for the requested I/O, or zero if no file descriptor became ready
+ during the requested timeout milliseconds. When an error occurs,
+ epoll_wait(2) returns -1 and errno is set appropriately.
+
+ERRORS
+ EBADF epfd is not a valid file descriptor.
+
+ EINVAL The supplied file descriptor, epfd, is not an epoll file
+ descriptor, or the maxevents parameter is less than or equal to
+ zero.
+
+ EFAULT The memory area pointed to by events is not accessible with
+ write permissions.
+
+CONFORMING TO
+ epoll_wait(2) is a new API introduced in Linux kernel 2.5.44. The
+ interface should be finalized by Linux kernel 2.5.66.
+
+SEE ALSO
+ epoll(4) epoll_create(2) epoll_ctl(2)
+
+
+
+
+Linux 23 October 2002 EPOLL_WAIT(2)
diff --git a/testcases/kernel/syscalls/epoll2/man/mkpages.sh b/testcases/kernel/syscalls/epoll2/man/mkpages.sh
new file mode 100755
index 000000000..a1a7cf610
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/man/mkpages.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+groff -t -e -mandoc -Tascii epoll.4 | col -bx > epoll.txt
+groff -t -e -mandoc -Tascii epoll_create.2 | col -bx > epoll_create.txt
+groff -t -e -mandoc -Tascii epoll_ctl.2 | col -bx > epoll_ctl.txt
+groff -t -e -mandoc -Tascii epoll_wait.2 | col -bx > epoll_wait.txt
+groff -t -e -mandoc -Tps epoll.4 > epoll.ps
+groff -t -e -mandoc -Tps epoll_create.2 > epoll_create.ps
+groff -t -e -mandoc -Tps epoll_ctl.2 > epoll_ctl.ps
+groff -t -e -mandoc -Tps epoll_wait.2 > epoll_wait.ps
+
diff --git a/testcases/kernel/syscalls/epoll2/src/epoll.c b/testcases/kernel/syscalls/epoll2/src/epoll.c
new file mode 100644
index 000000000..0a8283964
--- /dev/null
+++ b/testcases/kernel/syscalls/epoll2/src/epoll.c
@@ -0,0 +1,28 @@
+/*
+ * epoll.c ( Efficent event polling implementation )
+ * Copyright (C) 2001,...,2002 Davide Libenzi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Davide Libenzi <davidel@xmailserver.org>
+ *
+ */
+
+#include <linux/unistd.h>
+#include <errno.h>
+#include "epoll.h"
+
+#define __sys_epoll_create(size) _syscall1(int, epoll_create, int, size)
+#define __sys_epoll_ctl(epfd, op, fd, event) _syscall4(int, epoll_ctl, \
+ int, epfd, int, op, int, fd, struct epoll_event *, event)
+#define __sys_epoll_wait(epfd, pevents, maxevents, timeout) _syscall4(int, epoll_wait, \
+ int, epfd, struct epoll_event *, pevents, int, maxevents, int, timeout)
+
+__sys_epoll_create(size)
+
+ __sys_epoll_ctl(epfd, op, fd, event)
+
+ __sys_epoll_wait(epfd, pevents, maxevents, timeout)
diff --git a/testcases/kernel/syscalls/epoll_create1/Makefile b/testcases/kernel/syscalls/epoll_create1/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/epoll_create1/Makefile
+++ b/testcases/kernel/syscalls/epoll_create1/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/epoll_ctl/Makefile b/testcases/kernel/syscalls/epoll_ctl/Makefile
index c7810c9fd..2666822e6 100644
--- a/testcases/kernel/syscalls/epoll_ctl/Makefile
+++ b/testcases/kernel/syscalls/epoll_ctl/Makefile
@@ -1,6 +1,21 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 Fujitsu Ltd.
# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/epoll_pwait/Makefile b/testcases/kernel/syscalls/epoll_pwait/Makefile
index 0253b3ab6..289aaaf44 100644
--- a/testcases/kernel/syscalls/epoll_pwait/Makefile
+++ b/testcases/kernel/syscalls/epoll_pwait/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 Fujitsu Ltd.
# Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c
index 1f08112ad..ed05da8fe 100644
--- a/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c
+++ b/testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c
@@ -121,8 +121,8 @@ static void verify_sigmask(void)
return;
}
- if (TEST_RETURN != 1) {
- tst_resm(TFAIL, "epoll_pwait() returned %li, expected 1",
+ if (TEST_RETURN != 0) {
+ tst_resm(TFAIL, "epoll_pwait() returned %li, expected 0",
TEST_RETURN);
return;
}
@@ -153,7 +153,6 @@ static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
static void do_test(sigset_t *sigmask)
{
pid_t cpid;
- char b;
cpid = tst_fork();
if (cpid < 0)
@@ -162,15 +161,13 @@ static void do_test(sigset_t *sigmask)
if (cpid == 0)
do_child();
- TEST(epoll_pwait(epfd, &epevs, 1, -1, sigmask));
+ TEST(epoll_pwait(epfd, &epevs, 1, 100, sigmask));
if (sigmask != NULL)
verify_sigmask();
else
verify_nonsigmask();
- SAFE_READ(cleanup, 1, fds[0], &b, 1);
-
tst_record_childstatus(cleanup, cpid);
}
@@ -182,8 +179,6 @@ static void do_child(void)
}
SAFE_KILL(cleanup, getppid(), SIGUSR1);
- usleep(10000);
- SAFE_WRITE(cleanup, 1, fds[1], "w", 1);
cleanup();
tst_exit();
diff --git a/testcases/kernel/syscalls/epoll_wait/Makefile b/testcases/kernel/syscalls/epoll_wait/Makefile
index 068de0414..f29b9a78b 100644
--- a/testcases/kernel/syscalls/epoll_wait/Makefile
+++ b/testcases/kernel/syscalls/epoll_wait/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 Fujitsu Ltd.
# Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c
index c54a739f8..a1eab2697 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c
@@ -1,8 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2016 Fujitsu Ltd.
* Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
*/
/*
diff --git a/testcases/kernel/syscalls/eventfd/Makefile b/testcases/kernel/syscalls/eventfd/Makefile
index ce4f13b72..268d2e74b 100644
--- a/testcases/kernel/syscalls/eventfd/Makefile
+++ b/testcases/kernel/syscalls/eventfd/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/eventfd/eventfd01.c b/testcases/kernel/syscalls/eventfd/eventfd01.c
index 4d888910b..e4f9c804a 100644
--- a/testcases/kernel/syscalls/eventfd/eventfd01.c
+++ b/testcases/kernel/syscalls/eventfd/eventfd01.c
@@ -510,11 +510,6 @@ static int trigger_eventfd_overflow(int evfd, int *fd, io_context_t * ctx)
ret = io_setup(16, ctx);
if (ret < 0) {
errno = -ret;
- if (errno == ENOSYS) {
- tst_brkm(TCONF | TERRNO, cleanup,
- "io_setup(): AIO not supported by kernel");
- }
-
tst_resm(TINFO | TERRNO, "io_setup error");
return -1;
}
diff --git a/testcases/kernel/syscalls/eventfd2/Makefile b/testcases/kernel/syscalls/eventfd2/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/eventfd2/Makefile
+++ b/testcases/kernel/syscalls/eventfd2/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execl/Makefile b/testcases/kernel/syscalls/execl/Makefile
index 446466b1c..a0e5f0fc4 100644
--- a/testcases/kernel/syscalls/execl/Makefile
+++ b/testcases/kernel/syscalls/execl/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Linux Test Project, 2018
# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execl/execl01.c b/testcases/kernel/syscalls/execl/execl01.c
index 9268d4976..4ec94b5f9 100644
--- a/testcases/kernel/syscalls/execl/execl01.c
+++ b/testcases/kernel/syscalls/execl/execl01.c
@@ -26,7 +26,7 @@ static void verify_execl(void)
pid = SAFE_FORK();
if (pid == 0) {
TEST(execl(path, "execl01_child", "canary", NULL));
- tst_brk(TFAIL | TTERRNO,
+ tst_brk(TFAIL | TERRNO,
"Failed to execute execl01_child");
}
}
diff --git a/testcases/kernel/syscalls/execle/Makefile b/testcases/kernel/syscalls/execle/Makefile
index ea102983a..a0e5f0fc4 100644
--- a/testcases/kernel/syscalls/execle/Makefile
+++ b/testcases/kernel/syscalls/execle/Makefile
@@ -1,7 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
#
-# Copyright (c) Linux Test Project, 2018
-# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) Linux Test Project, 2018
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execle/execle01.c b/testcases/kernel/syscalls/execle/execle01.c
index f10813cca..8df1cc649 100644
--- a/testcases/kernel/syscalls/execle/execle01.c
+++ b/testcases/kernel/syscalls/execle/execle01.c
@@ -33,7 +33,7 @@ static void verify_execle(void)
pid = SAFE_FORK();
if (pid == 0) {
TEST(execle(path, "execle01_child", "canary", NULL, envp));
- tst_brk(TFAIL | TTERRNO,
+ tst_brk(TFAIL | TERRNO,
"Failed to execute execl01_child");
}
}
diff --git a/testcases/kernel/syscalls/execlp/Makefile b/testcases/kernel/syscalls/execlp/Makefile
index ea102983a..a0e5f0fc4 100644
--- a/testcases/kernel/syscalls/execlp/Makefile
+++ b/testcases/kernel/syscalls/execlp/Makefile
@@ -1,7 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
#
-# Copyright (c) Linux Test Project, 2018
-# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) Linux Test Project, 2018
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execlp/execlp01.c b/testcases/kernel/syscalls/execlp/execlp01.c
index 87c2a9fca..61a81c612 100644
--- a/testcases/kernel/syscalls/execlp/execlp01.c
+++ b/testcases/kernel/syscalls/execlp/execlp01.c
@@ -24,7 +24,7 @@ static void verify_execlp(void)
pid = SAFE_FORK();
if (pid == 0 ) {
TEST(execlp("execlp01_child", "execlp01_child", "canary", NULL));
- tst_brk(TFAIL | TTERRNO,
+ tst_brk(TFAIL | TERRNO,
"Failed to execute execlp01_child");
}
}
diff --git a/testcases/kernel/syscalls/execv/Makefile b/testcases/kernel/syscalls/execv/Makefile
index 446466b1c..a0e5f0fc4 100644
--- a/testcases/kernel/syscalls/execv/Makefile
+++ b/testcases/kernel/syscalls/execv/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Linux Test Project, 2018
# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execv/execv01.c b/testcases/kernel/syscalls/execv/execv01.c
index 730333f4b..58c61a3e4 100644
--- a/testcases/kernel/syscalls/execv/execv01.c
+++ b/testcases/kernel/syscalls/execv/execv01.c
@@ -28,7 +28,7 @@ static void verify_execv(void)
pid = SAFE_FORK();
if (pid == 0) {
TEST(execv(path, args));
- tst_brk(TFAIL | TTERRNO, "Failed to execute execv01_child");
+ tst_brk(TFAIL | TERRNO, "Failed to execute execv01_child");
}
}
diff --git a/testcases/kernel/syscalls/execve/Makefile b/testcases/kernel/syscalls/execve/Makefile
index df690c6bd..139875ff4 100644
--- a/testcases/kernel/syscalls/execve/Makefile
+++ b/testcases/kernel/syscalls/execve/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execve/execve02.c b/testcases/kernel/syscalls/execve/execve02.c
index 0574f5c8b..d9fb5b919 100644
--- a/testcases/kernel/syscalls/execve/execve02.c
+++ b/testcases/kernel/syscalls/execve/execve02.c
@@ -49,9 +49,9 @@ static void do_child(void)
tst_brk(TFAIL, "execve() passed unexpectedly");
if (TST_ERR != EACCES)
- tst_brk(TFAIL | TTERRNO, "execve() failed unexpectedly");
+ tst_brk(TFAIL | TERRNO, "execve() failed unexpectedly");
- tst_res(TPASS | TTERRNO, "execve() failed expectedly");
+ tst_res(TPASS | TERRNO, "execve() failed expectedly");
exit(0);
}
diff --git a/testcases/kernel/syscalls/execve/execve05.c b/testcases/kernel/syscalls/execve/execve05.c
index 4c9789cc5..63e597f6b 100644
--- a/testcases/kernel/syscalls/execve/execve05.c
+++ b/testcases/kernel/syscalls/execve/execve05.c
@@ -43,6 +43,10 @@
static int nchild = 8;
static char *opt_nchild;
+static struct tst_option exe_options[] = {
+ {"n:", &opt_nchild, "-n numbers of children"},
+ {NULL, NULL, NULL}
+};
static const char *const resource_files[] = {
TEST_APP,
@@ -56,7 +60,7 @@ static void do_child(void)
TST_CHECKPOINT_WAIT(0);
TEST(execve(TEST_APP, argv, environ));
- tst_res(TFAIL | TTERRNO, "execve() returned unexpected errno");
+ tst_res(TFAIL | TERRNO, "execve() returned unexpected errno");
}
static void verify_execve(void)
@@ -79,10 +83,7 @@ static void setup(void)
static struct tst_test test = {
.test_all = verify_execve,
- .options = (struct tst_option[]) {
- {"n:", &opt_nchild, "-n numbers of children"},
- {}
- },
+ .options = exe_options,
.forks_child = 1,
.child_needs_reinit = 1,
.needs_checkpoints = 1,
diff --git a/testcases/kernel/syscalls/execveat/Makefile b/testcases/kernel/syscalls/execveat/Makefile
index ea1252263..0bab6dc83 100644
--- a/testcases/kernel/syscalls/execveat/Makefile
+++ b/testcases/kernel/syscalls/execveat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2018 MediaTek Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/execveat/execveat01.c b/testcases/kernel/syscalls/execveat/execveat01.c
index 16d27acf6..5325d484b 100644
--- a/testcases/kernel/syscalls/execveat/execveat01.c
+++ b/testcases/kernel/syscalls/execveat/execveat01.c
@@ -55,7 +55,7 @@ static void verify_execveat(unsigned int i)
pid = SAFE_FORK();
if (pid == 0) {
TEST(execveat(*tc->fd, tc->pathname, argv, environ, tc->flag));
- tst_res(TFAIL | TTERRNO, "execveat() returns unexpected errno");
+ tst_res(TFAIL | TERRNO, "execveat() returns unexpected errno");
}
}
diff --git a/testcases/kernel/syscalls/execveat/execveat03.c b/testcases/kernel/syscalls/execveat/execveat03.c
index 78b26ab56..27247e664 100644
--- a/testcases/kernel/syscalls/execveat/execveat03.c
+++ b/testcases/kernel/syscalls/execveat/execveat03.c
@@ -51,7 +51,7 @@ static void do_child(void)
SAFE_UNLINK(TEST_FILE_PATH);
TEST(execveat(fd, "", argv, environ, AT_EMPTY_PATH));
- tst_res(TFAIL | TTERRNO, "execveat() returned unexpected errno");
+ tst_res(TFAIL | TERRNO, "execveat() returned unexpected errno");
}
static void verify_execveat(void)
diff --git a/testcases/kernel/syscalls/execvp/Makefile b/testcases/kernel/syscalls/execvp/Makefile
index d44bfa32b..a0e5f0fc4 100644
--- a/testcases/kernel/syscalls/execvp/Makefile
+++ b/testcases/kernel/syscalls/execvp/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2018
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) Linux Test Project, 2018
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/exit/Makefile b/testcases/kernel/syscalls/exit/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/exit/Makefile
+++ b/testcases/kernel/syscalls/exit/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/exit_group/Makefile b/testcases/kernel/syscalls/exit_group/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/exit_group/Makefile
+++ b/testcases/kernel/syscalls/exit_group/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/faccessat/Makefile b/testcases/kernel/syscalls/faccessat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/faccessat/Makefile
+++ b/testcases/kernel/syscalls/faccessat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fadvise/Makefile b/testcases/kernel/syscalls/fadvise/Makefile
index 50117a9fa..13aa315d7 100644
--- a/testcases/kernel/syscalls/fadvise/Makefile
+++ b/testcases/kernel/syscalls/fadvise/Makefile
@@ -1,9 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copied from ../open/Makefile by Masatake YAMATO
#
###
#
# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fallocate/.gitignore b/testcases/kernel/syscalls/fallocate/.gitignore
index 083c330d4..ef38ed64d 100644
--- a/testcases/kernel/syscalls/fallocate/.gitignore
+++ b/testcases/kernel/syscalls/fallocate/.gitignore
@@ -3,4 +3,3 @@
/fallocate03
/fallocate04
/fallocate05
-/fallocate06
diff --git a/testcases/kernel/syscalls/fallocate/Makefile b/testcases/kernel/syscalls/fallocate/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/fallocate/Makefile
+++ b/testcases/kernel/syscalls/fallocate/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fallocate/fallocate01.c b/testcases/kernel/syscalls/fallocate/fallocate01.c
index c60e160f4..02aa33100 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate01.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate01.c
@@ -247,14 +247,14 @@ void runtest(int mode, int fd, loff_t expected_size)
tst_resm(TFAIL | TERRNO, "fstat failed after fallocate()");
if (file_stat.st_size != expected_size)
- tst_resm(TFAIL | TERRNO,
+ tst_resm(TFAIL | TTERRNO,
"fstat test fails on fallocate (%d, %d, %" PRId64 ", %"
PRId64 ") Failed on mode", fd, mode, offset, len);
write_offset = random() % len;
lseek_offset = lseek(fd, write_offset, SEEK_CUR);
if (lseek_offset != offset + write_offset) {
- tst_resm(TFAIL | TERRNO,
+ tst_resm(TFAIL | TTERRNO,
"lseek fails in fallocate(%d, %d, %" PRId64 ", %"
PRId64 ") failed on mode", fd, mode, offset, len);
return;
diff --git a/testcases/kernel/syscalls/fallocate/fallocate04.c b/testcases/kernel/syscalls/fallocate/fallocate04.c
index 7ffc8f4fa..1901502c2 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate04.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate04.c
@@ -296,11 +296,13 @@ static void cleanup(void)
SAFE_CLOSE(fd);
}
+static struct tst_option opts[] = {
+ {"v", &verbose, "-v Turns on verbose mode"},
+ {NULL, NULL, NULL}
+};
+
static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"v", &verbose, "-v Turns on verbose mode"},
- {}
- },
+ .options = opts,
.cleanup = cleanup,
.setup = setup,
.test = run,
diff --git a/testcases/kernel/syscalls/fallocate/fallocate05.c b/testcases/kernel/syscalls/fallocate/fallocate05.c
index 55ec1aee4..00a1d3864 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate05.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate05.c
@@ -30,16 +30,16 @@
#define DEALLOCATE_BLOCKS 4
#define TESTED_FLAGS "fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)"
+static int fd;
static char *buf;
static blksize_t blocksize;
static long bufsize;
static void setup(void)
{
- int fd;
struct stat statbuf;
- fd = SAFE_OPEN(MNTPOINT "/test_file", O_WRONLY | O_CREAT, 0644);
+ fd = SAFE_OPEN(MNTPOINT "/test_file", O_WRONLY | O_CREAT);
/*
* Use real FS block size, otherwise fallocate() call will test
@@ -49,16 +49,12 @@ static void setup(void)
blocksize = statbuf.st_blksize;
bufsize = FALLOCATE_BLOCKS * blocksize;
buf = SAFE_MALLOC(bufsize);
- SAFE_CLOSE(fd);
}
static void run(void)
{
- int fd;
long extsize, tmp;
- fd = SAFE_OPEN(MNTPOINT "/test_file", O_WRONLY | O_CREAT | O_TRUNC,
- 0644);
TEST(fallocate(fd, 0, 0, bufsize));
if (TST_RET) {
@@ -135,12 +131,14 @@ static void run(void)
else
tst_res(TPASS, "write()");
- SAFE_CLOSE(fd);
- tst_purge_dir(MNTPOINT);
+ /* TODO: wipe the test device here to allow looping with -i/-I */
}
static void cleanup(void)
{
+ if (fd > 0)
+ SAFE_CLOSE(fd);
+
free(buf);
}
diff --git a/testcases/kernel/syscalls/fallocate/fallocate06.c b/testcases/kernel/syscalls/fallocate/fallocate06.c
deleted file mode 100644
index 49ddba4a2..000000000
--- a/testcases/kernel/syscalls/fallocate/fallocate06.c
+++ /dev/null
@@ -1,274 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*\
- * [Description]
- *
- * Tests misaligned fallocate()
- *
- * Test scenario:
- *
- * 1. write() several blocks worth of data
- * 2. fallocate() some more space (not aligned to FS blocks)
- * 3. try to write() into the allocated space
- * 4. deallocate misaligned part of file range written in step 1
- * 5. read() the deallocated range and check that it was zeroed
- *
- * Subtests:
- *
- * - fill filesystem between step 2 and 3
- * - disable copy-on-write on test file
- * - combinations of above subtests
- */
-
-/*
- * This is also regression test for:
- * e093c4be760e ("xfs: Fix tail rounding in xfs_alloc_file_space()")
- * 6d4572a9d71d ("Allow btrfs_truncate_block() to fallback to nocow for data
- * space reservation")
- */
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/fs.h>
-#include "tst_test.h"
-#include "lapi/fallocate.h"
-
-#define MNTPOINT "mntpoint"
-#define TEMPFILE MNTPOINT "/test_file"
-#define WRITE_BLOCKS 8
-#define FALLOCATE_BLOCKS 2
-#define DEALLOCATE_BLOCKS 3
-#define TESTED_FLAGS "fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)"
-
-const struct test_case {
- int no_cow, fill_fs;
-} testcase_list[] = {
- {1, 0},
- {1, 1},
- {0, 0},
- {0, 1}
-};
-
-static int cow_support;
-static char *wbuf, *rbuf;
-static blksize_t blocksize;
-static long wbuf_size, rbuf_size, block_offset;
-
-static int toggle_cow(int fd, int enable)
-{
- int ret, attr;
-
- ret = ioctl(fd, FS_IOC_GETFLAGS, &attr);
-
- if (ret)
- return ret;
-
- if (enable)
- attr &= ~FS_NOCOW_FL;
- else
- attr |= FS_NOCOW_FL;
-
- return ioctl(fd, FS_IOC_SETFLAGS, &attr);
-}
-
-static void setup(void)
-{
- unsigned char ch;
- long i;
- int fd;
- struct stat statbuf;
-
- fd = SAFE_OPEN(TEMPFILE, O_WRONLY | O_CREAT | O_TRUNC, 0644);
-
- /*
- * Set FS_NOCOW_FL flag on the temp file. Non-CoW filesystems will
- * return error.
- */
- TEST(toggle_cow(fd, 0));
- SAFE_FSTAT(fd, &statbuf);
- blocksize = statbuf.st_blksize;
- block_offset = MIN(blocksize / 2, 512);
- wbuf_size = MAX(WRITE_BLOCKS, FALLOCATE_BLOCKS) * blocksize;
- rbuf_size = (DEALLOCATE_BLOCKS + 1) * blocksize;
- SAFE_CLOSE(fd);
- SAFE_UNLINK(TEMPFILE);
-
- if (blocksize < 2)
- tst_brk(TCONF, "Block size %ld too small for test", blocksize);
-
- if (!TST_RET) {
- cow_support = 1;
- } else {
- switch (TST_ERR) {
- case ENOTSUP:
- case ENOTTY:
- case EINVAL:
- case ENOSYS:
- cow_support = 0;
- break;
-
- default:
- tst_brk(TBROK|TTERRNO,
- "Error checking copy-on-write support");
- break;
- }
- }
-
- tst_res(TINFO, "Copy-on-write is%s supported",
- cow_support ? "" : " not");
- wbuf = SAFE_MALLOC(wbuf_size);
- rbuf = SAFE_MALLOC(rbuf_size);
-
- /* Fill the buffer with known values */
- for (i = 0, ch = 1; i < wbuf_size; i++, ch++)
- wbuf[i] = ch;
-}
-
-static int check_result(const struct test_case *tc, const char *func, long exp)
-{
- if (tc->fill_fs && !tc->no_cow && TST_RET < 0) {
- if (TST_RET != -1) {
- tst_res(TFAIL, "%s returned unexpected value %ld",
- func, TST_RET);
- return 0;
- }
-
- if (TST_ERR != ENOSPC) {
- tst_res(TFAIL | TTERRNO, "%s should fail with ENOSPC",
- func);
- return 0;
- }
-
- tst_res(TPASS | TTERRNO, "%s on full FS with CoW", func);
- return 1;
- }
-
- if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO, "%s failed unexpectedly", func);
- return 0;
- }
-
- if (TST_RET != exp) {
- tst_res(TFAIL,
- "Unexpected return value from %s: %ld (expected %ld)",
- func, TST_RET, exp);
- return 0;
- }
-
- tst_res(TPASS, "%s successful", func);
- return 1;
-}
-
-static void run(unsigned int n)
-{
- int fd, i, err;
- long offset, size;
- const struct test_case *tc = testcase_list + n;
-
- tst_res(TINFO, "Case %u. Fill FS: %s; Use copy on write: %s", n+1,
- tc->fill_fs ? "yes" : "no", tc->no_cow ? "no" : "yes");
- fd = SAFE_OPEN(TEMPFILE, O_RDWR | O_CREAT | O_TRUNC, 0644);
-
- if (cow_support)
- toggle_cow(fd, !tc->no_cow);
- else if (!tc->no_cow)
- tst_brk(TCONF, "File system does not support copy-on-write");
-
- /* Prepare test data for deallocation test */
- size = WRITE_BLOCKS * blocksize;
- SAFE_WRITE(1, fd, wbuf, size);
-
- /* Allocation test */
- offset = size + block_offset;
- size = FALLOCATE_BLOCKS * blocksize;
- TEST(fallocate(fd, 0, offset, size));
-
- if (TST_RET) {
- SAFE_CLOSE(fd);
-
- if (TST_ERR == ENOTSUP)
- tst_brk(TCONF | TTERRNO, "fallocate() not supported");
-
- tst_brk(TBROK | TTERRNO, "fallocate(fd, 0, %ld, %ld)", offset,
- size);
- }
-
- if (tc->fill_fs)
- tst_fill_fs(MNTPOINT, 1);
-
- SAFE_LSEEK(fd, offset, SEEK_SET);
- TEST(write(fd, wbuf, size));
- if (check_result(tc, "write()", size))
- tst_res(TPASS, "Misaligned allocation works as expected");
-
- /* Deallocation test */
- size = DEALLOCATE_BLOCKS * blocksize;
- offset = block_offset;
- TEST(fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset,
- size));
-
- if (TST_RET == -1 && TST_ERR == ENOTSUP) {
- tst_res(TCONF | TTERRNO, TESTED_FLAGS);
- goto end;
- }
-
- if (!check_result(tc, TESTED_FLAGS, 0) || TST_RET)
- goto end;
-
- /* Validate that fallocate() cleared the correct file range */
- SAFE_LSEEK(fd, 0, SEEK_SET);
- SAFE_READ(1, fd, rbuf, rbuf_size);
-
- for (err = 0, i = offset; i < offset + size; i++) {
- if (rbuf[i]) {
- err = 1;
- break;
- }
- }
-
- err = err || memcmp(rbuf, wbuf, offset);
- offset += size;
- size = rbuf_size - offset;
- err = err || memcmp(rbuf + offset, wbuf + offset, size);
-
- if (err)
- tst_res(TFAIL, TESTED_FLAGS
- " did not clear the correct file range.");
- else
- tst_res(TPASS, TESTED_FLAGS " cleared the correct file range");
-
-end:
- SAFE_CLOSE(fd);
- tst_purge_dir(MNTPOINT);
-}
-
-static void cleanup(void)
-{
- free(wbuf);
- free(rbuf);
-}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(testcase_list),
- .needs_root = 1,
- .mount_device = 1,
- .dev_min_size = 512,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .setup = setup,
- .cleanup = cleanup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "e093c4be760e"},
- {"linux-git", "6d4572a9d71d"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/fanotify/.gitignore b/testcases/kernel/syscalls/fanotify/.gitignore
index 9554b16b1..68e4cc7aa 100644
--- a/testcases/kernel/syscalls/fanotify/.gitignore
+++ b/testcases/kernel/syscalls/fanotify/.gitignore
@@ -13,8 +13,4 @@
/fanotify13
/fanotify14
/fanotify15
-/fanotify16
-/fanotify17
-/fanotify18
-/fanotify19
/fanotify_child
diff --git a/testcases/kernel/syscalls/fanotify/Makefile b/testcases/kernel/syscalls/fanotify/Makefile
index 3628094ba..5d01b4825 100644
--- a/testcases/kernel/syscalls/fanotify/Makefile
+++ b/testcases/kernel/syscalls/fanotify/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Jan Kara <jack@suse.cz>, 2013
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
fanotify11: CFLAGS+=-pthread
diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index a2be18338..6da7e765c 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2012-2020 Linux Test Project. All Rights Reserved.
+ * Copyright (c) 2012 Linux Test Project. All Rights Reserved.
* Author: Jan Kara, November 2013
*/
@@ -12,80 +12,35 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#include <sys/fanotify.h>
-#include "lapi/fcntl.h"
+#include <fcntl.h>
-int safe_fanotify_init(const char *file, const int lineno,
- unsigned int flags, unsigned int event_f_flags)
-{
- int rval;
+#if defined(HAVE_SYS_FANOTIFY_H)
- rval = fanotify_init(flags, event_f_flags);
+#include <sys/fanotify.h>
- if (rval == -1) {
- if (errno == ENOSYS) {
- tst_brk_(file, lineno, TCONF,
- "fanotify is not configured in this kernel");
- }
- tst_brk_(file, lineno, TBROK | TERRNO,
- "%s:%d: fanotify_init() failed", file, lineno);
- }
+#else /* HAVE_SYS_FANOTIFY_H */
- if (rval < -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "invalid fanotify_init() return %d", rval);
- }
+/* fanotify(7) wrappers */
- return rval;
-}
+#include <stdint.h>
+#include "lapi/syscalls.h"
-static inline int safe_fanotify_mark(const char *file, const int lineno,
- int fd, unsigned int flags, uint64_t mask,
- int dfd, const char *pathname)
+static int fanotify_init(unsigned int flags, unsigned int event_f_flags)
{
- int rval;
-
- rval = fanotify_mark(fd, flags, mask, dfd, pathname);
-
- if (rval == -1) {
- tst_brk_(file, lineno, TBROK | TERRNO, "fanotify_mark() failed");
- }
-
- if (rval < -1) {
- tst_brk_(file, lineno, TBROK | TERRNO,
- "invalid fanotify_mark() return %d", rval);
- }
-
- return rval;
+ return syscall(__NR_fanotify_init, flags, event_f_flags);
}
-#define SAFE_FANOTIFY_MARK(fd, flags, mask, dfd, pathname) \
- safe_fanotify_mark(__FILE__, __LINE__, (fd), (flags), (mask), (dfd), (pathname))
+static long fanotify_mark(int fd, unsigned int flags, uint64_t mask,
+ int dfd, const char *pathname)
+{
+ return syscall(__NR_fanotify_mark, fd, flags, mask, dfd, pathname);
+}
-#define SAFE_FANOTIFY_INIT(fan, mode) \
- safe_fanotify_init(__FILE__, __LINE__, (fan), (mode))
+#endif /* HAVE_SYS_FANOTIFY_H */
#ifndef FAN_REPORT_TID
#define FAN_REPORT_TID 0x00000100
#endif
-#ifndef FAN_REPORT_FID
-#define FAN_REPORT_FID 0x00000200
-#endif
-#ifndef FAN_REPORT_DIR_FID
-#define FAN_REPORT_DIR_FID 0x00000400
-#endif
-#ifndef FAN_REPORT_NAME
-#define FAN_REPORT_NAME 0x00000800
-#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
-#endif
-
-/* Non-uapi convenience macros */
-#ifndef FAN_REPORT_DFID_NAME_FID
-#define FAN_REPORT_DFID_NAME_FID (FAN_REPORT_DFID_NAME | FAN_REPORT_FID)
-#endif
-#ifndef FAN_REPORT_DFID_FID
-#define FAN_REPORT_DFID_FID (FAN_REPORT_DIR_FID | FAN_REPORT_FID)
-#endif
#ifndef FAN_MARK_INODE
#define FAN_MARK_INODE 0
@@ -125,8 +80,9 @@ static inline int safe_fanotify_mark(const char *file, const int lineno,
#define FAN_OPEN_EXEC_PERM 0x00040000
#endif
-/* Flags required for unprivileged user group */
-#define FANOTIFY_REQUIRED_USER_INIT_FLAGS (FAN_REPORT_FID)
+#ifndef FAN_REPORT_FID
+#define FAN_REPORT_FID 0x00000200
+#endif
/*
* FAN_ALL_PERM_EVENTS has been deprecated, so any new permission events
@@ -138,11 +94,6 @@ static inline int safe_fanotify_mark(const char *file, const int lineno,
#define LTP_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_OPEN_EXEC_PERM | \
FAN_ACCESS_PERM)
-struct fanotify_group_type {
- unsigned int flag;
- const char * name;
-};
-
struct fanotify_mark_type {
unsigned int flag;
const char * name;
@@ -155,16 +106,6 @@ typedef struct {
#define __kernel_fsid_t lapi_fsid_t
#endif /* __kernel_fsid_t */
-#ifndef FAN_EVENT_INFO_TYPE_FID
-#define FAN_EVENT_INFO_TYPE_FID 1
-#endif
-#ifndef FAN_EVENT_INFO_TYPE_DFID_NAME
-#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
-#endif
-#ifndef FAN_EVENT_INFO_TYPE_DFID
-#define FAN_EVENT_INFO_TYPE_DFID 3
-#endif
-
#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER
struct fanotify_event_info_header {
uint8_t info_type;
@@ -189,11 +130,6 @@ struct fanotify_event_info_fid {
#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */
#ifdef HAVE_NAME_TO_HANDLE_AT
-
-#ifndef MAX_HANDLE_SZ
-#define MAX_HANDLE_SZ 128
-#endif
-
/*
* Helper function used to obtain fsid and file_handle for a given path.
* Used by test files correlated to FAN_REPORT_FID functionality.
@@ -219,158 +155,9 @@ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid,
"name_to_handle_at(AT_FDCWD, %s, ...) failed", path);
}
}
-
-struct fanotify_fid_t {
- __kernel_fsid_t fsid;
- struct file_handle handle;
- char buf[MAX_HANDLE_SZ];
-};
-
-static inline void fanotify_save_fid(const char *path,
- struct fanotify_fid_t *fid)
-{
- int *fh = (int *)(fid->handle.f_handle);
-
- fh[0] = fh[1] = fh[2] = 0;
- fid->handle.handle_bytes = MAX_HANDLE_SZ;
- fanotify_get_fid(path, &fid->fsid, &fid->handle);
-
- tst_res(TINFO,
- "fid(%s) = %x.%x.%x.%x.%x...", path, fid->fsid.val[0],
- fid->fsid.val[1], fh[0], fh[1], fh[2]);
-}
#endif /* HAVE_NAME_TO_HANDLE_AT */
-#define INIT_FANOTIFY_GROUP_TYPE(t) \
- { FAN_ ## t, "FAN_" #t }
-
#define INIT_FANOTIFY_MARK_TYPE(t) \
{ FAN_MARK_ ## t, "FAN_MARK_" #t }
-static inline void require_fanotify_access_permissions_supported_by_kernel(void)
-{
- int fd;
-
- fd = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY);
-
- if (fanotify_mark(fd, FAN_MARK_ADD, FAN_ACCESS_PERM, AT_FDCWD, ".") < 0) {
- if (errno == EINVAL) {
- tst_brk(TCONF | TERRNO,
- "CONFIG_FANOTIFY_ACCESS_PERMISSIONS not configured in kernel?");
- } else {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark (%d, FAN_MARK_ADD, FAN_ACCESS_PERM, AT_FDCWD, \".\") failed", fd);
- }
- }
-
- SAFE_CLOSE(fd);
-}
-
-static inline int fanotify_events_supported_by_kernel(uint64_t mask)
-{
- int fd;
- int rval = 0;
-
- fd = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY);
-
- if (fanotify_mark(fd, FAN_MARK_ADD, mask, AT_FDCWD, ".") < 0) {
- if (errno == EINVAL) {
- rval = -1;
- } else {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, \".\") failed", fd);
- }
- }
-
- SAFE_CLOSE(fd);
-
- return rval;
-}
-
-/*
- * @return 0: fanotify supported both in kernel and on tested filesystem
- * @return -1: @flags not supported in kernel
- * @return -2: @flags not supported on tested filesystem (tested if @fname is not NULL)
- */
-static inline int fanotify_init_flags_supported_on_fs(unsigned int flags, const char *fname)
-{
- int fd;
- int rval = 0;
-
- fd = fanotify_init(flags, O_RDONLY);
-
- if (fd < 0) {
- if (errno == ENOSYS)
- tst_brk(TCONF, "fanotify not configured in kernel");
-
- if (errno == EINVAL)
- return -1;
-
- tst_brk(TBROK | TERRNO, "fanotify_init() failed");
- }
-
- if (fname && fanotify_mark(fd, FAN_MARK_ADD, FAN_ACCESS, AT_FDCWD, fname) < 0) {
- if (errno == ENODEV || errno == EOPNOTSUPP || errno == EXDEV) {
- rval = -2;
- } else {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, %s) failed",
- fd, fname);
- }
- }
-
- SAFE_CLOSE(fd);
-
- return rval;
-}
-
-static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags)
-{
- return fanotify_init_flags_supported_on_fs(flags, NULL);
-}
-
-typedef void (*tst_res_func_t)(const char *file, const int lineno,
- int ttype, const char *fmt, ...);
-
-static inline void fanotify_init_flags_err_msg(const char *flags_str,
- const char *file, const int lineno, tst_res_func_t res_func, int fail)
-{
- if (fail == -1)
- res_func(file, lineno, TCONF,
- "%s not supported in kernel?", flags_str);
- if (fail == -2)
- res_func(file, lineno, TCONF,
- "%s not supported on %s filesystem",
- flags_str, tst_device->fs_type);
-}
-
-#define FANOTIFY_INIT_FLAGS_ERR_MSG(flags, fail) \
- fanotify_init_flags_err_msg(#flags, __FILE__, __LINE__, tst_res_, (fail))
-
-#define REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(flags, fname) do { \
- fanotify_init_flags_err_msg(#flags, __FILE__, __LINE__, tst_brk_, \
- fanotify_init_flags_supported_on_fs(flags, fname)); \
- } while (0)
-
-static inline int fanotify_mark_supported_by_kernel(uint64_t flag)
-{
- int fd;
- int rval = 0;
-
- fd = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY);
-
- if (fanotify_mark(fd, FAN_MARK_ADD | flag, FAN_ACCESS, AT_FDCWD, ".") < 0) {
- if (errno == EINVAL) {
- rval = -1;
- } else {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark (%d, FAN_MARK_ADD, ..., FAN_ACCESS, AT_FDCWD, \".\") failed", fd);
- }
- }
-
- SAFE_CLOSE(fd);
-
- return rval;
-}
-
#endif /* __FANOTIFY_H__ */
diff --git a/testcases/kernel/syscalls/fanotify/fanotify01.c b/testcases/kernel/syscalls/fanotify/fanotify01.c
index 6b64e5b13..03e453f41 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify01.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify01.c
@@ -3,27 +3,26 @@
* Copyright (c) 2013 SUSE. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
+ *
+ * DESCRIPTION
+ * Check that fanotify work for a file
*/
-
-/*\
- * [Description]
- * Check that fanotify work for a file.
- */
-
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/syscall.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
@@ -75,8 +74,6 @@ static struct tcase {
static char fname[BUF_SIZE];
static char buf[BUF_SIZE];
static int fd_notify;
-static int fan_report_fid_unsupported;
-static int filesystem_mark_unsupported;
static unsigned long long event_set[EVENT_MAX];
@@ -91,21 +88,33 @@ static void test_fanotify(unsigned int n)
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
- if (fan_report_fid_unsupported && (tc->init_flags & FAN_REPORT_FID)) {
- FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_FID, fan_report_fid_unsupported);
- return;
+ fd_notify = fanotify_init(tc->init_flags, O_RDONLY);
+ if (fd_notify < 0) {
+ if (errno == EINVAL &&
+ (tc->init_flags & FAN_REPORT_FID)) {
+ tst_res(TCONF,
+ "FAN_REPORT_FID not supported in kernel?");
+ return;
+ }
+ tst_brk(TBROK | TERRNO,
+ "fanotify_init (0x%x, O_RDONLY) "
+ "failed", tc->init_flags);
}
- if (filesystem_mark_unsupported && mark->flag == FAN_MARK_FILESYSTEM) {
- tst_res(TCONF, "FAN_MARK_FILESYSTEM not supported in kernel?");
- return;
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag,
+ FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN,
+ AT_FDCWD, fname) < 0) {
+ if (errno == EINVAL && mark->flag == FAN_MARK_FILESYSTEM) {
+ tst_res(TCONF,
+ "FAN_MARK_FILESYSTEM not supported in kernel?");
+ return;
+ }
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD, FAN_ACCESS | %s | "
+ "FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, %s) "
+ "failed", fd_notify, mark->name, fname);
}
- fd_notify = SAFE_FANOTIFY_INIT(tc->init_flags, O_RDONLY);
-
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | mark->flag,
- FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, fname);
-
/*
* generate sequence of events
*/
@@ -152,9 +161,14 @@ static void test_fanotify(unsigned int n)
*/
/* Ignore access events */
- SAFE_FANOTIFY_MARK(fd_notify,
+ if (fanotify_mark(fd_notify,
FAN_MARK_ADD | mark->flag | FAN_MARK_IGNORED_MASK,
- FAN_ACCESS, AT_FDCWD, fname);
+ FAN_ACCESS, AT_FDCWD, fname) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD | %s | "
+ "FAN_MARK_IGNORED_MASK, FAN_ACCESS, AT_FDCWD, %s) "
+ "failed", fd_notify, mark->name, fname);
+ }
fd = SAFE_OPEN(fname, O_RDWR);
event_set[tst_count] = FAN_OPEN;
@@ -170,7 +184,7 @@ static void test_fanotify(unsigned int n)
EVENT_BUF_LEN - len);
len += ret;
- SAFE_LSEEK(fd, 0, SEEK_SET);
+ lseek(fd, 0, SEEK_SET);
/* Generate modify event to clear ignore mask */
SAFE_WRITE(1, fd, fname, 1);
event_set[tst_count] = FAN_MODIFY;
@@ -197,9 +211,15 @@ static void test_fanotify(unsigned int n)
* Now ignore open & close events regardless of file
* modifications
*/
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | mark->flag |
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag |
FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY,
- FAN_OPEN | FAN_CLOSE, AT_FDCWD, fname);
+ FAN_OPEN | FAN_CLOSE, AT_FDCWD, fname) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD | %s | "
+ "FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY, "
+ "FAN_OPEN | FAN_CLOSE, AT_FDCWD, %s) failed",
+ fd_notify, mark->name, fname);
+ }
/* This event should be ignored */
fd = SAFE_OPEN(fname, O_RDWR);
@@ -220,9 +240,15 @@ static void test_fanotify(unsigned int n)
len += ret;
/* Now remove open and close from ignored mask */
- SAFE_FANOTIFY_MARK(fd_notify,
+ if (fanotify_mark(fd_notify,
FAN_MARK_REMOVE | mark->flag | FAN_MARK_IGNORED_MASK,
- FAN_OPEN | FAN_CLOSE, AT_FDCWD, fname);
+ FAN_OPEN | FAN_CLOSE, AT_FDCWD, fname) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_REMOVE | %s | "
+ "FAN_MARK_IGNORED_MASK, FAN_OPEN | FAN_CLOSE, "
+ "AT_FDCWD, %s) failed", fd_notify,
+ mark->name, fname);
+ }
SAFE_CLOSE(fd);
event_set[tst_count] = FAN_CLOSE_WRITE;
@@ -318,9 +344,14 @@ pass:
}
/* Remove mark to clear FAN_MARK_IGNORED_SURV_MODIFY */
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_REMOVE | mark->flag,
+ if (fanotify_mark(fd_notify, FAN_MARK_REMOVE | mark->flag,
FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN,
- AT_FDCWD, fname);
+ AT_FDCWD, fname) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_REMOVE | %s, FAN_ACCESS | "
+ "FAN_MODIFY | FAN_CLOSE | FAN_OPEN, AT_FDCWD, %s) "
+ "failed", fd_notify, mark->name, fname);
+ }
SAFE_CLOSE(fd_notify);
}
@@ -335,9 +366,6 @@ static void setup(void)
sprintf(fname, MOUNT_PATH"/tfile_%d", getpid());
SAFE_FILE_PRINTF(fname, "1");
-
- fan_report_fid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_FID, fname);
- filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM);
}
static void cleanup(void)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify02.c b/testcases/kernel/syscalls/fanotify/fanotify02.c
index eb40a2e24..c578e0ae8 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify02.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify02.c
@@ -3,27 +3,26 @@
* Copyright (c) 2013 SUSE. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
+ *
+ * DESCRIPTION
+ * Check that fanotify work for children of a directory
*/
-
-/*\
- * [Description]
- * Check that fanotify work for children of a directory.
- */
-
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/syscall.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
@@ -47,9 +46,16 @@ void test01(void)
int tst_count = 0;
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD, FAN_ACCESS |
- FAN_MODIFY | FAN_CLOSE | FAN_OPEN | FAN_EVENT_ON_CHILD |
- FAN_ONDIR, AT_FDCWD, ".");
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD, FAN_ACCESS |
+ FAN_MODIFY | FAN_CLOSE | FAN_OPEN |
+ FAN_EVENT_ON_CHILD | FAN_ONDIR, AT_FDCWD,
+ ".") < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD, FAN_ACCESS | "
+ "FAN_MODIFY | FAN_CLOSE | FAN_OPEN | "
+ "FAN_EVENT_ON_CHILD | FAN_ONDIR, AT_FDCWD, '.') "
+ "failed", fd_notify);
+ }
/*
* generate sequence of events
@@ -96,8 +102,13 @@ void test01(void)
/*
* now remove child mark
*/
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_REMOVE,
- FAN_EVENT_ON_CHILD, AT_FDCWD, ".");
+ if (fanotify_mark(fd_notify, FAN_MARK_REMOVE,
+ FAN_EVENT_ON_CHILD, AT_FDCWD, ".") < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK REMOVE, "
+ "FAN_EVENT_ON_CHILD, AT_FDCWD, '.') failed",
+ fd_notify);
+ }
/*
* Do something to verify events didn't get generated
diff --git a/testcases/kernel/syscalls/fanotify/fanotify03.c b/testcases/kernel/syscalls/fanotify/fanotify03.c
index 26d17e64d..1ef1c206b 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify03.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify03.c
@@ -3,13 +3,10 @@
* Copyright (c) 2013 SUSE. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
+ *
+ * DESCRIPTION
+ * Check that fanotify permission events work
*/
-
-/*\
- * [Description]
- * Check that fanotify permission events work.
- */
-
#define _GNU_SOURCE
#include "config.h"
@@ -17,6 +14,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <sys/wait.h>
#include <errno.h>
#include <string.h>
@@ -24,9 +22,10 @@
#include <sys/syscall.h>
#include <stdlib.h>
#include "tst_test.h"
+#include "fanotify.h"
-#ifdef HAVE_SYS_FANOTIFY_H
-# include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
@@ -49,14 +48,18 @@ static volatile int fd_notify;
static pid_t child_pid;
static char event_buf[EVENT_BUF_LEN];
-static int exec_events_unsupported;
-static int filesystem_mark_unsupported;
+static int support_exec_events;
struct event {
unsigned long long mask;
unsigned int response;
};
+/*
+ * Ensure to keep the first FAN_OPEN_EXEC_PERM test case before the first
+ * MARK_TYPE(FILESYSTEM) in order to allow for correct detection between
+ * exec events not supported and filesystem marks not supported.
+ */
static struct tcase {
const char *tname;
struct fanotify_mark_type mark;
@@ -131,15 +134,17 @@ static void generate_events(void)
/*
* Generate sequence of events
*/
- fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0700);
-
- SAFE_WRITE(0, fd, fname, 1);
- SAFE_LSEEK(fd, 0, SEEK_SET);
+ if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1)
+ exit(1);
+ if (write(fd, fname, 1) == -1)
+ exit(2);
+ lseek(fd, 0, SEEK_SET);
if (read(fd, buf, BUF_SIZE) != -1)
exit(3);
- SAFE_CLOSE(fd);
+ if (close(fd) == -1)
+ exit(4);
if (execve(FILE_EXEC_PATH, argv, environ) != -1)
exit(5);
@@ -152,7 +157,7 @@ static void child_handler(int tmp)
* Close notification fd so that we cannot block while reading
* from it
*/
- SAFE_CLOSE(fd_notify);
+ close(fd_notify);
fd_notify = -1;
}
@@ -173,7 +178,7 @@ static void run_child(void)
if (child_pid == 0) {
/* Child will generate events now */
- SAFE_CLOSE(fd_notify);
+ close(fd_notify);
generate_events();
exit(0);
}
@@ -207,22 +212,44 @@ static int setup_mark(unsigned int n)
char *const files[] = {fname, FILE_EXEC_PATH};
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
-
- if (exec_events_unsupported && tc->mask & FAN_OPEN_EXEC_PERM) {
- tst_res(TCONF, "FAN_OPEN_EXEC_PERM not supported in kernel?");
- return -1;
- }
-
- if (filesystem_mark_unsupported && mark->flag == FAN_MARK_FILESYSTEM) {
- tst_res(TCONF, "FAN_MARK_FILESYSTEM not supported in kernel?");
- return -1;
- }
-
fd_notify = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY);
for (; i < ARRAY_SIZE(files); i++) {
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | mark->flag,
- tc->mask, AT_FDCWD, files[i]);
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag,
+ tc->mask, AT_FDCWD, files[i]) < 0) {
+ if (errno == EINVAL &&
+ (tc->mask & FAN_OPEN_EXEC_PERM &&
+ !support_exec_events)) {
+ tst_res(TCONF,
+ "FAN_OPEN_EXEC_PERM not supported in "
+ "kernel?");
+ return -1;
+ } else if (errno == EINVAL &&
+ mark->flag == FAN_MARK_FILESYSTEM) {
+ tst_res(TCONF,
+ "FAN_MARK_FILESYSTEM not supported in "
+ "kernel?");
+ return -1;
+ } else if (errno == EINVAL) {
+ tst_brk(TCONF | TERRNO,
+ "CONFIG_FANOTIFY_ACCESS_PERMISSIONS "
+ "not configured in kernel?");
+ } else {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | %s, "
+ "FAN_ACCESS_PERM | FAN_OPEN_PERM, "
+ "AT_FDCWD, %s) failed.",
+ fd_notify, mark->name, fname);
+ }
+ } else {
+ /*
+ * To distinguish between perm not supported, exec
+ * events not supported and filesystem mark not
+ * supported.
+ */
+ if (tc->mask & FAN_OPEN_EXEC_PERM)
+ support_exec_events = 1;
+ }
}
return 0;
@@ -320,11 +347,6 @@ static void test_fanotify(unsigned int n)
static void setup(void)
{
- require_fanotify_access_permissions_supported_by_kernel();
-
- filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM);
- exec_events_unsupported = fanotify_events_supported_by_kernel(FAN_OPEN_EXEC_PERM);
-
sprintf(fname, MOUNT_PATH"/fname_%d", getpid());
SAFE_FILE_PRINTF(fname, "1");
diff --git a/testcases/kernel/syscalls/fanotify/fanotify04.c b/testcases/kernel/syscalls/fanotify/fanotify04.c
index b23d7a9a3..722ad5d41 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify04.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify04.c
@@ -3,11 +3,9 @@
* Copyright (c) 2013 SUSE. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
- */
-
-/*\
- * [Description]
- * Check various fanotify special flags.
+ *
+ * DESCRIPTION
+ * Check various fanotify special flags
*/
#define _GNU_SOURCE
@@ -16,14 +14,16 @@
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/syscall.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
@@ -77,8 +77,13 @@ static void check_mark(char *file, unsigned long long flag, char *flagstr,
if (test_event)
test_event(file);
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_REMOVE | flag,
- FAN_OPEN, AT_FDCWD, file);
+ if (fanotify_mark(fd_notify, FAN_MARK_REMOVE | flag,
+ FAN_OPEN, AT_FDCWD, file) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_REMOVE | %s, "
+ "FAN_OPEN, AT_FDCWD, '%s') failed",
+ fd_notify, flagstr, file);
+ }
}
}
@@ -186,14 +191,29 @@ void test01(void)
CHECK_MARK(sname, 0, 0, test_open_file);
/* Verify FAN_MARK_FLUSH destroys all inode marks */
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD, fname);
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD, FAN_OPEN | FAN_ONDIR,
- AT_FDCWD, dir);
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD,
+ FAN_OPEN, AT_FDCWD, fname) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD, FAN_OPEN, "
+ "AT_FDCWD, '%s') failed", fd_notify, fname);
+ }
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD,
+ FAN_OPEN | FAN_ONDIR, AT_FDCWD, dir) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD, FAN_OPEN | "
+ "FAN_ONDIR, AT_FDCWD, '%s') failed", fd_notify,
+ dir);
+ }
open_file(fname);
verify_event(S_IFREG);
open_dir(dir);
verify_event(S_IFDIR);
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_FLUSH, 0, AT_FDCWD, ".");
+ if (fanotify_mark(fd_notify, FAN_MARK_FLUSH,
+ 0, AT_FDCWD, ".") < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_FLUSH, 0, "
+ "AT_FDCWD, '.') failed", fd_notify);
+ }
open_dir(dir);
verify_no_event();
diff --git a/testcases/kernel/syscalls/fanotify/fanotify05.c b/testcases/kernel/syscalls/fanotify/fanotify05.c
index 1c683c4c0..e53cc333a 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify05.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify05.c
@@ -3,129 +3,54 @@
* Copyright (c) 2014 SUSE Linux. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
- */
-
-/*\
- * [Description]
- * Check that fanotify overflow event is properly generated.
*
- * [Algorithm]
- * Generate enough events without reading them and check that overflow
- * event is generated.
+ * DESCRIPTION
+ * Check that fanotify overflow event is properly generated
+ *
+ * ALGORITHM
+ * Generate enough events without reading them and check that overflow
+ * event is generated.
*/
-
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
-#include <libgen.h>
-#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include "tst_test.h"
-#include "tst_timer.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
-#define MOUNT_PATH "fs_mnt"
-#define FNAME_PREFIX "fname_"
-#define FNAME_PREFIX_LEN 6
-#define PATH_PREFIX MOUNT_PATH "/" FNAME_PREFIX
-
-#define SYSFS_MAX_EVENTS "/proc/sys/fs/fanotify/max_queued_events"
-
-/* In older kernels this limit is fixed in kernel */
-#define DEFAULT_MAX_EVENTS 16384
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
-static int max_events;
+#define MOUNT_PATH "fs_mnt"
-static struct tcase {
- const char *tname;
- unsigned int init_flags;
-} tcases[] = {
- {
- "Limited queue",
- FAN_CLASS_NOTIF,
- },
- {
- "Unlimited queue",
- FAN_CLASS_NOTIF | FAN_UNLIMITED_QUEUE,
- },
-};
+/* Currently this is fixed in kernel... */
+#define MAX_EVENTS 16384
#define BUF_SIZE 256
static char fname[BUF_SIZE];
-static char symlnk[BUF_SIZE];
-static char fdpath[BUF_SIZE];
static int fd, fd_notify;
struct fanotify_event_metadata event;
-static void event_res(struct fanotify_event_metadata *event, int i)
+void test01(void)
{
- int len = 0;
- const char *filename;
- sprintf(symlnk, "/proc/self/fd/%d", event->fd);
- len = readlink(symlnk, fdpath, sizeof(fdpath));
- if (len < 0)
- len = 0;
- fdpath[len] = 0;
- filename = basename(fdpath);
- if (len > FNAME_PREFIX_LEN && atoi(filename + FNAME_PREFIX_LEN) != i) {
- tst_res(TFAIL, "Got event #%d out of order filename=%s", i, filename);
- } else if (i == 0) {
- tst_res(TINFO, "Got event #%d filename=%s", i, filename);
- }
-}
-
-static void generate_events(int open_flags, int num_files)
-{
- long long elapsed_ms;
int i;
-
- tst_timer_start(CLOCK_MONOTONIC);
-
- for (i = 0; i < num_files; i++) {
- sprintf(fname, PATH_PREFIX "%d", i);
- fd = SAFE_OPEN(fname, open_flags, 0644);
- SAFE_CLOSE(fd);
- }
-
- tst_timer_stop();
-
- elapsed_ms = tst_timer_elapsed_ms();
-
- tst_res(TINFO, "%s %d files in %llims",
- (open_flags & O_CREAT) ? "Created" : "Opened", i, elapsed_ms);
-}
-
-static void test_fanotify(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int len, nevents = 0, got_overflow = 0;
- int num_files = max_events + 1;
- int expect_overflow = !(tc->init_flags & FAN_UNLIMITED_QUEUE);
-
- tst_res(TINFO, "Test #%d: %s", n, tc->tname);
-
- fd_notify = SAFE_FANOTIFY_INIT(tc->init_flags | FAN_NONBLOCK, O_RDONLY);
-
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_MOUNT | FAN_MARK_ADD, FAN_OPEN,
- AT_FDCWD, MOUNT_PATH);
-
- /*
- * Generate events on unique files so they won't be merged
- */
- generate_events(O_RDWR | O_CREAT, num_files);
+ int len;
/*
- * Generate more events on the same files that me be merged
+ * generate events
*/
- generate_events(O_RDONLY, num_files);
+ for (i = 0; i < MAX_EVENTS + 1; i++) {
+ sprintf(fname, MOUNT_PATH"/fname_%d", i);
+ fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0644);
+ SAFE_CLOSE(fd);
+ }
while (1) {
/*
@@ -133,24 +58,17 @@ static void test_fanotify(unsigned int n)
*/
len = read(fd_notify, &event, sizeof(event));
if (len < 0) {
- if (errno != EAGAIN) {
- tst_brk(TBROK | TERRNO,
- "read of notification event failed");
+ if (errno == -EAGAIN) {
+ tst_res(TFAIL, "Overflow event not "
+ "generated!\n");
+ break;
}
- if (!got_overflow)
- tst_res(expect_overflow ? TFAIL : TPASS, "Overflow event not generated!\n");
+ tst_brk(TBROK | TERRNO,
+ "read of notification event failed");
break;
}
- if (event.fd != FAN_NOFD) {
- /*
- * Verify that events generated on unique files
- * are received by the same order they were generated.
- */
- if (nevents < num_files)
- event_res(&event, nevents);
+ if (event.fd != FAN_NOFD)
close(event.fd);
- }
- nevents++;
/*
* check events
@@ -166,40 +84,36 @@ static void test_fanotify(unsigned int n)
break;
}
if (event.mask == FAN_Q_OVERFLOW) {
- if (got_overflow || event.fd != FAN_NOFD) {
+ if (event.fd != FAN_NOFD) {
tst_res(TFAIL,
- "%s overflow event: "
+ "invalid overflow event: "
"mask=%llx pid=%u fd=%d",
- got_overflow ? "unexpected" : "invalid",
(unsigned long long)event.mask,
(unsigned)event.pid,
event.fd);
break;
}
- tst_res(expect_overflow ? TPASS : TFAIL,
- "Got an overflow event: pid=%u fd=%d",
+ tst_res(TPASS,
+ "got event: mask=%llx pid=%u fd=%d",
+ (unsigned long long)event.mask,
(unsigned)event.pid, event.fd);
- got_overflow = 1;
+ break;
}
}
- tst_res(TINFO, "Got %d events", nevents);
- SAFE_CLOSE(fd_notify);
}
static void setup(void)
{
- int fd;
-
- /* Check for kernel fanotify support */
- fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
- SAFE_CLOSE(fd);
-
- /* In older kernels this limit is fixed in kernel */
- if (access(SYSFS_MAX_EVENTS, F_OK) && errno == ENOENT)
- max_events = DEFAULT_MAX_EVENTS;
- else
- SAFE_FILE_SCANF(SYSFS_MAX_EVENTS, "%d", &max_events);
- tst_res(TINFO, "max_queued_events=%d", max_events);
+ fd_notify = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF | FAN_NONBLOCK,
+ O_RDONLY);
+
+ if (fanotify_mark(fd_notify, FAN_MARK_MOUNT | FAN_MARK_ADD, FAN_OPEN,
+ AT_FDCWD, MOUNT_PATH) < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_MOUNT | FAN_MARK_ADD, "
+ "FAN_OPEN, AT_FDCWD, \".\") failed",
+ fd_notify);
+ }
}
static void cleanup(void)
@@ -209,8 +123,7 @@ static void cleanup(void)
}
static struct tst_test test = {
- .test = test_fanotify,
- .tcnt = ARRAY_SIZE(tcases),
+ .test_all = test01,
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
diff --git a/testcases/kernel/syscalls/fanotify/fanotify06.c b/testcases/kernel/syscalls/fanotify/fanotify06.c
index 30055da4b..99e312a4f 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify06.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify06.c
@@ -3,14 +3,11 @@
* Copyright (c) 2014 SUSE. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
- */
-
-/*\
- * [Description]
- * Check that fanotify properly merges ignore mask of an inode and mountpoint.
- */
-
-/*
+ *
+ * DESCRIPTION
+ * Check that fanotify properly merges ignore mask of an inode and
+ * mountpoint.
+ *
* This is a regression test for:
*
* commit 8edc6e1688fc8f02c8c1f53a2ec4928cb1055f4d
@@ -27,22 +24,23 @@
*
* ovl: do not generate duplicate fsnotify events for "fake" path
*/
-
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
@@ -80,6 +78,7 @@ static struct tcase {
static void create_fanotify_groups(void)
{
unsigned int p, i;
+ int ret;
for (p = 0; p < FANOTIFY_PRIORITIES; p++) {
for (i = 0; i < GROUPS_PER_PRIO; i++) {
@@ -88,20 +87,32 @@ static void create_fanotify_groups(void)
O_RDONLY);
/* Add mount mark for each group */
- SAFE_FANOTIFY_MARK(fd_notify[p][i],
+ ret = fanotify_mark(fd_notify[p][i],
FAN_MARK_ADD | FAN_MARK_MOUNT,
FAN_MODIFY,
AT_FDCWD, fname);
-
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | "
+ "FAN_MARK_MOUNT, FAN_MODIFY, AT_FDCWD,"
+ " %s) failed", fd_notify[p][i], fname);
+ }
/* Add ignore mark for groups with higher priority */
if (p == 0)
continue;
-
- SAFE_FANOTIFY_MARK(fd_notify[p][i],
+ ret = fanotify_mark(fd_notify[p][i],
FAN_MARK_ADD |
FAN_MARK_IGNORED_MASK |
FAN_MARK_IGNORED_SURV_MODIFY,
FAN_MODIFY, AT_FDCWD, fname);
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | "
+ "FAN_MARK_IGNORED_MASK | "
+ "FAN_MARK_IGNORED_SURV_MODIFY, "
+ "FAN_MODIFY, AT_FDCWD, %s) failed",
+ fd_notify[p][i], fname);
+ }
}
}
}
diff --git a/testcases/kernel/syscalls/fanotify/fanotify07.c b/testcases/kernel/syscalls/fanotify/fanotify07.c
index cc56d9019..c2e185710 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify07.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify07.c
@@ -3,21 +3,17 @@
* Copyright (c) 2017 SUSE. All Rights Reserved.
*
* Started by Jan Kara <jack@suse.cz>
- */
-
-/*\
- * [Description]
- * Check that fanotify permission events are handled properly on instance destruction.
- */
-
-/*
+ *
+ * DESCRIPTION
+ * Check that fanotify permission events are handled properly on instance
+ * destruction.
+ *
* Kernel crashes should be fixed by:
* 96d41019e3ac "fanotify: fix list corruption in fanotify_get_response()"
*
* Kernel hangs should be fixed by:
* 05f0e38724e8 "fanotify: Release SRCU lock when waiting for userspace response"
*/
-
#define _GNU_SOURCE
#include "config.h"
@@ -34,10 +30,11 @@
#include <sys/syscall.h>
#include "tst_test.h"
#include "lapi/syscalls.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define BUF_SIZE 256
static char fname[BUF_SIZE];
static char buf[BUF_SIZE];
@@ -57,12 +54,14 @@ static void generate_events(void)
/*
* generate sequence of events
*/
- fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0700);
+ if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1)
+ exit(1);
/* Run until killed... */
while (1) {
- SAFE_LSEEK(fd, 0, SEEK_SET);
- SAFE_READ(0, fd, buf, BUF_SIZE);
+ lseek(fd, 0, SEEK_SET);
+ if (read(fd, buf, BUF_SIZE) == -1)
+ exit(3);
}
}
@@ -74,7 +73,7 @@ static void run_children(void)
child_pid[i] = SAFE_FORK();
if (!child_pid[i]) {
/* Child will generate events now */
- SAFE_CLOSE(fd_notify);
+ close(fd_notify);
generate_events();
exit(0);
}
@@ -103,7 +102,20 @@ static int setup_instance(void)
int fd;
fd = SAFE_FANOTIFY_INIT(FAN_CLASS_CONTENT, O_RDONLY);
- SAFE_FANOTIFY_MARK(fd, FAN_MARK_ADD, FAN_ACCESS_PERM, AT_FDCWD, fname);
+
+ if (fanotify_mark(fd, FAN_MARK_ADD, FAN_ACCESS_PERM, AT_FDCWD,
+ fname) < 0) {
+ close(fd);
+ if (errno == EINVAL) {
+ tst_brk(TCONF | TERRNO,
+ "CONFIG_FANOTIFY_ACCESS_PERMISSIONS not "
+ "configured in kernel?");
+ } else {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, FAN_MARK_ADD, FAN_ACCESS_PERM, "
+ "AT_FDCWD, %s) failed.", fd, fname);
+ }
+ }
return fd;
}
@@ -161,8 +173,9 @@ static void test_fanotify(void)
* unanswered fanotify events block notification subsystem.
*/
newfd = setup_instance();
-
- SAFE_CLOSE(newfd);
+ if (close(newfd)) {
+ tst_brk(TBROK | TERRNO, "close(%d) failed", newfd);
+ }
tst_res(TPASS, "second instance destroyed successfully");
@@ -182,8 +195,6 @@ static void test_fanotify(void)
static void setup(void)
{
- require_fanotify_access_permissions_supported_by_kernel();
-
sprintf(fname, "fname_%d", getpid());
SAFE_FILE_PRINTF(fname, "%s", fname);
}
diff --git a/testcases/kernel/syscalls/fanotify/fanotify08.c b/testcases/kernel/syscalls/fanotify/fanotify08.c
index f86b56752..a4031b4ad 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify08.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify08.c
@@ -3,27 +3,26 @@
* Copyright (c) 2017 RedHat. All Rights Reserved.
*
* Started by Xiong Zhou <xzhou@redhat.com>
+ *
+ * DESCRIPTION
+ * Sanity check fanotify_init flag FAN_CLOEXEC by fcntl.
*/
-
-/*\
- * [Description]
- * Sanity check fanotify_init flag FAN_CLOEXEC by fcntl.
- */
-
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/syscall.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
static int fd_notify;
static void test_init_bit(unsigned int fan_bit,
diff --git a/testcases/kernel/syscalls/fanotify/fanotify09.c b/testcases/kernel/syscalls/fanotify/fanotify09.c
index d622ff3a2..0f6a9e864 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify09.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify09.c
@@ -3,48 +3,37 @@
* Copyright (c) 2018 CTERA Networks. All Rights Reserved.
*
* Started by Amir Goldstein <amir73il@gmail.com>
- */
-
-/*\
- * [Description]
- * Check that fanotify handles events on children correctly when both parent and
- * subdir or mountpoint marks exist.
- */
-
-/*
+ *
+ * DESCRIPTION
+ * Check that fanotify handles events on children correctly when
+ * both inode and mountpoint marks exist.
+ *
* This is a regression test for commit 54a307ba8d3c:
*
* fanotify: fix logic of events on child
*
- * Test case #1 is a regression test for commit b469e7e47c8a:
+ * Test case #2 is a regression test for commit b469e7e47c8a:
*
* fanotify: fix handling of events on child sub-directory
- *
- * Test case #2 is a regression test for commit 55bf882c7f13:
- *
- * fanotify: fix merging marks masks with FAN_ONDIR
- *
- * Test case #5 is a regression test for commit 7372e79c9eb9:
- *
- * fanotify: fix logic of reporting name info with watched parent
*/
-
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <stdint.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
@@ -61,105 +50,68 @@ static int fd_notify[NUM_GROUPS];
static char event_buf[EVENT_BUF_LEN];
-#define MOUNT_PATH "fs_mnt"
#define MOUNT_NAME "mntpoint"
#define DIR_NAME "testdir"
-#define FILE2_NAME "testfile"
static int mount_created;
-static int fan_report_dfid_unsupported;
-
static struct tcase {
const char *tname;
- struct fanotify_mark_type mark;
unsigned int ondir;
- unsigned int report_name;
- const char *close_nowrite;
int nevents;
} tcases[] = {
{
- "Events on non-dir child with both parent and mount marks",
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
+ "Events on children with both inode and mount marks",
0,
- 0,
- DIR_NAME,
1,
},
{
- "Events on non-dir child and subdir with both parent and mount marks",
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- FAN_ONDIR,
- 0,
- DIR_NAME,
- 2,
- },
- {
- "Events on non-dir child and parent with both parent and mount marks",
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- FAN_ONDIR,
- 0,
- ".",
- 2,
- },
- {
- "Events on non-dir child and subdir with both parent and subdir marks",
- INIT_FANOTIFY_MARK_TYPE(INODE),
+ "Events on children and subdirs with both inode and mount marks",
FAN_ONDIR,
- 0,
- DIR_NAME,
- 2,
- },
- {
- "Events on non-dir children with both parent and mount marks",
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- 0,
- 0,
- FILE2_NAME,
- 2,
- },
- {
- "Events on non-dir child with both parent and mount marks and filename info",
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- 0,
- FAN_REPORT_DFID_NAME,
- FILE2_NAME,
2,
},
};
-static void create_fanotify_groups(struct tcase *tc)
+static void create_fanotify_groups(unsigned int ondir)
{
- struct fanotify_mark_type *mark = &tc->mark;
- unsigned int i, onchild, report_name, ondir = tc->ondir;
+ unsigned int i, onchild;
+ int ret;
for (i = 0; i < NUM_GROUPS; i++) {
- /*
- * The first group may request events with filename info.
- */
- report_name = (i == 0) ? tc->report_name : 0;
- fd_notify[i] = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF | report_name |
- FAN_NONBLOCK, O_RDONLY);
+ fd_notify[i] = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF |
+ FAN_NONBLOCK,
+ O_RDONLY);
- /*
- * Add subdir or mount mark for each group with CLOSE event,
- * but only the first group requests events on dir.
- */
+ /* Add mount mark for each group without MODIFY event */
onchild = (i == 0) ? FAN_EVENT_ON_CHILD | ondir : 0;
- SAFE_FANOTIFY_MARK(fd_notify[i],
- FAN_MARK_ADD | mark->flag,
+ ret = fanotify_mark(fd_notify[i],
+ FAN_MARK_ADD | FAN_MARK_MOUNT,
FAN_CLOSE_NOWRITE | onchild,
- AT_FDCWD, tc->close_nowrite);
-
+ AT_FDCWD, ".");
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | "
+ "FAN_MARK_MOUNT, FAN_MODIFY%s, AT_FDCWD,"
+ " '.') failed", fd_notify[i],
+ ondir ? " | FAN_ONDIR" : "");
+ }
/*
- * Add inode mark on parent for each group with MODIFY event,
- * but only the first group requests events on child.
+ * Add inode mark on parent for each group with MODIFY
+ * event, but only one group requests events on child.
* The one mark with FAN_EVENT_ON_CHILD is needed for
* setting the DCACHE_FSNOTIFY_PARENT_WATCHED dentry
* flag.
*/
- SAFE_FANOTIFY_MARK(fd_notify[i], FAN_MARK_ADD,
+ ret = fanotify_mark(fd_notify[i], FAN_MARK_ADD,
FAN_MODIFY | ondir | onchild,
AT_FDCWD, ".");
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD, "
+ "FAN_MODIFY%s%s, AT_FDCWD, '.') failed",
+ fd_notify[i],
+ ondir ? " | FAN_ONDIR" : "",
+ onchild ? " | FAN_EVENT_ON_CHILD" : "");
+ }
}
}
@@ -173,93 +125,51 @@ static void cleanup_fanotify_groups(void)
}
}
-static void event_res(int ttype, int group,
- struct fanotify_event_metadata *event,
- const char *filename)
-{
- if (event->fd != FAN_NOFD) {
- int len = 0;
- sprintf(symlnk, "/proc/self/fd/%d", event->fd);
- len = readlink(symlnk, fdpath, sizeof(fdpath));
- if (len < 0)
- len = 0;
- fdpath[len] = 0;
- filename = fdpath;
- }
- tst_res(ttype, "group %d got event: mask %llx pid=%u fd=%d filename=%s",
- group, (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename);
-}
-
-static const char *event_filename(struct fanotify_event_metadata *event)
-{
- struct fanotify_event_info_fid *event_fid;
- struct file_handle *file_handle;
- const char *filename, *end;
-
- if (event->event_len <= FAN_EVENT_METADATA_LEN)
- return "";
-
- event_fid = (struct fanotify_event_info_fid *)(event + 1);
- file_handle = (struct file_handle *)event_fid->handle;
- filename = (char *)file_handle->f_handle + file_handle->handle_bytes;
- end = (char *)event_fid + event_fid->hdr.len;
-
- /* End of event_fid could have name, zero padding, both or none */
- return (filename == end) ? "" : filename;
-}
-
static void verify_event(int group, struct fanotify_event_metadata *event,
- uint32_t expect, const char *expect_filename)
+ uint32_t expect)
{
- const char *filename = event_filename(event);
-
if (event->mask != expect) {
tst_res(TFAIL, "group %d got event: mask %llx (expected %llx) "
- "pid=%u fd=%d filename=%s", group, (unsigned long long)event->mask,
+ "pid=%u fd=%d", group, (unsigned long long)event->mask,
(unsigned long long)expect,
- (unsigned)event->pid, event->fd, filename);
+ (unsigned)event->pid, event->fd);
} else if (event->pid != getpid()) {
tst_res(TFAIL, "group %d got event: mask %llx pid=%u "
- "(expected %u) fd=%d filename=%s", group,
+ "(expected %u) fd=%d", group,
(unsigned long long)event->mask, (unsigned)event->pid,
- (unsigned)getpid(), event->fd, filename);
- } else if (strcmp(filename, expect_filename)) {
- tst_res(TFAIL, "group %d got event: mask %llx pid=%u "
- "fd=%d filename='%s' (expected '%s')", group,
- (unsigned long long)event->mask, (unsigned)event->pid,
- event->fd, filename, expect_filename);
+ (unsigned)getpid(), event->fd);
} else {
- event_res(TPASS, group, event, filename);
+ int len;
+ sprintf(symlnk, "/proc/self/fd/%d", event->fd);
+ len = readlink(symlnk, fdpath, sizeof(fdpath));
+ if (len < 0)
+ len = 0;
+ fdpath[len] = 0;
+ tst_res(TPASS, "group %d got event: mask %llx pid=%u fd=%d path=%s",
+ group, (unsigned long long)event->mask,
+ (unsigned)event->pid, event->fd, fdpath);
}
- if (event->fd != FAN_NOFD)
- SAFE_CLOSE(event->fd);
}
static void test_fanotify(unsigned int n)
{
int ret, dirfd;
unsigned int i;
- struct fanotify_event_metadata *event;
+ struct fanotify_event_metadata *event, *ev;
struct tcase *tc = &tcases[n];
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
- if (fan_report_dfid_unsupported && tc->report_name) {
- FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_DFID_NAME, fan_report_dfid_unsupported);
- return;
- }
-
- create_fanotify_groups(tc);
+ create_fanotify_groups(tc->ondir);
/*
* generate MODIFY event and no FAN_CLOSE_NOWRITE event.
*/
SAFE_FILE_PRINTF(fname, "1");
/*
- * generate FAN_CLOSE_NOWRITE event on a child, subdir or "."
+ * generate FAN_CLOSE_NOWRITE event on a child subdir.
*/
- dirfd = SAFE_OPEN(tc->close_nowrite, O_RDONLY);
+ dirfd = SAFE_OPEN(DIR_NAME, O_RDONLY);
if (dirfd >= 0)
SAFE_CLOSE(dirfd);
@@ -282,44 +192,33 @@ static void test_fanotify(unsigned int n)
ret, tc->nevents * (int)FAN_EVENT_METADATA_LEN);
}
event = (struct fanotify_event_metadata *)event_buf;
- verify_event(0, event, FAN_MODIFY, tc->report_name ? fname : "");
- event = FAN_EVENT_NEXT(event, ret);
- if (tc->nevents > 1) {
- verify_event(0, event, FAN_CLOSE_NOWRITE,
- tc->report_name ? (tc->ondir ? "." : tc->close_nowrite) : "");
- event = FAN_EVENT_NEXT(event, ret);
- }
- if (ret > 0) {
+ verify_event(0, event, FAN_MODIFY);
+ if (tc->ondir)
+ verify_event(0, event + 1, FAN_CLOSE_NOWRITE);
+ if (ret > tc->nevents * (int)FAN_EVENT_METADATA_LEN) {
tst_res(TFAIL,
- "first group got more than %d events (%d bytes)",
- tc->nevents, ret);
+ "first group got more than %d events (%d > %d)",
+ tc->nevents, ret,
+ tc->nevents * (int)FAN_EVENT_METADATA_LEN);
}
/* Close all file descriptors of read events */
- for (; FAN_EVENT_OK(event, ret); FAN_EVENT_NEXT(event, ret)) {
- if (event->fd != FAN_NOFD)
- SAFE_CLOSE(event->fd);
+ for (ev = event; ret >= (int)FAN_EVENT_METADATA_LEN; ev++) {
+ if (ev->fd != FAN_NOFD)
+ SAFE_CLOSE(ev->fd);
+ ret -= (int)FAN_EVENT_METADATA_LEN;
}
/*
* Then verify the rest of the groups did not get the MODIFY event and
- * got the FAN_CLOSE_NOWRITE event only on a non-directory.
+ * did not get the FAN_CLOSE_NOWRITE event on subdir.
*/
for (i = 1; i < NUM_GROUPS; i++) {
- ret = read(fd_notify[i], event_buf, EVENT_BUF_LEN);
+ ret = read(fd_notify[i], event_buf, FAN_EVENT_METADATA_LEN);
if (ret > 0) {
- uint32_t expect = 0;
-
- if (tc->nevents > 1 && !tc->ondir)
- expect = FAN_CLOSE_NOWRITE;
-
- event = (struct fanotify_event_metadata *)event_buf;
- verify_event(i, event, expect, "");
- event = FAN_EVENT_NEXT(event, ret);
-
- for (; FAN_EVENT_OK(event, ret); FAN_EVENT_NEXT(event, ret)) {
- if (event->fd != FAN_NOFD)
- SAFE_CLOSE(event->fd);
- }
+ tst_res(TFAIL, "group %d got event", i);
+ verify_event(i, event, FAN_CLOSE_NOWRITE);
+ if (event->fd != FAN_NOFD)
+ SAFE_CLOSE(event->fd);
continue;
}
@@ -339,18 +238,14 @@ static void test_fanotify(unsigned int n)
static void setup(void)
{
- fan_report_dfid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME,
- MOUNT_PATH);
-
SAFE_MKDIR(MOUNT_NAME, 0755);
- SAFE_MOUNT(MOUNT_PATH, MOUNT_NAME, "none", MS_BIND, NULL);
+ SAFE_MOUNT(MOUNT_NAME, MOUNT_NAME, "none", MS_BIND, NULL);
mount_created = 1;
SAFE_CHDIR(MOUNT_NAME);
SAFE_MKDIR(DIR_NAME, 0755);
sprintf(fname, "tfile_%d", getpid());
SAFE_FILE_PRINTF(fname, "1");
- SAFE_FILE_PRINTF(FILE2_NAME, "1");
}
static void cleanup(void)
@@ -368,14 +263,11 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcases),
.setup = setup,
.cleanup = cleanup,
- .mount_device = 1,
- .mntpoint = MOUNT_PATH,
+ .needs_tmpdir = 1,
.needs_root = 1,
.tags = (const struct tst_tag[]) {
{"linux-git", "54a307ba8d3c"},
{"linux-git", "b469e7e47c8a"},
- {"linux-git", "55bf882c7f13"},
- {"linux-git", "7372e79c9eb9"},
{}
}
};
diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c
index 92e4d3ff3..ef0807761 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify10.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
@@ -5,31 +5,17 @@
*
* Started by Jan Kara <jack@suse.cz>
* Forked from fanotify06.c by Amir Goldstein <amir73il@gmail.com>
- */
-
-/*\
- * [Description]
- * Check that fanotify properly merges ignore mask of a mount mark
- * with a mask of an inode mark on the same group. Unlike the
- * prototype test fanotify06, do not use FAN_MODIFY event for the
- * test mask, because it hides the bug.
- */
-
-/*
- * This is a regression test for commit:
- *
- * 9bdda4e9cf2d fsnotify: fix ignore mask logic in fsnotify()
*
- * Test case #16 is a regression test for commit:
+ * DESCRIPTION
+ * Check that fanotify properly merges ignore mask of a mount mark
+ * with a mask of an inode mark on the same group. Unlike the
+ * prototype test fanotify06, do not use FAN_MODIFY event for the
+ * test mask, because it hides the bug.
*
- * 2f02fd3fa13e fanotify: fix ignore mask logic for events on child...
- *
- * Test cases with 'ignored_onchild' are regression tests for commit
- * (from v5.9, unlikely to be backported thus not in .tags):
+ * This is a regression test for commit:
*
- * 497b0c5a7c06 fsnotify: send event to parent and child with single...
+ * 9bdda4e9cf2d fsnotify: fix ignore mask logic in fsnotify()
*/
-
#define _GNU_SOURCE
#include "config.h"
@@ -37,40 +23,36 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
/* size of the event structure, not counting name */
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
/* reasonable guess as to size of 1024 events */
#define EVENT_BUF_LEN (EVENT_MAX * EVENT_SIZE)
-static unsigned int fanotify_class[] = {
+static unsigned int fanotify_prio[] = {
FAN_CLASS_PRE_CONTENT,
FAN_CLASS_CONTENT,
- FAN_CLASS_NOTIF,
- /* Reporting dfid+name+fid merges events similar to reporting fd */
- FAN_REPORT_DFID_NAME_FID,
+ FAN_CLASS_NOTIF
};
-#define NUM_CLASSES ARRAY_SIZE(fanotify_class)
-#define NUM_PRIORITIES 3
+#define FANOTIFY_PRIORITIES ARRAY_SIZE(fanotify_prio)
#define GROUPS_PER_PRIO 3
-static int fd_notify[NUM_CLASSES][GROUPS_PER_PRIO];
+static int fd_notify[FANOTIFY_PRIORITIES][GROUPS_PER_PRIO];
static char event_buf[EVENT_BUF_LEN];
-static int exec_events_unsupported;
-static int fan_report_dfid_unsupported;
-static int filesystem_mark_unsupported;
#define MOUNT_PATH "fs_mnt"
#define MNT2_PATH "mntpoint"
@@ -89,7 +71,6 @@ static int filesystem_mark_unsupported;
static pid_t child_pid;
static int bind_mount_created;
-static unsigned int num_classes = NUM_CLASSES;
enum {
FANOTIFY_INODE,
@@ -109,7 +90,6 @@ static struct tcase {
int mark_type;
const char *ignore_path;
int ignore_mark_type;
- unsigned int ignored_onchild;
const char *event_path;
unsigned long long expected_mask_with_ignore;
unsigned long long expected_mask_without_ignore;
@@ -118,28 +98,24 @@ static struct tcase {
"ignore mount events created on a specific file",
MOUNT_PATH, FANOTIFY_MOUNT,
FILE_MNT2, FANOTIFY_INODE,
- 0,
FILE_PATH, 0, FAN_OPEN
},
{
"ignore exec mount events created on a specific file",
MOUNT_PATH, FANOTIFY_MOUNT,
FILE_EXEC_PATH2, FANOTIFY_INODE,
- 0,
FILE_EXEC_PATH, FAN_OPEN_EXEC, FAN_OPEN | FAN_OPEN_EXEC
},
{
"don't ignore mount events created on another file",
MOUNT_PATH, FANOTIFY_MOUNT,
FILE_PATH, FANOTIFY_INODE,
- 0,
FILE2_PATH, FAN_OPEN, FAN_OPEN
},
{
"don't ignore exec mount events created on another file",
MOUNT_PATH, FANOTIFY_MOUNT,
FILE_EXEC_PATH, FANOTIFY_INODE,
- 0,
FILE2_EXEC_PATH, FAN_OPEN | FAN_OPEN_EXEC,
FAN_OPEN | FAN_OPEN_EXEC
},
@@ -147,28 +123,24 @@ static struct tcase {
"ignore inode events created on a specific mount point",
FILE_PATH, FANOTIFY_INODE,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_MNT2, 0, FAN_OPEN
},
{
"ignore exec inode events created on a specific mount point",
FILE_EXEC_PATH, FANOTIFY_INODE,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_EXEC_PATH2, FAN_OPEN_EXEC, FAN_OPEN | FAN_OPEN_EXEC
},
{
"don't ignore inode events created on another mount point",
FILE_MNT2, FANOTIFY_INODE,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_PATH, FAN_OPEN, FAN_OPEN
},
{
"don't ignore exec inode events created on another mount point",
FILE_EXEC_PATH2, FANOTIFY_INODE,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_EXEC_PATH, FAN_OPEN | FAN_OPEN_EXEC,
FAN_OPEN | FAN_OPEN_EXEC
},
@@ -176,28 +148,24 @@ static struct tcase {
"ignore fs events created on a specific file",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
FILE_PATH, FANOTIFY_INODE,
- 0,
FILE_PATH, 0, FAN_OPEN
},
{
"ignore exec fs events created on a specific file",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
FILE_EXEC_PATH, FANOTIFY_INODE,
- 0,
FILE_EXEC_PATH, FAN_OPEN_EXEC, FAN_OPEN | FAN_OPEN_EXEC
},
{
"don't ignore mount events created on another file",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
FILE_PATH, FANOTIFY_INODE,
- 0,
FILE2_PATH, FAN_OPEN, FAN_OPEN
},
{
"don't ignore exec mount events created on another file",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
FILE_EXEC_PATH, FANOTIFY_INODE,
- 0,
FILE2_EXEC_PATH, FAN_OPEN | FAN_OPEN_EXEC,
FAN_OPEN | FAN_OPEN_EXEC
},
@@ -205,140 +173,88 @@ static struct tcase {
"ignore fs events created on a specific mount point",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_MNT2, 0, FAN_OPEN
},
{
"ignore exec fs events created on a specific mount point",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_EXEC_PATH2, FAN_OPEN_EXEC, FAN_OPEN | FAN_OPEN_EXEC
},
{
"don't ignore fs events created on another mount point",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_PATH, FAN_OPEN, FAN_OPEN
},
{
"don't ignore exec fs events created on another mount point",
MOUNT_PATH, FANOTIFY_FILESYSTEM,
MNT2_PATH, FANOTIFY_MOUNT,
- 0,
FILE_EXEC_PATH, FAN_OPEN | FAN_OPEN_EXEC,
FAN_OPEN | FAN_OPEN_EXEC
- },
- {
- "ignore child exec events created on a specific mount point",
- MOUNT_PATH, FANOTIFY_INODE,
- MOUNT_PATH, FANOTIFY_MOUNT,
- 0,
- FILE_EXEC_PATH, FAN_OPEN_EXEC, FAN_OPEN | FAN_OPEN_EXEC
- },
- {
- "ignore events on children of directory created on a specific file",
- MNT2_PATH, FANOTIFY_INODE,
- FILE_PATH, FANOTIFY_INODE,
- FAN_EVENT_ON_CHILD,
- FILE_PATH, 0, FAN_OPEN
- },
- {
- "ignore events on file created inside a parent watching children",
- FILE_PATH, FANOTIFY_INODE,
- MNT2_PATH, FANOTIFY_INODE,
- FAN_EVENT_ON_CHILD,
- FILE_PATH, 0, FAN_OPEN
- },
- {
- "don't ignore events on file created inside a parent not watching children",
- FILE_PATH, FANOTIFY_INODE,
- MNT2_PATH, FANOTIFY_INODE,
- 0,
- FILE_PATH, FAN_OPEN, FAN_OPEN
- },
- {
- "ignore mount events created inside a parent watching children",
- FILE_PATH, FANOTIFY_MOUNT,
- MNT2_PATH, FANOTIFY_INODE,
- FAN_EVENT_ON_CHILD,
- FILE_PATH, 0, FAN_OPEN
- },
- {
- "don't ignore mount events created inside a parent not watching children",
- FILE_PATH, FANOTIFY_MOUNT,
- MNT2_PATH, FANOTIFY_INODE,
- 0,
- FILE_PATH, FAN_OPEN, FAN_OPEN
- },
- {
- "ignore fs events created inside a parent watching children",
- FILE_PATH, FANOTIFY_FILESYSTEM,
- MNT2_PATH, FANOTIFY_INODE,
- FAN_EVENT_ON_CHILD,
- FILE_PATH, 0, FAN_OPEN
- },
- {
- "don't ignore fs events created inside a parent not watching children",
- FILE_PATH, FANOTIFY_FILESYSTEM,
- MNT2_PATH, FANOTIFY_INODE,
- 0,
- FILE_PATH, FAN_OPEN, FAN_OPEN
- },
+ }
};
static int create_fanotify_groups(unsigned int n)
{
struct tcase *tc = &tcases[n];
struct fanotify_mark_type *mark, *ignore_mark;
- unsigned int mark_ignored, mask;
unsigned int p, i;
+ int ret;
mark = &fanotify_mark_types[tc->mark_type];
ignore_mark = &fanotify_mark_types[tc->ignore_mark_type];
- for (p = 0; p < num_classes; p++) {
+ for (p = 0; p < FANOTIFY_PRIORITIES; p++) {
for (i = 0; i < GROUPS_PER_PRIO; i++) {
- fd_notify[p][i] = SAFE_FANOTIFY_INIT(fanotify_class[p] |
- FAN_NONBLOCK, O_RDONLY);
-
- /*
- * Add mark for each group.
- *
- * FAN_EVENT_ON_CHILD has no effect on filesystem/mount
- * or inode mark on non-directory.
- */
- SAFE_FANOTIFY_MARK(fd_notify[p][i],
+ fd_notify[p][i] = SAFE_FANOTIFY_INIT(fanotify_prio[p] |
+ FAN_NONBLOCK,
+ O_RDONLY);
+
+ /* Add mark for each group */
+ ret = fanotify_mark(fd_notify[p][i],
FAN_MARK_ADD | mark->flag,
- tc->expected_mask_without_ignore |
- FAN_EVENT_ON_CHILD,
+ tc->expected_mask_without_ignore,
AT_FDCWD, tc->mark_path);
-
+ if (ret < 0) {
+ if (errno == EINVAL &&
+ tc->expected_mask_without_ignore &
+ FAN_OPEN_EXEC) {
+ tst_res(TCONF,
+ "FAN_OPEN_EXEC not supported "
+ "by kernel?");
+ return -1;
+ } else if (errno == EINVAL &&
+ tc->mark_type == FANOTIFY_FILESYSTEM) {
+ tst_res(TCONF,
+ "FAN_MARK_FILESYSTEM not "
+ "supported in kernel?");
+ return -1;
+ }
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | %s,"
+ "FAN_OPEN, AT_FDCWD, %s) failed",
+ fd_notify[p][i], mark->name,
+ tc->mark_path);
+ }
/* Add ignore mark for groups with higher priority */
if (p == 0)
continue;
-
- mask = FAN_OPEN;
- mark_ignored = FAN_MARK_IGNORED_MASK |
- FAN_MARK_IGNORED_SURV_MODIFY;
-add_mark:
- SAFE_FANOTIFY_MARK(fd_notify[p][i],
- FAN_MARK_ADD | ignore_mark->flag | mark_ignored,
- mask, AT_FDCWD, tc->ignore_path);
-
- /*
- * If ignored mask is on a parent watching children,
- * also set the flag FAN_EVENT_ON_CHILD in mark mask.
- * This is needed to indicate that parent ignored mask
- * should be applied to events on children.
- */
- if (tc->ignored_onchild && mark_ignored) {
- mask = tc->ignored_onchild;
- /* XXX: temporary hack may be removed in the future */
- mask |= FAN_OPEN;
- mark_ignored = 0;
- goto add_mark;
+ ret = fanotify_mark(fd_notify[p][i],
+ FAN_MARK_ADD | ignore_mark->flag |
+ FAN_MARK_IGNORED_MASK |
+ FAN_MARK_IGNORED_SURV_MODIFY,
+ FAN_OPEN, AT_FDCWD,
+ tc->ignore_path);
+ if (ret < 0) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | %s | "
+ "FAN_MARK_IGNORED_MASK | "
+ "FAN_MARK_IGNORED_SURV_MODIFY, "
+ "FAN_OPEN, AT_FDCWD, %s) failed",
+ fd_notify[p][i], ignore_mark->name,
+ tc->ignore_path);
}
}
}
@@ -349,7 +265,7 @@ static void cleanup_fanotify_groups(void)
{
unsigned int i, p;
- for (p = 0; p < num_classes; p++) {
+ for (p = 0; p < FANOTIFY_PRIORITIES; p++) {
for (i = 0; i < GROUPS_PER_PRIO; i++) {
if (fd_notify[p][i] > 0)
SAFE_CLOSE(fd_notify[p][i]);
@@ -357,23 +273,22 @@ static void cleanup_fanotify_groups(void)
}
}
-static void verify_event(int p, int group, struct fanotify_event_metadata *event,
+static void verify_event(int group, struct fanotify_event_metadata *event,
unsigned long long expected_mask)
{
if (event->mask != expected_mask) {
- tst_res(TFAIL, "group %d (%x) got event: mask %llx (expected %llx) "
- "pid=%u fd=%u", group, fanotify_class[p],
- (unsigned long long) event->mask,
+ tst_res(TFAIL, "group %d got event: mask %llx (expected %llx) "
+ "pid=%u fd=%u", group, (unsigned long long)event->mask,
(unsigned long long) expected_mask,
(unsigned)event->pid, event->fd);
} else if (event->pid != child_pid) {
- tst_res(TFAIL, "group %d (%x) got event: mask %llx pid=%u "
- "(expected %u) fd=%u", group, fanotify_class[p],
+ tst_res(TFAIL, "group %d got event: mask %llx pid=%u "
+ "(expected %u) fd=%u", group,
(unsigned long long)event->mask, (unsigned)event->pid,
(unsigned)getpid(), event->fd);
} else {
- tst_res(TPASS, "group %d (%x) got event: mask %llx pid=%u fd=%u",
- group, fanotify_class[p], (unsigned long long)event->mask,
+ tst_res(TPASS, "group %d got event: mask %llx pid=%u fd=%u",
+ group, (unsigned long long)event->mask,
(unsigned)event->pid, event->fd);
}
}
@@ -415,22 +330,6 @@ static void test_fanotify(unsigned int n)
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
- if (exec_events_unsupported && tc->expected_mask_with_ignore & FAN_OPEN_EXEC) {
- tst_res(TCONF, "FAN_OPEN_EXEC not supported in kernel?");
- return;
- }
-
- if (filesystem_mark_unsupported && tc->mark_type == FANOTIFY_FILESYSTEM) {
- tst_res(TCONF, "FAN_MARK_FILESYSTEM not supported in kernel?");
- return;
- }
-
- if (tc->ignored_onchild && tst_kvercmp(5, 9, 0) < 0) {
- tst_res(TCONF, "ignored mask in combination with flag FAN_EVENT_ON_CHILD"
- " has undefined behavior on kernel < 5.9");
- return;
- }
-
if (create_fanotify_groups(n) != 0)
goto cleanup;
@@ -442,7 +341,7 @@ static void test_fanotify(unsigned int n)
tst_brk(TBROK, "Child process terminated incorrectly");
/* First verify all groups without matching ignore mask got the event */
- for (p = 0; p < num_classes; p++) {
+ for (p = 0; p < FANOTIFY_PRIORITIES; p++) {
if (p > 0 && !tc->expected_mask_with_ignore)
break;
@@ -450,10 +349,9 @@ static void test_fanotify(unsigned int n)
ret = read(fd_notify[p][i], event_buf, EVENT_BUF_LEN);
if (ret < 0) {
if (errno == EAGAIN) {
- tst_res(TFAIL, "group %d (%x) "
+ tst_res(TFAIL, "group %d (prio %d) "
"with %s did not get event",
- i, fanotify_class[p], mark->name);
- continue;
+ i, p, mark->name);
}
tst_brk(TBROK | TERRNO,
"reading fanotify events failed");
@@ -466,12 +364,12 @@ static void test_fanotify(unsigned int n)
}
event = (struct fanotify_event_metadata *)event_buf;
if (ret > (int)event->event_len) {
- tst_res(TFAIL, "group %d (%x) with %s "
+ tst_res(TFAIL, "group %d (prio %d) with %s "
"got more than one event (%d > %d)",
- i, fanotify_class[p], mark->name, ret,
+ i, p, mark->name, ret,
event->event_len);
} else {
- verify_event(p, i, event, p == 0 ?
+ verify_event(i, event, p == 0 ?
tc->expected_mask_without_ignore :
tc->expected_mask_with_ignore);
}
@@ -480,7 +378,8 @@ static void test_fanotify(unsigned int n)
}
}
/* Then verify all groups with matching ignore mask did got the event */
- for (p = 1; p < num_classes && !tc->expected_mask_with_ignore; p++) {
+ for (p = 1; p < FANOTIFY_PRIORITIES &&
+ !tc->expected_mask_with_ignore; p++) {
for (i = 0; i < GROUPS_PER_PRIO; i++) {
ret = read(fd_notify[p][i], event_buf, EVENT_BUF_LEN);
if (ret == 0) {
@@ -488,15 +387,15 @@ static void test_fanotify(unsigned int n)
"zero length read from fanotify fd");
}
if (ret > 0) {
- tst_res(TFAIL, "group %d (%x) with %s and "
+ tst_res(TFAIL, "group %d (prio %d) with %s and "
"%s ignore mask got event",
- i, fanotify_class[p], mark->name, ignore_mark->name);
+ i, p, mark->name, ignore_mark->name);
if (event->fd != FAN_NOFD)
SAFE_CLOSE(event->fd);
} else if (errno == EAGAIN) {
- tst_res(TPASS, "group %d (%x) with %s and "
+ tst_res(TPASS, "group %d (prio %d) with %s and "
"%s ignore mask got no event",
- i, fanotify_class[p], mark->name, ignore_mark->name);
+ i, p, mark->name, ignore_mark->name);
} else {
tst_brk(TBROK | TERRNO,
"reading fanotify events failed");
@@ -509,16 +408,6 @@ cleanup:
static void setup(void)
{
- exec_events_unsupported = fanotify_events_supported_by_kernel(FAN_OPEN_EXEC);
- filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM);
- fan_report_dfid_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_DFID_NAME,
- MOUNT_PATH);
- if (fan_report_dfid_unsupported) {
- FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_DFID_NAME, fan_report_dfid_unsupported);
- /* Limit tests to legacy priority classes */
- num_classes = NUM_PRIORITIES;
- }
-
/* Create another bind mount at another path for generating events */
SAFE_MKDIR(MNT2_PATH, 0755);
SAFE_MOUNT(MOUNT_PATH, MNT2_PATH, "none", MS_BIND, NULL);
@@ -556,7 +445,6 @@ static struct tst_test test = {
.resource_files = resource_files,
.tags = (const struct tst_tag[]) {
{"linux-git", "9bdda4e9cf2d"},
- {"linux-git", "2f02fd3fa13e"},
{}
}
};
diff --git a/testcases/kernel/syscalls/fanotify/fanotify11.c b/testcases/kernel/syscalls/fanotify/fanotify11.c
index b21c986cc..9e8606c72 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify11.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify11.c
@@ -3,15 +3,13 @@
* Copyright (c) 2018 Huawei. All Rights Reserved.
*
* Started by nixiaoming <nixiaoming@huawei.com>
+ *
+ * DESCRIPTION
+ * After fanotify_init adds flags FAN_REPORT_TID,
+ * check whether the program can accurately identify which thread id
+ * in the multithreaded program triggered the event.
+ *
*/
-
-/*\
- * [Description]
- * After fanotify_init adds flags FAN_REPORT_TID,
- * check whether the program can accurately identify which thread id
- * in the multithreaded program triggered the event.
- */
-
#define _GNU_SOURCE
#include "config.h"
@@ -20,24 +18,25 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <pthread.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include <linux/limits.h>
#include "tst_test.h"
#include "tst_safe_pthread.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define gettid() syscall(SYS_gettid)
static int tid;
-static int fan_report_tid_unsupported;
-
void *thread_create_file(void *arg LTP_ATTRIBUTE_UNUSED)
{
char tid_file[64] = {0};
@@ -56,6 +55,7 @@ static unsigned int tcases[] = {
void test01(unsigned int i)
{
+ int ret;
pthread_t p_id;
struct fanotify_event_metadata event;
int fd_notify;
@@ -65,15 +65,21 @@ void test01(unsigned int i)
i, (tcases[i] & FAN_REPORT_TID) ? "with" : "without",
tgid, tid, event.pid);
- if (fan_report_tid_unsupported && (tcases[i] & FAN_REPORT_TID)) {
- FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TID, fan_report_tid_unsupported);
- return;
+ fd_notify = fanotify_init(tcases[i], 0);
+ if (fd_notify < 0) {
+ if (errno == EINVAL && (tcases[i] & FAN_REPORT_TID)) {
+ tst_res(TCONF,
+ "FAN_REPORT_TID not supported in kernel?");
+ return;
+ }
+ tst_brk(TBROK | TERRNO, "fanotify_init(0x%x, 0) failed",
+ tcases[i]);
}
- fd_notify = SAFE_FANOTIFY_INIT(tcases[i], 0);
-
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD,
+ ret = fanotify_mark(fd_notify, FAN_MARK_ADD,
FAN_ALL_EVENTS | FAN_EVENT_ON_CHILD, AT_FDCWD, ".");
+ if (ret != 0)
+ tst_brk(TBROK, "fanotify_mark FAN_MARK_ADD fail ret=%d", ret);
SAFE_PTHREAD_CREATE(&p_id, NULL, thread_create_file, NULL);
@@ -94,7 +100,10 @@ void test01(unsigned int i)
static void setup(void)
{
- fan_report_tid_unsupported = fanotify_init_flags_supported_by_kernel(FAN_REPORT_TID);
+ int fd;
+
+ fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
+ SAFE_CLOSE(fd);
}
static struct tst_test test = {
@@ -106,5 +115,5 @@ static struct tst_test test = {
};
#else
- TST_TEST_TCONF("system doesn't have required fanotify support");
+TST_TEST_TCONF("system doesn't have required fanotify support");
#endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify12.c b/testcases/kernel/syscalls/fanotify/fanotify12.c
index 76f1aca77..fcb7ec0d3 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify12.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify12.c
@@ -3,16 +3,14 @@
* Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
*
* Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
+ *
+ * DESCRIPTION
+ * Validate that the newly introduced FAN_OPEN_EXEC mask functions as
+ * expected. The idea is to generate a sequence of open related
+ * actions to ensure that the correct event flags are being set
+ * depending on what event mask was requested when the object was
+ * marked.
*/
-
-/*\
- * [Description]
- * Validate that the newly introduced FAN_OPEN_EXEC mask functions as expected.
- * The idea is to generate a sequence of open related actions to ensure that
- * the correct event flags are being set depending on what event mask was
- * requested when the object was marked.
- */
-
#define _GNU_SOURCE
#include "config.h"
@@ -23,10 +21,11 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define EVENT_MAX 1024
#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
#define EVENT_BUF_LEN (EVENT_MAX * EVENT_SIZE)
@@ -40,7 +39,6 @@ static char fname[BUF_SIZE];
static volatile int fd_notify;
static volatile int complete;
static char event_buf[EVENT_BUF_LEN];
-static int exec_events_unsupported;
static struct test_case_t {
const char *tname;
@@ -137,26 +135,59 @@ static int setup_mark(unsigned int n)
const char *const files[] = {fname, TEST_APP};
tst_res(TINFO, "Test #%d: %s", n, tc->tname);
-
- if (exec_events_unsupported && ((tc->mask & FAN_OPEN_EXEC) ||
- tc->ignore_mask & FAN_OPEN_EXEC)) {
- tst_res(TCONF, "FAN_OPEN_EXEC not supported in kernel?");
- return -1;
- }
-
fd_notify = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
for (; i < ARRAY_SIZE(files); i++) {
/* Setup normal mark on object */
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | mark->flag,
- tc->mask, AT_FDCWD, files[i]);
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag,
+ tc->mask, AT_FDCWD, files[i]) < 0) {
+ if (errno == EINVAL && tc->mask & FAN_OPEN_EXEC) {
+ tst_res(TCONF,
+ "FAN_OPEN_EXEC not supported in "
+ "kernel?");
+ return -1;
+ } else if (errno == EINVAL) {
+ tst_brk(TCONF | TERRNO,
+ "CONFIG_FANOTIFY_ACCESS_PERMISSIONS "
+ "not configured in kernel?");
+ }else {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD | %s, "
+ "%llx, AT_FDCWD, %s) failed",
+ fd_notify,
+ mark->name,
+ tc->mask,
+ files[i]);
+ }
+ }
/* Setup ignore mark on object */
if (tc->ignore_mask) {
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | mark->flag
+ if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag
| FAN_MARK_IGNORED_MASK,
tc->ignore_mask, AT_FDCWD,
- files[i]);
+ files[i]) < 0) {
+ if (errno == EINVAL &&
+ tc->ignore_mask & FAN_OPEN_EXEC) {
+ tst_res(TCONF,
+ "FAN_OPEN_EXEC not supported "
+ "in kernel?");
+ return -1;
+ } else if (errno == EINVAL) {
+ tst_brk(TCONF | TERRNO,
+ "CONFIG_FANOTIFY_ACCESS_"
+ "PERMISSIONS not configured in "
+ "kernel?");
+ } else {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark (%d, "
+ "FAN_MARK_ADD | %s "
+ "| FAN_MARK_IGNORED_MASK, "
+ "%llx, AT_FDCWD, %s) failed",
+ fd_notify, mark->name,
+ tc->ignore_mask, files[i]);
+ }
+ }
}
}
@@ -222,8 +253,6 @@ cleanup:
static void do_setup(void)
{
- exec_events_unsupported = fanotify_events_supported_by_kernel(FAN_OPEN_EXEC);
-
sprintf(fname, "fname_%d", getpid());
SAFE_FILE_PRINTF(fname, "1");
}
diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c
index 9061c1ffe..3d8de6009 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify13.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify13.c
@@ -3,20 +3,16 @@
* Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
*
* Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
- */
-
-/*\
- * [Description]
- * Validate that the values returned within an event when FAN_REPORT_FID is
- * specified matches those that are obtained via explicit invocation to system
- * calls statfs(2) and name_to_handle_at(2).
- */
-
- /*
+ *
+ * DESCRIPTION
+ * Validate that the values returned within an event when
+ * FAN_REPORT_FID is specified matches those that are obtained via
+ * explicit invocation to system calls statfs(2) and
+ * name_to_handle_at(2).
+ *
* This is also regression test for:
* c285a2f01d69 ("fanotify: update connector fsid cache on add mark")
*/
-
#define _GNU_SOURCE
#include "config.h"
@@ -25,13 +21,15 @@
#include <sys/statfs.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
#define PATH_LEN 128
#define BUF_SIZE 256
#define DIR_ONE "dir_one"
@@ -46,16 +44,18 @@
#if defined(HAVE_NAME_TO_HANDLE_AT)
struct event_t {
unsigned long long expected_mask;
+ __kernel_fsid_t fsid;
+ struct file_handle handle;
+ char buf[MAX_HANDLE_SZ];
};
static struct object_t {
const char *path;
int is_dir;
- struct fanotify_fid_t fid;
} objects[] = {
- {FILE_PATH_ONE, 0, {}},
- {FILE_PATH_TWO, 0, {}},
- {DIR_PATH_ONE, 1, {}}
+ {FILE_PATH_ONE, 0},
+ {FILE_PATH_TWO, 0},
+ {DIR_PATH_ONE, 1}
};
static struct test_case_t {
@@ -90,7 +90,6 @@ static struct test_case_t {
static int nofid_fd;
static int fanotify_fd;
-static int filesystem_mark_unsupported;
static char events_buf[BUF_SIZE];
static struct event_t event_set[EVENT_MAX];
@@ -109,8 +108,11 @@ static void create_objects(void)
static void get_object_stats(void)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(objects); i++)
- fanotify_save_fid(objects[i].path, &objects[i].fid);
+ for (i = 0; i < ARRAY_SIZE(objects); i++) {
+ event_set[i].handle.handle_bytes = MAX_HANDLE_SZ;
+ fanotify_get_fid(objects[i].path, &event_set[i].fsid,
+ &event_set[i].handle);
+ }
}
static int setup_marks(unsigned int fd, struct test_case_t *tc)
@@ -119,8 +121,28 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc)
struct fanotify_mark_type *mark = &tc->mark;
for (i = 0; i < ARRAY_SIZE(objects); i++) {
- SAFE_FANOTIFY_MARK(fd, FAN_MARK_ADD | mark->flag, tc->mask,
- AT_FDCWD, objects[i].path);
+ if (fanotify_mark(fd, FAN_MARK_ADD | mark->flag, tc->mask,
+ AT_FDCWD, objects[i].path) == -1) {
+ if (errno == EINVAL &&
+ mark->flag & FAN_MARK_FILESYSTEM) {
+ tst_res(TCONF,
+ "FAN_MARK_FILESYSTEM not supported by "
+ "kernel");
+ return 1;
+ } else if (errno == ENODEV &&
+ !event_set[i].fsid.val[0] &&
+ !event_set[i].fsid.val[1]) {
+ tst_res(TCONF,
+ "FAN_REPORT_FID not supported on "
+ "filesystem type %s",
+ tst_device->fs_type);
+ return 1;
+ }
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD, FAN_OPEN, "
+ "AT_FDCWD, %s) failed",
+ fanotify_fd, objects[i].path);
+ }
/* Setup the expected mask for each generated event */
event_set[i].expected_mask = tc->mask;
@@ -145,13 +167,18 @@ static void do_test(unsigned int number)
"Test #%d: FAN_REPORT_FID with mark flag: %s",
number, mark->name);
- if (filesystem_mark_unsupported && mark->flag & FAN_MARK_FILESYSTEM) {
- tst_res(TCONF, "FAN_MARK_FILESYSTEM not supported in kernel?");
- return;
+ fanotify_fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_FID, O_RDONLY);
+ if (fanotify_fd == -1) {
+ if (errno == EINVAL) {
+ tst_res(TCONF,
+ "FAN_REPORT_FID not supported by kernel");
+ return;
+ }
+ tst_brk(TBROK | TERRNO,
+ "fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_FID, "
+ "O_RDONLY) failed");
}
- fanotify_fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF | FAN_REPORT_FID, O_RDONLY);
-
/*
* Place marks on a set of objects and setup the expected masks
* for each event that is expected to be generated.
@@ -180,7 +207,6 @@ static void do_test(unsigned int number)
for (i = 0, metadata = (struct fanotify_event_metadata *) events_buf;
FAN_EVENT_OK(metadata, len);
metadata = FAN_EVENT_NEXT(metadata, len), i++) {
- struct fanotify_fid_t *expected_fid = &objects[i].fid;
event_fid = (struct fanotify_event_info_fid *) (metadata + 1);
event_file_handle = (struct file_handle *) event_fid->handle;
@@ -200,43 +226,43 @@ static void do_test(unsigned int number)
event_set[i].expected_mask);
/* Verify handle_bytes returned in event */
- if (event_file_handle->handle_bytes !=
- expected_fid->handle.handle_bytes) {
+ if (event_file_handle->handle_bytes
+ != event_set[i].handle.handle_bytes) {
tst_res(TFAIL,
"handle_bytes (%x) returned in event does not "
"equal to handle_bytes (%x) returned in "
"name_to_handle_at(2)",
event_file_handle->handle_bytes,
- expected_fid->handle.handle_bytes);
+ event_set[i].handle.handle_bytes);
continue;
}
/* Verify handle_type returned in event */
if (event_file_handle->handle_type !=
- expected_fid->handle.handle_type) {
+ event_set[i].handle.handle_type) {
tst_res(TFAIL,
"handle_type (%x) returned in event does not "
"equal to handle_type (%x) returned in "
"name_to_handle_at(2)",
event_file_handle->handle_type,
- expected_fid->handle.handle_type);
+ event_set[i].handle.handle_type);
continue;
}
/* Verify file identifier f_handle returned in event */
if (memcmp(event_file_handle->f_handle,
- expected_fid->handle.f_handle,
- expected_fid->handle.handle_bytes) != 0) {
+ event_set[i].handle.f_handle,
+ event_set[i].handle.handle_bytes) != 0) {
tst_res(TFAIL,
- "file_handle returned in event does not match "
- "the file_handle returned in "
+ "event_file_handle->f_handle does not match "
+ "event_set[i].handle.f_handle returned in "
"name_to_handle_at(2)");
continue;
}
/* Verify filesystem ID fsid returned in event */
- if (memcmp(&event_fid->fsid, &expected_fid->fsid,
- sizeof(expected_fid->fsid)) != 0) {
+ if (memcmp(&event_fid->fsid, &event_set[i].fsid,
+ sizeof(event_set[i].fsid)) != 0) {
tst_res(TFAIL,
"event_fid.fsid != stat.f_fsid that was "
"obtained via statfs(2)");
@@ -259,10 +285,7 @@ out:
static void do_setup(void)
{
- REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, MOUNT_PATH);
-
- filesystem_mark_unsupported = fanotify_mark_supported_by_kernel(FAN_MARK_FILESYSTEM);
-
+ /* Check for kernel fanotify support */
nofid_fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
/* Create file and directory objects for testing */
@@ -273,8 +296,13 @@ static void do_setup(void)
* uninitialized connector->fsid cache. This mark remains for all test
* cases and is not expected to get any events (no writes in this test).
*/
- SAFE_FANOTIFY_MARK(nofid_fd, FAN_MARK_ADD, FAN_CLOSE_WRITE, AT_FDCWD,
- FILE_PATH_ONE);
+ if (fanotify_mark(nofid_fd, FAN_MARK_ADD, FAN_CLOSE_WRITE, AT_FDCWD,
+ FILE_PATH_ONE) == -1) {
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD, FAN_CLOSE_WRITE, "
+ "AT_FDCWD, "FILE_PATH_ONE") failed",
+ nofid_fd);
+ }
/* Get the filesystem fsid and file handle for each created object */
get_object_stats();
@@ -293,6 +321,7 @@ static struct tst_test test = {
.setup = do_setup,
.cleanup = do_cleanup,
.needs_root = 1,
+ .needs_tmpdir = 1,
.mount_device = 1,
.mntpoint = MOUNT_PATH,
.all_filesystems = 1,
diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
index d19d5576a..3ca38d1e7 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify14.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
@@ -3,22 +3,21 @@
* Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
*
* Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
+ *
+ * DESCRIPTION
+ * This test file has been designed to ensure that the fanotify
+ * system calls fanotify_init(2) and fanotify_mark(2) return the
+ * correct error code to the calling process when an invalid flag or
+ * mask value has been specified in conjunction with FAN_REPORT_FID.
*/
-
-/*\
- * [Description]
- * This test file has been designed to ensure that the fanotify
- * system calls fanotify_init(2) and fanotify_mark(2) return the
- * correct error code to the calling process when an invalid flag or
- * mask value has been specified in conjunction with FAN_REPORT_FID.
- */
-
#define _GNU_SOURCE
#include "tst_test.h"
+#include "fanotify.h"
+
#include <errno.h>
-#ifdef HAVE_SYS_FANOTIFY_H
-#include "fanotify.h"
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
#define MNTPOINT "mntpoint"
#define FILE1 MNTPOINT"/file1"
@@ -53,15 +52,7 @@ static struct test_case_t {
},
{
FAN_CLASS_NOTIF | FAN_REPORT_FID, FAN_MARK_MOUNT, INODE_EVENTS
- },
- {
- /* FAN_REPORT_NAME without FAN_REPORT_DIR_FID is not valid */
- FAN_CLASS_NOTIF | FAN_REPORT_NAME, 0, 0
- },
- {
- /* FAN_REPORT_NAME without FAN_REPORT_DIR_FID is not valid */
- FAN_CLASS_NOTIF | FAN_REPORT_FID | FAN_REPORT_NAME, 0, 0
- },
+ }
};
static void do_test(unsigned int number)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify15.c b/testcases/kernel/syscalls/fanotify/fanotify15.c
index a7736af90..e0d513025 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify15.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify15.c
@@ -4,39 +4,29 @@
*
* Started by Amir Goldstein <amir73il@gmail.com>
* Modified by Matthew Bobrowski <mbobrowski@mbobrowski.org>
+ *
+ * DESCRIPTION
+ * Test file that has been purposely designed to verify
+ * FAN_REPORT_FID functionality while using newly defined dirent
+ * events.
*/
-
-/*\
- * [Description]
- * Test file that has been purposely designed to verify FAN_REPORT_FID
- * functionality while using newly defined dirent events.
- */
-
-/*
- * Test case #1 is a regression test for commit f367a62a7cad:
- * fanotify: merge duplicate events on parent and child
- */
-
#define _GNU_SOURCE
#include "config.h"
#include <string.h>
#include <errno.h>
+#include <fcntl.h>
#include <sys/statfs.h>
#include <sys/types.h>
-#include "tst_test.h"
-#ifdef HAVE_SYS_FANOTIFY_H
+#include "tst_test.h"
#include "fanotify.h"
-#define EVENT_MAX 10
-
-/* Size of the event structure, not including file handle */
-#define EVENT_SIZE (sizeof(struct fanotify_event_metadata) + \
- sizeof(struct fanotify_event_info_fid))
-/* Double events buffer size to account for file handles */
-#define EVENT_BUF_LEN (EVENT_MAX * EVENT_SIZE * 2)
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+#define BUF_SIZE 256
+#define EVENT_MAX 256
#define MOUNT_POINT "mntpoint"
#define TEST_DIR MOUNT_POINT"/test_dir"
@@ -48,97 +38,60 @@
#if defined(HAVE_NAME_TO_HANDLE_AT)
struct event_t {
unsigned long long mask;
- struct fanotify_fid_t *fid;
+ __kernel_fsid_t fsid;
+ struct file_handle handle;
+ char buf[MAX_HANDLE_SZ];
};
static int fanotify_fd;
-static char events_buf[EVENT_BUF_LEN];
+static char events_buf[BUF_SIZE];
static struct event_t event_set[EVENT_MAX];
-static struct test_case_t {
- const char *tname;
- struct fanotify_mark_type mark;
- unsigned long mask;
-} test_cases[] = {
- {
- "FAN_REPORT_FID on filesystem including FAN_DELETE_SELF",
- INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
- FAN_DELETE_SELF,
- },
- {
- "FAN_REPORT_FID on directory with FAN_EVENT_ON_CHILD",
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_EVENT_ON_CHILD,
- },
-};
-
-static void do_test(unsigned int number)
+static void do_test(void)
{
int i, fd, len, count = 0;
struct file_handle *event_file_handle;
struct fanotify_event_metadata *metadata;
struct fanotify_event_info_fid *event_fid;
- struct test_case_t *tc = &test_cases[number];
- struct fanotify_mark_type *mark = &tc->mark;
- struct fanotify_fid_t root_fid, dir_fid, file_fid;
-
- tst_res(TINFO, "Test #%d: %s", number, tc->tname);
-
- SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_ADD | mark->flag, tc->mask |
- FAN_CREATE | FAN_DELETE | FAN_MOVE |
- FAN_MODIFY | FAN_ONDIR,
- AT_FDCWD, TEST_DIR);
- /* Save the test root dir fid */
- fanotify_save_fid(TEST_DIR, &root_fid);
+ if (fanotify_mark(fanotify_fd, FAN_MARK_ADD | FAN_MARK_FILESYSTEM,
+ FAN_CREATE | FAN_DELETE | FAN_ATTRIB |
+ FAN_MOVED_FROM | FAN_MOVED_TO |
+ FAN_DELETE_SELF | FAN_ONDIR,
+ AT_FDCWD, TEST_DIR) == -1) {
+ if (errno == ENODEV)
+ tst_brk(TCONF,
+ "FAN_REPORT_FID not supported on %s "
+ "filesystem", tst_device->fs_type);
+ tst_brk(TBROK | TERRNO,
+ "fanotify_mark(%d, FAN_MARK_ADD, FAN_CREATE | "
+ "FAN_DELETE | FAN_MOVED_FROM | FAN_MOVED_TO | "
+ "FAN_DELETE_SELF | FAN_ONDIR, AT_FDCWD, %s) failed",
+ fanotify_fd, TEST_DIR);
+ }
- /* All dirent events on testdir are merged */
- event_set[count].mask = FAN_CREATE | FAN_MOVE | FAN_DELETE;
- event_set[count].fid = &root_fid;
+ /* Generate a sequence of events */
+ event_set[count].mask = FAN_CREATE | FAN_MOVED_FROM | FAN_MOVED_TO | \
+ FAN_DELETE;
+ event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+ fanotify_get_fid(TEST_DIR, &event_set[count].fsid,
+ &event_set[count].handle);
count++;
fd = SAFE_CREAT(FILE1, 0644);
SAFE_CLOSE(fd);
- /* Save the file fid */
- fanotify_save_fid(FILE1, &file_fid);
-
- /* Recursive watch file for events "on self" */
- if (mark->flag == FAN_MARK_INODE &&
- fanotify_mark(fanotify_fd, FAN_MARK_ADD | mark->flag,
- FAN_MODIFY | FAN_DELETE_SELF,
- AT_FDCWD, FILE1) == -1) {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark(%d, FAN_MARK_ADD | %s, "
- "FAN_DELETE_SELF, AT_FDCWD, %s) failed",
- fanotify_fd, mark->name, FILE1);
- }
-
- /*
- * Event on child file is not merged with dirent events.
- * FAN_MODIFY event reported on file mark should be merged with the
- * FAN_MODIFY event reported on parent directory watch.
- */
- event_set[count].mask = FAN_MODIFY;
- event_set[count].fid = &file_fid;
- count++;
-
- SAFE_TRUNCATE(FILE1, 1);
SAFE_RENAME(FILE1, FILE2);
- /*
- * FAN_DELETE_SELF may be merged with FAN_MODIFY event above.
- */
- event_set[count].mask = FAN_DELETE_SELF;
- event_set[count].fid = &file_fid;
+ event_set[count].mask = FAN_ATTRIB | FAN_DELETE_SELF;
+ event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+ fanotify_get_fid(FILE2, &event_set[count].fsid,
+ &event_set[count].handle);
count++;
SAFE_UNLINK(FILE2);
- /* Read file events from the event queue */
- len = SAFE_READ(0, fanotify_fd, events_buf, EVENT_BUF_LEN);
-
/*
* Generate a sequence of events on a directory. Subsequent events
* are merged, so it's required that we set FAN_ONDIR once in
@@ -146,47 +99,32 @@ static void do_test(unsigned int number)
* took place. Events on subdirectories are not merged with events
* on non-subdirectories.
*/
- event_set[count].mask = FAN_ONDIR | FAN_CREATE | FAN_MOVE | FAN_DELETE;
- event_set[count].fid = &root_fid;
+ event_set[count].mask = FAN_ONDIR | FAN_CREATE | FAN_MOVED_FROM | \
+ FAN_MOVED_TO | FAN_DELETE;
+ event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+ fanotify_get_fid(TEST_DIR, &event_set[count].fsid,
+ &event_set[count].handle);
count++;
SAFE_MKDIR(DIR1, 0755);
- /* Save the subdir fid */
- fanotify_save_fid(DIR1, &dir_fid);
-
- /* Recursive watch subdir for events "on self" */
- if (mark->flag == FAN_MARK_INODE &&
- fanotify_mark(fanotify_fd, FAN_MARK_ADD | mark->flag,
- FAN_DELETE_SELF | FAN_ONDIR,
- AT_FDCWD, DIR1) == -1) {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark(%d, FAN_MARK_ADD | %s,"
- "FAN_DELETE_SELF | FAN_ONDIR, AT_FDCWD, %s) failed",
- fanotify_fd, mark->name, DIR1);
- }
-
SAFE_RENAME(DIR1, DIR2);
event_set[count].mask = FAN_ONDIR | FAN_DELETE_SELF;
- event_set[count].fid = &dir_fid;
+ event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+ fanotify_get_fid(DIR2, &event_set[count].fsid,
+ &event_set[count].handle);
count++;
SAFE_RMDIR(DIR2);
- /* Read dir events from the event queue */
- len += SAFE_READ(0, fanotify_fd, events_buf + len, EVENT_BUF_LEN - len);
-
- /*
- * Cleanup the mark
- */
- SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_FLUSH | mark->flag, 0,
- AT_FDCWD, TEST_DIR);
+ /* Read events from the event queue */
+ len = SAFE_READ(0, fanotify_fd, events_buf, BUF_SIZE);
/* Process each event in buffer */
for (i = 0, metadata = (struct fanotify_event_metadata *) events_buf;
- FAN_EVENT_OK(metadata, len); i++) {
- struct event_t *expected = &event_set[i];
+ FAN_EVENT_OK(metadata, len);
+ metadata = FAN_EVENT_NEXT(metadata,len), i++) {
event_fid = (struct fanotify_event_info_fid *) (metadata + 1);
event_file_handle = (struct file_handle *) event_fid->handle;
@@ -203,12 +141,13 @@ static void do_test(unsigned int number)
"Received unexpected file descriptor %d in "
"event. Expected to get FAN_NOFD(%d)",
metadata->fd, FAN_NOFD);
- } else if (!(metadata->mask & expected->mask)) {
+ } else if (metadata->mask != event_set[i].mask) {
tst_res(TFAIL,
"Got event: mask=%llx (expected %llx) "
"pid=%u fd=%d",
(unsigned long long) metadata->mask,
- expected->mask, (unsigned) metadata->pid,
+ event_set[i].mask,
+ (unsigned) metadata->pid,
metadata->fd);
} else if (metadata->pid != getpid()) {
tst_res(TFAIL,
@@ -219,30 +158,31 @@ static void do_test(unsigned int number)
(unsigned) getpid(),
metadata->fd);
} else if (event_file_handle->handle_bytes !=
- expected->fid->handle.handle_bytes) {
+ event_set[i].handle.handle_bytes) {
tst_res(TFAIL,
"Got event: handle_bytes (%x) returned in "
"event does not equal handle_bytes (%x) "
"retunred in name_to_handle_at(2)",
event_file_handle->handle_bytes,
- expected->fid->handle.handle_bytes);
+ event_set[i].handle.handle_bytes);
} else if (event_file_handle->handle_type !=
- expected->fid->handle.handle_type) {
+ event_set[i].handle.handle_type) {
tst_res(TFAIL,
"handle_type (%x) returned in event does not "
"equal to handle_type (%x) returned in "
"name_to_handle_at(2)",
event_file_handle->handle_type,
- expected->fid->handle.handle_type);
+ event_set[i].handle.handle_type);
} else if (memcmp(event_file_handle->f_handle,
- expected->fid->handle.f_handle,
- expected->fid->handle.handle_bytes) != 0) {
+ event_set[i].handle.f_handle,
+ event_set[i].handle.handle_bytes)
+ != 0) {
tst_res(TFAIL,
- "file_handle returned in event does not match "
- "the file_handle returned in "
+ "event_file_handle->f_handle does not match "
+ "handle.f_handle returned in "
"name_to_handle_at(2)");
- } else if (memcmp(&event_fid->fsid, &expected->fid->fsid,
- sizeof(event_fid->fsid)) != 0) {
+ } else if (memcmp(&event_fid->fsid, &event_set[i].fsid,
+ sizeof(event_set[i].fsid)) != 0) {
tst_res(TFAIL,
"event_fid->fsid != stats.f_fsid that was "
"obtained via statfs(2)");
@@ -257,10 +197,6 @@ static void do_test(unsigned int number)
*(unsigned long *)
event_file_handle->f_handle);
}
- metadata->mask &= ~expected->mask;
- /* No events left in current mask? Go for next event */
- if (metadata->mask == 0)
- metadata = FAN_EVENT_NEXT(metadata, len);
}
for (; i < count; i++)
@@ -271,9 +207,22 @@ static void do_test(unsigned int number)
static void do_setup(void)
{
+ int fd;
+
+ /* Check kernel for fanotify support */
+ fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
+ SAFE_CLOSE(fd);
+
+ fanotify_fd = fanotify_init(FAN_REPORT_FID, O_RDONLY);
+ if (fanotify_fd == -1) {
+ if (errno == EINVAL)
+ tst_brk(TCONF,
+ "FAN_REPORT_FID not supported in kernel");
+ tst_brk(TBROK | TERRNO,
+ "fanotify_init(FAN_REPORT_FID, O_RDONLY) failed");
+ }
+
SAFE_MKDIR(TEST_DIR, 0755);
- REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, TEST_DIR);
- fanotify_fd = SAFE_FANOTIFY_INIT(FAN_REPORT_FID, O_RDONLY);
}
static void do_cleanup(void)
@@ -287,14 +236,9 @@ static struct tst_test test = {
.mount_device = 1,
.mntpoint = MOUNT_POINT,
.all_filesystems = 1,
- .test = do_test,
- .tcnt = ARRAY_SIZE(test_cases),
+ .test_all = do_test,
.setup = do_setup,
- .cleanup = do_cleanup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "f367a62a7cad"},
- {}
- }
+ .cleanup = do_cleanup
};
#else
diff --git a/testcases/kernel/syscalls/fanotify/fanotify16.c b/testcases/kernel/syscalls/fanotify/fanotify16.c
deleted file mode 100644
index 357f4216b..000000000
--- a/testcases/kernel/syscalls/fanotify/fanotify16.c
+++ /dev/null
@@ -1,577 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 CTERA Networks. All Rights Reserved.
- *
- * Started by Amir Goldstein <amir73il@gmail.com>
- */
-
-/*\
- * [Description]
- * Check fanotify directory entry modification events, events on child and
- * on self with group init flags:
- *
- * - FAN_REPORT_DFID_NAME (dir fid + name)
- * - FAN_REPORT_DIR_FID (dir fid)
- * - FAN_REPORT_DIR_FID | FAN_REPORT_FID (dir fid + child fid)
- * - FAN_REPORT_DFID_NAME | FAN_REPORT_FID (dir fid + name + child fid)
- */
-
-#define _GNU_SOURCE
-#include "config.h"
-
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/mount.h>
-#include <sys/syscall.h>
-#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
-#include "fanotify.h"
-
-#define EVENT_MAX 20
-
-/* Size of the event structure, not including file handle */
-#define EVENT_SIZE (sizeof(struct fanotify_event_metadata) + \
- sizeof(struct fanotify_event_info_fid))
-/* Tripple events buffer size to account for file handles and names */
-#define EVENT_BUF_LEN (EVENT_MAX * EVENT_SIZE * 3)
-
-
-#define BUF_SIZE 256
-
-#ifdef HAVE_NAME_TO_HANDLE_AT
-struct event_t {
- unsigned long long mask;
- struct fanotify_fid_t *fid;
- struct fanotify_fid_t *child_fid;
- char name[BUF_SIZE];
-};
-
-static char fname1[BUF_SIZE + 11], fname2[BUF_SIZE + 11];
-static char dname1[BUF_SIZE], dname2[BUF_SIZE];
-static int fd_notify;
-
-static struct event_t event_set[EVENT_MAX];
-
-static char event_buf[EVENT_BUF_LEN];
-
-#define DIR_NAME1 "test_dir1"
-#define DIR_NAME2 "test_dir2"
-#define FILE_NAME1 "test_file1"
-#define FILE_NAME2 "test_file2"
-#define MOUNT_PATH "fs_mnt"
-
-static struct test_case_t {
- const char *tname;
- struct fanotify_group_type group;
- struct fanotify_mark_type mark;
- unsigned long mask;
- struct fanotify_mark_type sub_mark;
- unsigned long sub_mask;
-} test_cases[] = {
- {
- "FAN_REPORT_DFID_NAME monitor filesystem for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DFID_NAME),
- INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR,
- /* Mount watch for events possible on children */
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- FAN_OPEN | FAN_CLOSE | FAN_ONDIR,
- },
- {
- "FAN_REPORT_DFID_NAME monitor directories for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DFID_NAME),
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_ONDIR,
- /* Watches for self events on subdir and events on subdir's children */
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR |
- FAN_OPEN | FAN_CLOSE | FAN_EVENT_ON_CHILD,
- },
- {
- "FAN_REPORT_DIR_FID monitor filesystem for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DIR_FID),
- INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR,
- /* Mount watch for events possible on children */
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- FAN_OPEN | FAN_CLOSE | FAN_ONDIR,
- },
- {
- "FAN_REPORT_DIR_FID monitor directories for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DIR_FID),
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_ONDIR,
- /* Watches for self events on subdir and events on subdir's children */
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR |
- FAN_OPEN | FAN_CLOSE | FAN_EVENT_ON_CHILD,
- },
- {
- "FAN_REPORT_DFID_FID monitor filesystem for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DFID_FID),
- INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR,
- /* Mount watch for events possible on children */
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- FAN_OPEN | FAN_CLOSE | FAN_ONDIR,
- },
- {
- "FAN_REPORT_DFID_FID monitor directories for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DFID_FID),
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_ONDIR,
- /* Watches for self events on subdir and events on subdir's children */
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR |
- FAN_OPEN | FAN_CLOSE | FAN_EVENT_ON_CHILD,
- },
- {
- "FAN_REPORT_DFID_NAME_FID monitor filesystem for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DFID_NAME_FID),
- INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR,
- /* Mount watch for events possible on children */
- INIT_FANOTIFY_MARK_TYPE(MOUNT),
- FAN_OPEN | FAN_CLOSE | FAN_ONDIR,
- },
- {
- "FAN_REPORT_DFID_NAME_FID monitor directories for create/delete/move/open/close",
- INIT_FANOTIFY_GROUP_TYPE(REPORT_DFID_NAME_FID),
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_ONDIR,
- /* Watches for self events on subdir and events on subdir's children */
- INIT_FANOTIFY_MARK_TYPE(INODE),
- FAN_CREATE | FAN_DELETE | FAN_MOVE | FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR |
- FAN_OPEN | FAN_CLOSE | FAN_EVENT_ON_CHILD,
- },
-};
-
-static void do_test(unsigned int number)
-{
- int fd, dirfd, len = 0, i = 0, test_num = 0, tst_count = 0;
- struct test_case_t *tc = &test_cases[number];
- struct fanotify_group_type *group = &tc->group;
- struct fanotify_mark_type *mark = &tc->mark;
- struct fanotify_mark_type *sub_mark = &tc->sub_mark;
- struct fanotify_fid_t root_fid, dir_fid, file_fid;
-
- tst_res(TINFO, "Test #%d: %s", number, tc->tname);
-
- fd_notify = SAFE_FANOTIFY_INIT(group->flag, 0);
-
- /*
- * Watch dir modify events with name in filesystem/dir
- */
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | mark->flag, tc->mask,
- AT_FDCWD, MOUNT_PATH);
-
- /* Save the mount root fid */
- fanotify_save_fid(MOUNT_PATH, &root_fid);
-
- /*
- * Create subdir and watch open events "on children" with name.
- * Make it a mount root.
- */
- SAFE_MKDIR(dname1, 0755);
- SAFE_MOUNT(dname1, dname1, "none", MS_BIND, NULL);
-
- /* Save the subdir fid */
- fanotify_save_fid(dname1, &dir_fid);
-
- if (tc->sub_mask)
- SAFE_FANOTIFY_MARK(fd_notify, FAN_MARK_ADD | sub_mark->flag,
- tc->sub_mask, AT_FDCWD, dname1);
-
- event_set[tst_count].mask = FAN_CREATE | FAN_ONDIR;
- event_set[tst_count].fid = &root_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, DIR_NAME1);
- tst_count++;
-
- /* Generate modify events "on child" */
- fd = SAFE_CREAT(fname1, 0755);
-
- /* Save the file fid */
- fanotify_save_fid(fname1, &file_fid);
-
- SAFE_WRITE(1, fd, "1", 1);
- SAFE_RENAME(fname1, fname2);
-
- SAFE_CLOSE(fd);
-
- /* Generate delete events with fname2 */
- SAFE_UNLINK(fname2);
-
- /* Read events on files in subdir */
- len += SAFE_READ(0, fd_notify, event_buf + len, EVENT_BUF_LEN - len);
-
- /*
- * FAN_CREATE|FAN_DELETE|FAN_MOVE events with the same name are merged.
- */
- event_set[tst_count].mask = FAN_CREATE | FAN_MOVED_FROM;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, FILE_NAME1);
- tst_count++;
- /*
- * Event on non-dir child with the same name may be merged with the
- * directory entry modification events above, unless FAN_REPORT_FID is
- * set and child fid is reported. If FAN_REPORT_FID is set but
- * FAN_REPORT_NAME is not set, then FAN_CREATE above is merged with
- * FAN_DELETE below and FAN_OPEN will be merged with FAN_CLOSE.
- */
- if (group->flag & FAN_REPORT_NAME) {
- event_set[tst_count].mask = FAN_OPEN;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = &file_fid;
- strcpy(event_set[tst_count].name, FILE_NAME1);
- tst_count++;
- }
-
- event_set[tst_count].mask = FAN_DELETE | FAN_MOVED_TO;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, FILE_NAME2);
- tst_count++;
- /*
- * When not reporting name, open of FILE_NAME1 is merged
- * with close of FILE_NAME2.
- */
- if (!(group->flag & FAN_REPORT_NAME)) {
- event_set[tst_count].mask = FAN_OPEN | FAN_CLOSE_WRITE;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = &file_fid;
- strcpy(event_set[tst_count].name, "");
- tst_count++;
- }
- /*
- * Directory watch does not get self events on children.
- * Filesystem watch gets self event w/o name info if FAN_REPORT_FID
- * is set.
- */
- if (mark->flag == FAN_MARK_FILESYSTEM && (group->flag & FAN_REPORT_FID)) {
- event_set[tst_count].mask = FAN_DELETE_SELF | FAN_MOVE_SELF;
- event_set[tst_count].fid = &file_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, "");
- tst_count++;
- }
- /*
- * When reporting name, close of FILE_NAME2 is not merged with
- * open of FILE_NAME1 and it is received after the merged self
- * events.
- */
- if (group->flag & FAN_REPORT_NAME) {
- event_set[tst_count].mask = FAN_CLOSE_WRITE;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = &file_fid;
- strcpy(event_set[tst_count].name, FILE_NAME2);
- tst_count++;
- }
-
- dirfd = SAFE_OPEN(dname1, O_RDONLY | O_DIRECTORY);
- SAFE_CLOSE(dirfd);
-
- SAFE_UMOUNT(dname1);
-
- /*
- * Directory watch gets open/close events on itself and on its subdirs.
- * Filesystem watch gets open/close event on all directories with name ".".
- */
- event_set[tst_count].mask = FAN_OPEN | FAN_CLOSE_NOWRITE | FAN_ONDIR;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, ".");
- tst_count++;
- /*
- * Directory watch gets self event on itself and filesystem watch gets
- * self event on all directories with name ".".
- */
- event_set[tst_count].mask = FAN_DELETE_SELF | FAN_MOVE_SELF | FAN_ONDIR;
- event_set[tst_count].fid = &dir_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, ".");
- tst_count++;
-
- SAFE_RENAME(dname1, dname2);
- SAFE_RMDIR(dname2);
-
- /* Read more events on dirs */
- len += SAFE_READ(0, fd_notify, event_buf + len, EVENT_BUF_LEN - len);
-
- event_set[tst_count].mask = FAN_MOVED_FROM | FAN_ONDIR;
- event_set[tst_count].fid = &root_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, DIR_NAME1);
- tst_count++;
- event_set[tst_count].mask = FAN_DELETE | FAN_MOVED_TO | FAN_ONDIR;
- event_set[tst_count].fid = &root_fid;
- event_set[tst_count].child_fid = NULL;
- strcpy(event_set[tst_count].name, DIR_NAME2);
- tst_count++;
- /* Expect no more events */
- event_set[tst_count].mask = 0;
-
- /*
- * Cleanup the marks
- */
- SAFE_CLOSE(fd_notify);
- fd_notify = -1;
-
- while (i < len) {
- struct event_t *expected = &event_set[test_num];
- struct fanotify_event_metadata *event;
- struct fanotify_event_info_fid *event_fid;
- struct fanotify_event_info_fid *child_fid;
- struct fanotify_fid_t *expected_fid = expected->fid;
- struct fanotify_fid_t *expected_child_fid = expected->child_fid;
- struct file_handle *file_handle;
- unsigned int fhlen;
- const char *filename;
- int namelen, info_type, mask_match, info_id = 0;
-
- event = (struct fanotify_event_metadata *)&event_buf[i];
- event_fid = (struct fanotify_event_info_fid *)(event + 1);
- file_handle = (struct file_handle *)event_fid->handle;
- fhlen = file_handle->handle_bytes;
- filename = (char *)file_handle->f_handle + fhlen;
- child_fid = (void *)((char *)event_fid + event_fid->hdr.len);
- namelen = (char *)child_fid - (char *)filename;
- /* End of event_fid could have name, zero padding, both or none */
- if (namelen > 0) {
- namelen = strlen(filename);
- } else {
- filename = "";
- namelen = 0;
- }
- /* Is there a child fid after first fid record? */
- if (((char *)child_fid - (char *)event) >= event->event_len)
- child_fid = NULL;
-
- if (!(group->flag & FAN_REPORT_FID))
- expected_child_fid = NULL;
-
- if (!(group->flag & FAN_REPORT_NAME))
- expected->name[0] = 0;
-
- if (expected->name[0]) {
- info_type = FAN_EVENT_INFO_TYPE_DFID_NAME;
- } else if (expected->mask & FAN_ONDIR) {
- info_type = FAN_EVENT_INFO_TYPE_DFID;
- } else if (expected->mask & (FAN_DELETE_SELF | FAN_MOVE_SELF)) {
- /* Self event on non-dir has only child fid */
- info_type = FAN_EVENT_INFO_TYPE_FID;
- } else {
- info_type = FAN_EVENT_INFO_TYPE_DFID;
- }
-
- /*
- * Event may contain more than the expected mask, but it must
- * have all the bits in expected mask.
- * Expected event on dir must not get event on non dir and the
- * other way around.
- */
- mask_match = ((event->mask & expected->mask) &&
- !(expected->mask & ~event->mask) &&
- !((event->mask ^ expected->mask) & FAN_ONDIR));
-
-check_match:
- if (test_num >= tst_count) {
- tst_res(TFAIL,
- "got unnecessary event: mask=%llx "
- "pid=%u fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- } else if (!fhlen || namelen < 0) {
- tst_res(TFAIL,
- "got event without fid: mask=%llx pid=%u fd=%d, "
- "len=%d info_type=%d info_len=%d fh_len=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd,
- event->event_len, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- } else if (!mask_match) {
- tst_res(TFAIL,
- "got event: mask=%llx (expected %llx) "
- "pid=%u fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d",
- (unsigned long long)event->mask, expected->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- } else if (info_type != event_fid->hdr.info_type) {
- tst_res(TFAIL,
- "got event: mask=%llx pid=%u fd=%d, "
- "len=%d info_type=%d expected(%d) info_len=%d fh_len=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd,
- event->event_len, event_fid->hdr.info_type,
- info_type, event_fid->hdr.len, fhlen);
- } else if (fhlen != expected_fid->handle.handle_bytes) {
- tst_res(TFAIL,
- "got event: mask=%llx pid=%u fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d expected(%d)"
- "fh_type=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, info_type,
- event_fid->hdr.len, fhlen,
- expected_fid->handle.handle_bytes,
- file_handle->handle_type);
- } else if (file_handle->handle_type !=
- expected_fid->handle.handle_type) {
- tst_res(TFAIL,
- "got event: mask=%llx pid=%u fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d "
- "fh_type=%d expected(%x)",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, info_type,
- event_fid->hdr.len, fhlen,
- file_handle->handle_type,
- expected_fid->handle.handle_type);
- } else if (memcmp(file_handle->f_handle,
- expected_fid->handle.f_handle, fhlen)) {
- tst_res(TFAIL,
- "got event: mask=%llx pid=%u fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d "
- "fh_type=%d unexpected file handle (%x...)",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, info_type,
- event_fid->hdr.len, fhlen,
- file_handle->handle_type,
- *(int *)(file_handle->f_handle));
- } else if (memcmp(&event_fid->fsid, &expected_fid->fsid,
- sizeof(event_fid->fsid)) != 0) {
- tst_res(TFAIL,
- "got event: mask=%llx pid=%u fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d "
- "fsid=%x.%x (expected %x.%x)",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, info_type,
- event_fid->hdr.len, fhlen,
- FSID_VAL_MEMBER(event_fid->fsid, 0),
- FSID_VAL_MEMBER(event_fid->fsid, 1),
- expected_fid->fsid.val[0],
- expected_fid->fsid.val[1]);
- } else if (strcmp(expected->name, filename)) {
- tst_res(TFAIL,
- "got event: mask=%llx "
- "pid=%u fd=%d name='%s' expected('%s') "
- "len=%d info_type=%d info_len=%d fh_len=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd,
- filename, expected->name,
- event->event_len, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- } else if (event->pid != getpid()) {
- tst_res(TFAIL,
- "got event: mask=%llx pid=%u "
- "(expected %u) fd=%d name='%s' "
- "len=%d info_type=%d info_len=%d fh_len=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid,
- (unsigned)getpid(),
- event->fd, filename,
- event->event_len, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- } else if (!!child_fid != !!expected_child_fid) {
- tst_res(TFAIL,
- "got event: mask=%llx "
- "pid=%u fd=%d name='%s' num_info=%d (expected %d) "
- "len=%d info_type=%d info_len=%d fh_len=%d",
- (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd,
- filename, 1 + !!child_fid, 1 + !!expected_child_fid,
- event->event_len, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- } else if (child_fid) {
- tst_res(TINFO,
- "got event #%d: info #%d: info_type=%d info_len=%d fh_len=%d",
- test_num, info_id, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
-
- /* Recheck event_fid match with child_fid */
- event_fid = child_fid;
- expected_fid = expected->child_fid;
- info_id = 1;
- info_type = FAN_EVENT_INFO_TYPE_FID;
- file_handle = (struct file_handle *)event_fid->handle;
- fhlen = file_handle->handle_bytes;
- child_fid = NULL;
- expected_child_fid = NULL;
- goto check_match;
- } else {
- tst_res(TPASS,
- "got event #%d: mask=%llx pid=%u fd=%d name='%s' "
- "len=%d; info #%d: info_type=%d info_len=%d fh_len=%d",
- test_num, (unsigned long long)event->mask,
- (unsigned)event->pid, event->fd, filename,
- event->event_len, info_id, event_fid->hdr.info_type,
- event_fid->hdr.len, fhlen);
- }
-
- if (test_num < tst_count)
- test_num++;
-
- if (mask_match) {
- /* In case of merged event match next expected mask */
- event->mask &= ~expected->mask | FAN_ONDIR;
- if (event->mask & ~FAN_ONDIR)
- continue;
- }
-
- i += event->event_len;
- if (event->fd > 0)
- SAFE_CLOSE(event->fd);
- }
-
- for (; test_num < tst_count; test_num++) {
- tst_res(TFAIL, "didn't get event: mask=%llx, name='%s'",
- event_set[test_num].mask, event_set[test_num].name);
-
- }
-}
-
-static void setup(void)
-{
- REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_DIR_FID, MOUNT_PATH);
-
- sprintf(dname1, "%s/%s", MOUNT_PATH, DIR_NAME1);
- sprintf(dname2, "%s/%s", MOUNT_PATH, DIR_NAME2);
- sprintf(fname1, "%s/%s", dname1, FILE_NAME1);
- sprintf(fname2, "%s/%s", dname1, FILE_NAME2);
-}
-
-static void cleanup(void)
-{
- if (fd_notify > 0)
- SAFE_CLOSE(fd_notify);
-}
-
-static struct tst_test test = {
- .test = do_test,
- .tcnt = ARRAY_SIZE(test_cases),
- .setup = setup,
- .cleanup = cleanup,
- .mount_device = 1,
- .mntpoint = MOUNT_PATH,
- .all_filesystems = 1,
- .needs_root = 1
-};
-
-#else
- TST_TEST_TCONF("system does not have required name_to_handle_at() support");
-#endif
-#else
- TST_TEST_TCONF("system doesn't have required fanotify support");
-#endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify17.c b/testcases/kernel/syscalls/fanotify/fanotify17.c
deleted file mode 100644
index 35beb53d2..000000000
--- a/testcases/kernel/syscalls/fanotify/fanotify17.c
+++ /dev/null
@@ -1,267 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
- * Copyright (c) 2021 CTERA Networks. All Rights Reserved.
- *
- * User ns support by: Xiao Yang <yangx.jy@cn.fujitsu.com>
- * Forked from getxattr05.c by Amir Goldstein <amir73il@gmail.com>
- */
-
-/*\
- * [Description]
- * Check that fanotify groups and marks limits are enforced correctly.
- * If user ns is supported, verify that global limit and per user ns
- * limits are both enforced.
- * Otherwise, we only check that global groups limit is enforced.
- */
-
-#define _GNU_SOURCE
-#include "config.h"
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sched.h>
-#include <stdlib.h>
-
-#include "tst_test.h"
-#include "lapi/namespaces_constants.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
-#include "fanotify.h"
-
-#define MOUNT_PATH "fs_mnt"
-#define TEST_FILE MOUNT_PATH "/testfile"
-#define SELF_USERNS "/proc/self/ns/user"
-#define MAX_USERNS "/proc/sys/user/max_user_namespaces"
-#define UID_MAP "/proc/self/uid_map"
-
-#define GLOBAL_MAX_GROUPS "/proc/sys/fs/fanotify/max_user_groups"
-#define GLOBAL_MAX_MARKS "/proc/sys/fs/fanotify/max_user_marks"
-#define USERNS_MAX_GROUPS "/proc/sys/user/max_fanotify_groups"
-#define USERNS_MAX_MARKS "/proc/sys/user/max_fanotify_marks"
-
-/*
- * In older kernels those limits were fixed in kernel.
- * The fanotify_init() man page documents the max groups limit is 128, but the
- * implementation actually allows one extra group.
- */
-#define DEFAULT_MAX_GROUPS 129
-#define DEFAULT_MAX_MARKS 8192
-
-static int orig_max_userns = -1;
-static int user_ns_supported = 1;
-static int max_groups = DEFAULT_MAX_GROUPS;
-static int max_marks = DEFAULT_MAX_MARKS;
-
-static struct tcase {
- const char *tname;
- unsigned int init_flags;
- /* 0: without userns, 1: with userns */
- int set_userns;
- /* 0: don't map root UID in userns, 1: map root UID in userns */
- int map_root;
- /* 0: unlimited groups in userns */
- int max_user_groups;
- /* 0: unlimited marks in userns */
- int max_user_marks;
-} tcases[] = {
- {
- "Global groups limit in init user ns",
- FAN_CLASS_NOTIF,
- 0, 0, 0, 0,
- },
- {
- "Global groups limit in privileged user ns",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS,
- 1, 1, 0, 0,
- },
- {
- "Local groups limit in unprivileged user ns",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS,
- 1, 0, 10, 0,
- },
- {
- "Local marks limit in unprivileged user ns",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS,
- 1, 0, 0, 10,
- },
-};
-
-/* Verify that groups and marks cannot be created beyond limit */
-static void verify_user_limits(unsigned int init_flags, int groups, int marks)
-{
- int i, fd = 0, ret = 0;
-
- for (i = 0; i <= groups; i++) {
- fd = fanotify_init(init_flags, O_RDONLY);
- /*
- * Don't bother closing fd's, the child process will exit
- * and all fd's will be closed.
- */
- if (fd < 0)
- break;
-
- ret = fanotify_mark(fd, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD,
- TEST_FILE);
- if (ret < 0)
- break;
-
- }
- if (fd > 0 && i > groups) {
- tst_res(TFAIL,
- "Created %d groups and marks - "
- "groups limit (%d) exceeded", i, groups);
- } else if (!ret && i > marks) {
- tst_res(TFAIL,
- "Created %d groups and marks - "
- "marks limit (%d) exceeded", i, marks);
- } else if (ret < 0 && errno == ENOSPC && marks < groups) {
- /*
- * ENOSPC is to be returned to the calling process when
- * fanotify marks limit is reached.
- */
- tst_res(TPASS,
- "Created %d marks - "
- "below marks limit (%d)", i, marks);
- } else if (fd < 0 && errno == EMFILE) {
- /*
- * EMFILE is to be returned to the calling process when
- * fanotify groups limit is reached.
- */
- tst_res(TPASS,
- "Created %d groups - "
- "below groups limit (%d)", i, groups);
- } else if (errno == EPERM) {
- tst_res(TCONF,
- "unprivileged fanotify not supported by kernel?");
- } else if (fd < 0) {
- tst_brk(TBROK | TERRNO,
- "fd=%d, fanotify_init(%x, O_RDONLY) failed",
- fd, init_flags);
- } else if (ret < 0) {
- tst_brk(TBROK | TERRNO,
- "ret=%d, fanotify_mark(%d, FAN_MARK_ADD, FAN_OPEN, "
- "AT_FDCWD, '" TEST_FILE "') failed", ret, fd);
- }
-}
-
-static void do_unshare(int map_root)
-{
- int res;
-
- /* unshare() should support CLONE_NEWUSER flag since Linux 3.8 */
- res = unshare(CLONE_NEWUSER);
- if (res == -1)
- tst_brk(TFAIL | TERRNO, "unshare(CLONE_NEWUSER) failed");
-
- if (map_root) {
- /*
- * uid_map file should exist since Linux 3.8 because
- * it is available on Linux 3.5
- */
- if (access(UID_MAP, F_OK))
- tst_brk(TBROK, "file %s didn't exist", UID_MAP);
-
- SAFE_FILE_PRINTF(UID_MAP, "%d %d %d", 0, 0, 1);
- }
-}
-
-static void test_fanotify(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int groups = max_groups;
- int marks = max_marks;
- pid_t pid;
-
- tst_res(TINFO, "Test #%d: %s", n, tc->tname);
-
- if (tc->set_userns && !user_ns_supported) {
- tst_res(TCONF, "fanotify inside user namespace is not supported");
- return;
- }
-
- pid = SAFE_FORK();
- if (!pid) {
- if (tc->set_userns) {
- do_unshare(tc->map_root);
- /* Not changing global limits, only per userns limits */
- if (tc->max_user_groups && tc->max_user_groups < groups) {
- /* Further limit user ns groups */
- marks = groups = tc->max_user_groups;
- SAFE_FILE_PRINTF(USERNS_MAX_GROUPS, "%d", groups);
- }
- if (tc->max_user_marks && tc->max_user_marks < marks) {
- /* Further limit user ns marks */
- marks = tc->max_user_marks;
- SAFE_FILE_PRINTF(USERNS_MAX_MARKS, "%d", marks);
- }
- }
- verify_user_limits(tc->init_flags, groups, marks);
- exit(0);
- }
-
- tst_reap_children();
-}
-
-static void setup_rlimit(unsigned int max_files)
-{
- struct rlimit rlim;
-
- SAFE_GETRLIMIT(RLIMIT_NOFILE, &rlim);
- rlim.rlim_cur = max_files;
- SAFE_SETRLIMIT(RLIMIT_NOFILE, &rlim);
-}
-
-static void setup(void)
-{
- SAFE_TOUCH(TEST_FILE, 0666, NULL);
- /* Check for kernel fanotify support */
- REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, TEST_FILE);
-
- /*
- * The default value of max_user_namespaces is set to 0 on some distros,
- * We need to change the default value to call unshare().
- */
- if (access(SELF_USERNS, F_OK) != 0) {
- user_ns_supported = 0;
- } else if (!access(MAX_USERNS, F_OK)) {
- SAFE_FILE_SCANF(MAX_USERNS, "%d", &orig_max_userns);
- SAFE_FILE_PRINTF(MAX_USERNS, "%d", 10);
- }
-
- /*
- * In older kernels those limits were fixed in kernel and fanotify is
- * not permitted inside user ns.
- */
- if (access(GLOBAL_MAX_GROUPS, F_OK) && errno == ENOENT) {
- user_ns_supported = 0;
- } else {
- SAFE_FILE_SCANF(GLOBAL_MAX_GROUPS, "%d", &max_groups);
- SAFE_FILE_SCANF(GLOBAL_MAX_MARKS, "%d", &max_marks);
- }
- tst_res(TINFO, "max_fanotify_groups=%d max_fanotify_marks=%d",
- max_groups, max_marks);
-
- /* Make sure we are not limited by nr of open files */
- setup_rlimit(max_groups * 2);
-}
-
-static void cleanup(void)
-{
- if (orig_max_userns != -1)
- SAFE_FILE_PRINTF(MAX_USERNS, "%d", orig_max_userns);
-}
-
-static struct tst_test test = {
- .test = test_fanotify,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .forks_child = 1,
- .mount_device = 1,
- .mntpoint = MOUNT_PATH,
-};
-#else
- TST_TEST_TCONF("system doesn't have required fanotify support");
-#endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify18.c b/testcases/kernel/syscalls/fanotify/fanotify18.c
deleted file mode 100644
index 8a7eebba3..000000000
--- a/testcases/kernel/syscalls/fanotify/fanotify18.c
+++ /dev/null
@@ -1,200 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
- *
- * Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
- */
-
-/*\
- * [Description]
- * This set of tests is to ensure that the unprivileged listener feature of
- * fanotify is functioning as expected. The objective this test case file
- * is to validate whether any forbidden flags that are passed by an
- * unprivileged user return the correct error result.
- */
-
-#define _GNU_SOURCE
-#include "config.h"
-
-#include <pwd.h>
-#include <stdio.h>
-#include <errno.h>
-#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
-#include "fanotify.h"
-
-/*
- * This is a set of intialization flags that are not permitted to be used by an
- * unprivileged user. Thus, if supplied, either EPERM or EINVAL should be
- * returned to the calling process respectively.
- */
-#define DISALLOWED_INIT_FLAGS (FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS | \
- FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT | \
- FAN_REPORT_TID)
-
-/*
- * This is a set of mark flags that are not permitted to be used with an
- * unprivileged listener.
- */
-#define DISALLOWED_MARK_FLAGS (FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
-
-#define MOUNT_PATH "fs_mnt"
-#define TEST_FILE MOUNT_PATH "/testfile"
-
-static int fd_notify;
-
-static struct test_case_t {
- const char *name;
- unsigned long init_flags;
- unsigned long mark_flags;
- unsigned long long mark_mask;
-} test_cases[] = {
- {
- "init_flags: missing FAN_REPORT_FID",
- FAN_CLASS_NOTIF,
- 0, 0
- },
- {
- "init_flags: FAN_CLASS_CONTENT",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_CLASS_CONTENT,
- 0, 0
- },
- {
- "init_flags: FAN_CLASS_PRE_CONTENT",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_CLASS_PRE_CONTENT,
- 0, 0
- },
- {
- "init_flags: FAN_UNLIMITED_QUEUE",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_UNLIMITED_QUEUE,
- 0, 0
- },
- {
- "init_flags: FAN_UNLIMITED_MARKS",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_UNLIMITED_MARKS,
- 0, 0
- },
- {
- "init_flags: FAN_REPORT_TID",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_REPORT_TID,
- 0, 0
- },
- {
- "init_flags: FAN_CLASS_NOTIF, "
- "mark_flags: FAN_MARK_ADD | FAN_MARK_MOUNT",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_CLASS_NOTIF,
- FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_ALL_EVENTS
- },
- {
- "init_flags: FAN_CLASS_NOTIF, "
- "mark_flags: FAN_MARK_ADD | FAN_MARK_FILESYSTEM",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_CLASS_NOTIF,
- FAN_MARK_ADD | FAN_MARK_FILESYSTEM, FAN_ALL_EVENTS
- },
- {
- "init_flags: FAN_CLASS_NOTIF, "
- "mark_flags: FAN_MARK_ADD, "
- "mark_mask: FAN_ALL_EVENTS",
- FANOTIFY_REQUIRED_USER_INIT_FLAGS | FAN_CLASS_NOTIF,
- FAN_MARK_ADD, FAN_ALL_EVENTS
- }
-};
-
-static void test_fanotify(unsigned int n)
-{
- struct test_case_t *tc = &test_cases[n];
-
- tst_res(TINFO, "Test #%d %s", n, tc->name);
-
- /* Initialize fanotify */
- fd_notify = fanotify_init(tc->init_flags, O_RDONLY);
-
- if (fd_notify < 0) {
- if (errno == EPERM &&
- ((tc->init_flags & DISALLOWED_INIT_FLAGS) ||
- (tc->init_flags & FANOTIFY_REQUIRED_USER_INIT_FLAGS) !=
- FANOTIFY_REQUIRED_USER_INIT_FLAGS)) {
- tst_res(TPASS,
- "Received result EPERM, as expected");
- return;
- } else {
- tst_brk(TBROK | TERRNO,
- "fanotify_init(0x%lx, O_RDONLY) failed",
- tc->init_flags);
- }
- }
-
- /* Attempt to place mark on object */
- if (fanotify_mark(fd_notify, tc->mark_flags, tc->mark_mask, AT_FDCWD,
- TEST_FILE) < 0) {
- /*
- * Unprivileged users are only allowed to mark inodes and not
- * permitted to use access permissions
- */
- if (errno == EPERM &&
- (tc->mark_flags & DISALLOWED_MARK_FLAGS ||
- tc->mark_mask & FAN_ALL_PERM_EVENTS)) {
- tst_res(TPASS, "Received result EPERM, as expected");
- return;
- }
-
- tst_brk(TBROK | TERRNO,
- "fanotify_mark(%d, %lx, %llx, AT_FDCWD, %s) "
- "failed",
- fd_notify,
- tc->mark_flags,
- tc->mark_mask,
- TEST_FILE);
- }
-
- tst_res(TPASS,
- "fanotify_init() and fanotify_mark() returned successfully, "
- "as expected");
-}
-
-static void setup(void)
-{
- int fd;
-
- SAFE_TOUCH(TEST_FILE, 0666, NULL);
-
- /* Check for kernel fanotify support */
- REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, TEST_FILE);
-
- /* Relinquish privileged user */
- if (geteuid() == 0) {
- tst_res(TINFO,
- "Running as privileged user, revoking permissions.");
- struct passwd *nobody = SAFE_GETPWNAM("nobody");
- SAFE_SETUID(nobody->pw_uid);
- }
-
- /* Check for unprivileged fanotify support */
- fd = fanotify_init(FANOTIFY_REQUIRED_USER_INIT_FLAGS, O_RDONLY);
- if (fd < 0) {
- tst_brk(TCONF,
- "unprivileged fanotify not supported by kernel?");
- }
- SAFE_CLOSE(fd);
-}
-
-static void cleanup(void)
-{
- if (fd_notify > 0)
- SAFE_CLOSE(fd_notify);
-}
-
-static struct tst_test test = {
- .test = test_fanotify,
- .tcnt = ARRAY_SIZE(test_cases),
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MOUNT_PATH,
-};
-
-#else
- TST_TEST_TCONF("system doesn't have required fanotify support");
-#endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify19.c b/testcases/kernel/syscalls/fanotify/fanotify19.c
deleted file mode 100644
index e4ac8a032..000000000
--- a/testcases/kernel/syscalls/fanotify/fanotify19.c
+++ /dev/null
@@ -1,255 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
- *
- * Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
- */
-
-/*\
- * [Description]
- * This set of tests is to ensure that the unprivileged listener feature of
- * fanotify is functioning as expected. The objective of this test file is
- * to generate a sequence of events and ensure that the returned events
- * contain the limited values that an unprivileged listener is expected
- * to receive.
- */
-
-#define _GNU_SOURCE
-#include "config.h"
-
-#include <pwd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-
-#include "tst_test.h"
-
-#ifdef HAVE_SYS_FANOTIFY_H
-#include "fanotify.h"
-
-#define EVENT_MAX 1024
-#define EVENT_SIZE (sizeof (struct fanotify_event_metadata))
-#define EVENT_BUF_LEN (EVENT_MAX * EVENT_SIZE)
-#define EVENT_SET_MAX 48
-
-#define BUF_SIZE 256
-
-#define MOUNT_PATH "fs_mnt"
-#define TEST_FILE MOUNT_PATH "/testfile"
-
-static int fd_notify;
-static char buf[BUF_SIZE];
-static struct fanotify_event_metadata event_buf[EVENT_BUF_LEN];
-
-static struct test_case_t {
- const char *name;
- unsigned int fork;
- unsigned int event_count;
- unsigned long long event_set[EVENT_SET_MAX];
-} test_cases[] = {
- {
- "unprivileged listener - events by self",
- 0,
- 4,
- {
- FAN_OPEN,
- FAN_ACCESS,
- FAN_MODIFY,
- FAN_CLOSE,
- }
- },
- {
- "unprivileged lisneter - events by child",
- 1,
- 4,
- {
- FAN_OPEN,
- FAN_ACCESS,
- FAN_MODIFY,
- FAN_CLOSE,
- }
- }
-};
-
-static void generate_events(void)
-{
- int fd;
-
- /* FAN_OPEN */
- fd = SAFE_OPEN(TEST_FILE, O_RDWR);
-
- /* FAN_ACCESS */
- SAFE_READ(0, fd, buf, BUF_SIZE);
-
- /* FAN_MODIFY */
- SAFE_WRITE(1, fd, TEST_FILE, 1);
-
- /* FAN_CLOSE */
- SAFE_CLOSE(fd);
-}
-
-static void do_fork(void)
-{
- int status;
- pid_t child;
-
- child = SAFE_FORK();
-
- if (child == 0) {
- SAFE_CLOSE(fd_notify);
- generate_events();
- exit(0);
- }
-
- SAFE_WAITPID(child, &status, 0);
-
- if (WIFEXITED(child) && WEXITSTATUS(child) != 0)
- tst_brk(TBROK, "Child process terminated incorrectly. Aborting");
-}
-
-static void test_fanotify(unsigned int n)
-{
- int len = 0;
- pid_t pid = getpid();
- unsigned int test_number = 0;
- struct fanotify_event_metadata *event;
- struct test_case_t *tc = &test_cases[n];
-
- tst_res(TINFO, "Test #%d %s", n, tc->name);
-
- /* Initialize fanotify */
- fd_notify = fanotify_init(FANOTIFY_REQUIRED_USER_INIT_FLAGS, O_RDONLY);
-
- if (fd_notify < 0) {
- if (errno == EPERM || errno == EINVAL) {
- tst_res(TCONF,
- "unprivileged fanotify not supported by kernel?");
- return;
- } else {
- tst_brk(TBROK | TERRNO,
- "fanotify_init(FAN_CLASS_NOTIF, O_RDONLY) failed");
- }
- }
-
- /* Place mark on object */
- if (fanotify_mark(fd_notify, FAN_MARK_ADD, FAN_ALL_EVENTS,
- AT_FDCWD, TEST_FILE) < 0) {
- tst_brk(TBROK | TERRNO,
- "fanotify_mark(%d, FAN_MARK_ADD, %d, "
- "AT_FDCWD, %s) failed",
- fd_notify,
- FAN_ALL_EVENTS,
- TEST_FILE);
- }
-
- /* Generate events in either child or listening process */
- if (tc->fork)
- do_fork();
- else
- generate_events();
-
- /* Read events from queue */
- len = SAFE_READ(0, fd_notify, event_buf + len, EVENT_BUF_LEN - len);
-
- event = event_buf;
-
- /* Iterate over and validate events against expected result set */
- while (FAN_EVENT_OK(event, len) && test_number < tc->event_count) {
- if (!(event->mask & tc->event_set[test_number])) {
- tst_res(TFAIL,
- "Received unexpected event mask: mask=%llx "
- "pid=%u fd=%d",
- (unsigned long long) event->mask,
- (unsigned) event->pid,
- event->fd);
- } else if ((!tc->fork && event->pid != pid) ||
- (tc->fork && event->pid != 0)) {
- tst_res(TFAIL,
- "Received unexpected pid in event: "
- "mask=%llx pid=%u (expected %u) fd=%d",
- (unsigned long long) event->mask,
- (unsigned) event->pid,
- (tc->fork ? 0 : pid),
- event->fd);
- } else if (event->fd != FAN_NOFD) {
- tst_res(TFAIL,
- "Received unexpected file descriptor: "
- "mask=%llx pid=%u fd=%d (expected %d)",
- (unsigned long long) event->pid,
- (unsigned) event->pid,
- event->fd,
- FAN_NOFD);
- SAFE_CLOSE(event->fd);
- } else {
- tst_res(TPASS,
- "Received event: mask=%llx, pid=%u fd=%d",
- (unsigned long long) event->mask,
- (unsigned) event->pid,
- event->fd);
- }
-
- /* Non-permission events can be merged into a single event. */
- event->mask &= ~tc->event_set[test_number];
-
- if (event->mask == 0)
- event = FAN_EVENT_NEXT(event, len);
- test_number++;
- }
-
- /*
- * Determine whether there is still unprocessed events remaining in the
- * buffer. This is to cover the basis whereby the event processing loop
- * terminates prematurely. In that case, we need to ensure that any
- * event file descriptor that is open is closed so that the temporary
- * filesystem can be unmounted.
- */
- if (FAN_EVENT_OK(event, len)) {
- tst_res(TFAIL,
- "Event processing loop exited prematurely. Did NOT "
- "finish processing events in buffer. Cleaning up.");
- while (FAN_EVENT_OK(event, len)) {
- if (event->fd != FAN_NOFD)
- SAFE_CLOSE(event->fd);
- event = FAN_EVENT_NEXT(event, len);
- }
- }
-}
-
-static void setup(void)
-{
- SAFE_FILE_PRINTF(TEST_FILE, "1");
- SAFE_CHMOD(TEST_FILE, 0666);
-
- /* Check for kernel fanotify support */
- REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_FID, TEST_FILE);
-
- /* Relinquish privileged user */
- if (geteuid() == 0) {
- tst_res(TINFO,
- "Running as privileged user, revoking.");
- struct passwd *nobody = SAFE_GETPWNAM("nobody");
- SAFE_SETUID(nobody->pw_uid);
- }
-}
-
-static void cleanup(void)
-{
- if (fd_notify > 0)
- SAFE_CLOSE(fd_notify);
-}
-
-static struct tst_test test = {
- .test = test_fanotify,
- .tcnt = ARRAY_SIZE(test_cases),
- .setup = setup,
- .cleanup = cleanup,
- .forks_child = 1,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MOUNT_PATH,
-};
-
-#else
- TST_TEST_TCONF("system doesn't have required fanotify support");
-#endif
diff --git a/testcases/kernel/syscalls/fchdir/Makefile b/testcases/kernel/syscalls/fchdir/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fchdir/Makefile
+++ b/testcases/kernel/syscalls/fchdir/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fchmod/Makefile b/testcases/kernel/syscalls/fchmod/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fchmod/Makefile
+++ b/testcases/kernel/syscalls/fchmod/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fchmodat/Makefile b/testcases/kernel/syscalls/fchmodat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fchmodat/Makefile
+++ b/testcases/kernel/syscalls/fchmodat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fchown/Makefile b/testcases/kernel/syscalls/fchown/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/fchown/Makefile
+++ b/testcases/kernel/syscalls/fchown/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fchownat/Makefile b/testcases/kernel/syscalls/fchownat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fchownat/Makefile
+++ b/testcases/kernel/syscalls/fchownat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fcntl/.gitignore b/testcases/kernel/syscalls/fcntl/.gitignore
index ede0c97b8..8d5738f97 100644
--- a/testcases/kernel/syscalls/fcntl/.gitignore
+++ b/testcases/kernel/syscalls/fcntl/.gitignore
@@ -70,7 +70,3 @@
/fcntl35_64
/fcntl36
/fcntl36_64
-/fcntl37
-/fcntl37_64
-/fcntl38
-/fcntl38_64
diff --git a/testcases/kernel/syscalls/fcntl/Makefile b/testcases/kernel/syscalls/fcntl/Makefile
index df663a50a..ae37214e5 100644
--- a/testcases/kernel/syscalls/fcntl/Makefile
+++ b/testcases/kernel/syscalls/fcntl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fcntl/fcntl01.c b/testcases/kernel/syscalls/fcntl/fcntl01.c
index 64d3bb96e..8d20be25e 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl01.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl01.c
@@ -46,8 +46,7 @@ int main(int ac, char **av)
int flags;
char fname[40];
int fd[10], fd2[10];
- int mypid;
- unsigned int i;
+ int mypid, i;
int lc;
tst_parse_opts(ac, av, NULL, NULL);
@@ -158,7 +157,7 @@ int main(int ac, char **av)
for (i = 0; i < ARRAY_SIZE(fd); i++)
close(fd[i]);
for (i = 0; i < 8; i++) {
- sprintf(fname, "./fcntl%u.%d", i, mypid);
+ sprintf(fname, "./fcntl%d.%d", i, mypid);
if ((unlink(fname)) == -1)
tst_resm(TFAIL | TERRNO,
"unlinking %s failed", fname);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl31.c b/testcases/kernel/syscalls/fcntl/fcntl31.c
index fd284fd7e..52b4932fa 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl31.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl31.c
@@ -116,12 +116,9 @@ static void setup(void)
pid = getpid();
- /* Changing process group ID is forbidden when PID == SID i.e. we are session leader */
- if (pid != getsid(0)) {
- ret = setpgrp();
- if (ret < 0)
- tst_brkm(TBROK | TERRNO, cleanup, "setpgrp() failed");
- }
+ ret = setpgrp();
+ if (ret < 0)
+ tst_brkm(TBROK | TERRNO, cleanup, "setpgrp() failed");
pgrp_pid = getpgid(0);
if (pgrp_pid < 0)
tst_brkm(TBROK | TERRNO, cleanup, "getpgid() failed");
diff --git a/testcases/kernel/syscalls/fcntl/fcntl33.c b/testcases/kernel/syscalls/fcntl/fcntl33.c
index 8d0d1a5a1..70d5ec5ff 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl33.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl33.c
@@ -81,6 +81,17 @@ static void setup(void)
SAFE_FILE_SCANF(PATH_LS_BRK_T, "%d", &ls_brk_t);
SAFE_FILE_PRINTF(PATH_LS_BRK_T, "%d", 45);
+ switch ((type = tst_fs_type("."))) {
+ case TST_NFS_MAGIC:
+ case TST_RAMFS_MAGIC:
+ case TST_TMPFS_MAGIC:
+ tst_brk(TCONF,
+ "Cannot do fcntl(F_SETLEASE, F_WRLCK) on %s filesystem",
+ tst_fs_type_name(type));
+ default:
+ break;
+ }
+
SAFE_TOUCH("file", FILE_MODE, NULL);
sigemptyset(&newset);
@@ -219,11 +230,5 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(test_cases),
.setup = setup,
.test = do_test,
- .cleanup = cleanup,
- .skip_filesystems = (const char *const []) {
- "tmpfs",
- "ramfs",
- "nfs",
- NULL
- },
+ .cleanup = cleanup
};
diff --git a/testcases/kernel/syscalls/fcntl/fcntl37.c b/testcases/kernel/syscalls/fcntl/fcntl37.c
deleted file mode 100644
index c52af22dd..000000000
--- a/testcases/kernel/syscalls/fcntl/fcntl37.c
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * Test basic error handling for fcntl(2) using F_SETPIPE_SZ, F_GETPIPE_SZ
- * argument.
- * 1)fcntl fails with EINVAL when cmd is F_SETPIPE_SZ and the arg is
- * beyond 1<<31.
- * 2)fcntl fails with EBUSY when cmd is F_SETPIPE_SZ and the arg is smaller
- * than the amount of the current used buffer space.
- * 3)fcntl fails with EPERM when cmd is F_SETPIPE_SZ and the arg is over
- * /proc/sys/fs/pipe-max-size limit under unprivileged users.
- */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <limits.h>
-#include <stdlib.h>
-#include "tst_test.h"
-#include "lapi/fcntl.h"
-#include "lapi/capability.h"
-
-static int fds[2];
-static unsigned int invalid_value, half_value, sys_value;
-
-static struct tcase {
- unsigned int *setvalue;
- int exp_err;
- char *message;
-} tcases[] = {
- {&invalid_value, EINVAL, "F_SETPIPE_SZ and size is beyond 1<<31"},
- {&half_value, EBUSY, "F_SETPIPE_SZ and size < data stored in pipe"},
- {&sys_value, EPERM, "F_SETPIPE_SZ and size is over limit for unpriviledged user"},
-};
-
-static void verify_fcntl(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- tst_res(TINFO, "%s", tc->message);
-
- TEST(fcntl(fds[1], F_SETPIPE_SZ, *(tc->setvalue)));
- if (TST_RET != -1) {
- tst_res(TFAIL, "F_SETPIPE_SZ succeed and return %ld", TST_RET);
- return;
- }
- if (TST_ERR == tc->exp_err)
- tst_res(TPASS | TTERRNO, "F_SETPIPE_SZ failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "F_SETPIPE_SZ failed expected %s got",
- tst_strerrno(tc->exp_err));
-}
-
-static void setup(void)
-{
- char *wrbuf;
- unsigned int orig_value;
-
- SAFE_PIPE(fds);
-
- TEST(fcntl(fds[1], F_GETPIPE_SZ));
- if (TST_ERR == EINVAL)
- tst_brk(TCONF, "kernel doesn't support F_GET/SETPIPE_SZ");
-
- orig_value = TST_RET;
-
- wrbuf = SAFE_MALLOC(orig_value);
- memset(wrbuf, 'x', orig_value);
- SAFE_WRITE(1, fds[1], wrbuf, orig_value);
- free(wrbuf);
-
- SAFE_FILE_SCANF("/proc/sys/fs/pipe-max-size", "%d", &sys_value);
- sys_value++;
-
- half_value = orig_value / 2;
- invalid_value = (1U << 31) + 1;
-}
-
-static void cleanup(void)
-{
- if (fds[0] > 0)
- SAFE_CLOSE(fds[0]);
- if (fds[1] > 0)
- SAFE_CLOSE(fds[1]);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_fcntl,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_DROP, CAP_SYS_RESOURCE),
- {}
- },
-};
diff --git a/testcases/kernel/syscalls/fcntl/fcntl38.c b/testcases/kernel/syscalls/fcntl/fcntl38.c
deleted file mode 100644
index 6185d3209..000000000
--- a/testcases/kernel/syscalls/fcntl/fcntl38.c
+++ /dev/null
@@ -1,96 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2020 CTERA Networks. All Rights Reserved.
- *
- * Started by Amir Goldstein <amir73il@gmail.com>
- *
- * DESCRIPTION
- * Check that dnotify event is reported to both parent and subdir
- */
-
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-#include "tst_test.h"
-#include "lapi/fcntl.h"
-
-#define TEST_DIR "test_dir"
-
-#define TEST_SIG SIGRTMIN+1
-
-static int parent_fd, subdir_fd;
-static int got_parent_event, got_subdir_event;
-
-static void dnotify_handler(int sig, siginfo_t *si, void *data __attribute__((unused)))
-{
- if (si->si_fd == parent_fd)
- got_parent_event = 1;
- else if (si->si_fd == subdir_fd)
- got_subdir_event = 1;
- else
- tst_brk(TBROK, "Got unexpected signal %d with si_fd %d", sig, si->si_fd);
-}
-
-static void setup_dnotify(int fd)
-{
- struct sigaction act;
-
- act.sa_sigaction = dnotify_handler;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO;
- sigaction(TEST_SIG, &act, NULL);
-
- TEST(fcntl(fd, F_SETSIG, TEST_SIG));
- if (TST_RET != 0) {
- tst_brk(TBROK, "F_SETSIG failed errno = %d : %s",
- TST_ERR, strerror(TST_ERR));
- }
- TEST(fcntl(fd, F_NOTIFY, DN_ATTRIB|DN_MULTISHOT));
- if (TST_RET != 0) {
- tst_brk(TBROK, "F_NOTIFY failed errno = %d : %s",
- TST_ERR, strerror(TST_ERR));
- }
-}
-
-static void verify_dnotify(void)
-{
- parent_fd = SAFE_OPEN(".", O_RDONLY);
- subdir_fd = SAFE_OPEN(TEST_DIR, O_RDONLY);
- /* Watch "." and its children for changes */
- setup_dnotify(parent_fd);
- /* Also watch subdir itself for changes */
- setup_dnotify(subdir_fd);
- /* Generate DN_ATTRIB event on subdir that should send a signal on both fds */
- SAFE_CHMOD(TEST_DIR, 0755);
- if (got_parent_event)
- tst_res(TPASS, "Got event on parent as expected");
- else
- tst_res(TFAIL, "Missing event on parent");
- if (got_subdir_event)
- tst_res(TPASS, "Got event on subdir as expected");
- else
- tst_res(TFAIL, "Missing event on subdir");
- SAFE_CLOSE(parent_fd);
- SAFE_CLOSE(subdir_fd);
-}
-
-static void setup(void)
-{
- SAFE_MKDIR(TEST_DIR, 00700);
-}
-
-static void cleanup(void)
-{
- if (parent_fd > 0)
- SAFE_CLOSE(parent_fd);
- if (subdir_fd > 0)
- SAFE_CLOSE(subdir_fd);
-}
-
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_dnotify,
-};
diff --git a/testcases/kernel/syscalls/fcntl/fcntl_common.h b/testcases/kernel/syscalls/fcntl/fcntl_common.h
index abb82c96f..92beb0c68 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl_common.h
+++ b/testcases/kernel/syscalls/fcntl/fcntl_common.h
@@ -1,6 +1,3 @@
-#ifndef FCNTL_COMMON_H__
-#define FCNTL_COMMON_H__
-
#include "lapi/syscalls.h"
#include "lapi/abisize.h"
@@ -34,5 +31,3 @@ static int my_fcntl(int fd, int cmd, void *lck)
return ret;
}
#endif
-
-#endif /* FCNTL_COMMON_H__ */
diff --git a/testcases/kernel/syscalls/fdatasync/Makefile b/testcases/kernel/syscalls/fdatasync/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fdatasync/Makefile
+++ b/testcases/kernel/syscalls/fdatasync/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync03.c b/testcases/kernel/syscalls/fdatasync/fdatasync03.c
index 5f3e0c96f..263175b85 100644
--- a/testcases/kernel/syscalls/fdatasync/fdatasync03.c
+++ b/testcases/kernel/syscalls/fdatasync/fdatasync03.c
@@ -58,8 +58,4 @@ static struct tst_test test = {
.all_filesystems = 1,
.mntpoint = MNTPOINT,
.test_all = verify_fdatasync,
- .skip_filesystems = (const char *[]) {
- "tmpfs",
- NULL
- }
};
diff --git a/testcases/kernel/syscalls/fgetxattr/Makefile b/testcases/kernel/syscalls/fgetxattr/Makefile
index e6674a6b2..f71e4fc25 100644
--- a/testcases/kernel/syscalls/fgetxattr/Makefile
+++ b/testcases/kernel/syscalls/fgetxattr/Makefile
@@ -5,4 +5,4 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk \ No newline at end of file
diff --git a/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c b/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c
index 82fb676be..02e81810a 100644
--- a/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c
+++ b/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c
@@ -210,8 +210,7 @@ static void setup(void)
size_t i = 0;
struct sockaddr_un sun;
- dev_t chr_dev = makedev(1, 3);
- dev_t blk_dev = makedev(7, 3);
+ dev_t dev = makedev(1, 3);
SAFE_TOUCH(FILENAME, 0644, NULL);
SAFE_TOUCH(SYMLINKF, 0644, NULL);
@@ -220,8 +219,8 @@ static void setup(void)
/* root: mknod(2) needs it to create something other than a file */
SAFE_MKNOD(FIFO, S_IFIFO | 0777, 0);
- SAFE_MKNOD(CHR, S_IFCHR | 0777, chr_dev);
- SAFE_MKNOD(BLK, S_IFBLK | 0777, blk_dev);
+ SAFE_MKNOD(CHR, S_IFCHR | 0777, dev);
+ SAFE_MKNOD(BLK, S_IFBLK | 0777, dev);
for (i = 0; i < ARRAY_SIZE(tc); i++) {
diff --git a/testcases/kernel/syscalls/finit_module/.gitignore b/testcases/kernel/syscalls/finit_module/.gitignore
deleted file mode 100644
index 5fcafdb37..000000000
--- a/testcases/kernel/syscalls/finit_module/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/finit_module01
-/finit_module02
-/*.ko
diff --git a/testcases/kernel/syscalls/finit_module/Makefile b/testcases/kernel/syscalls/finit_module/Makefile
deleted file mode 100644
index a529695d2..000000000
--- a/testcases/kernel/syscalls/finit_module/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-ifneq ($(KERNELRELEASE),)
-
-obj-m := finit_module.o
-
-else
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-REQ_VERSION_MAJOR := 3
-REQ_VERSION_PATCH := 8
-
-MAKE_TARGETS := finit_module01 finit_module02 finit_module.ko
-
-include $(top_srcdir)/include/mk/module.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-endif
diff --git a/testcases/kernel/syscalls/finit_module/finit_module.c b/testcases/kernel/syscalls/finit_module/finit_module.c
deleted file mode 100644
index 78d03b899..000000000
--- a/testcases/kernel/syscalls/finit_module/finit_module.c
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Dummy test module.
- *
- * The module accepts a single argument named "status" and it fails
- * initialization if the status is set to "invalid".
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <linux/kernel.h>
-
-static char status[20];
-module_param_string(status, status, 20, 0444);
-
-static int dummy_init(void)
-{
- struct proc_dir_entry *proc_dummy;
-
- if (!strcmp(status, "invalid"))
- return -EINVAL;
-
- proc_dummy = proc_mkdir("dummy", 0);
- return 0;
-}
-module_init(dummy_init);
-
-static void dummy_exit(void)
-{
- remove_proc_entry("dummy", 0);
-}
-module_exit(dummy_exit);
-
-MODULE_LICENSE("GPL");
diff --git a/testcases/kernel/syscalls/finit_module/finit_module01.c b/testcases/kernel/syscalls/finit_module/finit_module01.c
deleted file mode 100644
index 9c34282e1..000000000
--- a/testcases/kernel/syscalls/finit_module/finit_module01.c
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic finit_module() tests.
- *
- * [Algorithm]
- *
- * Inserts a simple module after opening and mmaping the module file.
- */
-
-#include <errno.h>
-#include "lapi/init_module.h"
-#include "tst_module.h"
-
-#define MODULE_NAME "finit_module.ko"
-
-static int fd;
-
-static char *mod_path;
-
-static void setup(void)
-{
- finit_module_supported_by_kernel();
-
- tst_module_exists(MODULE_NAME, &mod_path);
-
- fd = SAFE_OPEN(mod_path, O_RDONLY|O_CLOEXEC);
-}
-
-static void run(void)
-{
- TST_EXP_PASS(finit_module(fd, "status=valid", 0));
- if (!TST_PASS)
- return;
-
- tst_module_unload(MODULE_NAME);
-}
-
-static void cleanup(void)
-{
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/finit_module/finit_module02.c b/testcases/kernel/syscalls/finit_module/finit_module02.c
deleted file mode 100644
index 9d9255c6d..000000000
--- a/testcases/kernel/syscalls/finit_module/finit_module02.c
+++ /dev/null
@@ -1,136 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic finit_module() failure tests.
- *
- * [Algorithm]
- *
- * Tests various failure scenarios for finit_module().
- */
-
-#include <linux/capability.h>
-#include <errno.h>
-#include "lapi/init_module.h"
-#include "tst_module.h"
-#include "tst_capability.h"
-
-#define MODULE_NAME "finit_module.ko"
-#define TEST_DIR "test_dir"
-
-static char *mod_path;
-
-static int fd, fd_zero, fd_invalid = -1, fd_dir;
-
-static struct tst_cap cap_req = TST_CAP(TST_CAP_REQ, CAP_SYS_MODULE);
-static struct tst_cap cap_drop = TST_CAP(TST_CAP_DROP, CAP_SYS_MODULE);
-
-struct tcase {
- const char *name;
- int *fd;
- const char *param;
- int open_flags;
- int flags;
- int cap;
- int exp_errno;
- void (*fix_errno)(struct tcase *tc);
-};
-
-static void bad_fd_setup(struct tcase *tc)
-{
- if (tst_kvercmp(4, 6, 0) < 0)
- tc->exp_errno = ENOEXEC;
- else
- tc->exp_errno = EBADF;
-}
-
-static void wo_file_setup(struct tcase *tc)
-{
- if (tst_kvercmp(4, 6, 0) < 0)
- tc->exp_errno = EBADF;
- else
- tc->exp_errno = ETXTBSY;
-}
-
-static void dir_setup(struct tcase *tc)
-{
- if (tst_kvercmp(4, 6, 0) < 0)
- tc->exp_errno = EISDIR;
- else
- tc->exp_errno = EINVAL;
-}
-
-static struct tcase tcases[] = {
- {"invalid-fd", &fd_invalid, "", O_RDONLY | O_CLOEXEC, 0, 0, 0, bad_fd_setup},
- {"zero-fd", &fd_zero, "", O_RDONLY | O_CLOEXEC, 0, 0, EINVAL, NULL},
- {"null-param", &fd, NULL, O_RDONLY | O_CLOEXEC, 0, 0, EFAULT, NULL},
- {"invalid-param", &fd, "status=invalid", O_RDONLY | O_CLOEXEC, 0, 0, EINVAL, NULL},
- {"invalid-flags", &fd, "", O_RDONLY | O_CLOEXEC, -1, 0, EINVAL, NULL},
- {"no-perm", &fd, "", O_RDONLY | O_CLOEXEC, 0, 1, EPERM, NULL},
- {"module-exists", &fd, "", O_RDONLY | O_CLOEXEC, 0, 0, EEXIST, NULL},
- {"file-not-readable", &fd, "", O_WRONLY | O_CLOEXEC, 0, 0, 0, wo_file_setup},
- {"directory", &fd_dir, "", O_RDONLY | O_CLOEXEC, 0, 0, 0, dir_setup},
-};
-
-static void setup(void)
-{
- unsigned long int i;
-
- finit_module_supported_by_kernel();
-
- tst_module_exists(MODULE_NAME, &mod_path);
-
- SAFE_MKDIR(TEST_DIR, 0700);
- fd_dir = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
-
- for (i = 0; i < ARRAY_SIZE(tcases); i++) {
- if (tcases[i].fix_errno)
- tcases[i].fix_errno(&tcases[i]);
- }
-}
-
-static void cleanup(void)
-{
- SAFE_CLOSE(fd_dir);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- fd = SAFE_OPEN(mod_path, tc->open_flags);
-
- if (tc->cap)
- tst_cap_action(&cap_drop);
-
- /* Insert module twice */
- if (tc->exp_errno == EEXIST)
- tst_module_load(MODULE_NAME, NULL);
-
- TST_EXP_FAIL(finit_module(*tc->fd, tc->param, tc->flags), tc->exp_errno,
- "TestName: %s", tc->name);
-
- if (tc->exp_errno == EEXIST)
- tst_module_unload(MODULE_NAME);
-
- if (!TST_PASS && !TST_RET)
- tst_module_unload(MODULE_NAME);
-
- if (tc->cap)
- tst_cap_action(&cap_req);
-
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/flistxattr/Makefile b/testcases/kernel/syscalls/flistxattr/Makefile
index c2f84b159..b794ec01f 100644
--- a/testcases/kernel/syscalls/flistxattr/Makefile
+++ b/testcases/kernel/syscalls/flistxattr/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 RT-RK Institute for Computer Based Systems
# Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/flock/Makefile b/testcases/kernel/syscalls/flock/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/flock/Makefile
+++ b/testcases/kernel/syscalls/flock/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/flock/flock04.c b/testcases/kernel/syscalls/flock/flock04.c
index 89d1949cf..e4fd23c35 100644
--- a/testcases/kernel/syscalls/flock/flock04.c
+++ b/testcases/kernel/syscalls/flock/flock04.c
@@ -52,7 +52,7 @@ static void verify_flock(unsigned n)
fd2 = SAFE_OPEN("testfile", O_RDWR);
TEST(flock(fd2, tc->operation));
if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO, "flock() failed to acquire %s",
+ tst_res(TFAIL | TERRNO, "flock() failed to acquire %s",
tc->f_lock);
SAFE_CLOSE(fd2);
return;
diff --git a/testcases/kernel/syscalls/fmtmsg/Makefile b/testcases/kernel/syscalls/fmtmsg/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fmtmsg/Makefile
+++ b/testcases/kernel/syscalls/fmtmsg/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fork/Makefile b/testcases/kernel/syscalls/fork/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fork/Makefile
+++ b/testcases/kernel/syscalls/fork/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fork/fork04.c b/testcases/kernel/syscalls/fork/fork04.c
index 5e5e42c4e..208636c6b 100644
--- a/testcases/kernel/syscalls/fork/fork04.c
+++ b/testcases/kernel/syscalls/fork/fork04.c
@@ -144,7 +144,7 @@ static void child_environment(void)
fildes = creat(OUTPUT_FILE, 0700);
- for (index = 0; index < (int)NUMBER_OF_ENVIRON; index++) {
+ for (index = 0; index < NUMBER_OF_ENVIRON; index++) {
memset(msg, 0, MAX_LINE_LENGTH);
var = getenv(environ_list[index]);
@@ -238,7 +238,7 @@ void parent_environment(void)
int fildes;
char tmp_line[MAX_LINE_LENGTH];
char parent_value[MAX_LINE_LENGTH];
- unsigned int index;
+ int index;
int ret;
char *var;
diff --git a/testcases/kernel/syscalls/fork/fork12.c b/testcases/kernel/syscalls/fork/fork12.c
index 1c55c0c30..75278b012 100644
--- a/testcases/kernel/syscalls/fork/fork12.c
+++ b/testcases/kernel/syscalls/fork/fork12.c
@@ -70,12 +70,6 @@ int main(int ac, char **av)
forks = 0;
while ((pid1 = fork()) != -1) {
if (pid1 == 0) { /* child */
- /*
- * Taunt the OOM killer so that it doesn't
- * kill system processes
- */
- SAFE_FILE_PRINTF(NULL,
- "/proc/self/oom_score_adj", "500");
pause();
exit(0);
}
diff --git a/testcases/kernel/syscalls/fork/fork14.c b/testcases/kernel/syscalls/fork/fork14.c
index 93af2ebac..a92aa46ad 100644
--- a/testcases/kernel/syscalls/fork/fork14.c
+++ b/testcases/kernel/syscalls/fork/fork14.c
@@ -91,7 +91,7 @@ static void cleanup(void)
static int fork_test(void)
{
- int i, j, prev_failed = 0, fails = 0, cnt = 0;
+ int i, j, prev_failed = 0, fails = 0;
int reproduced = 0;
void *addr;
@@ -114,7 +114,6 @@ static int fork_test(void)
} else {
pointer_vec[i] = addr;
}
- cnt++;
switch (tst_fork()) {
case -1:
@@ -134,7 +133,7 @@ static int fork_test(void)
}
clear_memory_map:
- for (j = 0; j < cnt; j++) {
+ for (j = 0; j <= i; j++) {
if (pointer_vec[j])
SAFE_MUNMAP(cleanup, pointer_vec[j], 1 * GB);
}
diff --git a/testcases/kernel/syscalls/fpathconf/Makefile b/testcases/kernel/syscalls/fpathconf/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fpathconf/Makefile
+++ b/testcases/kernel/syscalls/fpathconf/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fremovexattr/Makefile b/testcases/kernel/syscalls/fremovexattr/Makefile
index e6674a6b2..f71e4fc25 100644
--- a/testcases/kernel/syscalls/fremovexattr/Makefile
+++ b/testcases/kernel/syscalls/fremovexattr/Makefile
@@ -5,4 +5,4 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk \ No newline at end of file
diff --git a/testcases/kernel/syscalls/fsconfig/.gitignore b/testcases/kernel/syscalls/fsconfig/.gitignore
deleted file mode 100644
index 2bc54b827..000000000
--- a/testcases/kernel/syscalls/fsconfig/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/fsconfig01
-/fsconfig02
diff --git a/testcases/kernel/syscalls/fsconfig/Makefile b/testcases/kernel/syscalls/fsconfig/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/syscalls/fsconfig/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig01.c b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
deleted file mode 100644
index a585daa6d..000000000
--- a/testcases/kernel/syscalls/fsconfig/fsconfig01.c
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fsconfig() test which tries to configure and mount the filesystem as
- * well.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-static int fd;
-
-static void cleanup(void)
-{
- if (fd != -1)
- SAFE_CLOSE(fd);
-}
-
-static void run(void)
-{
- int fsmfd;
-
- TEST(fd = fsopen(tst_device->fs_type, 0));
- if (fd == -1)
- tst_brk(TBROK | TTERRNO, "fsopen() failed");
-
- TEST(fsconfig(fd, FSCONFIG_SET_FLAG, "rw", NULL, 0));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_FLAG) failed");
-
- TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
-
- TEST(fsconfig(fd, FSCONFIG_SET_PATH, "sync", tst_device->dev, 0));
- if (TST_RET == -1) {
- if (TST_ERR == EOPNOTSUPP)
- tst_res(TCONF, "fsconfig(FSCONFIG_SET_PATH) not supported");
- else
- tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_PATH) failed");
- }
-
- TEST(fsconfig(fd, FSCONFIG_SET_PATH_EMPTY, "sync", tst_device->dev, 0));
- if (TST_RET == -1) {
- if (TST_ERR == EOPNOTSUPP)
- tst_res(TCONF, "fsconfig(FSCONFIG_SET_PATH_EMPTY) not supported");
- else
- tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_PATH_EMPTY) failed");
- }
-
- TEST(fsconfig(fd, FSCONFIG_SET_FD, "sync", NULL, 0));
- if (TST_RET == -1) {
- if (TST_ERR == EOPNOTSUPP)
- tst_res(TCONF, "fsconfig(FSCONFIG_SET_FD) not supported");
- else
- tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_FD) failed");
- }
-
- TEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_CREATE) failed");
-
- TEST(fsmfd = fsmount(fd, 0, 0));
- if (fsmfd == -1)
- tst_brk(TBROK | TTERRNO, "fsmount() failed");
-
- TEST(move_mount(fsmfd, "", AT_FDCWD, MNTPOINT,
- MOVE_MOUNT_F_EMPTY_PATH));
- SAFE_CLOSE(fsmfd);
-
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "move_mount() failed");
-
- if (tst_is_mounted_at_tmpdir(MNTPOINT)) {
- SAFE_UMOUNT(MNTPOINT);
- tst_res(TPASS, "fsconfig() passed");
- }
-
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = fsopen_supported_by_kernel,
- .cleanup = cleanup,
- .needs_root = 1,
- .format_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig02.c b/testcases/kernel/syscalls/fsconfig/fsconfig02.c
deleted file mode 100644
index 272e25a6f..000000000
--- a/testcases/kernel/syscalls/fsconfig/fsconfig02.c
+++ /dev/null
@@ -1,97 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fsconfig() failure tests.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-static int fd = -1, temp_fd = -1, invalid_fd = -1;
-static int aux_0 = 0, aux_1 = 1, aux_fdcwd = AT_FDCWD, aux_minus1 = -1;
-
-static struct tcase {
- char *name;
- int *fd;
- unsigned int cmd;
- const char *key;
- const void *value;
- int *aux;
- int exp_errno;
-} tcases[] = {
- {"invalid-fd", &invalid_fd, FSCONFIG_SET_FLAG, "user_xattr", NULL, &aux_0, EINVAL},
- {"invalid-cmd", &fd, 100, "rw", NULL, &aux_0, EOPNOTSUPP},
- {"set-flag-key", &fd, FSCONFIG_SET_FLAG, NULL, NULL, &aux_0, EINVAL},
- {"set-flag-value", &fd, FSCONFIG_SET_FLAG, "rw", "foo", &aux_0, EINVAL},
- {"set-flag-aux", &fd, FSCONFIG_SET_FLAG, "rw", NULL, &aux_1, EINVAL},
- {"set-string-key", &fd, FSCONFIG_SET_STRING, NULL, "#grand.central.org:root.cell.", &aux_0, EINVAL},
- {"set-string-value", &fd, FSCONFIG_SET_STRING, "source", NULL, &aux_0, EINVAL},
- {"set-string-aux", &fd, FSCONFIG_SET_STRING, "source", "#grand.central.org:root.cell.", &aux_1, EINVAL},
- {"set-binary-key", &fd, FSCONFIG_SET_BINARY, NULL, "foo", &aux_1, EINVAL},
- {"set-binary-value", &fd, FSCONFIG_SET_BINARY, "sync", NULL, &aux_1, EINVAL},
- {"set-binary-aux", &fd, FSCONFIG_SET_BINARY, "sync", "foo", &aux_0, EINVAL},
- {"set-path-key", &fd, FSCONFIG_SET_PATH, NULL, "/dev/foo", &aux_fdcwd, EINVAL},
- {"set-path-value", &fd, FSCONFIG_SET_PATH, "sync", NULL, &aux_fdcwd, EINVAL},
- {"set-path-aux", &fd, FSCONFIG_SET_PATH, "sync", "/dev/foo", &aux_minus1, EINVAL},
- {"set-path-empty-key", &fd, FSCONFIG_SET_PATH_EMPTY, NULL, "/dev/foo", &aux_fdcwd, EINVAL},
- {"set-path-empty-value", &fd, FSCONFIG_SET_PATH_EMPTY, "sync", NULL, &aux_fdcwd, EINVAL},
- {"set-path-empty-aux", &fd, FSCONFIG_SET_PATH_EMPTY, "sync", "/dev/foo", &aux_minus1, EINVAL},
- {"set-fd-key", &fd, FSCONFIG_SET_FD, NULL, NULL, &temp_fd, EINVAL},
- {"set-fd-value", &fd, FSCONFIG_SET_FD, "sync", "foo", &temp_fd, EINVAL},
- {"set-fd-aux", &fd, FSCONFIG_SET_FD, "sync", NULL, &aux_minus1, EINVAL},
- {"cmd-create-key", &fd, FSCONFIG_CMD_CREATE, "foo", NULL, &aux_0, EINVAL},
- {"cmd-create-value", &fd, FSCONFIG_CMD_CREATE, NULL, "foo", &aux_0, EINVAL},
- {"cmd-create-aux", &fd, FSCONFIG_CMD_CREATE, NULL, NULL, &aux_1, EINVAL},
- {"cmd-reconfigure-key", &fd, FSCONFIG_CMD_RECONFIGURE, "foo", NULL, &aux_0, EINVAL},
- {"cmd-reconfigure-value", &fd, FSCONFIG_CMD_RECONFIGURE, NULL, "foo", &aux_0, EINVAL},
- {"cmd-reconfigure-aux", &fd, FSCONFIG_CMD_RECONFIGURE, NULL, NULL, &aux_1, EINVAL},
-};
-
-static void setup(void)
-{
- fsopen_supported_by_kernel();
-
- TEST(fd = fsopen(tst_device->fs_type, 0));
- if (fd == -1)
- tst_brk(TBROK | TTERRNO, "fsopen() failed");
-
- temp_fd = SAFE_OPEN("testfile", O_RDWR | O_CREAT, 01444);
-}
-
-static void cleanup(void)
-{
- if (temp_fd != -1)
- SAFE_CLOSE(temp_fd);
- if (fd != -1)
- SAFE_CLOSE(fd);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- TEST(fsconfig(*tc->fd, tc->cmd, tc->key, tc->value, *tc->aux));
-
- if (TST_RET != -1) {
- tst_res(TFAIL, "%s: fsconfig() succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: fsconfig() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: fsconfig() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .needs_device = 1,
-};
diff --git a/testcases/kernel/syscalls/fsetxattr/Makefile b/testcases/kernel/syscalls/fsetxattr/Makefile
index e6674a6b2..f71e4fc25 100644
--- a/testcases/kernel/syscalls/fsetxattr/Makefile
+++ b/testcases/kernel/syscalls/fsetxattr/Makefile
@@ -5,4 +5,4 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk \ No newline at end of file
diff --git a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
index 3aea4b59e..205e80c95 100644
--- a/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
+++ b/testcases/kernel/syscalls/fsetxattr/fsetxattr02.c
@@ -241,6 +241,11 @@ static void cleanup(void)
}
}
+static const char *const needed_drivers[] = {
+ "brd",
+ NULL,
+};
+
static struct tst_test test = {
.setup = setup,
.test = verify_fsetxattr,
@@ -249,10 +254,7 @@ static struct tst_test test = {
.needs_devfs = 1,
.mntpoint = MNTPOINT,
.needs_root = 1,
- .needs_drivers = (const char *const[]) {
- "brd",
- NULL,
- },
+ .needs_drivers = needed_drivers,
};
#else /* HAVE_SYS_XATTR_H */
diff --git a/testcases/kernel/syscalls/fsmount/.gitignore b/testcases/kernel/syscalls/fsmount/.gitignore
deleted file mode 100644
index 7b77c5e33..000000000
--- a/testcases/kernel/syscalls/fsmount/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/fsmount01
-/fsmount02
diff --git a/testcases/kernel/syscalls/fsmount/Makefile b/testcases/kernel/syscalls/fsmount/Makefile
deleted file mode 100644
index bf798f437..000000000
--- a/testcases/kernel/syscalls/fsmount/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/fsmount/fsmount01.c b/testcases/kernel/syscalls/fsmount/fsmount01.c
deleted file mode 100644
index 5f755863f..000000000
--- a/testcases/kernel/syscalls/fsmount/fsmount01.c
+++ /dev/null
@@ -1,99 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Red Hat, Inc. All rights reserved.
- * Author: Zorro Lang <zlang@redhat.com>
- *
- * Basic fsmount() test.
- */
-
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-#define TCASE_ENTRY(_flags, _attrs) {.name = "Flag " #_flags ", Attr " #_attrs, .flags = _flags, .attrs = _attrs}
-
-static struct tcase {
- char *name;
- unsigned int flags;
- unsigned int attrs;
-} tcases[] = {
- TCASE_ENTRY(0, MOUNT_ATTR_RDONLY),
- TCASE_ENTRY(0, MOUNT_ATTR_NOSUID),
- TCASE_ENTRY(0, MOUNT_ATTR_NODEV),
- TCASE_ENTRY(0, MOUNT_ATTR_NOEXEC),
- TCASE_ENTRY(0, MOUNT_ATTR_RELATIME),
- TCASE_ENTRY(0, MOUNT_ATTR_NOATIME),
- TCASE_ENTRY(0, MOUNT_ATTR_STRICTATIME),
- TCASE_ENTRY(0, MOUNT_ATTR_NODIRATIME),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_RDONLY),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_NOSUID),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_NODEV),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_NOEXEC),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_RELATIME),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_NOATIME),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_STRICTATIME),
- TCASE_ENTRY(FSMOUNT_CLOEXEC, MOUNT_ATTR_NODIRATIME),
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int sfd, mfd;
-
- TEST(sfd = fsopen(tst_device->fs_type, FSOPEN_CLOEXEC));
- if (sfd == -1) {
- tst_res(TFAIL | TTERRNO, "fsopen() on %s failed",
- tst_device->fs_type);
- return;
- }
-
- TEST(fsconfig(sfd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
- if (TST_RET == -1) {
- SAFE_CLOSE(sfd);
- tst_res(TFAIL | TTERRNO,
- "fsconfig(FSCONFIG_SET_STRING) failed to set source to %s", tst_device->dev);
- return;
- }
-
- TEST(fsconfig(sfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
- if (TST_RET == -1) {
- SAFE_CLOSE(sfd);
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_CREATE) failed");
- return;
- }
-
- TEST(mfd = fsmount(sfd, tc->flags, tc->attrs));
- SAFE_CLOSE(sfd);
-
- if (mfd == -1) {
- tst_res(TFAIL | TTERRNO,
- "fsmount() failed to create a mount object");
- return;
- }
-
- TEST(move_mount(mfd, "", AT_FDCWD, MNTPOINT, MOVE_MOUNT_F_EMPTY_PATH));
- SAFE_CLOSE(mfd);
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO,
- "move_mount() failed to attach to the mount point");
- return;
- }
-
- if (tst_is_mounted_at_tmpdir(MNTPOINT)) {
- SAFE_UMOUNT(MNTPOINT);
- tst_res(TPASS, "%s: fsmount() passed", tc->name);
- }
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .mntpoint = MNTPOINT,
- .format_device = 1,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/fsmount/fsmount02.c b/testcases/kernel/syscalls/fsmount/fsmount02.c
deleted file mode 100644
index a4f42dc18..000000000
--- a/testcases/kernel/syscalls/fsmount/fsmount02.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fsmount() failure tests.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-int fd = -1, invalid_fd = -1;
-
-#define MNTPOINT "mntpoint"
-
-static struct tcase {
- char *name;
- int *fd;
- unsigned int flags;
- unsigned int mount_attrs;
- int exp_errno;
-} tcases[] = {
- {"invalid-fd", &invalid_fd, FSMOUNT_CLOEXEC, 0, EBADF},
- {"invalid-flags", &fd, 0x02, 0, EINVAL},
- {"invalid-attrs", &fd, FSMOUNT_CLOEXEC, 0x100, EINVAL},
-};
-
-static void cleanup(void)
-{
- if (fd != -1)
- SAFE_CLOSE(fd);
-}
-
-static void setup(void)
-{
- fsopen_supported_by_kernel();
-
- TEST(fd = fsopen(tst_device->fs_type, 0));
- if (fd == -1)
- tst_brk(TBROK | TTERRNO, "fsopen() failed");
-
- TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
-
- TEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "fsconfig(FSCONFIG_CMD_CREATE) failed");
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- TEST(fsmount(*tc->fd, tc->flags, tc->mount_attrs));
- if (TST_RET != -1) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: fsmount() succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: fsmount() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: fsmount() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .mntpoint = MNTPOINT,
- .format_device = 1,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/fsopen/.gitignore b/testcases/kernel/syscalls/fsopen/.gitignore
deleted file mode 100644
index 5da868621..000000000
--- a/testcases/kernel/syscalls/fsopen/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/fsopen01
-/fsopen02
diff --git a/testcases/kernel/syscalls/fsopen/Makefile b/testcases/kernel/syscalls/fsopen/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/syscalls/fsopen/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/fsopen/fsopen01.c b/testcases/kernel/syscalls/fsopen/fsopen01.c
deleted file mode 100644
index c2c719c96..000000000
--- a/testcases/kernel/syscalls/fsopen/fsopen01.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fsopen() test which tries to configure and mount the filesystem as
- * well.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-#define TCASE_ENTRY(_flags) {.name = "Flag " #_flags, .flags = _flags}
-
-static struct tcase {
- char *name;
- unsigned int flags;
-} tcases[] = {
- TCASE_ENTRY(0),
- TCASE_ENTRY(FSOPEN_CLOEXEC),
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int fd, fsmfd;
-
- TEST(fd = fsopen(tst_device->fs_type, tc->flags));
- if (fd == -1) {
- tst_res(TFAIL | TTERRNO, "fsopen() failed");
- return;
- }
-
- TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
- goto out;
- }
-
- TEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_CREATE) failed");
- goto out;
- }
-
- TEST(fsmfd = fsmount(fd, 0, 0));
- if (fsmfd == -1) {
- tst_res(TFAIL | TTERRNO, "fsmount() failed");
- goto out;
- }
-
- TEST(move_mount(fsmfd, "", AT_FDCWD, MNTPOINT,
- MOVE_MOUNT_F_EMPTY_PATH));
-
- SAFE_CLOSE(fsmfd);
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "move_mount() failed");
- goto out;
- }
-
- if (tst_is_mounted_at_tmpdir(MNTPOINT)) {
- SAFE_UMOUNT(MNTPOINT);
- tst_res(TPASS, "%s: fsopen() passed", tc->name);
- }
-
-out:
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .format_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/fsopen/fsopen02.c b/testcases/kernel/syscalls/fsopen/fsopen02.c
deleted file mode 100644
index 3f287bf29..000000000
--- a/testcases/kernel/syscalls/fsopen/fsopen02.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fsopen() failure tests.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-const char *invalid_fs = "invalid";
-const char *valid_fs;
-
-static struct tcase {
- char *name;
- const char **fs;
- unsigned int flags;
- int exp_errno;
-} tcases[] = {
- {"invalid-fs", &invalid_fs, 0, ENODEV},
- {"invalid-flags", &valid_fs, 0x10, EINVAL},
-};
-
-static void setup(void)
-{
- fsopen_supported_by_kernel();
-
- valid_fs = tst_device->fs_type;
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- TEST(fsopen(*tc->fs, tc->flags));
-
- if (TST_RET != -1) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: fsopen() succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: fsopen() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: fsopen() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_root = 1,
- .needs_device = 1,
-};
diff --git a/testcases/kernel/syscalls/fspick/.gitignore b/testcases/kernel/syscalls/fspick/.gitignore
deleted file mode 100644
index a8aa61dce..000000000
--- a/testcases/kernel/syscalls/fspick/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/fspick01
-/fspick02
diff --git a/testcases/kernel/syscalls/fspick/Makefile b/testcases/kernel/syscalls/fspick/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/syscalls/fspick/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/fspick/fspick01.c b/testcases/kernel/syscalls/fspick/fspick01.c
deleted file mode 100644
index d3309a912..000000000
--- a/testcases/kernel/syscalls/fspick/fspick01.c
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fspick() test.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-#define TCASE_ENTRY(_flags) {.name = "Flag " #_flags, .flags = _flags}
-
-static struct tcase {
- char *name;
- unsigned int flags;
-} tcases[] = {
- TCASE_ENTRY(FSPICK_CLOEXEC),
- TCASE_ENTRY(FSPICK_SYMLINK_NOFOLLOW),
- TCASE_ENTRY(FSPICK_NO_AUTOMOUNT),
- TCASE_ENTRY(FSPICK_EMPTY_PATH),
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int fspick_fd;
-
- TEST(fspick_fd = fspick(AT_FDCWD, MNTPOINT, tc->flags));
- if (fspick_fd == -1) {
- tst_res(TFAIL | TTERRNO, "fspick() failed");
- return;
- }
-
- TEST(fsconfig(fspick_fd, FSCONFIG_SET_STRING, "sync", "false", 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
- goto out;
- }
-
- TEST(fsconfig(fspick_fd, FSCONFIG_SET_FLAG, "ro", NULL, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_FLAG) failed");
- goto out;
- }
-
- TEST(fsconfig(fspick_fd, FSCONFIG_CMD_RECONFIGURE, NULL, NULL, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_RECONFIGURE) failed");
- goto out;
- }
-
- tst_res(TPASS, "%s: fspick() passed", tc->name);
-
-out:
- SAFE_CLOSE(fspick_fd);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/fspick/fspick02.c b/testcases/kernel/syscalls/fspick/fspick02.c
deleted file mode 100644
index f9a3697c1..000000000
--- a/testcases/kernel/syscalls/fspick/fspick02.c
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic fspick() failure tests.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-static struct tcase {
- char *name;
- int dirfd;
- const char *pathname;
- unsigned int flags;
- int exp_errno;
-} tcases[] = {
- {"invalid-fd", -1, MNTPOINT, FSPICK_NO_AUTOMOUNT | FSPICK_CLOEXEC, EBADF},
- {"invalid-path", AT_FDCWD, "invalid", FSPICK_NO_AUTOMOUNT | FSPICK_CLOEXEC, ENOENT},
- {"invalid-flags", AT_FDCWD, MNTPOINT, 0x10, EINVAL},
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- TEST(fspick(tc->dirfd, tc->pathname, tc->flags));
- if (TST_RET != -1) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: fspick() succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: fspick() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: fspick() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/fstat/Makefile b/testcases/kernel/syscalls/fstat/Makefile
index d97d2bad0..bf1201019 100644
--- a/testcases/kernel/syscalls/fstat/Makefile
+++ b/testcases/kernel/syscalls/fstat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fstat/fstat02.c b/testcases/kernel/syscalls/fstat/fstat02.c
index c0229de44..474456085 100644
--- a/testcases/kernel/syscalls/fstat/fstat02.c
+++ b/testcases/kernel/syscalls/fstat/fstat02.c
@@ -72,8 +72,6 @@ static void setup(void)
user_id = getuid();
group_id = getgid();
- umask(0);
-
fildes = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, FILE_MODE);
if (tst_fill_file(TESTFILE, 'a', FILE_SIZE, 1))
diff --git a/testcases/kernel/syscalls/fstat/fstat03.c b/testcases/kernel/syscalls/fstat/fstat03.c
index 4ff37e882..68fae43df 100644
--- a/testcases/kernel/syscalls/fstat/fstat03.c
+++ b/testcases/kernel/syscalls/fstat/fstat03.c
@@ -78,7 +78,7 @@ static void run(unsigned int tc_num)
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
return;
- tst_res(TFAIL, "child %s", tst_strstatus(status));
+ tst_res(TBROK, "child %s", tst_strstatus(status));
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/fstatat/Makefile b/testcases/kernel/syscalls/fstatat/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/fstatat/Makefile
+++ b/testcases/kernel/syscalls/fstatat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fstatfs/Makefile b/testcases/kernel/syscalls/fstatfs/Makefile
index d97d2bad0..bf1201019 100644
--- a/testcases/kernel/syscalls/fstatfs/Makefile
+++ b/testcases/kernel/syscalls/fstatfs/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fsync/Makefile b/testcases/kernel/syscalls/fsync/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/fsync/Makefile
+++ b/testcases/kernel/syscalls/fsync/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/fsync/fsync02.c b/testcases/kernel/syscalls/fsync/fsync02.c
index fcdc14f89..1e5f9ee00 100644
--- a/testcases/kernel/syscalls/fsync/fsync02.c
+++ b/testcases/kernel/syscalls/fsync/fsync02.c
@@ -1,113 +1,195 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Wayne Boyer, International Business Machines Corp., 2001
- * Copyright (c) 2019 SUSE LLC, Jozef Pupava <jpupava@suse.com>
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
- * Test Description:
- * Test fsync() return value on test file
- * fsync() has to finish within TIME_LIMIT.
+ * NAME
+ * fsync02.c
+ *
+ * DESCRIPTION
+ * Create a sparse file, fsync it, and time the fsync
+ *
+ * ALGORITHM
+ * 1. Create a file.
+ * 2. Write to the file at equally spaced intervals up to a max block
+ * 3. Check if the time limit was exceeded.
+ *
+ * USAGE: <for command-line>
+ * fsync02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * None
*/
#include <stdio.h>
-#include <stdlib.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/statvfs.h>
#include <fcntl.h>
+#include <errno.h>
#include <sys/resource.h>
+#include "test.h"
+#include "safe_macros.h"
#include <time.h>
-#include "tst_test.h"
#define BLOCKSIZE 8192
-#define MAXBLKS 65536
+#define MAXBLKS 262144
#define TIME_LIMIT 120
-#define BUF_SIZE 2048
+
+char *TCID = "fsync02";
+int TST_TOTAL = 1;
+
+void setup(void);
+void cleanup(void);
char tempfile[40] = "";
-char pbuf[BUF_SIZE];
-int fd;
+int fd, pid;
off_t max_blks = MAXBLKS;
struct statvfs stat_buf;
-static void setup(void) {
+int main(int ac, char **av)
+{
+ int lc;
+
+ off_t offsetret, offset;
+ char pbuf[BUFSIZ];
+ int ret, max_block = 0;
+ int i;
+ time_t time_start, time_end;
+ double time_delta;
+ int data_blocks = 0;
+ long int random_number;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ while (max_block <= data_blocks) {
+ random_number = random();
+ max_block = random_number % max_blks;
+ data_blocks = random_number % 1000 + 1;
+ }
+
+ for (i = 1; i <= data_blocks; i++) {
+ offset = i * ((BLOCKSIZE * max_block) / data_blocks);
+ offset -= BUFSIZ;
+ if ((offsetret = lseek(fd, offset, SEEK_SET)) != offset)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "lseek failed: %ld, %ld", offsetret,
+ offset);
+ if ((ret = write(fd, pbuf, BUFSIZ)) != BUFSIZ)
+ tst_brkm(TBROK, cleanup, "write failed");
+ }
+ if (time(&time_start) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "getting start time failed");
+
+ TEST(fsync(fd));
+
+ if (time(&time_end) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "getting end time failed");
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "fsync failed");
+ continue;
+ }
+
+ if (time_end < time_start)
+ tst_resm(TBROK,
+ "timer broken end %ld < start %ld",
+ time_end, time_start);
+
+ if ((time_delta =
+ difftime(time_end, time_start)) > TIME_LIMIT)
+ tst_resm(TFAIL,
+ "fsync took too long: %lf seconds; "
+ "max_block: %d; data_blocks: %d",
+ time_delta, max_block, data_blocks);
+ else
+ tst_resm(TPASS, "fsync succeeded in an "
+ "acceptable amount of time");
+
+ SAFE_FTRUNCATE(cleanup, fd, 0);
+ }
+
+ sync();
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test.
+ */
+void setup(void)
+{
/* free blocks avail to non-superuser */
unsigned long f_bavail;
- fd = SAFE_OPEN("tempfile", O_RDWR | O_CREAT | O_TRUNC, 0777);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- if (fstatvfs(fd, &stat_buf) != 0) {
- tst_brk(TBROK, "fstatvfs failed");
- }
+ TEST_PAUSE;
- f_bavail = (stat_buf.f_bavail * stat_buf.f_bsize) / BLOCKSIZE;
- if (f_bavail && (f_bavail < MAXBLKS)) {
+ /* make a temporary directory and cd to it */
+ tst_tmpdir();
+
+ sprintf(tempfile, "%s.%d", TCID, pid = getpid());
+ srand48(pid);
+
+ if ((fd = open(tempfile, O_RDWR | O_CREAT | O_TRUNC, 0777)) == -1)
+ tst_brkm(TBROK, cleanup, "open failed");
+
+ if (fstatvfs(fd, &stat_buf) != 0)
+ tst_brkm(TBROK, cleanup, "fstatvfs failed");
+
+ f_bavail = (stat_buf.f_bavail * stat_buf.f_frsize) / BLOCKSIZE;
+ if (f_bavail && (f_bavail < MAXBLKS))
max_blks = f_bavail;
- }
#ifdef LARGEFILE
- SAFE_FCNTL(fd, F_SETFL, O_LARGEFILE);
- SAFE_WRITE(1, fd, pbuf, BUF_SIZE);
+ if ((fcntl(fd, F_SETFL, O_LARGEFILE)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "fcntl(.., O_LARGEFILE) failed");
+
+ if (write(fd, pbuf, BUFSIZ) != BUFSIZ)
+ tst_brkm(TBROK | TERRNO, cleanup, "write(fd, pbuf, ..) failed");
#endif
}
-static void run(void) {
- off_t offset;
- int i;
- int max_block = 0;
- int data_blocks = 0;
- time_t time_start, time_end;
- double time_delta;
- long int random_number;
-
- random_number = rand();
- max_block = random_number % max_blks + 1;
- data_blocks = random_number % max_block;
+void cleanup(void)
+{
+ if (close(fd) == -1)
+ tst_resm(TWARN | TERRNO, "close failed");
- for (i = 1; i <= data_blocks; i++) {
- offset = i * ((BLOCKSIZE * max_block) / data_blocks);
- offset -= BUF_SIZE;
- SAFE_LSEEK(fd, offset, SEEK_SET);
- SAFE_WRITE(1, fd, pbuf, BUF_SIZE);
- }
- time_start = time(0);
-
- TEST(fsync(fd));
-
- time_end = time(0);
-
- if (time_end == -1) {
- tst_res(TFAIL | TTERRNO, "getting end time failed");
- } else if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "fsync failed");
- } else if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO,
- "fsync failed with unexpected return value");
- } else if (time_end < time_start) {
- tst_res(TFAIL,
- "timer broken end %ld < start %ld",
- time_end, time_start);
- } else if ((time_delta =
- difftime(time_end, time_start)) > TIME_LIMIT) {
- tst_res(TFAIL,
- "fsync took too long: %lf seconds; "
- "max_block: %d; data_blocks: %d",
- time_delta, max_block, data_blocks);
- } else {
- tst_res(TPASS,
- "fsync succeeded in an acceptable amount of time");
- }
- SAFE_FTRUNCATE(fd, 0);
-}
+ tst_rmdir();
-static void cleanup(void) {
- SAFE_CLOSE(fd);
}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1
-};
diff --git a/testcases/kernel/syscalls/fsync/fsync04.c b/testcases/kernel/syscalls/fsync/fsync04.c
index 9aa1584c1..1e4b8754c 100644
--- a/testcases/kernel/syscalls/fsync/fsync04.c
+++ b/testcases/kernel/syscalls/fsync/fsync04.c
@@ -58,8 +58,4 @@ static struct tst_test test = {
.all_filesystems = 1,
.mntpoint = MNTPOINT,
.test_all = verify_fsync,
- .skip_filesystems = (const char *[]) {
- "tmpfs",
- NULL
- }
};
diff --git a/testcases/kernel/syscalls/ftruncate/Makefile b/testcases/kernel/syscalls/ftruncate/Makefile
index a51e28017..54205d401 100644
--- a/testcases/kernel/syscalls/ftruncate/Makefile
+++ b/testcases/kernel/syscalls/ftruncate/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/futex/.gitignore b/testcases/kernel/syscalls/futex/.gitignore
index 54cd02b02..68bc2028e 100644
--- a/testcases/kernel/syscalls/futex/.gitignore
+++ b/testcases/kernel/syscalls/futex/.gitignore
@@ -6,6 +6,7 @@
/futex_wait04
/futex_wait05
/futex_wait_bitset01
+/futex_wait_bitset02
/futex_wake01
/futex_wake02
/futex_wake03
diff --git a/testcases/kernel/syscalls/futex/Makefile b/testcases/kernel/syscalls/futex/Makefile
index c88af7c96..1a0c0088a 100644
--- a/testcases/kernel/syscalls/futex/Makefile
+++ b/testcases/kernel/syscalls/futex/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2015 Cyril Hrubis <chrubis@suse.cz>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
@@ -12,6 +27,7 @@ futex_wake02: CFLAGS+=-pthread
futex_wake04: CFLAGS+=-pthread
futex_wait05: LDLIBS+=-lrt
futex_wait_bitset01: LDLIBS+=-lrt
+futex_wait_bitset02: LDLIBS+=-lrt
include $(top_srcdir)/include/mk/testcases.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
index 13e67c758..a2e899b8d 100644
--- a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
@@ -42,25 +42,14 @@ static struct tcase {
{1000, 300, 500},
};
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
static void do_child(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- struct tst_ts usec = tst_ts_from_ms(tv->tstype, max_sleep_ms);
int slept_for_ms = 0;
+ struct timespec usec = tst_ms_to_timespec(max_sleep_ms);
int pid = getpid();
int ret = 0;
- if (futex_wait(tv->fntype, &sd->futexes[0], sd->futexes[0], &usec, 0) == -1) {
+ if (futex_wait(&sd->futexes[0], sd->futexes[0], &usec, 0) == -1) {
if (errno == EAGAIN) {
/* spurious wakeup or signal */
tst_atomic_inc(&sd->spurious);
@@ -83,7 +72,6 @@ static void do_child(void)
static void verify_futex_cmp_requeue(unsigned int n)
{
- struct futex_test_variants *tv = &variants[tst_variant];
int num_requeues = 0, num_waits = 0, num_total = 0;
int i, status, spurious, woken_up;
struct tcase *tc = &tcases[n];
@@ -99,7 +87,7 @@ static void verify_futex_cmp_requeue(unsigned int n)
}
for (i = 0; i < tc->num_waiters; i++)
- TST_PROCESS_STATE_WAIT(pid[i], 'S', 0);
+ TST_PROCESS_STATE_WAIT(pid[i], 'S');
tst_res(TINFO, "Test %d: waiters: %d, wakes: %d, requeues: %d",
n, tc->num_waiters, tc->set_wakes, tc->set_requeues);
@@ -116,8 +104,8 @@ static void verify_futex_cmp_requeue(unsigned int n)
* specifies an upper limit on the number of waiters that are requeued.
* Returns the total number of waiters that were woken up or requeued.
*/
- TEST(futex_cmp_requeue(tv->fntype, &sd->futexes[0], sd->futexes[0],
- &sd->futexes[1], tc->set_wakes, tc->set_requeues, 0));
+ TEST(futex_cmp_requeue(&sd->futexes[0], sd->futexes[0], &sd->futexes[1],
+ tc->set_wakes, tc->set_requeues, 0));
/* Fail if more than requested wakes + requeues were returned */
if (TST_RET > exp_ret) {
@@ -127,8 +115,8 @@ static void verify_futex_cmp_requeue(unsigned int n)
tst_res(TINFO, "futex_cmp_requeue() returned %ld", TST_RET);
}
- num_requeues = futex_wake(tv->fntype, &sd->futexes[1], tc->num_waiters, 0);
- num_waits = futex_wake(tv->fntype, &sd->futexes[0], tc->num_waiters, 0);
+ num_requeues = futex_wake(&sd->futexes[1], tc->num_waiters, 0);
+ num_waits = futex_wake(&sd->futexes[0], tc->num_waiters, 0);
tst_atomic_store(1, &sd->test_done);
for (i = 0; i < tc->num_waiters; i++) {
@@ -190,11 +178,6 @@ static void verify_futex_cmp_requeue(unsigned int n)
static void setup(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-
max_sleep_ms = tst_multiply_timeout(5000);
sd = SAFE_MMAP(NULL, sizeof(*sd), PROT_READ | PROT_WRITE,
@@ -215,6 +198,5 @@ static struct tst_test test = {
.cleanup = cleanup,
.tcnt = ARRAY_SIZE(tcases),
.test = verify_futex_cmp_requeue,
- .test_variants = ARRAY_SIZE(variants),
.forks_child = 1,
};
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
index 0514b0ba4..228d8cff6 100644
--- a/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
@@ -32,23 +32,12 @@ static struct tcase {
{1, 1, FUTEX_INITIALIZER + 1, EAGAIN},
};
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
static void verify_futex_cmp_requeue(unsigned int n)
{
- struct futex_test_variants *tv = &variants[tst_variant];
struct tcase *tc = &tcases[n];
- TEST(futex_cmp_requeue(tv->fntype, &futexes[0], tc->exp_val,
- &futexes[1], tc->set_wakes, tc->set_requeues, 0));
+ TEST(futex_cmp_requeue(&futexes[0], tc->exp_val, &futexes[1],
+ tc->set_wakes, tc->set_requeues, 0));
if (TST_RET != -1) {
tst_res(TFAIL, "futex_cmp_requeue() succeeded unexpectedly");
return;
@@ -66,11 +55,6 @@ static void verify_futex_cmp_requeue(unsigned int n)
static void setup(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-
futexes = SAFE_MMAP(NULL, sizeof(futex_t) * 2, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_SHARED, -1, 0);
@@ -89,7 +73,6 @@ static struct tst_test test = {
.cleanup = cleanup,
.test = verify_futex_cmp_requeue,
.tcnt = ARRAY_SIZE(tcases),
- .test_variants = ARRAY_SIZE(variants),
.tags = (const struct tst_tag[]) {
{"CVE", "2018-6927"},
{"linux-git", "fbe0e839d1e2"},
diff --git a/testcases/kernel/syscalls/futex/futex_utils.h b/testcases/kernel/syscalls/futex/futex_utils.h
index 156895efb..63b97c00b 100644
--- a/testcases/kernel/syscalls/futex/futex_utils.h
+++ b/testcases/kernel/syscalls/futex/futex_utils.h
@@ -20,13 +20,10 @@
#ifndef FUTEX_UTILS_H__
#define FUTEX_UTILS_H__
-#include <stdio.h>
-#include <stdlib.h>
-
/*
* Wait for nr_threads to be sleeping
*/
-static inline int wait_for_threads(unsigned int nr_threads)
+static int wait_for_threads(unsigned int nr_threads)
{
char thread_state, name[1024];
DIR *dir;
@@ -35,31 +32,31 @@ static inline int wait_for_threads(unsigned int nr_threads)
snprintf(name, sizeof(name), "/proc/%i/task/", getpid());
- dir = SAFE_OPENDIR(name);
+ dir = SAFE_OPENDIR(NULL, name);
- while ((dent = SAFE_READDIR(dir))) {
+ while ((dent = SAFE_READDIR(NULL, dir))) {
/* skip ".", ".." and the main thread */
if (atoi(dent->d_name) == getpid() || atoi(dent->d_name) == 0)
continue;
snprintf(name, sizeof(name), "/proc/%i/task/%s/stat",
- getpid(), dent->d_name);
+ getpid(), dent->d_name);
- SAFE_FILE_SCANF(name, "%*i %*s %c", &thread_state);
+ SAFE_FILE_SCANF(NULL, name, "%*i %*s %c", &thread_state);
if (thread_state != 'S') {
- tst_res(TINFO, "Thread %s not sleeping yet", dent->d_name);
- SAFE_CLOSEDIR(dir);
+ tst_resm(TINFO, "Thread %s not sleeping yet", dent->d_name);
+ SAFE_CLOSEDIR(NULL, dir);
return 1;
}
cnt++;
}
- SAFE_CLOSEDIR(dir);
+ SAFE_CLOSEDIR(NULL, dir);
if (cnt != nr_threads) {
- tst_res(TINFO, "%u threads sleeping, expected %u", cnt,
- nr_threads);
+ tst_resm(TINFO, "%u threads sleeping, expected %u",
+ cnt, nr_threads);
}
return 0;
diff --git a/testcases/kernel/syscalls/futex/futex_wait01.c b/testcases/kernel/syscalls/futex/futex_wait01.c
index 02a3fca35..51a540d9e 100644
--- a/testcases/kernel/syscalls/futex/futex_wait01.c
+++ b/testcases/kernel/syscalls/futex/futex_wait01.c
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
@@ -6,13 +5,34 @@
* written by Darren Hart <dvhltc@us.ibm.com>
* Gowrishankar <gowrishankar.m@in.ibm.com>
*
- * 1. Block on a futex and wait for timeout.
- * 2. Test if FUTEX_WAIT op returns -EWOULDBLOCK if the futex value differs
- * from the expected one.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * 1. Block on a futex and wait for timeout.
+ * 2. Test if FUTEX_WAIT op returns -EWOULDBLOCK if the futex value differs
+ * from the expected one.
+ */
+
+#include <errno.h>
+#include "test.h"
#include "futextest.h"
+const char *TCID="futex_wait01";
+
struct testcase {
futex_t *f_addr;
futex_t f_val;
@@ -21,6 +41,7 @@ struct testcase {
};
static futex_t futex = FUTEX_INITIALIZER;
+static struct timespec to = {.tv_sec = 0, .tv_nsec = 10000};
static struct testcase testcases[] = {
{&futex, FUTEX_INITIALIZER, 0, ETIMEDOUT},
@@ -29,50 +50,38 @@ static struct testcase testcases[] = {
{&futex, FUTEX_INITIALIZER+1, FUTEX_PRIVATE_FLAG, EWOULDBLOCK},
};
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+const int TST_TOTAL=ARRAY_SIZE(testcases);
-static void run(unsigned int n)
+static void verify_futex_wait(struct testcase *tc)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- struct testcase *tc = &testcases[n];
- struct tst_ts to = tst_ts_from_ns(tv->tstype, 10000);
int res;
- res = futex_wait(tv->fntype, tc->f_addr, tc->f_val, &to, tc->opflags);
+ res = futex_wait(tc->f_addr, tc->f_val, &to, tc->opflags);
if (res != -1) {
- tst_res(TFAIL, "futex_wait() succeeded unexpectedly");
+ tst_resm(TFAIL, "futex_wait() returned %i, expected -1", res);
return;
}
if (errno != tc->exp_errno) {
- tst_res(TFAIL | TERRNO, "futex_wait() failed with incorrect error, expected errno=%s",
+ tst_resm(TFAIL | TERRNO, "expected errno=%s",
tst_strerrno(tc->exp_errno));
return;
}
- tst_res(TPASS | TERRNO, "futex_wait() passed");
+ tst_resm(TPASS | TERRNO, "futex_wait()");
}
-static void setup(void)
+int main(int argc, char *argv[])
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ int lc, i;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-}
+ tst_parse_opts(argc, argv, NULL, NULL);
-static struct tst_test test = {
- .setup = setup,
- .test = run,
- .tcnt = ARRAY_SIZE(testcases),
- .test_variants = ARRAY_SIZE(variants),
-};
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ for (i = 0; i < TST_TOTAL; i++)
+ verify_futex_wait(testcases + i);
+ }
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wait02.c b/testcases/kernel/syscalls/futex/futex_wait02.c
index c83e6cce4..1ca1df457 100644
--- a/testcases/kernel/syscalls/futex/futex_wait02.c
+++ b/testcases/kernel/syscalls/futex/futex_wait02.c
@@ -1,80 +1,105 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
- * Block on a futex and wait for wakeup.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This tests uses shared memory page to store the mutex variable.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * Block on a futex and wait for wakeup.
+ *
+ * This tests uses shared memory page to store the mutex variable.
+ */
#include <sys/mman.h>
#include <sys/wait.h>
+#include <errno.h>
+#include "test.h"
+#include "safe_macros.h"
#include "futextest.h"
-#include "futex_utils.h"
-
-static futex_t *futex;
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
-#endif
+const char *TCID="futex_wait02";
+const int TST_TOTAL=1;
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+static futex_t *futex;
static void do_child(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
int ret;
- TST_PROCESS_STATE_WAIT(getppid(), 'S', 1000);
+ tst_process_state_wait2(getppid(), 'S');
- ret = futex_wake(tv->fntype, futex, 1, 0);
+ ret = futex_wake(futex, 1, 0);
if (ret != 1)
- tst_res(TFAIL | TERRNO, "futex_wake() failed");
+ tst_brkm(TFAIL, NULL, "futex_wake() returned %i", ret);
- exit(0);
+ exit(TPASS);
}
-static void run(void)
+static void verify_futex_wait(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- int res, pid;
+ int res;
+ int pid;
- pid = SAFE_FORK();
- if (!pid)
+ pid = tst_fork();
+
+ switch (pid) {
+ case 0:
do_child();
+ break;
+ case -1:
+ tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+ break;
+ default:
+ break;
+ }
+
+ res = futex_wait(futex, *futex, NULL, 0);
- res = futex_wait(tv->fntype, futex, *futex, NULL, 0);
if (res) {
- tst_res(TFAIL | TERRNO, "futex_wait() failed");
- return;
+ tst_resm(TFAIL, "futex_wait() returned %i, errno %s",
+ res, tst_strerrno(errno));
}
- SAFE_WAIT(NULL);
- tst_res(TPASS, "futex_wait() woken up");
+ SAFE_WAIT(NULL, &res);
+
+ if (WIFEXITED(res) && WEXITSTATUS(res) == TPASS)
+ tst_resm(TPASS, "futex_wait() woken up");
+ else
+ tst_resm(TFAIL, "child failed");
}
static void setup(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-
- futex = SAFE_MMAP(NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
+ futex = SAFE_MMAP(NULL, NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_SHARED, -1, 0);
*futex = FUTEX_INITIALIZER;
}
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .forks_child = 1,
-};
+int main(int argc, char *argv[])
+{
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ verify_futex_wait();
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wait03.c b/testcases/kernel/syscalls/futex/futex_wait03.c
index 50eb61f7e..9683e7650 100644
--- a/testcases/kernel/syscalls/futex/futex_wait03.c
+++ b/testcases/kernel/syscalls/futex/futex_wait03.c
@@ -1,71 +1,87 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
- * Block on a futex and wait for wakeup.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This tests uses private mutexes with threads.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * Block on a futex and wait for wakeup.
+ *
+ * This tests uses private mutexes with threads.
+ */
-#include "futextest.h"
-#include "futex_utils.h"
-#include "tst_safe_pthread.h"
+#include <errno.h>
+#include <pthread.h>
-static futex_t futex = FUTEX_INITIALIZER;
+#include "test.h"
+#include "futextest.h"
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
-#endif
+const char *TCID="futex_wait03";
+const int TST_TOTAL=1;
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+static futex_t futex = FUTEX_INITIALIZER;
-static void *threaded(void *arg)
+static void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- long ret, pid = (long)arg;
+ long ret;
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
+ tst_process_state_wait2(getpid(), 'S');
- ret = futex_wake(tv->fntype, &futex, 1, FUTEX_PRIVATE_FLAG);
- if (ret != 1)
- tst_res(TFAIL, "futex_wake() returned %li", ret);
+ ret = futex_wake(&futex, 1, FUTEX_PRIVATE_FLAG);
return (void*)ret;
}
-static void run(void)
+static void verify_futex_wait(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- long res, pid = getpid();
+ long ret;
+ int res;
pthread_t t;
- SAFE_PTHREAD_CREATE(&t, NULL, threaded, (void*)pid);
+ res = pthread_create(&t, NULL, threaded, NULL);
+ if (res) {
+ tst_brkm(TBROK, NULL, "pthread_create(): %s",
+ tst_strerrno(res));
+ }
- res = futex_wait(tv->fntype, &futex, futex, NULL, FUTEX_PRIVATE_FLAG);
+ res = futex_wait(&futex, futex, NULL, FUTEX_PRIVATE_FLAG);
if (res) {
- tst_res(TFAIL | TERRNO, "futex_wait() failed");
- SAFE_PTHREAD_JOIN(t, NULL);
+ tst_resm(TFAIL, "futex_wait() returned %i, errno %s",
+ res, tst_strerrno(errno));
+ pthread_join(t, NULL);
return;
}
- SAFE_PTHREAD_JOIN(t, NULL);
- tst_res(TPASS, "futex_wait() woken up");
+ res = pthread_join(t, (void*)&ret);
+ if (res)
+ tst_brkm(TBROK, NULL, "pthread_join(): %s", tst_strerrno(res));
+
+ if (ret != 1)
+ tst_resm(TFAIL, "futex_wake() returned %li", ret);
+ else
+ tst_resm(TPASS, "futex_wait() woken up");
}
-static void setup(void)
+int main(int argc, char *argv[])
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ int lc;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-}
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ verify_futex_wait();
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
-};
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wait04.c b/testcases/kernel/syscalls/futex/futex_wait04.c
index 500b74ae1..b8360ff80 100644
--- a/testcases/kernel/syscalls/futex/futex_wait04.c
+++ b/testcases/kernel/syscalls/futex/futex_wait04.c
@@ -1,58 +1,65 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
* Based on futextest (futext_wait_uninitialized_heap.c)
* written by KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
*
- * Wait on uninitialized heap. It shold be zero and FUTEX_WAIT should return
- * immediately. This test tests zero page handling in futex code.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * Wait on uninitialized heap. It shold be zero and FUTEX_WAIT should return
+ * immediately. This test tests zero page handling in futex code.
+ */
#include <errno.h>
+#include "test.h"
+#include "safe_macros.h"
#include "futextest.h"
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+const char *TCID="futex_wait04";
+const int TST_TOTAL=1;
+static struct timespec to = {.tv_sec = 0, .tv_nsec = 10000};
-static void run(void)
+static void verify_futex_wait(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- struct tst_ts to = tst_ts_from_ns(tv->tstype, 10000);
- size_t pagesize = getpagesize();
- void *buf;
int res;
+ void *buf;
+ size_t pagesize = getpagesize();
+ buf = SAFE_MMAP(NULL, NULL, pagesize, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
- buf = SAFE_MMAP(NULL, pagesize, PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+ res = futex_wait(buf, 1, &to, 0);
- res = futex_wait(tv->fntype, buf, 1, &to, 0);
if (res == -1 && errno == EWOULDBLOCK)
- tst_res(TPASS | TERRNO, "futex_wait() returned %i", res);
+ tst_resm(TPASS | TERRNO, "futex_wait() returned %i", res);
else
- tst_res(TFAIL | TERRNO, "futex_wait() returned %i", res);
+ tst_resm(TFAIL | TERRNO, "futex_wait() returned %i", res);
- SAFE_MUNMAP(buf, pagesize);
+ SAFE_MUNMAP(NULL, buf, pagesize);
}
-static void setup(void)
+int main(int argc, char *argv[])
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ int lc;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-}
+ tst_parse_opts(argc, argv, NULL, NULL);
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
-};
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ verify_futex_wait();
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wait05.c b/testcases/kernel/syscalls/futex/futex_wait05.c
index 8fad5d858..0c5939c53 100644
--- a/testcases/kernel/syscalls/futex/futex_wait05.c
+++ b/testcases/kernel/syscalls/futex/futex_wait05.c
@@ -1,12 +1,25 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015-2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-/*
- * 1. Block on a futex and wait for timeout.
- * 2. Check that the futex waited for expected time.
- */
+ /*
+ * 1. Block on a futex and wait for timeout.
+ * 2. Check that the futex waited for expected time.
+ */
#include <errno.h>
@@ -15,11 +28,11 @@
int sample_fn(int clk_id, long long usec)
{
- struct timespec to = tst_timespec_from_us(usec);
+ struct timespec to = tst_us_to_timespec(usec);
futex_t futex = FUTEX_INITIALIZER;
tst_timer_start(clk_id);
- TEST(syscall(SYS_futex, &futex, FUTEX_WAIT, futex, &to, NULL, 0));
+ TEST(futex_wait(&futex, futex, &to, 0));
tst_timer_stop();
tst_timer_sample();
diff --git a/testcases/kernel/syscalls/futex/futex_wait_bitset.h b/testcases/kernel/syscalls/futex/futex_wait_bitset.h
new file mode 100644
index 000000000..78075b366
--- /dev/null
+++ b/testcases/kernel/syscalls/futex/futex_wait_bitset.h
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#define TRESHOLD_US 100000
+#define DEFAULT_TIMEOUT_US 100010
+
+static void verify_futex_wait_bitset(long long wait_us, clock_t clk_id)
+{
+ struct timespec start, to, end;
+ futex_t futex = FUTEX_INITIALIZER;
+ u_int32_t bitset = 0xffffffff;
+ int flags = clk_id == CLOCK_REALTIME ? FUTEX_CLOCK_REALTIME : 0;
+
+ tst_res(TINFO, "testing futex_wait_bitset() timeout with %s",
+ clk_id == CLOCK_REALTIME ? "CLOCK_REALTIME" : "CLOCK_MONOTONIC");
+
+ clock_gettime(clk_id, &start);
+ to = tst_timespec_add_us(start, wait_us);
+
+ TEST(futex_wait_bitset(&futex, futex, &to, bitset, flags));
+
+ clock_gettime(clk_id, &end);
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "futex_wait_bitset() returned %li, expected -1",
+ TST_RET);
+ return;
+ }
+
+ if (TST_ERR == ENOSYS) {
+ tst_res(TCONF,
+ "In this kernel, futex() does not support FUTEX_WAIT_BITSET operation");
+ return;
+ }
+
+ if (TST_ERR != ETIMEDOUT) {
+ tst_res(TFAIL | TTERRNO, "expected %s",
+ tst_strerrno(ETIMEDOUT));
+ return;
+ }
+
+ if (tst_timespec_lt(end, to)) {
+ tst_res(TFAIL,
+ "futex_wait_bitset() woken up prematurely %llius, expected %llius",
+ tst_timespec_diff_us(end, start), wait_us);
+ return;
+ }
+
+ if (tst_timespec_diff_us(end, to) > TRESHOLD_US) {
+ tst_res(TFAIL,
+ "futex_wait_bitset() waited too long %llius, expected %llius",
+ tst_timespec_diff_us(end, start), wait_us);
+ return;
+ }
+
+ tst_res(TPASS, "futex_wait_bitset() waited %llius, expected %llius",
+ tst_timespec_diff_us(end, start), wait_us);
+}
+
+static void setup(void)
+{
+ tst_timer_check(USE_CLOCK);
+}
+
+static void run(void)
+{
+ verify_futex_wait_bitset(DEFAULT_TIMEOUT_US, USE_CLOCK);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .test_all = run,
+};
diff --git a/testcases/kernel/syscalls/futex/futex_wait_bitset01.c b/testcases/kernel/syscalls/futex/futex_wait_bitset01.c
index 6880df6a5..1ae3253cf 100644
--- a/testcases/kernel/syscalls/futex/futex_wait_bitset01.c
+++ b/testcases/kernel/syscalls/futex/futex_wait_bitset01.c
@@ -7,102 +7,13 @@
* 2. Check that the futex waited for expected time.
*/
+#include <errno.h>
+
#include "tst_test.h"
#include "tst_timer.h"
#include "futextest.h"
-#define THRESHOLD_US 100000
-#define DEFAULT_TIMEOUT_US 100010
-
-static struct test_case_t {
- clockid_t clk_id;
-} tcases[] = {
- { CLOCK_MONOTONIC },
- { CLOCK_REALTIME }
-};
-
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .gettime = sys_clock_gettime, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .gettime = sys_clock_gettime64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void verify_futex_wait_bitset(long long wait_us, clock_t clk_id)
-{
- struct futex_test_variants *tv = &variants[tst_variant];
- struct tst_ts start, to, end;
- futex_t futex = FUTEX_INITIALIZER;
- u_int32_t bitset = 0xffffffff;
- int flags = clk_id == CLOCK_REALTIME ? FUTEX_CLOCK_REALTIME : 0;
-
- start.type = end.type = to.type = tv->tstype;
-
- tst_res(TINFO, "testing futex_wait_bitset() timeout with %s",
- clk_id == CLOCK_REALTIME ? "CLOCK_REALTIME" : "CLOCK_MONOTONIC");
-
- tv->gettime(clk_id, tst_ts_get(&start));
- to = tst_ts_add_us(start, wait_us);
-
- TEST(futex_wait_bitset(tv->fntype, &futex, futex, &to, bitset, flags));
-
- tv->gettime(clk_id, tst_ts_get(&end));
-
- if (TST_RET != -1) {
- tst_res(TFAIL, "futex_wait_bitset() returned %li, expected -1",
- TST_RET);
- return;
- }
-
- if (TST_ERR == ENOSYS) {
- tst_res(TCONF,
- "In this kernel, futex() does not support FUTEX_WAIT_BITSET operation");
- return;
- }
-
- if (TST_ERR != ETIMEDOUT) {
- tst_res(TFAIL | TTERRNO, "expected %s",
- tst_strerrno(ETIMEDOUT));
- return;
- }
-
- if (tst_ts_lt(end, to)) {
- tst_res(TFAIL,
- "futex_wait_bitset() woken up prematurely %llius, expected %llius",
- tst_ts_diff_us(end, start), wait_us);
- return;
- }
-
- if (tst_ts_diff_us(end, to) > THRESHOLD_US) {
- tst_res(TFAIL,
- "futex_wait_bitset() waited too long %llius, expected %llius",
- tst_ts_diff_us(end, start), wait_us);
- return;
- }
-
- tst_res(TPASS, "futex_wait_bitset() waited %llius, expected %llius",
- tst_ts_diff_us(end, start), wait_us);
-}
-
-static void run(unsigned int n)
-{
- verify_futex_wait_bitset(DEFAULT_TIMEOUT_US, tcases[n].clk_id);
-}
-
-static void setup(void)
-{
- struct futex_test_variants *tv = &variants[tst_variant];
+#define USE_CLOCK CLOCK_MONOTONIC
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-}
+#include "futex_wait_bitset.h"
-static struct tst_test test = {
- .setup = setup,
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
- .test_variants = ARRAY_SIZE(variants),
-};
diff --git a/testcases/kernel/syscalls/futex/futex_wait_bitset02.c b/testcases/kernel/syscalls/futex/futex_wait_bitset02.c
new file mode 100644
index 000000000..4d532fc07
--- /dev/null
+++ b/testcases/kernel/syscalls/futex/futex_wait_bitset02.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * 1. Block on a bitset futex and wait for timeout, the difference between
+ * normal futex and bitset futex is that that the later have absolute timeout.
+ * 2. Check that the futex waited for expected time.
+ */
+
+#include <errno.h>
+
+#include "tst_test.h"
+#include "tst_timer.h"
+#include "futextest.h"
+
+#define USE_CLOCK CLOCK_REALTIME
+
+#include "futex_wait_bitset.h"
diff --git a/testcases/kernel/syscalls/futex/futex_wake01.c b/testcases/kernel/syscalls/futex/futex_wake01.c
index 1dcf2f094..42ea6f6e6 100644
--- a/testcases/kernel/syscalls/futex/futex_wake01.c
+++ b/testcases/kernel/syscalls/futex/futex_wake01.c
@@ -1,14 +1,33 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
- * futex_wake() returns 0 (0 woken up processes) when no processes wait on the mutex.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * futex_wake() returns 0 (0 woken up processes) when no processes wait on the mutex.
+ */
+#include <errno.h>
#include <limits.h>
+#include "test.h"
#include "futextest.h"
+const char *TCID="futex_wake01";
+
struct testcase {
futex_t *f_addr;
int nr_wake;
@@ -27,42 +46,32 @@ static struct testcase testcases[] = {
{&futex, INT_MAX, FUTEX_PRIVATE_FLAG},
};
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
-#endif
+const int TST_TOTAL=ARRAY_SIZE(testcases);
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void run(unsigned int n)
+static void verify_futex_wake(struct testcase *tc)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- struct testcase *tc = &testcases[n];
int res;
- res = futex_wake(tv->fntype, tc->f_addr, tc->nr_wake, tc->opflags);
+ res = futex_wake(tc->f_addr, tc->nr_wake, tc->opflags);
+
if (res != 0) {
- tst_res(TFAIL | TERRNO, "futex_wake() failed");
+ tst_resm(TFAIL, "futex_wake() returned %i, expected 0", res);
return;
}
- tst_res(TPASS, "futex_wake() passed");
+ tst_resm(TPASS, "futex_wake() returned 0");
}
-static void setup(void)
+int main(int argc, char *argv[])
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ int lc, i;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-}
+ tst_parse_opts(argc, argv, NULL, NULL);
-static struct tst_test test = {
- .setup = setup,
- .test = run,
- .tcnt = ARRAY_SIZE(testcases),
- .test_variants = ARRAY_SIZE(variants),
-};
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ for (i = 0; i < TST_TOTAL; i++)
+ verify_futex_wake(testcases + i);
+ }
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wake02.c b/testcases/kernel/syscalls/futex/futex_wake02.c
index 2eeec959d..8a4c2d58e 100644
--- a/testcases/kernel/syscalls/futex/futex_wake02.c
+++ b/testcases/kernel/syscalls/futex/futex_wake02.c
@@ -1,30 +1,40 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
- * Block several threads on a private mutex, then wake them up.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * Block several threads on a private mutex, then wake them up.
+ */
-#include <sys/types.h>
+#include <errno.h>
+#include <pthread.h>
+#include "test.h"
+#include "safe_macros.h"
#include "futextest.h"
#include "futex_utils.h"
-#include "tst_safe_pthread.h"
+
+const char *TCID="futex_wake02";
+const int TST_TOTAL=11;
static futex_t futex = FUTEX_INITIALIZER;
static volatile int threads_flags[55];
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
static int threads_awake(void)
{
int ret = 0;
@@ -48,10 +58,9 @@ static void clear_threads_awake(void)
static void *threaded(void *arg)
{
- struct futex_test_variants *tv = &variants[tst_variant];
long i = (long)arg;
- futex_wait(tv->fntype, &futex, futex, NULL, FUTEX_PRIVATE_FLAG);
+ futex_wait(&futex, futex, NULL, FUTEX_PRIVATE_FLAG);
threads_flags[i] = 1;
@@ -60,23 +69,27 @@ static void *threaded(void *arg)
static void do_child(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
- int i, j, awake;
+ int res, i, j, awake;
pthread_t t[55];
- for (i = 0; i < (int)ARRAY_SIZE(t); i++)
- SAFE_PTHREAD_CREATE(&t[i], NULL, threaded, (void*)((long)i));
+ for (i = 0; i < (int)ARRAY_SIZE(t); i++) {
+ res = pthread_create(&t[i], NULL, threaded, (void*)((long)i));
+ if (res) {
+ tst_brkm(TBROK, NULL, "pthread_create(): %s",
+ tst_strerrno(res));
+ }
+ }
while (wait_for_threads(ARRAY_SIZE(t)))
usleep(100);
for (i = 1; i <= 10; i++) {
clear_threads_awake();
- TEST(futex_wake(tv->fntype, &futex, i, FUTEX_PRIVATE_FLAG));
- if (i != TST_RET) {
- tst_res(TFAIL | TTERRNO,
- "futex_wake() woken up %li threads, expected %i",
- TST_RET, i);
+ res = futex_wake(&futex, i, FUTEX_PRIVATE_FLAG);
+ if (i != res) {
+ tst_resm(TFAIL,
+ "futex_wake() woken up %i threads, expected %i",
+ res, i);
}
for (j = 0; j < 100000; j++) {
@@ -88,25 +101,26 @@ static void do_child(void)
}
if (awake == i) {
- tst_res(TPASS, "futex_wake() woken up %i threads", i);
+ tst_resm(TPASS, "futex_wake() woken up %i threads", i);
} else {
- tst_res(TFAIL, "Woken up %i threads, expected %i",
- awake, i);
+ tst_resm(TFAIL, "Woken up %i threads, expected %i",
+ awake, i);
}
}
- TEST(futex_wake(tv->fntype, &futex, 1, FUTEX_PRIVATE_FLAG));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "futex_wake() woken up %li, none were waiting",
- TST_RET);
+ res = futex_wake(&futex, 1, FUTEX_PRIVATE_FLAG);
+
+ if (res) {
+ tst_resm(TFAIL, "futex_wake() woken up %i, none were waiting",
+ res);
} else {
- tst_res(TPASS, "futex_wake() woken up 0 threads");
+ tst_resm(TPASS, "futex_wake() woken up 0 threads");
}
for (i = 0; i < (int)ARRAY_SIZE(t); i++)
- SAFE_PTHREAD_JOIN(t[i], NULL);
+ pthread_join(t[i], NULL);
- exit(0);
+ tst_exit();
}
/*
@@ -121,23 +135,30 @@ static void do_child(void)
* under /proc/$PID/tasks/, but the subsequent open() fails with ENOENT because
* the thread was removed meanwhile.
*/
-static void run(void)
+static void verify_futex_wake(void)
{
- if (!SAFE_FORK())
+ int pid;
+
+ pid = tst_fork();
+
+ switch (pid) {
+ case 0:
do_child();
+ case -1:
+ tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+ default:
+ tst_record_childstatus(NULL, pid);
+ }
}
-static void setup(void)
+int main(int argc, char *argv[])
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ int lc;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-}
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ verify_futex_wake();
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .forks_child = 1,
-};
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wake03.c b/testcases/kernel/syscalls/futex/futex_wake03.c
index a56ae9222..d6e5e5422 100644
--- a/testcases/kernel/syscalls/futex/futex_wake03.c
+++ b/testcases/kernel/syscalls/futex/futex_wake03.c
@@ -1,46 +1,54 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
*
- * Block several processes on a mutex, then wake them up.
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+ /*
+ * Block several processes on a mutex, then wake them up.
+ */
+#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include "test.h"
+#include "safe_macros.h"
#include "futextest.h"
-#include "futex_utils.h"
-static futex_t *futex;
+const char *TCID="futex_wake03";
+const int TST_TOTAL=11;
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+static futex_t *futex;
static void do_child(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
-
- futex_wait(tv->fntype, futex, *futex, NULL, 0);
+ futex_wait(futex, *futex, NULL, 0);
exit(0);
}
static void do_wake(int nr_children)
{
- struct futex_test_variants *tv = &variants[tst_variant];
int res, i, cnt;
- TEST(futex_wake(tv->fntype, futex, nr_children, 0));
- if (TST_RET != nr_children) {
- tst_res(TFAIL | TTERRNO,
- "futex_wake() woken up %li children, expected %i",
- TST_RET, nr_children);
+ res = futex_wake(futex, nr_children, 0);
+
+ if (res != nr_children) {
+ tst_resm(TFAIL,
+ "futex_wake() woken up %i children, expected %i",
+ res, nr_children);
return;
}
@@ -55,57 +63,65 @@ static void do_wake(int nr_children)
}
if (cnt != nr_children) {
- tst_res(TFAIL, "reaped only %i childs, expected %i",
- cnt, nr_children);
+ tst_resm(TFAIL, "reaped only %i childs, expected %i",
+ cnt, nr_children);
} else {
- tst_res(TPASS, "futex_wake() woken up %i childs", cnt);
+ tst_resm(TPASS, "futex_wake() woken up %i childs", cnt);
}
}
-static void run(void)
+static void verify_futex_wake(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ int i, res;
pid_t pids[55];
- unsigned int i;
- for (i = 0; i < ARRAY_SIZE(pids); i++) {
- pids[i] = SAFE_FORK();
- if (!pids[i])
+ for (i = 0; i < (int)ARRAY_SIZE(pids); i++) {
+ pids[i] = tst_fork();
+
+ switch (pids[i]) {
+ case -1:
+ tst_brkm(TBROK | TERRNO, NULL, "fork()");
+ case 0:
do_child();
+ default:
+ break;
+ }
}
- for (i = 0; i < ARRAY_SIZE(pids); i++)
- TST_PROCESS_STATE_WAIT(pids[i], 'S', 0);
+ for (i = 0; i < (int)ARRAY_SIZE(pids); i++)
+ tst_process_state_wait2(pids[i], 'S');
for (i = 1; i <= 10; i++)
do_wake(i);
- TEST(futex_wake(tv->fntype, futex, 1, 0));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO,
- "futex_wake() woken up %li, none were waiting",
- TST_RET);
+ res = futex_wake(futex, 1, 0);
+
+ if (res) {
+ tst_resm(TFAIL, "futex_wake() woken up %u, none were waiting",
+ res);
} else {
- tst_res(TPASS, "futex_wake() woken up 0 children");
+ tst_resm(TPASS, "futex_wake() woken up 0 children");
}
}
static void setup(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
-
- futex = SAFE_MMAP(NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
+ futex = SAFE_MMAP(NULL, NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_SHARED, -1, 0);
*futex = FUTEX_INITIALIZER;
}
-static struct tst_test test = {
- .setup = setup,
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .forks_child = 1,
-};
+int main(int argc, char *argv[])
+{
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ verify_futex_wake();
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futex_wake04.c b/testcases/kernel/syscalls/futex/futex_wake04.c
index 2260a3936..f92bda53f 100644
--- a/testcases/kernel/syscalls/futex/futex_wake04.c
+++ b/testcases/kernel/syscalls/futex/futex_wake04.c
@@ -1,9 +1,23 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015 Yi Zhang <wetpzy@gmail.com>
* Li Wang <liwang@redhat.com>
*
- * DESCRIPTION:
+ * Licensed under the GNU GPLv2 or later.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ /* DESCRIPTION:
*
* It is a regression test for commit:
* http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
@@ -23,85 +37,120 @@
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
#include <sys/time.h>
#include <string.h>
+#include "test.h"
+#include "safe_macros.h"
#include "futextest.h"
#include "futex_utils.h"
#include "lapi/mmap.h"
-#include "tst_safe_stdio.h"
-#include "tst_safe_pthread.h"
-static futex_t *futex1, *futex2;
+#define PATH_MEMINFO "/proc/meminfo"
+#define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages"
+#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/"
-static struct tst_ts to;
+const char *TCID = "futex_wake04";
+const int TST_TOTAL = 1;
-static struct futex_test_variants variants[] = {
-#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+static futex_t *futex1, *futex2;
+
+static struct timespec to = {.tv_sec = 30, .tv_nsec = 0};
-#if (__NR_futex_time64 != __LTP__NR_INVALID_SYSCALL)
- { .fntype = FUTEX_FN_FUTEX64, .tstype = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+static long orig_hugepages;
static void setup(void)
{
- if (tst_hugepages == 0)
- tst_brk(TCONF, "No enough hugepages for testing.");
+ tst_require_root();
+
+ if ((tst_kvercmp(2, 6, 32)) < 0) {
+ tst_brkm(TCONF, NULL, "This test can only run on kernels "
+ "that are 2.6.32 or higher");
+ }
- struct futex_test_variants *tv = &variants[tst_variant];
+ if (access(PATH_HUGEPAGES, F_OK))
+ tst_brkm(TCONF, NULL, "Huge page is not supported.");
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- futex_supported_by_kernel(tv->fntype);
+ tst_tmpdir();
- to = tst_ts_from_ns(tv->tstype, 30 * NSEC_PER_SEC);
+ SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
+
+ if (orig_hugepages <= 0)
+ SAFE_FILE_PRINTF(NULL, PATH_NR_HUGEPAGES, "%d", 1);
+
+ TEST_PAUSE;
}
-static void *wait_thread1(void *arg LTP_ATTRIBUTE_UNUSED)
+static void cleanup(void)
+{
+ if (orig_hugepages <= 0)
+ SAFE_FILE_PRINTF(NULL, PATH_NR_HUGEPAGES, "%ld", orig_hugepages);
+
+ tst_rmdir();
+}
+
+static int read_hugepagesize(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
+ FILE *fp;
+ char line[BUFSIZ], buf[BUFSIZ];
+ int val;
+
+ fp = SAFE_FOPEN(cleanup, PATH_MEMINFO, "r");
+ while (fgets(line, BUFSIZ, fp) != NULL) {
+ if (sscanf(line, "%64s %d", buf, &val) == 2)
+ if (strcmp(buf, "Hugepagesize:") == 0) {
+ SAFE_FCLOSE(cleanup, fp);
+ return 1024 * val;
+ }
+ }
- futex_wait(tv->fntype, futex1, *futex1, &to, 0);
+ SAFE_FCLOSE(cleanup, fp);
+ tst_brkm(TBROK, NULL, "can't find \"%s\" in %s",
+ "Hugepagesize:", PATH_MEMINFO);
+}
+
+static void *wait_thread1(void *arg LTP_ATTRIBUTE_UNUSED)
+{
+ futex_wait(futex1, *futex1, &to, 0);
return NULL;
}
static void *wait_thread2(void *arg LTP_ATTRIBUTE_UNUSED)
{
- struct futex_test_variants *tv = &variants[tst_variant];
int res;
- errno = 0;
- res = futex_wait(tv->fntype, futex2, *futex2, &to, 0);
+ res = futex_wait(futex2, *futex2, &to, 0);
if (!res)
- tst_res(TPASS, "Hi hydra, thread2 awake!");
+ tst_resm(TPASS, "Hi hydra, thread2 awake!");
else
- tst_res(TFAIL | TERRNO, "Bug: wait_thread2 did not wake after 30 secs.");
+ tst_resm(TFAIL, "Bug: wait_thread2 did not wake after 30 secs.");
return NULL;
}
static void wakeup_thread2(void)
{
- struct futex_test_variants *tv = &variants[tst_variant];
void *addr;
- int hpsz, pgsz;
+ int hpsz, pgsz, res;
pthread_t th1, th2;
- hpsz = tst_get_hugepage_size();
- tst_res(TINFO, "Hugepagesize %i", hpsz);
+ hpsz = read_hugepagesize();
+ tst_resm(TINFO, "Hugepagesize %i", hpsz);
/*allocate some shared memory*/
addr = mmap(NULL, hpsz, PROT_WRITE | PROT_READ,
MAP_SHARED | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
if (addr == MAP_FAILED) {
- if (errno == ENOMEM)
- tst_brk(TCONF, "Cannot allocate hugepage, memory too fragmented?");
+ if (errno == ENOMEM) {
+ tst_brkm(TCONF, NULL,
+ "Cannot allocate hugepage, memory too fragmented?");
+ }
- tst_brk(TBROK | TERRNO, "Cannot allocate hugepage");
+ tst_brkm(TBROK | TERRNO, NULL, "Cannot allocate hugepage");
}
pgsz = getpagesize();
@@ -114,26 +163,47 @@ static void wakeup_thread2(void)
*futex2 = 0;
/*thread1 block on futex1 first,then thread2 block on futex2*/
- SAFE_PTHREAD_CREATE(&th1, NULL, wait_thread1, NULL);
- SAFE_PTHREAD_CREATE(&th2, NULL, wait_thread2, NULL);
+ res = pthread_create(&th1, NULL, wait_thread1, NULL);
+ if (res) {
+ tst_brkm(TBROK, NULL, "pthread_create(): %s",
+ tst_strerrno(res));
+ }
+
+ res = pthread_create(&th2, NULL, wait_thread2, NULL);
+ if (res) {
+ tst_brkm(TBROK, NULL, "pthread_create(): %s",
+ tst_strerrno(res));
+ }
while (wait_for_threads(2))
usleep(1000);
- futex_wake(tv->fntype, futex2, 1, 0);
- SAFE_PTHREAD_JOIN(th2, NULL);
- futex_wake(tv->fntype, futex1, 1, 0);
- SAFE_PTHREAD_JOIN(th1, NULL);
+ futex_wake(futex2, 1, 0);
+
+ res = pthread_join(th2, NULL);
+ if (res)
+ tst_brkm(TBROK, NULL, "pthread_join(): %s", tst_strerrno(res));
- SAFE_MUNMAP(addr, hpsz);
+ futex_wake(futex1, 1, 0);
+
+ res = pthread_join(th1, NULL);
+ if (res)
+ tst_brkm(TBROK, NULL, "pthread_join(): %s", tst_strerrno(res));
+
+ SAFE_MUNMAP(NULL, addr, hpsz);
}
-static struct tst_test test = {
- .setup = setup,
- .test_all = wakeup_thread2,
- .test_variants = ARRAY_SIZE(variants),
- .needs_root = 1,
- .min_kver = "2.6.32",
- .needs_tmpdir = 1,
- .request_hugepages = 1,
-};
+int main(int argc, char *argv[])
+{
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ wakeup_thread2();
+
+ cleanup();
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/futex/futextest.h b/testcases/kernel/syscalls/futex/futextest.h
index 3f2f36fef..5754d36da 100644
--- a/testcases/kernel/syscalls/futex/futextest.h
+++ b/testcases/kernel/syscalls/futex/futextest.h
@@ -1,14 +1,35 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright © International Business Machines Corp., 2009
- * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
+/******************************************************************************
+ *
+ * Copyright © International Business Machines Corp., 2009
+ * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * NAME
+ * futextest.h
*
* DESCRIPTION
* Glibc independent futex library for testing kernel functionality.
*
* AUTHOR
* Darren Hart <dvhltc@us.ibm.com>
- */
+ *
+ * HISTORY
+ * 2009-Nov-6: Initial version by Darren Hart <dvhltc@us.ibm.com>
+ *
+ *****************************************************************************/
#ifndef _FUTEXTEST_H
#define _FUTEXTEST_H
@@ -18,7 +39,6 @@
#include <sys/types.h>
#include <linux/futex.h>
#include "lapi/futex.h"
-#include "tst_timer.h"
#define FUTEX_INITIALIZER 0
@@ -62,42 +82,18 @@
# define FUTEX_CLOCK_REALTIME 256
#endif
-enum futex_fn_type {
- FUTEX_FN_FUTEX,
- FUTEX_FN_FUTEX64,
-};
-
-struct futex_test_variants {
- enum futex_fn_type fntype;
- enum tst_ts_type tstype;
- int (*gettime)(clockid_t clk_id, void *ts);
- char *desc;
-};
-
-static inline void futex_supported_by_kernel(enum futex_fn_type fntype)
-{
- if (fntype != FUTEX_FN_FUTEX64)
- return;
-
- /* Check if the syscall is implemented on the platform */
- TEST(sys_futex_time64(NULL, 0, 0, NULL, NULL, 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel/platform");
-}
-
/**
- * futex_syscall() - futex syscall wrapper
- * @fntype: Futex function type
+ * futex() - SYS_futex syscall wrapper
* @uaddr: address of first futex
* @op: futex op code
* @val: typically expected value of uaddr, but varies by op
- * @timeout: typically an absolute struct tst_ts (except where noted
+ * @timeout: typically an absolute struct timespec (except where noted
* otherwise). Overloaded by some ops
* @uaddr2: address of second futex for some ops\
* @val3: varies by op
* @opflags: flags to be bitwise OR'd with op, such as FUTEX_PRIVATE_FLAG
*
- * futex_syscall() is used by all the following futex op wrappers. It can also be
+ * futex() is used by all the following futex op wrappers. It can also be
* used for misuse and abuse testing. Generally, the specific op wrappers
* should be used instead. It is a macro instead of an static inline function as
* some of the types over overloaded (timeout is used for nr_requeue for
@@ -106,30 +102,17 @@ static inline void futex_supported_by_kernel(enum futex_fn_type fntype)
* These argument descriptions are the defaults for all
* like-named arguments in the following wrappers except where noted below.
*/
-static inline int futex_syscall(enum futex_fn_type fntype, futex_t *uaddr,
- int futex_op, futex_t val, void *timeout,
- futex_t *uaddr2, int val3, int opflags)
-{
- int (*func)(int *uaddr, int futex_op, int val, void *to, int *uaddr2, int val3);
-
- if (fntype == FUTEX_FN_FUTEX)
- func = sys_futex;
- else
- func = sys_futex_time64;
-
- return func((int *)uaddr, futex_op | opflags, val, timeout, (int *)uaddr2, val3);
-}
+#define futex(uaddr, op, val, timeout, uaddr2, val3, opflags) \
+ syscall(SYS_futex, uaddr, op | opflags, val, timeout, uaddr2, val3)
/**
* futex_wait() - block on uaddr with optional timeout
* @timeout: relative timeout
*/
static inline int
-futex_wait(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
- struct tst_ts *timeout, int opflags)
+futex_wait(futex_t *uaddr, futex_t val, struct timespec *timeout, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_WAIT, val,
- tst_ts_get(timeout), NULL, 0, opflags);
+ return futex(uaddr, FUTEX_WAIT, val, timeout, NULL, 0, opflags);
}
/**
@@ -137,10 +120,9 @@ futex_wait(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
* @nr_wake: wake up to this many tasks
*/
static inline int
-futex_wake(enum futex_fn_type fntype, futex_t *uaddr, int nr_wake, int opflags)
+futex_wake(futex_t *uaddr, int nr_wake, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_WAKE, nr_wake, NULL, NULL, 0,
- opflags);
+ return futex(uaddr, FUTEX_WAKE, nr_wake, NULL, NULL, 0, opflags);
}
/**
@@ -148,11 +130,11 @@ futex_wake(enum futex_fn_type fntype, futex_t *uaddr, int nr_wake, int opflags)
* @bitset: bitset to be used with futex_wake_bitset
*/
static inline int
-futex_wait_bitset(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
- struct tst_ts *timeout, u_int32_t bitset, int opflags)
+futex_wait_bitset(futex_t *uaddr, futex_t val, struct timespec *timeout,
+ u_int32_t bitset, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_WAIT_BITSET, val,
- tst_ts_get(timeout), NULL, bitset, opflags);
+ return futex(uaddr, FUTEX_WAIT_BITSET, val, timeout, NULL, bitset,
+ opflags);
}
/**
@@ -160,11 +142,10 @@ futex_wait_bitset(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
* @bitset: bitset to compare with that used in futex_wait_bitset
*/
static inline int
-futex_wake_bitset(enum futex_fn_type fntype, futex_t *uaddr, int nr_wake,
- u_int32_t bitset, int opflags)
+futex_wake_bitset(futex_t *uaddr, int nr_wake, u_int32_t bitset, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_WAKE_BITSET, nr_wake, NULL,
- NULL, bitset, opflags);
+ return futex(uaddr, FUTEX_WAKE_BITSET, nr_wake, NULL, NULL, bitset,
+ opflags);
}
/**
@@ -172,32 +153,30 @@ futex_wake_bitset(enum futex_fn_type fntype, futex_t *uaddr, int nr_wake,
* @detect: whether (1) or not (0) to perform deadlock detection
*/
static inline int
-futex_lock_pi(enum futex_fn_type fntype, futex_t *uaddr, struct tst_ts *timeout,
- int detect, int opflags)
+futex_lock_pi(futex_t *uaddr, struct timespec *timeout, int detect,
+ int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_LOCK_PI, detect,
- tst_ts_get(timeout), NULL, 0, opflags);
+ return futex(uaddr, FUTEX_LOCK_PI, detect, timeout, NULL, 0, opflags);
}
/**
* futex_unlock_pi() - release uaddr as a PI mutex, waking the top waiter
*/
static inline int
-futex_unlock_pi(enum futex_fn_type fntype, futex_t *uaddr, int opflags)
+futex_unlock_pi(futex_t *uaddr, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_UNLOCK_PI, 0, NULL, NULL, 0,
- opflags); }
+ return futex(uaddr, FUTEX_UNLOCK_PI, 0, NULL, NULL, 0, opflags);
+}
/**
* futex_wake_op() - FIXME: COME UP WITH A GOOD ONE LINE DESCRIPTION
*/
static inline int
-futex_wake_op(enum futex_fn_type fntype, futex_t *uaddr, futex_t *uaddr2,
- int nr_wake, int nr_wake2, int wake_op, int opflags)
+futex_wake_op(futex_t *uaddr, futex_t *uaddr2, int nr_wake, int nr_wake2,
+ int wake_op, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_WAKE_OP, nr_wake,
- (void *)((unsigned long)nr_wake2), uaddr2, wake_op,
- opflags);
+ return futex(uaddr, FUTEX_WAKE_OP, nr_wake, nr_wake2, uaddr2, wake_op,
+ opflags);
}
/**
@@ -209,12 +188,11 @@ futex_wake_op(enum futex_fn_type fntype, futex_t *uaddr, futex_t *uaddr2,
* favor of futex_cmp_requeue().
*/
static inline int
-futex_requeue(enum futex_fn_type fntype, futex_t *uaddr, futex_t *uaddr2,
- int nr_wake, int nr_requeue, int opflags)
+futex_requeue(futex_t *uaddr, futex_t *uaddr2, int nr_wake, int nr_requeue,
+ int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_REQUEUE, nr_wake,
- (void *)((unsigned long)nr_requeue), uaddr2, 0,
- opflags);
+ return futex(uaddr, FUTEX_REQUEUE, nr_wake, nr_requeue, uaddr2, 0,
+ opflags);
}
/**
@@ -223,12 +201,11 @@ futex_requeue(enum futex_fn_type fntype, futex_t *uaddr, futex_t *uaddr2,
* @nr_requeue: requeue up to this many tasks
*/
static inline int
-futex_cmp_requeue(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
- futex_t *uaddr2, int nr_wake, int nr_requeue, int opflags)
+futex_cmp_requeue(futex_t *uaddr, futex_t val, futex_t *uaddr2, int nr_wake,
+ int nr_requeue, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_CMP_REQUEUE, nr_wake,
- (void *)((unsigned long)nr_requeue), uaddr2, val,
- opflags);
+ return futex(uaddr, FUTEX_CMP_REQUEUE, nr_wake, nr_requeue, uaddr2,
+ val, opflags);
}
/**
@@ -240,11 +217,11 @@ futex_cmp_requeue(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
* paired with futex_cmp_requeue_pi().
*/
static inline int
-futex_wait_requeue_pi(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
- futex_t *uaddr2, struct tst_ts *timeout, int opflags)
+futex_wait_requeue_pi(futex_t *uaddr, futex_t val, futex_t *uaddr2,
+ struct timespec *timeout, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_WAIT_REQUEUE_PI, val,
- tst_ts_get(timeout), uaddr2, 0, opflags);
+ return futex(uaddr, FUTEX_WAIT_REQUEUE_PI, val, timeout, uaddr2, 0,
+ opflags);
}
/**
@@ -255,12 +232,11 @@ futex_wait_requeue_pi(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
* @nr_requeue: requeue up to this many tasks
*/
static inline int
-futex_cmp_requeue_pi(enum futex_fn_type fntype, futex_t *uaddr, futex_t val,
- futex_t *uaddr2, int nr_wake, int nr_requeue, int opflags)
+futex_cmp_requeue_pi(futex_t *uaddr, futex_t val, futex_t *uaddr2, int nr_wake,
+ int nr_requeue, int opflags)
{
- return futex_syscall(fntype, uaddr, FUTEX_CMP_REQUEUE_PI, nr_wake,
- (void *)((unsigned long)nr_requeue), uaddr2, val,
- opflags);
+ return futex(uaddr, FUTEX_CMP_REQUEUE_PI, nr_wake, nr_requeue, uaddr2, val,
+ opflags);
}
/**
diff --git a/testcases/kernel/syscalls/futimesat/Makefile b/testcases/kernel/syscalls/futimesat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/futimesat/Makefile
+++ b/testcases/kernel/syscalls/futimesat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/get_mempolicy/.gitignore b/testcases/kernel/syscalls/get_mempolicy/.gitignore
index 285d0a91e..3eafcde7d 100644
--- a/testcases/kernel/syscalls/get_mempolicy/.gitignore
+++ b/testcases/kernel/syscalls/get_mempolicy/.gitignore
@@ -1,2 +1 @@
/get_mempolicy01
-/get_mempolicy02
diff --git a/testcases/kernel/syscalls/get_mempolicy/Makefile b/testcases/kernel/syscalls/get_mempolicy/Makefile
index a108d8209..fb7e9ac70 100644
--- a/testcases/kernel/syscalls/get_mempolicy/Makefile
+++ b/testcases/kernel/syscalls/get_mempolicy/Makefile
@@ -1,14 +1,26 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2012-2020
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpnuma
-
include $(top_srcdir)/include/mk/testcases.mk
-LDLIBS += $(NUMA_LIBS)
-LTPLDLIBS = -lltpnuma
+CPPFLAGS += -I$(abs_srcdir)/../utils
+include $(top_srcdir)/testcases/kernel/include/lib.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
index 23f62091a..fcb677986 100644
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
+++ b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c
@@ -1,213 +1,320 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- * Copyright (c) Linux Test Project, 2009-2020
- * Copyright (c) Crackerjack Project, 2007-2008, Hitachi, Ltd
- *
- * Authors:
- * Takahiro Yasui <takahiro.yasui.mp@hitachi.com>
- * Yumiko Sugita <yumiko.sugita.yf@hitachi.com>
- * Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
- * Manas Kumar Nayak <maknayak@in.ibm.com> (original port to the legacy API)
- */
-
-/*\
- * [Description]
- *
- * Verify that get_mempolicy() returns a proper return value and errno for various cases.
- */
+/******************************************************************************/
+/* Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd */
+/* Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>, */
+/* Yumiko Sugita <yumiko.sugita.yf@hitachi.com>, */
+/* Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp> */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/******************************************************************************/
+/******************************************************************************/
+/* */
+/* File: get_mempolicy01.c */
+/* */
+/* Description: This tests the get_mempolicy() syscall */
+/* */
+/* Usage: <for command-line> */
+/* get_mempolicy01 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 1 */
+/* */
+/* Test Name: get_mempolicy01 */
+/* History: Porting from Crackerjack to LTP is done by */
+/* Manas Kumar Nayak maknayak@in.ibm.com> */
+/******************************************************************************/
#include "config.h"
-#include "tst_test.h"
-
-#ifdef HAVE_NUMA_V2
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <getopt.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <libgen.h>
+#if HAVE_NUMA_H
#include <numa.h>
+#endif
+#if HAVE_NUMAIF_H
#include <numaif.h>
-#include <errno.h>
-#include "tst_numa.h"
+#endif
+
+#include "test.h"
+#include "lapi/syscalls.h"
+#include "include_j_h.h"
+#include "common_j_h.c"
+#include "numa_helper.h"
+
+char *TCID = "get_mempolicy01";
+int TST_TOTAL = 1;
+
+#ifdef HAVE_NUMA_V2
#define MEM_LENGTH (4 * 1024 * 1024)
-#define PAGES_ALLOCATED 16u
-#define POLICY_DESC(x) .policy = x, .desc = "policy: "#x
-#define POLICY_DESC_NO_TARGET(x) .policy = x, .desc = "policy: "#x", no target"
-#define POLICY_DESC_FLAGS(x, y) .policy = x, .flags = y, .desc = "policy: "#x", flags: "#y
-#define POLICY_DESC_FLAGS_NO_TARGET(x, y) .policy = x, .flags = y, .desc = "policy: "#x", flags: "#y", no target"
+static int testno;
-static struct tst_nodemap *node;
-static struct bitmask *nodemask, *getnodemask, *empty_nodemask;
+enum test_type {
+ DEFAULT, /* get default policy */
+ ADDR, /* get policy of memory which include mapped address */
+ INVALID_POINTER,
+ INVALID_FLAGS,
+};
+
+enum from_node {
+ NONE,
+ SELF,
+};
struct test_case {
+ int ttype;
int policy;
- const char *desc;
- unsigned int flags;
- char *addr;
- int (*pre_test)(struct test_case *tc);
- int (*alloc)(struct test_case *tc);
- struct bitmask **exp_nodemask;
+ int from_node;
+ int ret;
+ int err;
};
-static int test_set_mempolicy_default(struct test_case *tc);
-static int test_set_mempolicy_none(struct test_case *tc);
-static int test_mbind_none(struct test_case *tc);
-static int test_mbind_default(struct test_case *tc);
-
+/* Test cases
+ *
+ * test status of errors on man page
+ *
+ * (NONE) man page hadn't been completed.
+ *
+ * test status of errors NOT on man page
+ *
+ * EFAULT v (invalid address)
+ * EINVAL v (invalid parameters)
+ */
static struct test_case tcase[] = {
- {
- POLICY_DESC_NO_TARGET(MPOL_DEFAULT),
- .alloc = test_set_mempolicy_none,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC(MPOL_BIND),
- .alloc = test_set_mempolicy_default,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC(MPOL_INTERLEAVE),
- .alloc = test_set_mempolicy_default,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC_NO_TARGET(MPOL_PREFERRED),
- .alloc = test_set_mempolicy_none,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC(MPOL_PREFERRED),
- .alloc = test_set_mempolicy_default,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC_FLAGS_NO_TARGET(MPOL_DEFAULT, MPOL_F_ADDR),
- .pre_test = test_mbind_none,
- .alloc = test_set_mempolicy_none,
- .exp_nodemask = &empty_nodemask,
- },
- {
- POLICY_DESC_FLAGS(MPOL_BIND, MPOL_F_ADDR),
- .pre_test = test_mbind_default,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC_FLAGS(MPOL_INTERLEAVE, MPOL_F_ADDR),
- .pre_test = test_mbind_default,
- .alloc = test_set_mempolicy_default,
- .exp_nodemask = &nodemask,
- },
- {
- POLICY_DESC_FLAGS_NO_TARGET(MPOL_PREFERRED, MPOL_F_ADDR),
- .pre_test = test_mbind_none,
- .alloc = test_set_mempolicy_none,
- .exp_nodemask = &empty_nodemask,
- },
- {
- POLICY_DESC_FLAGS(MPOL_PREFERRED, MPOL_F_ADDR),
- .pre_test = test_mbind_default,
- .alloc = test_set_mempolicy_default,
- .exp_nodemask = &nodemask,
- },
+ { /* case00 */
+ .ttype = DEFAULT,
+ .policy = MPOL_DEFAULT,
+ .from_node = NONE,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case01 */
+ .ttype = DEFAULT,
+ .policy = MPOL_BIND,
+ .from_node = SELF,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case02 */
+ .ttype = DEFAULT,
+ .policy = MPOL_INTERLEAVE,
+ .from_node = SELF,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case03 */
+ .ttype = DEFAULT,
+ .policy = MPOL_PREFERRED,
+ .from_node = NONE,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case04 */
+ .ttype = DEFAULT,
+ .policy = MPOL_PREFERRED,
+ .from_node = SELF,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case05 */
+ .ttype = ADDR,
+ .policy = MPOL_DEFAULT,
+ .from_node = NONE,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case06 */
+ .ttype = ADDR,
+ .policy = MPOL_BIND,
+ .from_node = SELF,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case07 */
+ .ttype = ADDR,
+ .policy = MPOL_INTERLEAVE,
+ .from_node = SELF,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case08 */
+ .ttype = ADDR,
+ .policy = MPOL_PREFERRED,
+ .from_node = NONE,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case09 */
+ .ttype = ADDR,
+ .policy = MPOL_PREFERRED,
+ .from_node = SELF,
+ .ret = 0,
+ .err = 0,
+ },
+ { /* case10 */
+ .ttype = INVALID_POINTER,
+ .policy = MPOL_DEFAULT,
+ .from_node = NONE,
+ .ret = -1,
+ .err = EFAULT,
+ },
+ { /* case11 */
+ .ttype = INVALID_FLAGS,
+ .policy = MPOL_DEFAULT,
+ .from_node = NONE,
+ .ret = -1,
+ .err = EINVAL,
+ },
};
-static int test_set_mempolicy_default(struct test_case *tc)
-{
- TEST(set_mempolicy(tc->policy, nodemask->maskp, nodemask->size));
- return TST_RET;
-}
+static int do_test(struct test_case *tc);
+static void setup(void);
+static void cleanup(void);
-static int test_set_mempolicy_none(struct test_case *tc)
+int main(int argc, char **argv)
{
- TEST(set_mempolicy(tc->policy, NULL, 0));
- return TST_RET;
-}
+ int i, ret, lc;
-static int test_mbind(struct test_case *tc, unsigned long *maskp, unsigned long size)
-{
- tc->addr = SAFE_MMAP(NULL, MEM_LENGTH, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ setup();
- TEST(mbind(tc->addr, MEM_LENGTH, tc->policy, maskp, size, 0));
- return TST_RET;
-}
+ ret = 0;
+ testno = (int)ARRAY_SIZE(tcase);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
-static int test_mbind_none(struct test_case *tc)
-{
- return test_mbind(tc, NULL, 0);
-}
+ for (i = 0; i < testno; i++) {
+ tst_resm(TINFO, "(case%02d) START", i);
+ ret = do_test(&tcase[i]);
+ tst_resm((ret == 0 ? TPASS : TFAIL | TERRNO),
+ "(case%02d) END", i);
+ }
+ }
-static int test_mbind_default(struct test_case *tc)
-{
- return test_mbind(tc, nodemask->maskp, nodemask->size);
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+static int do_test(struct test_case *tc)
{
- unsigned int i;
-
- node = tst_get_nodemap(TST_NUMA_MEM, PAGES_ALLOCATED * getpagesize() / 1024);
- if (node->cnt < 1)
- tst_brk(TCONF, "test requires at least one NUMA memory node");
-
- nodemask = numa_allocate_nodemask();
- empty_nodemask = numa_allocate_nodemask();
- getnodemask = numa_allocate_nodemask();
- numa_bitmask_setbit(nodemask, node->map[0]);
+ int ret, err, result, cmp_ok;
+ int policy, flags;
+ struct bitmask *nodemask = numa_allocate_nodemask();
+ struct bitmask *getnodemask = numa_allocate_nodemask();
+ char *p = NULL;
+ unsigned long len = MEM_LENGTH;
+ int test_node = -1;
+
+ ret = get_allowed_nodes(NH_MEMS, 1, &test_node);
+ if (ret < 0)
+ tst_brkm(TBROK | TERRNO, cleanup, "get_allowed_nodes: %d", ret);
+ numa_bitmask_setbit(nodemask, test_node);
+ switch (tc->ttype) {
+ case DEFAULT:
+ flags = 0;
+ p = NULL;
+ if (tc->from_node == NONE)
+ TEST(ltp_syscall(__NR_set_mempolicy, tc->policy,
+ NULL, 0));
+ else
+ TEST(ltp_syscall(__NR_set_mempolicy, tc->policy,
+ nodemask->maskp, nodemask->size));
+ if (TEST_RETURN < 0) {
+ tst_resm(TBROK | TERRNO, "set_mempolicy");
+ return -1;
+ }
- for (i = 0; i < ARRAY_SIZE(tcase); i++) {
- struct test_case *tc = &tcase[i];
+ break;
+ default:
+ flags = MPOL_F_ADDR;
+ p = mmap(NULL, len, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+ if (p == MAP_FAILED)
+ tst_brkm(TBROK | TERRNO, cleanup, "mmap");
+ if (tc->from_node == NONE)
+ TEST(ltp_syscall(__NR_mbind, p, len, tc->policy,
+ NULL, 0, 0));
+ else
+ TEST(ltp_syscall(__NR_mbind, p, len, tc->policy,
+ nodemask->maskp, nodemask->size, 0));
+ if (TEST_RETURN < 0) {
+ tst_resm(TBROK | TERRNO, "mbind");
+ return -1;
+ }
- if (tc->pre_test && tc->pre_test(tc))
- tst_brk(TFAIL | TERRNO, "test #%d: mbind() failed", i+1);
+ if (tc->ttype == INVALID_POINTER)
+#ifdef __ia64__
+ p = (char *)0x8000000000000000UL;
+#else
+ p = 0;
+#endif
- if (tc->alloc && tc->alloc(tc))
- tst_brk(TFAIL | TERRNO, "test #%d: set_mempolicy() failed", i+1);
+ if (tc->ttype == INVALID_FLAGS)
+ flags = -1;
}
+ errno = 0;
+ cmp_ok = 1;
+ TEST(ret = ltp_syscall(__NR_get_mempolicy, &policy, getnodemask->maskp,
+ getnodemask->size, p, flags));
+ err = TEST_ERRNO;
+ if (ret < 0)
+ goto TEST_END;
+
+ /* if policy == MPOL_DEFAULT, get_mempolicy doesn't return nodemask */
+ if (tc->policy == MPOL_DEFAULT)
+ numa_bitmask_clearall(nodemask);
+ cmp_ok = (tc->policy == policy && (tc->from_node == NONE ||
+ numa_bitmask_equal(nodemask,
+ getnodemask)));
+TEST_END:
+ result = (err != tc->err) || !cmp_ok;
+ PRINT_RESULT_CMP(0, tc->ret, tc->err, ret, err, cmp_ok);
+ return result;
}
static void cleanup(void)
{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(tcase); i++) {
- struct test_case *tc = &tcase[i];
-
- if (tc->pre_test)
- SAFE_MUNMAP(tc->addr, MEM_LENGTH);
- }
-
- numa_free_nodemask(nodemask);
- numa_free_nodemask(getnodemask);
- tst_nodemap_free(node);
+ tst_rmdir();
}
-static void do_test(unsigned int i)
+static void setup(void)
{
- struct test_case *tc = &tcase[i];
- int policy;
-
- tst_res(TINFO, "test #%d: %s", i+1, tc->desc);
+ /* check syscall availability */
+ ltp_syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0);
- TST_EXP_PASS(get_mempolicy(&policy, getnodemask->maskp, getnodemask->size,
- tc->addr, tc->flags), "%s", tc->desc);
+ if (!is_numa(NULL, NH_MEMS, 1))
+ tst_brkm(TCONF, NULL, "requires NUMA with at least 1 node");
- struct bitmask *exp_mask = *(tc->exp_nodemask);
-
- if (!numa_bitmask_equal(exp_mask, getnodemask)) {
- tst_res(TFAIL, "masks are not equal");
- tst_res_hexd(TINFO, exp_mask->maskp,
- exp_mask->size / 8, "expected:");
- tst_res_hexd(TINFO, getnodemask->maskp,
- getnodemask->size / 8, "returned:");
- }
+ TEST_PAUSE;
+ tst_tmpdir();
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcase),
- .test = do_test,
- .setup = setup,
- .cleanup = cleanup,
-};
-
#else
-TST_TEST_TCONF(NUMA_ERROR_MSG);
-#endif /* HAVE_NUMA_V2 */
+int main(void)
+{
+ tst_brkm(TCONF, NULL, NUMA_ERROR_MSG);
+}
+#endif
diff --git a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c b/testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c
deleted file mode 100644
index 4a855596d..000000000
--- a/testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- * Copyright (c) Linux Test Project, 2009-2020
- * Copyright (c) Crackerjack Project, 2007-2008, Hitachi, Ltd
- *
- * Authors:
- * Takahiro Yasui <takahiro.yasui.mp@hitachi.com>
- * Yumiko Sugita <yumiko.sugita.yf@hitachi.com>
- * Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
- * Manas Kumar Nayak <maknayak@in.ibm.com> (original port to the legacy API)
- */
-
-/*\
- * [Description]
- *
- * Verify that get_mempolicy() returns a proper return errno for failure cases.
- */
-
-#include "config.h"
-#include "tst_test.h"
-
-#ifdef HAVE_NUMA_V2
-#include <numa.h>
-#include <numaif.h>
-#include <errno.h>
-#include "tst_numa.h"
-
-#define PAGES_ALLOCATED 16u
-
-#define POLICY_DESC_TEXT(x, y) .policy = x, .desc = "policy: "#x", "y
-
-static struct tst_nodemap *node;
-static struct bitmask *nodemask;
-
-struct test_case {
- int policy;
- const char *desc;
- unsigned int flags;
- int err;
- char *addr;
-};
-
-static struct test_case tcase[] = {
- {
- POLICY_DESC_TEXT(MPOL_DEFAULT, "invalid address"),
- .addr = NULL,
- .err = EFAULT,
- .flags = MPOL_F_ADDR,
- },
- {
- POLICY_DESC_TEXT(MPOL_DEFAULT, "invalid flags, no target"),
- .err = EINVAL,
- .flags = -1,
- },
-};
-
-static void setup(void)
-{
- node = tst_get_nodemap(TST_NUMA_MEM, PAGES_ALLOCATED * getpagesize() / 1024);
- if (node->cnt < 1)
- tst_brk(TCONF, "test requires at least one NUMA memory node");
-
- nodemask = numa_allocate_nodemask();
-}
-
-static void cleanup(void)
-{
- numa_free_nodemask(nodemask);
- tst_nodemap_free(node);
-}
-
-static void do_test(unsigned int i)
-{
- struct test_case *tc = &tcase[i];
- int policy;
-
- TST_EXP_FAIL(get_mempolicy(&policy, nodemask->maskp, nodemask->size,
- tc->addr, tc->flags), tc->err, "%s", tc->desc);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcase),
- .test = do_test,
- .setup = setup,
- .cleanup = cleanup,
-};
-
-#else
-TST_TEST_TCONF(NUMA_ERROR_MSG);
-#endif /* HAVE_NUMA_V2 */
diff --git a/testcases/kernel/syscalls/get_robust_list/Makefile b/testcases/kernel/syscalls/get_robust_list/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/get_robust_list/Makefile
+++ b/testcases/kernel/syscalls/get_robust_list/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getcontext/Makefile b/testcases/kernel/syscalls/getcontext/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getcontext/Makefile
+++ b/testcases/kernel/syscalls/getcontext/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getcpu/Makefile b/testcases/kernel/syscalls/getcpu/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/getcpu/Makefile
+++ b/testcases/kernel/syscalls/getcpu/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getcwd/Makefile b/testcases/kernel/syscalls/getcwd/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getcwd/Makefile
+++ b/testcases/kernel/syscalls/getcwd/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getcwd/getcwd04.c b/testcases/kernel/syscalls/getcwd/getcwd04.c
index 2e07e675f..2fa65fb2c 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd04.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd04.c
@@ -68,6 +68,9 @@ static void verify_getcwd(void)
static void setup(void)
{
+ if (tst_ncpus() == 1)
+ tst_brk(TCONF, "This test needs two cpus at least");
+
SAFE_SIGNAL(SIGALRM, sigproc);
alarm(TIMEOUT);
@@ -98,6 +101,5 @@ static struct tst_test test = {
.setup = setup,
.test_all = verify_getcwd,
.needs_tmpdir = 1,
- .forks_child = 1,
- .min_cpus = 2
+ .forks_child = 1
};
diff --git a/testcases/kernel/syscalls/getdents/Makefile b/testcases/kernel/syscalls/getdents/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getdents/Makefile
+++ b/testcases/kernel/syscalls/getdents/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getdents/getdents.h b/testcases/kernel/syscalls/getdents/getdents.h
index 560df4126..a20b1811a 100644
--- a/testcases/kernel/syscalls/getdents/getdents.h
+++ b/testcases/kernel/syscalls/getdents/getdents.h
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
@@ -22,13 +21,9 @@
#define GETDENTS_H
#include <stdint.h>
-#include "config.h"
+#include "test.h"
#include "lapi/syscalls.h"
-
-#if HAVE_GETDENTS || HAVE_GETDENTS64
-#include <unistd.h>
-#endif
-
+#include "config.h"
/*
* See fs/compat.c struct compat_linux_dirent
*/
@@ -39,12 +34,17 @@ struct linux_dirent {
char d_name[];
};
+#if HAVE_GETDENTS
+#include <unistd.h>
+#else
static inline int
-linux_getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
+getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
{
- return tst_syscall(__NR_getdents, fd, dirp, size);
+ return ltp_syscall(__NR_getdents, fd, dirp, size);
}
+#endif /* HAVE_GETDENTS */
+
struct linux_dirent64 {
uint64_t d_ino;
int64_t d_off;
@@ -53,120 +53,14 @@ struct linux_dirent64 {
char d_name[];
};
-static inline int
-linux_getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
-{
- return tst_syscall(__NR_getdents64, fd, dirp64, size);
-}
-
-static inline size_t
-tst_dirp_size(void)
-{
- switch (tst_variant) {
- case 0:
- return sizeof(struct linux_dirent);
- case 1:
- return sizeof(struct linux_dirent64);
-#if HAVE_GETDENTS
- case 2:
- return sizeof(struct dirent);
-#endif
-#if HAVE_GETDENTS64
- case 3:
- return sizeof(struct dirent64);
-#endif
- }
- return 0;
-}
-
-static inline const char *
-tst_dirp_name(void *dirp)
-{
- switch (tst_variant) {
- case 0:
- return ((struct linux_dirent *)dirp)->d_name;
- case 1:
- return ((struct linux_dirent64 *)dirp)->d_name;
-#if HAVE_GETDENTS
- case 2:
- return ((struct dirent *)dirp)->d_name;
-#endif
#if HAVE_GETDENTS64
- case 3:
- return ((struct dirent64 *)dirp)->d_name;
-#endif
- }
- return NULL;
-}
-
-static inline size_t
-tst_dirp_reclen(void *dirp)
-{
- switch (tst_variant) {
- case 0:
- return ((struct linux_dirent *)dirp)->d_reclen;
- case 1:
- return ((struct linux_dirent64 *)dirp)->d_reclen;
-#if HAVE_GETDENTS
- case 2:
- return ((struct dirent *)dirp)->d_reclen;
-#endif
-#if HAVE_GETDENTS64
- case 3:
- return ((struct dirent64 *)dirp)->d_reclen;
-#endif
-
- }
- return 0;
-}
-
+#include <dirent.h>
+#include <unistd.h>
+#else
static inline int
-tst_getdents(int fd, void *dirp, unsigned int size)
-{
- switch (tst_variant) {
- case 0:
- return linux_getdents(fd, dirp, size);
- case 1:
- return linux_getdents64(fd, dirp, size);
-#if HAVE_GETDENTS
- case 2:
- return getdents(fd, dirp, size);
-#endif
-#if HAVE_GETDENTS64
- case 3:
- return getdents64(fd, dirp, size);
-#endif
- }
- return -1;
-}
-
-static inline void
-getdents_info(void)
+getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
{
- switch (tst_variant) {
- case 0:
- tst_res(TINFO, "Testing the SYS_getdents syscall");
- break;
- case 1:
- tst_res(TINFO, "Testing the SYS_getdents64 syscall");
- break;
- case 2:
-#if HAVE_GETDENTS
- tst_res(TINFO, "Testing libc getdents()");
-#else
- tst_brk(TCONF, "libc getdents() is not implemented");
-#endif
- break;
- case 3:
-#if HAVE_GETDENTS64
- tst_res(TINFO, "Testing libc getdents64()");
-#else
- tst_brk(TCONF, "libc getdents64() is not implemented");
-#endif
- break;
- }
+ return ltp_syscall(__NR_getdents64, fd, dirp64, size);
}
-
-#define TEST_VARIANTS 4
-
+#endif /* HAVE_GETDENTS64 */
#endif /* GETDENTS_H */
diff --git a/testcases/kernel/syscalls/getdents/getdents01.c b/testcases/kernel/syscalls/getdents/getdents01.c
index e5e4689ee..eca572d42 100644
--- a/testcases/kernel/syscalls/getdents/getdents01.c
+++ b/testcases/kernel/syscalls/getdents/getdents01.c
@@ -1,32 +1,57 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* written by Wayne Boyer
* Copyright (c) 2013 Markos Chandras
* Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
*
- * [Description]
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * Basic getdents() test that checks if directory listing is correct and
- * complete.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE
-
-#include "tst_test.h"
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "test.h"
+#include "safe_macros.h"
#include "getdents.h"
-#include <stdlib.h>
+static void cleanup(void);
+static void setup(void);
static void reset_flags(void);
static void check_flags(void);
static void set_flag(const char *name);
-static int fd;
+char *TCID = "getdents01";
+int TST_TOTAL = 1;
+
+static int longsyscall;
+
+static option_t options[] = {
+ /* -l long option. Tests getdents64 */
+ {"l", &longsyscall, NULL},
+ {NULL, NULL, NULL}
+};
+
+static void help(void)
+{
+ printf(" -l Test the getdents64 system call\n");
+}
enum entry_type {
ENTRY_DIR,
@@ -55,54 +80,95 @@ struct testcase testcases[] = {
*/
#define BUFSIZE 512
-static void *dirp;
-
-static void run(void)
+int main(int ac, char **av)
{
- int rval;
+ int lc;
+ int rval, fd;
+ struct linux_dirent64 *dirp64;
+ struct linux_dirent *dirp;
+ void *buf;
- fd = SAFE_OPEN(".", O_RDONLY|O_DIRECTORY);
+ tst_parse_opts(ac, av, options, &help);
- rval = tst_getdents(fd, dirp, BUFSIZE);
+ /* The buffer is allocated to make sure it's suitably aligned */
+ buf = malloc(BUFSIZE);
- if (rval < 0) {
- if (errno == ENOSYS)
- tst_brk(TCONF, "syscall not implemented");
- else {
- tst_res(TFAIL | TERRNO, "getdents failed unexpectedly");
- return;
+ if (buf == NULL)
+ tst_brkm(TBROK, NULL, "malloc failed");
+
+ dirp64 = buf;
+ dirp = buf;
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ const char *d_name;
+
+ tst_count = 0;
+
+ if ((fd = open(".", O_RDONLY)) == -1)
+ tst_brkm(TBROK, cleanup, "open of directory failed");
+
+ if (longsyscall)
+ rval = getdents64(fd, dirp64, BUFSIZE);
+ else
+ rval = getdents(fd, dirp, BUFSIZE);
+
+ if (rval < 0) {
+ if (errno == ENOSYS)
+ tst_resm(TCONF, "syscall not implemented");
+ else
+ tst_resm(TFAIL | TERRNO,
+ "getdents failed unexpectedly");
+ continue;
}
- }
- if (rval == 0) {
- tst_res(TFAIL, "getdents failed - returned end of directory");
- return;
- }
+ if (rval == 0) {
+ tst_resm(TFAIL,
+ "getdents failed - returned end of directory");
+ continue;
+ }
- reset_flags();
+ reset_flags();
- void *recp = dirp;
+ do {
+ size_t d_reclen;
- do {
- size_t d_reclen = tst_dirp_reclen(recp);
- const char *d_name = tst_dirp_name(recp);
+ if (longsyscall) {
+ d_reclen = dirp64->d_reclen;
+ d_name = dirp64->d_name;
+ } else {
+ d_reclen = dirp->d_reclen;
+ d_name = dirp->d_name;
+ }
- set_flag(d_name);
+ set_flag(d_name);
- tst_res(TINFO, "Found '%s'", d_name);
+ tst_resm(TINFO, "Found '%s'", d_name);
+
+ rval -= d_reclen;
+
+ if (longsyscall)
+ dirp64 = (void*)dirp64 + d_reclen;
+ else
+ dirp = (void*)dirp + d_reclen;
- rval -= d_reclen;
- recp += d_reclen;
- } while (rval > 0);
+ } while (rval > 0);
- check_flags();
+ SAFE_CLOSE(cleanup, fd);
+
+ check_flags();
+ }
- SAFE_CLOSE(fd);
+ free(buf);
+
+ cleanup();
+ tst_exit();
}
static void reset_flags(void)
{
- size_t i;
+ int i;
for (i = 0; i < ARRAY_SIZE(testcases); i++)
testcases[i].found = 0;
@@ -110,73 +176,65 @@ static void reset_flags(void)
static void check_flags(void)
{
- size_t i;
- int err = 0;
+ int i, err = 0;
for (i = 0; i < ARRAY_SIZE(testcases); i++) {
if (!testcases[i].found) {
- tst_res(TINFO, "Entry '%s' not found", testcases[i].name);
+ tst_resm(TINFO, "Entry '%s' not found", testcases[i].name);
err++;
}
}
if (err)
- tst_res(TFAIL, "Some entries not found");
+ tst_resm(TFAIL, "Some entires not found");
else
- tst_res(TPASS, "All entries found");
+ tst_resm(TPASS, "All entires found");
}
static void set_flag(const char *name)
{
- size_t i;
+ int i;
for (i = 0; i < ARRAY_SIZE(testcases); i++) {
if (!strcmp(name, testcases[i].name)) {
-
- if (testcases[i].found)
- tst_res(TFAIL, "Duplicate entry %s", name);
-
testcases[i].found = 1;
return;
}
}
- tst_res(TFAIL, "Unexpected entry '%s' found", name);
+ tst_resm(TFAIL, "Unexpected entry '%s' found", name);
}
static void setup(void)
{
- size_t i;
-
- getdents_info();
-
- if (!tst_variant) {
- for (i = 0; i < ARRAY_SIZE(testcases); i++) {
- if (!testcases[i].create)
- continue;
-
- switch (testcases[i].type) {
- case ENTRY_DIR:
- SAFE_MKDIR(testcases[i].name, 0777);
- break;
- case ENTRY_FILE:
- SAFE_FILE_PRINTF(testcases[i].name, " ");
- break;
- case ENTRY_SYMLINK:
- SAFE_SYMLINK("nonexistent", testcases[i].name);
- break;
- }
+ int i;
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_tmpdir();
+
+ for (i = 0; i < ARRAY_SIZE(testcases); i++) {
+
+ if (!testcases[i].create)
+ continue;
+
+ switch (testcases[i].type) {
+ case ENTRY_DIR:
+ SAFE_MKDIR(cleanup, testcases[i].name, 0777);
+ break;
+ case ENTRY_FILE:
+ SAFE_FILE_PRINTF(cleanup, testcases[i].name, " ");
+ break;
+ case ENTRY_SYMLINK:
+ SAFE_SYMLINK(cleanup, "nonexistent", testcases[i].name);
+ break;
}
}
+
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .test_all = run,
- .setup = setup,
- .bufs = (struct tst_buffers []) {
- {&dirp, .size = BUFSIZE},
- {},
- },
- .test_variants = TEST_VARIANTS,
-};
+static void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/getdents/getdents02.c b/testcases/kernel/syscalls/getdents/getdents02.c
index ade1c9476..7b023c53f 100644
--- a/testcases/kernel/syscalls/getdents/getdents02.c
+++ b/testcases/kernel/syscalls/getdents/getdents02.c
@@ -1,97 +1,197 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* written by Wayne Boyer
* Copyright (c) 2013 Markos Chandras
* Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
- *
- * Verify that:
+/*
+ * Test Description:
+ * Verify that,
+ * 1. getdents() fails with -1 return value and sets errno to EBADF
+ * if file descriptor fd is invalid.
+ * 2. getdents() fails with -1 return value and sets errno to EINVAL
+ * if result buffer is too small.
+ * 3. getdents() fails with -1 return value and sets errno to ENOTDIR
+ * if file descriptor does not refer to a directory.
+ * 4. getdents() fails with -1 return value and sets errno to ENOENT
+ * if there is no such directory.
*
- * - getdents() fails with EBADF if file descriptor fd is invalid
- * - getdents() fails with EINVAL if result buffer is too small
- * - getdents() fails with ENOTDIR if file descriptor does not refer to a directory
- * - getdents() fails with ENOENT if directory was unlinked()
*/
#define _GNU_SOURCE
+#include <stdio.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
-#include "tst_test.h"
+#include "test.h"
#include "getdents.h"
+#include "safe_macros.h"
#define DIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \
S_IXGRP|S_IROTH|S_IXOTH)
#define TEST_DIR "test_dir"
+static void cleanup(void);
+static void setup(void);
+static void print_test_result(int err, int exp_errno);
+
char *TCID = "getdents02";
-static char *dirp;
-static size_t size;
-
-static char dirp1_arr[1];
-static char *dirp1 = dirp1_arr;
-static size_t size1 = 1;
-
-static int fd_inv = -5;
-static int fd;
-static int fd_file;
-static int fd_unlinked;
-
-static struct tcase {
- int *fd;
- char **dirp;
- size_t *size;
- int exp_errno;
-} tcases[] = {
- { &fd_inv, &dirp, &size, EBADF },
- { &fd, &dirp1, &size1, EINVAL },
- { &fd_file, &dirp, &size, ENOTDIR },
- { &fd_unlinked, &dirp, &size, ENOENT },
+static void test_ebadf(void);
+static void test_einval(void);
+static void test_enotdir(void);
+static void test_enoent(void);
+
+static void (*testfunc[])(void) = { test_ebadf, test_einval,
+ test_enotdir, test_enoent };
+
+int TST_TOTAL = ARRAY_SIZE(testfunc);
+
+static int longsyscall;
+
+option_t options[] = {
+ /* -l long option. Tests getdents64 */
+ {"l", &longsyscall, NULL},
+ {NULL, NULL, NULL}
};
-static void setup(void)
+static void help(void)
+{
+ printf(" -l Test the getdents64 system call\n");
+}
+
+int main(int ac, char **av)
{
- getdents_info();
+ int lc, i;
+
+ tst_parse_opts(ac, av, options, &help);
- size = tst_dirp_size();
- dirp = tst_alloc(size);
+ setup();
- fd = SAFE_OPEN(".", O_RDONLY);
- fd_file = SAFE_OPEN("test", O_CREAT | O_RDWR, 0644);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++)
+ (*testfunc[i])();
+ }
- SAFE_MKDIR(TEST_DIR, DIR_MODE);
- fd_unlinked = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
- SAFE_RMDIR(TEST_DIR);
+ cleanup();
+ tst_exit();
}
-static void run(unsigned int i)
+static void setup(void)
{
- struct tcase *tc = tcases + i;
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- TEST(tst_getdents(*tc->fd, *tc->dirp, *tc->size));
+ tst_tmpdir();
- if (TST_RET != -1) {
- tst_res(TFAIL, "getdents() returned %ld", TST_RET);
- return;
- }
+ TEST_PAUSE;
+}
- if (TST_ERR == tc->exp_errno) {
- tst_res(TPASS | TTERRNO, "getdents failed as expected");
- } else if (errno == ENOSYS) {
- tst_res(TCONF, "syscall not implemented");
+static void print_test_result(int err, int exp_errno)
+{
+ if (err == 0) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ } else if (err == exp_errno) {
+ tst_resm(TPASS, "getdents failed as expected: %s",
+ strerror(err));
+ } else if (err == ENOSYS) {
+ tst_resm(TCONF, "syscall not implemented");
} else {
- tst_res(TFAIL | TTERRNO, "getdents failed unexpectedly");
+ tst_resm(TFAIL, "getdents failed unexpectedly: %s",
+ strerror(err));
}
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .test = run,
- .setup = setup,
- .tcnt = ARRAY_SIZE(tcases),
- .test_variants = TEST_VARIANTS,
-};
+static void test_ebadf(void)
+{
+ int fd = -5;
+ struct linux_dirent64 dirp64;
+ struct linux_dirent dirp;
+
+ if (longsyscall)
+ getdents64(fd, &dirp64, sizeof(dirp64));
+ else
+ getdents(fd, &dirp, sizeof(dirp));
+
+ print_test_result(errno, EBADF);
+}
+
+static void test_einval(void)
+{
+ int fd;
+ char buf[1];
+
+ fd = SAFE_OPEN(cleanup, ".", O_RDONLY);
+
+ /* Pass one byte long buffer. The result should be EINVAL */
+ if (longsyscall)
+ getdents64(fd, (void *)buf, sizeof(buf));
+ else
+ getdents(fd, (void *)buf, sizeof(buf));
+
+ print_test_result(errno, EINVAL);
+
+ SAFE_CLOSE(cleanup, fd);
+}
+
+static void test_enotdir(void)
+{
+ int fd;
+ struct linux_dirent64 dir64;
+ struct linux_dirent dir;
+
+ fd = SAFE_OPEN(cleanup, "test", O_CREAT | O_RDWR);
+
+ if (longsyscall)
+ getdents64(fd, &dir64, sizeof(dir64));
+ else
+ getdents(fd, &dir, sizeof(dir));
+
+ print_test_result(errno, ENOTDIR);
+
+ SAFE_CLOSE(cleanup, fd);
+}
+
+static void test_enoent(void)
+{
+ int fd;
+ struct linux_dirent64 dir64;
+ struct linux_dirent dir;
+
+ SAFE_MKDIR(cleanup, TEST_DIR, DIR_MODE);
+
+ fd = SAFE_OPEN(cleanup, TEST_DIR, O_DIRECTORY);
+ SAFE_RMDIR(cleanup, TEST_DIR);
+
+ if (longsyscall)
+ getdents64(fd, &dir64, sizeof(dir64));
+ else
+ getdents(fd, &dir, sizeof(dir));
+
+ print_test_result(errno, ENOENT);
+
+ SAFE_CLOSE(cleanup, fd);
+}
+
+static void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/getdomainname/Makefile b/testcases/kernel/syscalls/getdomainname/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getdomainname/Makefile
+++ b/testcases/kernel/syscalls/getdomainname/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getdtablesize/Makefile b/testcases/kernel/syscalls/getdtablesize/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getdtablesize/Makefile
+++ b/testcases/kernel/syscalls/getdtablesize/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getegid/Makefile b/testcases/kernel/syscalls/getegid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/getegid/Makefile
+++ b/testcases/kernel/syscalls/getegid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/geteuid/Makefile b/testcases/kernel/syscalls/geteuid/Makefile
index e7a0f0ae1..ad6b9f57c 100644
--- a/testcases/kernel/syscalls/geteuid/Makefile
+++ b/testcases/kernel/syscalls/geteuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getgid/Makefile b/testcases/kernel/syscalls/getgid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/getgid/Makefile
+++ b/testcases/kernel/syscalls/getgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getgid/getgid01.c b/testcases/kernel/syscalls/getgid/getgid01.c
index dec0fca42..bf9ed3250 100644
--- a/testcases/kernel/syscalls/getgid/getgid01.c
+++ b/testcases/kernel/syscalls/getgid/getgid01.c
@@ -1,39 +1,86 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- * AUTHOR : William Roske
- * CO-PILOT : Dave Fenner
- */
-
-/*\
- * [Description]
*
- * Call getgid() and expects that the gid returned correctly.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
+ */
+/*
+ * AUTHOR : William Roske
+ * CO-PILOT : Dave Fenner
*/
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+#include "test.h"
+#include "compat_16.h"
-#include <pwd.h>
-#include "tst_test.h"
-#include "compat_tst_16.h"
+static void setup(void);
+static void cleanup(void);
-static struct passwd *ltpuser;
+TCID_DEFINE(getgid01);
+int TST_TOTAL = 1;
-static void run(void)
+int main(int ac, char **av)
{
- TEST(GETGID());
- if (TST_RET != ltpuser->pw_gid)
- tst_res(TFAIL, "getgid failed, returned %ld", TST_RET);
- else
- tst_res(TPASS, "getgid returned as expectedly");
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(GETGID(cleanup));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "getgid failed");
+ } else {
+ tst_resm(TPASS, "getgid returned %ld",
+ TEST_RETURN);
+ }
+ }
+
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- ltpuser = SAFE_GETPWNAM("nobody");
- SAFE_SETGID(ltpuser->pw_gid);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .needs_root = 1,
- .test_all = run,
- .setup = setup,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/getgid/getgid03.c b/testcases/kernel/syscalls/getgid/getgid03.c
index eb302ad32..b54fa108f 100644
--- a/testcases/kernel/syscalls/getgid/getgid03.c
+++ b/testcases/kernel/syscalls/getgid/getgid03.c
@@ -1,48 +1,89 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
- * Ported by Wayne Boyer
+ * Ported by Wayne Boyer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
* Testcase to check the basic functionality of getgid().
*
- * [Algorithm]
* For functionality test the return value from getgid() is compared to passwd
* entry.
*/
#include <pwd.h>
-#include "tst_test.h"
-#include "compat_tst_16.h"
+#include <errno.h>
+
+#include "test.h"
+#include "compat_16.h"
-static void run(void)
+static void cleanup(void);
+static void setup(void);
+
+TCID_DEFINE(getgid03);
+int TST_TOTAL = 1;
+
+int main(int ac, char **av)
{
+ int lc;
uid_t uid;
struct passwd *pwent;
- TEST(GETGID());
- if (TST_RET < 0)
- tst_brk(TBROK, "This should never happen");
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- uid = getuid();
- pwent = getpwuid(uid);
- if (pwent == NULL)
- tst_brk(TBROK | TERRNO, "getuid() returned unexpected value %d", uid);
+ TEST(GETGID(cleanup));
- GID16_CHECK(pwent->pw_gid, getgid);
+ if (TEST_RETURN < 0) {
+ tst_brkm(TBROK, cleanup, "This should never happen");
+ }
- if (pwent->pw_gid != TST_RET) {
- tst_res(TFAIL, "getgid() return value "
- "%ld unexpected - expected %d",
- TST_RET, pwent->pw_gid);
- return;
+ uid = getuid();
+ pwent = getpwuid(uid);
+
+ if (pwent == NULL)
+ tst_brkm(TBROK, cleanup, "getuid() returned "
+ "unexpected value %d", uid);
+
+ GID16_CHECK(pwent->pw_gid, getgid, cleanup);
+
+ if (pwent->pw_gid != TEST_RETURN) {
+ tst_resm(TFAIL, "getgid() return value "
+ "%ld unexpected - expected %d",
+ TEST_RETURN, pwent->pw_gid);
+ } else {
+ tst_resm(TPASS, "values from getuid "
+ "and getpwuid match");
+ }
}
- tst_res(TPASS, "values from getgid() and getpwuid() match");
+ cleanup();
+ tst_exit();
+}
+
+static void setup(void)
+{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .test_all = run,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/getgroups/Makefile b/testcases/kernel/syscalls/getgroups/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/getgroups/Makefile
+++ b/testcases/kernel/syscalls/getgroups/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/gethostbyname_r/Makefile b/testcases/kernel/syscalls/gethostbyname_r/Makefile
index 0f383f984..2a423d157 100644
--- a/testcases/kernel/syscalls/gethostbyname_r/Makefile
+++ b/testcases/kernel/syscalls/gethostbyname_r/Makefile
@@ -1,5 +1,16 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2015 Fujitsu Ltd.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/gethostid/Makefile b/testcases/kernel/syscalls/gethostid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/gethostid/Makefile
+++ b/testcases/kernel/syscalls/gethostid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/gethostname/Makefile b/testcases/kernel/syscalls/gethostname/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/gethostname/Makefile
+++ b/testcases/kernel/syscalls/gethostname/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getitimer/Makefile b/testcases/kernel/syscalls/getitimer/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getitimer/Makefile
+++ b/testcases/kernel/syscalls/getitimer/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getpagesize/Makefile b/testcases/kernel/syscalls/getpagesize/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getpagesize/Makefile
+++ b/testcases/kernel/syscalls/getpagesize/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getpeername/Makefile b/testcases/kernel/syscalls/getpeername/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getpeername/Makefile
+++ b/testcases/kernel/syscalls/getpeername/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getpgid/Makefile b/testcases/kernel/syscalls/getpgid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getpgid/Makefile
+++ b/testcases/kernel/syscalls/getpgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getpgid/getpgid01.c b/testcases/kernel/syscalls/getpgid/getpgid01.c
index 060486e7e..9af523d88 100644
--- a/testcases/kernel/syscalls/getpgid/getpgid01.c
+++ b/testcases/kernel/syscalls/getpgid/getpgid01.c
@@ -62,7 +62,7 @@ int main(int ac, char **av)
register int pgid_0, pgid_1;
register int my_pid, my_ppid;
- int ex_stat;
+ int ex_stat, fail = 0;
tst_parse_opts(ac, av, NULL, NULL);
@@ -77,19 +77,30 @@ int main(int ac, char **av)
while ((pgid_0 = wait(&ex_stat)) != -1) ;
if (WEXITSTATUS(ex_stat) == 0)
- tst_resm(TPASS, "%s PASSED", TCID);
+ tst_resm(TINFO, "%s PASSED", TCID);
else
- tst_resm(TFAIL, "%s FAILED", TCID);
+ tst_resm(TINFO, "%s FAILED", TCID);
exit(0);
}
- if ((pgid_0 = getpgid(0)) == -1)
+ tst_resm(TINFO, "Enter block 1");
+ fail = 0;
+ if ((pgid_0 = getpgid(0)) == -1) {
tst_resm(TFAIL | TERRNO, "getpgid(0) failed");
+ fail = 1;
+ }
+
+ if (fail)
+ tst_resm(TINFO, "Test block 1: getpgid(0) FAILED");
else
- tst_resm(TPASS, "getpgid(0) PASSED");
+ tst_resm(TPASS, "Test block 1: getpgid(0) PASSED");
+ tst_resm(TINFO, "Exit block 1");
//block2:
+ tst_resm(TINFO, "Enter block 2");
+ fail = 0;
+
my_pid = getpid();
if ((pgid_1 = getpgid(my_pid)) == -1)
tst_resm(TFAIL | TERRNO, "getpgid(%d) failed", my_pid);
@@ -97,10 +108,20 @@ int main(int ac, char **av)
if (pgid_0 != pgid_1) {
tst_resm(TFAIL, "getpgid(my_pid=%d) != getpgid(0) "
"[%d != %d]", my_pid, pgid_1, pgid_0);
- } else
- tst_resm(TPASS, "getpgid(getpid()) PASSED");
+ fail = 1;
+ }
+ if (fail)
+ tst_resm(TINFO, "Test block 2: getpgid(getpid()) "
+ "FAILED");
+ else
+ tst_resm(TPASS, "Test block 2: getpgid(getpid()) "
+ "PASSED");
+ tst_resm(TINFO, "Exit block 2");
//block3:
+ tst_resm(TINFO, "Enter block 3");
+ fail = 0;
+
my_ppid = getppid();
if ((pgid_1 = getpgid(my_ppid)) == -1)
tst_resm(TFAIL | TERRNO, "getpgid(%d) failed", my_ppid);
@@ -108,24 +129,51 @@ int main(int ac, char **av)
if (pgid_0 != pgid_1) {
tst_resm(TFAIL, "getpgid(%d) != getpgid(0) [%d != %d]",
my_ppid, pgid_1, pgid_0);
- } else
- tst_resm(TPASS, "getpgid(getppid()) PASSED");
+ fail = 1;
+ }
+
+ if (fail) {
+ tst_resm(TINFO, "Test block 3: getpgid(getppid()) "
+ "FAILED");
+ } else {
+ tst_resm(TPASS, "Test block 3: getpgid(getppid()) "
+ "PASSED");
+ }
+ tst_resm(TINFO, "Exit block 3");
//block4:
+ tst_resm(TINFO, "Enter block 4");
+ fail = 0;
+
if ((pgid_1 = getpgid(pgid_0)) < 0)
tst_resm(TFAIL | TERRNO, "getpgid(%d) failed", pgid_0);
if (pgid_0 != pgid_1) {
tst_resm(TFAIL, "getpgid(%d) != getpgid(0) [%d != %d]",
pgid_0, pgid_1, pgid_0);
- } else
- tst_resm(TPASS, "getpgid(%d) PASSED", pgid_0);
+ fail = 1;
+ }
+
+ if (fail)
+ tst_resm(TINFO, "Test block 4: getpgid(1) FAILED");
+ else
+ tst_resm(TPASS, "Test block 4: getpgid(1) PASSED");
+ tst_resm(TINFO, "Exit block 4");
//block5:
- if (getpgid(1) < 0)
+ tst_resm(TINFO, "Enter block 5");
+ fail = 0;
+
+ if (getpgid(1) < 0) {
tst_resm(TFAIL | TERRNO, "getpgid(1) failed");
+ fail = 1;
+ }
+
+ if (fail)
+ tst_resm(TINFO, "Test block 5: getpgid(1) FAILED");
else
- tst_resm(TPASS, "getpgid(1) PASSED");
+ tst_resm(TPASS, "Test block 5: getpgid(1) PASSED");
+ tst_resm(TINFO, "Exit block 5");
}
cleanup();
tst_exit();
diff --git a/testcases/kernel/syscalls/getpgrp/Makefile b/testcases/kernel/syscalls/getpgrp/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getpgrp/Makefile
+++ b/testcases/kernel/syscalls/getpgrp/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getpid/Makefile b/testcases/kernel/syscalls/getpid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getpid/Makefile
+++ b/testcases/kernel/syscalls/getpid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getpid/getpid01.c b/testcases/kernel/syscalls/getpid/getpid01.c
index ec18b67d5..b9b069c63 100644
--- a/testcases/kernel/syscalls/getpid/getpid01.c
+++ b/testcases/kernel/syscalls/getpid/getpid01.c
@@ -1,43 +1,158 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- */
-
-/*\
- * [Description]
*
- * Verify that getpid() system call returns process ID in range 2 ... PID_MAX
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
+/* $Id: getpid01.c,v 1.8 2009/10/26 14:55:47 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : getpid01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for getpid(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) getpid(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the getpid(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * getpid(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include "test.h"
-#include <stdlib.h>
-#include "tst_test.h"
+void setup();
+void cleanup();
-static void verify_getpid(void)
+char *TCID = "getpid01";
+int TST_TOTAL = 1;
+
+int main(int ac, char **av)
{
- pid_t pid_max, pid;
- int i;
-
- SAFE_FILE_SCANF("/proc/sys/kernel/pid_max", "%d\n", &pid_max);
-
- for (i = 0; i < 100; i++) {
- pid = SAFE_FORK();
- if (pid == 0) {
- pid = getpid();
-
- /* pid should not be 1 or out of maximum */
- if (1 < pid && pid <= pid_max)
- tst_res(TPASS, "getpid() returns %d", pid);
- else
- tst_res(TFAIL,
- "getpid() returns out of range: %d", pid);
- exit(0);
- } else {
- SAFE_WAIT(NULL);
- }
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(getpid());
+
+ if (TEST_RETURN == -1)
+ tst_resm(TFAIL | TTERRNO, "getpid failed");
+ else
+ tst_resm(TPASS, "getpid returned %ld", TEST_RETURN);
+
}
+
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .forks_child = 1,
- .test_all = verify_getpid,
-};
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/getpid/getpid02.c b/testcases/kernel/syscalls/getpid/getpid02.c
index d826724f4..6c44ea96a 100644
--- a/testcases/kernel/syscalls/getpid/getpid02.c
+++ b/testcases/kernel/syscalls/getpid/getpid02.c
@@ -1,68 +1,136 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * Test Name: getpid02
+ *
+ * Test Description:
+ * Verify that getpid() system call gets the process ID of the of the
+ * calling process.
*
- * Check that:
- * - fork() in parent returns the same pid as getpid() in child
- * - getppid() in child returns the same pid as getpid() in parent
+ * Expected Result:
+ * getpid() should return pid of the process on success.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * Usage: <for command-line>
+ * getpid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS:
+ * None.
*/
+#include <unistd.h>
+#include <sys/types.h>
#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+#include "test.h"
+#include "safe_macros.h"
-#include "tst_test.h"
+void setup(); /* Main setup function of test */
+void cleanup(); /* cleanup function for the test */
-static pid_t *child_pid;
+char *TCID = "getpid02";
+int TST_TOTAL = 1;
-static void verify_getpid(void)
+int main(int ac, char **av)
{
- pid_t proc_id;
- pid_t pid;
- pid_t pproc_id;
+ int lc;
+ pid_t proc_id; /* process id of the test process */
+ pid_t pid; /* process id of the child process */
+ pid_t pproc_id; /* parent process id */
+ int status; /* exit status of child process */
- proc_id = getpid();
- pid = SAFE_FORK();
+ tst_parse_opts(ac, av, NULL, NULL);
- if (pid == 0) {
- pproc_id = getppid();
+ setup();
- if (pproc_id != proc_id) {
- tst_res(TFAIL, "child getppid() (%d) != parent getpid() (%d)",
- pproc_id, proc_id);
- } else {
- tst_res(TPASS, "child getppid() == parent getpid() (%d)", proc_id);
- }
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- *child_pid = getpid();
+ tst_count = 0;
- return;
- }
+ TEST(getpid());
- tst_reap_children();
+ proc_id = TEST_RETURN;
- if (*child_pid != pid)
- tst_res(TFAIL, "child getpid() (%d) != parent fork() (%d)", *child_pid, pid);
- else
- tst_res(TPASS, "child getpid() == parent fork() (%d)", pid);
+ if ((pid = FORK_OR_VFORK()) == -1)
+ tst_resm(TFAIL | TERRNO, "fork failed");
+ else if (pid == 0) {
+ pproc_id = getppid();
+
+ if (pproc_id != proc_id)
+ exit(1);
+ exit(0);
+ } else {
+ SAFE_WAIT(cleanup, &status);
+ if (!WIFEXITED(status) ||
+ WEXITSTATUS(status) != 0)
+ tst_resm(TFAIL, "getpid() returned "
+ "invalid pid %d", proc_id);
+ else
+ tst_resm(TPASS,
+ "getpid functionality is correct");
+ }
+ }
+
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
- child_pid = SAFE_MMAP(NULL, sizeof(pid_t), PROT_READ | PROT_WRITE,
- MAP_ANONYMOUS | MAP_SHARED, -1, 0);
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
}
-static void cleanup(void)
+void cleanup(void)
{
- SAFE_MUNMAP(child_pid, sizeof(pid_t));
}
-
-static struct tst_test test = {
- .forks_child = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_getpid,
-};
diff --git a/testcases/kernel/syscalls/getppid/Makefile b/testcases/kernel/syscalls/getppid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getppid/Makefile
+++ b/testcases/kernel/syscalls/getppid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getppid/getppid01.c b/testcases/kernel/syscalls/getppid/getppid01.c
index f37948dd4..8a4875525 100644
--- a/testcases/kernel/syscalls/getppid/getppid01.c
+++ b/testcases/kernel/syscalls/getppid/getppid01.c
@@ -1,30 +1,160 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- */
-
-/*\
- * [Description]
*
- * Test whether parent process id that getppid() returns is out of range.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
+/* $Id: getppid01.c,v 1.6 2009/10/26 14:55:47 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : getppid01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for getppid(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) getppid(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the getppid(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * getppid(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+#include <sys/types.h>
+#include <fcntl.h>
#include <errno.h>
-#include "tst_test.h"
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+
+void setup();
+void cleanup();
+
+char *TCID = "getppid01";
+int TST_TOTAL = 1;
-static void verify_getppid(void)
+int main(int ac, char **av)
{
- pid_t ppid, pid_max;
+ int lc;
- SAFE_FILE_SCANF("/proc/sys/kernel/pid_max", "%d\n", &pid_max);
+ tst_parse_opts(ac, av, NULL, NULL);
- ppid = getppid();
- if (ppid > pid_max)
- tst_res(TFAIL, "getppid() returned %d, out of range!", ppid);
- else
- tst_res(TPASS, "getppid() returned %d", ppid);
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(getppid());
+
+ if (TEST_RETURN == -1)
+ tst_resm(TFAIL | TTERRNO, "getppid failed");
+ else
+ tst_resm(TPASS, "getppid returned %ld", TEST_RETURN);
+
+ }
+
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .test_all = verify_getppid,
-};
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/getppid/getppid02.c b/testcases/kernel/syscalls/getppid/getppid02.c
index cbc7ae76c..ae3c8eb26 100644
--- a/testcases/kernel/syscalls/getppid/getppid02.c
+++ b/testcases/kernel/syscalls/getppid/getppid02.c
@@ -1,38 +1,106 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * getppid02.c
+ *
+ * DESCRIPTION
+ * Testcase to check the basic functionality of the getppid() syscall.
+ *
+ * USAGE: <for command-line>
+ * getppid02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * Check that getppid() in child returns the same pid as getpid() in parent.
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * None
*/
-
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <err.h>
#include <errno.h>
+#include "test.h"
+#include "safe_macros.h"
+
+char *TCID = "getppid02";
+int TST_TOTAL = 1;
-#include "tst_test.h"
+void setup(void);
+void cleanup(void);
-static void verify_getppid(void)
+int main(int ac, char **av)
{
- pid_t proc_id;
- pid_t pid;
- pid_t pproc_id;
-
- proc_id = getpid();
- pid = SAFE_FORK();
- if (pid == 0) {
- pproc_id = getppid();
-
- if (pproc_id != proc_id)
- tst_res(TFAIL, "child's ppid(%d) not equal to parent's pid(%d)",
- pproc_id, proc_id);
- else
- tst_res(TPASS, "getppid() returned parent pid (%d)", proc_id);
+
+ int lc;
+ int status;
+ pid_t pid, ppid;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ ppid = getpid();
+ pid = FORK_OR_VFORK();
+ if (pid == -1)
+ tst_brkm(TBROK, cleanup, "fork failed");
+
+ if (pid == 0) {
+ TEST(getppid());
+
+ if (TEST_RETURN != ppid)
+ errx(1, "getppid failed (%ld != %d)",
+ TEST_RETURN, ppid);
+ else
+ printf("return value and parent's pid "
+ "value match\n");
+ exit(0);
+ } else {
+ SAFE_WAIT(cleanup, &status);
+ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ tst_resm(TFAIL,
+ "getppid functionality incorrect");
+ }
}
+ cleanup();
+
+ tst_exit();
+}
+
+void setup(void)
+{
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .forks_child = 1,
- .test_all = verify_getppid,
-};
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/getpriority/Makefile b/testcases/kernel/syscalls/getpriority/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getpriority/Makefile
+++ b/testcases/kernel/syscalls/getpriority/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getrandom/Makefile b/testcases/kernel/syscalls/getrandom/Makefile
index 53b787b78..96df4e406 100644
--- a/testcases/kernel/syscalls/getrandom/Makefile
+++ b/testcases/kernel/syscalls/getrandom/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2015 Cedric Hnyda ced.hnyda@gmail.com
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getrandom/getrandom02.c b/testcases/kernel/syscalls/getrandom/getrandom02.c
index 1384fc5f3..ee0193df9 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom02.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom02.c
@@ -10,8 +10,6 @@
#include "lapi/syscalls.h"
#include "tst_test.h"
-#define PROC_ENTROPY_AVAIL "/proc/sys/kernel/random/entropy_avail"
-
static int modes[] = { 0, GRND_RANDOM, GRND_NONBLOCK,
GRND_RANDOM | GRND_NONBLOCK };
@@ -39,17 +37,11 @@ static int check_content(unsigned char *buf, int nb)
static void verify_getrandom(unsigned int n)
{
unsigned char buf[256];
- int bufsize = 64, entropy_avail;
-
- if (access(PROC_ENTROPY_AVAIL, F_OK) == 0) {
- SAFE_FILE_SCANF(PROC_ENTROPY_AVAIL, "%d", &entropy_avail);
- if (entropy_avail > 256)
- bufsize = sizeof(buf);
- }
memset(buf, 0, sizeof(buf));
+
do {
- TEST(tst_syscall(__NR_getrandom, buf, bufsize, modes[n]));
+ TEST(tst_syscall(__NR_getrandom, buf, sizeof(buf), modes[n]));
} while ((modes[n] & GRND_NONBLOCK) && TST_RET == -1
&& TST_ERR == EAGAIN);
diff --git a/testcases/kernel/syscalls/getresgid/Makefile b/testcases/kernel/syscalls/getresgid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/getresgid/Makefile
+++ b/testcases/kernel/syscalls/getresgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getresuid/Makefile b/testcases/kernel/syscalls/getresuid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/getresuid/Makefile
+++ b/testcases/kernel/syscalls/getresuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getrlimit/Makefile b/testcases/kernel/syscalls/getrlimit/Makefile
index 7e9aff634..58c5a5478 100644
--- a/testcases/kernel/syscalls/getrlimit/Makefile
+++ b/testcases/kernel/syscalls/getrlimit/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getrusage/Makefile b/testcases/kernel/syscalls/getrusage/Makefile
index 8cfa15dcd..6702f2763 100644
--- a/testcases/kernel/syscalls/getrusage/Makefile
+++ b/testcases/kernel/syscalls/getrusage/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getrusage/getrusage04.c b/testcases/kernel/syscalls/getrusage/getrusage04.c
index c91fd2355..a5b3f6583 100644
--- a/testcases/kernel/syscalls/getrusage/getrusage04.c
+++ b/testcases/kernel/syscalls/getrusage/getrusage04.c
@@ -118,14 +118,14 @@ int main(int argc, char *argv[])
tst_resm(TINFO, "utime:%12luus; stime:%12luus",
usage.ru_utime.tv_usec,
usage.ru_stime.tv_usec);
- if ((long)udelta > 1000 + (BIAS_MAX * factor_nr)) {
+ if (udelta > 1000 + (BIAS_MAX * factor_nr)) {
sprintf(msg_string,
"utime increased > %ldus:",
1000 + BIAS_MAX * factor_nr);
tst_brkm(TFAIL, cleanup, msg_string,
" delta = %luus", udelta);
}
- if ((long)sdelta > 1000 + (BIAS_MAX * factor_nr)) {
+ if (sdelta > 1000 + (BIAS_MAX * factor_nr)) {
sprintf(msg_string,
"stime increased > %ldus:",
1000 + BIAS_MAX * factor_nr);
diff --git a/testcases/kernel/syscalls/getsid/Makefile b/testcases/kernel/syscalls/getsid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getsid/Makefile
+++ b/testcases/kernel/syscalls/getsid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getsockname/Makefile b/testcases/kernel/syscalls/getsockname/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getsockname/Makefile
+++ b/testcases/kernel/syscalls/getsockname/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getsockopt/Makefile b/testcases/kernel/syscalls/getsockopt/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/getsockopt/Makefile
+++ b/testcases/kernel/syscalls/getsockopt/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/gettid/Makefile b/testcases/kernel/syscalls/gettid/Makefile
index 4e9982f76..d060ca83f 100644
--- a/testcases/kernel/syscalls/gettid/Makefile
+++ b/testcases/kernel/syscalls/gettid/Makefile
@@ -1,9 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copied from ../getpid/Makefile by Masatake YAMATO
#
###
#
# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/gettimeofday/Makefile b/testcases/kernel/syscalls/gettimeofday/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/gettimeofday/Makefile
+++ b/testcases/kernel/syscalls/gettimeofday/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
index 08ea1673a..583d8f7b9 100644
--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
+++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday01.c
@@ -38,8 +38,10 @@
#include <sys/time.h>
#include <errno.h>
#include "test.h"
+#include <sys/syscall.h>
#include <unistd.h>
-#include "lapi/syscalls.h"
+
+#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b)
char *TCID = "gettimeofday01";
int TST_TOTAL = 1;
@@ -61,7 +63,7 @@ int main(int ac, char **av)
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
- TEST(ltp_syscall(__NR_gettimeofday, (void *)-1, (void *)-1));
+ TEST(gettimeofday((void *)-1, (void *)-1));
/* gettimeofday returns an int, so we need to turn the long
* TEST_RETURN into an int to test with */
diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
index c0e56ed34..1d60f448e 100644
--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
+++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
@@ -16,18 +16,24 @@
#include <stdint.h>
#include <sys/time.h>
#include <stdlib.h>
+#include <sys/syscall.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include "tst_test.h"
-#include "tst_timer.h"
-#include "lapi/syscalls.h"
+
+#define gettimeofday(a,b) syscall(__NR_gettimeofday,a,b)
static volatile sig_atomic_t done;
static char *str_rtime;
static int rtime = 10;
+static struct tst_option options[] = {
+ {"T:", &str_rtime, "-T len Test iteration runtime in seconds"},
+ {NULL, NULL, NULL},
+};
+
static void breakout(int sig)
{
done = sig;
@@ -35,19 +41,23 @@ static void breakout(int sig)
static void verify_gettimeofday(void)
{
- struct __kernel_old_timeval tv1, tv2;
+ struct timeval tv1, tv2;
unsigned long long cnt = 0;
done = 0;
alarm(rtime);
- if (tst_syscall(__NR_gettimeofday, &tv1, NULL))
- tst_brk(TFAIL | TERRNO, "gettimeofday() failed");
+ if (gettimeofday(&tv1, NULL)) {
+ tst_res(TBROK | TERRNO, "gettimeofday() failed");
+ return;
+ }
while (!done) {
- if (tst_syscall(__NR_gettimeofday, &tv2, NULL))
- tst_brk(TFAIL | TERRNO, "gettimeofday() failed");
+ if (gettimeofday(&tv2, NULL)) {
+ tst_res(TBROK | TERRNO, "gettimeofday() failed");
+ return;
+ }
if (tv2.tv_sec < tv1.tv_sec ||
(tv2.tv_sec == tv1.tv_sec && tv2.tv_usec < tv1.tv_usec)) {
@@ -62,6 +72,7 @@ static void verify_gettimeofday(void)
cnt++;
}
+
tst_res(TINFO, "gettimeofday() called %llu times", cnt);
tst_res(TPASS, "gettimeofday() monotonous in %i seconds", rtime);
}
@@ -80,9 +91,6 @@ static void setup(void)
static struct tst_test test = {
.setup = setup,
- .options = (struct tst_option[]) {
- {"T:", &str_rtime, "-T len Test iteration runtime in seconds"},
- {},
- },
+ .options = options,
.test_all = verify_gettimeofday,
};
diff --git a/testcases/kernel/syscalls/getuid/Makefile b/testcases/kernel/syscalls/getuid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/getuid/Makefile
+++ b/testcases/kernel/syscalls/getuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getxattr/Makefile b/testcases/kernel/syscalls/getxattr/Makefile
index 53b867f61..3f78745ca 100644
--- a/testcases/kernel/syscalls/getxattr/Makefile
+++ b/testcases/kernel/syscalls/getxattr/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Red Hat Inc., 2011
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/getxattr/getxattr01.c b/testcases/kernel/syscalls/getxattr/getxattr01.c
index cec802a33..54ca65390 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr01.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr01.c
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
- for (i = 0; i < (int)ARRAY_SIZE(tc); i++) {
+ for (i = 0; i < ARRAY_SIZE(tc); i++) {
TEST(getxattr(tc[i].fname, tc[i].key, tc[i].value,
tc[i].size));
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
static void setup(void)
{
int fd;
- unsigned int i;
+ int i;
tst_require_root();
@@ -161,7 +161,7 @@ static void setup(void)
}
/* Prepare test cases */
- for (i = 0; i < ARRAY_SIZE(tc); i++) {
+ for (i = 0; i < ARRAY_SIZE(tc); i++) {
tc[i].value = malloc(BUFFSIZE);
if (tc[i].value == NULL) {
tst_brkm(TBROK | TERRNO, cleanup,
diff --git a/testcases/kernel/syscalls/init_module/.gitignore b/testcases/kernel/syscalls/init_module/.gitignore
deleted file mode 100644
index 23baeb651..000000000
--- a/testcases/kernel/syscalls/init_module/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-/init_module01
-/init_module02
-/*.ko
-/*.mod.c
-/*.ko.cmd
-/*.mod.cmd
-/*.mod.o.cmd
-/*.o.cmd
-/.built-in.a.cmd
-/Module.symvers
-/modules.order
diff --git a/testcases/kernel/syscalls/init_module/Makefile b/testcases/kernel/syscalls/init_module/Makefile
deleted file mode 100644
index ebdca67d4..000000000
--- a/testcases/kernel/syscalls/init_module/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-ifneq ($(KERNELRELEASE),)
-
-obj-m := init_module.o
-
-else
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-REQ_VERSION_MAJOR := 2
-REQ_VERSION_PATCH := 6
-
-MAKE_TARGETS := init_module01 init_module02 init_module.ko
-
-include $(top_srcdir)/include/mk/module.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-endif
diff --git a/testcases/kernel/syscalls/init_module/init_module.c b/testcases/kernel/syscalls/init_module/init_module.c
deleted file mode 100644
index 78d03b899..000000000
--- a/testcases/kernel/syscalls/init_module/init_module.c
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Dummy test module.
- *
- * The module accepts a single argument named "status" and it fails
- * initialization if the status is set to "invalid".
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <linux/kernel.h>
-
-static char status[20];
-module_param_string(status, status, 20, 0444);
-
-static int dummy_init(void)
-{
- struct proc_dir_entry *proc_dummy;
-
- if (!strcmp(status, "invalid"))
- return -EINVAL;
-
- proc_dummy = proc_mkdir("dummy", 0);
- return 0;
-}
-module_init(dummy_init);
-
-static void dummy_exit(void)
-{
- remove_proc_entry("dummy", 0);
-}
-module_exit(dummy_exit);
-
-MODULE_LICENSE("GPL");
diff --git a/testcases/kernel/syscalls/init_module/init_module01.c b/testcases/kernel/syscalls/init_module/init_module01.c
deleted file mode 100644
index 2f47eed32..000000000
--- a/testcases/kernel/syscalls/init_module/init_module01.c
+++ /dev/null
@@ -1,56 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic init_module() tests.
- *
- * [Algorithm]
- *
- * Inserts a simple module after opening and mmaping the module file.
- */
-
-#include <errno.h>
-#include "lapi/init_module.h"
-#include "tst_module.h"
-
-#define MODULE_NAME "init_module.ko"
-
-static struct stat sb;
-static void *buf;
-
-static void setup(void)
-{
- int fd;
-
- tst_module_exists(MODULE_NAME, NULL);
-
- fd = SAFE_OPEN(MODULE_NAME, O_RDONLY|O_CLOEXEC);
- SAFE_FSTAT(fd, &sb);
- buf = SAFE_MMAP(0, sb.st_size, PROT_READ|PROT_EXEC, MAP_PRIVATE, fd, 0);
- SAFE_CLOSE(fd);
-}
-
-static void run(void)
-{
- TST_EXP_PASS(init_module(buf, sb.st_size, "status=valid"));
- if (!TST_PASS)
- return;
-
- tst_module_unload(MODULE_NAME);
-}
-
-static void cleanup(void)
-{
- munmap(buf, sb.st_size);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/init_module/init_module02.c b/testcases/kernel/syscalls/init_module/init_module02.c
deleted file mode 100644
index 3953f4f61..000000000
--- a/testcases/kernel/syscalls/init_module/init_module02.c
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic init_module() failure tests.
- *
- * [Algorithm]
- *
- * Tests various failure scenarios for init_module().
- */
-
-#include <linux/capability.h>
-#include <errno.h>
-#include "lapi/init_module.h"
-#include "tst_module.h"
-#include "tst_capability.h"
-
-#define MODULE_NAME "init_module.ko"
-
-static unsigned long size, zero_size;
-static void *buf, *faulty_buf, *null_buf;
-
-static struct tst_cap cap_req = TST_CAP(TST_CAP_REQ, CAP_SYS_MODULE);
-static struct tst_cap cap_drop = TST_CAP(TST_CAP_DROP, CAP_SYS_MODULE);
-
-static struct tcase {
- const char *name;
- void **buf;
- unsigned long *size;
- const char *param;
- int cap;
- int exp_errno;
-} tcases[] = {
- {"NULL-buffer", &null_buf, &size, "", 0, EFAULT},
- {"faulty-buffer", &faulty_buf, &size, "", 0, EFAULT},
- {"null-param", &buf, &size, NULL, 0, EFAULT},
- {"zero-size", &buf, &zero_size, "", 0, ENOEXEC},
- {"invalid_param", &buf, &size, "status=invalid", 0, EINVAL},
- {"no-perm", &buf, &size, "", 1, EPERM},
- {"module-exists", &buf, &size, "", 0, EEXIST},
-};
-
-static void setup(void)
-{
- struct stat sb;
- int fd;
-
- tst_module_exists(MODULE_NAME, NULL);
-
- fd = SAFE_OPEN(MODULE_NAME, O_RDONLY|O_CLOEXEC);
- SAFE_FSTAT(fd, &sb);
- size = sb.st_size;
- buf = SAFE_MMAP(0, size, PROT_READ|PROT_EXEC, MAP_PRIVATE, fd, 0);
- SAFE_CLOSE(fd);
-
- faulty_buf = tst_get_bad_addr(NULL);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- if (tc->cap)
- tst_cap_action(&cap_drop);
-
- /* Insert module twice */
- if (tc->exp_errno == EEXIST)
- tst_module_load(MODULE_NAME, NULL);
-
- TST_EXP_FAIL(init_module(*tc->buf, *tc->size, tc->param), tc->exp_errno,
- "TestName: %s", tc->name);
-
- if (tc->exp_errno == EEXIST)
- tst_module_unload(MODULE_NAME);
-
- if (!TST_PASS && !TST_RET)
- tst_module_unload(MODULE_NAME);
-
- if (tc->cap)
- tst_cap_action(&cap_req);
-}
-
-static void cleanup(void)
-{
- munmap(buf, size);
-}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/inotify/.gitignore b/testcases/kernel/syscalls/inotify/.gitignore
index da9bfc767..32ccab5de 100644
--- a/testcases/kernel/syscalls/inotify/.gitignore
+++ b/testcases/kernel/syscalls/inotify/.gitignore
@@ -7,4 +7,3 @@
/inotify07
/inotify08
/inotify09
-/inotify10
diff --git a/testcases/kernel/syscalls/inotify/Makefile b/testcases/kernel/syscalls/inotify/Makefile
index 16d430864..ea746618d 100644
--- a/testcases/kernel/syscalls/inotify/Makefile
+++ b/testcases/kernel/syscalls/inotify/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) SWSoft, 2007
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/inotify/inotify01.c b/testcases/kernel/syscalls/inotify/inotify01.c
index 2d82e5970..8f1547d46 100644
--- a/testcases/kernel/syscalls/inotify/inotify01.c
+++ b/testcases/kernel/syscalls/inotify/inotify01.c
@@ -52,7 +52,10 @@ void verify_inotify(void)
event_set[test_cnt] = IN_ATTRIB;
test_cnt++;
- fd = SAFE_OPEN(fname, O_RDONLY);
+ if ((fd = open(fname, O_RDONLY)) == -1) {
+ tst_brk(TBROK | TERRNO,
+ "open(%s, O_RDWR|O_CREAT,0700) failed", fname);
+ }
event_set[test_cnt] = IN_OPEN;
test_cnt++;
@@ -67,7 +70,10 @@ void verify_inotify(void)
event_set[test_cnt] = IN_CLOSE_NOWRITE;
test_cnt++;
- fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0700);
+ if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1) {
+ tst_brk(TBROK,
+ "open(%s, O_RDWR|O_CREAT,0700) failed", fname);
+ }
event_set[test_cnt] = IN_OPEN;
test_cnt++;
diff --git a/testcases/kernel/syscalls/inotify/inotify06.c b/testcases/kernel/syscalls/inotify/inotify06.c
index 68813769b..96189b082 100644
--- a/testcases/kernel/syscalls/inotify/inotify06.c
+++ b/testcases/kernel/syscalls/inotify/inotify06.c
@@ -38,11 +38,7 @@
/* Number of files to test (must be > 1) */
#define FILES 5
-#define PROCFILE "/proc/sys/fs/inotify/max_user_instances"
-
-static char names[FILES][PATH_MAX];
-static pid_t pid;
-static int old_proc_limit;
+char names[FILES][PATH_MAX];
static void setup(void)
{
@@ -50,16 +46,12 @@ static void setup(void)
for (i = 0; i < FILES; i++)
sprintf(names[i], "fname_%d", i);
-
- SAFE_FILE_SCANF(PROCFILE, "%d", &old_proc_limit);
-
- if (old_proc_limit >= 0 && old_proc_limit < TEARDOWNS)
- SAFE_FILE_PRINTF(PROCFILE, "%d", TEARDOWNS + 128);
}
static void verify_inotify(void)
{
int inotify_fd, fd;
+ pid_t pid;
int i, tests;
pid = SAFE_FORK();
@@ -93,27 +85,14 @@ static void verify_inotify(void)
/* Kill the child creating / deleting files and wait for it */
SAFE_KILL(pid, SIGKILL);
- pid = 0;
SAFE_WAIT(NULL);
}
-static void cleanup(void)
-{
- if (pid) {
- SAFE_KILL(pid, SIGKILL);
- SAFE_WAIT(NULL);
- }
-
- SAFE_FILE_PRINTF(PROCFILE, "%d", old_proc_limit);
-}
-
static struct tst_test test = {
.timeout = 600,
- .needs_root = 1,
.needs_tmpdir = 1,
.forks_child = 1,
.setup = setup,
- .cleanup = cleanup,
.test_all = verify_inotify,
};
diff --git a/testcases/kernel/syscalls/inotify/inotify09.c b/testcases/kernel/syscalls/inotify/inotify09.c
index fdfc9c078..ff7379252 100644
--- a/testcases/kernel/syscalls/inotify/inotify09.c
+++ b/testcases/kernel/syscalls/inotify/inotify09.c
@@ -94,10 +94,6 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.test_all = verify_inotify,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "d90a10e2444b"},
- {}
- }
};
#else
diff --git a/testcases/kernel/syscalls/inotify/inotify10.c b/testcases/kernel/syscalls/inotify/inotify10.c
deleted file mode 100644
index eb2322090..000000000
--- a/testcases/kernel/syscalls/inotify/inotify10.c
+++ /dev/null
@@ -1,219 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2020 CTERA Networks. All Rights Reserved.
- *
- * Started by Amir Goldstein <amir73il@gmail.com>
- *
- * DESCRIPTION
- * Check that event is reported to watching parent and watching child
- * based on their interest
- *
- * Test case #3 is a regression test for commit fecc4559780d that fixes
- * a bug introduced in kernel v5.9:
- *
- * fsnotify: fix events reported to watching parent and child
- */
-
-#include "config.h"
-
-#if defined(HAVE_SYS_INOTIFY_H)
-# include <sys/inotify.h>
-#endif
-#include <errno.h>
-#include <string.h>
-#include "tst_test.h"
-#include "inotify.h"
-
-#if defined(HAVE_SYS_INOTIFY_H)
-
-#define EVENT_MAX 10
-/* Size of the event structure, not including the name */
-#define EVENT_SIZE (sizeof(struct inotify_event))
-#define EVENT_BUF_LEN (EVENT_MAX * (EVENT_SIZE + 16))
-
-
-#define BUF_SIZE 256
-
-struct event_t {
- char name[BUF_SIZE];
- unsigned int mask;
- int wd;
-};
-
-#define TEST_DIR "test_dir"
-#define TEST_FILE "test_file"
-
-static struct tcase {
- const char *tname;
- unsigned int parent_mask;
- unsigned int subdir_mask;
- unsigned int child_mask;
- unsigned int parent_mask_other;
- unsigned int subdir_mask_other;
- unsigned int child_mask_other;
-} tcases[] = {
- {
- "Group with parent and child watches",
- IN_ATTRIB, IN_ATTRIB, IN_ATTRIB,
- 0, 0, 0,
- },
- {
- "Group with child watches and other group with parent watch",
- 0, IN_ATTRIB, IN_ATTRIB,
- IN_ATTRIB, 0, 0,
- },
- {
- "Group with parent watch and other group with child watches",
- IN_ATTRIB, 0, 0,
- 0, IN_ATTRIB, IN_ATTRIB,
- },
- {
- "Two Groups with parent and child watches for different events",
- IN_ATTRIB, IN_OPEN, IN_OPEN,
- IN_OPEN, IN_ATTRIB, IN_ATTRIB,
- },
-};
-
-struct event_t event_set[EVENT_MAX];
-
-char event_buf[EVENT_BUF_LEN];
-
-int fd_notify, fd_notify_other;
-
-static void verify_inotify(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int i = 0, test_num = 0, len;
- int wd_parent = 0, wd_subdir = 0, wd_child = 0;
- int test_cnt = 0;
-
- tst_res(TINFO, "Test #%d: %s", n, tc->tname);
-
- fd_notify = SAFE_MYINOTIFY_INIT();
- fd_notify_other = SAFE_MYINOTIFY_INIT();
-
- /* Setup watches on parent dir and children */
- if (tc->parent_mask)
- wd_parent = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, ".", tc->parent_mask);
- if (tc->subdir_mask)
- wd_subdir = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, TEST_DIR, tc->subdir_mask);
- if (tc->child_mask)
- wd_child = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, TEST_FILE, tc->child_mask);
- /*
- * Setup watches on "other" group to verify no intereferecne with our group.
- * We do not check events reported to the "other" group.
- */
- if (tc->parent_mask_other)
- SAFE_MYINOTIFY_ADD_WATCH(fd_notify_other, ".", tc->parent_mask_other);
- if (tc->subdir_mask_other)
- SAFE_MYINOTIFY_ADD_WATCH(fd_notify_other, TEST_DIR, tc->subdir_mask_other);
- if (tc->child_mask_other)
- SAFE_MYINOTIFY_ADD_WATCH(fd_notify_other, TEST_FILE, tc->child_mask_other);
-
- /*
- * Generate IN_ATTRIB events on file and subdir that should be reported to parent
- * dir with name and to children without name if they have IN_ATTRIB in their mask.
- */
- SAFE_CHMOD(TEST_DIR, 0755);
- SAFE_CHMOD(TEST_FILE, 0644);
-
- if (wd_parent && (tc->parent_mask & IN_ATTRIB)) {
- event_set[test_cnt].wd = wd_parent;
- event_set[test_cnt].mask = tc->parent_mask | IN_ISDIR;
- strcpy(event_set[test_cnt].name, TEST_DIR);
- test_cnt++;
- }
- if (wd_subdir && (tc->subdir_mask & IN_ATTRIB)) {
- event_set[test_cnt].wd = wd_subdir;
- event_set[test_cnt].mask = tc->subdir_mask | IN_ISDIR;
- strcpy(event_set[test_cnt].name, "");
- test_cnt++;
- }
- if (wd_parent && (tc->parent_mask & IN_ATTRIB)) {
- event_set[test_cnt].wd = wd_parent;
- event_set[test_cnt].mask = tc->parent_mask;
- strcpy(event_set[test_cnt].name, TEST_FILE);
- test_cnt++;
- }
- if (wd_child && (tc->child_mask & IN_ATTRIB)) {
- event_set[test_cnt].wd = wd_child;
- event_set[test_cnt].mask = tc->child_mask;
- strcpy(event_set[test_cnt].name, "");
- test_cnt++;
- }
-
- len = read(fd_notify, event_buf, EVENT_BUF_LEN);
- if (len == -1)
- tst_brk(TBROK | TERRNO, "read failed");
-
- while (i < len) {
- struct event_t *expected = &event_set[test_num];
- struct inotify_event *event;
- event = (struct inotify_event *)&event_buf[i];
- if (test_num >= test_cnt) {
- tst_res(TFAIL,
- "got unnecessary event: "
- "wd=%d mask=%04x len=%u "
- "name=\"%.*s\"", event->wd, event->mask,
- event->len, event->len, event->name);
-
- } else if (expected->wd == event->wd &&
- expected->mask == event->mask &&
- !strncmp(expected->name, event->name, event->len)) {
- tst_res(TPASS,
- "got event: wd=%d mask=%04x "
- "cookie=%u len=%u name=\"%.*s\"",
- event->wd, event->mask, event->cookie,
- event->len, event->len, event->name);
-
- } else {
- tst_res(TFAIL, "got event: wd=%d (expected %d) "
- "mask=%04x (expected %x) len=%u "
- "name=\"%.*s\" (expected \"%s\")",
- event->wd, expected->wd,
- event->mask, expected->mask,
- event->len, event->len,
- event->name, expected->name);
- }
- test_num++;
- i += EVENT_SIZE + event->len;
- }
-
- for (; test_num < test_cnt; test_num++) {
- tst_res(TFAIL, "didn't get event: mask=%04x ",
- event_set[test_num].mask);
- }
-
- SAFE_CLOSE(fd_notify);
- SAFE_CLOSE(fd_notify_other);
-}
-
-static void setup(void)
-{
- SAFE_MKDIR(TEST_DIR, 00700);
- SAFE_FILE_PRINTF(TEST_FILE, "1");
-}
-
-static void cleanup(void)
-{
- if (fd_notify > 0)
- SAFE_CLOSE(fd_notify);
- if (fd_notify_other > 0)
- SAFE_CLOSE(fd_notify_other);
-}
-
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_inotify,
- .tcnt = ARRAY_SIZE(tcases),
- .tags = (const struct tst_tag[]) {
- {"linux-git", "fecc4559780d"},
- {}
- }
-};
-
-#else
- TST_TEST_TCONF("system doesn't have required inotify support");
-#endif /* defined(HAVE_SYS_INOTIFY_H) */
diff --git a/testcases/kernel/syscalls/inotify_init/Makefile b/testcases/kernel/syscalls/inotify_init/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/inotify_init/Makefile
+++ b/testcases/kernel/syscalls/inotify_init/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/io_cancel/Makefile b/testcases/kernel/syscalls/io_cancel/Makefile
index ce4f13b72..268d2e74b 100644
--- a/testcases/kernel/syscalls/io_cancel/Makefile
+++ b/testcases/kernel/syscalls/io_cancel/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
index 11f789b78..ed6af050b 100644
--- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c
+++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c
@@ -1,30 +1,115 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Crackerjack Project., 2007
- * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
- * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
- * [Description]
*
- * Calls io_cancel() with one of the data structures points to invalid data and
- * expects it to return EFAULT.
+ * Copyright (c) Crackerjack Project., 2007
+ * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <linux/aio_abi.h>
+/* Porting from Crackerjack to LTP is done
+ by Masatake YAMATO <yamato@redhat.com> */
+
+#include <errno.h>
+#include <string.h>
#include "config.h"
-#include "tst_test.h"
-#include "lapi/syscalls.h"
+#include "test.h"
+
+char *TCID = "io_cancel01";
+
+int TST_TOTAL = 1;
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+
+static void cleanup(void)
+{
+}
+
+static void setup(void)
+{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ DESCRIPTION
+ io_cancel attempts to cancel an asynchronous I/O operation previously
+ submitted with the io_submit system call. ctx_id is the AIO context
+ ID of the operation to be cancelled. If the AIO context is found, the
+ event will be cancelled and then copied into the memory pointed to by
+ result without being placed into the completion queue.
+
+ RETURN VALUE
+ io_cancel returns 0 on success; otherwise, it returns one of the er-
+ rors listed in the "Errors" section.
+
+ ERRORS
+ EINVAL The AIO context specified by ctx_id is invalid.
+
+ EFAULT One of the data structures points to invalid data.
+ */
-static void run(void)
+#define EXP_RET (-EFAULT)
+
+int main(int argc, char *argv[])
{
- aio_context_t ctx;
+ int lc;
+
+ io_context_t ctx;
+
memset(&ctx, 0, sizeof(ctx));
- TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT);
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ TEST(io_cancel(ctx, NULL, NULL));
+
+ switch (TEST_RETURN) {
+ case 0:
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ break;
+ case EXP_RET:
+ tst_resm(TPASS, "expected failure - "
+ "returned value = %ld : %s", TEST_RETURN,
+ strerror(-TEST_RETURN));
+ break;
+ case -ENOSYS:
+ tst_resm(TCONF, "io_cancel returned ENOSYS");
+ break;
+ default:
+ tst_resm(TFAIL, "unexpected returned value - %s (%i) - "
+ "expected %s (%i)", strerror(-TEST_RETURN),
+ (int)TEST_RETURN, strerror(-EXP_RET), EXP_RET);
+ break;
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .test_all = run,
-};
+#else
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
+}
+#endif
diff --git a/testcases/kernel/syscalls/io_destroy/Makefile b/testcases/kernel/syscalls/io_destroy/Makefile
index ce4f13b72..268d2e74b 100644
--- a/testcases/kernel/syscalls/io_destroy/Makefile
+++ b/testcases/kernel/syscalls/io_destroy/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy01.c b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
index bb89f61f5..560d7b3fb 100644
--- a/testcases/kernel/syscalls/io_destroy/io_destroy01.c
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
@@ -25,25 +25,21 @@ static void verify_io_destroy(void)
io_context_t ctx;
memset(&ctx, 0xff, sizeof(ctx));
- TEST(io_destroy(ctx));
+ TEST(io_destroy(ctx));
if (TST_RET == 0) {
tst_res(TFAIL, "io_destroy() succeeded unexpectedly");
return;
}
- if (TST_RET == -ENOSYS) {
- tst_res(TCONF, "io_destroy() not supported");
- return;
- }
-
if (TST_RET == -EINVAL) {
- tst_res(TPASS, "io_destroy() failed as expected, returned -EINVAL");
- return;
+ tst_res(TPASS,
+ "io_destroy() failed as expected, returned -EINVAL");
+ } else {
+ tst_res(TFAIL, "io_destroy() failed unexpectedly, "
+ "returned -%s expected -EINVAL",
+ tst_strerrno(-TST_RET));
}
-
- tst_res(TFAIL, "io_destroy() failed unexpectedly, returned -%s expected -EINVAL",
- tst_strerrno(-TST_RET));
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/io_getevents/Makefile b/testcases/kernel/syscalls/io_getevents/Makefile
index ce4f13b72..268d2e74b 100644
--- a/testcases/kernel/syscalls/io_getevents/Makefile
+++ b/testcases/kernel/syscalls/io_getevents/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/io_getevents/io_getevents01.c b/testcases/kernel/syscalls/io_getevents/io_getevents01.c
index ad85cdaa5..b34f17907 100644
--- a/testcases/kernel/syscalls/io_getevents/io_getevents01.c
+++ b/testcases/kernel/syscalls/io_getevents/io_getevents01.c
@@ -1,29 +1,113 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Crackerjack Project., 2007
- * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
- * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
- * [Description]
*
- * Calls io_getevents() when ctx is invalid and expects it to return EINVAL.
+ * Copyright (c) Crackerjack Project., 2007
+ * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <linux/aio_abi.h>
+/* Porting from Crackerjack to LTP is done
+ by Masatake YAMATO <yamato@redhat.com> */
+
+#include <errno.h>
+#include <string.h>
#include "config.h"
-#include "tst_test.h"
-#include "lapi/syscalls.h"
+#include "test.h"
+
+char *TCID = "io_getevents01";
+int TST_TOTAL = 1;
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
-static void run(void)
+static void cleanup(void)
{
- aio_context_t ctx;
+}
+
+static void setup(void)
+{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ DESCRIPTION
+ io_getevents attempts to read at least min_nr events and up to nr
+ events from the completion queue of the AIO context specified by
+ ctx_id. timeout specifies the amount of time to wait for events,
+ where a NULL timeout waits until at least min_nr events have been
+ seen. Note that timeout is relative and will be updated if not NULL
+ and the operation blocks.
+
+ RETURN VALUE
+ io_getevents returns the number of events read: 0 if no events are
+ available or < min_nr if the timeout has elapsed.
+
+ ERRORS
+ EINVAL ctx_id is invalid. min_nr is out of range or nr is out of
+ range.
+ */
+
+#define EXP_RET (-EINVAL)
+
+int main(int argc, char *argv[])
+{
+ int lc;
+
+ io_context_t ctx;
+
memset(&ctx, 0, sizeof(ctx));
- TST_EXP_FAIL(tst_syscall(__NR_io_getevents, ctx, 0, 0, NULL, NULL), EINVAL);
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ TEST(io_getevents(ctx, 0, 0, NULL, NULL));
+
+ switch (TEST_RETURN) {
+ case 0:
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ break;
+ case EXP_RET:
+ tst_resm(TPASS, "expected failure - "
+ "returned value = %ld : %s", TEST_RETURN,
+ strerror(-TEST_RETURN));
+ break;
+ case -ENOSYS:
+ tst_resm(TCONF, "io_cancel returned ENOSYS");
+ break;
+ default:
+ tst_resm(TFAIL, "unexpected returned value - %s (%i) - "
+ "expected %s (%i)", strerror(-TEST_RETURN),
+ (int)TEST_RETURN, strerror(-EXP_RET), EXP_RET);
+ break;
+ }
+ }
+
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .test_all = run,
-};
+#else
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "test requires libaio and it's development packages");
+}
+#endif
diff --git a/testcases/kernel/syscalls/io_pgetevents/.gitignore b/testcases/kernel/syscalls/io_pgetevents/.gitignore
deleted file mode 100644
index ae02077ba..000000000
--- a/testcases/kernel/syscalls/io_pgetevents/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-io_pgetevents01
-io_pgetevents02
diff --git a/testcases/kernel/syscalls/io_pgetevents/Makefile b/testcases/kernel/syscalls/io_pgetevents/Makefile
deleted file mode 100644
index c26cffd37..000000000
--- a/testcases/kernel/syscalls/io_pgetevents/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += $(AIO_LIBS)
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
deleted file mode 100644
index a0b56d814..000000000
--- a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * Basic io_pgetevents() test to receive 1 event successfully.
- */
-#include "time64_variants.h"
-#include "tst_test.h"
-#include "tst_timer.h"
-#include "lapi/io_pgetevents.h"
-
-#ifdef HAVE_LIBAIO
-static int fd;
-
-static struct time64_variants variants[] = {
-#if (__NR_io_pgetevents != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_io_pgetevents_time64 != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
-{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-}
-
-static void cleanup(void)
-{
- if (fd > 0)
- SAFE_CLOSE(fd);
-}
-
-static void run(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct io_event events[1];
- struct iocb cb, *cbs[1];
- io_context_t ctx = 0;
- struct tst_ts to = tst_ts_from_ns(tv->ts_type, 10000);
- sigset_t sigmask;
- char data[4096];
- int ret;
-
- cbs[0] = &cb;
- sigemptyset(&sigmask);
-
- fd = SAFE_OPEN("io_pgetevents_file", O_RDWR | O_CREAT, 0644);
- io_prep_pwrite(&cb, fd, data, 4096, 0);
-
- TEST(io_setup(1, &ctx));
- if (TST_RET == -ENOSYS)
- tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
- if (TST_RET < 0)
- tst_brk(TBROK | TRERRNO, "io_setup() failed");
-
- ret = io_submit(ctx, 1, cbs);
- if (ret != 1)
- tst_brk(TBROK | TERRNO, "io_submit() failed");
-
- /* get the reply */
- ret = tv->io_pgetevents(ctx, 1, 1, events, tst_ts_get(&to), &sigmask);
-
- if (ret == 1)
- tst_res(TPASS, "io_pgetevents() works as expected");
- else
- tst_res(TFAIL | TERRNO, "io_pgetevents() failed");
-
- if (io_destroy(ctx) < 0)
- tst_brk(TBROK | TERRNO, "io_destroy() failed");
-}
-
-static struct tst_test test = {
- .min_kver = "4.18",
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .needs_tmpdir = 1,
- .cleanup = cleanup,
- .setup = setup,
-};
-
-#else
-TST_TEST_TCONF("test requires libaio and it's development packages");
-#endif
diff --git a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
deleted file mode 100644
index af71e17fe..000000000
--- a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
+++ /dev/null
@@ -1,133 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * Basic io_pgetevents() test to check various failures.
- */
-#include "time64_variants.h"
-#include "tst_test.h"
-#include "tst_timer.h"
-#include "lapi/io_pgetevents.h"
-
-#ifdef HAVE_LIBAIO
-static sigset_t sigmask;
-static struct io_event events[1];
-static io_context_t ctx, invalid_ctx = 0;
-static int fd, ctx_initialized;
-
-static struct tst_ts to;
-static void *bad_addr;
-
-static struct tcase {
- char *name;
- io_context_t *ctx;
- long min_nr;
- long max_nr;
- struct io_event *events;
- struct tst_ts *timeout;
- sigset_t *sigmask;
- int exp_errno;
-} tcases[] = {
- {"invalid ctx", &invalid_ctx, 1, 1, events, &to, &sigmask, EINVAL},
- {"invalid min_nr", &ctx, -1, 1, events, &to, &sigmask, EINVAL},
- {"invalid max_nr", &ctx, 1, -1, events, &to, &sigmask, EINVAL},
- {"invalid events", &ctx, 1, 1, NULL, &to, &sigmask, EFAULT},
- {"invalid timeout", &ctx, 1, 1, events, NULL, &sigmask, EFAULT},
- {"invalid sigmask", &ctx, 1, 1, events, &to, NULL, EFAULT},
-};
-
-static struct time64_variants variants[] = {
-#if (__NR_io_pgetevents != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_io_pgetevents_time64 != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct iocb cb, *cbs[1];
- char data[4096];
- int ret;
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- bad_addr = tst_get_bad_addr(NULL);
- to = tst_ts_from_ns(tv->ts_type, 10000);
-
- cbs[0] = &cb;
-
- sigemptyset(&sigmask);
-
- fd = SAFE_OPEN("io_pgetevents_file", O_RDWR | O_CREAT, 0644);
- io_prep_pwrite(&cb, fd, data, 4096, 0);
-
- TEST(io_setup(1, &ctx));
- if (TST_RET == -ENOSYS)
- tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
- if (TST_RET < 0)
- tst_brk(TBROK | TRERRNO, "io_setup() failed");
-
- ctx_initialized = 1;
-
- ret = io_submit(ctx, 1, cbs);
- if (ret != 1)
- tst_brk(TBROK | TERRNO, "io_submit() failed");
-}
-
-static void cleanup(void)
-{
- if (ctx_initialized) {
- if (io_destroy(ctx) < 0)
- tst_res(TWARN | TERRNO, "io_destroy() failed");
- }
-
- if (fd > 0)
- SAFE_CLOSE(fd);
-}
-
-static void run(unsigned int n)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct tcase *tc = &tcases[n];
- struct timespec *to;
- sigset_t *sigmask;
-
- sigmask = tc->sigmask ? tc->sigmask : bad_addr;
- to = tc->timeout ? tc->timeout : bad_addr;
-
- TEST(tv->io_pgetevents(*tc->ctx, tc->min_nr, tc->max_nr, tc->events, to,
- sigmask));
-
- if (TST_RET == 1) {
- tst_res(TFAIL, "%s: io_pgetevents() passed unexpectedly",
- tc->name);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: io_pgetevents() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: io_pgetevents() failed as expected",
- tc->name);
-}
-
-static struct tst_test test = {
- .min_kver = "4.18",
- .needs_tmpdir = 1,
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
-};
-
-#else
-TST_TEST_TCONF("test requires libaio and it's development packages");
-#endif
diff --git a/testcases/kernel/syscalls/io_setup/Makefile b/testcases/kernel/syscalls/io_setup/Makefile
index ce4f13b72..268d2e74b 100644
--- a/testcases/kernel/syscalls/io_setup/Makefile
+++ b/testcases/kernel/syscalls/io_setup/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/io_setup/io_setup01.c b/testcases/kernel/syscalls/io_setup/io_setup01.c
index 28aee7831..4693f8fbb 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup01.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup01.c
@@ -53,8 +53,6 @@ static void verify_success(unsigned int nr, io_context_t *ctx, int init_val)
memset(ctx, init_val, sizeof(*ctx));
TEST(io_setup(nr, ctx));
- if (TST_RET == -ENOSYS)
- tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
if (TST_RET != 0) {
tst_res(TFAIL, "io_setup() failed unexpectedly with %li (%s)",
TST_RET, tst_strerrno(-TST_RET));
diff --git a/testcases/kernel/syscalls/io_submit/Makefile b/testcases/kernel/syscalls/io_submit/Makefile
index ce4f13b72..268d2e74b 100644
--- a/testcases/kernel/syscalls/io_submit/Makefile
+++ b/testcases/kernel/syscalls/io_submit/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index bbbbc9101..afa077c59 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -66,11 +66,11 @@ static struct tcase {
static void setup(void)
{
- TEST(io_setup(1, &ctx));
- if (TST_RET == -ENOSYS)
- tst_brk(TCONF | TRERRNO, "io_setup(): AIO not supported by kernel");
- else if (TST_RET)
- tst_brk(TBROK | TRERRNO, "io_setup() failed");
+ int rval;
+
+ rval = io_setup(1, &ctx);
+ if (rval)
+ tst_brk(TBROK | TERRNO, "io_setup() returned %d", rval);
io_prep_pread(&inv_fd_iocb, -1, buf, sizeof(buf), 0);
diff --git a/testcases/kernel/syscalls/io_uring/.gitignore b/testcases/kernel/syscalls/io_uring/.gitignore
deleted file mode 100644
index 749db17db..000000000
--- a/testcases/kernel/syscalls/io_uring/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/io_uring01
-/io_uring02
diff --git a/testcases/kernel/syscalls/io_uring/Makefile b/testcases/kernel/syscalls/io_uring/Makefile
deleted file mode 100644
index 94a19de2f..000000000
--- a/testcases/kernel/syscalls/io_uring/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2020 ARM Ltd. All rights reserved.
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/io_uring/io_uring01.c b/testcases/kernel/syscalls/io_uring/io_uring01.c
deleted file mode 100644
index 70151bb85..000000000
--- a/testcases/kernel/syscalls/io_uring/io_uring01.c
+++ /dev/null
@@ -1,268 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 ARM Ltd. All rights reserved.
- * Author: Vikas Kumar <vikas.kumar2@arm.com>
- *
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
- *
- * Tests for asynchronous I/O raw API i.e io_uring_setup(), io_uring_register()
- * and io_uring_enter(). This tests validate basic API operation by creating a
- * submission queue and a completion queue using io_uring_setup(). User buffer
- * registered in the kernel for long term operation using io_uring_register().
- * This tests initiates I/O operations with the help of io_uring_enter().
- */
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include "config.h"
-#include "tst_test.h"
-#include "lapi/io_uring.h"
-
-#define TEST_FILE "test_file"
-
-#define QUEUE_DEPTH 1
-#define BLOCK_SZ 1024
-
-static struct tcase {
- unsigned int setup_flags;
- unsigned int register_opcode;
- unsigned int enter_flags;
-} tcases[] = {
- {0, IORING_REGISTER_BUFFERS, IORING_OP_READ_FIXED},
-};
-
-struct io_sq_ring {
- unsigned int *head;
- unsigned int *tail;
- unsigned int *ring_mask;
- unsigned int *ring_entries;
- unsigned int *flags;
- unsigned int *array;
-};
-
-struct io_cq_ring {
- unsigned int *head;
- unsigned int *tail;
- unsigned int *ring_mask;
- unsigned int *ring_entries;
- struct io_uring_cqe *cqes;
-};
-
-struct submitter {
- int ring_fd;
- struct io_sq_ring sq_ring;
- struct io_uring_sqe *sqes;
- struct io_cq_ring cq_ring;
-};
-
-static struct submitter sub_ring;
-static struct submitter *s = &sub_ring;
-static sigset_t sig;
-static struct iovec *iov;
-
-
-static void *sptr;
-static size_t sptr_size;
-static void *cptr;
-static size_t cptr_size;
-
-static int setup_io_uring_test(struct submitter *s, struct tcase *tc)
-{
- struct io_sq_ring *sring = &s->sq_ring;
- struct io_cq_ring *cring = &s->cq_ring;
- struct io_uring_params p;
-
- memset(&p, 0, sizeof(p));
- p.flags |= tc->setup_flags;
- s->ring_fd = io_uring_setup(QUEUE_DEPTH, &p);
- if (s->ring_fd != -1) {
- tst_res(TPASS, "io_uring_setup() passed");
- } else {
- tst_res(TFAIL | TERRNO, "io_uring_setup() failed");
- return 1;
- }
-
- sptr_size = p.sq_off.array + p.sq_entries * sizeof(unsigned int);
-
- /* Submission queue ring buffer mapping */
- sptr = SAFE_MMAP(0, sptr_size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_POPULATE,
- s->ring_fd, IORING_OFF_SQ_RING);
-
- /* Save global submission queue struct info */
- sring->head = sptr + p.sq_off.head;
- sring->tail = sptr + p.sq_off.tail;
- sring->ring_mask = sptr + p.sq_off.ring_mask;
- sring->ring_entries = sptr + p.sq_off.ring_entries;
- sring->flags = sptr + p.sq_off.flags;
- sring->array = sptr + p.sq_off.array;
-
- /* Submission queue entries ring buffer mapping */
- s->sqes = SAFE_MMAP(0, p.sq_entries *
- sizeof(struct io_uring_sqe),
- PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_POPULATE,
- s->ring_fd, IORING_OFF_SQES);
-
- cptr_size = p.cq_off.cqes + p.cq_entries * sizeof(struct io_uring_cqe);
-
- /* Completion queue ring buffer mapping */
- cptr = SAFE_MMAP(0, cptr_size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_POPULATE,
- s->ring_fd, IORING_OFF_CQ_RING);
-
- /* Save global completion queue struct info */
- cring->head = cptr + p.cq_off.head;
- cring->tail = cptr + p.cq_off.tail;
- cring->ring_mask = cptr + p.cq_off.ring_mask;
- cring->ring_entries = cptr + p.cq_off.ring_entries;
- cring->cqes = cptr + p.cq_off.cqes;
-
- return 0;
-}
-
-static void check_buffer(char *buffer, size_t len)
-{
- size_t i;
-
- for (i = 0; i < len; i++) {
- if (buffer[i] != 'a') {
- tst_res(TFAIL, "Wrong data at offset %zu", i);
- break;
- }
- }
-
- if (i == len)
- tst_res(TPASS, "Buffer filled in correctly");
-}
-
-static void drain_uring_cq(struct submitter *s, unsigned int exp_events)
-{
- struct io_cq_ring *cring = &s->cq_ring;
- unsigned int head = *cring->head;
- unsigned int events = 0;
-
- for (head = *cring->head; head != *cring->tail; head++) {
- struct io_uring_cqe *cqe = &cring->cqes[head & *s->cq_ring.ring_mask];
-
- events++;
-
- if (cqe->res < 0) {
- tst_res(TFAIL, "CQE result %s", tst_strerrno(-cqe->res));
- } else {
- struct iovec *iovecs = (void*)cqe->user_data;
-
- if (cqe->res == BLOCK_SZ)
- tst_res(TPASS, "CQE result %i", cqe->res);
- else
- tst_res(TFAIL, "CQE result %i expected %i", cqe->res, BLOCK_SZ);
-
- check_buffer(iovecs[0].iov_base, cqe->res);
- }
- }
-
- *cring->head = head;
-
- if (exp_events == events) {
- tst_res(TPASS, "Got %u completion events", events);
- return;
- }
-
- tst_res(TFAIL, "Got %u completion events expected %u",
- events, exp_events);
-}
-
-static int submit_to_uring_sq(struct submitter *s, struct tcase *tc)
-{
- unsigned int index = 0, tail = 0, next_tail = 0;
- struct io_sq_ring *sring = &s->sq_ring;
- struct io_uring_sqe *sqe;
- int ret;
-
- memset(iov->iov_base, 0, iov->iov_len);
-
- ret = io_uring_register(s->ring_fd, tc->register_opcode,
- iov, QUEUE_DEPTH);
- if (ret == 0) {
- tst_res(TPASS, "io_uring_register() passed");
- } else {
- tst_res(TFAIL | TERRNO, "io_uring_register() failed");
- return 1;
- }
-
- int fd = SAFE_OPEN(TEST_FILE, O_RDONLY);
-
- /* Submission queue entry addition to SQE ring buffer tail */
- tail = *sring->tail;
- next_tail = tail + 1;
- index = tail & *s->sq_ring.ring_mask;
- sqe = &s->sqes[index];
- sqe->flags = 0;
- sqe->fd = fd;
- sqe->opcode = tc->enter_flags;
- sqe->addr = (unsigned long)iov->iov_base;
- sqe->len = BLOCK_SZ;
- sqe->off = 0;
- sqe->user_data = (unsigned long long)iov;
- sring->array[index] = index;
- tail = next_tail;
-
- /* Kernel to notice the tail update */
- if (*sring->tail != tail)
- *sring->tail = tail;
-
- ret = io_uring_enter(s->ring_fd, 1, 1, IORING_ENTER_GETEVENTS, &sig);
- if (ret == 1) {
- tst_res(TPASS, "io_uring_enter() waited for 1 event");
- } else {
- tst_res(TFAIL | TERRNO, "io_uring_enter() returned %i", ret);
- SAFE_CLOSE(fd);
- return 1;
- }
-
- SAFE_CLOSE(fd);
- return 0;
-}
-
-static void cleanup_io_uring_test(void)
-{
- io_uring_register(s->ring_fd, IORING_UNREGISTER_BUFFERS,
- NULL, QUEUE_DEPTH);
- SAFE_MUNMAP(s->sqes, sizeof(struct io_uring_sqe));
- SAFE_MUNMAP(cptr, cptr_size);
- SAFE_MUNMAP(sptr, sptr_size);
- SAFE_CLOSE(s->ring_fd);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- if (setup_io_uring_test(s, tc))
- return;
-
- if (!submit_to_uring_sq(s, tc))
- drain_uring_cq(s, 1);
-
- cleanup_io_uring_test();
-}
-
-static void setup(void)
-{
- io_uring_setup_supported_by_kernel();
- tst_fill_file(TEST_FILE, 'a', 1024, 1);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .test = run,
- .needs_tmpdir = 1,
- .tcnt = ARRAY_SIZE(tcases),
- .bufs = (struct tst_buffers []) {
- {&iov, .iov_sizes = (int[]){BLOCK_SZ, -1}},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/io_uring/io_uring02.c b/testcases/kernel/syscalls/io_uring/io_uring02.c
deleted file mode 100644
index c5c770074..000000000
--- a/testcases/kernel/syscalls/io_uring/io_uring02.c
+++ /dev/null
@@ -1,267 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2021 SUSE LLC
- * Author: Nicolai Stange <nstange@suse.de>
- * LTP port: Martin Doucha <mdoucha@suse.cz>
- *
- * CVE-2020-29373
- *
- * Check that io_uring does not bypass chroot. Fixed in:
- *
- * commit 9392a27d88b9707145d713654eb26f0c29789e50
- * Author: Jens Axboe <axboe@kernel.dk>
- * Date: Thu Feb 6 21:42:51 2020 -0700
- *
- * io-wq: add support for inheriting ->fs
- *
- * commit ff002b30181d30cdfbca316dadd099c3ca0d739c
- * Author: Jens Axboe <axboe@kernel.dk>
- * Date: Fri Feb 7 16:05:21 2020 -0700
- *
- * io_uring: grab ->fs as part of async preparation
- *
- * stable 5.4 specific backport:
- *
- * commit c4a23c852e80a3921f56c6fbc851a21c84a6d06b
- * Author: Nicolai Stange <nstange@suse.de>
- * Date: Wed Jan 27 14:34:43 2021 +0100
- */
-
-#include <stdio.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include "tst_test.h"
-#include "tst_safe_io_uring.h"
-
-#define CHROOT_DIR "test_root"
-#define SOCK_NAME "sock"
-#define SPAM_MARK 0xfa7
-#define BEEF_MARK 0xbeef
-
-static struct sockaddr_un addr;
-static int sendsock = -1, recvsock = -1, sockpair[2] = {-1, -1};
-static struct io_uring_params params;
-static struct tst_io_uring uring = { .fd = -1 };
-static char buf[16];
-static struct iovec iov = {
- .iov_base = buf,
- .iov_len = sizeof(buf)
-};
-
-static struct msghdr spam_header = {
- .msg_name = NULL,
- .msg_namelen = 0,
- .msg_iov = &iov,
- .msg_iovlen = 1
-};
-
-static struct msghdr beef_header = {
- .msg_name = &addr,
- .msg_namelen = sizeof(addr),
- .msg_iov = &iov,
- .msg_iovlen = 1
-};
-
-static void setup(void)
-{
- char *tmpdir = tst_get_tmpdir();
- int ret;
-
- addr.sun_family = AF_UNIX;
- ret = snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", tmpdir,
- SOCK_NAME);
- free(tmpdir);
-
- if (ret >= (int)sizeof(addr.sun_path))
- tst_brk(TBROK, "Tempdir path is too long");
-
- io_uring_setup_supported_by_kernel();
-
- sendsock = SAFE_SOCKET(AF_UNIX, SOCK_DGRAM, 0);
- recvsock = SAFE_SOCKET(AF_UNIX, SOCK_DGRAM, 0);
- SAFE_BIND(recvsock, (struct sockaddr *)&addr, sizeof(addr));
-
- SAFE_MKDIR(CHROOT_DIR, 0755);
- SAFE_CHROOT(CHROOT_DIR);
-}
-
-static void drain_fallback(void)
-{
- uint32_t i, count, tail;
- int beef_found = 0;
- struct io_uring_sqe *sqe_ptr = uring.sqr_entries;
- const struct io_uring_cqe *cqe_ptr;
-
- SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sockpair);
- SAFE_SETSOCKOPT_INT(sockpair[0], SOL_SOCKET, SO_SNDBUF,
- 32+sizeof(buf));
- SAFE_FCNTL(sockpair[0], F_SETFL, O_NONBLOCK);
-
- /* Add spam requests to force async processing of the real test */
- for (i = 0, tail = *uring.sqr_tail; i < 255; i++, tail++, sqe_ptr++) {
- memset(sqe_ptr, 0, sizeof(*sqe_ptr));
- sqe_ptr->opcode = IORING_OP_SENDMSG;
- sqe_ptr->flags = IOSQE_IO_DRAIN;
- sqe_ptr->fd = sockpair[0];
- sqe_ptr->addr = (__u64)&spam_header;
- sqe_ptr->user_data = SPAM_MARK;
- uring.sqr_array[tail & *uring.sqr_mask] = i;
- }
-
- /* Add the real test to queue */
- memset(sqe_ptr, 0, sizeof(*sqe_ptr));
- sqe_ptr->opcode = IORING_OP_SENDMSG;
- sqe_ptr->flags = IOSQE_IO_DRAIN;
- sqe_ptr->fd = sendsock;
- sqe_ptr->addr = (__u64)&beef_header;
- sqe_ptr->user_data = BEEF_MARK;
- uring.sqr_array[tail & *uring.sqr_mask] = i;
- count = ++i;
- tail++;
-
- __atomic_store(uring.sqr_tail, &tail, __ATOMIC_RELEASE);
- SAFE_IO_URING_ENTER(1, uring.fd, count, count, IORING_ENTER_GETEVENTS,
- NULL);
-
- /* Check test results */
- __atomic_load(uring.cqr_tail, &tail, __ATOMIC_ACQUIRE);
-
- for (i = *uring.cqr_head; i != tail; i++, count--) {
- cqe_ptr = uring.cqr_entries + (i & *uring.cqr_mask);
- TST_ERR = -cqe_ptr->res;
-
- if (cqe_ptr->user_data == SPAM_MARK) {
- if (cqe_ptr->res >= 0 || cqe_ptr->res == -EAGAIN)
- continue;
-
- tst_res(TFAIL | TTERRNO,
- "Spam request failed unexpectedly");
- continue;
- }
-
- if (cqe_ptr->user_data != BEEF_MARK) {
- tst_res(TFAIL, "Unexpected entry in completion queue");
- count++;
- continue;
- }
-
- beef_found = 1;
-
- if (cqe_ptr->res >= 0) {
- tst_res(TFAIL, "Write outside chroot succeeded.");
- } else if (cqe_ptr->res != -ENOENT) {
- tst_res(TFAIL | TTERRNO,
- "Write outside chroot failed unexpectedly");
- } else {
- tst_res(TPASS | TTERRNO,
- "Write outside chroot failed as expected");
- }
- }
-
- __atomic_store(uring.cqr_head, &i, __ATOMIC_RELEASE);
-
- if (!beef_found)
- tst_res(TFAIL, "Write outside chroot result not found");
-
- if (count)
- tst_res(TFAIL, "Wrong number of entries in completion queue");
-
- SAFE_CLOSE(sockpair[0]);
- SAFE_CLOSE(sockpair[1]);
-}
-
-static void check_result(void)
-{
- const struct io_uring_cqe *cqe_ptr;
-
- cqe_ptr = uring.cqr_entries + (*uring.cqr_head & *uring.cqr_mask);
- ++*uring.cqr_head;
- TST_ERR = -cqe_ptr->res;
-
- if (cqe_ptr->user_data != BEEF_MARK) {
- tst_res(TFAIL, "Unexpected entry in completion queue");
- return;
- }
-
- if (cqe_ptr->res == -EINVAL) {
- tst_res(TINFO, "IOSQE_ASYNC is not supported, using fallback");
- drain_fallback();
- return;
- }
-
- tst_res(TINFO, "IOSQE_ASYNC is supported");
-
- if (cqe_ptr->res >= 0) {
- tst_res(TFAIL, "Write outside chroot succeeded.");
- return;
- }
-
- if (cqe_ptr->res != -ENOENT) {
- tst_res(TFAIL | TTERRNO,
- "Write outside chroot failed unexpectedly");
- return;
- }
-
- tst_res(TPASS | TTERRNO, "Write outside chroot failed as expected");
-}
-
-static void run(void)
-{
- uint32_t tail;
- struct io_uring_sqe *sqe_ptr;
-
- SAFE_IO_URING_INIT(512, &params, &uring);
- sqe_ptr = uring.sqr_entries;
- tail = *uring.sqr_tail;
-
- memset(sqe_ptr, 0, sizeof(*sqe_ptr));
- sqe_ptr->opcode = IORING_OP_SENDMSG;
- sqe_ptr->flags = IOSQE_ASYNC;
- sqe_ptr->fd = sendsock;
- sqe_ptr->addr = (__u64)&beef_header;
- sqe_ptr->user_data = BEEF_MARK;
- uring.sqr_array[tail & *uring.sqr_mask] = 0;
- tail++;
-
- __atomic_store(uring.sqr_tail, &tail, __ATOMIC_RELEASE);
- SAFE_IO_URING_ENTER(1, uring.fd, 1, 1, IORING_ENTER_GETEVENTS, NULL);
- check_result();
- SAFE_IO_URING_CLOSE(&uring);
-}
-
-static void cleanup(void)
-{
- if (uring.fd >= 0)
- SAFE_IO_URING_CLOSE(&uring);
-
- if (sockpair[0] >= 0) {
- SAFE_CLOSE(sockpair[0]);
- SAFE_CLOSE(sockpair[1]);
- }
-
- if (recvsock >= 0)
- SAFE_CLOSE(recvsock);
-
- if (sendsock >= 0)
- SAFE_CLOSE(sendsock);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_REQ, CAP_SYS_CHROOT),
- {}
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "9392a27d88b9"},
- {"linux-git", "ff002b30181d"},
- {"linux-git", "d87683620489"},
- {"linux-stable-git", "c4a23c852e80"},
- {"linux-stable-git", "cac68d12c531"},
- {"CVE", "2020-29373"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/.gitignore b/testcases/kernel/syscalls/ioctl/.gitignore
index 5fff7a61d..2551ffb7f 100644
--- a/testcases/kernel/syscalls/ioctl/.gitignore
+++ b/testcases/kernel/syscalls/ioctl/.gitignore
@@ -6,14 +6,6 @@
/ioctl06
/ioctl07
/ioctl08
-/ioctl09
-/ioctl_loop01
-/ioctl_loop02
-/ioctl_loop03
-/ioctl_loop04
-/ioctl_loop05
-/ioctl_loop06
-/ioctl_loop07
/ioctl_ns01
/ioctl_ns02
/ioctl_ns03
@@ -21,4 +13,3 @@
/ioctl_ns05
/ioctl_ns06
/ioctl_ns07
-/ioctl_sg01
diff --git a/testcases/kernel/syscalls/ioctl/Makefile b/testcases/kernel/syscalls/ioctl/Makefile
index c2ff6c8e7..f7d6adbd7 100644
--- a/testcases/kernel/syscalls/ioctl/Makefile
+++ b/testcases/kernel/syscalls/ioctl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/ioctl/ioctl01.c b/testcases/kernel/syscalls/ioctl/ioctl01.c
index c8a1b9a10..7fb8d417e 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl01.c
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * Copyright (c) 2020 Petr Vorel <petr.vorel@gmail.com>
- * 07/2001 Ported by Wayne Boyer
- * 04/2002 Fixes by wjhuie
- *
+ * Copyright (c) International Business Machines Corp., 2001
+ * 07/2001 Ported by Wayne Boyer
+ * 04/2002 Fixes by wjhuie
+ */
+/*
+ * DESCRIPTION
* Testcase to check the errnos set by the ioctl(2) system call.
*
* ALGORITHM
@@ -13,14 +14,15 @@
* 3. EINVAL: Pass invalid cmd in ioctl(fd, cmd, arg)
* 4. ENOTTY: Pass an non-streams fd in ioctl(fd, cmd, arg)
* 5. EFAULT: Pass a NULL address for termio
+ *
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
+#include <termio.h>
#include <termios.h>
#include "tst_test.h"
-#include "lapi/ioctl.h"
#define INVAL_IOCTL 9999999
diff --git a/testcases/kernel/syscalls/ioctl/ioctl02.c b/testcases/kernel/syscalls/ioctl/ioctl02.c
index b4d4a3594..a4b468e43 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl02.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl02.c
@@ -1,6 +1,6 @@
/*
+ *
* Copyright (c) International Business Machines Corp., 2001
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,16 +57,17 @@
*/
#include <stdio.h>
+#include <termio.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <termios.h>
+#include <sys/ioctl.h>
+#include <sys/termios.h>
#include "test.h"
#include "safe_macros.h"
-#include "lapi/ioctl.h"
#define CNUL 0
diff --git a/testcases/kernel/syscalls/ioctl/ioctl04.c b/testcases/kernel/syscalls/ioctl/ioctl04.c
index d9ddb8e59..353114cc0 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl04.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl04.c
@@ -47,11 +47,11 @@ static void verify_ioctl(void)
}
if (TST_ERR == EACCES) {
- tst_res(TPASS | TTERRNO, "Mounting RO device RW failed");
+ tst_res(TPASS | TERRNO, "Mounting RO device RW failed");
goto next;
}
- tst_res(TFAIL | TTERRNO,
+ tst_res(TFAIL | TERRNO,
"Mounting RO device RW failed unexpectedly expected EACCES");
next:
diff --git a/testcases/kernel/syscalls/ioctl/ioctl07.c b/testcases/kernel/syscalls/ioctl/ioctl07.c
index 883a556c5..c1de7137c 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl07.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl07.c
@@ -17,6 +17,10 @@
static char *s_fuzz;
static int fuzz = 2;
+static struct tst_option options[] = {
+ {"f:", &s_fuzz, "-f c Fuzz factor for valid match (default 2)"},
+ {NULL, NULL, NULL}
+};
static int fd;
static void verify_ioctl(void)
@@ -49,9 +53,6 @@ static void cleanup(void)
static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"f:", &s_fuzz, "-f c Fuzz factor for valid match (default 2)"},
- {}
- },
+ .options = options,
.test_all = verify_ioctl,
};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl08.c b/testcases/kernel/syscalls/ioctl/ioctl08.c
index f7d11815d..dca898a65 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl08.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl08.c
@@ -112,6 +112,10 @@ static void setup(void)
sizeof(struct file_dedupe_range_info));
}
+static const char *const needed_drivers[] = {
+ "btrfs",
+ NULL,
+};
static struct tst_test test = {
.test = verify_ioctl,
@@ -123,10 +127,7 @@ static struct tst_test test = {
.mount_device = 1,
.mntpoint = MNTPOINT,
.dev_fs_type = "btrfs",
- .needs_drivers = (const char *const[]) {
- "btrfs",
- NULL,
- },
+ .needs_drivers = needed_drivers,
};
#else
TST_TEST_TCONF(
diff --git a/testcases/kernel/syscalls/ioctl/ioctl09.c b/testcases/kernel/syscalls/ioctl/ioctl09.c
deleted file mode 100644
index 9728ecb9c..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl09.c
+++ /dev/null
@@ -1,121 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * Basic test for the BLKRRPART ioctl, it is the same as blockdev
- * --rereadpt command.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/mount.h>
-#include <stdbool.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-#define RETVAL_CHECK(x) \
- ({ value ? TST_RETVAL_EQ0(x) : TST_RETVAL_NOTNULL(x); })
-
-static char dev_path[1024];
-static int dev_num, attach_flag, dev_fd;
-static char loop_partpath[1026], sys_loop_partpath[1026];
-
-static void change_partition(const char *const cmd[])
-{
- int ret;
-
- ret = tst_cmd(cmd, NULL, NULL, TST_CMD_PASS_RETVAL);
- if (ret)
- tst_brk(TBROK, "parted return %i", ret);
-}
-
-static void check_partition(int part_num, bool value)
-{
- int ret;
-
- sprintf(sys_loop_partpath, "/sys/block/loop%d/loop%dp%d",
- dev_num, dev_num, part_num);
- sprintf(loop_partpath, "%sp%d", dev_path, part_num);
-
- ret = TST_RETRY_FN_EXP_BACKOFF(access(sys_loop_partpath, F_OK), RETVAL_CHECK, 30);
- if (ret == 0)
- tst_res(value ? TPASS : TFAIL, "access %s succeeds",
- sys_loop_partpath);
- else
- tst_res(value ? TFAIL : TPASS, "access %s fails",
- sys_loop_partpath);
-
- ret = TST_RETRY_FN_EXP_BACKOFF(access(loop_partpath, F_OK), RETVAL_CHECK, 30);
- if (ret == 0)
- tst_res(value ? TPASS : TFAIL, "access %s succeeds",
- loop_partpath);
- else
- tst_res(value ? TFAIL : TPASS, "access %s fails",
- loop_partpath);
-}
-
-static void verify_ioctl(void)
-{
- const char *const cmd_parted_old[] = {"parted", "-s", "test.img",
- "mklabel", "msdos", "mkpart",
- "primary", "ext4", "1M", "10M",
- NULL};
- const char *const cmd_parted_new[] = {"parted", "-s", "test.img",
- "mklabel", "msdos", "mkpart",
- "primary", "ext4", "1M", "10M",
- "mkpart", "primary", "ext4",
- "10M", "20M", NULL};
- struct loop_info loopinfo = {0};
-
- change_partition(cmd_parted_old);
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
-
- loopinfo.lo_flags = LO_FLAGS_PARTSCAN;
- SAFE_IOCTL(dev_fd, LOOP_SET_STATUS, &loopinfo);
- check_partition(1, true);
- check_partition(2, false);
-
- change_partition(cmd_parted_new);
- TST_RETRY_FUNC(ioctl(dev_fd, BLKRRPART, 0), TST_RETVAL_EQ0);
- check_partition(1, true);
- check_partition(2, true);
-
- tst_detach_device_by_fd(dev_path, dev_fd);
- attach_flag = 0;
-}
-
-static void setup(void)
-{
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
- tst_prealloc_file("test.img", 1024 * 1024, 20);
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_ioctl,
- .needs_root = 1,
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- },
- .needs_cmds = (const char *const []) {
- "parted",
- NULL
- },
- .needs_tmpdir = 1,
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop01.c b/testcases/kernel/syscalls/ioctl/ioctl_loop01.c
deleted file mode 100644
index cf71184b4..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop01.c
+++ /dev/null
@@ -1,155 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic ioctl test about loopdevice.
- * It is designed to test LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN flag.
- *
- * For LO_FLAGS_AUTOCLEAR flag, we only check autoclear field value in sys
- * directory and also get lo_flags by using LOOP_GET_STATUS.
- *
- * For LO_FLAGS_PARTSCAN flag, it is the same as LO_FLAGS_AUTOCLEAR flag.
- * But we also check whether we can scan partition table correctly ie check
- * whether /dev/loopnp1 and /sys/bloclk/loop0/loop0p1 existed.
- *
- * For LO_FLAGS_AUTOCLEAR flag, it can be clear. For LO_FLAGS_PARTSCAN flag,
- * it cannot be clear. We also check this.
- *
- * It is also a regression test for kernel
- * commit 10c70d95c0f2 ("block: remove the bd_openers checks in blk_drop_partitions")
- * commit 6ac92fb5cdff ("loop: Fix wrong masking of status flags").
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-static char dev_path[1024], backing_path[1024], backing_file_path[1024];
-static int dev_num, attach_flag, dev_fd, parted_sup;
-
-/*
- * In drivers/block/loop.c code, set status function doesn't handle
- * LO_FLAGS_READ_ONLY flag and ingore it. Only loop_set_fd with read only mode
- * file_fd, lo_flags will include LO_FLAGS_READ_ONLY and it's the same for
- * LO_FLAGS_DIRECT_IO.
- */
-#define SET_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN | LO_FLAGS_READ_ONLY | LO_FLAGS_DIRECT_IO)
-#define GET_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN)
-
-static char partscan_path[1024], autoclear_path[1024];
-static char loop_partpath[1026], sys_loop_partpath[1026];
-
-static void check_loop_value(int set_flag, int get_flag, int autoclear_field)
-{
- struct loop_info loopinfo = {0}, loopinfoget = {0};
- int ret;
-
- loopinfo.lo_flags = set_flag;
- SAFE_IOCTL(dev_fd, LOOP_SET_STATUS, &loopinfo);
- SAFE_IOCTL(dev_fd, LOOP_GET_STATUS, &loopinfoget);
-
- if (loopinfoget.lo_flags & ~get_flag)
- tst_res(TFAIL, "expect %d but got %d", get_flag, loopinfoget.lo_flags);
- else
- tst_res(TPASS, "get expected lo_flag %d", loopinfoget.lo_flags);
-
- TST_ASSERT_INT(partscan_path, 1);
- TST_ASSERT_INT(autoclear_path, autoclear_field);
-
- if (!parted_sup) {
- tst_res(TINFO, "Current environment doesn't have parted disk, skip it");
- return;
- }
-
- ret = TST_RETRY_FN_EXP_BACKOFF(access(loop_partpath, F_OK), TST_RETVAL_EQ0, 30);
- if (ret == 0)
- tst_res(TPASS, "access %s succeeds", loop_partpath);
- else
- tst_res(TFAIL, "access %s fails", loop_partpath);
-
- ret = TST_RETRY_FN_EXP_BACKOFF(access(sys_loop_partpath, F_OK), TST_RETVAL_EQ0, 30);
- if (ret == 0)
- tst_res(TPASS, "access %s succeeds", sys_loop_partpath);
- else
- tst_res(TFAIL, "access %s fails", sys_loop_partpath);
-}
-
-static void verify_ioctl_loop(void)
-{
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
-
- TST_ASSERT_INT(partscan_path, 0);
- TST_ASSERT_INT(autoclear_path, 0);
- TST_ASSERT_STR(backing_path, backing_file_path);
-
- check_loop_value(SET_FLAGS, GET_FLAGS, 1);
-
- tst_res(TINFO, "Test flag can be clear");
- check_loop_value(0, LO_FLAGS_PARTSCAN, 0);
-
- tst_detach_device_by_fd(dev_path, dev_fd);
- attach_flag = 0;
-}
-
-static void setup(void)
-{
- int ret;
- const char *const cmd_parted[] = {"parted", "-s", "test.img", "mklabel", "msdos", "mkpart",
- "primary", "ext4", "1M", "10M", NULL};
-
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- tst_fill_file("test.img", 0, 1024 * 1024, 10);
-
- ret = tst_cmd(cmd_parted, NULL, NULL, TST_CMD_PASS_RETVAL);
- switch (ret) {
- case 0:
- parted_sup = 1;
- break;
- case 255:
- tst_res(TCONF, "parted binary not installed or failed");
- break;
- default:
- tst_res(TCONF, "parted exited with %i", ret);
- break;
- }
-
- sprintf(partscan_path, "/sys/block/loop%d/loop/partscan", dev_num);
- sprintf(autoclear_path, "/sys/block/loop%d/loop/autoclear", dev_num);
- sprintf(backing_path, "/sys/block/loop%d/loop/backing_file", dev_num);
- sprintf(sys_loop_partpath, "/sys/block/loop%d/loop%dp1", dev_num, dev_num);
- sprintf(backing_file_path, "%s/test.img", tst_get_tmpdir());
- sprintf(loop_partpath, "%sp1", dev_path);
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_ioctl_loop,
- .needs_root = 1,
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "10c70d95c0f2"},
- {"linux-git", "6ac92fb5cdff"},
- {}
- },
- .needs_tmpdir = 1,
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop02.c b/testcases/kernel/syscalls/ioctl/ioctl_loop02.c
deleted file mode 100644
index ac6184216..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop02.c
+++ /dev/null
@@ -1,164 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic ioctl test about loopdevice.
- *
- * It is designed to test LO_FLAGS_READ_ONLY (similar as losetup -r)
- * and LOOP_CHANGE_FD.
- *
- * For LOOP_CHANGE_FD, this operation is possible only if the loop device
- * is read-only and the new backing store is the same size and type as the
- * old backing store.
- *
- * If using LOOP_CONFIGURE ioctl, we can set LO_FLAGS_READ_ONLY
- * flag even though backing file with write mode.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-static int file_fd, file_change_fd, file_fd_invalid;
-static char backing_path[1024], backing_file_path[1024], backing_file_change_path[1024];
-static int attach_flag, dev_fd, loop_configure_sup = 1;
-static char loop_ro_path[1024], dev_path[1024];
-static struct loop_config loopconfig;
-
-static struct tcase {
- int mode;
- int ioctl;
- char *message;
-} tcases[] = {
- {O_RDONLY, LOOP_SET_FD, "Using LOOP_SET_FD to setup loopdevice"},
- {O_RDWR, LOOP_CONFIGURE, "Using LOOP_CONFIGURE with read_only flag"},
-};
-
-static void verify_ioctl_loop(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- struct loop_info loopinfoget;
-
- if (tc->ioctl == LOOP_CONFIGURE && !loop_configure_sup) {
- tst_res(TCONF, "LOOP_CONFIGURE ioctl not supported");
- return;
- }
-
- tst_res(TINFO, "%s", tc->message);
- file_fd = SAFE_OPEN("test.img", tc->mode);
-
- if (tc->ioctl == LOOP_SET_FD) {
- SAFE_IOCTL(dev_fd, LOOP_SET_FD, file_fd);
- } else {
- loopconfig.fd = file_fd;
- SAFE_IOCTL(dev_fd, LOOP_CONFIGURE, &loopconfig);
- }
- attach_flag = 1;
-
- TST_ASSERT_INT(loop_ro_path, 1);
- TST_ASSERT_STR(backing_path, backing_file_path);
-
- memset(&loopinfoget, 0, sizeof(loopinfoget));
-
- SAFE_IOCTL(dev_fd, LOOP_GET_STATUS, &loopinfoget);
-
- if (loopinfoget.lo_flags & ~LO_FLAGS_READ_ONLY)
- tst_res(TFAIL, "lo_flags has unexpected %d flag", loopinfoget.lo_flags);
- else
- tst_res(TPASS, "lo_flags only has default LO_FLAGS_READ_ONLY flag");
-
- TEST(write(dev_fd, "xx", 2));
- if (TST_RET != -1)
- tst_res(TFAIL, "write succeed unexpectedly");
- else
- tst_res(TPASS | TTERRNO, "Can not write data in RO mode");
-
- TEST(ioctl(dev_fd, LOOP_CHANGE_FD, file_change_fd));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "LOOP_CHANGE_FD failed");
- } else {
- tst_res(TPASS, "LOOP_CHANGE_FD succeeded");
- TST_ASSERT_INT(loop_ro_path, 1);
- TST_ASSERT_STR(backing_path, backing_file_change_path);
- }
-
- TEST(ioctl(dev_fd, LOOP_CHANGE_FD, file_fd_invalid));
- if (TST_RET) {
- if (TST_ERR == EINVAL)
- tst_res(TPASS | TTERRNO, "LOOP_CHANGE_FD failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "LOOP_CHANGE_FD failed expected EINVAL got");
- } else {
- tst_res(TFAIL, "LOOP_CHANGE_FD succeeded");
- }
-
- SAFE_CLOSE(file_fd);
- tst_detach_device_by_fd(dev_path, dev_fd);
- attach_flag = 0;
-}
-
-static void setup(void)
-{
- int dev_num;
- int ret;
-
- char *tmpdir = tst_get_tmpdir();
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- tst_fill_file("test.img", 0, 1024, 10);
- tst_fill_file("test1.img", 0, 1024, 10);
- tst_fill_file("test2.img", 0, 2048, 20);
-
- sprintf(backing_path, "/sys/block/loop%d/loop/backing_file", dev_num);
- sprintf(backing_file_path, "%s/test.img", tmpdir);
- sprintf(backing_file_change_path, "%s/test1.img", tmpdir);
- sprintf(loop_ro_path, "/sys/block/loop%d/ro", dev_num);
-
- free(tmpdir);
-
- file_change_fd = SAFE_OPEN("test1.img", O_RDWR);
- file_fd_invalid = SAFE_OPEN("test2.img", O_RDWR);
-
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
- loopconfig.fd = -1;
- ret = ioctl(dev_fd, LOOP_CONFIGURE, &loopconfig);
-
- if (ret && errno != EBADF) {
- tst_res(TINFO | TERRNO, "LOOP_CONFIGURE is not supported");
- loop_configure_sup = 0;
- }
- loopconfig.info.lo_flags = LO_FLAGS_READ_ONLY;
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (file_fd > 0)
- SAFE_CLOSE(file_fd);
- if (file_change_fd > 0)
- SAFE_CLOSE(file_change_fd);
- if (file_fd_invalid > 0)
- SAFE_CLOSE(file_fd_invalid);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_ioctl_loop,
- .needs_root = 1,
- .needs_tmpdir = 1,
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop03.c b/testcases/kernel/syscalls/ioctl/ioctl_loop03.c
deleted file mode 100644
index 9cf5a41fa..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop03.c
+++ /dev/null
@@ -1,75 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic ioctl test about loopdevice.
- *
- * It is designed to test LOOP_CHANGE_FD can not succeed (get EINVAL error)
- * when loop_dev is not read only.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-static char dev_path[1024];
-static int dev_num, dev_fd, file_fd, attach_flag;
-
-static void verify_ioctl_loop(void)
-{
- TEST(ioctl(dev_fd, LOOP_CHANGE_FD, file_fd));
- if (TST_RET == 0) {
- tst_res(TFAIL, "LOOP_CHANGE_FD succeeded unexpectedly");
- return;
- }
- if (TST_ERR == EINVAL)
- tst_res(TPASS | TTERRNO, "LOOP_CHANGE_FD failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "LOOP_CHANGE_FD failed expected EINVAL got");
-}
-
-static void setup(void)
-{
- struct loop_info loopinfoget;
-
- memset(&loopinfoget, 0, sizeof(loopinfoget));
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- tst_fill_file("test.img", 0, 1024, 10);
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
-
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
- file_fd = SAFE_OPEN("test.img", O_RDWR);
- SAFE_IOCTL(dev_fd, LOOP_GET_STATUS, &loopinfoget);
-
- if (loopinfoget.lo_flags & LO_FLAGS_READ_ONLY)
- tst_brk(TCONF, "Current environment has unexpected LO_FLAGS_READ_ONLY flag");
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (file_fd > 0)
- SAFE_CLOSE(file_fd);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_ioctl_loop,
- .needs_root = 1,
- .needs_tmpdir = 1,
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop04.c b/testcases/kernel/syscalls/ioctl/ioctl_loop04.c
deleted file mode 100644
index b4ab44a74..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop04.c
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic ioctl test about loopdevice.
- *
- * It is designed to test LOOP_SET_CAPACITY can update a live
- * loop device size when we change the size of the underlying
- * backing file. Also check sys value.
- */
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-#define OLD_SIZE 10240
-#define NEW_SIZE 5120
-
-static char dev_path[1024], sys_loop_sizepath[1024];
-static char *wrbuf;
-static int dev_num, dev_fd, file_fd, attach_flag;
-
-static void verify_ioctl_loop(void)
-{
- struct loop_info loopinfoget;
-
- memset(&loopinfoget, 0, sizeof(loopinfoget));
- tst_fill_file("test.img", 0, 1024, OLD_SIZE/1024);
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
-
- TST_ASSERT_INT(sys_loop_sizepath, OLD_SIZE/512);
- file_fd = SAFE_OPEN("test.img", O_RDWR);
- SAFE_IOCTL(dev_fd, LOOP_GET_STATUS, &loopinfoget);
-
- if (loopinfoget.lo_flags & LO_FLAGS_READ_ONLY)
- tst_brk(TCONF, "Current environment has unexpected LO_FLAGS_READ_ONLY flag");
-
- SAFE_TRUNCATE("test.img", NEW_SIZE);
- SAFE_IOCTL(dev_fd, LOOP_SET_CAPACITY);
-
- SAFE_LSEEK(dev_fd, 0, SEEK_SET);
-
- /*check that we can't write data beyond 5K into loop device*/
- TEST(write(dev_fd, wrbuf, OLD_SIZE));
- if (TST_RET == NEW_SIZE) {
- tst_res(TPASS, "LOOP_SET_CAPACITY set loop size to %d", NEW_SIZE);
- } else {
- tst_res(TFAIL, "LOOP_SET_CAPACITY didn't set loop size to %d, its size is %ld",
- NEW_SIZE, TST_RET);
- }
-
- TST_ASSERT_INT(sys_loop_sizepath, NEW_SIZE/512);
-
- SAFE_CLOSE(file_fd);
- tst_detach_device_by_fd(dev_path, dev_fd);
- unlink("test.img");
- attach_flag = 0;
-}
-
-static void setup(void)
-{
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- wrbuf = SAFE_MALLOC(OLD_SIZE);
- memset(wrbuf, 'x', OLD_SIZE);
- sprintf(sys_loop_sizepath, "/sys/block/loop%d/size", dev_num);
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (file_fd > 0)
- SAFE_CLOSE(file_fd);
- if (wrbuf)
- free(wrbuf);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_ioctl_loop,
- .needs_root = 1,
- .needs_tmpdir = 1,
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
deleted file mode 100644
index 58aa6f0d8..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
+++ /dev/null
@@ -1,157 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic ioctl test about loopdevice.
- *
- * It is designed to test LOOP_SET_DIRECT_IO can update a live
- * loop device dio mode. It needs the backing file also supports
- * dio mode and the lo_offset is aligned with the logical block size.
- *
- * The direct I/O error handling is a bit messy on Linux, some filesystems
- * return error when it coudln't be enabled, some silently fall back to regular
- * buffered I/O.
- *
- * The LOOP_SET_DIRECT_IO ioctl() may ignore all checks if it cannot get the
- * logical block size which is the case if the block device pointer in the
- * backing file inode is not set. In this case the direct I/O appears to be
- * enabled but falls back to buffered I/O later on. This is the case at least
- * for Btrfs. Because of that the test passes both with failure as well as
- * success with non-zero offset.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mount.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-#define DIO_MESSAGE "In dio mode"
-#define NON_DIO_MESSAGE "In non dio mode"
-
-static char dev_path[1024], sys_loop_diopath[1024], backing_file_path[1024];;
-static int dev_num, dev_fd, block_devfd, attach_flag, logical_block_size;
-
-static void check_dio_value(int flag)
-{
- struct loop_info loopinfoget;
-
- memset(&loopinfoget, 0, sizeof(loopinfoget));
-
- SAFE_IOCTL(dev_fd, LOOP_GET_STATUS, &loopinfoget);
- tst_res(TINFO, "%s", flag ? DIO_MESSAGE : NON_DIO_MESSAGE);
-
- if (loopinfoget.lo_flags & LO_FLAGS_DIRECT_IO)
- tst_res(flag ? TPASS : TFAIL, "lo_flags has LO_FLAGS_DIRECT_IO flag");
- else
- tst_res(flag ? TFAIL : TPASS, "lo_flags doesn't have LO_FLAGS_DIRECT_IO flag");
-
- TST_ASSERT_INT(sys_loop_diopath, flag);
-}
-
-static void verify_ioctl_loop(void)
-{
- struct loop_info loopinfo;
-
- memset(&loopinfo, 0, sizeof(loopinfo));
- TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo), TST_RETVAL_EQ0);
-
- tst_res(TINFO, "Without setting lo_offset or sizelimit");
- SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 1);
- check_dio_value(1);
-
- SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 0);
- check_dio_value(0);
-
- tst_res(TINFO, "With offset equal to logical_block_size");
- loopinfo.lo_offset = logical_block_size;
- TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo), TST_RETVAL_EQ0);
- TEST(ioctl(dev_fd, LOOP_SET_DIRECT_IO, 1));
- if (TST_RET == 0) {
- tst_res(TPASS, "LOOP_SET_DIRECT_IO succeeded");
- check_dio_value(1);
- SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 0);
- } else {
- tst_res(TFAIL | TTERRNO, "LOOP_SET_DIRECT_IO failed");
- }
-
- tst_res(TINFO, "With nonzero offset less than logical_block_size");
- loopinfo.lo_offset = logical_block_size / 2;
- TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo), TST_RETVAL_EQ0);
-
- TEST(ioctl(dev_fd, LOOP_SET_DIRECT_IO, 1));
- if (TST_RET == 0) {
- tst_res(TPASS, "LOOP_SET_DIRECT_IO succeeded, offset is ignored");
- SAFE_IOCTL(dev_fd, LOOP_SET_DIRECT_IO, 0);
- return;
- }
- if (TST_ERR == EINVAL)
- tst_res(TPASS | TTERRNO, "LOOP_SET_DIRECT_IO failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "LOOP_SET_DIRECT_IO failed expected EINVAL got");
-}
-
-static void setup(void)
-{
- char bd_path[100];
-
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- sprintf(sys_loop_diopath, "/sys/block/loop%d/loop/dio", dev_num);
- tst_fill_file("test.img", 0, 1024, 1024);
-
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-
- if (ioctl(dev_fd, LOOP_SET_DIRECT_IO, 0) && errno == EINVAL)
- tst_brk(TCONF, "LOOP_SET_DIRECT_IO is not supported");
-
- /*
- * from __loop_update_dio():
- * We support direct I/O only if lo_offset is aligned with the
- * logical I/O size of backing device, and the logical block
- * size of loop is bigger than the backing device's and the loop
- * needn't transform transfer.
- */
- sprintf(backing_file_path, "%s/test.img", tst_get_tmpdir());
- tst_find_backing_dev(backing_file_path, bd_path);
- block_devfd = SAFE_OPEN(bd_path, O_RDWR);
- SAFE_IOCTL(block_devfd, BLKSSZGET, &logical_block_size);
- tst_res(TINFO, "backing dev(%s) logical_block_size is %d", bd_path, logical_block_size);
- SAFE_CLOSE(block_devfd);
- if (logical_block_size > 512)
- TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_BLOCK_SIZE, logical_block_size), TST_RETVAL_EQ0);
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (block_devfd > 0)
- SAFE_CLOSE(block_devfd);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_ioctl_loop,
- .needs_root = 1,
- .needs_tmpdir = 1,
- .skip_filesystems = (const char *const []) {
- "tmpfs",
- "overlayfs",
- NULL
- },
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
deleted file mode 100644
index bd0d289ca..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
+++ /dev/null
@@ -1,143 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic error test about the invalid block size of loopdevice
- * by using LOOP_SET_BLOCK_SIZE or LOOP_CONFIGURE ioctl.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-static char dev_path[1024];
-static int dev_num, dev_fd, file_fd, attach_flag, loop_configure_sup = 1;
-static unsigned int invalid_value, half_value, unalign_value;
-static struct loop_config loopconfig;
-
-static struct tcase {
- unsigned int *setvalue;
- int ioctl_flag;
- char *message;
-} tcases[] = {
- {&half_value, LOOP_SET_BLOCK_SIZE,
- "Using LOOP_SET_BLOCK_SIZE with arg < 512"},
-
- {&invalid_value, LOOP_SET_BLOCK_SIZE,
- "Using LOOP_SET_BLOCK_SIZE with arg > PAGE_SIZE"},
-
- {&unalign_value, LOOP_SET_BLOCK_SIZE,
- "Using LOOP_SET_BLOCK_SIZE with arg != power_of_2"},
-
- {&half_value, LOOP_CONFIGURE,
- "Using LOOP_CONFIGURE with block_size < 512"},
-
- {&invalid_value, LOOP_CONFIGURE,
- "Using LOOP_CONFIGURE with block_size > PAGE_SIZE"},
-
- {&unalign_value, LOOP_CONFIGURE,
- "Using LOOP_CONFIGURE with block_size != power_of_2"},
-};
-
-static void verify_ioctl_loop(unsigned int n)
-{
- if (tcases[n].ioctl_flag == LOOP_CONFIGURE)
- TEST(ioctl(dev_fd, LOOP_CONFIGURE, &loopconfig));
- else
- TEST(ioctl(dev_fd, LOOP_SET_BLOCK_SIZE, *(tcases[n].setvalue)));
-
- if (TST_RET == 0) {
- tst_res(TFAIL, "Set block size succeed unexpectedly");
- if (tcases[n].ioctl_flag == LOOP_CONFIGURE)
- tst_detach_device_by_fd(dev_path, dev_fd);
- return;
- }
- if (TST_ERR == EINVAL)
- tst_res(TPASS | TTERRNO, "Set block size failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "Set block size failed expected EINVAL got");
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- tst_res(TINFO, "%s", tc->message);
- if (tc->ioctl_flag == LOOP_SET_BLOCK_SIZE) {
- if (!attach_flag) {
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
- }
- verify_ioctl_loop(n);
- return;
- }
-
- if (tc->ioctl_flag == LOOP_CONFIGURE && !loop_configure_sup) {
- tst_res(TCONF, "LOOP_CONFIGURE ioctl not supported");
- return;
- }
- if (attach_flag) {
- tst_detach_device_by_fd(dev_path, dev_fd);
- attach_flag = 0;
- }
- loopconfig.block_size = *(tc->setvalue);
- verify_ioctl_loop(n);
-}
-
-static void setup(void)
-{
- unsigned int pg_size;
- int ret;
-
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- tst_fill_file("test.img", 0, 1024, 1024);
- half_value = 256;
- pg_size = getpagesize();
- invalid_value = pg_size * 2 ;
- unalign_value = pg_size - 1;
-
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-
- if (ioctl(dev_fd, LOOP_SET_BLOCK_SIZE, 512) && errno == EINVAL)
- tst_brk(TCONF, "LOOP_SET_BLOCK_SIZE is not supported");
-
- file_fd = SAFE_OPEN("test.img", O_RDWR);
- loopconfig.fd = -1;
- ret = ioctl(dev_fd, LOOP_CONFIGURE, &loopconfig);
- if (ret && errno != EBADF) {
- tst_res(TINFO | TERRNO, "LOOP_CONFIGURE is not supported");
- loop_configure_sup = 0;
- return;
- }
- loopconfig.fd = file_fd;
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (file_fd > 0)
- SAFE_CLOSE(file_fd);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
- .needs_root = 1,
- .needs_tmpdir = 1,
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop07.c b/testcases/kernel/syscalls/ioctl/ioctl_loop07.c
deleted file mode 100644
index efe48962e..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop07.c
+++ /dev/null
@@ -1,165 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * This is a basic ioctl test about loopdevice LOOP_SET_STATUS64
- * and LOOP_GET_STATUS64.
- * Test its lo_sizelimit field. If lo_sizelimit is 0,it means max
- * available. If sizelimit is less than loop_size, loopsize will
- * be truncated.
- *
- * We also use LOOP_CONFIGURE ioctl to test lo_sizelimit field. It is
- * also a regression test for
- * commit 79e5dc59e297 ("loop: Set correct device size when using LOOP_CONFIGURE").
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include "lapi/loop.h"
-#include "tst_test.h"
-
-static char dev_path[1024], sys_loop_sizepath[1024], sys_loop_sizelimitpath[1024];
-static int dev_num, dev_fd, file_fd, attach_flag, loop_configure_sup = 1;
-static struct loop_config loopconfig;
-
-static struct tcase {
- unsigned int set_sizelimit;
- unsigned int exp_loopsize;
- int ioctl_flag;
- char *message;
-} tcases[] = {
- {1024 * 4096, 2048, LOOP_SET_STATUS64,
- "When sizelimit is greater than loopsize by using LOOP_SET_STATUS64"},
-
- {1024 * 512, 1024, LOOP_SET_STATUS64,
- "When sizelimit is less than loopsize by using LOOP_SET_STATUS64"},
-
- {1024 * 4096, 2048, LOOP_CONFIGURE,
- "When sizelimit is greater than loopsize by using LOOP_CONFIGURE"},
-
- {1024 * 512, 1024, LOOP_CONFIGURE,
- "When sizelimit is less than loopsize by using LOOP_CONFIGURE"},
-};
-
-static void verify_ioctl_loop(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- struct loop_info64 loopinfo, loopinfoget;
-
- memset(&loopinfo, 0, sizeof(loopinfo));
- memset(&loopinfoget, 0, sizeof(loopinfoget));
-
- if (tc->ioctl_flag == LOOP_CONFIGURE) {
- SAFE_IOCTL(dev_fd, LOOP_CONFIGURE, &loopconfig);
- } else {
- loopinfo.lo_sizelimit = tc->set_sizelimit;
- TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS64, &loopinfo), TST_RETVAL_EQ0);
- }
-
- TST_ASSERT_INT(sys_loop_sizepath, tc->exp_loopsize);
- TST_ASSERT_INT(sys_loop_sizelimitpath, tc->set_sizelimit);
- SAFE_IOCTL(dev_fd, LOOP_GET_STATUS64, &loopinfoget);
- if (loopinfoget.lo_sizelimit == tc->set_sizelimit)
- tst_res(TPASS, "LOOP_GET_STATUS64 gets correct lo_sizelimit(%d)", tc->set_sizelimit);
- else
- tst_res(TFAIL, "LOOP_GET_STATUS64 gets wrong lo_sizelimit(%llu), expect %d",
- loopinfoget.lo_sizelimit, tc->set_sizelimit);
- /*Reset*/
- if (tc->ioctl_flag == LOOP_CONFIGURE) {
- tst_detach_device_by_fd(dev_path, dev_fd);
- } else {
- loopinfo.lo_sizelimit = 0;
- TST_RETRY_FUNC(ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo), TST_RETVAL_EQ0);
- }
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- tst_res(TINFO, "%s", tc->message);
-
- if (tc->ioctl_flag == LOOP_SET_STATUS64) {
- if (!attach_flag) {
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
- }
-
- verify_ioctl_loop(n);
- return;
- }
-
- if (tc->ioctl_flag == LOOP_CONFIGURE && !loop_configure_sup) {
- tst_res(TCONF, "LOOP_CONFIGURE ioctl not supported");
- return;
- }
- if (attach_flag) {
- tst_detach_device_by_fd(dev_path, dev_fd);
- attach_flag = 0;
- }
- loopconfig.info.lo_sizelimit = tc->set_sizelimit;
- verify_ioctl_loop(n);
-}
-
-static void setup(void)
-{
- int ret;
-
- dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
- if (dev_num < 0)
- tst_brk(TBROK, "Failed to find free loop device");
-
- tst_fill_file("test.img", 0, 1024 * 1024, 1);
- tst_attach_device(dev_path, "test.img");
- attach_flag = 1;
-
- sprintf(sys_loop_sizepath, "/sys/block/loop%d/size", dev_num);
- sprintf(sys_loop_sizelimitpath, "/sys/block/loop%d/loop/sizelimit", dev_num);
-
- tst_detach_device(dev_path);
- attach_flag = 0;
-
- tst_res(TINFO, "original loop size 2048 sectors");
- file_fd = SAFE_OPEN("test.img", O_RDWR);
- dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-
- loopconfig.fd = -1;
- ret = ioctl(dev_fd, LOOP_CONFIGURE, &loopconfig);
- if (ret && errno != EBADF) {
- tst_res(TINFO | TERRNO, "LOOP_CONFIGURE is not supported");
- loop_configure_sup = 0;
- return;
- }
-
- loopconfig.fd = file_fd;
-}
-
-static void cleanup(void)
-{
- if (dev_fd > 0)
- SAFE_CLOSE(dev_fd);
- if (file_fd > 0)
- SAFE_CLOSE(file_fd);
- if (attach_flag)
- tst_detach_device(dev_path);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
- .needs_root = 1,
- .needs_tmpdir = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "79e5dc59e297"},
- {}
- },
- .needs_drivers = (const char *const []) {
- "loop",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_sg01.c b/testcases/kernel/syscalls/ioctl/ioctl_sg01.c
deleted file mode 100644
index 94b30dc6b..000000000
--- a/testcases/kernel/syscalls/ioctl/ioctl_sg01.c
+++ /dev/null
@@ -1,134 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2018-1000204
- *
- * Test ioctl(SG_IO) and check that kernel doesn't leak data. Requires
- * a read-accessible generic SCSI device (e.g. a DVD drive).
- *
- * Leak fixed in:
- *
- * commit a45b599ad808c3c982fdcdc12b0b8611c2f92824
- * Author: Alexander Potapenko <glider@google.com>
- * Date: Fri May 18 16:23:18 2018 +0200
- *
- * scsi: sg: allocate with __GFP_ZERO in sg_build_indirect()
- */
-
-#include <sys/types.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <scsi/sg.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include "tst_test.h"
-#include "tst_memutils.h"
-
-#define BUF_SIZE (128 * 4096)
-#define CMD_SIZE 6
-
-static int devfd = -1;
-static char buffer[BUF_SIZE];
-static unsigned char command[CMD_SIZE];
-static struct sg_io_hdr query;
-
-/* TODO: split this off to a separate SCSI library? */
-static const char *find_generic_scsi_device(int access_flags)
-{
- DIR *devdir;
- struct dirent *ent;
- int tmpfd;
- static char devpath[PATH_MAX];
-
- errno = 0;
- devdir = opendir("/dev");
-
- if (!devdir)
- return NULL;
-
- while ((ent = SAFE_READDIR(devdir))) {
- /* The bug is most likely reproducible only on /dev/sg* */
- if (strncmp(ent->d_name, "sg", 2) || !isdigit(ent->d_name[2]))
- continue;
-
- snprintf(devpath, PATH_MAX, "/dev/%s", ent->d_name);
- /* access() makes incorrect assumptions about block devices */
- tmpfd = open(devpath, access_flags);
-
- if (tmpfd >= 0) {
- SAFE_CLOSE(tmpfd);
- SAFE_CLOSEDIR(devdir);
- return devpath;
- }
- }
-
- SAFE_CLOSEDIR(devdir);
- return NULL;
-}
-
-static void setup(void)
-{
- const char *devpath = find_generic_scsi_device(O_RDONLY);
-
- if (!devpath)
- tst_brk(TCONF, "Could not find any usable SCSI device");
-
- tst_res(TINFO, "Found SCSI device %s", devpath);
-
- /* Pollute some memory to avoid false negatives */
- tst_pollute_memory(0, 0x42);
-
- devfd = SAFE_OPEN(devpath, O_RDONLY);
- query.interface_id = 'S';
- query.dxfer_direction = SG_DXFER_FROM_DEV;
- query.cmd_len = CMD_SIZE;
- query.dxfer_len = BUF_SIZE;
- query.dxferp = buffer;
- query.cmdp = command;
-}
-
-static void cleanup(void)
-{
- if (devfd >= 0)
- SAFE_CLOSE(devfd);
-}
-
-static void run(void)
-{
- size_t i, j;
-
- memset(buffer, 0, BUF_SIZE);
-
- for (i = 0; i < 100; i++) {
- TEST(ioctl(devfd, SG_IO, &query));
-
- if (TST_RET != 0 && TST_RET != -1)
- tst_brk(TBROK|TTERRNO, "Invalid ioctl() return value");
-
- /* Check the buffer even if ioctl() failed, just in case. */
- for (j = 0; j < BUF_SIZE; j++) {
- if (buffer[j]) {
- tst_res(TFAIL, "Kernel memory leaked");
- return;
- }
- }
- }
-
- tst_res(TPASS, "Output buffer is empty, no data leaked");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "a45b599ad808"},
- {"CVE", "2018-1000204"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/ioperm/Makefile b/testcases/kernel/syscalls/ioperm/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/ioperm/Makefile
+++ b/testcases/kernel/syscalls/ioperm/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/ioperm/ioperm01.c b/testcases/kernel/syscalls/ioperm/ioperm01.c
index 6c50a0b75..e8bd18dd7 100644
--- a/testcases/kernel/syscalls/ioperm/ioperm01.c
+++ b/testcases/kernel/syscalls/ioperm/ioperm01.c
@@ -1,50 +1,132 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2020
- * Copyright (c) Wipro Technologies Ltd, 2002
- */
-
-/*
- * This is a basic test for ioperm(2) system call.
- * It is intended to provide a limited exposure of the system call.
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Author: Subhab Biswas <subhabrata.biswas@wipro.com>
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : ioperm01
+ *
+ * EXECUTED BY : superuser
+ *
+ * TEST TITLE : Basic test for ioperm(2)
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : Subhab Biswas <subhabrata.biswas@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a Phase I test for the ioperm(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Test caller is superuser
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Issue FAIL message with errno.
+ * Otherwise, Issue PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * ioperm01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
-#include <errno.h>
-#include <unistd.h>
-
-#include "tst_test.h"
+char *TCID = "ioperm01";
#if defined __i386__ || defined(__x86_64__)
+
+#include <errno.h>
+#include <unistd.h>
#include <sys/io.h>
-unsigned long io_addr;
-#define NUM_BYTES 3
+#include "test.h"
+
+unsigned long io_addr; /*kernel version dependant io start address */
+#define NUM_BYTES 3 /* number of bytes from start address */
+#define TURN_ON 1
+#define TURN_OFF 0
#ifndef IO_BITMAP_BITS
#define IO_BITMAP_BITS 1024
#endif
-static void verify_ioperm(void)
+static void setup();
+static void cleanup();
+
+int TST_TOTAL = 1;
+
+int main(int ac, char **av)
{
- TEST(ioperm(io_addr, NUM_BYTES, 1));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "ioperm() failed for port address "
- "%lu, errno=%d : %s", io_addr,
- TST_ERR, tst_strerrno(TST_ERR));
- } else {
- tst_res(TPASS, "ioperm() passed for port "
- "address %lu, returned %lu",
- io_addr, TST_RET);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ /*
+ * Test the system call.
+ */
+ TEST(ioperm(io_addr, NUM_BYTES, TURN_ON));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "ioperm() failed for port address "
+ "%lu, errno=%d : %s", io_addr,
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TPASS, "ioperm() passed for port "
+ "address %lu, returned %lu",
+ io_addr, TEST_RETURN);
+ }
}
+
+ /* cleanup and exit */
+ cleanup();
+ tst_exit();
+
}
-static void setup(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- /* ioperm() is restricted under kernel lockdown. */
- if (tst_lockdown_enabled())
- tst_brk(TCONF, "Kernel is locked down, skip this test");
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
/*
* The value of IO_BITMAP_BITS (include/asm-i386/processor.h) changed
@@ -52,28 +134,45 @@ static void setup(void)
*
* Ricky Ng-Adam, rngadam@yahoo.com
* */
- if (tst_kvercmp(2, 6, 8) < 0)
+ if (tst_kvercmp(2, 6, 8) < 0) {
+ /*get ioperm on 1021, 1022, 1023 */
io_addr = IO_BITMAP_BITS - NUM_BYTES;
- else
+ } else {
+ /*get ioperm on 65533, 65534, 65535 */
io_addr = IO_BITMAP_BITS - NUM_BYTES;
+ }
+
+ TEST_PAUSE;
+
}
-static void cleanup(void)
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
{
+
/*
* Reset I/O privileges for the specified port.
*/
- if ((ioperm(io_addr, NUM_BYTES, 0)) == -1)
- tst_brk(TBROK | TERRNO, "ioperm() cleanup failed");
+ if ((ioperm(io_addr, NUM_BYTES, TURN_OFF)) == -1) {
+ tst_brkm(TBROK, NULL, "ioperm() cleanup failed");
+ }
+
}
-static struct tst_test test = {
- .test_all = verify_ioperm,
- .needs_root = 1,
- .setup = setup,
- .cleanup = cleanup,
-};
+#else /* __i386__ */
+
+#include "test.h"
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS,
+ "LSB v1.3 does not specify ioperm() for this architecture.");
+ tst_exit();
+}
-#else
-TST_TEST_TCONF("LSB v1.3 does not specify ioperm() for this architecture. (only for i386 or x86_64)");
-#endif /* __i386_, __x86_64__*/
+#endif /* __i386__ */
diff --git a/testcases/kernel/syscalls/ioperm/ioperm02.c b/testcases/kernel/syscalls/ioperm/ioperm02.c
index 80dcb992e..3d9b1445f 100644
--- a/testcases/kernel/syscalls/ioperm/ioperm02.c
+++ b/testcases/kernel/syscalls/ioperm/ioperm02.c
@@ -1,101 +1,250 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2020
- * Copyright (c) Wipro Technologies Ltd, 2002
- */
-
-/*
- * This is an error test for ioperm(2) system call.
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * Verify that
- * 1) ioperm(2) returns -1 and sets errno to EINVAL for I/O port
- * address greater than 0x3ff.
- * 2) ioperm(2) returns -1 and sets errno to EPERM if the current
- * user is not the super-user.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Author: Subhab Biswas <subhabrata.biswas@wipro.com>
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : ioperm02
+ *
+ * EXECUTED BY : superuser
+ *
+ * TEST TITLE : Tests for error conditions
+ *
+ * TEST CASE TOTAL : 2
+ *
+ * AUTHOR : Subhab Biwas <subhabrata.biswas@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verify that
+ * 1) ioperm(2) returns -1 and sets errno to EINVAL for I/O port
+ * address greater than 0x3ff.
+ * 2) ioperm(2) returns -1 and sets errno to EPERM if the current
+ * user is not the super-user.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Set expected errnos for logging
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code and error number, if matching,
+ * Issue PASS message
+ * Otherwise,
+ * Issue FAIL message
+ * Perform testcase specific cleanup (if needed)
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * ioperm02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_macros.h"
+char *TCID = "ioperm02";
#if defined __i386__ || defined(__x86_64__)
+
+#include <errno.h>
+#include <unistd.h>
#include <sys/io.h>
+#include <pwd.h>
+#include "test.h"
+#include "safe_macros.h"
#define NUM_BYTES 3
+#define TURN_ON 1
+#define TURN_OFF 0
+#define EXP_RET_VAL -1
#ifndef IO_BITMAP_BITS
#define IO_BITMAP_BITS 1024 /* set to default value since some H/W may not support 0x10000 even with a 2.6.8 kernel */
#define IO_BITMAP_BITS_16 65536
#endif
-static struct tcase_t {
- long from;
- long num;
+static void setup();
+static int setup1(void);
+static void cleanup1();
+static void cleanup();
+
+static char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
+
+struct test_cases_t {
+ long from; /* starting port address */
+ long num; /* no. of bytes from starting address */
int turn_on;
- char *desc;
- int exp_errno;
-} tcases[] = {
- {0, NUM_BYTES, 1, "Invalid I/O address", EINVAL},
- {0, NUM_BYTES, 1, "Non super-user", EPERM},
+ char *desc; /* test case description */
+ int exp_errno; /* expected error number */
};
-static void setup(void)
+int TST_TOTAL = 2;
+struct test_cases_t *test_cases;
+
+int main(int ac, char **av)
{
- /* ioperm() is restricted under kernel lockdown. */
- if (tst_lockdown_enabled())
- tst_brk(TCONF, "Kernel is locked down, skip this test");
+ int lc, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; ++i) {
+
+ if (i == 1) {
+ /* setup Non super-user for second test */
+ if (setup1()) {
+ /* setup1() failed, skip this test */
+ continue;
+ }
+ }
+
+ /* Test the system call */
+
+ TEST(ioperm(test_cases[i].from,
+ test_cases[i].num, test_cases[i].turn_on));
+
+ if ((TEST_RETURN == EXP_RET_VAL) &&
+ (TEST_ERRNO == test_cases[i].exp_errno)) {
+ tst_resm(TPASS, "Expected failure for %s, "
+ "errno: %d", test_cases[i].desc,
+ TEST_ERRNO);
+ } else {
+ tst_resm(TFAIL, "Unexpected results for %s ; "
+ "returned %ld (expected %d), errno %d "
+ "(expected errno %d)",
+ test_cases[i].desc,
+ TEST_RETURN, EXP_RET_VAL,
+ TEST_ERRNO, test_cases[i].exp_errno);
+ }
+
+ if (i == 1) {
+ /* revert back to super user */
+ cleanup1();
+ } else {
+ }
+ }
+
+ }
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
+
+}
+
+/* setup1() - set up non-super user for second test case */
+int setup1(void)
+{
+ /* switch to "nobody" user */
+ if (seteuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TWARN, "Failed to set effective"
+ "uid to %d", ltpuser->pw_uid);
+ return 1;
+ }
+ return 0;
+}
+
+/* cleanup1() - reset to super user for second test case */
+void cleanup1(void)
+{
+ /* reset user as root */
+ SAFE_SETEUID(NULL, 0);
+}
+
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ /* Check if "nobody" user id exists */
+ if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
+ tst_brkm(TBROK, NULL, "\"nobody\" user id doesn't exist");
+ }
/*
* The value of IO_BITMAP_BITS (include/asm-i386/processor.h) changed
* from kernel 2.6.8 to permit 16-bits (65536) ioperm
*
* Ricky Ng-Adam, rngadam@yahoo.com
- */
+ * */
+ test_cases = malloc(sizeof(struct test_cases_t) * 2);
+ test_cases[0].num = NUM_BYTES;
+ test_cases[0].turn_on = TURN_ON;
+ test_cases[0].desc = "Invalid I/O address";
+ test_cases[0].exp_errno = EINVAL;
+ test_cases[1].num = NUM_BYTES;
+ test_cases[1].turn_on = TURN_ON;
+ test_cases[1].desc = "Non super-user";
+ test_cases[1].exp_errno = EPERM;
if ((tst_kvercmp(2, 6, 8) < 0) || (tst_kvercmp(2, 6, 9) == 0)) {
- tcases[0].from = (IO_BITMAP_BITS - NUM_BYTES) + 1;
- tcases[1].from = IO_BITMAP_BITS - NUM_BYTES;
+ /*try invalid ioperm on 1022, 1023, 1024 */
+ test_cases[0].from = (IO_BITMAP_BITS - NUM_BYTES) + 1;
+
+ /*try get valid ioperm on 1021, 1022, 1023 */
+ test_cases[1].from = IO_BITMAP_BITS - NUM_BYTES;
} else {
- tcases[0].from = (IO_BITMAP_BITS_16 - NUM_BYTES) + 1;
- tcases[1].from = IO_BITMAP_BITS_16 - NUM_BYTES;
+ /*try invalid ioperm on 65534, 65535, 65536 */
+ test_cases[0].from = (IO_BITMAP_BITS_16 - NUM_BYTES) + 1;
+
+ /*try valid ioperm on 65533, 65534, 65535 */
+ test_cases[1].from = IO_BITMAP_BITS_16 - NUM_BYTES;
}
- struct passwd *pw;
- pw = SAFE_GETPWNAM("nobody");
- SAFE_SETEUID(pw->pw_uid);
-}
+ TEST_PAUSE;
-static void cleanup(void)
-{
- SAFE_SETEUID(0);
}
-static void verify_ioperm(unsigned int i)
+void cleanup(void)
{
- TEST(ioperm(tcases[i].from, tcases[i].num, tcases[i].turn_on));
- if ((TST_RET == -1) && (TST_ERR == tcases[i].exp_errno)) {
- tst_res(TPASS | TTERRNO, "Expected failure for %s, "
- "errno: %d", tcases[i].desc, TST_ERR);
- } else {
- tst_res(TFAIL | TTERRNO, "Unexpected results for %s ; "
- "returned %ld (expected -1), errno %d "
- "(expected errno %d)", tcases[i].desc,
- TST_RET, TST_ERR, tcases[i].exp_errno);
- }
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_ioperm,
- .needs_root = 1,
- .setup = setup,
- .cleanup = cleanup,
-};
+#else /* __i386__ */
+
+#include "test.h"
+#include "safe_macros.h"
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS,
+ "LSB v1.3 does not specify ioperm() for this architecture.");
+ tst_exit();
+}
-#else
-TST_TEST_TCONF("LSB v1.3 does not specify ioperm() for this architecture. (only for i386 or x86_64)");
-#endif /* __i386_, __x86_64__*/
+#endif /* __i386__ */
diff --git a/testcases/kernel/syscalls/iopl/Makefile b/testcases/kernel/syscalls/iopl/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/iopl/Makefile
+++ b/testcases/kernel/syscalls/iopl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/iopl/iopl01.c b/testcases/kernel/syscalls/iopl/iopl01.c
index dcf2cc406..0b1952668 100644
--- a/testcases/kernel/syscalls/iopl/iopl01.c
+++ b/testcases/kernel/syscalls/iopl/iopl01.c
@@ -1,70 +1,162 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2020
- * Copyright (c) Wipro Technologies Ltd, 2002
- */
-
-/*
- * This is a basic test for iopl(2) system call.
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
*
- * Test the system call for possible privelege levels.
- * As the privelge level for a normal process is 0, start by
- * setting/changing the level to 0.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Author: Subhab Biswas <subhabrata.biswas@wipro.com>
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : iopl01
+ *
+ * EXECUTED BY : superuser
+ *
+ * TEST TITLE : Basic test for iopl(2)
+ *
+ * TEST CASE TOTAL : 4
+ *
+ * AUTHOR : Subhab Biswas <subhabrata.biswas@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a Phase I test for the iopl(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Test caller is superuser
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Issue FAIL message with errno.
+ * Otherwise, Issue PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * iopl01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
+
+char *TCID = "iopl01";
+
+#if defined __i386__ || defined(__x86_64__)
#include <errno.h>
#include <unistd.h>
+#include <sys/io.h>
-#include "tst_test.h"
+#include "test.h"
-#if defined __i386__ || defined(__x86_64__)
-#include <sys/io.h>
+static void setup();
+static void cleanup();
-static void verify_iopl(void)
+int TST_TOTAL = 4;
+
+int level; /* I/O privilege level of the process */
+
+int main(int ac, char **av)
{
- int total_level = 4;
- int level;
- for (level = 0; level < total_level; ++level) {
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
- TEST(iopl(level));
+ /*
+ * Test the system call for possible privelege levels.
+ * As the privelge level for a normal process is 0,
+ * start by setting/changing the level to 0.
+ */
+ for (level = 0; level < TST_TOTAL; ++level) {
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "iopl() failed for level %d, "
- "errno=%d : %s", level,
- TST_ERR, tst_strerrno(TST_ERR));
- } else {
- tst_res(TPASS, "iopl() passed for level %d, "
- "returned %ld", level, TST_RET);
+ TEST(iopl(level));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "iopl() failed for level %d, "
+ "errno=%d : %s", level,
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TPASS, "iopl() passed for level %d, "
+ "returned %ld", level, TEST_RETURN);
+ }
}
}
+
+ /* cleanup and exit */
+ cleanup();
+ tst_exit();
+
}
-static void setup(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- /* iopl() is restricted under kernel lockdown. */
- if (tst_lockdown_enabled())
- tst_brk(TCONF, "Kernel is locked down, skip this test");
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
}
-static void cleanup(void)
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
{
+
/*
* back to I/O privilege for normal process.
*/
- if (iopl(0) == -1)
- tst_res(TWARN, "iopl() cleanup failed");
+ if (iopl(0) == -1) {
+ tst_resm(TWARN, "iopl() cleanup failed");
+ }
+
}
-static struct tst_test test = {
- .test_all = verify_iopl,
- .needs_root = 1,
- .setup = setup,
- .cleanup = cleanup,
-};
+#else /* __i386__ */
+
+#include "test.h"
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS,
+ "LSB v1.3 does not specify iopl() for this architecture.");
+ tst_exit();
+}
-#else
-TST_TEST_TCONF("LSB v1.3 does not specify iopl() for this architecture. (only for i386 or x86_64)");
-#endif /* __i386_, __x86_64__*/
+#endif /* __i386__ */
diff --git a/testcases/kernel/syscalls/iopl/iopl02.c b/testcases/kernel/syscalls/iopl/iopl02.c
index a6135ddf3..35d239268 100644
--- a/testcases/kernel/syscalls/iopl/iopl02.c
+++ b/testcases/kernel/syscalls/iopl/iopl02.c
@@ -1,79 +1,221 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2020
- * Copyright (c) Wipro Technologies Ltd, 2002
- */
-
-/*
- * This is an error test for iopl(2) system call.
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
*
- * Verify that
- * 1) iopl(2) returns -1 and sets errno to EINVAL for privilege
- * level greater than 3.
- * 2) iopl(2) returns -1 and sets errno to EPERM if the current
- * user is not the super-user.
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Author: Subhab Biswas <subhabrata.biswas@wipro.com>
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : iopl02
+ *
+ * EXECUTED BY : superuser
+ *
+ * TEST TITLE : Tests for error conditions
+ *
+ * TEST CASE TOTAL : 2
+ *
+ * AUTHOR : Subhab Biwas <subhabrata.biswas@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verify that
+ * 1) iopl(2) returns -1 and sets errno to EINVAL for privilege
+ * level greater than 3.
+ * 2) iopl(2) returns -1 and sets errno to EPERM if the current
+ * user is not the super-user.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Test caller is superuser
+ * Set expected errnos for logging
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code and error number, if matching,
+ * Issue PASS message
+ * Otherwise,
+ * Issue FAIL message
+ * Perform testcase specific cleanup (if needed)
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * iopl02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
+
+char *TCID = "iopl02";
+
+#if defined __i386__ || defined(__x86_64__)
#include <errno.h>
#include <unistd.h>
+#include <sys/io.h>
#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_macros.h"
+#include "test.h"
+#include "safe_macros.h"
-#if defined __i386__ || defined(__x86_64__)
-#include <sys/io.h>
+#define INVALID_LEVEL 4 /* Invalid privilege level */
+#define EXP_RET_VAL -1
-static struct tcase {
- int level;
- char *desc;
- int exp_errno;
-} tcases[] = {
- {4, "Invalid privilege level", EINVAL},
- {1, "Non super-user", EPERM}
+static void setup();
+static int setup1(void);
+static void cleanup1();
+static void cleanup();
+
+static char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
+
+struct test_cases_t {
+ int level; /* I/O privilege level */
+ char *desc; /* test case description */
+ int exp_errno; /* expected error number */
+} test_cases[] = {
+ {
+ INVALID_LEVEL, "Invalid privilege level", EINVAL}, {
+ 1, "Non super-user", EPERM}
};
-static void verify_iopl(unsigned int i)
+int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
+
+int main(int ac, char **av)
{
- TEST(iopl(tcases[i].level));
-
- if ((TST_RET == -1) && (TST_ERR == tcases[i].exp_errno)) {
- tst_res(TPASS | TTERRNO,
- "Expected failure for %s, errno: %d",
- tcases[i].desc, TST_ERR);
- } else {
- tst_res(TFAIL | TTERRNO,
- "%s returned %ld expected -1, expected %s got ",
- tcases[i].desc, TST_RET, tst_strerrno(tcases[i].exp_errno));
+
+ int lc, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; ++i) {
+
+ if (i == 1) {
+ /* setup Non super-user for second test */
+ if (setup1()) {
+ /* setup1() failed, skip this test */
+ continue;
+ }
+ }
+
+ /*
+ * Call iopl(2)
+ */
+ TEST(iopl(test_cases[i].level));
+
+ if ((TEST_RETURN == EXP_RET_VAL) &&
+ (TEST_ERRNO == test_cases[i].exp_errno)) {
+ tst_resm(TPASS, "Expected failure for %s, "
+ "errno: %d", test_cases[i].desc,
+ TEST_ERRNO);
+ } else {
+ tst_resm(TFAIL, "Unexpected results for %s ; "
+ "returned %ld (expected %d), errno %d "
+ "(expected errno %d)",
+ test_cases[i].desc,
+ TEST_RETURN, EXP_RET_VAL,
+ TEST_ERRNO, test_cases[i].exp_errno);
+ }
+
+ if (i == 1) {
+ /* revert back to super user */
+ cleanup1();
+ }
+
+ }
}
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
+
}
-static void setup(void)
+/* setup1() - set up non-super user for second test case */
+int setup1(void)
{
- struct passwd *pw;
+ /* switch to "nobody" user */
+ if (seteuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TWARN, "Failed to set effective"
+ "uid to %d", ltpuser->pw_uid);
+ return 1;
+ }
+ return 0;
+}
- /* iopl() is restricted under kernel lockdown. */
- if (tst_lockdown_enabled())
- tst_brk(TCONF, "Kernel is locked down, skip this test");
+/* cleanup1() - reset to super user for first test case */
+void cleanup1(void)
+{
+ /* reset user as root */
+ SAFE_SETEUID(NULL, 0);
+}
+
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ /* Check if "nobody" user id exists */
+ if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
+ tst_brkm(TBROK, NULL, "\"nobody\" user id doesn't exist");
+ }
+
+ TEST_PAUSE;
- pw = SAFE_GETPWNAM("nobody");
- SAFE_SETEUID(pw->pw_uid);
}
-static void cleanup(void)
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
{
- SAFE_SETEUID(0);
+
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_iopl,
- .needs_root = 1,
- .setup = setup,
- .cleanup = cleanup,
-};
+#else /* __i386__ */
+
+#include "test.h"
+#include "safe_macros.h"
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS,
+ "LSB v1.3 does not specify iopl() for this architecture.");
+ tst_exit();
+}
-#else
-TST_TEST_TCONF("LSB v1.3 does not specify iopl() for this architecture. (only for i386 or x86_64)");
-#endif /* __i386_, __x86_64__*/
+#endif /* __i386__ */
diff --git a/testcases/kernel/syscalls/ipc/Makefile b/testcases/kernel/syscalls/ipc/Makefile
index 7876f4bbd..fbd2f6f97 100644
--- a/testcases/kernel/syscalls/ipc/Makefile
+++ b/testcases/kernel/syscalls/ipc/Makefile
@@ -1,7 +1,44 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
+
+LIBDIR := lib
+LIBNEWDIR := libnewipc
+FILTER_OUT_DIRS := $(LIBDIR) $(LIBNEWDIR)
+LIB := $(LIBDIR)/libipc.a $(LIBDIR)/libmsgctl.a
+
+$(LIBDIR):
+ mkdir -p "$@"
+
+$(LIB): $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS := $(LIB)
+
+trunk-clean:: | lib-clean libnew-clean
+
+lib-clean:: $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
+
+libnew-clean:: $(LIBNEWDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
+
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/syscalls/ipc/Makefile.inc b/testcases/kernel/syscalls/ipc/Makefile.inc
new file mode 100644
index 000000000..839b4e4e7
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/Makefile.inc
@@ -0,0 +1,42 @@
+#
+# kernel/syscalls/ipc testcase suite common definitions Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Ngie Cooper, July 2009
+#
+
+# DO NOT USE THIS FILE FOR ipc / lib!!!
+
+LDLIBS += -lipc
+LIBDIR := ../lib
+
+LIBIPC := $(LIBDIR)/libipc.a
+
+$(LIBDIR):
+ mkdir -p "$@"
+
+$(LIBIPC): $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS := $(LIBIPC)
+
+CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR)
+
+LDFLAGS += -L$(abs_builddir)/$(LIBDIR)
+
+# vim: syntax=make
diff --git a/testcases/kernel/syscalls/ipc/Makefile2.inc b/testcases/kernel/syscalls/ipc/Makefile2.inc
new file mode 100644
index 000000000..9d612450d
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/Makefile2.inc
@@ -0,0 +1,36 @@
+#
+# kernel/syscalls/ipc testcase suite common definitions Makefile.
+#
+# Copyright (C) 2016, Cyril Hrubis
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+LDLIBS += -lnewipc
+LIBDIR := ../libnewipc
+
+LIBIPC := $(LIBDIR)/libnewipc.a
+
+$(LIBDIR):
+ mkdir -p "$@"
+
+$(LIBIPC): $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS := $(LIBIPC)
+
+CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR)
+
+LDFLAGS += -L$(abs_builddir)/$(LIBDIR)
diff --git a/testcases/kernel/syscalls/ipc/lib/Makefile b/testcases/kernel/syscalls/ipc/lib/Makefile
new file mode 100644
index 000000000..0333d482f
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/lib/Makefile
@@ -0,0 +1,25 @@
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+LIB := libipc.a libmsgctl.a
+
+include $(top_srcdir)/include/mk/lib.mk
diff --git a/include/ipcmsg.h b/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
index d89894b72..d89894b72 100644
--- a/include/ipcmsg.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
diff --git a/include/ipcsem.h b/testcases/kernel/syscalls/ipc/lib/ipcsem.h
index 09a0b3cbe..6a37672a7 100644
--- a/include/ipcsem.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcsem.h
@@ -29,7 +29,7 @@
#include <sys/sem.h>
#include "test.h"
-#include "lapi/sem.h"
+#include "lapi/semun.h"
void cleanup(void);
void setup(void);
diff --git a/include/ipcshm.h b/testcases/kernel/syscalls/ipc/lib/ipcshm.h
index 08307d4ab..08307d4ab 100644
--- a/include/ipcshm.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcshm.h
diff --git a/libs/libltpipc/libipc.c b/testcases/kernel/syscalls/ipc/lib/libipc.c
index d94880f54..d94880f54 100644
--- a/libs/libltpipc/libipc.c
+++ b/testcases/kernel/syscalls/ipc/lib/libipc.c
diff --git a/libs/libltpipc/libmsgctl.c b/testcases/kernel/syscalls/ipc/lib/libmsgctl.c
index ae459d480..ae459d480 100644
--- a/libs/libltpipc/libmsgctl.c
+++ b/testcases/kernel/syscalls/ipc/lib/libmsgctl.c
diff --git a/include/libmsgctl.h b/testcases/kernel/syscalls/ipc/lib/libmsgctl.h
index e1afeab5f..e1afeab5f 100644
--- a/include/libmsgctl.h
+++ b/testcases/kernel/syscalls/ipc/lib/libmsgctl.h
diff --git a/testcases/kernel/syscalls/ipc/libnewipc/Makefile b/testcases/kernel/syscalls/ipc/libnewipc/Makefile
new file mode 100644
index 000000000..efd8da76f
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/libnewipc/Makefile
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2016 Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INTERNAL_LIB := libnewipc.a
+
+include $(top_srcdir)/include/mk/lib.mk
diff --git a/libs/libltpnewipc/libnewipc.c b/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c
index d0974bbe0..b909cb7e6 100644
--- a/libs/libltpnewipc/libnewipc.c
+++ b/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c
@@ -21,9 +21,6 @@
#include "tst_test.h"
#include "libnewipc.h"
-#include "tst_safe_stdio.h"
-#include "tst_safe_sysv_ipc.h"
-#include "tst_clocks.h"
#define BUFSIZE 1024
@@ -34,7 +31,7 @@ key_t getipckey(const char *file, const int lineno)
int id;
static int count;
- safe_getcwd(file, lineno, NULL, buf, BUFSIZE);
+ SAFE_GETCWD(buf, BUFSIZE);
id = count % 26 + (int) 'a';
count++;
@@ -54,7 +51,11 @@ int get_used_queues(const char *file, const int lineno)
int used_queues = -1;
char buf[BUFSIZE];
- fp = safe_fopen(file, lineno, NULL, "/proc/sysvipc/msg", "r");
+ fp = fopen("/proc/sysvipc/msg", "r");
+ if (fp == NULL) {
+ tst_brk(TBROK | TERRNO,
+ "fopen() failed at %s:%d", file, lineno);
+ }
while (fgets(buf, BUFSIZE, fp) != NULL)
used_queues++;
@@ -77,25 +78,21 @@ void *probe_free_addr(const char *file, const int lineno)
probe_key = GETIPCKEY();
- shm_id = safe_shmget(file, lineno, probe_key, SHMLBA * 2,
- SHM_RW | IPC_CREAT | IPC_EXCL);
- addr = safe_shmat(file, lineno, shm_id, NULL, 0);
- safe_shmdt(file, lineno, addr);
- safe_shmctl(file, lineno, shm_id, IPC_RMID, NULL);
+ shm_id = shmget(probe_key, SHMLBA * 2, SHM_RW | IPC_CREAT | IPC_EXCL);
+ if (shm_id == -1)
+ tst_brk(TBROK, "probe: shmget() failed at %s:%d", file, lineno);
- addr = (void *)(((unsigned long)(addr) + (SHMLBA - 1)) & ~(SHMLBA - 1));
+ addr = shmat(shm_id, NULL, 0);
+ if (addr == (void *) -1)
+ tst_brk(TBROK, "probe: shmat() failed at %s:%d", file, lineno);
- return addr;
-}
+ if (shmdt(addr) == -1)
+ tst_brk(TBROK, "probe: shmdt() failed at %s:%d", file, lineno);
-time_t get_ipc_timestamp(void)
-{
- struct timespec ts;
- int ret;
+ if (shmctl(shm_id, IPC_RMID, NULL) == -1)
+ tst_brk(TBROK, "probe: shmctl() failed at %s:%d", file, lineno);
- ret = tst_clock_gettime(CLOCK_REALTIME_COARSE, &ts);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "clock_gettime(CLOCK_REALTIME_COARSE)");
+ addr = (void *)(((unsigned long)(addr) + (SHMLBA - 1)) & ~(SHMLBA - 1));
- return ts.tv_sec;
+ return addr;
}
diff --git a/include/libnewipc.h b/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.h
index 075364f85..660be8088 100644
--- a/include/libnewipc.h
+++ b/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.h
@@ -22,9 +22,6 @@
#ifndef __LIBNEWIPC_H
#define __LIBNEWIPC_H 1
-#include <time.h>
-#include <sys/types.h>
-
#define MSG_RD 0400
#define MSG_WR 0200
#define MSG_RW (MSG_RD | MSG_WR)
@@ -57,6 +54,4 @@ void *probe_free_addr(const char *file, const int lineno);
#define PROBE_FREE_ADDR() \
probe_free_addr(__FILE__, __LINE__)
-time_t get_ipc_timestamp(void);
-
#endif /* newlibipc.h */
diff --git a/testcases/kernel/syscalls/ipc/msgctl/.gitignore b/testcases/kernel/syscalls/ipc/msgctl/.gitignore
index ed10a8dbd..f179f2606 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/.gitignore
+++ b/testcases/kernel/syscalls/ipc/msgctl/.gitignore
@@ -2,6 +2,4 @@
/msgctl02
/msgctl03
/msgctl04
-/msgctl05
-/msgctl06
/msgctl12
diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
index 6b2b26d05..f9ee8d2c2 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile2.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
deleted file mode 100644
index cd2643bc1..000000000
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * Cross verify the _high fields being set to 0 by the kernel.
- */
-#include <sys/msg.h>
-#include "lapi/msgbuf.h"
-#include "libnewipc.h"
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-
-#ifdef HAVE_MSQID64_DS_TIME_HIGH
-
-static void run(void)
-{
- struct msqid64_ds buf_ds = {
- .msg_stime_high = 0x0A0A,
- .msg_rtime_high = 0x0A0A,
- .msg_ctime_high = 0x0A0A,
- };
- int msqid;
- key_t key;
-
- key = GETIPCKEY();
-
- msqid = SAFE_MSGGET(key, IPC_CREAT | IPC_EXCL | MSG_RW | 0600);
-
- TEST(msgctl(msqid, IPC_STAT, (struct msqid_ds *)&buf_ds));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "msqctl() failed");
-
- if (buf_ds.msg_stime_high || buf_ds.msg_rtime_high || buf_ds.msg_ctime_high)
- tst_res(TFAIL, "time_high fields aren't cleared by the kernel");
- else
- tst_res(TPASS, "time_high fields cleared by the kernel");
-
- SAFE_MSGCTL(msqid, IPC_RMID, NULL);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .needs_tmpdir = 1,
-};
-#else
-TST_TEST_TCONF("test requires struct msqid64_ds to have the time_high fields");
-#endif
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c
deleted file mode 100644
index 6f5476383..000000000
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c
+++ /dev/null
@@ -1,171 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Feiyu Zhu <zhufy.jy@cn.fujitsu.com>
- */
-/*\
- * [Description]
- *
- * Call msgctl() with MSG_INFO flag and check that:
- *
- * * The returned index points to a valid MSG by calling MSG_STAT_ANY
- * * Also count that valid indexes < returned max index sums up to used_ids
- * * And the data are consistent with /proc/sysvipc/msg
- *
- * There is a possible race between the call to the msgctl() and read from the
- * proc file so this test cannot be run in parallel with any IPC testcases that
- * adds or removes MSG queues.
- *
- * Note what we create a MSG segment in the test setup and send msg to make sure
- * that there is at least one during the testrun.
- *
- * Also note that for MSG_INFO the members of the msginfo structure have
- * completely different meaning than their names seems to suggest.
- */
-
-#include <stdio.h>
-#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-#include "lapi/msg.h"
-
-static int msg_id = -1;
-static struct passwd *ltpuser;
-static uid_t nobody_uid, root_uid;
-
-static struct tcases {
- uid_t *uid;
- char *desc;
-} tests[] = {
- {&nobody_uid, "with nobody user"},
- {&root_uid, "with root user"}
-};
-
-static void parse_proc_sysvipc(struct msginfo *info)
-{
- FILE *f = fopen("/proc/sysvipc/msg", "r");
- int queue_cnt = 0;
- int msg_cnt = 0;
- int msg_bytes = 0;
-
- /* Eat header */
- for (;;) {
- int c = fgetc(f);
-
- if (c == '\n' || c == EOF)
- break;
- }
-
- int cbytes, msgs;
-
- /*
- * Sum queue and byte for all elements listed, which should equal
- * the data returned in the msginfo structure.
- */
- while (fscanf(f, "%*i %*i %*i %i %i %*i %*i %*i %*i %*i %*i %*i %*i %*i",
- &cbytes, &msgs) > 0){
- queue_cnt++;
- msg_cnt += msgs;
- msg_bytes += cbytes;
- }
-
- if (info->msgpool != queue_cnt) {
- tst_res(TFAIL, "msgpool = %i, expected %i",
- info->msgpool, queue_cnt);
- } else {
- tst_res(TPASS, "queue_cnt = %i", queue_cnt);
- }
-
- if (info->msgmap != msg_cnt) {
- tst_res(TFAIL, "msgmap = %i, expected %i",
- info->msgpool, msg_cnt);
- } else {
- tst_res(TPASS, "msg_cnt = %i", msg_cnt);
- }
-
- if (info->msgtql != msg_bytes) {
- tst_res(TFAIL, "msgtql = %i, expected %i",
- info->msgtql, msg_bytes);
- } else {
- tst_res(TPASS, "msg_bytes = %i", msg_bytes);
- }
-
- fclose(f);
-}
-
-static void verify_msgctl(unsigned int n)
-{
- struct tcases *tc = &tests[n];
- int i, msgid, cnt = 0;
- struct msqid_ds buf;
- struct msginfo info;
-
- tst_res(TINFO, "Test MSG_STAT_ANY %s", tc->desc);
-
- SAFE_SETEUID(*tc->uid);
-
- TEST(msgctl(0, MSG_INFO, (struct msqid_ds *)&info));
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgctl(0, MSG_INFO, ...)");
- return;
- }
-
- msgid = msgctl(TST_RET, MSG_STAT_ANY, &buf);
-
- if (msgid == -1) {
- tst_res(TFAIL | TERRNO, "MSG_INFO haven't returned a valid index");
- } else {
- tst_res(TPASS, "MSG_INFO returned valid index %li to msgid %i",
- TST_RET, msgid);
- }
-
- for (i = 0; i <= TST_RET; i++) {
- if (msgctl(i, MSG_STAT_ANY, &buf) != -1)
- cnt++;
- }
-
- if (cnt == info.msgpool) {
- tst_res(TPASS, "Counted used = %i", cnt);
- } else {
- tst_res(TFAIL, "Counted used = %i, msgpool = %i",
- cnt, info.msgpool);
- }
-
- parse_proc_sysvipc(&info);
-}
-
-static void setup(void)
-{
- struct msqid_ds temp_buf;
- ltpuser = SAFE_GETPWNAM("nobody");
- nobody_uid = ltpuser->pw_uid;
- root_uid = 0;
-
- msg_id = SAFE_MSGGET(IPC_PRIVATE, IPC_CREAT | MSG_RW);
- SAFE_MSGSND(msg_id, "abcd", 4, 0);
-
- TEST(msgctl(msg_id, MSG_STAT_ANY, &temp_buf));
- if (TST_RET == -1) {
- if (TST_ERR == EINVAL)
- tst_brk(TCONF, "kernel doesn't support MSG_STAT_ANY");
- else
- tst_brk(TBROK | TTERRNO,
- "Current environment doesn't permit MSG_STAT_ANY");
- }
-}
-
-static void cleanup(void)
-{
- if (msg_id >= 0)
- SAFE_MSGCTL(msg_id, IPC_RMID, NULL);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_msgctl,
- .tcnt = ARRAY_SIZE(tests),
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/ipc/msgget/.gitignore b/testcases/kernel/syscalls/ipc/msgget/.gitignore
index 3372016ea..3b2dfb518 100644
--- a/testcases/kernel/syscalls/ipc/msgget/.gitignore
+++ b/testcases/kernel/syscalls/ipc/msgget/.gitignore
@@ -1,5 +1,3 @@
/msgget01
/msgget02
/msgget03
-/msgget04
-/msgget05
diff --git a/testcases/kernel/syscalls/ipc/msgget/Makefile b/testcases/kernel/syscalls/ipc/msgget/Makefile
index 6b2b26d05..f11974c94 100644
--- a/testcases/kernel/syscalls/ipc/msgget/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgget/Makefile
@@ -1,12 +1,22 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile2.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget04.c b/testcases/kernel/syscalls/ipc/msgget/msgget04.c
deleted file mode 100644
index 72cd4497b..000000000
--- a/testcases/kernel/syscalls/ipc/msgget/msgget04.c
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * It is a basic test about msg_next_id.
- * msg_next_id specifies desired id for next allocated IPC message. By default
- * they are equal to -1, which means generic allocation logic. Possible values
- * to set are in range {0..INT_MAX}.
- * Toggle with non-default value will be set back to -1 by kernel after
- * successful IPC object allocation.
- */
-
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-#define NEXT_ID_PATH "/proc/sys/kernel/msg_next_id"
-static int queue_id, pid;
-static key_t msgkey;
-
-static void verify_msgget(void)
-{
- SAFE_FILE_PRINTF(NEXT_ID_PATH, "%d", pid);
-
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | MSG_RW);
- if (queue_id == pid)
- tst_res(TPASS, "msg_next_id succeeded, queue id %d", pid);
- else
- tst_res(TFAIL, "msg_next_id failed, expected id %d, but got %d", pid, queue_id);
-
- TST_ASSERT_INT(NEXT_ID_PATH, -1);
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- pid++;
-}
-
-static void setup(void)
-{
- msgkey = GETIPCKEY();
- pid = getpid();
-}
-
-static void cleanup(void)
-{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_msgget,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_CHECKPOINT_RESTORE=y",
- NULL
- },
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget05.c b/testcases/kernel/syscalls/ipc/msgget/msgget05.c
deleted file mode 100644
index d6177bbed..000000000
--- a/testcases/kernel/syscalls/ipc/msgget/msgget05.c
+++ /dev/null
@@ -1,71 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
- *
- * It is a basic test about msg_next_id.
- * When the message queue identifier that msg_next_id stored has existed,
- * call msgget with different key just use another unused value in range
- * [0,INT_MAX]. kernel doesn't guarantee the desired id.
- */
-
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-#define NEXT_ID_PATH "/proc/sys/kernel/msg_next_id"
-
-static int queue_id[2], pid;
-static key_t msgkey[2];
-
-static void verify_msgget(void)
-{
- SAFE_FILE_PRINTF(NEXT_ID_PATH, "%d", queue_id[0]);
-
- queue_id[1] = SAFE_MSGGET(msgkey[1], IPC_CREAT | MSG_RW);
- if (queue_id[1] == queue_id[0])
- tst_res(TFAIL, "msg id %d has existed, msgget() returns the"
- " same msg id unexpectedly", queue_id[0]);
- else
- tst_res(TPASS, "msg id %d has existed, msgget() returns the"
- " new msgid %d", queue_id[0], queue_id[1]);
-
- SAFE_MSGCTL(queue_id[1], IPC_RMID, NULL);
-}
-
-static void setup(void)
-{
- msgkey[0] = GETIPCKEY();
- msgkey[1] = GETIPCKEY();
- pid = getpid();
- SAFE_FILE_PRINTF(NEXT_ID_PATH, "%d", pid);
- queue_id[0] = SAFE_MSGGET(msgkey[0], IPC_CREAT | MSG_RW);
- tst_res(TINFO, "Test msg_next_id effects on msgget(different key) "
- "when this message queue identifier has existed");
-}
-
-static void cleanup(void)
-{
- int i;
-
- for (i = 0; i < 2; i++) {
- if (queue_id[i] != -1)
- SAFE_MSGCTL(queue_id[i], IPC_RMID, NULL);
- }
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_msgget,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_CHECKPOINT_RESTORE=y",
- NULL
- },
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/.gitignore b/testcases/kernel/syscalls/ipc/msgrcv/.gitignore
index 8ab91e763..203464f5f 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/.gitignore
+++ b/testcases/kernel/syscalls/ipc/msgrcv/.gitignore
@@ -1,6 +1,7 @@
/msgrcv01
/msgrcv02
/msgrcv03
+/msgrcv04
/msgrcv05
/msgrcv06
/msgrcv07
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/Makefile b/testcases/kernel/syscalls/ipc/msgrcv/Makefile
index 6b2b26d05..f467389b9 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgrcv/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c
index afe552c4f..375d262bc 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c
@@ -1,82 +1,210 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * msgrcv01 - test that msgrcv() receives the expected message
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * msgrcv01.c
+ *
+ * DESCRIPTION
+ * msgrcv01 - test that msgrcv() receives the expected message
+ *
+ * ALGORITHM
+ * create a message queue
+ * initialize a message buffer with a known message and type
+ * loop if that option was specified
+ * fork a child to receive the message
+ * parent enqueues the message then exits
+ * check the return code
+ * if failure, issue a FAIL message.
+ * otherwise,
+ * if doing functionality testing
+ * build a new message and compare it to the one received
+ * if they are the same,
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * msgrcv01 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * none
*/
#include <string.h>
#include <sys/wait.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-static key_t msgkey;
-static int queue_id = -1, pid;
-static struct buf {
- long type;
- char mtext[MSGSIZE];
-} rcv_buf, snd_buf = {MSGTYPE, "hello"};
-
-static void verify_msgrcv(void)
+
+#include "test.h"
+
+#include "ipcmsg.h"
+
+void cleanup(void);
+void setup(void);
+void do_child(void);
+
+char *TCID = "msgrcv01";
+int TST_TOTAL = 1;
+
+int msg_q_1;
+MSGBUF snd_buf, rcv_buf, cmp_buf;
+
+pid_t c_pid;
+
+int main(int ac, char **av)
{
- struct msqid_ds qs_buf;
- time_t before_rcv, after_rcv;
+ int lc;
+ void check_functionality(void);
+ int status, e_code;
+
+ tst_parse_opts(ac, av, NULL, NULL);
- SAFE_MSGSND(queue_id, &snd_buf, MSGSIZE, 0);
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "d", &msg_q_1);
+#endif
- before_rcv = get_ipc_timestamp();
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, 1, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv failed");
- return;
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ /*
+ * fork a child to read from the queue while the parent
+ * enqueues the message to be read.
+ */
+ if ((c_pid = FORK_OR_VFORK()) == -1) {
+ tst_brkm(TBROK, cleanup, "could not fork");
+ }
+
+ if (c_pid == 0) { /* child */
+#ifdef UCLINUX
+ if (self_exec(av[0], "d", msg_q_1) < 0) {
+ tst_brkm(TBROK, cleanup, "could not self_exec");
+ }
+#else
+ do_child();
+#endif
+ } else { /* parent */
+ /* put the message on the queue */
+ if (msgsnd(msg_q_1, &snd_buf, MSGSIZE, 0) == -1) {
+ tst_brkm(TBROK, cleanup,
+ "Couldn't enqueue" " message");
+ }
+ /* wait for the child to finish */
+ wait(&status);
+ /* make sure the child returned a good exit status */
+ e_code = status >> 8;
+ if (e_code != 0) {
+ tst_resm(TFAIL, "Failures reported above");
+ }
+
+ }
}
- after_rcv = get_ipc_timestamp();
-
- if (strcmp(rcv_buf.mtext, snd_buf.mtext) == 0)
- tst_res(TPASS, "message received(%s) = message sent(%s)",
- rcv_buf.mtext, snd_buf.mtext);
- else
- tst_res(TFAIL, "message received(%s) != message sent(%s)",
- rcv_buf.mtext, snd_buf.mtext);
-
- SAFE_MSGCTL(queue_id, IPC_STAT, &qs_buf);
- if (qs_buf.msg_cbytes == 0 && qs_buf.msg_qnum == 0)
- tst_res(TPASS, "queue bytes and number of queues matched");
- else
- tst_res(TFAIL, "queue bytes or number of queues mismatched");
- if (qs_buf.msg_lrpid == pid)
- tst_res(TPASS, "PID of last msgrcv(2) matched");
- else
- tst_res(TFAIL, "PID of last msgrcv(2) mismatched");
-
- if (qs_buf.msg_rtime >= before_rcv && qs_buf.msg_rtime <= after_rcv) {
- tst_res(TPASS, "msg_rtime = %lu in [%lu, %lu]",
- (unsigned long)qs_buf.msg_rtime,
- (unsigned long)before_rcv, (unsigned long)after_rcv);
+
+ cleanup();
+ tst_exit();
+
+ /** NOT REACHED **/
+
+}
+
+/*
+ * do_child()
+ */
+void do_child(void)
+{
+ int retval = 0;
+
+ TEST(msgrcv(msg_q_1, &rcv_buf, MSGSIZE, 1, 0));
+
+ if (TEST_RETURN == -1) {
+ retval = 1;
+ tst_resm(TFAIL, "%s call failed - errno = %d : %s",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO));
} else {
- tst_res(TFAIL, "msg_rtime = %lu out of [%lu, %lu]",
- (unsigned long)qs_buf.msg_rtime,
- (unsigned long)before_rcv, (unsigned long)after_rcv);
+ /*
+ * Build a new message and compare it
+ * with the one received.
+ */
+ init_buf(&cmp_buf, MSGTYPE, MSGSIZE);
+
+ if (strcmp(rcv_buf.mtext, cmp_buf.mtext) == 0) {
+ tst_resm(TPASS,
+ "message received = " "message sent");
+ } else {
+ retval = 1;
+ tst_resm(TFAIL,
+ "message received != " "message sent");
+ }
}
+ exit(retval);
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- msgkey = GETIPCKEY();
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- pid = getpid();
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ msgkey = getipckey();
+
+ /* create a message queue with read/write permission */
+ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) {
+ tst_brkm(TBROK, cleanup, "Can't create message queue");
+ }
+
+ /* initialize the message buffer */
+ init_buf(&snd_buf, MSGTYPE, MSGSIZE);
}
-static void cleanup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
-}
+ /* if it exists, remove the message queue that was created */
+ rm_queue(msg_q_1);
+
+ tst_rmdir();
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_msgrcv,
- .needs_tmpdir = 1,
-};
+}
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
index 8dd28116a..e42cf1f13 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
@@ -1,115 +1,204 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * Basic error test for msgrcv(2).
+ * Copyright (c) International Business Machines Corp., 2001
*
- * 1)msgrcv(2) fails and sets errno to E2BIG if the message text length is
- * greater than msgsz and MSG_NOERROR isn't specified in msgflg.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * 2)The calling process does not have read permission on the message
- * queue, so msgrcv(2) fails and sets errno to EACCES.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*
- * 3)msgrcv(2) fails and sets errno to EFAULT if the message buffer address
- * isn't accessible.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * msgrcv02.c
*
- * 4)msgrcv(2) fails and sets errno to EINVAL if msqid was invalid(<0).
+ * DESCRIPTION
+ * msgrcv02 - test for EACCES and EFAULT errors
*
- * 5)msgrcv(2) fails and sets errno to EINVAL if msgsize is less than 0.
+ * ALGORITHM
+ * create a message queue with read/write permissions
+ * initialize a message buffer with a known message and type
+ * enqueue the message
+ * create another message queue without read/write permissions
+ * loop if that option was specified
+ * call msgrcv() using two different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EACCES or EFAULT
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * msgrcv02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ * 14/03/2008 Matthieu Fertré (Matthieu.Fertre@irisa.fr)
+ * - Fix concurrency issue. The second key used for this test could
+ * conflict with the key from another task.
+
*
- * 6)msgrcv(2) fails and sets errno to ENOMSG if IPC_NOWAIT was specified in
- * msgflg and no message of the requested type existed on the message queue.
+ * RESTRICTIONS
+ * none
*/
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/msg.h>
-#include <stdlib.h>
#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-static key_t msgkey;
-static int queue_id = -1;
-static int bad_id = -1;
-struct passwd *pw;
-
-static struct buf {
- long type;
- char mtext[MSGSIZE];
-} rcv_buf, snd_buf = {MSGTYPE, "hello"};
-
-static struct tcase {
- int *id;
- struct buf *buffer;
- int msgsz;
- long msgtyp;
- int msgflag;
- int exp_user;
- int exp_err;
-} tcases[] = {
- {&queue_id, &rcv_buf, 4, 1, 0, 0, E2BIG},
- {&queue_id, &rcv_buf, MSGSIZE, 1, 0, 1, EACCES},
- {&queue_id, NULL, MSGSIZE, 1, 0, 0, EFAULT},
- {&bad_id, &rcv_buf, MSGSIZE, 1, 0, 0, EINVAL},
- {&queue_id, &rcv_buf, -1, 1, 0, 0, EINVAL},
- {&queue_id, &rcv_buf, MSGSIZE, 2, IPC_NOWAIT, 0, ENOMSG},
+
+#include "test.h"
+
+#include "ipcmsg.h"
+
+void cleanup(void);
+void setup(void);
+
+char *TCID = "msgrcv02";
+int TST_TOTAL = 2;
+
+char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
+
+int msg_q_1 = -1; /* The message queue ID created in setup */
+int msg_q_2 = -1; /* Another message queue ID created in setup */
+MSGBUF snd_buf, rcv_buf;
+
+struct test_case_t {
+ int *queue_id;
+ MSGBUF *mbuf;
+ int error;
+} TC[] = {
+ /* EACCES - the queue has no read access */
+ {
+ &msg_q_2, &rcv_buf, EACCES},
+ /* EFAULT - the message buffer address is invalid */
+ {
+ &msg_q_1, (MSGBUF *) - 1, EFAULT}
};
-static void verify_msgrcv(struct tcase *tc)
+int main(int ac, char **av)
{
- TEST(msgrcv(*tc->id, tc->buffer, tc->msgsz, tc->msgtyp, tc->msgflag));
- if (TST_RET != -1) {
- tst_res(TFAIL, "smgrcv() succeeded unexpectedly");
- return;
- }
+ int lc;
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
- if (TST_ERR == tc->exp_err) {
- tst_res(TPASS | TTERRNO, "msgrcv() failed as expected");
- } else {
- tst_res(TFAIL | TTERRNO, "msgrcv() failed unexpectedly,"
- " expected %s but got", tst_strerrno(tc->exp_err));
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /*
+ * Use the TEST macro to make the call
+ */
+
+ TEST(msgrcv(*(TC[i].queue_id), TC[i].mbuf, MSGSIZE,
+ 1, IPC_NOWAIT));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "call failed with an "
+ "unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
}
+
+ cleanup();
+
+ tst_exit();
}
-static void do_test(unsigned int n)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- struct tcase *tc = &tcases[n];
- pid_t pid;
-
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
-
- SAFE_MSGSND(queue_id, &snd_buf, MSGSIZE, 0);
- pid = SAFE_FORK();
- if (pid == 0) {
- if (tc->exp_user)
- SAFE_SETUID(pw->pw_uid);
- verify_msgrcv(tc);
- exit(0);
+ key_t msgkey2;
+
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /* Switch to nobody user for correct error code collection */
+ ltpuser = getpwnam(nobody_uid);
+ if (setuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TINFO, "setuid failed to "
+ "to set the effective uid to %d", ltpuser->pw_uid);
+ perror("setuid");
}
- tst_reap_children();
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
-}
-static void setup(void)
-{
- msgkey = GETIPCKEY();
- pw = SAFE_GETPWNAM("nobody");
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ msgkey = getipckey();
+
+ /* Get an new IPC resource key. */
+ msgkey2 = getipckey();
+
+ /* create a message queue with read/write permission */
+ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) {
+ tst_brkm(TBROK, cleanup, "Can't create message queue #1");
+ }
+
+ /* initialize a message buffer */
+ init_buf(&snd_buf, MSGTYPE, MSGSIZE);
+
+ /* put it on msq_q_1 */
+ if (msgsnd(msg_q_1, &snd_buf, MSGSIZE, IPC_NOWAIT) == -1) {
+ tst_brkm(TBROK, cleanup, "Couldn't put message on queue");
+ }
+
+ /* create a message queue without read/write permission */
+ if ((msg_q_2 = msgget(msgkey2, IPC_CREAT | IPC_EXCL)) == -1) {
+ tst_brkm(TBROK, cleanup, "Can't create message queue #2");
+ }
}
-static void cleanup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
-}
+ /* if it exists, remove the message queue #1 */
+ rm_queue(msg_q_1);
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .needs_root = 1,
- .forks_child = 1,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .cleanup = cleanup,
- .test = do_test
-};
+ /* if it exists, remove the message queue #2 */
+ rm_queue(msg_q_2);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c
index b578e2810..762b4d51b 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c
@@ -1,104 +1,162 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
*
- * This is a basic test about MSG_COPY flag.
- * This flag was added in 3.8 for the implementation of the kernel checkpoint
- * restore facility and is available only if the kernel was built with the
- * CONFIG_CHECKPOINT_RESTORE option.
- * On old kernel without this support, it only ignores this flag and doesn't
- * report ENOSYS/EINVAL error. The CONFIG_CHECKPOINT_RESTORE has existed
- * before kernel 3.8.
- * So for using this flag, kernel should greater than 3.8 and enable
- * CONFIG_CHECKPOINT_RESTORE together.
+ * Copyright (c) International Business Machines Corp., 2001
*
- * 1)msgrcv(2) fails and sets errno to EINVAL if IPC_NOWAIT was not specified
- * in msgflag.
- * 2)msgrcv(2) fails and sets errno to EINVAL if IPC_EXCEPT was specified
- * in msgflag.
- * 3)msgrcv(2) fails and set errno to ENOMSG if IPC_NOWAIT and MSG_COPY were
- * specified in msgflg and the queue contains less than msgtyp messages.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * msgrcv03.c
+ *
+ * DESCRIPTION
+ * msgrcv03 - test for EINVAL error
+ *
+ * ALGORITHM
+ * create a message queue with read/write permissions
+ * loop if that option was specified
+ * call msgrcv() using two different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EINVAL
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * msgrcv03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * none
*/
-#define _GNU_SOURCE
-#include <string.h>
-#include <sys/wait.h>
-#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-#include "lapi/msg.h"
-
-static key_t msgkey;
-static int queue_id = -1;
-static struct buf {
- long type;
- char mtext[MSGSIZE];
-} rcv_buf, snd_buf = {MSGTYPE, "hello"};
-
-static struct tcase {
- int exp_err;
- int msg_flag;
- int msg_type;
- char *message;
-} tcases[] = {
- {EINVAL, 0, MSGTYPE,
- "EINVAL for MSG_COPY without IPC_NOWAIT"},
-
- {EINVAL, MSG_EXCEPT, MSGTYPE,
- "EINVAL for MSG_COPY with MSG_EXCEPT"},
-
- {ENOMSG, IPC_NOWAIT, 2,
- "ENOMSG with IPC_NOWAIT and MSG_COPY but with less than msgtyp messages"},
+#include "test.h"
+
+#include "ipcmsg.h"
+
+void cleanup(void);
+void setup(void);
+
+char *TCID = "msgrcv03";
+int TST_TOTAL = 2;
+
+int msg_q_1 = -1; /* The message queue id created in setup */
+int bad_q = -1; /* a value to use as a bad queue ID */
+MSGBUF rcv_buf;
+
+struct test_case_t {
+ int *queue_id;
+ int msize;
+ int error;
+} TC[] = {
+ /* EINVAL - the queue ID is invalid */
+ {
+ &bad_q, MSGSIZE, EINVAL},
+ /* EINVAL - the message size is less than 0 */
+ {
+ &msg_q_1, -1, EINVAL}
};
-static void verify_msgrcv(unsigned int n)
+int main(int ac, char **av)
{
- struct tcase *tc = &tcases[n];
+ int lc;
+ int i;
- tst_res(TINFO, "%s", tc->message);
+ tst_parse_opts(ac, av, NULL, NULL);
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, tc->msg_type, MSG_COPY | tc->msg_flag));
- if (TST_RET != -1) {
- tst_res(TFAIL, "msgrcv() succeeded unexpectedly");
- SAFE_MSGSND(queue_id, &snd_buf, MSGSIZE, 0);
- return;
- }
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
- if (TST_ERR == tc->exp_err) {
- tst_res(TPASS | TTERRNO, "msgrcv() failed as expected");
- return;
+ /*
+ * Use the TEST macro to make the call
+ */
+
+ TEST(msgrcv(*(TC[i].queue_id), &rcv_buf, TC[i].msize,
+ 1, 0));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "call failed with an "
+ "unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
}
- tst_res(TFAIL | TTERRNO,
- "msgrcv() failed unexpectedly, expected %s got",
- tst_strerrno(tc->exp_err));
+ cleanup();
+
+ tst_exit();
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- msgkey = GETIPCKEY();
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- SAFE_MSGSND(queue_id, &snd_buf, MSGSIZE, 0);
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ msgkey = getipckey();
+
+ /* create a message queue with read/write permission */
+ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) {
+ tst_brkm(TBROK, cleanup, "Can't create message queue");
+ }
}
-static void cleanup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
-}
+ /* if it exists, remove the message queue that was created */
+ rm_queue(msg_q_1);
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_CHECKPOINT_RESTORE",
- NULL
- },
- .min_kver = "3.8.0",
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_msgrcv,
- .setup = setup,
- .cleanup = cleanup,
-};
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c
new file mode 100644
index 000000000..833ad1aec
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c
@@ -0,0 +1,181 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * msgrcv04.c
+ *
+ * DESCRIPTION
+ * msgrcv04 - test for E2BIG and ENOMSG errors
+ *
+ * ALGORITHM
+ * create a message queue with read/write permissions
+ * initialize a message buffer with a known message and type
+ * enqueue the message
+ * loop if that option was specified
+ * call msgrcv() using two different invalid cases
+ * check the errno value
+ * issue a PASS message if we get E2BIG or ENOMSG
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * msgrcv04 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * none
+ */
+
+#include "test.h"
+
+#include "ipcmsg.h"
+
+void cleanup(void);
+void setup(void);
+
+char *TCID = "msgrcv04";
+int TST_TOTAL = 2;
+
+int msg_q_1 = -1; /* The message queue id created in setup */
+
+#define SMSIZE 512
+
+MSGBUF snd_buf, rcv_buf;
+
+struct test_case_t {
+ int size;
+ int type;
+ int flags;
+ int error;
+} TC[] = {
+ /*
+ * E2BIG - The receive buffer is too small for the message and
+ * MSG_NOERROR isn't asserted in the flags.
+ */
+ {
+ SMSIZE, 1, 0, E2BIG},
+ /*
+ * ENOMSG - There is no message with the requested type and
+ * IPC_NOWAIT is asserted in the flags.
+ */
+ {
+ MSGSIZE, 2, IPC_NOWAIT, ENOMSG}
+};
+
+int main(int ac, char **av)
+{
+ int lc;
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /*
+ * Use the TEST macro to make the call
+ */
+
+ TEST(msgrcv(msg_q_1, &rcv_buf, TC[i].size, TC[i].type,
+ TC[i].flags));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "call failed with an "
+ "unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
+}
+
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ msgkey = getipckey();
+
+ /* create a message queue with read/write permission */
+ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) {
+ tst_brkm(TBROK, cleanup, "Can't create message queue");
+ }
+
+ /* initialize a buffer */
+ init_buf(&snd_buf, MSGTYPE, MSGSIZE);
+
+ /* put the message on the queue */
+ if (msgsnd(msg_q_1, &snd_buf, MSGSIZE, 0) == -1) {
+ tst_brkm(TBROK, cleanup, "Can't enqueue message");
+ }
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+ /* if it exists, remove the message queue that was created */
+ rm_queue(msg_q_1);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
index 43581896a..66c4341f1 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
@@ -1,78 +1,206 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * msgrcv error test for EINTR.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * msgrcv05.c
+ *
+ * DESCRIPTION
+ * msgrcv05 - test for EINTR error
+ *
+ * ALGORITHM
+ * create a message queue with read/write permissions
+ * loop if that option was specified
+ * fork a child who attempts to read a non-existent message with msgrcv()
+ * parent sends a SIGHUP to the child, then waits for the child to complete
+ * check the errno value
+ * issue a PASS message if we get EINTR
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * child exits, parent calls cleanup
+ *
+ * USAGE: <for command-line>
+ * msgrcv05 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ * 14/03/2008 Matthieu Fertré (Matthieu.Fertre@irisa.fr)
+ * - Fix concurrency issue. Due to the use of usleep function to
+ * synchronize processes, synchronization issues can occur on a loaded
+ * system. Fix this by using pipes to synchronize processes.
+ *
+ * RESTRICTIONS
+ * none
*/
+#include "test.h"
+#include "safe_macros.h"
+
+#include "ipcmsg.h"
+
#include <sys/types.h>
#include <sys/wait.h>
-#include <signal.h>
-#include <stdlib.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-static key_t msgkey;
-static int queue_id = -1;
-static struct buf {
- long type;
- char mtext[MSGSIZE];
-} rcv_buf;
-
-static void sighandler(int sig)
+
+void do_child(void);
+void cleanup(void);
+void setup(void);
+#ifdef UCLINUX
+#define PIPE_NAME "msgrcv05"
+void do_child_uclinux(void);
+#endif
+
+char *TCID = "msgrcv05";
+int TST_TOTAL = 1;
+
+int msg_q_1 = -1; /* The message queue id created in setup */
+
+MSGBUF rcv_buf;
+pid_t c_pid;
+
+int main(int ac, char **av)
{
- if (sig == SIGHUP)
- return;
- else
- _exit(TBROK);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+#ifdef UCLINUX
+ maybe_run_child(&do_child_uclinux, "d", &msg_q_1);
+#endif
+
+ setup(); /* global setup */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ /*
+ * fork a child that will attempt to read a non-existent
+ * message from the queue
+ */
+ if ((c_pid = FORK_OR_VFORK()) == -1)
+ tst_brkm(TBROK, cleanup, "could not fork");
+
+ if (c_pid == 0) {
+ /*
+ * Attempt to read a message without IPC_NOWAIT.
+ * With no message to read, the child sleeps.
+ */
+
+#ifdef UCLINUX
+ if (self_exec(av[0], "d", msg_q_1) < 0)
+ tst_brkm(TBROK, cleanup, "could not self_exec");
+#else
+ do_child();
+#endif
+ } else {
+ TST_PROCESS_STATE_WAIT(cleanup, c_pid, 'S');
+
+ /* send a signal that must be caught to the child */
+ SAFE_KILL(cleanup, c_pid, SIGHUP);
+
+ waitpid(c_pid, NULL, 0);
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
}
-static void verify_msgrcv(void)
+void do_child(void)
{
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, 1, 0));
+ TEST(msgrcv(msg_q_1, &rcv_buf, MSGSIZE, 1, 0));
- if (TST_RET != -1) {
- tst_res(TFAIL, "msgrcv() succeeded unexpectedly");
- return;
+ if (TEST_RETURN != -1)
+ tst_brkm(TFAIL, NULL, "call succeeded unexpectedly");
+
+ switch (TEST_ERRNO) {
+ case EINTR:
+ tst_resm(TPASS, "got EINTR as expected");
+ break;
+ default:
+ tst_resm(TFAIL | TTERRNO,
+ "call failed with an unexpected error");
+ break;
}
- if (TST_ERR == EINTR)
- tst_res(TPASS | TTERRNO, "msgrcv() failed as expected");
+
+ exit(0);
+}
+
+void sighandler(int sig)
+{
+ if (sig == SIGHUP)
+ return;
else
- tst_res(TFAIL | TTERRNO, "msgrcv() failed expected EINTR but got");
+ tst_brkm(TBROK, NULL, "unexpected signal %d received", sig);
}
-static void do_test(void)
+#ifdef UCLINUX
+/*
+ * do_child_uclinux() - capture signals again, then run do_child()
+ */
+void do_child_uclinux(void)
{
- int pid;
+ tst_sig(FORK, sighandler, cleanup);
- pid = SAFE_FORK();
- if (pid == 0) {
- verify_msgrcv();
- exit(0);
- }
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
- SAFE_KILL(pid, SIGHUP);
- tst_reap_children();
+ do_child();
}
+#endif
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- msgkey = GETIPCKEY();
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- SAFE_SIGNAL(SIGHUP, sighandler);
+
+ tst_sig(FORK, sighandler, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ msgkey = getipckey();
+
+ /* create a message queue with read/write permission */
+ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1)
+ tst_brkm(TBROK, cleanup, "Can't create message queue");
}
-static void cleanup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
-}
+ /* if it exists, remove the message queue that was created */
+ rm_queue(msg_q_1);
+
+ tst_rmdir();
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = do_test,
- .needs_tmpdir = 1,
- .forks_child = 1,
-};
+}
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
index 283b4af1d..a27d093be 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
@@ -1,70 +1,219 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * msgrcv error test for EIDRM.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * msgrcv06.c
+ *
+ * DESCRIPTION
+ * msgrcv06 - test for EIDRM error
+ *
+ * ALGORITHM
+ * loop if that option was specified
+ * create a message queue with read/write permissions
+ * fork a child who sleeps on an attempted read with msgrcv()
+ * parent removes the queue then waits for child to complete
+ * check the errno value
+ * issue a PASS message if we get EIDRM
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * child removes message queue if required
+ * parent callc cleanup
+ *
+ * USAGE: <for command-line>
+ * msgrcv06 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ * 14/03/2008 Matthieu Fertré (Matthieu.Fertre@irisa.fr)
+ * - Fix concurrency issue. Due to the use of usleep function to
+ * synchronize processes, synchronization issues can occur on a loaded
+ * system. Fix this by using pipes to synchronize processes.
+ *
+ *
+ * RESTRICTIONS
+ * none
*/
-#include <errno.h>
-#include <unistd.h>
+#include "test.h"
+
+#include "ipcmsg.h"
+
#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <stdlib.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-static key_t msgkey;
-static int queue_id = -1;
-static struct buf {
- long type;
- char text[MSGSIZE];
-} rcv_buf = {1, "hello"};
-
-static void verify_msgrcv(void)
+#include <sys/wait.h>
+
+void do_child(void);
+void cleanup(void);
+void setup(void);
+#ifdef UCLINUX
+#define PIPE_NAME "msgrcv06"
+void do_child_uclinux(void);
+#endif
+
+char *TCID = "msgrcv06";
+int TST_TOTAL = 1;
+
+int msg_q_1 = -1; /* The message queue id created in setup */
+
+MSGBUF rcv_buf;
+pid_t c_pid;
+
+int main(int ac, char **av)
{
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, 1, 0));
- if (TST_RET != -1) {
- tst_res(TFAIL, "msgrcv() succeeded unexpectedly");
- return;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+#ifdef UCLINUX
+ maybe_run_child(&do_child_uclinux, "d", &msg_q_1);
+#endif
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ /*
+ * set up the queue here so that multiple test iterations
+ * will work.
+ */
+ msgkey = getipckey();
+
+ /* create a message queue with read/write permission */
+ if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW))
+ == -1) {
+ tst_brkm(TBROK, cleanup, "Can't create message queue");
+ }
+
+ /*
+ * fork a child that will attempt to read a non-existent
+ * message from the queue
+ */
+ if ((c_pid = FORK_OR_VFORK()) == -1) {
+ tst_brkm(TBROK, cleanup, "could not fork");
+ }
+
+ if (c_pid == 0) { /* child */
+ /*
+ * Attempt to read a message without IPC_NOWAIT.
+ * With no message to read, the child sleeps.
+ */
+
+#ifdef UCLINUX
+ if (self_exec(av[0], "d", msg_q_1) < 0) {
+ tst_brkm(TBROK, cleanup, "could not self_exec");
+ }
+#else
+ do_child();
+#endif
+ } else {
+ TST_PROCESS_STATE_WAIT(cleanup, c_pid, 'S');
+
+ /* remove the queue */
+ rm_queue(msg_q_1);
+
+ waitpid(c_pid, NULL, 0);
+ }
}
- if (TST_ERR == EIDRM)
- tst_res(TPASS | TTERRNO, "msgrcv() failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "msgrcv() failed expected EIDRM but got");
+
+ tst_exit();
}
-static void do_test(void)
+/*
+ * do_child()
+ */
+void do_child(void)
{
- int pid;
+ TEST(msgrcv(msg_q_1, &rcv_buf, MSGSIZE, 1, 0));
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- pid = SAFE_FORK();
- if (pid == 0) {
- verify_msgrcv();
- exit(0);
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded when error expected");
+ exit(-1);
}
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- tst_reap_children();
+
+ switch (TEST_ERRNO) {
+ case EIDRM:
+ tst_resm(TPASS, "expected failure - errno = %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+
+ /* mark the queue as invalid as it was removed */
+ msg_q_1 = -1;
+ break;
+ default:
+ tst_resm(TFAIL,
+ "call failed with an unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ break;
+ }
+
+ /* if it exists, remove the message queue that was created */
+ rm_queue(msg_q_1);
+
+ exit(0);
}
-static void setup(void)
+#ifdef UCLINUX
+/*
+ * do_child_uclinux() - capture signals again, then run do_child()
+ */
+void do_child_uclinux(void)
{
- msgkey = GETIPCKEY();
+ tst_sig(FORK, SIG_IGN, cleanup);
+
+ do_child();
}
+#endif
-static void cleanup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
+
+ tst_sig(FORK, SIG_IGN, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .forks_child = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test_all = do_test,
-};
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv07.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv07.c
index 2c687c5c8..44f1c1d91 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv07.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv07.c
@@ -1,269 +1,172 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2014-2020 Fujitsu Ltd.
+ * Copyright (c) 2014 Fujitsu Ltd.
* Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
*
- * Basic test for msgrcv(2) using MSG_EXCEPT, MSG_NOERROR, MSG_COPY and
- * different msg_typ(zero,positive,negative).
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
*
- * * With MSG_EXCEPT flag any message type but the one passed to the function
- * is received.
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * * With MSG_NOERROR and buffer size less than message size only part of the
- * buffer is received.
- *
- * * With MSG_COPY and IPC_NOWAIT flag read the msg but don't destroy it in
- * msg queue.
- *
- * * With msgtyp is 0, then the first message in the queue is read.
- *
- * * With msgtyp is greater than 0, then the first message in the queue of type
- * msgtyp is read.
- *
- * * With msgtyp is less than 0, then the first message in the queue with the
- * lowest type less than or equal to absolute value of msgtyp is received.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Description:
+ * Basic test for msgrcv(2) using MSG_EXCEPT, MSG_NOERROR
*/
#define _GNU_SOURCE
#include <sys/wait.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-#include "lapi/msg.h"
+#include "test.h"
+#include "ipcmsg.h"
+
#define MSGTYPE1 1
#define MSGTYPE2 2
-#define MSG1 "messagetype1"
-#define MSG2 "messagetype2"
-
-static key_t msgkey;
-static int queue_id = -1, msg_copy_sup;
-static struct buf {
- long type;
- char mtext[MSGSIZE];
-} rcv_buf, snd_buf[2] = {
- {MSGTYPE1, MSG1},
- {MSGTYPE2, MSG2}
-};
-
-static void prepare_queue(void)
-{
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- SAFE_MSGSND(queue_id, &snd_buf[0], MSGSIZE, 0);
- SAFE_MSGSND(queue_id, &snd_buf[1], MSGSIZE, 0);
- memset(&rcv_buf, 0, sizeof(rcv_buf));
-}
+#define MSG1 "message type1"
+#define MSG2 "message type2"
-static void test_msg_except(void)
-{
- prepare_queue();
+static void wait4child(pid_t child, char *tst_flag);
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, MSGTYPE2, MSG_EXCEPT));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv(MSG_EXCEPT) failed");
- goto exit;
- }
-
- tst_res(TPASS, "msgrcv(MSG_EXCEPT) succeeded");
+static void test_msg_except(void);
+static void test_msg_noerror(void);
- if (strcmp(rcv_buf.mtext, MSG1) == 0 && rcv_buf.type == MSGTYPE1)
- tst_res(TPASS, "MSG_EXCEPT excepted MSGTYPE2 and got MSGTYPE1");
- else
- tst_res(TFAIL, "MSG_EXCEPT didn't get MSGTYPE1 message");
+static void (*testfunc[])(void) = { test_msg_except, test_msg_noerror };
-exit:
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- queue_id = -1;
-}
+char *TCID = "msgrcv07";
+int TST_TOTAL = ARRAY_SIZE(testfunc);
-static void test_msg_noerror(void)
-{
- int msg_len;
-
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- SAFE_MSGSND(queue_id, &snd_buf[0], MSGSIZE, 0);
- msg_len = sizeof(MSG1) / 2;
- memset(&rcv_buf, 0, sizeof(rcv_buf));
-
- TEST(msgrcv(queue_id, &rcv_buf, msg_len, MSGTYPE1, MSG_NOERROR));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv(MSG_NOERROR) failed");
- goto exit;
- }
-
- tst_res(TPASS, "msgrcv(MSG_NOERROR) succeeded");
-
- if (strncmp(rcv_buf.mtext, MSG1, msg_len) == 0 && rcv_buf.type == MSGTYPE1)
- tst_res(TPASS, "MSG_NOERROR truncated message correctly");
- else
- tst_res(TFAIL, "MSG_NOERROR truncated message incorrectly");
-
-exit:
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- queue_id = -1;
-}
-
-static void test_msg_copy(void)
+int main(int ac, char **av)
{
- struct msqid_ds buf = {0};
-
- if (!msg_copy_sup) {
- tst_res(TCONF, "MSG_COPY not supported");
- return;
- }
-
- prepare_queue();
-
- /*
- * If MSG_COPY flag was specified, then mtype is interpreted as number
- * of the message to copy.
- */
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, 0, MSG_COPY | IPC_NOWAIT));
- if (TST_RET == -1) {
- if (TST_ERR == ENOSYS) {
- tst_res(TCONF,
- "MSG_COPY needs CONFIG_CHECKPORINT_RESTORE");
- msg_copy_sup = 0;
- } else {
- tst_res(TFAIL | TTERRNO, "msgrcv(0, MSG_COPY) failed");
- }
- goto exit;
- }
-
- tst_res(TPASS, "msgrcv(0, MSG_COPY) succeeded");
+ int lc;
+ int i;
- if (strcmp(rcv_buf.mtext, MSG1) == 0 && rcv_buf.type == MSGTYPE1)
- tst_res(TPASS, "MSG_COPY got MSGTYPE1 data correctly");
- else
- tst_res(TFAIL, "MSG_COPY got MSGTYPE1 data incorrectly");
-
- memset(&rcv_buf, 0, sizeof(rcv_buf));
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, 1, MSG_COPY | IPC_NOWAIT));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv(1, MSG_COPY) failed");
- goto exit;
- }
+ tst_parse_opts(ac, av, NULL, NULL);
- tst_res(TPASS, "msgrcv(1, MSG_COPY) succeeded");
+ setup();
- if (strcmp(rcv_buf.mtext, MSG2) == 0 && rcv_buf.type == MSGTYPE2)
- tst_res(TPASS, "MSG_COPY got MSGTYPE2 data correctly");
- else
- tst_res(TFAIL, "MSG_COPY got MSGTYPE2 data incorrectly");
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- SAFE_MSGCTL(queue_id, IPC_STAT, &buf);
- if (buf.msg_qnum == 2) {
- tst_res(TPASS, "Two messages still in queue");
- } else {
- tst_res(TFAIL, "Expected 2 msgs in queue got %d",
- (int)buf.msg_qnum);
+ for (i = 0; i < TST_TOTAL; i++)
+ (*testfunc[i])();
}
-exit:
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- queue_id = -1;
+ cleanup();
+ tst_exit();
}
-static void test_zero_msgtyp(void)
+void setup(void)
{
- prepare_queue();
-
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, 0, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv(zero_msgtyp) failed");
- goto exit;
- }
-
- tst_res(TPASS, "msgrcv(zero_msgtyp) succeeded");
+ tst_sig(FORK, DEF_HANDLER, cleanup);
- if (strcmp(rcv_buf.mtext, MSG1) == 0 && rcv_buf.type == MSGTYPE1)
- tst_res(TPASS, "zero_msgtyp got the first message");
- else
- tst_res(TFAIL, "zero_msgtyp didn't get the first message");
-
-exit:
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- queue_id = -1;
+ TEST_PAUSE;
}
-static void test_positive_msgtyp(void)
+static void test_msg_except(void)
{
- prepare_queue();
-
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, MSGTYPE2, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv(positive_msgtyp) failed");
- goto exit;
- }
-
- tst_res(TPASS, "msgrcv(positive_msgtyp) succeeded");
-
- if (strcmp(rcv_buf.mtext, MSG2) == 0 && rcv_buf.type == MSGTYPE2) {
- tst_res(TPASS,
- "msgtyp got the first message in the queue of type msgtyp");
+ pid_t child_pid;
+ int msgq_id;
+ MSGBUF snd_buf1 = {.mtype = MSGTYPE1, .mtext = MSG1};
+ MSGBUF snd_buf2 = {.mtype = MSGTYPE2, .mtext = MSG2};
+ MSGBUF rcv_buf;
+
+ msgq_id = msgget(IPC_PRIVATE, MSG_RW);
+ if (msgq_id == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "Can't create message queue");
+
+ if (msgsnd(msgq_id, &snd_buf1, MSGSIZE, 0) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "Can't enqueue message");
+
+ if (msgsnd(msgq_id, &snd_buf2, MSGSIZE, 0) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "Can't enqueue message");
+
+ child_pid = tst_fork();
+ if (child_pid == -1) {
+ tst_brkm(TBROK, cleanup, "fork failed");
+ } else if (child_pid > 0) {
+ wait4child(child_pid, "MSG_EXCEPT");
} else {
- tst_res(TFAIL,
- "msgtyp didn't get the first message in the queue of type msgtyp");
+ memset(&rcv_buf, 0, sizeof(rcv_buf));
+ TEST(msgrcv(msgq_id, &rcv_buf, MSGSIZE, MSGTYPE2, MSG_EXCEPT));
+ if (TEST_RETURN == -1) {
+ fprintf(stderr, "msgrcv(MSG_EXCEPT) failed\n");
+ exit(TBROK);
+ }
+ /* check the received message */
+ if (strcmp(rcv_buf.mtext, MSG1) == 0 &&
+ rcv_buf.mtype == MSGTYPE1)
+ exit(TPASS);
+ else
+ exit(TFAIL);
}
-exit:
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- queue_id = -1;
+ rm_queue(msgq_id);
}
-static void test_negative_msgtyp(void)
-{
- prepare_queue();
- TEST(msgrcv(queue_id, &rcv_buf, MSGSIZE, -MSGTYPE2, 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "msgrcv(negative_msgtyp) failed");
- goto exit;
- }
+static void test_msg_noerror(void)
+{
+ pid_t child_pid;
+ int msg_len, msgq_id;
+ MSGBUF snd_buf1 = {.mtype = MSGTYPE1, .mtext = MSG1};
+ MSGBUF rcv_buf;
+
+ msgq_id = msgget(IPC_PRIVATE, MSG_RW);
+ if (msgq_id == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "Can't create message queue");
+
+ if (msgsnd(msgq_id, &snd_buf1, MSGSIZE, 0) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "Can't enqueue message");
+
+ child_pid = tst_fork();
+ if (child_pid == -1) {
+ tst_brkm(TBROK, cleanup, "fork failed");
+ } else if (child_pid > 0) {
+ wait4child(child_pid, "MSG_NOERROR");
+ } else {
+ msg_len = sizeof(MSG1) / 2;
+ memset(&rcv_buf, 0, sizeof(rcv_buf));
- tst_res(TPASS, "msgrcv(negative_msgtyp) succeeded");
+ TEST(msgrcv(msgq_id, &rcv_buf, msg_len, MSGTYPE1, MSG_NOERROR));
+ if (TEST_RETURN == -1)
+ exit(TFAIL);
- if (strcmp(rcv_buf.mtext, MSG1) == 0 && rcv_buf.type == MSGTYPE1) {
- tst_res(TPASS,
- "-msgtyp got the first message in the queue with the lowest type");
- } else {
- tst_res(TFAIL,
- "-msgtyp didn't get the first message in the queue with the lowest type");
+ if (strncmp(rcv_buf.mtext, MSG1, msg_len) == 0 &&
+ rcv_buf.mtype == MSGTYPE1)
+ exit(TPASS);
+ exit(TFAIL);
}
-exit:
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
- queue_id = -1;
-}
-
-static void cleanup(void)
-{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
+ rm_queue(msgq_id);
}
-static void setup(void)
+static void wait4child(pid_t child, char *tst_flag)
{
- msgkey = GETIPCKEY();
-
- if (tst_kvercmp(3, 8, 0) >= 0)
- msg_copy_sup = 1;
+ int status;
+ int ret;
+
+ if (waitpid(child, &status, 0) == -1)
+ tst_resm(TBROK | TERRNO, "waitpid");
+ if (WIFEXITED(status)) {
+ ret = WEXITSTATUS(status);
+ if (ret == 0)
+ tst_resm(TPASS, "test %s success", tst_flag);
+ else if (ret == 1)
+ tst_resm(TFAIL, "test %s failed", tst_flag);
+ else
+ tst_brkm(TBROK, cleanup, "msgrcv failed unexpectedly");
+ } else {
+ tst_brkm(TBROK, cleanup, "child process terminated "
+ "abnormally. status: %d", status);
+ }
}
-static void (*testfunc[])(void) = {test_msg_except, test_msg_noerror,
- test_msg_copy, test_zero_msgtyp,
- test_positive_msgtyp, test_negative_msgtyp};
-
-static void verify_msgcrv(unsigned int n)
+void cleanup(void)
{
- (*testfunc[n])();
}
-
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_msgcrv,
- .tcnt = ARRAY_SIZE(testfunc),
-};
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
index 1ab6eba9f..dbe67e189 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv08.c
@@ -1,7 +1,23 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015 Author: Gabriellla Schmidt <gsc@bruker.de>
* Modify: Li Wang <liwang@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * you should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Description:
+ *
* A regression test for:
* commit e7ca2552369c1dfe0216c626baf82c3d83ec36bb
* Author: Mateusz Guzik <mguzik@redhat.com>
@@ -25,60 +41,78 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-static long mtype = 121;
-static key_t msgkey;
-static int queue_id = -1;
-static struct mbuf {
- long mtype;
- char mtext[16];
-} rcv_buf, snd_buf = {121, "hello"};
-
-static void verify_msgrcv(void)
+#include "test.h"
+#include "lapi/abisize.h"
+
+const char *TCID = "msgrcv08";
+const int TST_TOTAL = 1;
+
+#ifdef TST_ABI32
+
+struct mbuf {
+ long mtype; /* message type, must be > 0 */
+ char mtext[16]; /* message data */
+};
+
+static void msr(int msqid)
{
- memset(&rcv_buf, 0, sizeof(rcv_buf));
- SAFE_MSGSND(queue_id, &snd_buf, sizeof(snd_buf.mtext), IPC_NOWAIT);
+ struct mbuf msbs;
+ struct mbuf msbr;
+ ssize_t sret;
+ long mtype = 121;
- TEST(msgrcv(queue_id, &rcv_buf, sizeof(rcv_buf.mtext), -mtype, IPC_NOWAIT | MSG_NOERROR));
- if (TST_RET == -1) {
- tst_res(TFAIL, "Bug: No message of desired type.");
- return;
- }
+ memset(&msbs, 0, sizeof(msbs));
+ msbs.mtype = mtype;
- if (rcv_buf.mtype != mtype) {
- tst_res(TFAIL, "found mtype %ld, expected %ld", rcv_buf.mtype, mtype);
- return;
- }
- if ((size_t)TST_RET != sizeof(snd_buf.mtext)) {
- tst_res(TFAIL, "received %zi, expected %zu", (size_t)TST_RET, sizeof(snd_buf.mtext));
+ if (msgsnd(msqid, &msbs, sizeof(msbs.mtext), IPC_NOWAIT))
+ tst_brkm(TBROK | TERRNO, NULL, "msgsnd error");
+
+ sret = msgrcv(msqid, &msbr, sizeof(msbr.mtext), -mtype, IPC_NOWAIT | MSG_NOERROR);
+
+ if (sret < 0) {
+ tst_resm(TFAIL, "Bug: No message of desired type.");
return;
}
- tst_res(TPASS, "No regression found.");
+ if (msbr.mtype != mtype)
+ tst_brkm(TBROK, NULL,
+ "found mtype %ld, expected %ld\n", msbr.mtype, mtype);
+
+ if ((size_t)sret != sizeof(msbs.mtext))
+ tst_brkm(TBROK, NULL, "received %zi, expected %zu\n",
+ sret, sizeof(msbs.mtext));
+
+ tst_resm(TPASS, "No regression found.");
}
-static void setup(void)
+static void msgrcv_test(void)
{
- msgkey = GETIPCKEY();
- queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
+ int msqid = msgget(IPC_PRIVATE, IPC_CREAT | IPC_EXCL | 0666);
+
+ if (msqid < 0)
+ tst_brkm(TBROK | TERRNO, NULL, "msgget error");
+
+ msr(msqid);
+
+ if (msgctl(msqid, IPC_RMID, 0))
+ tst_brkm(TBROK | TERRNO, NULL, "msgctl error");
}
-static void cleanup(void)
+int main(int argc, char *argv[])
{
- if (queue_id != -1)
- SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ for (lc = 0; TEST_LOOPING(lc); lc++)
+ msgrcv_test();
+
+ tst_exit();
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_msgrcv,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "e7ca2552369c"},
- {}
- }
-};
+#else /* no 64-bit */
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "not works when compiled as 64-bit application.");
+}
+#endif
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/Makefile b/testcases/kernel/syscalls/ipc/msgsnd/Makefile
index 85017fe90..207fb1675 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgsnd/Makefile
@@ -1,16 +1,26 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpnewipc
-
ifeq ($(UCLINUX),1)
FILTER_OUT_MAKE_TARGETS += msgsnd05 msgsnd06
endif
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS += -lltpnewipc
-
+include $(abs_srcdir)/../Makefile2.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
index 432b03def..fca7c6789 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
@@ -18,7 +18,7 @@
#include "libnewipc.h"
static key_t msgkey;
-static int queue_id = -1, pid;
+static int queue_id = -1;
static struct buf {
long type;
char text[MSGSIZE];
@@ -27,15 +27,12 @@ static struct buf {
static void verify_msgsnd(void)
{
struct msqid_ds qs_buf;
- time_t before_snd, after_snd;
- before_snd = get_ipc_timestamp();
TEST(msgsnd(queue_id, &snd_buf, MSGSIZE, 0));
if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "msgsnd() failed");
return;
}
- after_snd = get_ipc_timestamp();
SAFE_MSGCTL(queue_id, IPC_STAT, &qs_buf);
@@ -44,29 +41,14 @@ static void verify_msgsnd(void)
else
tst_res(TFAIL, "queue bytes or number of queues mismatched");
- if (qs_buf.msg_lspid == pid)
- tst_res(TPASS, "PID of last msgsnd(2) matched");
- else
- tst_res(TFAIL, "PID of last msgsnd(2) mismatched");
-
- if (qs_buf.msg_stime >= before_snd && qs_buf.msg_stime <= after_snd) {
- tst_res(TPASS, "msg_stime = %lu in [%lu, %lu]",
- (unsigned long)qs_buf.msg_stime,
- (unsigned long)before_snd, (unsigned long)after_snd);
- } else {
- tst_res(TFAIL, "msg_stime = %lu out of [%lu, %lu]",
- (unsigned long)qs_buf.msg_stime,
- (unsigned long)before_snd, (unsigned long)after_snd);
- }
-
SAFE_MSGRCV(queue_id, &rcv_buf, MSGSIZE, 1, 0);
}
static void setup(void)
{
msgkey = GETIPCKEY();
+
queue_id = SAFE_MSGGET(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW);
- pid = getpid();
}
static void cleanup(void)
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
index ace32cdaa..e169831e0 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
@@ -80,7 +80,7 @@ static void do_test(unsigned int n)
_exit(0);
}
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
+ TST_PROCESS_STATE_WAIT(pid, 'S');
SAFE_KILL(pid, SIGHUP);
tst_reap_children();
}
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
index 9f462b672..e7855e844 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
@@ -57,7 +57,7 @@ static void do_test(void)
_exit(0);
}
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
+ TST_PROCESS_STATE_WAIT(pid, 'S');
SAFE_MSGCTL(queue_id, IPC_RMID, NULL);
diff --git a/testcases/kernel/syscalls/ipc/msgstress/Makefile b/testcases/kernel/syscalls/ipc/msgstress/Makefile
index b821bda01..4472eeb1c 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgstress/Makefile
@@ -1,12 +1,29 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpipc
-
include $(top_srcdir)/include/mk/testcases.mk
-LTPLDLIBS += -lltpipc
+LIBMSGCTL := $(LIBDIR)/libmsgctl.a
+LDLIBS += -lmsgctl
+
+MAKE_DEPS := $(LIBMSGCTL)
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
index 0a660c042..7117e3831 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress01.c
@@ -39,7 +39,7 @@
#include <sys/msg.h>
#include "test.h"
#include "ipcmsg.h"
-#include "libmsgctl.h"
+#include "../lib/libmsgctl.h"
char *TCID = "msgstress01";
int TST_TOTAL = 1;
diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress02.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress02.c
index e15131043..43982bdc2 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress02.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress02.c
@@ -37,7 +37,7 @@
#include <unistd.h>
#include "test.h"
#include "ipcmsg.h"
-#include "libmsgctl.h"
+#include "../lib/libmsgctl.h"
char *TCID = "msgstress02";
int TST_TOTAL = 1;
diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
index 294b401b1..de4b459a1 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
@@ -40,7 +40,7 @@
#include <sys/msg.h>
#include "test.h"
#include "ipcmsg.h"
-#include "libmsgctl.h"
+#include "../lib/libmsgctl.h"
char *TCID = "msgstress03";
int TST_TOTAL = 1;
diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c
index f1c124990..81383d6c8 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress04.c
@@ -38,7 +38,7 @@
#include <unistd.h>
#include "test.h"
#include "ipcmsg.h"
-#include "libmsgctl.h"
+#include "../lib/libmsgctl.h"
char *TCID = "msgstress04";
int TST_TOTAL = 1;
diff --git a/testcases/kernel/syscalls/ipc/semctl/.gitignore b/testcases/kernel/syscalls/ipc/semctl/.gitignore
index 87d839336..b6899acf5 100644
--- a/testcases/kernel/syscalls/ipc/semctl/.gitignore
+++ b/testcases/kernel/syscalls/ipc/semctl/.gitignore
@@ -5,5 +5,3 @@
/semctl05
/semctl06
/semctl07
-/semctl08
-/semctl09
diff --git a/testcases/kernel/syscalls/ipc/semctl/Makefile b/testcases/kernel/syscalls/ipc/semctl/Makefile
index 42d00f1cd..f467389b9 100644
--- a/testcases/kernel/syscalls/ipc/semctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/semctl/Makefile
@@ -1,13 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpipc ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-semctl06: LTPLDLIBS = -lltpipc
-semctl02 semctl03 semctl04 semctl05 semctl07 semctl08 semctl09: LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl01.c b/testcases/kernel/syscalls/ipc/semctl/semctl01.c
index b12385970..2f443db89 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl01.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl01.c
@@ -1,162 +1,429 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+
+/*
+ * NAME
+ * semctl01.c
*
- * Test the 13 possible semctl() commands
+ * DESCRIPTION
+ * semctl01 - test the 13 possible semctl() commands
+ *
+ * ALGORITHM
+ * create a semaphore set with read and alter permissions
+ * loop if that option was specified
+ * loop through the test cases
+ * do any setup required for the test case
+ * make the semctl() call using the TEST() macro
+ * check the return code
+ * if failure, issue a FAIL message.
+ * otherwise,
+ * if doing functionality testing
+ * call the appropriate test function
+ * if correct,
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
*/
+
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
-#include <stdlib.h>
-#include "tst_safe_sysv_ipc.h"
-#include "tst_test.h"
-#include "lapi/sem.h"
-#include "libnewipc.h"
+#endif
+#include <sys/wait.h>
+#include "ipcsem.h"
+#include "safe_macros.h"
-#define INCVAL 2
-#define NEWMODE 066
-#define NCHILD 5
-#define SEMUN_CAST (union semun)
+char *TCID = "semctl01";
-static int sem_id = -1;
+static int sem_id_1 = -1;
static int sem_index;
+
+/*
+ * These are the various setup and check functions for the 10 different
+ * commands that are available for the semctl() call.
+ */
+static void func_stat(void);
+static void set_setup(void), func_set(void);
+static void func_gall(void);
+static void cnt_setup(int), func_cnt(int);
+static void pid_setup(void), func_pid(int);
+static void func_gval(int);
+static void sall_setup(void), func_sall(void);
+static void func_sval(void);
+static void func_rmid(void);
+static void child_cnt(void);
+static void child_pid(void);
+static void func_iinfo(int);
+static void func_sinfo(void);
+static void func_sstat(int);
+
static struct semid_ds buf;
static struct seminfo ipc_buf;
static unsigned short array[PSEMS];
static struct sembuf sops;
+
+#define INCVAL 2
+#define NEWMODE 066
+#define NCHILD 5
+#define SEM2 2
+#define SEM4 4
+#define ONE 1
+#ifdef _XLC_COMPILER
+#define SEMUN_CAST
+#else
+#define SEMUN_CAST (union semun)
+#endif
+
static int pid_arr[NCHILD];
+#ifdef UCLINUX
+#define PIPE_NAME "semctl01"
+static char *argv0;
+static int sem_op;
+#endif
+
+static struct test_case_t {
+ int *semid;
+ int semnum;
+ int cmd;
+ void (*func_test) ();
+ union semun arg;
+ void (*func_setup) ();
+} TC[] = {
+ {&sem_id_1, 0, IPC_STAT, func_stat, SEMUN_CAST & buf, NULL},
+ {&sem_id_1, 0, IPC_SET, func_set, SEMUN_CAST & buf, set_setup},
+ {&sem_id_1, 0, GETALL, func_gall, SEMUN_CAST array, NULL},
+ {&sem_id_1, SEM4, GETNCNT, func_cnt, SEMUN_CAST & buf, cnt_setup},
+ {&sem_id_1, SEM2, GETPID, func_pid, SEMUN_CAST & buf, pid_setup},
+ {&sem_id_1, SEM2, GETVAL, func_gval, SEMUN_CAST & buf, NULL},
+ {&sem_id_1, SEM4, GETZCNT, func_cnt, SEMUN_CAST & buf, cnt_setup},
+ {&sem_id_1, 0, SETALL, func_sall, SEMUN_CAST array, sall_setup},
+ {&sem_id_1, SEM4, SETVAL, func_sval, SEMUN_CAST INCVAL, NULL},
+ {&sem_id_1, 0, IPC_INFO, func_iinfo, SEMUN_CAST & ipc_buf, NULL},
+ {&sem_id_1, 0, SEM_INFO, func_sinfo, SEMUN_CAST & ipc_buf, NULL},
+ {&sem_index, 0, SEM_STAT, func_sstat, SEMUN_CAST & buf, NULL},
+ {&sem_id_1, 0, IPC_RMID, func_rmid, SEMUN_CAST & buf, NULL},
+};
+
+int TST_TOTAL = ARRAY_SIZE(TC);
+
static void kill_all_children(void)
{
- int j;
+ int j, status;
+
+ for (j = 0; j < NCHILD; j++) {
+ SAFE_KILL(cleanup, pid_arr[j], SIGKILL);
+ }
+
+ /*
+ * make sure children finished before we proceed with next testcase
+ */
+ for (j = 0; j < NCHILD; j++) {
+ SAFE_WAIT(cleanup, &status);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int lc;
+ int i;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+#ifdef UCLINUX
+ argv0 = argv[0];
+ maybe_run_child(&child_pid, "nd", 1, &sem_id_1);
+ maybe_run_child(&child_cnt, "ndd", 2, &sem_id_1, &sem_op);
+#endif
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /*
+ * Set up any conditions if needed
+ */
+ if (TC[i].func_setup != NULL) {
+ /* call the setup function */
+ switch (TC[i].cmd) {
+ case GETNCNT:
+ (*TC[i].func_setup) (-ONE);
+ break;
+ case GETZCNT:
+ (*TC[i].func_setup) (0);
+ break;
+ default:
+ (*TC[i].func_setup) ();
+ break;
+ }
+ }
+
+ TEST(semctl(*(TC[i].semid), TC[i].semnum, TC[i].cmd,
+ TC[i].arg));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "%s call failed - errno = %d "
+ ": %s", TCID, TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ /*
+ * call the appropriate test function
+ * and pass the return value where it
+ * is needed to perform certain tests.
+ */
+ switch (TC[i].cmd) {
+ case GETNCNT:
+ case GETZCNT:
+ case GETPID:
+ case GETVAL:
+ case IPC_INFO:
+ case SEM_STAT:
+ (*TC[i].func_test) (TEST_RETURN);
+ break;
+ default:
+ (*TC[i].func_test) ();
+ break;
+ }
+ }
+
+ /*
+ * If testing GETNCNT or GETZCNT, clean up the children.
+ */
+ switch (TC[i].cmd) {
+ case GETNCNT:
+ case GETZCNT:
+ kill_all_children();
+ break;
+ }
+ }
+ /*
+ * recreate the semaphore resource if looping
+ */
+ if (TEST_LOOPING(lc)) {
+ sem_id_1 = semget(semkey, PSEMS,
+ IPC_CREAT | IPC_EXCL | SEM_RA);
+ if (sem_id_1 == -1)
+ tst_brkm(TBROK, cleanup,
+ "couldn't recreate " "semaphore");
+ }
+ }
- for (j = 0; j < NCHILD; j++)
- SAFE_KILL(pid_arr[j], SIGKILL);
+ cleanup();
- for (j = 0; j < NCHILD; j++)
- SAFE_WAIT(NULL);
+ tst_exit();
}
+/*
+ * func_stat() - check the functionality of the IPC_STAT command with semctl()
+ */
static void func_stat(void)
{
+ /* check the number of semaphores and the ipc_perm.mode value */
if (buf.sem_nsems == PSEMS && buf.sem_perm.mode == (SEM_RA))
- tst_res(TPASS, "buf.sem_nsems and buf.sem_perm.mode are correct");
+ tst_resm(TPASS, "buf.sem_nsems and buf.sem_perm.mode"
+ " are correct");
else
- tst_res(TFAIL, "semaphore STAT info is incorrect");
+ tst_resm(TFAIL, "semaphore STAT info is incorrect");
}
+/*
+ * set_setup() - set up for the IPC_SET command with semctl()
+ */
static void set_setup(void)
{
+ /* set up a new mode for the semaphore set */
buf.sem_perm.mode = SEM_RA | NEWMODE;
}
+/*
+ * func_set() - check the functionality of the IPC_SET command with semctl()
+ */
static void func_set(void)
{
- SAFE_SEMCTL(sem_id, 0, IPC_STAT, (union semun)&buf);
+ /* first stat the semaphore to get the new data */
+ if (semctl(sem_id_1, 0, IPC_STAT, (union semun)&buf) == -1) {
+ tst_resm(TBROK, "stat failed in func_set()");
+ return;
+ }
+ /* check that the new mode is what we set */
if (buf.sem_perm.mode == (SEM_RA | NEWMODE))
- tst_res(TPASS, "buf.sem_perm.mode is correct");
+ tst_resm(TPASS, "buf.sem_perm.mode is correct");
else
- tst_res(TFAIL, "semaphore mode info is incorrect");
+ tst_resm(TFAIL, "semaphore mode info is incorrect");
}
+/*
+ * func_gall() - check the functionality of the GETALL command with semctl()
+ */
static void func_gall(void)
{
int i;
+ /* the initial value of the primitive semaphores should be zero */
for (i = 0; i < PSEMS; i++) {
if (array[i] != 0) {
- tst_res(TFAIL, "semaphore %d has unexpected value", i);
+ tst_resm(TFAIL, "semaphore %d has unexpected value", i);
return;
}
}
- tst_res(TPASS, "semaphores have expected values");
-}
-
-static void child_cnt(void)
-{
- sops.sem_num = 4;
- sops.sem_flg = 0;
-
- /*
- * Do a semop that will cause the child to sleep.
- * The child process will be killed in the func_ncnt
- * routine which should cause an error to be return
- * by the semop() call.
- */
- if (semop(sem_id, &sops, 1) != -1)
- tst_brk(TBROK, "semop succeeded - cnt_setup");
+ tst_resm(TPASS, "semaphores have expected values");
}
+/*
+ * cnt_setup() - set up for the GETNCNT and GETZCNT commands with semctl()
+ */
static void cnt_setup(int opval)
{
int pid, i;
- sops.sem_num = 4;
+ sops.sem_num = SEM4;
sops.sem_flg = 0;
+
/*
* if seting up for GETZCNT, the semaphore value needs to be positive
*/
if (opval == 0) {
- sops.sem_op = 1;
- SAFE_SEMOP(sem_id, &sops, 1);
+ /* initialize the semaphore value to ONE */
+ sops.sem_op = ONE;
+ if (semop(sem_id_1, &sops, 1) == -1)
+ tst_brkm(TBROK, cleanup, "semop #1 failed - cnt_setup");
}
+ /* set the correct operation */
sops.sem_op = opval;
for (i = 0; i < NCHILD; i++) {
- pid = SAFE_FORK();
+ /* fork five children to wait */
+ pid = FORK_OR_VFORK();
+ if (pid == -1)
+ tst_brkm(TBROK, cleanup, "fork failed in cnt_setup");
+
if (pid == 0) {
+#ifdef UCLINUX
+ sem_op = sops.sem_op;
+ if (self_exec(argv0, "ndd", 2, sem_id_1, sem_op) < 0)
+ tst_brkm(TBROK, cleanup, "self_exec failed "
+ "in cnt_setup");
+#else
child_cnt();
+#endif
} else {
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
+ TST_PROCESS_STATE_WAIT(cleanup, pid, 'S');
+ /* save the pid so we can kill it later */
pid_arr[i] = pid;
}
}
}
-static void func_cnt(int rval)
+static void child_cnt(void)
{
- if (rval == NCHILD)
- tst_res(TPASS, "number of sleeping processes is correct");
- else
- tst_res(TFAIL, "number of sleeping processes is not correct");
-}
+#ifdef UCLINUX
+ sops.sem_op = (short int)sem_op;
+#endif
-static void child_pid(void)
-{
- sops.sem_num = 2;
- sops.sem_op = 1;
+ sops.sem_num = SEM4;
sops.sem_flg = 0;
+
/*
- * Do a semop that will increment the semaphore.
+ * Do a semop that will cause the child to sleep.
+ * The child process will be killed in the func_ncnt
+ * routine which should cause an error to be return
+ * by the semop() call.
*/
- SAFE_SEMOP(sem_id, &sops, 1);
+ if (semop(sem_id_1, &sops, 1) != -1)
+ tst_resm(TBROK, "semop succeeded - cnt_setup");
+
exit(0);
}
+/*
+ * func_cnt() - check the functionality of the GETNCNT and GETZCNT commands
+ * with semctl()
+ */
+static void func_cnt(int rval)
+{
+
+ if (rval == NCHILD)
+ tst_resm(TPASS, "number of sleeping processes is correct");
+ else
+ tst_resm(TFAIL, "number of sleeping processes is not correct");
+}
+
+/*
+ * pid_setup() - set up for the GETPID command with semctl()
+ */
static void pid_setup(void)
{
int pid;
- pid = SAFE_FORK();
- if (pid == 0) {
+ /*
+ * Fork a child to do a semop that will pass.
+ */
+ pid = FORK_OR_VFORK();
+ if (pid == -1)
+ tst_brkm(TBROK, cleanup, "fork failed in pid_setup()");
+
+ if (pid == 0) { /* child */
+#ifdef UCLINUX
+ if (self_exec(argv0, "nd", 1, sem_id_1) < 0)
+ tst_brkm(TBROK, cleanup, "self_exec failed "
+ "in pid_setup()");
+#else
child_pid();
+#endif
} else {
- pid_arr[2] = pid;
- TST_PROCESS_STATE_WAIT(pid, 'Z', 0);
+ pid_arr[SEM2] = pid;
+ TST_PROCESS_STATE_WAIT(cleanup, pid, 'Z');
}
}
+static void child_pid(void)
+{
+ sops.sem_num = SEM2;
+ sops.sem_op = ONE;
+ sops.sem_flg = 0;
+ /*
+ * Do a semop that will increment the semaphore.
+ */
+ if (semop(sem_id_1, &sops, 1) == -1)
+ tst_resm(TBROK, "semop failed - pid_setup");
+ exit(0);
+}
+
+/*
+ * func_pid() - check the functionality of the GETPID command with semctl()
+ */
static void func_pid(int rval)
{
- if (rval == pid_arr[2])
- tst_res(TPASS, "last pid value is correct");
+ /* compare the rval (pid) to the saved pid from the setup */
+ if (rval == pid_arr[SEM2])
+ tst_resm(TPASS, "last pid value is correct");
else
- tst_res(TFAIL, "last pid value is not correct");
+ tst_resm(TFAIL, "last pid value is not correct");
}
+/*
+ * func_gval() - check the functionality of the GETVAL command with semctl()
+ */
static void func_gval(int rval)
{
/*
@@ -164,153 +431,142 @@ static void func_gval(int rval)
* to ONE as it was set in the last test (GETPID).
*/
if (rval == 1)
- tst_res(TPASS, "semaphore value is correct");
+ tst_resm(TPASS, "semaphore value is correct");
else
- tst_res(TFAIL, "semaphore value is not correct");
+ tst_resm(TFAIL, "semaphore value is not correct");
}
+/*
+ * all_setup() - set up for the SETALL command with semctl()
+ */
static void sall_setup(void)
{
int i;
for (i = 0; i < PSEMS; i++) {
+ /* initialize the array values to 3 */
array[i] = 3;
}
}
+/*
+ * func_sall() - check the functionality of the SETALL command with semctl()
+ */
static void func_sall(void)
{
int i;
unsigned short rarray[PSEMS];
- SAFE_SEMCTL(sem_id, 0, GETALL, (union semun)rarray);
+ /*
+ * do a GETALL and compare the values to those set above
+ */
+
+ if (semctl(sem_id_1, 0, GETALL, (union semun)rarray) == -1)
+ tst_brkm(TBROK, cleanup, "semctl failed in func_sall");
+
for (i = 0; i < PSEMS; i++) {
if (array[i] != rarray[i]) {
- tst_res(TFAIL, "semaphore values are not correct");
+ tst_resm(TFAIL, "semaphore values are not correct");
return;
}
}
- tst_res(TPASS, "semaphore values are correct");
+ tst_resm(TPASS, "semaphore values are correct");
}
+/*
+ * func_sval() - check the functionality of the SETVAL command with semctl()
+ */
static void func_sval(void)
{
int semv;
union semun arr;
- semv = SAFE_SEMCTL(sem_id, 4, GETVAL, arr);
+ /*
+ * do a GETVAL and compare it to the value set above
+ */
+
+ semv = semctl(sem_id_1, SEM4, GETVAL, arr);
+ if (semv == -1)
+ tst_brkm(TBROK, cleanup, "semctl failed in func_sval");
+
if (semv != INCVAL)
- tst_res(TFAIL, "semaphore value is not what was set");
+ tst_resm(TFAIL, "semaphore value is not what was set");
else
- tst_res(TPASS, "semaphore value is correct");
+ tst_resm(TPASS, "semaphore value is correct");
}
+/*
+ * func_rmid() - check the functionality of the IPC_RMID command with semctl()
+ */
static void func_rmid(void)
{
- TST_EXP_FAIL(semop(sem_id, &sops, 1), EINVAL, "semaphore appears to be removed");
- sem_id = -1;
+
+ /*
+ * do a semop() - we should get EINVAL
+ */
+ if (semop(sem_id_1, &sops, 1) != -1)
+ tst_resm(TFAIL, "semop succeeded on expected fail");
+
+ if (errno != EINVAL)
+ tst_resm(TFAIL, "returned errno - %d - is not expected", errno);
+ else
+ tst_resm(TPASS, "semaphore appears to be removed");
+
+ sem_id_1 = -1;
}
static void func_iinfo(int hidx)
{
if (hidx >= 0) {
sem_index = hidx;
- tst_res(TPASS, "the highest index is correct");
+ tst_resm(TPASS, "the highest index is correct");
} else {
sem_index = 0;
- tst_res(TFAIL, "the highest index is incorrect");
+ tst_resm(TFAIL, "the highest index is incorrect");
}
}
static void func_sinfo(void)
{
if (ipc_buf.semusz < 1)
- tst_res(TFAIL, "number of semaphore sets is incorrect");
+ tst_resm(TFAIL, "number of semaphore sets is incorrect");
else
- tst_res(TPASS, "number of semaphore sets is correct");
+ tst_resm(TPASS, "number of semaphore sets is correct");
}
static void func_sstat(int semidx)
{
if (semidx >= 0)
- tst_res(TPASS, "id of the semaphore set is correct");
+ tst_resm(TPASS, "id of the semaphore set is correct");
else
- tst_res(TFAIL, "id of the semaphore set is incorrect");
+ tst_resm(TFAIL, "id of the semaphore set is incorrect");
}
-static struct tcases {
- int *semid;
- int semnum;
- int cmd;
- void (*func_test) ();
- union semun arg;
- void (*func_setup) ();
-} tests[] = {
- {&sem_id, 0, IPC_STAT, func_stat, SEMUN_CAST & buf, NULL},
- {&sem_id, 0, IPC_SET, func_set, SEMUN_CAST & buf, set_setup},
- {&sem_id, 0, GETALL, func_gall, SEMUN_CAST array, NULL},
- {&sem_id, 4, GETNCNT, func_cnt, SEMUN_CAST & buf, cnt_setup},
- {&sem_id, 2, GETPID, func_pid, SEMUN_CAST & buf, pid_setup},
- {&sem_id, 2, GETVAL, func_gval, SEMUN_CAST & buf, NULL},
- {&sem_id, 4, GETZCNT, func_cnt, SEMUN_CAST & buf, cnt_setup},
- {&sem_id, 0, SETALL, func_sall, SEMUN_CAST array, sall_setup},
- {&sem_id, 4, SETVAL, func_sval, SEMUN_CAST INCVAL, NULL},
- {&sem_id, 0, IPC_INFO, func_iinfo, SEMUN_CAST & ipc_buf, NULL},
- {&sem_id, 0, SEM_INFO, func_sinfo, SEMUN_CAST & ipc_buf, NULL},
- {&sem_index, 0, SEM_STAT, func_sstat, SEMUN_CAST & buf, NULL},
- {&sem_id, 0, IPC_RMID, func_rmid, SEMUN_CAST & buf, NULL},
-};
-
-static void verify_semctl(unsigned int n)
+void setup(void)
{
- struct tcases *tc = &tests[n];
- int rval;
-
- if (sem_id == -1)
- sem_id = SAFE_SEMGET(IPC_PRIVATE, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
- if (tc->func_setup) {
- switch (tc->cmd) {
- case GETNCNT:
- tc->func_setup(-1);
- break;
- case GETZCNT:
- tc->func_setup(0);
- break;
- default:
- tc->func_setup();
- break;
- }
- }
- rval = SAFE_SEMCTL(*(tc->semid), tc->semnum, tc->cmd, tc->arg);
- switch (tc->cmd) {
- case GETNCNT:
- case GETZCNT:
- case GETPID:
- case GETVAL:
- case IPC_INFO:
- case SEM_STAT:
- tc->func_test(rval);
- break;
- default:
- tc->func_test();
- break;
- }
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ TST_CHECKPOINT_INIT(tst_rmdir);
- if (tc->cmd == GETNCNT || tc->cmd == GETZCNT)
- kill_all_children();
+ /* get an IPC resource key */
+ semkey = getipckey();
+
+ /* create a semaphore set with read and alter permissions */
+ sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
+ if (sem_id_1 == -1)
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
}
-static void cleanup(void)
+void cleanup(void)
{
- if (sem_id >= 0)
- SAFE_SEMCTL(sem_id, 0, IPC_RMID);
-}
+ /* if it exists, remove the semaphore resource */
+ rm_sema(sem_id_1);
-static struct tst_test test = {
- .cleanup = cleanup,
- .test = verify_semctl,
- .tcnt = ARRAY_SIZE(tests),
- .forks_child = 1,
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl02.c b/testcases/kernel/syscalls/ipc/semctl/semctl02.c
index 3134dde57..1fcdd1dc6 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl02.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl02.c
@@ -1,55 +1,157 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * 03/2001 - Written by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+
+/*
+ * NAME
+ * semctl02.c
+ *
+ * DESCRIPTION
+ * semctl02 - test for EACCES error
+ *
+ * ALGORITHM
+ * create a semaphore set without read/alter permissions
+ * loop if that option was specified
+ * call semctl() attempting an IPC_STAT command
+ * check the errno value
+ * issue a PASS message if we get EACCES
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * semctl02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * Test for semctl() EACCES error.
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * none
*/
+#include "ipcsem.h"
#include <pwd.h>
-#include "tst_safe_sysv_ipc.h"
-#include "tst_test.h"
-#include "lapi/sem.h"
-#include "libnewipc.h"
-static int sem_id = -1;
+char *TCID = "semctl02";
+int TST_TOTAL = 1;
+
+char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
+
+int sem_id_1 = -1;
-static void verify_semctl(void)
+int main(int ac, char **av)
{
+ int lc;
+
struct semid_ds sem_ds;
union semun un_arg;
- un_arg.buf = &sem_ds;
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
- TST_EXP_FAIL(semctl(sem_id, 0, IPC_STAT, un_arg), EACCES,
- "semctl(IPC_STAT) with nobody user");
+ un_arg.buf = &sem_ds;
+
+ /*
+ * use the TEST macro to make the call
+ */
+
+ TEST(semctl(sem_id_1, 0, IPC_STAT, un_arg));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded when error expected");
+ continue;
+ }
+
+ switch (TEST_ERRNO) {
+ case EACCES:
+ tst_resm(TPASS, "expected failure - errno = %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ break;
+ default:
+ tst_resm(TFAIL, "unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ break;
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- static key_t semkey;
- struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
+ tst_require_root();
- SAFE_SETUID(ltpuser->pw_uid);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- semkey = GETIPCKEY();
+ TEST_PAUSE;
- sem_id = SAFE_SEMGET(semkey, PSEMS, IPC_CREAT | IPC_EXCL);
+ /* Switch to nobody user for correct error code collection */
+ ltpuser = getpwnam(nobody_uid);
+ if (setuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TINFO, "setuid failed to "
+ "to set the effective uid to %d", ltpuser->pw_uid);
+ perror("setuid");
+ }
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ semkey = getipckey();
+
+ /* create a semaphore set without read or alter permissions */
+ if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
}
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
void cleanup(void)
{
- if (sem_id != -1)
- SAFE_SEMCTL(sem_id, 0, IPC_RMID);
-}
+ /* if it exists, remove the semaphore resouce */
+ rm_sema(sem_id_1);
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .test_all = verify_semctl,
-};
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl03.c b/testcases/kernel/syscalls/ipc/semctl/semctl03.c
index ed2a46b16..c1006509e 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl03.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl03.c
@@ -1,70 +1,175 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * semctl03.c
+ *
+ * DESCRIPTION
+ * semctl03 - test for EINVAL and EFAULT errors
+ *
+ * ALGORITHM
+ * create a semaphore set with read and alter permissions
+ * loop if that option was specified
+ * call semctl() using four different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EINVAL or EFAULT
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * semctl03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
* HISTORY
* 03/2001 - Written by Wayne Boyer
- */
-/*\
- * [Description]
*
- * Test for semctl() EINVAL and EFAULT errors
+ * RESTRICTIONS
+ * none
*/
-#include "tst_safe_sysv_ipc.h"
-#include "tst_test.h"
-#include "lapi/sem.h"
-#include "libnewipc.h"
+#include "ipcsem.h"
+
+#ifdef _XLC_COMPILER
+#define SEMUN_CAST
+#else
+#define SEMUN_CAST (union semun)
+#endif
+
+char *TCID = "semctl03";
+int TST_TOTAL = 4;
-static int sem_id = -1;
-static int bad_id = -1;
+#ifdef _XLC_COMPILER
+#define SEMUN_CAST
+#else
+#define SEMUN_CAST (union semun)
+#endif
-static struct semid_ds sem_ds;
-static union semun sem_un = {.buf = &sem_ds};
-static void *semds_ptr = &sem_un;
-static void *bad_ptr;
+int sem_id_1 = -1;
+int bad_id = -1;
-static struct tcases {
+struct semid_ds sem_ds;
+
+struct test_case_t {
int *sem_id;
int ipc_cmd;
- void **buf;
+ union semun arg;
int error;
- char *message;
-} tests[] = {
- {&sem_id, -1, &semds_ptr, EINVAL, "invalid IPC command"},
- {&bad_id, IPC_STAT, &semds_ptr, EINVAL, "invalid sem id"},
- {&sem_id, GETALL, &bad_ptr, EFAULT, "invalid union arg"},
- {&sem_id, IPC_SET, &bad_ptr, EFAULT, "invalid union arg"}
+} TC[] = {
+ /* EINVAL - the IPC command is not valid */
+ {
+ &sem_id_1, -1, SEMUN_CAST & sem_ds, EINVAL},
+ /* EINVAL - the semaphore ID is not valid */
+ {
+ &bad_id, IPC_STAT, SEMUN_CAST & sem_ds, EINVAL},
+ /* EFAULT - the union arg is invalid when expecting "ushort *array" */
+ {
+ &sem_id_1, GETALL, SEMUN_CAST - 1, EFAULT},
+ /* EFAULT - the union arg is invalid when expecting */
+ /* "struct semid_ds *buf */
+ {
+ &sem_id_1, IPC_SET, SEMUN_CAST - 1, EFAULT}
};
-static void verify_semctl(unsigned int n)
+int main(int ac, char **av)
{
- struct tcases *tc = &tests[n];
+ int lc;
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
- TST_EXP_FAIL(semctl(*(tc->sem_id), 0, tc->ipc_cmd, *(tc->buf)),
- tc->error, "semctl() with %s", tc->message);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ TEST(semctl(*(TC[i].sem_id), 0, TC[i].ipc_cmd,
+ TC[i].arg));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = %d"
+ " : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- static key_t semkey;
- semkey = GETIPCKEY();
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- sem_id = SAFE_SEMGET(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
+ TEST_PAUSE;
- bad_ptr = tst_get_bad_addr(NULL);
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ semkey = getipckey();
+
+ /* create a semaphore set with read and alter permissions */
+ if ((sem_id_1 =
+ semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
}
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
void cleanup(void)
{
- if (sem_id != -1)
- SAFE_SEMCTL(sem_id, 0, IPC_RMID);
-}
+ /* if it exists, remove the semaphore resouce */
+ rm_sema(sem_id_1);
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_semctl,
- .tcnt = ARRAY_SIZE(tests),
-};
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl04.c b/testcases/kernel/syscalls/ipc/semctl/semctl04.c
index 015850a3b..a08db1c5c 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl04.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl04.c
@@ -1,87 +1,200 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * HISTORY
- * 03/2001 - Written by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+
+/*
+ * NAME
+ * semctl04.c
*
- * Test for semctl() EPERM error
+ * DESCRIPTION
+ * semctl04 - test for EPERM error
*
- * Runs IPC_SET and IPC_RMID from unprivileged child process.
+ * ALGORITHM
+ * create a semaphore set without read or alter permissions
+ * get the user id for "nobody"
+ * fork a child process
+ * if child
+ * set the ID of the child process to that of "nobody"
+ * loop if that option was specified
+ * call semctl() with two different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EPERM
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ * if parent
+ * wait for child to exit
+ * remove the semaphore set
*
+ * USAGE: <for command-line>
+ * semctl04 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * test must be run as root
*/
+#include "ipcsem.h"
+
#include <pwd.h>
#include <sys/wait.h>
-#include "tst_safe_sysv_ipc.h"
-#include "tst_test.h"
-#include "lapi/sem.h"
-#include "libnewipc.h"
-static uid_t ltp_uid;
-static int sem_id = -1;
+char *TCID = "semctl04";
+int TST_TOTAL = 2;
+
+int sem_id_1 = -1;
+
+uid_t ltp_uid;
+char *ltp_user = "nobody";
-static int tcases[] = { IPC_SET, IPC_RMID };
+int TC[] = { IPC_SET, IPC_RMID };
-static void do_child(void)
+int main(int ac, char **av)
{
- int i;
- union semun arg;
- struct semid_ds perm;
+ pid_t pid;
+ void do_child(void);
- for (i = 0; i < 2; i++) {
- if (tcases[i] == IPC_SET) {
- arg.buf = &perm;
- memset(&perm, 0, sizeof(perm));
- perm.sem_perm.uid = getuid() + 1;
- perm.sem_perm.gid = getgid() + 1;
- perm.sem_perm.mode = 0666;
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ if ((pid = FORK_OR_VFORK()) == -1) {
+ tst_brkm(TBROK, cleanup, "could not fork");
+ }
+
+ if (pid == 0) { /* child */
+ /* set the user ID of the child to the non root user */
+ if (setuid(ltp_uid) == -1) {
+ tst_resm(TBROK, "setuid() failed");
+ exit(1);
+ }
+
+ do_child();
+
+ } else {
+ if (waitpid(pid, NULL, 0) == -1) {
+ tst_resm(TBROK, "waitpid() failed");
+ tst_resm(TINFO, "waitpid() error = %d : %s", errno,
+ strerror(errno));
}
- TST_EXP_FAIL(semctl(sem_id, 0, tcases[i], arg), EPERM,
- "semctl() with nobody user in child");
+ /* if it exists, remove the semaphore resouce */
+ rm_sema(sem_id_1);
+
+ tst_rmdir();
}
+ cleanup();
+
+ tst_exit();
}
-static void verify_semctl(void)
+/*
+ * do_child() - make the TEST call as the child process
+ */
+void do_child(void)
{
- pid_t pid;
+ int lc;
+ int i;
+ union semun arg;
+ struct semid_ds perm;
- pid = SAFE_FORK();
+ /* The following loop checks looping state if -i option given */
- if (pid == 0) {
- SAFE_SETEUID(ltp_uid);
- do_child();
- } else {
- SAFE_WAITPID(pid, NULL, 0);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ if (TC[i] == IPC_SET) {
+ arg.buf = &perm;
+ memset(&perm, 0, sizeof perm);
+ perm.sem_perm.uid = getuid() + 1;
+ perm.sem_perm.gid = getgid() + 1;
+ perm.sem_perm.mode = 0666;
+ }
+
+ TEST(semctl(sem_id_1, 0, TC[i], arg));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ switch (TEST_ERRNO) {
+ case EPERM:
+ tst_resm(TPASS, "expected failure - errno ="
+ " %d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ break;
+ default:
+ tst_resm(TFAIL, "unexpected error "
+ "- %d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ break;
+ }
+ }
}
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- static key_t semkey;
+ tst_require_root();
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
- semkey = GETIPCKEY();
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
- sem_id = SAFE_SEMGET(semkey, PSEMS, IPC_CREAT | IPC_EXCL);
+ /* get an IPC resource key */
+ semkey = getipckey();
- struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
- ltp_uid = ltpuser->pw_uid;
+ /* create a semaphore set without read or alter permissions */
+ if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
+
+ /* get the userid for a non root user */
+ ltp_uid = getuserid(ltp_user);
}
-static void cleanup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- if (sem_id != -1)
- SAFE_SEMCTL(sem_id, 0, IPC_RMID);
-}
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .forks_child = 1,
- .needs_root = 1,
- .test_all = verify_semctl,
-};
+}
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl05.c b/testcases/kernel/syscalls/ipc/semctl/semctl05.c
index 69df08750..865305484 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl05.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl05.c
@@ -1,68 +1,178 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
/*
+ * NAME
+ * semctl05.c
+ *
+ * DESCRIPTION
+ * semctl05 - test for ERANGE error
+ *
+ * ALGORITHM
+ * create a semaphore set with read and alter permissions
+ * loop if that option was specified
+ * call semctl() with three different invalid cases
+ * check the errno value
+ * issue a PASS message if we get ERANGE
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * semctl05 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
* HISTORY
* 03/2001 - Written by Wayne Boyer
- */
-/*\
- * [Description]
*
- * Test for semctl() ERANGE error
+ * RESTRICTIONS
+ * none
*/
-#include "tst_safe_sysv_ipc.h"
-#include "tst_test.h"
-#include "lapi/sem.h"
-#include "libnewipc.h"
+#include "ipcsem.h"
+
+char *TCID = "semctl05";
+int TST_TOTAL = 3;
-static int sem_id = -1;
+#ifdef _XLC_COMPILER
+#define SEMUN_CAST
+#else
+#define SEMUN_CAST (union semun)
+#endif
+
+int sem_id_1 = -1;
#define BIGV 65535 /* a number ((2^16)-1) that should be larger */
/* than the maximum for a semaphore value */
+#ifdef _XLC_COMPILER
+#define SEMUN_CAST
+#else
+#define SEMUN_CAST (union semun)
+#endif
+
unsigned short big_arr[] = { BIGV, BIGV, BIGV, BIGV, BIGV, BIGV, BIGV, BIGV,
BIGV, BIGV
};
-static struct tcases {
+struct test_case_t {
int count;
int cmd;
union semun t_arg;
- char *message;
-} tests[] = {
- {5, SETVAL, {.val = -1}, "the value to set is less than zero"},
- {0, SETALL, {.array = big_arr}, "the value to set are too large"},
- {5, SETVAL, {.val = BIGV}, "the value to set is too large"}
+} TC[] = {
+ /* ERANGE - the value to set is less than zero - SETVAL */
+ {
+ 5, SETVAL, SEMUN_CAST - 1},
+ /* ERANGE - the values to set are too large, > semaphore max value */
+ {
+ 0, SETALL, SEMUN_CAST big_arr},
+ /* ERANGE - the value to set is too large, > semaphore max value */
+ {
+ 5, SETVAL, SEMUN_CAST BIGV}
};
-static void verify_semctl(unsigned int n)
+int main(int ac, char **av)
{
- struct tcases *tc = &tests[n];
+ int lc;
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
- TST_EXP_FAIL(semctl(sem_id, tc->count, tc->cmd, tc->t_arg), ERANGE,
- "semctl() with %s", tc->message);
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ TEST(semctl(sem_id_1, TC[i].count,
+ TC[i].cmd, TC[i].t_arg));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ switch (TEST_ERRNO) {
+ case ERANGE:
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ break;
+ default:
+ tst_resm(TFAIL, "unexpected error "
+ "- %d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ break;
+ }
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- static key_t semkey;
- semkey = GETIPCKEY();
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
- sem_id = SAFE_SEMGET(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ semkey = getipckey();
+
+ /* create a semaphore set with read and alter permissions */
+ if ((sem_id_1 =
+ semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
}
-static void cleanup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- if (sem_id != -1)
- SAFE_SEMCTL(sem_id, 0, IPC_RMID);
-}
+ /* if it exists, remove the semaphore resouce */
+ rm_sema(sem_id_1);
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_semctl,
- .tcnt = ARRAY_SIZE(tests),
-};
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl07.c b/testcases/kernel/syscalls/ipc/semctl/semctl07.c
index 1b203ef5e..5d7fad394 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl07.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl07.c
@@ -1,151 +1,176 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2002
*
- * HISTORY
- * 06/30/2001 Port to Linux nsharoff@us.ibm.com
- * 10/30/2002 Port to LTP dbarrera@us.ibm.com
- * 10/03/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
- * - Fix concurrency issue. A statically defined key was used. Leading
- * to conflict with other instances of the same test.
+ * Copyright (c) International Business Machines Corp., 2002
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+
+/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
+/* 10/30/2002 Port to LTP dbarrera@us.ibm.com */
+
+/*
+ * NAME
+ * semctl07
*
- * Basic tests for semctl().
+ * CALLS
+ * semctl(2) semget(2)
*
- * - semctl() with IPC_STAT where we check the semid_ds buf content
- * - semctl() with SETVAL and GETVAL
- * - semctl() with GETPID
- * - semctl() with GETNCNT and GETZCNT
+ * ALGORITHM
+ * Get and manipulate a set of semaphores.
+ *
+ * RESTRICTIONS
+ *
+ * HISTORY
+ * 10/03/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
+ * - Fix concurrency issue. A statically defined key was used. Leading
+ * to conflict with other instances of the same test.
*/
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-#include "lapi/sem.h"
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <signal.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/wait.h>
+#include "ipcsem.h"
+#include "test.h"
-static int semid = -1;
-static unsigned long nsems;
+void setup(void);
+void cleanup(void);
-static void verify_semctl(void)
+char *TCID = "semctl07";
+int TST_TOTAL = 1;
+
+key_t key;
+int semid = -1, nsems;
+
+int main(int argc, char *argv[])
{
int status;
struct semid_ds buf_ds;
union semun arg;
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
arg.buf = &buf_ds;
- TST_EXP_PASS(semctl(semid, 0, IPC_STAT, arg));
+ if ((status = semctl(semid, 0, IPC_STAT, arg)) == -1) {
+ tst_resm(TFAIL, "semctl() failed errno = %d", errno);
+ semctl(semid, 1, IPC_RMID, arg);
- if (arg.buf->sem_nsems != nsems) {
- tst_res(TFAIL, "sem_nsems = %lu, expected %lu",
- arg.buf->sem_nsems, nsems);
- } else {
- tst_res(TPASS, "sem_nsems = %lu", arg.buf->sem_nsems);
}
- if (arg.buf->sem_perm.uid != getuid()) {
- tst_res(TFAIL, "sem_perm.uid = %d, expected %d",
- arg.buf->sem_perm.uid, getuid());
- } else {
- tst_res(TPASS, "sem_perm.uid = %d", arg.buf->sem_perm.uid);
+ /*
+ * Check contents of semid_ds structure.
+ */
+
+ if (arg.buf->sem_nsems != nsems) {
+ tst_resm(TFAIL, "error: unexpected number of sems %lu",
+ arg.buf->sem_nsems);
+
}
+ if (arg.buf->sem_perm.uid != getuid()) {
+ tst_resm(TFAIL, "error: unexpected uid %d",
+ arg.buf->sem_perm.uid);
- if (arg.buf->sem_perm.gid != getgid()) {
- tst_res(TFAIL, "sem_perm.gid = %d, expected %d",
- arg.buf->sem_perm.gid, getgid());
- } else {
- tst_res(TPASS, "sem_perm.gid = %d", arg.buf->sem_perm.gid);
}
+ if (arg.buf->sem_perm.gid != getgid()) {
+ tst_resm(TFAIL, "error: unexpected gid %d",
+ arg.buf->sem_perm.gid);
- if (arg.buf->sem_perm.cuid != getuid()) {
- tst_res(TFAIL, "sem_perm.cuid = %d, expected %d",
- arg.buf->sem_perm.cuid, getuid());
- } else {
- tst_res(TPASS, "sem_perm.cuid = %d", arg.buf->sem_perm.cuid);
}
+ if (arg.buf->sem_perm.cuid != getuid()) {
+ tst_resm(TFAIL, "error: unexpected cuid %d",
+ arg.buf->sem_perm.cuid);
- if (arg.buf->sem_perm.cgid != getgid()) {
- tst_res(TFAIL, "sem_perm.cgid = %d, expected %d",
- arg.buf->sem_perm.cgid, getgid());
- } else {
- tst_res(TPASS, "sem_perm.cgid = %d", arg.buf->sem_perm.cgid);
}
+ if (arg.buf->sem_perm.cgid != getgid()) {
+ tst_resm(TFAIL, "error: unexpected cgid %d",
+ arg.buf->sem_perm.cgid);
- if ((status = semctl(semid, 0, GETVAL)) < 0)
- tst_res(TFAIL | TERRNO, "semctl(GETVAL)");
- else
- tst_res(TPASS, "semctl(GETVAL) succeeded");
+ }
+ if ((status = semctl(semid, 0, GETVAL, arg)) == -1) {
+ tst_resm(TFAIL, "semctl(GETVAL) failed errno = %d", errno);
+ }
arg.val = 1;
+ if ((status = semctl(semid, 0, SETVAL, arg)) == -1) {
+ tst_resm(TFAIL, "SEMCTL(SETVAL) failed errno = %d", errno);
- if ((status = semctl(semid, 0, SETVAL, arg)) < 0)
- tst_res(TFAIL | TERRNO, "SEMCTL(SETVAL)");
- else
- tst_res(TPASS, "semctl(SETVAL) succeeded");
-
- if ((status = semctl(semid, 0, GETVAL)) < 0)
- tst_res(TFAIL | TERRNO, "semctl(GETVAL)");
- else
- tst_res(TPASS, "semctl(GETVAL) succeeded");
+ }
+ if ((status = semctl(semid, 0, GETVAL, arg)) == -1) {
+ tst_resm(TFAIL, "semctl(GETVAL) failed errno = %d", errno);
+ }
if (status != arg.val) {
- tst_res(TFAIL, "semctl(GETVAL) returned %d expected %d",
- status, arg.val);
- } else {
- tst_res(TPASS, "semctl(GETVAL) returned %d", status);
- }
-
- if ((status = semctl(semid, 0, GETPID)) < 0)
- tst_res(TFAIL | TERRNO, "semctl(GETPID)");
- else
- tst_res(TPASS, "semctl(GETPID) succeeded");
-
- if (status != getpid()) {
- tst_res(TFAIL, "semctl(GETPID) returned %d expected %d",
- status, getpid());
- } else {
- tst_res(TPASS, "semctl(GETPID) returned %d", status);
- }
-
- if ((status = semctl(semid, 0, GETNCNT)) < 0)
- tst_res(TFAIL | TERRNO, "semctl(GETNCNT)");
- else
- tst_res(TPASS, "semctl(GETNCNT) succeeded");
-
- if (status != 0)
- tst_res(TFAIL, "semctl(GETNCNT) returned %d expected 0",
- status);
- else
- tst_res(TPASS, "semctl(GETNCNT) returned 0");
-
- if ((status = semctl(semid, 0, GETZCNT)) < 0)
- tst_res(TFAIL | TERRNO, "semctl(GETZCNT)");
- else
- tst_res(TPASS, "semctl(GETZCNT) succeeded");
-
- if (status != 0)
- tst_res(TFAIL, "error: unexpected semzcnt %d", status);
- else
- tst_res(TPASS, "semctl(GETZCNT) succeeded 0");
+ tst_resm(TFAIL, "error: unexpected value %d", status);
+
+ }
+ if ((status = semctl(semid, 0, GETPID, arg)) == -1) {
+ tst_resm(TFAIL, "semctl(GETPID) failed errno = %d", errno);
+
+ }
+ status = getpid();
+ if (status == 0) {
+ tst_resm(TFAIL, "error: unexpected pid %d", status);
+
+ }
+ if ((status = semctl(semid, 0, GETNCNT, arg)) == -1) {
+ tst_resm(TFAIL, "semctl(GETNCNT) failed errno = %d", errno);
+
+ }
+ if (status != 0) {
+ tst_resm(TFAIL, "error: unexpected semncnt %d", status);
+
+ }
+ if ((status = semctl(semid, 0, GETZCNT, arg)) == -1) {
+ tst_resm(TFAIL, "semctl(GETZCNT) failed errno = %d", errno);
+
+ }
+ if (status != 0) {
+ tst_resm(TFAIL, "error: unexpected semzcnt %d", status);
+
+ }
+
+ tst_resm(TPASS, "semctl07 ran successfully!");
+
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
- key_t key = GETIPCKEY();
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ key = getipckey();
nsems = 1;
- semid = SAFE_SEMGET(key, nsems, SEM_RA | IPC_CREAT);
+ if ((semid = semget(key, nsems, SEM_RA | IPC_CREAT)) == -1) {
+ tst_brkm(TFAIL, NULL, "semget() failed errno = %d", errno);
+ }
}
-static void cleanup(void)
+void cleanup(void)
{
- if (semid != -1)
- SAFE_SEMCTL(semid, 0, IPC_RMID);
+ rm_sema(semid);
+ tst_rmdir();
}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_semctl,
-};
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl08.c b/testcases/kernel/syscalls/ipc/semctl/semctl08.c
deleted file mode 100644
index 1878bd49d..000000000
--- a/testcases/kernel/syscalls/ipc/semctl/semctl08.c
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * Cross verify the _high fields being set to 0 by the kernel.
- */
-#include "lapi/sembuf.h"
-#include "lapi/sem.h"
-#include "tst_test.h"
-#include "libnewipc.h"
-
-#ifdef HAVE_SEMID64_DS_TIME_HIGH
-
-static void run(void)
-{
- struct semid64_ds buf_ds = {
- .sem_otime_high = 0x0A0A,
- .sem_ctime_high = 0x0A0A,
- };
- int semid;
- union semun arg;
- key_t key;
-
- /* get an IPC resource key */
- key = GETIPCKEY();
-
- semid = semget(key, 1, SEM_RA | IPC_CREAT);
- if (semid == -1)
- tst_brk(TBROK | TERRNO, "couldn't create semaphore");
-
- arg.buf = (struct semid_ds *)&buf_ds;
- TEST(semctl(semid, 0, IPC_STAT, arg));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "semctl() failed");
-
- if (buf_ds.sem_otime_high || buf_ds.sem_ctime_high)
- tst_res(TFAIL, "time_high fields aren't cleared by the kernel");
- else
- tst_res(TPASS, "time_high fields cleared by the kernel");
-
- if (semctl(semid, 0, IPC_RMID, arg) == -1)
- tst_res(TINFO, "WARNING: semaphore deletion failed.");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .needs_tmpdir = 1,
-};
-#else
-TST_TEST_TCONF("test requires struct semid64_ds to have the time_high fields");
-#endif
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl09.c b/testcases/kernel/syscalls/ipc/semctl/semctl09.c
deleted file mode 100644
index efbc67f33..000000000
--- a/testcases/kernel/syscalls/ipc/semctl/semctl09.c
+++ /dev/null
@@ -1,229 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Feiyu Zhu <zhufy.jy@cn.fujitsu.com>
- */
-/*\
- * [Description]
- *
- * Call semctl() with SEM_INFO flag and check that:
- *
- * * The returned index points to a valid SEM by calling SEM_STAT_ANY
- * * Also count that valid indexes < returned max index sums up to semusz
- * * And the data are consistent with /proc/sysvipc/sem
- *
- * There is a possible race between the call to the semctl() and read from the
- * proc file so this test cannot be run in parallel with any IPC testcases that
- * adds or removes semaphore set.
- *
- * Note what we create a semaphore set in the test setup to make sure
- * that there is at least one during the testrun.
- *
- * Also note that for SEM_INFO the members of the seminfo structure have
- * completely different meaning than their names seems to suggest.
- *
- * We also calling semctl() directly by syscall(), because of a glibc bug:
- *
- * semctl SEM_STAT_ANY fails to pass the buffer specified by the caller
- * to the kernel.
- *
- * https://sourceware.org/bugzilla/show_bug.cgi?id=26637
- */
-
-/*
- * The glibc bug was fixed in:
- *
- * * commit 574500a108be1d2a6a0dc97a075c9e0a98371aba
- * * Author: Dmitry V. Levin <ldv@altlinux.org>
- * * Date: Tue, 29 Sep 2020 17:10:20 +0000 (14:10 -0300)
- */
-
-#include <stdio.h>
-#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-#include "lapi/sem.h"
-#include "lapi/syscalls.h"
-
-static int sem_id = -1;
-static uid_t nobody_uid, root_uid;
-static union semun un;
-
-/*
- * Note: semctl man-pages may have wrong description. We should use sem_ds
- * struct(un.buf) instead of seminfo struct(un.__buf).
- */
-static inline int do_semctl(int semid, int semnum, int cmd)
-{
- struct semid_ds info;
-
- un.buf = &info;
-
- switch (tst_variant) {
- case 0:
- return tst_syscall(__NR_semctl, semid, semnum, cmd, un);
- case 1:
- return semctl(semid, semnum, cmd, un);
- }
- return -1;
-}
-
-static void test_info(void)
-{
- switch (tst_variant) {
- case 0:
- tst_res(TINFO, "Test SYS_semctl syscall");
- break;
- case 1:
- tst_res(TINFO, "Test libc semctl()");
- break;
- }
-}
-
-static struct tcases {
- uid_t *uid;
- char *desc;
-} tests[] = {
- {&nobody_uid, "with nobody user",},
- {&root_uid, "with root user",},
-};
-
-static void parse_proc_sysvipc(struct seminfo *info)
-{
- FILE *f = fopen("/proc/sysvipc/sem", "r");
- int semset_cnt = 0;
- int sem_cnt = 0;
-
- /* Eat header */
- for (;;) {
- int c = fgetc(f);
-
- if (c == '\n' || c == EOF)
- break;
- }
-
- int nsems;
- /*
- * Sum sem set, nsems for all elements listed, which should equal
- * the data returned in the seminfo structure.
- */
- while (fscanf(f, "%*i %*i %*i %i %*i %*i %*i %*i %*i %*i",
- &nsems) > 0){
- semset_cnt++;
- sem_cnt += nsems;
- }
-
- if (info->semusz != semset_cnt) {
- tst_res(TFAIL, "semusz = %i, expected %i",
- info->semusz, semset_cnt);
- } else {
- tst_res(TPASS, "semset_cnt = %i", semset_cnt);
- }
-
- if (info->semaem != sem_cnt) {
- tst_res(TFAIL, "semaem = %i, expected %i",
- info->semaem, sem_cnt);
- } else {
- tst_res(TPASS, "sen_cnt = %i", sem_cnt);
- }
-
- fclose(f);
-}
-
-static void verify_semctl(unsigned int n)
-{
- struct tcases *tc = &tests[n];
- int i, semid, cnt = 0;
- struct seminfo info;
- union semun arg;
-
- tst_res(TINFO, "Test SEM_STAT_ANY %s", tc->desc);
-
- SAFE_SETEUID(*tc->uid);
-
- arg.__buf = &info;
-
- TEST(semctl(sem_id, 0, SEM_INFO, arg));
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "semctl(sem_id, 0, SEM_INFO, ...)");
- return;
- }
-
- semid = do_semctl(TST_RET, 0, SEM_STAT_ANY);
-
- if (errno == EFAULT) {
- tst_res(TFAIL, "SEM_STAT_ANY doesn't pass the buffer "
- "specified by the caller to kernel");
- return;
- } else if (semid == -1) {
- tst_res(TFAIL | TERRNO, "SEM_INFO haven't returned a valid index");
- } else {
- tst_res(TPASS, "SEM_INFO returned valid index %li to semid %i",
- TST_RET, semid);
- }
-
- for (i = 0; i <= TST_RET; i++) {
- if ((do_semctl(i, 0, SEM_STAT_ANY)) != -1)
- cnt++;
- }
-
- if (cnt == info.semusz) {
- tst_res(TPASS, "Counted used = %i", cnt);
- } else {
- tst_res(TFAIL, "Counted used = %i, semuse = %i",
- cnt, info.semusz);
- }
-
- parse_proc_sysvipc(&info);
-}
-
-static void setup(void)
-{
- struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
-
- nobody_uid = ltpuser->pw_uid;
- root_uid = 0;
- test_info();
-
-#if !HAVE_DECL_SEM_STAT_ANY
- if (tst_variant == 1)
- tst_brk(TCONF, "libc does not support semctl(SEM_STAT_ANY)");
-#endif
-
- sem_id = SAFE_SEMGET(IPC_PRIVATE, 2, IPC_CREAT | 0600);
-
- TEST(do_semctl(sem_id, 0, SEM_STAT_ANY));
- if (TST_RET == -1) {
- if (TST_ERR == EFAULT)
- tst_brk(TFAIL,
- "SEM_STAT_ANY doesn't pass the buffer specified by the caller to kernel");
- if (TST_ERR == EINVAL)
- tst_brk(TCONF, "kernel doesn't support SEM_STAT_ANY");
- else
- tst_brk(TBROK | TTERRNO,
- "Current environment doesn't permit SEM_STAT_ANY");
- }
-}
-
-static void cleanup(void)
-{
- SAFE_SETEUID(root_uid);
-
- if (sem_id >= 0)
- SAFE_SEMCTL(sem_id, 0, IPC_RMID);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_semctl,
- .tcnt = ARRAY_SIZE(tests),
- .test_variants = 2,
- .needs_root = 1,
- .tags = (const struct tst_tag[]) {
- {"glibc-git", "574500a108be"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/ipc/semget/Makefile b/testcases/kernel/syscalls/ipc/semget/Makefile
index 26b9f264d..f467389b9 100644
--- a/testcases/kernel/syscalls/ipc/semget/Makefile
+++ b/testcases/kernel/syscalls/ipc/semget/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/semget/semget01.c b/testcases/kernel/syscalls/ipc/semget/semget01.c
index 217163b3a..a6cdd2d20 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget01.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget01.c
@@ -56,7 +56,7 @@
* none
*/
-#include "ipcsem.h"
+#include "../lib/ipcsem.h"
char *TCID = "semget01";
int TST_TOTAL = 1;
@@ -150,7 +150,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/semget/semget02.c b/testcases/kernel/syscalls/ipc/semget/semget02.c
index 4124514c2..af7797189 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget02.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget02.c
@@ -51,7 +51,7 @@
*/
#include <pwd.h>
-#include "ipcsem.h"
+#include "../lib/ipcsem.h"
char *TCID = "semget02";
int TST_TOTAL = 2;
@@ -138,7 +138,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/semget/semget03.c b/testcases/kernel/syscalls/ipc/semget/semget03.c
index 995b4bd3a..976c78a52 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget03.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget03.c
@@ -50,7 +50,7 @@
* none
*/
-#include "ipcsem.h"
+#include "../lib/ipcsem.h"
char *TCID = "semget03";
int TST_TOTAL = 1;
@@ -111,7 +111,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/semget/semget05.c b/testcases/kernel/syscalls/ipc/semget/semget05.c
index f801cb8ed..976769619 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget05.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget05.c
@@ -48,7 +48,7 @@
* none
*/
-#include "ipcsem.h"
+#include "../lib/ipcsem.h"
char *TCID = "semget05";
int TST_TOTAL = 1;
diff --git a/testcases/kernel/syscalls/ipc/semget/semget06.c b/testcases/kernel/syscalls/ipc/semget/semget06.c
index 52297c010..858006d80 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget06.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget06.c
@@ -50,7 +50,7 @@
* none
*/
-#include "ipcsem.h"
+#include "../lib/ipcsem.h"
char *TCID = "semget06";
int TST_TOTAL = 2;
@@ -121,7 +121,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/semop/.gitignore b/testcases/kernel/syscalls/ipc/semop/.gitignore
index bb57f08af..cc67b1862 100644
--- a/testcases/kernel/syscalls/ipc/semop/.gitignore
+++ b/testcases/kernel/syscalls/ipc/semop/.gitignore
@@ -1,3 +1,5 @@
/semop01
/semop02
/semop03
+/semop04
+/semop05
diff --git a/testcases/kernel/syscalls/ipc/semop/Makefile b/testcases/kernel/syscalls/ipc/semop/Makefile
index 6b2b26d05..f467389b9 100644
--- a/testcases/kernel/syscalls/ipc/semop/Makefile
+++ b/testcases/kernel/syscalls/ipc/semop/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/semop/semop.h b/testcases/kernel/syscalls/ipc/semop/semop.h
deleted file mode 100644
index 73ab9fbbc..000000000
--- a/testcases/kernel/syscalls/ipc/semop/semop.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#ifndef SEMOP_VAR__
-#define SEMOP_VAR__
-
-#include <sys/sem.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
-
-static inline int sys_semtimedop(int semid, struct sembuf *sops, size_t nsops,
- void *timeout)
-{
- return tst_syscall(__NR_semtimedop, semid, sops, nsops, timeout);
-}
-
-static inline int sys_semtimedop_time64(int semid, struct sembuf *sops,
- size_t nsops, void *timeout)
-{
- return tst_syscall(__NR_semtimedop_time64, semid, sops, nsops, timeout);
-}
-
-static struct time64_variants variants[] = {
- { .semop = semop, .ts_type = TST_LIBC_TIMESPEC, .desc = "semop: syscall"},
-
-#if (__NR_semtimedop != __LTP__NR_INVALID_SYSCALL)
- { .semtimedop = sys_semtimedop, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "semtimedop: syscall with old kernel spec"},
-#endif
-
-#if (__NR_semtimedop_time64 != __LTP__NR_INVALID_SYSCALL)
- { .semtimedop = sys_semtimedop_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "semtimedop: syscall time64 with kernel spec"},
-#endif
-};
-
-static inline int call_semop(struct time64_variants *tv, int semid,
- struct sembuf *sops, size_t nsops, void *timeout)
-{
- if (tv->semop)
- return tv->semop(semid, sops, nsops);
-
- return tv->semtimedop(semid, sops, nsops, timeout);
-}
-
-static inline void semop_supported_by_kernel(struct time64_variants *tv)
-{
- /* Check if the syscall is implemented on the platform */
- TEST(call_semop(tv, 0, NULL, 0, NULL));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
- tst_brk(TCONF, "Test not supported on kernel/platform");
-}
-
-#endif /* SEMOP_VAR__ */
diff --git a/testcases/kernel/syscalls/ipc/semop/semop01.c b/testcases/kernel/syscalls/ipc/semop/semop01.c
index 207263539..ea05c53eb 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop01.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop01.c
@@ -1,85 +1,143 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Test that semop() basic functionality is correct
*
- * Copyright (c) International Business Machines Corp., 2001
- * 03/2001 - Written by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * semop01.c
+ *
+ * DESCRIPTION
+ * semop01 - test that semop() basic functionality is correct
+ *
+ * ALGORITHM
+ * create a semaphore set and initialize some values
+ * loop if that option was specified
+ * call semop() to set values for the primitive semaphores
+ * check the return code
+ * if failure, issue a FAIL message.
+ * otherwise,
+ * if doing functionality testing
+ * get the semaphore values and compare with expected values
+ * if correct,
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * else issue a PASS message
+ * call cleanup
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
* 17/01/02 - Modified. Manoj Iyer, IBM Austin. TX. manjo@austin.ibm.com
+ * 4th argument to semctl() system call was modified according
+ * to man pages.
+ * In my opinion The test should not even have compiled but
+ * it was working due to some mysterious reason.
+ *
+ * RESTRICTIONS
+ * none
*/
-#include <stdlib.h>
-#include "tst_test.h"
-#include "libnewipc.h"
-#include "lapi/sem.h"
-#include "semop.h"
+#include "ipcsem.h"
-#define NSEMS 4
+#define NSEMS 4 /* the number of primitive semaphores to test */
-static int sem_id = -1;
-static key_t semkey;
+char *TCID = "semop01";
+int TST_TOTAL = 1;
-static unsigned short int sarr[PSEMS];
-static union semun get_arr = {.array = sarr};
-static struct sembuf sops[PSEMS];
-static struct tst_ts timeout;
+int sem_id_1 = -1; /* a semaphore set with read & alter permissions */
-static struct test_case_t {
- struct tst_ts *to;
-} tc[] = {
- {NULL},
- {&timeout}
-};
+union semun get_arr;
+struct sembuf sops[PSEMS];
-static void run(unsigned int n)
+int main(int ac, char **av)
{
- struct time64_variants *tv = &variants[tst_variant];
- union semun arr = { .val = 0 };
- int fail = 0;
+ int lc;
int i;
+ int fail = 0;
- TEST(call_semop(tv, sem_id, sops, NSEMS, tst_ts_get(tc[n].to)));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "semop() failed");
- return;
- }
-
- if (semctl(sem_id, 0, GETALL, get_arr) == -1)
- tst_brk(TBROK | TERRNO, "semctl(%i, 0, GETALL, ...)", sem_id);
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ TEST(semop(sem_id_1, sops, NSEMS));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "%s call failed - errno = %d : %s",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ /* get the values and make sure they */
+ /* are the same as what was set */
+ if (semctl(sem_id_1, 0, GETALL, get_arr) == -1) {
+ tst_brkm(TBROK, cleanup,
+ "semctl() failed in functional test");
+ }
+
+ for (i = 0; i < NSEMS; i++) {
+ if (get_arr.array[i] != i * i) {
+ fail = 1;
+ }
+ }
+ if (fail)
+ tst_resm(TFAIL,
+ "semaphore values are wrong");
+ else
+ tst_resm(TPASS,
+ "semaphore values are correct");
+ }
- for (i = 0; i < NSEMS; i++) {
- if (get_arr.array[i] != i * i) {
- fail = 1;
+ /*
+ * clean up things in case we are looping
+ */
+ union semun set_arr;
+ set_arr.val = 0;
+ for (i = 0; i < NSEMS; i++) {
+ if (semctl(sem_id_1, i, SETVAL, set_arr) == -1) {
+ tst_brkm(TBROK, cleanup, "semctl failed");
+ }
}
}
- if (fail)
- tst_res(TFAIL, "semaphore values are wrong");
- else
- tst_res(TPASS, "semaphore values are correct");
-
- for (i = 0; i < NSEMS; i++) {
- if (semctl(sem_id, i, SETVAL, arr) == -1)
- tst_brk(TBROK | TERRNO, "semctl(%i, %i, SETVAL, ...)", sem_id, i);
- }
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
- struct time64_variants *tv = &variants[tst_variant];
int i;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- semop_supported_by_kernel(tv);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- timeout.type = tv->ts_type;
- tst_ts_set_sec(&timeout, 0);
- tst_ts_set_nsec(&timeout, 10000);
+ TEST_PAUSE;
- semkey = GETIPCKEY();
+ tst_tmpdir();
- sem_id = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
- if (sem_id == -1)
- tst_brk(TBROK | TERRNO, "couldn't create semaphore in setup");
+ get_arr.array = malloc(sizeof(unsigned short int) * PSEMS);
+ if (get_arr.array == NULL)
+ tst_brkm(TBROK, cleanup, "malloc failed");
+
+ semkey = getipckey();
+
+ sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
+ if (sem_id_1 == -1)
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
for (i = 0; i < NSEMS; i++) {
sops[i].sem_num = i;
@@ -88,19 +146,11 @@ static void setup(void)
}
}
-static void cleanup(void)
+void cleanup(void)
{
- if (sem_id != -1) {
- if (semctl(sem_id, 0, IPC_RMID) == -1)
- tst_res(TWARN, "semaphore deletion failed.");
- }
-}
+ rm_sema(sem_id_1);
+
+ free(get_arr.array);
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/ipc/semop/semop02.c b/testcases/kernel/syscalls/ipc/semop/semop02.c
index d8181db17..f067229b1 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop02.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop02.c
@@ -1,177 +1,163 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * E2BIG - nsops is greater than max number of operations allowed per syscall
- * EACCESS - calling process does not have permission to alter semaphore
- * EFAULT - invalid address passed for sops
- * EINVAL - nonpositive nsops
- * EINVAL - negative semid
- * ERANGE - semop + semval > semvmx a maximal semaphore value
- * EFBIG - sem_num less than zero
- * EFBIG - sem_num > number of semaphores in a set
- * EAGAIN - semop = 0 for non-zero semaphore and IPC_NOWAIT passed in flags
- * EAGAIN - semop = -1 for zero semaphore and IPC_NOWAIT passed in flags
- * EAGAIN - semop = 0 and timeout happens
- * EAGAIN - semop = -1 and timeout happens
- * EFAULT - invalid timeout pointer
*
- * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * DESCRIPTION
+ * semop02 - test for E2BIG, EACCES, EFAULT, EINVAL and ERANGE errors
+ *
+ * HISTORY
* 03/2001 - Written by Wayne Boyer
- * 10/03/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
+ *
+ * 10/03/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
+ * - Fix concurrency issue. The second key used for this test could
+ * conflict with the key from another task.
*/
#define _GNU_SOURCE
#include <pwd.h>
-#include <sys/ipc.h>
-#include "tst_test.h"
-#include "libnewipc.h"
-#include "lapi/sem.h"
-#include "semop.h"
-
-static int valid_sem_id = -1;
-static int noperm_sem_id = -1;
-static int bad_sem_id = -1;
-static short sem_op_max, sem_op_1 = 1, sem_op_negative = -1, sem_op_zero = 0;
-static struct sembuf *faulty_buf;
-static struct tst_ts timeout;
-static struct tst_ts *valid_to = &timeout, *invalid_to;
-
-#define NSOPS 1
-#define BIGOPS 1024
-
-static struct test_case_t {
- int semtimedop_only;
+#include "test.h"
+#include "safe_macros.h"
+#include "ipcsem.h"
+
+char *TCID = "semop02";
+
+static void semop_verify(int i);
+int sem_id_1 = -1; /* a semaphore set with read & alter permissions */
+int sem_id_2 = -1; /* a semaphore set without read & alter permissions */
+int bad_id = -1;
+
+struct sembuf s_buf[PSEMS];
+
+int badbuf = -1;
+
+#define NSOPS 5 /* a resonable number of operations */
+#define BIGOPS 1024 /* a value that is too large for the number */
+ /* of semop operations that are permitted */
+struct test_case_t {
int *semid;
- struct sembuf **buf;
- short *sem_op;
- unsigned short ctl_sem_num;
- unsigned short sem_num;
- short sem_flg;
+ struct sembuf *t_sbuf;
unsigned t_ops;
- int arr_val;
- struct tst_ts **to;
int error;
-} tc[] = {
- {0, &valid_sem_id, NULL, &sem_op_1, 0, 0, 0, BIGOPS, 1, &valid_to, E2BIG},
- {0, &noperm_sem_id, NULL, &sem_op_1, 0, 0, 0, NSOPS, 1, &valid_to, EACCES},
- {0, &valid_sem_id, &faulty_buf, &sem_op_1, 0, 0, 0, NSOPS, 1, &valid_to, EFAULT},
- {0, &valid_sem_id, NULL, &sem_op_1, 0, 0, 0, 0, 1, &valid_to, EINVAL},
- {0, &bad_sem_id, NULL, &sem_op_1, 0, 0, 0, NSOPS, 1, &valid_to, EINVAL},
- {0, &valid_sem_id, NULL, &sem_op_max, 0, 0, 0, 1, 1, &valid_to, ERANGE},
- {0, &valid_sem_id, NULL, &sem_op_1, 0, -1, SEM_UNDO, 1, 1, &valid_to, EFBIG},
- {0, &valid_sem_id, NULL, &sem_op_1, 0, PSEMS + 1, SEM_UNDO, 1, 1, &valid_to, EFBIG},
- {0, &valid_sem_id, NULL, &sem_op_zero, 2, 2, IPC_NOWAIT, 1, 1, &valid_to, EAGAIN},
- {0, &valid_sem_id, NULL, &sem_op_negative, 2, 2, IPC_NOWAIT, 1, 0, &valid_to, EAGAIN},
- {1, &valid_sem_id, NULL, &sem_op_zero, 0, 0, SEM_UNDO, 1, 1, &valid_to, EAGAIN},
- {1, &valid_sem_id, NULL, &sem_op_negative, 0, 0, SEM_UNDO, 1, 0, &valid_to, EAGAIN},
- {1, &valid_sem_id, NULL, &sem_op_zero, 0, 0, SEM_UNDO, 1, 1, &invalid_to, EFAULT},
+} TC[] = {
+ {&sem_id_1, (struct sembuf *)&s_buf, BIGOPS, E2BIG},
+ {&sem_id_2, (struct sembuf *)&s_buf, NSOPS, EACCES},
+ {&sem_id_1, (struct sembuf *)-1, NSOPS, EFAULT},
+ {&sem_id_1, (struct sembuf *)&s_buf, 0, EINVAL},
+ {&bad_id, (struct sembuf *)&s_buf, NSOPS, EINVAL},
+ {&sem_id_1, (struct sembuf *)&s_buf, 1, ERANGE}
};
-static void setup(void)
+int TST_TOTAL = ARRAY_SIZE(TC);
+
+int main(int ac, char **av)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct passwd *ltpuser;
- key_t semkey;
- union semun arr;
- struct seminfo ipc_buf;
- void *faulty_address;
+ int lc;
+ int i;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- semop_supported_by_kernel(tv);
+ tst_parse_opts(ac, av, NULL, NULL);
- timeout.type = tv->ts_type;
- tst_ts_set_sec(&timeout, 0);
- tst_ts_set_nsec(&timeout, 10000);
+ setup();
- ltpuser = SAFE_GETPWNAM("nobody");
- SAFE_SETUID(ltpuser->pw_uid);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- semkey = GETIPCKEY();
+ for (i = 0; i < TST_TOTAL; i++)
+ semop_verify(i);
+ }
- valid_sem_id = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
- if (valid_sem_id == -1)
- tst_brk(TBROK | TERRNO, "couldn't create semaphore in setup");
+ cleanup();
+ tst_exit();
+}
- semkey = GETIPCKEY();
+void setup(void)
+{
+ char nobody_uid[] = "nobody";
+ struct passwd *ltpuser;
+ key_t semkey2;
+ struct seminfo ipc_buf;
+ union semun arr;
- noperm_sem_id = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL);
- if (noperm_sem_id == -1)
- tst_brk(TBROK | TERRNO, "couldn't create semaphore in setup");
+ tst_require_root();
- arr.__buf = &ipc_buf;
- if (semctl(valid_sem_id, 0, IPC_INFO, arr) == -1)
- tst_brk(TBROK | TERRNO, "semctl() IPC_INFO failed");
+ ltpuser = SAFE_GETPWNAM(NULL, nobody_uid);
+ SAFE_SETUID(NULL, ltpuser->pw_uid);
- sem_op_max = ipc_buf.semvmx;
- faulty_address = tst_get_bad_addr(NULL);
- invalid_to = faulty_address;
- faulty_buf = faulty_address;
-}
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
-static void run(unsigned int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- union semun arr = {.val = tc[i].arr_val};
- struct sembuf buf = {
- .sem_op = *tc[i].sem_op,
- .sem_flg = tc[i].sem_flg,
- .sem_num = tc[i].sem_num,
- };
- struct sembuf *ptr = &buf;
- void *to;
-
- if (tc[i].semtimedop_only && tv->semop) {
- tst_res(TCONF, "Test not supported for variant");
- return;
- }
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ semkey = getipckey();
- if (*tc[i].semid == valid_sem_id) {
- if (semctl(valid_sem_id, tc[i].ctl_sem_num, SETVAL, arr) == -1)
- tst_brk(TBROK | TERRNO, "semctl() SETVAL failed");
+ /* create a semaphore set with read and alter permissions */
+ sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
+ if (sem_id_1 == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "couldn't create semaphore in setup");
}
- if (tc[i].buf)
- ptr = *tc[i].buf;
+ /* Get an new IPC resource key. */
+ semkey2 = getipckey();
- if (*tc[i].to == invalid_to)
- to = invalid_to;
- else
- to = tst_ts_get(*tc[i].to);
+ /* create a semaphore set without read and alter permissions */
+ sem_id_2 = semget(semkey2, PSEMS, IPC_CREAT | IPC_EXCL);
+ if (sem_id_2 == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "couldn't create semaphore in setup");
+ }
- TEST(call_semop(tv, *(tc[i].semid), ptr, tc[i].t_ops, to));
+ arr.__buf = &ipc_buf;
+ if (semctl(sem_id_1, 0, IPC_INFO, arr) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "semctl() IPC_INFO failed");
+
+ /* for ERANGE errno test */
+ arr.val = 1;
+ s_buf[0].sem_op = ipc_buf.semvmx;
+ if (semctl(sem_id_1, 0, SETVAL, arr) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "semctl() SETVAL failed");
+}
+
+static void semop_verify(int i)
+{
+ TEST(semop(*(TC[i].semid), TC[i].t_sbuf, TC[i].t_ops));
- if (TST_RET != -1) {
- tst_res(TFAIL | TTERRNO, "call succeeded unexpectedly");
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TST_ERR == tc[i].error) {
- tst_res(TPASS | TTERRNO, "semop failed as expected");
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS | TTERRNO, "semop failed as expected");
} else {
- tst_res(TFAIL | TTERRNO,
- "semop failed unexpectedly; expected: %s",
- tst_strerrno(tc[i].error));
+ tst_resm(TFAIL | TTERRNO,
+ "semop failed unexpectedly; expected: "
+ "%d - %s", TC[i].error, strerror(TC[i].error));
}
}
-static void cleanup(void)
+void cleanup(void)
{
- if (valid_sem_id != -1) {
- if (semctl(valid_sem_id, 0, IPC_RMID) == -1)
- tst_res(TWARN, "semaphore deletion failed.");
- }
+ /* if they exist, remove the semaphore resources */
+ rm_sema(sem_id_1);
+ rm_sema(sem_id_2);
- if (noperm_sem_id != -1) {
- if (semctl(noperm_sem_id, 0, IPC_RMID) == -1)
- tst_res(TWARN, "semaphore deletion failed.");
- }
+ tst_rmdir();
}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/ipc/semop/semop03.c b/testcases/kernel/syscalls/ipc/semop/semop03.c
index 636b71531..a904e9943 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop03.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop03.c
@@ -1,138 +1,158 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * semop05 - test for EINTR and EIDRM errors
*
- * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * semop03.c
+ *
+ * DESCRIPTION
+ * semop03 - test for EFBIG error
+ *
+ * ALGORITHM
+ * create a semaphore set with read and alter permissions
+ * loop if that option was specified
+ * call semop() using two different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EFBIG
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * semop03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
* 03/2001 - Written by Wayne Boyer
- * 14/03/2008 Matthieu Fertré (Matthieu.Fertre@irisa.fr)
+ *
+ * RESTRICTIONS
+ * none
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "tst_test.h"
-#include "libnewipc.h"
-#include "lapi/sem.h"
-#include "semop.h"
-
-static key_t semkey;
-static int sem_id = -1;
-static struct tst_ts timeout;
-
-struct test_case_t {
- union semun semunptr;
- short op;
- short flg;
- short num;
- int error;
-} tc[] = {
- {{1}, 0, 0, 2, EIDRM},
- {{0}, -1, 0, 3, EIDRM},
- {{1}, 0, 0, 4, EINTR},
- {{0}, -1, 0, 5, EINTR}
-};
-
-static void do_child(int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct sembuf s_buf = {
- .sem_op = tc[i].op,
- .sem_flg = tc[i].flg,
- .sem_num = tc[i].num,
- };
-
- TEST(call_semop(tv, sem_id, &s_buf, 1, tst_ts_get(&timeout)));
- if (TST_RET != -1) {
- tst_res(TFAIL, "call succeeded when error expected");
- exit(0);
- }
+#include "ipcsem.h"
- if (TST_ERR == tc[i].error)
- tst_res(TPASS | TTERRNO, "expected failure");
- else
- tst_res(TFAIL | TTERRNO, "unexpected failure");
+char *TCID = "semop03";
+int TST_TOTAL = 2;
- exit(0);
-}
+int sem_id_1 = -1;
-static void sighandler(int sig)
-{
- if (sig != SIGHUP)
- tst_brk(TBROK, "unexpected signal %d received", sig);
-}
+struct sembuf s_buf;
-static void setup(void)
+int TC[] = { -1, PSEMS + 1 }; /* negative and too many "primitive" semas */
+
+int main(int ac, char **av)
{
- struct time64_variants *tv = &variants[tst_variant];
+ int lc;
+ int i;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- semop_supported_by_kernel(tv);
+ tst_parse_opts(ac, av, NULL, NULL);
- timeout.type = tv->ts_type;
- tst_ts_set_sec(&timeout, 2);
- tst_ts_set_nsec(&timeout, 10000000);
+ setup(); /* global setup */
- SAFE_SIGNAL(SIGHUP, sighandler);
- semkey = GETIPCKEY();
+ /* initialize two fields in the sembuf structure here */
+ s_buf.sem_op = 1; /* add this value to struct sem.semval */
+ s_buf.sem_flg = SEM_UNDO; /* undo when process exits */
- sem_id = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
- if (sem_id == -1)
- tst_brk(TBROK | TERRNO, "couldn't create semaphore in setup");
-}
+ /* The following loop checks looping state if -i option given */
-static void cleanup(void)
-{
- if (sem_id != -1) {
- if (semctl(sem_id, 0, IPC_RMID) == -1)
- tst_res(TWARN, "semaphore deletion failed.");
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /* initialize the last field in the sembuf */
+ /* structure to the test dependent value */
+ s_buf.sem_num = TC[i];
+
+ /*
+ * use the TEST macro to make the call
+ */
+
+ TEST(semop(sem_id_1, &s_buf, 1));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ switch (TEST_ERRNO) {
+ case EFBIG:
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ break;
+ default:
+ tst_resm(TFAIL, "unexpected error - "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ break;
+ }
+ }
}
+
+ cleanup();
+
+ tst_exit();
}
-static void run(unsigned int i)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- pid_t pid;
-
- if (semctl(sem_id, tc[i].num, SETVAL, tc[i].semunptr) == -1)
- tst_brk(TBROK | TERRNO, "semctl() failed");
-
- pid = SAFE_FORK();
-
- if (pid == 0) {
- do_child(i);
- } else {
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
-
- /*
- * If we are testing for EIDRM then remove
- * the semaphore, else send a signal that
- * must be caught as we are testing for
- * EINTR.
- */
- if (tc[i].error == EIDRM) {
- /* remove the semaphore resource */
- cleanup();
- } else {
- SAFE_KILL(pid, SIGHUP);
- }
- waitpid(pid, NULL, 0);
- }
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
- if (tc[i].error == EINTR)
- return;
+ /* get an IPC resource key */
+ semkey = getipckey();
- sem_id = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
- if (sem_id == -1)
- tst_brk(TBROK | TERRNO, "couldn't recreate semaphore");
+ /* create a semaphore with read and alter permissions */
+ if ((sem_id_1 =
+ semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tc),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .forks_child = 1,
-};
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+ /* if it exists, remove the semaphore resource */
+ rm_sema(sem_id_1);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/semop/semop04.c b/testcases/kernel/syscalls/ipc/semop/semop04.c
new file mode 100644
index 000000000..bf425b54b
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/semop/semop04.c
@@ -0,0 +1,177 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * semop04.c
+ *
+ * DESCRIPTION
+ * semop04 - test for EAGAIN error
+ *
+ * ALGORITHM
+ * create a semaphore set with read and alter permissions
+ * loop if that option was specified
+ * call semop() with two different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EAGAIN
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * semop04 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * none
+ */
+
+#include "ipcsem.h"
+
+char *TCID = "semop04";
+int TST_TOTAL = 2;
+
+int sem_id_1 = -1;
+
+struct sembuf s_buf;
+
+struct test_case_t {
+ union semun get_arr;
+ short op;
+ short flg;
+ short num;
+ int error;
+} TC[] = {
+ /* EAGAIN sem_op = 0 */
+ { {
+ 1}, 0, IPC_NOWAIT, 2, EAGAIN},
+ /* EAGAIN sem_op = -1 */
+ { {
+ 0}, -1, IPC_NOWAIT, 2, EAGAIN}
+};
+
+int main(int ac, char **av)
+{
+ int lc;
+ int val; /* value for SETVAL */
+
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ val = 1;
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /* initialize the s_buf buffer */
+ s_buf.sem_op = TC[i].op;
+ s_buf.sem_flg = TC[i].flg;
+ s_buf.sem_num = TC[i].num;
+
+ /* initialize all the primitive semaphores */
+ TC[i].get_arr.val = val--;
+ if (semctl(sem_id_1, TC[i].num, SETVAL, TC[i].get_arr)
+ == -1) {
+ tst_brkm(TBROK, cleanup, "semctl() failed");
+ }
+
+ /*
+ * make the call with the TEST macro
+ */
+
+ TEST(semop(sem_id_1, &s_buf, 1));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS,
+ "expected failure - errno = %d"
+ " : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "unexpected error - "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ }
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
+}
+
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ semkey = getipckey();
+
+ /* create a semaphore set with read and alter permissions */
+ /* and PSEMS "primitive" semaphores */
+ if ((sem_id_1 =
+ semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+ /* if it exists, remove the semaphore resource */
+ rm_sema(sem_id_1);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/semop/semop05.c b/testcases/kernel/syscalls/ipc/semop/semop05.c
new file mode 100644
index 000000000..6ed25014c
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/semop/semop05.c
@@ -0,0 +1,284 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * semop05.c
+ *
+ * DESCRIPTION
+ * semop05 - test for EINTR and EIDRM errors
+ *
+ * ALGORITHM
+ * create a semaphore set with read and alter permissions
+ * loop if that option was specified
+ * set up the s_buf buffer
+ * initialize the primitive semaphores
+ * fork a child process
+ * child calls semop() and sleeps
+ * parent either removes the semaphore set or sends a signal to the child
+ * parent then exits
+ * child gets a return from the semop() call
+ * check the errno value
+ * issue a PASS message if we get EINTR or EIDRM
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * semop05 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ * 14/03/2008 Matthieu Fertré (Matthieu.Fertre@irisa.fr)
+ * - Fix concurrency issue. Due to the use of usleep function to
+ * synchronize processes, synchronization issues can occur on a loaded
+ * system. Fix this by using pipes to synchronize processes.
+ *
+ * RESTRICTIONS
+ * none
+ */
+
+#include "ipcsem.h"
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include "safe_macros.h"
+
+char *TCID = "semop05";
+int TST_TOTAL = 4;
+
+int sem_id_1 = -1;
+
+struct sembuf s_buf;
+
+struct test_case_t {
+ union semun semunptr;
+ short op;
+ short flg;
+ short num;
+ int error;
+} TC[] = {
+ /* EIRDM sem_op = 0 */
+ { {
+ 1}, 0, 0, 2, EIDRM},
+ /* EIRDM sem_op = -1 */
+ { {
+ 0}, -1, 0, 3, EIDRM},
+ /* EINTR sem_op = 0 */
+ { {
+ 1}, 0, 0, 4, EINTR},
+ /* EINTR sem_op = -1 */
+ { {
+ 0}, -1, 0, 5, EINTR}
+};
+
+#ifdef UCLINUX
+#define PIPE_NAME "semop05"
+void do_child_uclinux();
+static int i_uclinux;
+#endif
+
+int main(int ac, char **av)
+{
+ int lc;
+ int i;
+ pid_t pid;
+ void do_child();
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+#ifdef UCLINUX
+ maybe_run_child(&do_child_uclinux, "dd", &i_uclinux, &sem_id_1);
+#endif
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /* initialize the s_buf buffer */
+ s_buf.sem_op = TC[i].op;
+ s_buf.sem_flg = TC[i].flg;
+ s_buf.sem_num = TC[i].num;
+
+ /* initialize all of the primitive semaphores */
+ if (semctl(sem_id_1, TC[i].num, SETVAL, TC[i].semunptr)
+ == -1) {
+ tst_brkm(TBROK, cleanup, "semctl() failed");
+ }
+
+ if ((pid = FORK_OR_VFORK()) == -1) {
+ tst_brkm(TBROK, cleanup, "could not fork");
+ }
+
+ if (pid == 0) { /* child */
+
+#ifdef UCLINUX
+ if (self_exec(av[0], "dd", i, sem_id_1) < 0) {
+ tst_brkm(TBROK, cleanup,
+ "could not self_exec");
+ }
+#else
+ do_child(i);
+#endif
+ } else {
+ TST_PROCESS_STATE_WAIT(cleanup, pid, 'S');
+
+ /*
+ * If we are testing for EIDRM then remove
+ * the semaphore, else send a signal that
+ * must be caught as we are testing for
+ * EINTR.
+ */
+ if (TC[i].error == EIDRM) {
+ /* remove the semaphore resource */
+ rm_sema(sem_id_1);
+ } else {
+ SAFE_KILL(cleanup, pid, SIGHUP);
+ }
+
+ /* let the child carry on */
+ waitpid(pid, NULL, 0);
+ }
+
+ /*
+ * recreate the semaphore resource if needed
+ */
+ if (TC[i].error == EINTR) {
+ continue;
+ }
+
+ if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT |
+ IPC_EXCL | SEM_RA)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't recreate "
+ "semaphore");
+ }
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
+}
+
+/*
+ * do_child()
+ */
+void do_child(int i)
+{
+ /*
+ * make the call with the TEST macro
+ */
+
+ TEST(semop(sem_id_1, &s_buf, 1));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded when error expected");
+ exit(-1);
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = %d"
+ " : %s", TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "unexpected error - "
+ "%d : %s", TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+
+ exit(0);
+}
+
+void sighandler(int sig)
+{
+ if (sig == SIGHUP)
+ return;
+ else
+ tst_brkm(TBROK, NULL, "unexpected signal %d received", sig);
+}
+
+#ifdef UCLINUX
+/*
+ * do_child_uclinux() - capture signals, re-initialize s_buf then call do_child
+ * with the appropriate argument
+ */
+void do_child_uclinux(void)
+{
+ int i = i_uclinux;
+
+ tst_sig(FORK, sighandler, cleanup);
+
+ /* initialize the s_buf buffer */
+ s_buf.sem_op = TC[i].op;
+ s_buf.sem_flg = TC[i].flg;
+ s_buf.sem_num = TC[i].num;
+
+ do_child(i);
+}
+#endif
+
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
+{
+
+ tst_sig(FORK, sighandler, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ semkey = getipckey();
+
+ /* create a semaphore set with read and alter permissions */
+ /* and PSEMS "primitive" semaphores */
+ if ((sem_id_1 =
+ semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup");
+ }
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+ /* if it exists, remove the semaphore resource */
+ rm_sema(sem_id_1);
+
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/ipc/shmat/Makefile b/testcases/kernel/syscalls/ipc/shmat/Makefile
index 6b2b26d05..f9ee8d2c2 100644
--- a/testcases/kernel/syscalls/ipc/shmat/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmat/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile2.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/shmctl/.gitignore b/testcases/kernel/syscalls/ipc/shmctl/.gitignore
index f3f88ee17..d6777e3b8 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/.gitignore
+++ b/testcases/kernel/syscalls/ipc/shmctl/.gitignore
@@ -3,6 +3,3 @@
/shmctl03
/shmctl04
/shmctl05
-/shmctl06
-/shmctl07
-/shmctl08
diff --git a/testcases/kernel/syscalls/ipc/shmctl/Makefile b/testcases/kernel/syscalls/ipc/shmctl/Makefile
index 06d72d968..16da31b03 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmctl/Makefile
@@ -1,15 +1,26 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpipc ltpnewipc
-
shmctl05: CFLAGS += -pthread
shmctl05: LDLIBS += -lrt
include $(top_srcdir)/include/mk/testcases.mk
-
-shmctl01 shmctl02 shmctl04 shmctl06: LTPLDLIBS = -lltpnewipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index b32752fb1..52bf23a40 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -1,272 +1,499 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
- * [Description]
*
- * Verify that shmctl() IPC_STAT and SHM_STAT reports correct data.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*
- * The shm_nattach is excercised by:
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * shmctl01.c
*
- * - forking() children that attach and detach SHM
- * - attaching the SHM before fork and letting the children detach it
+ * DESCRIPTION
+ * shmctl01 - test the IPC_STAT, IPC_SET and IPC_RMID commands as
+ * they are used with shmctl()
*
- * We check that the number shm_nattach is correct after each step we do.
+ * ALGORITHM
+ * loop if that option was specified
+ * create a shared memory segment with read and write permission
+ * set up any test case specific conditions
+ * call shmctl() using the TEST macro
+ * check the return code
+ * if failure, issue a FAIL message.
+ * otherwise,
+ * if doing functionality testing
+ * call the correct test function
+ * if the conditions are correct,
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * otherwise
+ * issue a PASS message
+ * call cleanup
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
-#include <stdlib.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
+#endif
+#include "ipcshm.h"
+#include "safe_macros.h"
+
+char *TCID = "shmctl01";
+
+static int shm_id_1 = -1;
+static int shm_index;
+static struct shmid_ds buf;
+static struct shminfo info;
+static long save_time;
+
+#define FIRST 0
+#define SECOND 1
+static int stat_time;
+
+static void *set_shared;
+
+#define N_ATTACH 4
+
+static pid_t pid_arr[N_ATTACH];
+
+/* Setup, cleanup and check routines for IPC_STAT */
+static void stat_setup(void), func_istat(int ret);
+static void stat_cleanup(void);
+
+/* Setup and check routines for IPC_SET */
+static void set_setup(void), func_set(int ret);
+
+/* Check routine for IPC_INFO */
+static void func_info(int ret);
+
+/* Check routine for SHM_STAT */
+static void func_sstat(int ret);
+static void func_sstat_setup(void);
+
+/* Check routine for SHM_LOCK */
+static void func_lock(int ret);
+
+/* Check routine for SHM_UNLOCK */
+static void func_unlock(int ret);
+
+/* Check routine for IPC_RMID */
+static void func_rmid(int ret);
+
+/* Child function */
+static void do_child(void);
+
+static struct test_case_t {
+ int *shmid;
+ int cmd;
+ struct shmid_ds *arg;
+ void (*func_test) (int);
+ void (*func_setup) (void);
+} TC[] = {
+ {&shm_id_1, IPC_STAT, &buf, func_istat, stat_setup},
+#ifndef UCLINUX
+ /*
+ * The second test is not applicable to uClinux;
+ * shared memory segments are detached on exec(),
+ * so cannot be passed to uClinux children.
+ */
+ {&shm_id_1, IPC_STAT, &buf, func_istat, stat_setup},
+#endif
+ {&shm_id_1, IPC_SET, &buf, func_set, set_setup},
+ {&shm_id_1, IPC_INFO, (struct shmid_ds *) &info, func_info, NULL},
+ {&shm_index, SHM_STAT, &buf, func_sstat, func_sstat_setup},
+ {&shm_id_1, SHM_LOCK, NULL, func_lock, NULL},
+ {&shm_id_1, SHM_UNLOCK, NULL, func_unlock, NULL},
+ {&shm_id_1, IPC_RMID, NULL, func_rmid, NULL},
+};
-#define NCHILD 20
+static int TST_TOTAL = ARRAY_SIZE(TC);
-static pid_t children[NCHILD];
+#define NEWMODE 0066
-static int shm_id;
-static int shm_idx;
-static time_t ctime_min, ctime_max;
+#ifdef UCLINUX
+#define PIPE_NAME "shmctl01"
+static char *argv0;
+#endif
-static void *addr;
+static int stat_i;
-static void attach_child(void)
+int main(int argc, char *argv[])
{
- pause();
-
- addr = SAFE_SHMAT(shm_id, NULL, 0);
-
- pause();
-
- SAFE_SHMDT(addr);
-
- pause();
+ int lc;
+ int i;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+#ifdef UCLINUX
+ argv0 = argv[0];
+ maybe_run_child(do_child, "ddd", &stat_i, &stat_time, &shm_id_1);
+#endif
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ stat_time = FIRST;
+
+ /*
+ * Create a shared memory segment with read and write
+ * permissions. Do this here instead of in setup()
+ * so that looping (-i) will work correctly.
+ */
+ shm_id_1 = shmget(shmkey, SHM_SIZE,
+ IPC_CREAT | IPC_EXCL | SHM_RW);
+ if (shm_id_1 == -1)
+ tst_brkm(TBROK, cleanup, "couldn't create the shared"
+ " memory segment");
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ /*
+ * if needed, set up any required conditions by
+ * calling the appropriate setup function
+ */
+ if (TC[i].func_setup != NULL)
+ (*TC[i].func_setup) ();
+
+ TEST(shmctl(*(TC[i].shmid), TC[i].cmd, TC[i].arg));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "%s call failed - errno "
+ "= %d : %s", TCID, TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ continue;
+ }
+ (*TC[i].func_test) (TEST_RETURN);
+ }
+ }
- exit(0);
+ cleanup();
+ tst_exit();
}
-static void detach_child(void)
+/*
+ * set_shmat() - Attach the shared memory and return the pointer. Use
+ * this seperate routine to avoid code duplication in
+ * stat_setup() below.
+ */
+void *set_shmat(void)
{
- pause();
-
- SAFE_SHMDT(addr);
-
- pause();
+ void *rval;
+
+ /* attach the shared memory */
+ rval = shmat(shm_id_1, 0, 0);
+
+ /*
+ * if shmat() fails, the only thing we can do is
+ * print a message to that effect.
+ */
+ if (rval == (void *)-1) {
+ tst_resm(TBROK, "shmat() failed - %s", strerror(errno));
+ cleanup();
+ }
- exit(0);
+ return rval;
}
-static void fork_children(void (*child_func)(void))
+/*
+ * stat_setup() - Set up for the IPC_STAT command with shmctl().
+ * Make things interesting by forking some children
+ * that will either attach or inherit the shared memory.
+ */
+void stat_setup(void)
{
- unsigned int i;
-
- for (i = 0; i < NCHILD; i++) {
- pid_t pid = SAFE_FORK();
-
- if (!pid)
- child_func();
-
- children[i] = pid;
+ void *set_shmat();
+ pid_t pid;
+
+ /*
+ * The first time through, let the children attach the memory.
+ * The second time through, attach the memory first and let
+ * the children inherit the memory.
+ */
+
+ if (stat_time == SECOND)
+ /*
+ * use the global "set_shared" variable here so that
+ * it can be removed in the stat_func() routine.
+ */
+ set_shared = set_shmat();
+
+ tst_old_flush();
+ for (stat_i = 0; stat_i < N_ATTACH; stat_i++) {
+ pid = FORK_OR_VFORK();
+ if (pid == -1)
+ tst_brkm(TBROK, cleanup, "could not fork");
+
+ if (pid == 0) {
+#ifdef UCLINUX
+ if (self_exec(argv0, "ddd", stat_i, stat_time,
+ shm_id_1) < 0)
+ tst_brkm(TBROK, cleanup, "could not self_exec");
+#else
+ do_child();
+#endif
+
+ } else {
+ /* save the child's pid for cleanup later */
+ pid_arr[stat_i] = pid;
+ TST_PROCESS_STATE_WAIT(cleanup, pid, 'S');
+ }
}
}
-static void wait_for_children(void)
+void do_child(void)
{
- unsigned int i;
+ void *test;
- for (i = 0; i < NCHILD; i++)
- TST_PROCESS_STATE_WAIT(children[i], 'S', 0);
-}
+ if (stat_time == FIRST)
+ test = set_shmat();
+ else
+ test = set_shared;
-static void signal_children(void)
-{
- unsigned int i;
+ memcpy(test, &stat_i, sizeof(stat_i));
- for (i = 0; i < NCHILD; i++)
- SAFE_KILL(children[i], SIGUSR1);
-}
+ /* pause until we get a signal from stat_cleanup() */
+ pause();
-static void reap_children(void)
-{
- unsigned int i;
+ /* now we're back - detach the memory and exit */
+ if (shmdt(test) == -1)
+ tst_resm(TBROK, "shmdt() failed - %d", errno);
- for (i = 0; i < NCHILD; i++)
- SAFE_WAITPID(children[i], NULL, 0);
+ tst_exit();
}
-static void check_nattch(int exp_nattch, const char *msg)
+/*
+ * func_istat() - check the functionality of the IPC_STAT command with shmctl()
+ * by looking at the pid of the creator, the segement size,
+ * the number of attaches and the mode.
+ */
+void func_istat(int ret)
{
- struct shmid_ds ds1;
- struct shmid_ds ds2;
+ int fail = 0;
+ pid_t pid;
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds1);
- SAFE_SHMCTL(shm_idx, SHM_STAT, &ds2);
+ /* check perm, pid, nattach and size */
- if (ds1.shm_nattch != ds2.shm_nattch) {
- tst_res(TFAIL, "IPC_STAT nattch=%li SHM_STAT nattch=%li",
- (long)ds1.shm_nattch, (long)ds2.shm_nattch);
- return;
- }
+ pid = getpid();
- if ((int)ds1.shm_nattch == exp_nattch) {
- tst_res(TPASS, "%s shm_nattch=%i", msg, exp_nattch);
- return;
+ if (buf.shm_cpid != pid) {
+ tst_resm(TFAIL, "creator pid is incorrect");
+ fail = 1;
}
- tst_res(TFAIL, "%s shm_nattcg=%li expected %i",
- msg, (long)ds1.shm_nattch, exp_nattch);
-}
-
-static void verify_shmstat_attach(void)
-{
- fork_children(attach_child);
- wait_for_children();
+ if (!fail && buf.shm_segsz != SHM_SIZE) {
+ tst_resm(TFAIL, "segment size is incorrect");
+ fail = 1;
+ }
- check_nattch(0, "before child shmat()");
+ /*
+ * The first time through, only the children attach the memory, so
+ * the attaches equal N_ATTACH + stat_time (0). The second time
+ * through, the parent attaches the memory and the children inherit
+ * that memory so the attaches equal N_ATTACH + stat_time (1).
+ */
+ if (!fail && buf.shm_nattch != N_ATTACH + stat_time) {
+ tst_resm(TFAIL, "# of attaches is incorrect - %ld",
+ buf.shm_nattch);
+ fail = 1;
+ }
- signal_children();
- wait_for_children();
+ /* use MODE_MASK to make sure we are comparing the last 9 bits */
+ if (!fail && (buf.shm_perm.mode & MODE_MASK) !=
+ ((SHM_RW) & MODE_MASK)) {
+ tst_resm(TFAIL, "segment mode is incorrect");
+ fail = 1;
+ }
- check_nattch(NCHILD, "after child shmat()");
+ stat_cleanup();
- signal_children();
- wait_for_children();
+ /* save the change time for use in the next test */
+ save_time = buf.shm_ctime;
- check_nattch(0, "after child shmdt()");
+ if (fail)
+ return;
- signal_children();
- reap_children();
+ tst_resm(TPASS, "pid, size, # of attaches and mode are correct "
+ "- pass #%d", stat_time);
}
-static void verify_shmstat_inherit(void)
+/*
+ * stat_cleanup() - signal the children to clean up after themselves and
+ * have the parent make dessert, er, um, make that remove
+ * the shared memory that is no longer needed.
+ */
+void stat_cleanup(void)
{
- addr = SAFE_SHMAT(shm_id, NULL, 0);
+ int i;
- fork_children(detach_child);
- wait_for_children();
-
- check_nattch(NCHILD+1, "inherited after fork()");
+ /* wake up the childern so they can detach the memory and exit */
+ for (i = 0; i < N_ATTACH; i++) {
+ SAFE_KILL(cleanup, pid_arr[i], SIGUSR1);
+ }
- signal_children();
- wait_for_children();
+ /* remove the parent's shared memory the second time through */
+ if (stat_time == SECOND) {
+ if (shmdt(set_shared) == -1)
+ tst_resm(TINFO, "shmdt() failed");
+ }
- check_nattch(1, "after child shmdt()");
+ for (i = 0; i < N_ATTACH; i++) {
+ SAFE_WAITPID(cleanup, pid_arr[i], NULL, 0);
+ }
- SAFE_SHMDT(addr);
+ stat_time++;
+}
- check_nattch(0, "after parent shmdt()");
+/*
+ * set_setup() - set up for the IPC_SET command with shmctl()
+ */
+void set_setup(void)
+{
+ /* set up a new mode for the shared memory segment */
+ buf.shm_perm.mode = SHM_RW | NEWMODE;
- signal_children();
- reap_children();
+ /* sleep for one second to get a different shm_ctime value */
+ sleep(1);
}
-static void check_ds(struct shmid_ds *ds, const char *desc)
+/*
+ * func_set() - check the functionality of the IPC_SET command with shmctl()
+ */
+void func_set(int ret)
{
- pid_t pid = getpid();
+ int fail = 0;
- if (ds->shm_segsz != SHM_SIZE) {
- tst_res(TFAIL, "%s: shm_segsz=%zu, expected %i",
- desc, ds->shm_segsz, SHM_SIZE);
- } else {
- tst_res(TPASS, "%s: shm_segsz=%i", desc, SHM_SIZE);
+ /* first stat the shared memory to get the new data */
+ if (shmctl(shm_id_1, IPC_STAT, &buf) == -1) {
+ tst_resm(TBROK, "stat failed in func_set()");
+ return;
}
- if (ds->shm_cpid != pid) {
- tst_res(TFAIL, "%s: shm_cpid=%i, expected %i",
- desc, ds->shm_cpid, pid);
- } else {
- tst_res(TPASS, "%s: shm_cpid=%i", desc, pid);
+ if ((buf.shm_perm.mode & MODE_MASK) !=
+ ((SHM_RW | NEWMODE) & MODE_MASK)) {
+ tst_resm(TFAIL, "new mode is incorrect");
+ fail = 1;
}
- if (ds->shm_ctime < ctime_min || ds->shm_ctime > ctime_max) {
- tst_res(TFAIL, "%s: shm_ctime=%li, expected <%li,%li>",
- desc, ds->shm_ctime, ctime_min, ctime_max);
- } else {
- tst_res(TPASS, "%s: shm_ctime=%li in range <%li,%li>",
- desc, ds->shm_ctime, ctime_min, ctime_max);
+ if (!fail && save_time >= buf.shm_ctime) {
+ tst_resm(TFAIL, "change time is incorrect");
+ fail = 1;
}
-}
-
-static void shmstat_basic_check(void)
-{
- struct shmid_ds ds;
- memset(&ds, 0, sizeof(ds));
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds);
-
- check_ds(&ds, "IPC_STAT");
-
- memset(&ds, 0, sizeof(ds));
- SAFE_SHMCTL(shm_idx, SHM_STAT, &ds);
+ if (fail)
+ return;
- check_ds(&ds, "SHM_STAT");
+ tst_resm(TPASS, "new mode and change time are correct");
}
-static struct tcase {
- void (*func)(void);
- const char *desc;
-} tcases[] = {
- {shmstat_basic_check, "Basic checks"},
- {verify_shmstat_attach, "Children attach SHM"},
- {verify_shmstat_inherit, "Chidlren inherit SHM"},
-};
+static void func_info(int ret)
+{
+ if (info.shmmin != 1)
+ tst_resm(TFAIL, "value of shmmin is incorrect");
+ else
+ tst_resm(TPASS, "get correct shared memory limits");
+}
-static void verify_shmstat(unsigned int n)
+static void func_sstat(int ret)
{
- tst_res(TINFO, "%s", tcases[n].desc);
- tcases[n].func();
+ if (ret >= 0)
+ tst_resm(TPASS, "get correct shared memory id for index: %d",
+ shm_index);
+ else
+ tst_resm(TFAIL, "shared memory id is incorrect, index: %d",
+ shm_index);
}
-static void dummy_sighandler(int sig)
+static void func_sstat_setup(void)
{
- (void)sig;
+ struct shm_info tmp;
+ int ret;
+
+ ret = shmctl(shm_id_1, SHM_INFO, (void *)&tmp);
+ if (ret < 0)
+ tst_resm(TFAIL|TERRNO, "shmctl(SHM_INFO)");
+ else
+ shm_index = ret;
}
-static int get_shm_idx_from_id(int shm_id)
+static void func_lock(int ret)
{
- struct shm_info dummy;
- struct shmid_ds dummy_ds;
- int max_idx, i;
+ if (shmctl(shm_id_1, IPC_STAT, &buf) == -1) {
+ tst_resm(TBROK, "stat failed in func_lock()");
+ return;
+ }
- max_idx = SAFE_SHMCTL(shm_id, SHM_INFO, (void*)&dummy);
+ if (buf.shm_perm.mode & SHM_LOCKED)
+ tst_resm(TPASS, "SHM_LOCK is set");
+ else
+ tst_resm(TFAIL, "SHM_LOCK is cleared");
+}
- for (i = 0; i <= max_idx; i++) {
- if (shmctl(i, SHM_STAT, &dummy_ds) == shm_id)
- return i;
+static void func_unlock(int ret)
+{
+ if (shmctl(shm_id_1, IPC_STAT, &buf) == -1) {
+ tst_resm(TBROK, "stat failed in func_unlock()");
+ return;
}
- return -1;
+ if (buf.shm_perm.mode & SHM_LOCKED)
+ tst_resm(TFAIL, "SHM_LOCK is set");
+ else
+ tst_resm(TPASS, "SHM_LOCK is cleared");
}
-static void setup(void)
-{
- ctime_min = get_ipc_timestamp();
- shm_id = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | SHM_RW);
- ctime_max = get_ipc_timestamp();
- shm_idx = get_shm_idx_from_id(shm_id);
+/*
+ * func_rmid() - check the functionality of the IPC_RMID command with shmctl()
+ */
+void func_rmid(int ret)
+{
+ /* Do another shmctl() - we should get EINVAL */
+ if (shmctl(shm_id_1, IPC_STAT, &buf) != -1)
+ tst_brkm(TBROK, cleanup, "shmctl succeeded on expected fail");
- if (shm_idx < 0)
- tst_brk(TBROK, "Failed to get shm_id to idx mapping");
+ if (errno != EINVAL)
+ tst_resm(TFAIL, "returned unexpected errno %d", errno);
+ else
+ tst_resm(TPASS, "shared memory appears to be removed");
- tst_res(TINFO, "shm_id=%i maps to kernel index=%i", shm_id, shm_idx);
+ shm_id_1 = -1;
+}
- SAFE_SIGNAL(SIGUSR1, dummy_sighandler);
+/*
+ * sighandler() - handle signals, in this case SIGUSR1 is the only one expected
+ */
+void sighandler(int sig)
+{
+ if (sig != SIGUSR1)
+ tst_resm(TBROK, "received unexpected signal %d", sig);
}
-static void cleanup(void)
+void setup(void)
{
- if (shm_id >= 0)
- SAFE_SHMCTL(shm_id, IPC_RMID, NULL);
+ tst_sig(FORK, sighandler, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ shmkey = getipckey();
}
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .forks_child = 1,
- .test = verify_shmstat,
- .tcnt = ARRAY_SIZE(tcases),
-};
+void cleanup(void)
+{
+ rm_shm(shm_id_1);
+
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
index 9057b7f54..563f6870a 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
@@ -1,126 +1,213 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 03/2001 - Written by Wayne Boyer
*
- * Copyright (c) 2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
+ * Copyright (c) International Business Machines Corp., 2001
*
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * shmctl02.c
+ *
+ * DESCRIPTION
+ * shmctl02 - check for EACCES, EFAULT and EINVAL errors
+ *
+ * ALGORITHM
+ * create a shared memory segment without read or write permissions
+ * create a shared memory segment with read & write permissions
+ * loop if that option was specified
+ * call shmctl() using five different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EACCES, EFAULT or EINVAL
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * shmctl02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * Test for EACCES, EFAULT and EINVAL errors.
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
*
- * * EACCES - segment has no read or write permissions
- * * EFAULT - IPC_SET & buf isn't valid
- * * EFAULT - IPC_STAT & buf isn't valid
- * * EINVAL - the command is not valid
- * * EINVAL - the shmid is not valid
- * * EINVAL - the shmid belongs to removed shm
+ * 06/03/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
+ * - Fix concurrency issue. The second key used for this test could
+ * conflict with the key from another task.
*
- * * EACCES - attempt to stat root-owned shm
- * * EPERM - attempt to delete root-owned shm
- * * EPERM - attempt to change root-owned shm
- * * EPERM - attempt to lock root-owned shm
- * * EPERM - attempt to unlock root-owned shm
+ * RESTRICTIONS
+ * none
*/
+#include "ipcshm.h"
#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
+char *TCID = "shmctl02";
+char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
-#define SHM_SIZE 2048
+int shm_id_1 = -1;
+int shm_id_2 = -1;
+int shm_id_3 = -1;
-static int shm_id1 = -1;
-static int shm_id2 = -1;
-static int shm_id3 = -1;
-static int shm_bad = -1;
-static int shm_rem;
+struct shmid_ds buf;
-static struct shmid_ds buf;
-
-static struct tcase {
- int *shm_id;
+struct test_case_t {
+ int *shmid;
int cmd;
- struct shmid_ds *buf;
+ struct shmid_ds *sbuf;
int error;
-} tc[] = {
- {&shm_id1, IPC_STAT, &buf, EACCES},
- {&shm_id2, IPC_SET, (struct shmid_ds *)-1, EFAULT},
- {&shm_id2, IPC_STAT, (struct shmid_ds *)-1, EFAULT},
- {&shm_id2, -1, &buf, EINVAL},
- {&shm_bad, IPC_STAT, &buf, EINVAL},
- {&shm_rem, IPC_STAT, &buf, EINVAL},
- /* Operations on root-owned shm */
- {&shm_id3, IPC_STAT, &buf, EACCES},
- {&shm_id3, IPC_RMID, NULL, EPERM},
- {&shm_id3, IPC_SET, &buf, EPERM},
- {&shm_id3, SHM_LOCK, &buf, EPERM},
- {&shm_id3, SHM_UNLOCK, &buf, EPERM}
+} TC[] = {
+ /* EACCES - segment has no read or write permissions */
+ {
+ &shm_id_1, IPC_STAT, &buf, EACCES},
+ /* EFAULT - IPC_SET & buf isn't valid */
+ {
+ &shm_id_2, IPC_SET, (struct shmid_ds *)-1, EFAULT},
+ /* EFAULT - IPC_STAT & buf isn't valid */
+ {
+ &shm_id_2, IPC_STAT, (struct shmid_ds *)-1, EFAULT},
+ /* EINVAL - the shmid is not valid */
+ {
+ &shm_id_3, IPC_STAT, &buf, EINVAL},
+ /* EINVAL - the command is not valid */
+ {
+ &shm_id_2, -1, &buf, EINVAL},
+ /* EPERM - the command is only valid for the super-user */
+ {
+ &shm_id_2, SHM_LOCK, &buf, EPERM},
+ /* EPERM - the command is only valid for the super-user */
+ {
+ &shm_id_2, SHM_UNLOCK, &buf, EPERM}
};
-static void verify_shmctl(unsigned int i)
-{
- TEST(shmctl(*(tc[i].shm_id), tc[i].cmd, tc[i].buf));
+int TST_TOTAL = ARRAY_SIZE(TC);
- if (TST_RET != -1) {
- tst_res(TFAIL, "shmctl() returned %li", TST_RET);
- return;
+int main(int ac, char **av)
+{
+ int lc;
+ int i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ /* loop through the test cases */
+ for (i = 0; i < TST_TOTAL; i++) {
+ /*
+ * use the TEST() macro to make the call
+ */
+
+ TEST(shmctl(*(TC[i].shmid), TC[i].cmd, TC[i].sbuf));
+
+ if ((TEST_RETURN != -1) && (i < 5)) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ if (i >= 5)
+ tst_resm(TCONF,
+ "shmctl() did not fail for non-root user."
+ "This may be okay for your distribution.");
+ else
+ tst_resm(TFAIL, "call failed with an "
+ "unexpected error - %d : %s",
+ TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ }
+ }
}
- if (TST_ERR == tc[i].error) {
- tst_res(TPASS | TTERRNO, "shmctl(%i, %i, %p)",
- *tc[i].shm_id, tc[i].cmd, tc[i].buf);
- return;
- }
+ cleanup();
- tst_res(TFAIL | TTERRNO, "shmctl(%i, %i, %p) expected %s",
- *tc[i].shm_id, tc[i].cmd, tc[i].buf, tst_strerrno(tc[i].error));
+ tst_exit();
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- key_t shmkey1, shmkey2;
- struct passwd *ltpuser;
- int tmp;
+ key_t shmkey2;
- shm_id3 = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | SHM_RW);
+ tst_require_root();
- ltpuser = SAFE_GETPWNAM("nobody");
- SAFE_SETEUID(ltpuser->pw_uid);
+ /* Switch to nobody user for correct error code collection */
+ ltpuser = getpwnam(nobody_uid);
+ if (setuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TINFO, "setuid failed to "
+ "to set the effective uid to %d", ltpuser->pw_uid);
+ perror("setuid");
+ }
- shmkey1 = GETIPCKEY();
- shmkey2 = GETIPCKEY();
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- shm_id1 = SAFE_SHMGET(shmkey1, SHM_SIZE, IPC_CREAT | IPC_EXCL);
- shm_id2 = SAFE_SHMGET(shmkey2, SHM_SIZE, IPC_CREAT | IPC_EXCL | SHM_RW);
+ TEST_PAUSE;
- tmp = shm_rem = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | SHM_RW);
- SAFE_SHMCTL(tmp, IPC_RMID, NULL);
-}
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
-static void cleanup(void)
-{
- if (shm_id1 >= 0)
- SAFE_SHMCTL(shm_id1, IPC_RMID, NULL);
+ /* get an IPC resource key */
+ shmkey = getipckey();
- if (shm_id2 >= 0)
- SAFE_SHMCTL(shm_id2, IPC_RMID, NULL);
+ /* create a shared memory segment without read or write permissions */
+ if ((shm_id_1 = shmget(shmkey, SHM_SIZE, IPC_CREAT | IPC_EXCL)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create shared memory "
+ "segment #1 in setup()");
+ }
+
+ /* Get an new IPC resource key. */
+ shmkey2 = getipckey();
- if (shm_id3 >= 0) {
- SAFE_SETEUID(0);
- SAFE_SHMCTL(shm_id3, IPC_RMID, NULL);
+ /* create a shared memory segment with read and write permissions */
+ if ((shm_id_2 = shmget(shmkey2, SHM_SIZE, IPC_CREAT | IPC_EXCL |
+ SHM_RW)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create shared memory "
+ "segment #2 in setup()");
}
}
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_shmctl,
- .tcnt = ARRAY_SIZE(tc),
- .needs_root = 1,
-};
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+ /* if they exist, remove the shared memory resources */
+ rm_shm(shm_id_1);
+ rm_shm(shm_id_2);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
index 0f700a9bd..97cf27baf 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
@@ -1,43 +1,204 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * shmctl03.c
+ *
+ * DESCRIPTION
+ * shmctl03 - check for EACCES, and EPERM errors
*
- * Call shmctl() with IPC_INFO flag and check that the data are consistent with
- * /proc/sys/kernel/shm*.
+ * ALGORITHM
+ * create a shared memory segment with root only read & write permissions
+ * fork a child process
+ * if child
+ * set the ID of the child process to that of "ltpuser1"
+ * call do_child()
+ * loop if that option was specified
+ * call shmctl() using three different invalid cases
+ * check the errno value
+ * issue a PASS message if we get EACCES or EPERM
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * call cleanup
+ * if parent
+ * wait for child to exit
+ * remove the shared memory segment
+ *
+ * USAGE: <for command-line>
+ * shmctl03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 03/2001 - Written by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * test must be run as root
*/
-#define _GNU_SOURCE
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
+#include "ipcshm.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include "safe_macros.h"
+
+char *TCID = "shmctl03";
+int shm_id_1 = -1;
+
+uid_t ltp_uid;
+char *ltp_user = "nobody";
+
+struct shmid_ds buf;
+
+struct test_case_t {
+ int *shmid;
+ int cmd;
+ struct shmid_ds *sbuf;
+ int error;
+} TC[] = {
+ /* EACCES - child has no read permission for segment */
+ {
+ &shm_id_1, IPC_STAT, &buf, EACCES},
+ /* EPERM - IPC_SET - child doesn't have permission to change segment */
+ {
+ &shm_id_1, IPC_SET, &buf, EPERM},
+ /* EPERM - IPC_RMID - child can not remove the segment */
+ {
+&shm_id_1, IPC_RMID, &buf, EPERM},};
+
+int TST_TOTAL = ARRAY_SIZE(TC);
+
+int main(int ac, char **av)
+{
+ int pid;
+ void do_child(void);
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ if ((pid = FORK_OR_VFORK()) == -1) {
+ tst_brkm(TBROK, cleanup, "could not fork");
+ }
+
+ if (pid == 0) { /* child */
+ /* set the user ID of the child to the non root user */
+ if (setuid(ltp_uid) == -1) {
+ tst_resm(TBROK, "setuid() failed");
+ exit(1);
+ }
+
+ do_child();
+ } else {
+ /* wait for the child to return */
+ SAFE_WAITPID(cleanup, pid, NULL, 0);
+
+ /* if it exists, remove the shared memory resource */
+ rm_shm(shm_id_1);
+
+ tst_rmdir();
+ }
+
+ cleanup();
+ tst_exit();
+}
-static void verify_ipcinfo(void)
+/*
+ * do_child - make the call as the child process
+ */
+void do_child(void)
{
- struct shminfo info;
+ int i, lc;
+
+ /* The following loop checks looping state if -i option given */
- TEST(shmctl(0, IPC_INFO, (struct shmid_ds *)&info));
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
- if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO,
- "shmctl(0, IPC_INFO, ...) returned %li",
- TST_RET);
- return;
+ /* loop through the test cases */
+ for (i = 0; i < TST_TOTAL; i++) {
+ /*
+ * use the TEST() macro to make the call
+ */
+
+ TEST(shmctl(*(TC[i].shmid), TC[i].cmd, TC[i].sbuf));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO == TC[i].error) {
+ tst_resm(TPASS, "expected failure - errno = "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "call failed with an "
+ "unexpected error - %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
}
+}
+
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
+
+ /* get an IPC resource key */
+ shmkey = getipckey();
- if (info.shmmin != 1)
- tst_res(TFAIL, "shmmin = %li, expected 1", info.shmmin);
- else
- tst_res(TPASS, "shmmin = 1");
+ /* create a shared memory segment with read and write permissions */
+ if ((shm_id_1 = shmget(shmkey, SHM_SIZE, IPC_CREAT | IPC_EXCL |
+ SHM_RW)) == -1) {
+ tst_brkm(TBROK, cleanup, "couldn't create shared memory "
+ "segment in setup()");
+ }
- TST_ASSERT_ULONG("/proc/sys/kernel/shmmax", info.shmmax);
- TST_ASSERT_ULONG("/proc/sys/kernel/shmmni", info.shmmni);
- TST_ASSERT_ULONG("/proc/sys/kernel/shmall", info.shmall);
+ /* get the userid for a non root user */
+ ltp_uid = getuserid(ltp_user);
}
-static struct tst_test test = {
- .test_all = verify_ipcinfo,
-};
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
index 724610ef0..c9d13d46e 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
@@ -1,186 +1,115 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * shmctl04.c
*
- * Call shmctl() with SHM_INFO flag and check that:
+ * DESCRIPTION
+ * shmctl04 - test the SHM_INFO command
+ * they are used with shmctl() in ipcs
*
- * * The returned index points to a valid SHM by calling SHM_STAT_ANY
- * * Also count that valid indexes < returned max index sums up to used_ids
- * * And the data are consistent with /proc/sysvipc/shm
+ * USAGE: <for command-line>
+ * shmctl04 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * There is a possible race between the call to the shmctl() and read from the
- * proc file so this test cannot be run in parallel with any IPC testcases that
- * adds or removes SHM segments.
+ * HISTORY
+ * 09/2002 - Written by Mingming Cao
*
- * Note what we create a SHM segment in the test setup to make sure that there
- * is at least one during the testrun.
+ * RESTRICTIONS
+ * none
*/
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <pwd.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-#include "lapi/shm.h"
+#include "ipcshm.h"
-#define SHM_SIZE 2048
+char *TCID = "shmctl04";
+int TST_TOTAL = 1;
-static int shm_id = -1;
-static uid_t nobody_uid, root_uid;
+struct shm_info shm_info;
+int max_ids;
-static struct tcases {
- uid_t *uid;
- char *desc;
-} tests[] = {
- {&nobody_uid, "with nobody user"},
- {&root_uid, "with root user"}
-};
+/*
+ * These are the various setup and check functions for the commands
+ * that we are checking.
+ */
-static void parse_proc_sysvipc(struct shm_info *info)
+int main(int ac, char **av)
{
- int page_size = getpagesize();
- FILE *f = fopen("/proc/sysvipc/shm", "r");
- int used_ids = 0;
- int shmid_max = 0;
- unsigned long shm_rss = 0;
- unsigned long shm_swp = 0;
- unsigned long shm_tot = 0;
-
- /* Eat header */
- for (;;) {
- int c = fgetc(f);
-
- if (c == '\n' || c == EOF)
- break;
- }
+ int lc;
- int shmid, size, rss, swap;
+ tst_parse_opts(ac, av, NULL, NULL);
- /*
- * Sum rss, swap and size for all elements listed, which should equal
- * the data returned in the shm_info structure.
- *
- * Note that the size has to be rounded up to nearest multiple of page
- * size.
- */
- while (fscanf(f, "%*i %i %*i %i %*i %*i %*i %*i %*i %*i %*i %*i %*i %*i %i %i",
- &shmid, &size, &rss, &swap) > 0) {
- used_ids++;
- shm_rss += rss/page_size;
- shm_swp += swap/page_size;
- shm_tot += (size + page_size - 1) / page_size;
- if (shmid > shmid_max)
- shmid_max = shmid;
- }
+ setup();
- if (info->used_ids != used_ids) {
- tst_res(TFAIL, "used_ids = %i, expected %i",
- info->used_ids, used_ids);
- } else {
- tst_res(TPASS, "used_ids = %i", used_ids);
- }
+ /* The following loop checks looping state if -i option given */
- if (info->shm_rss != shm_rss) {
- tst_res(TFAIL, "shm_rss = %li, expected %li",
- info->shm_rss, shm_rss);
- } else {
- tst_res(TPASS, "shm_rss = %li", shm_rss);
- }
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+ TEST(shmctl(0, SHM_INFO, (struct shmid_ds *)&shm_info));
- if (info->shm_swp != shm_swp) {
- tst_res(TFAIL, "shm_swp = %li, expected %li",
- info->shm_swp, shm_swp);
- } else {
- tst_res(TPASS, "shm_swp = %li", shm_swp);
- }
+ if (TEST_RETURN != -1) {
+ tst_resm(TPASS, "SHM_INFO call succeeded");
+ continue;
+ }
+
+ tst_resm(TFAIL, "SHM_INFO call failed with an unexpected error"
+ " - %d : %s", TEST_ERRNO, strerror(TEST_ERRNO));
- if (info->shm_tot != shm_tot) {
- tst_res(TFAIL, "shm_tot = %li, expected %li",
- info->shm_tot, shm_tot);
- } else {
- tst_res(TPASS, "shm_tot = %li", shm_tot);
}
- fclose(f);
+ cleanup();
+
+ tst_exit();
}
-static void verify_shminfo(unsigned int n)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- struct tcases *tc = &tests[n];
- struct shm_info info;
- struct shmid_ds ds;
- int i, shmid, cnt = 0;
- tst_res(TINFO, "Test SHM_STAT_ANY %s", tc->desc);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- SAFE_SETEUID(*tc->uid);
+ TEST_PAUSE;
- TEST(shmctl(0, SHM_INFO, (struct shmid_ds *)&info));
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "shmctl(0, SHM_INFO, ...)");
- return;
- }
-
- shmid = shmctl(TST_RET, SHM_STAT_ANY, &ds);
-
- if (shmid == -1) {
- tst_res(TFAIL | TERRNO, "SHM_INFO haven't returned a valid index");
- } else {
- tst_res(TPASS,
- "SHM_INFO returned valid index %li maps to shmid %i",
- TST_RET, shmid);
- }
-
- for (i = 0; i <= TST_RET; i++) {
- if (shmctl(i, SHM_STAT_ANY, &ds) != -1)
- cnt++;
- }
-
- if (cnt == info.used_ids) {
- tst_res(TPASS, "Counted used = %i", cnt);
- } else {
- tst_res(TFAIL, "Counted used = %i, used_ids = %i",
- cnt, info.used_ids);
- }
+ /*
+ * Create a temporary directory and cd into it.
+ * This helps to ensure that a unique msgkey is created.
+ * See ../lib/libipc.c for more information.
+ */
+ tst_tmpdir();
- parse_proc_sysvipc(&info);
}
-static void setup(void)
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
{
- struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
- struct shmid_ds temp_ds;
- nobody_uid = ltpuser->pw_uid;
- root_uid = 0;
-
- shm_id = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | SHM_RW);
-
- TEST(shmctl(shm_id, SHM_STAT_ANY, &temp_ds));
- if (TST_RET == -1) {
- if (TST_ERR == EINVAL)
- tst_brk(TCONF, "kernel doesn't support SHM_STAT_ANY");
- else
- tst_brk(TBROK | TTERRNO,
- "Current environment doesn't permit SHM_STAT_ANY");
- }
-}
-static void cleanup(void)
-{
- if (shm_id >= 0)
- SAFE_SHMCTL(shm_id, IPC_RMID, NULL);
-}
+ tst_rmdir();
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = verify_shminfo,
- .tcnt = ARRAY_SIZE(tests),
- .needs_root = 1,
-};
+}
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
index f8b76bda7..50196ae99 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
@@ -3,18 +3,14 @@
* Copyright (c) 2018 Google, Inc.
*/
-/*\
- * [Description]
- *
- * Regression test for commit
- * 3f05317d9889 (ipc/shm: fix use-after-free of shm file via remap_file_pages()).
- *
- * This bug allowed the remap_file_pages() syscall to use the file of a System
- * V shared memory segment after its ID had been reallocated and the file
- * freed. This test reproduces the bug as a NULL pointer dereference in
- * touch_atime(), although it's a race condition so it's not guaranteed to
- * work. This test is based on the reproducer provided in the fix's commit
- * message.
+/*
+ * Regression test for commit 3f05317d9889 ("ipc/shm: fix use-after-free of shm
+ * file via remap_file_pages()"). This bug allowed the remap_file_pages()
+ * syscall to use the file of a System V shared memory segment after its ID had
+ * been reallocated and the file freed. This test reproduces the bug as a NULL
+ * pointer dereference in touch_atime(), although it's a race condition so it's
+ * not guaranteed to work. This test is based on the reproducer provided in the
+ * fix's commit message.
*/
#include "lapi/syscalls.h"
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl06.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
deleted file mode 100644
index 92aaa38e2..000000000
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
+++ /dev/null
@@ -1,55 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Cross verify the _high fields being set to 0 by the kernel.
- */
-
-#include <sys/shm.h>
-#include "lapi/shmbuf.h"
-#include "libnewipc.h"
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-
-#ifdef HAVE_SHMID64_DS_TIME_HIGH
-
-static void run(void)
-{
- struct shmid64_ds buf_ds = {
- .shm_atime_high = 0x0A0A,
- .shm_dtime_high = 0x0A0A,
- .shm_ctime_high = 0x0A0A,
- };
- int shmid;
- key_t key;
-
- /* get an IPC resource key */
- key = GETIPCKEY();
-
- shmid = shmget(key, SHM_SIZE, IPC_CREAT | IPC_EXCL | SHM_RW);
- if (shmid == -1)
- tst_brk(TBROK | TERRNO, "couldn't create shared memory segment");
-
- TEST(shmctl(shmid, IPC_STAT, (struct shmid_ds *)&buf_ds));
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "shmctl() failed");
-
- if (buf_ds.shm_atime_high || buf_ds.shm_dtime_high || buf_ds.shm_ctime_high)
- tst_res(TFAIL, "time_high fields aren't cleared by the kernel");
- else
- tst_res(TPASS, "time_high fields cleared by the kernel");
-
- SAFE_SHMCTL(shmid, IPC_RMID, NULL);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .needs_tmpdir = 1,
-};
-#else
-TST_TEST_TCONF("test requires struct shmid64_ds to have the time_high fields");
-#endif
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl07.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl07.c
deleted file mode 100644
index 15af7b452..000000000
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl07.c
+++ /dev/null
@@ -1,71 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
- * [Description]
- *
- * Test for a SHM_LOCK and SHM_UNLOCK.
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-#define SHM_SIZE 2048
-
-static int shm_id = -1;
-
-static void verify_shmlock(void)
-{
- struct shmid_ds ds;
-
- TEST(shmctl(shm_id, SHM_LOCK, NULL));
-
- if (TST_RET != 0)
- tst_res(TFAIL | TTERRNO, "shmctl(%i, SHM_LOCK, NULL)", shm_id);
- else
- tst_res(TPASS, "shmctl(%i, SHM_LOCK, NULL)", shm_id);
-
-
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds);
-
- if (ds.shm_perm.mode & SHM_LOCKED)
- tst_res(TPASS, "SMH_LOCKED bit is on in shm_perm.mode");
- else
- tst_res(TFAIL, "SHM_LOCKED bit is off in shm_perm.mode");
-
- TEST(shmctl(shm_id, SHM_UNLOCK, NULL));
-
- if (TST_RET != 0)
- tst_res(TFAIL | TTERRNO, "shmctl(%i, SHM_UNLOCK, NULL)", shm_id);
- else
- tst_res(TPASS, "shmctl(%i, SHM_UNLOCK, NULL)", shm_id);
-
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds);
-
- if (ds.shm_perm.mode & SHM_LOCKED)
- tst_res(TFAIL, "SMH_LOCKED bit is on in shm_perm.mode");
- else
- tst_res(TPASS, "SHM_LOCKED bit is off in shm_perm.mode");
-}
-
-static void setup(void)
-{
- shm_id = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | SHM_RW);
-}
-
-static void cleanup(void)
-{
- if (shm_id >= 0)
- SAFE_SHMCTL(shm_id, IPC_RMID, NULL);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_shmlock,
-};
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl08.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl08.c
deleted file mode 100644
index 88fcfe41f..000000000
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl08.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-
-/*\
- * [Description]
- *
- * Test for a SHM_SET.
- *
- * The test clears the group and others bits from the shm_perm.mode and checks
- * the result as well as if the ctime was updated correctly.
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
-#include "libnewipc.h"
-
-#define SHM_SIZE 2048
-
-static int shm_id = -1;
-
-static int test_ipc_set(struct shmid_ds *ds)
-{
- TEST(shmctl(shm_id, IPC_SET, ds));
-
- if (TST_RET != 0) {
- tst_res(TFAIL, "shmctl(%i, IPC_SET, ...)", shm_id);
- return 1;
- }
-
- tst_res(TPASS, "shmctl(%i, IPC_SET, {shm_perm.mode=%04o})",
- shm_id, ds->shm_perm.mode);
- return 0;
-}
-
-static void check_mode(struct shmid_ds *ds, short exp_mode)
-{
- if (ds->shm_perm.mode == exp_mode) {
- tst_res(TPASS, "shm_perm.mode=%04o", exp_mode);
- return;
- }
-
- tst_res(TFAIL, "shm_perm.mode=%04o, expected %i",
- ds->shm_perm.mode, exp_mode);
-}
-
-static void verify_shmset(void)
-{
- struct shmid_ds ds;
- unsigned short old_mode;
- time_t old_ctime;
-
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds);
-
- old_mode = ds.shm_perm.mode;
- old_ctime = ds.shm_ctime;
-
- check_mode(&ds, 0666);
-
- sleep(1);
-
- ds.shm_perm.mode &= ~0066;
-
- if (test_ipc_set(&ds))
- return;
-
- memset(&ds, 0, sizeof(ds));
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds);
- check_mode(&ds, old_mode & ~0066);
-
- if (ds.shm_ctime <= old_ctime || ds.shm_ctime > old_ctime + 10) {
- tst_res(TFAIL, "shm_ctime not updated old %li new %li",
- (long)old_ctime, (long)ds.shm_ctime);
- } else {
- tst_res(TPASS, "shm_ctime updated correctly diff=%li",
- (long)(ds.shm_ctime - old_ctime));
- }
-
- ds.shm_perm.mode = old_mode;
- if (test_ipc_set(&ds))
- return;
-
- memset(&ds, 0, sizeof(ds));
- SAFE_SHMCTL(shm_id, IPC_STAT, &ds);
- check_mode(&ds, old_mode & MODE_MASK);
-}
-
-static void setup(void)
-{
- shm_id = SAFE_SHMGET(IPC_PRIVATE, SHM_SIZE, IPC_CREAT | 0666);
-}
-
-static void cleanup(void)
-{
- if (shm_id >= 0)
- SAFE_SHMCTL(shm_id, IPC_RMID, NULL);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_shmset,
-};
diff --git a/testcases/kernel/syscalls/ipc/shmdt/Makefile b/testcases/kernel/syscalls/ipc/shmdt/Makefile
index 26b9f264d..f467389b9 100644
--- a/testcases/kernel/syscalls/ipc/shmdt/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmdt/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c b/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c
index 697613a47..fc167e7fd 100644
--- a/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c
+++ b/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c
@@ -184,7 +184,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/shmget/Makefile b/testcases/kernel/syscalls/ipc/shmget/Makefile
index 26b9f264d..f467389b9 100644
--- a/testcases/kernel/syscalls/ipc/shmget/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmget/Makefile
@@ -1,12 +1,23 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../../..
-LTPLIBS = ltpipc
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpipc
-
+include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget01.c b/testcases/kernel/syscalls/ipc/shmget/shmget01.c
index 586f4c263..ae63baf6f 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget01.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget01.c
@@ -149,7 +149,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget02.c b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
index 4436ca7f8..71d161614 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget02.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
@@ -144,7 +144,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget03.c b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
index 96ebf3608..b9ff1a4e6 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget03.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
@@ -123,7 +123,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget04.c b/testcases/kernel/syscalls/ipc/shmget/shmget04.c
index 60a263c77..b0cff3056 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget04.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget04.c
@@ -125,7 +125,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget05.c b/testcases/kernel/syscalls/ipc/shmget/shmget05.c
index de9544591..01770ba7d 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget05.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget05.c
@@ -157,7 +157,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/kcmp/Makefile b/testcases/kernel/syscalls/kcmp/Makefile
index a86863c0d..cb8a3dea3 100644
--- a/testcases/kernel/syscalls/kcmp/Makefile
+++ b/testcases/kernel/syscalls/kcmp/Makefile
@@ -1,5 +1,21 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2015 Cedric Hnyda chnyda@suse.com
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/kcmp/kcmp01.c b/testcases/kernel/syscalls/kcmp/kcmp01.c
index a03a25a2b..31c2ef3b1 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp01.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp01.c
@@ -43,7 +43,7 @@ static struct test_case {
static void setup(void)
{
- fd1 = SAFE_OPEN(TEST_FILE, O_CREAT | O_RDWR | O_TRUNC, 0666);
+ fd1 = SAFE_OPEN(TEST_FILE, O_CREAT | O_RDWR | O_TRUNC);
}
static void cleanup(void)
diff --git a/testcases/kernel/syscalls/kcmp/kcmp02.c b/testcases/kernel/syscalls/kcmp/kcmp02.c
index 993d9a4a4..1885dc968 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp02.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp02.c
@@ -54,8 +54,8 @@ static void setup(void)
pid1 = getpid();
pid_unused = tst_get_unused_pid();
- fd1 = SAFE_OPEN(TEST_FILE, O_CREAT | O_RDWR | O_TRUNC, 0644);
- fd2 = SAFE_OPEN(TEST_FILE2, O_CREAT | O_RDWR | O_TRUNC, 0644);
+ fd1 = SAFE_OPEN(TEST_FILE, O_CREAT | O_RDWR | O_TRUNC);
+ fd2 = SAFE_OPEN(TEST_FILE2, O_CREAT | O_RDWR | O_TRUNC);
}
static void cleanup(void)
diff --git a/testcases/kernel/syscalls/keyctl/Makefile b/testcases/kernel/syscalls/keyctl/Makefile
index 180ece25a..9ccb35741 100644
--- a/testcases/kernel/syscalls/keyctl/Makefile
+++ b/testcases/kernel/syscalls/keyctl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/keyctl/keyctl05.c b/testcases/kernel/syscalls/keyctl/keyctl05.c
index 7d7c076c0..c592eb49e 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl05.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl05.c
@@ -71,8 +71,6 @@ static const char x509_cert[] =
"\x83\x8d\x69\xda\xd6\x59\xbd"
;
- static int fips_enabled;
-
static void new_session_keyring(void)
{
TEST(keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL));
@@ -87,31 +85,25 @@ static void test_update_nonupdatable(const char *type,
new_session_keyring();
- int is_asymmetric = !strcmp(type, "asymmetric");
-
TEST(add_key(type, "desc", payload, plen, KEY_SPEC_SESSION_KEYRING));
if (TST_RET < 0) {
- if (TST_ERR == EINVAL && is_asymmetric && fips_enabled) {
- tst_res(TCONF, "key size not allowed in FIPS mode");
- return;
- }
if (TST_ERR == ENODEV) {
tst_res(TCONF, "kernel doesn't support key type '%s'",
type);
return;
}
- if (TST_ERR == EBADMSG && is_asymmetric) {
+ if (TST_ERR == EBADMSG && !strcmp(type, "asymmetric")) {
tst_res(TCONF, "kernel is missing x509 cert parser "
"(CONFIG_X509_CERTIFICATE_PARSER)");
return;
}
- if (TST_ERR == ENOENT && is_asymmetric) {
+ if (TST_ERR == ENOENT && !strcmp(type, "asymmetric")) {
tst_res(TCONF, "kernel is missing crypto algorithms "
"needed to parse x509 cert (CONFIG_CRYPTO_RSA "
"and/or CONFIG_CRYPTO_SHA256)");
return;
}
- tst_res(TFAIL | TTERRNO, "unexpected error adding '%s' key",
+ tst_res(TBROK | TTERRNO, "unexpected error adding '%s' key",
type);
return;
}
@@ -123,7 +115,7 @@ static void test_update_nonupdatable(const char *type,
*/
TEST(keyctl(KEYCTL_SETPERM, keyid, KEY_POS_ALL));
if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TBROK | TTERRNO,
"failed to grant write permission to '%s' key", type);
return;
}
@@ -131,12 +123,12 @@ static void test_update_nonupdatable(const char *type,
tst_res(TINFO, "Try to update the '%s' key...", type);
TEST(keyctl(KEYCTL_UPDATE, keyid, payload, plen));
if (TST_RET == 0) {
- tst_res(TFAIL,
+ tst_res(TBROK,
"updating '%s' key unexpectedly succeeded", type);
return;
}
if (TST_ERR != EOPNOTSUPP) {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TBROK | TTERRNO,
"updating '%s' key unexpectedly failed", type);
return;
}
@@ -159,7 +151,7 @@ static void test_update_setperm_race(void)
TEST(add_key("user", "desc", payload, sizeof(payload),
KEY_SPEC_SESSION_KEYRING));
if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO, "failed to add 'user' key");
+ tst_res(TBROK | TTERRNO, "failed to add 'user' key");
return;
}
keyid = TST_RET;
@@ -180,7 +172,7 @@ static void test_update_setperm_race(void)
for (i = 0; i < 10000; i++) {
TEST(keyctl(KEYCTL_UPDATE, keyid, payload, sizeof(payload)));
if (TST_RET != 0 && TST_ERR != EACCES) {
- tst_res(TFAIL | TTERRNO, "failed to update 'user' key");
+ tst_res(TBROK | TTERRNO, "failed to update 'user' key");
return;
}
}
@@ -188,11 +180,6 @@ static void test_update_setperm_race(void)
tst_res(TPASS, "didn't crash while racing to update 'user' key");
}
-static void setup(void)
-{
- fips_enabled = tst_fips_enabled();
-}
-
static void do_test(unsigned int i)
{
/*
@@ -218,7 +205,6 @@ static void do_test(unsigned int i)
static struct tst_test test = {
.tcnt = 3,
- .setup = setup,
.test = do_test,
.forks_child = 1,
.tags = (const struct tst_tag[]) {
diff --git a/testcases/kernel/syscalls/kill/.gitignore b/testcases/kernel/syscalls/kill/.gitignore
index 75fdaa561..490a1e27f 100644
--- a/testcases/kernel/syscalls/kill/.gitignore
+++ b/testcases/kernel/syscalls/kill/.gitignore
@@ -1,5 +1,7 @@
+/kill01
/kill02
/kill03
+/kill04
/kill05
/kill06
/kill07
diff --git a/testcases/kernel/syscalls/kill/Makefile b/testcases/kernel/syscalls/kill/Makefile
index 0cc064b32..23dabfc37 100644
--- a/testcases/kernel/syscalls/kill/Makefile
+++ b/testcases/kernel/syscalls/kill/Makefile
@@ -1,13 +1,41 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpipc ltpnewipc
-
include $(top_srcdir)/include/mk/testcases.mk
-kill07: LTPLDLIBS = -lltpipc
-kill05: LTPLDLIBS = -lltpnewipc
+LDLIBS += -lipc
+
+LIBDIR := ../ipc/lib
+
+LIB := $(LIBDIR)/libipc.a
+
+$(LIBDIR):
+ mkdir -p "$@"
+
+$(LIB): $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS := $(LIB)
+
+CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR)
+
+LDFLAGS += -L$(abs_builddir)/$(LIBDIR)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/kill/kill01.c b/testcases/kernel/syscalls/kill/kill01.c
new file mode 100644
index 000000000..0aa77b967
--- /dev/null
+++ b/testcases/kernel/syscalls/kill/kill01.c
@@ -0,0 +1,161 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * kill01.c
+ *
+ * DESCRIPTION
+ * Test case to check the basic functionality of kill().
+ *
+ * ALGORITHM
+ * call setup
+ * loop if the -i option was given
+ * fork a child
+ * execute the kill system call
+ * check the return value
+ * if return value is -1
+ * issue a FAIL message, break remaining tests and cleanup
+ * if we are doing functional testing
+ * if the process was terminated with the expected signal.
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE
+ * kill01 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * This test should be ran as a non-root user.
+ */
+
+#include "test.h"
+
+#include <signal.h>
+#include <errno.h>
+#include <sys/wait.h>
+
+void cleanup(void);
+void setup(void);
+void do_child(void);
+
+char *TCID = "kill01";
+int TST_TOTAL = 1;
+
+#define TEST_SIG SIGKILL
+
+int main(int ac, char **av)
+{
+ int lc;
+ pid_t pid;
+ int exno, status, nsig;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "");
+#endif
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+ status = 1;
+ exno = 1;
+ pid = FORK_OR_VFORK();
+ if (pid < 0) {
+ tst_brkm(TBROK, cleanup, "Fork of child failed");
+ } else if (pid == 0) {
+#ifdef UCLINUX
+ if (self_exec(av[0], "") < 0) {
+ tst_brkm(TBROK, cleanup,
+ "self_exec of child failed");
+ }
+#else
+ do_child();
+#endif
+ } else {
+ TEST(kill(pid, TEST_SIG));
+ waitpid(pid, &status, 0);
+ }
+
+ if (TEST_RETURN == -1) {
+ tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+
+ /*
+ * Check to see if the process was terminated with the
+ * expected signal.
+ */
+ nsig = WTERMSIG(status);
+ if (nsig == TEST_SIG) {
+ tst_resm(TPASS, "received expected signal %d",
+ nsig);
+ } else {
+ tst_resm(TFAIL,
+ "expected signal %d received %d",
+ TEST_SIG, nsig);
+ }
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * do_child()
+ */
+void do_child(void)
+{
+ int exno = 1;
+
+ pause();
+ exit(exno);
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/kill/kill02.c b/testcases/kernel/syscalls/kill/kill02.c
index 7ae2427c8..08360ddbe 100644
--- a/testcases/kernel/syscalls/kill/kill02.c
+++ b/testcases/kernel/syscalls/kill/kill02.c
@@ -349,7 +349,7 @@ void parent_rout(void)
TEST(kill(0, SIGUSR1));
if (TEST_RETURN == -1) {
- tst_brkm(TBROK | TTERRNO, NULL, "kill() failed");
+ tst_brkm(TBROK | TERRNO, NULL, "kill() failed");
(void)par_kill();
cleanup();
}
diff --git a/testcases/kernel/syscalls/kill/kill03.c b/testcases/kernel/syscalls/kill/kill03.c
index 7d3070678..5770ae08c 100644
--- a/testcases/kernel/syscalls/kill/kill03.c
+++ b/testcases/kernel/syscalls/kill/kill03.c
@@ -1,58 +1,165 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * 1) kill() fails with errno set to EINVAL if given an invalid signal.
- * 2) kill() fails with errno set to ESRCH if given a non-existent pid.
- * 3) kill() fails with errno set to ESRCH if the given pid is INT_MIN.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * kill03.c
+ *
+ * DESCRIPTION
+ * Test case to check that kill fails when given an invalid signal.
+ *
+ * ALGORITHM
+ * call setup
+ * loop if the -i option was given
+ * fork a child
+ * execute the kill system call with an invalid signal
+ * check the return value
+ * if return value is not -1
+ * issue a FAIL message, break remaining tests and cleanup
+ * if we are doing functional testing
+ * if the errno was set to 22 (invalid argument).
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE
+ * kill03 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * none
*/
-#include <sys/types.h>
+#include "test.h"
+
#include <signal.h>
-#include <unistd.h>
-#include "tst_test.h"
-
-static pid_t real_pid, fake_pid, int_min_pid;
-
-static struct tcase {
- int test_sig;
- int exp_errno;
- pid_t *pid;
-} tcases[] = {
- {2000, EINVAL, &real_pid},
- {SIGKILL, ESRCH, &fake_pid},
- {SIGKILL, ESRCH, &int_min_pid}
-};
-
-static void verify_kill(unsigned int n)
+#include <errno.h>
+#include <sys/wait.h>
+
+void cleanup(void);
+void setup(void);
+void do_child(void);
+
+char *TCID = "kill03";
+int TST_TOTAL = 1;
+
+#define TEST_SIG 2000
+
+int main(int ac, char **av)
{
- struct tcase *tc = &tcases[n];
+ int lc;
+ pid_t pid;
+ int exno, status;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "");
+#endif
+
+ setup();
- TEST(kill(*tc->pid, tc->test_sig));
- if (TST_RET != -1) {
- tst_res(TFAIL, "kill should fail but not, return %ld", TST_RET);
- return;
+ /* The following loop checks looping state if -i option given */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+ status = 1;
+ exno = 1;
+ pid = FORK_OR_VFORK();
+ if (pid < 0) {
+ tst_brkm(TBROK, cleanup, "Fork of child failed");
+ } else if (pid == 0) {
+#ifdef UCLINUX
+ if (self_exec(av[0], "") < 0) {
+ tst_brkm(TBROK, cleanup,
+ "self_exec of child failed");
+ }
+#else
+ do_child();
+#endif
+ } else {
+ TEST(kill(pid, TEST_SIG));
+ kill(pid, SIGKILL);
+ waitpid(pid, &status, 0);
+ }
+
+ if (TEST_RETURN != -1) {
+ tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s "
+ "Expected a return value of -1 got %ld",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO),
+ TEST_RETURN);
+ }
+
+ /*
+ * Check to see if the errno was set to the expected
+ * value of 22 : EINVAL.
+ */
+ if (TEST_ERRNO == EINVAL) {
+ tst_resm(TPASS, "errno set to %d : %s, as "
+ "expected", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "errno set to %d : %s expected "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO), 22,
+ strerror(22));
+ }
}
- if (tc->exp_errno == TST_ERR)
- tst_res(TPASS | TTERRNO, "kill failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "kill expected %s but got",
- tst_strerrno(tc->exp_errno));
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+/*
+ * do_child()
+ */
+void do_child(void)
{
- real_pid = getpid();
- fake_pid = tst_get_unused_pid();
- int_min_pid = INT_MIN;
+ int exno = 1;
+
+ pause();
+ exit(exno);
}
-static struct tst_test test = {
- .test = verify_kill,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
-};
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/kill/kill04.c b/testcases/kernel/syscalls/kill/kill04.c
new file mode 100644
index 000000000..f3bec1367
--- /dev/null
+++ b/testcases/kernel/syscalls/kill/kill04.c
@@ -0,0 +1,133 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * kill04.c
+ *
+ * DESCRIPTION
+ * Test case to check that kill() fails when passed a non-existant pid.
+ *
+ * ALGORITHM
+ * call setup
+ * loop if the -i option was given
+ * fork a child
+ * execute the kill system call with a non-existant PID
+ * check the return value
+ * if return value is not -1
+ * issue a FAIL message, break remaining tests and cleanup
+ * if we are doing functional testing
+ * if the errno was set to 3 (No such proccess)
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE
+ * kill04 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * This test should be run by a non-root user
+ */
+
+#include "test.h"
+
+#include <signal.h>
+#include <errno.h>
+#include <sys/wait.h>
+
+void cleanup(void);
+void setup(void);
+void do_child(void);
+
+char *TCID = "kill04";
+int TST_TOTAL = 1;
+
+#define TEST_SIG SIGKILL
+
+int main(int ac, char **av)
+{
+ int lc;
+ pid_t fake_pid;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ /* The following loop checks looping state if -i option given */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ fake_pid = tst_get_unused_pid(cleanup);
+ TEST(kill(fake_pid, TEST_SIG));
+
+ if (TEST_RETURN != -1) {
+ tst_brkm(TFAIL, cleanup, "%s failed - errno = %d : %s "
+ "Expected a return value of -1 got %ld",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO),
+ TEST_RETURN);
+ }
+
+ /*
+ * Check to see if the errno was set to the expected
+ * value of 3 : ESRCH
+ */
+ if (TEST_ERRNO == ESRCH) {
+ tst_resm(TPASS, "errno set to %d : %s, as "
+ "expected", TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TFAIL, "errno set to %d : %s expected "
+ "%d : %s", TEST_ERRNO,
+ strerror(TEST_ERRNO), 3, strerror(3));
+ }
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/kill/kill05.c b/testcases/kernel/syscalls/kill/kill05.c
index e694126f6..ccef5afd6 100644
--- a/testcases/kernel/syscalls/kill/kill05.c
+++ b/testcases/kernel/syscalls/kill/kill05.c
@@ -1,8 +1,56 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * Test case to check that kill() fails when passed a pid owned by another user.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * kill05.c
+ *
+ * DESCRIPTION
+ * Test case to check that kill() fails when passed a pid owned by another
+ * user.
+ *
+ * ALGORITHM
+ * call setup
+ * loop if the -i option was given
+ * setup a shared memory segment to for a flag which will notify
+ * ltpuser1's process that life is not worth living in a continuous loop.
+ * fork a child and set the euid to ltpuser1
+ * set the parents euid to ltpuser2
+ * execute the kill system call on ltpuser1's pid
+ * check the return value
+ * if return value is not -1
+ * issue a FAIL message, break remaining tests and cleanup
+ * if we are doing functional testing
+ * if the errno was set to 1 (Operation not permitted)
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE
+ * kill05 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
@@ -15,99 +63,180 @@
*
* RESTRICTIONS
* This test must be run as root.
+ * Looping with the -i option does not work correctly.
*/
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
#include <sys/wait.h>
+#include <errno.h>
#include <pwd.h>
+#include <signal.h>
+#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#include "tst_test.h"
-#include "libnewipc.h"
-#include "tst_safe_sysv_ipc.h"
-#include "tst_safe_macros.h"
+#include <unistd.h>
+
+#include "test.h"
+#include "safe_macros.h"
+
+extern void rm_shm(int);
+
+void cleanup(void);
+void setup(void);
+void do_child(void);
+void do_master_child(char **av);
-static uid_t nobody_uid, bin_uid;
-static int *flag;
-static int shm_id = -1;
-static key_t shm_key;
+char *TCID = "kill05";
+int TST_TOTAL = 1;
+int shmid1 = -1;
+extern key_t semkey;
+int *flag;
-static void wait_for_flag(int value)
+extern int getipckey();
+
+#define TEST_SIG SIGKILL
+
+int main(int ac, char **av)
+{
+ pid_t pid;
+ int status;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "");
+#endif
+
+ setup(); /* global setup */
+
+ pid = FORK_OR_VFORK();
+ if (pid == -1)
+ tst_brkm(TBROK, cleanup, "Fork failed");
+ else if (pid == 0)
+ do_master_child(av);
+
+ if (waitpid(pid, &status, 0) == -1)
+ tst_resm(TBROK | TERRNO, "waitpid failed");
+ else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ tst_resm(TFAIL, "child exited abnormally");
+ else
+ tst_resm(TPASS, "received expected errno(EPERM)");
+ cleanup();
+ tst_exit();
+}
+
+void wait_for_flag(int value)
{
while (1) {
if (*flag == value)
break;
else
- usleep(100);
+ sleep(1);
}
}
-static void do_master_child(void)
+/*
+ * do_master_child()
+ */
+void do_master_child(char **av)
{
pid_t pid1;
+ int status;
+
+ char user1name[] = "nobody";
+ char user2name[] = "bin";
+
+ struct passwd *ltpuser1, *ltpuser2;
+
+ tst_count = 0;
*flag = 0;
- pid1 = SAFE_FORK();
+
+ pid1 = FORK_OR_VFORK();
+
+ if (pid1 == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "Fork failed");
+
if (pid1 == 0) {
- SAFE_SETREUID(nobody_uid, nobody_uid);
+ ltpuser1 = SAFE_GETPWNAM(NULL, user1name);
+ if (setreuid(ltpuser1->pw_uid, ltpuser1->pw_uid) == -1) {
+ perror("setreuid failed (in child)");
+ exit(1);
+ }
*flag = 1;
- wait_for_flag(2);
-
- exit(0);
+#ifdef UCLINUX
+ if (self_exec(av[0], "") < 0) {
+ perror("self_exec failed");
+ exit(1);
+ }
+#else
+ do_child();
+#endif
+ }
+ ltpuser2 = SAFE_GETPWNAM(NULL, user2name);
+ if (setreuid(ltpuser2->pw_uid, ltpuser2->pw_uid) == -1) {
+ perror("seteuid failed");
+ exit(1);
}
- SAFE_SETREUID(bin_uid, bin_uid);
+ /* wait until child sets its euid */
wait_for_flag(1);
- TEST(kill(pid1, SIGKILL));
- *flag = 2;
- SAFE_WAITPID(pid1, NULL, 0);
+ TEST(kill(pid1, TEST_SIG));
- if (TST_RET == 0)
- tst_brk(TFAIL, "kill succeeded unexpectedly");
+ /* signal the child that we're done */
+ *flag = 2;
- if (TST_ERR == EPERM)
- tst_res(TPASS, "kill failed with EPERM");
- else
- tst_res(TFAIL | TTERRNO, "kill failed expected EPERM, but got");
-}
+ if (waitpid(pid1, &status, 0) == -1) {
+ perror("waitpid failed");
+ exit(1);
+ }
-static void verify_kill(void)
-{
- pid_t pid;
+ if (TEST_RETURN != -1) {
+ printf("kill succeeded unexpectedly\n");
+ exit(1);
+ }
- pid = SAFE_FORK();
- if (pid == 0) {
- do_master_child();
+ /*
+ * Check to see if the errno was set to the expected
+ * value of 1 : EPERM
+ */
+ if (TEST_ERRNO == EPERM) {
+ printf("kill failed with EPERM\n");
exit(0);
}
+ perror("kill failed unexpectedly");
+ exit(1);
+}
- tst_reap_children();
+void do_child(void)
+{
+ wait_for_flag(2);
+ exit(0);
}
-static void setup(void)
+void setup(void)
{
- struct passwd *pw;
+ tst_require_root();
+
+ TEST_PAUSE;
- shm_key = GETIPCKEY();
- shm_id = SAFE_SHMGET(shm_key, getpagesize(), 0666 | IPC_CREAT);
- flag = SAFE_SHMAT(shm_id, 0, 0);
+ tst_tmpdir();
- pw = SAFE_GETPWNAM("nobody");
- nobody_uid = pw->pw_uid;
+ semkey = getipckey();
- pw = SAFE_GETPWNAM("bin");
- bin_uid = pw->pw_uid;
+ if ((shmid1 = shmget(semkey, getpagesize(), 0666 | IPC_CREAT)) == -1)
+ tst_brkm(TBROK, cleanup, "Failed to setup shared memory");
+
+ if ((flag = shmat(shmid1, 0, 0)) == (int *)-1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "Failed to attach shared memory:%d", shmid1);
}
-static void cleanup(void)
+void cleanup(void)
{
- if (shm_id != -1)
- SAFE_SHMCTL(shm_id, IPC_RMID, NULL);
-}
+ rm_shm(shmid1);
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = verify_kill,
- .needs_root = 1,
- .forks_child = 1,
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/kill/kill06.c b/testcases/kernel/syscalls/kill/kill06.c
index 42003a684..7a1e8bf3a 100644
--- a/testcases/kernel/syscalls/kill/kill06.c
+++ b/testcases/kernel/syscalls/kill/kill06.c
@@ -1,49 +1,187 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * Test case to check the basic functionality of kill() when killing an
- * entire process group with a negative pid.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * kill06.c
+ *
+ * DESCRIPTION
+ * Test case to check the basic functionality of kill() when killing an
+ * entire process group with a negative pid.
+ *
+ * ALGORITHM
+ * call setup
+ * loop if the -i option was given
+ * fork 5 children
+ * execute the kill system call
+ * check the return value
+ * if return value is -1
+ * issue a FAIL message, break remaining tests and cleanup
+ * if we are doing functional testing
+ * if the processes were terminated with the expected signal.
+ * issue a PASS message
+ * otherwise
+ * issue a FAIL message
+ * call cleanup
+ *
+ * USAGE
+ * kill06 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * This test should be run as a non-root user.
*/
-#include <sys/types.h>
+#include "test.h"
+
#include <signal.h>
+#include <errno.h>
#include <sys/wait.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "tst_test.h"
-static void verify_kill(void)
+void cleanup(void);
+void setup(void);
+void do_child(void);
+
+char *TCID = "kill06";
+int TST_TOTAL = 1;
+
+#define TEST_SIG SIGKILL
+
+int main(int ac, char **av)
{
- int nsig, i, status;
+ int lc;
+ pid_t pid1, pid2;
+ int exno, status, nsig, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "");
+#endif
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+ status = 1;
+ exno = 1;
+
+ /* Fork a process and set the process group so that */
+ /* it is different from this one. Fork 5 more children. */
+
+ pid1 = FORK_OR_VFORK();
+ if (pid1 < 0) {
+ tst_brkm(TBROK, cleanup, "Fork of first child failed");
+ } else if (pid1 == 0) {
+ setpgrp();
+ for (i = 0; i < 5; i++) {
+ pid2 = FORK_OR_VFORK();
+ if (pid2 < 0) {
+ tst_brkm(TBROK, cleanup, "Fork failed");
+ } else if (pid2 == 0) {
+#ifdef UCLINUX
+ if (self_exec(av[0], "") < 0) {
+ tst_brkm(TBROK, cleanup,
+ "self_exec of "
+ "child failed");
+ }
+#else
+ do_child();
+#endif
+ }
+ }
+ /* Kill all processes in this process group */
+ TEST(kill(-getpgrp(), TEST_SIG));
+ sleep(300);
- if (!SAFE_FORK()) {
- setpgrp();
- for (i = 0; i < 5; i++) {
- if (!SAFE_FORK())
- pause();
+ tst_resm(TINFO, "%d never received a"
+ " signal", getpid());
+ exit(exno);
+ } else {
+ waitpid(pid1, &status, 0);
+ if (TEST_RETURN != 0) {
+ tst_brkm(TFAIL, cleanup, "%s failed - errno = "
+ "%d : %s", TCID, TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ }
}
- TEST(kill(-getpgrp(), SIGKILL));
- if (TST_RET != 0)
- tst_res(TFAIL | TTERRNO, "kill failed");
- exit(0);
+ /*
+ * Check to see if the process was terminated with the
+ * expected signal.
+ */
+ nsig = WTERMSIG(status);
+ if (!nsig) {
+ tst_resm(TFAIL, "Did not receive any signal");
+ } else if (nsig == TEST_SIG) {
+ tst_resm(TPASS, "received expected signal %d",
+ nsig);
+ } else {
+ tst_resm(TFAIL,
+ "expected signal %d received %d",
+ TEST_SIG, nsig);
+ }
}
- SAFE_WAITPID(-1, &status, 0);
- nsig = WTERMSIG(status);
- if (nsig != SIGKILL) {
- tst_brk(TFAIL, "wait: unexpected signal %d returned, "
- "expected SIGKILL(9)", nsig);
- }
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * do_child()
+ */
+void do_child(void)
+{
+ int exno = 1;
+
+ sleep(299);
- tst_res(TPASS, "receive expected signal SIGKILL(9)");
+ tst_resm(TINFO, "%d never received a" " signal", getpid());
+ exit(exno);
}
-static struct tst_test test = {
- .forks_child = 1,
- .test_all = verify_kill,
-};
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+ /* Setup default signal handling */
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/kill/kill07.c b/testcases/kernel/syscalls/kill/kill07.c
index c566a0a09..60904dd2b 100644
--- a/testcases/kernel/syscalls/kill/kill07.c
+++ b/testcases/kernel/syscalls/kill/kill07.c
@@ -214,7 +214,7 @@ void setup(void)
/*
* Create a temporary directory and cd into it.
* This helps to ensure that a unique msgkey is created.
- * See libs/libltpipc/libipc.c for more information.
+ * See ../lib/libipc.c for more information.
*/
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
index 918f17f22..83fba5beb 100644
--- a/testcases/kernel/syscalls/kill/kill11.c
+++ b/testcases/kernel/syscalls/kill/kill11.c
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/* IBM Corporation
* 01/02/2003 Port to LTP avenkat@us.ibm.com
* 06/30/2001 Port to Linux nsharoff@us.ibm.com
@@ -6,14 +5,31 @@
* Copyright (c) International Business Machines Corp., 2002
* Copyright (c) Cyril Hrubis <chrubis@suse.cz> 2014
*
- * Test checks that when a child is killed by its parent with sig, it
- * returns the correct values(sig and core dump bit) to the waiting parent.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * RESTRICTIONS
- * The ulimit for core file size must be greater than 0.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+
+ Test check that when a child is killed by its parent, it returns the correct
+ values to the waiting parent--default behaviour assumed by child.
+
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
+
+#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <signal.h>
@@ -22,9 +38,27 @@
#include <sys/wait.h>
#include <sys/resource.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
-static struct tcase {
+#define FAILED 0
+#define PASSED 1
+
+char *TCID = "kill11";
+
+int local_flag = PASSED;
+int block_number;
+FILE *temp;
+int TST_TOTAL = 1;
+static int sig;
+
+void setup(void);
+void do_child(void);
+
+/*
+ * These signals terminate process by default, some create core file.
+ */
+struct tcase {
int sig;
int dumps_core;
} tcases[] = {
@@ -44,9 +78,6 @@ static struct tcase {
{SIGPIPE, 0},
{SIGALRM, 0},
{SIGTERM, 0},
-#ifdef SIGSTKFLT
- {SIGSTKFLT, 0},
-#endif
{SIGXCPU, 1},
{SIGXFSZ, 1},
{SIGVTALRM, 0},
@@ -56,76 +87,126 @@ static struct tcase {
{SIGSYS, 1},
};
-static void verify_kill(unsigned int n)
+static void verify_kill(struct tcase *t)
{
int core;
- pid_t pid, npid;
- int nsig, status;
- struct tcase *tc = &tcases[n];
+ int pid, npid;
+ int nsig, nexno, status;
+
+ if (t->sig != SIGKILL) {
+#ifndef BCS
+ if (t->sig != SIGSTOP)
+#endif
+ if (sigset(t->sig, SIG_DFL) == SIG_ERR) {
+ tst_brkm(TBROK | TERRNO, tst_rmdir,
+ "sigset(%d) failed", sig);
+ }
+ }
+
+ pid = FORK_OR_VFORK();
+ if (pid < 0)
+ tst_brkm(TBROK | TERRNO, tst_rmdir, "fork() failed");
- pid = SAFE_FORK();
- if (!pid)
- pause();
+ if (pid == 0) {
+#ifdef UCLINUX
+ if (self_exec(argv[0], "dd", t->sig) < 0)
+ exit(1);
+#else
+ do_child();
+#endif
+ }
- SAFE_KILL(pid, tc->sig);
- npid = SAFE_WAIT(&status);
+ kill(pid, t->sig);
+ npid = wait(&status);
if (npid != pid) {
- tst_res(TFAIL, "wait() returned %d, expected %d", npid, pid);
+ tst_resm(TFAIL, "wait() returned %d, expected %d", npid, pid);
return;
}
nsig = WTERMSIG(status);
+#ifdef WCOREDUMP
core = WCOREDUMP(status);
+#endif
+ nexno = WIFEXITED(status);
- if (tc->dumps_core) {
+ if (t->dumps_core) {
if (!core) {
- tst_res(TFAIL, "core dump bit not set for %s", tst_strsig(tc->sig));
+ tst_resm(TFAIL, "core dump bit not set for %s", tst_strsig(t->sig));
return;
}
} else {
if (core) {
- tst_res(TFAIL, "core dump bit set for %s", tst_strsig(tc->sig));
+ tst_resm(TFAIL, "core dump bit set for %s", tst_strsig(t->sig));
return;
}
}
- if (nsig != tc->sig) {
- tst_res(TFAIL, "wait: unexpected signal %d returned, expected %d", nsig, tc->sig);
+ if (nsig != t->sig) {
+ tst_resm(TFAIL, "wait: unexpected signal %d returned, expected %d", nsig, t->sig);
+ return;
+ }
+
+ if (nexno != 0) {
+ tst_resm(TFAIL,
+ "signal: unexpected exit number %d returned, expected 0\n",
+ nexno);
return;
}
- tst_res(TPASS, "signal %-16s%s", tst_strsig(tc->sig),
- tc->dumps_core ? " dumped core" : "");
+ tst_resm(TPASS, "signal %-16s%s", tst_strsig(t->sig),
+ t->dumps_core ? " dumped core" : "");
}
-#define MIN_RLIMIT_CORE (512 * 1024)
+int main(int argc, char **argv)
+{
+ int lc;
+ unsigned int i;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "dd", &sig);
+#endif
+
+ setup();
-static void setup(void)
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ for (i = 0; i < ARRAY_SIZE(tcases); i++)
+ verify_kill(tcases + i);
+ }
+
+ tst_rmdir();
+ tst_exit();
+}
+
+void do_child(void)
+{
+ int i;
+
+ for (i = 0; i < 180; i++)
+ sleep(1);
+
+ fprintf(stderr, "Child missed siggnal");
+ fflush(stderr);
+ exit(1);
+}
+
+/* 1024 GNU blocks */
+#define MIN_RLIMIT_CORE (1024 * 1024)
+
+void setup(void)
{
struct rlimit rlim;
- SAFE_GETRLIMIT(RLIMIT_CORE, &rlim);
+ SAFE_GETRLIMIT(NULL, RLIMIT_CORE, &rlim);
- if (rlim.rlim_max < MIN_RLIMIT_CORE) {
- if (geteuid() != 0) {
- tst_brk(TCONF, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)",
- rlim.rlim_max, MIN_RLIMIT_CORE);
- }
- tst_res(TINFO, "Raising rlim_max to %i", MIN_RLIMIT_CORE);
- rlim.rlim_max = MIN_RLIMIT_CORE;
- }
if (rlim.rlim_cur < MIN_RLIMIT_CORE) {
- tst_res(TINFO, "Adjusting RLIMIT_CORE to %i", MIN_RLIMIT_CORE);
+ tst_resm(TINFO, "Adjusting RLIMIT_CORE to %i", MIN_RLIMIT_CORE);
rlim.rlim_cur = MIN_RLIMIT_CORE;
- SAFE_SETRLIMIT(RLIMIT_CORE, &rlim);
+ SAFE_SETRLIMIT(NULL, RLIMIT_CORE, &rlim);
}
-}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .forks_child = 1,
- .setup = setup,
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_kill,
-};
+ temp = stderr;
+ tst_tmpdir();
+}
diff --git a/testcases/kernel/syscalls/lchown/Makefile b/testcases/kernel/syscalls/lchown/Makefile
index 305fee281..a5b2431c4 100644
--- a/testcases/kernel/syscalls/lchown/Makefile
+++ b/testcases/kernel/syscalls/lchown/Makefile
@@ -1,11 +1,26 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-SRCS := $(sort $(wildcard $(abs_srcdir)/lchown*.c))
+SRCS := $(wildcard $(abs_srcdir)/lchown*.c)
include $(abs_srcdir)/../utils/compat_16.mk
diff --git a/testcases/kernel/syscalls/lchown/lchown01.c b/testcases/kernel/syscalls/lchown/lchown01.c
index 4e6076e1f..89c85e987 100644
--- a/testcases/kernel/syscalls/lchown/lchown01.c
+++ b/testcases/kernel/syscalls/lchown/lchown01.c
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
SFILE, TEST_ERRNO);
}
- if ((int)user_id == -1) {
+ if (user_id == -1) {
if (i > 0)
user_id =
test_cases[i - 1].user_id;
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
user_id = geteuid();
}
- if ((int)group_id == -1) {
+ if (group_id == -1) {
if (i > 0)
group_id =
test_cases[i - 1].group_id;
diff --git a/testcases/kernel/syscalls/lgetxattr/Makefile b/testcases/kernel/syscalls/lgetxattr/Makefile
index 28f5f6f9a..b788fed03 100644
--- a/testcases/kernel/syscalls/lgetxattr/Makefile
+++ b/testcases/kernel/syscalls/lgetxattr/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 Fujitsu Ltd.
# Author: Jinbao Huang <huangjb.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/link/Makefile b/testcases/kernel/syscalls/link/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/link/Makefile
+++ b/testcases/kernel/syscalls/link/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/linkat/Makefile b/testcases/kernel/syscalls/linkat/Makefile
index ad134b1d4..44de511b9 100644
--- a/testcases/kernel/syscalls/linkat/Makefile
+++ b/testcases/kernel/syscalls/linkat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/listen/Makefile b/testcases/kernel/syscalls/listen/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/listen/Makefile
+++ b/testcases/kernel/syscalls/listen/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/listxattr/Makefile b/testcases/kernel/syscalls/listxattr/Makefile
index c2f84b159..b794ec01f 100644
--- a/testcases/kernel/syscalls/listxattr/Makefile
+++ b/testcases/kernel/syscalls/listxattr/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 RT-RK Institute for Computer Based Systems
# Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/llistxattr/Makefile b/testcases/kernel/syscalls/llistxattr/Makefile
index c7810c9fd..ed05a4826 100644
--- a/testcases/kernel/syscalls/llistxattr/Makefile
+++ b/testcases/kernel/syscalls/llistxattr/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 Fujitsu Ltd.
# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/llseek/Makefile b/testcases/kernel/syscalls/llseek/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/llseek/Makefile
+++ b/testcases/kernel/syscalls/llseek/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c b/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c
index 590f5a6f3..0c19c62ac 100644
--- a/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c
+++ b/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c
@@ -95,7 +95,7 @@ static void verify_lremovexattr(void)
return;
}
- if (strncmp(got_value, XATTR_VALUE, XATTR_VALUE_SIZE)) {
+ if (strcmp(got_value, XATTR_VALUE)) {
tst_res(TFAIL, "lremovexattr(2) changed file attribute");
return;
}
diff --git a/testcases/kernel/syscalls/lseek/Makefile b/testcases/kernel/syscalls/lseek/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/lseek/Makefile
+++ b/testcases/kernel/syscalls/lseek/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/lstat/Makefile b/testcases/kernel/syscalls/lstat/Makefile
index d97d2bad0..bf1201019 100644
--- a/testcases/kernel/syscalls/lstat/Makefile
+++ b/testcases/kernel/syscalls/lstat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/madvise/Makefile b/testcases/kernel/syscalls/madvise/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/madvise/Makefile
+++ b/testcases/kernel/syscalls/madvise/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/madvise/madvise06.c b/testcases/kernel/syscalls/madvise/madvise06.c
index 63d8d5452..f76f3f6aa 100644
--- a/testcases/kernel/syscalls/madvise/madvise06.c
+++ b/testcases/kernel/syscalls/madvise/madvise06.c
@@ -3,38 +3,22 @@
* Copyright (c) 2016 Red Hat, Inc.
*/
-/*\
- * [Description]
- *
- * Page fault occurs in spite that madvise(WILLNEED) system call is called
- * to prefetch the page. This issue is reproduced by running a program
- * which sequentially accesses to a shared memory and calls madvise(WILLNEED)
- * to the next page on a page fault.
- *
- * This bug is present in all RHEL7 versions. It looks like this was fixed in
- * mainline kernel > v3.15 by the following patch:
+/*
+ * DESCRIPTION
*
- * commit 55231e5c898c5c03c14194001e349f40f59bd300
- * Author: Johannes Weiner <hannes@cmpxchg.org>
- * Date: Thu May 22 11:54:17 2014 -0700
+ * Page fault occurs in spite that madvise(WILLNEED) system call is called
+ * to prefetch the page. This issue is reproduced by running a program
+ * which sequentially accesses to a shared memory and calls madvise(WILLNEED)
+ * to the next page on a page fault.
*
- * mm: madvise: fix MADV_WILLNEED on shmem swapouts
+ * This bug is present in all RHEL7 versions. It looks like this was fixed in
+ * mainline kernel > v3.15 by the following patch:
*
- * Two checks are performed, the first looks at how SwapCache
- * changes during madvise. When the pages are dirtied, about half
- * will be accounted for under Cached and the other half will be
- * moved into Swap. When madvise is run it will cause the pages
- * under Cached to also be moved to Swap while rotating the pages
- * already in Swap into SwapCached. So we expect that SwapCached has
- * roughly MEM_LIMIT bytes added to it, but for reliability the
- * PASS_THRESHOLD is much lower than that.
+ * commit 55231e5c898c5c03c14194001e349f40f59bd300
+ * Author: Johannes Weiner <hannes@cmpxchg.org>
+ * Date: Thu May 22 11:54:17 2014 -0700
*
- * Secondly we run madvise again, but only on the first
- * PASS_THRESHOLD bytes to ensure these are entirely in RAM. Then we
- * dirty these pages and check there were (almost) no page
- * faults. Two faults are allowed incase some tasklet or something
- * else unexpected, but irrelevant procedure, registers a fault to
- * our process.
+ * mm: madvise: fix MADV_WILLNEED on shmem swapouts
*/
#include <errno.h>
@@ -42,54 +26,21 @@
#include <sys/mount.h>
#include <sys/sysinfo.h>
#include "tst_test.h"
-#include "tst_cgroup.h"
#define CHUNK_SZ (400*1024*1024L)
-#define MEM_LIMIT (CHUNK_SZ / 2)
-#define MEMSW_LIMIT (2 * CHUNK_SZ)
+#define CHUNK_PAGES (CHUNK_SZ / pg_sz)
#define PASS_THRESHOLD (CHUNK_SZ / 4)
-#define PASS_THRESHOLD_KB (PASS_THRESHOLD / 1024)
-static const struct tst_cgroup_group *cg;
+#define MNT_NAME "memory"
+#define GROUP_NAME "madvise06"
static const char drop_caches_fname[] = "/proc/sys/vm/drop_caches";
-static int pg_sz, stat_refresh_sup;
-
-static long init_swap, init_swap_cached, init_cached;
+static int pg_sz;
static void check_path(const char *path)
{
if (access(path, R_OK | W_OK))
- tst_brk(TCONF, "file needed: %s", path);
-}
-
-static void print_cgmem(const char *name)
-{
- long ret;
-
- if (!SAFE_CGROUP_HAS(cg, name))
- return;
-
- SAFE_CGROUP_SCANF(cg, name, "%ld", &ret);
- tst_res(TINFO, "\t%s: %ld Kb", name, ret / 1024);
-}
-
-static void meminfo_diag(const char *point)
-{
- if (stat_refresh_sup)
- SAFE_FILE_PRINTF("/proc/sys/vm/stat_refresh", "1");
-
- tst_res(TINFO, "%s", point);
- tst_res(TINFO, "\tSwap: %ld Kb",
- SAFE_READ_MEMINFO("SwapTotal:") - SAFE_READ_MEMINFO("SwapFree:") - init_swap);
- tst_res(TINFO, "\tSwapCached: %ld Kb",
- SAFE_READ_MEMINFO("SwapCached:") - init_swap_cached);
- tst_res(TINFO, "\tCached: %ld Kb",
- SAFE_READ_MEMINFO("Cached:") - init_cached);
-
- print_cgmem("memory.current");
- print_cgmem("memory.swap.current");
- print_cgmem("memory.kmem.usage_in_bytes");
+ tst_brk(TCONF, "file needed: %s\n", path);
}
static void setup(void)
@@ -112,40 +63,32 @@ static void setup(void)
2 * CHUNK_SZ);
}
- check_path("/proc/self/oom_score_adj");
- SAFE_FILE_PRINTF("/proc/self/oom_score_adj", "%d", -1000);
-
- tst_cgroup_require("memory", NULL);
- cg = tst_cgroup_get_test_group();
-
- SAFE_CGROUP_PRINTF(cg, "memory.max", "%ld", MEM_LIMIT);
- if (SAFE_CGROUP_HAS(cg, "memory.swap.max"))
- SAFE_CGROUP_PRINTF(cg, "memory.swap.max", "%ld", MEMSW_LIMIT);
-
- if (SAFE_CGROUP_HAS(cg, "memory.swappiness")) {
- SAFE_CGROUP_PRINT(cg, "memory.swappiness", "60");
- } else {
- check_path("/proc/sys/vm/swappiness");
- SAFE_FILE_PRINTF("/proc/sys/vm/swappiness", "%d", 60);
+ SAFE_MKDIR(MNT_NAME, 0700);
+ if (mount("memory", MNT_NAME, "cgroup", 0, "memory") == -1) {
+ if (errno == ENODEV || errno == ENOENT)
+ tst_brk(TCONF, "memory cgroup needed");
}
+ SAFE_MKDIR(MNT_NAME"/"GROUP_NAME, 0700);
- SAFE_CGROUP_PRINTF(cg, "cgroup.procs", "%d", getpid());
-
- meminfo_diag("Initial meminfo, later values are relative to this (except memcg)");
- init_swap = SAFE_READ_MEMINFO("SwapTotal:") - SAFE_READ_MEMINFO("SwapFree:");
- init_swap_cached = SAFE_READ_MEMINFO("SwapCached:");
- init_cached = SAFE_READ_MEMINFO("Cached:");
-
- if (!access("/proc/sys/vm/stat_refresh", W_OK))
- stat_refresh_sup = 1;
+ check_path("/proc/self/oom_score_adj");
+ check_path(MNT_NAME"/"GROUP_NAME"/memory.limit_in_bytes");
+ check_path(MNT_NAME"/"GROUP_NAME"/memory.swappiness");
+ check_path(MNT_NAME"/"GROUP_NAME"/tasks");
- tst_res(TINFO, "mapping %ld Kb (%ld pages), limit %ld Kb, pass threshold %ld Kb",
- CHUNK_SZ / 1024, CHUNK_SZ / pg_sz, MEM_LIMIT / 1024, PASS_THRESHOLD_KB);
+ SAFE_FILE_PRINTF("/proc/self/oom_score_adj", "%d", -1000);
+ SAFE_FILE_PRINTF(MNT_NAME"/"GROUP_NAME"/memory.limit_in_bytes", "%ld\n",
+ PASS_THRESHOLD);
+ SAFE_FILE_PRINTF(MNT_NAME"/"GROUP_NAME"/memory.swappiness", "60");
+ SAFE_FILE_PRINTF(MNT_NAME"/"GROUP_NAME"/tasks", "%d\n", getpid());
}
static void cleanup(void)
{
- tst_cgroup_cleanup();
+ if (!access(MNT_NAME"/tasks", F_OK)) {
+ SAFE_FILE_PRINTF(MNT_NAME"/tasks", "%d\n", getpid());
+ SAFE_RMDIR(MNT_NAME"/"GROUP_NAME);
+ SAFE_UMOUNT(MNT_NAME);
+ }
}
static void dirty_pages(char *ptr, long size)
@@ -169,61 +112,55 @@ static int get_page_fault_num(void)
static void test_advice_willneed(void)
{
- int loops = 50, res;
+ int loops = 50;
char *target;
long swapcached_start, swapcached;
int page_fault_num_1, page_fault_num_2;
- meminfo_diag("Before mmap");
- tst_res(TINFO, "PageFault(before mmap): %d", get_page_fault_num());
target = SAFE_MMAP(NULL, CHUNK_SZ, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS,
-1, 0);
- meminfo_diag("Before dirty");
- tst_res(TINFO, "PageFault(before dirty): %d", get_page_fault_num());
dirty_pages(target, CHUNK_SZ);
- tst_res(TINFO, "PageFault(after dirty): %d", get_page_fault_num());
- meminfo_diag("Before madvise");
SAFE_FILE_LINES_SCANF("/proc/meminfo", "SwapCached: %ld",
&swapcached_start);
+ tst_res(TINFO, "SwapCached (before madvise): %ld", swapcached_start);
- TEST(madvise(target, MEM_LIMIT, MADV_WILLNEED));
+ TEST(madvise(target, CHUNK_SZ, MADV_WILLNEED));
if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "madvise failed");
+ tst_brk(TBROK | TERRNO, "madvise failed");
do {
loops--;
usleep(100000);
- if (stat_refresh_sup)
- SAFE_FILE_PRINTF("/proc/sys/vm/stat_refresh", "1");
SAFE_FILE_LINES_SCANF("/proc/meminfo", "SwapCached: %ld",
&swapcached);
- } while (swapcached < swapcached_start + PASS_THRESHOLD_KB && loops > 0);
-
- meminfo_diag("After madvise");
- res = swapcached > swapcached_start + PASS_THRESHOLD_KB;
- tst_res(res ? TPASS : TFAIL,
- "%s than %ld Kb were moved to the swap cache",
- res ? "more" : "less", PASS_THRESHOLD_KB);
-
+ } while (swapcached < swapcached_start + PASS_THRESHOLD / 1024
+ && loops > 0);
- TEST(madvise(target, PASS_THRESHOLD, MADV_WILLNEED));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "madvise failed");
+ tst_res(TINFO, "SwapCached (after madvise): %ld", swapcached);
+ if (swapcached > swapcached_start + PASS_THRESHOLD / 1024) {
+ tst_res(TPASS, "Regression test pass");
+ SAFE_MUNMAP(target, CHUNK_SZ);
+ return;
+ }
+ /*
+ * We may have hit a bug or we just have slow I/O,
+ * try accessing first page.
+ */
page_fault_num_1 = get_page_fault_num();
tst_res(TINFO, "PageFault(madvice / no mem access): %d",
page_fault_num_1);
- dirty_pages(target, PASS_THRESHOLD);
+ target[0] = 'a';
page_fault_num_2 = get_page_fault_num();
tst_res(TINFO, "PageFault(madvice / mem access): %d",
page_fault_num_2);
- meminfo_diag("After page access");
- res = page_fault_num_2 - page_fault_num_1;
- tst_res(res < 3 ? TPASS : TFAIL,
- "%d pages were faulted out of 2 max", res);
+ if (page_fault_num_1 != page_fault_num_2)
+ tst_res(TFAIL, "Bug has been reproduced");
+ else
+ tst_res(TPASS, "Regression test pass");
SAFE_MUNMAP(target, CHUNK_SZ);
}
@@ -235,13 +172,8 @@ static struct tst_test test = {
.min_kver = "3.10.0",
.needs_tmpdir = 1,
.needs_root = 1,
- .save_restore = (const char * const[]) {
- "?/proc/sys/vm/swappiness",
- NULL
- },
.tags = (const struct tst_tag[]) {
{"linux-git", "55231e5c898c"},
- {"linux-git", "8de15e920dc8"},
{}
}
};
diff --git a/testcases/kernel/syscalls/madvise/madvise08.c b/testcases/kernel/syscalls/madvise/madvise08.c
index ff167dafe..a2245b298 100644
--- a/testcases/kernel/syscalls/madvise/madvise08.c
+++ b/testcases/kernel/syscalls/madvise/madvise08.c
@@ -42,6 +42,11 @@
static int dfd;
static void *fmem;
+static const char * const save_restore[] = {
+ CORE_PATTERN,
+ NULL,
+};
+
static void setup(void)
{
char cwd[1024];
@@ -213,8 +218,5 @@ static struct tst_test test = {
.needs_tmpdir = 1,
.needs_root = 1,
.forks_child = 1,
- .save_restore = (const char * const[]) {
- CORE_PATTERN,
- NULL,
- },
+ .save_restore = save_restore
};
diff --git a/testcases/kernel/syscalls/madvise/madvise09.c b/testcases/kernel/syscalls/madvise/madvise09.c
index 1a5cc9dcf..cd556920c 100644
--- a/testcases/kernel/syscalls/madvise/madvise09.c
+++ b/testcases/kernel/syscalls/madvise/madvise09.c
@@ -12,7 +12,7 @@
*
* o Madvise pages with MADV_FREE
*
- * o Check that madvised pages were not freed immediately
+ * o Check that madvised pages were not freed immediatelly
*
* o Write to some of the madvised pages again, these must not be freed
*
@@ -177,9 +177,9 @@ static void child(void)
}
if (ptr[page_size] != 'a')
- tst_res(TFAIL, "MADV_FREE pages were freed immediately");
+ tst_res(TFAIL, "MADV_FREE pages were freed immediatelly");
else
- tst_res(TPASS, "MADV_FREE pages were not freed immediately");
+ tst_res(TPASS, "MADV_FREE pages were not freed immediatelly");
ptr[TOUCHED_PAGE1 * page_size] = 'b';
ptr[TOUCHED_PAGE2 * page_size] = 'b';
diff --git a/testcases/kernel/syscalls/mallinfo/.gitignore b/testcases/kernel/syscalls/mallinfo/.gitignore
deleted file mode 100644
index 678ac277e..000000000
--- a/testcases/kernel/syscalls/mallinfo/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/mallinfo01
-/mallinfo02
diff --git a/testcases/kernel/syscalls/mallinfo/Makefile b/testcases/kernel/syscalls/mallinfo/Makefile
deleted file mode 100644
index 044619fb8..000000000
--- a/testcases/kernel/syscalls/mallinfo/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/mallinfo/mallinfo01.c b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
deleted file mode 100644
index 48fce0132..000000000
--- a/testcases/kernel/syscalls/mallinfo/mallinfo01.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-
-/*\
- * [Description]
- *
- * Basic mallinfo() test. Refer to glibc test mallinfo2 test
- * https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/tst-mallinfo2.c
- */
-#include "mallinfo_common.h"
-#include "tst_safe_macros.h"
-
-#ifdef HAVE_MALLINFO
-#define M_NUM 20
-static struct mallinfo info1;
-static void *buf[M_NUM + 1];
-
-static void cleanup(void)
-{
- int i;
-
- for (i = M_NUM; i > 0; i--) {
- if (buf[i]) {
- free(buf[i]);
- buf[i] = NULL;
- }
- }
-}
-
-void test_mallinfo(void)
-{
- int i;
- int total = 0;
- struct mallinfo info2;
-
- for (i = 1; i <= M_NUM; i++) {
- buf[i] = SAFE_MALLOC(160 * i);
- total += 160 * i;
- }
- info2 = mallinfo();
- print_mallinfo("Test uordblks", &info2);
- if (info2.uordblks >= info1.uordblks + total)
- tst_res(TPASS, "mallinfo() uordblks passed");
- else
- tst_res(TFAIL, "mallinfo() uordblks failed");
-
- //Create another free chunk
- free(buf[M_NUM/2]);
- buf[M_NUM/2] = NULL;
- info2 = mallinfo();
- print_mallinfo("Test ordblks", &info2);
- if (info2.ordblks == info1.ordblks + 1)
- tst_res(TPASS, "mallinfo() ordblks passed");
- else
- tst_res(TFAIL, "mallinfo() ordblks failed");
-
- cleanup();
-}
-
-static void setup(void)
-{
- if (sizeof(info1.arena) != sizeof(int))
- tst_res(TFAIL, "The member of mallinfo struct is not int");
-
- info1 = mallinfo();
- print_mallinfo("Start", &info1);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .test_all = test_mallinfo,
- .cleanup = cleanup,
-};
-
-#else
-TST_TEST_TCONF("system doesn't implement non-POSIX mallinfo()");
-#endif
diff --git a/testcases/kernel/syscalls/mallinfo/mallinfo02.c b/testcases/kernel/syscalls/mallinfo/mallinfo02.c
deleted file mode 100644
index 6012b4e22..000000000
--- a/testcases/kernel/syscalls/mallinfo/mallinfo02.c
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-
-/*\
- * [Description]
- *
- * Basic mallinfo() test for malloc() using sbrk or mmap.
- * It size > MMAP_THRESHOLD, it will use mmap. Otherwise, use sbrk.
- */
-
-#include "mallinfo_common.h"
-#include "tst_safe_macros.h"
-
-#ifdef HAVE_MALLINFO
-void test_mallinfo(void)
-{
- struct mallinfo info;
- int size;
- char *buf;
-
- buf = SAFE_MALLOC(20480);
-
- info = mallinfo();
- if (info.uordblks > 20480 && info.hblkhd == 0) {
- tst_res(TPASS, "malloc() uses sbrk when size < 128k");
- } else {
- tst_res(TFAIL, "malloc() use mmap when size < 128k");
- print_mallinfo("Test malloc(20480)", &info);
- }
- free(buf);
-
- info = mallinfo();
- size = MAX(info.fordblks, 131072);
-
- buf = SAFE_MALLOC(size);
- info = mallinfo();
- if (info.hblkhd > size && info.hblks > 0) {
- tst_res(TPASS, "malloc() uses mmap when size >= 128k");
- } else {
- tst_res(TFAIL, "malloc uses sbrk when size >= 128k");
- print_mallinfo("Test malloc(1024*128)", &info);
- }
-
- free(buf);
-}
-
-static void setup(void)
-{
- if (mallopt(M_MMAP_THRESHOLD, 131072) == 0)
- tst_res(TFAIL, "mallopt(M_MMAP_THRESHOLD, 128K) failed");
-}
-
-static struct tst_test test = {
- .setup = setup,
- .test_all = test_mallinfo,
-};
-
-#else
-TST_TEST_TCONF("system doesn't implement non-POSIX mallinfo()");
-#endif
diff --git a/testcases/kernel/syscalls/mallinfo/mallinfo_common.h b/testcases/kernel/syscalls/mallinfo/mallinfo_common.h
deleted file mode 100644
index a00cc7a64..000000000
--- a/testcases/kernel/syscalls/mallinfo/mallinfo_common.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-#ifndef MALLINFO_COMMON_H
-#define MALLINFO_COMMON_H
-
-#include <malloc.h>
-#include "tst_test.h"
-#include "config.h"
-
-#ifdef HAVE_MALLINFO
-static inline void print_mallinfo(const char *msg, struct mallinfo *m)
-{
- tst_res(TINFO, "%s...", msg);
-#define P(f) tst_res(TINFO, "%s: %d", #f, m->f)
- P(arena);
- P(ordblks);
- P(smblks);
- P(hblks);
- P(hblkhd);
- P(usmblks);
- P(fsmblks);
- P(uordblks);
- P(fordblks);
- P(keepcost);
-}
-#endif
-
-#endif
diff --git a/testcases/kernel/syscalls/mallopt/Makefile b/testcases/kernel/syscalls/mallopt/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mallopt/Makefile
+++ b/testcases/kernel/syscalls/mallopt/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mallopt/mallopt01.c b/testcases/kernel/syscalls/mallopt/mallopt01.c
index 8ff4649e3..14e26dd81 100644
--- a/testcases/kernel/syscalls/mallopt/mallopt01.c
+++ b/testcases/kernel/syscalls/mallopt/mallopt01.c
@@ -1,76 +1,155 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2003-2021
- * Copyright (c) International Business Machines Corp., 2002
- * 01/02/2003 Port to LTP <avenkat@us.ibm.com>
- * 06/30/2001 Port to Linux <nsharoff@us.ibm.com>
+ *
+ * Copyright (c) International Business Machines Corp., 2002
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/* 01/02/2003 Port to LTP avenkat@us.ibm.com*/
+/* 06/30/2001 Port to Linux nsharoff@us.ibm.com */
+
+/*
+ * NAME
+ * mallopt
+ *
+ * CALLS
+ * malloc(3x), mallopt(3x), mallinfo(3x).
+ *
+ * ALGORITHM
+ * Set options, malloc memory, and check resource ussage.
*
- * Basic mallinfo() and mallopt() testing.
+ * RESTRICTIONS
*/
+#ifdef CONFIG_COLDFIRE
+#define __MALLOC_STANDARD__
+#endif
+#include <errno.h>
+/*
+ * NOTE: struct mallinfo is only exported via malloc.h (not stdlib.h), even
+ * though it's an obsolete header for malloc(3).
+ *
+ * Inconsistencies rock.
+ */
+#include <malloc.h>
+#include <stdio.h>
-#include "../mallinfo/mallinfo_common.h"
-#include "tst_safe_macros.h"
-
-#ifdef HAVE_MALLOPT
+#include "test.h"
+#include "safe_macros.h"
+#define FAILED 0
+#define PASSED 1
#define MAX_FAST_SIZE (80 * sizeof(size_t) / 4)
+int local_flag = PASSED;
+
+char *TCID = "mallopt01";
+int block_number;
+FILE *temp;
+int TST_TOTAL = 6;
+extern int tst_COUNT; /* Test Case counter for tst_routines */
+
+void printinfo();
+
+#if defined(__GLIBC__)
struct mallinfo info;
-void test_mallopt(void)
+int main(int argc, char *argv[])
{
char *buf;
- buf = SAFE_MALLOC(20480);
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ tst_tmpdir();
+
+ buf = SAFE_MALLOC(NULL, 20480);
+
+ /*
+ * Check space usage.
+ */
info = mallinfo();
if (info.uordblks < 20480) {
- print_mallinfo("Test uordblks", &info);
- tst_res(TFAIL, "mallinfo() failed: uordblks < 20K");
+ printinfo();
+ tst_resm(TFAIL, "mallinfo failed: uordblks < 20K");
}
if (info.smblks != 0) {
- print_mallinfo("Test smblks", &info);
- tst_res(TFAIL, "mallinfo() failed: smblks != 0");
+ printinfo();
+ tst_resm(TFAIL, "mallinfo failed: smblks != 0");
}
if (info.uordblks >= 20480 && info.smblks == 0)
- tst_res(TPASS, "mallinfo() succeeded");
-
+ tst_resm(TPASS, "mallinfo() succeeded");
free(buf);
+ /*
+ * Test mallopt's M_MXFAST and M_NLBLKS cmds.
+ */
+
if (mallopt(M_MXFAST, MAX_FAST_SIZE) == 0)
- tst_res(TFAIL, "mallopt(M_MXFAST, %d) failed", (int)MAX_FAST_SIZE);
+ tst_resm(TFAIL, "mallopt(M_MXFAST, %d) failed", (int)MAX_FAST_SIZE);
+ else
+ tst_resm(TPASS, "mallopt(M_MXFAST, %d) succeeded", (int)MAX_FAST_SIZE);
+
+ if (mallopt(M_NLBLKS, 50) == 0)
+ tst_resm(TFAIL, "mallopt(M_NLBLKS, 50) failed");
else
- tst_res(TPASS, "mallopt(M_MXFAST, %d) succeeded", (int)MAX_FAST_SIZE);
+ tst_resm(TPASS, "mallopt(M_NLBLKS, 50) succeeded");
if ((buf = malloc(1024)) == NULL) {
- tst_res(TFAIL, "malloc(1024) failed");
+ tst_resm(TFAIL, "malloc(1024) failed");
} else {
- tst_res(TPASS, "malloc(1024) succeeded");
+ tst_resm(TPASS, "malloc(1024) succeeded");
free(buf);
}
if (mallopt(M_MXFAST, 0) == 0)
- tst_res(TFAIL, "mallopt(M_MXFAST, 0) failed");
+ tst_resm(TFAIL, "mallopt(M_MXFAST, 0) failed");
else
- tst_res(TPASS, "mallopt(M_MXFAST, 0) succeeded");
+ tst_resm(TPASS, "mallopt(M_MXFAST, 0) succeeded");
if ((buf = malloc(1024)) == NULL) {
- tst_res(TFAIL, "malloc(1024) failed");
+ tst_resm(TFAIL, "malloc(1024) failed");
} else {
- tst_res(TPASS, "malloc(1024) succeeded");
+ tst_resm(TPASS, "malloc(1024) succeeded");
free(buf);
}
+
+ unlink("core");
+ tst_rmdir();
+ tst_exit();
}
-static struct tst_test test = {
- .test_all = test_mallopt,
-};
+void printinfo(void)
+{
+
+ fprintf(stderr, "mallinfo structure:\n");
+ fprintf(stderr, "mallinfo.arena = %d\n", info.arena);
+ fprintf(stderr, "mallinfo.ordblks = %d\n", info.ordblks);
+ fprintf(stderr, "mallinfo.smblks = %d\n", info.smblks);
+ fprintf(stderr, "mallinfo.hblkhd = %d\n", info.hblkhd);
+ fprintf(stderr, "mallinfo.hblks = %d\n", info.hblks);
+ fprintf(stderr, "mallinfo.usmblks = %d\n", info.usmblks);
+ fprintf(stderr, "mallinfo.fsmblks = %d\n", info.fsmblks);
+ fprintf(stderr, "mallinfo.uordblks = %d\n", info.uordblks);
+ fprintf(stderr, "mallinfo.fordblks = %d\n", info.fordblks);
+ fprintf(stderr, "mallinfo.keepcost = %d\n", info.keepcost);
+}
#else
-TST_TEST_TCONF("system doesn't implement non-POSIX mallopt()");
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "mallopt defined only for glibc");
+}
#endif
diff --git a/testcases/kernel/syscalls/mbind/Makefile b/testcases/kernel/syscalls/mbind/Makefile
index ed7d4375c..ebb1207ef 100644
--- a/testcases/kernel/syscalls/mbind/Makefile
+++ b/testcases/kernel/syscalls/mbind/Makefile
@@ -1,16 +1,29 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS=ltpnuma
-
include $(top_srcdir)/include/mk/testcases.mk
CPPFLAGS += -I$(abs_srcdir)/../utils/
-LDLIBS += $(NUMA_LIBS)
-LTPLDLIBS = -lltpnuma
+LDLIBS += $(NUMA_LIBS) -lltpnuma
+LDFLAGS += -L$(top_builddir)/libs/libltpnuma
include $(top_srcdir)/testcases/kernel/include/lib.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index bc713d78b..cd1027ce5 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -170,8 +170,10 @@ static void do_test(unsigned int i)
setup_node();
- p = SAFE_MMAP(NULL, MEM_LENGTH, PROT_READ | PROT_WRITE, MAP_PRIVATE |
+ p = mmap(NULL, MEM_LENGTH, PROT_READ | PROT_WRITE, MAP_PRIVATE |
MAP_ANONYMOUS, 0, 0);
+ if (p == MAP_FAILED)
+ tst_brk(TBROK | TERRNO, "mmap");
tc->test(i, p);
diff --git a/testcases/kernel/syscalls/membarrier/Makefile b/testcases/kernel/syscalls/membarrier/Makefile
index e6674a6b2..f71e4fc25 100644
--- a/testcases/kernel/syscalls/membarrier/Makefile
+++ b/testcases/kernel/syscalls/membarrier/Makefile
@@ -5,4 +5,4 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk \ No newline at end of file
diff --git a/testcases/kernel/syscalls/memcmp/Makefile b/testcases/kernel/syscalls/memcmp/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/memcmp/Makefile
+++ b/testcases/kernel/syscalls/memcmp/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/memcpy/Makefile b/testcases/kernel/syscalls/memcpy/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/memcpy/Makefile
+++ b/testcases/kernel/syscalls/memcpy/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/memfd_create/.gitignore b/testcases/kernel/syscalls/memfd_create/.gitignore
index b79adfa65..71b898c34 100644
--- a/testcases/kernel/syscalls/memfd_create/.gitignore
+++ b/testcases/kernel/syscalls/memfd_create/.gitignore
@@ -1,4 +1,4 @@
/memfd_create01
/memfd_create02
/memfd_create03
-/memfd_create04
+/memfd_create04 \ No newline at end of file
diff --git a/testcases/kernel/syscalls/memfd_create/Makefile b/testcases/kernel/syscalls/memfd_create/Makefile
index 1fdf7923e..f23b8732c 100644
--- a/testcases/kernel/syscalls/memfd_create/Makefile
+++ b/testcases/kernel/syscalls/memfd_create/Makefile
@@ -1,5 +1,16 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2017 Red Hat, Inc.
+#
+# Copyright (C) 2017 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
top_srcdir ?= ../../../..
@@ -9,4 +20,4 @@ FILTER_OUT_MAKE_TARGETS := memfd_create_common
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: memfd_create_common.o
+$(MAKE_TARGETS): %: %.o memfd_create_common.o
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create01.c b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
index bdc0c8512..fdd37f64b 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create01.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2017-2020
* Copyright (C) 2017 Red Hat, Inc.
*/
@@ -242,7 +241,7 @@ static void verify_memfd_create(unsigned int n)
tst_res(TINFO, "%s", tc->desc);
- fd = CHECK_MFD_NEW("ltp_memfd_create01", MFD_DEF_SIZE, tc->flags);
+ fd = CHECK_MFD_NEW(TCID, MFD_DEF_SIZE, tc->flags);
tc->func(fd);
@@ -258,7 +257,7 @@ static void setup(void)
* is this flag is missing.
*/
if (!MFD_FLAGS_AVAILABLE(MFD_ALLOW_SEALING)) {
- tst_brk(TCONF | TERRNO,
+ tst_brk(TCONF | TTERRNO,
"memfd_create(%u) not implemented", MFD_ALLOW_SEALING);
}
}
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create03.c b/testcases/kernel/syscalls/memfd_create/memfd_create03.c
index 036182f0a..0502a2d19 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create03.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create03.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Zilogic Systems Pvt. Ltd., 2018
@@ -109,7 +110,7 @@ static void test_def_pagesize(int fd)
} else {
tst_res(TFAIL,
"munmap(%p, %dkB) suceeded unexpectedly\n",
- mem, i/1024);
+ mem, i);
return;
}
}
@@ -207,7 +208,7 @@ static void setup(void)
SAFE_FILE_LINES_SCANF(TOTAL_HP_PATH, "%ld", &og_total_pages);
sprintf(buf, "%ld", og_total_pages + 1);
- fd = SAFE_OPEN(TOTAL_HP_PATH, O_RDWR | O_TRUNC);
+ fd = open(TOTAL_HP_PATH, O_RDWR | O_TRUNC);
if (write(fd, buf, strlen(buf)) == -1)
tst_brk(TCONF | TERRNO,
@@ -233,7 +234,7 @@ static void cleanup(void)
sprintf(buf, "%ld", og_total_pages);
- fd = SAFE_OPEN(TOTAL_HP_PATH, O_RDWR | O_TRUNC);
+ fd = open(TOTAL_HP_PATH, O_RDWR | O_TRUNC);
if (write(fd, buf, strlen(buf)) == -1)
tst_brk(TCONF | TERRNO, "Clean-up failed: write() failed");
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create04.c b/testcases/kernel/syscalls/memfd_create/memfd_create04.c
index dc6e195f0..659431cd9 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create04.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create04.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Zilogic Systems Pvt. Ltd., 2018
@@ -69,7 +70,7 @@ static void memfd_huge_x_controller(unsigned int n)
fd = sys_memfd_create("tfile", MFD_HUGETLB | tflag.flag);
if (fd < 0) {
if (errno == tflag.exp_err)
- tst_res(TPASS, "Test failed as expected");
+ tst_res(TPASS, "Test failed as expected\n");
else
tst_brk(TFAIL | TERRNO,
"memfd_create() failed unexpectedly");
@@ -77,7 +78,7 @@ static void memfd_huge_x_controller(unsigned int n)
}
tst_res(TPASS,
- "memfd_create succeeded for %s page size",
+ "memfd_create succeeded for %s page size\n",
tflag.h_size);
}
diff --git a/testcases/kernel/syscalls/memmap/.gitignore b/testcases/kernel/syscalls/memmap/.gitignore
new file mode 100644
index 000000000..c4c684456
--- /dev/null
+++ b/testcases/kernel/syscalls/memmap/.gitignore
@@ -0,0 +1 @@
+/mem03
diff --git a/testcases/kernel/syscalls/memmap/Makefile b/testcases/kernel/syscalls/memmap/Makefile
new file mode 100644
index 000000000..bd617d806
--- /dev/null
+++ b/testcases/kernel/syscalls/memmap/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/memmap/mem03.c b/testcases/kernel/syscalls/memmap/mem03.c
new file mode 100644
index 000000000..a2dd02847
--- /dev/null
+++ b/testcases/kernel/syscalls/memmap/mem03.c
@@ -0,0 +1,173 @@
+/*
+ *
+ * Copyright (c) National ICT Australia, 2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* NICTA */
+/* 13/02/2006 Implemented carl.vanschaik at nicta.com.au */
+
+/* mem03.c */
+/*
+ * NAME
+ * mem03.c
+ *
+ * DESCRIPTION
+ * - create two files, write known data to the files.
+ * - mmap the files, verify data
+ * - unmap files
+ * - remmap files, swap virtual addresses ie: file1 at file2's address, etc
+ *
+ * REASONING
+ * - If the kernel fails to correctly flush the TLB entry, the second mmap
+ * will not show the correct data.
+ *
+ *
+ * RESTRICTIONS
+ * None
+ */
+
+#include <stdio.h>
+#include <signal.h>
+#include <stdlib.h>
+#include "test.h"
+#include <unistd.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h> /* definitions for open() */
+#include <sys/mman.h> /* definitions for mmap() */
+#include <fcntl.h> /* definition of open() */
+#include <sys/user.h>
+
+#define FAILED (-1) /* return status for all funcs indicating failure */
+#define SUCCESS 0 /* return status for all routines indicating success */
+
+static void setup();
+static void cleanup();
+
+char *TCID = "mem03";
+int TST_TOTAL = 1;
+
+int f1 = -1, f2 = -1;
+char *mm1 = NULL, *mm2 = NULL;
+
+/*--------------------------------------------------------------------*/
+int main(void)
+{
+ char tmp1[] = "./tmp.file.1";
+ char tmp2[] = "./tmp.file.2";
+
+ char str1[] = "testing 123";
+ char str2[] = "my test mem";
+
+ setup();
+
+ if ((f1 = open(tmp1, O_RDWR | O_CREAT, S_IREAD | S_IWRITE)) == -1)
+ tst_brkm(TFAIL, cleanup, "failed to open/create file %s", tmp1);
+
+ if ((f2 = open(tmp2, O_RDWR | O_CREAT, S_IREAD | S_IWRITE)) == -1)
+ tst_brkm(TFAIL, cleanup, "failed to open/create file %s", tmp2);
+
+ write(f1, str1, strlen(str1));
+ write(f2, str2, strlen(str2));
+
+ {
+ char *save_mm1, *save_mm2;
+
+ mm1 = mmap(0, 64, PROT_READ, MAP_PRIVATE, f1, 0);
+ mm2 = mmap(0, 64, PROT_READ, MAP_PRIVATE, f2, 0);
+
+ if ((mm1 == (void *)-1) || (mm2 == (void *)-1))
+ tst_brkm(TFAIL, cleanup, "mmap failed");
+
+ save_mm1 = mm1;
+ save_mm2 = mm2;
+
+ if (strncmp(str1, mm1, strlen(str1)))
+ tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp1);
+
+ if (strncmp(str2, mm2, strlen(str2)))
+ tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp2);
+
+ munmap(mm1, 64);
+ munmap(mm2, 64);
+
+ mm1 = mmap(save_mm2, 64, PROT_READ, MAP_PRIVATE, f1, 0);
+ mm2 = mmap(save_mm1, 64, PROT_READ, MAP_PRIVATE, f2, 0);
+
+ if ((mm1 == (void *)-1) || (mm2 == (void *)-1))
+ tst_brkm(TFAIL, cleanup, "second mmap failed");
+
+ if (mm1 != save_mm2) {
+ printf("mmap not using same address\n");
+
+ }
+
+ if (mm2 != save_mm1) {
+ printf("mmap not using same address\n");
+
+ }
+
+ if (strncmp(str1, mm1, strlen(str1)))
+ tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp1);
+
+ if (strncmp(str2, mm2, strlen(str2)))
+ tst_brkm(TFAIL, cleanup, "failed on compare %s", tmp2);
+
+ munmap(mm1, 64);
+ munmap(mm2, 64);
+ }
+
+ tst_resm(TPASS, "%s memory test succeeded", TCID);
+
+ /* clean up and exit */
+ cleanup();
+
+ tst_exit();
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+ /*
+ * Create a temporary directory and cd into it.
+ */
+ tst_tmpdir();
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+ if (mm1)
+ munmap(mm1, 64);
+ if (mm2)
+ munmap(mm2, 64);
+
+ if (f1 != -1)
+ close(f1);
+ if (f2 != -1)
+ close(f2);
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/memset/Makefile b/testcases/kernel/syscalls/memset/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/memset/Makefile
+++ b/testcases/kernel/syscalls/memset/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/migrate_pages/Makefile b/testcases/kernel/syscalls/migrate_pages/Makefile
index 9cf3ce526..46a35d3e0 100644
--- a/testcases/kernel/syscalls/migrate_pages/Makefile
+++ b/testcases/kernel/syscalls/migrate_pages/Makefile
@@ -1,12 +1,27 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(sort $(wildcard $(abs_srcdir)/*[0-9].c)))
-$(MAKE_TARGETS): %: migrate_pages_common.o
+MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
+$(MAKE_TARGETS): %: %.o migrate_pages_common.o
CPPFLAGS += -I$(abs_srcdir)/../utils/
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
index 485a1c5aa..e6e2fdff3 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
@@ -44,6 +44,11 @@ static struct passwd *ltpuser;
static int *nodes, nodeA, nodeB;
static int num_nodes;
+static const char * const save_restore[] = {
+ "?/proc/sys/kernel/numa_balancing",
+ NULL,
+};
+
static void print_mem_stats(pid_t pid, int node)
{
char s[64];
@@ -89,7 +94,7 @@ static int migrate_to_node(pid_t pid, int node)
new_nodes));
if (TST_RET != 0) {
if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO, "migrate_pages failed "
+ tst_res(TFAIL | TERRNO, "migrate_pages failed "
"ret: %ld, ", TST_RET);
print_mem_stats(pid, node);
} else {
@@ -110,8 +115,8 @@ static int addr_on_node(void *addr)
ret = tst_syscall(__NR_get_mempolicy, &node, NULL, (unsigned long)0,
(unsigned long)addr, MPOL_F_NODE | MPOL_F_ADDR);
if (ret == -1) {
- tst_res(TFAIL | TERRNO,
- "error getting memory policy for page %p", addr);
+ tst_res(TBROK | TERRNO, "error getting memory policy "
+ "for page %p", addr);
}
return node;
}
@@ -327,10 +332,7 @@ static struct tst_test test = {
.forks_child = 1,
.test_all = run,
.setup = setup,
- .save_restore = (const char * const[]) {
- "?/proc/sys/kernel/numa_balancing",
- NULL,
- },
+ .save_restore = save_restore,
};
#else
TST_TEST_TCONF(NUMA_ERROR_MSG);
diff --git a/testcases/kernel/syscalls/mincore/.gitignore b/testcases/kernel/syscalls/mincore/.gitignore
index 25a5e8ab1..fdb2070e9 100644
--- a/testcases/kernel/syscalls/mincore/.gitignore
+++ b/testcases/kernel/syscalls/mincore/.gitignore
@@ -1,4 +1,2 @@
/mincore01
/mincore02
-/mincore03
-/mincore04
diff --git a/testcases/kernel/syscalls/mincore/Makefile b/testcases/kernel/syscalls/mincore/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mincore/Makefile
+++ b/testcases/kernel/syscalls/mincore/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mincore/mincore03.c b/testcases/kernel/syscalls/mincore/mincore03.c
deleted file mode 100644
index 774fce98b..000000000
--- a/testcases/kernel/syscalls/mincore/mincore03.c
+++ /dev/null
@@ -1,83 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Zilogic Systems Pvt. Ltd., 2020
- * Email: code@zilogic.com
- */
-
-/*
- * mincore03
- * Testcase 1: Test shows that pages mapped as anonymous and
- * not faulted, are reported as not resident in memory by mincore().
- * Testcase 2: Test shows that pages mapped as anonymous and faulted,
- * are reported as resident in memory by mincore().
- */
-
-#include <stdbool.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include "tst_test.h"
-
-#define NUM_PAGES 3
-
-static struct tcase {
- bool mlock;
- int expected_pages;
- char *desc;
-} tcases[] = {
- { false, 0, "untouched pages are not resident"},
- { true, NUM_PAGES, "locked pages are resident"},
-};
-
-static int size, page_size;
-static void *ptr;
-
-static void cleanup(void)
-{
- if (ptr)
- SAFE_MUNMAP(ptr, size);
-}
-
-static void setup(void)
-{
- page_size = getpagesize();
- size = page_size * NUM_PAGES;
-}
-
-static void test_mincore(unsigned int test_nr)
-{
- const struct tcase *tc = &tcases[test_nr];
- unsigned char vec[NUM_PAGES];
- int locked_pages;
- int count, mincore_ret;
-
- ptr = SAFE_MMAP(NULL, size, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
- if (tc->mlock)
- SAFE_MLOCK(ptr, size);
-
- mincore_ret = mincore(ptr, size, vec);
- if (mincore_ret == -1)
- tst_brk(TBROK | TERRNO, "mincore failed");
- locked_pages = 0;
- for (count = 0; count < NUM_PAGES; count++)
- if (vec[count] & 1)
- locked_pages++;
-
- if (locked_pages == tc->expected_pages)
- tst_res(TPASS, "mincore() reports %s", tc->desc);
- else
- tst_res(TFAIL, "mincore reports resident pages as %d, but expected %d",
- locked_pages, tc->expected_pages);
-
- if (tc->mlock)
- SAFE_MUNLOCK(ptr, size);
- SAFE_MUNMAP(ptr, size);
- ptr = NULL;
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .cleanup = cleanup,
- .test = test_mincore,
-};
-
diff --git a/testcases/kernel/syscalls/mincore/mincore04.c b/testcases/kernel/syscalls/mincore/mincore04.c
deleted file mode 100644
index ed0ab7dfa..000000000
--- a/testcases/kernel/syscalls/mincore/mincore04.c
+++ /dev/null
@@ -1,112 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Zilogic Systems Pvt. Ltd., 2020
- * Email: code@zilogic.com
- */
-
-/*
- * mincore04
- * Test shows that pages mapped in one process(parent) and
- * faulted in another(child) results in mincore(in parent) reporting
- * that all mapped pages are resident.
- */
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include "tst_test.h"
-
-#define NUM_PAGES 3
-
-static int fd;
-static int size;
-static void *ptr;
-
-static void cleanup(void)
-{
- if (fd > 0)
- SAFE_CLOSE(fd);
- if (ptr) {
- SAFE_MUNLOCK(ptr, size);
- SAFE_MUNMAP(ptr, size);
- }
-}
-
-static void setup(void)
-{
- int page_size, ret;
-
- page_size = getpagesize();
- size = page_size * NUM_PAGES;
- fd = SAFE_OPEN("FILE", O_CREAT | O_RDWR, 0600);
- SAFE_FTRUNCATE(fd, size);
-
- /* File pages from file creation are cleared from cache. */
- SAFE_FSYNC(fd);
- ret = posix_fadvise(fd, 0, size, POSIX_FADV_DONTNEED);
- if (ret == -1)
- tst_brk(TBROK | TERRNO, "fadvise failed");
-}
-
-static void lock_file(void)
-{
- SAFE_MLOCK(ptr, size);
- TST_CHECKPOINT_WAKE(0);
- TST_CHECKPOINT_WAIT(1);
-}
-
-static int count_pages_in_cache(void)
-{
- int locked_pages = 0;
- int count, ret;
- unsigned char vec[NUM_PAGES];
-
- TST_CHECKPOINT_WAIT(0);
-
- ret = mincore(ptr, size, vec);
- if (ret == -1)
- tst_brk(TBROK | TERRNO, "mincore failed");
- for (count = 0; count < NUM_PAGES; count++) {
- if (vec[count] & 1)
- locked_pages++;
- }
-
- TST_CHECKPOINT_WAKE(1);
- return locked_pages;
-}
-
-static void test_mincore(void)
-{
- int locked_pages;
-
- ptr = SAFE_MMAP(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
- pid_t child_pid = SAFE_FORK();
-
- if (child_pid == 0) {
- lock_file();
- exit(0);
- }
-
- locked_pages = count_pages_in_cache();
- tst_reap_children();
-
- if (locked_pages == NUM_PAGES)
- tst_res(TPASS, "mincore reports all %d pages locked by child process "
- "are resident", locked_pages);
- else
- tst_res(TFAIL, "mincore reports %d pages resident but %d pages "
- "locked by child process", locked_pages, NUM_PAGES);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .forks_child = 1,
- .test_all = test_mincore,
- .needs_checkpoints = 1,
-};
diff --git a/testcases/kernel/syscalls/mkdir/Makefile b/testcases/kernel/syscalls/mkdir/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mkdir/Makefile
+++ b/testcases/kernel/syscalls/mkdir/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mkdirat/Makefile b/testcases/kernel/syscalls/mkdirat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mkdirat/Makefile
+++ b/testcases/kernel/syscalls/mkdirat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mknod/Makefile b/testcases/kernel/syscalls/mknod/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mknod/Makefile
+++ b/testcases/kernel/syscalls/mknod/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mknodat/Makefile b/testcases/kernel/syscalls/mknodat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mknodat/Makefile
+++ b/testcases/kernel/syscalls/mknodat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mlock/Makefile b/testcases/kernel/syscalls/mlock/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/mlock/Makefile
+++ b/testcases/kernel/syscalls/mlock/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mlockall/Makefile b/testcases/kernel/syscalls/mlockall/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/mlockall/Makefile
+++ b/testcases/kernel/syscalls/mlockall/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mlockall/mlockall03.c b/testcases/kernel/syscalls/mlockall/mlockall03.c
index 7418dd64d..5e8e55648 100644
--- a/testcases/kernel/syscalls/mlockall/mlockall03.c
+++ b/testcases/kernel/syscalls/mlockall/mlockall03.c
@@ -231,7 +231,7 @@ int setup_test(int i)
rl.rlim_cur = 7;
if (setrlimit(RLIMIT_MEMLOCK, &rl) != 0) {
- tst_resm(TWARN | TERRNO, "setrlimit failed to set the "
+ tst_resm(TWARN, "setrlimit failed to set the "
"resource for RLIMIT_MEMLOCK to check "
"for mlockall() error %s\n", TC[i].edesc);
return 1;
@@ -268,7 +268,6 @@ void cleanup_test(int i)
switch (i) {
case 0:
- case 1:
SAFE_SETEUID(cleanup, 0);
rl.rlim_max = -1;
@@ -281,6 +280,11 @@ void cleanup_test(int i)
"checking for mlockall() error %s\n",
TC[i].edesc);
}
+
+ return;
+
+ case 1:
+ SAFE_SETEUID(cleanup, 0);
return;
}
diff --git a/testcases/kernel/syscalls/mmap/.gitignore b/testcases/kernel/syscalls/mmap/.gitignore
index 8811226be..39ed2aab0 100644
--- a/testcases/kernel/syscalls/mmap/.gitignore
+++ b/testcases/kernel/syscalls/mmap/.gitignore
@@ -15,6 +15,3 @@
/mmap14
/mmap15
/mmap16
-/mmap17
-/mmap18
-/mmap19
diff --git a/testcases/kernel/syscalls/mmap/Makefile b/testcases/kernel/syscalls/mmap/Makefile
index 743ca36e7..b2f0bd4f9 100644
--- a/testcases/kernel/syscalls/mmap/Makefile
+++ b/testcases/kernel/syscalls/mmap/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mmap/mmap001.c b/testcases/kernel/syscalls/mmap/mmap001.c
index dabb7d1e4..59a923f0f 100644
--- a/testcases/kernel/syscalls/mmap/mmap001.c
+++ b/testcases/kernel/syscalls/mmap/mmap001.c
@@ -81,8 +81,7 @@ option_t options[] = {
int main(int argc, char *argv[])
{
char *array;
- int lc;
- unsigned int i;
+ int i, lc;
int fd;
unsigned int pages, memsize;
diff --git a/testcases/kernel/syscalls/mmap/mmap01.c b/testcases/kernel/syscalls/mmap/mmap01.c
index 99266b57f..dc94baa97 100644
--- a/testcases/kernel/syscalls/mmap/mmap01.c
+++ b/testcases/kernel/syscalls/mmap/mmap01.c
@@ -164,7 +164,7 @@ static void setup(void)
}
/* Write some data into temporary file */
- if (write(fildes, write_buf, strlen(write_buf)) != (long)strlen(write_buf)) {
+ if (write(fildes, write_buf, strlen(write_buf)) != strlen(write_buf)) {
tst_brkm(TFAIL, cleanup, "writing to %s", TEMPFILE);
}
diff --git a/testcases/kernel/syscalls/mmap/mmap02.c b/testcases/kernel/syscalls/mmap/mmap02.c
index 566cc323a..829f33305 100644
--- a/testcases/kernel/syscalls/mmap/mmap02.c
+++ b/testcases/kernel/syscalls/mmap/mmap02.c
@@ -144,7 +144,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) < (int)page_sz) {
+ if (write(fildes, tst_buff, page_sz) < page_sz) {
free(tst_buff);
tst_brkm(TFAIL | TERRNO, cleanup,
"writing to %s failed", TEMPFILE);
diff --git a/testcases/kernel/syscalls/mmap/mmap03.c b/testcases/kernel/syscalls/mmap/mmap03.c
index b957a3218..679f0762d 100644
--- a/testcases/kernel/syscalls/mmap/mmap03.c
+++ b/testcases/kernel/syscalls/mmap/mmap03.c
@@ -175,7 +175,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) < (long)page_sz) {
+ if (write(fildes, tst_buff, page_sz) < page_sz) {
free(tst_buff);
tst_brkm(TFAIL | TERRNO, cleanup, "writing to %s failed",
TEMPFILE);
diff --git a/testcases/kernel/syscalls/mmap/mmap04.c b/testcases/kernel/syscalls/mmap/mmap04.c
index 43f7b7525..896157baf 100644
--- a/testcases/kernel/syscalls/mmap/mmap04.c
+++ b/testcases/kernel/syscalls/mmap/mmap04.c
@@ -147,7 +147,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) < (ssize_t)page_sz) {
+ if (write(fildes, tst_buff, page_sz) < page_sz) {
free(tst_buff);
tst_brkm(TFAIL, cleanup, "writing to %s failed", TEMPFILE);
}
diff --git a/testcases/kernel/syscalls/mmap/mmap05.c b/testcases/kernel/syscalls/mmap/mmap05.c
index 82f122543..2cbad0653 100644
--- a/testcases/kernel/syscalls/mmap/mmap05.c
+++ b/testcases/kernel/syscalls/mmap/mmap05.c
@@ -153,7 +153,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) != (int)page_sz) {
+ if (write(fildes, tst_buff, page_sz) != page_sz) {
free(tst_buff);
tst_brkm(TFAIL, cleanup, "writing to %s failed", TEMPFILE);
}
diff --git a/testcases/kernel/syscalls/mmap/mmap06.c b/testcases/kernel/syscalls/mmap/mmap06.c
index fb7c49257..e01cef2ed 100644
--- a/testcases/kernel/syscalls/mmap/mmap06.c
+++ b/testcases/kernel/syscalls/mmap/mmap06.c
@@ -128,7 +128,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) < (ssize_t)page_sz) {
+ if (write(fildes, tst_buff, page_sz) < page_sz) {
free(tst_buff);
tst_brkm(TFAIL, cleanup, "writing to %s failed", TEMPFILE);
}
diff --git a/testcases/kernel/syscalls/mmap/mmap07.c b/testcases/kernel/syscalls/mmap/mmap07.c
index 682e527aa..372840ac5 100644
--- a/testcases/kernel/syscalls/mmap/mmap07.c
+++ b/testcases/kernel/syscalls/mmap/mmap07.c
@@ -131,7 +131,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) < (int)page_sz) {
+ if (write(fildes, tst_buff, page_sz) < page_sz) {
free(tst_buff);
tst_brkm(TFAIL, cleanup, "writing to %s failed", TEMPFILE);
}
diff --git a/testcases/kernel/syscalls/mmap/mmap08.c b/testcases/kernel/syscalls/mmap/mmap08.c
index f2daf45a3..f7ef6c3a2 100644
--- a/testcases/kernel/syscalls/mmap/mmap08.c
+++ b/testcases/kernel/syscalls/mmap/mmap08.c
@@ -122,7 +122,7 @@ static void setup(void)
}
/* Write test buffer contents into temporary file */
- if (write(fildes, tst_buff, page_sz) != (int)page_sz) {
+ if (write(fildes, tst_buff, page_sz) != page_sz) {
free(tst_buff);
tst_brkm(TFAIL, cleanup, "writing to %s failed", TEMPFILE);
}
diff --git a/testcases/kernel/syscalls/mmap/mmap10.c b/testcases/kernel/syscalls/mmap/mmap10.c
index b844af07f..34149186d 100644
--- a/testcases/kernel/syscalls/mmap/mmap10.c
+++ b/testcases/kernel/syscalls/mmap/mmap10.c
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
if (access(PATH_KSM, F_OK) == -1)
tst_brkm(TCONF, NULL,
"KSM configuration is not enabled");
-#ifdef HAVE_DECL_MADV_MERGEABLE
+#ifdef HAVE_MADV_MERGEABLE
tst_resm(TINFO, "add to KSM regions.");
#else
tst_brkm(TCONF, NULL, "MADV_MERGEABLE missing in sys/mman.h");
@@ -133,7 +133,7 @@ void mmapzero(void)
}
if (x == MAP_FAILED)
tst_brkm(TFAIL | TERRNO, cleanup, "mmap");
-#ifdef HAVE_DECL_MADV_MERGEABLE
+#ifdef HAVE_MADV_MERGEABLE
if (opt_ksm) {
if (madvise(x, SIZE + SIZE - ps, MADV_MERGEABLE) == -1)
tst_brkm(TBROK | TERRNO, cleanup, "madvise");
diff --git a/testcases/kernel/syscalls/mmap/mmap17.c b/testcases/kernel/syscalls/mmap/mmap17.c
deleted file mode 100644
index 0001c3794..000000000
--- a/testcases/kernel/syscalls/mmap/mmap17.c
+++ /dev/null
@@ -1,85 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Zilogic Systems Pvt. Ltd., 2020
- * Email: code@zilogic.com
- */
-
-/*
- * Test mmap with MAP_FIXED_NOREPLACE flag
- *
- * We are testing the MAP_FIXED_NOREPLACE flag of mmap() syscall. To check
- * if an attempt to mmap at an exisiting mapping fails with EEXIST.
- * The code allocates a free address by passing NULL to first mmap call
- * Then tries to mmap with the same address using MAP_FIXED_NOREPLACE flag
- * and the mapping fails as expected.
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include "lapi/mmap.h"
-#include "tst_test.h"
-
-static int fd_file1;
-static int fd_file2;
-static void *mapped_address;
-static const char str[] = "Writing to mapped file";
-
-#define FNAME1 "file1_to_mmap"
-#define FNAME2 "file2_to_mmap"
-
-static void setup(void)
-{
- fd_file1 = SAFE_OPEN(FNAME1, O_CREAT | O_RDWR, 0600);
- fd_file2 = SAFE_OPEN(FNAME2, O_CREAT | O_RDWR, 0600);
-}
-
-static void cleanup(void)
-{
- int str_len;
-
- str_len = strlen(str);
-
- if (fd_file2 > 0)
- SAFE_CLOSE(fd_file2);
- if (fd_file1 > 0)
- SAFE_CLOSE(fd_file1);
- if (mapped_address)
- SAFE_MUNMAP(mapped_address, str_len);
-}
-
-static void test_mmap(void)
-{
- int str_len;
- void *address;
-
- str_len = strlen(str);
-
- SAFE_WRITE(1, fd_file1, str, str_len);
- mapped_address = SAFE_MMAP(NULL, str_len, PROT_WRITE,
- MAP_PRIVATE, fd_file1, 0);
-
- SAFE_WRITE(1, fd_file2, str, str_len);
-
- address = mmap(mapped_address, str_len, PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED_NOREPLACE, fd_file2, 0);
- if (address == MAP_FAILED && errno == EEXIST)
- tst_res(TPASS, "mmap set errno to EEXIST as expected");
- else
- tst_res(TFAIL | TERRNO, "mmap failed, with unexpected error "
- "code, expected EEXIST");
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = test_mmap,
- .min_kver = "4.17",
- .needs_tmpdir = 1
-};
diff --git a/testcases/kernel/syscalls/mmap/mmap18.c b/testcases/kernel/syscalls/mmap/mmap18.c
deleted file mode 100644
index dc2926454..000000000
--- a/testcases/kernel/syscalls/mmap/mmap18.c
+++ /dev/null
@@ -1,215 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Zilogic Systems Pvt. Ltd., 2020
- * Email: code@zilogic.com
- */
-
-/*
- * Test mmap() MAP_GROWSDOWN flag
- *
- * # Test1:
- *
- * We assign the memory region partially allocated with MAP_GROWSDOWN flag to
- * a thread as a stack and expect the mapping to grow when we touch the
- * guard page by calling a recusive function in the thread that uses the
- * growable mapping as a stack.
- *
- * The kernel only grows the memory region when the stack pointer is within
- * guard page when the guard page is touched so simply faulting the guard
- * page will not cause the mapping to grow.
- *
- * Newer kernels does not allow a MAP_GROWSDOWN mapping to grow closer than
- * 'stack_guard_gap' pages to an existing mapping. So when we map the stack we
- * make sure there is enough of free address space before the lowest stack
- * address.
- *
- * Kernel default 'stack_guard_gap' size is '256 * getpagesize()'.
- *
- * The stack memory map would look like:
- *
- * | - - - reserved size - - - |
- *
- * +-- - - - --+------------+-------------+
- * | 256 pages | unmapped | mapped |
- * +-- - - - --+------------+-------------+
- * | mapped size |
- * ^ | - - stack size - - |
- * start
- * ^ ^
- * stack bottom stack top
- *
- * # Test2:
- *
- * We allocate stack as we do in the first test but we mmap a page in the
- * space the stack is supposed to grow into and we expect the thread to
- * segfault when the guard page is faulted.
- */
-
-#include <unistd.h>
-#include <pthread.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdbool.h>
-
-#include "tst_test.h"
-#include "tst_safe_pthread.h"
-
-static long page_size;
-
-static bool __attribute__((noinline)) check_stackgrow_up(void)
-{
- char local_var;
- static char *addr;
-
- if (!addr) {
- addr = &local_var;
- return check_stackgrow_up();
- }
-
- return (addr < &local_var);
-}
-
-static void setup(void)
-{
- if (check_stackgrow_up())
- tst_brk(TCONF, "Test can't be performed with stack grows up architecture");
-
- page_size = getpagesize();
-}
-
-/*
- * Returns stack lowest address. Note that the address is not mapped and will
- * be mapped on page fault when we grow the stack to the lowest address possible.
- */
-static void *allocate_stack(size_t stack_size, size_t mapped_size)
-{
- void *start, *stack_top, *stack_bottom;
-
- long reserved_size = 256 * page_size + stack_size;
-
- start = SAFE_MMAP(NULL, reserved_size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- SAFE_MUNMAP(start, reserved_size);
-
- SAFE_MMAP((start + reserved_size - mapped_size), mapped_size, PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS | MAP_GROWSDOWN,
- -1, 0);
-
- stack_top = start + reserved_size;
- stack_bottom = start + reserved_size - stack_size;
-
- tst_res(TINFO, "start = %p, stack_top = %p, stack bottom = %p",
- start, stack_top, stack_bottom);
- tst_res(TINFO, "mapped pages %zu, stack pages %zu",
- mapped_size/page_size, stack_size/page_size);
-
- return stack_bottom;
-}
-
-static __attribute__((noinline)) void *check_depth_recursive(void *limit)
-{
- if ((off_t) &limit < (off_t) limit) {
- tst_res(TINFO, "&limit = %p, limit = %p", &limit, limit);
- return NULL;
- }
-
- return check_depth_recursive(limit);
-}
-
-/*
- * We set the limit one page above the stack bottom to make sure that the stack
- * frame will not overflow to the next page, which would potentially cause
- * segfault if we are unlucky and there is a mapping right after the guard gap.
- *
- * Generally the stack frame would be much smaller than page_size so moving the
- * pointer by a few bytes would probably be enough, but we do not want to take
- * any chances.
- */
-static void grow_stack(void *stack, size_t size)
-{
- pthread_t test_thread;
- pthread_attr_t attr;
- int ret;
- void *limit = stack + page_size;
-
- ret = pthread_attr_init(&attr);
- if (ret)
- tst_brk(TBROK, "pthread_attr_init failed during setup");
-
- ret = pthread_attr_setstack(&attr, stack, size);
- if (ret)
- tst_brk(TBROK, "pthread_attr_setstack failed during setup");
-
- SAFE_PTHREAD_CREATE(&test_thread, &attr, check_depth_recursive, limit);
- SAFE_PTHREAD_JOIN(test_thread, NULL);
-
- exit(0);
-}
-
-static void grow_stack_success(size_t stack_size, size_t mapped_size)
-{
- pid_t child_pid;
- int wstatus;
- void *stack;
-
- child_pid = SAFE_FORK();
- if (!child_pid) {
- stack = allocate_stack(stack_size, mapped_size);
- grow_stack(stack, stack_size);
- }
-
- SAFE_WAIT(&wstatus);
- if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0)
- tst_res(TPASS, "Stack grows in unmapped region");
- else
- tst_res(TFAIL, "Child: %s", tst_strstatus(wstatus));
-
-}
-
-/*
- * We map a page at the bottom of the stack which will cause the thread to be
- * killed with SIGSEGV on faulting the guard page.
- */
-static void grow_stack_fail(size_t stack_size, size_t mapped_size)
-{
- pid_t child_pid;
- int wstatus;
- void *stack;
-
- child_pid = SAFE_FORK();
- if (!child_pid) {
- tst_no_corefile(0);
- stack = allocate_stack(stack_size, mapped_size);
-
- SAFE_MMAP(stack, page_size, PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
- tst_res(TINFO, "mapped page at %p", stack);
-
- grow_stack(stack, stack_size);
- }
-
- SAFE_WAIT(&wstatus);
- if (WIFSIGNALED(wstatus) && WTERMSIG(wstatus) == SIGSEGV)
- tst_res(TPASS, "Child killed by %s as expected", tst_strsig(SIGSEGV));
- else
- tst_res(TFAIL, "Child: %s", tst_strstatus(wstatus));
-}
-
-static void run_test(void)
-{
- size_t stack_size = 8 * PTHREAD_STACK_MIN;
-
- grow_stack_success(stack_size, PTHREAD_STACK_MIN);
- grow_stack_success(stack_size, stack_size/2);
- grow_stack_fail(stack_size, PTHREAD_STACK_MIN);
- grow_stack_fail(stack_size, stack_size/2);
-}
-
-static struct tst_test test = {
- .setup = setup,
- .test_all = run_test,
- .forks_child = 1,
-};
diff --git a/testcases/kernel/syscalls/mmap/mmap19.c b/testcases/kernel/syscalls/mmap/mmap19.c
deleted file mode 100644
index 734a3a23e..000000000
--- a/testcases/kernel/syscalls/mmap/mmap19.c
+++ /dev/null
@@ -1,99 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (c) National ICT Australia, 2006
- * Author: carl.vanschaik at nicta.com.au
- */
-
-/*\
- * [Description]
- *
- * If the kernel fails to correctly flush the TLB entry, the second mmap
- * will not show the correct data.
- *
- * [Algorithm]
- * - create two files, write known data to the files
- * - mmap the files, verify data
- * - unmap files
- * - remmap files, swap virtual addresses
- * - check wheather if the memory content is correct
- */
-
-#include <string.h>
-#include "tst_test.h"
-
-#define LEN 64
-
-static int f1 = -1, f2 = -1;
-static char *mm1 = NULL, *mm2 = NULL;
-
-static const char tmp1[] = "testfile1";
-static const char tmp2[] = "testfile2";
-
-static const char str1[] = "testing 123";
-static const char str2[] = "my test mem";
-
-static void run(void)
-{
-
- char *save_mm1, *save_mm2;
-
- mm1 = SAFE_MMAP(0, LEN, PROT_READ, MAP_PRIVATE, f1, 0);
- mm2 = SAFE_MMAP(0, LEN, PROT_READ, MAP_PRIVATE, f2, 0);
-
- save_mm1 = mm1;
- save_mm2 = mm2;
-
- if (strncmp(str1, mm1, strlen(str1)))
- tst_brk(TFAIL, "failed on compare %s", tmp1);
-
- if (strncmp(str2, mm2, strlen(str2)))
- tst_brk(TFAIL, "failed on compare %s", tmp2);
-
- SAFE_MUNMAP(mm1, LEN);
- SAFE_MUNMAP(mm2, LEN);
-
- mm1 = SAFE_MMAP(save_mm2, LEN, PROT_READ, MAP_PRIVATE, f1, 0);
- mm2 = SAFE_MMAP(save_mm1, LEN, PROT_READ, MAP_PRIVATE, f2, 0);
-
- if (mm1 != save_mm2 || mm2 != save_mm1)
- tst_res(TINFO, "mmap not using same address");
-
- if (strncmp(str1, mm1, strlen(str1)))
- tst_brk(TFAIL, "failed on compare %s", tmp1);
-
- if (strncmp(str2, mm2, strlen(str2)))
- tst_brk(TFAIL, "failed on compare %s", tmp2);
-
- tst_res(TPASS, "memory test succeeded");
-}
-
-static void setup(void)
-{
- f1 = SAFE_OPEN(tmp1, O_RDWR | O_CREAT, S_IREAD | S_IWRITE);
- f2 = SAFE_OPEN(tmp2, O_RDWR | O_CREAT, S_IREAD | S_IWRITE);
-
- SAFE_WRITE(1, f1, str1, strlen(str1));
- SAFE_WRITE(1, f2, str2, strlen(str2));
-}
-
-static void cleanup(void)
-{
- if (mm1)
- SAFE_MUNMAP(mm1, LEN);
-
- if (mm2)
- SAFE_MUNMAP(mm2, LEN);
-
- if (f1 != -1)
- SAFE_CLOSE(f1);
- if (f2 != -1)
- SAFE_CLOSE(f2);
-}
-
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
-};
-
diff --git a/testcases/kernel/syscalls/modify_ldt/Makefile b/testcases/kernel/syscalls/modify_ldt/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/modify_ldt/Makefile
+++ b/testcases/kernel/syscalls/modify_ldt/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/modify_ldt/modify_ldt01.c b/testcases/kernel/syscalls/modify_ldt/modify_ldt01.c
index 684e53772..248111814 100644
--- a/testcases/kernel/syscalls/modify_ldt/modify_ldt01.c
+++ b/testcases/kernel/syscalls/modify_ldt/modify_ldt01.c
@@ -89,6 +89,8 @@ int create_segment(void *, size_t);
void cleanup(void);
void setup(void);
+#define FAILED 1
+
int main(int ac, char **av)
{
int lc;
@@ -96,20 +98,25 @@ int main(int ac, char **av)
void *ptr;
int retval, func;
+ int flag;
int seg[4];
tst_parse_opts(ac, av, NULL, NULL);
- setup();
+ setup(); /* global setup */
+ /* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset tst_count in case we are looping */
tst_count = 0;
+//block1:
/*
* Check for ENOSYS.
*/
+ tst_resm(TINFO, "Enter block 1");
+ flag = 0;
ptr = malloc(10);
func = 100;
retval = modify_ldt(func, ptr, sizeof(ptr));
@@ -118,20 +125,29 @@ int main(int ac, char **av)
tst_resm(TFAIL, "modify_ldt() set invalid "
"errno, expected ENOSYS, got: %d",
errno);
- } else {
- tst_resm(TPASS,
- "modify_ldt() set expected errno");
+ flag = FAILED;
}
} else {
tst_resm(TFAIL, "modify_ldt error: "
"unexpected return value %d", retval);
+ flag = FAILED;
}
+ if (flag) {
+ tst_resm(TINFO, "block 1 FAILED");
+ } else {
+ tst_resm(TINFO, "block 1 PASSED");
+ }
+ tst_resm(TINFO, "Exit block 1");
free(ptr);
+//block2:
/*
* Check for EINVAL
*/
+ tst_resm(TINFO, "Enter block 2");
+ flag = 0;
+
ptr = 0;
retval = modify_ldt(1, ptr, sizeof(ptr));
@@ -140,20 +156,28 @@ int main(int ac, char **av)
tst_resm(TFAIL, "modify_ldt() set invalid "
"errno, expected EINVAL, got: %d",
errno);
- } else {
- tst_resm(TPASS,
- "modify_ldt() set expected errno");
+ flag = FAILED;
}
} else {
tst_resm(TFAIL, "modify_ldt error: "
"unexpected return value %d", retval);
+ flag = FAILED;
}
+ if (flag) {
+ tst_resm(TINFO, "block 2 FAILED");
+ } else {
+ tst_resm(TINFO, "block 2 PASSED");
+ }
+ tst_resm(TINFO, "Exit block 2");
+
+//block3:
+
/*
* Create a new LDT segment.
*/
if (create_segment(seg, sizeof(seg)) == -1) {
- tst_brkm(TBROK, cleanup, "Creation of segment failed");
+ tst_brkm(TINFO, cleanup, "Creation of segment failed");
}
/*
@@ -167,17 +191,25 @@ int main(int ac, char **av)
tst_resm(TFAIL, "modify_ldt() set invalid "
"errno, expected EFAULT, got: %d",
errno);
- } else {
- tst_resm(TPASS,
- "modify_ldt() set expected errno");
+ flag = FAILED;
}
} else {
tst_resm(TFAIL, "modify_ldt error: "
"unexpected return value %d", retval);
+ flag = FAILED;
}
+
+ if (flag) {
+ tst_resm(TINFO, "block 3 FAILED");
+ } else {
+ tst_resm(TINFO, "block 3 PASSED");
+ }
+ tst_resm(TINFO, "Exit block 3");
+
}
cleanup();
tst_exit();
+
}
/*
@@ -199,6 +231,9 @@ int create_segment(void *seg, size_t size)
return modify_ldt(1, &entry, sizeof(entry));
}
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
void setup(void)
{
@@ -207,6 +242,10 @@ void setup(void)
TEST_PAUSE;
}
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
void cleanup(void)
{
diff --git a/testcases/kernel/syscalls/modify_ldt/modify_ldt02.c b/testcases/kernel/syscalls/modify_ldt/modify_ldt02.c
index f911aa5fd..c953ac420 100644
--- a/testcases/kernel/syscalls/modify_ldt/modify_ldt02.c
+++ b/testcases/kernel/syscalls/modify_ldt/modify_ldt02.c
@@ -86,24 +86,34 @@ int read_segment(unsigned int);
void cleanup(void);
void setup(void);
+#define FAILED 1
+
int main(int ac, char **av)
{
int lc;
int val, pid, status;
+ int flag;
int seg[4];
tst_parse_opts(ac, av, NULL, NULL);
- setup();
+ setup(); /* global setup */
+ /* The following loop checks looping state if -i option given */
for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ /* reset tst_count in case we are looping */
tst_count = 0;
+//block1:
+ tst_resm(TINFO, "Enter block 1");
+ flag = 0;
+
seg[0] = 12345;
if (create_segment(seg, sizeof(seg)) == -1) {
- tst_brkm(TBROK, cleanup, "Creation of segment failed");
+ tst_brkm(TINFO, cleanup, "Creation of segment failed");
}
val = read_segment(0);
@@ -111,16 +121,27 @@ int main(int ac, char **av)
if (val != seg[0]) {
tst_resm(TFAIL, "Invalid value read %d, expected %d",
val, seg[0]);
- } else
- tst_resm(TPASS, "value read as expected");
+ flag = FAILED;
+ }
+
+ if (flag) {
+ tst_resm(TINFO, "block 1 FAILED");
+ } else {
+ tst_resm(TINFO, "block 1 PASSED");
+ }
+
+ tst_resm(TINFO, "Exit block 1");
+
+//block2:
+ tst_resm(TINFO, "Enter block 2");
+ flag = 0;
if (create_segment(0, 10) == -1) {
- tst_brkm(TBROK, cleanup, "Creation of segment failed");
+ tst_brkm(TINFO, cleanup, "Creation of segment failed");
}
tst_old_flush();
if ((pid = FORK_OR_VFORK()) == 0) {
- signal(SIGSEGV, SIG_DFL);
val = read_segment(0);
exit(1);
}
@@ -128,13 +149,15 @@ int main(int ac, char **av)
(void)waitpid(pid, &status, 0);
if (WEXITSTATUS(status) != 0) {
+ flag = FAILED;
tst_resm(TFAIL, "Did not generate SEGV, child returned "
"unexpected status");
+ }
+
+ if (flag) {
+ tst_resm(TINFO, "block 2 FAILED");
} else {
- if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGSEGV))
- tst_resm(TPASS, "generate SEGV as expected");
- else
- tst_resm(TFAIL, "Did not generate SEGV");
+ tst_resm(TINFO, "block 2 PASSED");
}
}
cleanup();
@@ -169,13 +192,34 @@ int read_segment(unsigned int index)
return res;
}
+void sigsegv_handler(int sig)
+{
+ tst_resm(TINFO, "received signal: %d", sig);
+ exit(0);
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test
+ */
void setup(void)
{
+ struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+ sigemptyset(&act.sa_mask);
+
tst_sig(FORK, DEF_HANDLER, cleanup);
+ act.sa_handler = sigsegv_handler;
+ (void)sigaction(SIGSEGV, &act, NULL);
+
TEST_PAUSE;
}
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
void cleanup(void)
{
diff --git a/testcases/kernel/syscalls/mount/Makefile b/testcases/kernel/syscalls/mount/Makefile
index 31cf89155..5caed987f 100644
--- a/testcases/kernel/syscalls/mount/Makefile
+++ b/testcases/kernel/syscalls/mount/Makefile
@@ -1,7 +1,21 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
# Copyright (C) International Business Machines Corp., 2007
#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
# HISTORY:
# 6/8/07 krisw@us.ibm.com Copied change made in RHEL Makefile for seg fault.
#
diff --git a/testcases/kernel/syscalls/mount/mount03.c b/testcases/kernel/syscalls/mount/mount03.c
index 25f99bbfc..6603fb77a 100644
--- a/testcases/kernel/syscalls/mount/mount03.c
+++ b/testcases/kernel/syscalls/mount/mount03.c
@@ -208,7 +208,7 @@ int test_rwflag(int i, int cnt)
/* Write the buffer data into file */
if (write(fildes, write_buffer, strlen(write_buffer)) !=
- (long)strlen(write_buffer)) {
+ strlen(write_buffer)) {
tst_resm(TWARN | TERRNO, "writing to %s failed", file);
close(fildes);
return 1;
diff --git a/testcases/kernel/syscalls/move_mount/.gitignore b/testcases/kernel/syscalls/move_mount/.gitignore
deleted file mode 100644
index 83ae40145..000000000
--- a/testcases/kernel/syscalls/move_mount/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/move_mount01
-/move_mount02
diff --git a/testcases/kernel/syscalls/move_mount/Makefile b/testcases/kernel/syscalls/move_mount/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/syscalls/move_mount/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/move_mount/move_mount01.c b/testcases/kernel/syscalls/move_mount/move_mount01.c
deleted file mode 100644
index 445e6197e..000000000
--- a/testcases/kernel/syscalls/move_mount/move_mount01.c
+++ /dev/null
@@ -1,83 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic move_mount() test.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-#define TCASE_ENTRY(_flags) {.name = "Flag " #_flags, .flags = _flags}
-
-static struct tcase {
- char *name;
- unsigned int flags;
-} tcases[] = {
- TCASE_ENTRY(MOVE_MOUNT_F_SYMLINKS),
- TCASE_ENTRY(MOVE_MOUNT_F_AUTOMOUNTS),
- TCASE_ENTRY(MOVE_MOUNT_F_EMPTY_PATH),
- TCASE_ENTRY(MOVE_MOUNT_T_SYMLINKS),
- TCASE_ENTRY(MOVE_MOUNT_T_AUTOMOUNTS),
- TCASE_ENTRY(MOVE_MOUNT_T_EMPTY_PATH),
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int fsmfd, fd;
-
- TEST(fd = fsopen(tst_device->fs_type, 0));
- if (fd == -1) {
- tst_res(TFAIL | TTERRNO, "fsopen() failed");
- return;
- }
-
- TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
- if (TST_RET == -1) {
- SAFE_CLOSE(fd);
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
- return;
- }
-
- TEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
- if (TST_RET == -1) {
- SAFE_CLOSE(fd);
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_CREATE) failed");
- return;
- }
-
- TEST(fsmfd = fsmount(fd, 0, 0));
- SAFE_CLOSE(fd);
-
- if (fsmfd == -1) {
- tst_res(TFAIL | TTERRNO, "fsmount() failed");
- return;
- }
-
- TEST(move_mount(fsmfd, "", AT_FDCWD, MNTPOINT,
- tc->flags | MOVE_MOUNT_F_EMPTY_PATH));
- SAFE_CLOSE(fsmfd);
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "move_mount() failed");
- return;
- }
-
- if (tst_is_mounted_at_tmpdir(MNTPOINT)) {
- SAFE_UMOUNT(MNTPOINT);
- tst_res(TPASS, "%s: move_mount() passed", tc->name);
- }
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .format_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/move_mount/move_mount02.c b/testcases/kernel/syscalls/move_mount/move_mount02.c
deleted file mode 100644
index 45b1db4be..000000000
--- a/testcases/kernel/syscalls/move_mount/move_mount02.c
+++ /dev/null
@@ -1,92 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic move_mount() failure tests.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-int invalid_fd = -1, fsmfd;
-
-static struct tcase {
- char *name;
- int *from_dirfd;
- const char *from_pathname;
- int to_dirfd;
- const char *to_pathname;
- unsigned int flags;
- int exp_errno;
-} tcases[] = {
- {"invalid-from-fd", &invalid_fd, "", AT_FDCWD, MNTPOINT, MOVE_MOUNT_F_EMPTY_PATH, EBADF},
- {"invalid-from-path", &fsmfd, "invalid", AT_FDCWD, MNTPOINT, MOVE_MOUNT_F_EMPTY_PATH, ENOENT},
- {"invalid-to-fd", &fsmfd, "", -1, MNTPOINT, MOVE_MOUNT_F_EMPTY_PATH, EBADF},
- {"invalid-to-path", &fsmfd, "", AT_FDCWD, "invalid", MOVE_MOUNT_F_EMPTY_PATH, ENOENT},
- {"invalid-flags", &fsmfd, "", AT_FDCWD, MNTPOINT, 0x08, EINVAL},
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int fd;
-
- TEST(fd = fsopen(tst_device->fs_type, 0));
- if (fd == -1) {
- tst_res(TFAIL | TTERRNO, "fsopen() failed");
- return;
- }
-
- TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
- if (TST_RET == -1) {
- SAFE_CLOSE(fd);
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
- return;
- }
-
- TEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
- if (TST_RET == -1) {
- SAFE_CLOSE(fd);
- tst_res(TFAIL | TTERRNO, "fsconfig(FSCONFIG_CMD_CREATE) failed");
- return;
- }
-
- TEST(fsmfd = fsmount(fd, 0, 0));
- SAFE_CLOSE(fd);
-
- if (fsmfd == -1) {
- tst_res(TFAIL | TTERRNO, "fsmount() failed");
- return;
- }
-
- TEST(move_mount(*tc->from_dirfd, tc->from_pathname, tc->to_dirfd,
- tc->to_pathname, tc->flags));
- SAFE_CLOSE(fsmfd);
-
- if (TST_RET != -1) {
- SAFE_UMOUNT(MNTPOINT);
- tst_res(TFAIL, "%s: move_mount() succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: move_mount() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: move_mount() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .format_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/move_pages/Makefile b/testcases/kernel/syscalls/move_pages/Makefile
index 4b22160ed..27cf0f7a8 100644
--- a/testcases/kernel/syscalls/move_pages/Makefile
+++ b/testcases/kernel/syscalls/move_pages/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
@@ -7,9 +22,9 @@ include $(top_srcdir)/include/mk/testcases.mk
CPPFLAGS += -I$(abs_srcdir)/../utils
-MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(sort $(wildcard $(abs_srcdir)/*[0-9].c)))
+MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
-$(MAKE_TARGETS): %: move_pages_support.o
+$(MAKE_TARGETS): %: %.o move_pages_support.o
LDLIBS += -lpthread -lrt
diff --git a/testcases/kernel/syscalls/move_pages/move_pages01.c b/testcases/kernel/syscalls/move_pages/move_pages01.c
index f853928ac..4a3a8efbb 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages01.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages01.c
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
free_pages(pages, TEST_PAGES);
continue;
} else if (ret > 0) {
- tst_resm(TINFO, "move_pages() returned %d", ret);
+ tst_resm(TINFO, "move_pages() returned %d\n", ret);
}
verify_pages_linear(pages, status, TEST_PAGES);
diff --git a/testcases/kernel/syscalls/move_pages/move_pages02.c b/testcases/kernel/syscalls/move_pages/move_pages02.c
index 27d683bb0..80fe6e60f 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages02.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages02.c
@@ -108,7 +108,7 @@ int main(int argc, char **argv)
free_pages(pages, TEST_PAGES);
continue;
} else if (ret > 0) {
- tst_resm(TINFO, "move_pages() returned %d", ret);
+ tst_resm(TINFO, "move_pages() returned %d\n", ret);
}
for (i = 0; i < TEST_PAGES; i++)
diff --git a/testcases/kernel/syscalls/move_pages/move_pages03.c b/testcases/kernel/syscalls/move_pages/move_pages03.c
index fe849ec03..d0f2294fb 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages03.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages03.c
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
tst_resm(TFAIL|TERRNO, "move_pages failed");
goto err_kill_child;
} else if (ret > 0) {
- tst_resm(TINFO, "move_pages() returned %d", ret);
+ tst_resm(TINFO, "move_pages() returned %d\n", ret);
}
verify_pages_on_node(pages, status, TEST_PAGES, to_node);
diff --git a/testcases/kernel/syscalls/move_pages/move_pages04.c b/testcases/kernel/syscalls/move_pages/move_pages04.c
index f53453ab4..df5e334e2 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages04.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages04.c
@@ -132,7 +132,7 @@ int main(int argc, char **argv)
"move_pages unexpectedly failed");
goto err_free_pages;
} else if (ret > 0) {
- tst_resm(TINFO, "move_pages() returned %d", ret);
+ tst_resm(TINFO, "move_pages() returned %d\n", ret);
}
if (status[UNTOUCHED_PAGE] == exp_status) {
diff --git a/testcases/kernel/syscalls/move_pages/move_pages05.c b/testcases/kernel/syscalls/move_pages/move_pages05.c
index 41f65ed39..7db3c47a9 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages05.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages05.c
@@ -176,7 +176,7 @@ int main(int argc, char **argv)
"move_pages unexpectedly failed");
goto err_kill_child;
} else if (ret > 0) {
- tst_resm(TINFO, "move_pages() returned %d", ret);
+ tst_resm(TINFO, "move_pages() returned %d\n", ret);
}
if (status[SHARED_PAGE] == -EACCES)
diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index 220130f4b..c906acbe3 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -7,17 +7,16 @@
* Ported: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
*/
-/*\
- * [Description]
- *
- * *Test 1*
+/*
+ * Description:
*
- * This is a regression test for the race condition between move_pages()
- * and freeing hugepages, where move_pages() calls follow_page(FOLL_GET)
- * for hugepages internally and tries to get its refcount without
- * preventing concurrent freeing.
+ * Test #1:
+ * This is a regression test for the race condition between move_pages()
+ * and freeing hugepages, where move_pages() calls follow_page(FOLL_GET)
+ * for hugepages internally and tries to get its refcount without
+ * preventing concurrent freeing.
*
- * This test can crash the buggy kernel, and the bug was fixed in:
+ * This test can crash the buggy kernel, and the bug was fixed in:
*
* commit e66f17ff71772b209eed39de35aaa99ba819c93d
* Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
@@ -25,25 +24,25 @@
*
* mm/hugetlb: take page table lock in follow_huge_pmd()
*
- * *Test 2.1*
+ * Test #2:
+ * #2.1:
+ * This is a regression test for the race condition, where move_pages()
+ * and soft offline are called on a single hugetlb page concurrently.
*
- * This is a regression test for the race condition, where move_pages()
- * and soft offline are called on a single hugetlb page concurrently.
- *
- * This test can crash the buggy kernel, and was fixed by:
+ * This bug can crash the buggy kernel, and was fixed by:
*
* commit c9d398fa237882ea07167e23bcfc5e6847066518
* Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
* Date: Fri Mar 31 15:11:55 2017 -0700
*
- * mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd()
- *
- * *Test 2.2*
+ * mm, hugetlb: use pte_present() instead of pmd_present() in
+ * follow_huge_pmd()
*
- * This is also a regression test for an race condition causing SIGBUS
- * in hugepage migration/fault.
+ * #2.2:
+ * This is also a regression test for an race condition causing SIGBUS
+ * in hugepage migration/fault.
*
- * This bug was fixed by:
+ * This bug was fixed by:
*
* commit 4643d67e8cb0b3536ef0ab5cddd1cedc73fa14ad
* Author: Mike Kravetz <mike.kravetz@oracle.com>
@@ -51,16 +50,6 @@
*
* hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS
*
- * *Test 2.3*
- *
- * The madvise() in the do_soft_online() was also triggering cases where soft
- * online returned EIO when page migration failed, which was fixed in:
- *
- * commit 3f4b815a439adfb8f238335612c4b28bc10084d8
- * Author: Oscar Salvador <osalvador@suse.de>
- * Date: Mon Dec 14 19:11:51 2020 -0800
- *
- * mm,hwpoison: return -EBUSY when migration fails
*/
#include <errno.h>
@@ -345,7 +334,6 @@ static struct tst_test test = {
{"linux-git", "e66f17ff7177"},
{"linux-git", "c9d398fa2378"},
{"linux-git", "4643d67e8cb0"},
- {"linux-git", "3f4b815a439a"},
{}
}
};
diff --git a/testcases/kernel/syscalls/move_pages/move_pages_support.c b/testcases/kernel/syscalls/move_pages/move_pages_support.c
index 717321a48..fc0b8b036 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages_support.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages_support.c
@@ -67,11 +67,11 @@ int alloc_pages_on_nodes(void **pages, unsigned int num, int *nodes)
size_t onepage = get_page_size();
#endif
- for (i = 0; i < (int)num; i++) {
+ for (i = 0; i < num; i++) {
pages[i] = NULL;
}
- for (i = 0; i < (int)num; i++) {
+ for (i = 0; i < num; i++) {
char *page;
#ifdef HAVE_NUMA_V2
@@ -88,7 +88,7 @@ int alloc_pages_on_nodes(void **pages, unsigned int num, int *nodes)
page[0] = i;
}
- if (i == (int)num)
+ if (i == num)
return 0;
free_pages(pages, num);
diff --git a/testcases/kernel/syscalls/mprotect/Makefile b/testcases/kernel/syscalls/mprotect/Makefile
index 06d97ca42..bc5c8bc10 100644
--- a/testcases/kernel/syscalls/mprotect/Makefile
+++ b/testcases/kernel/syscalls/mprotect/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mprotect/mprotect04.c b/testcases/kernel/syscalls/mprotect/mprotect04.c
index 6c7f6bd01..1a0fa0e63 100644
--- a/testcases/kernel/syscalls/mprotect/mprotect04.c
+++ b/testcases/kernel/syscalls/mprotect/mprotect04.c
@@ -214,7 +214,7 @@ static void *get_func(void *mem, uintptr_t *func_page_offset)
/* If the memory is still not accessible, then something must be
* wrong. */
if (!page_present(page_to_copy))
- tst_brkm(TBROK, cleanup, "page_to_copy not present");
+ tst_brkm(TBROK, cleanup, "page_to_copy not present\n");
}
memcpy(mem, page_to_copy, page_sz);
diff --git a/testcases/kernel/syscalls/mq_notify/Makefile b/testcases/kernel/syscalls/mq_notify/Makefile
index 0f7c7cf7e..7b9304212 100644
--- a/testcases/kernel/syscalls/mq_notify/Makefile
+++ b/testcases/kernel/syscalls/mq_notify/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
index 1a6c5dbad..9083e0de0 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
@@ -198,13 +198,15 @@ static void do_test(unsigned int i)
tst_res(TPASS, "mq_notify and mq_timedsend exited expectedly");
}
+static struct tst_option options[] = {
+ {"d", &str_debug, "Print debug messages"},
+ {NULL, NULL, NULL}
+};
+
static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcase),
.test = do_test,
- .options = (struct tst_option[]) {
- {"d", &str_debug, "Print debug messages"},
- {}
- },
+ .options = options,
.setup = setup_common,
.cleanup = cleanup_common,
};
diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify02.c b/testcases/kernel/syscalls/mq_notify/mq_notify02.c
index 3109fe345..fe59b5a11 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify02.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify02.c
@@ -77,8 +77,6 @@ static void mq_notify_verify(struct test_case_t *test)
if (TEST_ERRNO == test->exp_errno) {
tst_resm(TPASS | TTERRNO, "mq_notify failed as expected");
- } else if (TEST_ERRNO == ENOSYS) {
- tst_resm(TCONF | TTERRNO, "mq_notify not available");
} else {
tst_resm(TFAIL | TTERRNO,
"mq_notify failed unexpectedly; expected: %d - %s",
diff --git a/testcases/kernel/syscalls/mq_open/Makefile b/testcases/kernel/syscalls/mq_open/Makefile
index 262eef71b..71ebae98b 100644
--- a/testcases/kernel/syscalls/mq_open/Makefile
+++ b/testcases/kernel/syscalls/mq_open/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mq_timedreceive/Makefile b/testcases/kernel/syscalls/mq_timedreceive/Makefile
index 0f7c7cf7e..7b9304212 100644
--- a/testcases/kernel/syscalls/mq_timedreceive/Makefile
+++ b/testcases/kernel/syscalls/mq_timedreceive/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
index be437e19a..1be515ced 100644
--- a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
+++ b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Crackerjack Project., 2007-2008, Hitachi, Ltd
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
@@ -7,6 +6,19 @@
* Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
* Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
* Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
@@ -16,8 +28,7 @@ static int fd, fd_root, fd_nonblock, fd_maxint = INT_MAX - 1, fd_invalid = -1;
#include "mq_timed.h"
-static struct tst_ts ts;
-static void *bad_addr;
+static struct timespec ts;
static struct test_case tcase[] = {
{
@@ -84,27 +95,21 @@ static struct test_case tcase[] = {
{
.fd = &fd,
.len = 16,
- .tv_sec = -1,
- .tv_nsec = 0,
- .rq = &ts,
+ .rq = &(struct timespec) {.tv_sec = -1, .tv_nsec = 0},
.ret = -1,
.err = EINVAL,
},
{
.fd = &fd,
.len = 16,
- .tv_sec = 0,
- .tv_nsec = -1,
- .rq = &ts,
+ .rq = &(struct timespec) {.tv_sec = 0, .tv_nsec = -1},
.ret = -1,
.err = EINVAL,
},
{
.fd = &fd,
.len = 16,
- .tv_sec = 0,
- .tv_nsec = 1000000000,
- .rq = &ts,
+ .rq = &(struct timespec) {.tv_sec = 0, .tv_nsec = 1000000000},
.ret = -1,
.err = EINVAL,
},
@@ -124,63 +129,30 @@ static struct test_case tcase[] = {
.ret = -1,
.err = EINTR,
},
- {
- .fd = &fd,
- .len = 16,
- .bad_ts_addr = 1,
- .ret = -1,
- .err = EFAULT,
- }
};
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- ts.type = tv->ts_type;
-
- bad_addr = tst_get_bad_addr(NULL);
-
- setup_common();
-}
-
static void do_test(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
const struct test_case *tc = &tcase[i];
unsigned int j;
unsigned int prio;
size_t len = MAX_MSGSIZE;
char rmsg[len];
pid_t pid = -1;
- void *abs_timeout;
-
- tst_ts_set_sec(&ts, tc->tv_sec);
- tst_ts_set_nsec(&ts, tc->tv_nsec);
if (tc->signal)
- pid = set_sig(tc->rq, tv->clock_gettime);
+ pid = set_sig(tc->rq);
if (tc->timeout)
- set_timeout(tc->rq, tv->clock_gettime);
+ set_timeout(tc->rq);
- if (tc->send) {
- if (tv->mqt_send(*tc->fd, smsg, tc->len, tc->prio, NULL) < 0) {
- tst_res(TFAIL | TTERRNO, "mq_timedsend() failed");
- return;
- }
- }
+ if (tc->send)
+ send_msg(*tc->fd, tc->len, tc->prio);
if (tc->invalid_msg)
len -= 1;
- if (tc->bad_ts_addr)
- abs_timeout = bad_addr;
- else
- abs_timeout = tst_ts_get(tc->rq);
-
- TEST(tv->mqt_receive(*tc->fd, rmsg, len, &prio, abs_timeout));
+ TEST(mq_timedreceive(*tc->fd, rmsg, len, &prio, tc->rq));
if (pid > 0)
kill_pid(pid);
@@ -191,22 +163,22 @@ static void do_test(unsigned int i)
if (TST_RET < 0) {
if (tc->err != TST_ERR)
tst_res(TFAIL | TTERRNO,
- "mq_timedreceive() failed unexpectedly, expected %s",
+ "mq_timedreceive failed unexpectedly, expected %s",
tst_strerrno(tc->err));
else
- tst_res(TPASS | TTERRNO, "mq_timedreceive() failed expectedly");
+ tst_res(TPASS | TTERRNO, "mq_timedreceive failed expectedly");
return;
}
if (tc->len != TST_RET) {
- tst_res(TFAIL, "mq_timedreceive() wrong length %ld, expected %u",
+ tst_res(TFAIL, "mq_timedreceive wrong length %ld, expected %zu",
TST_RET, tc->len);
return;
}
if (tc->prio != prio) {
- tst_res(TFAIL, "mq_timedreceive() wrong prio %d, expected %d",
+ tst_res(TFAIL, "mq_timedreceive wrong prio %d, expected %d",
prio, tc->prio);
return;
}
@@ -214,21 +186,20 @@ static void do_test(unsigned int i)
for (j = 0; j < tc->len; j++) {
if (rmsg[j] != smsg[j]) {
tst_res(TFAIL,
- "mq_timedreceive() wrong data %d in %u, expected %d",
+ "mq_timedreceive wrong data %d in %u, expected %d",
rmsg[j], i, smsg[j]);
return;
}
}
- tst_res(TPASS, "mq_timedreceive() returned %ld, priority %u, length: %zu",
+ tst_res(TPASS, "mq_timedreceive returned %ld, priority %u, length: %zu",
TST_RET, prio, len);
}
static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcase),
.test = do_test,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
+ .setup = setup_common,
.cleanup = cleanup_common,
.forks_child = 1,
};
diff --git a/testcases/kernel/syscalls/mq_timedsend/Makefile b/testcases/kernel/syscalls/mq_timedsend/Makefile
index 0f7c7cf7e..7b9304212 100644
--- a/testcases/kernel/syscalls/mq_timedsend/Makefile
+++ b/testcases/kernel/syscalls/mq_timedsend/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c b/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
index 334131402..8f209d396 100644
--- a/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
+++ b/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Crackerjack Project., 2007-2008, Hitachi, Ltd
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
@@ -7,18 +6,29 @@
* Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
* Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
* Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <limits.h>
static int fd, fd_root, fd_nonblock, fd_maxint = INT_MAX - 1, fd_invalid = -1;
+static struct timespec ts;
#include "mq_timed.h"
-static struct tst_ts ts;
-static void *bad_addr;
-
static struct test_case tcase[] = {
{
.fd = &fd,
@@ -85,9 +95,7 @@ static struct test_case tcase[] = {
{
.fd = &fd,
.len = 16,
- .tv_sec = -1,
- .tv_nsec = 0,
- .rq = &ts,
+ .rq = &(struct timespec) {.tv_sec = -1, .tv_nsec = 0},
.send = 1,
.ret = -1,
.err = EINVAL,
@@ -95,9 +103,7 @@ static struct test_case tcase[] = {
{
.fd = &fd,
.len = 16,
- .tv_sec = 0,
- .tv_nsec = -1,
- .rq = &ts,
+ .rq = &(struct timespec) {.tv_sec = 0, .tv_nsec = -1},
.send = 1,
.ret = -1,
.err = EINVAL,
@@ -105,9 +111,7 @@ static struct test_case tcase[] = {
{
.fd = &fd,
.len = 16,
- .tv_sec = 0,
- .tv_nsec = 1000000000,
- .rq = &ts,
+ .rq = &(struct timespec) {.tv_sec = 0, .tv_nsec = 1000000000},
.send = 1,
.ret = -1,
.err = EINVAL,
@@ -130,73 +134,29 @@ static struct test_case tcase[] = {
.ret = -1,
.err = EINTR,
},
- {
- .fd = &fd,
- .len = 16,
- .bad_msg_addr = 1,
- .ret = -1,
- .err = EFAULT,
- },
- {
- .fd = &fd,
- .len = 16,
- .bad_ts_addr = 1,
- .ret = -1,
- .err = EFAULT,
- }
};
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- ts.type = tv->ts_type;
-
- bad_addr = tst_get_bad_addr(cleanup_common);
-
- setup_common();
-}
-
static void do_test(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
const struct test_case *tc = &tcase[i];
unsigned int j;
unsigned int prio;
size_t len = MAX_MSGSIZE;
char rmsg[len];
pid_t pid = -1;
- void *msg_ptr, *abs_timeout;
-
- tst_ts_set_sec(&ts, tc->tv_sec);
- tst_ts_set_nsec(&ts, tc->tv_nsec);
if (tc->signal)
- pid = set_sig(tc->rq, tv->clock_gettime);
+ pid = set_sig(tc->rq);
if (tc->timeout)
- set_timeout(tc->rq, tv->clock_gettime);
+ set_timeout(tc->rq);
if (tc->send) {
for (j = 0; j < MSG_LENGTH; j++)
- if (tv->mqt_send(*tc->fd, smsg, tc->len, tc->prio, NULL) < 0) {
- tst_res(TFAIL | TTERRNO, "mq_timedsend() failed");
- return;
- }
+ send_msg(*tc->fd, tc->len, tc->prio);
}
- if (tc->bad_msg_addr)
- msg_ptr = bad_addr;
- else
- msg_ptr = smsg;
-
- if (tc->bad_ts_addr)
- abs_timeout = bad_addr;
- else
- abs_timeout = tst_ts_get(tc->rq);
-
- TEST(tv->mqt_send(*tc->fd, msg_ptr, tc->len, tc->prio, abs_timeout));
+ TEST(mq_timedsend(*tc->fd, smsg, tc->len, tc->prio, tc->rq));
if (pid > 0)
kill_pid(pid);
@@ -204,10 +164,10 @@ static void do_test(unsigned int i)
if (TST_RET < 0) {
if (tc->err != TST_ERR)
tst_res(TFAIL | TTERRNO,
- "mq_timedsend() failed unexpectedly, expected %s",
+ "mq_timedsend failed unexpectedly, expected %s",
tst_strerrno(tc->err));
else
- tst_res(TPASS | TTERRNO, "mq_timedsend() failed expectedly");
+ tst_res(TPASS | TTERRNO, "mq_timedreceive failed expectedly");
if (*tc->fd == fd)
cleanup_queue(fd);
@@ -215,7 +175,7 @@ static void do_test(unsigned int i)
return;
}
- TEST(tv->mqt_receive(*tc->fd, rmsg, len, &prio, tst_ts_get(tc->rq)));
+ TEST(mq_timedreceive(*tc->fd, rmsg, len, &prio, tc->rq));
if (*tc->fd == fd)
cleanup_queue(fd);
@@ -223,26 +183,26 @@ static void do_test(unsigned int i)
if (TST_RET < 0) {
if (tc->err != TST_ERR) {
tst_res(TFAIL | TTERRNO,
- "mq_timedreceive() failed unexpectedly, expected %s",
+ "mq_timedreceive failed unexpectedly, expected %s",
tst_strerrno(tc->err));
return;
}
if (tc->ret >= 0) {
- tst_res(TFAIL | TTERRNO, "mq_timedreceive() returned %ld, expected %d",
+ tst_res(TFAIL | TTERRNO, "mq_timedreceive returned %ld, expected %d",
TST_RET, tc->ret);
return;
}
}
if (tc->len != TST_RET) {
- tst_res(TFAIL, "mq_timedreceive() wrong length %ld, expected %u",
+ tst_res(TFAIL, "mq_timedreceive wrong length %ld, expected %d",
TST_RET, tc->len);
return;
}
if (tc->prio != prio) {
- tst_res(TFAIL, "mq_timedreceive() wrong prio %d, expected %d",
+ tst_res(TFAIL, "mq_timedreceive wrong prio %d, expected %d",
prio, tc->prio);
return;
}
@@ -250,21 +210,20 @@ static void do_test(unsigned int i)
for (j = 0; j < tc->len; j++) {
if (rmsg[j] != smsg[j]) {
tst_res(TFAIL,
- "mq_timedreceive() wrong data %d in %u, expected %d",
+ "mq_timedreceive wrong data %d in %u, expected %d",
rmsg[j], i, smsg[j]);
return;
}
}
- tst_res(TPASS, "mq_timedreceive() returned %ld, priority %u, length: %zu",
+ tst_res(TPASS, "mq_timedreceive returned %ld, priority %u, length: %zu",
TST_RET, prio, len);
}
static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcase),
.test = do_test,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
+ .setup = setup_common,
.cleanup = cleanup_common,
.forks_child = 1,
};
diff --git a/testcases/kernel/syscalls/mq_unlink/Makefile b/testcases/kernel/syscalls/mq_unlink/Makefile
index 262eef71b..71ebae98b 100644
--- a/testcases/kernel/syscalls/mq_unlink/Makefile
+++ b/testcases/kernel/syscalls/mq_unlink/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c b/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
index baca57948..af79d9571 100644
--- a/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
+++ b/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
@@ -85,7 +85,7 @@ static void do_test(unsigned int i)
fd = SAFE_MQ_OPEN(QUEUE_NAME, O_CREAT | O_EXCL | O_RDWR, S_IRWXU, NULL);
if (tc->as_nobody && seteuid(pw->pw_uid)) {
- tst_res(TFAIL | TERRNO, "seteuid failed");
+ tst_res(TBROK | TERRNO, "seteuid failed");
goto EXIT;
}
diff --git a/testcases/kernel/syscalls/mremap/Makefile b/testcases/kernel/syscalls/mremap/Makefile
index 190b7659d..102e473ee 100644
--- a/testcases/kernel/syscalls/mremap/Makefile
+++ b/testcases/kernel/syscalls/mremap/Makefile
@@ -1,12 +1,41 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpipc
-
include $(top_srcdir)/include/mk/testcases.mk
-mremap04: LTPLDLIBS = -lltpipc
+LDLIBS += -lipc
+
+LIBDIR := ../ipc/lib
+
+LIB := $(LIBDIR)/libipc.a
+
+$(LIBDIR):
+ mkdir -p "$@"
+
+$(LIB): $(LIBDIR)
+ $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS := $(LIB)
+
+CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR)
+
+LDFLAGS += -L$(abs_builddir)/$(LIBDIR)
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/msync/Makefile b/testcases/kernel/syscalls/msync/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/msync/Makefile
+++ b/testcases/kernel/syscalls/msync/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/msync/msync01.c b/testcases/kernel/syscalls/msync/msync01.c
index 3a5a48ee5..565d5fe7c 100644
--- a/testcases/kernel/syscalls/msync/msync01.c
+++ b/testcases/kernel/syscalls/msync/msync01.c
@@ -103,7 +103,7 @@ int main(int ac, char **av)
TEST(msync(addr, page_sz, MS_ASYNC));
if (TEST_RETURN == -1) {
- tst_resm(TFAIL | TTERRNO, "msync failed");
+ tst_resm(TFAIL | TERRNO, "msync failed");
continue;
}
@@ -153,13 +153,14 @@ int main(int ac, char **av)
*/
void setup(void)
{
- size_t c_total = 0, nwrite = 0; /* no. of bytes to be written */
+ int c_total = 0, nwrite = 0; /* no. of bytes to be written */
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
- page_sz = (size_t)getpagesize();
+ if ((page_sz = getpagesize()) == -1)
+ tst_brkm(TBROK | TERRNO, NULL, "getpagesize failed");
tst_tmpdir();
diff --git a/testcases/kernel/syscalls/msync/msync02.c b/testcases/kernel/syscalls/msync/msync02.c
index 11ed29e3b..243ceb06e 100644
--- a/testcases/kernel/syscalls/msync/msync02.c
+++ b/testcases/kernel/syscalls/msync/msync02.c
@@ -106,14 +106,15 @@ int main(int ac, char **av)
void setup(void)
{
- size_t c_total = 0, nwrite = 0; /* no. of bytes to be written */
+ int c_total = 0, nwrite = 0; /* no. of bytes to be written */
char tst_buf[BUF_SIZE];
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
- page_sz = (size_t)getpagesize();
+ if ((page_sz = getpagesize()) == -1)
+ tst_brkm(TBROK | TERRNO, NULL, "getpagesize failed");
tst_tmpdir();
@@ -139,7 +140,7 @@ void setup(void)
tst_brkm(TBROK | TERRNO, cleanup, "lseek failed");
/* Write the string in write_buf at the 100 byte offset */
- if (write(fildes, write_buf, strlen(write_buf)) != (long)strlen(write_buf))
+ if (write(fildes, write_buf, strlen(write_buf)) != strlen(write_buf))
tst_brkm(TBROK | TERRNO, cleanup, "write failed");
}
diff --git a/testcases/kernel/syscalls/msync/msync04.c b/testcases/kernel/syscalls/msync/msync04.c
index 4a564a3d1..dad07b264 100644
--- a/testcases/kernel/syscalls/msync/msync04.c
+++ b/testcases/kernel/syscalls/msync/msync04.c
@@ -47,8 +47,7 @@ static void test_msync(void)
{
uint64_t dirty;
- test_fd = SAFE_OPEN("msync04/testfile", O_CREAT | O_TRUNC | O_RDWR,
- 0644);
+ test_fd = SAFE_OPEN("msync04/testfile", O_CREAT | O_TRUNC | O_RDWR);
SAFE_WRITE(0, test_fd, STRING_TO_WRITE, sizeof(STRING_TO_WRITE) - 1);
mmaped_area = SAFE_MMAP(NULL, pagesize, PROT_READ | PROT_WRITE,
MAP_SHARED, test_fd, 0);
@@ -98,9 +97,5 @@ static struct tst_test test = {
.mntpoint = "msync04",
.mount_device = 1,
.all_filesystems = 1,
- .skip_filesystems = (const char *[]) {
- "tmpfs",
- NULL
- },
.min_kver = "2.6.25",
};
diff --git a/testcases/kernel/syscalls/munlock/Makefile b/testcases/kernel/syscalls/munlock/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/munlock/Makefile
+++ b/testcases/kernel/syscalls/munlock/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/munlockall/Makefile b/testcases/kernel/syscalls/munlockall/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/munlockall/Makefile
+++ b/testcases/kernel/syscalls/munlockall/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/munmap/Makefile b/testcases/kernel/syscalls/munmap/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/munmap/Makefile
+++ b/testcases/kernel/syscalls/munmap/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/name_to_handle_at/.gitignore b/testcases/kernel/syscalls/name_to_handle_at/.gitignore
deleted file mode 100644
index 268a8a34f..000000000
--- a/testcases/kernel/syscalls/name_to_handle_at/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-name_to_handle_at01
-name_to_handle_at02
diff --git a/testcases/kernel/syscalls/name_to_handle_at/Makefile b/testcases/kernel/syscalls/name_to_handle_at/Makefile
deleted file mode 100644
index 18896b6f2..000000000
--- a/testcases/kernel/syscalls/name_to_handle_at/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c
deleted file mode 100644
index 9677b0671..000000000
--- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c
+++ /dev/null
@@ -1,116 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic name_to_handle_at() tests.
- *
- * [Algorithm]
- * - Check that EOVERFLOW is returned as expected by name_to_handle_at().
- * - Check that we were able to access a file's stat with name_to_handle_at()
- * and open_by_handle_at().
- */
-
-#define _GNU_SOURCE
-#include <sys/stat.h>
-#include "lapi/name_to_handle_at.h"
-
-#define TEST_FILE "test_file"
-#define TEST_DIR "test_dir"
-
-static int dir_fd, fd_atcwd = AT_FDCWD, file_fd;
-static struct file_handle *fhp;
-
-static struct tcase {
- int *dfd;
- const char *pathname;
- int name_flags;
- int flags;
-} tcases[] = {
- {&dir_fd, TEST_FILE, 0, O_RDWR},
- {&dir_fd, TEST_FILE, 0, O_RDONLY},
- {&dir_fd, TEST_FILE, 0, O_WRONLY},
- {&dir_fd, TEST_FILE, AT_EMPTY_PATH, O_RDWR},
- {&dir_fd, TEST_FILE, AT_EMPTY_PATH, O_RDONLY},
- {&dir_fd, TEST_FILE, AT_EMPTY_PATH, O_WRONLY},
- {&dir_fd, TEST_FILE, AT_SYMLINK_FOLLOW, O_RDWR},
- {&dir_fd, TEST_FILE, AT_SYMLINK_FOLLOW, O_RDONLY},
- {&dir_fd, TEST_FILE, AT_SYMLINK_FOLLOW, O_WRONLY},
- {&dir_fd, TEST_FILE, AT_EMPTY_PATH | AT_SYMLINK_FOLLOW, O_RDWR},
- {&dir_fd, TEST_FILE, AT_EMPTY_PATH | AT_SYMLINK_FOLLOW, O_RDONLY},
- {&dir_fd, TEST_FILE, AT_EMPTY_PATH | AT_SYMLINK_FOLLOW, O_WRONLY},
- {&dir_fd, "", AT_EMPTY_PATH, O_RDONLY},
- {&file_fd, "", AT_EMPTY_PATH, O_RDONLY},
-
- {&fd_atcwd, TEST_FILE, 0, O_RDWR},
- {&fd_atcwd, TEST_FILE, 0, O_RDONLY},
- {&fd_atcwd, TEST_FILE, 0, O_WRONLY},
- {&fd_atcwd, TEST_FILE, AT_EMPTY_PATH, O_RDWR},
- {&fd_atcwd, TEST_FILE, AT_EMPTY_PATH, O_RDONLY},
- {&fd_atcwd, TEST_FILE, AT_EMPTY_PATH, O_WRONLY},
- {&fd_atcwd, TEST_FILE, AT_SYMLINK_FOLLOW, O_RDWR},
- {&fd_atcwd, TEST_FILE, AT_SYMLINK_FOLLOW, O_RDONLY},
- {&fd_atcwd, TEST_FILE, AT_SYMLINK_FOLLOW, O_WRONLY},
- {&fd_atcwd, TEST_FILE, AT_EMPTY_PATH | AT_SYMLINK_FOLLOW, O_RDWR},
- {&fd_atcwd, TEST_FILE, AT_EMPTY_PATH | AT_SYMLINK_FOLLOW, O_RDONLY},
- {&fd_atcwd, TEST_FILE, AT_EMPTY_PATH | AT_SYMLINK_FOLLOW, O_WRONLY},
- {&fd_atcwd, "", AT_EMPTY_PATH, O_RDONLY},
-};
-
-static void cleanup(void)
-{
- SAFE_CLOSE(dir_fd);
- SAFE_CLOSE(file_fd);
-}
-
-static void setup(void)
-{
- SAFE_MKDIR(TEST_DIR, 0700);
- dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
- SAFE_CHDIR(TEST_DIR);
- SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
- fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- struct stat file_stat;
- int fd, mount_id;
-
- TEST(name_to_handle_at(*tc->dfd, tc->pathname, fhp, &mount_id,
- tc->name_flags));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "name_to_handle_at() failed (%d)", n);
- return;
- }
-
- TEST(fd = open_by_handle_at(*tc->dfd, fhp, tc->flags));
- if (fd < 0) {
- tst_res(TFAIL | TTERRNO, "open_by_handle_at() failed (%d)", n);
- return;
- }
-
- SAFE_FSTAT(fd, &file_stat);
-
- /* Don't check stats when pathname is empty */
- if (file_stat.st_size == 0 || !tc->pathname[0])
- tst_res(TPASS, "name_to_handle_at() passed (%d)", n);
- else
- tst_res(TFAIL, "fstat() didn't work as expected (%d)", n);
-
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c
deleted file mode 100644
index afd9cd066..000000000
--- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at02.c
+++ /dev/null
@@ -1,84 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Failure tests for name_to_handle_at().
- */
-
-#define _GNU_SOURCE
-#include "lapi/name_to_handle_at.h"
-
-#define TEST_FILE "test_file"
-
-static struct file_handle fh, high_fh = {.handle_bytes = MAX_HANDLE_SZ + 1};
-static struct file_handle *valid_fhp = &fh, *invalid_fhp, *high_fhp = &high_fh;
-static int mount_id, *valid_mount_id = &mount_id, *invalid_mount_id;
-static const char *valid_path = TEST_FILE, *invalid_path, *empty_path = "";
-
-static struct tcase {
- const char *name;
- int dfd;
- const char **pathname;
- int flags;
- struct file_handle **fhp;
- int **mount_id;
- int exp_errno;
-} tcases[] = {
- {"invalid-dfd", -1, &valid_path, 0, &valid_fhp, &valid_mount_id, EBADF},
- {"not a directory", 0, &valid_path, 0, &valid_fhp, &valid_mount_id, ENOTDIR},
- {"invalid-path", AT_FDCWD, &invalid_path, 0, &valid_fhp, &valid_mount_id, EFAULT},
- {"invalid-file-handle", AT_FDCWD, &valid_path, 0, &invalid_fhp, &valid_mount_id, EFAULT},
- {"zero-file-handle-size", AT_FDCWD, &valid_path, 0, &valid_fhp, &valid_mount_id, EOVERFLOW},
- {"high-file-handle-size", AT_FDCWD, &valid_path, 0, &high_fhp, &valid_mount_id, EINVAL},
- {"invalid-mount_id", AT_FDCWD, &valid_path, 0, &valid_fhp, &invalid_mount_id, EFAULT},
- {"invalid-flags", AT_FDCWD, &valid_path, -1, &valid_fhp, &valid_mount_id, EINVAL},
- {"empty-path", AT_FDCWD, &empty_path, 0, &valid_fhp, &valid_mount_id, ENOENT},
-};
-
-static void setup(void)
-{
- void *faulty_address;
-
- SAFE_TOUCH(TEST_FILE, 0600, NULL);
- faulty_address = tst_get_bad_addr(NULL);
- invalid_fhp = faulty_address;
- invalid_mount_id = faulty_address;
- invalid_path = faulty_address;
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- memset(&fh, 0, sizeof(fh));
-
- TEST(name_to_handle_at(tc->dfd, *tc->pathname, *tc->fhp, *tc->mount_id,
- tc->flags));
-
- if (TST_RET != -1) {
- tst_res(TFAIL, "%s: name_to_handle_at() passed unexpectedly",
- tc->name);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO,
- "%s: name_to_handle_at() should fail with %s", tc->name,
- tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: name_to_handle_at() failed as expected",
- tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_tmpdir = 1,
-};
diff --git a/testcases/kernel/syscalls/nanosleep/Makefile b/testcases/kernel/syscalls/nanosleep/Makefile
index 48006f7b8..a425d1c17 100644
--- a/testcases/kernel/syscalls/nanosleep/Makefile
+++ b/testcases/kernel/syscalls/nanosleep/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep01.c b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
index eaacb89fa..567be8c10 100644
--- a/testcases/kernel/syscalls/nanosleep/nanosleep01.c
+++ b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
@@ -16,7 +16,7 @@
int sample_fn(int clk_id, long long usec)
{
- struct timespec t = tst_timespec_from_us(usec);
+ struct timespec t = tst_us_to_timespec(usec);
tst_timer_start(clk_id);
TEST(nanosleep(&t, NULL));
@@ -24,7 +24,7 @@ int sample_fn(int clk_id, long long usec)
tst_timer_sample();
if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TFAIL | TERRNO,
"nanosleep() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/newuname/Makefile b/testcases/kernel/syscalls/newuname/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/newuname/Makefile
+++ b/testcases/kernel/syscalls/newuname/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/nftw/Makefile b/testcases/kernel/syscalls/nftw/Makefile
index 04e2c43cb..9cb5a81da 100644
--- a/testcases/kernel/syscalls/nftw/Makefile
+++ b/testcases/kernel/syscalls/nftw/Makefile
@@ -1,8 +1,22 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# testcases/kernel/syscalls Makefile.
#
# Copyright (C) 2009, Cisco Systems Inc.
#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, July 2009
#
diff --git a/testcases/kernel/syscalls/nice/Makefile b/testcases/kernel/syscalls/nice/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/nice/Makefile
+++ b/testcases/kernel/syscalls/nice/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/nice/nice01.c b/testcases/kernel/syscalls/nice/nice01.c
index aee5ea043..04ca17a1e 100644
--- a/testcases/kernel/syscalls/nice/nice01.c
+++ b/testcases/kernel/syscalls/nice/nice01.c
@@ -49,7 +49,7 @@ static void verify_nice(void)
TEST(nice(-NICEINC));
if (TST_ERR)
- tst_brk(TBROK | TTERRNO, "nice(-NICEINC) failed");
+ tst_brk(TBROK | TERRNO, "nice(-NICEINC) failed");
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/nice/nice02.c b/testcases/kernel/syscalls/nice/nice02.c
index 036301000..65c612265 100644
--- a/testcases/kernel/syscalls/nice/nice02.c
+++ b/testcases/kernel/syscalls/nice/nice02.c
@@ -47,7 +47,7 @@ static void verify_nice(void)
TEST(nice(DEFAULT_PRIO));
if (TST_ERR)
- tst_brk(TBROK | TTERRNO, "nice(-NICEINC) failed");
+ tst_brk(TBROK | TERRNO, "nice(-NICEINC) failed");
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/open/Makefile b/testcases/kernel/syscalls/open/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/open/Makefile
+++ b/testcases/kernel/syscalls/open/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/open/open01.c b/testcases/kernel/syscalls/open/open01.c
index baf73ab11..c689a4b9b 100644
--- a/testcases/kernel/syscalls/open/open01.c
+++ b/testcases/kernel/syscalls/open/open01.c
@@ -36,8 +36,8 @@ static struct tcase {
unsigned short tst_bit;
char *desc;
} tcases[] = {
- {TEST_FILE, O_RDWR | O_CREAT, 01444, S_ISVTX, "sticky bit"},
- {TEST_DIR, O_DIRECTORY, 0, S_IFDIR, "sirectory bit"}
+ {TEST_FILE, O_RDWR | O_CREAT, 01444, S_ISVTX, "Sticky bit"},
+ {TEST_DIR, O_DIRECTORY, 0, S_IFDIR, "Directory bit"}
};
static void verify_open(unsigned int n)
@@ -45,12 +45,12 @@ static void verify_open(unsigned int n)
struct tcase *tc = &tcases[n];
struct stat buf;
- TST_EXP_FD_SILENT(open(tc->filename, tc->flag, tc->mode),
- "open() with %s", tc->desc);
- if (!TST_PASS)
- return;
-
+ TEST(open(tc->filename, tc->flag, tc->mode));
fd = TST_RET;
+ if (fd == -1) {
+ tst_res(TFAIL, "Cannot open a file");
+ return;
+ }
SAFE_FSTAT(fd, &buf);
if (!(buf.st_mode & tc->tst_bit))
diff --git a/testcases/kernel/syscalls/open/open02.c b/testcases/kernel/syscalls/open/open02.c
index ca9839c2d..7195b1b6c 100644
--- a/testcases/kernel/syscalls/open/open02.c
+++ b/testcases/kernel/syscalls/open/open02.c
@@ -25,13 +25,12 @@
#define TEST_FILE2 "test_file2"
static struct tcase {
- const char *filename;
+ char *filename;
int flag;
int exp_errno;
- const char *desc;
} tcases[] = {
- {TEST_FILE, O_RDWR, ENOENT, "new file without O_CREAT"},
- {TEST_FILE2, O_RDONLY | O_NOATIME, EPERM, "unpriviledget O_RDONLY | O_NOATIME"},
+ {TEST_FILE, O_RDWR, ENOENT},
+ {TEST_FILE2, O_RDONLY | O_NOATIME, EPERM},
};
void setup(void)
@@ -49,8 +48,22 @@ static void verify_open(unsigned int n)
{
struct tcase *tc = &tcases[n];
- TST_EXP_FAIL(open(tc->filename, tc->flag, 0444),
- tc->exp_errno, "open() %s", tc->desc);
+ TEST(open(tc->filename, tc->flag, 0444));
+
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "open(%s) succeeded unexpectedly",
+ tc->filename);
+ return;
+ }
+
+ if (tc->exp_errno != TST_ERR) {
+ tst_res(TFAIL | TTERRNO,
+ "open() should fail with %s",
+ tst_strerrno(tc->exp_errno));
+ return;
+ }
+
+ tst_res(TPASS | TTERRNO, "open() failed as expected");
}
void cleanup(void)
diff --git a/testcases/kernel/syscalls/open/open05.c b/testcases/kernel/syscalls/open/open05.c
index f5098be2d..051aec3b3 100644
--- a/testcases/kernel/syscalls/open/open05.c
+++ b/testcases/kernel/syscalls/open/open05.c
@@ -103,10 +103,11 @@ int main(int ac, char **av)
tst_resm(TFAIL, "Failures reported above");
close(fd);
+ cleanup();
+
}
}
- cleanup();
tst_exit();
}
diff --git a/testcases/kernel/syscalls/open/open11.c b/testcases/kernel/syscalls/open/open11.c
index ded384fa8..cfd04fdcd 100644
--- a/testcases/kernel/syscalls/open/open11.c
+++ b/testcases/kernel/syscalls/open/open11.c
@@ -277,19 +277,21 @@ static struct test_case {
static void verify_open(unsigned int n)
{
- if (tc[n].err > 0) {
- TST_EXP_FAIL(open(tc[n].path, tc[n].flags, tc[n].mode),
- tc[n].err, "%s", tc[n].desc);
- } else if (tc[n].err == 0) {
- TST_EXP_FD(open(tc[n].path, tc[n].flags, tc[n].mode),
- "%s", tc[n].desc);
- } else {
- TEST(open(tc[n].path, tc[n].flags, tc[n].mode));
+ int fd;
+
+ TEST(open(tc[n].path, tc[n].flags, tc[n].mode));
+ fd = TST_RET;
+
+ if (fd > 0)
+ SAFE_CLOSE(fd);
+
+ if (tc[n].err == -1 || TST_ERR == tc[n].err) {
tst_res(TPASS, "%s", tc[n].desc);
+ return;
}
- if (TST_RET > 0)
- SAFE_CLOSE(TST_RET);
+ tst_res(TFAIL | TTERRNO, "%s - expected %s",
+ tc[n].desc, tst_strerrno(tc[n].err));
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/open_by_handle_at/.gitignore b/testcases/kernel/syscalls/open_by_handle_at/.gitignore
deleted file mode 100644
index 799eba82a..000000000
--- a/testcases/kernel/syscalls/open_by_handle_at/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-open_by_handle_at01
-open_by_handle_at02
diff --git a/testcases/kernel/syscalls/open_by_handle_at/Makefile b/testcases/kernel/syscalls/open_by_handle_at/Makefile
deleted file mode 100644
index 18896b6f2..000000000
--- a/testcases/kernel/syscalls/open_by_handle_at/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c
deleted file mode 100644
index 76be720ca..000000000
--- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Basic open_by_handle_at() tests.
- *
- * [Algorithm]
- *
- * Check that we were able to access a file's stat which is opened with
- * open_by_handle_at().
- */
-
-#define _GNU_SOURCE
-#include <sys/stat.h>
-#include "lapi/name_to_handle_at.h"
-
-#define TEST_FILE "test_file"
-#define TEST_DIR "test_dir"
-
-static int dir_fd, fd_atcwd = AT_FDCWD, file_fd;
-static struct file_handle *f_fhp, *d_fhp, *at_fhp;
-static struct file_handle *f_fhp, *d_fhp, *at_fhp;
-
-static struct tcase {
- int *dfd;
- struct file_handle **fhp;
- int flags;
-} tcases[] = {
- {&dir_fd, &d_fhp, O_RDWR},
- {&dir_fd, &d_fhp, O_RDONLY},
- {&dir_fd, &d_fhp, O_WRONLY},
- {&file_fd, &f_fhp, O_RDWR},
- {&file_fd, &f_fhp, O_RDONLY},
- {&file_fd, &f_fhp, O_WRONLY},
- {&fd_atcwd, &at_fhp, O_RDWR},
- {&fd_atcwd, &at_fhp, O_RDONLY},
- {&fd_atcwd, &at_fhp, O_WRONLY},
-};
-
-static void cleanup(void)
-{
- SAFE_CLOSE(dir_fd);
- SAFE_CLOSE(file_fd);
-}
-
-static void setup(void)
-{
- int mount_id;
-
- SAFE_MKDIR(TEST_DIR, 0700);
- dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
- SAFE_CHDIR(TEST_DIR);
- SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
-
- f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
- d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
- at_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
-
- TEST(name_to_handle_at(file_fd, "", f_fhp, &mount_id, AT_EMPTY_PATH));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "name_to_handle_at() failed");
- return;
- }
-
- TEST(name_to_handle_at(dir_fd, TEST_FILE, d_fhp, &mount_id,
- AT_EMPTY_PATH | AT_SYMLINK_FOLLOW));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "name_to_handle_at() failed");
- return;
- }
-
- TEST(name_to_handle_at(AT_FDCWD, TEST_FILE, at_fhp, &mount_id,
- AT_EMPTY_PATH | AT_SYMLINK_FOLLOW));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "name_to_handle_at() failed");
- return;
- }
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- struct stat file_stat;
- int fd;
-
- TEST(fd = open_by_handle_at(*tc->dfd, *tc->fhp, tc->flags));
- if (fd < 0) {
- tst_res(TFAIL | TTERRNO, "open_by_handle_at() failed (%d)", n);
- return;
- }
-
- SAFE_FSTAT(fd, &file_stat);
-
- /* Don't check stats when pathname is empty */
- if (file_stat.st_size == 0 || (tc->fhp == &f_fhp))
- tst_res(TPASS, "open_by_handle_at() passed (%d)", n);
- else
- tst_res(TFAIL, "fstat() didn't work as expected (%d)", n);
-
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c
deleted file mode 100644
index a505deeb1..000000000
--- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c
+++ /dev/null
@@ -1,108 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
- *
- * Failure tests for open_by_handle_at().
- */
-#define _GNU_SOURCE
-#include <linux/capability.h>
-#include "tst_capability.h"
-#include "lapi/name_to_handle_at.h"
-
-#define TEST_FILE "test_file"
-#define FOO_SYMLINK "foo_symlink"
-
-static struct file_handle high_fh = {.handle_bytes = MAX_HANDLE_SZ + 1}, *high_fhp = &high_fh;
-static struct file_handle zero_fh, *zero_fhp = &zero_fh;
-static struct file_handle *valid_fhp, *invalid_fhp, *link_fhp;
-
-static struct tst_cap cap_req = TST_CAP(TST_CAP_REQ, CAP_DAC_READ_SEARCH);
-static struct tst_cap cap_drop = TST_CAP(TST_CAP_DROP, CAP_DAC_READ_SEARCH);
-
-static struct tcase {
- const char *name;
- int dfd;
- struct file_handle **fhp;
- int flags;
- int cap;
- int exp_errno;
-} tcases[] = {
- {"invalid-dfd", -1, &valid_fhp, O_RDWR, 0, EBADF},
- {"stale-dfd", 0, &valid_fhp, O_RDWR, 0, ESTALE},
- {"invalid-file-handle", AT_FDCWD, &invalid_fhp, O_RDWR, 0, EFAULT},
- {"high-file-handle-size", AT_FDCWD, &high_fhp, O_RDWR, 0, EINVAL},
- {"zero-file-handle-size", AT_FDCWD, &zero_fhp, O_RDWR, 0, EINVAL},
- {"no-capability", AT_FDCWD, &valid_fhp, O_RDWR, 1, EPERM},
- {"symlink", AT_FDCWD, &link_fhp, O_RDWR, 0, ELOOP},
-};
-
-static void setup(void)
-{
- void *faulty_address;
- int mount_id;
-
- SAFE_TOUCH(TEST_FILE, 0600, NULL);
- SAFE_SYMLINK(TEST_FILE, FOO_SYMLINK);
- faulty_address = tst_get_bad_addr(NULL);
- invalid_fhp = faulty_address;
-
- valid_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
- if (!valid_fhp)
- return;
-
- TEST(name_to_handle_at(AT_FDCWD, TEST_FILE, valid_fhp, &mount_id, 0));
- if (TST_RET)
- tst_res(TFAIL | TTERRNO, "name_to_handle_at() failed");
-
- /* Symlink's file handle */
- link_fhp = tst_alloc(sizeof(*link_fhp) + valid_fhp->handle_bytes);
- link_fhp->handle_type = valid_fhp->handle_type;
- link_fhp->handle_bytes = valid_fhp->handle_bytes;
-
- TEST(name_to_handle_at(AT_FDCWD, FOO_SYMLINK, link_fhp, &mount_id, 0));
- if (TST_RET)
- tst_res(TFAIL | TTERRNO, "name_to_handle_at() failed");
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int fd;
-
- if (tc->cap)
- tst_cap_action(&cap_drop);
-
- TEST(fd = open_by_handle_at(tc->dfd, *tc->fhp, tc->flags));
-
- if (tc->cap)
- tst_cap_action(&cap_req);
-
- if (TST_RET != -1) {
- SAFE_CLOSE(fd);
- tst_res(TFAIL, "%s: open_by_handle_at() passed unexpectedly",
- tc->name);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO,
- "%s: open_by_handle_at() should fail with %s", tc->name,
- tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: open_by_handle_at() failed as expected",
- tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_tmpdir = 1,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/open_tree/.gitignore b/testcases/kernel/syscalls/open_tree/.gitignore
deleted file mode 100644
index 2f732b445..000000000
--- a/testcases/kernel/syscalls/open_tree/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/open_tree01
-/open_tree02
diff --git a/testcases/kernel/syscalls/open_tree/Makefile b/testcases/kernel/syscalls/open_tree/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/syscalls/open_tree/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/open_tree/open_tree01.c b/testcases/kernel/syscalls/open_tree/open_tree01.c
deleted file mode 100644
index 808d25665..000000000
--- a/testcases/kernel/syscalls/open_tree/open_tree01.c
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic open_tree() test.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-#define OT_MNTPOINT "ot_mntpoint"
-
-#define TCASE_ENTRY(_flags) {.name = "Flag " #_flags, .flags = _flags}
-
-static struct tcase {
- char *name;
- unsigned int flags;
-} tcases[] = {
- TCASE_ENTRY(OPEN_TREE_CLONE),
- TCASE_ENTRY(OPEN_TREE_CLOEXEC)
-};
-
-static int dir_created;
-
-static void cleanup(void)
-{
- if (dir_created)
- SAFE_RMDIR(OT_MNTPOINT);
-}
-
-static void setup(void)
-{
- fsopen_supported_by_kernel();
- SAFE_MKDIR(OT_MNTPOINT, 0777);
- dir_created = 1;
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int otfd;
-
- TEST(otfd = open_tree(AT_FDCWD, MNTPOINT, tc->flags | OPEN_TREE_CLONE));
- if (otfd == -1) {
- tst_res(TFAIL | TTERRNO, "open_tree() failed");
- return;
- }
-
- TEST(move_mount(otfd, "", AT_FDCWD, OT_MNTPOINT,
- MOVE_MOUNT_F_EMPTY_PATH));
- SAFE_CLOSE(otfd);
-
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "move_mount() failed");
- return;
- }
-
- if (tst_is_mounted_at_tmpdir(OT_MNTPOINT)) {
- SAFE_UMOUNT(OT_MNTPOINT);
- tst_res(TPASS, "%s: open_tree() passed", tc->name);
- }
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/open_tree/open_tree02.c b/testcases/kernel/syscalls/open_tree/open_tree02.c
deleted file mode 100644
index ddaa204f2..000000000
--- a/testcases/kernel/syscalls/open_tree/open_tree02.c
+++ /dev/null
@@ -1,55 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic open_tree() failure tests.
- */
-#include "tst_test.h"
-#include "lapi/fsmount.h"
-
-#define MNTPOINT "mntpoint"
-
-static struct tcase {
- char *name;
- int dirfd;
- const char *pathname;
- unsigned int flags;
- int exp_errno;
-} tcases[] = {
- {"invalid-fd", -1, MNTPOINT, OPEN_TREE_CLONE, EBADF},
- {"invalid-path", AT_FDCWD, "invalid", OPEN_TREE_CLONE, ENOENT},
- {"invalid-flags", AT_FDCWD, MNTPOINT, 0xFFFFFFFF, EINVAL},
-};
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- TEST(open_tree(tc->dirfd, tc->pathname, tc->flags));
- if (TST_RET != -1) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: open_tree() succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: open_tree() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: open_tree() failed as expected",
- tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = fsopen_supported_by_kernel,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
-};
diff --git a/testcases/kernel/syscalls/openat/Makefile b/testcases/kernel/syscalls/openat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/openat/Makefile
+++ b/testcases/kernel/syscalls/openat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/openat2/.gitignore b/testcases/kernel/syscalls/openat2/.gitignore
deleted file mode 100644
index 5a0843a85..000000000
--- a/testcases/kernel/syscalls/openat2/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-openat201
-openat202
-openat203
diff --git a/testcases/kernel/syscalls/openat2/Makefile b/testcases/kernel/syscalls/openat2/Makefile
deleted file mode 100644
index 18896b6f2..000000000
--- a/testcases/kernel/syscalls/openat2/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/openat2/openat201.c b/testcases/kernel/syscalls/openat2/openat201.c
deleted file mode 100644
index ecd63b150..000000000
--- a/testcases/kernel/syscalls/openat2/openat201.c
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic openat2() test.
- */
-#include "tst_test.h"
-#include "lapi/openat2.h"
-
-#define TEST_FILE "test_file"
-#define TEST_DIR "test_dir"
-
-static struct open_how *how;
-static struct open_how_pad *phow;
-
-static int dir_fd = -1, fd_atcwd = AT_FDCWD;
-
-static struct tcase {
- int *dfd;
- const char *pathname;
- uint64_t flags;
- uint64_t mode;
- uint64_t resolve;
- struct open_how **how;
- size_t size;
-} tcases[] = {
- {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, 0, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_RDONLY, S_IRUSR, 0, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_WRONLY, S_IWUSR, 0, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_XDEV, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_MAGICLINKS, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_SYMLINKS, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_BENEATH, &how, sizeof(*how)},
- {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_IN_ROOT, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDWR, S_IRWXU, 0, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDONLY, S_IRUSR, 0, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_WRONLY, S_IWUSR, 0, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_XDEV, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_MAGICLINKS, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_SYMLINKS, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_BENEATH, &how, sizeof(*how)},
- {&fd_atcwd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_IN_ROOT, (struct open_how **)&phow, sizeof(*how) + 8},
-};
-
-static void cleanup(void)
-{
- if (dir_fd != -1)
- SAFE_CLOSE(dir_fd);
-}
-
-static void setup(void)
-{
- openat2_supported_by_kernel();
-
- phow->pad = 0x00;
- SAFE_MKDIR(TEST_DIR, 0700);
- dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
-}
-
-static void run(unsigned int n)
-{
- int fd;
- struct stat file_stat;
- struct tcase *tc = &tcases[n];
- struct open_how *myhow = *tc->how;
-
- myhow->flags = tc->flags | O_CREAT;
- myhow->mode = tc->mode;
- myhow->resolve = tc->resolve;
-
- TEST(fd = openat2(*tc->dfd, tc->pathname, myhow, tc->size));
- if (fd < 0) {
- tst_res(TFAIL | TTERRNO, "openat2() failed (%d)", n);
- return;
- }
-
- SAFE_FSTAT(fd, &file_stat);
-
- if (file_stat.st_size == 0)
- tst_res(TPASS, "openat2() passed (%d)", n);
- else
- tst_res(TFAIL, "fstat() didn't work as expected (%d)", n);
-
- SAFE_CLOSE(fd);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .bufs = (struct tst_buffers []) {
- {&how, .size = sizeof(*how)},
- {&phow, .size = sizeof(*phow)},
- {},
- },
-};
diff --git a/testcases/kernel/syscalls/openat2/openat202.c b/testcases/kernel/syscalls/openat2/openat202.c
deleted file mode 100644
index 6d1b5a67c..000000000
--- a/testcases/kernel/syscalls/openat2/openat202.c
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * openat2() tests with various resolve flags.
- */
-#include "tst_test.h"
-#include "lapi/openat2.h"
-
-#define FOO_SYMLINK "foo_symlink"
-
-static struct open_how *how;
-
-static struct tcase {
- const char *name;
- const char *pathname;
- uint64_t resolve;
- int exp_errno;
-} tcases[] = {
- /* Success cases */
- {"open /proc/version", "/proc/version", 0, 0},
- {"open magiclinks", "/proc/self/exe", 0, 0},
- {"open symlinks", FOO_SYMLINK, 0, 0},
-
- /* Failure cases */
- {"resolve-no-xdev", "/proc/version", RESOLVE_NO_XDEV, EXDEV},
- {"resolve-no-magiclinks", "/proc/self/exe", RESOLVE_NO_MAGICLINKS, ELOOP},
- {"resolve-no-symlinks", FOO_SYMLINK, RESOLVE_NO_SYMLINKS, ELOOP},
- {"resolve-beneath", "/proc/version", RESOLVE_BENEATH, EXDEV},
- {"resolve-beneath", "../foo", RESOLVE_BENEATH, EXDEV},
- {"resolve-no-in-root", "/proc/version", RESOLVE_IN_ROOT, ENOENT},
-};
-
-static void setup(void)
-{
- openat2_supported_by_kernel();
- SAFE_SYMLINK("/proc/version", FOO_SYMLINK);
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- how->flags = O_RDONLY | O_CREAT;
- how->mode = S_IRUSR;
- how->resolve = tc->resolve;
-
- TEST(openat2(AT_FDCWD, tc->pathname, how, sizeof(*how)));
-
- if (!tc->exp_errno) {
- if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO, "%s: openat2() failed",
- tc->name);
- return;
- }
-
- SAFE_CLOSE(TST_RET);
- tst_res(TPASS, "%s: openat2() passed", tc->name);
- } else {
- if (TST_RET >= 0) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: openat2() passed unexpectedly",
- tc->name);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: openat2() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: openat2() failed as expected",
- tc->name);
- }
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_tmpdir = 1,
- .bufs = (struct tst_buffers []) {
- {&how, .size = sizeof(*how)},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/openat2/openat203.c b/testcases/kernel/syscalls/openat2/openat203.c
deleted file mode 100644
index 6ac49ef4c..000000000
--- a/testcases/kernel/syscalls/openat2/openat203.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic openat2() test to check various failures.
- */
-#include "tst_test.h"
-#include "lapi/openat2.h"
-
-#define TEST_FILE "test_file"
-
-static struct open_how *how;
-static struct open_how_pad *phow;
-
-static struct tcase {
- const char *name;
- int dfd;
- const char *pathname;
- uint64_t flags;
- uint64_t mode;
- uint64_t resolve;
- struct open_how **how;
- size_t size;
- int exp_errno;
-} tcases[] = {
- {"invalid-dfd", -1, TEST_FILE, O_RDWR | O_CREAT, S_IRWXU, 0, &how, sizeof(*how), EBADF},
- {"invalid-pathname", AT_FDCWD, NULL, O_RDONLY | O_CREAT, S_IRUSR, 0, &how, sizeof(*how), EFAULT},
- {"invalid-flags", AT_FDCWD, TEST_FILE, O_RDONLY, S_IWUSR, 0, &how, sizeof(*how), EINVAL},
- {"invalid-mode", AT_FDCWD, TEST_FILE, O_RDWR | O_CREAT, -1, 0, &how, sizeof(*how), EINVAL},
- {"invalid-resolve", AT_FDCWD, TEST_FILE, O_RDWR | O_CREAT, S_IRWXU, -1, &how, sizeof(*how), EINVAL},
- {"invalid-size-zero", AT_FDCWD, TEST_FILE, O_RDWR | O_CREAT, S_IRWXU, 0, &how, 0, EINVAL},
- {"invalid-size-small", AT_FDCWD, TEST_FILE, O_RDWR | O_CREAT, S_IRWXU, 0, &how, sizeof(*how) - 1, EINVAL},
- {"invalid-size-big", AT_FDCWD, TEST_FILE, O_RDWR | O_CREAT, S_IRWXU, 0, &how, sizeof(*how) + 1, EFAULT},
- {"invalid-size-big-with-pad", AT_FDCWD, TEST_FILE, O_RDWR | O_CREAT, S_IRWXU, 0, (struct open_how **)&phow, sizeof(*how) + 8, E2BIG},
-};
-
-static void setup(void)
-{
- openat2_supported_by_kernel();
- phow->pad = 0xDEAD;
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- struct open_how *myhow = *tc->how;
-
- myhow->flags = tc->flags;
- myhow->mode = tc->mode;
- myhow->resolve = tc->resolve;
-
- TEST(openat2(tc->dfd, tc->pathname, myhow, tc->size));
-
- if (TST_RET >= 0) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: openat2() passed unexpectedly",
- tc->name);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: openat2() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: openat2() failed as expected", tc->name);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
- .needs_tmpdir = 1,
- .bufs = (struct tst_buffers []) {
- {&how, .size = sizeof(*how)},
- {&phow, .size = sizeof(*phow)},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/paging/Makefile b/testcases/kernel/syscalls/paging/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/paging/Makefile
+++ b/testcases/kernel/syscalls/paging/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pathconf/Makefile b/testcases/kernel/syscalls/pathconf/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/pathconf/Makefile
+++ b/testcases/kernel/syscalls/pathconf/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pause/Makefile b/testcases/kernel/syscalls/pause/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/pause/Makefile
+++ b/testcases/kernel/syscalls/pause/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pause/pause01.c b/testcases/kernel/syscalls/pause/pause01.c
index c88248da0..d44e7972a 100644
--- a/testcases/kernel/syscalls/pause/pause01.c
+++ b/testcases/kernel/syscalls/pause/pause01.c
@@ -38,7 +38,7 @@ static void do_test(void)
do_child();
TST_CHECKPOINT_WAIT(0);
- TST_PROCESS_STATE_WAIT(pid, 'S', 0);
+ TST_PROCESS_STATE_WAIT(pid, 'S');
kill(pid, SIGINT);
/*
diff --git a/testcases/kernel/syscalls/perf_event_open/Makefile b/testcases/kernel/syscalls/perf_event_open/Makefile
index 0facf540c..3c07fe47a 100644
--- a/testcases/kernel/syscalls/perf_event_open/Makefile
+++ b/testcases/kernel/syscalls/perf_event_open/Makefile
@@ -1,6 +1,19 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2009, Cisco Systems Inc.
#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Ngie Cooper, July 2009
#
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
index 6286d415d..5568035d9 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open01.c
@@ -165,19 +165,19 @@ static void verify(struct test_case_t *tc)
fd = TEST_RETURN;
if (ioctl(fd, PERF_EVENT_IOC_RESET, 0) == -1) {
- tst_brkm(TFAIL | TERRNO, cleanup,
+ tst_brkm(TFAIL | TTERRNO, cleanup,
"ioctl set PERF_EVENT_IOC_RESET failed");
}
if (ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) == -1) {
- tst_brkm(TFAIL | TERRNO, cleanup,
+ tst_brkm(TFAIL | TTERRNO, cleanup,
"ioctl set PERF_EVENT_IOC_ENABLE failed");
}
do_work();
if (ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) == -1) {
- tst_brkm(TFAIL | TERRNO, cleanup,
+ tst_brkm(TFAIL | TTERRNO, cleanup,
"ioctl set PERF_EVENT_IOC_RESET failed");
}
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
index eead421ac..7fb9183c3 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -61,6 +61,10 @@ struct read_format {
};
static char *verbose;
+static struct tst_option options[] = {
+ {"v", &verbose, "-v\tverbose output"},
+ {NULL, NULL, NULL},
+};
static int ntotal, nhw;
static int tsk0 = -1, hwfd[MAX_CTRS], tskfd[MAX_CTRS];
@@ -355,10 +359,7 @@ static void verify(void)
static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"v", &verbose, "-v verbose output"},
- {},
- },
+ .options = options,
.test_all = verify,
.needs_root = 1,
};
diff --git a/testcases/kernel/syscalls/personality/Makefile b/testcases/kernel/syscalls/personality/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/personality/Makefile
+++ b/testcases/kernel/syscalls/personality/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pidfd_open/.gitignore b/testcases/kernel/syscalls/pidfd_open/.gitignore
deleted file mode 100644
index e0b8900c1..000000000
--- a/testcases/kernel/syscalls/pidfd_open/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-pidfd_open01
-pidfd_open02
-pidfd_open03
diff --git a/testcases/kernel/syscalls/pidfd_open/Makefile b/testcases/kernel/syscalls/pidfd_open/Makefile
deleted file mode 100644
index 5ea7d67db..000000000
--- a/testcases/kernel/syscalls/pidfd_open/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open01.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open01.c
deleted file mode 100644
index f40e9b624..000000000
--- a/testcases/kernel/syscalls/pidfd_open/pidfd_open01.c
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * Basic pidfd_open() test:
- * 1) Fetch the PID of the current process and try to get its file descriptor.
- * 2) Check that the close-on-exec flag is set on the file descriptor.
- */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include "tst_test.h"
-#include "lapi/pidfd_open.h"
-
-static void run(void)
-{
- int flag;
-
- TEST(pidfd_open(getpid(), 0));
-
- if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "pidfd_open(getpid(), 0) failed");
-
- flag = fcntl(TST_RET, F_GETFD);
-
- SAFE_CLOSE(TST_RET);
-
- if (flag == -1)
- tst_brk(TFAIL | TERRNO, "fcntl(F_GETFD) failed");
-
- if (!(flag & FD_CLOEXEC))
- tst_brk(TFAIL, "pidfd_open(getpid(), 0) didn't set close-on-exec flag");
-
- tst_res(TPASS, "pidfd_open(getpid(), 0) passed");
-}
-
-static struct tst_test test = {
- .min_kver = "5.3",
- .test_all = run,
-};
diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
deleted file mode 100644
index dc86cae7a..000000000
--- a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * Basic pidfd_open() test to test invalid arguments.
- */
-#include "tst_test.h"
-#include "lapi/pidfd_open.h"
-
-pid_t expired_pid, my_pid, invalid_pid = -1;
-
-static struct tcase {
- char *name;
- pid_t *pid;
- int flags;
- int exp_errno;
-} tcases[] = {
- {"expired pid", &expired_pid, 0, ESRCH},
- {"invalid pid", &invalid_pid, 0, EINVAL},
- {"invalid flags", &my_pid, 1, EINVAL},
-};
-
-static void setup(void)
-{
- expired_pid = tst_get_unused_pid();
- my_pid = getpid();
-}
-
-static void run(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
-
- TEST(pidfd_open(*tc->pid, tc->flags));
-
- if (TST_RET != -1) {
- SAFE_CLOSE(TST_RET);
- tst_res(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
- tc->name, n);
- return;
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
-
- tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
- tc->name);
-}
-
-static struct tst_test test = {
- .min_kver = "5.3",
- .tcnt = ARRAY_SIZE(tcases),
- .test = run,
- .setup = setup,
-};
diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c
deleted file mode 100644
index 48470e5e1..000000000
--- a/testcases/kernel/syscalls/pidfd_open/pidfd_open03.c
+++ /dev/null
@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Description:
- * This program opens the PID file descriptor of the child process created with
- * fork(). It then uses poll to monitor the file descriptor for process exit, as
- * indicated by an EPOLLIN event.
- */
-#include <poll.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "tst_test.h"
-#include "lapi/pidfd_open.h"
-
-static void run(void)
-{
- struct pollfd pollfd;
- int fd, ready;
- pid_t pid;
-
- pid = SAFE_FORK();
-
- if (!pid) {
- TST_CHECKPOINT_WAIT(0);
- exit(EXIT_SUCCESS);
- }
-
- TEST(pidfd_open(pid, 0));
-
- fd = TST_RET;
- if (fd == -1)
- tst_brk(TFAIL | TTERRNO, "pidfd_open() failed");
-
- TST_CHECKPOINT_WAKE(0);
-
- pollfd.fd = fd;
- pollfd.events = POLLIN;
-
- ready = poll(&pollfd, 1, -1);
-
- SAFE_CLOSE(fd);
- SAFE_WAITPID(pid, NULL, 0);
-
- if (ready != 1)
- tst_res(TFAIL, "poll() returned %d", ready);
- else
- tst_res(TPASS, "pidfd_open() passed");
-}
-
-static struct tst_test test = {
- .min_kver = "5.3",
- .test_all = run,
- .forks_child = 1,
- .needs_checkpoints = 1,
-};
diff --git a/include/lapi/pidfd_send_signal.h b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal.h
index 512174def..dc17fe058 100644
--- a/include/lapi/pidfd_send_signal.h
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal.h
@@ -10,16 +10,17 @@
#include "tst_test.h"
#include "lapi/syscalls.h"
-static inline void pidfd_send_signal_supported(void)
+static void check_syscall_support(void)
{
/* allow the tests to fail early */
tst_syscall(__NR_pidfd_send_signal);
}
#ifndef HAVE_PIDFD_SEND_SIGNAL
-static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
- unsigned int flags)
+static int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
+ unsigned int flags)
{
+ tst_res(TINFO, "Testing syscall(__NR_pidfd_send_signal)");
return tst_syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
}
#endif /* HAVE_PIDFD_SEND_SIGNAL */
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c
index 4cb5df94c..b529551d2 100644
--- a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c
@@ -12,8 +12,8 @@
#define _GNU_SOURCE
#include <signal.h>
#include <stdlib.h>
-#include "lapi/pidfd_send_signal.h"
#include "tst_safe_pthread.h"
+#include "pidfd_send_signal.h"
#define SIGNAL SIGUSR1
#define DATA 777
@@ -26,7 +26,7 @@ static int pidfd;
static void received_signal(int sig, siginfo_t *info, void *ucontext)
{
if (info && ucontext) {
- if (sig == SIGNAL && info->si_value.sival_int == DATA) {
+ if (sig == SIGNAL && uinfo->si_value.sival_int == DATA) {
tst_res(TPASS, "Received correct signal and data!");
sig_rec = 1;
} else {
@@ -69,7 +69,7 @@ static void verify_pidfd_send_signal(void)
static void setup(void)
{
- pidfd_send_signal_supported();
+ check_syscall_support();
pidfd = SAFE_OPEN("/proc/self", O_DIRECTORY | O_CLOEXEC);
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c
index 1e62b417f..74914523f 100644
--- a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c
@@ -24,8 +24,8 @@
#define _GNU_SOURCE
#include <pwd.h>
#include <signal.h>
-#include "lapi/pidfd_send_signal.h"
#include "tst_safe_pthread.h"
+#include "pidfd_send_signal.h"
#define CORRECT_SIGNAL SIGUSR1
#define DIFFERENT_SIGNAL SIGUSR2
@@ -68,7 +68,7 @@ static void setup(void)
{
struct passwd *pw;
- pidfd_send_signal_supported();
+ check_syscall_support();
pidfd = SAFE_OPEN("/proc/self", O_DIRECTORY | O_CLOEXEC);
init_pidfd = SAFE_OPEN("/proc/1", O_DIRECTORY | O_CLOEXEC);
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c
index 0903d6707..3420afbb9 100644
--- a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c
@@ -19,7 +19,7 @@
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
-#include "lapi/pidfd_send_signal.h"
+#include "pidfd_send_signal.h"
#include "tst_safe_pthread.h"
#define PIDTRIES 3
@@ -111,7 +111,7 @@ static void verify_pidfd_send_signal(void)
static void setup(void)
{
- pidfd_send_signal_supported();
+ check_syscall_support();
last_pid_file = "/proc/sys/kernel/ns_last_pid";
if (access(last_pid_file, F_OK) == -1) {
diff --git a/testcases/kernel/syscalls/pipe/.gitignore b/testcases/kernel/syscalls/pipe/.gitignore
index 23e7186a6..ee2974ca8 100644
--- a/testcases/kernel/syscalls/pipe/.gitignore
+++ b/testcases/kernel/syscalls/pipe/.gitignore
@@ -9,5 +9,3 @@
/pipe09
/pipe10
/pipe11
-/pipe12
-/pipe13
diff --git a/testcases/kernel/syscalls/pipe/Makefile b/testcases/kernel/syscalls/pipe/Makefile
index 0056c2138..12279c494 100644
--- a/testcases/kernel/syscalls/pipe/Makefile
+++ b/testcases/kernel/syscalls/pipe/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pipe/pipe02.c b/testcases/kernel/syscalls/pipe/pipe02.c
index bf81c1899..204091163 100644
--- a/testcases/kernel/syscalls/pipe/pipe02.c
+++ b/testcases/kernel/syscalls/pipe/pipe02.c
@@ -47,7 +47,7 @@ static void verify_pipe(void)
TEST(pipe(fd));
if (TST_RET == -1) {
- tst_res(TFAIL|TTERRNO, "pipe() failed");
+ tst_res(TFAIL|TERRNO, "pipe() failed");
return;
}
diff --git a/testcases/kernel/syscalls/pipe/pipe12.c b/testcases/kernel/syscalls/pipe/pipe12.c
deleted file mode 100644
index 4c7eda2d6..000000000
--- a/testcases/kernel/syscalls/pipe/pipe12.c
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- *
- * Test Description:
- * A pipe has a limited capacity. If the pipe with non block mode is full,
- * then a write(2) will fail and get EAGAIN error. Otherwise, from 1 to
- * PIPE_BUF bytes may be written.
- */
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include "tst_test.h"
-#include "lapi/fcntl.h"
-
-static int fds[2];
-static char *wrbuf;
-static char *rdbuf;
-static ssize_t max_size, invalid_size;
-
-static struct tcase {
- int full_flag;
- int offset;
- char *message;
- int check_flag;
-} tcases[] = {
- {1, 0, "Write to full pipe", 1},
- /*
- * For a non-empty(unaligned page size) pipe, the sequent large size
- * write(>page_size)will use new pages. So it may exist a hole in
- * page and we print this value instead of checking it.
- */
- {0, 1, "Write to non-empty pipe", 0},
- {0, 0, "Write to empty pipe", 1},
-};
-
-static void verify_pipe(unsigned int n)
-{
- struct tcase *tc = &tcases[n];
- int nbytes;
-
- memset(rdbuf, 0, max_size);
-
- tst_res(TINFO, "%s", tc->message);
- if (tc->full_flag) {
- SAFE_WRITE(1, fds[1], wrbuf, max_size);
- TEST(write(fds[1], "x", 1));
- if (TST_RET != -1) {
- tst_res(TFAIL, "write succeeded unexpectedly");
- goto clean_pipe_buf;
- }
- if (TST_ERR == EAGAIN)
- tst_res(TPASS | TTERRNO, "write failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "write failed, expected EAGAIN but got");
- } else {
- SAFE_WRITE(1, fds[1], "x", tc->offset);
- TEST(write(fds[1], wrbuf, invalid_size));
- if (TST_RET == -1) {
- tst_res(TFAIL, "write failed unexpectedly");
- goto clean_pipe_buf;
- }
- tst_res(TPASS, "write succeeded as expectedly");
- }
- SAFE_IOCTL(fds[1], FIONREAD, &nbytes);
- if (tc->check_flag) {
- if (nbytes == max_size - tc->offset)
- tst_res(TPASS, "write %d bytes", nbytes);
- else
- tst_res(TFAIL, "write expected %ld bytes, got %d bytes",
- max_size, nbytes);
- } else
- tst_res(TPASS, "write %d bytes", nbytes);
-
-clean_pipe_buf:
- SAFE_READ(0, fds[0], rdbuf, max_size);
-}
-
-
-static void cleanup(void)
-{
- if (fds[0] > 0)
- SAFE_CLOSE(fds[0]);
- if (fds[1] > 0)
- SAFE_CLOSE(fds[1]);
- if (wrbuf)
- free(wrbuf);
- if (rdbuf)
- free(rdbuf);
-}
-
-static void setup(void)
-{
- SAFE_PIPE(fds);
-
- max_size = SAFE_FCNTL(fds[1], F_GETPIPE_SZ);
- invalid_size = max_size + 4096;
- wrbuf = SAFE_MALLOC(invalid_size);
- rdbuf = SAFE_MALLOC(max_size);
- memset(wrbuf, 'x', invalid_size);
-
- SAFE_FCNTL(fds[1], F_SETFL, O_NONBLOCK);
- SAFE_FCNTL(fds[0], F_SETFL, O_NONBLOCK);
-}
-
-static struct tst_test test = {
- .test = verify_pipe,
- .setup = setup,
- .cleanup = cleanup,
- .tcnt = ARRAY_SIZE(tcases),
-};
diff --git a/testcases/kernel/syscalls/pipe/pipe13.c b/testcases/kernel/syscalls/pipe/pipe13.c
deleted file mode 100644
index 5d76e1f00..000000000
--- a/testcases/kernel/syscalls/pipe/pipe13.c
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- *
- * Test Description:
- * This case is designed to test whether pipe can wakeup all readers
- * when last writer closes.
- *
- * This is also a regression test for commit 6551d5c56eb0
- * ("pipe: make sure to wake up everybody when the last reader/writer closes").
- * This bug was introduced by commit 0ddad21d3e99 ("pipe: use exclusive
- * waits when reading or writing").
- */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <stdlib.h>
-#include "tst_test.h"
-
-static unsigned int tcases[] = {
- 2,
- 10,
- 27,
- 100
-};
-
-static int fds[2];
-
-static void do_child(unsigned int i)
-{
- char buf;
-
- SAFE_CLOSE(fds[1]);
- TST_CHECKPOINT_WAKE(i);
- int ret = SAFE_READ(0, fds[0], &buf, 1);
- if (ret != 0)
- tst_res(TFAIL, "Wrong return from read %i", ret);
- exit(0);
-}
-
-static void verify_pipe(unsigned int n)
-{
- int ret;
- unsigned int i, cnt = 0, sleep_us = 1, fail = 0;
- unsigned int child_num = tcases[n];
- int pid[child_num];
-
- SAFE_PIPE(fds);
- tst_res(TINFO, "Creating %d child processes", child_num);
-
- for (i = 0; i < child_num; i++) {
- pid[i] = SAFE_FORK();
- if (pid[i] == 0)
- do_child(i);
- TST_CHECKPOINT_WAIT(i);
- TST_PROCESS_STATE_WAIT(pid[i], 'S', 0);
- }
-
- SAFE_CLOSE(fds[0]);
- SAFE_CLOSE(fds[1]);
-
- while (cnt < child_num && sleep_us < 1000000) {
- ret = waitpid(-1, NULL, WNOHANG);
- if (ret < 0)
- tst_brk(TBROK | TERRNO, "waitpid()");
- if (ret > 0) {
- cnt++;
- for (i = 0; i < child_num; i++) {
- if (pid[i] == ret)
- pid[i] = 0;
- }
- continue;
- }
- usleep(sleep_us);
- sleep_us *= 2;
- }
-
- for (i = 0; i < child_num; i++) {
- if (pid[i]) {
- tst_res(TINFO, "pid %i still sleeps", pid[i]);
- fail = 1;
- SAFE_KILL(pid[i], SIGKILL);
- SAFE_WAIT(NULL);
- }
- }
-
- if (fail)
- tst_res(TFAIL, "Closed pipe didn't wake up everyone");
- else
- tst_res(TPASS, "Closed pipe waked up everyone");
-}
-
-static struct tst_test test = {
- .test = verify_pipe,
- .tcnt = ARRAY_SIZE(tcases),
- .forks_child = 1,
- .needs_checkpoints = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "6551d5c56eb"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/pipe2/.gitignore b/testcases/kernel/syscalls/pipe2/.gitignore
index 50f7023b8..cd38bb309 100644
--- a/testcases/kernel/syscalls/pipe2/.gitignore
+++ b/testcases/kernel/syscalls/pipe2/.gitignore
@@ -1,4 +1,2 @@
/pipe2_01
/pipe2_02
-/pipe2_02_child
-/pipe2_04
diff --git a/testcases/kernel/syscalls/pipe2/Makefile b/testcases/kernel/syscalls/pipe2/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/pipe2/Makefile
+++ b/testcases/kernel/syscalls/pipe2/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pipe2/pipe2_01.c b/testcases/kernel/syscalls/pipe2/pipe2_01.c
index 6597162e7..5f3ad8f0f 100644
--- a/testcases/kernel/syscalls/pipe2/pipe2_01.c
+++ b/testcases/kernel/syscalls/pipe2/pipe2_01.c
@@ -1,80 +1,186 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Ulrich Drepper <drepper@redhat.com>
- * Copyright (c) International Business Machines Corp., 2009
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- *
- * Author: Ulrich Drepper <drepper@redhat.com>
- *
- * History:
- * Created - Jan 13 2009 - Ulrich Drepper <drepper@redhat.com>
- * Ported to LTP - Jan 13 2009 - Subrata <subrata@linux.vnet.ibm.com>
- * Converted into new api - Apri 15 2020 - Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-
-#define _GNU_SOURCE
+/******************************************************************************/
+/* */
+/* Copyright (c) Ulrich Drepper <drepper@redhat.com> */
+/* Copyright (c) International Business Machines Corp., 2009 */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/******************************************************************************/
+/******************************************************************************/
+/* */
+/* File: pipe2_01.c */
+/* */
+/* Description: This Program tests the new system call introduced in 2.6.27. */
+/* Ulrich´s comment as in: */
+/* http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ed8cae8ba01348bfd83333f4648dd807b04d7f08 */
+/* says: */
+/* This patch introduces the new syscall pipe2 which is like pipe but it also */
+/* takes an additional parameter which takes a flag value. This patch */
+/* implements the handling of O_CLOEXEC for the flag. I did not add support */
+/* for the new syscall for the architectures which have a special sys_pipe */
+/* implementation. I think the maintainers of those archs have the chance to */
+/* go with the unified implementation but that's up to them. */
+/* */
+/* The implementation introduces do_pipe_flags. I did that instead of */
+/* changing all callers of do_pipe because some of the callers are written in */
+/* assembler. I would probably screw up changing the assembly code. To avoid */
+/* breaking code do_pipe is now a small wrapper around do_pipe_flags. Once */
+/* all callers are changed over to do_pipe_flags the old do_pipe function can */
+/* be removed. */
+/* The following test must be adjusted for architectures other than x86 and */
+/* x86-64 and in case the syscall numbers changed. */
+/* */
+/* Usage: <for command-line> */
+/* pipe2_01 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 1 */
+/* */
+/* Test Name: pipe2_01 */
+/* */
+/* Author: Ulrich Drepper <drepper@redhat.com> */
+/* */
+/* History: Created - Jan 13 2009 - Ulrich Drepper <drepper@redhat.com> */
+/* Ported to LTP */
+/* - Jan 13 2009 - Subrata <subrata@linux.vnet.ibm.com> */
+/******************************************************************************/
+#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
+#include <sys/syscall.h>
+#include <errno.h>
+
+#include "test.h"
#include "lapi/fcntl.h"
-#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+char *TCID = "pipe2_01";
+int testno;
+int TST_TOTAL = 1;
+
+/* Extern Global Functions */
+/******************************************************************************/
+/* */
+/* Function: cleanup */
+/* */
+/* Description: Performs all one time clean up for this test on successful */
+/* completion, premature exit or failure. Closes all temporary */
+/* files, removes all temporary directories exits the test with */
+/* appropriate return code by calling tst_exit() function. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */
+/* On success - Exits calling tst_exit(). With '0' return code. */
+/* */
+/******************************************************************************/
+void cleanup(void)
+{
-static int fds[2];
+ tst_rmdir();
-static struct tcase {
- int flags;
- int cmd;
- int check_read_end;
- char *message;
-} tcases[] = {
- {0, F_GETFD, 1, "Test pipe2 with 0 flag"},
- {O_CLOEXEC, F_GETFD, 1, "Test pipe2 using O_CLOEXEC flag"},
- /*
- * It may get EINVAL error on older kernel because this flag was
- * introduced since kernel 3.4. We only test flag in write end
- * because this flag was used to make pipe buffer marked with the
- * PIPE_BUF_FLAG_PACKET flag. In read end, kernel also checks buffer
- * flag instead of O_DIRECT. So it make no sense to check this flag
- * in fds[0].
- */
- {O_DIRECT, F_GETFL, 0, "Test pipe2 using O_DIRECT flag"},
- {O_NONBLOCK, F_GETFL, 1, "Test pipe2 using O_NONBLOCK flag"},
-};
+}
-static void cleanup(void)
+/* Local Functions */
+/******************************************************************************/
+/* */
+/* Function: setup */
+/* */
+/* Description: Performs all one time setup for this test. This function is */
+/* typically used to capture signals, create temporary dirs */
+/* and temporary files that may be used in the course of this */
+/* test. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits by calling cleanup(). */
+/* On success - returns 0. */
+/* */
+/******************************************************************************/
+void setup(void)
{
- if (fds[0] > 0)
- SAFE_CLOSE(fds[0]);
- if (fds[1] > 1)
- SAFE_CLOSE(fds[1]);
+ /* Capture signals if any */
+ /* Create temporary directories */
+ TEST_PAUSE;
+ tst_tmpdir();
}
-static void verify_pipe2(unsigned int n)
+int main(int argc, char *argv[])
{
- struct tcase *tc = &tcases[n];
- int get_flag = 0, i = 0;
+ int fd[2], i, coe;
+ int lc;
- tst_res(TINFO, "%s ", tc->message);
- if ((tc->flags == O_DIRECT) && (tst_kvercmp(3, 4, 0)) < 0) {
- tst_res(TCONF, "O_DIRECT needs Linux 3.4 or newer");
- return;
+ tst_parse_opts(argc, argv, NULL, NULL);
+ if ((tst_kvercmp(2, 6, 27)) < 0) {
+ tst_brkm(TCONF,
+ NULL,
+ "This test can only run on kernels that are 2.6.27 and higher");
}
+ setup();
- SAFE_PIPE2(fds, tc->flags);
- for (i = 0; i < 2; i++) {
- if (i == 0 && !tc->check_read_end)
- continue;
- get_flag = SAFE_FCNTL(fds[i], tc->cmd);
- if ((get_flag && tc->flags) || (tc->flags == get_flag))
- tst_res(TPASS, "pipe2 fds[%d] gets expected flag(%d)", i, tc->flags);
- else
- tst_res(TFAIL, "pipe2 fds[%d] doesn't get expected flag(%d), get flag(%d)",
- i, tc->flags, get_flag);
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
+ if (ltp_syscall(__NR_pipe2, fd, 0) != 0) {
+ tst_brkm(TFAIL, cleanup, "pipe2(0) failed");
+ }
+ for (i = 0; i < 2; ++i) {
+ coe = fcntl(fd[i], F_GETFD);
+ if (coe == -1) {
+ tst_brkm(TBROK, cleanup,
+ "fcntl failed");
+ }
+ if (coe & FD_CLOEXEC) {
+ tst_brkm(TFAIL,
+ cleanup, "pipe2(0) set close-on-exit for fd[%d]",
+ i);
+ }
+ }
+ close(fd[0]);
+ close(fd[1]);
+
+ if (ltp_syscall(__NR_pipe2, fd, O_CLOEXEC) != 0) {
+ tst_brkm(TFAIL, cleanup,
+ "pipe2(O_CLOEXEC) failed");
+ }
+ for (i = 0; i < 2; ++i) {
+ coe = fcntl(fd[i], F_GETFD);
+ if (coe == -1) {
+ tst_brkm(TBROK, cleanup,
+ "fcntl failed");
+ }
+ if ((coe & FD_CLOEXEC) == 0) {
+ tst_brkm(TFAIL,
+ cleanup, "pipe2(O_CLOEXEC) does not set close-on-exit for fd[%d]",
+ i);
+ }
+ }
+ close(fd[0]);
+ close(fd[1]);
+ tst_resm(TPASS, "pipe2(O_CLOEXEC) PASSED");
+ cleanup();
+ }
}
- cleanup();
+ tst_exit();
}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_pipe2,
- .cleanup = cleanup,
-};
diff --git a/testcases/kernel/syscalls/pipe2/pipe2_02.c b/testcases/kernel/syscalls/pipe2/pipe2_02.c
index 9ba69667b..39f02ff8c 100644
--- a/testcases/kernel/syscalls/pipe2/pipe2_02.c
+++ b/testcases/kernel/syscalls/pipe2/pipe2_02.c
@@ -1,68 +1,175 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- *
- * This case is designed to test the basic functionality about the
- * O_CLOEXEC flag of pipe2.
- */
-
-#define _GNU_SOURCE
+/******************************************************************************/
+/* */
+/* Copyright (c) Ulrich Drepper <drepper@redhat.com> */
+/* Copyright (c) International Business Machines Corp., 2009 */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/******************************************************************************/
+/******************************************************************************/
+/* */
+/* File: pipe2_02.c */
+/* */
+/* Description: This Program tests the new system call introduced in 2.6.27. */
+/* Ulrich´s comment as in: */
+/* http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be61a86d7237dd80510615f38ae21d6e1e98660c */
+/* which says: */
+/* This patch adds O_NONBLOCK support to pipe2. It is minimally more involved*/
+/* than the patches for eventfd et.al but still trivial. The interfaces of */
+/* the create_write_pipe and create_read_pipe helper functions were changed */
+/* and the one other caller as well. */
+/* The following test must be adjusted for architectures other than x86 and */
+/* x86-64 and in case the syscall numbers changed. */
+/* */
+/* Usage: <for command-line> */
+/* pipe2_02 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 1 */
+/* */
+/* Test Name: pipe2_02 */
+/* */
+/* Author: Ulrich Drepper <drepper@redhat.com> */
+/* */
+/* History: Created - Jan 13 2009 - Ulrich Drepper <drepper@redhat.com> */
+/* Ported to LTP */
+/* - Jan 13 2009 - Subrata <subrata@linux.vnet.ibm.com> */
+/******************************************************************************/
+#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
-#include <stdlib.h>
+#include <sys/syscall.h>
+#include <errno.h>
+
+#include "test.h"
#include "lapi/fcntl.h"
-#include "tst_test.h"
+#include "lapi/syscalls.h"
-#define TESTBIN "pipe2_02_child"
-static int fds[2];
+char *TCID = "pipe2_02";
+int testno;
+int TST_TOTAL = 1;
-static void cleanup(void)
+/* Extern Global Functions */
+/******************************************************************************/
+/* */
+/* Function: cleanup */
+/* */
+/* Description: Performs all one time clean up for this test on successful */
+/* completion, premature exit or failure. Closes all temporary */
+/* files, removes all temporary directories exits the test with */
+/* appropriate return code by calling tst_exit() function. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */
+/* On success - Exits calling tst_exit(). With '0' return code. */
+/* */
+/******************************************************************************/
+void cleanup(void)
{
- if (fds[0] > 0)
- SAFE_CLOSE(fds[0]);
- if (fds[1] > 0)
- SAFE_CLOSE(fds[1]);
+
+ tst_rmdir();
+
}
-static void verify_pipe2(void)
+/* Local Functions */
+/******************************************************************************/
+/* */
+/* Function: setup */
+/* */
+/* Description: Performs all one time setup for this test. This function is */
+/* typically used to capture signals, create temporary dirs */
+/* and temporary files that may be used in the course of this */
+/* test. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits by calling cleanup(). */
+/* On success - returns 0. */
+/* */
+/******************************************************************************/
+void setup(void)
{
- int pid, status;
- char buf[20];
+ /* Capture signals if any */
+ /* Create temporary directories */
+ TEST_PAUSE;
+ tst_tmpdir();
+}
- SAFE_PIPE2(fds, O_CLOEXEC);
- sprintf(buf, "%d", fds[1]);
- pid = SAFE_FORK();
- if (pid == 0)
- SAFE_EXECLP(TESTBIN, TESTBIN, buf, NULL);
+int main(int argc, char *argv[])
+{
+ int fds[2], fl, i;
+ int lc;
- SAFE_WAIT(&status);
- if (WIFEXITED(status)) {
- switch (WEXITSTATUS(status)) {
- case 0:
- tst_res(TPASS, "test O_CLOEXEC for pipe2 success");
- break;
- case 1:
- tst_res(TFAIL, "test O_CLOEXEC for pipe2 failed");
- break;
- default:
- tst_brk(TBROK, "execlp() failed");
- }
- } else {
- tst_brk(TBROK, "%s exits with unexpected error", TESTBIN);
+ tst_parse_opts(argc, argv, NULL, NULL);
+ if ((tst_kvercmp(2, 6, 27)) < 0) {
+ tst_brkm(TCONF,
+ NULL,
+ "This test can only run on kernels that are 2.6.27 and higher");
}
- cleanup();
-}
+ setup();
-static const char *const resfile[] = {
- TESTBIN,
- NULL,
-};
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
+ if (ltp_syscall(__NR_pipe2, fds, 0) == -1) {
+ tst_brkm(TFAIL, cleanup, "pipe2(0) failed");
+ }
+ for (i = 0; i < 2; ++i) {
+ fl = fcntl(fds[i], F_GETFL);
+ if (fl == -1) {
+ tst_brkm(TBROK, cleanup,
+ "fcntl failed");
+ }
+ if (fl & O_NONBLOCK) {
+ tst_brkm(TFAIL,
+ cleanup, "pipe2(0) set non-blocking mode for fds[%d]",
+ i);
+ }
+ close(fds[i]);
+ }
-static struct tst_test test = {
- .resource_files = resfile,
- .cleanup = cleanup,
- .forks_child = 1,
- .needs_root = 1,
- .test_all = verify_pipe2,
-};
+ if (ltp_syscall(__NR_pipe2, fds, O_NONBLOCK) == -1) {
+ tst_brkm(TFAIL, cleanup,
+ "pipe2(O_NONBLOCK) failed");
+ }
+ for (i = 0; i < 2; ++i) {
+ fl = fcntl(fds[i], F_GETFL);
+ if (fl == -1) {
+ tst_brkm(TBROK, cleanup,
+ "fcntl failed");
+ }
+ if ((fl & O_NONBLOCK) == 0) {
+ tst_brkm(TFAIL,
+ cleanup, "pipe2(O_NONBLOCK) does not set non-blocking mode for fds[%d]\n",
+ i);
+ }
+ close(fds[i]);
+ }
+ tst_resm(TPASS, "pipe2(O_NONBLOCK) PASSED");
+ cleanup();
+ }
+ }
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/pipe2/pipe2_02_child.c b/testcases/kernel/syscalls/pipe2/pipe2_02_child.c
deleted file mode 100644
index fa0f881e9..000000000
--- a/testcases/kernel/syscalls/pipe2/pipe2_02_child.c
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-
-int main(int argc, char **argv)
-{
- int fd;
-
- if (argc != 2) {
- fprintf(stderr, "Only two arguments: %s <fd>\n", argv[0]);
- exit(1);
- }
-
- fd = atoi(argv[1]);
- if (fcntl(fd, F_GETFL) < 0 && errno == EBADF)
- return 0;
-
- return 1;
-}
diff --git a/testcases/kernel/syscalls/pipe2/pipe2_04.c b/testcases/kernel/syscalls/pipe2/pipe2_04.c
deleted file mode 100644
index 432007e4d..000000000
--- a/testcases/kernel/syscalls/pipe2/pipe2_04.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Francis Laniel. All rights reserved.
- * Author: Francis Laniel <laniel_francis@privacyrequired.com>
- *
- * Test Description:
- * This Program tests getting and setting the pipe size.
- * It also tests what happen when you write to a full pipe depending on whether
- * O_NONBLOCK is set or not.
- */
-#define _GNU_SOURCE
-#include <stdlib.h>
-#include <features.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include "lapi/fcntl.h"
-#include "tst_test.h"
-
-static int fds[2];
-static int flags;
-
-static void test_pipe2(void)
-{
- int ret;
- pid_t pid;
-
- /*
- * This ensures parent process is still in non-block mode when
- * using -i parameter. Subquent writes hould return -1 and errno
- * set to either EAGAIN or EWOULDBLOCK because pipe is already full.
- */
- SAFE_FCNTL(fds[1], F_SETFL, flags | O_NONBLOCK);
- ret = write(fds[1], "x", 1);
- if (ret == -1) {
- if (errno == EAGAIN)
- tst_res(TPASS | TERRNO, "write failed as expected");
- else
- tst_brk(TFAIL | TERRNO, "write failed expected EAGAIN but got");
- } else {
- tst_res(TFAIL, "write() succeeded unexpectedly");
- }
-
- pid = SAFE_FORK();
- if (!pid) {
- SAFE_FCNTL(fds[1], F_SETFL, flags & ~O_NONBLOCK);
- SAFE_WRITE(1, fds[1], "x", 1);
- }
-
- if (TST_PROCESS_STATE_WAIT(pid, 'S', 1000) < 0)
- tst_res(TFAIL, "Child process is not blocked");
- else
- tst_res(TPASS, "Child process is blocked");
-
- SAFE_KILL(pid, SIGKILL);
- SAFE_WAIT(NULL);
-}
-
-static void setup(void)
-{
- int page_size, pipe_size;
- char *write_buffer;
-
- SAFE_PIPE2(fds, O_NONBLOCK);
- page_size = SAFE_SYSCONF(_SC_PAGESIZE);
-
- flags = SAFE_FCNTL(fds[1], F_GETFL);
- if (!(flags & O_NONBLOCK))
- tst_brk(TCONF, "O_NONBLOCK flag must be set");
- /*
- * A pipe has two file descriptors.
- * But in the kernel these two file descriptors point to the same pipe.
- * So setting size from first file handle set size for the pipe.
- */
- SAFE_FCNTL(fds[0], F_SETPIPE_SZ, 0);
-
- /*
- * So getting size from the second file descriptor return the size of
- * the pipe which was changed before with first file descriptor.
- */
- pipe_size = SAFE_FCNTL(fds[1], F_GETPIPE_SZ);
- if (pipe_size != page_size)
- tst_res(TFAIL, "Pipe size (%d) must be page size (%d)",
- pipe_size, page_size);
-
- write_buffer = SAFE_MALLOC(pipe_size);
- memset(write_buffer, 'x', pipe_size);
- SAFE_WRITE(1, fds[1], write_buffer, pipe_size);
- free(write_buffer);
-}
-
-static void cleanup(void)
-{
- if (fds[0] > 0)
- SAFE_CLOSE(fds[0]);
- if (fds[1] > 0)
- SAFE_CLOSE(fds[1]);
-}
-
-static struct tst_test test = {
- .min_kver = "2.6.35",
- .test_all = test_pipe2,
- .setup = setup,
- .cleanup = cleanup,
- .forks_child = 1,
-};
diff --git a/testcases/kernel/syscalls/pivot_root/pivot_root01.c b/testcases/kernel/syscalls/pivot_root/pivot_root01.c
index 1fbe8c189..2e8a7ff24 100644
--- a/testcases/kernel/syscalls/pivot_root/pivot_root01.c
+++ b/testcases/kernel/syscalls/pivot_root/pivot_root01.c
@@ -101,7 +101,7 @@ static void run(unsigned int test_case)
/* pivot_root requires no shared mounts exist in process namespace */
TEST(unshare(CLONE_NEWNS | CLONE_FS));
if (TST_RET == -1)
- tst_brk(TFAIL | TTERRNO, "unshare failed");
+ tst_brk(TFAIL | TERRNO, "unshare failed");
/*
* Create an initial root dir. pivot_root doesn't work if the initial root
@@ -153,7 +153,7 @@ static void run(unsigned int test_case)
if (test_cases[test_case].test_case == NORMAL) {
if (TST_RET)
- tst_res(TFAIL | TTERRNO, "pivot_root failed");
+ tst_res(TFAIL | TERRNO, "pivot_root failed");
else
tst_res(TPASS, "pivot_root succeeded");
diff --git a/testcases/kernel/syscalls/pkeys/pkey01.c b/testcases/kernel/syscalls/pkeys/pkey01.c
index 04f50924c..fa84e71f3 100644
--- a/testcases/kernel/syscalls/pkeys/pkey01.c
+++ b/testcases/kernel/syscalls/pkeys/pkey01.c
@@ -36,6 +36,12 @@
#define PATH_VM_NRHPS "/proc/sys/vm/nr_hugepages"
static int size;
+static int no_hugepage;
+
+static const char * const save_restore[] = {
+ "?/proc/sys/vm/nr_hugepages",
+ NULL,
+};
static struct tcase {
unsigned long flags;
@@ -50,12 +56,21 @@ static void setup(void)
{
int i, fd;
- check_pkey_support();
-
- if (tst_hugepages == test.request_hugepages)
- size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
- else
+ if (access("/sys/kernel/mm/hugepages/", F_OK)) {
+ tst_res(TINFO, "Huge page is not supported");
size = getpagesize();
+ no_hugepage = 1;
+ } else {
+ int val;
+ SAFE_FILE_PRINTF(PATH_VM_NRHPS, "%d", 1);
+ SAFE_FILE_SCANF(PATH_VM_NRHPS, "%d", &val);
+ if (val != 1)
+ tst_brk(TBROK, "nr_hugepages = %d, but expect %d",
+ val, 1);
+ size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+ }
+
+ check_pkey_support();
fd = SAFE_OPEN(TEST_FILE, O_RDWR | O_CREAT, 0664);
for (i = 0; i < 128; i++)
@@ -132,7 +147,7 @@ static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
int pkey, status;
int fd = mpa->fd;
- if (!tst_hugepages && (mpa->flags & MAP_HUGETLB)) {
+ if (no_hugepage && (mpa->flags & MAP_HUGETLB)) {
tst_res(TINFO, "Skip test on (%s) buffer", flag_to_str(mpa->flags));
return;
}
@@ -221,5 +236,5 @@ static struct tst_test test = {
.forks_child = 1,
.test = verify_pkey,
.setup = setup,
- .request_hugepages = 1,
+ .save_restore = save_restore,
};
diff --git a/testcases/kernel/syscalls/poll/Makefile b/testcases/kernel/syscalls/poll/Makefile
index d76b60ed7..ef00c78dc 100644
--- a/testcases/kernel/syscalls/poll/Makefile
+++ b/testcases/kernel/syscalls/poll/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/poll/poll02.c b/testcases/kernel/syscalls/poll/poll02.c
index c0665927b..98f0c89d5 100644
--- a/testcases/kernel/syscalls/poll/poll02.c
+++ b/testcases/kernel/syscalls/poll/poll02.c
@@ -1,6 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2015-2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
diff --git a/testcases/kernel/syscalls/ppoll/Makefile b/testcases/kernel/syscalls/ppoll/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/ppoll/Makefile
+++ b/testcases/kernel/syscalls/ppoll/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/ppoll/ppoll01.c b/testcases/kernel/syscalls/ppoll/ppoll01.c
index 3d2f92f2a..2fadd0653 100644
--- a/testcases/kernel/syscalls/ppoll/ppoll01.c
+++ b/testcases/kernel/syscalls/ppoll/ppoll01.c
@@ -19,10 +19,8 @@
#include <sys/wait.h>
#include "lapi/syscalls.h"
#include "ltp_signal.h"
-#include "time64_variants.h"
#include "tst_sig_proc.h"
#include "tst_test.h"
-#include "tst_timer.h"
/* Older versions of glibc don't publish this constant's value. */
#ifndef POLLRDHUP
@@ -40,7 +38,7 @@ struct test_case {
unsigned int nfds; /* nfds ppoll parameter */
sigset_t *sigmask; /* sigmask ppoll parameter */
sigset_t *sigmask_cur; /* sigmask set for current process */
- struct tst_ts *ts; /* ts ppoll parameter */
+ struct timespec *ts; /* ts ppoll parameter */
struct pollfd *fds; /* fds ppoll parameter */
int sigint_count; /* if > 0, spawn process to send SIGINT */
/* 'count' times to current process */
@@ -62,7 +60,14 @@ static int fd1 = -1;
static sigset_t sigmask_empty, sigmask_sigint;
static struct pollfd fds_good[1], fds_already_closed[1];
-static struct tst_ts ts_short, ts_long;
+static struct timespec ts_short = {
+ .tv_sec = 0,
+ .tv_nsec = 200000000,
+};
+static struct timespec ts_long = {
+ .tv_sec = 2,
+ .tv_nsec = 0,
+};
/* Test cases
*
@@ -155,48 +160,14 @@ static struct test_case tcase[] = {
},
};
-static inline int libc_ppoll(struct pollfd *fds, nfds_t nfds, void *tmo_p,
- const sigset_t *sigmask,
- size_t sigsetsize LTP_ATTRIBUTE_UNUSED)
-{
- return ppoll(fds, nfds, tmo_p, sigmask);
-}
-
-static inline int sys_ppoll(struct pollfd *fds, nfds_t nfds, void *tmo_p,
- const sigset_t *sigmask, size_t sigsetsize)
-{
- return tst_syscall(__NR_ppoll, fds, nfds, tmo_p, sigmask, sigsetsize);
-}
-
-static inline int sys_ppoll_time64(struct pollfd *fds, nfds_t nfds, void *tmo_p,
- const sigset_t *sigmask, size_t sigsetsize)
-{
- return tst_syscall(__NR_ppoll_time64, fds, nfds, tmo_p, sigmask,
- sigsetsize);
-}
-
-static struct time64_variants variants[] = {
- { .ppoll = libc_ppoll, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_ppoll != __LTP__NR_INVALID_SYSCALL)
- { .ppoll = sys_ppoll, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_ppoll_time64 != __LTP__NR_INVALID_SYSCALL)
- { .ppoll = sys_ppoll_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
{
}
static void setup(void)
{
- struct time64_variants *tv = &variants[tst_variant];
int fd2;
- tst_res(TINFO, "Testing variant: %s", tv->desc);
SAFE_SIGNAL(SIGINT, sighandler);
if (sigemptyset(&sigmask_empty) == -1)
@@ -206,22 +177,18 @@ static void setup(void)
if (sigaddset(&sigmask_sigint, SIGINT) == -1)
tst_brk(TBROK | TERRNO, "sigaddset");
- fd1 = SAFE_OPEN("testfile1", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+ fd1 = SAFE_OPEN("testfile1", O_CREAT | O_EXCL | O_RDWR,
+ S_IRUSR | S_IWUSR);
fds_good[0].fd = fd1;
fds_good[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
fds_good[0].revents = 0;
- fd2 = SAFE_OPEN("testfile2", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
+ fd2 = SAFE_OPEN("testfile2", O_CREAT | O_EXCL | O_RDWR,
+ S_IRUSR | S_IWUSR);
fds_already_closed[0].fd = fd2;
fds_already_closed[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
fds_already_closed[0].revents = 0;
SAFE_CLOSE(fd2);
-
- ts_short.type = ts_long.type = tv->ts_type;
- tst_ts_set_sec(&ts_short, 0);
- tst_ts_set_nsec(&ts_short, 20000000);
- tst_ts_set_sec(&ts_long, 2);
- tst_ts_set_nsec(&ts_long, 0);
}
static void cleanup(void)
@@ -232,11 +199,10 @@ static void cleanup(void)
static void do_test(unsigned int i)
{
- struct time64_variants *tv = &variants[tst_variant];
pid_t pid = 0;
int sys_ret, sys_errno = 0, dummy;
struct test_case *tc = &tcase[i];
- struct tst_ts ts, *tsp = NULL;
+ struct timespec ts, *tsp = NULL;
if (tc->ts) {
memcpy(&ts, tc->ts, sizeof(ts));
@@ -257,8 +223,8 @@ static void do_test(unsigned int i)
/* test */
errno = 0;
- sys_ret = tv->ppoll(tc->fds, tc->nfds, tst_ts_get(tsp), tc->sigmask,
- SIGSETSIZE);
+ sys_ret = tst_syscall(__NR_ppoll, tc->fds, tc->nfds, tsp,
+ tc->sigmask, SIGSETSIZE);
sys_errno = errno;
/* cleanup */
@@ -295,7 +261,6 @@ static void do_test(unsigned int i)
static struct tst_test test = {
.tcnt = ARRAY_SIZE(tcase),
.test = do_test,
- .test_variants = ARRAY_SIZE(variants),
.setup = setup,
.cleanup = cleanup,
.forks_child = 1,
diff --git a/testcases/kernel/syscalls/prctl/Makefile b/testcases/kernel/syscalls/prctl/Makefile
index b0b8ca435..c02b6d1de 100644
--- a/testcases/kernel/syscalls/prctl/Makefile
+++ b/testcases/kernel/syscalls/prctl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/prctl/prctl02.c b/testcases/kernel/syscalls/prctl/prctl02.c
index ebc0e5060..93f30b54a 100644
--- a/testcases/kernel/syscalls/prctl/prctl02.c
+++ b/testcases/kernel/syscalls/prctl/prctl02.c
@@ -41,7 +41,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stddef.h>
-#include <limits.h>
#include "config.h"
#include "lapi/prctl.h"
#include "lapi/seccomp.h"
@@ -66,7 +65,7 @@ static unsigned long bad_addr;
static unsigned long num_0;
static unsigned long num_1 = 1;
static unsigned long num_2 = 2;
-static unsigned long num_invalid = ULONG_MAX;
+static unsigned long num_invalid = 999;
static int seccomp_nsup;
static int nonewprivs_nsup;
static int thpdisable_nsup;
@@ -88,12 +87,12 @@ static struct tcase {
{PR_SET_SECCOMP, &num_2, &strict_addr, EACCES, "PR_SET_SECCOMP"},
{PR_SET_TIMING, &num_1, &num_0, EINVAL, "PR_SET_TIMING"},
{PR_SET_NO_NEW_PRIVS, &num_0, &num_0, EINVAL, "PR_SET_NO_NEW_PRIVS"},
- {PR_SET_NO_NEW_PRIVS, &num_1, &num_1, EINVAL, "PR_SET_NO_NEW_PRIVS"},
+ {PR_SET_NO_NEW_PRIVS, &num_1, &num_0, EINVAL, "PR_SET_NO_NEW_PRIVS"},
{PR_GET_NO_NEW_PRIVS, &num_1, &num_0, EINVAL, "PR_GET_NO_NEW_PRIVS"},
{PR_SET_THP_DISABLE, &num_0, &num_1, EINVAL, "PR_SET_THP_DISABLE"},
{PR_GET_THP_DISABLE, &num_1, &num_1, EINVAL, "PR_GET_THP_DISABLE"},
- {PR_CAP_AMBIENT, &num_invalid, &num_0, EINVAL, "PR_CAP_AMBIENT"},
- {PR_GET_SPECULATION_CTRL, &num_0, &num_invalid, EINVAL, "PR_GET_SPECULATION_CTRL"},
+ {PR_CAP_AMBIENT, &num_2, &num_1, EINVAL, "PR_CAP_AMBIENT"},
+ {PR_GET_SPECULATION_CTRL, &num_1, &num_0, EINVAL, "PR_GET_SPECULATION_CTRL"},
{PR_SET_SECUREBITS, &num_0, &num_0, EPERM, "PR_SET_SECUREBITS"},
{PR_CAPBSET_DROP, &num_1, &num_0, EPERM, "PR_CAPBSET_DROP"},
};
@@ -141,7 +140,7 @@ static void verify_prctl(unsigned int n)
break;
}
- TEST(prctl(tc->option, *tc->arg2, *tc->arg3, 0, 0));
+ TEST(prctl(tc->option, *tc->arg2, *tc->arg3));
if (TST_RET == 0) {
tst_res(TFAIL, "prctl() succeeded unexpectedly");
return;
diff --git a/testcases/kernel/syscalls/prctl/prctl05.c b/testcases/kernel/syscalls/prctl/prctl05.c
index ae390fdfc..1f979007f 100644
--- a/testcases/kernel/syscalls/prctl/prctl05.c
+++ b/testcases/kernel/syscalls/prctl/prctl05.c
@@ -28,6 +28,18 @@ static struct tcase {
{"prctl05_test_xxxxx", "prctl05_test_xx"}
};
+static void check_proc_comm(char *path, char *name)
+{
+ char comm_buf[20];
+
+ SAFE_FILE_SCANF(path, "%s", comm_buf);
+ if (strcmp(name, comm_buf))
+ tst_res(TFAIL,
+ "%s has %s, expected %s", path, comm_buf, name);
+ else
+ tst_res(TPASS, "%s sets to %s", path, comm_buf);
+}
+
static void verify_prctl(unsigned int n)
{
char buf[20];
@@ -59,8 +71,9 @@ static void verify_prctl(unsigned int n)
tid = tst_syscall(__NR_gettid);
sprintf(comm_path, "/proc/self/task/%d/comm", tid);
- TST_ASSERT_STR(comm_path, tc->expname);
- TST_ASSERT_STR("/proc/self/comm", tc->expname);
+ check_proc_comm(comm_path, tc->expname);
+
+ check_proc_comm("/proc/self/comm", tc->expname);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/prctl/prctl06.c b/testcases/kernel/syscalls/prctl/prctl06.c
index 21d336c07..0e1274a2a 100644
--- a/testcases/kernel/syscalls/prctl/prctl06.c
+++ b/testcases/kernel/syscalls/prctl/prctl06.c
@@ -21,18 +21,16 @@
static uid_t nobody_uid;
static gid_t nobody_gid;
-static int proc_flag = 1;
-static char *proc_sup = "Yes";
static void do_prctl(void)
{
char ipc_env_var[1024];
- char *const argv[] = {BIN_PATH, "After execve, parent process", proc_sup, NULL};
- char *const childargv[] = {BIN_PATH, "After execve, child process", proc_sup, NULL};
+ char *const argv[] = {BIN_PATH, "After execve, parent process", NULL};
+ char *const childargv[] = {BIN_PATH, "After execve, child process", NULL};
char *const envp[] = {ipc_env_var, NULL };
int childpid;
- check_no_new_privs(0, "parent", proc_flag);
+ check_no_new_privs(0, "parent");
TEST(prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0));
if (TST_RET == -1) {
@@ -48,16 +46,16 @@ static void do_prctl(void)
childpid = SAFE_FORK();
if (childpid == 0) {
- check_no_new_privs(1, "After fork, child process", proc_flag);
+ check_no_new_privs(1, "After fork, child process");
execve(BIN_PATH, childargv, envp);
- tst_brk(TFAIL | TERRNO,
+ tst_brk(TFAIL | TTERRNO,
"child process failed to execute prctl_execve");
} else {
tst_reap_children();
- check_no_new_privs(1, "parent process", proc_flag);
+ check_no_new_privs(1, "parent process");
execve(BIN_PATH, argv, envp);
- tst_brk(TFAIL | TERRNO,
+ tst_brk(TFAIL | TTERRNO,
"parent process failed to execute prctl_execve");
}
}
@@ -76,7 +74,6 @@ static void verify_prctl(void)
static void setup(void)
{
struct passwd *pw;
- int field;
pw = SAFE_GETPWNAM("nobody");
nobody_uid = pw->pw_uid;
@@ -87,12 +84,6 @@ static void setup(void)
SAFE_CHOWN(BIN_PATH, 0, 0);
SAFE_CHMOD(BIN_PATH, SUID_MODE);
- if (FILE_LINES_SCANF(PROC_STATUS, "NoNewPrivs:%d", &field)) {
- tst_res(TCONF, "%s doesn't support NoNewPrivs field", PROC_STATUS);
- proc_flag = 0;
- proc_sup = "No";
- }
-
TEST(prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0));
if (TST_RET == 0) {
tst_res(TINFO, "kernel supports PR_GET/SET_NO_NEW_PRIVS");
diff --git a/testcases/kernel/syscalls/prctl/prctl06.h b/testcases/kernel/syscalls/prctl/prctl06.h
index 227ce3006..7f5be20bb 100644
--- a/testcases/kernel/syscalls/prctl/prctl06.h
+++ b/testcases/kernel/syscalls/prctl/prctl06.h
@@ -24,7 +24,30 @@
#define BIN_PATH MNTPOINT"/"TESTBIN
#define SUID_MODE (S_ISUID|S_ISGID|S_IXUSR|S_IXGRP|S_IXOTH)
-void check_no_new_privs(int val, char *name, int flag)
+void check_proc_field(int val, char *name)
+{
+ static int flag = 1;
+ int field = 0;
+
+ if (!flag)
+ return;
+
+ TEST(FILE_LINES_SCANF(PROC_STATUS, "NoNewPrivs:%d", &field));
+ if (TST_RET == 1) {
+ tst_res(TCONF,
+ "%s doesn't support NoNewPrivs field", PROC_STATUS);
+ flag = 0;
+ return;
+ }
+ if (val == field)
+ tst_res(TPASS, "%s %s NoNewPrivs field expected %d got %d",
+ name, PROC_STATUS, val, field);
+ else
+ tst_res(TFAIL, "%s %s NoNewPrivs field expected %d got %d",
+ name, PROC_STATUS, val, field);
+}
+
+void check_no_new_privs(int val, char *name)
{
TEST(prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0));
if (TST_RET == val)
@@ -35,8 +58,8 @@ void check_no_new_privs(int val, char *name, int flag)
tst_res(TFAIL,
"%s prctl(PR_GET_NO_NEW_PRIVS) expected %d got %ld",
name, val, TST_RET);
- if (flag)
- TST_ASSERT_FILE_INT(PROC_STATUS, "NoNewPrivs:", val);
+
+ check_proc_field(val, name);
}
#endif
diff --git a/testcases/kernel/syscalls/prctl/prctl06_execve.c b/testcases/kernel/syscalls/prctl/prctl06_execve.c
index cca261ac4..d1e60e6c2 100644
--- a/testcases/kernel/syscalls/prctl/prctl06_execve.c
+++ b/testcases/kernel/syscalls/prctl/prctl06_execve.c
@@ -12,19 +12,14 @@
int main(int argc, char **argv)
{
struct passwd *pw;
- int proc_flag;
pw = SAFE_GETPWNAM("nobody");
tst_reinit();
- if (argc != 3)
- tst_brk(TFAIL, "argc is %d, expected 3", argc);
-
- if (!strcmp(argv[2], "Yes"))
- proc_flag = 1;
- else
- proc_flag = 0;
- check_no_new_privs(1, argv[1], proc_flag);
+ if (argc != 2)
+ tst_brk(TFAIL, "argc is %d, expected 2", argc);
+
+ check_no_new_privs(1, argv[1]);
TEST(getegid());
if (TST_RET == 0)
diff --git a/testcases/kernel/syscalls/prctl/prctl07.c b/testcases/kernel/syscalls/prctl/prctl07.c
index d27cac26c..79f7710a8 100644
--- a/testcases/kernel/syscalls/prctl/prctl07.c
+++ b/testcases/kernel/syscalls/prctl/prctl07.c
@@ -34,9 +34,36 @@
#include "tst_test.h"
#define PROC_STATUS "/proc/self/status"
-#define ZERO_STRING "0000000000000000"
-/*CAP_NET_BIND_SERVICE stored in the CapAmb field of PROC_STATUS*/
-#define CAP_STRING "0000000000000400"
+
+#ifdef HAVE_SYS_CAPABILITY_H
+static void check_proc_capamb(char *message, int flag)
+{
+ int cap_num;
+ char CapAmb[20];
+
+ SAFE_FILE_LINES_SCANF(PROC_STATUS, "CapAmb:%s", CapAmb);
+ cap_num = strtol(CapAmb, NULL, 16);
+ if (flag == 2) {
+ if (cap_num == 0)
+ tst_res(TPASS,
+ "%s, %s CapAmb has been clear as %d",
+ message, PROC_STATUS, cap_num);
+ else
+ tst_res(TFAIL,
+ "%s, %s CapAmb has been clear expect 0, got %d",
+ message, PROC_STATUS, cap_num);
+ return;
+ }
+ if (cap_num == (1 << CAP_NET_BIND_SERVICE))
+ tst_res(flag ? TPASS : TFAIL,
+ "%s, CapAmb in %s has CAP_NET_BIND_SERVICE",
+ message, PROC_STATUS);
+ else
+ tst_res(flag ? TFAIL : TPASS,
+ "%s, CapAmb in %s doesn't have CAP_NET_BIND_SERVICE",
+ message, PROC_STATUS);
+}
+#endif
static inline void check_cap_raise(unsigned int cap, char *message, int fail_flag)
{
@@ -100,8 +127,7 @@ static void verify_prctl(void)
cap_set_flag(caps, CAP_PERMITTED, numcaps, caplist, CAP_SET);
cap_set_proc(caps);
- tst_res(TINFO, "At the beginning");
- TST_ASSERT_FILE_STR(PROC_STATUS, "CapAmb", ZERO_STRING);
+ check_proc_capamb("At the beginning", 0);
cap_clear_flag(caps, CAP_INHERITABLE);
cap_set_proc(caps);
@@ -122,17 +148,14 @@ static void verify_prctl(void)
/*Even this cap has been in ambient set, raise succeeds and return 0*/
check_cap_raise(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERIVCE twice", 0);
- tst_res(TINFO, "After PR_CAP_AMBIENT_RAISE");
- TST_ASSERT_FILE_STR(PROC_STATUS, "CapAmb", CAP_STRING);
+ check_proc_capamb("After PR_CAP_AMBIENT_RAISE", 1);
check_cap_is_set(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERVICE was", 1);
check_cap_is_set(CAP_NET_RAW, "CAP_NET_RAW was", 0);
/*move a cap what was not in ambient set, it also return 0*/
check_cap_lower(CAP_NET_RAW, "CAP_NET_RAW(it wasn't in ambient set)");
check_cap_lower(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERVICE(it was in ambient set)");
-
- tst_res(TINFO, "After PR_CAP_AMBIENT_LORWER");
- TST_ASSERT_FILE_STR(PROC_STATUS, "CapAmb", ZERO_STRING);
+ check_proc_capamb("After PR_CAP_AMBIENT_LORWER", 0);
prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0);
tst_res(TINFO, "raise cap for clear");
@@ -140,10 +163,9 @@ static void verify_prctl(void)
if (TST_RET == 0)
tst_res(TPASS, "PR_CAP_AMBIENT_CLEAR ALL succeeded");
else
- tst_res(TFAIL | TTERRNO, "PR_AMBIENT_CLEAR_ALL failed");
+ tst_res(TFAIL | TERRNO, "PR_AMBIENT_CLEAR_ALL failed");
- tst_res(TINFO, "After PR_CAP_AMBIENT_CLEAR_ALL");
- TST_ASSERT_FILE_STR(PROC_STATUS, "CapAmb", ZERO_STRING);
+ check_proc_capamb("After PR_CAP_AMBIENT_CLEAN_ALL", 2);
cap_free(caps);
#else
diff --git a/testcases/kernel/syscalls/prctl/prctl08.c b/testcases/kernel/syscalls/prctl/prctl08.c
index 9a1b34c17..fd8ccb6ad 100644
--- a/testcases/kernel/syscalls/prctl/prctl08.c
+++ b/testcases/kernel/syscalls/prctl/prctl08.c
@@ -53,6 +53,19 @@ static void check_reset_timerslack(char *message)
check_get_timerslack(message, origin_value);
}
+static void check_proc_timerslack(char *message, unsigned long value)
+{
+ unsigned long proc_value;
+
+ SAFE_FILE_SCANF(PROC_TIMERSLACK_PATH, "%lu", &proc_value);
+ if (proc_value == value)
+ tst_res(TPASS, "%s %s got %lu expectedly",
+ message, PROC_TIMERSLACK_PATH, proc_value);
+ else
+ tst_res(TFAIL, "%s %s expected %lu got %lu",
+ message, PROC_TIMERSLACK_PATH, value, proc_value);
+}
+
static void check_get_timerslack(char *message, unsigned long value)
{
TEST(prctl(PR_GET_TIMERSLACK));
@@ -64,7 +77,8 @@ static void check_get_timerslack(char *message, unsigned long value)
message, value, TST_RET);
if (proc_flag)
- TST_ASSERT_INT(PROC_TIMERSLACK_PATH, value);
+ check_proc_timerslack(message, value);
+
}
static void check_inherit_timerslack(char *message, unsigned long value)
diff --git a/testcases/kernel/syscalls/prctl/prctl09.c b/testcases/kernel/syscalls/prctl/prctl09.c
index 07ce57063..0d94df7b5 100644
--- a/testcases/kernel/syscalls/prctl/prctl09.c
+++ b/testcases/kernel/syscalls/prctl/prctl09.c
@@ -16,7 +16,7 @@
int sample_fn(int clk_id, long long usec)
{
- struct timespec t = tst_timespec_from_us(usec);
+ struct timespec t = tst_us_to_timespec(usec);
tst_timer_start(clk_id);
TEST(nanosleep(&t, NULL));
diff --git a/testcases/kernel/syscalls/pread/Makefile b/testcases/kernel/syscalls/pread/Makefile
index 518fad5f5..c006930f5 100644
--- a/testcases/kernel/syscalls/pread/Makefile
+++ b/testcases/kernel/syscalls/pread/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/preadv/Makefile b/testcases/kernel/syscalls/preadv/Makefile
index 0b209fe9d..764c956a8 100644
--- a/testcases/kernel/syscalls/preadv/Makefile
+++ b/testcases/kernel/syscalls/preadv/Makefile
@@ -1,6 +1,21 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2015 Fujitsu Ltd.
# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/preadv/preadv03.c b/testcases/kernel/syscalls/preadv/preadv03.c
index 59c3b84f7..c456d4105 100644
--- a/testcases/kernel/syscalls/preadv/preadv03.c
+++ b/testcases/kernel/syscalls/preadv/preadv03.c
@@ -135,8 +135,4 @@ static struct tst_test test = {
.mntpoint = MNTPOINT,
.mount_device = 1,
.all_filesystems = 1,
- .skip_filesystems = (const char *[]) {
- "tmpfs",
- NULL
- }
};
diff --git a/testcases/kernel/syscalls/preadv2/preadv203.c b/testcases/kernel/syscalls/preadv2/preadv203.c
index 01622ad15..47c46d526 100644
--- a/testcases/kernel/syscalls/preadv2/preadv203.c
+++ b/testcases/kernel/syscalls/preadv2/preadv203.c
@@ -235,7 +235,7 @@ static void check_preadv2_nowait(int fd)
TEST(preadv2(fd, iovec, 1, 0, RWF_NOWAIT));
if (TST_ERR == EOPNOTSUPP)
- tst_brk(TCONF | TTERRNO, "preadv2()");
+ tst_brk(TCONF | TERRNO, "preadv2()");
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/profil/Makefile b/testcases/kernel/syscalls/profil/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/profil/Makefile
+++ b/testcases/kernel/syscalls/profil/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/profil/profil01.c b/testcases/kernel/syscalls/profil/profil01.c
index a8254cb00..404f71517 100644
--- a/testcases/kernel/syscalls/profil/profil01.c
+++ b/testcases/kernel/syscalls/profil/profil01.c
@@ -82,7 +82,7 @@ static void test_profil(void)
* set scale to 2*65536 to have 1:1 mapping for $pc */
ret = profil(buf, sizeof(buf), offset, 2*65536);
if (ret)
- tst_brkm(TBROK, NULL, "profil returned: %d", ret);
+ tst_brkm(TBROK, NULL, "profil returned: %d\n", ret);
signal(SIGALRM, alrm_handler);
alarm(PROFIL_TIME);
diff --git a/testcases/kernel/syscalls/pselect/Makefile b/testcases/kernel/syscalls/pselect/Makefile
index a354c132e..2ad4c3968 100644
--- a/testcases/kernel/syscalls/pselect/Makefile
+++ b/testcases/kernel/syscalls/pselect/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pselect/pselect01.c b/testcases/kernel/syscalls/pselect/pselect01.c
index 5b2b8b3ba..0052b97ab 100644
--- a/testcases/kernel/syscalls/pselect/pselect01.c
+++ b/testcases/kernel/syscalls/pselect/pselect01.c
@@ -1,6 +1,18 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sys/select.h>
#include <sys/time.h>
@@ -12,7 +24,7 @@
int sample_fn(int clk_id, long long usec)
{
fd_set readfds;
- struct timespec tv = tst_timespec_from_us(usec);
+ struct timespec tv = tst_us_to_timespec(usec);
FD_ZERO(&readfds);
FD_SET(0, &readfds);
diff --git a/testcases/kernel/syscalls/ptrace/.gitignore b/testcases/kernel/syscalls/ptrace/.gitignore
index 01cbc6072..70629112f 100644
--- a/testcases/kernel/syscalls/ptrace/.gitignore
+++ b/testcases/kernel/syscalls/ptrace/.gitignore
@@ -4,7 +4,3 @@
/ptrace04
/ptrace05
/ptrace07
-/ptrace08
-/ptrace09
-/ptrace10
-/ptrace11
diff --git a/testcases/kernel/syscalls/ptrace/Makefile b/testcases/kernel/syscalls/ptrace/Makefile
index 9ee7b8374..078792b3c 100644
--- a/testcases/kernel/syscalls/ptrace/Makefile
+++ b/testcases/kernel/syscalls/ptrace/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/ptrace/ptrace01.c b/testcases/kernel/syscalls/ptrace/ptrace01.c
index 9071bbaba..274e5389b 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace01.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace01.c
@@ -1,22 +1,20 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * Copyright (c) 2019 SUSE LLC
+ * Copyright (c) 2019 Jorik Cronenberg <jcronenberg@suse.de>
*
* Author: Saji Kumar.V.R <saji.kumar@wipro.com>
* Ported to new library: Jorik Cronenberg <jcronenberg@suse.de>
*
- * Test the functionality of ptrace() for PTRACE_TRACEME in combination with
- * PTRACE_KILL and PTRACE_CONT requests.
+ * Test the functionality of ptrace() for PTRACE_TRACEME & PTRACE_KILL requests.
* Forked child does ptrace(PTRACE_TRACEME, ...).
* Then a signal is delivered to the child and verified that parent
* is notified via wait().
- * Afterwards parent does ptrace(PTRACE_KILL, ..)/ptrace(PTRACE_CONT, ..)
- * and then parent does wait() for child to finish.
- * Test passes if child exits with SIGKILL for PTRACE_KILL.
- * Test passes if child exits normally for PTRACE_CONT.
+ * After parent does ptrace(PTRACE_KILL, ..) to kill the child
+ * and parent wait() for child to finish.
+ * Test passes if child finished abnormally.
*
- * Testing two cases for each:
+ * Testing two cases:
* 1) child ignore SIGUSR2 signal
* 2) using a signal handler for child for SIGUSR2
* In both cases, child should stop & notify parent on reception of SIGUSR2.
@@ -30,19 +28,6 @@
#include "ptrace.h"
#include "tst_test.h"
-static struct tcase {
- int handler;
- int request;
- int exp_wifexited;
- int exp_wtermsig;
- char *message;
-} tcases[] = {
- {0, PTRACE_KILL, 0, 9, "Testing PTRACE_KILL without child handler"},
- {1, PTRACE_KILL, 0, 9, "Testing PTRACE_KILL with child handler"},
- {0, PTRACE_CONT, 1, 0, "Testing PTRACE_CONT without child handler"},
- {1, PTRACE_CONT, 1, 0, "Testing PTRACE_CONT with child handler"},
-};
-
static volatile int got_signal;
static void child_handler(int sig LTP_ATTRIBUTE_UNUSED)
@@ -79,16 +64,13 @@ static void do_child(unsigned int i)
static void run(unsigned int i)
{
- struct tcase *tc = &tcases[i];
pid_t child_pid;
int status;
struct sigaction parent_act;
got_signal = 0;
- tst_res(TINFO, "%s", tc->message);
-
- if (tc->handler == 1) {
+ if (i == 1) {
parent_act.sa_handler = parent_handler;
parent_act.sa_flags = SA_RESTART;
sigemptyset(&parent_act.sa_mask);
@@ -98,32 +80,28 @@ static void run(unsigned int i)
child_pid = SAFE_FORK();
if (!child_pid)
- do_child(tc->handler);
+ do_child(i);
SAFE_WAITPID(child_pid, &status, 0);
if (((WIFEXITED(status)) && (WEXITSTATUS(status)))
|| (got_signal == 1))
tst_res(TFAIL, "Test Failed");
- else if ((ptrace(tc->request, child_pid, 0, 0)) == -1)
- tst_res(TFAIL | TERRNO, "ptrace(%i, %i, 0, 0) failed",
- tc->request, child_pid);
+ else if ((ptrace(PTRACE_KILL, child_pid, 0, 0)) == -1)
+ tst_res(TFAIL | TERRNO, "ptrace(PTRACE_KILL, %i, 0, 0) failed",
+ child_pid);
SAFE_WAITPID(child_pid, &status, 0);
- if ((tc->request == PTRACE_CONT &&
- WIFEXITED(status) && WEXITSTATUS(status) == tc->exp_wifexited) ||
- (tc->request == PTRACE_KILL &&
- WIFSIGNALED(status) && WTERMSIG(status) == tc->exp_wtermsig)) {
+ if (WTERMSIG(status) == 9)
tst_res(TPASS, "Child %s as expected", tst_strstatus(status));
- } else {
+ else
tst_res(TFAIL, "Child %s unexpectedly", tst_strstatus(status));
- }
}
static struct tst_test test = {
.test = run,
- .tcnt = ARRAY_SIZE(tcases),
+ .tcnt = 2,
.forks_child = 1,
};
diff --git a/testcases/kernel/syscalls/ptrace/ptrace02.c b/testcases/kernel/syscalls/ptrace/ptrace02.c
index e330f459e..057591f62 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace02.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace02.c
@@ -1,69 +1,288 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * ptrace() returns -1 and sets errno to EPERM if tracer doesn't have
- * CAP_SYS_PTRACE capability for the process. Such as nobody user.
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : ptrace02
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : functionality test for ptrace(2)
+ *
+ * TEST CASE TOTAL : 2
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This test case tests the functionality of ptrace() for
+ * PTRACE_TRACEME & PTRACE_CONT requests.
+ * Here, we fork a child & the child does ptrace(PTRACE_TRACEME, ...).
+ * Then a signal is delivered to the child & verified that parent
+ * is notified via wait(). then parent does ptrace(PTRACE_CONT, ..)
+ * to make the child to continue. Again parent wait() for child to finish.
+ * If child finished normally, test passes.
+ * We test two cases
+ * 1) By telling child to ignore SIGUSR2 signal
+ * 2) By installing a signal handler for child for SIGUSR2
+ * In both cases, child should stop & notify parent on reception
+ * of SIGUSR2
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * setup signal handler for SIGUSR2 signal
+ * fork a child
+ *
+ * CHILD:
+ * setup signal handler for SIGUSR2 signal
+ * call ptrace() with PTRACE_TRACEME request
+ * send SIGUSR2 signal to self
+ * PARENT:
+ * wait() for child.
+ * if parent is notified when child gets a signal through wait(),
+ * then
+ * do ptrace(PTRACE_CONT, ..) on child
+ * wait() for child to finish,
+ * if child exited normaly,
+ * TEST passed
+ * else
+ * TEST failed
+ * else
+ * TEST failed
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * ptrace02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
-#include <pwd.h>
+
#include <config.h>
-#include <stdlib.h>
#include "ptrace.h"
-#include "tst_test.h"
-uid_t uid;
+#include "test.h"
-static void verify_ptrace(void)
+static void do_child(void);
+static void setup(void);
+static void cleanup(void);
+static void child_handler();
+static void parent_handler();
+
+static int got_signal = 0;
+
+char *TCID = "ptrace02";
+static int i; /* loop test case counter, shared with do_child */
+
+int TST_TOTAL = 2;
+
+int main(int ac, char **av)
{
- int child_pid[2];
- child_pid[0] = SAFE_FORK();
- if (!child_pid[0])
- pause();
+ int lc;
+ pid_t child_pid;
+ int status;
+ struct sigaction parent_act;
- child_pid[1] = SAFE_FORK();
- if (!child_pid[1]) {
- SAFE_SETUID(uid);
- TEST(ptrace(PTRACE_ATTACH, child_pid[0], NULL, NULL));
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ maybe_run_child(&do_child, "d", &i);
+#endif
- if (TST_RET == 0) {
- tst_res(TFAIL, "ptrace() succeeded unexpectedly");
- exit(0);
- }
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; ++i) {
+ got_signal = 0;
+
+ /* Setup signal handler for parent */
+ if (i == 1) {
+ parent_act.sa_handler = parent_handler;
+ parent_act.sa_flags = SA_RESTART;
+ sigemptyset(&parent_act.sa_mask);
+
+ if ((sigaction(SIGUSR2, &parent_act, NULL))
+ == -1) {
+ tst_resm(TWARN, "sigaction() failed"
+ " in parent");
+ continue;
+ }
+ }
+
+ switch (child_pid = FORK_OR_VFORK()) {
+
+ case -1:
+ /* fork() failed */
+ tst_resm(TFAIL, "fork() failed");
+ continue;
+
+ case 0:
+ /* Child */
+#ifdef UCLINUX
+ if (self_exec(av[0], "d", i) < 0) {
+ tst_resm(TFAIL, "self_exec failed");
+ continue;
+ }
+#else
+ do_child();
+#endif
+
+ default:
+ /* Parent */
+ if ((waitpid(child_pid, &status, 0)) < 0) {
+ tst_resm(TFAIL, "waitpid() failed");
+ continue;
+ }
+
+ /*
+ * Check the exit status of child. If (it exits
+ * normally with exit value 1) OR (child came
+ * through signal handler), Test Failed
+ */
+
+ if (((WIFEXITED(status)) &&
+ (WEXITSTATUS(status))) ||
+ (got_signal == 1)) {
+ tst_resm(TFAIL, "Test Failed");
+ continue;
+ } else {
+ /* Restart child */
+ if ((ptrace(PTRACE_CONT, child_pid,
+ 0, 0)) == -1) {
+ tst_resm(TFAIL, "Test Failed:"
+ " Parent was not able to do"
+ " ptrace(PTRACE_CONT, ..) on"
+ " child");
+ continue;
+ }
+ }
+
+ if ((waitpid(child_pid, &status, 0)) < 0) {
+ tst_resm(TFAIL, "waitpid() failed");
+ continue;
+ }
- if (TST_RET != -1) {
- tst_res(TFAIL,
- "Invalid ptrace() return value %ld", TST_RET);
- exit(0);
+ if (WIFEXITED(status)) {
+ /* Child exits normally */
+ tst_resm(TPASS, "Test Passed");
+ } else {
+ tst_resm(TFAIL, "Test Failed");
+ }
+
+ }
}
+ }
+
+ /* cleanup and exit */
+ cleanup();
+ tst_exit();
+
+}
+
+/* do_child() */
+void do_child(void)
+{
+ struct sigaction child_act;
+
+ /* Setup signal handler for child */
+ if (i == 0) {
+ child_act.sa_handler = SIG_IGN;
+ } else {
+ child_act.sa_handler = child_handler;
+ }
+ child_act.sa_flags = SA_RESTART;
+ sigemptyset(&child_act.sa_mask);
- if (TST_ERR == EPERM)
- tst_res(TPASS | TTERRNO, "ptrace() failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "ptrace() expected EPERM, but got");
- exit(0);
+ if ((sigaction(SIGUSR2, &child_act, NULL)) == -1) {
+ tst_resm(TWARN, "sigaction() failed in child");
+ exit(1);
}
- SAFE_WAITPID(child_pid[1], NULL, 0);
- SAFE_KILL(child_pid[0], SIGKILL);
- SAFE_WAITPID(child_pid[0], NULL, 0);
+
+ if ((ptrace(PTRACE_TRACEME, 0, 0, 0)) == -1) {
+ tst_resm(TWARN, "ptrace() failed in child");
+ exit(1);
+ }
+
+ /* ensure that child bypasses signal handler */
+ if ((kill(getpid(), SIGUSR2)) == -1) {
+ tst_resm(TWARN, "kill() failed in child");
+ exit(1);
+ }
+ exit(1);
}
-static void setup(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- struct passwd *pw;
- pw = SAFE_GETPWNAM("nobody");
- uid = pw->pw_uid;
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
}
-static struct tst_test test = {
- .setup = setup,
- .test_all = verify_ptrace,
- .forks_child = 1,
- .needs_root = 1,
-};
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+}
+
+/*
+ * child_handler() - Signal handler for child
+ */
+void child_handler(void)
+{
+
+ if ((kill(getppid(), SIGUSR2)) == -1) {
+ tst_resm(TWARN, "kill() failed in child_handler()");
+ exit(1);
+ }
+}
+
+/*
+ * parent_handler() - Signal handler for parent
+ */
+void parent_handler(void)
+{
+
+ got_signal = 1;
+}
diff --git a/testcases/kernel/syscalls/ptrace/ptrace03.c b/testcases/kernel/syscalls/ptrace/ptrace03.c
index b2b3fb49d..f326b834d 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace03.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace03.c
@@ -1,74 +1,217 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
*
- * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * 1) ptrace() returns -1 and sets errno to ESRCH if process with
- * specified pid does not exist.
- * 2) ptrace() returns -1 and sets errno to EPERM if we are trying
- * to trace a process which is already been traced
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : ptrace03
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Tests for error conditions
+ *
+ * TEST CASE TOTAL : 3
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verifies that
+ * 1) ptrace() returns -1 & sets errno to EPERM while tring to trace
+ * process 1
+ * (This test case will be executed only if the kernel version
+ * is 2.6.25 or below)
+ * 2) ptrace() returns -1 & sets errno to ESRCH if process with
+ * specified pid does not exist
+ * 3) ptrace() returns -1 & sets errno to EPERM if we are trying
+ * to trace a process which is already been traced
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * setup signal handler for SIGUSR2 signal
+ * fork a child
+ *
+ * CHILD:
+ * call ptrace() with proper arguments
+ * if ptrace() failed with expected return value & errno
+ * exit with errno
+ * else
+ * Give proper error message
+ * exit with errno
+ *
+ * PARENT:
+ * Wait for child to finish
+ * if child exits with expected errno
+ * Test Passed
+ * else
+ * Test failed
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * ptrace03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <pwd.h>
+
#include <config.h>
-#include <stdlib.h>
#include "ptrace.h"
-#include "tst_test.h"
+#include "test.h"
+
+static void setup(void);
+static void cleanup(void);
+
+char *TCID = "ptrace03";
+
+static pid_t init_pid = 1;
static pid_t unused_pid;
static pid_t zero_pid;
-static struct tcase {
+struct test_case_t {
int request;
pid_t *pid;
int exp_errno;
- char *tname;
-} tcases[] = {
- {PTRACE_ATTACH, &unused_pid, ESRCH,
- "Trace a process which does not exist"},
+} test_cases[] = {
+ {
+ PTRACE_ATTACH, &init_pid, EPERM}, {
+ PTRACE_ATTACH, &unused_pid, ESRCH}, {
+ PTRACE_TRACEME, &zero_pid, EPERM},};
- {PTRACE_TRACEME, &zero_pid, EPERM,
- "Trace a process which is already been traced"}
-};
+int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-static void verify_ptrace(unsigned int n)
+int main(int ac, char **av)
{
- struct tcase *tc = &tcases[n];
- int child_pid;
- tst_res(TINFO, "%s", tc->tname);
+ int lc, i;
+ pid_t child_pid;
+ int status;
- child_pid = SAFE_FORK();
- if (!child_pid) {
- if (tc->exp_errno == EPERM)
- SAFE_PTRACE(PTRACE_TRACEME, 0, NULL, NULL);
+ tst_parse_opts(ac, av, NULL, NULL);
- TEST(ptrace(tc->request, *(tc->pid), NULL, NULL));
- if (TST_RET == 0) {
- tst_res(TFAIL, "ptrace() succeeded unexpectedly");
- exit(1);
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; ++i) {
+
+ /* since Linux 2.6.26, it's allowed to trace init,
+ so just skip this test case */
+ if (i == 0 && tst_kvercmp(2, 6, 25) > 0) {
+ tst_resm(TCONF,
+ "this kernel allows to trace init");
+ continue;
+ }
+
+ /* fork() */
+ switch (child_pid = FORK_OR_VFORK()) {
+
+ case -1:
+ /* fork() failed */
+ tst_resm(TFAIL, "fork() failed");
+ continue;
+
+ case 0:
+ /* Child */
+
+ /* setup for third test case */
+ if (i == 2) {
+ if ((ptrace(PTRACE_TRACEME, 0,
+ NULL, NULL)) == -1) {
+ tst_resm(TWARN, "ptrace()"
+ " falied with errno, %d : %s",
+ errno,
+ strerror(errno));
+ exit(0);
+ }
+ }
+
+ TEST(ptrace(test_cases[i].request,
+ *(test_cases[i].pid), NULL, NULL));
+ if ((TEST_RETURN == -1) && (TEST_ERRNO ==
+ test_cases
+ [i].exp_errno)) {
+ exit(TEST_ERRNO);
+ } else {
+ tst_resm(TWARN | TTERRNO,
+ "ptrace() returned %ld",
+ TEST_RETURN);
+ exit(TEST_ERRNO);
+ }
+
+ default:
+ /* Parent */
+ if ((waitpid(child_pid, &status, 0)) < 0) {
+ tst_resm(TFAIL, "waitpid() failed");
+ continue;
+ }
+ if ((WIFEXITED(status)) &&
+ (WEXITSTATUS(status) ==
+ test_cases[i].exp_errno)) {
+ tst_resm(TPASS, "Test Passed");
+ } else {
+ tst_resm(TFAIL, "Test Failed");
+ }
+ }
}
- if (tc->exp_errno == TST_ERR)
- tst_res(TPASS | TTERRNO, "ptrace() failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "ptrace() failed unexpectedly, expected %s",
- tst_strerrno(tc->exp_errno));
}
- tst_reap_children();
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
+
}
-static void setup(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- unused_pid = tst_get_unused_pid();
+ unused_pid = tst_get_unused_pid(cleanup);
+
+ TEST_PAUSE;
+
}
-static struct tst_test test = {
- .test = verify_ptrace,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .forks_child = 1,
-};
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/ptrace/ptrace08.c b/testcases/kernel/syscalls/ptrace/ptrace08.c
deleted file mode 100644
index f86f69a9c..000000000
--- a/testcases/kernel/syscalls/ptrace/ptrace08.c
+++ /dev/null
@@ -1,176 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2018 Andrew Lutomirski
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2018-1000199
- *
- * Test error handling when ptrace(POKEUSER) modified x86 debug registers even
- * when the call returned error.
- *
- * When the bug was present we could create breakpoint in the kernel code,
- * which shoudn't be possible at all. The original CVE caused a kernel crash by
- * setting a breakpoint on do_debug kernel function which, when triggered,
- * caused an infinite loop. However we do not have to crash the kernel in order
- * to assert if kernel has been fixed or not.
- *
- * On newer kernels all we have to do is to try to set a breakpoint, on any
- * kernel address, then read it back and check if the value has been set or
- * not.
- *
- * The original fix to the CVE however disabled a breakpoint on address change
- * and the check was deffered to write dr7 that enabled the breakpoint again.
- * So on older kernels we have to write to dr7 which should fail instead.
- *
- * Kernel crash partially fixed in:
- *
- * commit f67b15037a7a50c57f72e69a6d59941ad90a0f0f
- * Author: Linus Torvalds <torvalds@linux-foundation.org>
- * Date: Mon Mar 26 15:39:07 2018 -1000
- *
- * perf/hwbp: Simplify the perf-hwbp code, fix documentation
- *
- * On Centos7, this is also a regression test for
- * commit 27747f8bc355 ("perf/x86/hw_breakpoints: Fix check for kernel-space breakpoints").
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <signal.h>
-#include "tst_test.h"
-#include "tst_safe_stdio.h"
-
-#if defined(__i386__) || defined(__x86_64__)
-
-static pid_t child_pid;
-
-#if defined(__x86_64__)
-# define KERN_ADDR_MIN 0xffff800000000000
-# define KERN_ADDR_MAX 0xffffffffffffffff
-# define KERN_ADDR_BITS 64
-#elif defined(__i386__)
-# define KERN_ADDR_MIN 0xc0000000
-# define KERN_ADDR_MAX 0xffffffff
-# define KERN_ADDR_BITS 32
-#endif
-
-static int deffered_check;
-
-static struct tst_kern_exv kvers[] = {
- {"RHEL8", "4.18.0-49"},
- {NULL, NULL},
-};
-
-static void setup(void)
-{
- /*
- * When running in compat mode we can't pass 64 address to ptrace so we
- * have to skip the test.
- */
- if (tst_kernel_bits() != KERN_ADDR_BITS)
- tst_brk(TCONF, "Cannot pass 64bit kernel address in compat mode");
-
-
- /*
- * The original fix for the kernel haven't rejected the kernel address
- * right away when breakpoint was modified from userspace it was
- * disabled instead and the EINVAL was returned when dr7 was written to
- * enable it again. On RHEL8, it has introduced the right fix since
- * 4.18.0-49.
- */
- if (tst_kvercmp2(4, 19, 0, kvers) < 0)
- deffered_check = 1;
-}
-
-static void child_main(void)
-{
- raise(SIGSTOP);
- exit(0);
-}
-
-static void ptrace_try_kern_addr(unsigned long kern_addr)
-{
- int status;
- unsigned long addr;
-
- tst_res(TINFO, "Trying address 0x%lx", kern_addr);
-
- child_pid = SAFE_FORK();
-
- if (!child_pid)
- child_main();
-
- if (SAFE_WAITPID(child_pid, &status, WUNTRACED) != child_pid)
- tst_brk(TBROK, "Received event from unexpected PID");
-
- SAFE_PTRACE(PTRACE_ATTACH, child_pid, NULL, NULL);
- SAFE_PTRACE(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[0]), (void *)1);
- SAFE_PTRACE(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[7]), (void *)1);
-
- TEST(ptrace(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[0]),
- (void *)kern_addr));
-
- if (deffered_check) {
- TEST(ptrace(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[7]), (void *)1));
- }
-
- if (TST_RET != -1) {
- tst_res(TFAIL, "ptrace() breakpoint with kernel addr succeeded");
- } else {
- if (TST_ERR == EINVAL) {
- tst_res(TPASS | TTERRNO,
- "ptrace() breakpoint with kernel addr failed");
- } else {
- tst_res(TFAIL | TTERRNO,
- "ptrace() breakpoint on kernel addr should return EINVAL, got");
- }
- }
-
- addr = ptrace(PTRACE_PEEKUSER, child_pid,
- (void*)offsetof(struct user, u_debugreg[0]), NULL);
-
- if (!deffered_check && addr == kern_addr)
- tst_res(TFAIL, "Was able to set breakpoint on kernel addr");
-
- SAFE_PTRACE(PTRACE_DETACH, child_pid, NULL, NULL);
- SAFE_KILL(child_pid, SIGCONT);
- child_pid = 0;
- tst_reap_children();
-}
-
-static void run(void)
-{
- ptrace_try_kern_addr(KERN_ADDR_MIN);
- ptrace_try_kern_addr(KERN_ADDR_MAX);
- ptrace_try_kern_addr(KERN_ADDR_MIN + (KERN_ADDR_MAX - KERN_ADDR_MIN)/2);
-}
-
-static void cleanup(void)
-{
- /* Main process terminated by tst_brk() with child still paused */
- if (child_pid)
- SAFE_KILL(child_pid, SIGKILL);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .forks_child = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "f67b15037a7a"},
- {"CVE", "2018-1000199"},
- {"linux-git", "27747f8bc355"},
- {}
- }
-};
-#else
-TST_TEST_TCONF("This test is only supported on x86 systems");
-#endif
diff --git a/testcases/kernel/syscalls/ptrace/ptrace09.c b/testcases/kernel/syscalls/ptrace/ptrace09.c
deleted file mode 100644
index 85875ce65..000000000
--- a/testcases/kernel/syscalls/ptrace/ptrace09.c
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2018 SUSE LLC <nstange@suse.de>
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2018-8897
- *
- * Test that the MOV SS instruction touching a ptrace watchpoint followed by
- * INT3 breakpoint is handled correctly by the kernel. Kernel crash fixed in:
- *
- * commit d8ba61ba58c88d5207c1ba2f7d9a2280e7d03be9
- * Author: Andy Lutomirski <luto@kernel.org>
- * Date: Thu Jul 23 15:37:48 2015 -0700
- *
- * x86/entry/64: Don't use IST entry for #BP stack
- */
-
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <signal.h>
-#include "tst_test.h"
-
-#if defined(__i386__) || defined(__x86_64__)
-static short watchpoint;
-static pid_t child_pid;
-
-static int child_main(void)
-{
- SAFE_PTRACE(PTRACE_TRACEME, 0, NULL, NULL);
- raise(SIGSTOP);
- /* wait for SIGCONT from parent */
-
- asm volatile(
- "mov %%ss, %0\n"
- "mov %0, %%ss\n"
- "int $3\n"
- : "+m" (watchpoint)
- );
-
- return 0;
-}
-
-static void run(void)
-{
- int status;
-
- child_pid = SAFE_FORK();
-
- if (!child_pid) {
- exit(child_main());
- }
-
- if (SAFE_WAITPID(child_pid, &status, 0) != child_pid)
- tst_brk(TBROK, "Received event from unexpected PID");
-
- SAFE_PTRACE(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[0]), &watchpoint);
- SAFE_PTRACE(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[7]), (void *)0x30001);
- SAFE_PTRACE(PTRACE_CONT, child_pid, NULL, NULL);
-
- while (1) {
- if (SAFE_WAITPID(child_pid, &status, 0) != child_pid)
- tst_brk(TBROK, "Received event from unexpected PID");
-
- if (WIFEXITED(status)) {
- child_pid = 0;
- break;
- }
-
- if (WIFSTOPPED(status)) {
- SAFE_PTRACE(PTRACE_CONT, child_pid, NULL, NULL);
- continue;
- }
-
- tst_brk(TBROK, "Unexpected event from child");
- }
-
- tst_res(TPASS, "We're still here. Nothing bad happened, probably.");
-}
-
-static void cleanup(void)
-{
- /* Main process terminated by tst_brk() with child still paused */
- if (child_pid)
- SAFE_KILL(child_pid, SIGKILL);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .cleanup = cleanup,
- .forks_child = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "d8ba61ba58c8"},
- {"CVE", "2018-8897"},
- {}
- }
-};
-#else
-TST_TEST_TCONF("This test is only supported on x86 systems");
-#endif
diff --git a/testcases/kernel/syscalls/ptrace/ptrace10.c b/testcases/kernel/syscalls/ptrace/ptrace10.c
deleted file mode 100644
index b5d6b9f8f..000000000
--- a/testcases/kernel/syscalls/ptrace/ptrace10.c
+++ /dev/null
@@ -1,86 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Cyril Hrubis <chrbis@suse.cz>
- *
- * After fix for CVE-2018-1000199 (see ptrace08.c) subsequent calls to POKEUSER
- * for x86 debug registers were ignored silently.
- *
- * This is a regression test for commit:
- *
- * commit bd14406b78e6daa1ea3c1673bda1ffc9efdeead0
- * Author: Jiri Olsa <jolsa@kernel.org>
- * Date: Mon Aug 27 11:12:25 2018 +0200
- *
- * perf/hw_breakpoint: Modify breakpoint even if the new attr has disabled set
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <signal.h>
-#include "tst_test.h"
-
-#if defined(__i386__) || defined(__x86_64__)
-
-static pid_t child_pid;
-
-static void child_main(void)
-{
- raise(SIGSTOP);
- exit(0);
-}
-
-static void run(void)
-{
- int status;
- unsigned long addr;
-
- child_pid = SAFE_FORK();
-
- if (!child_pid)
- child_main();
-
- if (SAFE_WAITPID(child_pid, &status, WUNTRACED) != child_pid)
- tst_brk(TBROK, "Received event from unexpected PID");
-
- SAFE_PTRACE(PTRACE_ATTACH, child_pid, NULL, NULL);
- SAFE_PTRACE(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[0]), (void *)1);
- SAFE_PTRACE(PTRACE_POKEUSER, child_pid,
- (void *)offsetof(struct user, u_debugreg[0]), (void *)2);
-
- addr = ptrace(PTRACE_PEEKUSER, child_pid,
- (void*)offsetof(struct user, u_debugreg[0]), NULL);
-
- if (addr == 2)
- tst_res(TPASS, "The rd0 was set on second PTRACE_POKEUSR");
- else
- tst_res(TFAIL, "The rd0 wasn't set on second PTRACE_POKEUSER");
-
- SAFE_PTRACE(PTRACE_DETACH, child_pid, NULL, NULL);
- SAFE_KILL(child_pid, SIGCONT);
- child_pid = 0;
- tst_reap_children();
-}
-
-static void cleanup(void)
-{
- /* Main process terminated by tst_brk() with child still paused */
- if (child_pid)
- SAFE_KILL(child_pid, SIGKILL);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .cleanup = cleanup,
- .forks_child = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "bd14406b78e6"},
- {}
- }
-};
-#else
-TST_TEST_TCONF("This test is only supported on x86 systems");
-#endif
diff --git a/testcases/kernel/syscalls/ptrace/ptrace11.c b/testcases/kernel/syscalls/ptrace/ptrace11.c
deleted file mode 100644
index c54441671..000000000
--- a/testcases/kernel/syscalls/ptrace/ptrace11.c
+++ /dev/null
@@ -1,45 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- */
-
-/*\
- * [Description]
- *
- * Before kernel 2.6.26 we could not trace init(1) process and ptrace() would
- * fail with EPERM. This case just checks whether we can trace init(1) process
- * successfully.
- */
-
-#include <errno.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <pwd.h>
-#include <config.h>
-#include <stdlib.h>
-#include "ptrace.h"
-#include "tst_test.h"
-
-static void verify_ptrace(void)
-{
- TEST(ptrace(PTRACE_ATTACH, 1, NULL, NULL));
- if (TST_RET == 0)
- tst_res(TPASS, "ptrace() traces init process successfully");
- else
- tst_res(TFAIL | TTERRNO,
- "ptrace() returns %ld, failed unexpectedly", TST_RET);
-
- /*
- * Wait until tracee is stopped by SIGSTOP otherwise detach will fail
- * with ESRCH.
- */
- SAFE_WAITPID(1, NULL, 0);
-
- SAFE_PTRACE(PTRACE_DETACH, 1, NULL, NULL);
-}
-
-static struct tst_test test = {
- .test_all = verify_ptrace,
- .needs_root = 1,
-};
diff --git a/testcases/kernel/syscalls/pwrite/Makefile b/testcases/kernel/syscalls/pwrite/Makefile
index 25dfccf90..1defdf44c 100644
--- a/testcases/kernel/syscalls/pwrite/Makefile
+++ b/testcases/kernel/syscalls/pwrite/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/pwritev/pwritev03.c b/testcases/kernel/syscalls/pwritev/pwritev03.c
index 91a5e3c54..f32c368c0 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev03.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev03.c
@@ -134,8 +134,4 @@ static struct tst_test test = {
.mntpoint = MNTPOINT,
.mount_device = 1,
.all_filesystems = 1,
- .skip_filesystems = (const char *[]){
- "tmpfs",
- NULL
- }
};
diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore
index 8d2ef94d9..12896d6ad 100644
--- a/testcases/kernel/syscalls/quotactl/.gitignore
+++ b/testcases/kernel/syscalls/quotactl/.gitignore
@@ -4,4 +4,3 @@
/quotactl04
/quotactl05
/quotactl06
-/quotactl07
diff --git a/testcases/kernel/syscalls/quotactl/Makefile b/testcases/kernel/syscalls/quotactl/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/quotactl/Makefile
+++ b/testcases/kernel/syscalls/quotactl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index 56146b595..ede61d7e4 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -53,8 +53,6 @@
static int32_t fmt_id = FMTID;
static int test_id;
-static char usrpath[] = USRPATH;
-static char grppath[] = GRPPATH;
static struct dqblk set_dq = {
.dqb_bsoftlimit = 100,
.dqb_valid = QIF_BLIMITS
@@ -81,7 +79,7 @@ static struct tcase {
char *des;
char *tname;
} tcases[] = {
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath,
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH,
NULL, NULL, 0, "turn on quota for user",
"QCMD(Q_QUOTAON, USRQUOTA)"},
@@ -117,11 +115,11 @@ static struct tcase {
"get next disk quota limit for user",
"QCMD(Q_GETNEXTQUOTA, USRQUOTA)"},
- {QCMD(Q_QUOTAOFF, USRQUOTA), &test_id, usrpath,
+ {QCMD(Q_QUOTAOFF, USRQUOTA), &test_id, USRPATH,
NULL, NULL, 0, "turn off quota for user",
"QCMD(Q_QUOTAOFF, USRQUOTA)"},
- {QCMD(Q_QUOTAON, GRPQUOTA), &fmt_id, grppath,
+ {QCMD(Q_QUOTAON, GRPQUOTA), &fmt_id, GRPPATH,
NULL, NULL, 0, "turn on quota for group",
"QCMD(Q_QUOTAON, GRPQUOTA)"},
@@ -156,7 +154,7 @@ static struct tcase {
"get next disk quota limit for group",
"QCMD(Q_GETNEXTQUOTA, GRPQUOTA)"},
- {QCMD(Q_QUOTAOFF, GRPQUOTA), &test_id, grppath,
+ {QCMD(Q_QUOTAOFF, GRPQUOTA), &test_id, GRPPATH,
NULL, NULL, 0, "turn off quota for group",
"QCMD(Q_QUOTAOFF, GRPQUOTA)"},
};
@@ -164,8 +162,18 @@ static struct tcase {
static void setup(void)
{
const char *const cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
-
- SAFE_CMD(cmd, NULL, NULL);
+ int ret;
+
+ ret = tst_run_cmd(cmd, NULL, NULL, 1);
+ switch (ret) {
+ case 0:
+ break;
+ case 255:
+ tst_brk(TCONF, "quotacheck binary not installed");
+ break;
+ default:
+ tst_brk(TBROK, "quotacheck exited with %i", ret);
+ }
test_id = geteuid();
if (access(USRPATH, F_OK) == -1)
@@ -174,8 +182,6 @@ static void setup(void)
if (access(GRPPATH, F_OK) == -1)
tst_brk(TFAIL | TERRNO, "group quotafile didn't exist");
- tst_require_quota_support(tst_device->dev, fmt_id, usrpath);
-
TEST(quotactl(QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev,
test_id, (void *) &res_ndq));
if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
@@ -214,21 +220,19 @@ static void verify_quota(unsigned int n)
tst_res(TPASS, "quotactl succeeded to %s", tc->des);
}
+static const char *kconfigs[] = {
+ "CONFIG_QFMT_V2",
+ NULL
+};
+
static struct tst_test test = {
.needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_QFMT_V2",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.test = verify_quota,
.tcnt = ARRAY_SIZE(tcases),
.mount_device = 1,
.dev_fs_type = "ext4",
.mntpoint = MNTPOINT,
.mnt_data = "usrquota,grpquota",
- .needs_cmds = (const char *const []) {
- "quotacheck",
- NULL
- },
.setup = setup,
};
diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c
index 4186bff65..cd8a0c388 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl02.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.c
@@ -142,10 +142,7 @@ static void verify_quota(unsigned int n)
static struct tst_test test = {
.needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_XFS_QUOTA",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.test = verify_quota,
.tcnt = ARRAY_SIZE(tcases),
.mount_device = 1,
diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h
index 37f3d7eb7..5140a7042 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl02.h
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.h
@@ -26,6 +26,10 @@ static uint32_t test_id;
static int x_getnextquota_nsup;
static int x_getstatv_nsup;
static const char mntpoint[] = "mnt_point";
+static const char *kconfigs[] = {
+ "CONFIG_XFS_QUOTA",
+ NULL
+};
void check_support_cmd(int quotatype)
{
diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c
index 3ec931727..d95719521 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl03.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl03.c
@@ -64,12 +64,14 @@ static void verify_quota(void)
tst_res(TPASS, "quotactl() failed with ENOENT as expected");
}
+static const char *kconfigs[] = {
+ "CONFIG_XFS_QUOTA",
+ NULL
+};
+
static struct tst_test test = {
.needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_XFS_QUOTA",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.test_all = verify_quota,
.mount_device = 1,
.dev_fs_type = "xfs",
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
index fd3afc888..8dab83da0 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl04.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -19,8 +19,6 @@
* 7) quotactl(2) succeeds to get disk quota limit greater than or equal to
* ID with Q_GETNEXTQUOTA flag for project.
* 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for project.
- *
- * Minimum e2fsprogs version required is 1.43.
*/
#include <errno.h>
@@ -28,10 +26,8 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
-#include <sys/mount.h>
#include "config.h"
#include "lapi/quotactl.h"
-#include "tst_safe_stdio.h"
#include "tst_test.h"
#ifndef QFMT_VFS_V1
@@ -104,44 +100,14 @@ static struct tcase {
};
-static void do_mount(const char *source, const char *target,
- const char *filesystemtype, unsigned long mountflags,
- const void *data)
-{
- TEST(mount(source, target, filesystemtype, mountflags, data));
-
- if (TST_RET == -1 && TST_ERR == ESRCH)
- tst_brk(TCONF, "Kernel or device does not support FS quotas");
-
- if (TST_RET == -1) {
- tst_brk(TBROK | TTERRNO, "mount(%s, %s, %s, %lu, %p) failed",
- source, target, filesystemtype, mountflags, data);
- }
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO, "mount(%s, %s, %s, %lu, %p) failed",
- source, target, filesystemtype, mountflags, data);
- }
-
- mount_flag = 1;
-}
-
static void setup(void)
{
- FILE *f;
- const char *const fs_opts[] = {"-I 256", "-O quota,project", NULL};
- int rc, major, minor, patch;
+ const char *const extra_opts[] = {"-O quota,project", NULL};
test_id = geteuid();
- f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r");
- rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch);
- if (rc != 3)
- tst_res(TWARN, "Unable parse version number");
- else if (major * 10000 + minor * 100 + patch < 14300)
- tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for quota,project option, test skipped");
- pclose(f);
- SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
- do_mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
+ SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, extra_opts);
+ SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
+ mount_flag = 1;
}
static void cleanup(void)
@@ -176,12 +142,14 @@ static void verify_quota(unsigned int n)
tst_res(TPASS, "quotactl succeeded to %s", tc->des);
}
+static const char *kconfigs[] = {
+ "CONFIG_QFMT_V2",
+ NULL
+};
+
static struct tst_test test = {
.needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_QFMT_V2",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.min_kver = "4.10", /* commit 689c958cbe6b (ext4: add project quota support) */
.test = verify_quota,
.tcnt = ARRAY_SIZE(tcases),
@@ -190,8 +158,4 @@ static struct tst_test test = {
.needs_device = 1,
.dev_fs_type = "ext4",
.mntpoint = MNTPOINT,
- .needs_cmds = (const char *[]) {
- "mkfs.ext4",
- NULL
- }
};
diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c
index e811e47a4..af5a164e4 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl05.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl05.c
@@ -99,10 +99,7 @@ static void verify_quota(unsigned int n)
static struct tst_test test = {
.needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_XFS_QUOTA",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.test = verify_quota,
.tcnt = ARRAY_SIZE(tcases),
.mount_device = 1,
diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
index a10d1ca07..a3b4517e0 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl06.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
@@ -40,9 +40,6 @@
#define TESTDIR1 MNTPOINT "/testdir1"
#define TESTDIR2 MNTPOINT "/testdir2"
-static char usrpath[] = USRPATH;
-static char testdir1[] = TESTDIR1;
-static char testdir2[] = TESTDIR2;
static int32_t fmt_id = FMTID;
static int32_t fmt_invalid = 999;
static int test_invalid;
@@ -79,17 +76,17 @@ static struct tcase {
int exp_err;
int on_flag;
} tcases[] = {
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, testdir1, EACCES, 0},
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, testdir2, ENOENT, 0},
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, EBUSY, 1},
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, TESTDIR1, EACCES, 0},
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, TESTDIR2, ENOENT, 0},
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH, EBUSY, 1},
{QCMD(Q_SETQUOTA, USRQUOTA), &fmt_id, NULL, EFAULT, 1},
- {QCMD(OPTION_INVALID, USRQUOTA), &fmt_id, usrpath, EINVAL, 0},
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, ENOTBLK, 0},
+ {QCMD(OPTION_INVALID, USRQUOTA), &fmt_id, USRPATH, EINVAL, 0},
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH, ENOTBLK, 0},
{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, ESRCH, 0},
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_invalid, usrpath, ESRCH, 0},
- {QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_invalid, usrpath, ESRCH, 0},
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_invalid, USRPATH, ESRCH, 0},
+ {QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_invalid, USRPATH, ESRCH, 0},
{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dqmax, ERANGE, 1},
- {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, usrpath, EPERM, 0},
+ {QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH, EPERM, 0},
};
static void verify_quotactl(unsigned int n)
@@ -104,8 +101,7 @@ static void verify_quotactl(unsigned int n)
}
if (tc->on_flag) {
- TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev,
- FMTID, usrpath));
+ TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev, FMTID, USRPATH));
if (TST_RET == -1)
tst_brk(TBROK,
"quotactl with Q_QUOTAON returned %ld", TST_RET);
@@ -134,8 +130,7 @@ static void verify_quotactl(unsigned int n)
}
if (quota_on) {
- TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev,
- FMTID, usrpath));
+ TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev, FMTID, USRPATH));
if (TST_RET == -1)
tst_brk(TBROK,
"quotactl with Q_QUOTAOFF returned %ld", TST_RET);
@@ -151,15 +146,23 @@ static void verify_quotactl(unsigned int n)
static void setup(void)
{
const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
+ int ret;
unsigned int i;
- SAFE_CMD(cmd, NULL, NULL);
+ ret = tst_run_cmd(cmd, NULL, NULL, 1);
+ switch (ret) {
+ case 0:
+ break;
+ case 255:
+ tst_brk(TCONF, "quotacheck binary not installed");
+ break;
+ default:
+ tst_brk(TBROK, "quotacheck exited with %i", ret);
+ }
if (access(USRPATH, F_OK) == -1)
tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
- tst_require_quota_support(tst_device->dev, fmt_id, usrpath);
-
SAFE_MKDIR(TESTDIR1, 0666);
test_id = geteuid();
test_invalid = test_id + 1;
@@ -175,21 +178,19 @@ static void setup(void)
}
}
+static const char *kconfigs[] = {
+ "CONFIG_QFMT_V2",
+ NULL
+};
+
static struct tst_test test = {
.setup = setup,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_QFMT_V2",
- NULL
- },
+ .needs_kconfigs = kconfigs,
.tcnt = ARRAY_SIZE(tcases),
.test = verify_quotactl,
.dev_fs_type = "ext4",
.mntpoint = MNTPOINT,
.mount_device = 1,
.mnt_data = "usrquota",
- .needs_cmds = (const char *const []) {
- "quotacheck",
- NULL
- },
.needs_root = 1,
};
diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
deleted file mode 100644
index db477589b..000000000
--- a/testcases/kernel/syscalls/quotactl/quotactl07.c
+++ /dev/null
@@ -1,67 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
- * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- *
- * This is a regresstion test for kernel commit 3dd4d40b4208
- * ("xfs: Sanity check flags of Q_XQUOTARM call").
- */
-
-#include "config.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/quota.h>
-#include "lapi/quotactl.h"
-#include "tst_test.h"
-
-#ifdef HAVE_XFS_XQM_H
-# include <xfs/xqm.h>
-
-#define MNTPOINT "mntpoint"
-
-static uint32_t qflag_acct = XFS_QUOTA_UDQ_ACCT;
-static unsigned int valid_type = XFS_USER_QUOTA;
-/* Include a valid quota type to avoid other EINVAL error */
-static unsigned int invalid_type = XFS_GROUP_QUOTA << 1 | XFS_USER_QUOTA;
-
-static void verify_quota(void)
-{
- TEST(quotactl(QCMD(Q_XQUOTARM, USRQUOTA), tst_device->dev, 0, (void *)&invalid_type));
- if (TST_ERR == EINVAL)
- tst_res(TPASS, "Q_XQUOTARM has quota type check");
- else
- tst_res(TFAIL, "Q_XQUOTARM doesn't have quota type check");
-}
-
-static void setup(void)
-{
- TEST(quotactl(QCMD(Q_XQUOTAOFF, USRQUOTA), tst_device->dev, 0, (void *)&qflag_acct));
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, "quotactl with Q_XQUOTAOFF failed");
-
- TEST(quotactl(QCMD(Q_XQUOTARM, USRQUOTA), tst_device->dev, 0, (void *)&valid_type));
- if (TST_ERR == EINVAL)
- tst_brk(TCONF, "current system doesn't support Q_XQUOTARM, skip it");
-}
-
-static struct tst_test test = {
- .setup = setup,
- .needs_root = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_XFS_QUOTA",
- NULL
- },
- .test_all = verify_quota,
- .mount_device = 1,
- .dev_fs_type = "xfs",
- .mnt_data = "usrquota",
- .mntpoint = MNTPOINT,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "3dd4d40b4208"},
- {}
- }
-};
-#else
- TST_TEST_TCONF("System doesn't have <xfs/xqm.h>");
-#endif
diff --git a/testcases/kernel/syscalls/read/Makefile b/testcases/kernel/syscalls/read/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/read/Makefile
+++ b/testcases/kernel/syscalls/read/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/readahead/Makefile b/testcases/kernel/syscalls/readahead/Makefile
index 159d5651c..45a3bbc59 100644
--- a/testcases/kernel/syscalls/readahead/Makefile
+++ b/testcases/kernel/syscalls/readahead/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2012 Linux Test Project, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/readahead/readahead01.c b/testcases/kernel/syscalls/readahead/readahead01.c
index a0be96065..e1967955a 100644
--- a/testcases/kernel/syscalls/readahead/readahead01.c
+++ b/testcases/kernel/syscalls/readahead/readahead01.c
@@ -61,7 +61,7 @@ static void test_bad_fd(void)
tst_res(TINFO, "test_bad_fd O_WRONLY");
fd = mkstemp(tempname);
if (fd == -1)
- tst_res(TFAIL | TERRNO, "mkstemp failed");
+ tst_res(TBROK | TERRNO, "mkstemp failed");
SAFE_CLOSE(fd);
fd = SAFE_OPEN(tempname, O_WRONLY);
TEST(readahead(fd, 0, getpagesize()));
diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
index 258c70e21..fb06be755 100644
--- a/testcases/kernel/syscalls/readahead/readahead02.c
+++ b/testcases/kernel/syscalls/readahead/readahead02.c
@@ -49,6 +49,11 @@ static int orig_bdi_limit;
static const char mntpoint[] = OVL_BASE_MNTPOINT;
+static struct tst_option options[] = {
+ {"s:", &opt_fsizestr, "-s testfile size (default 64MB)"},
+ {NULL, NULL, NULL}
+};
+
static int libc_readahead(int fd, off_t offset, size_t len)
{
return readahead(fd, offset, len);
@@ -400,10 +405,7 @@ static struct tst_test test = {
.mntpoint = mntpoint,
.setup = setup,
.cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"s:", &opt_fsizestr, "-s testfile size (default 64MB)"},
- {}
- },
+ .options = options,
.test = test_readahead,
.tcnt = ARRAY_SIZE(tcases),
.tags = (const struct tst_tag[]) {
diff --git a/testcases/kernel/syscalls/readdir/Makefile b/testcases/kernel/syscalls/readdir/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/readdir/Makefile
+++ b/testcases/kernel/syscalls/readdir/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/readlink/Makefile b/testcases/kernel/syscalls/readlink/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/readlink/Makefile
+++ b/testcases/kernel/syscalls/readlink/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/readlinkat/Makefile b/testcases/kernel/syscalls/readlinkat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/readlinkat/Makefile
+++ b/testcases/kernel/syscalls/readlinkat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/readv/Makefile b/testcases/kernel/syscalls/readv/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/readv/Makefile
+++ b/testcases/kernel/syscalls/readv/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/readv/readv01.c b/testcases/kernel/syscalls/readv/readv01.c
index f12b3f09f..82fec39e1 100644
--- a/testcases/kernel/syscalls/readv/readv01.c
+++ b/testcases/kernel/syscalls/readv/readv01.c
@@ -1,8 +1,22 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* 07/2001 Ported by Wayne Boyer
+ *
* Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
@@ -17,109 +31,94 @@
#include <sys/uio.h>
#include <fcntl.h>
#include <memory.h>
+#include <errno.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
-/* Note: multi_iovec test assumes CHUNK is divisible by 4 */
#define CHUNK 64
+char *TCID = "readv01";
+int TST_TOTAL = 1;
+
static char buf[CHUNK];
-static struct iovec *rd_iovec, *big_iovec, *multi_iovec, *lockup_iovec;
-static int fd;
-static struct testcase {
- struct iovec **iov;
- int iov_count, exp_ret;
- const char *name;
-} testcase_list[] = {
- {&rd_iovec, 0, 0, "readv() with 0 I/O vectors"},
- {&rd_iovec, 3, CHUNK, "readv() with NULL I/O vectors"},
- {&big_iovec, 2, CHUNK, "readv() with too big I/O vectors"},
- {&multi_iovec, 2, 3*CHUNK/4, "readv() with multiple I/O vectors"},
- {&lockup_iovec, 2, CHUNK, "readv() with zero-len buffer"},
+static struct iovec rd_iovec[] = {
+ {buf, CHUNK},
+ {NULL, 0},
+ {NULL, 0},
};
-static void test_readv(unsigned int n)
+static int fd;
+
+static void setup(void);
+static void cleanup(void);
+
+int main(int ac, char **av)
{
- int i, fpos, fail = 0;
- size_t j;
- char *ptr;
- const struct testcase *tc = testcase_list + n;
- struct iovec *vec;
-
- SAFE_LSEEK(fd, 0, SEEK_SET);
- vec = *tc->iov;
-
- for (i = 0; i < tc->iov_count; i++) {
- if (vec[i].iov_base && vec[i].iov_len)
- memset(vec[i].iov_base, 0, vec[i].iov_len);
- }
+ int lc, i, fail;
+ char *vec;
- TEST(readv(fd, vec, tc->iov_count));
+ tst_parse_opts(ac, av, NULL, NULL);
- if (TST_RET == -1)
- tst_res(TFAIL | TTERRNO, "readv() failed unexpectedly");
- else if (TST_RET < 0)
- tst_res(TFAIL | TTERRNO, "readv() returned invalid value");
- else if (TST_RET != tc->exp_ret)
- tst_res(TFAIL, "readv() returned unexpected value %ld",
- TST_RET);
+ setup();
- if (TST_RET != tc->exp_ret)
- return;
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- tst_res(TPASS, "%s", tc->name);
+ SAFE_LSEEK(cleanup, fd, 0, SEEK_SET);
- for (i = 0, fpos = 0; i < tc->iov_count; i++) {
- ptr = vec[i].iov_base;
+ if (readv(fd, rd_iovec, 0) == -1)
+ tst_resm(TFAIL | TERRNO, "readv failed unexpectedly");
+ else
+ tst_resm(TPASS, "readv read 0 io vectors");
- for (j = 0; j < vec[i].iov_len; j++, fpos++) {
- if (ptr[j] != (fpos < tc->exp_ret ? 0x42 : 0))
- fail++;
+ memset(rd_iovec[0].iov_base, 0x00, CHUNK);
+
+ if (readv(fd, rd_iovec, 3) != CHUNK) {
+ tst_resm(TFAIL, "readv failed reading %d bytes, "
+ "followed by two NULL vectors", CHUNK);
+ } else {
+ fail = 0;
+ vec = rd_iovec[0].iov_base;
+
+ for (i = 0; i < CHUNK; i++) {
+ if (vec[i] != 0x42)
+ fail++;
+ }
+
+ if (fail)
+ tst_resm(TFAIL, "Wrong buffer content");
+ else
+ tst_resm(TPASS, "readv passed reading %d bytes "
+ "followed by two NULL vectors", CHUNK);
}
}
- if (fail)
- tst_res(TFAIL, "Wrong buffer content");
- else
- tst_res(TPASS, "readv() correctly read %d bytes ", tc->exp_ret);
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- /* replace the default NULL pointer with invalid address */
- lockup_iovec[0].iov_base = tst_get_bad_addr(NULL);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
memset(buf, 0x42, sizeof(buf));
- fd = SAFE_OPEN("data_file", O_WRONLY | O_CREAT | O_TRUNC, 0666);
- SAFE_WRITE(1, fd, buf, sizeof(buf));
- SAFE_CLOSE(fd);
- fd = SAFE_OPEN("data_file", O_RDONLY);
+ fd = SAFE_OPEN(cleanup, "data_file", O_WRONLY | O_CREAT, 0666);
+ SAFE_WRITE(cleanup, 1, fd, buf, sizeof(buf));
+ SAFE_CLOSE(cleanup, fd);
+ fd = SAFE_OPEN(cleanup, "data_file", O_RDONLY);
}
static void cleanup(void)
{
- if (fd >= 0)
- SAFE_CLOSE(fd);
-}
+ if (fd > 0)
+ close(fd);
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test = test_readv,
- .tcnt = ARRAY_SIZE(testcase_list),
- .needs_tmpdir = 1,
- .timeout = 15,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "19f18459330f"},
- {}
- },
- .bufs = (struct tst_buffers[]) {
- {&rd_iovec, .iov_sizes = (int[]){CHUNK, 0, 0, -1}},
- {&big_iovec, .iov_sizes = (int[]){2*CHUNK, CHUNK, -1}},
- {&multi_iovec, .iov_sizes = (int[]){CHUNK/4, CHUNK/2, -1}},
- {&lockup_iovec, .iov_sizes = (int[]){0, CHUNK, -1}},
- {}
- }
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/reboot/Makefile b/testcases/kernel/syscalls/reboot/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/reboot/Makefile
+++ b/testcases/kernel/syscalls/reboot/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/reboot/reboot01.c b/testcases/kernel/syscalls/reboot/reboot01.c
index 56eb22796..cbcfa354e 100644
--- a/testcases/kernel/syscalls/reboot/reboot01.c
+++ b/testcases/kernel/syscalls/reboot/reboot01.c
@@ -1,49 +1,142 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * AUTHOR: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- */
-
-/*\
- * [Description]
- * This is a Phase I test for the reboot(2) system call.
- * It is intended to provide a limited exposure of the system call.
- *
- * [Algorithm]
- * 1) Two test cases for two flag values
- * 2) Execute system call
- * 3) Check return code, if system call failed (return=-1)
- * 4) Log the errno and Issue a FAIL message
- * 5) Otherwise, Issue a PASS message
- *
- * [Restrictions]
- * For lib4 and lib5 reboot(2) system call is implemented as
- * int reboot(int magic, int magic2, int flag, void *arg); This test case
- * is written for int reboot(int flag); which is implemented under glibc
- * Therefore this testcase may not work under libc4 and libc5 libraries.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
+/**************************************************************************
+ *
+ * TEST IDENTIFIER : reboot01
+ *
+ * EXECUTED BY : root / superuser
+ *
+ * TEST TITLE : Basic test for reboot(2)
+ *
+ * TEST CASE TOTAL : 2
+ *
+ * AUTHOR : Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a Phase I test for the reboot(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ * $
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ * setting the flag value for two tests.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * for two test cases for two flag values
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * reboot01 [-c n] [-e] [-i n] [-I x] [-p x] [-t] [-h] [-f] [-p]
+ * where:
+ * -c n : run the test for n number of times.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ *RESTRICTIONS:
+ *for lib4 and lib5 reboot(2) system call is implemented as
+ *int reboot(int magic, int magic2, int flag, void *arg); This test case
+ *is written for int reboot(int flag); which is implemented under glibc
+ *Therefore this testcase may not work under libc4 and libc5 libraries
+ *****************************************************************************/
#include <unistd.h>
#include <sys/reboot.h>
+#include "test.h"
+#include <errno.h>
#include <linux/reboot.h>
-#include "tst_test.h"
-
-static struct tcase {
- const char *option_message;
- int flag;
-} tcases[] = {
- {"LINUX_REBOOT_CMD_CAD_ON", LINUX_REBOOT_CMD_CAD_ON,},
- {"LINUX_REBOOT_CMD_CAD_OFF", LINUX_REBOOT_CMD_CAD_OFF,},
+
+static void setup();
+static void cleanup();
+
+char *TCID = "reboot01";
+int TST_TOTAL = 2;
+
+static int flag[2] = { LINUX_REBOOT_CMD_CAD_ON, LINUX_REBOOT_CMD_CAD_OFF };
+
+static const char *option_message[] = { "LINUX_REBOOT_CMD_CAD_ON",
+ "LINUX_REBOOT_CMD_CAD_OFF"
};
-static void run(unsigned int n)
+int main(int ac, char **av)
{
- TST_EXP_PASS(reboot(tcases[n].flag),
- "reboot(%s)", tcases[n].option_message);
+
+ int lc, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ TEST(reboot(flag[i]));
+ /* check return code */
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "reboot(2) Failed for "
+ "option %s", option_message[i]);
+ } else {
+ tst_resm(TPASS, "reboot(2) Passed for "
+ "option %s", option_message[i]);
+ }
+ } /*End of TEST CASE LOOPING */
+ } /*End for TEST_LOOPING */
+
+ /*Clean up and exit */
+ cleanup();
+
+ tst_exit();
}
-static struct tst_test test = {
- .needs_root = 1,
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
-};
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+}
+
+/*
+ * cleanup() - Performs one time cleanup for this test at
+ * completion or premature exit
+ */
+
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/reboot/reboot02.c b/testcases/kernel/syscalls/reboot/reboot02.c
index 585a67872..65ddae242 100644
--- a/testcases/kernel/syscalls/reboot/reboot02.c
+++ b/testcases/kernel/syscalls/reboot/reboot02.c
@@ -1,65 +1,196 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * AUTHOR: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- */
-
-/*\
- * [Description]
- * This test case checks whether reboot(2) system call returns appropriate
- * error number for invalid flag parameter or invalid user.
*
- * [Algorithm]
- * Execute system call with invaid flag parameter and then for invalid user
- * check return value and errno.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * [Restrictions]
- * For lib4 and lib5 reboot(2) system call is implemented as
- * int reboot(int magic, int magic2, int flag, void *arg); This test case
- * is written for int reboot(int flag); which is implemented under glibc
- * Therefore this testcase may not work under libc4 and libc5 libraries
*/
+/**************************************************************************
+ *
+ * TEST IDENTIFIER : reboot02
+ *
+ *
+ * EXECUTED BY : root / superuser
+ *
+ * TEST TITLE : Test checking for basic error conditions
+ * for reboot(2)
+ *
+ * TEST CASE TOTAL : 2
+ *
+ * AUTHOR : Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This test case checks whether reboot(2) system call returns
+ * appropriate error number for invalid
+ * flag parameter or invalid user.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ * For testing error on invalid user, change the effective uid
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call with invaid flag parameter
+ * and then for invalid user
+ * Check return code, if system call fails with errno == expected errno
+ * Issue syscall passed with expected errno
+ * Otherwise,
+ * Issue syscall failed to produce expected errno
+ *
+ * Cleanup:
+ * Do cleanup for the test.
+ * $
+ * USAGE: <for command-line>
+ * reboot02 [-c n] [-e] [-i n] [-I x] [-p x] [-t] [-h] [-f] [-p]
+ * where
+ * -c n: run n copies simultaneously
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ *RESTRICTIONS:
+ *for lib4 and lib5 reboot(2) system call is implemented as
+ *int reboot(int magic, int magic2, int flag, void *arg); This test case
+ *is written for int reboot(int flag); which is implemented under glibc
+ *Therefore this testcase may not work under libc4 and libc5 libraries
+ *****************************************************************************/
#include <unistd.h>
#include <sys/reboot.h>
+#include <errno.h>
#include <linux/reboot.h>
#include <pwd.h>
-#include "tst_test.h"
+#include "test.h"
#define INVALID_PARAMETER 100
+static void setup();
+static void cleanup();
+static int setup_test();
+
+char *TCID = "reboot02";
+int TST_TOTAL = 2;
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
-static struct tcase {
- int flag;
- int exp_errno;
- const char *option_message;
-} tcases[] = {
- {INVALID_PARAMETER, EINVAL, "INVALID_PARAMETER"},
- {LINUX_REBOOT_CMD_CAD_ON, EPERM, "LINUX_REBOOT_CMD_CAD_ON"},
+static struct test_case_t {
+ char *err_desc; /*error description */
+ int exp_errno; /* expected error number */
+ char *exp_errval; /*Expected errorvalue string */
+} testcase[] = {
+ {
+ "Invalid flag", EINVAL, "EINVAL"}, {
+ "Permission denied", EPERM, "EPERM "}
};
-static void run(unsigned int n)
+int main(int ac, char **av)
{
- struct tcase *tc = &tcases[n];
- if (n == 0)
- TST_EXP_FAIL(reboot(tc->flag),
- tc->exp_errno, "%s", tc->option_message);
- else {
- ltpuser = SAFE_GETPWNAM(nobody_uid);
- SAFE_SETEUID(ltpuser->pw_uid);
+ int lc, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- TST_EXP_FAIL(reboot(tc->flag),
- tc->exp_errno, "%s", tc->option_message);
+ for (i = 0; i < TST_TOTAL; i++) {
- SAFE_SETEUID(0);
+ tst_count = 0;
+ if (i == 0) {
+ TEST(reboot(INVALID_PARAMETER));
+ } else {
+ /*change the user to nobody */
+ if (setup_test() == 0) {
+ TEST(reboot(LINUX_REBOOT_CMD_CAD_ON));
+ /* Set effective user id back to root */
+ if (seteuid(0) == -1) {
+ tst_brkm(TBROK, cleanup,
+ "seteuid failed to "
+ "set the effective uid"
+ " to root");
+ perror("seteuid");
+ }
+ } else {
+ tst_resm(TWARN, "skipping the test");
+ continue;
+ }
+ }
+ /* check return code */
+ if ((TEST_RETURN == -1)
+ && (TEST_ERRNO == testcase[i].exp_errno)) {
+ tst_resm(TPASS,
+ "reboot(2) expected failure;"
+ " Got errno - %s : %s",
+ testcase[i].exp_errval,
+ testcase[i].err_desc);
+ } else {
+ tst_resm(TFAIL, "reboot(2) failed to produce"
+ " expected error; %d, errno"
+ ": %s and got %d",
+ testcase[i].exp_errno,
+ testcase[i].exp_errval, TEST_ERRNO);
+ }
+ } /*End of TEST LOOPS */
}
+
+ /*Clean up and exit */
+ cleanup();
+
+ tst_exit();
+} /*End of main */
+
+/*
+ * setup_test() - This function sets the user as nobdy
+ */
+int setup_test(void)
+{
+ if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
+ tst_resm(TWARN, "\"nobody\" user not present. skipping test");
+ return -1;
+ }
+ if (seteuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TWARN, "seteuid failed to "
+ "to set the effective uid to %d", ltpuser->pw_uid);
+ perror("seteuid");
+ return -1;
+ }
+ return 0;
}
-static struct tst_test test = {
- .needs_root = 1,
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
-};
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+}
+
+/*
+* cleanup() - Performs one time cleanup for this test at
+* completion or premature exit
+*/
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/recv/Makefile b/testcases/kernel/syscalls/recv/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/recv/Makefile
+++ b/testcases/kernel/syscalls/recv/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/recvfrom/Makefile b/testcases/kernel/syscalls/recvfrom/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/recvfrom/Makefile
+++ b/testcases/kernel/syscalls/recvfrom/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/recvmmsg/.gitignore b/testcases/kernel/syscalls/recvmmsg/.gitignore
deleted file mode 100644
index 974ae1ef9..000000000
--- a/testcases/kernel/syscalls/recvmmsg/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-recvmmsg01
diff --git a/testcases/kernel/syscalls/recvmmsg/Makefile b/testcases/kernel/syscalls/recvmmsg/Makefile
deleted file mode 100644
index 18896b6f2..000000000
--- a/testcases/kernel/syscalls/recvmmsg/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/recvmmsg/recvmmsg01.c b/testcases/kernel/syscalls/recvmmsg/recvmmsg01.c
deleted file mode 100644
index 10eaa3dcd..000000000
--- a/testcases/kernel/syscalls/recvmmsg/recvmmsg01.c
+++ /dev/null
@@ -1,147 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-/*\
- * Test recvmmsg() errors:
- *
- * - EBADF Bad socket file descriptor
- * - EFAULT Bad message vector address
- * - EINVAL Bad seconds value for the timeout argument
- * - EINVAL Bad nanoseconds value for the timeout argument
- * - EFAULT Bad timeout address
- */
-
-#define _GNU_SOURCE
-#include "../sendmmsg/sendmmsg.h"
-
-static int send_sockfd;
-static int receive_sockfd;
-
-#define VLEN 1
-
-static struct mmsghdr *msg;
-static struct iovec *iov;
-
-static void *bad_addr;
-static int bad_fd = -1;
-
-static struct tst_ts ts;
-
-struct test_case {
- const char *desc;
- int *fd;
- long tv_sec;
- long tv_nsec;
- int exp_errno;
- struct mmsghdr **msg_vec;
- int bad_ts_addr;
-};
-
-static struct test_case tcase[] = {
- {
- .desc = "bad socket file descriptor",
- .fd = &bad_fd,
- .exp_errno = EBADF,
- .msg_vec = &msg,
- },
- {
- .desc = "bad message vector address",
- .fd = &receive_sockfd,
- .exp_errno = EFAULT,
- .msg_vec = (void*)&bad_addr,
- },
- {
- .desc = "negative seconds in timeout",
- .fd = &receive_sockfd,
- .tv_sec = -1,
- .tv_nsec = 0,
- .exp_errno = EINVAL,
- .msg_vec = &msg,
- },
- {
- .desc = "overflow in nanoseconds in timeout",
- .fd = &receive_sockfd,
- .tv_sec = 1,
- .tv_nsec = 1000000001,
- .exp_errno = EINVAL,
- .msg_vec = &msg,
- },
- {
- .desc = "bad timeout address",
- .fd = &receive_sockfd,
- .exp_errno = EFAULT,
- .msg_vec = &msg,
- .bad_ts_addr = 1,
- }
-};
-
-static void do_test(unsigned int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct test_case *tc = &tcase[i];
- void *timeout;
-
- ts.type = tv->ts_type;
- tst_ts_set_sec(&ts, tc->tv_sec);
- tst_ts_set_nsec(&ts, tc->tv_nsec);
-
- if (tc->bad_ts_addr)
- timeout = bad_addr;
- else
- timeout = tst_ts_get(&ts);
-
- TST_EXP_FAIL(tv->recvmmsg(*tc->fd, *tc->msg_vec, VLEN, 0, timeout),
- tc->exp_errno, "recvmmsg() %s", tc->desc);
-}
-
-static void setup(void)
-{
- struct sockaddr_in addr;
- unsigned int port = TST_GET_UNUSED_PORT(AF_INET, SOCK_DGRAM);
- struct time64_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-
- send_sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
- receive_sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
-
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- addr.sin_port = port;
-
- SAFE_BIND(receive_sockfd, (struct sockaddr *)&addr, sizeof(addr));
- SAFE_CONNECT(send_sockfd, (struct sockaddr *)&addr, sizeof(addr));
-
- msg[0].msg_hdr.msg_iov = iov;
- msg[0].msg_hdr.msg_iovlen = 1;
-
- TEST(tv->sendmmsg(send_sockfd, msg, 1, 0));
-
- if (TST_RET != 1) {
- tst_res(TFAIL | TTERRNO, "sendmmsg() failed");
- return;
- }
-
- bad_addr = tst_get_bad_addr(NULL);
-}
-
-static void cleanup(void)
-{
- if (send_sockfd > 0)
- SAFE_CLOSE(send_sockfd);
-
- if (receive_sockfd > 0)
- SAFE_CLOSE(receive_sockfd);
-}
-
-static struct tst_test test = {
- .test = do_test,
- .tcnt = ARRAY_SIZE(tcase),
- .setup = setup,
- .cleanup = cleanup,
- .test_variants = ARRAY_SIZE(variants),
- .bufs = (struct tst_buffers []) {
- {&iov, .iov_sizes = (int[]){1, -1}},
- {&msg, .size = VLEN * sizeof(*msg)},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/recvmsg/Makefile b/testcases/kernel/syscalls/recvmsg/Makefile
index 8fcf0dce0..e69c726f5 100644
--- a/testcases/kernel/syscalls/recvmsg/Makefile
+++ b/testcases/kernel/syscalls/recvmsg/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/remap_file_pages/Makefile b/testcases/kernel/syscalls/remap_file_pages/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/remap_file_pages/Makefile
+++ b/testcases/kernel/syscalls/remap_file_pages/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c b/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c
index 631db51a7..86496c1d1 100644
--- a/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c
+++ b/testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c
@@ -149,14 +149,14 @@ static void test_nonlinear(int fd)
char *data = NULL;
int i, j, repeat = 2;
- for (i = 0; i < (int)cache_pages; i++) {
+ for (i = 0; i < cache_pages; i++) {
char *page = cache_contents + i * page_sz;
- for (j = 0; j < (int)page_words; j++)
+ for (j = 0; j < page_words; j++)
page[j] = i;
}
- if (write(fd, cache_contents, cache_sz) != (int)cache_sz) {
+ if (write(fd, cache_contents, cache_sz) != cache_sz) {
tst_resm(TFAIL,
"Write Error for \"cache_contents\" to \"cache_sz\" of %zu (errno=%d : %s)",
cache_sz, errno, strerror(errno));
@@ -173,7 +173,7 @@ static void test_nonlinear(int fd)
}
again:
- for (i = 0; i < (int)window_pages; i += 2) {
+ for (i = 0; i < window_pages; i += 2) {
char *page = data + i * page_sz;
if (remap_file_pages(page, page_sz * 2, 0,
@@ -186,12 +186,12 @@ again:
}
}
- for (i = 0; i < (int)window_pages; i++) {
+ for (i = 0; i < window_pages; i++) {
/*
* Double-check the correctness of the mapping:
*/
if (i & 1) {
- if (data[i * page_sz] != ((int)window_pages) - i) {
+ if (data[i * page_sz] != window_pages - i) {
tst_resm(TFAIL,
"hm, mapped incorrect data, "
"data[%d]=%d, (window_pages-%d)=%zu",
@@ -200,7 +200,7 @@ again:
cleanup(data);
}
} else {
- if (data[i * page_sz] != ((int)window_pages) - i - 2) {
+ if (data[i * page_sz] != window_pages - i - 2) {
tst_resm(TFAIL,
"hm, mapped incorrect data, "
"data[%d]=%d, (window_pages-%d-2)=%zu",
diff --git a/testcases/kernel/syscalls/removexattr/Makefile b/testcases/kernel/syscalls/removexattr/Makefile
index c7810c9fd..ed05a4826 100644
--- a/testcases/kernel/syscalls/removexattr/Makefile
+++ b/testcases/kernel/syscalls/removexattr/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2016 Fujitsu Ltd.
# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/rename/Makefile b/testcases/kernel/syscalls/rename/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/rename/Makefile
+++ b/testcases/kernel/syscalls/rename/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/renameat/Makefile b/testcases/kernel/syscalls/renameat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/renameat/Makefile
+++ b/testcases/kernel/syscalls/renameat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/renameat2/Makefile b/testcases/kernel/syscalls/renameat2/Makefile
index ddaa3112c..083a071b4 100644
--- a/testcases/kernel/syscalls/renameat2/Makefile
+++ b/testcases/kernel/syscalls/renameat2/Makefile
@@ -1,5 +1,21 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2015 Cedric Hnyda chnyda@suse.com
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/request_key/Makefile b/testcases/kernel/syscalls/request_key/Makefile
index 58a99875e..9add429d4 100644
--- a/testcases/kernel/syscalls/request_key/Makefile
+++ b/testcases/kernel/syscalls/request_key/Makefile
@@ -1,6 +1,19 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2016 Fujitsu Ltd.
-# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+# Copyright (c) 2016 Fujitsu Ltd.
+# Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/request_key/request_key03.c b/testcases/kernel/syscalls/request_key/request_key03.c
index b33da1a3b..b508ddc38 100644
--- a/testcases/kernel/syscalls/request_key/request_key03.c
+++ b/testcases/kernel/syscalls/request_key/request_key03.c
@@ -39,6 +39,11 @@
static char *opt_bug;
+static struct tst_option options[] = {
+ {"b:", &opt_bug, "-b Bug to test for (cve-2017-15299 or cve-2017-15951; default is both)"},
+ {NULL, NULL, NULL}
+};
+
static void test_with_key_type(const char *type, const char *payload,
int effort)
{
@@ -182,10 +187,7 @@ static void do_test(void)
static struct tst_test test = {
.test_all = do_test,
.forks_child = 1,
- .options = (struct tst_option[]) {
- {"b:", &opt_bug, "-b Bug to test for (cve-2017-15299 or cve-2017-15951; default is both)"},
- {}
- },
+ .options = options,
.tags = (const struct tst_tag[]) {
{"CVE", "2017-15299"},
{"linux-git", "60ff5b2f547a"},
diff --git a/testcases/kernel/syscalls/request_key/request_key04.c b/testcases/kernel/syscalls/request_key/request_key04.c
index c125f4261..da036bf3a 100644
--- a/testcases/kernel/syscalls/request_key/request_key04.c
+++ b/testcases/kernel/syscalls/request_key/request_key04.c
@@ -65,7 +65,7 @@ static void do_test(void)
if (TST_ERR == EACCES) {
tst_res(TPASS, "request_key() failed with EACCES as expected");
} else {
- tst_res(TFAIL | TTERRNO,
+ tst_res(TBROK | TTERRNO,
"request_key() failed with unexpected error code");
}
}
diff --git a/testcases/kernel/syscalls/rmdir/Makefile b/testcases/kernel/syscalls/rmdir/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/rmdir/Makefile
+++ b/testcases/kernel/syscalls/rmdir/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/rt_sigaction/Makefile b/testcases/kernel/syscalls/rt_sigaction/Makefile
index b09c86ff8..3839d4276 100644
--- a/testcases/kernel/syscalls/rt_sigaction/Makefile
+++ b/testcases/kernel/syscalls/rt_sigaction/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c b/testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c
index 72286d99d..fa50af319 100644
--- a/testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c
+++ b/testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c
@@ -65,7 +65,7 @@ char *test_flags_list[] =
static void handler(int sig)
{
- tst_resm(TINFO, "Signal Handler Called with signal number %d", sig);
+ tst_resm(TINFO, "Signal Handler Called with signal number %d\n", sig);
return;
}
diff --git a/testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c b/testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c
index eabbcd9b9..6e7865c07 100644
--- a/testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c
+++ b/testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c
@@ -71,7 +71,7 @@ static struct test_case_t {
static void handler(int sig)
{
- tst_resm(TINFO, "Signal Handler Called with signal number %d", sig);
+ tst_resm(TINFO, "Signal Handler Called with signal number %d\n", sig);
return;
}
diff --git a/testcases/kernel/syscalls/rt_sigprocmask/Makefile b/testcases/kernel/syscalls/rt_sigprocmask/Makefile
index 24099f7ac..37bc3a910 100644
--- a/testcases/kernel/syscalls/rt_sigprocmask/Makefile
+++ b/testcases/kernel/syscalls/rt_sigprocmask/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile b/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile
index 2a0d6926f..498ba8e31 100644
--- a/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile
+++ b/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/rt_sigsuspend/Makefile b/testcases/kernel/syscalls/rt_sigsuspend/Makefile
index 24099f7ac..37bc3a910 100644
--- a/testcases/kernel/syscalls/rt_sigsuspend/Makefile
+++ b/testcases/kernel/syscalls/rt_sigsuspend/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/rt_sigtimedwait/Makefile b/testcases/kernel/syscalls/rt_sigtimedwait/Makefile
index 1ae50b32c..c7110d756 100644
--- a/testcases/kernel/syscalls/rt_sigtimedwait/Makefile
+++ b/testcases/kernel/syscalls/rt_sigtimedwait/Makefile
@@ -1,12 +1,31 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpsigwait
-
include $(top_srcdir)/include/mk/testcases.mk
-LTPLDLIBS = -lltpsigwait
+CPPFLAGS += -DTEST_RT_SIGTIMEDWAIT
+
+rt_sigtimedwait01: $(abs_srcdir)/../sigwaitinfo/sigwaitinfo01.c
+ $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+MAKE_TARGETS := rt_sigtimedwait01
include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
diff --git a/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c b/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c
deleted file mode 100644
index 813f75b9e..000000000
--- a/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */
-
-#include "time64_variants.h"
-#include "libsigwait.h"
-
-static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
- void *timeout)
-{
- /* _NSIG is always the right number of bits of signal map for all arches */
- return tst_syscall(__NR_rt_sigtimedwait, set, info, timeout, _NSIG/8);
-}
-
-#if (__NR_rt_sigtimedwait_time64 != __LTP__NR_INVALID_SYSCALL)
-static int my_rt_sigtimedwait_time64(const sigset_t * set, siginfo_t * info,
- void *timeout)
-{
- /* _NSIG is always the right number of bits of signal map for all arches */
- return tst_syscall(__NR_rt_sigtimedwait_time64, set, info, timeout, _NSIG/8);
-}
-#endif
-
-struct sigwait_test_desc tests[] = {
- { test_empty_set, SIGUSR1},
- { test_unmasked_matching, SIGUSR1},
- { test_masked_matching, SIGUSR1},
- { test_unmasked_matching_noinfo, SIGUSR1},
- { test_masked_matching_noinfo, SIGUSR1},
- { test_bad_address, SIGUSR1},
- { test_bad_address2, SIGUSR1},
- { test_bad_address3, SIGUSR1},
- { test_timeout, 0},
- /* Special cases */
- /* 1: sigwaitinfo does respond to ignored signal */
- { test_masked_matching, SIGUSR2},
- /* 2: An ignored signal doesn't cause sigwaitinfo to return EINTR */
- { test_timeout, SIGUSR2},
- /* 3: The handler is not called when the signal is waited for by sigwaitinfo */
- { test_masked_matching, SIGTERM},
- /* 4: Simultaneous realtime signals are delivered in the order of increasing signal number */
- { test_masked_matching_rt, -1},
-};
-
-static struct time64_variants variants[] = {
-#if (__NR_rt_sigtimedwait != __LTP__NR_INVALID_SYSCALL)
- { .sigwait = my_rt_sigtimedwait, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_rt_sigtimedwait_time64 != __LTP__NR_INVALID_SYSCALL)
- { .sigwait = my_rt_sigtimedwait_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void run(unsigned int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct sigwait_test_desc *tc = &tests[i];
-
- tc->tf(tv->sigwait, tc->signo, tv->ts_type);
-}
-
-static void setup(void)
-{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
- sigwait_setup();
-}
-
-static struct tst_test test = {
- .test= run,
- .tcnt = ARRAY_SIZE(tests),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .forks_child = 1,
-};
diff --git a/testcases/kernel/syscalls/sbrk/Makefile b/testcases/kernel/syscalls/sbrk/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sbrk/Makefile
+++ b/testcases/kernel/syscalls/sbrk/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_get_priority_max/Makefile b/testcases/kernel/syscalls/sched_get_priority_max/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_get_priority_max/Makefile
+++ b/testcases/kernel/syscalls/sched_get_priority_max/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_get_priority_min/Makefile b/testcases/kernel/syscalls/sched_get_priority_min/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_get_priority_min/Makefile
+++ b/testcases/kernel/syscalls/sched_get_priority_min/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_getaffinity/Makefile b/testcases/kernel/syscalls/sched_getaffinity/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/sched_getaffinity/Makefile
+++ b/testcases/kernel/syscalls/sched_getaffinity/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_getattr/Makefile b/testcases/kernel/syscalls/sched_getattr/Makefile
index ea299ff4a..0ad382e35 100644
--- a/testcases/kernel/syscalls/sched_getattr/Makefile
+++ b/testcases/kernel/syscalls/sched_getattr/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) International Business Machines Corp., 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_getparam/.gitignore b/testcases/kernel/syscalls/sched_getparam/.gitignore
index b7f9fd029..d1a7402e7 100644
--- a/testcases/kernel/syscalls/sched_getparam/.gitignore
+++ b/testcases/kernel/syscalls/sched_getparam/.gitignore
@@ -1,2 +1,3 @@
/sched_getparam01
+/sched_getparam02
/sched_getparam03
diff --git a/testcases/kernel/syscalls/sched_getparam/Makefile b/testcases/kernel/syscalls/sched_getparam/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_getparam/Makefile
+++ b/testcases/kernel/syscalls/sched_getparam/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c
index efb697707..82e97713b 100644
--- a/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c
+++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c
@@ -1,70 +1,137 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- */
-
-/*\
- * [Description]
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
*
- * Verify that:
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * sched_getparam(2) gets correct scheduling parameters for
- * the specified process:
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * - If pid is zero, sched_getparam(2) gets the scheduling parameters
- * for the calling process.
- * - If pid is not zero, sched_getparam(2) gets the scheduling
- * parameters for the specified [pid] process.
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : sched_getparam01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for sched_getparam(2)
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a Phase I test for the sched_getparam(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * sched_getparam01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
#include <errno.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
#include <sched.h>
-#include "tst_test.h"
+#include "test.h"
+
+static void setup();
+static void cleanup();
+
+char *TCID = "sched_getparam01";
+int TST_TOTAL = 1;
-static pid_t pids[2] = {0, 0};
+static struct sched_param param;
-static void verify_sched_getparam(unsigned int n)
+int main(int ac, char **av)
{
- pid_t child_pid;
- struct sched_param param = {
- .sched_priority = 100,
- };
-
- child_pid = SAFE_FORK();
- if (!child_pid) {
- TST_EXP_PASS_SILENT(sched_getparam(pids[n], &param),
- "sched_getparam(%d)", pids[n]);
- if (!TST_PASS)
- exit(0);
+
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ param.sched_priority = 100;
+
+ /*
+ * Call sched_getparam(2) with pid=0 sothat it will
+ * get the scheduling parameters for the calling process
+ */
+ TEST(sched_getparam(0, &param));
/*
- * For normal process, scheduling policy is SCHED_OTHER.
- * For this scheduling policy, only allowed priority value is 0.
+ * Check return code & priority. For normal process,
+ * scheduling policy is SCHED_OTHER. For this scheduling
+ * policy, only allowed priority value is 0. So we should
+ * get 0 for priority value
*/
- if (param.sched_priority)
- tst_res(TFAIL,
- "sched_getparam(%d) got wrong sched_priority %d, expected 0",
- pids[n], param.sched_priority);
- else
- tst_res(TPASS, "sched_getparam(%d) got expected sched_priority 0", pids[n]);
-
- exit(0);
+ if ((TEST_RETURN == 0) && (param.sched_priority == 0)) {
+ tst_resm(TPASS, "sched_getparam() returned %ld",
+ TEST_RETURN);
+ } else {
+ tst_resm(TFAIL, "Test Failed, sched_getparam()"
+ "returned %ld, errno = %d : %s; returned "
+ "process priority value is %d", TEST_RETURN,
+ TEST_ERRNO, strerror(TEST_ERRNO),
+ param.sched_priority);
+ }
}
- tst_reap_children();
+ cleanup();
+ tst_exit();
+
}
-static void setup(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- pids[1] = getpid();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
}
-static struct tst_test test = {
- .forks_child = 1,
- .setup = setup,
- .tcnt = ARRAY_SIZE(pids),
- .test = verify_sched_getparam,
-};
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam02.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam02.c
new file mode 100644
index 000000000..1bbf686ae
--- /dev/null
+++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam02.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+/**********************************************************
+ *
+ * TEST IDENTIFIER : sched_getparam02
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Get scheduling parametes for parent process
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verifies functionality of sched_getparam() for a process other than
+ * current process (ie, pid != 0). Here we get the scheduling parameters
+ * for parent process.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * fork a child
+ *
+ * CHILD:
+ * Gets the scheduling parameters for parent process
+ * If successfull,
+ * TEST passed
+ * else
+ * TEST failed.
+ *
+ * PARENT:
+ * wait for child to finish
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * sched_getparam02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
+
+#include <errno.h>
+#include <sched.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include "test.h"
+
+static void setup();
+static void cleanup();
+
+char *TCID = "sched_getparam02";
+int TST_TOTAL = 1;
+
+static struct sched_param param;
+
+int main(int ac, char **av)
+{
+
+ int lc;
+ int status;
+ pid_t child_pid;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ switch (child_pid = FORK_OR_VFORK()) {
+
+ case -1:
+ /* fork() failed */
+ tst_resm(TFAIL, "fork() failed");
+ continue;
+
+ case 0:
+ /* Child */
+ param.sched_priority = 100;
+
+ /*
+ * Call sched_getparam(2) with pid = getppid() sothat
+ * it will get the scheduling parameters for parent
+ * process
+ */
+ TEST(sched_getparam(getppid(), &param));
+
+ /*
+ * Check return code & priority. For normal process,
+ * scheduling policy is SCHED_OTHER. For this
+ * scheduling policy, only allowed priority value is 0.
+ * So we should get 0 for priority value
+ */
+ if (TEST_RETURN == 0 && param.sched_priority == 0)
+ exit(0);
+ else {
+ tst_resm(TWARN, "sched_getparam()"
+ "returned %ld, errno = %d : %s;"
+ " returned process priority value"
+ " is %d", TEST_RETURN, TEST_ERRNO,
+ strerror(TEST_ERRNO),
+ param.sched_priority);
+ exit(1);
+ }
+
+ default:
+ /* Parent */
+ if ((waitpid(child_pid, &status, 0)) < 0) {
+ tst_resm(TFAIL, "wait() failed");
+ continue;
+ }
+ if ((WIFEXITED(status)) && (WEXITSTATUS(status) == 0))
+ tst_resm(TPASS, "Test Passed");
+ else
+ tst_resm(TFAIL, "Test Failed");
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
+{
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+}
+
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c
index 19ecaf147..ceec4c380 100644
--- a/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c
+++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c
@@ -1,26 +1,88 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- */
-
-/*\
- * [Description]
*
- * Verify that:
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * - sched_getparam(2) returns -1 and sets errno to ESRCH if the
- * process with specified pid could not be found
- * - sched_getparam(2) returns -1 and sets errno to EINVAL if
- * the parameter pid is an invalid value (-1)
- * - sched_getparam(2) returns -1 and sets errno to EINVAL if the
- * parameter p is an invalid address
*/
+ /*******************************************************************
+ *
+ * TEST IDENTIFIER : sched_getparam03
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : testing error conditions for sched_getparam(2)
+ *
+ * TEST CASE TOTAL : 3
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verify that,
+ * 1) sched_getparam(2) returns -1 and sets errno to ESRCH if the
+ * process with specified pid could not be found
+ * 2) sched_getparam(2) returns -1 and sets errno to EINVAL if
+ * the parameter pid is an invalid value (-1)
+ * 3) sched_getparam(2) returns -1 and sets errno to EINVAL if the
+ * parameter p is an invalid address
+ *
+ * ALGORITHM
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if (system call failed (return=-1)) &
+ * (errno set == expected errno)
+ * Issue sys call fails with expected return value and errno.
+ * Otherwise,
+ * Issue sys call returns unexpected value.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * sched_getparam03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ *********************************************************************/
#include <errno.h>
#include <sched.h>
-#include "tst_test.h"
+#include "test.h"
+
+#define LARGE_PID 999999
+
+static void cleanup(void);
+static void setup(void);
static struct sched_param param;
+
+char *TCID = "sched_getparam03";
+
static pid_t unused_pid;
static pid_t zero_pid;
static pid_t inval_pid = -1;
@@ -30,29 +92,73 @@ static struct test_case_t {
pid_t *pid;
struct sched_param *p;
int exp_errno;
+ char err_desc[10];
} test_cases[] = {
- {"sched_getparam() with non-existing pid",
- &unused_pid, &param, ESRCH},
- {"sched_getparam() with invalid pid",
- &inval_pid, &param, EINVAL},
- {"sched_getparam() with invalid address for param",
- &zero_pid, NULL, EINVAL},
-};
-
-static void verify_sched_getparam(unsigned int n)
+ {
+ "test with non-existing pid", &unused_pid, &param, ESRCH, "ESRCH"}, {
+ "test invalid pid value", &inval_pid, &param, EINVAL, "EINVAL"}, {
+ "test with invalid address for p", &zero_pid, NULL, EINVAL, "EINVAL"},};
+
+int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
+
+int main(int ac, char **av)
{
- struct test_case_t *tc = &test_cases[n];
+ int lc, ind;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* The following loop checks looping state if -i option given */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ for (ind = 0; ind < TST_TOTAL; ind++) {
+
+ /* Call sched_getparam(2) to test different test
+ * conditions. verify that it fails with -1 return
+ * value and sets appropriate errno.
+ */
+ TEST(sched_getparam(*(test_cases[ind].pid),
+ test_cases[ind].p));
+
+ if ((TEST_RETURN == -1) &&
+ (TEST_ERRNO == test_cases[ind].exp_errno)) {
+ tst_resm(TPASS, "expected failure; Got %s",
+ test_cases[ind].err_desc);
+ } else {
+ tst_resm(TFAIL, "Call failed to produce "
+ "expected error; Expected errno: %d "
+ "Got : %d, %s",
+ test_cases[ind].exp_errno,
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
+ }
+
+ cleanup();
+ tst_exit();
- TST_EXP_FAIL(sched_getparam(*(tc->pid), tc->p), tc->exp_errno, "%s", tc->desc);
}
-static void setup(void)
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
{
- unused_pid = tst_get_unused_pid();
+ unused_pid = tst_get_unused_pid(cleanup);
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
}
-static struct tst_test test = {
- .setup = setup,
- .tcnt = ARRAY_SIZE(test_cases),
- .test = verify_sched_getparam,
-};
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/sched_getscheduler/Makefile b/testcases/kernel/syscalls/sched_getscheduler/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_getscheduler/Makefile
+++ b/testcases/kernel/syscalls/sched_getscheduler/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/Makefile b/testcases/kernel/syscalls/sched_rr_get_interval/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/Makefile
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
index 5da5fe51d..b6084f673 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
@@ -1,84 +1,142 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
*
- * Gets round-robin time quantum by calling sched_rr_get_interval() and
- * checks that the value is sane.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * It is also a regression test for kernel
- * commit 975e155ed873 ("sched/rt: Show the 'sched_rr_timeslice' SCHED_RR
- * timeslice tuning knob in milliseconds").
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : sched_rr_get_interval01
+ *
+ * EXECUTED BY : root / superuser
+ *
+ * TEST TITLE : Basic test for sched_rr_get_interval(2)
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a Phase I test for the sched_rr_get_interval(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ * Change scheduling policy to SCHED_RR
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if it is 0,
+ * Test passed.
+ * Otherwise
+ * Test failed
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * sched_rr_get_interval01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
+#include <errno.h>
#include <sched.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
+#include "test.h"
-#define PROC_SCHED_RR_TIMESLICE_MS "/proc/sys/kernel/sched_rr_timeslice_ms"
-static int proc_flag;
+static void setup();
+static void cleanup();
-struct tst_ts tp;
+char *TCID = "sched_rr_get_interval01";
+int TST_TOTAL = 1;
-static struct time64_variants variants[] = {
- { .sched_rr_get_interval = libc_sched_rr_get_interval, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+struct timespec tp;
-#if (__NR_sched_rr_get_interval != __LTP__NR_INVALID_SYSCALL)
- { .sched_rr_get_interval = sys_sched_rr_get_interval, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+int main(int ac, char **av)
+{
-#if (__NR_sched_rr_get_interval_time64 != __LTP__NR_INVALID_SYSCALL)
- { .sched_rr_get_interval = sys_sched_rr_get_interval64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+ int lc;
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct sched_param p = { 1 };
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
- tst_res(TINFO, "Testing variant: %s", tv->desc);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- tp.type = tv->ts_type;
+ tst_count = 0;
- if ((sched_setscheduler(0, SCHED_RR, &p)) == -1)
- tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
+ /*
+ * Call sched_rr_get_interval(2) with pid=0 so that it will
+ * write into the timespec structure pointed to by tp, the
+ * round robin time quantum for the current process.
+ */
+ TEST(sched_rr_get_interval(0, &tp));
+
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "sched_rr_get_interval() returned %ld",
+ TEST_RETURN);
+ } else {
+ tst_resm(TFAIL | TTERRNO,
+ "Test Failed, sched_rr_get_interval()"
+ "returned %ld", TEST_RETURN);
+ }
+ }
+
+ /* cleanup and exit */
+ cleanup();
+ tst_exit();
- proc_flag = !access(PROC_SCHED_RR_TIMESLICE_MS, F_OK);
}
-static void run(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- struct time64_variants *tv = &variants[tst_variant];
+ tst_require_root();
+ /*
+ * Initialize scheduling parameter structure to use with
+ * sched_setscheduler()
+ */
+ struct sched_param p = { 1 };
- TEST(tv->sched_rr_get_interval(0, tst_ts_get(&tp)));
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- if (!TST_RET) {
- tst_res(TPASS, "sched_rr_get_interval() passed");
- } else {
- tst_res(TFAIL | TTERRNO, "Test Failed, sched_rr_get_interval() returned %ld",
- TST_RET);
- }
+ TEST_PAUSE;
- if (!tst_ts_valid(&tp)) {
- tst_res(TPASS, "Time quantum %llis %llins",
- tst_ts_get_sec(tp), tst_ts_get_nsec(tp));
- } else {
- tst_res(TFAIL, "Invalid time quantum %llis %llins",
- tst_ts_get_sec(tp), tst_ts_get_nsec(tp));
+ /* Change scheduling policy to SCHED_RR */
+ if ((sched_setscheduler(0, SCHED_RR, &p)) == -1) {
+ tst_brkm(TBROK, cleanup, "sched_setscheduler() failed");
}
-
- if (proc_flag)
- TST_ASSERT_INT("/proc/sys/kernel/sched_rr_timeslice_ms", tst_ts_to_ms(tp));
}
-static struct tst_test test = {
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_root = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "975e155ed873"},
- {}
- }
-};
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
index 9a0b8673d..6bf743f78 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
@@ -1,65 +1,146 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
*
- * Verify that for a process with scheduling policy SCHED_FIFO,
- * sched_rr_get_interval() writes zero into timespec structure
- * for tv_sec & tv_nsec.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : sched_rr_get_interval02
+ *
+ * EXECUTED BY : root / superuser
+ *
+ * TEST TITLE : Functionality test
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verify that for a process with scheduling policy SCHED_FIFO,
+ * sched_rr_get_interval() writes zero into timespec structure
+ * for tv_sec & tv_nsec.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ * Change scheduling policy to SCHED_FIFO
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check (return code == 0) & (got 0 for tv_sec & tv_nsec )
+ * Test passed.
+ * Otherwise
+ * Test failed
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * sched_rr_get_interval02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
+#include <errno.h>
#include <sched.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
-
-static struct tst_ts tp;
+#include "test.h"
-static struct time64_variants variants[] = {
- { .sched_rr_get_interval = libc_sched_rr_get_interval, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static void setup();
+static void cleanup();
-#if (__NR_sched_rr_get_interval != __LTP__NR_INVALID_SYSCALL)
- { .sched_rr_get_interval = sys_sched_rr_get_interval, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+char *TCID = "sched_rr_get_interval02";
+int TST_TOTAL = 1;
-#if (__NR_sched_rr_get_interval_time64 != __LTP__NR_INVALID_SYSCALL)
- { .sched_rr_get_interval = sys_sched_rr_get_interval64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+struct timespec tp;
-static void setup(void)
+int main(int ac, char **av)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct sched_param p = { 1 };
- tst_res(TINFO, "Testing variant: %s", tv->desc);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ tp.tv_sec = 99;
+ tp.tv_nsec = 99;
+ /*
+ * Call sched_rr_get_interval(2) with pid=0 sothat it will
+ * write into the timespec structure pointed to by tp the
+ * round robin time quantum for the current process.
+ */
+ TEST(sched_rr_get_interval(0, &tp));
- tp.type = tv->ts_type;
+ if ((TEST_RETURN == 0) && (tp.tv_sec == 0) && (tp.tv_nsec == 0)) {
+ tst_resm(TPASS, "Test passed");
+ } else {
+ tst_resm(TFAIL, "Test Failed, sched_rr_get_interval()"
+ "returned %ld, errno = %d : %s, tp.tv_sec = %d,"
+ " tp.tv_nsec = %ld", TEST_RETURN, TEST_ERRNO,
+ strerror(TEST_ERRNO), (int)tp.tv_sec,
+ tp.tv_nsec);
+ }
+ }
+
+ /* cleanup and exit */
+ cleanup();
+ tst_exit();
- if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1)
- tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
}
-static void run(void)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- struct time64_variants *tv = &variants[tst_variant];
+ tst_require_root();
+ /*
+ * Initialize scheduling parameter structure to use with
+ * sched_setscheduler()
+ */
+ struct sched_param p = { 1 };
- tst_ts_set_sec(&tp, 99);
- tst_ts_set_nsec(&tp, 99);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- TEST(tv->sched_rr_get_interval(0, tst_ts_get(&tp)));
+ TEST_PAUSE;
- if (!TST_RET && tst_ts_valid(&tp) == -1) {
- tst_res(TPASS, "sched_rr_get_interval() passed");
- } else {
- tst_res(TFAIL | TTERRNO,
- "sched_rr_get_interval() returned %ld, tp.tv_sec = %lld, tp.tv_nsec = %lld",
- TST_RET, tst_ts_get_sec(tp), tst_ts_get_nsec(tp));
+ /* Change scheduling policy to SCHED_FIFO */
+ if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1) {
+ tst_brkm(TBROK, cleanup, "sched_setscheduler() failed");
}
}
-static struct tst_test test = {
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_root = 1,
-};
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
index 0c9887f36..56f2fcf28 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
@@ -1,95 +1,171 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
*
- * Verify that
- * 1) sched_rr_get_interval() fails with errno set to EINVAL for an
- * invalid pid
- * 2) sched_rr_get_interval() fails with errno set to ESRCH if the
- * process with specified pid does not exists
- * 3) sched_rr_get_interval() fails with errno set to EFAULT if the
- * address specified as &tp is invalid
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
+/**********************************************************
+ *
+ * TEST IDENTIFIER : sched_rr_get_interval03
+ *
+ * EXECUTED BY : root / superuser
+ *
+ * TEST TITLE : Tests for error conditions
+ *
+ * TEST CASE TOTAL : 3
+ *
+ * AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * Verify that
+ * 1) sched_rr_get_interval() fails with errno set to EINVAL for an
+ * invalid pid
+ * 2) sched_rr_get_interval() fails with errno set to ESRCH if the
+ * process with specified pid does not exists
+ * 2) sched_rr_get_interval() fails with errno set to EFAULT if the
+ * address specified as &tp is invalid
+ *
+ * Setup:
+ * Setup signal handling.
+ * Set expected errors for logging.
+ * Pause for SIGUSR1 if option specified.
+ * Change scheduling policy to SCHED_RR
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * if call fails with expected errno,
+ * Test passed.
+ * Otherwise
+ * Test failed
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * sched_rr_get_interval03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -h : Show help screen
+ * -f : Turn off functional testing
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ ****************************************************************/
+#include <errno.h>
#include <sched.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
+#include "test.h"
+
+static void setup();
+static void cleanup();
+
+char *TCID = "sched_rr_get_interval03";
+struct timespec tp;
static pid_t unused_pid;
static pid_t inval_pid = -1;
static pid_t zero_pid;
-static struct tst_ts tp;
-static void *bad_addr;
-
struct test_cases_t {
pid_t *pid;
- struct tst_ts *tp;
+ struct timespec *tp;
int exp_errno;
} test_cases[] = {
- { &inval_pid, &tp, EINVAL},
- { &unused_pid, &tp, ESRCH},
- { &zero_pid, NULL, EFAULT}
+ {
+ &inval_pid, &tp, EINVAL}, {
+ &unused_pid, &tp, ESRCH},
+#ifndef UCLINUX
+ /* Skip since uClinux does not implement memory protection */
+ {
+ &zero_pid, (struct timespec *)-1, EFAULT}
+#endif
};
-static struct time64_variants variants[] = {
- { .sched_rr_get_interval = libc_sched_rr_get_interval, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-#if (__NR_sched_rr_get_interval != __LTP__NR_INVALID_SYSCALL)
- { .sched_rr_get_interval = sys_sched_rr_get_interval, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+int main(int ac, char **av)
+{
-#if (__NR_sched_rr_get_interval_time64 != __LTP__NR_INVALID_SYSCALL)
- { .sched_rr_get_interval = sys_sched_rr_get_interval64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+ int lc, i;
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct sched_param p = { 1 };
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
- tst_res(TINFO, "Testing variant: %s", tv->desc);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- bad_addr = tst_get_bad_addr(NULL);
- tp.type = tv->ts_type;
+ tst_count = 0;
- if ((sched_setscheduler(0, SCHED_RR, &p)) == -1)
- tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
+ for (i = 0; i < TST_TOTAL; ++i) {
+ /*
+ * Call sched_rr_get_interval(2)
+ */
+ TEST(sched_rr_get_interval(*(test_cases[i].pid),
+ test_cases[i].tp));
+
+ if ((TEST_RETURN == -1) &&
+ (TEST_ERRNO == test_cases[i].exp_errno)) {
+ tst_resm(TPASS, "Test Passed");
+ } else {
+ tst_resm(TFAIL | TTERRNO, "Test Failed,"
+ " sched_rr_get_interval() returned %ld",
+ TEST_RETURN);
+ }
+ }
+ }
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
- unused_pid = tst_get_unused_pid();
}
-static void run(unsigned int i)
+/* setup() - performs all ONE TIME setup for this test */
+void setup(void)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct test_cases_t *tc = &test_cases[i];
- struct timerspec *ts;
+ tst_require_root();
+ /*
+ * Initialize scheduling parameter structure to use with
+ * sched_setscheduler()
+ */
+ struct sched_param p = { 1 };
- if (tc->exp_errno == EFAULT)
- ts = bad_addr;
- else
- ts = tst_ts_get(tc->tp);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- TEST(tv->sched_rr_get_interval(*tc->pid, ts));
+ TEST_PAUSE;
- if (TST_RET != -1) {
- tst_res(TFAIL, "sched_rr_get_interval() passed unexpectedly");
- return;
+ /* Change scheduling policy to SCHED_RR */
+ if ((sched_setscheduler(0, SCHED_RR, &p)) == -1) {
+ tst_brkm(TBROK, cleanup, "sched_setscheduler() failed");
}
- if (tc->exp_errno == TST_ERR)
- tst_res(TPASS | TTERRNO, "sched_rr_get_interval() failed as expected");
- else
- tst_res(TFAIL | TTERRNO, "sched_rr_get_interval() failed unexpectedly: %s",
- tst_strerrno(tc->exp_errno));
+ unused_pid = tst_get_unused_pid(cleanup);
}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(test_cases),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_root = 1,
-};
+/*
+ *cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/sched_setaffinity/Makefile b/testcases/kernel/syscalls/sched_setaffinity/Makefile
index cdb5c3afc..6055d11bf 100644
--- a/testcases/kernel/syscalls/sched_setaffinity/Makefile
+++ b/testcases/kernel/syscalls/sched_setaffinity/Makefile
@@ -1,5 +1,19 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c b/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
index a56ae1f50..d9d6530e2 100644
--- a/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
+++ b/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
@@ -95,16 +95,16 @@ static void setup(void)
mask = CPU_ALLOC(ncpus);
if (!mask)
- tst_brk(TBROK | TERRNO, "CPU_ALLOC() failed");
+ tst_brk(TBROK | TTERRNO, "CPU_ALLOC() failed");
mask_size = CPU_ALLOC_SIZE(ncpus);
if (sched_getaffinity(0, mask_size, mask) < 0)
- tst_brk(TBROK | TERRNO, "sched_getaffinity() failed");
+ tst_brk(TBROK | TTERRNO, "sched_getaffinity() failed");
emask = CPU_ALLOC(ncpus + 1);
if (!emask)
- tst_brk(TBROK | TERRNO, "CPU_ALLOC() failed");
+ tst_brk(TBROK | TTERRNO, "CPU_ALLOC() failed");
emask_size = CPU_ALLOC_SIZE(ncpus + 1);
CPU_ZERO_S(emask_size, emask);
diff --git a/testcases/kernel/syscalls/sched_setattr/Makefile b/testcases/kernel/syscalls/sched_setattr/Makefile
index 8fd2bd6f2..30718a9ce 100644
--- a/testcases/kernel/syscalls/sched_setattr/Makefile
+++ b/testcases/kernel/syscalls/sched_setattr/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Huawei Technologies Co., Ltd., 2015
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_setparam/Makefile b/testcases/kernel/syscalls/sched_setparam/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_setparam/Makefile
+++ b/testcases/kernel/syscalls/sched_setparam/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_setscheduler/Makefile b/testcases/kernel/syscalls/sched_setscheduler/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/Makefile
+++ b/testcases/kernel/syscalls/sched_setscheduler/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
index 9045d0366..22f4e34f4 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
+++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
@@ -130,11 +130,11 @@ static void setup(void)
tst_res(TINFO, "Setting init sched policy to SCHED_OTHER");
if (sched_setscheduler(0, SCHED_OTHER, &param[0]) != 0)
- tst_res(TFAIL | TERRNO,
+ tst_res(TBROK | TERRNO,
"ERROR sched_setscheduler: (0, SCHED_OTHER, param)");
if (sched_getscheduler(0) != SCHED_OTHER)
- tst_res(TFAIL | TERRNO, "ERROR sched_setscheduler");
+ tst_res(TBROK | TERRNO, "ERROR sched_setscheduler");
tst_res(TINFO, "Setting euid to nobody to drop privilege");
diff --git a/testcases/kernel/syscalls/sched_yield/Makefile b/testcases/kernel/syscalls/sched_yield/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sched_yield/Makefile
+++ b/testcases/kernel/syscalls/sched_yield/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/select/Makefile b/testcases/kernel/syscalls/select/Makefile
index 2c5e10e60..aed044fd0 100644
--- a/testcases/kernel/syscalls/select/Makefile
+++ b/testcases/kernel/syscalls/select/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/select/select01.c b/testcases/kernel/syscalls/select/select01.c
index 4bf386160..e9100c78e 100644
--- a/testcases/kernel/syscalls/select/select01.c
+++ b/testcases/kernel/syscalls/select/select01.c
@@ -1,123 +1,126 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
* http://www.sgi.com
*
- * AUTHOR : Richard Logan
- * CO-PILOT : William Roske
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ */
+/*
+ * AUTHOR : Richard Logan
+ * CO-PILOT : William Roske
+ * DATE STARTED : 02/24/93
*
- * 1.) select(2) to fd of regular file with no I/O and small timeout
- * 2.) select(2) to fd of system pipe with no I/O and small timeout
- * 3.) select(2) of fd of a named-pipe (FIFO) with no I/O and small timeout value
+ * 1.) select(2) to a fd of regular file with no I/O and small timeout
*/
-#include <unistd.h>
#include <errno.h>
-#include <sys/time.h>
-#include <sys/types.h>
+#include <signal.h>
#include <fcntl.h>
-#include "select_var.h"
-
-static fd_set readfds_reg, readfds_pipe, writefds_pipe, readfds_npipe, writefds_npipe;
-static int fd_reg, fds_pipe[2], fd_npipe;
-
-static struct tcases {
- int *nfds;
- fd_set *readfds;
- fd_set *writefds;
- int *readfd;
- int *writefd;
- char *desc;
-} tests[] = {
- {&fd_reg, &readfds_reg, NULL, &fd_reg, NULL, "with regular file"},
- {&fds_pipe[1], &readfds_pipe, &writefds_pipe, &fds_pipe[0], &fds_pipe[1], "with system pipe"},
- {&fd_npipe, &readfds_npipe, &writefds_npipe, &fd_npipe, &fd_npipe, "with named pipe (FIFO)"},
-};
-
-static void run(unsigned int n)
+#include <signal.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include "test.h"
+
+#define FILENAME "select01"
+
+static void setup(void);
+static void cleanup(void);
+
+char *TCID = "select01";
+int TST_TOTAL = 1;
+
+int Fd = -1;
+fd_set Readfds;
+
+int main(int ac, char **av)
{
- struct tcases *tc = &tests[n];
+ int lc;
struct timeval timeout;
- char buf;
- int exp_ret = 1;
+ long test_time = 0; /* in usecs */
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
+ tst_parse_opts(ac, av, NULL, NULL);
- if (tc->writefd) {
- SAFE_WRITE(0, *tc->writefd, &buf, sizeof(buf));
- exp_ret++;
- }
+ setup();
- TEST(do_select(*tc->nfds + 1, tc->readfds, tc->writefds, 0, &timeout));
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "select() %s failed", tc->desc);
- return;
- }
+ test_time = ((lc % 2000) * 100000); /* 100 milli-seconds */
- if (!TST_RET) {
- tst_res(TFAIL, "select() %s timed out", tc->desc);
- return;
- }
+ if (test_time > 1000000 * 60)
+ test_time = test_time % (1000000 * 60);
- if (TST_RET != exp_ret) {
- tst_res(TFAIL, "select() %s returned %lu expected %d",
- tc->desc, TST_RET, exp_ret);
- return;
- }
+ timeout.tv_sec = test_time / 1000000;
+ timeout.tv_usec = test_time - (timeout.tv_sec * 1000000);
+
+ TEST(select(4, &Readfds, 0, 0, &timeout));
- tst_res(TPASS, "select() %s returned %i", tc->desc, exp_ret);
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL,
+ "%d select(4, &Readfds, 0, 0, &timeout), timeout = %ld usecs, errno=%d",
+ lc, test_time, errno);
+ }
- if (FD_ISSET(*tc->readfd, tc->readfds))
- tst_res(TPASS, "readfds bit %i is set", *tc->readfd);
- else
- tst_res(TFAIL, "readfds bit %i is not set", *tc->readfd);
+ tst_resm(TPASS,
+ "select(4, &Readfds, 0, 0, &timeout) timeout = %ld usecs",
+ test_time);
- if (!tc->writefd)
- return;
+ }
- if (FD_ISSET(*tc->writefd, tc->writefds))
- tst_res(TPASS, "writefds bit %i is set", *tc->writefd);
- else
- tst_res(TPASS, "writefds bit %i is not set", *tc->writefd);
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- select_info();
-
- /* Regular file */
- fd_reg = SAFE_OPEN("tmpfile1", O_CREAT | O_RDWR, 0777);
- FD_ZERO(&readfds_reg);
- FD_SET(fd_reg, &readfds_reg);
-
- /* System pipe*/
- SAFE_PIPE(fds_pipe);
- FD_ZERO(&readfds_pipe);
- FD_ZERO(&writefds_pipe);
- FD_SET(fds_pipe[0], &readfds_pipe);
- FD_SET(fds_pipe[1], &writefds_pipe);
-
- /* Named pipe (FIFO) */
- SAFE_MKFIFO("tmpfile2", 0666);
- fd_npipe = SAFE_OPEN("tmpfile2", O_RDWR);
- FD_ZERO(&readfds_npipe);
- FD_ZERO(&writefds_npipe);
- FD_SET(fd_npipe, &readfds_npipe);
- FD_SET(fd_npipe, &writefds_npipe);
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ if ((Fd = open(FILENAME, O_CREAT | O_RDWR, 0777)) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "open(%s, O_CREAT | O_RDWR) failed", FILENAME);
+
+ FD_ZERO(&Readfds);
+ FD_SET(Fd, &Readfds);
}
static void cleanup(void)
{
- SAFE_UNLINK("tmpfile2");
-}
+ if (Fd >= 0) {
+ if (close(Fd) == -1)
+ tst_resm(TWARN | TERRNO, "close(%s) failed", FILENAME);
+ Fd = -1;
+ }
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tests),
- .test_variants = TEST_VARIANTS,
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/select/select02.c b/testcases/kernel/syscalls/select/select02.c
index 784ec9211..7aa0107c0 100644
--- a/testcases/kernel/syscalls/select/select02.c
+++ b/testcases/kernel/syscalls/select/select02.c
@@ -1,65 +1,114 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (C) 2015-2017 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
-
/*
- * Check that select() timeouts correctly.
+ * AUTHOR : Richard Logan
+ * CO-PILOT : Glen Overby
+ * DATE STARTED : 02/24/93
+ *
+ * TEST CASES
+ * 1.) select(2) to fd of system pipe with no I/O and small timeout
*/
-#include <unistd.h>
#include <errno.h>
-#include <sys/time.h>
-#include <sys/types.h>
+#include <signal.h>
#include <fcntl.h>
+#include <signal.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include "test.h"
+#include "safe_macros.h"
-#include "tst_timer_test.h"
+static void setup(void);
-#include "select_var.h"
+char *TCID = "select02";
+int TST_TOTAL = 1;
-static int fds[2];
+int Fd[2];
+fd_set saved_Readfds, saved_Writefds;
+fd_set Readfds, Writefds;
-static int sample_fn(int clk_id, long long usec)
+int main(int ac, char **av)
{
- struct timeval timeout = tst_us_to_timeval(usec);
- fd_set sfds;
+ int lc;
+ struct timeval timeout;
+ long test_time = 0; /* in usecs */
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
- FD_ZERO(&sfds);
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- FD_SET(fds[0], &sfds);
+ test_time = ((lc % 2000) * 100000); /* 100 milli-seconds */
- tst_timer_start(clk_id);
- TEST(do_select(1, &sfds, NULL, NULL, &timeout));
- tst_timer_stop();
- tst_timer_sample();
+ if (test_time > 1000000 * 60)
+ test_time = test_time % (1000000 * 60);
+
+ timeout.tv_sec = test_time / 1000000;
+ timeout.tv_usec = test_time - (timeout.tv_sec * 1000000);
+
+ Readfds = saved_Readfds;
+ Writefds = saved_Writefds;
+
+ TEST(select(5, &Readfds, &Writefds, 0, &timeout));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL,
+ "%d select(5, &Readfds, &Writefds, 0, &timeout) failed, errno=%d\n",
+ lc, errno);
+ } else {
+ tst_resm(TPASS,
+ "select(5, &Readfds, &Writefds, 0, &timeout) timeout = %ld usecs",
+ test_time);
+ }
- if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO, "select() returned %li", TST_RET);
- return 1;
}
- return 0;
+ tst_exit();
}
static void setup(void)
{
- select_info();
+ tst_sig(FORK, DEF_HANDLER, NULL);
- SAFE_PIPE(fds);
-}
+ TEST_PAUSE;
-static void cleanup(void)
-{
- if (fds[0] > 0)
- SAFE_CLOSE(fds[0]);
+ SAFE_PIPE(NULL, Fd);
- if (fds[1] > 0)
- SAFE_CLOSE(fds[1]);
+ FD_ZERO(&saved_Readfds);
+ FD_ZERO(&saved_Writefds);
+ FD_SET(Fd[0], &saved_Readfds);
+ FD_SET(Fd[1], &saved_Writefds);
}
-
-static struct tst_test test = {
- .scall = "select()",
- .sample = sample_fn,
- .setup = setup,
- .test_variants = TEST_VARIANTS,
- .cleanup = cleanup,
-};
diff --git a/testcases/kernel/syscalls/select/select03.c b/testcases/kernel/syscalls/select/select03.c
index 1cec3a4c7..da7fdb094 100644
--- a/testcases/kernel/syscalls/select/select03.c
+++ b/testcases/kernel/syscalls/select/select03.c
@@ -1,125 +1,134 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2020 Linaro Ltd.
+ * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
- * Failure tests.
+ */
+/*
+ * AUTHOR : Richard Logan
+ * CO-PILOT : Glen Overby
+ * DATE STARTED : 02/24/93
+ *
+ * 1.) select(2) of fd of a named-pipe (FIFO) with no I/O and small timeout value
*/
-#include <unistd.h>
#include <errno.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
+#include <signal.h>
#include <fcntl.h>
-#include "select_var.h"
-
-static fd_set readfds_reg, writefds_reg, fds_closed;
-static fd_set *preadfds_reg = &readfds_reg, *pwritefds_reg = &writefds_reg;
-static fd_set *pfds_closed = &fds_closed, *nullfds = NULL, *faulty_fds;
-static int fd_closed, fd[2];
-static int negative_nfds = -1, maxfds;
-static struct timeval timeout = {.tv_sec = 0, .tv_usec = 100000};
-
-static struct timeval *valid_to = &timeout, *invalid_to;
-
-static struct tcases {
- char *name;
- int *nfds;
- fd_set **readfds;
- fd_set **writefds;
- fd_set **exceptfds;
- struct timeval **timeout;
- int exp_errno;
-} tests[] = {
- { "Negative nfds", &negative_nfds, &preadfds_reg, &pwritefds_reg, &nullfds, &valid_to, EINVAL },
- { "Invalid readfds", &maxfds, &pfds_closed, &pwritefds_reg, &nullfds, &valid_to, EBADF },
- { "Invalid writefds", &maxfds, &preadfds_reg, &pfds_closed, &nullfds, &valid_to, EBADF },
- { "Invalid exceptfds", &maxfds, &preadfds_reg, &pwritefds_reg, &pfds_closed, &valid_to, EBADF },
- { "Faulty readfds", &maxfds, &faulty_fds, &pwritefds_reg, &nullfds, &valid_to, EFAULT },
- { "Faulty writefds", &maxfds, &preadfds_reg, &faulty_fds, &nullfds, &valid_to, EFAULT },
- { "Faulty exceptfds", &maxfds, &preadfds_reg, &pwritefds_reg, &faulty_fds, &valid_to, EFAULT },
- { "Faulty timeout", &maxfds, &preadfds_reg, &pwritefds_reg, &nullfds, &invalid_to, EFAULT },
-};
-
-static void verify_select(unsigned int n)
-{
- struct tcases *tc = &tests[n];
+#include <signal.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
- TEST(do_select_faulty_to(*tc->nfds, *tc->readfds, *tc->writefds,
- *tc->exceptfds, *tc->timeout,
- tc->timeout == &invalid_to));
+#include "test.h"
+#include "safe_macros.h"
- if (TST_RET != -1) {
- tst_res(TFAIL, "%s: select() passed unexpectedly with %ld",
- tc->name, TST_RET);
- return;
- }
+#define FILENAME "select03"
- if (tc->exp_errno != TST_ERR) {
- tst_res(TFAIL | TTERRNO, "%s: select()() should fail with %s",
- tc->name, tst_strerrno(tc->exp_errno));
- return;
- }
+static void setup(void);
+static void cleanup(void);
- tst_res(TPASS | TTERRNO, "%s: select() failed as expected", tc->name);
+char *TCID = "select03";
+int TST_TOTAL = 1;
- exit(0);
-}
+int Fd;
+fd_set saved_Readfds, saved_Writefds;
+fd_set Readfds, Writefds;
-static void run(unsigned int n)
+int main(int ac, char **av)
{
- int pid, status;
+ int lc;
+ struct timeval timeout;
+ long test_time = 0; /* in usecs */
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
- pid = SAFE_FORK();
- if (!pid)
- verify_select(n);
+ test_time = ((lc % 2000) * 100000); /* 100 milli-seconds */
- SAFE_WAITPID(pid, &status, 0);
+ if (test_time > 1000000 * 60)
+ test_time = test_time % (1000000 * 60);
- if (WIFEXITED(status))
- return;
+ timeout.tv_sec = test_time / 1000000;
+ timeout.tv_usec = test_time - (timeout.tv_sec * 1000000);
+
+ Readfds = saved_Readfds;
+ Writefds = saved_Writefds;
+
+ TEST(select(5, &Readfds, &Writefds, 0, &timeout));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL,
+ "%d select(5, &Readfds, &Writefds, 0, &timeout) failed errno=%d\n",
+ lc, errno);
+ } else {
+ tst_resm(TPASS,
+ "select(5, &Readfds, &Writefds, 0, &timeout) timeout = %ld usecs",
+ test_time);
+ }
- if (tst_variant == GLIBC_SELECT_VARIANT &&
- tests[n].timeout == &invalid_to &&
- WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
- tst_res(TPASS, "%s: select() killed by signal", tests[n].name);
- return;
}
- tst_res(TFAIL, "Child %s", tst_strstatus(status));
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- void *faulty_address;
- select_info();
+ tst_sig(FORK, DEF_HANDLER, cleanup);
- /* Regular file */
- fd_closed = SAFE_OPEN("tmpfile1", O_CREAT | O_RDWR, 0777);
- FD_ZERO(&fds_closed);
- FD_SET(fd_closed, &fds_closed);
+ TEST_PAUSE;
- SAFE_PIPE(fd);
- FD_ZERO(&readfds_reg);
- FD_ZERO(&writefds_reg);
- FD_SET(fd[0], &readfds_reg);
- FD_SET(fd[1], &writefds_reg);
+ tst_tmpdir();
- SAFE_CLOSE(fd_closed);
+ SAFE_MKFIFO(cleanup, FILENAME, 0777);
- maxfds = fd[1] + 1;
- faulty_address = tst_get_bad_addr(NULL);
- invalid_to = faulty_address;
- faulty_fds = faulty_address;
+ if ((Fd = open(FILENAME, O_RDWR)) == -1) {
+ tst_brkm(TBROK, cleanup, "open(%s, O_RDWR) failed, errno=%d",
+ FILENAME, errno);
+ }
+
+ FD_ZERO(&saved_Readfds);
+ FD_ZERO(&saved_Writefds);
+ FD_SET(Fd, &saved_Readfds);
+ FD_SET(Fd, &saved_Writefds);
}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tests),
- .test_variants = TEST_VARIANTS,
- .setup = setup,
- .needs_tmpdir = 1,
- .forks_child = 1,
-};
+static void cleanup(void)
+{
+ close(Fd);
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/select/select04.c b/testcases/kernel/syscalls/select/select04.c
index f7a463ee1..64aa4ac9b 100644
--- a/testcases/kernel/syscalls/select/select04.c
+++ b/testcases/kernel/syscalls/select/select04.c
@@ -1,88 +1,78 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2020 Linaro Limited. All rights reserved.
- * Author: Viresh Kumar <viresh.kumar@linaro.org>
- */
-
-/*\
- * [Description]
+ * Copyright (C) 2015-2017 Cyril Hrubis <chrubis@suse.cz>
*
- * Test to check if fd set bits are cleared by select().
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * [Algorithm]
- * - Check that writefds flag is cleared on full pipe
- * - Check that readfds flag is cleared on empty pipe
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/*
+ * Check that select() timeouts correctly.
+ */
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
-#include "select_var.h"
-static fd_set readfds_pipe, writefds_pipe;
-static int fd_empty[2], fd_full[2];
+#include "tst_timer_test.h"
-static struct tcases {
- int *fd;
- fd_set *readfds;
- fd_set *writefds;
- char *desc;
-} tests[] = {
- {&fd_empty[0], &readfds_pipe, NULL, "No data to read"},
- {&fd_full[1], NULL, &writefds_pipe, "No space to write"},
-};
+#include "select_var.h"
-static void run(unsigned int n)
+static int fds[2];
+
+static int sample_fn(int clk_id, long long usec)
{
- struct tcases *tc = &tests[n];
- struct timeval timeout = {.tv_sec = 0, .tv_usec = 1000};
+ struct timeval timeout = tst_us_to_timeval(usec);
+ fd_set sfds;
- FD_SET(fd_empty[0], &readfds_pipe);
- FD_SET(fd_full[1], &writefds_pipe);
+ FD_ZERO(&sfds);
- TEST(do_select(*tc->fd + 1, tc->readfds, tc->writefds, NULL, &timeout));
+ FD_SET(fds[0], &sfds);
- if (TST_RET) {
- tst_res(TFAIL, "%s: select() should have timed out", tc->desc);
- return;
- }
+ tst_timer_start(clk_id);
+ TEST(do_select(1, &sfds, NULL, NULL, &timeout));
+ tst_timer_stop();
+ tst_timer_sample();
- if ((tc->readfds && FD_ISSET(*tc->fd, tc->readfds)) ||
- (tc->writefds && FD_ISSET(*tc->fd, tc->writefds))) {
- tst_res(TFAIL, "%s: select() didn't clear the fd set", tc->desc);
- return;
+ if (TST_RET != 0) {
+ tst_res(TFAIL | TTERRNO, "select() returned %li", TST_RET);
+ return 1;
}
- tst_res(TPASS, "%s: select() cleared the fd set", tc->desc);
+ return 0;
}
static void setup(void)
{
- int buf = 0;
-
select_info();
- SAFE_PIPE(fd_empty);
- FD_ZERO(&readfds_pipe);
-
- SAFE_PIPE2(fd_full, O_NONBLOCK);
- FD_ZERO(&writefds_pipe);
+ SAFE_PIPE(fds);
+}
- /* Make the write buffer full for fd_full */
- do {
- TEST(write(fd_full[1], &buf, sizeof(buf)));
- } while (TST_RET != -1);
+static void cleanup(void)
+{
+ if (fds[0] > 0)
+ SAFE_CLOSE(fds[0]);
- if (TST_ERR != EAGAIN)
- tst_res(TFAIL | TTERRNO, "write() failed with unexpected error");
+ if (fds[1] > 0)
+ SAFE_CLOSE(fds[1]);
}
static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tests),
- .test_variants = TEST_VARIANTS,
+ .scall = "select()",
+ .sample = sample_fn,
.setup = setup,
- .needs_tmpdir = 1,
+ .test_variants = TEST_VARIANTS,
+ .cleanup = cleanup,
};
diff --git a/testcases/kernel/syscalls/select/select_var.h b/testcases/kernel/syscalls/select/select_var.h
index a17b2fdd6..b19a1d1bf 100644
--- a/testcases/kernel/syscalls/select/select_var.h
+++ b/testcases/kernel/syscalls/select/select_var.h
@@ -6,7 +6,6 @@
#define SELECT_VAR__
#include "lapi/syscalls.h"
-#include "tst_timer.h"
struct compat_sel_arg_struct {
long _n;
@@ -16,10 +15,7 @@ struct compat_sel_arg_struct {
long _tvp;
};
-#define GLIBC_SELECT_VARIANT 0
-
-static int do_select_faulty_to(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout, int faulty_to)
+static int do_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
{
switch (tst_variant) {
case 0:
@@ -42,49 +38,16 @@ static int do_select_faulty_to(int nfds, fd_set *readfds, fd_set *writefds,
}
case 2: {
int ret;
- struct __kernel_old_timespec _ts;
- void *ts;
-
- if (faulty_to) {
- ts = timeout;
- } else {
- ts = &_ts;
- _ts.tv_sec = timeout->tv_sec;
- _ts.tv_nsec = timeout->tv_usec * 1000;
- }
-
- ret = tst_syscall(__NR_pselect6, nfds, readfds, writefds, exceptfds, ts, NULL);
- if (!faulty_to) {
- timeout->tv_sec = _ts.tv_sec;
- timeout->tv_usec = _ts.tv_nsec / 1000;
- }
- return ret;
- }
- case 3: {
- int ret = 0;
-#if (__NR_pselect6_time64 != __LTP__NR_INVALID_SYSCALL)
- struct __kernel_timespec _ts;
- void *ts;
-
- if (faulty_to) {
- ts = timeout;
- } else {
- ts = &_ts;
- _ts.tv_sec = timeout->tv_sec;
- _ts.tv_nsec = timeout->tv_usec * 1000;
- }
-
- ret = tst_syscall(__NR_pselect6_time64, nfds, readfds, writefds, exceptfds, ts, NULL);
- if (!faulty_to) {
- timeout->tv_sec = _ts.tv_sec;
- timeout->tv_usec = _ts.tv_nsec / 1000;
- }
-#else
- tst_brk(TCONF, "__NR_pselect6 time64 variant not supported");
-#endif
+ struct timespec ts = {
+ .tv_sec = timeout->tv_sec,
+ .tv_nsec = timeout->tv_usec * 1000,
+ };
+ ret = tst_syscall(__NR_pselect6, nfds, readfds, writefds, exceptfds, &ts, NULL);
+ timeout->tv_sec = ts.tv_sec;
+ timeout->tv_usec = ts.tv_nsec / 1000;
return ret;
}
- case 4:
+ case 3:
#ifdef __NR__newselect
return tst_syscall(__NR__newselect, nfds, readfds, writefds, exceptfds, timeout);
#else
@@ -96,12 +59,6 @@ static int do_select_faulty_to(int nfds, fd_set *readfds, fd_set *writefds,
return -1;
}
-static inline int do_select(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout)
-{
- return do_select_faulty_to(nfds, readfds, writefds, exceptfds, timeout, 0);
-}
-
static void select_info(void)
{
switch (tst_variant) {
@@ -115,14 +72,11 @@ static void select_info(void)
tst_res(TINFO, "Testing SYS_pselect6 syscall");
break;
case 3:
- tst_res(TINFO, "Testing SYS_pselect6 time64 syscall");
- break;
- case 4:
tst_res(TINFO, "Testing SYS__newselect syscall");
break;
}
}
-#define TEST_VARIANTS 5
+#define TEST_VARIANTS 4
#endif /* SELECT_VAR__ */
diff --git a/testcases/kernel/syscalls/send/.gitignore b/testcases/kernel/syscalls/send/.gitignore
index ec3cc677c..9394e972f 100644
--- a/testcases/kernel/syscalls/send/.gitignore
+++ b/testcases/kernel/syscalls/send/.gitignore
@@ -1,2 +1 @@
/send01
-/send02
diff --git a/testcases/kernel/syscalls/send/Makefile b/testcases/kernel/syscalls/send/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/send/Makefile
+++ b/testcases/kernel/syscalls/send/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/send/send02.c b/testcases/kernel/syscalls/send/send02.c
deleted file mode 100644
index 4d8da1613..000000000
--- a/testcases/kernel/syscalls/send/send02.c
+++ /dev/null
@@ -1,187 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * Check that the kernel correctly handles send()/sendto()/sendmsg() calls
- * with MSG_MORE flag
- */
-
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <sched.h>
-
-#include "tst_test.h"
-#include "tst_net.h"
-
-#define SENDSIZE 16
-#define RECVSIZE 32
-
-static int sock = -1, dst_sock = -1, listen_sock = -1;
-static struct sockaddr_in addr;
-static char sendbuf[SENDSIZE];
-
-static void do_send(int sock, void *buf, size_t size, int flags)
-{
- SAFE_SEND(1, sock, buf, size, flags);
-}
-
-static void do_sendto(int sock, void *buf, size_t size, int flags)
-{
- SAFE_SENDTO(1, sock, buf, size, flags, (struct sockaddr *)&addr,
- sizeof(addr));
-}
-
-static void do_sendmsg(int sock, void *buf, size_t size, int flags)
-{
- struct msghdr msg;
- struct iovec iov;
-
- iov.iov_base = buf;
- iov.iov_len = size;
- msg.msg_name = &addr;
- msg.msg_namelen = sizeof(addr);
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- msg.msg_flags = 0;
- SAFE_SENDMSG(size, sock, &msg, flags);
-}
-
-static struct test_case {
- int domain, type, protocol;
- void (*send)(int sock, void *buf, size_t size, int flags);
- int needs_connect, needs_accept;
- const char *name;
-} testcase_list[] = {
- {AF_INET, SOCK_STREAM, 0, do_send, 1, 1, "TCP send"},
- {AF_INET, SOCK_DGRAM, 0, do_send, 1, 0, "UDP send"},
- {AF_INET, SOCK_DGRAM, 0, do_sendto, 0, 0, "UDP sendto"},
- {AF_INET, SOCK_DGRAM, 0, do_sendmsg, 0, 0, "UDP sendmsg"}
-};
-
-static void setup(void)
-{
- memset(sendbuf, 0x42, SENDSIZE);
-}
-
-static int check_recv(int sock, long expsize, int loop)
-{
- char recvbuf[RECVSIZE] = {0};
-
- while (1) {
- TEST(recv(sock, recvbuf, RECVSIZE, MSG_DONTWAIT));
-
- if (TST_RET == -1) {
- /* expected error immediately after send(MSG_MORE) */
- if (TST_ERR == EAGAIN || TST_ERR == EWOULDBLOCK) {
- if (expsize)
- continue;
- else
- break;
- }
-
- /* unexpected error */
- tst_res(TFAIL | TTERRNO, "recv() error at step %d, expsize %ld",
- loop, expsize);
- return 0;
- }
-
- if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO, "recv() returns %ld at step %d, expsize %ld",
- TST_RET, loop, expsize);
- return 0;
- }
-
- if (TST_RET != expsize) {
- tst_res(TFAIL, "recv() read %ld bytes, expected %ld, step %d",
- TST_RET, expsize, loop);
- return 0;
- }
- return 1;
- }
-
- return 1;
-}
-
-static void cleanup(void)
-{
- if (sock >= 0)
- SAFE_CLOSE(sock);
-
- if (dst_sock >= 0 && dst_sock != listen_sock)
- SAFE_CLOSE(dst_sock);
-
- if (listen_sock >= 0)
- SAFE_CLOSE(listen_sock);
-}
-
-static void run(unsigned int n)
-{
- int i, ret;
- struct test_case *tc = testcase_list + n;
- socklen_t len = sizeof(addr);
-
- tst_res(TINFO, "Tesing %s", tc->name);
-
- tst_init_sockaddr_inet_bin(&addr, INADDR_LOOPBACK, 0);
- listen_sock = SAFE_SOCKET(tc->domain, tc->type, tc->protocol);
- dst_sock = listen_sock;
- SAFE_BIND(listen_sock, (struct sockaddr *)&addr, sizeof(addr));
- SAFE_GETSOCKNAME(listen_sock, (struct sockaddr *)&addr, &len);
-
- if (tc->needs_accept)
- SAFE_LISTEN(listen_sock, 1);
-
- for (i = 0; i < 1000; i++) {
- sock = SAFE_SOCKET(tc->domain, tc->type, tc->protocol);
-
- if (tc->needs_connect)
- SAFE_CONNECT(sock, (struct sockaddr *)&addr, len);
-
- if (tc->needs_accept)
- dst_sock = SAFE_ACCEPT(listen_sock, NULL, NULL);
-
- tc->send(sock, sendbuf, SENDSIZE, 0);
- ret = check_recv(dst_sock, SENDSIZE, i + 1);
-
- if (!ret)
- break;
-
- tc->send(sock, sendbuf, SENDSIZE, MSG_MORE);
- ret = check_recv(dst_sock, 0, i + 1);
-
- if (!ret)
- break;
-
- tc->send(sock, sendbuf, 1, 0);
- ret = check_recv(dst_sock, SENDSIZE + 1, i + 1);
-
- if (!ret)
- break;
-
- SAFE_CLOSE(sock);
-
- if (dst_sock != listen_sock)
- SAFE_CLOSE(dst_sock);
- }
-
- if (ret)
- tst_res(TPASS, "MSG_MORE works correctly");
-
- cleanup();
- dst_sock = -1;
-}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(testcase_list),
- .setup = setup,
- .cleanup = cleanup
-};
diff --git a/testcases/kernel/syscalls/sendfile/Makefile b/testcases/kernel/syscalls/sendfile/Makefile
index f63a42fe9..1bd1b578d 100644
--- a/testcases/kernel/syscalls/sendfile/Makefile
+++ b/testcases/kernel/syscalls/sendfile/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sendfile/sendfile03.c b/testcases/kernel/syscalls/sendfile/sendfile03.c
index 8783a6c34..cd790ccde 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile03.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile03.c
@@ -1,67 +1,179 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * sendfile03.c
+ *
+ * DESCRIPTION
+ * Testcase to test that sendfile(2) system call returns appropriete
+ * errnos on error.
*
- * Testcase to test that sendfile(2) system call returns EBADF when passing
- * wrong out_fd or in_fd.
+ * ALGORITHM
+ * 1. Call sendfile(2) with out_fd = -1, and expect EBADF to be returned.
+ * 2. Call sendfile(2) with in_fd = -1, and expect EBADF to be returned.
+ * 3. Call sendfile(2) with in_fd = out_fd = -1, and expect EBADF.
*
- * There are four cases:
+ * USAGE: <for command-line>
+ * sendfile03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * - in_fd == -1
- * - out_fd = -1
- * - in_fd opened with O_WRONLY
- * - out_fd opened with O_RDONLY
+ * HISTORY
+ * 07/2001 Ported by Wayne Boyer
+ *
+ * RESTRICTIONS
+ * NONE
*/
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/sendfile.h>
+#include "test.h"
+
+#define FAILED 1
-#include "tst_test.h"
+#ifndef OFF_T
+#define OFF_T off_t
+#endif /* Not def: OFF_T */
-static int in_fd;
-static int out_fd;
-static int negative_fd = -1;
+TCID_DEFINE(sendfile03);
+int TST_TOTAL = 3;
+
+int in_fd, out_fd;
+char in_file[100], out_file[100];
+
+void cleanup(void);
+void setup(void);
+void setup_func1(void);
struct test_case_t {
- int *in_fd;
- int *out_fd;
- const char *desc;
-} tc[] = {
- {&in_fd, &negative_fd, "out_fd=-1"},
- {&in_fd, &in_fd, "out_fd=O_RDONLY"},
- {&negative_fd, &out_fd, "in_fd=-1"},
- {&out_fd, &out_fd, "out_fd=O_WRONLY"},
+ char *desc;
+ void (*setupfunc) ();
+ int out_fd;
+ int in_fd;
+ OFF_T *offset;
+ int count;
+ int exp_errno;
+} testcases[] = {
+ {
+ "Test for EBADF, in_fd = -1", NULL, 8, -1, NULL, 0, EBADF}, {
+ "Test for EBADF, out_fd = -1", NULL, -1, 7, NULL, 0, EBADF}, {
+ "Test for EBADF, in_fd = out_fd = -1", NULL, -1, -1, NULL,
+ 0, EBADF}
};
-static void setup(void)
+int main(int ac, char **av)
{
- in_fd = SAFE_OPEN("in_file", O_CREAT | O_RDONLY, 0600);
- out_fd = SAFE_CREAT("out_file", 0600);
+ int i;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ /*
+ * The following loop checks looping state if -c option given
+ */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; ++i) {
+ if (testcases[i].setupfunc != NULL) {
+ testcases[i].setupfunc();
+ }
+
+ TEST(sendfile(testcases[i].out_fd, testcases[i].in_fd,
+ testcases[i].offset, testcases[i].count));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO != testcases[i].exp_errno) {
+ tst_resm(TFAIL, "sendfile returned unexpected "
+ "errno, expected: %d, got: %d",
+ testcases[i].exp_errno, TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "sendfile() returned %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
+ }
+ cleanup();
+
+ tst_exit();
}
-static void cleanup(void)
+/*
+ * setup() - performs all ONE TIME setup for this test.
+ */
+void setup(void)
{
- SAFE_CLOSE(in_fd);
- SAFE_CLOSE(out_fd);
+ char buf[100];
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /* make a temporary directory and cd to it */
+ tst_tmpdir();
+
+ sprintf(in_file, "in.%d", getpid());
+ if ((in_fd = creat(in_file, 00700)) < 0) {
+ tst_brkm(TBROK, cleanup, "creat failed in setup, errno: %d",
+ errno);
+ }
+ sprintf(buf, "abcdefghijklmnopqrstuvwxyz");
+ if (write(in_fd, buf, strlen(buf)) < 0) {
+ tst_brkm(TBROK, cleanup, "write failed, errno: %d", errno);
+ }
+ close(in_fd);
+ if ((in_fd = open(in_file, O_RDONLY)) < 0) {
+ tst_brkm(TBROK, cleanup, "open failed, errno: %d", errno);
+ }
+ sprintf(out_file, "out.%d", getpid());
+ if ((out_fd = open(out_file, O_TRUNC | O_CREAT | O_RDWR, 0777)) < 0) {
+ tst_brkm(TBROK, cleanup, "open failed, errno: %d", errno);
+ }
}
-static void run(unsigned int i)
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
{
- TST_EXP_FAIL(sendfile(*(tc[i].out_fd), *(tc[i].in_fd), NULL, 1),
- EBADF, "sendfile(..) with %s", tc[i].desc);
-}
+ /*
+ * print timing stats if that option was specified.
+ * print errno log if that option was specified.
+ */
+ close(out_fd);
+ close(in_fd);
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .needs_tmpdir = 1,
- .cleanup = cleanup,
- .setup = setup,
- .test = run,
-};
+ /* delete the test directory created in setup() */
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/sendfile/sendfile04.c b/testcases/kernel/syscalls/sendfile/sendfile04.c
index 67d004c74..0f315abb0 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile04.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile04.c
@@ -1,23 +1,51 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * Copyright (c) Red Hat Inc., 2007
- * 11/2007 Copied from sendfile02.c by Masatake YAMATO
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) Red Hat Inc., 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * sendfile04.c
+ *
+ * DESCRIPTION
+ * Testcase to test that sendfile(2) system call returns EFAULT
+ * when passing wrong buffer.
+ *
+ * ALGORITHM
+ * Given wrong address or protected buffer as OFFSET argument to sendfile.
+ * A wrong address is created by munmap a buffer allocated by mmap.
+ * A protected buffer is created by mmap with specifying protection.
*
- * Testcase to test that sendfile(2) system call returns EFAULT when passing
- * wrong offset pointer.
+ * USAGE: <for command-line>
+ * sendfile04 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where,
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * [Algorithm]
+ * HISTORY
+ * 11/2007 Copyed from sendfile02.c by Masatake YAMATO
*
- * Given wrong address or protected buffer as OFFSET argument to sendfile:
- * - a wrong address is created by munmap a buffer allocated by mmap
- * - a protected buffer is created by mmap with specifying protection
+ * RESTRICTIONS
+ * NONE
*/
-
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
@@ -28,58 +56,232 @@
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include "test.h"
+#include "safe_macros.h"
+
+#ifndef OFF_T
+#define OFF_T off_t
+#endif /* Not def: OFF_T */
+
+TCID_DEFINE(sendfile04);
-#include "tst_test.h"
+char in_file[100];
+char out_file[100];
+int out_fd;
+pid_t child_pid;
+static int sockfd, s;
+static struct sockaddr_in sin1; /* shared between do_child and create_server */
-static int in_fd;
-static int out_fd;
+void cleanup(void);
+void do_child(void);
+void setup(void);
+int create_server(void);
+
+#define PASS_MAPPED_BUFFER 0
+#define PASS_UNMAPPED_BUFFER 1
struct test_case_t {
int protection;
int pass_unmapped_buffer;
- const char *desc;
-} tc[] = {
- {PROT_NONE, 0, "pass_mapped_buffer"},
- {PROT_READ, 0, "pass_mapped_buffer"},
- {PROT_EXEC, 0, "pass_mapped_buffer"},
- {PROT_EXEC | PROT_READ, 0, "pass_mapped_buffer"},
- {PROT_READ | PROT_WRITE, 1, "pass_unmapped_buffer"}
-};
-
-static void setup(void)
+} testcases[] = {
+ {
+ PROT_NONE, PASS_MAPPED_BUFFER}, {
+ PROT_READ, PASS_MAPPED_BUFFER}, {
+ PROT_EXEC, PASS_MAPPED_BUFFER}, {
+ PROT_EXEC | PROT_READ, PASS_MAPPED_BUFFER}, {
+PROT_READ | PROT_WRITE, PASS_UNMAPPED_BUFFER},};
+
+int TST_TOTAL = sizeof(testcases) / sizeof(testcases[0]);
+
+#ifdef UCLINUX
+static char *argv0;
+#endif
+
+void do_sendfile(int prot, int pass_unmapped_buffer)
{
- in_fd = SAFE_OPEN("in_file", O_CREAT | O_RDWR, 0600);
- out_fd = SAFE_CREAT("out_file", 0600);
+ OFF_T *protected_buffer;
+ int in_fd;
+ struct stat sb;
+
+ protected_buffer = mmap(NULL,
+ sizeof(*protected_buffer),
+ prot, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+ if (protected_buffer == MAP_FAILED) {
+ tst_brkm(TBROK, cleanup, "mmap failed: %d", errno);
+ }
+
+ out_fd = create_server();
+
+ if ((in_fd = open(in_file, O_RDONLY)) < 0) {
+ tst_brkm(TBROK, cleanup, "open failed: %d", errno);
+ }
+ SAFE_STAT(cleanup, in_file, &sb);
+
+ if (pass_unmapped_buffer) {
+ SAFE_MUNMAP(cleanup, protected_buffer,
+ sizeof(*protected_buffer));
+ }
+
+ TEST(sendfile(out_fd, in_fd, protected_buffer, sb.st_size));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ } else {
+ if (TEST_ERRNO != EFAULT) {
+ tst_resm(TFAIL, "sendfile returned unexpected "
+ "errno, expected: %d, got: %d",
+ EFAULT, TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "sendfile() returned %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
+
+ shutdown(sockfd, SHUT_RDWR);
+ shutdown(s, SHUT_RDWR);
+ kill(child_pid, SIGKILL);
+ close(in_fd);
+
+ if (!pass_unmapped_buffer) {
+ /* Not unmapped yet. So do it now. */
+ munmap(protected_buffer, sizeof(*protected_buffer));
+ }
}
-static void cleanup(void)
+/*
+ * do_child
+ */
+void do_child(void)
{
- SAFE_CLOSE(in_fd);
- SAFE_CLOSE(out_fd);
+ int lc;
+ socklen_t length;
+ char rbuf[4096];
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ length = sizeof(sin1);
+ recvfrom(sockfd, rbuf, 4096, 0, (struct sockaddr *)&sin1,
+ &length);
+ }
+ exit(0);
}
-static void run(unsigned int i)
+/*
+ * setup() - performs all ONE TIME setup for this test.
+ */
+void setup(void)
+{
+ int fd;
+ char buf[100];
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /* make a temporary directory and cd to it */
+ tst_tmpdir();
+ sprintf(in_file, "in.%d", getpid());
+ if ((fd = creat(in_file, 00700)) < 0) {
+ tst_brkm(TBROK, cleanup, "creat failed in setup, errno: %d",
+ errno);
+ }
+ sprintf(buf, "abcdefghijklmnopqrstuvwxyz");
+ if (write(fd, buf, strlen(buf)) < 0) {
+ tst_brkm(TBROK, cleanup, "write failed, errno: %d", errno);
+ }
+ close(fd);
+ sprintf(out_file, "out.%d", getpid());
+}
+
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+ close(out_fd);
+ /* delete the test directory created in setup() */
+ tst_rmdir();
+
+}
+
+int create_server(void)
{
- off_t *protected_buffer;
- protected_buffer = SAFE_MMAP(NULL, sizeof(*protected_buffer),
- tc[i].protection,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ static int count = 0;
+ socklen_t slen = sizeof(sin1);
- if (tc[i].pass_unmapped_buffer)
- SAFE_MUNMAP(protected_buffer, sizeof(*protected_buffer));
+ sockfd = socket(PF_INET, SOCK_DGRAM, 0);
+ if (sockfd < 0) {
+ tst_brkm(TBROK, cleanup, "call to socket() failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ sin1.sin_family = AF_INET;
+ sin1.sin_port = 0; /* pick random free port */
+ sin1.sin_addr.s_addr = INADDR_ANY;
+ count++;
+ if (bind(sockfd, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) {
+ tst_brkm(TBROK, cleanup, "call to bind() failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ SAFE_GETSOCKNAME(cleanup, sockfd, (struct sockaddr *)&sin1, &slen);
- TST_EXP_FAIL(sendfile(out_fd, in_fd, protected_buffer, 1),
- EFAULT, "sendfile(..) with %s, protection=%d",
- tc[i].desc, tc[i].protection);
+ child_pid = FORK_OR_VFORK();
+ if (child_pid < 0) {
+ tst_brkm(TBROK, cleanup, "client/server fork failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ if (!child_pid) { /* child */
+#ifdef UCLINUX
+ if (self_exec(argv0, "") < 0) {
+ tst_brkm(TBROK, cleanup, "self_exec failed");
+ return -1;
+
+ }
+#else
+ do_child();
+#endif
+ }
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ inet_aton("127.0.0.1", &sin1.sin_addr);
+ if (s < 0) {
+ tst_brkm(TBROK, cleanup, "call to socket() failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ SAFE_CONNECT(cleanup, s, (struct sockaddr *)&sin1, sizeof(sin1));
+ return s;
- if (!tc[i].pass_unmapped_buffer)
- SAFE_MUNMAP(protected_buffer, sizeof(*protected_buffer));
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .needs_tmpdir = 1,
- .cleanup = cleanup,
- .setup = setup,
- .test = run,
-};
+int main(int ac, char **av)
+{
+ int i;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ argv0 = av[0];
+ maybe_run_child(&do_child, "");
+#endif
+
+ setup();
+
+ /*
+ * The following loop checks looping state if -c option given
+ */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; ++i) {
+ do_sendfile(testcases[i].protection,
+ testcases[i].pass_unmapped_buffer);
+ }
+ }
+ cleanup();
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/sendfile/sendfile05.c b/testcases/kernel/syscalls/sendfile/sendfile05.c
index 99c91f660..0f268ceb3 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile05.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile05.c
@@ -1,21 +1,46 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * Copyright (c) Red Hat Inc., 2007
- * 11/2007 Copyed from sendfile02.c by Masatake YAMATO
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) Red Hat Inc., 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * sendfile05.c
+ *
+ * DESCRIPTION
+ * Testcase to test that sendfile(2) system call returns EINVAL
+ * when passing negative offset.
*
- * Testcase to test that sendfile(2) system call returns EINVAL when passing
- * negative offset.
+ * USAGE: <for command-line>
+ * sendfile05 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
+ * where,
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
*
- * [Algorithm]
+ * HISTORY
+ * 11/2007 Copyed from sendfile02.c by Masatake YAMATO
*
- * Call sendfile with offset = -1.
+ * RESTRICTIONS
+ * NONE
*/
-
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
@@ -26,35 +51,198 @@
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include "test.h"
+#include "safe_macros.h"
+
+#ifndef OFF_T
+#define OFF_T off_t
+#endif /* Not def: OFF_T */
+
+TCID_DEFINE(sendfile05);
-#include "tst_test.h"
+char in_file[100];
+char out_file[100];
+int out_fd;
+pid_t child_pid;
+static int sockfd, s;
+static struct sockaddr_in sin1; /* shared between do_child and create_server */
-static int in_fd;
-static int out_fd;
+void cleanup(void);
+void do_child(void);
+void setup(void);
+int create_server(void);
-static void setup(void)
+int TST_TOTAL = 1;
+
+#ifdef UCLINUX
+static char *argv0;
+#endif
+
+void do_sendfile(void)
{
- in_fd = SAFE_OPEN("in_file", O_CREAT | O_RDWR, 0600);
- out_fd = SAFE_CREAT("out_file", 0600);
+ OFF_T offset;
+ int in_fd;
+ struct stat sb;
+
+ out_fd = create_server();
+
+ if ((in_fd = open(in_file, O_RDONLY)) < 0) {
+ tst_brkm(TBROK, cleanup, "open failed: %d", errno);
+ }
+ SAFE_STAT(cleanup, in_file, &sb);
+
+ offset = -1;
+ TEST(sendfile(out_fd, in_fd, &offset, sb.st_size));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ } else {
+ if (TEST_ERRNO != EINVAL) {
+ tst_resm(TFAIL, "sendfile returned unexpected "
+ "errno, expected: %d, got: %d",
+ EINVAL, TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "sendfile() returned %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ }
+ }
+
+ shutdown(sockfd, SHUT_RDWR);
+ shutdown(s, SHUT_RDWR);
+ kill(child_pid, SIGKILL);
+ close(in_fd);
}
-static void cleanup(void)
+/*
+ * do_child
+ */
+void do_child(void)
{
- SAFE_CLOSE(in_fd);
- SAFE_CLOSE(out_fd);
+ int lc;
+ socklen_t length;
+ char rbuf[4096];
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ length = sizeof(sin1);
+ recvfrom(sockfd, rbuf, 4096, 0, (struct sockaddr *)&sin1,
+ &length);
+ }
+ exit(0);
}
-static void run(void)
+/*
+ * setup() - performs all ONE TIME setup for this test.
+ */
+void setup(void)
{
- off_t offset = -1;
+ int fd;
+ char buf[100];
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
- TST_EXP_FAIL(sendfile(out_fd, in_fd, &offset, 1), EINVAL,
- "sendfile(out, in, &offset, ..) with offset=%ld", offset);
+ /* make a temporary directory and cd to it */
+ tst_tmpdir();
+ sprintf(in_file, "in.%d", getpid());
+ if ((fd = creat(in_file, 00700)) < 0) {
+ tst_brkm(TBROK, cleanup, "creat failed in setup, errno: %d",
+ errno);
+ }
+ sprintf(buf, "abcdefghijklmnopqrstuvwxyz");
+ if (write(fd, buf, strlen(buf)) < 0) {
+ tst_brkm(TBROK, cleanup, "write failed, errno: %d", errno);
+ }
+ close(fd);
+ sprintf(out_file, "out.%d", getpid());
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .cleanup = cleanup,
- .setup = setup,
- .test_all = run,
-};
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+ close(out_fd);
+ /* delete the test directory created in setup() */
+ tst_rmdir();
+
+}
+
+int create_server(void)
+{
+ static int count = 0;
+ socklen_t slen = sizeof(sin1);
+
+ sockfd = socket(PF_INET, SOCK_DGRAM, 0);
+ if (sockfd < 0) {
+ tst_brkm(TBROK, cleanup, "call to socket() failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ sin1.sin_family = AF_INET;
+ sin1.sin_port = 0; /* pick random free port */
+ sin1.sin_addr.s_addr = INADDR_ANY;
+ count++;
+ if (bind(sockfd, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) {
+ tst_brkm(TBROK, cleanup, "call to bind() failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ SAFE_GETSOCKNAME(cleanup, sockfd, (struct sockaddr *)&sin1, &slen);
+
+ child_pid = FORK_OR_VFORK();
+ if (child_pid < 0) {
+ tst_brkm(TBROK, cleanup, "client/server fork failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ if (!child_pid) { /* child */
+#ifdef UCLINUX
+ if (self_exec(argv0, "") < 0) {
+ tst_brkm(TBROK, cleanup, "self_exec failed");
+ return -1;
+
+ }
+#else
+ do_child();
+#endif
+ }
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ inet_aton("127.0.0.1", &sin1.sin_addr);
+ if (s < 0) {
+ tst_brkm(TBROK, cleanup, "call to socket() failed: %s",
+ strerror(errno));
+ return -1;
+ }
+ SAFE_CONNECT(cleanup, s, (struct sockaddr *)&sin1, sizeof(sin1));
+ return s;
+
+}
+
+int main(int ac, char **av)
+{
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+#ifdef UCLINUX
+ argv0 = av[0];
+ maybe_run_child(&do_child, "");
+#endif
+
+ setup();
+
+ /*
+ * The following loop checks looping state if -c option given
+ */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ do_sendfile();
+ }
+ cleanup();
+
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/sendfile/sendfile07.c b/testcases/kernel/syscalls/sendfile/sendfile07.c
index e8bf022a7..c93363bad 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile07.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile07.c
@@ -1,78 +1,194 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * Copyright (c) Red Hat Inc., 2007
- * 12/2007 Copyed from sendfile03.c by Masatake YAMATO
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) Red Hat Inc., 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * NAME
+ * sendfile07.c
*
- * Testcase to test that sendfile(2) system call returns EAGAIN
- * when passing full out_fd opened with O_NONBLOCK.
+ * DESCRIPTION
+ * Testcase to test that sendfile(2) system call returns EAGAIN
+ * when passing blocked out_fd. Here out_fd is opend with O_NONBLOCK.
+ *
+ * ALGORITHM
+ * 1. Make sockets with socketpair(&p). Use p[1] as out_fd.
+ * 2. Set O_NONBLOCK flag of out_fd on.
+ * 3. Write much datum to out_fd till write() returns EAGAIN.
+ * 4. Call sendfile with out_fd, and expect EAGAIN.
+ *
+ * USAGE: <for command-line>
+ * sendfile07 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * HISTORY
+ * 12/2007 Copyed from sendfile03.c by Masatake YAMATO
+ *
+ * RESTRICTIONS
+ * NONE
*/
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
#include <sys/sendfile.h>
-#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/mman.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#include "test.h"
+
+#ifndef OFF_T
+#define OFF_T off_t
+#endif /* Not def: OFF_T */
-#include "tst_test.h"
+TCID_DEFINE(sendfile07);
+int TST_TOTAL = 1;
+int in_fd, out_fd = 0, ignored_fd = 0;
+char in_file[100];
+
+/* To make out_fd overflow, write much chars
+ to out_fd. MAX_FILL_DATA_LENGTH defines the `much'. */
#define MAX_FILL_DATA_LENGTH 0xFFFFFFF
-static int p[2];
-static int in_fd;
-static int out_fd;
+void cleanup(void);
+void setup(void);
-static void setup(void)
+int main(int ac, char **av)
{
- int i;
+ int lc;
- tst_fill_file("in_file", 'a', 10, 1);
- in_fd = SAFE_OPEN("in_file", O_RDONLY);
+ tst_parse_opts(ac, av, NULL, NULL);
- SAFE_SOCKETPAIR(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, p);
- out_fd = p[1];
+ setup();
+
+ /*
+ * The following loop checks looping state if -c option given
+ */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ TEST(sendfile(out_fd, in_fd, NULL, 1));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
- for (i = 0; i < MAX_FILL_DATA_LENGTH; ++i) {
- TEST(write(out_fd, "a", 1));
- if (TST_RET < 0) {
- if (TST_ERR == EAGAIN)
- return;
- else
- tst_brk(TBROK | TTERRNO, "write(out_fd, buf, 1)");
+ if (TEST_ERRNO != EAGAIN) {
+ tst_resm(TFAIL, "sendfile returned unexpected "
+ "errno, expected: %d, got: %d",
+ EAGAIN, TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "sendfile() returned %d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
}
}
- tst_brk(TBROK, "Failed to get EAGAIN after %i bytes",
- MAX_FILL_DATA_LENGTH);
+ cleanup();
+ tst_exit();
+
}
-static void cleanup(void)
+/*
+ * setup() - performs all ONE TIME setup for this test.
+ */
+void setup(void)
{
- if (p[0])
- SAFE_CLOSE(p[0]);
- if (p[1])
- SAFE_CLOSE(p[1]);
- SAFE_CLOSE(in_fd);
+ char buf[100];
+ int p[2];
+ int i, r;
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ /* make a temporary directory and cd to it */
+ tst_tmpdir();
+
+ sprintf(in_file, "in.%d", getpid());
+ if ((in_fd = creat(in_file, 00700)) < 0) {
+ tst_brkm(TBROK, cleanup, "creat failed in setup, errno: %d",
+ errno);
+ }
+ sprintf(buf, "abcdefghijklmnopqrstuvwxyz");
+ if (write(in_fd, buf, strlen(buf)) < 0) {
+ tst_brkm(TBROK, cleanup, "write failed, errno: %d", errno);
+ }
+ close(in_fd);
+ if ((in_fd = open(in_file, O_RDONLY)) < 0) {
+ tst_brkm(TBROK, cleanup, "open failed, errno: %d", errno);
+ }
+
+ /* Make fulfilled out_fd. */
+ if (socketpair(PF_UNIX, SOCK_DGRAM, 0, p) < 0) {
+ tst_brkm(TBROK, cleanup, "socketpair failed, errno: %d", errno);
+ }
+
+ /* Don't close.
+ You cannot write nothing on out_fd if ignored_fd is closed. */
+ ignored_fd = p[0];
+ out_fd = p[1];
+ if (fcntl(out_fd, F_SETFL, O_WRONLY | O_NONBLOCK) < 0) {
+ tst_brkm(TBROK, cleanup, "fcntl failed, errno: %d", errno);
+ }
+
+ i = MAX_FILL_DATA_LENGTH;
+ while (i > 0) {
+ r = write(out_fd, buf, 1);
+ if (r < 0) {
+ if (errno == EAGAIN) {
+ break;
+ } else {
+ tst_brkm(TBROK, cleanup,
+ "write failed to fill out_fd, errno: %d",
+ errno);
+ }
+ }
+ i--;
+ }
+ if (i == 0) {
+ tst_brkm(TBROK, cleanup,
+ "fail to fill out_fd, write %d bytes but EAGAIN it not returned.",
+ MAX_FILL_DATA_LENGTH);
+ }
}
-static void run(void)
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
{
- TST_EXP_FAIL(sendfile(out_fd, in_fd, NULL, 1), EAGAIN,
- "sendfile(out_fd, in_fd, NULL, 1) with blocked out_fd");
-}
+ /*
+ * print timing stats if that option was specified.
+ * print errno log if that option was specified.
+ */
+ if (out_fd)
+ close(out_fd);
+ if (ignored_fd)
+ close(ignored_fd);
+ close(in_fd);
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .cleanup = cleanup,
- .setup = setup,
- .test_all = run,
-};
+ /* delete the test directory created in setup() */
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/sendmmsg/.gitignore b/testcases/kernel/syscalls/sendmmsg/.gitignore
index 42693c44d..b703ececd 100644
--- a/testcases/kernel/syscalls/sendmmsg/.gitignore
+++ b/testcases/kernel/syscalls/sendmmsg/.gitignore
@@ -1,2 +1 @@
sendmmsg01
-sendmmsg02
diff --git a/testcases/kernel/syscalls/sendmmsg/sendmmsg.h b/testcases/kernel/syscalls/sendmmsg/sendmmsg.h
deleted file mode 100644
index 65d5b680f..000000000
--- a/testcases/kernel/syscalls/sendmmsg/sendmmsg.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include <netinet/ip.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "time64_variants.h"
-#include "tst_test.h"
-#include "lapi/socket.h"
-#include "tst_safe_macros.h"
-#include "sendmmsg_var.h"
-
-#define BUFSIZE 16
-
-static struct time64_variants variants[] = {
- { .recvmmsg = libc_recvmmsg, .sendmmsg = libc_sendmmsg, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_recvmmsg != __LTP__NR_INVALID_SYSCALL)
- { .recvmmsg = sys_recvmmsg, .sendmmsg = sys_sendmmsg, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_recvmmsg_time64 != __LTP__NR_INVALID_SYSCALL)
- { .recvmmsg = sys_recvmmsg64, .sendmmsg = sys_sendmmsg, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
diff --git a/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c b/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
index de58abd92..37084102e 100644
--- a/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
+++ b/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
@@ -1,13 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-or-later
-/*\
- * Basic sendmmsg() test that sends and receives messages.
- *
+/*
* This test is based on source contained in the man pages for sendmmsg and
* recvmmsg in release 4.15 of the Linux man-pages project.
*/
#define _GNU_SOURCE
-#include "sendmmsg.h"
+#include <netinet/ip.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "tst_test.h"
+#include "lapi/socket.h"
+#include "tst_safe_macros.h"
+
+#include "sendmmsg_var.h"
#define BUFSIZE 16
#define VLEN 2
@@ -19,27 +27,25 @@ static struct iovec *snd1, *snd2, *rcv1, *rcv2;
static void run(void)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct tst_ts timeout;
+ struct timespec timeout;
int retval;
- retval = tv->sendmmsg(send_sockfd, snd_msg, VLEN, 0);
+ retval = do_sendmmsg(send_sockfd, snd_msg, VLEN, 0);
if (retval < 0 || snd_msg[0].msg_len != 6 || snd_msg[1].msg_len != 6) {
- tst_res(TFAIL | TERRNO, "sendmmsg() failed");
+ tst_res(TFAIL|TTERRNO, "sendmmsg failed");
return;
}
memset(rcv1->iov_base, 0, rcv1->iov_len);
memset(rcv2->iov_base, 0, rcv2->iov_len);
- timeout.type = tv->ts_type;
- tst_ts_set_sec(&timeout, 1);
- tst_ts_set_nsec(&timeout, 0);
+ timeout.tv_sec = 1;
+ timeout.tv_nsec = 0;
- retval = tv->recvmmsg(receive_sockfd, rcv_msg, VLEN, 0, tst_ts_get(&timeout));
+ retval = do_recvmmsg(receive_sockfd, rcv_msg, VLEN, 0, &timeout);
if (retval == -1) {
- tst_res(TFAIL | TERRNO, "recvmmsg() failed");
+ tst_res(TFAIL | TTERRNO, "recvmmsg failed");
return;
}
if (retval != 2) {
@@ -90,7 +96,7 @@ static void setup(void)
rcv_msg[1].msg_hdr.msg_iov = rcv2;
rcv_msg[1].msg_hdr.msg_iovlen = 1;
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
+ test_info();
}
static void cleanup(void)
@@ -105,7 +111,7 @@ static struct tst_test test = {
.test_all = run,
.setup = setup,
.cleanup = cleanup,
- .test_variants = ARRAY_SIZE(variants),
+ .test_variants = TEST_VARIANTS,
.bufs = (struct tst_buffers []) {
{&snd1, .iov_sizes = (int[]){3, 3, -1}},
{&snd2, .iov_sizes = (int[]){6, -1}},
diff --git a/testcases/kernel/syscalls/sendmmsg/sendmmsg02.c b/testcases/kernel/syscalls/sendmmsg/sendmmsg02.c
deleted file mode 100644
index b14faccb6..000000000
--- a/testcases/kernel/syscalls/sendmmsg/sendmmsg02.c
+++ /dev/null
@@ -1,75 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-/*\
- * Tests sendmmsg() failures:
- *
- * - EBADF Bad socket file descriptor
- * - EFAULT Bad message vector address
- */
-
-#define _GNU_SOURCE
-#include "sendmmsg.h"
-
-#define VLEN 1
-
-static int send_sockfd;
-static struct mmsghdr *snd_msg;
-
-static void *bad_addr;
-static int bad_fd = -1;
-
-struct test_case {
- const char *desc;
- int *fd;
- int exp_errno;
- struct mmsghdr **msg_vec;
-};
-
-static struct test_case tcase[] = {
- {
- .desc = "bad file descriptor",
- .fd = &bad_fd,
- .msg_vec = &snd_msg,
- .exp_errno = EBADF,
- },
- {
- .desc = "invalid msgvec address",
- .fd = &send_sockfd,
- .msg_vec = (void*)&bad_addr,
- .exp_errno = EFAULT,
- },
-};
-
-static void do_test(unsigned int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct test_case *tc = &tcase[i];
-
- TST_EXP_FAIL(tv->sendmmsg(*tc->fd, *tc->msg_vec, VLEN, 0),
- tc->exp_errno, "sendmmsg() %s", tc->desc);
-}
-
-static void setup(void)
-{
- send_sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
-
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-}
-
-static void cleanup(void)
-{
- if (send_sockfd > 0)
- SAFE_CLOSE(send_sockfd);
-}
-
-static struct tst_test test = {
- .test = do_test,
- .tcnt = ARRAY_SIZE(tcase),
- .setup = setup,
- .cleanup = cleanup,
- .test_variants = ARRAY_SIZE(variants),
- .bufs = (struct tst_buffers []) {
- {&snd_msg, .size = VLEN * sizeof(*snd_msg)},
- {},
- }
-};
diff --git a/testcases/kernel/syscalls/sendmmsg/sendmmsg_var.h b/testcases/kernel/syscalls/sendmmsg/sendmmsg_var.h
index ca9635987..f00cf056a 100644
--- a/testcases/kernel/syscalls/sendmmsg/sendmmsg_var.h
+++ b/testcases/kernel/syscalls/sendmmsg/sendmmsg_var.h
@@ -6,48 +6,55 @@
#ifndef SENDMMSG_VAR__
#define SENDMMSG_VAR__
-#include "tst_timer.h"
#include "lapi/syscalls.h"
-static inline int libc_sendmmsg(int sockfd, struct mmsghdr *msgvec,
- unsigned int vlen, unsigned int flags)
+static int do_sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
+ int flags)
{
+ switch (tst_variant) {
+ case 0:
+ return tst_syscall(__NR_sendmmsg, sockfd, msgvec, vlen, flags);
+ case 1:
#ifdef HAVE_SENDMMSG
- return sendmmsg(sockfd, msgvec, vlen, flags);
+ return sendmmsg(sockfd, msgvec, vlen, flags);
#else
- tst_brk(TCONF, "libc sendmmsg not present");
- return -1;
+ tst_brk(TCONF, "libc sendmmsg not present");
#endif
-}
+ }
-static inline int sys_sendmmsg(int sockfd, struct mmsghdr *msgvec,
- unsigned int vlen, unsigned int flags)
-{
- return tst_syscall(__NR_sendmmsg, sockfd, msgvec, vlen, flags);
+ return -1;
}
-static inline int libc_recvmmsg(int sockfd, struct mmsghdr *msgvec,
- unsigned int vlen, unsigned int flags, void *timeout)
+static int do_recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
+ int flags, struct timespec *timeout)
{
+ switch (tst_variant) {
+ case 0:
+ return tst_syscall(__NR_recvmmsg, sockfd, msgvec, vlen, flags,
+ timeout);
+ case 1:
#ifdef HAVE_RECVMMSG
- return recvmmsg(sockfd, msgvec, vlen, flags, timeout);
+ return recvmmsg(sockfd, msgvec, vlen, flags, timeout);
#else
- tst_brk(TCONF, "libc recvmmsg not present");
- return -1;
+ tst_brk(TCONF, "libc recvmmsg not present");
#endif
-}
+ }
-static inline int sys_recvmmsg(int sockfd, struct mmsghdr *msgvec,
- unsigned int vlen, unsigned int flags, void *timeout)
-{
- return tst_syscall(__NR_recvmmsg, sockfd, msgvec, vlen, flags, timeout);
+ return -1;
}
-static inline int sys_recvmmsg64(int sockfd, struct mmsghdr *msgvec,
- unsigned int vlen, unsigned int flags, void *timeout)
+static void test_info(void)
{
- return tst_syscall(__NR_recvmmsg_time64, sockfd, msgvec, vlen, flags,
- timeout);
+ switch (tst_variant) {
+ case 0:
+ tst_res(TINFO, "Testing direct sendmmsg and recvmmsg syscalls");
+ break;
+ case 1:
+ tst_res(TINFO, "Testing libc sendmmsg and recvmmsg syscalls");
+ break;
+ }
}
+#define TEST_VARIANTS 2
+
#endif /* SENDMMSG_VAR__ */
diff --git a/testcases/kernel/syscalls/sendmsg/.gitignore b/testcases/kernel/syscalls/sendmsg/.gitignore
index 983bb4795..5867a047f 100644
--- a/testcases/kernel/syscalls/sendmsg/.gitignore
+++ b/testcases/kernel/syscalls/sendmsg/.gitignore
@@ -1,3 +1,2 @@
/sendmsg01
/sendmsg02
-/sendmsg03
diff --git a/testcases/kernel/syscalls/sendmsg/Makefile b/testcases/kernel/syscalls/sendmsg/Makefile
index 25a18eaab..e69c726f5 100644
--- a/testcases/kernel/syscalls/sendmsg/Makefile
+++ b/testcases/kernel/syscalls/sendmsg/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
@@ -7,7 +22,4 @@ include $(top_srcdir)/include/mk/testcases.mk
CPPFLAGS += -I$(abs_srcdir)/../utils
-sendmsg03: CFLAGS += -pthread
-sendmsg03: LDLIBS += -pthread -lrt
-
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg02.c b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
index f72e9db22..aa3c88da5 100644
--- a/testcases/kernel/syscalls/sendmsg/sendmsg02.c
+++ b/testcases/kernel/syscalls/sendmsg/sendmsg02.c
@@ -34,6 +34,7 @@
#define _GNU_SOURCE
#include <sys/ipc.h>
#include <sys/stat.h>
+#include <sys/sem.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
@@ -44,7 +45,7 @@
#include "config.h"
#include "test.h"
#include "safe_macros.h"
-#include "lapi/sem.h"
+#include "lapi/semun.h"
char *TCID = "sendmsg02";
diff --git a/testcases/kernel/syscalls/sendmsg/sendmsg03.c b/testcases/kernel/syscalls/sendmsg/sendmsg03.c
deleted file mode 100644
index c7d72f686..000000000
--- a/testcases/kernel/syscalls/sendmsg/sendmsg03.c
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2017-17712
- *
- * Test for race condition vulnerability in sendmsg() on SOCK_RAW sockets.
- * Changing the value of IP_HDRINCL socket option in parallel with sendmsg()
- * call may lead to uninitialized stack pointer usage, allowing arbitrary code
- * execution or privilege escalation. Fixed in:
- *
- * commit 8f659a03a0ba9289b9aeb9b4470e6fb263d6f483
- * Author: Mohamed Ghannam <simo.ghannam@gmail.com>
- * Date: Sun Dec 10 03:50:58 2017 +0000
- *
- * net: ipv4: fix for a race condition in raw_sendmsg
- */
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sched.h>
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-
-#define IOVEC_COUNT 4
-#define PACKET_SIZE 100
-
-static int sockfd = -1;
-static struct msghdr msg;
-/* addr must be full of zeroes to trigger the kernel bug */
-static struct sockaddr_in addr;
-static struct iovec iov[IOVEC_COUNT];
-static unsigned char buf[PACKET_SIZE];
-static struct tst_fzsync_pair fzsync_pair;
-
-static void setup(void)
-{
- int i;
-
- SAFE_UNSHARE(CLONE_NEWUSER);
- SAFE_UNSHARE(CLONE_NEWNET);
- sockfd = SAFE_SOCKET(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-
- memset(buf, 0xcc, PACKET_SIZE);
-
- for (i = 0; i < IOVEC_COUNT; i++) {
- iov[i].iov_base = buf;
- iov[i].iov_len = PACKET_SIZE;
- }
-
- msg.msg_name = &addr;
- msg.msg_namelen = sizeof(addr);
- msg.msg_iov = iov;
- msg.msg_iovlen = IOVEC_COUNT;
-
- fzsync_pair.exec_loops = 100000;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void cleanup(void)
-{
- if (sockfd > 0)
- SAFE_CLOSE(sockfd);
- tst_fzsync_pair_cleanup(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- int val = 0;
-
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- setsockopt(sockfd, SOL_IP, IP_HDRINCL, &val, sizeof(val));
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- int hdrincl = 1;
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- SAFE_SETSOCKOPT_INT(sockfd, SOL_IP, IP_HDRINCL, hdrincl);
-
- tst_fzsync_start_race_a(&fzsync_pair);
- sendmsg(sockfd, &msg, 0);
- tst_fzsync_end_race_a(&fzsync_pair);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "8f659a03a0ba"},
- {"CVE", "2017-17712"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/sendto/.gitignore b/testcases/kernel/syscalls/sendto/.gitignore
index 5fd24dfe6..8d2bb6b5f 100644
--- a/testcases/kernel/syscalls/sendto/.gitignore
+++ b/testcases/kernel/syscalls/sendto/.gitignore
@@ -1,3 +1,2 @@
/sendto01
/sendto02
-/sendto03
diff --git a/testcases/kernel/syscalls/sendto/Makefile b/testcases/kernel/syscalls/sendto/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sendto/Makefile
+++ b/testcases/kernel/syscalls/sendto/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sendto/sendto03.c b/testcases/kernel/syscalls/sendto/sendto03.c
deleted file mode 100644
index 3ecb574a1..000000000
--- a/testcases/kernel/syscalls/sendto/sendto03.c
+++ /dev/null
@@ -1,224 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2020-14386
- *
- * Check for vulnerability in tpacket_rcv() which allows an unprivileged user
- * to write arbitrary data to a memory area outside the allocated packet
- * buffer. Kernel crash fixed in:
- *
- * commit acf69c946233259ab4d64f8869d4037a198c7f06
- * Author: Or Cohen <orcohen@paloaltonetworks.com>
- * Date: Thu Sep 3 21:05:28 2020 -0700
- *
- * net/packet: fix overflow in tpacket_rcv
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/ethernet.h>
-#include <sched.h>
-
-#include "tst_test.h"
-#include "tst_net.h"
-#include "lapi/if_packet.h"
-
-#define BUFSIZE 1024
-
-static int dst_sock = -1, sock = -1;
-static unsigned char buf[BUFSIZE];
-static struct sockaddr_ll bind_addr, addr;
-
-static void setup(void)
-{
- int real_uid = getuid();
- int real_gid = getgid();
- struct ifreq ifr;
-
- SAFE_UNSHARE(CLONE_NEWUSER);
- SAFE_UNSHARE(CLONE_NEWNET);
- SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
- SAFE_FILE_PRINTF("/proc/self/uid_map", "0 %d 1", real_uid);
- SAFE_FILE_PRINTF("/proc/self/gid_map", "0 %d 1", real_gid);
-
- sock = SAFE_SOCKET(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- strcpy(ifr.ifr_name, "lo");
- ifr.ifr_flags = IFF_UP;
- SAFE_IOCTL(sock, SIOCSIFFLAGS, &ifr);
- SAFE_IOCTL(sock, SIOCGIFINDEX, &ifr);
- SAFE_CLOSE(sock);
-
- memset(buf, 0x42, BUFSIZE);
-
- bind_addr.sll_family = AF_PACKET;
- bind_addr.sll_protocol = htons(ETH_P_ALL);
- bind_addr.sll_ifindex = ifr.ifr_ifindex;
-
- addr.sll_family = AF_PACKET;
- addr.sll_ifindex = ifr.ifr_ifindex;
- addr.sll_halen = ETH_ALEN;
-}
-
-/* Test for commit bcc5364bdcfe (cap PACKET_RESERVE to INT_MAX) */
-static int check_tiny_frame(void)
-{
- unsigned int val = (UINT_MAX - TPACKET2_HDRLEN) + 1;
- struct tpacket_req tpreq;
-
- tpreq.tp_block_size = SAFE_SYSCONF(_SC_PAGESIZE);
- tpreq.tp_frame_size = TPACKET_ALIGNMENT;
- tpreq.tp_block_nr = 1;
- tpreq.tp_frame_nr = (tpreq.tp_block_size * tpreq.tp_block_nr) /
- tpreq.tp_frame_size;
-
- dst_sock = SAFE_SOCKET(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- SAFE_SETSOCKOPT_INT(dst_sock, SOL_PACKET, PACKET_VERSION, TPACKET_V2);
- TEST(setsockopt(dst_sock, SOL_PACKET, PACKET_RESERVE, &val,
- sizeof(val)));
-
- if (TST_RET == -1 && TST_ERR == EINVAL) {
- SAFE_CLOSE(dst_sock);
- tst_res(TPASS | TTERRNO,
- "setsockopt(PACKET_RESERVE) value is capped");
- return 0;
- }
-
- if (TST_RET == -1) {
- tst_brk(TBROK | TTERRNO,
- "setsockopt(PACKET_RESERVE): unexpected error");
- }
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "Invalid setsockopt(PACKET_RESERVE) return value");
- }
-
- tst_res(TINFO, "setsockopt(PACKET_RESERVE) accepted too large value");
- tst_res(TINFO, "Checking whether this will cause integer overflow...");
- TEST(setsockopt(dst_sock, SOL_PACKET, PACKET_RX_RING, &tpreq,
- sizeof(tpreq)));
- SAFE_CLOSE(dst_sock);
-
- if (!TST_RET) {
- tst_res(TFAIL, "setsockopt(PACKET_RX_RING) accepted frame "
- "size smaller than packet header");
- return 0;
- }
-
- if (TST_RET != -1) {
- tst_brk(TBROK | TTERRNO,
- "Invalid setsockopt(PACKET_RX_RING) return value");
- }
-
- if (TST_ERR != EINVAL) {
- tst_brk(TBROK | TTERRNO,
- "setsockopt(PACKET_RX_RING): unexpeced error");
- }
-
- tst_res(TPASS | TTERRNO, "setsockopt(PACKET_RX_RING) frame size check "
- "rejects values smaller than packet header");
- /* This test case should not cause kernel taint, skip taint check */
- return 0;
-}
-
-/* Test for commit acf69c946233 (drop packet if netoff overflows) */
-static int check_vnet_hdr(void)
-{
- struct tpacket_req tpreq;
- size_t blocksize = 0x800000, pagesize = SAFE_SYSCONF(_SC_PAGESIZE);
-
- /* Make sure blocksize is big enough and pagesize aligned */
- if (blocksize % pagesize)
- blocksize += pagesize - (blocksize % pagesize);
-
- tpreq.tp_block_size = blocksize;
- tpreq.tp_frame_size = 0x11000;
- tpreq.tp_block_nr = 1;
- tpreq.tp_frame_nr = (tpreq.tp_block_size * tpreq.tp_block_nr) /
- tpreq.tp_frame_size;
-
- dst_sock = SAFE_SOCKET(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- SAFE_SETSOCKOPT_INT(dst_sock, SOL_PACKET, PACKET_VERSION, TPACKET_V2);
- SAFE_SETSOCKOPT_INT(dst_sock, SOL_PACKET, PACKET_VNET_HDR, 1);
- SAFE_SETSOCKOPT_INT(dst_sock, SOL_PACKET, PACKET_RESERVE, 0xffff - 75);
- TEST(setsockopt(dst_sock, SOL_PACKET, PACKET_RX_RING, &tpreq,
- sizeof(tpreq)));
-
- if (TST_RET == -1 && TST_ERR == EINVAL) {
- SAFE_CLOSE(dst_sock);
- tst_res(TCONF, "PACKET_VNET_HDR and PACKET_RX_RING not "
- "supported together");
- return 0;
- }
-
- if (TST_RET == -1) {
- tst_brk(TBROK | TTERRNO,
- "setsockopt(PACKET_RX_RING): unexpected error");
- }
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "Invalid setsockopt(PACKET_RX_RING) return value");
- }
-
- SAFE_BIND(dst_sock, (struct sockaddr *)&bind_addr, sizeof(addr));
-
- sock = SAFE_SOCKET(AF_PACKET, SOCK_RAW, IPPROTO_RAW);
- SAFE_SENDTO(1, sock, buf, BUFSIZE, 0, (struct sockaddr *)&addr,
- sizeof(addr));
-
- SAFE_CLOSE(sock);
- SAFE_CLOSE(dst_sock);
- return 1; /* Continue to taint check */
-}
-
-static int (*testcase_list[])(void) = {check_tiny_frame, check_vnet_hdr};
-
-static void run(unsigned int n)
-{
- if (!testcase_list[n]())
- return;
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static void cleanup(void)
-{
- if (sock != -1)
- SAFE_CLOSE(sock);
-
- if (dst_sock != -1)
- SAFE_CLOSE(dst_sock);
-}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(testcase_list),
- .setup = setup,
- .cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_USER_NS=y",
- "CONFIG_NET_NS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "bcc5364bdcfe"},
- {"linux-git", "acf69c946233"},
- {"CVE", "2020-14386"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/set_mempolicy/Makefile b/testcases/kernel/syscalls/set_mempolicy/Makefile
index 55ac0026f..a0b79d6e1 100644
--- a/testcases/kernel/syscalls/set_mempolicy/Makefile
+++ b/testcases/kernel/syscalls/set_mempolicy/Makefile
@@ -4,7 +4,6 @@ LTPLIBS = ltpnuma
include $(top_srcdir)/include/mk/testcases.mk
-LDLIBS += $(NUMA_LIBS)
-LTPLDLIBS = -lltpnuma
+LDLIBS += $(NUMA_LIBS) -lltpnuma
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/set_robust_list/Makefile b/testcases/kernel/syscalls/set_robust_list/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/set_robust_list/Makefile
+++ b/testcases/kernel/syscalls/set_robust_list/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/set_thread_area/Makefile b/testcases/kernel/syscalls/set_thread_area/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/set_thread_area/Makefile
+++ b/testcases/kernel/syscalls/set_thread_area/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/set_tid_address/Makefile b/testcases/kernel/syscalls/set_tid_address/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/set_tid_address/Makefile
+++ b/testcases/kernel/syscalls/set_tid_address/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setdomainname/Makefile b/testcases/kernel/syscalls/setdomainname/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/setdomainname/Makefile
+++ b/testcases/kernel/syscalls/setdomainname/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setegid/Makefile b/testcases/kernel/syscalls/setegid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/setegid/Makefile
+++ b/testcases/kernel/syscalls/setegid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setfsgid/Makefile b/testcases/kernel/syscalls/setfsgid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setfsgid/Makefile
+++ b/testcases/kernel/syscalls/setfsgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setfsuid/Makefile b/testcases/kernel/syscalls/setfsuid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setfsuid/Makefile
+++ b/testcases/kernel/syscalls/setfsuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setgid/Makefile b/testcases/kernel/syscalls/setgid/Makefile
index e7a0f0ae1..ad6b9f57c 100644
--- a/testcases/kernel/syscalls/setgid/Makefile
+++ b/testcases/kernel/syscalls/setgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setgid/setgid01.c b/testcases/kernel/syscalls/setgid/setgid01.c
index 91d615261..0c8ef3b2a 100644
--- a/testcases/kernel/syscalls/setgid/setgid01.c
+++ b/testcases/kernel/syscalls/setgid/setgid01.c
@@ -1,33 +1,91 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
- * AUTHOR : William Roske
- * CO-PILOT : Dave Fenner
- */
-/*\
- * [Description]
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
*
- * Calls setgid() with current gid and expects success.
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
+ */
+/*
+ * AUTHOR : William Roske
+ * CO-PILOT : Dave Fenner
*/
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+
+#include "test.h"
+#include "compat_16.h"
+
+static void setup(void);
+static void cleanup(void);
-#include "tst_test.h"
-#include "compat_tst_16.h"
+TCID_DEFINE(setgid01);
+int TST_TOTAL = 1;
static gid_t gid;
-static void run(void)
+int main(int ac, char **av)
{
- TST_EXP_PASS(SETGID(gid));
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ TEST(SETGID(cleanup, gid));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "setgid(%d) Failed, errno=%d : %s", gid,
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TPASS, "setgid(%d) returned %ld", gid,
+ TEST_RETURN);
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
gid = getgid();
- GID16_CHECK(gid, setgid);
+ GID16_CHECK(gid, setgid, cleanup);
}
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/setgid/setgid02.c b/testcases/kernel/syscalls/setgid/setgid02.c
index ff6791a1a..b3f4fd646 100644
--- a/testcases/kernel/syscalls/setgid/setgid02.c
+++ b/testcases/kernel/syscalls/setgid/setgid02.c
@@ -1,45 +1,111 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* Ported by Wayne Boyer
- */
-
-/*\
- * [Description]
*
- * Test if setgid() system call sets errno to EPERM correctly.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * [Algorithm]
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*
- * Call setgid() to set the gid to that of root. Run this test as
- * nobody, and expect to get EPERM.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/*
+ * Testcase to ensure that the setgid() system call sets errno to EPERM
+ *
+ * ALGORITHM
+ * Call setgid() to set the gid to that of root. Run this test as
+ * ltpuser1, and expect to get EPERM
+ */
#include <pwd.h>
-#include "tst_test.h"
-#include "compat_tst_16.h"
+#include <errno.h>
+
+#include "test.h"
+#include "compat_16.h"
-static void run(void)
+TCID_DEFINE(setgid02);
+int TST_TOTAL = 1;
+
+static char root[] = "root";
+static char nobody_uid[] = "nobody";
+static char nobody_gid[] = "nobody";
+static struct passwd *ltpuser;
+
+static void setup(void);
+static void cleanup(void);
+
+int main(int ac, char **av)
{
- struct passwd *rootpwent;
+ struct passwd *getpwnam(), *rootpwent;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
- rootpwent = SAFE_GETPWNAM("root");
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- GID16_CHECK(rootpwent->pw_gid, setgid);
+ if ((rootpwent = getpwnam(root)) == NULL) {
+ tst_brkm(TBROK, cleanup, "getpwnam failed for user id "
+ "%s", root);
+ }
- TST_EXP_FAIL(SETGID(rootpwent->pw_gid), EPERM);
+ GID16_CHECK(rootpwent->pw_gid, setgid, cleanup);
+
+ TEST(SETGID(cleanup, rootpwent->pw_gid));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "call succeeded unexpectedly");
+ continue;
+ }
+
+ if (TEST_ERRNO != EPERM) {
+ tst_resm(TFAIL, "setgid set invalid errno, expected: "
+ "EPERM, got: %d\n", TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "setgid returned EPERM");
+ }
+ }
+
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- struct passwd *nobody = SAFE_GETPWNAM("nobody");
+ tst_require_root();
+
+ /* Switch to nobody user for correct error code collection */
+ ltpuser = getpwnam(nobody_uid);
+ if (ltpuser == NULL)
+ tst_brkm(TBROK, cleanup, "getpwnam failed for user id %s",
+ nobody_uid);
- SAFE_SETGID(nobody->pw_gid);
- SAFE_SETUID(nobody->pw_uid);
+ if (setgid(ltpuser->pw_gid) == -1) {
+ tst_resm(TINFO, "setgid failed to "
+ "to set the effective gid to %d", ltpuser->pw_gid);
+ perror("setgid");
+ }
+
+ if (setuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TINFO, "setuid failed to "
+ "to set the effective uid to %d", ltpuser->pw_uid);
+ perror("setuid");
+ }
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .needs_root = 1,
- .setup = setup,
- .test_all = run,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/setgid/setgid03.c b/testcases/kernel/syscalls/setgid/setgid03.c
index 36e31f6f0..f29347a13 100644
--- a/testcases/kernel/syscalls/setgid/setgid03.c
+++ b/testcases/kernel/syscalls/setgid/setgid03.c
@@ -1,39 +1,100 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* Ported by Wayne Boyer
- */
-
-/*\
- * [Algorithm]
*
- * As a root sets current group id to nobody and expects success.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/*
+ * ALGORITHM
+ * As root sets the current group id to ltpuser1, verify the results
+ */
#include <pwd.h>
-#include "tst_test.h"
-#include <compat_tst_16.h>
+#include <errno.h>
-static struct passwd *nobody;
+#include "test.h"
+#include <compat_16.h>
-static void run(void)
+TCID_DEFINE(setgid03);
+int TST_TOTAL = 1;
+
+static char ltpuser1[] = "nobody";
+static char root[] = "root";
+static struct passwd *ltpuser1pwent, *rootpwent;
+static gid_t mygid;
+
+static void setup(void);
+static void cleanup(void);
+
+int main(int ac, char **av)
{
- TST_EXP_PASS(SETGID(nobody->pw_gid));
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- if (getgid() != nobody->pw_gid)
- tst_res(TFAIL, "setgid failed to set gid to nobody gid");
- else
- tst_res(TPASS, "functionality of getgid() is correct");
+ TEST(SETGID(cleanup, ltpuser1pwent->pw_gid));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "call failed unexpectedly");
+ continue;
+ }
+
+ if (getgid() != ltpuser1pwent->pw_gid) {
+ tst_resm(TFAIL, "setgid failed to set gid to "
+ "ltpuser1's gid");
+ } else {
+ tst_resm(TPASS, "functionality of getgid() is correct");
+ }
+ }
+
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
- nobody = SAFE_GETPWNAM("nobody");
- GID16_CHECK(nobody->pw_gid, setgid);
+ tst_require_root();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ if ((rootpwent = getpwnam(root)) == NULL) {
+ tst_brkm(TBROK, cleanup, "getpwnam failed for "
+ "user id %s", root);
+ }
+
+ mygid = getgid();
+
+ if (mygid != rootpwent->pw_gid) {
+ tst_brkm(TBROK, cleanup, "real group id is not root");
+ }
+
+ if ((ltpuser1pwent = getpwnam(ltpuser1)) == NULL) {
+ tst_brkm(TBROK, cleanup, "getpwnam failed for user "
+ "id %s", ltpuser1);
+ }
+
+ GID16_CHECK(ltpuser1pwent->pw_gid, setgid, cleanup);
}
-static struct tst_test test = {
- .needs_root = 1,
- .setup = setup,
- .test_all = run,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/setgroups/Makefile b/testcases/kernel/syscalls/setgroups/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setgroups/Makefile
+++ b/testcases/kernel/syscalls/setgroups/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setitimer/Makefile b/testcases/kernel/syscalls/setitimer/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/setitimer/Makefile
+++ b/testcases/kernel/syscalls/setitimer/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setns/Makefile b/testcases/kernel/syscalls/setns/Makefile
index 9b051f64f..f1b5129c2 100644
--- a/testcases/kernel/syscalls/setns/Makefile
+++ b/testcases/kernel/syscalls/setns/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (C) 2013 Linux Test Project, Inc.
#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setns/setns.h b/testcases/kernel/syscalls/setns/setns.h
index 46beef17f..a05e6736c 100644
--- a/testcases/kernel/syscalls/setns/setns.h
+++ b/testcases/kernel/syscalls/setns/setns.h
@@ -1,11 +1,27 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2014-2020
+ * Copyright (C) 2013 Linux Test Project, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like. Any license provided herein, whether
+ * implied or otherwise, applies only to this software file. Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
*/
-#include <stdio.h>
-#include "lapi/namespaces_constants.h"
-
#define NS_MAX 5
static int ns_types[NS_MAX];
static int ns_fds[NS_MAX];
@@ -19,10 +35,12 @@ static int get_ns_fd(int pid, const char *ns)
sprintf(tmp, "/proc/%d/ns/%s", pid, ns);
if (stat(tmp, &st) == 0) {
- fd = SAFE_OPEN(tmp, O_RDONLY);
+ fd = open(tmp, O_RDONLY);
+ if (fd == -1)
+ tst_brkm(TBROK|TERRNO, NULL, "failed to open %s", tmp);
} else {
if (errno != ENOENT)
- tst_brk(TBROK|TERRNO, "failed to stat %s", tmp);
+ tst_brkm(TBROK|TERRNO, NULL, "failed to stat %s", tmp);
}
return fd;
}
@@ -35,7 +53,7 @@ static void init_ns_type(int clone_type, const char *proc_name)
if (fd != -1) {
ns_types[ns_total] = clone_type;
ns_fds[ns_total] = fd;
- tst_res(TINFO, "ns_name=%s, ns_fds[%d]=%d, ns_types[%d]=0x%x",
+ tst_resm(TINFO, "ns_name=%s, ns_fds[%d]=%d, ns_types[%d]=0x%x",
proc_name, ns_total, fd, ns_total, clone_type);
ns_total++;
}
@@ -43,11 +61,21 @@ static void init_ns_type(int clone_type, const char *proc_name)
static void init_available_ns(void)
{
+#if defined(CLONE_NEWIPC)
init_ns_type(CLONE_NEWIPC, "ipc");
+#endif
+#if defined(CLONE_NEWNS)
init_ns_type(CLONE_NEWNS, "mnt");
+#endif
+#if defined(CLONE_NEWNET)
init_ns_type(CLONE_NEWNET, "net");
+#endif
+#if defined(CLONE_NEWPID)
init_ns_type(CLONE_NEWPID, "pid");
+#endif
+#if defined(CLONE_NEWUTS)
init_ns_type(CLONE_NEWUTS, "uts");
+#endif
}
static void close_ns_fds(void)
@@ -56,5 +84,5 @@ static void close_ns_fds(void)
for (i = 0; i < ns_total; i++)
if (ns_fds[i] != -1)
- SAFE_CLOSE(ns_fds[i]);
+ close(ns_fds[i]);
}
diff --git a/testcases/kernel/syscalls/setns/setns01.c b/testcases/kernel/syscalls/setns/setns01.c
index 4578871f6..864899205 100644
--- a/testcases/kernel/syscalls/setns/setns01.c
+++ b/testcases/kernel/syscalls/setns/setns01.c
@@ -1,24 +1,46 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2014-2020
+ * Copyright (C) 2013 Linux Test Project, Inc.
*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like. Any license provided herein, whether
+ * implied or otherwise, applies only to this software file. Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+/*
* errno tests for setns(2) - reassociate thread with a namespace
*/
#define _GNU_SOURCE
#include <sys/stat.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <errno.h>
#include <sched.h>
#include <pwd.h>
#include <string.h>
#include "config.h"
-#include "tst_test.h"
+#include "test.h"
#include "lapi/syscalls.h"
-#include "setns.h"
+#include "safe_macros.h"
-static const char nobody_uid[] = "nobody";
-static struct passwd *ltpuser;
-static int regular_fd;
+char *TCID = "setns01";
+
+#if defined(__NR_setns)
+#include "setns.h"
struct testcase_t {
const char *msg;
@@ -31,6 +53,57 @@ struct testcase_t {
void (*cleanup) (struct testcase_t *);
};
+static void setup(void);
+static void cleanup(void);
+static void setup0(struct testcase_t *, int);
+static void setup1(struct testcase_t *, int);
+static void setup2(struct testcase_t *, int);
+static void setup3(struct testcase_t *, int);
+static void setup4(struct testcase_t *, int);
+static void cleanup1(struct testcase_t *);
+static void cleanup4(struct testcase_t *);
+
+struct testcase_t tdat[] = {
+ {
+ .msg = "invalid fd",
+ .fd = -1,
+ .exp_ret = -1,
+ .exp_errno = EBADF,
+ .setup = setup0,
+ },
+ {
+ .msg = "regular file fd",
+ .exp_ret = -1,
+ .exp_errno = EINVAL,
+ .setup = setup1,
+ .cleanup = cleanup1
+ },
+ {
+ .msg = "invalid ns_type",
+ .ns_type = -1,
+ .exp_ret = -1,
+ .exp_errno = EINVAL,
+ .setup = setup2,
+ },
+ {
+ .msg = "mismatch ns_type/fd",
+ .exp_ret = -1,
+ .exp_errno = EINVAL,
+ .setup = setup3,
+ },
+ {
+ .msg = "without CAP_SYS_ADMIN",
+ .exp_ret = -1,
+ .exp_errno = EPERM,
+ .setup = setup4,
+ .cleanup = cleanup4,
+ }
+};
+
+static int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
+static const char nobody_uid[] = "nobody";
+static struct passwd *ltpuser;
+
static void setup0(struct testcase_t *t, int i)
{
t->ns_type = ns_types[i];
@@ -39,7 +112,15 @@ static void setup0(struct testcase_t *t, int i)
static void setup1(struct testcase_t *t, int i)
{
t->ns_type = ns_types[i];
- t->fd = regular_fd;
+ t->fd = open("dummy", O_RDWR|O_CREAT, 0600);
+ if (t->fd == -1)
+ tst_brkm(TFAIL|TERRNO, cleanup, "setup1:open failed");
+ unlink("dummy");
+}
+
+static void cleanup1(struct testcase_t *t)
+{
+ close(t->fd);
}
static void setup2(struct testcase_t *t, int i)
@@ -60,82 +141,42 @@ static void setup3(struct testcase_t *t, int i)
static void setup4(struct testcase_t *t, int i)
{
- SAFE_SETEUID(ltpuser->pw_uid);
+ SAFE_SETEUID(NULL, ltpuser->pw_uid);
t->fd = ns_fds[i];
t->ns_type = ns_types[i];
}
-static void cleanup4(LTP_ATTRIBUTE_UNUSED struct testcase_t *t)
+static void cleanup4(struct testcase_t *t)
{
- SAFE_SETEUID(0);
+ SAFE_SETEUID(NULL, 0);
}
-static struct testcase_t tcases[] = {
- {
- .msg = "invalid fd",
- .fd = -1,
- .exp_ret = -1,
- .exp_errno = EBADF,
- .setup = setup0,
- },
- {
- .msg = "regular file fd",
- .exp_ret = -1,
- .exp_errno = EINVAL,
- .setup = setup1,
- },
- {
- .msg = "invalid ns_type",
- .ns_type = -1,
- .exp_ret = -1,
- .exp_errno = EINVAL,
- .setup = setup2,
- },
- {
- .msg = "mismatch ns_type/fd",
- .exp_ret = -1,
- .exp_errno = EINVAL,
- .setup = setup3,
- },
- {
- .msg = "without CAP_SYS_ADMIN",
- .exp_ret = -1,
- .exp_errno = EPERM,
- .setup = setup4,
- .cleanup = cleanup4,
- }
-};
-
-static void test_setns(unsigned int testno)
+static void test_setns(struct testcase_t *t)
{
int ret, i;
- struct testcase_t *t = &tcases[testno];
for (i = 0; i < ns_total; i++) {
if (t->setup)
t->setup(t, i);
if (t->skip) {
- tst_res(TCONF, "skip %s", t->msg);
+ tst_resm(TINFO, "skip %s", tdat->msg);
continue;
}
- tst_res(TINFO, "setns(%d, 0x%x)", t->fd, t->ns_type);
- ret = tst_syscall(__NR_setns, t->fd, t->ns_type);
+ tst_resm(TINFO, "setns(%d, 0x%x)", t->fd, t->ns_type);
+ ret = syscall(__NR_setns, t->fd, t->ns_type);
if (ret == t->exp_ret) {
- if (ret == -1 && errno == t->exp_errno) {
- tst_res(TPASS, "%s exp_errno=%d (%s)",
- t->msg, t->exp_errno,
- tst_strerrno(t->exp_errno));
- } else {
- tst_res(TFAIL|TERRNO, "%s exp_errno=%d (%s)",
- t->msg, t->exp_errno,
- tst_strerrno(t->exp_errno));
- }
+ if (ret == -1 && errno == t->exp_errno)
+ tst_resm(TPASS, "%s exp_errno=%d", t->msg,
+ t->exp_errno);
+ else
+ tst_resm(TFAIL|TERRNO, "%s exp_errno=%d",
+ t->msg, t->exp_errno);
} else {
- tst_res(TFAIL, "%s ret=%d expected=%d",
- t->msg, ret, t->exp_ret);
+ tst_resm(TFAIL, "%s ret=%d expected=%d", t->msg,
+ ret, t->exp_ret);
}
if (t->cleanup)
@@ -143,33 +184,50 @@ static void test_setns(unsigned int testno)
}
}
+int main(int argc, char *argv[])
+{
+ int lc, testno;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ for (testno = 0; testno < TST_TOTAL; testno++)
+ test_setns(&tdat[testno]);
+ }
+ cleanup();
+ tst_exit();
+}
+
static void setup(void)
{
+ tst_require_root();
+
/* runtime check if syscall is supported */
- tst_syscall(__NR_setns, -1, 0);
+ ltp_syscall(__NR_setns, -1, 0);
init_available_ns();
if (ns_total == 0)
- tst_brk(TCONF, "no ns types/proc entries");
+ tst_brkm(TCONF, NULL, "no ns types/proc entries");
- ltpuser = SAFE_GETPWNAM(nobody_uid);
- regular_fd = SAFE_OPEN("dummy", O_RDWR|O_CREAT, 0600);
- SAFE_UNLINK("dummy");
+ ltpuser = getpwnam(nobody_uid);
+ if (ltpuser == NULL)
+ tst_brkm(TBROK | TERRNO, NULL, "getpwnam failed");
+
+
+ tst_tmpdir();
+ TEST_PAUSE;
}
static void cleanup(void)
{
close_ns_fds();
- if (regular_fd)
- SAFE_CLOSE(regular_fd);
+ tst_rmdir();
}
+#else
+int main(int argc, char *argv[])
+{
+ tst_brkm(TCONF, NULL, "__NR_setns is not defined on your system.");
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = test_setns,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
- .needs_tmpdir = 1,
-};
-
+}
+#endif
diff --git a/testcases/kernel/syscalls/setns/setns02.c b/testcases/kernel/syscalls/setns/setns02.c
index db442541b..0f4902845 100644
--- a/testcases/kernel/syscalls/setns/setns02.c
+++ b/testcases/kernel/syscalls/setns/setns02.c
@@ -1,7 +1,27 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2014-2020
+ * Copyright (C) 2013 Linux Test Project, Inc.
*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like. Any license provided herein, whether
+ * implied or otherwise, applies only to this software file. Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+/*
* functional test for setns(2) - reassociate thread with a namespace
* 1. create child with CLONE_NEWUTS, set different hostname in child,
* set namespace back to parent ns and check that hostname has changed
@@ -13,21 +33,24 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <errno.h>
#include <sched.h>
-#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "tst_test.h"
-#include "tst_safe_sysv_ipc.h"
+#include "test.h"
#include "lapi/syscalls.h"
-#include "setns.h"
+#include "safe_macros.h"
#define CHILD_STACK_SIZE (1024*1024)
#define CP "(child) "
+char *TCID = "setns02";
+
+#if defined(__NR_setns) && defined(CLONE_NEWIPC) && defined(CLONE_NEWUTS)
+#include "setns.h"
static char *dummy_hostname = "setns_dummy_uts";
static int ns_ipc_fd;
@@ -44,37 +67,37 @@ static int do_child_newuts(void *arg)
int ns_flag = *(int *)arg;
if (uname(&uts_parent) == -1)
- tst_res(TFAIL|TERRNO, CP"uname");
- tst_res(TINFO, CP"hostname (inherited from parent): %s",
+ tst_resm(TFAIL|TERRNO, CP"uname");
+ tst_resm(TINFO, CP"hostname (inherited from parent): %s",
uts_parent.nodename);
if (sethostname(dummy_hostname, strlen(dummy_hostname)) == -1)
- tst_res(TFAIL|TERRNO, CP"sethostname");
+ tst_resm(TFAIL|TERRNO, CP"sethostname");
if (uname(&uts) == -1)
- tst_res(TFAIL|TERRNO, CP"uname");
+ tst_resm(TFAIL|TERRNO, CP"uname");
- tst_res(TINFO, CP"hostname changed to: %s", uts.nodename);
+ tst_resm(TINFO, CP"hostname changed to: %s", uts.nodename);
if (strcmp(uts_parent.nodename, uts.nodename) == 0) {
- tst_res(TFAIL, CP"expected hostname to be different");
+ tst_resm(TFAIL, CP"expected hostname to be different");
return 1;
} else {
- tst_res(TPASS, CP"hostname is different in parent/child");
+ tst_resm(TPASS, CP"hostname is different in parent/child");
}
- tst_res(TINFO, CP"attempting to switch ns back to parent ns");
- if (tst_syscall(__NR_setns, ns_uts_fd, ns_flag) == -1) {
- tst_res(TFAIL|TERRNO, CP"setns");
+ tst_resm(TINFO, CP"attempting to switch ns back to parent ns");
+ if (syscall(__NR_setns, ns_uts_fd, ns_flag) == -1) {
+ tst_resm(TFAIL|TERRNO, CP"setns");
return 2;
}
if (uname(&uts) == -1)
- tst_res(TFAIL|TERRNO, CP"uname");
+ tst_resm(TFAIL|TERRNO, CP"uname");
- tst_res(TINFO, CP"hostname: %s", uts.nodename);
+ tst_resm(TINFO, CP"hostname: %s", uts.nodename);
if (strcmp(uts_parent.nodename, uts.nodename) != 0) {
- tst_res(TFAIL, CP"expected hostname to match parent");
+ tst_resm(TFAIL, CP"expected hostname to match parent");
return 3;
} else {
- tst_res(TPASS, CP"hostname now as expected");
+ tst_resm(TPASS, CP"hostname now as expected");
}
return 0;
}
@@ -86,25 +109,25 @@ static int do_child_newipc(void *arg)
p = shmat(shmid, NULL, 0);
if (p == (void *) -1) {
- tst_res(TPASS|TERRNO, CP"shmat failed as expected");
+ tst_resm(TPASS|TERRNO, CP"shmat failed as expected");
} else {
- tst_res(TFAIL, CP"shmat unexpectedly suceeded");
+ tst_resm(TFAIL, CP"shmat unexpectedly suceeded");
shmdt(p);
return 1;
}
- tst_res(TINFO, CP"attempting to switch ns back to parent ns");
- if (tst_syscall(__NR_setns, ns_ipc_fd, ns_flag) == -1) {
- tst_res(TFAIL|TERRNO, CP"setns");
+ tst_resm(TINFO, CP"attempting to switch ns back to parent ns");
+ if (syscall(__NR_setns, ns_ipc_fd, ns_flag) == -1) {
+ tst_resm(TFAIL|TERRNO, CP"setns");
return 2;
}
p = shmat(shmid, NULL, 0);
if (p == (void *) -1) {
- tst_res(TFAIL|TERRNO, CP"shmat failed after setns");
+ tst_resm(TFAIL|TERRNO, CP"shmat failed after setns");
return 3;
} else {
- tst_res(TPASS, CP"shmat suceeded");
+ tst_resm(TPASS, CP"shmat suceeded");
shmdt(p);
}
@@ -116,68 +139,87 @@ static void test_flag(int clone_flag, int ns_flag, int (*fn) (void *arg))
void *child_stack;
int ret, status;
- child_stack = SAFE_MALLOC(CHILD_STACK_SIZE);
+ child_stack = malloc(CHILD_STACK_SIZE);
+ if (child_stack == NULL)
+ tst_brkm(TBROK, cleanup, "Cannot allocate stack for child");
- tst_res(TINFO, "creating child with clone_flag=0x%x, ns_flag=0x%x",
+ tst_resm(TINFO, "creating child with clone_flag=0x%x, ns_flag=0x%x",
clone_flag, ns_flag);
ret = ltp_clone(SIGCHLD|clone_flag, fn, &ns_flag,
CHILD_STACK_SIZE, child_stack);
if (ret == -1)
- tst_brk(TBROK|TERRNO, "ltp_clone");
+ tst_brkm(TBROK|TERRNO, cleanup, "ltp_clone");
- SAFE_WAITPID(ret, &status, 0);
+ SAFE_WAITPID(cleanup, ret, &status, 0);
+ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ tst_resm(TFAIL, "child returns %d", status);
+ else
+ tst_resm(TPASS, "child finished succesfully");
free(child_stack);
}
-void test_all(void)
+int main(int argc, char *argv[])
{
- if (ns_uts_fd != -1) {
- tst_res(TINFO, "test_newuts");
- test_flag(CLONE_NEWUTS, CLONE_NEWUTS, do_child_newuts);
- test_flag(CLONE_NEWUTS, 0, do_child_newuts);
- } else
- tst_res(TCONF, "CLONE_NEWUTS is not supported");
-
- if (ns_ipc_fd != -1) {
- tst_res(TINFO, "test_newipc");
- test_flag(CLONE_NEWIPC, CLONE_NEWIPC, do_child_newipc);
- test_flag(CLONE_NEWIPC, 0, do_child_newipc);
- } else
- tst_res(TCONF, "CLONE_NEWIPC is not supported");
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ if (ns_uts_fd != -1) {
+ tst_resm(TINFO, "test_newuts");
+ test_flag(CLONE_NEWUTS, CLONE_NEWUTS, do_child_newuts);
+ test_flag(CLONE_NEWUTS, 0, do_child_newuts);
+ }
+ if (ns_ipc_fd != -1) {
+ tst_resm(TINFO, "test_newipc");
+ test_flag(CLONE_NEWIPC, CLONE_NEWIPC, do_child_newipc);
+ test_flag(CLONE_NEWIPC, 0, do_child_newipc);
+ }
+ }
+ cleanup();
+ tst_exit();
}
static void setup(void)
{
char tmp[PATH_MAX];
+ tst_require_root();
+
/* runtime check if syscall is supported */
- tst_syscall(__NR_setns, -1, 0);
+ ltp_syscall(__NR_setns, -1, 0);
/* check if kernel has CONFIG_*_NS set and exports /proc entries */
ns_ipc_fd = get_ns_fd(getpid(), "ipc");
ns_uts_fd = get_ns_fd(getpid(), "uts");
if (ns_ipc_fd == -1 && ns_uts_fd == -1)
- tst_brk(TCONF, "your kernel has CONFIG_IPC_NS, "
+ tst_brkm(TCONF, NULL, "your kernel has CONFIG_IPC_NS, "
"CONFIG_UTS_NS or CONFIG_PROC disabled");
- SAFE_GETCWD(tmp, PATH_MAX);
+ if (getcwd(tmp, PATH_MAX) == NULL)
+ tst_brkm(TBROK|TERRNO, NULL, "getcwd");
ipc_key = ftok(tmp, 65);
- shmid = SAFE_SHMGET(ipc_key, getpagesize(), IPC_CREAT | 0666);
+ shmid = shmget(ipc_key, getpagesize(), IPC_CREAT | 0666);
+ if (shmid == -1)
+ tst_brkm(TBROK|TERRNO, NULL, "shmget");
+
+ TEST_PAUSE;
}
static void cleanup(void)
{
if (ns_ipc_fd != -1)
- SAFE_CLOSE(ns_ipc_fd);
+ close(ns_ipc_fd);
if (ns_uts_fd != -1)
- SAFE_CLOSE(ns_uts_fd);
+ close(ns_uts_fd);
- SAFE_SHMCTL(shmid, IPC_RMID, NULL);
+ shmctl(shmid, IPC_RMID, NULL);
}
-
-static struct tst_test test = {
- .test_all = test_all,
- .setup = setup,
- .cleanup = cleanup,
- .needs_root = 1,
-};
+#else
+int main(int argc, char *argv[])
+{
+ tst_brkm(TCONF, NULL, "__NR_setns, CLONE_NEWIPC or CLONE_NEWUTS "
+ " is not defined on your system.");
+}
+#endif
diff --git a/testcases/kernel/syscalls/setpgid/Makefile b/testcases/kernel/syscalls/setpgid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/setpgid/Makefile
+++ b/testcases/kernel/syscalls/setpgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setpgrp/Makefile b/testcases/kernel/syscalls/setpgrp/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/setpgrp/Makefile
+++ b/testcases/kernel/syscalls/setpgrp/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setpriority/Makefile b/testcases/kernel/syscalls/setpriority/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/setpriority/Makefile
+++ b/testcases/kernel/syscalls/setpriority/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setpriority/setpriority01.c b/testcases/kernel/syscalls/setpriority/setpriority01.c
index 22fbe1ae5..ffd7499c4 100644
--- a/testcases/kernel/syscalls/setpriority/setpriority01.c
+++ b/testcases/kernel/syscalls/setpriority/setpriority01.c
@@ -112,7 +112,7 @@ static void setup(void)
struct passwd *ltpuser;
int rc;
- switch ((rc = tst_cmd(cmd_useradd, NULL, NULL, TST_CMD_PASS_RETVAL))) {
+ switch ((rc = tst_run_cmd(cmd_useradd, NULL, NULL, 1))) {
case 0:
user_added = 1;
ltpuser = SAFE_GETPWNAM(username);
@@ -133,7 +133,7 @@ static void cleanup(void)
const char *const cmd_userdel[] = {"userdel", "-r", username, NULL};
- if (tst_cmd(cmd_userdel, NULL, NULL, TST_CMD_PASS_RETVAL))
+ if (tst_run_cmd(cmd_userdel, NULL, NULL, 1))
tst_res(TWARN | TERRNO, "'userdel -r %s' failed", username);
}
diff --git a/testcases/kernel/syscalls/setregid/Makefile b/testcases/kernel/syscalls/setregid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setregid/Makefile
+++ b/testcases/kernel/syscalls/setregid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setregid/setregid04.c b/testcases/kernel/syscalls/setregid/setregid04.c
index 9490ae173..d8e7c2dc2 100644
--- a/testcases/kernel/syscalls/setregid/setregid04.c
+++ b/testcases/kernel/syscalls/setregid/setregid04.c
@@ -69,13 +69,12 @@ static void run(unsigned int i)
TEST(SETREGID(*test_data[i].real_gid, *test_data[i].eff_gid));
if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "setregid(%d, %d) failed",
+ tst_res(TBROK | TTERRNO, "setregid(%d, %d) failed",
*test_data[i].real_gid, *test_data[i].eff_gid);
- return;
+ } else {
+ gid_verify(test_data[i].exp_real_usr, test_data[i].exp_eff_usr,
+ test_data[i].test_msg);
}
-
- gid_verify(test_data[i].exp_real_usr, test_data[i].exp_eff_usr,
- test_data[i].test_msg);
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/setresgid/Makefile b/testcases/kernel/syscalls/setresgid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setresgid/Makefile
+++ b/testcases/kernel/syscalls/setresgid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setresuid/Makefile b/testcases/kernel/syscalls/setresuid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setresuid/Makefile
+++ b/testcases/kernel/syscalls/setresuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setreuid/Makefile b/testcases/kernel/syscalls/setreuid/Makefile
index b2bb1e005..f3ab65753 100644
--- a/testcases/kernel/syscalls/setreuid/Makefile
+++ b/testcases/kernel/syscalls/setreuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setrlimit/Makefile b/testcases/kernel/syscalls/setrlimit/Makefile
index 1f734cd31..257a189dc 100644
--- a/testcases/kernel/syscalls/setrlimit/Makefile
+++ b/testcases/kernel/syscalls/setrlimit/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit01.c b/testcases/kernel/syscalls/setrlimit/setrlimit01.c
index 7b133ef9e..f66f99553 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit01.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit01.c
@@ -117,7 +117,7 @@ static void test2(void)
* Since we would be altering the filesize in the child,
* we need to "sync", ie. fflush the parent's write buffers
* here. This is because the child will inherit the parent's
- * write buffer, and while exiting it would try to fflush it.
+ * write buffer, and while exitting it would try to fflush it.
* Since its filesize is truncated to only 10 bytes, the
* fflush attempt would fail, and the child would exit with
* an wired value! So, it is essential to fflush the parent's
@@ -151,7 +151,8 @@ static void test2(void)
bytes = write(fd, buf, 26);
if (bytes != 10) {
- if (write(pipefd[1], &bytes, sizeof(bytes)) < (long)sizeof(bytes)) {
+ if (write(pipefd[1], &bytes, sizeof(bytes))
+ < sizeof(bytes)) {
perror("child: write to pipe failed");
}
close(pipefd[1]); /* EOF */
@@ -176,7 +177,7 @@ static void test2(void)
break;
case 3:
close(pipefd[1]); /* close unused write end */
- if (read(pipefd[0], &bytes, sizeof(bytes)) < (long)sizeof(bytes))
+ if (read(pipefd[0], &bytes, sizeof(bytes)) < sizeof(bytes))
tst_resm(TFAIL, "parent: reading pipe failed");
close(pipefd[0]);
@@ -247,7 +248,7 @@ static void test4(void)
TEST(setrlimit(RLIMIT_CORE, &rlim));
if (TEST_RETURN == -1) {
- tst_resm(TFAIL | TTERRNO, "setrlimit failed to set RLIMIT_CORE");
+ tst_resm(TFAIL | TERRNO, "setrlimit failed to set RLIMIT_CORE");
return;
}
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
index 906396f01..077399e83 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
@@ -57,7 +57,7 @@ static void verify_setrlimit(void)
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
return;
- tst_res(TFAIL, "child %s", tst_strstatus(status));
+ tst_res(TBROK, "child %s", tst_strstatus(status));
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit06.c b/testcases/kernel/syscalls/setrlimit/setrlimit06.c
index 9ff515d81..726b26841 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit06.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit06.c
@@ -59,8 +59,8 @@ static void verify_setrlimit(void)
pid = SAFE_FORK();
if (!pid) {
struct rlimit rlim = {
- .rlim_cur = 1,
- .rlim_max = 2,
+ .rlim_cur = 2,
+ .rlim_max = 3,
};
TEST(setrlimit(RLIMIT_CPU, &rlim));
@@ -70,7 +70,7 @@ static void verify_setrlimit(void)
exit(1);
}
- alarm(20);
+ alarm(10);
while (1);
}
@@ -106,7 +106,7 @@ static void verify_setrlimit(void)
}
}
- tst_res(TFAIL, "Child %s", tst_strstatus(status));
+ tst_res(TBROK, "Child %s", tst_strstatus(status));
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/setsid/Makefile b/testcases/kernel/syscalls/setsid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/setsid/Makefile
+++ b/testcases/kernel/syscalls/setsid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setsockopt/.gitignore b/testcases/kernel/syscalls/setsockopt/.gitignore
index 1ca5b836b..603e2ad7a 100644
--- a/testcases/kernel/syscalls/setsockopt/.gitignore
+++ b/testcases/kernel/syscalls/setsockopt/.gitignore
@@ -2,6 +2,3 @@
/setsockopt02
/setsockopt03
/setsockopt04
-/setsockopt05
-/setsockopt06
-/setsockopt07
diff --git a/testcases/kernel/syscalls/setsockopt/Makefile b/testcases/kernel/syscalls/setsockopt/Makefile
index 678ada75a..bd617d806 100644
--- a/testcases/kernel/syscalls/setsockopt/Makefile
+++ b/testcases/kernel/syscalls/setsockopt/Makefile
@@ -1,9 +1,22 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-setsockopt06 setsockopt07: CFLAGS += -pthread
-setsockopt06 setsockopt07: LDLIBS += -lrt
include $(top_srcdir)/include/mk/testcases.mk
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt01.c b/testcases/kernel/syscalls/setsockopt/setsockopt01.c
index 4c48a0d95..743c6be14 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt01.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt01.c
@@ -1,27 +1,72 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
+ *
* Copyright (c) International Business Machines Corp., 2001
- * 07/2001 John George
- * Copyright (c) 2020 Martin Doucha <mdoucha@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
+ * Test Name: setsockopt01
+ *
* Test Description:
* Verify that setsockopt() returns the proper errno for various failure cases
+ *
+ * Usage: <for command-line>
+ * setsockopt01 [-c n] [-e] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions:
+ * None.
+ *
*/
+#include <stdio.h>
#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/signal.h>
#include <sys/ioctl.h>
+
#include <netinet/in.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
-static struct sockaddr_in addr;
-static int optval;
+char *TCID = "setsockopt01";
+int testno;
-static struct test_case { /* test case structure */
+int s; /* socket descriptor */
+struct sockaddr_in sin0, fsin1;
+int optval;
+
+void setup(void), setup0(void), setup1(void),
+cleanup(void), cleanup0(void), cleanup1(void);
+
+struct test_case_t { /* test case structure */
int domain; /* PF_INET, PF_UNIX, ... */
int type; /* SOCK_STREAM, SOCK_DGRAM ... */
int proto; /* protocol number (usually 0 = default) */
@@ -29,80 +74,140 @@ static struct test_case { /* test case structure */
int optname;
void *optval;
int optlen;
+ struct sockaddr *sin;
+ int salen;
+ int retval; /* syscall return value */
int experrno; /* expected errno */
+ void (*setup) (void);
+ void (*cleanup) (void);
char *desc;
-} testcase_list[] = {
- {-1, -1, -1, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval),
- EBADF, "invalid file descriptor"},
- {-1, -1, -1, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval),
- ENOTSOCK, "non-socket file descriptor"},
- {PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, NULL,
- sizeof(optval), EFAULT, "invalid option buffer"},
- {PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, &optval, 0,
- EINVAL, "invalid optlen"},
- {PF_INET, SOCK_STREAM, 0, 500, SO_OOBINLINE, &optval, sizeof(optval),
- ENOPROTOOPT, "invalid level"},
- {PF_INET, SOCK_STREAM, 0, IPPROTO_UDP, SO_OOBINLINE, &optval,
- sizeof(optval), ENOPROTOOPT, "invalid option name (UDP)"},
- {PF_INET, SOCK_STREAM, 0, IPPROTO_IP, -1, &optval, sizeof(optval),
- ENOPROTOOPT, "invalid option name (IP)"},
- {PF_INET, SOCK_STREAM, 0, IPPROTO_TCP, -1, &optval, sizeof(optval),
- ENOPROTOOPT, "invalid option name (TCP)"}
-};
-
-static void setup(void)
+} tdat[] = {
+ {
+ PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, &optval,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, EBADF, setup0, cleanup0,
+ "bad file descriptor"}
+ , {
+ PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, &optval,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, ENOTSOCK, setup0, cleanup0,
+ "bad file descriptor"}
+ ,
+#if !defined(UCLINUX)
+ {
+ PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, 0,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, EFAULT, setup1, cleanup1,
+ "invalid option buffer"}
+ ,
+#endif
+ {
+ PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, &optval, 0,
+ (struct sockaddr *)&fsin1, sizeof(fsin1), -1,
+ EINVAL, setup1, cleanup1, "invalid optlen"}
+ , {
+ PF_INET, SOCK_STREAM, 0, 500, SO_OOBINLINE, &optval,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, ENOPROTOOPT, setup1, cleanup1,
+ "invalid level"}
+ , {
+ PF_INET, SOCK_STREAM, 0, IPPROTO_UDP, SO_OOBINLINE, &optval,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, ENOPROTOOPT, setup1, cleanup1,
+ "invalid option name (UDP)"}
+ , {
+ PF_INET, SOCK_STREAM, 0, IPPROTO_IP, -1, &optval,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, ENOPROTOOPT, setup1, cleanup1,
+ "invalid option name (IP)"}
+ , {
+ PF_INET, SOCK_STREAM, 0, IPPROTO_TCP, -1, &optval,
+ sizeof(optval), (struct sockaddr *)&fsin1,
+ sizeof(fsin1), -1, ENOPROTOOPT, setup1, cleanup1,
+ "invalid option name (TCP)"}
+,};
+
+int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
+
+int main(int argc, char *argv[])
{
- /* initialize local sockaddr */
- addr.sin_family = AF_INET;
- addr.sin_port = 0;
- addr.sin_addr.s_addr = INADDR_ANY;
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
+ tdat[testno].setup();
+
+ TEST(setsockopt(s, tdat[testno].level,
+ tdat[testno].optname,
+ tdat[testno].optval,
+ tdat[testno].optlen));
+
+ if (TEST_RETURN == -1) {
+ }
+
+ if (TEST_RETURN != tdat[testno].retval ||
+ (TEST_RETURN < 0 &&
+ TEST_ERRNO != tdat[testno].experrno)) {
+ tst_resm(TFAIL, "%s ; returned"
+ " %ld (expected %d), errno %d (expected"
+ " %d)", tdat[testno].desc,
+ TEST_RETURN, tdat[testno].retval,
+ TEST_ERRNO, tdat[testno].experrno);
+ } else {
+ tst_resm(TPASS, "%s successful",
+ tdat[testno].desc);
+ }
+ tdat[testno].cleanup();
+ }
+ }
+ cleanup();
+ tst_exit();
}
-static void run(unsigned int n)
+void setup(void)
{
- struct test_case *tc = testcase_list + n;
- int tmpfd, fd;
-
- tst_res(TINFO, "Testing %s", tc->desc);
-
- if (tc->domain == -1) {
- tmpfd = fd = SAFE_OPEN("/dev/null", O_WRONLY);
- } else {
- tmpfd = fd = SAFE_SOCKET(tc->domain, tc->type, tc->proto);
- SAFE_BIND(fd, (struct sockaddr *)&addr, sizeof(addr));
- }
- /* Use closed file descriptor rather than -1 */
- if (tc->experrno == EBADF)
- SAFE_CLOSE(tmpfd);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- TEST(setsockopt(fd, tc->level, tc->optname, tc->optval, tc->optlen));
+ TEST_PAUSE;
- if (tc->experrno != EBADF)
- SAFE_CLOSE(fd);
+ /* initialize local sockaddr */
+ sin0.sin_family = AF_INET;
+ sin0.sin_port = 0;
+ sin0.sin_addr.s_addr = INADDR_ANY;
+}
- if (TST_RET == 0) {
- tst_res(TFAIL, "setsockopt() succeeded unexpectedly");
- return;
- }
+void cleanup(void)
+{
+}
- if (TST_RET != -1) {
- tst_res(TFAIL | TTERRNO,
- "Invalid setsockopt() return value %ld", TST_RET);
- return;
- }
+void setup0(void)
+{
+ if (tdat[testno].experrno == EBADF)
+ s = 400; /* anything not an open file */
+ else if ((s = open("/dev/null", O_WRONLY)) == -1)
+ tst_brkm(TBROK, cleanup, "error opening /dev/null - "
+ "errno: %s", strerror(errno));
+}
- if (TST_ERR != tc->experrno) {
- tst_res(TFAIL | TTERRNO,
- "setsockopt() returned unexpected error");
- return;
- }
+void cleanup0(void)
+{
+ s = -1;
+}
- tst_res(TPASS | TTERRNO, "setsockopt() returned the expected error");
+void setup1(void)
+{
+ s = SAFE_SOCKET(cleanup, tdat[testno].domain, tdat[testno].type,
+ tdat[testno].proto);
+ SAFE_BIND(cleanup, s, (struct sockaddr *)&sin0, sizeof(sin0));
}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(testcase_list),
- .setup = setup
-};
+void cleanup1(void)
+{
+ (void)close(s);
+ s = -1;
+}
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt02.c b/testcases/kernel/syscalls/setsockopt/setsockopt02.c
index f0a2a5ecd..dc9db2d43 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt02.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt02.c
@@ -20,8 +20,41 @@
#include <errno.h>
#include "tst_test.h"
#include "tst_safe_net.h"
-#include "lapi/if_packet.h"
-#include "lapi/if_ether.h"
+#include "config.h"
+
+#ifdef HAVE_LINUX_IF_PACKET_H
+# include <linux/if_packet.h>
+#endif
+
+#ifdef HAVE_LINUX_IF_ETHER_H
+# include <linux/if_ether.h>
+#endif
+
+#ifndef ETH_P_ALL
+# define ETH_P_ALL 0x0003
+#endif
+
+#ifndef PACKET_RX_RING
+# define PACKET_RX_RING 5
+#endif
+
+#ifndef PACKET_VERSION
+# define PACKET_VERSION 10
+#endif
+
+#ifndef HAVE_STRUCT_TPACKET_REQ3
+# define TPACKET_V3 2
+
+struct tpacket_req3 {
+ unsigned int tp_block_size;
+ unsigned int tp_block_nr;
+ unsigned int tp_frame_size;
+ unsigned int tp_frame_nr;
+ unsigned int tp_retire_blk_tov;
+ unsigned int tp_sizeof_priv;
+ unsigned int tp_feature_req_word;
+};
+#endif
static int sk;
static long pgsz;
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt04.c b/testcases/kernel/syscalls/setsockopt/setsockopt04.c
index 50d82346c..fda5c6b02 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt04.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt04.c
@@ -61,9 +61,4 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "b98b0bc8c431"},
- {"CVE", "2016-9793"},
- {}
- }
};
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt05.c b/testcases/kernel/syscalls/setsockopt/setsockopt05.c
deleted file mode 100644
index 0b7ff39d2..000000000
--- a/testcases/kernel/syscalls/setsockopt/setsockopt05.c
+++ /dev/null
@@ -1,107 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2017-1000112
- *
- * Check that UDP fragmentation offload doesn't cause memory corruption
- * if the userspace process turns off UFO in between two send() calls.
- * Kernel crash fixed in:
- *
- * commit 85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa
- * Author: Willem de Bruijn <willemb@google.com>
- * Date: Thu Aug 10 12:29:19 2017 -0400
- *
- * udp: consistently apply ufo or fragmentation
- */
-
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <sched.h>
-
-#include "tst_test.h"
-#include "tst_net.h"
-
-#define BUFSIZE 4000
-
-static struct sockaddr_in addr;
-static int dst_sock = -1;
-
-static void setup(void)
-{
- int real_uid = getuid();
- int real_gid = getgid();
- struct ifreq ifr;
- socklen_t addrlen = sizeof(addr);
-
- SAFE_UNSHARE(CLONE_NEWUSER);
- SAFE_UNSHARE(CLONE_NEWNET);
- SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
- SAFE_FILE_PRINTF("/proc/self/uid_map", "0 %d 1", real_uid);
- SAFE_FILE_PRINTF("/proc/self/gid_map", "0 %d 1", real_gid);
-
- tst_init_sockaddr_inet_bin(&addr, INADDR_LOOPBACK, 0);
- dst_sock = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
-
- strcpy(ifr.ifr_name, "lo");
- ifr.ifr_mtu = 1500;
- SAFE_IOCTL(dst_sock, SIOCSIFMTU, &ifr);
- ifr.ifr_flags = IFF_UP;
- SAFE_IOCTL(dst_sock, SIOCSIFFLAGS, &ifr);
-
- SAFE_BIND(dst_sock, (struct sockaddr *)&addr, addrlen);
- SAFE_GETSOCKNAME(dst_sock, (struct sockaddr*)&addr, &addrlen);
-}
-
-static void cleanup(void)
-{
- if (dst_sock != -1)
- SAFE_CLOSE(dst_sock);
-}
-
-static void run(void)
-{
- int sock, i;
- char buf[BUFSIZE];
-
- memset(buf, 0x42, BUFSIZE);
-
- for (i = 0; i < 1000; i++) {
- sock = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
- SAFE_CONNECT(sock, (struct sockaddr *)&addr, sizeof(addr));
- SAFE_SEND(1, sock, buf, BUFSIZE, MSG_MORE);
- SAFE_SETSOCKOPT_INT(sock, SOL_SOCKET, SO_NO_CHECK, 1);
- send(sock, buf, 1, 0);
- SAFE_CLOSE(sock);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_USER_NS=y",
- "CONFIG_NET_NS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "85f1bd9a7b5a"},
- {"CVE", "2017-1000112"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt06.c b/testcases/kernel/syscalls/setsockopt/setsockopt06.c
deleted file mode 100644
index 33284e5a6..000000000
--- a/testcases/kernel/syscalls/setsockopt/setsockopt06.c
+++ /dev/null
@@ -1,133 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2016-8655
- *
- * Check for race condition between packet_set_ring() and tp_version. On some
- * kernels, this may lead to use-after-free. Kernel crash fixed in:
- *
- * commit 84ac7260236a49c79eede91617700174c2c19b0c
- * Author: Philip Pettersson <philip.pettersson@gmail.com>
- * Date: Wed Nov 30 14:55:36 2016 -0800
- *
- * packet: fix race condition in packet_set_ring
- */
-
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sched.h>
-
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-#include "lapi/if_packet.h"
-#include "lapi/if_ether.h"
-
-static int sock = -1;
-static struct tst_fzsync_pair fzsync_pair;
-
-static void setup(void)
-{
- int real_uid = getuid();
- int real_gid = getgid();
-
- SAFE_UNSHARE(CLONE_NEWUSER);
- SAFE_UNSHARE(CLONE_NEWNET);
- SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
- SAFE_FILE_PRINTF("/proc/self/uid_map", "0 %d 1", real_uid);
- SAFE_FILE_PRINTF("/proc/self/gid_map", "0 %d 1", real_gid);
-
- fzsync_pair.exec_loops = 100000;
- fzsync_pair.exec_time_p = 0.9;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- int ret;
- struct tpacket_req3 req = {
- .tp_block_size = 4096,
- .tp_block_nr = 1,
- .tp_frame_size = 4096,
- .tp_frame_nr = 1,
- .tp_retire_blk_tov = 100
- };
-
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- ret = setsockopt(sock, SOL_PACKET, PACKET_RX_RING, &req,
- sizeof(req));
- tst_fzsync_end_race_b(&fzsync_pair);
-
- if (!ret)
- tst_fzsync_pair_add_bias(&fzsync_pair, -10);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- int val1 = TPACKET_V1, val3 = TPACKET_V3;
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- sock = SAFE_SOCKET(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- TEST(setsockopt(sock, SOL_PACKET, PACKET_VERSION, &val3,
- sizeof(val3)));
-
- if (TST_RET == -1 && TST_ERR == EINVAL)
- tst_brk(TCONF | TTERRNO, "TPACKET_V3 not supported");
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "setsockopt(PACKET_VERSION, TPACKET_V3");
- }
-
- tst_fzsync_start_race_a(&fzsync_pair);
- setsockopt(sock, SOL_PACKET, PACKET_VERSION, &val1,
- sizeof(val1));
- tst_fzsync_end_race_a(&fzsync_pair);
- SAFE_CLOSE(sock);
- }
-
- /* setsockopt(PACKET_RX_RING) created a 100ms timer. Wait for it. */
- usleep(300000);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzsync_pair);
-
- if (sock >= 0)
- SAFE_CLOSE(sock);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_USER_NS=y",
- "CONFIG_NET_NS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "84ac7260236a"},
- {"CVE", "2016-8655"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt07.c b/testcases/kernel/syscalls/setsockopt/setsockopt07.c
deleted file mode 100644
index b00286989..000000000
--- a/testcases/kernel/syscalls/setsockopt/setsockopt07.c
+++ /dev/null
@@ -1,145 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE-2017-1000111
- *
- * Check for race condition between packet_set_ring() and tp_reserve.
- * The race allows you to set tp_reserve bigger than ring buffer size.
- * While this will cause truncation of all incoming packets to 0 bytes,
- * sanity checks in tpacket_rcv() prevent any exploitable buffer overflows.
- * Race fixed in:
- *
- * commit c27927e372f0785f3303e8fad94b85945e2c97b7 (HEAD)
- * Author: Willem de Bruijn <willemb@google.com>
- * Date: Thu Aug 10 12:41:58 2017 -0400
- *
- * packet: fix tp_reserve race in packet_set_ring
- */
-
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sched.h>
-
-#include "tst_test.h"
-#include "tst_fuzzy_sync.h"
-#include "lapi/if_packet.h"
-#include "lapi/if_ether.h"
-
-static int sock = -1;
-static struct tst_fzsync_pair fzsync_pair;
-
-static void setup(void)
-{
- int real_uid = getuid();
- int real_gid = getgid();
-
- SAFE_UNSHARE(CLONE_NEWUSER);
- SAFE_UNSHARE(CLONE_NEWNET);
- SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
- SAFE_FILE_PRINTF("/proc/self/uid_map", "0 %d 1", real_uid);
- SAFE_FILE_PRINTF("/proc/self/gid_map", "0 %d 1", real_gid);
-
- /*
- * Reproducing the bug on unpatched system takes <15 loops. The test
- * is slow and the bug is mostly harmless so don't waste too much
- * time.
- */
- fzsync_pair.exec_loops = 500;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- unsigned int val = 1 << 30;
-
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- setsockopt(sock, SOL_PACKET, PACKET_RESERVE, &val, sizeof(val));
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- unsigned int val, version = TPACKET_V3;
- socklen_t vsize = sizeof(val);
- struct tpacket_req3 req = {
- .tp_block_size = 4096,
- .tp_block_nr = 1,
- .tp_frame_size = 4096,
- .tp_frame_nr = 1,
- .tp_retire_blk_tov = 100
- };
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- sock = SAFE_SOCKET(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- TEST(setsockopt(sock, SOL_PACKET, PACKET_VERSION, &version,
- sizeof(version)));
-
- if (TST_RET == -1 && TST_ERR == EINVAL)
- tst_brk(TCONF | TTERRNO, "TPACKET_V3 not supported");
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "setsockopt(PACKET_VERSION, TPACKET_V3");
- }
-
- tst_fzsync_start_race_a(&fzsync_pair);
- TEST(setsockopt(sock, SOL_PACKET, PACKET_RX_RING, &req,
- sizeof(req)));
- tst_fzsync_end_race_a(&fzsync_pair);
-
- SAFE_GETSOCKOPT(sock, SOL_PACKET, PACKET_RESERVE, &val, &vsize);
- SAFE_CLOSE(sock);
-
- if (TST_RET == -1 && TST_ERR == EINVAL) {
- tst_fzsync_pair_add_bias(&fzsync_pair, 1);
- continue;
- }
-
- if (TST_RET) {
- tst_brk(TBROK | TTERRNO,
- "Invalid setsockopt() return value");
- }
-
- if (val > req.tp_block_size){
- tst_res(TFAIL, "PACKET_RESERVE checks bypassed");
- return;
- }
- }
-
- tst_res(TPASS, "Cannot reproduce bug");
-}
-
-static void cleanup(void)
-{
- tst_fzsync_pair_cleanup(&fzsync_pair);
-
- if (sock >= 0)
- SAFE_CLOSE(sock);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_USER_NS=y",
- "CONFIG_NET_NS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "c27927e372f0"},
- {"CVE", "2017-1000111"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/settimeofday/Makefile b/testcases/kernel/syscalls/settimeofday/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/settimeofday/Makefile
+++ b/testcases/kernel/syscalls/settimeofday/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/settimeofday/settimeofday01.c b/testcases/kernel/syscalls/settimeofday/settimeofday01.c
index b7f84b00f..7388c3231 100644
--- a/testcases/kernel/syscalls/settimeofday/settimeofday01.c
+++ b/testcases/kernel/syscalls/settimeofday/settimeofday01.c
@@ -1,61 +1,192 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * Ported to LTP 07/2001 John George
- * Testcase to check the basic functionality of settimeofday().
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * settimeofday01.c
+ *
+ * DESCRIPTION
+ * Testcase to check the basic functionality of settimeofday().
+ *
+ * ALGORITHM
+ * Setup:
+ * Setup signal handling.
+ * Check that we are the proper user.
+ * Setup expected errnos.
+ * Pause for SIGUSER1 if option specified.
+ * Save the current time values.
+ * Loop if the proper options are given.
+ * Call settimeofday and verify the time was changed.
+ * Call settimeofday with invalid Args and verify that the call fails.
+ * Cleanup:
+ * Restore the original time values.
+ * Print errno log and/or timing stats if options given.
+ *
+ * USAGE: <for command-line>
+ * settimeofday01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions
+ * Must be run as root.
*/
#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
-#include "tst_test.h"
-#include "lapi/syscalls.h"
+#include "test.h"
+#define FAILED 1
#define VAL_SEC 100
#define VAL_MSEC 100
-#define ACCEPTABLE_DELTA 500
+#define ACCEPTABLE_DELTA 500 /* in milli-seconds */
#define USEC_PER_SEC 1000000L
-static void verify_settimeofday(void)
+char *TCID = "settimeofday01";
+int TST_TOTAL = 1;
+time_t save_tv_sec, save_tv_usec;
+struct timeval tp, tp1, tp2;
+
+void setup(void);
+void cleanup(void);
+
+#if !defined(UCLINUX)
+
+int main(int argc, char **argv)
{
+ int lc;
suseconds_t delta;
- struct timeval tv1, tv2;
- if (gettimeofday(&tv1, NULL) == -1)
- tst_brk(TBROK | TERRNO, "gettimeofday(&tv1, NULL) failed");
+ tst_parse_opts(argc, argv, NULL, NULL);
- tv1.tv_sec += VAL_SEC;
- tv1.tv_usec += VAL_MSEC;
- if (tv1.tv_usec >= USEC_PER_SEC)
- tv1.tv_usec = VAL_MSEC;
+ setup();
- TEST(settimeofday(&tv1, NULL));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "settimeofday(&tv1, NULL) failed");
- return;
- }
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ int condition_number = 1;
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ gettimeofday(&tp, NULL);
+ tp.tv_sec += VAL_SEC;
+ tp.tv_usec += VAL_MSEC;
+ if (tp.tv_usec >= USEC_PER_SEC)
+ tp.tv_usec = VAL_MSEC;
+
+ TEST(settimeofday(&tp, NULL));
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "Error Setting Time, errno=%d",
+ TEST_ERRNO);
+ }
+
+ if ((gettimeofday(&tp2, (struct timezone *)&tp1)) == -1) {
+ tst_resm(TBROK, "Error Getting Time, errno=%d", errno);
+ }
+
+ if (tp2.tv_sec > tp.tv_sec) {
+ delta =
+ (suseconds_t) (tp2.tv_sec - tp.tv_sec) * 1000 +
+ (tp2.tv_usec - tp.tv_usec) / 1000;
+ } else {
+ delta =
+ (suseconds_t) (tp.tv_sec - tp2.tv_sec) * 1000 +
+ (tp.tv_usec - tp2.tv_usec) / 1000;
+ }
+
+ if (delta > -ACCEPTABLE_DELTA && delta < ACCEPTABLE_DELTA) {
+ tst_resm(TPASS, "Test condition %d successful",
+ condition_number++);
+ } else {
+ tst_resm(TFAIL, "Test condition %d failed",
+ condition_number++);
+ }
+
+ /* Invalid Args : Error Condition where tp = NULL */
+ TEST(settimeofday((struct timeval *)-1, NULL));
+ if (TEST_RETURN == -1) {
+ tst_resm(TPASS, "Test condition %d successful",
+ condition_number++);
+ } else {
+ tst_resm(TFAIL, "Test condition %d failed",
+ condition_number);
+ }
- if (gettimeofday(&tv2, NULL) == -1)
- tst_brk(TBROK | TERRNO, "gettimeofday(&tv2, NULL) failed");
-
- if (tv2.tv_sec > tv1.tv_sec) {
- delta =
- (suseconds_t) (tv2.tv_sec - tv1.tv_sec) * 1000 +
- (tv2.tv_usec - tv1.tv_usec) / 1000;
- } else {
- delta =
- (suseconds_t) (tv1.tv_sec - tv2.tv_sec) * 1000 +
- (tv1.tv_usec - tv2.tv_usec) / 1000;
}
+ cleanup();
+ tst_exit();
- if (delta > -ACCEPTABLE_DELTA && delta < ACCEPTABLE_DELTA)
- tst_res(TPASS, "settimeofday() pass");
- else
- tst_res(TFAIL, "settimeofday() fail");
}
-static struct tst_test test = {
- .restore_wallclock = 1,
- .test_all = verify_settimeofday,
- .needs_root = 1,
-};
+#else
+
+int main(void)
+{
+ tst_resm(TINFO, "test is not available on uClinux");
+ tst_exit();
+}
+
+#endif /* if !defined(UCLINUX) */
+
+/*
+ * setup()
+ * performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ /* Pause if that option was specified
+ * TEST_PAUSE contains the code to fork the test with the -c option.
+ */
+ TEST_PAUSE;
+
+ /* Save the current time values */
+ if ((gettimeofday(&tp, (struct timezone *)&tp1)) == -1) {
+ tst_brkm(TBROK, cleanup, "gettimeofday failed. "
+ "errno=%d", errno);
+ }
+ save_tv_sec = tp.tv_sec;
+ save_tv_usec = tp.tv_usec;
+}
+
+/*
+ * cleanup()
+ * performs all ONE TIME cleanup for this test at
+ * completion or premature exit
+ */
+void cleanup(void)
+{
+ /* restore the original time values. */
+ tp.tv_sec = save_tv_sec;
+ tp.tv_usec = save_tv_usec;
+ if ((settimeofday(&tp, NULL)) == -1) {
+ tst_resm(TWARN, "FATAL COULD NOT RESET THE CLOCK");
+ tst_resm(TFAIL, "Error Setting Time, errno=%d", errno);
+ }
+
+}
diff --git a/testcases/kernel/syscalls/settimeofday/settimeofday02.c b/testcases/kernel/syscalls/settimeofday/settimeofday02.c
index 0fa8a147a..5516e619e 100644
--- a/testcases/kernel/syscalls/settimeofday/settimeofday02.c
+++ b/testcases/kernel/syscalls/settimeofday/settimeofday02.c
@@ -1,49 +1,189 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * Ported to LTP 07/2001 John George
- * Testcase to check that settimeofday() sets errnos correctly.
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * settimeofday02.c
+ *
+ * DESCRIPTION
+ * Testcase to check that settimeofday() sets errnos correctly.
+ *
+ * ALGORITHM
+ * Setup:
+ * Setup signal handling.
+ * Check that we are not root.
+ * Setup expected errnos.
+ * Pause for SIGUSER1 if option specified.
+ * Save the current time values.
+ * Loop if the proper options are given.
+ * Call settimeofday with an invalid "buf" address and verify that
+ * errno is set to EFAULT.
+ * Call settimeofday as a non-root user. Verify that the call fails
+ * and errno is set to EPERM.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given.
+ *
+ * USAGE: <for command-line>
+ * settimeofday02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions
+ * Must not be run as root
*/
#include <stdio.h>
#include <sys/time.h>
#include <errno.h>
-#include "tst_capability.h"
-#include "tst_test.h"
-#include "lapi/syscalls.h"
-
-static struct tcase {
- struct timeval tv;
- int exp_errno;
- char *message;
-} tcases[] = {
- {{-1, 0}, EINVAL, "tv.tv_sec is negative"},
- {{0, -1}, EINVAL, "tv.tv_usec is outside the range [0..999,999]"},
- {{100, 100}, EPERM, "calling process without CAP_SYS_TIME capability"},
-};
-
-static void verify_settimeofday(unsigned int n)
+#include "test.h"
+#include <pwd.h>
+
+#define VAL_SEC 100
+#define VAL_MSEC 100
+
+char *TCID = "settimeofday02";
+int TST_TOTAL = 1;
+
+struct timeval tp;
+time_t save_tv_sec, save_tv_usec;
+
+char nobody_uid[] = "nobody";
+struct passwd *ltpuser;
+
+void setup(void);
+void cleanup(void);
+void restore_time(void);
+
+#if !defined(UCLINUX)
+
+int main(int argc, char **argv)
{
- struct tcase *tc = &tcases[n];
+ int lc;
- tst_res(TINFO, "%s", tc->message);
- TEST(settimeofday(&tc->tv, NULL));
- if (TST_RET != -1) {
- tst_res(TFAIL, "settimeofday() succeeded unexpectedly");
- return;
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ TEST(settimeofday((void *)-1, NULL));
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "settimeofday(2) failed to FAIL");
+ restore_time();
+ } else {
+ if (TEST_ERRNO != EFAULT) {
+ tst_resm(TFAIL, "Expected EFAULT got %d",
+ TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "Received expected errno");
+ }
+ }
+
+ tp.tv_sec = VAL_SEC;
+ tp.tv_usec = VAL_MSEC;
+ TEST(settimeofday(&tp, NULL));
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "settimeofday(2) failed to FAIL");
+ restore_time();
+ } else {
+ if (TEST_ERRNO != EPERM) {
+ tst_resm(TFAIL, "Expected EPERM got %d",
+ TEST_ERRNO);
+ } else {
+ tst_resm(TPASS, "Received expected errno");
+ }
+ }
}
+ cleanup();
+ tst_exit();
+
+}
+
+#else
- if (TST_ERR != tc->exp_errno)
- tst_res(TFAIL | TTERRNO, "Expected %s got ", tst_strerrno(tc->exp_errno));
- else
- tst_res(TPASS | TTERRNO, "Received expected errno");
+int main(void)
+{
+ tst_resm(TINFO, "test is not available on uClinux");
+ tst_exit();
}
-static struct tst_test test = {
- .test = verify_settimeofday,
- .tcnt = ARRAY_SIZE(tcases),
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_DROP, CAP_SYS_TIME),
- {}
- },
-};
+#endif /* if !defined(UCLINUX) */
+
+/*
+ * setup()
+ * performs all ONE TIME setup for this test
+ */
+void setup(void)
+{
+ tst_require_root();
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ /* Switch to nobody user for correct error code collection */
+ ltpuser = getpwnam(nobody_uid);
+ if (setuid(ltpuser->pw_uid) == -1) {
+ tst_resm(TINFO, "setuid failed to "
+ "to set the effective uid to %d", ltpuser->pw_uid);
+ perror("setuid");
+ }
+
+ /* Pause if that option was specified
+ * TEST_PAUSE contains the code to fork the test with the -c option.
+ */
+ TEST_PAUSE;
+
+ /* Save the current time values */
+ if ((gettimeofday(&tp, (struct timezone *)&tp)) == -1) {
+ tst_brkm(TBROK, cleanup, "gettimeofday failed. "
+ "errno=%d", errno);
+ }
+ save_tv_sec = tp.tv_sec;
+ save_tv_usec = tp.tv_usec;
+}
+
+/*
+ * cleanup()
+ * performs all ONE TIME cleanup for this test at
+ * completion or premature exit
+ */
+void cleanup(void)
+{
+
+}
+
+void restore_time(void)
+{
+ /* restore the original time values. */
+ tp.tv_sec = save_tv_sec;
+ tp.tv_usec = save_tv_usec;
+ if ((settimeofday(&tp, NULL)) == -1) {
+ tst_resm(TWARN, "FATAL COULD NOT RESET THE CLOCK");
+ tst_resm(TFAIL, "Error Setting Time, errno=%d", errno);
+ }
+}
diff --git a/testcases/kernel/syscalls/setuid/Makefile b/testcases/kernel/syscalls/setuid/Makefile
index 1fdd7bd76..6bd943aaf 100644
--- a/testcases/kernel/syscalls/setuid/Makefile
+++ b/testcases/kernel/syscalls/setuid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
diff --git a/testcases/kernel/syscalls/setxattr/Makefile b/testcases/kernel/syscalls/setxattr/Makefile
index 5f941a758..72544c13e 100644
--- a/testcases/kernel/syscalls/setxattr/Makefile
+++ b/testcases/kernel/syscalls/setxattr/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Red Hat Inc., 2011
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/setxattr/setxattr01.c b/testcases/kernel/syscalls/setxattr/setxattr01.c
index 8cd2821d0..8b84dfe0d 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr01.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr01.c
@@ -210,6 +210,7 @@ static struct tst_test test = {
.mntpoint = MNTPOINT,
.mount_device = 1,
.all_filesystems = 1,
+ .needs_tmpdir = 1,
.needs_root = 1,
};
diff --git a/testcases/kernel/syscalls/sgetmask/Makefile b/testcases/kernel/syscalls/sgetmask/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/sgetmask/Makefile
+++ b/testcases/kernel/syscalls/sgetmask/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigaction/Makefile b/testcases/kernel/syscalls/sigaction/Makefile
index a2e926a31..d4924c40a 100644
--- a/testcases/kernel/syscalls/sigaction/Makefile
+++ b/testcases/kernel/syscalls/sigaction/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigaltstack/Makefile b/testcases/kernel/syscalls/sigaltstack/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sigaltstack/Makefile
+++ b/testcases/kernel/syscalls/sigaltstack/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sighold/Makefile b/testcases/kernel/syscalls/sighold/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sighold/Makefile
+++ b/testcases/kernel/syscalls/sighold/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/signal/Makefile b/testcases/kernel/syscalls/signal/Makefile
index 62265c7d4..dad2a7dfc 100644
--- a/testcases/kernel/syscalls/signal/Makefile
+++ b/testcases/kernel/syscalls/signal/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/signalfd/Makefile b/testcases/kernel/syscalls/signalfd/Makefile
index e1073499d..7a1a87a28 100644
--- a/testcases/kernel/syscalls/signalfd/Makefile
+++ b/testcases/kernel/syscalls/signalfd/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/signalfd4/Makefile b/testcases/kernel/syscalls/signalfd4/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/signalfd4/Makefile
+++ b/testcases/kernel/syscalls/signalfd4/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigpending/Makefile b/testcases/kernel/syscalls/sigpending/Makefile
index 4e0d6aa9f..00a7d5e2b 100644
--- a/testcases/kernel/syscalls/sigpending/Makefile
+++ b/testcases/kernel/syscalls/sigpending/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigprocmask/Makefile b/testcases/kernel/syscalls/sigprocmask/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sigprocmask/Makefile
+++ b/testcases/kernel/syscalls/sigprocmask/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigrelse/Makefile b/testcases/kernel/syscalls/sigrelse/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sigrelse/Makefile
+++ b/testcases/kernel/syscalls/sigrelse/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigsuspend/Makefile b/testcases/kernel/syscalls/sigsuspend/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sigsuspend/Makefile
+++ b/testcases/kernel/syscalls/sigsuspend/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sigsuspend/sigsuspend01.c b/testcases/kernel/syscalls/sigsuspend/sigsuspend01.c
index 2276132e3..a846f6330 100644
--- a/testcases/kernel/syscalls/sigsuspend/sigsuspend01.c
+++ b/testcases/kernel/syscalls/sigsuspend/sigsuspend01.c
@@ -1,82 +1,212 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
*
- * Description:
- * Verify the basic function of sigsuspend():
- * 1) sigsuspend() can replace process's current signal mask
- * by the specified signal mask and suspend the process
- * execution until the delivery of a signal.
- * 2) sigsuspend() should return after the execution of signal
- * handler and restore the previous signal mask.
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <errno.h>
+/*
+ * Test Name: sigsuspend01
+ *
+ * Test Description:
+ * Verify that sigsuspend() succeeds to change process's current signal
+ * mask with the specified signal mask and suspends the process execution
+ * until the delivery of a signal.
+ *
+ * Expected Result:
+ * sigsuspend() should return after the execution of signal catching
+ * function and the previous signal mask should be restored.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * sigsuspend01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions:
+ * None.
+ */
+
+#include <stdio.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
#include <string.h>
#include <signal.h>
+#include <ucontext.h>
-#include "tst_test.h"
+#include "test.h"
-static sigset_t signalset, sigset1, sigset2;
-static volatile sig_atomic_t alarm_num;
+char *TCID = "sigsuspend01";
+int TST_TOTAL = 1;
-static void sig_handler(int sig)
-{
- alarm_num = sig;
-}
+struct sigaction sa_new; /* struct to hold signal info */
+sigset_t signalset; /* signal set to hold signal lists */
+sigset_t sigset1;
+sigset_t sigset2;
-static void verify_sigsuspend(void)
+void setup(); /* Main setup function of test */
+void cleanup(); /* cleanup function for the test */
+void sig_handler(int sig); /* signal catching function */
+
+int main(int ac, char **av)
{
- alarm_num = 0;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ /* Set the alarm timer */
+ alarm(5);
+
+ /*
+ * Call sigsuspend() to replace current signal mask
+ * of the process and suspend process execution till
+ * receipt of a signal 'SIGALRM'.
+ */
+ TEST(sigsuspend(&signalset));
+
+ /* Reset the alarm timer */
+ alarm(0);
+
+ if ((TEST_RETURN == -1) && (TEST_ERRNO == EINTR)) {
+ if (sigprocmask(SIG_UNBLOCK, 0, &sigset2) == -1) {
+ tst_resm(TFAIL, "sigprocmask() Failed "
+ "to get previous signal mask "
+ "of process");
+ } else if (memcmp(&sigset1, &sigset2,
+ sizeof(unsigned long))) {
+ tst_resm(TFAIL, "sigsuspend failed to "
+ "preserve signal mask");
+ } else {
+ tst_resm(TPASS, "Functionality of "
+ "sigsuspend() successful");
+ }
+ } else {
+ tst_resm(TFAIL | TTERRNO,
+ "sigsuspend() returned value %ld",
+ TEST_RETURN);
+ }
+
+ tst_count++; /* incr TEST_LOOP counter */
+ }
- SAFE_SIGFILLSET(&sigset2);
+ cleanup();
+ tst_exit();
+}
- alarm(1);
+/*
+ * void
+ * setup() - performs all ONE TIME setup for this test.
+ * Initialise signal set with the list that includes/excludes
+ * all system-defined signals.
+ * Set the signal handler to catch SIGALRM signal.
+ * Get the current signal mask of test process using sigprocmask().
+ */
+void setup(void)
+{
- /* Unblock SIGALRM */
- TEST(sigsuspend(&signalset));
+ tst_sig(FORK, DEF_HANDLER, cleanup);
- alarm(0);
+ TEST_PAUSE;
- if (TST_RET != -1 || TST_ERR != EINTR) {
- tst_res(TFAIL | TTERRNO,
- "sigsuspend() returned value %ld", TST_RET);
- return;
+ /*
+ * Initialise the signal sets with the list that
+ * excludes/includes all system-defined signals.
+ */
+ if (sigemptyset(&signalset) == -1) {
+ tst_brkm(TFAIL, cleanup,
+ "sigemptyset() failed, errno=%d : %s",
+ errno, strerror(errno));
}
-
- if (alarm_num != SIGALRM) {
- tst_res(TFAIL, "sigsuspend() didn't unblock SIGALRM");
- return;
+ if (sigfillset(&sigset2) == -1) {
+ tst_brkm(TFAIL, cleanup,
+ "sigfillset() failed, errno=%d : %s",
+ errno, strerror(errno));
}
- SAFE_SIGPROCMASK(0, NULL, &sigset2);
- if (memcmp(&sigset1, &sigset2, sizeof(unsigned long))) {
- tst_res(TFAIL, "sigsuspend() failed to "
- "restore the previous signal mask");
- return;
+ /* Set the signal handler function to catch the signal */
+ sa_new.sa_handler = sig_handler;
+ if (sigaction(SIGALRM, &sa_new, 0) == -1) {
+ tst_brkm(TFAIL, cleanup,
+ "sigaction() failed, errno=%d : %s",
+ errno, strerror(errno));
}
- tst_res(TPASS, "sigsuspend() succeeded");
+ /* Read the test process's current signal mask. */
+ if (sigprocmask(SIG_UNBLOCK, 0, &sigset1) == -1) {
+ tst_brkm(TFAIL, cleanup,
+ "sigprocmask() Failed, errno=%d : %s",
+ errno, strerror(errno));
+ }
}
-static void setup(void)
+/*
+ * void
+ * sig_handler(int sig) - Signal catching function.
+ * This function gets executed when the signal SIGALRM is delivered
+ * to the test process after the expiry of alarm time and the signal was
+ * trapped by sigaction() to execute this function.
+ *
+ * This function simply returns without doing anything.
+ */
+void sig_handler(int sig)
{
- SAFE_SIGEMPTYSET(&signalset);
- SAFE_SIGEMPTYSET(&sigset1);
- SAFE_SIGADDSET(&sigset1, SIGALRM);
-
- struct sigaction sa_new = {
- .sa_handler = sig_handler,
- };
+}
- SAFE_SIGACTION(SIGALRM, &sa_new, 0);
+/*
+ * void
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
- /* Block SIGALRM */
- SAFE_SIGPROCMASK(SIG_SETMASK, &sigset1, NULL);
}
-
-static struct tst_test test = {
- .setup = setup,
- .test_all = verify_sigsuspend,
-};
diff --git a/testcases/kernel/syscalls/sigtimedwait/Makefile b/testcases/kernel/syscalls/sigtimedwait/Makefile
index 1ae50b32c..ce1096edd 100644
--- a/testcases/kernel/syscalls/sigtimedwait/Makefile
+++ b/testcases/kernel/syscalls/sigtimedwait/Makefile
@@ -1,12 +1,30 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpsigwait
-
include $(top_srcdir)/include/mk/testcases.mk
-LTPLDLIBS = -lltpsigwait
+CPPFLAGS += -DTEST_SIGTIMEDWAIT
+
+sigtimedwait01: $(abs_srcdir)/../sigwaitinfo/sigwaitinfo01.c
+ $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+MAKE_TARGETS := sigtimedwait01
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sigtimedwait/sigtimedwait01.c b/testcases/kernel/syscalls/sigtimedwait/sigtimedwait01.c
deleted file mode 100644
index fa36c455f..000000000
--- a/testcases/kernel/syscalls/sigtimedwait/sigtimedwait01.c
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */
-
-#include "libsigwait.h"
-
-static int my_sigtimedwait(const sigset_t * set, siginfo_t * info,
- void *timeout)
-{
- return sigtimedwait(set, info, timeout);
-}
-
-struct sigwait_test_desc tests[] = {
- { test_empty_set, SIGUSR1},
- { test_unmasked_matching, SIGUSR1},
- { test_masked_matching, SIGUSR1},
- { test_unmasked_matching_noinfo, SIGUSR1},
- { test_masked_matching_noinfo, SIGUSR1},
- { test_bad_address, SIGUSR1},
- { test_bad_address2, SIGUSR1},
- { test_bad_address3, SIGUSR1},
- { test_timeout, 0},
-};
-
-static void run(unsigned int i)
-{
- struct sigwait_test_desc *tc = &tests[i];
-
- tc->tf(my_sigtimedwait, tc->signo, TST_LIBC_TIMESPEC);
-}
-
-static struct tst_test test = {
- .test= run,
- .tcnt = ARRAY_SIZE(tests),
- .setup = sigwait_setup,
- .forks_child = 1,
-};
diff --git a/testcases/kernel/syscalls/sigwait/Makefile b/testcases/kernel/syscalls/sigwait/Makefile
index 1ae50b32c..8725b0afc 100644
--- a/testcases/kernel/syscalls/sigwait/Makefile
+++ b/testcases/kernel/syscalls/sigwait/Makefile
@@ -1,12 +1,30 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpsigwait
-
include $(top_srcdir)/include/mk/testcases.mk
-LTPLDLIBS = -lltpsigwait
+CPPFLAGS += -DTEST_SIGWAIT
+
+sigwait01: $(abs_srcdir)/../sigwaitinfo/sigwaitinfo01.c
+ $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+MAKE_TARGETS := sigwait01
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sigwait/sigwait01.c b/testcases/kernel/syscalls/sigwait/sigwait01.c
deleted file mode 100644
index 92544c141..000000000
--- a/testcases/kernel/syscalls/sigwait/sigwait01.c
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */
-
-#include "libsigwait.h"
-
-static int my_sigwait(const sigset_t * set,
- siginfo_t * info LTP_ATTRIBUTE_UNUSED,
- void *timeout LTP_ATTRIBUTE_UNUSED)
-{
- int ret;
- int err = sigwait(set, &ret);
-
- if (err == 0)
- return ret;
- errno = err;
- return -1;
-}
-
-struct sigwait_test_desc tests[] = {
- { test_unmasked_matching_noinfo, SIGUSR1},
- { test_masked_matching_noinfo, SIGUSR1},
-};
-
-static void run(unsigned int i)
-{
- struct sigwait_test_desc *tc = &tests[i];
-
- tc->tf(my_sigwait, tc->signo, TST_LIBC_TIMESPEC);
-}
-
-static struct tst_test test = {
- .test= run,
- .tcnt = ARRAY_SIZE(tests),
- .setup = sigwait_setup,
- .forks_child = 1,
-};
diff --git a/testcases/kernel/syscalls/sigwaitinfo/Makefile b/testcases/kernel/syscalls/sigwaitinfo/Makefile
index 1ae50b32c..1246e5e82 100644
--- a/testcases/kernel/syscalls/sigwaitinfo/Makefile
+++ b/testcases/kernel/syscalls/sigwaitinfo/Makefile
@@ -1,12 +1,25 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpsigwait
-
include $(top_srcdir)/include/mk/testcases.mk
-LTPLDLIBS = -lltpsigwait
+CPPFLAGS += -DTEST_SIGWAITINFO
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
index f7d90047f..c221be87d 100644
--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
@@ -1,34 +1,513 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */
+/*
+ * Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include "test.h"
+#include <errno.h>
+#include <signal.h>
+#include "../utils/include_j_h.h"
+#include "../utils/common_j_h.c"
+#include <limits.h>
+#include "lapi/syscalls.h"
-#include "libsigwait.h"
+#define SUCCEED_OR_DIE(syscall, message, ...) \
+ (errno = 0, \
+ ({int ret=syscall(__VA_ARGS__); \
+ if (ret==-1) \
+ tst_brkm(TBROK|TERRNO, cleanup, message);\
+ ret;}))
+/* Report success iff TEST_RETURN and TEST_ERRNO are equal to
+ exp_return and exp_errno, resp., and cond is true. If cond is not
+ true, report condition_errmsg
+*/
+static void report_success_cond(const char *func, const char *file, int line,
+ long exp_return, int exp_errno, int condition,
+ char *condition_errmsg)
+{
+ if (exp_return == TEST_RETURN
+ && (exp_return != -1 || exp_errno == TEST_ERRNO))
+ if (condition)
+ tst_resm(TPASS, "Test passed");
+ else
+ tst_resm(TFAIL, "%s (%s: %d): %s", func, file, line,
+ condition_errmsg);
+ else if (TEST_RETURN != -1)
+ tst_resm(TFAIL,
+ "%s (%s: %d): Unexpected return value; expected %ld, got %ld",
+ func, file, line, exp_return, TEST_RETURN);
+ else
+ tst_resm(TFAIL | TTERRNO, "%s (%s: %d): Unexpected failure",
+ func, file, line);
+}
+
+#define REPORT_SUCCESS_COND(exp_return, exp_errno, condition, condition_errmsg) \
+ report_success_cond(__FUNCTION__, __FILE__, __LINE__, exp_return, exp_errno, condition, condition_errmsg);
+
+/* Report success iff TEST_RETURN and TEST_ERRNO are equal to
+ exp_return and exp_errno, resp.
+*/
+#define REPORT_SUCCESS(exp_return, exp_errno) \
+ REPORT_SUCCESS_COND(exp_return, exp_errno, 1, "");
+
+static void cleanup(void);
+
+static void empty_handler(int sig)
+{
+}
+
+static void setup(void)
+{
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+ signal(SIGUSR1, empty_handler);
+ signal(SIGALRM, empty_handler);
+ signal(SIGUSR2, SIG_IGN);
+
+ TEST_PAUSE;
+}
+
+static void cleanup(void)
+{
+}
+
+typedef int (*swi_func) (const sigset_t * set, siginfo_t * info,
+ struct timespec * timeout);
+typedef void (*test_func) (swi_func, int);
+
+#ifdef TEST_SIGWAIT
+static int my_sigwait(const sigset_t * set, siginfo_t * info,
+ struct timespec *timeout)
+{
+ int ret;
+ int err = sigwait(set, &ret);
+
+ if (err == 0)
+ return ret;
+ errno = err;
+ return -1;
+}
+#endif
+
+#ifdef TEST_SIGWAITINFO
static int my_sigwaitinfo(const sigset_t * set, siginfo_t * info,
- void *timeout LTP_ATTRIBUTE_UNUSED)
+ struct timespec *timeout)
{
+
return sigwaitinfo(set, info);
}
+#endif
-struct sigwait_test_desc tests[] = {
- { test_empty_set, SIGUSR1},
- { test_unmasked_matching, SIGUSR1},
- { test_masked_matching, SIGUSR1},
- { test_unmasked_matching_noinfo, SIGUSR1},
- { test_masked_matching_noinfo, SIGUSR1},
- { test_bad_address, SIGUSR1},
- { test_bad_address2, SIGUSR1},
-};
+#ifdef TEST_SIGTIMEDWAIT
+static int my_sigtimedwait(const sigset_t * set, siginfo_t * info,
+ struct timespec *timeout)
+{
+
+ return sigtimedwait(set, info, timeout);
+}
+#endif
+
+#ifdef TEST_RT_SIGTIMEDWAIT
+static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
+ struct timespec *timeout)
+{
+ /* _NSIG is always the right number of bits of signal map for all arches */
+ return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout, _NSIG/8);
+}
+#endif
+
+void test_empty_set(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs;
+ siginfo_t si;
+ pid_t child;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ /* Run a child that will wake us up */
+ child = create_sig_proc(100000, signo, UINT_MAX);
+
+ TEST(sigwaitinfo(&sigs, &si, NULL));
+ REPORT_SUCCESS(-1, EINTR);
+
+ kill(child, SIGTERM);
+}
+
+void test_timeout(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs;
+ siginfo_t si;
+ pid_t child;
+ struct timespec ts = {.tv_sec = 1 };
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+
+ /* Run a child that will wake us up */
+ child = create_sig_proc(100000, signo, UINT_MAX);
+
+ TEST(sigwaitinfo(&sigs, &si, &ts));
+ REPORT_SUCCESS(-1, EAGAIN);
+
+ kill(child, SIGTERM);
+}
+
+/* Note: sigwait-ing for a signal that is not blocked is unspecified
+ * by POSIX; but works for non-ignored signals under Linux
+ */
+void test_unmasked_matching(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs;
+ siginfo_t si;
+ pid_t child;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo);
+
+ /* Run a child that will wake us up */
+ child = create_sig_proc(100000, signo, UINT_MAX);
+
+ TEST(sigwaitinfo(&sigs, &si, NULL));
+ REPORT_SUCCESS_COND(signo, 0, si.si_pid == child
+ && si.si_code == SI_USER
+ && si.si_signo == signo, "Struct siginfo mismatch");
+
+ kill(child, SIGTERM);
+}
+
+void test_unmasked_matching_noinfo(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs;
+ pid_t child;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo);
+ /* Run a child that will wake us up */
+ child = create_sig_proc(100000, signo, UINT_MAX);
+
+ TEST(sigwaitinfo(&sigs, NULL, NULL));
+ REPORT_SUCCESS(signo, 0);
+
+ kill(child, SIGTERM);
+}
+
+void test_masked_matching(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs, oldmask;
+ siginfo_t si;
+ pid_t child;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo);
+ /* let's not get interrupted by our dying child */
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, SIGCHLD);
+
+ SUCCEED_OR_DIE(sigprocmask, "sigprocmask failed", SIG_SETMASK, &sigs,
+ &oldmask);
+
+ /* don't wait on a SIGCHLD */
+ SUCCEED_OR_DIE(sigdelset, "sigaddset failed", &sigs, SIGCHLD);
+
+ /* Run a child that will wake us up */
+ child = create_sig_proc(0, signo, 1);
-static void run(unsigned int i)
+ TEST(sigwaitinfo(&sigs, &si, NULL));
+ REPORT_SUCCESS_COND(signo, 0, si.si_pid == child
+ && si.si_code == SI_USER
+ && si.si_signo == signo, "Struct siginfo mismatch");
+
+ SUCCEED_OR_DIE(sigprocmask, "restoring original signal mask failed",
+ SIG_SETMASK, &oldmask, &oldmask);
+
+ tst_count--;
+
+ if (sigismember(&oldmask, signo))
+ tst_resm(TPASS, "sigwaitinfo restored the original mask");
+ else
+ tst_resm(TFAIL,
+ "sigwaitinfo failed to restore the original mask");
+}
+
+void test_masked_matching_rt(swi_func sigwaitinfo, int signo)
{
- struct sigwait_test_desc *tc = &tests[i];
+ sigset_t sigs, oldmask;
+ siginfo_t si;
+ pid_t child[2];
+ int status;
+
+ signo = SIGRTMIN + 1;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo + 1);
+ /* let's not get interrupted by our dying child */
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, SIGCHLD);
+
+ SUCCEED_OR_DIE(sigprocmask, "sigprocmask failed", SIG_SETMASK, &sigs,
+ &oldmask);
- tc->tf(my_sigwaitinfo, tc->signo, TST_LIBC_TIMESPEC);
+ /* don't wait on a SIGCHLD */
+ SUCCEED_OR_DIE(sigdelset, "sigdelset failed", &sigs, SIGCHLD);
+
+ /* Run a child that will wake us up */
+ child[0] = create_sig_proc(0, signo, 1);
+ child[1] = create_sig_proc(0, signo + 1, 1);
+
+ /* Ensure that the signals have been sent */
+ waitpid(child[0], &status, 0);
+ waitpid(child[1], &status, 0);
+
+ TEST(sigwaitinfo(&sigs, &si, NULL));
+ REPORT_SUCCESS_COND(signo, 0, si.si_pid == child[0]
+ && si.si_code == SI_USER
+ && si.si_signo == signo, "Struct siginfo mismatch");
+
+ /* eat the other signal */
+ tst_count--;
+ TEST(sigwaitinfo(&sigs, &si, NULL));
+ REPORT_SUCCESS_COND(signo + 1, 0, si.si_pid == child[1]
+ && si.si_code == SI_USER
+ && si.si_signo == signo + 1,
+ "Struct siginfo mismatch");
+
+ SUCCEED_OR_DIE(sigprocmask, "restoring original signal mask failed",
+ SIG_SETMASK, &oldmask, &oldmask);
+
+ tst_count--;
+
+ if (sigismember(&oldmask, signo))
+ tst_resm(TPASS, "sigwaitinfo restored the original mask");
+ else
+ tst_resm(TFAIL,
+ "sigwaitinfo failed to restore the original mask");
}
-static struct tst_test test = {
- .test= run,
- .tcnt = ARRAY_SIZE(tests),
- .setup = sigwait_setup,
- .forks_child = 1,
+void test_masked_matching_noinfo(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs, oldmask;
+ pid_t child;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo);
+ /* let's not get interrupted by our dying child */
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, SIGCHLD);
+
+ SUCCEED_OR_DIE(sigprocmask, "sigprocmask failed", SIG_SETMASK, &sigs,
+ &oldmask);
+
+ /* don't wait on a SIGCHLD */
+ SUCCEED_OR_DIE(sigdelset, "sigaddset failed", &sigs, SIGCHLD);
+
+ /* Run a child that will wake us up */
+ child = create_sig_proc(0, signo, 1);
+
+ TEST(sigwaitinfo(&sigs, NULL, NULL));
+ REPORT_SUCCESS(signo, 0);
+
+ SUCCEED_OR_DIE(sigprocmask, "restoring original signal mask failed",
+ SIG_SETMASK, &oldmask, &oldmask);
+
+ tst_count--;
+
+ if (sigismember(&oldmask, signo))
+ tst_resm(TPASS, "sigwaitinfo restored the original mask");
+ else
+ tst_resm(TFAIL,
+ "sigwaitinfo failed to restore the original mask");
+
+}
+
+void test_bad_address(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs, oldmask;
+ pid_t child;
+
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, signo);
+ /* let's not get interrupted by our dying child */
+ SUCCEED_OR_DIE(sigaddset, "sigaddset failed", &sigs, SIGCHLD);
+
+ SUCCEED_OR_DIE(sigprocmask, "sigprocmask failed", SIG_SETMASK, &sigs,
+ &oldmask);
+
+ /* don't wait on a SIGCHLD */
+ SUCCEED_OR_DIE(sigdelset, "sigaddset failed", &sigs, SIGCHLD);
+
+ /* Run a child that will wake us up */
+ child = create_sig_proc(0, signo, 1);
+
+ TEST(sigwaitinfo(&sigs, (void *)1, NULL));
+ REPORT_SUCCESS(-1, EFAULT);
+
+ SUCCEED_OR_DIE(sigprocmask, "sigprocmask failed", SIG_SETMASK, &oldmask,
+ &oldmask);
+
+ kill(child, SIGTERM);
+}
+
+void test_bad_address2(swi_func sigwaitinfo, int signo)
+{
+ pid_t pid;
+ int status;
+
+ switch (pid = fork()) {
+ case -1:
+ tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+ case 0:
+ signal(SIGSEGV, SIG_DFL);
+
+ /*
+ * depending on glibc implementation we should
+ * either crash or get EFAULT
+ */
+ TEST(sigwaitinfo((void *)1, NULL, NULL));
+
+ if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
+ _exit(0);
+
+ tst_resm(TINFO | TTERRNO, "swi_func returned: %ld",
+ TEST_RETURN);
+ _exit(1);
+ break;
+ default:
+ break;
+ }
+
+ SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, &status, 0);
+
+ if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
+ || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
+ tst_resm(TPASS, "Test passed");
+ return;
+ }
+
+ if (WIFEXITED(status)) {
+ tst_resm(TFAIL, "Unrecognised child exit code: %d",
+ WEXITSTATUS(status));
+ }
+ if (WIFSIGNALED(status)) {
+ tst_resm(TFAIL, "Unrecognised child termsig: %d",
+ WTERMSIG(status));
+ }
+}
+
+void test_bad_address3(swi_func sigwaitinfo, int signo)
+{
+ sigset_t sigs;
+ SUCCEED_OR_DIE(sigemptyset, "sigemptyset failed", &sigs);
+
+ TEST(sigwaitinfo(&sigs, NULL, (void *)1));
+ REPORT_SUCCESS(-1, EFAULT);
+}
+
+struct test_desc {
+ test_func tf;
+ swi_func swi;
+ int signo;
+} tests[] = {
+#ifdef TEST_RT_SIGTIMEDWAIT
+ {
+ test_empty_set, my_rt_sigtimedwait, SIGUSR1}, {
+ test_unmasked_matching, my_rt_sigtimedwait, SIGUSR1}, {
+ test_masked_matching, my_rt_sigtimedwait, SIGUSR1}, {
+ test_unmasked_matching_noinfo, my_rt_sigtimedwait, SIGUSR1}, {
+ test_masked_matching_noinfo, my_rt_sigtimedwait, SIGUSR1}, {
+ test_bad_address, my_rt_sigtimedwait, SIGUSR1}, {
+ test_bad_address2, my_rt_sigtimedwait, SIGUSR1}, {
+ test_bad_address3, my_rt_sigtimedwait, SIGUSR1}, {
+ test_timeout, my_rt_sigtimedwait, 0},
+ /* Special cases */
+ /* 1: sigwaitinfo does respond to ignored signal */
+ {
+ test_masked_matching, my_rt_sigtimedwait, SIGUSR2},
+ /* 2: An ignored signal doesn't cause sigwaitinfo to return EINTR */
+ {
+ test_timeout, my_rt_sigtimedwait, SIGUSR2},
+ /* 3: The handler is not called when the signal is waited for by sigwaitinfo */
+ {
+ test_masked_matching, my_rt_sigtimedwait, SIGTERM},
+ /* 4: Simultaneous realtime signals are delivered in the order of increasing signal number */
+#if !(defined(ANDROID) && !defined(__LP64__))
+ {
+ test_masked_matching_rt, my_rt_sigtimedwait, -1},
+#endif
+#endif
+#if defined TEST_SIGWAIT
+ {
+ test_unmasked_matching_noinfo, my_sigwait, SIGUSR1}, {
+ test_masked_matching_noinfo, my_sigwait, SIGUSR1},
+#endif
+#if defined TEST_SIGWAITINFO
+ {
+ test_empty_set, my_sigwaitinfo, SIGUSR1}, {
+ test_unmasked_matching, my_sigwaitinfo, SIGUSR1}, {
+ test_masked_matching, my_sigwaitinfo, SIGUSR1}, {
+ test_unmasked_matching_noinfo, my_sigwaitinfo, SIGUSR1}, {
+ test_masked_matching_noinfo, my_sigwaitinfo, SIGUSR1}, {
+ test_bad_address, my_sigwaitinfo, SIGUSR1}, {
+ test_bad_address2, my_sigwaitinfo, SIGUSR1},
+#endif
+#if defined TEST_SIGTIMEDWAIT
+ {
+ test_empty_set, my_sigtimedwait, SIGUSR1}, {
+ test_unmasked_matching, my_sigtimedwait, SIGUSR1}, {
+ test_masked_matching, my_sigtimedwait, SIGUSR1}, {
+ test_unmasked_matching_noinfo, my_sigtimedwait, SIGUSR1}, {
+ test_masked_matching_noinfo, my_sigtimedwait, SIGUSR1}, {
+ test_bad_address, my_sigtimedwait, SIGUSR1}, {
+ test_bad_address2, my_sigtimedwait, SIGUSR1}, {
+ test_bad_address3, my_sigtimedwait, SIGUSR1}, {
+ test_timeout, my_sigtimedwait, 0},
+#endif
};
+
+#if defined TEST_SIGWAITINFO
+const char *TCID = "sigwaitinfo01";
+#elif defined TEST_RT_SIGTIMEDWAIT
+const char *TCID = "rt_sigtimedwait01";
+#elif defined TEST_SIGTIMEDWAIT
+const char *TCID = "sigtimedwait01";
+#elif defined TEST_SIGWAIT
+const char *TCID = "sigwait01";
+#endif
+
+int TST_TOTAL = ARRAY_SIZE(tests);
+
+int main(int argc, char **argv)
+{
+ unsigned i;
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
+ alarm(10); /* arrange a 10 second timeout */
+ tst_resm(TINFO, "%p, %d", tests[i].swi, tests[i].signo);
+ tests[i].tf(tests[i].swi, tests[i].signo);
+ }
+ alarm(0);
+ }
+
+ cleanup();
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/socket/Makefile b/testcases/kernel/syscalls/socket/Makefile
index bbfb90c1b..96d779a1f 100644
--- a/testcases/kernel/syscalls/socket/Makefile
+++ b/testcases/kernel/syscalls/socket/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/socketcall/.gitignore b/testcases/kernel/syscalls/socketcall/.gitignore
index 33ee18123..1c8439a57 100644
--- a/testcases/kernel/syscalls/socketcall/.gitignore
+++ b/testcases/kernel/syscalls/socketcall/.gitignore
@@ -1,3 +1,4 @@
/socketcall01
/socketcall02
/socketcall03
+/socketcall04
diff --git a/testcases/kernel/syscalls/socketcall/Makefile b/testcases/kernel/syscalls/socketcall/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/socketcall/Makefile
+++ b/testcases/kernel/syscalls/socketcall/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/socketcall/socketcall01.c b/testcases/kernel/syscalls/socketcall/socketcall01.c
index 205306377..a8f6649a6 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall01.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall01.c
@@ -1,23 +1,26 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ * AUTHOR : sowmya adiga<sowmya.adiga@wipro.com>
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) Linux Test Project, 2017-2020
- * Author: Sowmya Adiga <sowmya.adiga@wipro.com>
- *
+ */
+/*
* This is a basic test for the socketcall(2) system call.
*/
-
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/syscall.h>
#include <linux/net.h>
#include <sys/un.h>
#include <netinet/in.h>
#include "tst_test.h"
-#include "lapi/syscalls.h"
+
+#ifdef __NR_socketcall
+
+#define socketcall(call, args) syscall(__NR_socketcall, call, args)
struct test_case_t {
int call;
@@ -32,7 +35,7 @@ struct test_case_t {
void verify_socketcall(unsigned int i)
{
- TEST(tst_syscall(__NR_socketcall, TC[i].call, TC[i].args));
+ TEST(socketcall(TC[i].call, TC[i].args));
if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "socketcall() for %s failed with %li",
@@ -50,3 +53,9 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(TC),
.needs_root = 1,
};
+
+#else
+
+TST_TEST_TCONF("The socketcall() syscall is not supported");
+
+#endif
diff --git a/testcases/kernel/syscalls/socketcall/socketcall02.c b/testcases/kernel/syscalls/socketcall/socketcall02.c
index e5350938a..cec0246a6 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall02.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall02.c
@@ -1,64 +1,163 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * Copyright (c) 2020 Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- * Author: Sowmya Adiga <sowmya.adiga@wipro.com>
*
- * This is a error test for the socketcall(2) system call.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
-
-#include <unistd.h>
+/**************************************************************************
+ *
+ * TEST IDENTIFIER : socketcall02
+ *
+ * EXECUTED BY : All user
+ *
+ * TEST TITLE : Error test for socketcall(2)
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : sowmya adiga<sowmya.adiga@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * verify socketcall(2) returns -1 and sets errno
+ * appropriately if argument passed is invalid.
+ *
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper option is given.
+ * Execute system call.
+ * Check return code, If system call failed (return == -1) &&
+ * (errno set == expected errno)
+ * Issue sys call pass with expected error
+ * otherwise
+ * Issue sys call fails with unexpected error
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * socketcall02 [-c n] [-e] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently
+ * -e : Turn on errno logging.
+ * -h : Show this help screen
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * RESTRICTIONS
+ * None
+ *****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/net.h>
#include <sys/un.h>
#include <netinet/in.h>
-#include "tst_test.h"
-#include "lapi/syscalls.h"
+#include "test.h"
+
+char *TCID = "socketcall02";
+
+#ifdef __NR_socketcall
-static unsigned long args_valid[3] = {PF_INET, SOCK_STREAM, 0};
+#define socketcall(call, args) syscall(__NR_socketcall, call, args)
+
+void setup();
+void cleanup();
+
+int TST_TOTAL = 1;
struct test_case_t {
int call;
- unsigned long *args;
- int exp_err;
+ unsigned long args[3];
+ int retval;
+ int experrno;
char *desc;
-} TC[] = {
- {0, args_valid, EINVAL, "invalid call(<1)"},
- {21, args_valid, EINVAL, "invalid call(>20)"},
- {SYS_SOCKET, NULL, EFAULT, "invalid args address"},
-};
+} TC = {
+ -1, {
+PF_INET, SOCK_STREAM, 0}, -1, EINVAL, "invalid call"};
-static void verify_socketcall(unsigned int i)
+int main(int ac, char **av)
{
- tst_res(TINFO, "%s", TC[i].desc);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ /* check looping state */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- TEST(tst_syscall(__NR_socketcall, TC[i].call, TC[i].args));
- if (TST_RET != -1) {
- tst_res(TFAIL, "socketcall() succeeded unexpectedly");
- return;
+ tst_count = 0;
+
+ TEST(socketcall(TC.call, TC.args));
+
+ /* check return code */
+ if ((TEST_RETURN == -1)
+ && (TEST_ERRNO == TC.experrno)) {
+ tst_resm(TPASS, "socketcall() failed"
+ " as expected for %s", TC.desc);
+ } else {
+ tst_brkm(TFAIL, NULL, "socketcall()"
+ " Failed with wrong experrno"
+ " =%d got: errno=%d : %s",
+ TC.experrno, TEST_ERRNO, strerror(TEST_ERRNO));
+ }
}
- if (TST_ERR == TC[i].exp_err)
- tst_res(TPASS | TTERRNO, "socketcall() failed as expected ");
- else
- tst_res(TFAIL | TTERRNO, "socketcall fail expected %s got", tst_strerrno(TC[i].exp_err));
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
}
-static void setup(void)
+/* setup() - performs all ONE TIME setup for this test. */
+void setup(void)
{
- unsigned int i;
- for (i = 0; i < ARRAY_SIZE(TC); i++) {
- if (!TC[i].args)
- TC[i].args = tst_get_bad_addr(NULL);
- }
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
}
-static struct tst_test test = {
- .setup = setup,
- .test = verify_socketcall,
- .tcnt = ARRAY_SIZE(TC),
-};
+#else
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS, "socket call test on this architecture disabled.");
+ tst_exit();
+}
+#endif
diff --git a/testcases/kernel/syscalls/socketcall/socketcall03.c b/testcases/kernel/syscalls/socketcall/socketcall03.c
index 617a85b0d..244a28678 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall03.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall03.c
@@ -1,60 +1,181 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- * Copyright (c) 2020 Yang Xu <xuyang2018.jy@cn.fujitsu.com>
- * Author: Sowmya Adiga <sowmya.adiga@wipro.com>
*
- * This is a basic test for the socketcall(2) for bind(2) and listen(2).
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
-#include <unistd.h>
+/**************************************************************************
+ *
+ * TEST IDENTIFIER : socketcall03
+ *
+ * EXECUTED BY : All user
+ *
+ * TEST TITLE : Basic test for socketcall(2) for bind(2)
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : sowmya adiga<sowmya.adiga@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a phase I test for the socketcall(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * socketcall03 [-c n] [-e] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently
+ * -e : Turn on errno logging.
+ * -h : Show this help screen
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * RESTRICTIONS
+ * None
+ *****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/net.h>
#include <sys/un.h>
#include <netinet/in.h>
-#include "tst_test.h"
-#include "lapi/syscalls.h"
+#include "test.h"
+
+char *TCID = "socketcall03";
+
+#ifdef __NR_socketcall
-static struct sockaddr_in si;
+#define socketcall(call, args) syscall(__NR_socketcall, call, args)
-static void verify_socketcall(void)
+void setup();
+void cleanup();
+void setup1(void);
+
+int TST_TOTAL = 1;
+int s;
+unsigned long args[3];
+struct sockaddr_in si;
+
+struct test_case_t {
+ int domain;
+ int type;
+ int pro;
+ int call;
+ void (*setupfunc) (void);
+ char *desc;
+} TC = {
+AF_INET, SOCK_STREAM, 6, SYS_BIND, setup1, "bind call"};
+
+int main(int ac, char **av)
{
- unsigned long args[3];
- int s = -1;
+ int lc;
- s = SAFE_SOCKET(AF_INET, SOCK_STREAM, 6);
- args[0] = s;
- args[1] = (unsigned long)&si;
- args[2] = sizeof(si);
+ tst_parse_opts(ac, av, NULL, NULL);
- TEST(tst_syscall(__NR_socketcall, SYS_BIND, args));
- if (TST_RET < 0)
- tst_res(TFAIL | TTERRNO, "socketcall() for bind call failed with %ld", TST_RET);
- else
- tst_res(TPASS, "socketcall() for bind call passed, returned %ld", TST_RET);
+ setup();
- args[1] = 1;
- args[2] = 0;
+ /* check looping state */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- TEST(tst_syscall(__NR_socketcall, SYS_LISTEN, args));
- if (TST_RET < 0)
- tst_res(TFAIL | TTERRNO, "socketcall() for listen call failed with %ld", TST_RET);
- else
- tst_res(TPASS, "socketcall() for listen call passed, returned %ld", TST_RET);
+ tst_count = 0;
- SAFE_CLOSE(s);
+ TC.setupfunc();
+
+ TEST(socketcall(TC.call, args));
+
+ /* check return code */
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TERRNO, "socketcall() Failed "
+ " with return=%ld", TEST_RETURN);
+ } else {
+ tst_resm(TPASS, "socketcall() passed "
+ "for %s with return=%ld ",
+ TC.desc, TEST_RETURN);
+
+ close(s);
+ }
+ }
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
}
-static void setup(void)
+/*setup1()*/
+void setup1(void)
{
si.sin_family = AF_INET;
si.sin_addr.s_addr = htons(INADDR_ANY);
si.sin_port = 0;
+
+ if ((s = socket(TC.domain, TC.type, TC.pro)) == -1) {
+ tst_brkm(TBROK, NULL, "socket creation failed");
+ }
+ args[0] = s;
+ args[1] = (unsigned long)&si;
+ args[2] = sizeof(si);
+}
+
+/* setup() - performs all ONE TIME setup for this test. */
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+}
+
+#else
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS, "socket call test on this architecture disabled.");
+ tst_exit();
}
-static struct tst_test test = {
- .setup = setup,
- .test_all = verify_socketcall,
-};
+#endif
diff --git a/testcases/kernel/syscalls/socketcall/socketcall04.c b/testcases/kernel/syscalls/socketcall/socketcall04.c
new file mode 100644
index 000000000..584c8f37a
--- /dev/null
+++ b/testcases/kernel/syscalls/socketcall/socketcall04.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+/**************************************************************************
+ *
+ * TEST IDENTIFIER : socketcall04
+ *
+ * EXECUTED BY : All user
+ *
+ * TEST TITLE : Basic test for socketcall(2) for listen(2)
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * AUTHOR : sowmya adiga<sowmya.adiga@wipro.com>
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * DESCRIPTION
+ * This is a phase I test for the socketcall(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * USAGE: <for command-line>
+ * socketcall04 [-c n] [-e] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently
+ * -e : Turn on errno logging.
+ * -h : Show this help screen
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -p : Pause for SIGUSR1 before starting
+ * -P x : Pause for x seconds between iterations.
+ * t : Turn on syscall timing.
+ *
+ * RESTRICTIONS
+ * None
+ *****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <linux/net.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+
+#include "test.h"
+
+char *TCID = "socketcall04";
+
+#ifdef __NR_socketcall
+
+#define socketcall(call, args) syscall(__NR_socketcall, call, args)
+
+void setup();
+void cleanup();
+void setup1(void);
+
+int TST_TOTAL = 1;
+int i, s;
+unsigned long args[3];
+struct sockaddr_in si;
+
+struct test_case_t {
+ int domain;
+ int type;
+ int pro;
+ int call;
+ void (*setupfunc) (void);
+ char *desc;
+} TC = {
+AF_INET, SOCK_STREAM, 6, SYS_LISTEN, setup1, "listen call"};
+
+int main(int ac, char **av)
+{
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ /* check looping state */
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TC.setupfunc();
+
+ TEST(socketcall(TC.call, args));
+
+ /* check return code */
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "socketcall() Failed "
+ " with return=%ld", TEST_RETURN);
+ } else {
+ tst_resm(TPASS, "socketcall() passed "
+ "for %s with return=%ld ",
+ TC.desc, TEST_RETURN);
+ close(s);
+ }
+ }
+
+ /* cleanup and exit */
+ cleanup();
+
+ tst_exit();
+}
+
+/*setup1()*/
+void setup1(void)
+{
+ if ((s = socket(TC.domain, TC.type, TC.pro)) == -1) {
+ tst_brkm(TBROK, NULL, "socket creation failed");
+ }
+ args[0] = s;
+ args[1] = 1;
+}
+
+/* setup() - performs all ONE TIME setup for this test. */
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+}
+
+#else
+
+int TST_TOTAL = 0;
+
+int main(void)
+{
+ tst_resm(TPASS, "socket call test on this architecture disabled.");
+ tst_exit();
+}
+
+#endif
diff --git a/testcases/kernel/syscalls/socketpair/Makefile b/testcases/kernel/syscalls/socketpair/Makefile
index 21da0e8a6..bd457ff8f 100644
--- a/testcases/kernel/syscalls/socketpair/Makefile
+++ b/testcases/kernel/syscalls/socketpair/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sockioctl/Makefile b/testcases/kernel/syscalls/sockioctl/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sockioctl/Makefile
+++ b/testcases/kernel/syscalls/sockioctl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/splice/Makefile b/testcases/kernel/syscalls/splice/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/splice/Makefile
+++ b/testcases/kernel/syscalls/splice/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/splice/splice02.c b/testcases/kernel/syscalls/splice/splice02.c
index 5d91e26cd..b579667b9 100644
--- a/testcases/kernel/syscalls/splice/splice02.c
+++ b/testcases/kernel/syscalls/splice/splice02.c
@@ -1,163 +1,40 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Jens Axboe <axboe@kernel.dk>, 2009
- * Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
- */
-
-/*\
- * [DESCRIPTION]
- * Original reproducer for kernel fix
- * bf40d3435caf NFS: add support for splice writes
- * from v2.6.31-rc1.
- *
* http://lkml.org/lkml/2009/4/2/55
- *
- * [ALGORITHM]
- * - create pipe
- * - fork(), child replace stdin with pipe
- * - parent write to pipe
- * - child slice from pipe
- * - check resulted file size and content
*/
#define _GNU_SOURCE
-#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
#include "tst_test.h"
-#include "lapi/mmap.h"
#include "lapi/splice.h"
-#define BUFSIZE 512
-#define SPLICE_SIZE 1024
-
-#define TEST_FILENAME "splice02-temp"
-
-static char *sarg;
-static int file_size;
-static int pipe_fd[2];
+#define SPLICE_SIZE (64*1024)
-static void setup(void)
-{
- if (tst_parse_int(sarg, &file_size, 1, INT_MAX))
- tst_brk(TBROK, "invalid number of writes '%s', use <1,%d>", sarg, INT_MAX);
-}
-
-static inline int get_letter(int n)
-{
- return n % ('z' - 'a' + 1) + 'a';
-}
-
-static void do_child(void)
+static void splice_test(void)
{
int fd;
- size_t page_size, to_check, block, blocks, i, fail = 0;
- struct stat st;
- char *map;
-
- SAFE_CLOSE(pipe_fd[1]);
- SAFE_DUP2(pipe_fd[0], STDIN_FILENO);
-
- fd = SAFE_OPEN(TEST_FILENAME, O_WRONLY | O_CREAT | O_TRUNC, 0644);
-
- do {
- TEST(splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0));
- if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO, "splice failed");
- goto cleanup;
- }
- } while (TST_RET > 0);
-
- stat(TEST_FILENAME, &st);
- if (st.st_size != file_size) {
- tst_res(TFAIL, "file size is different from expected: %ld (%d)",
- st.st_size, file_size);
- goto cleanup;
- }
-
- SAFE_CLOSE(fd);
- fd = SAFE_OPEN(TEST_FILENAME, O_RDONLY);
-
- page_size = sysconf(_SC_PAGESIZE);
-
- tst_res(TINFO, "checking file content");
- blocks = LTP_ALIGN(st.st_size, page_size) / page_size;
+ fd = SAFE_OPEN("splice02-temp", O_WRONLY | O_CREAT | O_TRUNC, 0644);
- for (block = 0; block < blocks; block++) {
- map = SAFE_MMAP(NULL, page_size, PROT_READ, MAP_PRIVATE,
- fd,block * page_size);
-
- to_check = (block+1) * page_size < (unsigned long)st.st_size ?
- page_size : st.st_size % page_size;
-
- for (i = 0; i < to_check; i++) {
- if (map[i] != get_letter(block * page_size + i))
- fail++;
- }
-
- SAFE_MUNMAP(map, page_size);
+ TEST(splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0));
+ if (TST_RET < 0) {
+ tst_res(TFAIL, "splice failed - errno = %d : %s",
+ TST_ERR, strerror(TST_ERR));
+ } else {
+ tst_res(TPASS, "splice() system call Passed");
}
- if (fail) {
- tst_res(TFAIL, "%ld unexpected bytes found", fail);
- goto cleanup;
- }
-
- tst_res(TPASS, "splice() system call passed");
-
-cleanup:
SAFE_CLOSE(fd);
- exit(0);
-}
-
-static void run(void)
-{
- size_t i, size, written, max_pipe_size, to_write;
- char buf[BUFSIZE];
-
- SAFE_PIPE(pipe_fd);
-
- if (!file_size) {
- max_pipe_size = SAFE_FCNTL(pipe_fd[1], F_GETPIPE_SZ);
- file_size = max_pipe_size << 4;
- }
-
- to_write = file_size;
-
- if (!SAFE_FORK())
- do_child();
-
- tst_res(TINFO, "writting %d bytes", file_size);
-
- while (to_write > 0) {
- size = to_write > BUFSIZE ? BUFSIZE : to_write;
-
- for (i = 0; i < size; i++)
- buf[i] = get_letter(file_size - to_write + i);
-
- written = SAFE_WRITE(1, pipe_fd[1], &buf, size);
- to_write -= written;
- }
-
- SAFE_CLOSE(pipe_fd[0]);
- SAFE_CLOSE(pipe_fd[1]);
-
- tst_reap_children();
}
static struct tst_test test = {
- .test_all = run,
- .setup = setup,
+ .test_all = splice_test,
.needs_tmpdir = 1,
- .forks_child = 1,
.min_kver = "2.6.17",
- .options = (struct tst_option[]) {
- {"s:", &sarg, "-s x Size of output file in bytes (default: 16x max pipe size, i.e. 1M on intel)"},
- {}
- },
};
diff --git a/testcases/kernel/syscalls/splice/splice04.c b/testcases/kernel/syscalls/splice/splice04.c
index 29fdd24e9..ce3895185 100644
--- a/testcases/kernel/syscalls/splice/splice04.c
+++ b/testcases/kernel/syscalls/splice/splice04.c
@@ -19,6 +19,11 @@ static char *str_len_data;
static int num_len_data = PIPE_MAX;
static char *arr_in, *arr_out;
+static struct tst_option options[] = {
+ {"l:", &str_len_data, "-l <num> Length of test data (in bytes)"},
+ {NULL, NULL, NULL},
+};
+
static void setup(void)
{
int i, pipe_limit;
@@ -79,9 +84,6 @@ static struct tst_test test = {
.test_all = pipe_pipe,
.setup = setup,
.cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"l:", &str_len_data, "-l <num> Length of test data (in bytes)"},
- {}
- },
+ .options = options,
.min_kver = "2.6.31"
};
diff --git a/testcases/kernel/syscalls/splice/splice05.c b/testcases/kernel/syscalls/splice/splice05.c
index 9a9a7d1d5..a800adc02 100644
--- a/testcases/kernel/syscalls/splice/splice05.c
+++ b/testcases/kernel/syscalls/splice/splice05.c
@@ -29,6 +29,11 @@ static char *str_len_data;
static int num_len_data = PIPE_MAX;
static char *arr_in, *arr_out;
+static struct tst_option options[] = {
+ {"l:", &str_len_data, "-l <num> Length of test data (in bytes)"},
+ {NULL, NULL, NULL},
+};
+
static void setup(void)
{
int i, pipe_limit;
@@ -104,9 +109,6 @@ static struct tst_test test = {
.test_all = pipe_socket,
.setup = setup,
.cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"l:", &str_len_data, "-l <num> Length of test data (in bytes)"},
- {}
- },
+ .options = options,
.min_kver = "2.6.17"
};
diff --git a/testcases/kernel/syscalls/ssetmask/Makefile b/testcases/kernel/syscalls/ssetmask/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/ssetmask/Makefile
+++ b/testcases/kernel/syscalls/ssetmask/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/stat/Makefile b/testcases/kernel/syscalls/stat/Makefile
index d97d2bad0..bf1201019 100644
--- a/testcases/kernel/syscalls/stat/Makefile
+++ b/testcases/kernel/syscalls/stat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/statfs/Makefile b/testcases/kernel/syscalls/statfs/Makefile
index d97d2bad0..bf1201019 100644
--- a/testcases/kernel/syscalls/statfs/Makefile
+++ b/testcases/kernel/syscalls/statfs/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/statfs/statfs01.c b/testcases/kernel/syscalls/statfs/statfs01.c
index 65f008988..c3678d5f4 100644
--- a/testcases/kernel/syscalls/statfs/statfs01.c
+++ b/testcases/kernel/syscalls/statfs/statfs01.c
@@ -144,7 +144,7 @@ int main(int ac, char **av)
/* check return code */
if (TEST_RETURN == -1) {
- tst_resm(TFAIL | TTERRNO, "statfs(%s, ..) failed",
+ tst_resm(TFAIL | TERRNO, "statfs(%s, ..) failed",
fname);
} else {
tst_resm(TPASS, "statfs(%s, ..) returned %ld",
diff --git a/testcases/kernel/syscalls/statvfs/Makefile b/testcases/kernel/syscalls/statvfs/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/statvfs/Makefile
+++ b/testcases/kernel/syscalls/statvfs/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/statvfs/statvfs01.c b/testcases/kernel/syscalls/statvfs/statvfs01.c
index e3b356c93..1523058e7 100644
--- a/testcases/kernel/syscalls/statvfs/statvfs01.c
+++ b/testcases/kernel/syscalls/statvfs/statvfs01.c
@@ -54,7 +54,7 @@ int main(int ac, char **av)
TEST(statvfs(TEST_PATH, &buf));
if (TEST_RETURN == -1) {
- tst_resm(TFAIL | TTERRNO, "statvfs(%s, ...) failed",
+ tst_resm(TFAIL | TERRNO, "statvfs(%s, ...) failed",
TEST_PATH);
} else {
tst_resm(TPASS, "statvfs(%s, ...) passed", TEST_PATH);
diff --git a/testcases/kernel/syscalls/statx/Makefile b/testcases/kernel/syscalls/statx/Makefile
index 7e4770997..1be0bc80b 100644
--- a/testcases/kernel/syscalls/statx/Makefile
+++ b/testcases/kernel/syscalls/statx/Makefile
@@ -1,6 +1,21 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) Zilogic Systems Pvt. Ltd., 2018
# Email: code@zilogic.com
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 2358dd7bc..4f9d58282 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -148,8 +148,6 @@ static void setup(void)
char data_buff[SIZE];
int file_fd;
- umask(0);
-
memset(data_buff, '@', sizeof(data_buff));
file_fd = SAFE_OPEN(TESTFILE, O_RDWR|O_CREAT, MODE);
diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
index 81a5bcbf2..42911fc17 100644
--- a/testcases/kernel/syscalls/statx/statx05.c
+++ b/testcases/kernel/syscalls/statx/statx05.c
@@ -17,7 +17,6 @@
* Second directory has no flags set.
*
* Minimum kernel version required is 4.11.
- * Minimum e2fsprogs version required is 1.43.
*/
#define _GNU_SOURCE
@@ -25,7 +24,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include "tst_safe_stdio.h"
#include "tst_test.h"
#include "lapi/fs.h"
#include "lapi/stat.h"
@@ -88,22 +86,13 @@ static void run(unsigned int i)
static void setup(void)
{
- FILE *f;
char opt_bsize[32];
- const char *const fs_opts[] = {"-O encrypt", opt_bsize, NULL};
- int ret, rc, major, minor, patch;
-
- f = SAFE_POPEN("mkfs.ext4 -V 2>&1", "r");
- rc = fscanf(f, "mke2fs %d.%d.%d", &major, &minor, &patch);
- if (rc != 3)
- tst_res(TWARN, "Unable parse version number");
- else if (major * 10000 + minor * 100 + patch < 14300)
- tst_brk(TCONF, "Test needs mkfs.ext4 >= 1.43 for encrypt option, test skipped");
- pclose(f);
+ const char *const extra_opts[] = {"-O encrypt", opt_bsize, NULL};
+ int ret;
snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", getpagesize());
- SAFE_MKFS(tst_device->dev, tst_device->fs_type, fs_opts, NULL);
+ SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, extra_opts);
SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, 0);
mount_flag = 1;
@@ -135,8 +124,4 @@ static struct tst_test test = {
.needs_device = 1,
.mntpoint = MNTPOINT,
.dev_fs_type = "ext4",
- .needs_cmds = (const char *[]) {
- "mkfs.ext4",
- NULL
- }
};
diff --git a/testcases/kernel/syscalls/stime/Makefile b/testcases/kernel/syscalls/stime/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/stime/Makefile
+++ b/testcases/kernel/syscalls/stime/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/stime/stime_var.h b/testcases/kernel/syscalls/stime/stime_var.h
index 708b80573..b33c5704e 100644
--- a/testcases/kernel/syscalls/stime/stime_var.h
+++ b/testcases/kernel/syscalls/stime/stime_var.h
@@ -9,7 +9,6 @@
#include <sys/time.h>
#include "config.h"
-#include "tst_timer.h"
#include "lapi/syscalls.h"
#define TEST_VARIANTS 3
@@ -27,7 +26,7 @@ static int do_stime(time_t *ntime)
case 1:
return tst_syscall(__NR_stime, ntime);
case 2: {
- struct __kernel_old_timeval tv;
+ struct timeval tv;
tv.tv_sec = *ntime;
tv.tv_usec = 0;
diff --git a/testcases/kernel/syscalls/string/Makefile b/testcases/kernel/syscalls/string/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/string/Makefile
+++ b/testcases/kernel/syscalls/string/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/swapoff/Makefile b/testcases/kernel/syscalls/swapoff/Makefile
index 6954112a8..536b2dbac 100644
--- a/testcases/kernel/syscalls/swapoff/Makefile
+++ b/testcases/kernel/syscalls/swapoff/Makefile
@@ -1,12 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
-LTPLIBS = ltpswap
-
include $(top_srcdir)/include/mk/testcases.mk
-
-LTPLDLIBS = -lltpswap
-
+include $(abs_srcdir)/./Makefile.inc
include $(top_srcdir)/include/mk/generic_leaf_target.mk
+$(MAKE_TARGETS): %: %.o ../swapon/libswapon.o
diff --git a/testcases/kernel/syscalls/swapoff/Makefile.inc b/testcases/kernel/syscalls/swapoff/Makefile.inc
new file mode 100644
index 000000000..65350cbeb
--- /dev/null
+++ b/testcases/kernel/syscalls/swapoff/Makefile.inc
@@ -0,0 +1,6 @@
+LIBDIR += ../swapon/
+LIBSWAPON := $(LIBDIR)/libswapon.o
+$(LIBSWAPON):
+ $(MAKE) -C $(LIBDIR)
+CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR)
+LDFLAGS += -L$(abs_builddir)/$(LIBDIR)
diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c
index b27eecdad..e115269c0 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff01.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff01.c
@@ -1,59 +1,107 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
-/*\
- * [Description]
- *
+/*
* Check that swapoff() succeeds.
*/
#include <unistd.h>
+#include "test.h"
#include <errno.h>
#include <stdlib.h>
-
-#include "tst_test.h"
+#include "config.h"
#include "lapi/syscalls.h"
-#include "libswap.h"
+#include "../swapon/libswapon.h"
+
+static void setup(void);
+static void cleanup(void);
+static void verify_swapoff(void);
+
+char *TCID = "swapoff01";
+int TST_TOTAL = 1;
+
+static long fs_type;
+
+int main(int ac, char **av)
+{
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ verify_swapoff();
+ }
+
+ cleanup();
+ tst_exit();
+}
static void verify_swapoff(void)
{
- if (tst_syscall(__NR_swapon, "./swapfile01", 0) != 0) {
- tst_res(TFAIL | TERRNO, "Failed to turn on the swap file"
+ if (ltp_syscall(__NR_swapon, "./swapfile01", 0) != 0) {
+ if (fs_type == TST_BTRFS_MAGIC && errno == EINVAL) {
+ tst_brkm(TCONF, cleanup,
+ "Swapfiles on BTRFS are not implemented");
+ }
+
+ tst_resm(TBROK, "Failed to turn on the swap file"
", skipping test iteration");
return;
}
- TEST(tst_syscall(__NR_swapoff, "./swapfile01"));
+ TEST(ltp_syscall(__NR_swapoff, "./swapfile01"));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "Failed to turn off swapfile,"
- " system reboot after execution of LTP "
- "test suite is recommended.");
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "Failed to turn off swapfile,"
+ " system reboot after execution of LTP "
+ "test suite is recommended.");
} else {
- tst_res(TPASS, "Succeeded to turn off swapfile");
+ tst_resm(TPASS, "Succeeded to turn off swapfile");
}
}
static void setup(void)
{
- is_swap_supported("./tstswap");
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
- if (!tst_fs_has_free(".", 64, TST_MB))
- tst_brk(TBROK,
- "Insufficient disk space to create swap file");
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ is_swap_supported(cleanup, "./tstswap");
+
+ if (!tst_fs_has_free(NULL, ".", 64, TST_MB)) {
+ tst_brkm(TBROK, cleanup,
+ "Insufficient disk space to create swap file");
+ }
if (tst_fill_file("swapfile01", 0x00, 1024, 65536))
- tst_brk(TBROK, "Failed to create file for swap");
+ tst_brkm(TBROK, cleanup, "Failed to create file for swap");
if (system("mkswap swapfile01 > tmpfile 2>&1") != 0)
- tst_brk(TBROK, "Failed to make swapfile");
+ tst_brkm(TBROK, cleanup, "Failed to make swapfile");
}
-static struct tst_test test = {
- .needs_root = 1,
- .needs_tmpdir = 1,
- .test_all = verify_swapoff,
- .setup = setup
-};
+static void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/swapoff/swapoff02.c b/testcases/kernel/syscalls/swapoff/swapoff02.c
index cd940b1e7..8954f975f 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff02.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff02.c
@@ -1,100 +1,155 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
-/*\
- * [Description]
- *
+/*
* This test case checks whether swapoff(2) system call returns
* 1. EINVAL when the path does not exist
* 2. ENOENT when the path exists but is invalid
* 3. EPERM when user is not a superuser
*/
+#include <unistd.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <pwd.h>
-#include "tst_test.h"
+#include <string.h>
+#include <stdlib.h>
+#include "test.h"
#include "lapi/syscalls.h"
-#include "libswap.h"
+#include "safe_macros.h"
+#include "../swapon/libswapon.h"
+static void setup(void);
+static void cleanup(void);
static int setup01(void);
static void cleanup01(void);
+char *TCID = "swapoff02";
+int TST_TOTAL = 3;
+
static uid_t nobody_uid;
-static struct tcase {
+static struct test_case_t {
char *err_desc;
int exp_errno;
char *exp_errval;
char *path;
int (*setup)(void);
void (*cleanup)(void);
-} tcases[] = {
+} testcase[] = {
{"path does not exist", ENOENT, "ENOENT", "./doesnotexist", NULL, NULL},
{"Invalid file", EINVAL, "EINVAL", "./swapfile01", NULL, NULL},
{"Permission denied", EPERM, "EPERM", "./swapfile01", setup01, cleanup01}
};
-static void verify_swapoff(unsigned int i)
+int main(int ac, char **av)
{
- struct tcase *tc = tcases + i;
- if (tc->setup)
- tc->setup();
-
- TEST(tst_syscall(__NR_swapoff, tc->path));
-
- if (tc->cleanup)
- tc->cleanup();
-
- if (TST_RET == -1 && (TST_ERR == tc->exp_errno)) {
- tst_res(TPASS, "swapoff(2) expected failure;"
- " Got errno - %s : %s",
- tc->exp_errval, tc->err_desc);
- } else {
- tst_res(TFAIL, "swapoff(2) failed to produce"
- " expected error; %d, errno"
- ": %s and got %d",
- tc->exp_errno, tc->exp_errval, TST_ERR);
-
- if ((TST_RET == 0) && (i == 2)) {
- if (tst_syscall(__NR_swapon, "./swapfile01", 0) != 0)
- tst_brk(TBROK | TERRNO, " Failed to turn on swap file");
+ int lc, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ if (testcase[i].setup)
+ testcase[i].setup();
+
+ TEST(ltp_syscall(__NR_swapoff, testcase[i].path));
+
+ if (testcase[i].cleanup)
+ testcase[i].cleanup();
+
+ if (TEST_RETURN == -1
+ && (TEST_ERRNO == testcase[i].exp_errno)) {
+ tst_resm(TPASS,
+ "swapoff(2) expected failure;"
+ " Got errno - %s : %s",
+ testcase[i].exp_errval,
+ testcase[i].err_desc);
+
+ } else {
+ tst_resm(TFAIL, "swapoff(2) failed to produce"
+ " expected error; %d, errno"
+ ": %s and got %d",
+ testcase[i].exp_errno,
+ testcase[i].exp_errval, TEST_ERRNO);
+
+ if ((TEST_RETURN == 0) && (i == 2)) {
+ if (ltp_syscall
+ (__NR_swapon, "./swapfile01",
+ 0) != 0) {
+ tst_brkm(TBROK, cleanup,
+ " Failed to turn on"
+ " swap file");
+ }
+ }
+ }
}
}
+
+ cleanup();
+ tst_exit();
}
static int setup01(void)
{
- SAFE_SETEUID(nobody_uid);
+ SAFE_SETEUID(cleanup, nobody_uid);
return 0;
}
static void cleanup01(void)
{
- SAFE_SETEUID(0);
+ SAFE_SETEUID(cleanup, 0);
}
static void setup(void)
{
struct passwd *nobody;
- nobody = SAFE_GETPWNAM("nobody");
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
+ nobody = SAFE_GETPWNAM(NULL, "nobody");
nobody_uid = nobody->pw_uid;
- is_swap_supported("./tstswap");
+ TEST_PAUSE;
- if (!tst_fs_has_free(".", 1, TST_KB))
- tst_brk(TBROK, "Insufficient disk space to create swap file");
+ tst_tmpdir();
+
+ is_swap_supported(cleanup, "./tstswap");
+
+ if (!tst_fs_has_free(NULL, ".", 1, TST_KB)) {
+ tst_brkm(TBROK, cleanup,
+ "Insufficient disk space to create swap file");
+ }
if (tst_fill_file("./swapfile01", 0x00, 1024, 1))
- tst_brk(TBROK, "Failed to create swapfile");
+ tst_brkm(TBROK, cleanup, "Failed to create swapfile");
}
-static struct tst_test test = {
- .needs_root = 1,
- .needs_tmpdir = 1,
- .test = verify_swapoff,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup
-};
+static void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/swapon/Makefile b/testcases/kernel/syscalls/swapon/Makefile
index 53c795090..a109ecdf8 100644
--- a/testcases/kernel/syscalls/swapon/Makefile
+++ b/testcases/kernel/syscalls/swapon/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
NEEDSPECIAL := $(shell echo MAX_SWAPFILES | $(CC) -E -xc -include linux/swap.h 2>/dev/null - | tail -n 1 | grep 32; echo $?)
ifneq ($(strip $(NEEDSPECIAL)),)
@@ -8,10 +23,10 @@ endif
top_srcdir ?= ../../../..
-LTPLIBS = ltpswap
-
include $(top_srcdir)/include/mk/testcases.mk
-LTPLDLIBS = -lltpswap
+FILTER_OUT_MAKE_TARGETS := libswapon
include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+$(MAKE_TARGETS): %: %.o libswapon.o
diff --git a/testcases/kernel/syscalls/swapon/libswapon.c b/testcases/kernel/syscalls/swapon/libswapon.c
new file mode 100644
index 000000000..0a4501bdd
--- /dev/null
+++ b/testcases/kernel/syscalls/swapon/libswapon.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
+ *
+ */
+
+#include <errno.h>
+#include "lapi/syscalls.h"
+#include "test.h"
+#include "libswapon.h"
+
+/*
+ * Make a swap file
+ */
+int make_swapfile(void (cleanup)(void), const char *swapfile, int safe)
+{
+ if (!tst_fs_has_free(NULL, ".", sysconf(_SC_PAGESIZE) * 10,
+ TST_BYTES)) {
+ tst_brkm(TBROK, cleanup,
+ "Insufficient disk space to create swap file");
+ }
+
+ /* create file */
+ if (tst_fill_file(swapfile, 0,
+ sysconf(_SC_PAGESIZE), 10) != 0) {
+ tst_brkm(TBROK, cleanup, "Failed to create swapfile");
+ }
+
+ /* make the file swapfile */
+ const char *argv[2 + 1];
+ argv[0] = "mkswap";
+ argv[1] = swapfile;
+ argv[2] = NULL;
+
+ return tst_run_cmd(cleanup, argv, "/dev/null", "/dev/null", safe);
+}
+
+/*
+ * Check swapon/swapoff support status of filesystems or files
+ * we are testing on.
+ */
+void is_swap_supported(void (cleanup)(void), const char *filename)
+{
+ int fibmap = tst_fibmap(filename);
+ long fs_type = tst_fs_type(cleanup, filename);
+ const char *fstype = tst_fs_type_name(fs_type);
+
+ int ret = make_swapfile(NULL, filename, 1);
+ if (ret != 0) {
+ if (fibmap == 1) {
+ tst_brkm(TCONF, cleanup,
+ "mkswap on %s not supported", fstype);
+ } else {
+ tst_brkm(TFAIL, cleanup,
+ "mkswap on %s failed", fstype);
+ }
+ }
+
+ TEST(ltp_syscall(__NR_swapon, filename, 0));
+ if (TEST_RETURN == -1) {
+ if (fibmap == 1 && errno == EINVAL) {
+ tst_brkm(TCONF, cleanup,
+ "Swapfile on %s not implemented", fstype);
+ } else {
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "swapon on %s failed", fstype);
+ }
+ }
+
+ TEST(ltp_syscall(__NR_swapoff, filename, 0));
+ if (TEST_RETURN == -1) {
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "swapoff on %s failed", fstype);
+ }
+}
diff --git a/testcases/kernel/syscalls/swapon/libswapon.h b/testcases/kernel/syscalls/swapon/libswapon.h
new file mode 100644
index 000000000..a51833ec1
--- /dev/null
+++ b/testcases/kernel/syscalls/swapon/libswapon.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
+ *
+ */
+
+/*
+ * Contains common content for all swapon tests
+ */
+
+#ifndef __LIBSWAPON_H__
+#define __LIBSWAPON_H__
+
+/*
+ * Make a swap file
+ */
+int make_swapfile(void (cleanup)(void), const char *swapfile, int safe);
+
+/*
+ * Check swapon/swapoff support status of filesystems or files
+ * we are testing on.
+ */
+void is_swap_supported(void (cleanup)(void), const char *filename);
+#endif /* __LIBSWAPON_H__ */
diff --git a/testcases/kernel/syscalls/swapon/swapon01.c b/testcases/kernel/syscalls/swapon/swapon01.c
index c334ae246..f95ce0ab2 100644
--- a/testcases/kernel/syscalls/swapon/swapon01.c
+++ b/testcases/kernel/syscalls/swapon/swapon01.c
@@ -1,46 +1,95 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- */
-
-/*\
- * [Description]
*
- * Checks that swapon() succeds with swapfile.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
*/
+ /*
+ * Checks that swapon() succeds with swapfile.
+ */
+
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
-#include "tst_test.h"
+#include "test.h"
#include "lapi/syscalls.h"
-#include "libswap.h"
+#include "libswapon.h"
+
+static void setup(void);
+static void cleanup(void);
+
+char *TCID = "swapon01";
+int TST_TOTAL = 1;
+
+static long fs_type;
static void verify_swapon(void)
{
- TEST(tst_syscall(__NR_swapon, "./swapfile01", 0));
+ TEST(ltp_syscall(__NR_swapon, "./swapfile01", 0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "Failed to turn on swapfile");
+ if (TEST_RETURN == -1) {
+ if (fs_type == TST_BTRFS_MAGIC && errno == EINVAL) {
+ tst_brkm(TCONF, cleanup,
+ "Swapfile on BTRFS not implemeted");
+ return;
+ }
+ tst_resm(TFAIL | TTERRNO, "Failed to turn on swapfile");
} else {
- tst_res(TPASS, "Succeeded to turn on swapfile");
+ tst_resm(TPASS, "Succeeded to turn on swapfile");
/*we need to turn this swap file off for -i option */
- if (tst_syscall(__NR_swapoff, "./swapfile01") != 0) {
- tst_brk(TBROK | TERRNO, "Failed to turn off swapfile,"
- " system reboot after execution of LTP "
- "test suite is recommended.");
+ if (ltp_syscall(__NR_swapoff, "./swapfile01") != 0) {
+ tst_brkm(TBROK, cleanup, "Failed to turn off swapfile,"
+ " system reboot after execution of LTP "
+ "test suite is recommended.");
}
}
}
+int main(int ac, char **av)
+{
+
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ verify_swapon();
+ }
+
+ cleanup();
+ tst_exit();
+}
+
static void setup(void)
{
- is_swap_supported("./tstswap");
- make_swapfile("swapfile01", 0);
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ is_swap_supported(cleanup, "./tstswap");
+
+ make_swapfile(cleanup, "swapfile01", 0);
}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .test_all = verify_swapon,
- .setup = setup
-};
+static void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c
index d34c17a80..3d49d0c6b 100644
--- a/testcases/kernel/syscalls/swapon/swapon02.c
+++ b/testcases/kernel/syscalls/swapon/swapon02.c
@@ -1,109 +1,157 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
- */
-
-/*\
- * [Description]
+/* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * This test case checks whether swapon(2) system call returns
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+/*
+ * This test case checks whether swapon(2) system call returns
* 1. ENOENT when the path does not exist
* 2. EINVAL when the path exists but is invalid
* 3. EPERM when user is not a superuser
* 4. EBUSY when the specified path is already being used as a swap area
*/
+#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <pwd.h>
-
-#include "tst_test.h"
+#include <string.h>
+#include <sys/utsname.h>
+#include <signal.h>
+#include "test.h"
#include "lapi/syscalls.h"
-#include "libswap.h"
+#include "safe_macros.h"
+#include "libswapon.h"
+static void setup(void);
+static void cleanup(void);
static void setup01(void);
static void cleanup01(void);
+char *TCID = "swapon02";
+int TST_TOTAL = 4;
+
static uid_t nobody_uid;
static int do_swapoff;
+static long fs_type;
-static struct tcase {
+static struct test_case_t {
char *err_desc;
int exp_errno;
char *exp_errval;
char *path;
void (*setup)(void);
void (*cleanup)(void);
-} tcases[] = {
+} testcases[] = {
{"Path does not exist", ENOENT, "ENOENT", "./doesnotexist", NULL, NULL},
{"Invalid path", EINVAL, "EINVAL", "./notswap", NULL, NULL},
- {"Permission denied", EPERM, "EPERM", "./swapfile01", setup01, cleanup01},
+ {"Permission denied", EPERM, "EPERM", "./swapfile01",
+ setup01, cleanup01},
{"File already used", EBUSY, "EBUSY", "./alreadyused", NULL, NULL},
};
+static void verify_swapon(struct test_case_t *test)
+{
+ if (test->setup)
+ test->setup();
+
+ TEST(ltp_syscall(__NR_swapon, test->path, 0));
+
+ if (test->cleanup)
+ test->cleanup();
+
+ if (TEST_RETURN == -1 && TEST_ERRNO == test->exp_errno) {
+ tst_resm(TPASS, "swapon(2) expected failure;"
+ " Got errno - %s : %s",
+ test->exp_errval, test->err_desc);
+ return;
+ }
+
+ if (fs_type == TST_BTRFS_MAGIC && errno == EINVAL) {
+ tst_resm(TCONF, "Swapfile on BTRFS not implemeted");
+ return;
+ }
+
+ tst_resm(TFAIL, "swapon(2) failed to produce expected error:"
+ " %d, errno: %s and got %d.", test->exp_errno,
+ test->exp_errval, TEST_ERRNO);
+}
+
+int main(int ac, char **av)
+{
+ int lc, i;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ for (i = 0; i < TST_TOTAL; i++)
+ verify_swapon(testcases + i);
+ }
+
+ cleanup();
+ tst_exit();
+}
+
static void setup01(void)
{
- SAFE_SETEUID(nobody_uid);
+ SAFE_SETEUID(cleanup, nobody_uid);
}
static void cleanup01(void)
{
- SAFE_SETEUID(0);
+ SAFE_SETEUID(cleanup, 0);
}
static void setup(void)
{
struct passwd *nobody;
- nobody = SAFE_GETPWNAM("nobody");
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
+ nobody = SAFE_GETPWNAM(cleanup, "nobody");
nobody_uid = nobody->pw_uid;
- is_swap_supported("./tstswap");
+ tst_tmpdir();
- SAFE_TOUCH("notswap", 0777, NULL);
- make_swapfile("swapfile01", 0);
- make_swapfile("alreadyused", 0);
+ is_swap_supported(cleanup, "./tstswap");
- if (tst_syscall(__NR_swapon, "alreadyused", 0))
- tst_res(TWARN | TERRNO, "swapon(alreadyused) failed");
- else
+ SAFE_TOUCH(cleanup, "notswap", 0777, NULL);
+ make_swapfile(cleanup, "swapfile01", 0);
+ make_swapfile(cleanup, "alreadyused", 0);
+
+ if (ltp_syscall(__NR_swapon, "alreadyused", 0)) {
+ if (fs_type != TST_BTRFS_MAGIC || errno != EINVAL)
+ tst_resm(TWARN | TERRNO, "swapon(alreadyused) failed");
+ } else {
do_swapoff = 1;
-}
+ }
-void cleanup(void)
-{
- if (do_swapoff && tst_syscall(__NR_swapoff, "alreadyused"))
- tst_res(TWARN | TERRNO, "swapoff(alreadyused) failed");
+ TEST_PAUSE;
}
-static void verify_swapon(unsigned int i)
+void cleanup(void)
{
- struct tcase *tc = tcases + i;
- if (tc->setup)
- tc->setup();
+ if (do_swapoff && ltp_syscall(__NR_swapoff, "alreadyused"))
+ tst_resm(TWARN | TERRNO, "swapoff(alreadyused) failed");
- TEST(tst_syscall(__NR_swapon, tc->path, 0));
-
- if (tc->cleanup)
- tc->cleanup();
-
- if (TST_RET == -1 && TST_ERR == tc->exp_errno) {
- tst_res(TPASS, "swapon(2) expected failure;"
- " Got errno - %s : %s",
- tc->exp_errval, tc->err_desc);
- return;
- }
-
- tst_res(TFAIL, "swapon(2) failed to produce expected error:"
- " %d, errno: %s and got %d.", tc->exp_errno,
- tc->exp_errval, TST_ERR);
+ tst_rmdir();
}
-
-static struct tst_test test = {
- .needs_root = 1,
- .needs_tmpdir = 1,
- .test = verify_swapon,
- .tcnt = ARRAY_SIZE(tcases),
- .setup = setup,
- .cleanup = cleanup
-};
diff --git a/testcases/kernel/syscalls/swapon/swapon03.c b/testcases/kernel/syscalls/swapon/swapon03.c
index dc633ebc6..cef57150c 100644
--- a/testcases/kernel/syscalls/swapon/swapon03.c
+++ b/testcases/kernel/syscalls/swapon/swapon03.c
@@ -1,33 +1,59 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) International Business Machines Corp., 2007
- * Created by <rsalveti@linux.vnet.ibm.com>
+/******************************************************************************
*
- */
-
-/*\
- * [Description]
+ * Copyright (c) International Business Machines Corp., 2007
+ * Created by <rsalveti@linux.vnet.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ ******************************************************************************/
+
+/*
* This test case checks whether swapon(2) system call returns:
* - EPERM when there are more than MAX_SWAPFILES already in use.
+ *
*/
-#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/wait.h>
-
-#include "tst_test.h"
+#include <sys/stat.h>
+#include <sys/utsname.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <string.h>
+#include <signal.h>
+#include "test.h"
#include "lapi/syscalls.h"
#include "swaponoff.h"
-#include "libswap.h"
+#include "libswapon.h"
+static void setup(void);
+static void cleanup(void);
static int setup_swap(void);
static int clean_swap(void);
static int check_and_swapoff(const char *filename);
+char *TCID = "swapon03";
+int TST_TOTAL = 1;
+
static int swapfiles;
+static long fs_type;
+
int testfiles = 3;
static struct swap_testfile_t {
char *filename;
@@ -39,60 +65,83 @@ static struct swap_testfile_t {
int expected_errno = EPERM;
-static void verify_swapon(void)
+int main(int ac, char **av)
{
- if (setup_swap() < 0) {
- clean_swap();
- tst_brk(TBROK, "Setup failed, quitting the test");
- }
+ int lc;
- TEST(tst_syscall(__NR_swapon, swap_testfiles[0].filename, 0));
+ tst_parse_opts(ac, av, NULL, NULL);
- if ((TST_RET == -1) && (TST_ERR == expected_errno)) {
- tst_res(TPASS, "swapon(2) got expected failure (%d),",
- expected_errno);
- } else if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO,
- "swapon(2) failed to produce expected error "
- "(%d). System reboot recommended.",
- expected_errno);
- } else {
- /* Probably the system supports MAX_SWAPFILES > 30,
- * let's try with MAX_SWAPFILES == 32 */
+ setup();
- /* Call swapon sys call once again for 32
- * now we can't receive an error */
- TEST(tst_syscall(__NR_swapon, swap_testfiles[1].filename, 0));
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
- /* Check return code (now we're expecting success) */
- if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO,
- "swapon(2) got an unexpected failure");
+ if (setup_swap() < 0) {
+ clean_swap();
+ tst_brkm(TBROK, cleanup,
+ "Setup failed, quitting the test");
+ }
+
+ TEST(ltp_syscall(__NR_swapon, swap_testfiles[0].filename, 0));
+
+ if ((TEST_RETURN == -1) && (TEST_ERRNO == expected_errno)) {
+ tst_resm(TPASS, "swapon(2) got expected failure (%d),",
+ expected_errno);
+ } else if (TEST_RETURN < 0) {
+ tst_resm(TFAIL | TTERRNO,
+ "swapon(2) failed to produce expected error "
+ "(%d). System reboot recommended.",
+ expected_errno);
} else {
- /* Call swapon sys call once again for 33
- * now we have to receive an error */
- TEST(tst_syscall(__NR_swapon, swap_testfiles[2].filename, 0));
-
- /* Check return code (should be an error) */
- if ((TST_RET == -1) && (TST_ERR == expected_errno)) {
- tst_res(TPASS,
- "swapon(2) got expected failure;"
- " Got errno = %d, probably your"
- " MAX_SWAPFILES is 32",
- expected_errno);
+ /* Probably the system supports MAX_SWAPFILES > 30,
+ * let's try with MAX_SWAPFILES == 32 */
+
+ /* Call swapon sys call once again for 32
+ * now we can't receive an error */
+ TEST(ltp_syscall
+ (__NR_swapon, swap_testfiles[1].filename, 0));
+
+ /* Check return code (now we're expecting success) */
+ if (TEST_RETURN < 0) {
+ tst_resm(TFAIL | TTERRNO,
+ "swapon(2) got an unexpected failure");
} else {
- tst_res(TFAIL,
- "swapon(2) failed to produce"
- " expected error: %d, got %s."
- " System reboot after execution of LTP"
- " test suite is recommended.",
- expected_errno, strerror(TST_ERR));
+ /* Call swapon sys call once again for 33
+ * now we have to receive an error */
+ TEST(ltp_syscall
+ (__NR_swapon, swap_testfiles[2].filename,
+ 0));
+
+ /* Check return code (should be an error) */
+ if ((TEST_RETURN == -1)
+ && (TEST_ERRNO == expected_errno)) {
+ tst_resm(TPASS,
+ "swapon(2) got expected failure;"
+ " Got errno = %d, probably your"
+ " MAX_SWAPFILES is 32",
+ expected_errno);
+ } else {
+ tst_resm(TFAIL,
+ "swapon(2) failed to produce"
+ " expected error: %d, got %s."
+ " System reboot after execution of LTP"
+ " test suite is recommended.",
+ expected_errno,
+ strerror(TEST_ERRNO));
+ }
+
}
}
+
+ if (clean_swap() < 0)
+ tst_brkm(TBROK, cleanup,
+ "Cleanup failed, quitting the test");
+
}
- if (clean_swap() < 0)
- tst_brk(TBROK, "Cleanup failed, quitting the test");
+ cleanup();
+ tst_exit();
+
}
/*
@@ -110,20 +159,22 @@ static int setup_swap(void)
/* Find out how many swapfiles (1 line per entry) already exist */
swapfiles = 0;
- if (seteuid(0) < 0)
- tst_brk(TFAIL | TERRNO, "Failed to call seteuid");
+ if (seteuid(0) < 0) {
+ tst_brkm(TFAIL | TERRNO, cleanup, "Failed to call seteuid");
+ }
/* This includes the first (header) line */
if ((fd = open("/proc/swaps", O_RDONLY)) == -1) {
- tst_brk(TFAIL | TERRNO,
- "Failed to find out existing number of swap files");
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "Failed to find out existing number of swap files");
}
do {
char *p = buf;
res = read(fd, buf, BUFSIZ);
if (res < 0) {
- tst_brk(TFAIL | TERRNO,
- "Failed to find out existing number of swap files");
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "Failed to find out existing number of swap "
+ "files");
}
buf[res] = '\0';
while ((p = strchr(p, '\n'))) {
@@ -135,14 +186,18 @@ static int setup_swap(void)
if (swapfiles)
swapfiles--; /* don't count the /proc/swaps header */
- if (swapfiles < 0)
- tst_brk(TFAIL, "Failed to find existing number of swapfiles");
+ if (swapfiles < 0) {
+ tst_brkm(TFAIL, cleanup,
+ "Failed to find existing number of swapfiles");
+ }
/* Determine how many more files are to be created */
swapfiles = MAX_SWAPFILES - swapfiles;
- if (swapfiles > MAX_SWAPFILES)
+ if (swapfiles > MAX_SWAPFILES) {
swapfiles = MAX_SWAPFILES;
- pid = SAFE_FORK();
+ }
+
+ pid = FORK_OR_VFORK();
if (pid == 0) {
/*create and turn on remaining swapfiles */
for (j = 0; j < swapfiles; j++) {
@@ -155,16 +210,21 @@ static int setup_swap(void)
}
/* Create the swapfile */
- make_swapfile(filename, 0);
+ make_swapfile(cleanup, filename, 0);
/* turn on the swap file */
- res = tst_syscall(__NR_swapon, filename, 0);
+ res = ltp_syscall(__NR_swapon, filename, 0);
if (res != 0) {
+ if (fs_type == TST_BTRFS_MAGIC && errno == EINVAL)
+ exit(2);
+
if (errno == EPERM) {
- printf("Successfully created %d swapfiles\n", j);
+ printf("Successfully created %d "
+ "swapfiles\n", j);
break;
} else {
- printf("Failed to create swapfile: %s\n", filename);
+ printf("Failed to create "
+ "swapfile: %s\n", filename);
exit(1);
}
}
@@ -173,14 +233,23 @@ static int setup_swap(void)
} else
waitpid(pid, &status, 0);
- if (WEXITSTATUS(status))
- tst_brk(TFAIL, "Failed to setup swaps");
+ switch (WEXITSTATUS(status)) {
+ case 0:
+ break;
+ case 2:
+ tst_brkm(TCONF, cleanup, "Swapfile on BTRFS not implemeted");
+ break;
+ default:
+ tst_brkm(TFAIL, cleanup, "Failed to setup swaps");
+ break;
+ }
/* Create all needed extra swapfiles for testing */
for (j = 0; j < testfiles; j++)
- make_swapfile(swap_testfiles[j].filename, 0);
+ make_swapfile(cleanup, swap_testfiles[j].filename, 0);
return 0;
+
}
/*
@@ -194,21 +263,22 @@ static int clean_swap(void)
for (j = 0; j < swapfiles; j++) {
if (snprintf(filename, sizeof(filename),
"swapfile%02d", j + 2) < 0) {
- tst_res(TWARN, "sprintf() failed to create filename");
- tst_res(TWARN, "Failed to turn off swap files. System"
+ tst_resm(TWARN, "sprintf() failed to create filename");
+ tst_resm(TWARN, "Failed to turn off swap files. System"
" reboot after execution of LTP test"
" suite is recommended");
return -1;
}
if (check_and_swapoff(filename) != 0) {
- tst_res(TWARN, "Failed to turn off swap file %s.", filename);
+ tst_resm(TWARN, "Failed to turn off swap file %s.",
+ filename);
return -1;
}
}
for (j = 0; j < testfiles; j++) {
if (check_and_swapoff(swap_testfiles[j].filename) != 0) {
- tst_res(TWARN, "Failed to turn off swap file %s.",
+ tst_resm(TWARN, "Failed to turn off swap file %s.",
swap_testfiles[j].filename);
return -1;
}
@@ -227,7 +297,8 @@ static int check_and_swapoff(const char *filename)
if (snprintf(cmd_buffer, sizeof(cmd_buffer),
"grep -q '%s.*file' /proc/swaps", filename) < 0) {
- tst_res(TWARN, "sprintf() failed to create the command string");
+ tst_resm(TWARN,
+ "sprintf() failed to create the command string");
} else {
rc = 0;
@@ -235,9 +306,9 @@ static int check_and_swapoff(const char *filename)
if (system(cmd_buffer) == 0) {
/* now we need to swapoff the file */
- if (tst_syscall(__NR_swapoff, filename) != 0) {
+ if (ltp_syscall(__NR_swapoff, filename) != 0) {
- tst_res(TWARN, "Failed to turn off swap "
+ tst_resm(TWARN, "Failed to turn off swap "
"file. system reboot after "
"execution of LTP test suite "
"is recommended");
@@ -253,22 +324,23 @@ static int check_and_swapoff(const char *filename)
static void setup(void)
{
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
if (access("/proc/swaps", F_OK))
- tst_brk(TCONF, "swap not supported by kernel");
+ tst_brkm(TCONF, NULL, "swap not supported by kernel");
+
+ tst_tmpdir();
- is_swap_supported("./tstswap");
+ is_swap_supported(cleanup, "./tstswap");
+
+ TEST_PAUSE;
}
static void cleanup(void)
{
clean_swap();
-}
-static struct tst_test test = {
- .needs_root = 1,
- .needs_tmpdir = 1,
- .forks_child = 1,
- .test_all = verify_swapon,
- .setup = setup,
- .cleanup = cleanup
-};
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/switch/Makefile b/testcases/kernel/syscalls/switch/Makefile
index 6d5002ab6..504042e11 100644
--- a/testcases/kernel/syscalls/switch/Makefile
+++ b/testcases/kernel/syscalls/switch/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) International Business Machines Corp., 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/symlink/Makefile b/testcases/kernel/syscalls/symlink/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/symlink/Makefile
+++ b/testcases/kernel/syscalls/symlink/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/symlink/symlink01.c b/testcases/kernel/syscalls/symlink/symlink01.c
index eba64f9bd..03a51a5cb 100644
--- a/testcases/kernel/syscalls/symlink/symlink01.c
+++ b/testcases/kernel/syscalls/symlink/symlink01.c
@@ -598,7 +598,7 @@ struct tcses *get_tcs_info(char *ptr)
}
#endif
- for (ctr = 0; ctr < (int)(sizeof(all_tcses) / sizeof(struct tcses)); ctr++) {
+ for (ctr = 0; ctr < (sizeof(all_tcses) / sizeof(struct tcses)); ctr++) {
if (strcmp(ptr, all_tcses[ctr].tcid) == 0 ||
strcmp(ptr, all_tcses[ctr].syscall) == 0) {
tcs_ptr = &all_tcses[ctr];
@@ -1875,7 +1875,7 @@ void cleanup(void)
void help(void)
{
- unsigned int ind;
+ int ind;
printf(" -T id Determines which tests cases to execute:\n");
diff --git a/testcases/kernel/syscalls/symlinkat/Makefile b/testcases/kernel/syscalls/symlinkat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/symlinkat/Makefile
+++ b/testcases/kernel/syscalls/symlinkat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sync/.gitignore b/testcases/kernel/syscalls/sync/.gitignore
index 74d01da47..04f4710dd 100644
--- a/testcases/kernel/syscalls/sync/.gitignore
+++ b/testcases/kernel/syscalls/sync/.gitignore
@@ -1 +1,3 @@
/sync01
+/sync02
+/sync03
diff --git a/testcases/kernel/syscalls/sync/Makefile b/testcases/kernel/syscalls/sync/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sync/Makefile
+++ b/testcases/kernel/syscalls/sync/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sync/sync01.c b/testcases/kernel/syscalls/sync/sync01.c
index 423662678..dd0a336c2 100644
--- a/testcases/kernel/syscalls/sync/sync01.c
+++ b/testcases/kernel/syscalls/sync/sync01.c
@@ -1,62 +1,182 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2019 Linaro Limited. All rights reserved.
- * Author: Sumit Garg <sumit.garg@linaro.org>
- */
-
-/*
- * sync03
+ * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
- * It basically tests sync() to sync test file having large dirty file pages
- * to block device. Also, it tests all supported filesystems on a test block
- * device.
*/
+/* $Id: sync01.c,v 1.6 2009/11/02 13:57:19 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : sync01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for sync(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) sync(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the sync(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * sync(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-#define _GNU_SOURCE
#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include "tst_test.h"
-
-#define MNTPOINT "mnt_point"
-#define FNAME MNTPOINT"/test"
-#define FILE_SIZE_MB 32
-#define FILE_SIZE (FILE_SIZE_MB * TST_MB)
-#define MODE 0644
-
-static void verify_sync(void)
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+
+void setup();
+void cleanup();
+
+char *TCID = "sync01";
+int TST_TOTAL = 1;
+
+int main(int ac, char **av)
{
- int fd;
- unsigned long written;
+ int lc;
+
+ /***************************************************************
+ * parse standard options
+ ***************************************************************/
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ /***************************************************************
+ * perform global setup for test
+ ***************************************************************/
+ setup();
+
+ /***************************************************************
+ * check looping state if -c option given
+ ***************************************************************/
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
+ tst_count = 0;
- tst_dev_sync(fd);
- tst_dev_bytes_written(tst_device->dev);
+ /*
+ * Call sync(2)
+ */
+ TEST_VOID(sync());
- tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
+ /* check return code */
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "sync() Failed, errno=%d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TPASS, "sync() returned %ld",
+ TEST_RETURN);
+ }
+ }
- sync();
+ cleanup();
+ tst_exit();
+}
+
+/***************************************************************
+ * setup() - performs all ONE TIME setup for this test.
+ ***************************************************************/
+void setup(void)
+{
- written = tst_dev_bytes_written(tst_device->dev);
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
- SAFE_CLOSE(fd);
+ TEST_PAUSE;
- if (written >= FILE_SIZE)
- tst_res(TPASS, "Test file synced to device");
- else
- tst_res(TFAIL, "Synced %li, expected %i", written, FILE_SIZE);
}
-static struct tst_test test = {
- .needs_root = 1,
- .mount_device = 1,
- .all_filesystems = 1,
- .skip_filesystems = (const char *[]) {
- "tmpfs",
- NULL
- },
- .mntpoint = MNTPOINT,
- .test_all = verify_sync,
-};
+/***************************************************************
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ ***************************************************************/
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/sync/sync02.c b/testcases/kernel/syscalls/sync/sync02.c
new file mode 100644
index 000000000..d4fd94c0e
--- /dev/null
+++ b/testcases/kernel/syscalls/sync/sync02.c
@@ -0,0 +1,204 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Test Name: sync02
+ *
+ * Test Description:
+ * Open a file for write; modify the file, then do a sync().
+ * Verify that the data has been written to disk by re-opening the file.
+ *
+ * Expected Result:
+ * sync() alawys returns 0 in Linux. The data written to the file should
+ * be updated to the disk.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * sync02 [-c n] [-f] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions:
+ * None.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/stat.h>
+
+#include "test.h"
+
+#define TEMP_FILE "temp_file"
+#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+
+char *TCID = "sync02";
+int TST_TOTAL = 1;
+char write_buffer[BUFSIZ]; /* buffer used to write data to file */
+int fildes; /* file descriptor for temporary file */
+
+void setup(); /* Main setup function of test */
+void cleanup(); /* cleanup function for the test */
+
+int main(int ac, char **av)
+{
+ int lc;
+ char read_buffer[BUFSIZ]; /* buffer used to read data from file */
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ /*
+ * Call sync(2) to commit buffer data to disk.
+ */
+ TEST_VOID(sync());
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "%s, Failed, errno=%d : %s",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ /* Set the file ptr to b'nning of file */
+ if (lseek(fildes, 0, SEEK_SET) < 0) {
+ tst_brkm(TFAIL, cleanup, "lseek() "
+ "failed on %s, error=%d",
+ TEMP_FILE, errno);
+ }
+
+ /* Read the contents of file */
+ if (read(fildes, read_buffer,
+ sizeof(read_buffer)) > 0) {
+ if (strcmp(read_buffer, write_buffer)) {
+ tst_resm(TFAIL, "Data read "
+ "from %s doesn't match "
+ "with witten data",
+ TEMP_FILE);
+ } else {
+ tst_resm(TPASS, "Functionality "
+ "of sync() successful");
+ }
+ } else {
+ tst_brkm(TFAIL, cleanup,
+ "read() Fails on %s, error=%d",
+ TEMP_FILE, errno);
+ }
+ }
+ tst_count++; /* incr. TEST_LOOP counter */
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * void
+ * setup() - performs all ONE TIME setup for this test.
+ * Create a temporary directory and change directory to it.
+ * Create a test file under temporary directory and write some
+ * data into it.
+ */
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ /* Pause if that option was specified
+ * TEST_PAUSE contains the code to fork the test with the -i option.
+ * You want to make sure you do this before you create your temporary
+ * directory.
+ */
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ /* Copy some data into data buffer */
+ strcpy(write_buffer, "abcdefghijklmnopqrstuvwxyz");
+
+ /* Creat a temporary file under above directory */
+ if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
+ tst_brkm(TBROK, cleanup,
+ "open(%s, O_RDWR | O_CREAT, %#o) Failed, errno=%d :%s",
+ TEMP_FILE, FILE_MODE, errno, strerror(errno));
+ }
+
+ /* Write the buffer data into file */
+ if (write(fildes, write_buffer, strlen(write_buffer) + 1) !=
+ strlen(write_buffer) + 1) {
+ tst_brkm(TBROK, cleanup,
+ "write() failed to write buffer data to %s",
+ TEMP_FILE);
+ }
+
+}
+
+/*
+ * void
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ * Remove the test directory and testfile created in the setup.
+ */
+void cleanup(void)
+{
+
+ /* Close the temporary file */
+ if (close(fildes) == -1) {
+ tst_brkm(TFAIL, NULL,
+ "close(%s) Failed, errno=%d : %s",
+ TEMP_FILE, errno, strerror(errno));
+ }
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/sync/sync03.c b/testcases/kernel/syscalls/sync/sync03.c
new file mode 100644
index 000000000..c5c02f877
--- /dev/null
+++ b/testcases/kernel/syscalls/sync/sync03.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Linaro Limited. All rights reserved.
+ * Author: Sumit Garg <sumit.garg@linaro.org>
+ */
+
+/*
+ * sync03
+ *
+ * It basically tests sync() to sync test file having large dirty file pages
+ * to block device. Also, it tests all supported filesystems on a test block
+ * device.
+ */
+
+#define _GNU_SOURCE
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include "tst_test.h"
+
+#define MNTPOINT "mnt_point"
+#define FNAME MNTPOINT"/test"
+#define FILE_SIZE_MB 32
+#define FILE_SIZE (FILE_SIZE_MB * TST_MB)
+#define MODE 0644
+
+static void verify_sync(void)
+{
+ int fd;
+ unsigned long written;
+
+ fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
+
+ tst_dev_sync(fd);
+ tst_dev_bytes_written(tst_device->dev);
+
+ tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
+
+ TEST_VOID(sync());
+
+ if (TST_RET)
+ tst_brk(TFAIL | TTERRNO, "sync() failed");
+
+ written = tst_dev_bytes_written(tst_device->dev);
+
+ SAFE_CLOSE(fd);
+
+ if (written >= FILE_SIZE)
+ tst_res(TPASS, "Test file synced to device");
+ else
+ tst_res(TFAIL, "Synced %li, expected %i", written, FILE_SIZE);
+}
+
+static struct tst_test test = {
+ .needs_root = 1,
+ .mount_device = 1,
+ .all_filesystems = 1,
+ .mntpoint = MNTPOINT,
+ .test_all = verify_sync,
+};
diff --git a/testcases/kernel/syscalls/sync_file_range/Makefile b/testcases/kernel/syscalls/sync_file_range/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sync_file_range/Makefile
+++ b/testcases/kernel/syscalls/sync_file_range/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
index f9693089b..64d069e93 100644
--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
+++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
@@ -121,12 +121,7 @@ static struct tst_test test = {
.needs_root = 1,
.mount_device = 1,
.all_filesystems = 1,
- .skip_filesystems = (const char *const []){
- "fuse",
- "ntfs",
- "tmpfs",
- NULL
- },
+ .dev_fs_flags = TST_FS_SKIP_FUSE,
.mntpoint = MNTPOINT,
.setup = setup,
.test = run,
diff --git a/testcases/kernel/syscalls/syncfs/syncfs01.c b/testcases/kernel/syscalls/syncfs/syncfs01.c
index 24e3f2285..333726eaa 100644
--- a/testcases/kernel/syscalls/syncfs/syncfs01.c
+++ b/testcases/kernel/syscalls/syncfs/syncfs01.c
@@ -62,10 +62,6 @@ static struct tst_test test = {
.needs_root = 1,
.mount_device = 1,
.all_filesystems = 1,
- .skip_filesystems = (const char*[]) {
- "tmpfs",
- NULL
- },
.mntpoint = MNTPOINT,
.setup = setup,
.test_all = verify_syncfs,
diff --git a/testcases/kernel/syscalls/syscall/Makefile b/testcases/kernel/syscalls/syscall/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/syscall/Makefile
+++ b/testcases/kernel/syscalls/syscall/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sysconf/Makefile b/testcases/kernel/syscalls/sysconf/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sysconf/Makefile
+++ b/testcases/kernel/syscalls/sysconf/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sysctl/Makefile b/testcases/kernel/syscalls/sysctl/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sysctl/Makefile
+++ b/testcases/kernel/syscalls/sysctl/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sysfs/Makefile b/testcases/kernel/syscalls/sysfs/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sysfs/Makefile
+++ b/testcases/kernel/syscalls/sysfs/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sysinfo/.gitignore b/testcases/kernel/syscalls/sysinfo/.gitignore
index 8ad2279a4..aa7c26946 100644
--- a/testcases/kernel/syscalls/sysinfo/.gitignore
+++ b/testcases/kernel/syscalls/sysinfo/.gitignore
@@ -1,3 +1,2 @@
/sysinfo01
/sysinfo02
-/sysinfo03
diff --git a/testcases/kernel/syscalls/sysinfo/Makefile b/testcases/kernel/syscalls/sysinfo/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/sysinfo/Makefile
+++ b/testcases/kernel/syscalls/sysinfo/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/sysinfo/sysinfo03.c b/testcases/kernel/syscalls/sysinfo/sysinfo03.c
deleted file mode 100644
index af7cb6421..000000000
--- a/testcases/kernel/syscalls/sysinfo/sysinfo03.c
+++ /dev/null
@@ -1,84 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
- */
-/*
-
- Test if CLOCK_BOOTTIME namespace offset is applied to sysinfo uptime and that
- it's consistent with /proc/uptime as well.
-
- After a call to unshare(CLONE_NEWTIME) a new timer namespace is created, the
- process that has called the unshare() can adjust offsets for CLOCK_MONOTONIC
- and CLOCK_BOOTTIME for its children by writing to the '/proc/self/timens_offsets'.
-
- */
-
-#include <sys/sysinfo.h>
-#include "lapi/namespaces_constants.h"
-#include "lapi/posix_clocks.h"
-#include "tst_test.h"
-
-static int offsets[] = {
- 10,
- -10,
- 3600,
-};
-
-static long read_proc_uptime(void)
-{
- long sec, sec_rem;
-
- SAFE_FILE_SCANF("/proc/uptime", "%li.%li", &sec, &sec_rem);
-
- return sec + (sec_rem ? 1 : 0);
-}
-
-static void verify_sysinfo(unsigned int n)
-{
- struct sysinfo si;
- long uptime;
- int off = offsets[n];
-
- SAFE_UNSHARE(CLONE_NEWTIME);
-
- SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
- CLOCK_BOOTTIME, off);
-
- sysinfo(&si);
-
- uptime = si.uptime;
-
- if (!SAFE_FORK()) {
- sysinfo(&si);
- long proc_uptime = read_proc_uptime();
-
- long diff = si.uptime - uptime;
-
- if (diff < off || diff > off + 1)
- tst_res(TFAIL, "Wrong sysinfo uptime offset %li", diff);
- else
- tst_res(TPASS, "Correct sysinfo uptime offset %i", off);
-
- if (si.uptime < proc_uptime || si.uptime > proc_uptime + 1) {
- tst_res(TFAIL, "/proc/uptime %li differs from sysinfo %li",
- proc_uptime, si.uptime);
- } else {
- tst_res(TPASS, "/proc/uptime is consistent with sysinfo");
- }
- }
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(offsets),
- .test = verify_sysinfo,
- .needs_root = 1,
- .forks_child = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_TIME_NS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "ecc421e05bab"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/syslog/Makefile b/testcases/kernel/syscalls/syslog/Makefile
index f6b1e6a0f..a1d1ea8ed 100644
--- a/testcases/kernel/syscalls/syslog/Makefile
+++ b/testcases/kernel/syscalls/syslog/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/tee/Makefile b/testcases/kernel/syscalls/tee/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/tee/Makefile
+++ b/testcases/kernel/syscalls/tee/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/tee/tee02.c b/testcases/kernel/syscalls/tee/tee02.c
index 899e93e5f..21296e968 100644
--- a/testcases/kernel/syscalls/tee/tee02.c
+++ b/testcases/kernel/syscalls/tee/tee02.c
@@ -44,7 +44,7 @@ static struct tcase {
static void setup(void)
{
- fd = SAFE_OPEN(TEST_FILE, O_RDWR | O_CREAT, 0644);
+ fd = SAFE_OPEN(TEST_FILE, O_RDWR | O_CREAT);
SAFE_PIPE(pipes);
SAFE_WRITE(1, pipes[1], STR, sizeof(STR) - 1);
}
diff --git a/testcases/kernel/syscalls/tgkill/tgkill01.c b/testcases/kernel/syscalls/tgkill/tgkill01.c
index 37a4a331d..075bf4882 100644
--- a/testcases/kernel/syscalls/tgkill/tgkill01.c
+++ b/testcases/kernel/syscalls/tgkill/tgkill01.c
@@ -120,11 +120,13 @@ static void setup(void)
start_thread(&threads[i]);
}
+static struct tst_option options[] = {
+ {"t:", &str_threads, "-t Number of threads (default 10)"},
+ {NULL, NULL, NULL},
+};
+
static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"t:", &str_threads, "-t Number of threads (default 10)"},
- {}
- },
+ .options = options,
.needs_checkpoints = 1,
.setup = setup,
.test_all = run,
diff --git a/testcases/kernel/syscalls/tgkill/tgkill03.c b/testcases/kernel/syscalls/tgkill/tgkill03.c
index 0002f3278..593a21726 100644
--- a/testcases/kernel/syscalls/tgkill/tgkill03.c
+++ b/testcases/kernel/syscalls/tgkill/tgkill03.c
@@ -14,8 +14,6 @@
#include "tst_test.h"
#include "tgkill.h"
-#define CHECK_ENOENT(x) ((x) == -1 && errno == ENOENT)
-
static pthread_t child_thread;
static pid_t parent_tgid;
@@ -46,7 +44,6 @@ static void setup(void)
sigset_t sigusr1;
pthread_t defunct_thread;
char defunct_tid_path[PATH_MAX];
- int ret;
sigemptyset(&sigusr1);
sigaddset(&sigusr1, SIGUSR1);
@@ -62,10 +59,7 @@ static void setup(void)
SAFE_PTHREAD_CREATE(&defunct_thread, NULL, defunct_thread_func, NULL);
SAFE_PTHREAD_JOIN(defunct_thread, NULL);
sprintf(defunct_tid_path, "/proc/%d/task/%d", getpid(), defunct_tid);
- ret = TST_RETRY_FN_EXP_BACKOFF(access(defunct_tid_path, R_OK),
- CHECK_ENOENT, 15);
- if (!CHECK_ENOENT(ret))
- tst_brk(TBROK, "Timeout, %s still exists", defunct_tid_path);
+ TST_RETRY_FN_EXP_BACKOFF(access(defunct_tid_path, R_OK), -1, 15);
}
static void cleanup(void)
diff --git a/testcases/kernel/syscalls/time/.gitignore b/testcases/kernel/syscalls/time/.gitignore
index e422fac77..01da407ae 100644
--- a/testcases/kernel/syscalls/time/.gitignore
+++ b/testcases/kernel/syscalls/time/.gitignore
@@ -1 +1,2 @@
/time01
+/time02
diff --git a/testcases/kernel/syscalls/time/Makefile b/testcases/kernel/syscalls/time/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/time/Makefile
+++ b/testcases/kernel/syscalls/time/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/time/time01.c b/testcases/kernel/syscalls/time/time01.c
index d8625c04d..616a21fa8 100644
--- a/testcases/kernel/syscalls/time/time01.c
+++ b/testcases/kernel/syscalls/time/time01.c
@@ -1,50 +1,173 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
+/* $Id: time01.c,v 1.6 2009/11/02 13:57:19 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : time01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for time(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) time(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the time(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * time(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-/*\
- * [Description]
- * - Basic test for the time(2) system call. It is intended to provide a
- * limited exposure of the system call.
- * - Verify that time(2) returns the value of time in seconds since the Epoch
- * and stores this value in the memory pointed to by the parameter.
- */
-
-#include <time.h>
#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include <time.h>
+#include "test.h"
-#include "tst_test.h"
+void setup();
+void cleanup();
-time_t tlocal;
-time_t *targs[] = {
- NULL, &tlocal,
-};
+char *TCID = "time01";
+int TST_TOTAL = 1;
-static void verify_time(unsigned int i)
+int main(int ac, char **av)
{
- time_t *tloc = targs[i];
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
- TEST(time(tloc));
+ /*
+ * Call time(2)
+ */
+ TEST(time(0));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "time()");
- return;
+ /* check return code */
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "time(0) Failed, errno=%d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ tst_resm(TPASS, "time(0) returned %ld",
+ TEST_RETURN);
+ }
}
- if (!tloc)
- tst_res(TPASS, "time() returned value %ld", TST_RET);
- else if (*tloc == TST_RET)
- tst_res(TPASS,
- "time() returned value %ld, stored value %jd are same",
- TST_RET, (intmax_t) *tloc);
- else
- tst_res(TFAIL,
- "time() returned value %ld, stored value %jd are different",
- TST_RET, (intmax_t) *tloc);
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .test = verify_time,
- .tcnt = ARRAY_SIZE(targs),
-};
+/***************************************************************
+ * setup() - performs all ONE TIME setup for this test.
+ ***************************************************************/
+void setup(void)
+{
+ void trapper();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/***************************************************************
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ ***************************************************************/
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/time/time02.c b/testcases/kernel/syscalls/time/time02.c
new file mode 100644
index 000000000..137a3fda4
--- /dev/null
+++ b/testcases/kernel/syscalls/time/time02.c
@@ -0,0 +1,147 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Test Name: time02
+ *
+ * Test Description:
+ * Verify that time(2) returns the value of time in seconds since
+ * the Epoch and stores this value in the memory pointed to by the parameter.
+ *
+ * Expected Result:
+ * time() should return the time (seconds) since the Epoch and this value
+ * should be equal to the value stored in the specified parameter.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ * Usage: <for command-line>
+ * time02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions:
+ * None.
+ *
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/types.h>
+#include <stdint.h>
+
+#include "test.h"
+
+void setup(); /* setup function for the test */
+void cleanup(); /* cleanup function for the test */
+
+char *TCID = "time02";
+int TST_TOTAL = 1;
+
+int main(int ac, char **av)
+{
+ int lc;
+ time_t tloc; /* time_t variables for time(2) */
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ /*
+ * Call time() to get the time in seconds$
+ * since Epoch.
+ */
+ TEST(time(&tloc));
+
+ /* Check return code from time(2) */
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "time(0) Failed, errno=%d : %s",
+ TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ if (tloc == TEST_RETURN) {
+ tst_resm(TPASS, "time() returned value "
+ "%ld, stored value %jd are same",
+ TEST_RETURN, (intmax_t) tloc);
+ } else {
+ tst_resm(TFAIL, "time() returned value "
+ "%ld, stored value %jd are "
+ "different", TEST_RETURN,
+ (intmax_t) tloc);
+ }
+
+ }
+ tst_count++; /* incr. TEST_LOOP counter */
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * setup() - performs all ONE TIME setup for this test.
+ */
+void setup(void)
+{
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/timer_create/Makefile b/testcases/kernel/syscalls/timer_create/Makefile
index ada241fe1..8de247075 100644
--- a/testcases/kernel/syscalls/timer_create/Makefile
+++ b/testcases/kernel/syscalls/timer_create/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/timer_delete/Makefile b/testcases/kernel/syscalls/timer_delete/Makefile
index bc0c141be..173ce50c2 100644
--- a/testcases/kernel/syscalls/timer_delete/Makefile
+++ b/testcases/kernel/syscalls/timer_delete/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/timer_delete/timer_delete01.c b/testcases/kernel/syscalls/timer_delete/timer_delete01.c
index 6e5fc9940..962eb5670 100644
--- a/testcases/kernel/syscalls/timer_delete/timer_delete01.c
+++ b/testcases/kernel/syscalls/timer_delete/timer_delete01.c
@@ -12,9 +12,6 @@
*
* Creates a timer for each available clock and then tries
* to delete them again.
- *
- * This is also regression test for commit:
- * f18ddc13af98 ("alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP")
*/
#include <errno.h>
@@ -63,8 +60,4 @@ static void run(void)
static struct tst_test test = {
.test_all = run,
.needs_root = 1,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "f18ddc13af98"},
- {}
- }
};
diff --git a/testcases/kernel/syscalls/timer_getoverrun/Makefile b/testcases/kernel/syscalls/timer_getoverrun/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/timer_getoverrun/Makefile
+++ b/testcases/kernel/syscalls/timer_getoverrun/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c b/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
index ec5588410..2bb38ea7a 100644
--- a/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
+++ b/testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c
@@ -60,7 +60,7 @@ int main(int ac, char **av)
TEST(ltp_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer));
if (TEST_RETURN != 0)
- tst_brkm(TBROK | TTERRNO, cleanup, "Failed to create timer");
+ tst_brkm(TBROK | TERRNO, cleanup, "Failed to create timer");
for (lc = 0; TEST_LOOPING(lc); ++lc) {
tst_count = 0;
@@ -70,7 +70,7 @@ int main(int ac, char **av)
tst_resm(TPASS,
"timer_getoverrun(CLOCK_REALTIME) Passed");
} else {
- tst_resm(TFAIL | TTERRNO,
+ tst_resm(TFAIL | TERRNO,
"timer_getoverrun(CLOCK_REALTIME) Failed");
}
@@ -78,7 +78,7 @@ int main(int ac, char **av)
if (TEST_RETURN == -1 && TEST_ERRNO == EINVAL) {
tst_resm(TPASS, "timer_gettime(-1) Failed: EINVAL");
} else {
- tst_resm(TFAIL | TTERRNO,
+ tst_resm(TFAIL | TERRNO,
"timer_gettime(-1) = %li", TEST_RETURN);
}
}
diff --git a/testcases/kernel/syscalls/timer_gettime/Makefile b/testcases/kernel/syscalls/timer_gettime/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/timer_gettime/Makefile
+++ b/testcases/kernel/syscalls/timer_gettime/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c b/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
index 7ac835462..1c75f1cf0 100644
--- a/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
+++ b/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
@@ -1,10 +1,24 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Crackerjack Project., 2007
- * Porting from Crackerjack to LTP is done by:
- * Manas Kumar Nayak <maknayak@in.ibm.com>
- * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
- */
+/******************************************************************************
+ * Copyright (c) Crackerjack Project., 2007 *
+ * Porting from Crackerjack to LTP is done by: *
+ * Manas Kumar Nayak <maknayak@in.ibm.com> *
+ * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
+ * the GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation, *
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ ******************************************************************************/
#include <time.h>
#include <signal.h>
@@ -12,73 +26,71 @@
#include <stdio.h>
#include <errno.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
+#include "test.h"
+#include "lapi/syscalls.h"
-static struct time64_variants variants[] = {
-#if (__NR_timer_gettime != __LTP__NR_INVALID_SYSCALL)
- { .timer_gettime = sys_timer_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+char *TCID = "timer_gettime01";
+int TST_TOTAL = 3;
-#if (__NR_timer_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .timer_gettime = sys_timer_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static kernel_timer_t timer;
+static void cleanup(void)
+{
+ tst_rmdir();
+}
static void setup(void)
{
+ TEST_PAUSE;
+ tst_tmpdir();
+}
+
+int main(int ac, char **av)
+{
+ int lc;
+
struct sigevent ev;
+ struct itimerspec spec;
+ int timer;
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
ev.sigev_value = (union sigval) 0;
ev.sigev_signo = SIGALRM;
ev.sigev_notify = SIGEV_SIGNAL;
+ TEST(ltp_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer));
- TEST(tst_syscall(__NR_timer_create, CLOCK_REALTIME, &ev, &timer));
+ if (TEST_RETURN != 0)
+ tst_brkm(TBROK | TERRNO, cleanup, "Failed to create timer");
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "timer_create() failed");
- return;
- }
-}
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
-static void verify(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct tst_its spec = {.type = tv->ts_type, };
-
- TEST(tv->timer_gettime(timer, tst_its_get(&spec)));
- if (TST_RET == 0) {
- if (tst_its_get_interval_sec(spec) ||
- tst_its_get_interval_nsec(spec) ||
- tst_its_get_value_sec(spec) ||
- tst_its_get_value_nsec(spec))
- tst_res(TFAIL, "timespec should have been zeroed");
- else
- tst_res(TPASS, "timer_gettime() Passed");
- } else {
- tst_res(TFAIL | TTERRNO, "timer_gettime() Failed");
+ TEST(ltp_syscall(__NR_timer_gettime, timer, &spec));
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "timer_gettime(CLOCK_REALTIME) Passed");
+ } else {
+ tst_resm(TFAIL | TERRNO,
+ "timer_gettime(CLOCK_REALTIME) Failed");
+ }
+
+ TEST(ltp_syscall(__NR_timer_gettime, -1, &spec));
+ if (TEST_RETURN == -1 && TEST_ERRNO == EINVAL) {
+ tst_resm(TPASS, "timer_gettime(-1) Failed: EINVAL");
+ } else {
+ tst_resm(TFAIL | TERRNO,
+ "timer_gettime(-1) = %li", TEST_RETURN);
+ }
+
+ TEST(ltp_syscall(__NR_timer_gettime, timer, NULL));
+ if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT) {
+ tst_resm(TPASS, "timer_gettime(NULL) Failed: EFAULT");
+ } else {
+ tst_resm(TFAIL | TERRNO,
+ "timer_gettime(-1) = %li", TEST_RETURN);
+ }
}
- TEST(tv->timer_gettime((kernel_timer_t)-1, tst_its_get(&spec)));
- if (TST_RET == -1 && TST_ERR == EINVAL)
- tst_res(TPASS, "timer_gettime(-1) Failed: EINVAL");
- else
- tst_res(TFAIL | TTERRNO, "timer_gettime(-1) = %li", TST_RET);
-
- TEST(tv->timer_gettime(timer, NULL));
- if (TST_RET == -1 && TST_ERR == EFAULT)
- tst_res(TPASS, "timer_gettime(NULL) Failed: EFAULT");
- else
- tst_res(TFAIL | TTERRNO, "timer_gettime(-1) = %li", TST_RET);
+ cleanup();
+ tst_exit();
}
-
-static struct tst_test test = {
- .test_all = verify,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_tmpdir = 1,
-};
diff --git a/testcases/kernel/syscalls/timer_settime/.gitignore b/testcases/kernel/syscalls/timer_settime/.gitignore
index 2541a5b57..e1ed3ef17 100644
--- a/testcases/kernel/syscalls/timer_settime/.gitignore
+++ b/testcases/kernel/syscalls/timer_settime/.gitignore
@@ -1,3 +1,2 @@
/timer_settime01
/timer_settime02
-/timer_settime03
diff --git a/testcases/kernel/syscalls/timer_settime/Makefile b/testcases/kernel/syscalls/timer_settime/Makefile
index ad1900a54..8f6ad334d 100644
--- a/testcases/kernel/syscalls/timer_settime/Makefile
+++ b/testcases/kernel/syscalls/timer_settime/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime01.c b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
index 599ef2891..7bf00f527 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime01.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
@@ -10,88 +10,42 @@
/*
* This tests the timer_settime(2) syscall under various conditions:
*
- * 1) General initialization: No old_value, no flags
+ * 1) General initialization: No old_value, no flags, 5-second-timer
* 2) Setting a pointer to a itimerspec struct as old_set parameter
* 3) Using a periodic timer
* 4) Using absolute time
*
* All of these tests are supposed to be successful.
- *
- * This is also regression test for commit:
- * f18ddc13af98 ("alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP")
- * e86fea764991 ("alarmtimer: Return relative times in timer_gettime")
*/
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <signal.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
+#include "tst_test.h"
+#include "lapi/common_timers.h"
-static struct tst_ts timenow;
-static struct tst_its new_set, old_set;
+static struct timespec timenow;
+static struct itimerspec new_set, old_set;
static kernel_timer_t timer;
static struct testcase {
- struct tst_its *old_ptr;
- int it_value_tv_usec;
- int it_interval_tv_usec;
+ struct itimerspec *old_ptr;
+ int it_value_tv_sec;
+ int it_interval_tv_sec;
int flag;
char *description;
} tcases[] = {
- {NULL, 50000, 0, 0, "general initialization"},
- {&old_set, 50000, 0, 0, "setting old_value"},
- {&old_set, 50000, 50000, 0, "using periodic timer"},
- {&old_set, 50000, 0, TIMER_ABSTIME, "using absolute time"},
-};
-
-static struct time64_variants variants[] = {
-#if (__NR_timer_settime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .timer_gettime = sys_timer_gettime, .timer_settime = sys_timer_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_timer_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .timer_gettime = sys_timer_gettime64, .timer_settime = sys_timer_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
+ {NULL, 5, 0, 0, "general initialization"},
+ {&old_set, 5, 0, 0, "setting old_value"},
+ {&old_set, 0, 5, 0, "using periodic timer"},
+ {&old_set, 5, 0, TIMER_ABSTIME, "using absolute time"},
};
-static volatile int caught_signal;
-
-static void clear_signal(void)
-{
- /*
- * The busy loop is intentional. The signal is sent after X
- * seconds of CPU time has been accumulated for the process and
- * thread specific clocks.
- */
- while (!caught_signal);
-
- if (caught_signal != SIGALRM) {
- tst_res(TFAIL, "Received incorrect signal: %s",
- tst_strsig(caught_signal));
- }
-
- caught_signal = 0;
-}
-
-static void sighandler(int sig)
-{
- caught_signal = sig;
-}
-
-static void setup(void)
-{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
- SAFE_SIGNAL(SIGALRM, sighandler);
-}
-
static void run(unsigned int n)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct testcase *tc = &tcases[n];
- long long val;
unsigned int i;
+ struct testcase *tc = &tcases[n];
tst_res(TINFO, "Testing for %s:", tc->description);
@@ -121,71 +75,50 @@ static void run(unsigned int n)
memset(&new_set, 0, sizeof(new_set));
memset(&old_set, 0, sizeof(old_set));
- new_set.type = old_set.type = tv->ts_type;
- val = tc->it_value_tv_usec;
+ new_set.it_value.tv_sec = tc->it_value_tv_sec;
+ new_set.it_interval.tv_sec = tc->it_interval_tv_sec;
if (tc->flag & TIMER_ABSTIME) {
- timenow.type = tv->ts_type;
- if (tv->clock_gettime(clock, tst_ts_get(&timenow)) < 0) {
+ if (clock_gettime(clock, &timenow) < 0) {
tst_res(TFAIL,
"clock_gettime(%s) failed - skipping the test",
get_clock_str(clock));
continue;
}
- tst_ts_add_us(timenow, val);
- tst_its_set_value_from_ts(&new_set, timenow);
- } else {
- tst_its_set_value_from_us(&new_set, val);
+ new_set.it_value.tv_sec += timenow.tv_sec;
}
- tst_its_set_interval_from_us(&new_set, tc->it_interval_tv_usec);
-
- TEST(tv->timer_settime(timer, tc->flag, tst_its_get(&new_set), tst_its_get(tc->old_ptr)));
-
- if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO, "timer_settime(%s) failed",
- get_clock_str(clock));
- }
+ TEST(tst_syscall(__NR_timer_settime, timer,
+ tc->flag, &new_set, tc->old_ptr));
- TEST(tv->timer_gettime(timer, tst_its_get(&new_set)));
if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO, "timer_gettime(%s) failed",
- get_clock_str(clock));
- } else if ((tst_its_get_interval_nsec(new_set) !=
- tc->it_interval_tv_usec * 1000) ||
- (tst_its_get_value_nsec(new_set) >
- MAX(tc->it_value_tv_usec * 1000, tc->it_interval_tv_usec * 1000))) {
- tst_res(TFAIL | TTERRNO,
- "timer_gettime(%s) reported bad values (%llu: %llu)",
- get_clock_str(clock),
- tst_its_get_interval_nsec(new_set),
- tst_its_get_value_nsec(new_set));
+ tst_res(TFAIL | TTERRNO, "%s failed",
+ get_clock_str(clock));
+ } else {
+ tst_res(TPASS, "%s was successful",
+ get_clock_str(clock));
}
- clear_signal();
-
- /* Wait for another event when interval was set */
- if (tc->it_interval_tv_usec)
- clear_signal();
-
- tst_res(TPASS, "timer_settime(%s) passed",
- get_clock_str(clock));
-
TEST(tst_syscall(__NR_timer_delete, timer));
if (TST_RET != 0)
tst_res(TFAIL | TTERRNO, "timer_delete() failed!");
}
}
+static void sighandler(int sig)
+{
+ /* sighandler for CLOCK_*_ALARM */
+ tst_res(TINFO, "Caught signal %s", tst_strsig(sig));
+}
+
+static void setup(void)
+{
+ SAFE_SIGNAL(SIGALRM, sighandler);
+}
+
static struct tst_test test = {
.test = run,
.needs_root = 1,
.tcnt = ARRAY_SIZE(tcases),
- .test_variants = ARRAY_SIZE(variants),
.setup = setup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "f18ddc13af98"},
- {"linux-git", "e86fea764991"},
- {}
- }
};
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime02.c b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
index 564f1c2ce..74cb33d73 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime02.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
@@ -18,21 +18,16 @@
* 4) Passing an invalid timer -> EINVAL
* 5) Passing an invalid address for new_value -> EFAULT
* 6) Passing an invalid address for old_value -> EFAULT
- *
- * This is also regression test for commit:
- * f18ddc13af98 ("alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP")
*/
#include <errno.h>
#include <time.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
+#include "tst_test.h"
+#include "lapi/common_timers.h"
-static struct tst_its new_set, old_set;
-static struct tst_its *pnew_set = &new_set, *pold_set = &old_set, *null_set = NULL;
-static void *faulty_set;
+static struct itimerspec new_set, old_set;
static kernel_timer_t timer;
-static kernel_timer_t timer_inval = (kernel_timer_t)-1;
+static kernel_timer_t timer_inval = -1;
/* separate description-array to (hopefully) improve readability */
static const char * const descriptions[] = {
@@ -46,41 +41,23 @@ static const char * const descriptions[] = {
static struct testcase {
kernel_timer_t *timer_id;
- struct tst_its **new_ptr;
- struct tst_its **old_ptr;
+ struct itimerspec *new_ptr;
+ struct itimerspec *old_ptr;
int it_value_tv_nsec;
int error;
} tcases[] = {
- {&timer, &null_set, &pold_set, 0, EINVAL},
- {&timer, &pnew_set, &pold_set, -1, EINVAL},
- {&timer, &pnew_set, &pold_set, NSEC_PER_SEC + 1, EINVAL},
- {&timer_inval, &pnew_set, &pold_set, 0, EINVAL},
- {&timer, (struct tst_its **)&faulty_set, &pold_set, 0, EFAULT},
- {&timer, &pnew_set, (struct tst_its **)&faulty_set, 0, EFAULT},
-};
-
-static struct time64_variants variants[] = {
-#if (__NR_timer_settime != __LTP__NR_INVALID_SYSCALL)
- { .timer_settime = sys_timer_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_timer_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .timer_settime = sys_timer_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
+ {&timer, NULL, &old_set, 0, EINVAL},
+ {&timer, &new_set, &old_set, -1, EINVAL},
+ {&timer, &new_set, &old_set, NSEC_PER_SEC + 1, EINVAL},
+ {&timer_inval, &new_set, &old_set, 0, EINVAL},
+ {&timer, (struct itimerspec *) -1, &old_set, 0, EFAULT},
+ {&timer, &new_set, (struct itimerspec *) -1, 0, EFAULT},
};
-static void setup(void)
-{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
- faulty_set = tst_get_bad_addr(NULL);
-}
-
static void run(unsigned int n)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct testcase *tc = &tcases[n];
- void *new, *old;
unsigned int i;
+ struct testcase *tc = &tcases[n];
tst_res(TINFO, "Testing for %s:", descriptions[n]);
@@ -111,16 +88,11 @@ static void run(unsigned int n)
memset(&new_set, 0, sizeof(new_set));
memset(&old_set, 0, sizeof(old_set));
- new_set.type = old_set.type = tv->ts_type;
- tst_its_set_interval_sec(&new_set, 0);
- tst_its_set_interval_nsec(&new_set, 0);
- tst_its_set_value_sec(&new_set, 5);
- tst_its_set_value_nsec(&new_set, tc->it_value_tv_nsec);
+ new_set.it_value.tv_sec = 5;
+ new_set.it_value.tv_nsec = tc->it_value_tv_nsec;
- new = (tc->new_ptr == (struct tst_its **)&faulty_set) ? faulty_set : tst_its_get(*tc->new_ptr);
- old = (tc->old_ptr == (struct tst_its **)&faulty_set) ? faulty_set : tst_its_get(*tc->old_ptr);
-
- TEST(tv->timer_settime(*tc->timer_id, 0, new, old));
+ TEST(tst_syscall(__NR_timer_settime, *tc->timer_id,
+ 0, tc->new_ptr, tc->old_ptr));
if (tc->error != TST_ERR) {
tst_res(TFAIL | TTERRNO,
@@ -144,10 +116,4 @@ static struct tst_test test = {
.test = run,
.needs_root = 1,
.tcnt = ARRAY_SIZE(tcases),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "f18ddc13af98"},
- {}
- }
};
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime03.c b/testcases/kernel/syscalls/timer_settime/timer_settime03.c
deleted file mode 100644
index 4597bf74e..000000000
--- a/testcases/kernel/syscalls/timer_settime/timer_settime03.c
+++ /dev/null
@@ -1,127 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*
- * CVE 2018-12896
- *
- * Check for possible overflow of posix timer overrun counter. Create
- * a CLOCK_REALTIME timer, set extremely low timer interval and expiration
- * value just right to cause overrun overflow into negative values, start
- * the timer with TIMER_ABSTIME flag to cause overruns immediately. Then just
- * check the overrun counter in the timer signal handler. On a patched system,
- * the value returned by timer_getoverrun() should be capped at INT_MAX and
- * not allowed to overflow into negative range. Bug fixed in:
- *
- * commit 78c9c4dfbf8c04883941445a195276bb4bb92c76
- * Author: Thomas Gleixner <tglx@linutronix.de>
- * Date: Tue Jun 26 15:21:32 2018 +0200
- *
- * posix-timers: Sanitize overrun handling
- */
-
-#include <unistd.h>
-#include <signal.h>
-#include <time.h>
-#include <limits.h>
-
-#include "tst_test.h"
-#include "tst_safe_clocks.h"
-
-static timer_t timer;
-static volatile int handler_called, overrun, saved_errno;
-
-static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
-{
- struct itimerspec spec;
-
- /*
- * Signal handler will be called twice in total because kernel will
- * schedule another pending signal before the timer gets disabled.
- */
- if (handler_called)
- return;
-
- errno = 0;
- overrun = timer_getoverrun(timer);
- saved_errno = errno;
- memset(&spec, 0, sizeof(struct itimerspec));
- SAFE_TIMER_SETTIME(timer, 0, &spec, NULL);
- handler_called = 1;
-}
-
-static void setup(void)
-{
- struct sigevent sev;
-
- memset(&sev, 0, sizeof(struct sigevent));
- sev.sigev_notify = SIGEV_SIGNAL;
- sev.sigev_signo = SIGUSR1;
-
- SAFE_SIGNAL(SIGUSR1, sighandler);
- SAFE_TIMER_CREATE(CLOCK_REALTIME, &sev, &timer);
-}
-
-static void run(void)
-{
- int handler_delay = INT_MAX / 7;
- long nsec;
- struct itimerspec spec;
-
- handler_called = 0;
- memset(&spec, 0, sizeof(struct itimerspec));
- SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &spec.it_value);
- nsec = (handler_delay % 100000000) * 10L;
-
- if (nsec > spec.it_value.tv_nsec) {
- spec.it_value.tv_sec -= 1;
- spec.it_value.tv_nsec += 1000000000;
- }
-
- /* spec.it_value = now - 1.4 * max overrun value */
- /* IOW, overflow will land right in the middle of negative range */
- spec.it_value.tv_sec -= handler_delay / 100000000;
- spec.it_value.tv_nsec -= nsec;
- spec.it_interval.tv_nsec = 1;
-
- SAFE_TIMER_SETTIME(timer, TIMER_ABSTIME, &spec, NULL);
- while (!handler_called);
- errno = saved_errno;
-
- if (overrun == -1)
- tst_brk(TBROK | TERRNO, "Error reading timer overrun count");
-
- if (overrun == INT_MAX) {
- tst_res(TPASS, "Timer overrun count is capped");
- return;
- }
-
- if (overrun < 0) {
- tst_res(TFAIL, "Timer overrun counter overflow");
- return;
- }
-
- tst_res(TFAIL, "Timer overrun counter is wrong: %d; expected %d or "
- "negative number", overrun, INT_MAX);
-}
-
-static void cleanup(void)
-{
- SAFE_TIMER_DELETE(timer);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .setup = setup,
- .cleanup = cleanup,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_HIGH_RES_TIMERS=y",
- NULL
- },
- .tags = (const struct tst_tag[]) {
- {"linux-git", "78c9c4dfbf8c"},
- {"CVE", "2018-12896"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/timerfd/.gitignore b/testcases/kernel/syscalls/timerfd/.gitignore
index ef388685d..e5c819ced 100644
--- a/testcases/kernel/syscalls/timerfd/.gitignore
+++ b/testcases/kernel/syscalls/timerfd/.gitignore
@@ -1,8 +1,6 @@
/timerfd01
/timerfd02
/timerfd03
-/timerfd04
/timerfd_create01
/timerfd_gettime01
/timerfd_settime01
-/timerfd_settime02
diff --git a/testcases/kernel/syscalls/timerfd/Makefile b/testcases/kernel/syscalls/timerfd/Makefile
index 22b2d40fc..3691a8c36 100644
--- a/testcases/kernel/syscalls/timerfd/Makefile
+++ b/testcases/kernel/syscalls/timerfd/Makefile
@@ -1,11 +1,25 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-LDLIBS += -lrt
-timerfd_settime02: LDLIBS += -pthread
+LDLIBS += -lpthread -lrt
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/timerfd/timerfd01.c b/testcases/kernel/syscalls/timerfd/timerfd01.c
index 9f5694217..868fbe271 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd01.c
@@ -1,162 +1,282 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* timerfd() test by Davide Libenzi (test app for timerfd)
* Copyright (C) 2007 Davide Libenzi
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
* Davide Libenzi <davidel@xmailserver.org>
*
- * Description:
- * Test timerfd with the flags:
- * 1) CLOCK_MONOTONIC
- * 2) CLOCK_REALTIME
*
+ * $ gcc -o timerfd-test2 timerfd-test2.c -lrt
+ *
+ * NAME
+ * timerfd01.c
* HISTORY
- * 28/05/2008 Initial contribution by Davide Libenzi <davidel@xmailserver.org>
- * 28/05/2008 Integrated to LTP by Subrata Modak <subrata@linux.vnet.ibm.com>
+ * 28/05/2008 Initial contribution by Davide Libenzi <davidel@xmailserver.org>
+ * 28/05/2008 Integrated to LTP by Subrata Modak <subrata@linux.vnet.ibm.com>
*/
#define _GNU_SOURCE
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <sys/time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
#include <poll.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
-#include "tst_safe_timerfd.h"
+#include <fcntl.h>
+#include <time.h>
+#include <errno.h>
+#include "test.h"
+#include "lapi/syscalls.h"
-static struct tcase {
- int id;
- char const *name;
-} tcases[] = {
- {CLOCK_MONOTONIC, "CLOCK MONOTONIC"},
- {CLOCK_REALTIME, "CLOCK REALTIME"},
-};
+#define cleanup tst_exit
-static struct time64_variants variants[] = {
-#if (__NR_timerfd_gettime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .tfd_gettime = sys_timerfd_gettime, .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+char *TCID = "timerfd01";
-#if (__NR_timerfd_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .tfd_gettime = sys_timerfd_gettime64, .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
+/*
+ * This were good at the time of 2.6.23-rc7 ...
+ *
+ * #ifdef __NR_timerfd
+ *
+ * ... but is not now with 2.6.25
+ */
+#ifdef __NR_timerfd_create
+
+/* Definitions from include/linux/timerfd.h */
+#define TFD_TIMER_ABSTIME (1 << 0)
+
+struct tmr_type {
+ int id;
+ char const *name;
};
-static unsigned long long getustime(int clockid)
+unsigned long long getustime(int clockid)
{
- struct time64_variants *tv = &variants[tst_variant];
- struct tst_ts tp = {.type = tv->ts_type, };
+ struct timespec tp;
- if (tv->clock_gettime((clockid_t) clockid, tst_ts_get(&tp))) {
- tst_res(TFAIL | TERRNO, "clock_gettime() failed");
+ if (clock_gettime((clockid_t) clockid, &tp)) {
+ perror("clock_gettime");
return 0;
}
- return 1000000ULL * tst_ts_get_sec(tp) + tst_ts_get_nsec(tp) / 1000;
+ return 1000000ULL * tp.tv_sec + tp.tv_nsec / 1000;
+}
+
+void set_timespec(struct timespec *tmr, unsigned long long ustime)
+{
+
+ tmr->tv_sec = (time_t) (ustime / 1000000ULL);
+ tmr->tv_nsec = (long)(1000ULL * (ustime % 1000000ULL));
}
-static void settime(int tfd, struct tst_its *tmr, int tflags,
- unsigned long long tvalue, int tinterval)
+int timerfd_create(int clockid, int flags)
{
- struct time64_variants *tv = &variants[tst_variant];
- tst_its_set_value_from_us(tmr, tvalue);
- tst_its_set_interval_from_us(tmr, tinterval);
+ return ltp_syscall(__NR_timerfd_create, clockid, flags);
+}
+
+int timerfd_settime(int ufc, int flags, const struct itimerspec *utmr,
+ struct itimerspec *otmr)
+{
- if (tv->tfd_settime(tfd, tflags, tst_its_get(tmr), NULL))
- tst_res(TFAIL | TERRNO, "timerfd_settime() failed");
+ return ltp_syscall(__NR_timerfd_settime, ufc, flags, utmr, otmr);
}
-static void waittmr(int tfd, unsigned int exp_ticks)
+int timerfd_gettime(int ufc, struct itimerspec *otmr)
{
- uint64_t ticks;
+
+ return ltp_syscall(__NR_timerfd_gettime, ufc, otmr);
+}
+
+long waittmr(int tfd, int timeo)
+{
+ u_int64_t ticks;
struct pollfd pfd;
pfd.fd = tfd;
pfd.events = POLLIN;
pfd.revents = 0;
- if (poll(&pfd, 1, -1) < 0) {
- tst_res(TFAIL | TERRNO, "poll() failed");
- return;
+ if (poll(&pfd, 1, timeo) < 0) {
+ perror("poll");
+ return -1;
}
if ((pfd.revents & POLLIN) == 0) {
- tst_res(TFAIL, "no ticks happened");
- return;
+ fprintf(stdout, "no ticks happened\n");
+ return -1;
}
- SAFE_READ(0, tfd, &ticks, sizeof(ticks));
-
- if (ticks != exp_ticks) {
- tst_res(TFAIL, "got %u tick(s) expected %u",
- (unsigned int)ticks, exp_ticks);
- } else {
- tst_res(TPASS, "got %u tick(s)", exp_ticks);
+ if (read(tfd, &ticks, sizeof(ticks)) != sizeof(ticks)) {
+ perror("timerfd read");
+ return -1;
}
+
+ return ticks;
}
-static void run(unsigned int n)
+int TST_TOTAL = 3;
+
+int main(int ac, char **av)
{
- struct time64_variants *tv = &variants[tst_variant];
int tfd;
- unsigned long long tnow;
- uint64_t uticks;
- struct tst_its tmr = {.type = tv->ts_type, };
- struct tcase *clks = &tcases[n];
+ unsigned int i;
+ long ticks;
+ unsigned long long tnow, ttmr;
+ u_int64_t uticks;
+ struct itimerspec tmr;
+ struct tmr_type clks[] = {
+ {CLOCK_MONOTONIC, "CLOCK MONOTONIC"},
+ {CLOCK_REALTIME, "CLOCK REALTIME"},
+ };
- tst_res(TINFO, "testing %s", clks->name);
+ tst_parse_opts(ac, av, NULL, NULL);
- tfd = SAFE_TIMERFD_CREATE(clks->id, 0);
+ if ((tst_kvercmp(2, 6, 25)) < 0) {
+ tst_resm(TCONF, "This test can only run on kernels that are ");
+ tst_resm(TCONF, "2.6.25 and higher");
+ exit(0);
+ }
- tst_res(TINFO, "relative timer (100 ms)");
- settime(tfd, &tmr, 0, 100 * 1000, 0);
- waittmr(tfd, 1);
+ for (i = 0; i < sizeof(clks) / sizeof(clks[0]); i++) {
+ fprintf(stdout,
+ "\n\n---------------------------------------\n");
+ fprintf(stdout, "| testing %s\n", clks[i].name);
+ fprintf(stdout, "---------------------------------------\n\n");
- tst_res(TINFO, "absolute timer (100 ms)");
- tnow = getustime(clks->id);
- settime(tfd, &tmr, TFD_TIMER_ABSTIME, tnow + 100 * 1000, 0);
- waittmr(tfd, 1);
+ fprintf(stdout, "relative timer test (at 500 ms) ...\n");
+ set_timespec(&tmr.it_value, 500 * 1000);
+ set_timespec(&tmr.it_interval, 0);
+ tnow = getustime(clks[i].id);
+ if ((tfd = timerfd_create(clks[i].id, 0)) == -1) {
+ perror("timerfd");
+ return 1;
+ }
+ fprintf(stdout, "timerfd = %d\n", tfd);
- tst_res(TINFO, "sequential timer (50 ms)");
- tnow = getustime(clks->id);
- settime(tfd, &tmr, TFD_TIMER_ABSTIME, tnow + 50 * 1000, 50 * 1000);
+ if (timerfd_settime(tfd, 0, &tmr, NULL)) {
+ perror("timerfd_settime");
+ return 1;
+ }
- memset(&tmr, 0, sizeof(tmr));
- tmr.type = tv->ts_type;
+ fprintf(stdout, "wating timer ...\n");
+ ticks = waittmr(tfd, -1);
+ ttmr = getustime(clks[i].id);
+ if (ticks <= 0)
+ fprintf(stdout, "whooops! no timer showed up!\n");
+ else
+ fprintf(stdout, "got timer ticks (%ld) after %llu ms\n",
+ ticks, (ttmr - tnow) / 1000);
- if (tv->tfd_gettime(tfd, tst_its_get(&tmr)))
- tst_res(TFAIL | TERRNO, "timerfd_gettime() failed");
+ fprintf(stdout, "absolute timer test (at 500 ms) ...\n");
+ tnow = getustime(clks[i].id);
+ set_timespec(&tmr.it_value, tnow + 500 * 1000);
+ set_timespec(&tmr.it_interval, 0);
+ if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &tmr, NULL)) {
+ perror("timerfd_settime");
+ return 1;
+ }
- if (tst_its_get_value_sec(tmr) != 0 || tst_its_get_value_nsec(tmr) > 50 * 1000000)
- tst_res(TFAIL, "Timer read back value not relative");
- else
- tst_res(TPASS, "Timer read back value is relative");
+ fprintf(stdout, "wating timer ...\n");
+ ticks = waittmr(tfd, -1);
+ ttmr = getustime(clks[i].id);
+ if (ticks <= 0)
+ fprintf(stdout, "whooops! no timer showed up!\n");
+ else
+ fprintf(stdout, "got timer ticks (%ld) after %llu ms\n",
+ ticks, (ttmr - tnow) / 1000);
- usleep(160000);
+ fprintf(stdout, "sequential timer test (100 ms clock) ...\n");
+ tnow = getustime(clks[i].id);
+ set_timespec(&tmr.it_value, tnow + 100 * 1000);
+ set_timespec(&tmr.it_interval, 100 * 1000);
+ if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &tmr, NULL)) {
+ perror("timerfd_settime");
+ return 1;
+ }
- waittmr(tfd, 3);
+ fprintf(stdout, "sleeping 1 second ...\n");
+ sleep(1);
+ if (timerfd_gettime(tfd, &tmr)) {
+ perror("timerfd_gettime");
+ return 1;
+ }
+ fprintf(stdout, "timerfd_gettime returned:\n"
+ "\tit_value = { %ld, %ld } it_interval = { %ld, %ld }\n",
+ (long)tmr.it_value.tv_sec, (long)tmr.it_value.tv_nsec,
+ (long)tmr.it_interval.tv_sec,
+ (long)tmr.it_interval.tv_nsec);
+ fprintf(stdout, "sleeping 1 second ...\n");
+ sleep(1);
- tst_res(TINFO, "testing with O_NONBLOCK");
- settime(tfd, &tmr, 0, 100 * 1000, 0);
- waittmr(tfd, 1);
+ fprintf(stdout, "wating timer ...\n");
+ ticks = waittmr(tfd, -1);
+ ttmr = getustime(clks[i].id);
+ if (ticks <= 0)
+ fprintf(stdout, "whooops! no timer showed up!\n");
+ else
+ fprintf(stdout, "got timer ticks (%ld) after %llu ms\n",
+ ticks, (ttmr - tnow) / 1000);
- SAFE_FCNTL(tfd, F_SETFL, fcntl(tfd, F_GETFL, 0) | O_NONBLOCK);
+ fprintf(stdout, "O_NONBLOCK test ...\n");
+ tnow = getustime(clks[i].id);
+ set_timespec(&tmr.it_value, 100 * 1000);
+ set_timespec(&tmr.it_interval, 0);
+ if (timerfd_settime(tfd, 0, &tmr, NULL)) {
+ perror("timerfd_settime");
+ return 1;
+ }
+ fprintf(stdout, "timerfd = %d\n", tfd);
- TEST(read(tfd, &uticks, sizeof(uticks)));
- if (TST_RET > 0)
- tst_res(TFAIL, "timer ticks not zero");
- else if (TST_ERR != EAGAIN)
- tst_res(TFAIL | TTERRNO, "read should fail with EAGAIN got");
- else
- tst_res(TPASS | TERRNO, "read failed with");
+ fprintf(stdout, "wating timer (flush the single tick) ...\n");
+ ticks = waittmr(tfd, -1);
+ ttmr = getustime(clks[i].id);
+ if (ticks <= 0)
+ fprintf(stdout, "whooops! no timer showed up!\n");
+ else
+ fprintf(stdout, "got timer ticks (%ld) after %llu ms\n",
+ ticks, (ttmr - tnow) / 1000);
- SAFE_CLOSE(tfd);
+ fcntl(tfd, F_SETFL, fcntl(tfd, F_GETFL, 0) | O_NONBLOCK);
+
+ if (read(tfd, &uticks, sizeof(uticks)) > 0)
+ fprintf(stdout,
+ "whooops! timer ticks not zero when should have been\n");
+ else if (errno != EAGAIN)
+ fprintf(stdout,
+ "whooops! bad errno value (%d = '%s')!\n",
+ errno, strerror(errno));
+ else
+ fprintf(stdout, "success\n");
+
+ fcntl(tfd, F_SETFL, fcntl(tfd, F_GETFL, 0) & ~O_NONBLOCK);
+
+ close(tfd);
+ }
+
+ tst_exit();
}
-static void setup(void)
+#else
+int TST_TOTAL = 0;
+
+int main(void)
{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tcases),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .min_kver = "2.6.25",
-};
+ tst_brkm(TCONF, NULL,
+ "This test needs a kernel that has timerfd syscall.");
+}
+#endif
diff --git a/testcases/kernel/syscalls/timerfd/timerfd04.c b/testcases/kernel/syscalls/timerfd/timerfd04.c
deleted file mode 100644
index 4af91d6f8..000000000
--- a/testcases/kernel/syscalls/timerfd/timerfd04.c
+++ /dev/null
@@ -1,132 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
-
- Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
-
- */
-/*
-
- Test that timerfd adds correctly an offset with absolute expiration time.
-
- After a call to unshare(CLONE_NEWTIME) a new timer namespace is created, the
- process that has called the unshare() can adjust offsets for CLOCK_MONOTONIC
- and CLOCK_BOOTTIME for its children by writing to the '/proc/self/timens_offsets'.
-
- */
-
-#include <stdlib.h>
-#include "time64_variants.h"
-#include "tst_safe_clocks.h"
-#include "tst_safe_timerfd.h"
-#include "tst_timer.h"
-#include "lapi/namespaces_constants.h"
-
-#define SLEEP_US 40000
-
-static struct tcase {
- int clk_id;
- int clk_off;
- int off;
-} tcases[] = {
- {CLOCK_MONOTONIC, CLOCK_MONOTONIC, 10},
- {CLOCK_BOOTTIME, CLOCK_BOOTTIME, 10},
-
- {CLOCK_MONOTONIC, CLOCK_MONOTONIC, -10},
- {CLOCK_BOOTTIME, CLOCK_BOOTTIME, -10},
-};
-
-static struct time64_variants variants[] = {
-#if (__NR_timerfd_settime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_timerfd_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
-{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
-}
-
-static void verify_timerfd(unsigned int n)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct tst_ts start, end;
- struct tst_its it;
- struct tcase *tc = &tcases[n];
-
- start.type = end.type = it.type = tv->ts_type;
- SAFE_UNSHARE(CLONE_NEWTIME);
-
- SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
- tc->clk_off, tc->off);
-
- if (tv->clock_gettime(tc->clk_id, tst_ts_get(&start))) {
- tst_res(TFAIL | TERRNO, "clock_gettime(2) failed for clock %s",
- tst_clock_name(tc->clk_id));
- return;
- }
-
- end = tst_ts_add_us(start, 1000000 * tc->off + SLEEP_US);
- tst_its_set_interval_sec(&it, 0);
- tst_its_set_interval_nsec(&it, 0);
- tst_its_set_value_from_ts(&it, end);
-
- if (!SAFE_FORK()) {
- uint64_t exp;
- int fd = SAFE_TIMERFD_CREATE(tc->clk_id, 0);
-
- if (tv->tfd_settime(fd, TFD_TIMER_ABSTIME, tst_its_get(&it), NULL)) {
- tst_res(TFAIL | TERRNO, "timerfd_settime() failed");
- return;
- }
-
- SAFE_READ(1, fd, &exp, sizeof(exp));
-
- if (exp != 1)
- tst_res(TFAIL, "Got %llu expirations", (long long unsigned)exp);
-
- SAFE_CLOSE(fd);
- exit(0);
- }
-
- SAFE_WAIT(NULL);
-
- if (tv->clock_gettime(CLOCK_MONOTONIC, tst_ts_get(&end))) {
- tst_res(TFAIL | TERRNO, "clock_gettime(2) failed for clock %s",
- tst_clock_name(CLOCK_MONOTONIC));
- return;
- }
-
- long long diff = tst_ts_diff_us(end, start);
-
- if (diff > 5 * SLEEP_US) {
- tst_res(TFAIL, "timerfd %s slept too long %lli",
- tst_clock_name(tc->clk_id), diff);
- return;
- }
-
- if (diff < SLEEP_US) {
- tst_res(TFAIL, "timerfd %s slept too short %lli",
- tst_clock_name(tc->clk_id), diff);
- return;
- }
-
- tst_res(TPASS, "timerfd %s slept correctly %lli",
- tst_clock_name(tc->clk_id), diff);
-}
-
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_timerfd,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_root = 1,
- .forks_child = 1,
- .needs_kconfigs = (const char *[]) {
- "CONFIG_TIME_NS=y",
- NULL
- }
-};
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c b/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c
index aba77c05d..5f3240bdc 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c
@@ -1,8 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Fujitsu Ltd.
* Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+/*
* DESCRIPTION
* Verify that,
* 1. fd is not a valid file descriptor, EBADF would return.
@@ -12,94 +24,99 @@
#define _GNU_SOURCE
-#include "time64_variants.h"
-#include "tst_timer.h"
-#include "tst_safe_timerfd.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "test.h"
+#include "safe_macros.h"
+#include "lapi/timerfd.h"
char *TCID = "timerfd_gettime01";
static int bad_clockfd = -1;
static int clockfd;
static int fd;
-static void *bad_addr;
static struct test_case_t {
int *fd;
- struct tst_its *curr_value;
+ struct itimerspec *curr_value;
int exp_errno;
} test_cases[] = {
{&bad_clockfd, NULL, EBADF},
- {&clockfd, NULL, EFAULT},
+ {&clockfd, (struct itimerspec *)-1, EFAULT},
{&fd, NULL, EINVAL},
};
-static struct time64_variants variants[] = {
-#if (__NR_timerfd_gettime != __LTP__NR_INVALID_SYSCALL)
- { .tfd_gettime = sys_timerfd_gettime, .desc = "syscall with old kernel spec"},
-#endif
+int TST_TOTAL = ARRAY_SIZE(test_cases);
+static void setup(void);
+static void timerfd_gettime_verify(const struct test_case_t *);
+static void cleanup(void);
-#if (__NR_timerfd_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .tfd_gettime = sys_timerfd_gettime64, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
+int main(int argc, char *argv[])
{
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
- bad_addr = tst_get_bad_addr(NULL);
+ int lc;
+ int i;
- clockfd = timerfd_create(CLOCK_REALTIME, 0);
- if (clockfd == -1) {
- tst_brk(TFAIL | TERRNO, "timerfd_create() fail");
- return;
+ tst_parse_opts(argc, argv, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ for (i = 0; i < TST_TOTAL; i++)
+ timerfd_gettime_verify(&test_cases[i]);
}
- fd = SAFE_OPEN("test_file", O_RDWR | O_CREAT, 0644);
+ cleanup();
+ tst_exit();
}
-static void cleanup(void)
+static void setup(void)
{
- if (clockfd > 0)
- close(clockfd);
+ if ((tst_kvercmp(2, 6, 25)) < 0)
+ tst_brkm(TCONF, NULL, "This test needs kernel 2.6.25 or newer");
- if (fd > 0)
- close(fd);
-}
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
-static void run(unsigned int n)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct test_case_t *test = &test_cases[n];
- void *its;
+ TEST_PAUSE;
- if (test->exp_errno == EFAULT)
- its = bad_addr;
- else
- its = tst_its_get(test->curr_value);
+ tst_tmpdir();
- TEST(tv->tfd_gettime(*test->fd, its));
+ clockfd = timerfd_create(CLOCK_REALTIME, 0);
+ if (clockfd == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "timerfd_create() fail");
+
+ fd = SAFE_OPEN(cleanup, "test_file", O_RDWR | O_CREAT, 0644);
+}
- if (TST_RET != -1) {
- tst_res(TFAIL, "timerfd_gettime() succeeded unexpectedly");
+static void timerfd_gettime_verify(const struct test_case_t *test)
+{
+ TEST(timerfd_gettime(*test->fd, test->curr_value));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "timerfd_gettime() succeeded unexpectedly");
return;
}
- if (TST_ERR == test->exp_errno) {
- tst_res(TPASS | TTERRNO,
- "timerfd_gettime() failed as expected");
+ if (TEST_ERRNO == test->exp_errno) {
+ tst_resm(TPASS | TTERRNO,
+ "timerfd_gettime() failed as expected");
} else {
- tst_res(TFAIL | TTERRNO,
- "timerfd_gettime() failed unexpectedly; expected: "
- "%d - %s", test->exp_errno, strerror(test->exp_errno));
+ tst_resm(TFAIL | TTERRNO,
+ "timerfd_gettime() failed unexpectedly; expected: "
+ "%d - %s", test->exp_errno, strerror(test->exp_errno));
}
}
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(test_cases),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .min_kver = "2.6.25",
-};
+static void cleanup(void)
+{
+ if (clockfd > 0)
+ close(clockfd);
+
+ if (fd > 0)
+ close(fd);
+
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
index 36577e2c4..2e65d23ae 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
@@ -1,8 +1,20 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Fujitsu Ltd.
* Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+/*
* DESCRIPTION
* Verify that,
* 1. fd is not a valid file descriptor, EBADF would return.
@@ -13,54 +25,94 @@
#define _GNU_SOURCE
-#include "time64_variants.h"
-#include "tst_timer.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "test.h"
+#include "safe_macros.h"
#include "lapi/timerfd.h"
+char *TCID = "timerfd_settime01";
+
static int bad_clockfd = -1;
static int clockfd;
static int fd;
-static void *bad_addr;
static struct test_case_t {
int *fd;
int flags;
- struct tst_its *old_value;
+ struct itimerspec *old_value;
int exp_errno;
} test_cases[] = {
{&bad_clockfd, 0, NULL, EBADF},
- {&clockfd, 0, NULL, EFAULT},
+ {&clockfd, 0, (struct itimerspec *)-1, EFAULT},
{&fd, 0, NULL, EINVAL},
{&clockfd, -1, NULL, EINVAL},
};
-static struct tst_its new_value;
+int TST_TOTAL = ARRAY_SIZE(test_cases);
+static void setup(void);
+static void timerfd_settime_verify(const struct test_case_t *);
+static void cleanup(void);
+static struct itimerspec new_value;
+
+int main(int argc, char *argv[])
+{
+ int lc;
+ int i;
-static struct time64_variants variants[] = {
-#if (__NR_timerfd_settime != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+ tst_parse_opts(argc, argv, NULL, NULL);
-#if (__NR_timerfd_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ for (i = 0; i < TST_TOTAL; i++)
+ timerfd_settime_verify(&test_cases[i]);
+ }
+
+ cleanup();
+ tst_exit();
+}
static void setup(void)
{
- struct time64_variants *tv = &variants[tst_variant];
+ if ((tst_kvercmp(2, 6, 25)) < 0)
+ tst_brkm(TCONF, NULL, "This test needs kernel 2.6.25 or newer");
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- bad_addr = tst_get_bad_addr(NULL);
- new_value.type = tv->ts_type;
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+
+ tst_tmpdir();
clockfd = timerfd_create(CLOCK_REALTIME, 0);
- if (clockfd == -1) {
- tst_brk(TFAIL | TERRNO, "timerfd_create() fail");
+ if (clockfd == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "timerfd_create() fail");
+
+ fd = SAFE_OPEN(cleanup, "test_file", O_RDWR | O_CREAT, 0644);
+}
+
+static void timerfd_settime_verify(const struct test_case_t *test)
+{
+ TEST(timerfd_settime(*test->fd, test->flags, &new_value,
+ test->old_value));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "timerfd_settime() succeeded unexpectedly");
return;
}
- fd = SAFE_OPEN("test_file", O_RDWR | O_CREAT, 0644);
+ if (TEST_ERRNO == test->exp_errno) {
+ tst_resm(TPASS | TTERRNO,
+ "timerfd_settime() failed as expected");
+ } else {
+ tst_resm(TFAIL | TTERRNO,
+ "timerfd_settime() failed unexpectedly; expected: "
+ "%d - %s", test->exp_errno, strerror(test->exp_errno));
+ }
}
static void cleanup(void)
@@ -70,43 +122,6 @@ static void cleanup(void)
if (fd > 0)
close(fd);
-}
-
-static void run(unsigned int n)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct test_case_t *test = &test_cases[n];
- void *its;
-
- if (test->exp_errno == EFAULT)
- its = bad_addr;
- else
- its = tst_its_get(test->old_value);
- TEST(tv->tfd_settime(*test->fd, test->flags, tst_its_get(&new_value),
- its));
-
- if (TST_RET != -1) {
- tst_res(TFAIL, "timerfd_settime() succeeded unexpectedly");
- return;
- }
-
- if (TST_ERR == test->exp_errno) {
- tst_res(TPASS | TTERRNO,
- "timerfd_settime() failed as expected");
- } else {
- tst_res(TFAIL | TTERRNO,
- "timerfd_settime() failed unexpectedly; expected: "
- "%d - %s", test->exp_errno, strerror(test->exp_errno));
- }
+ tst_rmdir();
}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(test_cases),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
- .needs_tmpdir = 1,
- .min_kver = "2.6.25",
-};
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime02.c b/testcases/kernel/syscalls/timerfd/timerfd_settime02.c
deleted file mode 100644
index bd92ee964..000000000
--- a/testcases/kernel/syscalls/timerfd/timerfd_settime02.c
+++ /dev/null
@@ -1,120 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
- *
- * CVE-2017-10661
- *
- * Test for race condition vulnerability in timerfd_settime(). Multiple
- * concurrent calls of timerfd_settime() clearing the CANCEL_ON_SET flag may
- * cause memory corruption. Fixed in:
- *
- * commit 1e38da300e1e395a15048b0af1e5305bd91402f6
- * Author: Thomas Gleixner <tglx@linutronix.de>
- * Date: Tue Jan 31 15:24:03 2017 +0100
- *
- * timerfd: Protect the might cancel mechanism proper
- */
-#include <unistd.h>
-#include "time64_variants.h"
-#include "tst_timer.h"
-#include "tst_safe_timerfd.h"
-#include "tst_fuzzy_sync.h"
-
-#define TIMERFD_FLAGS "timerfd_settime(TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)"
-
-#ifndef TFD_TIMER_CANCEL_ON_SET
-#define TFD_TIMER_CANCEL_ON_SET (1<<1)
-#endif
-
-static int fd = -1;
-static struct tst_its its;
-static struct tst_fzsync_pair fzsync_pair;
-
-static struct time64_variants variants[] = {
-#if (__NR_timerfd_settime != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_timerfd_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
-
-static void setup(void)
-{
- struct time64_variants *tv = &variants[tst_variant];
-
- tst_res(TINFO, "Testing variant: %s", tv->desc);
- its.type = tv->ts_type;
-
- fd = SAFE_TIMERFD_CREATE(CLOCK_REALTIME, 0);
-
- fzsync_pair.exec_loops = 1000000;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void cleanup(void)
-{
- if (fd >= 0)
- SAFE_CLOSE(fd);
- tst_fzsync_pair_cleanup(&fzsync_pair);
-}
-
-static int punch_clock(int flags)
-{
- return variants[tst_variant].tfd_settime(fd, flags, tst_its_get(&its),
- NULL);
-
-}
-
-static void *thread_run(void *arg)
-{
- while (tst_fzsync_run_b(&fzsync_pair)) {
- tst_fzsync_start_race_b(&fzsync_pair);
- punch_clock(0);
- tst_fzsync_end_race_b(&fzsync_pair);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- TEST(punch_clock(TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET));
-
- if (TST_RET == -1)
- tst_brk(TBROK | TTERRNO, TIMERFD_FLAGS " failed");
-
- if (TST_RET != 0)
- tst_brk(TBROK | TTERRNO, "Invalid " TIMERFD_FLAGS
- " return value");
-
- tst_fzsync_start_race_a(&fzsync_pair);
- punch_clock(0);
- tst_fzsync_end_race_a(&fzsync_pair);
-
- if (tst_taint_check()) {
- tst_res(TFAIL, "Kernel is vulnerable");
- return;
- }
- }
-
- tst_res(TPASS, "Nothing bad happened, probably");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .cleanup = cleanup,
- .min_kver = "2.6.25",
- .taint_check = TST_TAINT_W | TST_TAINT_D,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "1e38da300e1e"},
- {"CVE", "2017-10661"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/times/Makefile b/testcases/kernel/syscalls/times/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/times/Makefile
+++ b/testcases/kernel/syscalls/times/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/times/times01.c b/testcases/kernel/syscalls/times/times01.c
index 408b91c9c..293a52957 100644
--- a/testcases/kernel/syscalls/times/times01.c
+++ b/testcases/kernel/syscalls/times/times01.c
@@ -1,30 +1,162 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- */
-/*\
- * [Description]
*
- * This is a Phase I test for the times(2) system call. It is intended to
- * provide a limited exposure of the system call.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
+/* $Id: times01.c,v 1.6 2009/10/26 14:55:48 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : times01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for times(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) times(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the times(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * times(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+#include <sys/types.h>
#include <sys/times.h>
#include <errno.h>
-#include "tst_test.h"
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+
+void setup();
+void cleanup();
+
+char *TCID = "times01";
+int TST_TOTAL = 1;
+
+struct tms mytimes;
-static void verify_times(void)
+int main(int ac, char **av)
{
- struct tms mytimes;
+ int lc;
- TEST(times(&mytimes));
+ tst_parse_opts(ac, av, NULL, NULL);
- if (TST_RET == -1)
- tst_res(TFAIL | TTERRNO, "times failed");
- else
- tst_res(TPASS, "times(&mytimes) returned %ld", TST_RET);
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ TEST(times(&mytimes));
+
+ if (TEST_RETURN == -1)
+ tst_resm(TFAIL | TTERRNO, "times failed");
+ else
+ tst_resm(TPASS, "times(&mytimes) returned %ld",
+ TEST_RETURN);
+
+ }
+
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .test_all = verify_times,
-};
+void setup(void)
+{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/tkill/Makefile b/testcases/kernel/syscalls/tkill/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/tkill/Makefile
+++ b/testcases/kernel/syscalls/tkill/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/tkill/tkill01.c b/testcases/kernel/syscalls/tkill/tkill01.c
index edce2b0b6..20c28f1bc 100644
--- a/testcases/kernel/syscalls/tkill/tkill01.c
+++ b/testcases/kernel/syscalls/tkill/tkill01.c
@@ -1,62 +1,106 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Linux Test Project, 2009-2021
- * Copyright (c) Crackerjack Project, 2007
- * Ported from Crackerjack to LTP by Manas Kumar Nayak maknayak@in.ibm.com>
- */
-
-/*\
- * [Description]
- *
- * Basic tests for the tkill syscall.
- *
- * [Algorithm]
- *
- * Calls tkill and capture signal to verify success.
- */
+/******************************************************************************/
+/* Copyright (c) Crackerjack Project., 2007 */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/******************************************************************************/
+/******************************************************************************/
+/* */
+/* File: tkill01.c */
+/* */
+/* Description: This tests the tkill() syscall */
+/* */
+/* Usage: <for command-line> */
+/* tkill01 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 1 */
+/* */
+/* Test Name: tkill01 */
+/* History: Porting from Crackerjack to LTP is done by */
+/* Manas Kumar Nayak maknayak@in.ibm.com> */
+/******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
#include <signal.h>
+#include <sys/syscall.h>
+#include <linux/unistd.h>
+#include <sys/types.h>
+#include "test.h"
#include "lapi/syscalls.h"
-#include "tst_test.h"
-static volatile sig_atomic_t sig_flag;
+char *TCID = "tkill01";
+int testno;
+int TST_TOTAL = 2;
+
+void cleanup(void)
+{
+
+ tst_rmdir();
+}
-static void sighandler(int sig)
+void setup(void)
{
- if (sig == SIGUSR1)
- sig_flag = 1;
+ TEST_PAUSE;
+ tst_tmpdir();
}
-static void setup(void)
+int sig_count = 0;
+
+void sig_action(int sig)
{
- SAFE_SIGNAL(SIGUSR1, sighandler);
+ sig_count = 1;
}
-static void run(void)
+int main(int ac, char **av)
{
int tid;
- int timeout_ms = 1000;
- sig_flag = 0;
+ int lc;
- tid = tst_syscall(__NR_gettid);
- TST_EXP_PASS(tst_syscall(__NR_tkill, tid, SIGUSR1));
+ tst_parse_opts(ac, av, NULL, NULL);
- while (timeout_ms--) {
- if (sig_flag)
- break;
+ setup();
- usleep(1000);
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
+ if (signal(SIGUSR1, &sig_action) == SIG_ERR)
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "signal(SIGUSR1, ..) failed");
+ TEST(tid = ltp_syscall(__NR_gettid));
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "tkill failed");
+ }
+ TEST(ltp_syscall(__NR_tkill, tid, SIGUSR1));
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "tkill call succeeded");
+ } else {
+ tst_resm(TFAIL | TTERRNO, "tkill failed");
+ }
+ }
}
-
- if (sig_flag)
- tst_res(TPASS, "signal captured");
- else
- tst_res(TFAIL, "signal not captured");
+ cleanup();
+ tst_exit();
}
-
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .test_all = run,
-};
diff --git a/testcases/kernel/syscalls/tkill/tkill02.c b/testcases/kernel/syscalls/tkill/tkill02.c
index 63fa664e4..48431755b 100644
--- a/testcases/kernel/syscalls/tkill/tkill02.c
+++ b/testcases/kernel/syscalls/tkill/tkill02.c
@@ -1,18 +1,28 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
+/******************************************************************************
+ * Copyright (c) Crackerjack Project., 2007 *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See *
+ * the GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation, *
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ * *
+ ******************************************************************************/
/*
- * Copyright (c) Crackerjack Project., 2007
- * Ported from Crackerjack to LTP by Manas Kumar Nayak maknayak@in.ibm.com>
- */
-
-/*\
- * [Description]
- *
- * Basic tests for the tkill() errors.
+ * File: tkill02.c
*
- * [Algorithm]
+ * Description: This tests the tkill() syscall
*
- * - EINVAL on an invalid thread ID
- * - ESRCH when no process with the specified thread ID exists
+ * History: Porting from Crackerjack to LTP is done by
+ * Manas Kumar Nayak maknayak@in.ibm.com>
*/
#include <stdio.h>
@@ -22,35 +32,66 @@
#include <signal.h>
#include <sys/syscall.h>
+#include "test.h"
#include "lapi/syscalls.h"
-#include "tst_test.h"
-static pid_t unused_tid;
+char *TCID = "tkill02";
+int testno;
+
static pid_t inval_tid = -1;
+static pid_t unused_tid;
+
+void cleanup(void)
+{
+ tst_rmdir();
+}
+
+void setup(void)
+{
+ TEST_PAUSE;
+ tst_tmpdir();
+
+ unused_tid = tst_get_unused_pid(cleanup);
+}
struct test_case_t {
int *tid;
int exp_errno;
-} tc[] = {
+} test_cases[] = {
{&inval_tid, EINVAL},
{&unused_tid, ESRCH}
};
-static void setup(void)
-{
- unused_tid = tst_get_unused_pid();
-}
+int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-static void run(unsigned int i)
+int main(int ac, char **av)
{
- TST_EXP_FAIL(tst_syscall(__NR_tkill, *(tc[i].tid), SIGUSR1),
- tc[i].exp_errno, "tst_syscall(__NR_tkill) expecting %s",
- tst_strerrno(tc[i].exp_errno));
-}
+ int i;
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .needs_tmpdir = 1,
- .setup = setup,
- .test = run,
-};
+ setup();
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ for (i = 0; i < TST_TOTAL; i++) {
+
+ TEST(ltp_syscall(__NR_tkill, *(test_cases[i].tid), SIGUSR1));
+
+ if (TEST_RETURN == -1) {
+ if (TEST_ERRNO == test_cases[i].exp_errno) {
+ tst_resm(TPASS | TTERRNO,
+ "tkill(%d, SIGUSR1) failed as expected",
+ *(test_cases[i].tid));
+ } else {
+ tst_brkm(TFAIL | TTERRNO, cleanup,
+ "tkill(%d, SIGUSR1) failed unexpectedly",
+ *(test_cases[i].tid));
+ }
+ } else {
+ tst_brkm(TFAIL, cleanup,
+ "tkill(%d) succeeded unexpectedly",
+ *(test_cases[i].tid));
+ }
+ }
+ cleanup();
+ tst_exit();
+}
diff --git a/testcases/kernel/syscalls/truncate/.gitignore b/testcases/kernel/syscalls/truncate/.gitignore
index ae58daa0f..b0efbc280 100644
--- a/testcases/kernel/syscalls/truncate/.gitignore
+++ b/testcases/kernel/syscalls/truncate/.gitignore
@@ -1,3 +1,5 @@
+/truncate01
+/truncate01_64
/truncate02
/truncate02_64
/truncate03
diff --git a/testcases/kernel/syscalls/truncate/Makefile b/testcases/kernel/syscalls/truncate/Makefile
index d97d2bad0..bf1201019 100644
--- a/testcases/kernel/syscalls/truncate/Makefile
+++ b/testcases/kernel/syscalls/truncate/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/truncate/truncate01.c b/testcases/kernel/syscalls/truncate/truncate01.c
new file mode 100644
index 000000000..b3a535f94
--- /dev/null
+++ b/testcases/kernel/syscalls/truncate/truncate01.c
@@ -0,0 +1,218 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * Test Name: truncate01
+ *
+ * Test Description:
+ * Verify that, truncate(2) succeeds to truncate a file to a specified
+ * length.
+ *
+ * Expected Result:
+ * truncate(2) should return a value 0 and the length of the file after
+ * truncation should be equal to the length it is truncated to.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * truncate01 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions:
+ * This test should be run by 'non-super-user' only.
+ *
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include <inttypes.h>
+
+#include "test.h"
+#include "safe_macros.h"
+
+#define TESTFILE "testfile" /* file under test */
+#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#define BUF_SIZE 256 /* buffer size */
+#define FILE_SIZE 1024 /* test file size */
+#define TRUNC_LEN 256 /* truncation length */
+
+TCID_DEFINE(truncate01);
+int TST_TOTAL = 1;
+
+void setup(); /* setup function for the test */
+void cleanup(); /* cleanup function for the test */
+
+int main(int ac, char **av)
+{
+ struct stat stat_buf; /* stat(2) struct contents */
+ int lc;
+ off_t file_length; /* test file length */
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+
+ tst_count = 0;
+
+ /*
+ * Call truncate(2) to truncate a test file to a
+ * specified length.
+ */
+ TEST(truncate(TESTFILE, TRUNC_LEN));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL,
+ "truncate(%s, %d) Failed, errno=%d : %s",
+ TESTFILE, TRUNC_LEN, TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ /*
+ * Get the testfile information using
+ * stat(2).
+ */
+ if (stat(TESTFILE, &stat_buf) < 0) {
+ tst_brkm(TFAIL, cleanup, "stat(2) of "
+ "%s failed, error:%d",
+ TESTFILE, errno);
+ }
+ stat_buf.st_mode &= ~S_IFREG;
+ file_length = stat_buf.st_size;
+
+ /*
+ * Check for expected size of testfile after
+ * truncate(2) on it.
+ */
+ if (file_length != TRUNC_LEN) {
+ tst_resm(TFAIL, "%s: Incorrect file "
+ "size %" PRId64
+ ", Expected %d", TESTFILE,
+ (int64_t) file_length,
+ TRUNC_LEN);
+ } else {
+ tst_resm(TPASS, "Functionality of "
+ "truncate(%s, %d) successful",
+ TESTFILE, TRUNC_LEN);
+ }
+ }
+ tst_count++; /* incr TEST_LOOP counter */
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * void
+ * setup() - performs all ONE TIME setup for this test.
+ * Create a temporary directory and change directory to it.
+ * Fill the buffer with some arbitrary data to be written to a file.
+ * Create a test file under temporary directory and close it
+ * write arbitrary data into testfile.
+ */
+void setup(void)
+{
+ int fd, i; /* file handler for testfile */
+ int c, c_total = 0; /* no. bytes to be written to file */
+ char tst_buff[BUF_SIZE]; /* buffer to hold data */
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ /* Pause if that option was specified
+ * TEST_PAUSE contains the code to fork the test with the -i option.
+ * You want to make sure you do this before you create your temporary
+ * directory.
+ */
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ /* Fill the test buffer with the known data */
+ for (i = 0; i < BUF_SIZE; i++) {
+ tst_buff[i] = 'a';
+ }
+
+ /* Creat a testfile under temporary directory */
+ if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
+ tst_brkm(TBROK, cleanup,
+ "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s",
+ TESTFILE, FILE_MODE, errno, strerror(errno));
+ }
+
+ /* Write to the file 1k data from the buffer */
+ while (c_total < FILE_SIZE) {
+ if ((c = write(fd, tst_buff, sizeof(tst_buff))) <= 0) {
+ tst_brkm(TBROK, cleanup,
+ "write(2) on %s Failed, errno=%d : %s",
+ TESTFILE, errno, strerror(errno));
+ } else {
+ c_total += c;
+ }
+ }
+
+ /* Close the testfile after writing data into it */
+ SAFE_CLOSE(cleanup, fd);
+}
+
+/*
+ * void
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ * Remove the test directory and testfile created in the setup.
+ */
+void cleanup(void)
+{
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/truncate/truncate02.c b/testcases/kernel/syscalls/truncate/truncate02.c
index 8d7f9a6fa..7a201eea1 100644
--- a/testcases/kernel/syscalls/truncate/truncate02.c
+++ b/testcases/kernel/syscalls/truncate/truncate02.c
@@ -1,114 +1,290 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 John George
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*\
- * [Description]
+/*
+ * Test Name: truncate02
+ *
+ * Test Description:
+ * Verify that, truncate(2) succeeds to truncate a file to a certain length,
+ * but the attempt to read past the truncated length will fail.$
+ *
+ * Expected Result:
+ * truncate(2) should return a value 0 and the attempt to read past the
+ * truncated length will fail. In case where the file before truncation was
+ * shorter, the bytes between the old and new should be all zeroes.
+ *
+ * Algorithm:
+ * Setup:
+ * Setup signal handling.
+ * Create temporary directory.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise,
+ * Verify the Functionality of system call
+ * if successful,
+ * Issue Functionality-Pass message.
+ * Otherwise,
+ * Issue Functionality-Fail message.
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ * Delete the temporary directory created.
+ *
+ * Usage: <for command-line>
+ * truncate02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
*
- * Verify that:
+ * Restrictions:
+ * This test should be run by 'non-super-user' only.
*
- * - truncate(2) truncates a file to a specified length successfully.
- * - If the file is larger than the specified length, the extra data is lost.
- * - If the file is shorter than the specified length, the extra data is filled by '0'.
- * - truncate(2) doesn't change offset.
*/
-#include <errno.h>
-#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
#include <string.h>
+#include <signal.h>
-#include "tst_test.h"
-#include "tst_safe_prw.h"
+#include "test.h"
-#define TESTFILE "testfile"
-#define FILE_SIZE 1024
-#define TRUNC_LEN1 256
-#define TRUNC_LEN2 512
+#define TESTFILE "testfile" /* file under test */
+#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#define BUF_SIZE 256 /* buffer size */
+#define FILE_SIZE 1024 /* test file size */
+#define TRUNC_LEN1 256 /* truncation length */
+#define TRUNC_LEN2 512 /* truncation length */
-static int fd;
+TCID_DEFINE(truncate02);
+int TST_TOTAL = 1; /* Total number of test conditions */
+int fd; /* file descriptor of testfile */
+char tst_buff[BUF_SIZE]; /* buffer to hold testfile contents */
-static struct tcase {
- off_t trunc_len;
- off_t read_off;
- off_t read_count;
- char exp_char;
-} tcases[] = {
- {TRUNC_LEN1, 0, TRUNC_LEN1, 'a'},
- {TRUNC_LEN2, TRUNC_LEN1, TRUNC_LEN1, '\0'},
-};
+void setup(); /* setup function for the test */
+void cleanup(); /* cleanup function for the test */
-static void verify_truncate(unsigned int n)
+int main(int ac, char **av)
{
- struct tcase *tc = &tcases[n];
- struct stat stat_buf;
- char read_buf[tc->read_count];
- int i;
+ struct stat stat_buf; /* stat(2) struct contents */
+ int lc, i;
+ off_t file_length2; /* test file length */
+ off_t file_length1; /* test file length */
+ int rbytes; /* bytes read from testfile */
+ int read_len; /* total no. of bytes read from testfile */
+ int err_flag = 0; /* error indicator flag */
- memset(read_buf, 'b', tc->read_count);
+ tst_parse_opts(ac, av, NULL, NULL);
- TEST(truncate(TESTFILE, tc->trunc_len));
- if (TST_RET == -1) {
- tst_res(TFAIL | TTERRNO, "truncate(%s, %ld) failed",
- TESTFILE, tc->trunc_len);
- return;
- }
+ setup();
- if (TST_RET != 0) {
- tst_res(TFAIL | TTERRNO,
- "truncate(%s, %ld) returned invalid value %ld",
- TESTFILE, tc->trunc_len, TST_RET);
- return;
- }
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- SAFE_STAT(TESTFILE, &stat_buf);
- if (stat_buf.st_size != tc->trunc_len) {
- tst_res(TFAIL, "%s: Incorrect file size %ld, expected %ld",
- TESTFILE, stat_buf.st_size, tc->trunc_len);
- return;
- }
+ tst_count = 0;
+ read_len = 0;
- if (SAFE_LSEEK(fd, 0, SEEK_CUR)) {
- tst_res(TFAIL, "truncate(%s, %ld) changes offset",
- TESTFILE, tc->trunc_len);
- return;
- }
+ /*
+ * Call truncate(2) to truncate a test file to a
+ * specified length (TRUNC_LEN1).
+ */
+ TEST(truncate(TESTFILE, TRUNC_LEN1));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL,
+ "truncate(%s, %d) Failed, errno=%d : %s",
+ TESTFILE, TRUNC_LEN1, TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ } else {
+ /*
+ * Get the testfile information using
+ * stat(2).
+ */
+ if (stat(TESTFILE, &stat_buf) < 0) {
+ tst_brkm(TFAIL, cleanup, "stat(2) of "
+ "%s failed after 1st truncate, "
+ "error:%d", TESTFILE, errno);
+ }
+ file_length1 = stat_buf.st_size;
+
+ /*
+ * Set the file pointer of testfile to the
+ * beginning of the file.
+ */
+ if (lseek(fd, 0, SEEK_SET) < 0) {
+ tst_brkm(TFAIL, cleanup, "lseek(2) on "
+ "%s failed after 1st truncate, "
+ "error:%d", TESTFILE, errno);
+ }
+
+ /* Read the testfile from the beginning. */
+ while ((rbytes = read(fd, tst_buff,
+ sizeof(tst_buff))) > 0) {
+ read_len += rbytes;
+ }
+
+ /*
+ * Execute truncate(2) again to truncate
+ * testfile to a size TRUNC_LEN2.
+ */
+ TEST(truncate(TESTFILE, TRUNC_LEN2));
- SAFE_PREAD(1, fd, read_buf, tc->read_count, tc->read_off);
- for (i = 0; i < tc->read_count; i++) {
- if (read_buf[i] != tc->exp_char) {
- tst_res(TFAIL, "%s: wrong content %c, expected %c",
- TESTFILE, read_buf[i], tc->exp_char);
- return;
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL, "truncate of %s to "
+ "size %d Failed, errno=%d : %s",
+ TESTFILE, TRUNC_LEN2,
+ TEST_ERRNO,
+ strerror(TEST_ERRNO));
+ }
+
+ /*
+ * Get the testfile information using
+ * stat(2)
+ */
+ if (stat(TESTFILE, &stat_buf) < 0) {
+ tst_brkm(TFAIL, cleanup, "stat(2) of "
+ "%s failed after 2nd truncate, "
+ "error:%d", TESTFILE, errno);
+ }
+ file_length2 = stat_buf.st_size;
+
+ /*
+ * Set the file pointer of testfile to the
+ * offset TRUNC_LEN1 of testfile.
+ */
+ if (lseek(fd, TRUNC_LEN1, SEEK_SET) < 0) {
+ tst_brkm(TFAIL, cleanup, "lseek(2) on "
+ "%s failed after 2nd truncate, "
+ "error:%d", TESTFILE, errno);
+ }
+
+ /* Read the testfile contents till EOF */
+ while ((rbytes = read(fd, tst_buff,
+ sizeof(tst_buff))) > 0) {
+ for (i = 0; i < rbytes; i++) {
+ if (tst_buff[i] != 0) {
+ err_flag++;
+ }
+ }
+ }
+
+ /*
+ * Check for expected size of testfile after
+ * issuing truncate(2) on it.
+ */
+ if ((file_length1 != TRUNC_LEN1) ||
+ (file_length2 != TRUNC_LEN2) ||
+ (read_len != TRUNC_LEN1) ||
+ (err_flag != 0)) {
+ tst_resm(TFAIL, "Functionality of "
+ "truncate(2) on %s Failed",
+ TESTFILE);
+ } else {
+ tst_resm(TPASS,
+ "Functionality of truncate(2) "
+ "on %s successful", TESTFILE);
+ }
}
+ tst_count++; /* incr. TEST_LOOP counter */
}
- tst_res(TPASS, "truncate(%s, %ld) succeeded",
- TESTFILE, tc->trunc_len);
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+/*
+ * void
+ * setup() - performs all ONE TIME setup for this test.
+ * Create a temporary directory and change directory to it.
+ * Create a test file under temporary directory and write some
+ * data into it.
+ */
+void setup(void)
{
- fd = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0644);
+ int i;
+ int wbytes; /* bytes written to testfile */
+ int write_len = 0; /* total no. of bytes written to testfile */
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ /* Pause if that option was specified
+ * TEST_PAUSE contains the code to fork the test with the -i option.
+ * You want to make sure you do this before you create your temporary
+ * directory.
+ */
+ TEST_PAUSE;
+
+ tst_tmpdir();
+
+ /* Fill the test buffer with the known data */
+ for (i = 0; i < BUF_SIZE; i++) {
+ tst_buff[i] = 'a';
+ }
- tst_fill_fd(fd, 'a', FILE_SIZE, 1);
+ /* Creat a testfile and write some data into it */
+ if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
+ tst_brkm(TBROK, cleanup,
+ "open(%s, O_RDWR|O_CREAT, %o) Failed, errno=%d : %s",
+ TESTFILE, FILE_MODE, errno, strerror(errno));
+ }
- SAFE_LSEEK(fd, 0, SEEK_SET);
+ /* Write to the file 1k data from the buffer */
+ while (write_len < FILE_SIZE) {
+ if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) {
+ tst_brkm(TBROK, cleanup,
+ "write(2) on %s Failed, errno=%d : %s",
+ TESTFILE, errno, strerror(errno));
+ } else {
+ write_len += wbytes;
+ }
+ }
}
-static void cleanup(void)
+/*
+ * void
+ * cleanup() - performs all ONE TIME cleanup for this test at
+ * completion or premature exit.
+ * Close the temporary file opened for reading/writing.
+ * Remove the test directory and testfile created in the setup.
+ */
+void cleanup(void)
{
- if (fd > 0)
- SAFE_CLOSE(fd);
-}
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .setup = setup,
- .cleanup = cleanup,
- .tcnt = ARRAY_SIZE(tcases),
- .test = verify_truncate,
-};
+ /* Close the testfile after writing data into it */
+ if (close(fd) == -1) {
+ tst_brkm(TFAIL, NULL,
+ "close(%s) Failed, errno=%d : %s",
+ TESTFILE, errno, strerror(errno));
+ }
+
+ tst_rmdir();
+
+}
diff --git a/testcases/kernel/syscalls/truncate/truncate03.c b/testcases/kernel/syscalls/truncate/truncate03.c
index a9cd4b3ed..401c16a8e 100644
--- a/testcases/kernel/syscalls/truncate/truncate03.c
+++ b/testcases/kernel/syscalls/truncate/truncate03.c
@@ -1,32 +1,42 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 John George
- */
-
-/*\
- * [Description]
+ * Copyright (c) International Business Machines Corp., 2001
+ * 07/2001 John George
*
- * Verify that:
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * - truncate(2) returns -1 and sets errno to EACCES if search/write
- * permission denied for the process on the component of the path prefix
- * or named file.
- * - truncate(2) returns -1 and sets errno to ENOTDIR if the component of
- * the path prefix is not a directory.
- * - truncate(2) returns -1 and sets errno to EFAULT if pathname points
- * outside user's accessible address space.
- * - truncate(2) returns -1 and sets errno to ENAMETOOLONG if the component
- * of a pathname exceeded 255 characters or entire pathname exceeds 1023
- * characters.
- * - truncate(2) returns -1 and sets errno to ENOENT if the named file
- * does not exist.
- * - truncate(2) returns -1 and sets errno to EISDIR if the named file
- * is a directory.
- * - truncate(2) returns -1 and sets errno to EFBIG if the argument length
- * is larger than the maximum file size.
- * - truncate(2) returns -1 and sets errno to ELOOP if too many symbolic
- * links were encountered in translating the pathname.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+/*
+ * Test Description:
+ * Verify that,
+ * 1) truncate(2) returns -1 and sets errno to EACCES if search/write
+ * permission denied for the process on the component of the path prefix
+ * or named file.
+ * 2) truncate(2) returns -1 and sets errno to ENOTDIR if the component of
+ * the path prefix is not a directory.
+ * 3) truncate(2) returns -1 and sets errno to EFAULT if pathname points
+ * outside user's accessible address space.
+ * 4) truncate(2) returns -1 and sets errno to ENAMETOOLONG if the component
+ * of a pathname exceeded 255 characters or entire pathname exceeds 1023
+ * characters.
+ * 5) truncate(2) returns -1 and sets errno to ENOENT if the named file
+ * does not exist.
+ * 6) truncate(2) returns -1 and sets errno to EISDIR if the named file
+ * is a directory.
+ * 7) truncate(2) returns -1 and sets errno to EFBIG if the argument length
+ * is larger than the maximum file size.
+ * 8) truncate(2) returns -1 and sets errno to ELOOP if too many symbolic
+ * links were encountered in translating the pathname.
*/
#define _GNU_SOURCE
@@ -42,7 +52,8 @@
#include <pwd.h>
#include <sys/resource.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
#define TEST_FILE1 "testfile"
#define TEST_FILE2 "t_file/testfile"
@@ -73,74 +84,102 @@ static struct test_case_t {
{ TEST_SYM1, TRUNC_LEN, ELOOP }
};
-static void setup(void)
+static void setup(void);
+static void cleanup(void);
+static void truncate_verify(struct test_case_t *);
+
+char *TCID = "truncate03";
+int TST_TOTAL = ARRAY_SIZE(test_cases);
+
+int main(int ac, char **av)
+{
+ int i, lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++)
+ truncate_verify(&test_cases[i]);
+
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+void setup(void)
{
struct passwd *ltpuser;
- struct rlimit rlim = {
- .rlim_cur = MAX_FSIZE,
- .rlim_max = MAX_FSIZE,
- };
+ struct rlimit rlim;
sigset_t signalset;
- unsigned int n;
+ int n;
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_require_root();
+
+ ltpuser = SAFE_GETPWNAM(cleanup, "nobody");
+ SAFE_SETEUID(cleanup, ltpuser->pw_uid);
+
+ TEST_PAUSE;
- ltpuser = SAFE_GETPWNAM("nobody");
- SAFE_SETEUID(ltpuser->pw_uid);
+ tst_tmpdir();
- SAFE_TOUCH(TEST_FILE1, NEW_MODE, NULL);
+ SAFE_TOUCH(cleanup, TEST_FILE1, NEW_MODE, NULL);
- SAFE_TOUCH("t_file", FILE_MODE, NULL);
+ SAFE_TOUCH(cleanup, "t_file", FILE_MODE, NULL);
memset(long_pathname, 'a', PATH_MAX + 1);
- SAFE_MKDIR(TEST_DIR1, DIR_MODE);
+ SAFE_MKDIR(cleanup, TEST_DIR1, DIR_MODE);
- SAFE_TOUCH(TEST_FILE3, FILE_MODE, NULL);
+ SAFE_TOUCH(cleanup, TEST_FILE3, FILE_MODE, NULL);
- SAFE_SYMLINK(TEST_SYM1, TEST_SYM2);
- SAFE_SYMLINK(TEST_SYM2, TEST_SYM1);
+ SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
+ SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
- SAFE_SETRLIMIT(RLIMIT_FSIZE, &rlim);
+ rlim.rlim_cur = MAX_FSIZE;
+ rlim.rlim_max = MAX_FSIZE;
+ SAFE_SETRLIMIT(cleanup, RLIMIT_FSIZE, &rlim);
- SAFE_SIGEMPTYSET(&signalset);
- SAFE_SIGADDSET(&signalset, SIGXFSZ);
- SAFE_SIGPROCMASK(SIG_BLOCK, &signalset, NULL);
+ sigemptyset(&signalset);
+ sigaddset(&signalset, SIGXFSZ);
+ TEST(sigprocmask(SIG_BLOCK, &signalset, NULL));
+ if (TEST_RETURN != 0)
+ tst_brkm(TBROK | TTERRNO, cleanup, "sigprocmask");
- for (n = 0; n < ARRAY_SIZE(test_cases); n++) {
+ for (n = 0; n < TST_TOTAL; n++) {
if (!test_cases[n].pathname)
- test_cases[n].pathname = tst_get_bad_addr(NULL);
+ test_cases[n].pathname = tst_get_bad_addr(cleanup);
}
}
-static void verify_truncate(unsigned int n)
+void truncate_verify(struct test_case_t *tc)
{
- struct test_case_t *tc = &test_cases[n];
-
TEST(truncate(tc->pathname, tc->length));
- if (TST_RET == 0) {
- tst_res(TFAIL, "truncate() succeeded when failure expected");
- return;
- }
- if (TST_RET != -1) {
- tst_res(TFAIL, "truncate() returned invalid value %ld",
- TST_RET);
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL, "truncate() returned %ld, "
+ "expected -1, errno:%d", TEST_RETURN,
+ tc->exp_errno);
return;
}
- if (TST_ERR == tc->exp_errno) {
- tst_res(TPASS | TTERRNO, "truncate() failed as expected");
+ if (TEST_ERRNO == tc->exp_errno) {
+ tst_resm(TPASS | TTERRNO, "truncate() failed as expected");
} else {
- tst_res(TFAIL | TTERRNO,
+ tst_resm(TFAIL | TTERRNO,
"truncate() failed unexpectedly; expected: %d - %s",
tc->exp_errno, strerror(tc->exp_errno));
}
}
-static struct tst_test test = {
- .needs_root = 1,
- .needs_tmpdir = 1,
- .setup = setup,
- .tcnt = ARRAY_SIZE(test_cases),
- .test = verify_truncate,
-};
+void cleanup(void)
+{
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/ulimit/Makefile b/testcases/kernel/syscalls/ulimit/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/ulimit/Makefile
+++ b/testcases/kernel/syscalls/ulimit/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/umask/Makefile b/testcases/kernel/syscalls/umask/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/umask/Makefile
+++ b/testcases/kernel/syscalls/umask/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/umount/Makefile b/testcases/kernel/syscalls/umount/Makefile
index c7cf9d538..f1e48b388 100644
--- a/testcases/kernel/syscalls/umount/Makefile
+++ b/testcases/kernel/syscalls/umount/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/umount2/Makefile b/testcases/kernel/syscalls/umount2/Makefile
index ff3b0bdba..bbf0541f3 100644
--- a/testcases/kernel/syscalls/umount2/Makefile
+++ b/testcases/kernel/syscalls/umount2/Makefile
@@ -1,6 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
+#
# Copyright (c) 2015 Fujitsu Ltd.
# Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/uname/.gitignore b/testcases/kernel/syscalls/uname/.gitignore
index ca279ef53..4f153e79f 100644
--- a/testcases/kernel/syscalls/uname/.gitignore
+++ b/testcases/kernel/syscalls/uname/.gitignore
@@ -1,3 +1,4 @@
/uname01
/uname02
+/uname03
/uname04
diff --git a/testcases/kernel/syscalls/uname/Makefile b/testcases/kernel/syscalls/uname/Makefile
index 001a2137e..eceaa64d0 100644
--- a/testcases/kernel/syscalls/uname/Makefile
+++ b/testcases/kernel/syscalls/uname/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/uname/uname01.c b/testcases/kernel/syscalls/uname/uname01.c
index 5e2f5ffac..6b4e655e6 100644
--- a/testcases/kernel/syscalls/uname/uname01.c
+++ b/testcases/kernel/syscalls/uname/uname01.c
@@ -1,36 +1,162 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
- * Basic test for uname(2):
- * Calling uname() succeeded and got correct sysname.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
+/* $Id: uname01.c,v 1.6 2009/11/02 13:57:19 subrata_modak Exp $ */
+/**********************************************************
+ *
+ * OS Test - Silicon Graphics, Inc.
+ *
+ * TEST IDENTIFIER : uname01
+ *
+ * EXECUTED BY : anyone
+ *
+ * TEST TITLE : Basic test for uname(2)
+ *
+ * PARENT DOCUMENT : usctpl01
+ *
+ * TEST CASE TOTAL : 1
+ *
+ * WALL CLOCK TIME : 1
+ *
+ * CPU TYPES : ALL
+ *
+ * AUTHOR : William Roske
+ *
+ * CO-PILOT : Dave Fenner
+ *
+ * DATE STARTED : 03/30/92
+ *
+ * INITIAL RELEASE : UNICOS 7.0
+ *
+ * TEST CASES
+ *
+ * 1.) uname(2) returns...(See Description)
+ *
+ * INPUT SPECIFICATIONS
+ * The standard options for system call tests are accepted.
+ * (See the parse_opts(3) man page).
+ *
+ * OUTPUT SPECIFICATIONS
+ *$
+ * DURATION
+ * Terminates - with frequency and infinite modes.
+ *
+ * SIGNALS
+ * Uses SIGUSR1 to pause before test if option set.
+ * (See the parse_opts(3) man page).
+ *
+ * RESOURCES
+ * None
+ *
+ * ENVIRONMENTAL NEEDS
+ * No run-time environmental needs.
+ *
+ * SPECIAL PROCEDURAL REQUIREMENTS
+ * None
+ *
+ * INTERCASE DEPENDENCIES
+ * None
+ *
+ * DETAILED DESCRIPTION
+ * This is a Phase I test for the uname(2) system call. It is intended
+ * to provide a limited exposure of the system call, for now. It
+ * should/will be extended when full functional tests are written for
+ * uname(2).
+ *
+ * Setup:
+ * Setup signal handling.
+ * Pause for SIGUSR1 if option specified.
+ *
+ * Test:
+ * Loop if the proper options are given.
+ * Execute system call
+ * Check return code, if system call failed (return=-1)
+ * Log the errno and Issue a FAIL message.
+ * Otherwise, Issue a PASS message.
+ *
+ * Cleanup:
+ * Print errno log and/or timing stats if options given
+ *
+ *
+ *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
#include <sys/utsname.h>
#include <errno.h>
#include <string.h>
-#include "tst_test.h"
+#include <signal.h>
+#include "test.h"
+
+void setup();
+void cleanup();
+
+char *TCID = "uname01";
+int TST_TOTAL = 1;
-static void verify_uname(void)
+struct utsname un;
+
+int main(int ac, char **av)
{
- struct utsname un;
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
- memset(&un, 0, sizeof(un));
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
- TST_EXP_PASS(uname(&un));
+ tst_count = 0;
- if (!TST_PASS)
- return;
+ TEST(uname(&un));
+
+ if (TEST_RETURN == -1)
+ tst_resm(TFAIL | TTERRNO, "uname failed");
+ else
+ tst_resm(TPASS, "uname(&un) returned %ld", TEST_RETURN);
- if (strcmp(un.sysname, "Linux")) {
- tst_res(TFAIL, "sysname is not Linux");
- return;
}
- tst_res(TPASS, "sysname set to Linux");
+ cleanup();
+ tst_exit();
}
-static struct tst_test test = {
- .test_all = verify_uname,
-};
+void setup(void)
+{
+ void trapper();
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/uname/uname02.c b/testcases/kernel/syscalls/uname/uname02.c
index cd4b15487..8b45a763d 100644
--- a/testcases/kernel/syscalls/uname/uname02.c
+++ b/testcases/kernel/syscalls/uname/uname02.c
@@ -1,30 +1,119 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
- * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
*
- * Basic test for uname():
- * Calling uname() with invalid buf got EFAULT.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * uname02.c
+ *
+ * DESCRIPTION
+ * uname02 - call uname() with an invalid address to produce a failure
+ *
+ * ALGORITHM
+ * loop if that option was specified
+ * issue the system call
+ * check the errno value
+ * issue a PASS message if we get EFAULT - errno 14
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * break any remaining tests
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * uname02 [-c n] [-e] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -e : Turn on errno logging.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions
+ * none
*/
+#include "test.h"
+
#include <errno.h>
#include <sys/utsname.h>
-#include "tst_test.h"
-static void *bad_addr;
+void cleanup(void);
+void setup(void);
+
+char *TCID = "uname02";
+int TST_TOTAL = 1;
-static void verify_uname(void)
+#if !defined(UCLINUX)
+
+int main(int ac, char **av)
{
- TST_EXP_FAIL(uname(bad_addr), EFAULT);
+ int lc;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ /*
+ * call the system call with the TEST() macro
+ * send -1 for an illegal address
+ */
+
+ TEST(uname((struct utsname *)-1));
+
+ if (TEST_RETURN == 0)
+ tst_resm(TFAIL, "call succeed when failure expected");
+
+ switch (TEST_ERRNO) {
+ case EFAULT:
+ tst_resm(TPASS | TTERRNO, "uname failed as expected");
+ break;
+ default:
+ tst_resm(TFAIL | TTERRNO, "uname failed unexpectedly");
+ }
+ }
+
+ cleanup();
+
+ tst_exit();
+
}
-static void setup(void)
+void setup(void)
{
- bad_addr = tst_get_bad_addr(NULL);
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
}
-static struct tst_test test = {
- .test_all = verify_uname,
- .setup = setup,
-};
+void cleanup(void)
+{
+}
+#else
+int main(void)
+{
+ tst_resm(TCONF, NULL, "test is not available on uClinux");
+}
+#endif /* if !defined(UCLINUX) */
diff --git a/testcases/kernel/syscalls/uname/uname03.c b/testcases/kernel/syscalls/uname/uname03.c
new file mode 100644
index 000000000..2f6292f0a
--- /dev/null
+++ b/testcases/kernel/syscalls/uname/uname03.c
@@ -0,0 +1,132 @@
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2001
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * NAME
+ * uname03.c
+ *
+ * DESCRIPTION
+ * uname03 - call uname() and make sure it succeeds
+ *
+ * ALGORITHM
+ * loop if that option was specified
+ * issue the system call
+ * check the errno value
+ * issue a PASS message if we get zero
+ * otherwise, the tests fails
+ * issue a FAIL message
+ * break any remaining tests
+ * call cleanup
+ *
+ * USAGE: <for command-line>
+ * uname03 [-c n] [-f] [-i n] [-I x] [-p x] [-t]
+ * where, -c n : Run n copies concurrently.
+ * -f : Turn off functionality Testing.
+ * -i n : Execute test n times.
+ * -I x : Execute test for x seconds.
+ * -P x : Pause for x seconds between iterations.
+ * -t : Turn on syscall timing.
+ *
+ * History
+ * 07/2001 John George
+ * -Ported
+ *
+ * Restrictions
+ * none
+ */
+
+#include "test.h"
+
+#include <errno.h>
+#include <sys/utsname.h>
+#include <string.h>
+
+void cleanup(void);
+void setup(void);
+
+char *TCID = "uname03";
+int TST_TOTAL = 1;
+
+#define LINUX "Linux"
+
+int main(int ac, char **av)
+{
+ int lc;
+ struct utsname *buf;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup(); /* global setup */
+
+ /* allocate some space for buf */
+
+ if ((buf = malloc((size_t)sizeof(struct utsname))) == NULL) {
+ tst_brkm(TBROK, cleanup, "malloc failed for buf");
+ }
+
+ /* The following loop checks looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ /* reset tst_count in case we are looping */
+ tst_count = 0;
+
+ /* Now make the system call with the TEST() macro */
+
+ TEST(uname(buf));
+
+ if (TEST_RETURN != 0) {
+ tst_resm(TFAIL, "%s failed - errno = %d - %s",
+ TCID, TEST_ERRNO, strerror(TEST_ERRNO));
+ } else {
+ if ((strcmp(buf->sysname, LINUX)) == 0) {
+ tst_resm(TPASS, "%s functionality test "
+ "succeeded", TCID);
+ } else {
+ tst_resm(TFAIL, "%s functionality test "
+ "failed", TCID);
+ }
+ }
+ }
+
+ free(buf);
+ buf = NULL;
+
+ cleanup();
+ tst_exit();
+}
+
+/*
+ * setup() - performs all the ONE TIME setup for this test.
+ */
+void setup(void)
+{
+
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+/*
+ * cleanup() - performs all the ONE TIME cleanup for this test at completion
+ * or premature exit.
+ */
+void cleanup(void)
+{
+
+}
diff --git a/testcases/kernel/syscalls/unlink/Makefile b/testcases/kernel/syscalls/unlink/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/unlink/Makefile
+++ b/testcases/kernel/syscalls/unlink/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/unlinkat/Makefile b/testcases/kernel/syscalls/unlinkat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/unlinkat/Makefile
+++ b/testcases/kernel/syscalls/unlinkat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/unlinkat/unlinkat01.c b/testcases/kernel/syscalls/unlinkat/unlinkat01.c
index 9e9a5d7db..76566e85a 100644
--- a/testcases/kernel/syscalls/unlinkat/unlinkat01.c
+++ b/testcases/kernel/syscalls/unlinkat/unlinkat01.c
@@ -1,109 +1,146 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) Linux Test Project, 2009-2021
* Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
* Copyright (c) International Business Machines Corp., 2006
- * Author: Yi Yang <yyangcdl@cn.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * DESCRIPTION
+ * This test case will verify basic function of unlinkat
+ * added by kernel 2.6.16 or up.
+ *
+ * Author
+ * Yi Yang <yyangcdl@cn.ibm.com>
*/
-/*\
- * [Description]
- * Basic unlinkat() test.
- */
-
-#include "tst_test.h"
+#define _GNU_SOURCE
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include "test.h"
+#include "safe_macros.h"
#include "lapi/syscalls.h"
-#include "tst_safe_stdio.h"
-#include "lapi/fcntl.h"
+
+#define TEST_CASES 7
+#ifndef AT_FDCWD
+#define AT_FDCWD -100
+#endif
+#ifndef AT_REMOVEDIR
+#define AT_REMOVEDIR 0x200
+#endif
+
+void setup();
+void cleanup();
+
+char *TCID = "unlinkat01";
+int TST_TOTAL = TEST_CASES;
static const char pathname[] = "unlinkattestdir",
subpathname[] = "unlinkatsubtestdir",
subpathdir[] = "unlinkattestdir/unlinkatsubtestdir",
testfile[] = "unlinkattestfile.txt",
testfile2[] = "unlinkattestdir/unlinkattestfile.txt";
-
static char *testfile3;
-static int fd;
-static int getfd(int i)
-{
- if (i == 2)
- fd = SAFE_OPEN(testfile3, O_CREAT | O_RDWR, 0600);
- else
- fd = SAFE_OPEN(pathname, O_DIRECTORY);
+static int fds[TEST_CASES];
+static const char *filenames[TEST_CASES];
+static const int expected_errno[] = { 0, 0, ENOTDIR, EBADF, EINVAL, 0, 0 };
+static const int flags[] = { 0, 0, 0, 0, 9999, 0, AT_REMOVEDIR };
- return fd;
+int myunlinkat(int dirfd, const char *filename, int flags)
+{
+ return ltp_syscall(__NR_unlinkat, dirfd, filename, flags);
}
-static struct tcase {
- int fd;
- const char *filename;
- int flag;
- int exp_errno;
-} tc[] = {
- {0, testfile, 0, 0},
- {0, NULL, 0, 0},
- {0, testfile, 0, ENOTDIR},
- {100, testfile, 0, EBADF},
- {0, testfile, 9999, EINVAL},
- {AT_FDCWD, testfile, 0, 0},
- {0, subpathname, AT_REMOVEDIR, 0},
-};
-
-static void run(unsigned int i)
+int main(int ac, char **av)
{
- /* tesfile2 will be unlinked by test0. */
- if (access(testfile2, F_OK))
- SAFE_FILE_PRINTF(testfile2, testfile2);
-
- /* testfile3 will be unlined by test1. */
- if (access(testfile3, F_OK))
- SAFE_OPEN(testfile3, O_CREAT | O_RDWR, 0600);
-
- /* subpathdir will be unlinked by test6. */
- if (access(subpathdir, F_OK))
- SAFE_MKDIR(subpathdir, 0700);
-
- /* testfile must exist except test1 and test6. */
- if (access(testfile, F_OK))
- SAFE_FILE_PRINTF(testfile, testfile);
-
- if (tc[i].fd)
- TEST(unlinkat(tc[i].fd, tc[i].filename, tc[i].flag));
- else
- TEST(unlinkat(getfd(i), tc[i].filename, tc[i].flag));
-
- if (TST_ERR == tc[i].exp_errno)
- tst_res(TPASS | TTERRNO, "unlinkat() returned expected errno");
- else
- tst_res(TFAIL | TTERRNO, "unlinkat() failed");
-
- if (!tc[i].fd)
- SAFE_CLOSE(fd);
+ int lc;
+ int i;
+
+ if ((tst_kvercmp(2, 6, 16)) < 0)
+ tst_brkm(TCONF, NULL, "Test must be run with kernel 2.6.16+");
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ for (i = 0; i < TST_TOTAL; i++) {
+ TEST(myunlinkat(fds[i], filenames[i], flags[i]));
+
+ if (TEST_ERRNO == expected_errno[i]) {
+ tst_resm(TPASS | TTERRNO,
+ "unlinkat() returned expected errno");
+ } else {
+ tst_resm(TFAIL | TTERRNO, "unlinkat() failed");
+ }
+ }
+
+ }
+
+ cleanup();
+ tst_exit();
}
-static void setup(void)
+void setup(void)
{
- char buf[PATH_MAX];
- SAFE_GETCWD(buf, PATH_MAX);
- SAFE_ASPRINTF(&testfile3, "%s/unlinkatfile3.txt", buf);
- tc[1].filename = testfile3;
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ tst_tmpdir();
+
+ char *abs_path = tst_get_tmpdir();
+
+ SAFE_ASPRINTF(cleanup, &testfile3, "%s/unlinkatfile3.txt", abs_path);
+
+ free(abs_path);
+
+ SAFE_MKDIR(cleanup, pathname, 0700);
+ SAFE_MKDIR(cleanup, subpathdir, 0700);
- SAFE_MKDIR(pathname, 0700);
+ fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY);
+ fds[1] = fds[4] = fds[6] = fds[0];
+
+ SAFE_FILE_PRINTF(cleanup, testfile, testfile);
+ SAFE_FILE_PRINTF(cleanup, testfile2, testfile2);
+
+ fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600);
+
+ fds[3] = 100;
+ fds[5] = AT_FDCWD;
+
+ filenames[0] = filenames[2] = filenames[3] = filenames[4] =
+ filenames[5] = testfile;
+ filenames[1] = testfile3;
+ filenames[6] = subpathname;
+
+ TEST_PAUSE;
}
-static void cleanup(void)
+void cleanup(void)
{
- SAFE_UNLINK(testfile);
- SAFE_UNLINK(testfile2);
- SAFE_RMDIR(pathname);
-}
+ if (fds[0] > 0)
+ close(fds[0]);
+ if (fds[2] > 0)
+ close(fds[2]);
-static struct tst_test test = {
- .needs_tmpdir = 1,
- .tcnt = ARRAY_SIZE(tc),
- .min_kver = "2.6.16",
- .setup = setup,
- .test = run,
- .cleanup = cleanup,
-};
+ free(testfile3);
+ tst_rmdir();
+}
diff --git a/testcases/kernel/syscalls/unshare/Makefile b/testcases/kernel/syscalls/unshare/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/unshare/Makefile
+++ b/testcases/kernel/syscalls/unshare/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c
index ad26a908d..52c774530 100644
--- a/testcases/kernel/syscalls/unshare/unshare01.c
+++ b/testcases/kernel/syscalls/unshare/unshare01.c
@@ -1,60 +1,291 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Crackerjack Project., 2007
- * Ported from Crackerjack to LTP by Manas Kumar Nayak maknayak@in.ibm.com>
- */
-
-/*\
- * [Description]
- *
- * Basic tests for the unshare() syscall.
- *
- * [Algorithm]
- *
- * Calls unshare() for different CLONE_* flags in a child process and expects
- * them to succeed.
- */
+/*************************************************************************/
+/* Copyright (c) Crackerjack Project., 2007 */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/
+/* */
+/*************************************************************************/
+/*************************************************************************/
+/* */
+/* File: unshare01.c */
+/* */
+/* Description: This tests the unshare() syscall. */
+/* unshare() allows a process to disassociate parts of its */
+/* execution context that are currently being shared with other */
+/* processes. Part of the execution context, such as the namespace */
+/* ,is shared implicitly when a new process is created using */
+/* fork(2) or vfork(2), while other parts, such as virtual memory */
+/* , may be shared by explicit request when creating a process */
+/* using clone(2). */
+/* */
+/* The main use of unshare() is to allow a process to control its */
+/* shared execution context without creating a new process. */
+/* */
+/* */
+/* The flags argument is a bit mask that specifies which parts of */
+/* the execution context should be unshared. This argument is */
+/* specified by ORing together zero or more of the following cons- */
+/* tants: */
+/* */
+/* CLONE_FILES: */
+/* Reverse the effect of the clone(2) CLONE_FILES flag. */
+/* Unshare the file descriptor table, so that the calling */
+/* process no longer shares its file descriptors with any */
+/* other process. */
+/* CLONE_FS: */
+/* Reverse the effect of the clone(2) CLONE_FS flag.Unshare*/
+/* file system attributes, so that the calling process no */
+/* longer shares its root directory, current directory, or */
+/* umask attributes with any other process. */
+/* CLONE_NEWNS: */
+/* This flag has the same effect as the clone(2) CLONE_NEWNS*/
+/* flag. Unshare the namespace, so that the calling process*/
+/* has a private copy of its namespacei which is not shared*/
+/* with any other process. Specifying this flag automat- */
+/* ically implies CLONE_FS as well. */
+/* */
+/* If flags is specified as zero, then unshare() is a no-op; no */
+/* changes are made to the calling process's execution context. */
+/* */
+/* Usage: <for command-line> */
+/* unshare01 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 1 */
+/* */
+/* Test Name: unshare01 */
+/* History: Porting from Crackerjack to LTP is done by */
+/* Manas Kumar Nayak maknayak@in.ibm.com> */
+/********************************************************************************/
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <limits.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <errno.h>
+#include <pwd.h>
+#include <grp.h>
+#include <string.h>
+#include <sys/param.h>
+#include <stdio.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
#include "config.h"
+char *TCID = "unshare01";
+int testno;
+int TST_TOTAL = 1;
+
#ifdef HAVE_UNSHARE
-static struct test_case_t {
- int mode;
- const char *desc;
-} tc[] = {
- {CLONE_FILES, "CLONE_FILES"},
- {CLONE_FS, "CLONE_FS"},
- {CLONE_NEWNS, "CLONE_NEWNS"},
-};
+/* Extern Global Functions */
+/******************************************************************************/
+/* */
+/* Function: cleanup */
+/* */
+/* Description: Performs all one time clean up for this test on successful */
+/* completion, premature exit or failure. Closes all temporary */
+/* files, removes all temporary directories exits the test with */
+/* appropriate return code by calling tst_exit() function. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */
+/* On success - Exits calling tst_exit(). With '0' return code. */
+/* */
+/******************************************************************************/
+void cleanup(void)
+{
+
+ tst_rmdir();
+}
-static void run(unsigned int i)
+/* Local Functions */
+/******************************************************************************/
+/* */
+/* Function: setup */
+/* */
+/* Description: Performs all one time setup for this test. This function is */
+/* typically used to capture signals, create temporary dirs */
+/* and temporary files that may be used in the course of this */
+/* test. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits by calling cleanup(). */
+/* On success - returns 0. */
+/* */
+/******************************************************************************/
+void setup(void)
{
- pid_t pid = SAFE_FORK();
- if (pid == 0)
- TST_EXP_PASS(unshare(tc[i].mode), "unshare(%s)", tc[i].desc);
+ tst_require_root();
+
+ /* Capture signals if any */
+ /* Create temporary directories */
+ TEST_PAUSE;
+ tst_tmpdir();
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .forks_child = 1,
- .needs_tmpdir = 1,
- .needs_root = 1,
- .test = run,
-};
+int main(int ac, char **av)
+{
+ pid_t pid1;
+ int lc;
+ int rval;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
+
+ pid1 = fork(); //call to fork()
+ if (pid1 == -1) {
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "fork failed");
+ } else if (pid1 == 0) {
+ switch (unshare(CLONE_FILES)) {
+ case 0:
+ printf("unshare with CLONE_FILES call "
+ "succeeded\n");
+ rval = 0;
+ break;
+ case -1:
+ if (errno == ENOSYS)
+ rval = 1;
+ else {
+ perror("unshare failed");
+ rval = 2;
+ }
+ }
+ exit(rval);
+ } else {
+ SAFE_WAIT(cleanup, &rval);
+ if (rval != 0 && WIFEXITED(rval)) {
+ switch (WEXITSTATUS(rval)) {
+ case 1:
+ tst_brkm(TCONF, cleanup,
+ "unshare not supported in "
+ "kernel");
+ break;
+ default:
+ tst_brkm(TFAIL, cleanup,
+ "unshare failed");
+ }
+ }
+ }
+
+ pid1 = fork();
+ if (pid1 == -1) {
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "fork failed");
+ } else if (pid1 == 0) {
+ switch (unshare(CLONE_FS)) {
+ case 0:
+ printf("unshare with CLONE_FS call "
+ "succeeded\n");
+ rval = 0;
+ break;
+ case -1:
+ if (errno == ENOSYS)
+ rval = 1;
+ else {
+ perror("unshare failed");
+ rval = 2;
+ }
+ }
+ exit(rval);
+ } else {
+ SAFE_WAIT(cleanup, &rval);
+ if (rval != 0 && WIFEXITED(rval)) {
+ switch (WEXITSTATUS(rval)) {
+ case 1:
+ tst_brkm(TCONF, cleanup,
+ "unshare not supported in "
+ "kernel");
+ break;
+ default:
+ tst_brkm(TFAIL, cleanup,
+ "unshare failed");
+ }
+ }
+ }
+
+ pid1 = fork();
+ if (pid1 == -1) {
+ tst_brkm(TFAIL | TERRNO, cleanup,
+ "fork() failed.");
+ } else if (pid1 == 0) {
+ switch (unshare(CLONE_NEWNS)) {
+ case 0:
+ printf("unshare call with CLONE_NEWNS "
+ "succeeded\n");
+ rval = 0;
+ break;
+ case -1:
+ if (errno == ENOSYS)
+ rval = 1;
+ else {
+ perror("unshare failed");
+ rval = 2;
+ }
+ }
+ exit(rval);
+ } else {
+ SAFE_WAIT(cleanup, &rval);
+ if (rval != 0 && WIFEXITED(rval)) {
+ switch (WEXITSTATUS(rval)) {
+ case 1:
+ tst_brkm(TCONF, cleanup,
+ "unshare not supported in "
+ "kernel");
+ break;
+ default:
+ tst_brkm(TFAIL, cleanup,
+ "unshare failed");
+ }
+ }
+
+ }
+
+ }
+
+ }
+ cleanup();
+ tst_exit();
+}
#else
-TST_TEST_TCONF("unshare is undefined.");
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "unshare is undefined.");
+}
#endif
diff --git a/testcases/kernel/syscalls/unshare/unshare02.c b/testcases/kernel/syscalls/unshare/unshare02.c
index 9b222fae2..18b8bf522 100644
--- a/testcases/kernel/syscalls/unshare/unshare02.c
+++ b/testcases/kernel/syscalls/unshare/unshare02.c
@@ -1,73 +1,218 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) Crackerjack Project., 2007
- * Ported from Crackerjack to LTP by Manas Kumar Nayak maknayak@in.ibm.com>
- */
-
-/*\
- * [Description]
- *
- * Basic tests for the unshare() errors.
- *
- * - EINVAL on invalid flags
- * - EPERM when process is missing required privileges
- */
+/******************************************************************************/
+/* Copyright (c) Crackerjack Project., 2007 */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/******************************************************************************/
+/******************************************************************************/
+/* */
+/* File: unshare02.c */
+/* */
+/* Description: This tests the unshare error() syscall */
+/* */
+/* Usage: <for command-line> */
+/* unshare02 [-c n] [-e][-i n] [-I x] [-p x] [-t] */
+/* where, -c n : Run n copies concurrently. */
+/* -e : Turn on errno logging. */
+/* -i n : Execute test n times. */
+/* -I x : Execute test for x seconds. */
+/* -P x : Pause for x seconds between iterations. */
+/* -t : Turn on syscall timing. */
+/* */
+/* Total Tests: 2 */
+/* */
+/* Test Name: unshare02 */
+/* History: Porting from Crackerjack to LTP is done by */
+/* Manas Kumar Nayak maknayak@in.ibm.com> */
+/******************************************************************************/
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <limits.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <errno.h>
#include <pwd.h>
+#include <grp.h>
+#include <string.h>
+#include <sys/param.h>
+#include <stdio.h>
-#include "tst_test.h"
+#include "test.h"
+#include "safe_macros.h"
#include "config.h"
+char *TCID = "unshare02";
+int testno;
+int TST_TOTAL = 2;
+
#ifdef HAVE_UNSHARE
-static uid_t nobody_uid;
+/* Extern Global Functions */
+/******************************************************************************/
+/* */
+/* Function: cleanup */
+/* */
+/* Description: Performs all one time clean up for this test on successful */
+/* completion, premature exit or failure. Closes all temporary */
+/* files, removes all temporary directories exits the test with */
+/* appropriate TEST_RETURNurn code by calling tst_exit() function. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits calling tst_exit(). Non '0' TEST_RETURNurn code. */
+/* On success - Exits calling tst_exit(). With '0' TEST_RETURNurn code. */
+/* */
+/******************************************************************************/
+void cleanup(void)
+{
-static struct test_case_t {
- int mode;
- int expected_error;
- const char *desc;
-} tc[] = {
- {-1, EINVAL, "-1"},
- {CLONE_NEWNS, EPERM, "CLONE_NEWNS"}
-};
+ tst_rmdir();
-static void run(unsigned int i)
-{
- pid_t pid = SAFE_FORK();
- if (pid == 0) {
- if (tc[i].expected_error == EPERM)
- SAFE_SETUID(nobody_uid);
+ /* Exit with appropriate TEST_RETURNurn code. */
- TST_EXP_FAIL(unshare(tc[i].mode), tc[i].expected_error,
- "unshare(%s)", tc[i].desc);
- }
}
-static void setup(void)
+/* Local Functions */
+/******************************************************************************/
+/* */
+/* Function: setup */
+/* */
+/* Description: Performs all one time setup for this test. This function is */
+/* typically used to capture signals, create temporary dirs */
+/* and temporary files that may be used in the course of this */
+/* test. */
+/* */
+/* Input: None. */
+/* */
+/* Output: None. */
+/* */
+/* Return: On failure - Exits by calling cleanup(). */
+/* On success - TEST_RETURNurns 0. */
+/* */
+/******************************************************************************/
+void setup(void)
{
- struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
- nobody_uid = ltpuser->pw_uid;
+ /* Capture signals if any */
+ /* Create temporary directories */
+ TEST_PAUSE;
+ tst_tmpdir();
}
-static struct tst_test test = {
- .tcnt = ARRAY_SIZE(tc),
- .forks_child = 1,
- .needs_tmpdir = 1,
- .needs_root = 1,
- .setup = setup,
- .test = run,
-};
+int main(int ac, char **av)
+{
+ pid_t pid1;
+ int lc;
+ int rval;
+
+ tst_parse_opts(ac, av, NULL, NULL);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
+
+ TEST(pid1 = fork()); //call to fork()
+ if (TEST_RETURN == -1) {
+ tst_brkm(TFAIL | TTERRNO, cleanup,
+ "fork() failed.");
+ } else if (TEST_RETURN == 0) {
+ TEST_RETURN = unshare(-1);
+ if (TEST_RETURN == 0) {
+ printf("Call unexpectedly succeeded\n");
+ rval = 1;
+ } else if (TEST_RETURN == -1) {
+ if (errno == EINVAL) {
+ printf("Got EINVAL\n");
+ rval = 0;
+ } else if (errno == ENOSYS) {
+ rval = 1;
+ } else {
+ perror("unshare failed");
+ rval = 2;
+ }
+ }
+ exit(rval);
+ } else {
+ SAFE_WAIT(cleanup, &rval);
+ if (rval != 0 && WIFEXITED(rval)) {
+ switch (WEXITSTATUS(rval)) {
+ case 1:
+ tst_brkm(TBROK, cleanup,
+ "unshare call unsupported "
+ "in kernel");
+ break;
+ case 2:
+ tst_brkm(TFAIL, cleanup,
+ "unshare call failed");
+ break;
+ }
+ }
+ }
+ TEST(pid1 = fork()); //call to fork()
+ if (pid1 == -1) {
+ tst_brkm(TFAIL | TTERRNO, cleanup,
+ "fork() failed.");
+ } else if (TEST_RETURN == 0) {
+ TEST_RETURN = unshare(0);
+ if (TEST_RETURN == 0) {
+ tst_resm(TPASS, "Call succeeded");
+ rval = 0;
+ } else if (TEST_RETURN == -1) {
+ if (errno == ENOSYS)
+ rval = 1;
+ else {
+ perror("unshare failed");
+ rval = 2;
+ }
+ }
+ exit(rval);
+ } else {
+ SAFE_WAIT(cleanup, &rval);
+ if (rval != 0 && WIFEXITED(rval)) {
+ switch (WEXITSTATUS(rval)) {
+ case 1:
+ tst_brkm(TBROK, cleanup,
+ "unshare call unsupported "
+ "in kernel");
+ break;
+ case 2:
+ tst_brkm(TFAIL, cleanup,
+ "unshare call failed");
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ cleanup();
+ tst_exit();
+}
#else
-TST_TEST_TCONF("unshare is undefined.");
+int main(void)
+{
+ tst_brkm(TCONF, NULL, "unshare is undefined.");
+}
#endif
diff --git a/testcases/kernel/syscalls/ustat/Makefile b/testcases/kernel/syscalls/ustat/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/ustat/Makefile
+++ b/testcases/kernel/syscalls/ustat/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/utils/common_j_h.c b/testcases/kernel/syscalls/utils/common_j_h.c
new file mode 100644
index 000000000..dbdbc117a
--- /dev/null
+++ b/testcases/kernel/syscalls/utils/common_j_h.c
@@ -0,0 +1,260 @@
+/*
+ * Crackerjack Project
+ *
+ * Copyright (C) 2007-2008, Hitachi, Ltd.
+ * Author(s): Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
+ * Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id: common_j_h.c,v 1.5 2009/11/20 06:48:31 yaberauneya Exp $
+ *
+ */
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <mqueue.h>
+#include "include_j_h.h"
+#include "test.h"
+
+#define barrier() __asm__ __volatile__("": : :"memory")
+#define WITH_SIGNALS_BLOCKED(code) { \
+ sigset_t held_sigs_; \
+ sigfillset(&held_sigs_); \
+ sigprocmask(SIG_SETMASK, &held_sigs_, &held_sigs_); \
+ barrier(); \
+ code; \
+ barrier(); \
+ sigprocmask(SIG_SETMASK, &held_sigs_, NULL); \
+ }
+
+/*
+ * Change user ID
+ *
+ * We assume 'test' executable is executed with 'root' permission.
+ * So, if you use this function, you can not return 'root' uid.
+ */
+int setup_uid(char *uname)
+{
+ struct passwd *pw;
+ int rc;
+
+ pw = getpwnam(uname);
+ if (!pw) {
+ EPRINTF("getpwnam failed.\n");
+ return -1;
+ }
+ rc = setuid(pw->pw_uid);
+ if (rc < 0) {
+ EPRINTF("setuid failed.\n");
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * Change effective user ID
+ */
+int setup_euid(char *uname, uid_t * old_uid)
+{
+ struct passwd *pw;
+ int rc;
+
+ *old_uid = geteuid();
+ pw = getpwnam(uname);
+ if (!pw) {
+ EPRINTF("getpwnam failed.\n");
+ return -1;
+ }
+ rc = seteuid(pw->pw_uid);
+ if (rc < 0) {
+ EPRINTF("seteuid failed.\n");
+ return -1;
+ }
+ return 0;
+}
+
+int cleanup_euid(uid_t old_uid)
+{
+ int rc;
+
+ rc = seteuid(old_uid);
+ if (rc < 0) {
+ EPRINTF("seteuid failed.\n");
+ return -1;
+ }
+ return 0;
+}
+
+static void sigterm_handler(int sig)
+{
+ _exit(0);
+}
+
+/*
+ * Generate a child process which will send a signal
+ */
+pid_t create_sig_proc(unsigned long usec, int sig, unsigned count)
+{
+ pid_t pid, cpid;
+
+ pid = getpid();
+ WITH_SIGNALS_BLOCKED(if ((cpid = fork()) == 0) {
+ tst_sig(NOFORK, SIG_DFL, NULL);
+ signal(SIGTERM, sigterm_handler);}
+ ) ;
+ switch (cpid) {
+ case 0:
+ while (count-- > 0) {
+ usleep(usec);
+ if (kill(pid, sig) == -1)
+ break;
+ }
+ _exit(0);
+ break;
+ case -1:
+ EPRINTF("fork failed.\n");
+ return cpid;
+ default:
+ return cpid;
+ }
+}
+
+/*
+ * Create and delete test file
+ */
+int setup_file(char *testdir, char *fname, char *path)
+{
+ return _setup_file(testdir, fname, path,
+ O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
+}
+
+int _setup_file(char *testdir, char *fname, char *path, int flags, mode_t mode)
+{
+ int rc;
+
+ sprintf(path, "%s/%s", testdir, fname);
+ rc = open(path, flags, mode);
+ if (rc < 0) {
+ EPRINTF("open failed.\n");
+ return -1;
+ }
+ return rc;
+}
+
+int cleanup_file(char *path)
+{
+ unlink(path);
+ return 0;
+}
+
+/*
+ * Create and delete swap file
+ */
+/* swap file needs to be more than 40KB */
+#define MIN_SWAPFILE_SIZE (64 * 1024)
+int setup_swapfile(char *testdir, char *fname, char *path, size_t size)
+{
+ int fd = -1, rc;
+ size_t r_sz;
+ int cmdlen = 256;
+ char cmd[cmdlen];
+ char *p = NULL;
+
+ sprintf(path, "%s/%s", testdir, fname);
+ fd = open(path, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
+ if (fd < 0) {
+ EPRINTF("open failed.\n");
+ goto ERR_EXIT;
+ }
+ if (size < MIN_SWAPFILE_SIZE) {
+ EPRINTF("size too short.\n");
+ goto ERR_EXIT;
+ }
+ p = malloc(size);
+ if (!p) {
+ EPRINTF("malloc failed.\n");
+ goto ERR_EXIT;
+ }
+ /* Swap file must not have hole area */
+ memset(p, 0x5a, size);
+ r_sz = (size_t) write(fd, p, size);
+ if (r_sz != size) {
+ EPRINTF("write failed.\n");
+ goto ERR_EXIT;
+ }
+ snprintf(cmd, cmdlen, "/sbin/mkswap %s > /dev/null 2>&1", path);
+ rc = system(cmd);
+ if (rc != 0) {
+ EPRINTF("system(%s) failed.\n", cmd);
+ goto ERR_EXIT;
+ }
+ return fd;
+
+ERR_EXIT:
+ if (fd >= 0)
+ close(fd);
+ if (p)
+ free(p);
+ return -1;
+}
+
+int cleanup_swapfile(char *path)
+{
+ unlink(path);
+ return 0;
+}
+
+#if 0
+/*
+ * Check max nodes from /sys/devices/system/node/node* files (for NUMA)
+ */
+int get_max_nodes(void)
+{
+ /* We assume that there is only one node */
+ return 1;
+}
+#endif
+
+/*
+ * Get unexist pid
+ */
+pid_t get_unexist_pid(void)
+{
+ pid_t pid;
+ int st;
+
+ pid = fork();
+ switch (pid) {
+ case -1:
+ EPRINTF("fork failed.\n");
+ return -1;
+ case 0:
+ _exit(0);
+ default:
+ wait(&st);
+ return pid;
+ }
+}
diff --git a/testcases/kernel/syscalls/utils/compat_16.mk b/testcases/kernel/syscalls/utils/compat_16.mk
index e81a00c40..a0ff8f558 100644
--- a/testcases/kernel/syscalls/utils/compat_16.mk
+++ b/testcases/kernel/syscalls/utils/compat_16.mk
@@ -50,7 +50,7 @@
CPPFLAGS += -I$(abs_srcdir) -I$(abs_srcdir)/../utils
-SRCS ?= $(sort $(wildcard $(abs_srcdir)/*.c))
+SRCS ?= $(wildcard $(abs_srcdir)/*.c)
MAKE_TARGETS := $(notdir $(patsubst %.c,%,$(SRCS)))
MAKE_TARGETS_OBJS_WO_COMPAT_16 := $(addsuffix .o,$(MAKE_TARGETS))
diff --git a/testcases/kernel/syscalls/utils/include_j_h.h b/testcases/kernel/syscalls/utils/include_j_h.h
new file mode 100644
index 000000000..742d96401
--- /dev/null
+++ b/testcases/kernel/syscalls/utils/include_j_h.h
@@ -0,0 +1,143 @@
+/*
+ * Crackerjack Project
+ *
+ * Copyright (C) 2007-2008, Hitachi, Ltd.
+ * Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
+ * Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
+ * Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id: include_j_h.h,v 1.2 2009/09/27 17:34:22 subrata_modak Exp $
+ *
+ */
+#ifndef __CJK_SYSCALL_J_H__
+#define __CJK_SYSCALL_J_H__
+
+#include <sys/time.h>
+#include <sys/resource.h>
+
+
+#define REG_RESULT_LOG_FP stdout
+#define REG_DETAIL_LOG_FP stderr
+
+
+/*
+ * RPRINTF : macro to output test result
+ */
+#define RPRINTF(...) \
+ do { \
+ fprintf(REG_RESULT_LOG_FP, __VA_ARGS__); \
+ } while (0)
+
+
+/*
+ * PRINTF : macro to output detail log
+ */
+#define PRINTF(...) \
+ do { \
+ fprintf(REG_DETAIL_LOG_FP, __VA_ARGS__); \
+ } while (0)
+
+
+/*
+ * EPRINTF : macro to output error message
+ */
+#define EPRINTF(...) \
+ do { \
+ fprintf(REG_DETAIL_LOG_FP, __VA_ARGS__); \
+ } while (0)
+
+/*
+ * PRINT_XXX : macro to output test result and expect
+ */
+#define __PRINT_EXPECT(rc_has_range, rc, errno) \
+ do { \
+ if (rc_has_range) \
+ PRINTF("EXPECT: return value(ret)=%s", \
+ (rc) >= 0 ? "(N >= 0)" : "(N < 0)"); \
+ else \
+ PRINTF("EXPECT: return value(ret)=%d", rc); \
+ PRINTF(" errno=%d (%s)", errno, strerror(errno)); \
+ } while (0)
+
+#define __PRINT_RESULT(rc_has_range, rc, errno) \
+ do { \
+ if (rc_has_range) \
+ PRINTF("RESULT: return value(ret)=%8d", rc); \
+ else \
+ PRINTF("RESULT: return value(ret)=%d", rc); \
+ PRINTF(" errno=%d (%s)", errno, strerror(errno)); \
+ } while (0)
+
+#define PRINT_RESULT(rc_has_range, e_rc, e_errno, r_rc, r_errno) \
+ do { \
+ __PRINT_EXPECT(rc_has_range, e_rc, e_errno); \
+ PRINTF("\n"); \
+ __PRINT_RESULT(rc_has_range, r_rc, r_errno); \
+ PRINTF("\n"); \
+ } while (0)
+
+#define PRINT_RESULT_EXTRA(rc_has_range, e_rc, e_errno, r_rc, r_errno, \
+ str, extra_ok) \
+ do { \
+ __PRINT_EXPECT(rc_has_range, e_rc, e_errno); \
+ if ((extra_ok)) \
+ PRINTF("\n"); \
+ else \
+ PRINTF(", %s=OK\n", str); \
+ __PRINT_RESULT(rc_has_range, r_rc, r_errno); \
+ if ((extra_ok)) \
+ PRINTF("\n"); \
+ else \
+ PRINTF(", %s=NG\n", str); \
+ } while (0)
+
+#define PRINT_RESULT_CMP(rc_has_range, e_rc, e_errno, r_rc, r_errno, cmp_ok) \
+ PRINT_RESULT_EXTRA(rc_has_range, e_rc, e_errno, r_rc, r_errno, \
+ "r/w check", cmp_ok)
+
+
+/*
+ * Definitions
+ */
+enum result_val {
+ RESULT_OK,
+ RESULT_NG
+};
+
+
+/*
+ * Prototype
+ */
+int setup_uid(char *uname);
+int setup_euid(char *uname, uid_t *old_uid);
+int cleanup_euid(uid_t old_uid);
+
+pid_t create_sig_proc(unsigned long usec, int sig, unsigned count);
+
+int _setup_file(char *testdir, char *fname, char *path, int flags, mode_t mode);
+int setup_file(char *testdir, char *fname, char *path);
+int cleanup_file(char *path);
+
+int setup_swapfile(char *testdir, char *fname, char *path, size_t size);
+int cleanup_swapfile(char *path);
+
+#define QUEUE_NAME "/test_mqueue"
+pid_t create_echo_msg_proc(void);
+
+pid_t get_unexist_pid(void);
+
+#endif /* __CJK_SYSCALL_J_H__ */
diff --git a/testcases/kernel/syscalls/utils/mq_timed.h b/testcases/kernel/syscalls/utils/mq_timed.h
index adf46034b..a163ddcee 100644
--- a/testcases/kernel/syscalls/utils/mq_timed.h
+++ b/testcases/kernel/syscalls/utils/mq_timed.h
@@ -1,58 +1,59 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MQ_TIMED_H
#define MQ_TIMED_H
#include "mq.h"
-#include "time64_variants.h"
-#include "tst_timer.h"
-
-static struct time64_variants variants[] = {
- { .clock_gettime = libc_clock_gettime, .mqt_send = libc_mq_timedsend, .mqt_receive = libc_mq_timedreceive, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
-
-#if (__NR_mq_timedsend != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .mqt_send = sys_mq_timedsend, .mqt_receive = sys_mq_timedreceive, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
-
-#if (__NR_mq_timedsend_time64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .mqt_send = sys_mq_timedsend64, .mqt_receive = sys_mq_timedreceive64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
-#endif
-};
struct test_case {
int *fd;
unsigned int len;
unsigned int prio;
- struct tst_ts *rq;
- long tv_sec;
- long tv_nsec;
+ struct timespec *rq;
int invalid_msg;
int send;
int signal;
int timeout;
- int bad_msg_addr;
- int bad_ts_addr;
int ret;
int err;
};
-static pid_t set_sig(struct tst_ts *ts,
- int (*gettime)(clockid_t clk_id, void *ts))
+static pid_t set_sig(struct timespec *ts)
{
- gettime(CLOCK_REALTIME, tst_ts_get(ts));
- *ts = tst_ts_add_us(*ts, 3000000);
+ clock_gettime(CLOCK_REALTIME, ts);
+ ts->tv_sec += 3;
- return create_sig_proc(SIGINT, 40, 50000);
+ return create_sig_proc(SIGINT, 40, 200000);
+}
+
+static void set_timeout(struct timespec *ts)
+{
+ clock_gettime(CLOCK_REALTIME, ts);
+ ts->tv_nsec += 50000000;
+ ts->tv_sec += ts->tv_nsec / 1000000000;
+ ts->tv_nsec %= 1000000000;
}
-static void set_timeout(struct tst_ts *ts,
- int (*gettime)(clockid_t clk_id, void *ts))
+static void send_msg(int fd, int len, int prio)
{
- gettime(CLOCK_REALTIME, tst_ts_get(ts));
- *ts = tst_ts_add_us(*ts, 10000);
+ if (mq_timedsend(fd, smsg, len, prio,
+ &((struct timespec){0})) < 0)
+ tst_brk(TBROK | TERRNO, "mq_timedsend failed");
}
static void kill_pid(pid_t pid)
diff --git a/testcases/kernel/syscalls/utils/newer_64.mk b/testcases/kernel/syscalls/utils/newer_64.mk
index 5e798057a..8cd7e03c8 100644
--- a/testcases/kernel/syscalls/utils/newer_64.mk
+++ b/testcases/kernel/syscalls/utils/newer_64.mk
@@ -25,7 +25,7 @@
CPPFLAGS += -I$(abs_srcdir) -I$(abs_srcdir)/../utils
-SRCS ?= $(sort $(wildcard $(abs_srcdir)/*.c))
+SRCS ?= $(wildcard $(abs_srcdir)/*.c)
MAKE_TARGETS := $(notdir $(patsubst %.c,%,$(SRCS)))
diff --git a/testcases/kernel/syscalls/utils/poll.h b/testcases/kernel/syscalls/utils/poll.h
new file mode 100644
index 000000000..2cd4929ab
--- /dev/null
+++ b/testcases/kernel/syscalls/utils/poll.h
@@ -0,0 +1,27 @@
+#ifndef __i386_POLL_H
+#define __i386_POLL_H
+
+/* These are specified by iBCS2 */
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+
+/* The rest seem to be more-or-less nonstandard. Check them! */
+#define POLLRDNORM 0x0040
+#define POLLRDBAND 0x0080
+#define POLLWRNORM 0x0100
+#define POLLWRBAND 0x0200
+#define POLLMSG 0x0400
+#define POLLREMOVE 0x1000
+#define POLLRDHUP 0x2000
+
+struct pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+
+#endif
diff --git a/testcases/kernel/syscalls/utime/Makefile b/testcases/kernel/syscalls/utime/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/utime/Makefile
+++ b/testcases/kernel/syscalls/utime/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/utimensat/Makefile b/testcases/kernel/syscalls/utimensat/Makefile
index 044619fb8..da655d7e2 100644
--- a/testcases/kernel/syscalls/utimensat/Makefile
+++ b/testcases/kernel/syscalls/utimensat/Makefile
@@ -1,8 +1,27 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
+vpath %.c $(srcdir):$(top_srcdir)/lib
+
+INSTALL_TARGETS := utimensat_tests.sh
+
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c
index ac267e7d9..264ca1e15 100644
--- a/testcases/kernel/syscalls/utimensat/utimensat01.c
+++ b/testcases/kernel/syscalls/utimensat/utimensat01.c
@@ -1,320 +1,282 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2008 Michael Kerrisk <mtk.manpages@gmail.com>
- * Copyright (c) 2008 Subrata Modak <subrata@linux.vnet.ibm.com>
- * Copyright (c) 2020 Viresh Kumar <viresh.kumar@linaro.org>
- *
- * Basic utimnsat() test.
- */
+/*************************************************************************************/
+/* */
+/* Copyright (C) 2008, Michael Kerrisk <mtk.manpages@gmail.com>, */
+/* Copyright (C) 2008, Linux Foundation */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
+/* the GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/*************************************************************************************/
+/* */
+/* File: utimnsat01.c */
+/* Description: A command-line interface for testing the utimensat() system call. */
+/* Author: Michael Kerrisk <mtk.manpages@gmail.com> */
+/* History: */
+/* 17 Mar 2008 Initial creation, */
+/* 31 May 2008 Reworked for easier test automation, */
+/* 2 June 2008 Renamed from t_utimensat.c to test_utimensat.c, */
+/* 05 June 2008 Submitted to LTP by Subrata Modak <subrata@linux.vnet.ibm.com> */
+/*************************************************************************************/
#define _GNU_SOURCE
+#define _ATFILE_SOURCE
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/syscall.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
-#include "lapi/fs.h"
-#include "lapi/utime.h"
-#include "time64_variants.h"
-#include "tst_timer.h"
-
-#define MNTPOINT "mntpoint"
-#define TEST_FILE MNTPOINT"/test_file"
-#define TEST_DIR MNTPOINT"/test_dir"
-
-static void *bad_addr;
-
-struct mytime {
- long access_tv_sec;
- long access_tv_nsec;
- long mod_tv_sec;
- long mod_tv_nsec;
- int atime_change;
- int mtime_change;
-};
-
-static struct mytime tnn = {0, UTIME_NOW, 0, UTIME_NOW, 1, 1};
-static struct mytime too = {0, UTIME_OMIT, 0, UTIME_OMIT, 0, 0};
-static struct mytime tno = {0, UTIME_NOW, 0, UTIME_OMIT, 1, 0};
-static struct mytime ton = {0, UTIME_OMIT, 0, UTIME_NOW, 0, 1};
-static struct mytime t11 = {1, 1, 1, 1, 1, 1};
-
-struct test_case {
- int dirfd;
- char *pathname;
- struct mytime *mytime;
- int flags;
- int oflags;
- int attr;
- int mode;
- int exp_err;
-} tcase[] = {
- /* Testing read-only file */
- {AT_FDCWD, TEST_FILE, NULL, 0, O_RDONLY, 0, 0400, 0},
- {AT_FDCWD, TEST_FILE, &tnn, 0, O_RDONLY, 0, 0400, 0},
- {AT_FDCWD, TEST_FILE, &too, 0, O_RDONLY, 0, 0400, 0},
- {AT_FDCWD, TEST_FILE, &tno, 0, O_RDONLY, 0, 0400, 0},
- {AT_FDCWD, TEST_FILE, &ton, 0, O_RDONLY, 0, 0400, 0},
- {AT_FDCWD, TEST_FILE, &t11, 0, O_RDONLY, 0, 0400, 0},
-
- /* Testing writable file */
- {AT_FDCWD, TEST_FILE, NULL, 0, O_RDONLY, 0, 0666, 0},
- {AT_FDCWD, TEST_FILE, &tnn, 0, O_RDONLY, 0, 0666, 0},
- {AT_FDCWD, TEST_FILE, &too, 0, O_RDONLY, 0, 0666, 0},
- {AT_FDCWD, TEST_FILE, &tno, 0, O_RDONLY, 0, 0666, 0},
- {AT_FDCWD, TEST_FILE, &ton, 0, O_RDONLY, 0, 0666, 0},
- {AT_FDCWD, TEST_FILE, &t11, 0, O_RDONLY, 0, 0666, 0},
-
- /* Testing append-only file */
- {AT_FDCWD, TEST_FILE, NULL, 0, O_RDONLY, FS_APPEND_FL, 0600, 0},
- {AT_FDCWD, TEST_FILE, &tnn, 0, O_RDONLY, FS_APPEND_FL, 0600, 0},
- {AT_FDCWD, TEST_FILE, &too, 0, O_RDONLY, FS_APPEND_FL, 0600, 0},
- {AT_FDCWD, TEST_FILE, &tno, 0, O_RDONLY, FS_APPEND_FL, 0600, EPERM},
- {AT_FDCWD, TEST_FILE, &ton, 0, O_RDONLY, FS_APPEND_FL, 0600, EPERM},
- {AT_FDCWD, TEST_FILE, &t11, 0, O_RDONLY, FS_APPEND_FL, 0600, EPERM},
-
- /* Testing immutable file */
- {AT_FDCWD, TEST_FILE, NULL, 0, O_RDONLY, FS_IMMUTABLE_FL, 0600, -1},
- {AT_FDCWD, TEST_FILE, &tnn, 0, O_RDONLY, FS_IMMUTABLE_FL, 0600, -1},
- {AT_FDCWD, TEST_FILE, &too, 0, O_RDONLY, FS_IMMUTABLE_FL, 0600, 0},
- {AT_FDCWD, TEST_FILE, &tno, 0, O_RDONLY, FS_IMMUTABLE_FL, 0600, EPERM},
- {AT_FDCWD, TEST_FILE, &ton, 0, O_RDONLY, FS_IMMUTABLE_FL, 0600, EPERM},
- {AT_FDCWD, TEST_FILE, &t11, 0, O_RDONLY, FS_IMMUTABLE_FL, 0600, EPERM},
-
- /* Testing immutable-append-only file */
- {AT_FDCWD, TEST_FILE, NULL, 0, O_RDONLY, FS_APPEND_FL|FS_IMMUTABLE_FL, 0600, -1},
- {AT_FDCWD, TEST_FILE, &tnn, 0, O_RDONLY, FS_APPEND_FL|FS_IMMUTABLE_FL, 0600, -1},
- {AT_FDCWD, TEST_FILE, &too, 0, O_RDONLY, FS_APPEND_FL|FS_IMMUTABLE_FL, 0600, 0},
- {AT_FDCWD, TEST_FILE, &tno, 0, O_RDONLY, FS_APPEND_FL|FS_IMMUTABLE_FL, 0600, EPERM},
- {AT_FDCWD, TEST_FILE, &ton, 0, O_RDONLY, FS_APPEND_FL|FS_IMMUTABLE_FL, 0600, EPERM},
- {AT_FDCWD, TEST_FILE, &t11, 0, O_RDONLY, FS_APPEND_FL|FS_IMMUTABLE_FL, 0600, EPERM},
-
- /* Other failure tests */
- {AT_FDCWD, TEST_FILE, NULL, 0, O_RDONLY, 0, 0400, EFAULT},
- {AT_FDCWD, NULL, &tnn, 0, O_RDONLY, 0, 0400, EFAULT},
- {-1, NULL, &tnn, AT_SYMLINK_NOFOLLOW, O_RDONLY, 0, 0400, EINVAL},
- {-1, TEST_FILE, &tnn, 0, O_RDONLY, 0, 0400, ENOENT},
-};
-
-static inline int sys_utimensat(int dirfd, const char *pathname,
- void *times, int flags)
-{
- return tst_syscall(__NR_utimensat, dirfd, pathname, times, flags);
-}
+#include "test.h"
+#include "lapi/syscalls.h"
-static inline int sys_utimensat_time64(int dirfd, const char *pathname,
- void *times, int flags)
-{
- return tst_syscall(__NR_utimensat_time64, dirfd, pathname, times, flags);
-}
+char *TCID = "utimensat01";
+int TST_TOTAL = 0;
-static struct time64_variants variants[] = {
-#if (__NR_utimensat != __LTP__NR_INVALID_SYSCALL)
- { .utimensat = sys_utimensat, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
-#endif
+#define cleanup tst_exit
+
+/* We use EXIT_FAILURE for an expected failure from utimensat()
+ (e.g., EACCES and EPERM), and one of the following for unexpected
+ failures (i.e., something broke in our test setup). */
-#if (__NR_utimensat_time64 != __LTP__NR_INVALID_SYSCALL)
- { .utimensat = sys_utimensat_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+#ifndef AT_FDCWD
+#define AT_FDCWD -100
#endif
-};
+#ifndef AT_SYMLINK_NOFOLLOW
+#define AT_SYMLINK_NOFOLLOW 0x100
+#endif
+
+#define EXIT_bad_usage 3
+#define EXIT_failed_syscall 3
+
+#define errExit(msg) do { perror(msg); exit(EXIT_failed_syscall); \
+ } while (0)
-union tst_multi {
- struct timespec libc_ts[2];
- struct __kernel_old_timespec kern_old_ts[2];
- struct __kernel_timespec kern_ts[2];
-} ts;
+#define UTIME_NOW ((1l << 30) - 1l)
+#define UTIME_OMIT ((1l << 30) - 2l)
-static void tst_multi_set_time(enum tst_ts_type type, struct mytime *mytime)
+static inline int
+utimensat_sc(int dirfd, const char *pathname,
+ const struct timespec times[2], int flags)
{
- switch (type) {
- case TST_LIBC_TIMESPEC:
- ts.libc_ts[0].tv_sec = mytime->access_tv_sec;
- ts.libc_ts[0].tv_nsec = mytime->access_tv_nsec;
- ts.libc_ts[1].tv_sec = mytime->mod_tv_sec;
- ts.libc_ts[1].tv_nsec = mytime->mod_tv_nsec;
- break;
- case TST_KERN_OLD_TIMESPEC:
- ts.kern_old_ts[0].tv_sec = mytime->access_tv_sec;
- ts.kern_old_ts[0].tv_nsec = mytime->access_tv_nsec;
- ts.kern_old_ts[1].tv_sec = mytime->mod_tv_sec;
- ts.kern_old_ts[1].tv_nsec = mytime->mod_tv_nsec;
- break;
- case TST_KERN_TIMESPEC:
- ts.kern_ts[0].tv_sec = mytime->access_tv_sec;
- ts.kern_ts[0].tv_nsec = mytime->access_tv_nsec;
- ts.kern_ts[1].tv_sec = mytime->mod_tv_sec;
- ts.kern_ts[1].tv_nsec = mytime->mod_tv_nsec;
- break;
- default:
- tst_brk(TBROK, "Invalid type: %d", type);
- }
+ return ltp_syscall(__NR_utimensat, dirfd, pathname, times, flags);
}
-static void update_error(struct test_case *tc)
+static void usageError(char *progName)
{
- static struct tst_kern_exv kvers[] = {
- /* Ubuntu kernel has patch b3b4283 since 4.4.0-48.69 */
- { "UBUNTU", "4.4.0-48.69" },
- { NULL, NULL},
- };
-
- if (tc->exp_err != -1)
- return;
-
- /*
- * Starting with 4.8.0 operations on immutable files return EPERM
- * instead of EACCES.
- * This patch has also been merged to stable 4.4 with
- * b3b4283 ("vfs: move permission checking into notify_change() for utimes(NULL)")
- */
- if (tst_kvercmp2(4, 4, 27, kvers) < 0)
- tc->exp_err = EACCES;
- else
- tc->exp_err = EPERM;
+ fprintf(stderr, "Usage: %s pathname [atime-sec "
+ "atime-nsec mtime-sec mtime-nsec]\n\n", progName);
+ fprintf(stderr, "Permitted options are:\n");
+ fprintf(stderr, " [-d path] "
+ "open a directory file descriptor"
+ " (instead of using AT_FDCWD)\n");
+ fprintf(stderr, " -q Quiet\n");
+ fprintf(stderr, " -w Open directory file "
+ "descriptor with O_RDWR|O_APPEND\n"
+ " (instead of O_RDONLY)\n");
+ fprintf(stderr, " -n Use AT_SYMLINK_NOFOLLOW\n");
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, "pathname can be \"NULL\" to use NULL "
+ "argument in call\n");
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, "Either nsec field can be\n");
+ fprintf(stderr, " 'n' for UTIME_NOW\n");
+ fprintf(stderr, " 'o' for UTIME_OMIT\n");
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, "If the time fields are omitted, "
+ "then a NULL 'times' argument is used\n");
+ fprintf(stderr, "\n");
+
+ exit(EXIT_bad_usage);
}
-static void change_attr(struct test_case *tc, int fd, int set)
+int main(int argc, char *argv[])
{
- int attr;
-
- if (!tc->attr)
- return;
+ int flags, dirfd, opt, oflag;
+ struct timespec ts[2];
+ struct timespec *tsp;
+ char *pathname, *dirfdPath;
+ struct stat sb;
+ int verbose;
+
+ /* Command-line argument parsing */
+
+ flags = 0;
+ verbose = 1;
+ dirfd = AT_FDCWD;
+ dirfdPath = NULL;
+ oflag = O_RDONLY;
+
+ while ((opt = getopt(argc, argv, "d:nqw")) != -1) {
+ switch (opt) {
+ case 'd':
+ dirfdPath = optarg;
+ break;
+
+ case 'n':
+ flags |= AT_SYMLINK_NOFOLLOW;
+ if (verbose)
+ printf("Not following symbolic links\n");
+ break;
+
+ case 'q':
+ verbose = 0;
+ break;
+
+ case 'w':
+ oflag = O_RDWR | O_APPEND;
+ break;
+
+ default:
+ usageError(argv[0]);
+ }
+ }
- if (ioctl(fd, FS_IOC_GETFLAGS, &attr)) {
- if (errno == ENOTTY)
- tst_brk(TCONF | TERRNO, "Attributes not supported by FS");
- else
- tst_brk(TBROK | TERRNO, "ioctl(fd, FS_IOC_GETFLAGS, &attr) failed");
+ if ((optind + 5 != argc) && (optind + 1 != argc))
+ usageError(argv[0]);
+
+ if (dirfdPath != NULL) {
+ dirfd = open(dirfdPath, oflag);
+ if (dirfd == -1)
+ errExit("open");
+
+ if (verbose) {
+ printf("Opened dirfd %d", oflag);
+ if ((oflag & O_ACCMODE) == O_RDWR)
+ printf(" O_RDWR");
+ if (oflag & O_APPEND)
+ printf(" O_APPEND");
+ printf(": %s\n", dirfdPath);
+ }
}
- if (set)
- attr |= tc->attr;
- else
- attr &= ~tc->attr;
+ pathname = (strcmp(argv[optind], "NULL") == 0) ? NULL : argv[optind];
- SAFE_IOCTL(fd, FS_IOC_SETFLAGS, &attr);
-}
+ /* Either, we get no values for 'times' fields, in which case
+ we give a NULL pointer to utimensat(), or we get four values,
+ for secs+nsecs for each of atime and mtime. The special
+ values 'n' and 'o' can be used for tv_nsec settings of
+ UTIME_NOW and UTIME_OMIT, respectively. */
-static void reset_time(char *pathname, int dfd, int flags, int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct stat sb;
+ if (argc == optind + 1) {
+ tsp = NULL;
- memset(&ts, 0, sizeof(ts));
- TEST(tv->utimensat(dfd, pathname, &ts, flags));
- if (TST_RET) {
- tst_res(TINFO | TTERRNO, "%2d: utimensat(%d, %s, {0, 0}, %d) failed",
- i, dfd, pathname, flags);
- }
+ } else {
+ ts[0].tv_sec = atoi(argv[optind + 1]);
+ if (argv[optind + 2][0] == 'n') {
+ ts[0].tv_nsec = UTIME_NOW;
+ } else if (argv[optind + 2][0] == 'o') {
+ ts[0].tv_nsec = UTIME_OMIT;
+ } else {
+ ts[0].tv_nsec = atoi(argv[optind + 2]);
+ }
- TEST(stat(pathname, &sb));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "%2d: stat() failed", i);
- } else if (sb.st_atime || sb.st_mtime) {
- tst_res(TFAIL, "Failed to reset access and modification time (%lu: %lu)",
- sb.st_atime, sb.st_mtime);
+ ts[1].tv_sec = atoi(argv[optind + 3]);
+ if (argv[optind + 4][0] == 'n') {
+ ts[1].tv_nsec = UTIME_NOW;
+ } else if (argv[optind + 4][0] == 'o') {
+ ts[1].tv_nsec = UTIME_OMIT;
+ } else {
+ ts[1].tv_nsec = atoi(argv[optind + 4]);
+ }
+
+ tsp = ts;
}
-}
-static void run(unsigned int i)
-{
- struct time64_variants *tv = &variants[tst_variant];
- struct test_case *tc = &tcase[i];
- int dfd = AT_FDCWD, fd = 0, atime_change, mtime_change;
- struct mytime *mytime = tc->mytime;
- char *pathname = NULL;
- void *tsp = NULL;
- struct stat sb;
+ /* For testing purposes, it may have been useful to run this program
+ as set-user-ID-root so that a directory file descriptor could be
+ opened as root. (This allows us to obtain a file descriptor even
+ if normal user doesn't have permissions on the file.) Now we
+ reset to the real UID before making the utimensat() call, so that
+ the permission checking for the utimensat() call is performed
+ under that UID. */
- if (tc->dirfd != AT_FDCWD)
- dfd = SAFE_OPEN(TEST_DIR, tc->oflags);
-
- if (tc->pathname) {
- fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT);
- pathname = tc->pathname;
- SAFE_CHMOD(tc->pathname, tc->mode);
- reset_time(pathname, dfd, tc->flags, i);
- change_attr(tc, fd, 1);
- } else if (tc->exp_err == EFAULT) {
- pathname = bad_addr;
- }
+ if (geteuid() == 0) {
+ uid_t u;
- if (mytime) {
- tst_multi_set_time(tv->ts_type, mytime);
- tsp = &ts;
- } else if (tc->exp_err == EFAULT) {
- tsp = bad_addr;
- }
+ u = getuid();
- TEST(tv->utimensat(dfd, pathname, tsp, tc->flags));
- if (tc->pathname)
- change_attr(tc, fd, 0);
+ if (verbose)
+ printf("Resetting UIDs to %ld\n", (long)u);
- if (TST_RET) {
- if (!tc->exp_err) {
- tst_res(TFAIL | TTERRNO, "%2d: utimensat() failed", i);
- } else if (tc->exp_err == TST_ERR) {
- tst_res(TPASS | TTERRNO, "%2d: utimensat() failed expectedly", i);
- } else {
- tst_res(TFAIL | TTERRNO, "%2d: utimensat() failed with incorrect error, expected %s",
- i, tst_strerrno(tc->exp_err));
- }
- } else if (tc->exp_err) {
- tst_res(TFAIL, "%2d: utimensat() passed unexpectedly", i);
- } else {
- atime_change = mytime ? mytime->atime_change : 1;
- mtime_change = mytime ? mytime->mtime_change : 1;
+ if (setresuid(u, u, u) == -1)
+ errExit("setresuid");
+ }
- TEST(stat(tc->pathname ? tc->pathname : TEST_DIR, &sb));
- if (TST_RET) {
- tst_res(TFAIL | TTERRNO, "%2d: stat() failed", i);
- goto close;
- }
+ /* Display information allowing user to verify arguments for call */
- if (!!sb.st_atime != atime_change) {
- tst_res(TFAIL, "%2d: atime %s have changed but %s",
- i, atime_change ? "should" : "shouldn't",
- sb.st_atime ? "did" : "didn't");
- } else if (!!sb.st_mtime != mtime_change) {
- tst_res(TFAIL, "%2d: mtime %s have changed but %s",
- i, mtime_change ? "should" : "shouldn't",
- sb.st_mtime ? "did" : "didn't");
- } else {
- tst_res(TPASS, "%2d: utimensat() passed", i);
+ if (verbose) {
+ printf("dirfd is %d\n", dirfd);
+ printf("pathname is %s\n", pathname);
+ printf("tsp is %p", tsp);
+ if (tsp != NULL) {
+ printf("; struct = { %ld, %ld } { %ld, %ld }",
+ (long)tsp[0].tv_sec, (long)tsp[0].tv_nsec,
+ (long)tsp[1].tv_sec, (long)tsp[1].tv_nsec);
}
+ printf("\n");
+ printf("flags is %d\n", flags);
}
-close:
- if (dfd != AT_FDCWD)
- SAFE_CLOSE(dfd);
+ /* Make the call and see what happened */
+
+ if (utimensat_sc(dirfd, pathname, tsp, flags) == -1) {
+ if (errno == EPERM) {
+ if (verbose)
+ printf("utimensat() failed with EPERM\n");
+ else
+ printf("EPERM\n");
+ exit(EXIT_FAILURE);
+
+ } else if (errno == EACCES) {
+ if (verbose)
+ printf("utimensat() failed with EACCES\n");
+ else
+ printf("EACCES\n");
+ exit(EXIT_FAILURE);
+
+ } else if (errno == EINVAL) {
+ if (verbose)
+ printf("utimensat() failed with EINVAL\n");
+ else
+ printf("EINVAL\n");
+ exit(EXIT_FAILURE);
+
+ } else { /* Unexpected failure case from utimensat() */
+ errExit("utimensat");
+ }
+ }
- if (tc->pathname)
- SAFE_CLOSE(fd);
-}
+ if (verbose)
+ printf("utimensat() succeeded\n");
-static void setup(void)
-{
- size_t i;
+ if (stat((pathname != NULL) ? pathname : dirfdPath, &sb) == -1)
+ errExit("stat");
- tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
+ if (verbose) {
+ printf("Last file access: %s", ctime(&sb.st_atime));
+ printf("Last file modification: %s", ctime(&sb.st_mtime));
+ printf("Last status change: %s", ctime(&sb.st_ctime));
- bad_addr = tst_get_bad_addr(NULL);
- if (access(TEST_DIR, R_OK))
- SAFE_MKDIR(TEST_DIR, 0700);
+ } else {
+ printf("SUCCESS %ld %ld\n", (long)sb.st_atime,
+ (long)sb.st_mtime);
+ }
- for (i = 0; i < ARRAY_SIZE(tcase); i++)
- update_error(&tcase[i]);
+ exit(EXIT_SUCCESS);
}
-
-static struct tst_test test = {
- .test = run,
- .tcnt = ARRAY_SIZE(tcase),
- .test_variants = ARRAY_SIZE(variants),
- .setup = setup,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
-};
diff --git a/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
new file mode 100755
index 000000000..46a0cc64b
--- /dev/null
+++ b/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
@@ -0,0 +1,517 @@
+#!/bin/sh
+#
+# Automated tests for utimensat()
+#
+# Copyright (C) 2008, Linux Foundation
+# Written by Michael Kerrisk <mtk.manpages@gmail.com>
+# Licensed under GPLv2 or later
+#
+# Not (yet) included in this automated test set:
+# * AT_SYMLINK_NOFOLLOW in flags: If pathname specifies a symbolic link,
+# then update the timestamps of the link, rather than the file to which
+# it refers.
+# * Setting of nanosecond components of timestamps (support for
+# nanosecond timestamps is file-system-dependent)
+# * "Updated file timestamps are set to the greatest value supported
+# by the file system that is not greater than the specified time."
+# (i.e., if we set timestamp to {0, 999999999}, then the setting
+# is rounded down, rather than up, to unit of timestamp resolution.
+# * Privileged processes should be able to bypass permission checks.
+# (except when file is marked with the "Immutable" EFA).
+
+#=====================================================================
+
+export TCID=utimensat01
+export TST_TOTAL=99
+export TST_COUNT=0
+. test.sh
+
+if tst_kvcmp -lt "2.6.22"; then
+ tst_brkm TCONF "System kernel version is less than 2.6.22,cannot execute test"
+fi
+
+# Starting with 4.8.0 operations on immutable files return EPERM instead of
+# EACCES.
+# This patch has also been merged to stable 4.4 with
+# b3b4283 ("vfs: move permission checking into notify_change() for utimes(NULL)")
+if tst_kvcmp -ge "4.4.27" -a -lt "4.5.0"; then
+ imaccess=EPERM
+elif tst_kvcmp -lt "4.4.27"; then
+ imaccess=EACCES
+else
+ imaccess=EPERM
+fi
+
+
+RESULT_FILE=$TMPDIR/utimensat.result
+
+TEST_DIR=$TMPDIR/utimensat_tests
+FILE=$TEST_DIR/utimensat.test_file
+
+TEST_PROG=utimensat01
+
+if [ ! -f $LTPROOT/testcases/bin/$TEST_PROG ]; then
+ tst_brkm TBROK "$LTPROOT/testcases/bin/$TEST_PROG is missing (please check install)"
+fi
+
+# Summary counters of all test results
+
+test_num=0
+failed_cnt=0
+passed_cnt=0
+failed_list=""
+
+#=====================================================================
+
+setup_file()
+{
+# $1 is test file pathname
+# $2 is owner for test file (chown(1))
+# $3 is permissions for test file (chmod(1))
+# $4 is "ext2" extended file attributes for test file (chattr(1))
+
+ FILE=$1
+
+ # Make sure any old version of file is deleted
+
+ if test -e $FILE; then
+ sudo $s_arg chattr -ai $FILE || return $?
+ sudo $s_arg rm -f $FILE || return $?
+ fi
+
+ # Create file and make atime and mtime zero.
+
+ sudo $s_arg -u $test_user touch $FILE || return $?
+ if ! $TEST_PROG -q $FILE 0 0 0 0 > $RESULT_FILE; then
+ echo "Failed to set up test file $FILE" 1>&2
+ exit 1
+ fi
+
+ read res atime mtime < $RESULT_FILE
+ if test "X$res" != "XSUCCESS" ||
+ test $atime -ne 0 || test $mtime != 0; then
+ echo "Failed to set correct times on test file $FILE" 1>&2
+ exit 1
+ fi
+
+ # Set owner, permissions, and EFAs for file.
+
+ if test -n "$2"; then
+ sudo $s_arg chown $2 $FILE || return $?
+ fi
+
+ sudo $s_arg chmod $3 $FILE || return $?
+
+ if test -n "$4"; then
+ sudo $s_arg chattr $4 $FILE || return $?
+ fi
+
+ # Display file setup, for visual verification
+
+ ls -l $FILE | awk '{ printf "Owner=%s; perms=%s; ", $3, $1}'
+ if ! sudo $s_arg lsattr -l $FILE | sed 's/, /,/g' | awk '{print "EFAs=" $2}'
+ then
+ return $?
+ fi
+
+}
+
+test_failed()
+{
+ tst_resm TFAIL "FAILED test $test_num"
+
+ failed_cnt=$(expr $failed_cnt + 1)
+ failed_list="$failed_list $test_num"
+}
+
+check_result()
+{
+ STATUS=$1 # Exit status from test program
+ EXPECTED_RESULT=$2 # SUCCESS / EACCES / EPERM / EINVAL
+ EXPECT_ATIME_CHANGED=$3 # Should be 'y' or 'n' (only for SUCCESS)
+ EXPECT_MTIME_CHANGED=$4 # Should be 'y' or 'n' (only for SUCCESS)
+
+ test_num=$(expr $test_num + 1)
+
+ # If our test setup failed, stop immediately
+
+ if test $STATUS -gt 1; then
+ echo "FAILED (bad test setup)"
+ exit 1
+ fi
+
+ read res atime mtime < $RESULT_FILE
+
+ echo "EXPECTED: $EXPECTED_RESULT $EXPECT_ATIME_CHANGED "\
+ "$EXPECT_MTIME_CHANGED"
+ echo "RESULT: $res $atime $mtime"
+
+ if test "$res" != "$EXPECTED_RESULT"; then
+ test_failed
+ return
+ fi
+
+ passed=1
+
+ # If the test program exited successfully, then check that atime and
+ # and mtime were updated / not updated, as expected.
+
+ if test $EXPECTED_RESULT = "SUCCESS"; then
+ if test $EXPECT_ATIME_CHANGED = "y"; then
+ if test $atime -eq 0; then
+ echo "atime should have changed, but did not"
+ passed=0
+ fi
+ else
+ if test $atime -ne 0; then
+ echo "atime should not have changed, but did"
+ passed=0
+ fi
+ fi
+
+ if test $EXPECT_MTIME_CHANGED = "y"; then
+ if test $mtime -eq 0; then
+ echo "mtime should have changed, but did not"
+ passed=0
+ fi
+ else
+ if test $mtime -ne 0; then
+ echo "mtime should not have changed, but did"
+ passed=0
+ fi
+ fi
+
+ if test $passed -eq 0; then
+ test_failed
+ return
+ fi
+ fi
+
+ passed_cnt=$(expr $passed_cnt + 1)
+ tst_resm TPASS "PASSED test $test_num"
+}
+
+run_test()
+{
+ # By default, we do three types of test:
+ # a) pathname (pathname != NULL)
+ # b) readable file descriptor (pathname == NULL, dirfd opened O_RDONLY)
+ # c) writable file descriptor (pathname == NULL, dirfd opened O_RDWR).
+ # For this case we also include O_APPEND in open flags, since that
+ # is needed if testing with a file that has the Append-only
+ # attribute enabled.
+
+ # -R says don't do tests with readable file descriptor
+ # -W says don't do tests with writable file descriptor
+
+ OPTIND=1
+
+ do_read_fd_test=1
+ do_write_fd_test=1
+ while getopts "RW" opt; do
+ case "$opt" in
+ R) do_read_fd_test=0
+ ;;
+ W) do_write_fd_test=0
+ ;;
+ *) echo "run_test: bad usage"
+ exit 1
+ ;;
+ esac
+ done
+ shift `expr $OPTIND - 1`
+
+ echo "Pathname test"
+ setup_file $FILE "$1" "$2" "$3"
+ cp $LTPROOT/testcases/bin/$TEST_PROG ./
+ CMD="./$TEST_PROG -q $FILE $4"
+ echo "$CMD"
+ sudo $s_arg -u $test_user $CMD > $RESULT_FILE
+ check_result $? $5 $6 $7
+ echo
+
+ if test $do_read_fd_test -ne 0; then
+ echo "Readable file descriptor (futimens(3)) test"
+ setup_file $FILE "$1" "$2" "$3"
+ CMD="./$TEST_PROG -q -d $FILE NULL $4"
+ echo "$CMD"
+ sudo $s_arg -u $test_user $CMD > $RESULT_FILE
+ check_result $? $5 $6 $7
+ echo
+ fi
+
+ # Can't do the writable file descriptor test for immutable files
+ # (even root can't open an immutable file for writing)
+
+ if test $do_write_fd_test -ne 0; then
+ echo "Writable file descriptor (futimens(3)) test"
+ setup_file $FILE "$1" "$2" "$3"
+ CMD="./$TEST_PROG -q -w -d $FILE NULL $4"
+ echo "$CMD"
+ sudo $s_arg -u $test_user $CMD > $RESULT_FILE
+ check_result $? $5 $6 $7
+ echo
+ fi
+
+ sudo $s_arg chattr -ai $FILE
+ sudo $s_arg rm -f $FILE
+}
+
+#=====================================================================
+
+# Since some automated testing systems have no tty while testing,
+# comment this line in /etc/sudoers to avoid the error message:
+# `sudo: sorry, you must have a tty to run sudo'
+# Use trap to restore this line after program terminates.
+sudoers=/etc/sudoers
+if [ ! -r $sudoers ]; then
+ tst_brkm TBROK "can't read $sudoers"
+fi
+pattern="[[:space:]]*Defaults[[:space:]]*requiretty.*"
+if grep -q "^${pattern}" $sudoers; then
+ tst_resm TINFO "Comment requiretty in $sudoers for automated testing systems"
+ if ! sed -r -i.$$ -e "s/^($pattern)/#\1/" $sudoers; then
+ tst_brkm TBROK "failed to mangle $sudoers properly"
+ fi
+ trap 'trap "" EXIT; restore_sudoers' EXIT
+fi
+
+restore_sudoers()
+{
+ tst_resm TINFO "Restore requiretty in $sudoers"
+ mv /etc/sudoers.$$ /etc/sudoers
+}
+
+test_user=nobody
+echo "test sudo for -n option, non-interactive"
+if sudo -h | grep -q -- -n; then
+ s_arg="-n"
+ echo "sudo supports -n"
+else
+ s_arg=
+ echo "sudo does not support -n"
+fi
+
+if ! sudo $s_arg true; then
+ tst_brkm TBROK "sudo cannot be run by user non-interactively"
+fi
+if test ! -f $sudoers
+then
+ echo "root ALL=(ALL) ALL" > $sudoers || exit
+ chmod 440 $sudoers
+ trap 'trap "" EXIT; nuke_sudoers' EXIT
+fi
+
+nuke_sudoers()
+{
+ sudo rm -f $sudoers
+}
+
+sudo $s_arg -u $test_user mkdir -p $TEST_DIR
+
+# Make sure chattr command is supported
+touch $TEST_DIR/tmp_file
+chattr +a $TEST_DIR/tmp_file
+if [ $? -ne 0 ] ; then
+ rm -rf $TEST_DIR
+ tst_brkm TCONF "chattr not supported"
+fi
+chattr -a $TEST_DIR/tmp_file
+
+cd $TEST_DIR
+chown root $LTPROOT/testcases/bin/$TEST_PROG
+chmod ugo+x,u+s $LTPROOT/testcases/bin/$TEST_PROG
+
+#=====================================================================
+
+
+echo "============================================================"
+
+echo
+echo "Testing read-only file, owned by self"
+echo
+
+echo "***** Testing times==NULL case *****"
+run_test -W "" 400 "" "" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test -W "" 400 "" "0 n 0 n" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test -W "" 400 "" "0 o 0 o" SUCCESS n n
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_OMIT } case *****"
+run_test -W "" 400 "" "0 n 0 o" SUCCESS y n
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_NOW } case *****"
+run_test -W "" 400 "" "0 o 0 n" SUCCESS n y
+
+echo "***** Testing times=={ x, y } case *****"
+run_test -W "" 400 "" "1 1 1 1" SUCCESS y y
+
+echo "============================================================"
+
+echo
+echo "Testing read-only file, not owned by self"
+echo
+
+echo "***** Testing times==NULL case *****"
+run_test -RW root 400 "" "" EACCES
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test -RW root 400 "" "0 n 0 n" EACCES
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test -RW root 400 "" "0 o 0 o" SUCCESS n n
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_OMIT } case *****"
+run_test -RW root 400 "" "0 n 0 o" EPERM
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_NOW } case *****"
+run_test -RW root 400 "" "0 o 0 n" EPERM
+
+echo "***** Testing times=={ x, y } case *****"
+run_test -RW root 400 "" "1 1 1 1" EPERM
+
+echo "============================================================"
+
+echo
+echo "Testing writable file, not owned by self"
+echo
+
+echo "***** Testing times==NULL case *****"
+run_test root 666 "" "" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test root 666 "" "0 n 0 n" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test root 666 "" "0 o 0 o" SUCCESS n n
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_OMIT } case *****"
+run_test root 666 "" "0 n 0 o" EPERM
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_NOW } case *****"
+run_test root 666 "" "0 o 0 n" EPERM
+
+echo "***** Testing times=={ x, y } case *****"
+run_test root 666 "" "1 1 1 1" EPERM
+
+echo "============================================================"
+
+echo
+echo "Testing append-only file, owned by self"
+echo
+
+echo "***** Testing times==NULL case *****"
+run_test "" 600 "+a" "" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test "" 600 "+a" "0 n 0 n" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test "" 600 "+a" "0 o 0 o" SUCCESS n n
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_OMIT } case *****"
+run_test "" 600 "+a" "0 n 0 o" EPERM
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_NOW } case *****"
+run_test "" 600 "+a" "0 o 0 n" EPERM
+
+echo "***** Testing times=={ x, y } case *****"
+run_test "" 600 "+a" "1 1 1 1" EPERM
+
+echo "============================================================"
+
+echo
+echo "Testing immutable file, owned by self"
+echo
+
+echo "***** Testing times==NULL case *****"
+run_test -W "" 600 "+i" "" $imaccess
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test -W "" 600 "+i" "0 n 0 n" $imaccess
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test -W "" 600 "+i" "0 o 0 o" SUCCESS n n
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_OMIT } case *****"
+run_test -W "" 600 "+i" "0 n 0 o" EPERM
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_NOW } case *****"
+run_test -W "" 600 "+i" "0 o 0 n" EPERM
+
+echo "***** Testing times=={ x, y } case *****"
+run_test -W "" 600 "+i" "1 1 1 1" EPERM
+
+echo "============================================================"
+
+# Immutable+append-only should have same results as immutable
+
+echo
+echo "Testing immutable append-only file, owned by self"
+echo
+
+echo "***** Testing times==NULL case *****"
+run_test -W "" 600 "+ai" "" $imaccess
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test -W "" 600 "+ai" "0 n 0 n" $imaccess
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test -W "" 600 "+ai" "0 o 0 o" SUCCESS n n
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_OMIT } case *****"
+run_test -W "" 600 "+ai" "0 n 0 o" EPERM
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_NOW } case *****"
+run_test -W "" 600 "+ai" "0 o 0 n" EPERM
+
+echo "***** Testing times=={ x, y } case *****"
+run_test -W "" 600 "+ai" "1 1 1 1" EPERM
+
+echo "============================================================"
+
+echo
+
+# EINVAL should result, if pathname is NULL, dirfd is not
+# AT_FDCWD, and flags contains AT_SYMLINK_NOFOLLOW.
+
+echo "***** Testing pathname==NULL, dirfd!=AT_FDCWD, flags has" \
+ "AT_SYMLINK_NOFOLLOW *****"
+setup_file $FILE "" 600 ""
+CMD="$TEST_PROG -q -n -d $FILE NULL $4"
+echo "$CMD"
+$CMD > $RESULT_FILE
+check_result $? EINVAL
+echo
+
+echo "============================================================"
+
+echo
+
+# If UTIME_NOW / UTIME_OMIT in tv_nsec field, the tv_sec should
+# be ignored.
+
+echo "tv_sec should be ignored if tv_nsec is UTIME_OMIT or UTIME_NOW"
+
+echo "***** Testing times=={ UTIME_NOW, UTIME_NOW } case *****"
+run_test -RW "" 600 "" "1 n 1 n" SUCCESS y y
+
+echo "***** Testing times=={ UTIME_OMIT, UTIME_OMIT } case *****"
+run_test -RW "" 600 "" "1 o 1 o" SUCCESS n n
+
+echo "============================================================"
+
+echo
+
+rm -rf "$TEST_DIR"
+uname -a
+date
+echo "Total tests: $test_num; passed: $passed_cnt; failed: $failed_cnt"
+if test $failed_cnt -gt 0; then
+ echo "Failed tests: $failed_list"
+fi
+
+tst_exit
diff --git a/testcases/kernel/syscalls/utimes/Makefile b/testcases/kernel/syscalls/utimes/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/utimes/Makefile
+++ b/testcases/kernel/syscalls/utimes/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/vfork/Makefile b/testcases/kernel/syscalls/vfork/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/vfork/Makefile
+++ b/testcases/kernel/syscalls/vfork/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/vhangup/Makefile b/testcases/kernel/syscalls/vhangup/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/vhangup/Makefile
+++ b/testcases/kernel/syscalls/vhangup/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/vmsplice/.gitignore b/testcases/kernel/syscalls/vmsplice/.gitignore
index 042c32585..03922073c 100644
--- a/testcases/kernel/syscalls/vmsplice/.gitignore
+++ b/testcases/kernel/syscalls/vmsplice/.gitignore
@@ -1,4 +1,3 @@
/vmsplice01
/vmsplice02
/vmsplice03
-/vmsplice04
diff --git a/testcases/kernel/syscalls/vmsplice/Makefile b/testcases/kernel/syscalls/vmsplice/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/vmsplice/Makefile
+++ b/testcases/kernel/syscalls/vmsplice/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice01.c b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
index 1d1b66d12..833af239f 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice01.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
@@ -103,6 +103,11 @@ static void setup(void)
{
int i;
+ if (tst_fs_type(".") == TST_NFS_MAGIC) {
+ tst_brk(TCONF, "Cannot do splice() "
+ "on a file located on an NFS filesystem");
+ }
+
for (i = 0; i < TEST_BLOCK_SIZE; i++)
buffer[i] = i & 0xff;
}
@@ -118,9 +123,5 @@ static struct tst_test test = {
.cleanup = cleanup,
.test_all = vmsplice_test,
.needs_tmpdir = 1,
- .skip_filesystems = (const char *const []) {
- "nfs",
- NULL
- },
.min_kver = "2.6.17",
};
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice02.c b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
index 39c407cb8..978633d31 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice02.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
@@ -52,6 +52,11 @@ static struct tcase {
static void setup(void)
{
+ if (tst_fs_type(".") == TST_NFS_MAGIC) {
+ tst_brk(TCONF, "Cannot do splice() "
+ "on a file located on an NFS filesystem");
+ }
+
filefd = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, 0644);
SAFE_PIPE(pipes);
@@ -101,9 +106,5 @@ static struct tst_test test = {
.test = vmsplice_verify,
.tcnt = ARRAY_SIZE(tcases),
.needs_tmpdir = 1,
- .skip_filesystems = (const char *const []) {
- "nfs",
- NULL
- },
.min_kver = "2.6.17",
};
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice04.c b/testcases/kernel/syscalls/vmsplice/vmsplice04.c
deleted file mode 100644
index 9aaa0b56f..000000000
--- a/testcases/kernel/syscalls/vmsplice/vmsplice04.c
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2019 SUSE LLC
- * Author: Jorik Cronenberg <jcronenberg@suse.de>
- *
- * Test vmsplice() to a full pipe with SPLICE_F_NONBLOCK and without.
- *
- * With SPLICE_F_NONBLOCK vmsplice() should return with errno EAGAIN
- * Without SPLICE_F_NONBLOCK it should block.
- */
-
-#define _GNU_SOURCE
-
-#include "tst_test.h"
-#include "lapi/vmsplice.h"
-#include "lapi/fcntl.h"
-#include <stdlib.h>
-
-static int pipes[2];
-static ssize_t pipe_max_size;
-static char *write_buffer;
-static struct iovec iov;
-
-static void vmsplice_test(void)
-{
- int status;
- int pid;
-
- TEST(vmsplice(pipes[1], &iov, 1, SPLICE_F_NONBLOCK));
-
- if (TST_RET < 0 && TST_ERR == EAGAIN) {
- tst_res(TPASS | TTERRNO,
- "vmsplice(..., SPLICE_F_NONBLOCK) failed as expected");
- } else if (TST_RET < 0) {
- tst_res(TFAIL | TTERRNO,
- "vmsplice(..., SPLICE_F_NONBLOCK) shall fail with EAGAIN");
- } else {
- tst_res(TFAIL,
- "vmsplice(..., SPLICE_F_NONBLOCK) wrote to a full pipe");
- }
-
- pid = SAFE_FORK();
- if (!pid) {
- TEST(vmsplice(pipes[1], &iov, 1, 0));
- if (TST_RET < 0)
- tst_res(TFAIL | TTERRNO, "vmsplice(..., 0) failed");
- else
- tst_res(TFAIL,
- "vmsplice(..., 0) wrote to a full pipe");
- exit(0);
- }
-
- if (TST_PROCESS_STATE_WAIT(pid, 'S', 1000) < 0)
- return;
- else
- tst_res(TPASS, "vmsplice(..., 0) blocked");
-
- SAFE_KILL(pid, SIGKILL);
- SAFE_WAIT(&status);
-}
-
-static void cleanup(void)
-{
- if (pipes[1] > 0)
- SAFE_CLOSE(pipes[1]);
- if (pipes[0] > 0)
- SAFE_CLOSE(pipes[0]);
-}
-
-static void setup(void)
-{
- SAFE_PIPE(pipes);
-
- pipe_max_size = SAFE_FCNTL(pipes[1], F_GETPIPE_SZ);
- write_buffer = tst_alloc(pipe_max_size);
-
- iov.iov_base = write_buffer;
- iov.iov_len = pipe_max_size;
-
- TEST(vmsplice(pipes[1], &iov, 1, 0));
- if (TST_RET < 0) {
- tst_brk(TBROK | TTERRNO,
- "Initial vmsplice() to fill pipe failed");
- }
-}
-
-static struct tst_test test = {
- .setup = setup,
- .cleanup = cleanup,
- .test_all = vmsplice_test,
- .min_kver = "2.6.17",
- .forks_child = 1,
-};
diff --git a/testcases/kernel/syscalls/wait/Makefile b/testcases/kernel/syscalls/wait/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/wait/Makefile
+++ b/testcases/kernel/syscalls/wait/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/wait/wait01.c b/testcases/kernel/syscalls/wait/wait01.c
index aec91b911..bd22c1191 100644
--- a/testcases/kernel/syscalls/wait/wait01.c
+++ b/testcases/kernel/syscalls/wait/wait01.c
@@ -1,24 +1,81 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Fujitsu Ltd.
* Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
- */
-/*\
- * [Description]
*
- * Check that if the calling process does not have any unwaited-for children
- * wait() will return ECHILD.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+/*
+ * Test Description:
+ * Verify that,
+ * The calling process does not have any unwaited-for children,
+ * ECHILD would return.
*/
-#include <sys/wait.h>
+#include <errno.h>
#include <sys/types.h>
-#include "tst_test.h"
+#include <sys/wait.h>
+
+#include "test.h"
+
+char *TCID = "wait01";
+int TST_TOTAL = 1;
+static void setup(void);
+static void wait_verify(void);
+static void cleanup(void);
+
+int main(int argc, char **argv)
+{
+ int lc;
+
+ tst_parse_opts(argc, argv, NULL, NULL);
-static void verify_wait(void)
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ wait_verify();
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+static void setup(void)
+{
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+static void wait_verify(void)
{
- TST_EXP_FAIL(wait(NULL), ECHILD);
+ TEST(wait(NULL));
+
+ if (TEST_RETURN != -1) {
+ tst_resm(TFAIL | TTERRNO, "wait failed unexpectedly: %ld",
+ TEST_RETURN);
+ return;
+ }
+
+ if (TEST_ERRNO == ECHILD) {
+ tst_resm(TPASS | TTERRNO, "wait failed as expected");
+ } else {
+ tst_resm(TFAIL | TTERRNO,
+ "wait failed unexpectedly; expected: %d - %s",
+ ECHILD, strerror(ECHILD));
+ }
}
-static struct tst_test test = {
- .test_all = verify_wait,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/wait/wait02.c b/testcases/kernel/syscalls/wait/wait02.c
index bc617f7ac..5695c071c 100644
--- a/testcases/kernel/syscalls/wait/wait02.c
+++ b/testcases/kernel/syscalls/wait/wait02.c
@@ -1,51 +1,103 @@
-// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
* AUTHOR : William Roske
* CO-PILOT : Dave Fenner
- */
-/*\
- * [Description]
*
- * For a terminated child, test whether wait(2) can get its pid
- * and exit status correctly.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ *
*/
#include <errno.h>
+#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <stdlib.h>
-#include "tst_test.h"
+#include "test.h"
-static void verify_wait(void)
-{
- int status, exit_child = 1;
- pid_t fpid;
+static void setup(void);
+static void cleanup(void);
- fpid = SAFE_FORK();
- if (fpid == 0)
- exit(exit_child);
+char *TCID = "wait02";
+int TST_TOTAL = 1;
+
+static void wait_verify(void);
- TST_EXP_PID_SILENT(wait(&status));
+int main(int ac, char **av)
+{
+ int lc;
- if (!TST_PASS)
- return;
+ tst_parse_opts(ac, av, NULL, NULL);
- if (fpid != TST_RET) {
- tst_res(TFAIL, "wait() returned pid %ld, expected %d",
- TST_RET, fpid);
- return;
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+ wait_verify();
}
- if (WIFEXITED(status) && WEXITSTATUS(status) == exit_child) {
- tst_res(TPASS, "wait() succeeded");
- return;
+ cleanup();
+ tst_exit();
+}
+
+static void setup(void)
+{
+ tst_sig(FORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+static void wait_verify(void)
+{
+ int fork_pid, status, exit_child = 1;
+
+ fork_pid = FORK_OR_VFORK();
+ if (fork_pid == -1) {
+ tst_brkm(TBROK | TERRNO, cleanup, "fork() Failure");
+ } else if (fork_pid == 0) {
+ sleep(1);
+ exit(exit_child);
}
- tst_res(TFAIL, "wait() reported child %s", tst_strstatus(status));
+ TEST(wait(&status));
+
+ if (TEST_RETURN == -1) {
+ tst_resm(TFAIL | TTERRNO, "wait(1) Failed");
+ } else if (WIFEXITED(status) && WEXITSTATUS(status) == exit_child) {
+ tst_resm(TPASS, "wait(&status) returned %ld", TEST_RETURN);
+ } else {
+ tst_resm(TFAIL,
+ "wait(1) Failed, exit_child - 0x%x, status - 0x%x",
+ exit_child, status);
+ }
}
-static struct tst_test test = {
- .test_all = verify_wait,
- .forks_child = 1,
-};
+static void cleanup(void)
+{
+}
diff --git a/testcases/kernel/syscalls/wait4/Makefile b/testcases/kernel/syscalls/wait4/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/wait4/Makefile
+++ b/testcases/kernel/syscalls/wait4/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/wait4/wait401.c b/testcases/kernel/syscalls/wait4/wait401.c
index ab99891be..fa0de693a 100644
--- a/testcases/kernel/syscalls/wait4/wait401.c
+++ b/testcases/kernel/syscalls/wait4/wait401.c
@@ -25,19 +25,21 @@ static void run(void)
pid = SAFE_FORK();
if (!pid) {
- TST_PROCESS_STATE_WAIT(getppid(), 'S', 0);
+ TST_PROCESS_STATE_WAIT(getppid(), 'S');
exit(0);
}
- TST_EXP_PID_SILENT(wait4(pid, &status, 0, &rusage), "wait4()");
- if (!TST_PASS)
+ TEST(wait4(pid, &status, 0, &rusage));
+ if (TST_RET == -1) {
+ tst_res(TFAIL | TERRNO, "wait4() failed");
return;
+ }
if (TST_RET != pid) {
- tst_res(TFAIL, "wait4() returned wrong pid %li, expected %i",
+ tst_res(TFAIL, "waitpid() returned wrong pid %li, expected %i",
TST_RET, pid);
} else {
- tst_res(TPASS, "wait4() returned correct pid %i", pid);
+ tst_res(TPASS, "waitpid() returned correct pid %i", pid);
}
if (!WIFEXITED(status)) {
diff --git a/testcases/kernel/syscalls/waitid/Makefile b/testcases/kernel/syscalls/waitid/Makefile
index 1273a4e9c..2ef86f06f 100644
--- a/testcases/kernel/syscalls/waitid/Makefile
+++ b/testcases/kernel/syscalls/waitid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2009
+#
+# Copyright (c) International Business Machines Corp., 2009
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/waitpid/Makefile b/testcases/kernel/syscalls/waitpid/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/waitpid/Makefile
+++ b/testcases/kernel/syscalls/waitpid/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/waitpid/waitpid01.c b/testcases/kernel/syscalls/waitpid/waitpid01.c
index 5a39a1107..6e03acef6 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid01.c
+++ b/testcases/kernel/syscalls/waitpid/waitpid01.c
@@ -18,7 +18,7 @@
static void run(void)
{
- pid_t pid;
+ pid_t pid, rpid;
int status;
pid = SAFE_FORK();
@@ -27,13 +27,13 @@ static void run(void)
exit(0);
}
- TST_EXP_PID_SILENT(waitpid(pid, &status, 0));
- if (!TST_PASS)
- return;
+ rpid = waitpid(pid, &status, 0);
+ if (rpid < 0)
+ tst_brk(TBROK | TERRNO, "waitpid() failed");
- if (TST_RET != pid) {
- tst_res(TFAIL, "waitpid() returned wrong pid %li, expected %i",
- TST_RET, pid);
+ if (rpid != pid) {
+ tst_res(TFAIL, "waitpid() returned wrong pid %i, expected %i",
+ rpid, pid);
} else {
tst_res(TPASS, "waitpid() returned correct pid %i", pid);
}
diff --git a/testcases/kernel/syscalls/write/Makefile b/testcases/kernel/syscalls/write/Makefile
index 044619fb8..bd617d806 100644
--- a/testcases/kernel/syscalls/write/Makefile
+++ b/testcases/kernel/syscalls/write/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
diff --git a/testcases/kernel/syscalls/writev/.gitignore b/testcases/kernel/syscalls/writev/.gitignore
index 167779736..d60da0f43 100644
--- a/testcases/kernel/syscalls/writev/.gitignore
+++ b/testcases/kernel/syscalls/writev/.gitignore
@@ -1,6 +1,5 @@
/writev01
/writev02
-/writev03
/writev05
/writev06
/writev07
diff --git a/testcases/kernel/syscalls/writev/Makefile b/testcases/kernel/syscalls/writev/Makefile
index 6627abaed..85965e4cb 100644
--- a/testcases/kernel/syscalls/writev/Makefile
+++ b/testcases/kernel/syscalls/writev/Makefile
@@ -1,5 +1,20 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
+#
+# Copyright (c) International Business Machines Corp., 2001
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
top_srcdir ?= ../../../..
@@ -9,7 +24,4 @@ endif
include $(top_srcdir)/include/mk/testcases.mk
-writev03: CFLAGS += -pthread
-writev03: LDLIBS += -lrt
-
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/writev/writev02.c b/testcases/kernel/syscalls/writev/writev02.c
index 005f37a14..60d9e8978 100644
--- a/testcases/kernel/syscalls/writev/writev02.c
+++ b/testcases/kernel/syscalls/writev/writev02.c
@@ -87,6 +87,7 @@ void sighandler(int);
void l_seek(int, off_t, int);
void setup(void);
void cleanup(void);
+int fail;
int main(int argc, char **argv)
{
@@ -134,6 +135,7 @@ int main(int argc, char **argv)
if ((fd[0] = open(f_name, O_RDWR, 0666)) < 0)
tst_brkm(TFAIL | TERRNO, cleanup,
"open(.., O_RDWR, ..) failed");
+//block1:
/*
* In this block we are trying to call writev() with invalid
* vector to be written in a sparse file. This will return
@@ -141,6 +143,8 @@ int main(int argc, char **argv)
* the scheduled write() with valid data at 8k th offset is
* done correctly or not.
*/
+ tst_resm(TINFO, "Enter block 1");
+
l_seek(fd[0], 0, 0);
TEST(writev(fd[0], wr_iovec, 2));
if (TEST_RETURN < 0) {
@@ -163,6 +167,7 @@ int main(int argc, char **argv)
} else
tst_resm(TFAIL, "Error writev returned a positive "
"value");
+ tst_resm(TINFO, "Exit block 1");
}
cleanup();
tst_exit();
diff --git a/testcases/kernel/syscalls/writev/writev03.c b/testcases/kernel/syscalls/writev/writev03.c
deleted file mode 100644
index d0c64743b..000000000
--- a/testcases/kernel/syscalls/writev/writev03.c
+++ /dev/null
@@ -1,153 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2021 SUSE LLC <mdoucha@suse.cz>
- */
-
-/*\
- * [Description]
- *
- * Check for potential issues in writev() if the first iovec entry is NULL
- * and the next one is not present in RAM. This can result in a brief window
- * where writev() first writes uninitialized data into the file (possibly
- * exposing internal kernel structures) and then overwrites it with the real
- * iovec contents later.
- */
-
-/*
- * Bugs fixed in:
- * commit d4690f1e1cdabb4d61207b6787b1605a0dc0aeab
- * Author: Al Viro <viro@ZenIV.linux.org.uk>
- * Date: Fri Sep 16 00:11:45 2016 +0100
- *
- * fix iov_iter_fault_in_readable()
- */
-
-#include <sys/uio.h>
-#include "tst_test.h"
-#include "tst_atomic.h"
-#include "tst_fuzzy_sync.h"
-
-#define CHUNK_SIZE 256
-#define BUF_SIZE (2 * CHUNK_SIZE)
-#define MNTPOINT "mntpoint"
-#define TEMPFILE MNTPOINT "/test_file"
-#define MAPFILE MNTPOINT "/map_file"
-
-static unsigned char buf[BUF_SIZE], *map_ptr;
-static int mapfd = -1, writefd = -1, readfd = -1;
-static int written;
-static struct tst_fzsync_pair fzsync_pair;
-struct iovec iov[5];
-
-static void setup(void)
-{
- int i;
-
- for (i = 0; i < BUF_SIZE; i++)
- buf[i] = i & 0xff;
-
- mapfd = SAFE_OPEN(MAPFILE, O_CREAT|O_RDWR|O_TRUNC, 0644);
- SAFE_WRITE(1, mapfd, buf, BUF_SIZE);
-
- fzsync_pair.exec_time_p = 0.25;
- tst_fzsync_pair_init(&fzsync_pair);
-}
-
-static void *thread_run(void *arg)
-{
- while (tst_fzsync_run_b(&fzsync_pair)) {
- writefd = SAFE_OPEN(TEMPFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644);
- written = BUF_SIZE;
- tst_fzsync_wait_b(&fzsync_pair);
-
- /*
- * Do *NOT* preload the data using MAP_POPULATE or touching
- * the mapped range. We're testing whether writev() handles
- * fault-in correctly.
- */
- map_ptr = SAFE_MMAP(NULL, BUF_SIZE, PROT_READ, MAP_SHARED,
- mapfd, 0);
- iov[1].iov_base = map_ptr;
- iov[1].iov_len = CHUNK_SIZE;
- iov[3].iov_base = map_ptr + CHUNK_SIZE;
- iov[3].iov_len = CHUNK_SIZE;
-
- tst_fzsync_start_race_b(&fzsync_pair);
- tst_atomic_store(writev(writefd, iov, ARRAY_SIZE(iov)),
- &written);
- tst_fzsync_end_race_b(&fzsync_pair);
-
- SAFE_MUNMAP(map_ptr, BUF_SIZE);
- map_ptr = NULL;
- SAFE_CLOSE(writefd);
- }
-
- return arg;
-}
-
-static void run(void)
-{
- int total_read;
- unsigned char readbuf[BUF_SIZE + 1];
-
- tst_fzsync_pair_reset(&fzsync_pair, thread_run);
-
- while (tst_fzsync_run_a(&fzsync_pair)) {
- tst_fzsync_wait_a(&fzsync_pair);
- readfd = SAFE_OPEN(TEMPFILE, O_RDONLY);
- tst_fzsync_start_race_a(&fzsync_pair);
-
- for (total_read = 0; total_read < tst_atomic_load(&written);) {
- total_read += SAFE_READ(0, readfd, readbuf+total_read,
- BUF_SIZE + 1 - total_read);
- }
-
- tst_fzsync_end_race_a(&fzsync_pair);
- SAFE_CLOSE(readfd);
-
- if (total_read > BUF_SIZE)
- tst_brk(TBROK, "writev() wrote too much data");
-
- if (total_read <= 0)
- continue;
-
- if (memcmp(readbuf, buf, total_read)) {
- tst_res(TFAIL, "writev() wrote invalid data");
- return;
- }
- }
-
- tst_res(TPASS, "writev() handles page fault-in correctly");
-}
-
-static void cleanup(void)
-{
- if (map_ptr && map_ptr != MAP_FAILED)
- SAFE_MUNMAP(map_ptr, BUF_SIZE);
-
- if (mapfd >= 0)
- SAFE_CLOSE(mapfd);
-
- if (readfd >= 0)
- SAFE_CLOSE(readfd);
-
- if (writefd >= 0)
- SAFE_CLOSE(writefd);
-
- tst_fzsync_pair_cleanup(&fzsync_pair);
-}
-
-static struct tst_test test = {
- .test_all = run,
- .needs_root = 1,
- .mount_device = 1,
- .mntpoint = MNTPOINT,
- .all_filesystems = 1,
- .min_cpus = 2,
- .setup = setup,
- .cleanup = cleanup,
- .tags = (const struct tst_tag[]) {
- {"linux-git", "d4690f1e1cda"},
- {}
- }
-};
diff --git a/testcases/kernel/syscalls/writev/writev05.c b/testcases/kernel/syscalls/writev/writev05.c
index c939e7de0..910fa23b8 100644
--- a/testcases/kernel/syscalls/writev/writev05.c
+++ b/testcases/kernel/syscalls/writev/writev05.c
@@ -82,6 +82,7 @@ void sighandler(int);
long l_seek(int, long, int);
void setup(void);
void cleanup(void);
+int fail;
#if !defined(UCLINUX)
@@ -152,24 +153,37 @@ int main(int argc, char **argv)
* the scheduled write() with valid data is done correctly
* or not.
*/
+//block1:
+ tst_resm(TINFO, "Enter block 1");
+ fail = 0;
+
l_seek(fd[0], 0, 0);
TEST(writev(fd[0], wr_iovec, 2));
if (TEST_RETURN < 0) {
if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS, "Received EFAULT as expected");
+ tst_resm(TINFO, "Received EFAULT as expected");
} else {
tst_resm(TFAIL, "Expected EFAULT, got %d",
TEST_ERRNO);
+ fail = 1;
}
l_seek(fd[0], K_1, 0);
if ((nbytes = read(fd[0], buf_list[0], CHUNK)) != 0) {
tst_resm(TFAIL, "Expected nbytes = 0, got "
"%d", nbytes);
+ fail = 1;
}
} else {
tst_resm(TFAIL, "Error writev returned a positive "
"value");
+ fail = 1;
+ }
+ if (fail) {
+ tst_resm(TINFO, "block 1 FAILED");
+ } else {
+ tst_resm(TINFO, "block 1 PASSED");
}
+ tst_resm(TINFO, "Exit block 1");
}
close(fd[0]);
close(fd[1]);
@@ -269,6 +283,7 @@ long l_seek(int fdesc, long offset, int whence)
{
if (lseek(fdesc, offset, whence) < 0) {
tst_resm(TFAIL, "lseek Failed : errno = %d", errno);
+ fail = 1;
}
return 0;
}
diff --git a/testcases/kernel/syscalls/writev/writev06.c b/testcases/kernel/syscalls/writev/writev06.c
index e97ae6f21..6fe7206e8 100644
--- a/testcases/kernel/syscalls/writev/writev06.c
+++ b/testcases/kernel/syscalls/writev/writev06.c
@@ -73,6 +73,7 @@ int TST_TOTAL = 1;
void sighandler(int);
void setup(void);
void cleanup(void);
+int fail;
int main(int argc, char **argv)
{
@@ -115,20 +116,33 @@ int main(int argc, char **argv)
* Iovecs passed to writev points to valid (readable) regions,
* so all bytes must be successfully written.
*/
+//block1:
+
+ tst_resm(TINFO, "Enter block 1");
+ fail = 0;
+
TEST(writev(fd[0], wr_iovec, 2));
if (TEST_RETURN >= 0) {
if (TEST_RETURN == 2) {
- tst_resm(TPASS,
+ tst_resm(TINFO,
"writev returned %d as expected", 2);
} else {
tst_resm(TFAIL, "Expected nbytes = %d, got "
"%ld", 2, TEST_RETURN);
+ fail = 1;
}
} else {
tst_resm(TFAIL | TTERRNO,
"Error writev return value = %ld",
TEST_RETURN);
+ fail = 1;
+ }
+ if (fail) {
+ tst_resm(TINFO, "block 1 FAILED");
+ } else {
+ tst_resm(TINFO, "block 1 PASSED");
}
+ tst_resm(TINFO, "Exit block 1");
}
cleanup();
tst_exit();
diff --git a/testcases/kernel/tracing/pt_test/pt_test.c b/testcases/kernel/tracing/pt_test/pt_test.c
index 33db6d770..f9903fdcd 100644
--- a/testcases/kernel/tracing/pt_test/pt_test.c
+++ b/testcases/kernel/tracing/pt_test/pt_test.c
@@ -216,14 +216,17 @@ static void cleanup(void)
del_map(bufm, buhsz);
}
+static struct tst_option options[] = {
+ {"m", &str_mode, "-m different mode, default is full mode"},
+ {"e:", &str_exclude_info, "-e exclude info, user or kernel"},
+ {"b", &str_branch_flag, "-b if disable branch trace"},
+ {NULL, NULL, NULL}
+};
+
+
static struct tst_test test = {
.test_all = intel_pt_trace_check,
- .options = (struct tst_option[]) {
- {"m", &str_mode, "-m different mode, default is full mode"},
- {"e:", &str_exclude_info, "-e exclude info, user or kernel"},
- {"b", &str_branch_flag, "-b if disable branch trace"},
- {}
- },
+ .options = options,
.min_kver = "4.1",
.setup = setup,
.cleanup = cleanup,
diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore
index bc299b6ee..52f99dc45 100644
--- a/testcases/lib/.gitignore
+++ b/testcases/lib/.gitignore
@@ -2,7 +2,6 @@
/tst_checkpoint
/tst_device
/tst_getconf
-/tst_get_median
/tst_get_unused_port
/tst_kvcmp
/tst_net_iface_prefix
diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
index f77da0d56..4616e24c0 100644
--- a/testcases/lib/Makefile
+++ b/testcases/lib/Makefile
@@ -28,7 +28,6 @@ INSTALL_TARGETS := *.sh
MAKE_TARGETS := tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\
- tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port\
- tst_get_median
+ tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/lib/cmdlib.sh b/testcases/lib/cmdlib.sh
index 0c5f5a4b8..e4986c39c 100644
--- a/testcases/lib/cmdlib.sh
+++ b/testcases/lib/cmdlib.sh
@@ -103,8 +103,8 @@ exists()
{
for cmd in $*; do
if ! command -v $cmd >/dev/null 2>&1; then
- tst_resm TCONF "$1: command $2 not found."
- exit 32
+ end_testcase "$cmd: command not found"
+ exit 1
fi
done
}
@@ -118,7 +118,7 @@ tst_require_root()
{
if [ "x$(id -u)" != "x0" ]; then
tst_resm TCONF "You must be root to execute this test"
- exit 32
+ exit 0
fi
}
diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
index 2a3ab1222..dc47d6f03 100644
--- a/testcases/lib/tst_device.c
+++ b/testcases/lib/tst_device.c
@@ -18,7 +18,7 @@ static struct tst_test test = {
static void print_help(void)
{
- fprintf(stderr, "\nUsage: tst_device acquire [size [filename]]\n");
+ fprintf(stderr, "\nUsage: tst_device acquire [size]\n");
fprintf(stderr, " or: tst_device release /path/to/device\n\n");
}
@@ -27,10 +27,10 @@ static int acquire_device(int argc, char *argv[])
unsigned int size = 0;
const char *device;
- if (argc > 4)
+ if (argc > 3)
return 1;
- if (argc >= 3) {
+ if (argc == 3) {
size = atoi(argv[2]);
if (!size) {
@@ -40,11 +40,7 @@ static int acquire_device(int argc, char *argv[])
}
}
- if (argc >= 4) {
- device = tst_acquire_loop_device(size, argv[3]);
- } else {
- device = tst_acquire_device__(size);
- }
+ device = tst_acquire_device__(size);
if (!device)
return 1;
@@ -64,13 +60,7 @@ static int release_device(int argc, char *argv[])
if (argc != 3)
return 1;
- /*
- * tst_acquire_[loop_]device() was called in a different process.
- * tst_release_device() would think that no device was acquired yet
- * and do nothing. Call tst_detach_device() directly to bypass
- * the check.
- */
- return tst_detach_device(argv[2]);
+ return tst_release_device(argv[2]);
}
int main(int argc, char *argv[])
diff --git a/testcases/lib/tst_get_median.c b/testcases/lib/tst_get_median.c
deleted file mode 100644
index 5246f12e0..000000000
--- a/testcases/lib/tst_get_median.c
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/* Copyright (c) 2021 Oracle and/or its affiliates. All Rights Reserved. */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static int cmp(const void *a, const void *b)
-{
- return (*(int *)a - *(int *)b);
-}
-
-int main(int argc, const char *argv[])
-{
- const size_t size = argc - 1;
-
- if (!size) {
- fprintf(stderr, "Please provide a numeric list\n");
- return 1;
- }
- if (size == 1) {
- printf("%d", atoi(argv[1]));
- return 0;
- }
-
- int arr[size];
- size_t i;
-
- for (i = 0; i < size; ++i)
- arr[i] = atoi(argv[i + 1]);
-
- qsort(arr, size, sizeof(arr[0]), cmp);
-
- const size_t size2 = size / 2;
- printf("%d", (size & 1) ? arr[size2] : ((arr[size2 - 1] + arr[size2]) / 2));
-
- return 0;
-}
diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index fc5719057..59ceb3352 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -18,14 +18,12 @@ TST_SETUP="tst_net_setup"
# Blank for an IPV4 test; 6 for an IPV6 test.
TST_IPV6=${TST_IPV6:-}
TST_IPVER=${TST_IPV6:-4}
-# Blank for IPv4, '-6' for IPv6 test.
-TST_IPV6_FLAG=${TST_IPV6_FLAG:-}
tst_net_parse_args()
{
case $1 in
- 6) TST_IPV6=6 TST_IPVER=6 TST_IPV6_FLAG="-6";;
- *) [ "$TST_PARSE_ARGS_CALLER" ] && $TST_PARSE_ARGS_CALLER "$1" "$2";;
+ 6) TST_IPV6=6 TST_IPVER=6;;
+ *) $TST_PARSE_ARGS_CALLER "$1" "$2";;
esac
}
@@ -99,6 +97,14 @@ tst_brk_()
{
[ -z "$TST_USE_LEGACY_API" ] && tst_brk $@ || tst_brkm $@
}
+tst_require_root_()
+{
+ if [ -z "$TST_USE_LEGACY_API" ]; then
+ _tst_require_root
+ else
+ tst_require_root
+ fi
+}
init_ltp_netspace()
{
@@ -106,9 +112,8 @@ init_ltp_netspace()
if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
tst_require_cmds ip
- tst_require_root
+ tst_require_root_
- tst_require_drivers veth
ROD ip li add name ltp_ns_veth1 type veth peer name ltp_ns_veth2
pid="$(ROD ns_create net,mnt)"
mkdir -p /var/run/netns
@@ -133,71 +138,61 @@ init_ltp_netspace()
tst_restore_ipaddr rhost
}
-# return 0: use ssh, 1: use netns
-tst_net_use_netns()
-{
- [ -n "$TST_USE_NETNS" ]
-}
-
# Run command on remote host.
-# tst_rhost_run -c CMD [-b] [-s] [-u USER]
# Options:
# -b run in background
-# -c CMD specify command to run (this must be binary, not shell builtin/function)
# -s safe option, if something goes wrong, will exit with TBROK
-# -u USER for ssh (default root)
+# -c specify command to run (this must be binary, not shell builtin/function)
# RETURN: 0 on success, 1 on failure
-# TST_NET_RHOST_RUN_DEBUG=1 enables debugging
tst_rhost_run()
{
+ local pre_cmd=
local post_cmd=' || echo RTERR'
+ local out=
local user="root"
- local ret=0
- local cmd out output pre_cmd rcmd sh_cmd safe use
+ local cmd=
+ local safe=0
- local OPTIND
- while getopts :bc:su: opt; do
+ OPTIND=0
+
+ while getopts :bsc:u: opt; do
case "$opt" in
- b) [ "${TST_USE_NETNS:-}" ] && pre_cmd= || pre_cmd="nohup"
+ b) [ "$TST_USE_NETNS" ] && pre_cmd= || pre_cmd="nohup"
post_cmd=" > /dev/null 2>&1 &"
out="1> /dev/null"
;;
- c) cmd="$OPTARG" ;;
s) safe=1 ;;
+ c) cmd="$OPTARG" ;;
u) user="$OPTARG" ;;
*) tst_brk_ TBROK "tst_rhost_run: unknown option: $OPTARG" ;;
esac
done
+ OPTIND=0
+
if [ -z "$cmd" ]; then
- [ "$safe" ] && \
+ [ "$safe" -eq 1 ] && \
tst_brk_ TBROK "tst_rhost_run: command not defined"
tst_res_ TWARN "tst_rhost_run: command not defined"
return 1
fi
- sh_cmd="$pre_cmd $cmd $post_cmd"
-
- if [ -n "${TST_USE_NETNS:-}" ]; then
- use="NETNS"
- rcmd="$LTP_NETNS sh -c"
+ local output=
+ local ret=0
+ if [ -n "${TST_USE_SSH:-}" ]; then
+ output=`ssh -n -q $user@$RHOST "sh -c \
+ '$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
+ elif [ -n "$TST_USE_NETNS" ]; then
+ output=`$LTP_NETNS sh -c \
+ "$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
else
- tst_require_cmds ssh
- use="SSH"
- rcmd="ssh -nq $user@$RHOST"
+ output=`rsh -n -l $user $RHOST "sh -c \
+ '$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
fi
-
- if [ "$TST_NET_RHOST_RUN_DEBUG" = 1 ]; then
- tst_res_ TINFO "tst_rhost_run: cmd: $cmd"
- tst_res_ TINFO "$use: $rcmd \"$sh_cmd\" $out 2>&1"
- fi
-
- output=$($rcmd "$sh_cmd" $out 2>&1 || echo 'RTERR')
-
echo "$output" | grep -q 'RTERR$' && ret=1
if [ $ret -eq 1 ]; then
output=$(echo "$output" | sed 's/RTERR//')
- [ "$safe" ] && \
+ [ "$safe" -eq 1 ] && \
tst_brk_ TBROK "'$cmd' failed on '$RHOST': '$output'"
fi
@@ -263,32 +258,22 @@ tst_net_run()
EXPECT_RHOST_PASS()
{
- local log="$TMPDIR/log.$$"
-
- tst_rhost_run -c "$*" > $log
+ tst_rhost_run -c "$*" > /dev/null
if [ $? -eq 0 ]; then
tst_res_ TPASS "$* passed as expected"
else
tst_res_ TFAIL "$* failed unexpectedly"
- cat $log
fi
-
- rm -f $log
}
EXPECT_RHOST_FAIL()
{
- local log="$TMPDIR/log.$$"
-
- tst_rhost_run -c "$*" > $log
+ tst_rhost_run -c "$* 2> /dev/null"
if [ $? -ne 0 ]; then
tst_res_ TPASS "$* failed as expected"
else
tst_res_ TFAIL "$* passed unexpectedly"
- cat $log
fi
-
- rm -f $log
}
# Get test interface names for local/remote host.
@@ -592,7 +577,7 @@ tst_del_ipaddr()
tst_restore_ipaddr()
{
tst_require_cmds ip
- tst_require_root
+ tst_require_root_
local type="${1:-lhost}"
local link_num="${2:-0}"
@@ -632,11 +617,9 @@ tst_wait_ipv6_dad()
done
}
-tst_netload_brk()
+tst_dump_rhost_cmd()
{
tst_rhost_run -c "cat $TST_TMPDIR/netstress.log"
- cat tst_netload.log
- tst_brk_ $1 $2
}
# Run network load test, see 'netstress -h' for option description
@@ -651,7 +634,6 @@ tst_netload()
# common options for client and server
local cs_opts=
- local run_cnt="$TST_NETLOAD_RUN_COUNT"
local c_num="$TST_NETLOAD_CLN_NUMBER"
local c_requests="$TST_NETLOAD_CLN_REQUESTS"
local c_opts=
@@ -704,163 +686,86 @@ tst_netload()
local expect_ret=0
[ "$expect_res" != "pass" ] && expect_ret=3
- local was_failure=0
- if [ "$run_cnt" -lt 2 ]; then
- run_cnt=1
- was_failure=1
- fi
-
+ tst_rhost_run -c "pkill -9 netstress\$"
s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
- c_opts="${cs_opts}${c_opts}-a $c_num -r $((c_requests / run_cnt)) -d $rfile"
-
tst_res_ TINFO "run server 'netstress $s_opts'"
- tst_res_ TINFO "run client 'netstress -l $c_opts' $run_cnt times"
-
- tst_rhost_run -c "pkill -9 netstress\$"
- rm -f tst_netload.log
-
- local results
- local passed=0
-
- for i in $(seq 1 $run_cnt); do
- tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
- if [ $? -ne 0 ]; then
- cat tst_netload.log
- local ttype="TFAIL"
- grep -e 'CONF:' tst_netload.log && ttype="TCONF"
- tst_brk_ $ttype "server failed"
- fi
-
- local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
- netstress -l ${c_opts} -g $port > tst_netload.log 2>&1
- ret=$?
- tst_rhost_run -c "pkill -9 netstress\$"
-
- if [ "$expect_ret" -ne 0 ]; then
- if [ $((ret & expect_ret)) -ne 0 ]; then
- tst_res_ TPASS "netstress failed as expected"
- else
- tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"
- fi
- return $ret
- fi
+ tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
+ if [ $? -ne 0 ]; then
+ cat tst_netload.log
+ local ttype="TFAIL"
+ grep -e 'CONF:' tst_netload.log && ttype="TCONF"
+ tst_brk_ $ttype "server failed"
+ fi
- if [ "$ret" -ne 0 ]; then
- [ $((ret & 32)) -ne 0 ] && \
- tst_netload_brk TCONF "not supported configuration"
+ local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
+ c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port"
- [ $((ret & 3)) -ne 0 -a $was_failure -gt 0 ] && \
- tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"
+ tst_res_ TINFO "run client 'netstress -l $c_opts'"
+ netstress -l $c_opts > tst_netload.log 2>&1 || ret=$?
+ tst_rhost_run -c "pkill -9 netstress\$"
- tst_res_ TWARN "netstress failed, ret: $ret"
- was_failure=1
- continue
+ if [ "$expect_ret" -ne 0 ]; then
+ if [ $((ret & expect_ret)) -ne 0 ]; then
+ tst_res_ TPASS "netstress failed as expected"
+ else
+ tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"
fi
-
- [ ! -f $rfile ] && \
- tst_netload_brk TFAIL "can't read $rfile"
-
- results="$results $(cat $rfile)"
- passed=$((passed + 1))
- done
+ return $ret
+ fi
if [ "$ret" -ne 0 ]; then
+ tst_dump_rhost_cmd
+ cat tst_netload.log
+ [ $((ret & 3)) -ne 0 ] && \
+ tst_brk_ TFAIL "expected '$expect_res' but ret: '$ret'"
+ [ $((ret & 32)) -ne 0 ] && \
+ tst_brk_ TCONF "not supported configuration"
[ $((ret & 4)) -ne 0 ] && \
tst_res_ TWARN "netstress has warnings"
- tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"
fi
- local median=$(tst_get_median $results)
- echo "$median" > $rfile
-
- tst_res_ TPASS "netstress passed, median time $median ms, data:$results"
-
- return $ret
-}
-
-# Compares results for netload runs.
-# tst_netload_compare TIME_BASE TIME THRESHOLD_LOW [THRESHOLD_HI]
-# TIME_BASE: time taken to run netstress load test - 100%
-# TIME: time that is compared to the base one
-# THRESHOD_LOW: lower limit for TFAIL
-# THRESHOD_HIGH: upper limit for TWARN
-tst_netload_compare()
-{
- local base_time=$1
- local new_time=$2
- local threshold_low=$3
- local threshold_hi=$4
-
- if [ -z "$base_time" -o -z "$new_time" -o -z "$threshold_low" ]; then
- tst_brk_ TBROK "tst_netload_compare: invalid argument(s)"
- fi
-
- local res=$(((base_time - new_time) * 100 / base_time))
- local msg="performance result is ${res}%"
-
- if [ "$res" -lt "$threshold_low" ]; then
- tst_res_ TFAIL "$msg < threshold ${threshold_low}%"
- return
+ if [ ! -f $rfile ]; then
+ tst_dump_rhost_cmd
+ cat tst_netload.log
+ tst_brk_ TFAIL "can't read $rfile"
fi
- [ "$threshold_hi" ] && [ "$res" -gt "$threshold_hi" ] && \
- tst_res_ TWARN "$msg > threshold ${threshold_hi}%"
+ tst_res_ TPASS "netstress passed, time spent '$(cat $rfile)' ms"
- tst_res_ TPASS "$msg, in range [${threshold_low}:${threshold_hi}]%"
-}
-
-tst_ping_opt_unsupported()
-{
- ping $@ 2>&1 | grep -q "invalid option"
+ return $ret
}
-# tst_ping -c COUNT -s MESSAGE_SIZES -p PATTERN -I IFACE -H HOST
+# tst_ping [IFACE] [DST ADDR] [MESSAGE SIZE ARRAY]
# Check icmp connectivity
# IFACE: source interface name or IP address
-# HOST: destination IPv4 or IPv6 address
-# MESSAGE_SIZES: message size array
+# DST ADDR: destination IPv4 or IPv6 address
+# MESSAGE SIZE ARRAY: message size array
tst_ping()
{
# The max number of ICMP echo request
- local ping_count="${PING_MAX:-500}"
- local flood_opt="-f"
- local pattern_opt
- local msg_sizes
- local src_iface="$(tst_iface)"
- local dst_addr="$(tst_ipaddr rhost)"
+ PING_MAX="${PING_MAX:-500}"
+
+ local src_iface="${1:-$(tst_iface)}"
+ local dst_addr="${2:-$(tst_ipaddr rhost)}"; shift $(( $# >= 2 ? 2 : 0 ))
+ local msg_sizes="$*"
+ local msg="tst_ping $dst_addr iface/saddr $src_iface, msg_size"
local cmd="ping"
local ret=0
- local opts
-
- local OPTIND
- while getopts c:s:p:I:H: opt; do
- case "$opt" in
- c) ping_count="$OPTARG";;
- s) msg_sizes="$OPTARG";;
- p) pattern_opt="-p $OPTARG";;
- I) src_iface="$OPTARG";;
- H) dst_addr="$OPTARG";;
- *) tst_brk_ TBROK "tst_ping: unknown option: $OPTARG";;
- esac
- done
echo "$dst_addr" | grep -q ':' && cmd="ping6"
tst_require_cmds $cmd
- if tst_ping_opt_unsupported $flood_opt; then
- flood_opt="-i 0.01"
- [ "$pattern_opt" ] && pattern_opt="-p aa"
-
- tst_ping_opt_unsupported -i $pattern_opt && \
- tst_brk_ TCONF "unsupported ping version (old busybox?)"
- fi
-
# ping cmd use 56 as default message size
for size in ${msg_sizes:-"56"}; do
- EXPECT_PASS $cmd -I $src_iface -c $ping_count -s $size \
- $flood_opt $pattern_opt $dst_addr \>/dev/null
+ $cmd -I $src_iface -c $PING_MAX $dst_addr \
+ -s $size -i 0 > /dev/null 2>&1
ret=$?
- [ "$ret" -ne 0 ] && break
+ if [ $ret -eq 0 ]; then
+ tst_res_ TPASS "$msg $size: pass"
+ else
+ tst_res_ TFAIL "$msg $size: fail"
+ break
+ fi
done
return $ret
}
@@ -938,7 +843,7 @@ tst_default_max_pkt()
export RHOST="$RHOST"
export PASSWD="${PASSWD:-}"
# Don't use it in new tests, use tst_rhost_run() from tst_net.sh instead.
-export LTP_RSH="${LTP_RSH:-ssh -nq}"
+export LTP_RSH="${LTP_RSH:-rsh -n}"
# Test Links
# IPV{4,6}_{L,R}HOST can be set with or without prefix (e.g. IP or IP/prefix),
@@ -991,12 +896,9 @@ if [ -z "$_tst_net_parse_variables" ]; then
export _tst_net_parse_variables="yes"
fi
-export TST_NET_DATAROOT="$LTPROOT/testcases/bin/datafiles"
-
export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}"
export TST_NETLOAD_CLN_NUMBER="${TST_NETLOAD_CLN_NUMBER:-2}"
export TST_NETLOAD_BINDTODEVICE="${TST_NETLOAD_BINDTODEVICE-1}"
-export TST_NETLOAD_RUN_COUNT="${TST_NETLOAD_RUN_COUNT:-5}"
export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
export FTP_UPLOAD_DIR="${FTP_UPLOAD_DIR:-/var/ftp/pub}"
@@ -1017,8 +919,6 @@ export UPLOAD_BIGFILESIZE="${UPLOAD_BIGFILESIZE:-2147483647}"
export UPLOAD_REGFILESIZE="${UPLOAD_REGFILESIZE:-1024}"
export MCASTNUM_NORMAL="${MCASTNUM_NORMAL:-20}"
export MCASTNUM_HEAVY="${MCASTNUM_HEAVY:-4000}"
-export ROUTE_CHANGE_IP="${ROUTE_CHANGE_IP:-100}"
-export ROUTE_CHANGE_NETLINK="${ROUTE_CHANGE_NETLINK:-10000}"
# Warning: make sure to set valid interface names and IP addresses below.
# Set names for test interfaces, e.g. "eth0 eth1"
diff --git a/testcases/lib/tst_net_iface_prefix.c b/testcases/lib/tst_net_iface_prefix.c
index 4b024872d..a40a8edc2 100644
--- a/testcases/lib/tst_net_iface_prefix.c
+++ b/testcases/lib/tst_net_iface_prefix.c
@@ -13,7 +13,6 @@
#include "tst_test.h"
#include "tst_net.h"
-#include "tst_private.h"
static char *iface;
static int prefix;
@@ -125,7 +124,7 @@ int main(int argc, char *argv[])
prefix_str = strchr(ip_str, '/');
if (prefix_str) {
- prefix = tst_get_prefix(ip_str, is_ipv6);
+ prefix = get_prefix(ip_str, is_ipv6);
tst_res_comment(TINFO,
"IP address '%s' contains prefix %d, using it and don't search for iface.\n",
ip_str, prefix);
@@ -137,12 +136,11 @@ int main(int argc, char *argv[])
/* checks for validity of IP string */
if (is_ipv6)
- tst_get_in6_addr(ip_str, &ip6);
+ get_in6_addr(ip_str, &ip6);
else
- tst_get_in_addr(ip_str, &ip);
+ get_in_addr(ip_str, &ip);
- tst_print_svar_change(is_rhost ? "RHOST_IFACES" : "LHOST_IFACES",
- iface);
+ print_svar_change(is_rhost ? "RHOST_IFACES" : "LHOST_IFACES", iface);
if (is_ipv6)
print_ivar(is_rhost ? "IPV6_RPREFIX" : "IPV6_LPREFIX", prefix);
else
diff --git a/testcases/lib/tst_net_ip_prefix.c b/testcases/lib/tst_net_ip_prefix.c
index 59c70ba7d..2ac06e724 100644
--- a/testcases/lib/tst_net_ip_prefix.c
+++ b/testcases/lib/tst_net_ip_prefix.c
@@ -10,7 +10,6 @@
#include "tst_test.h"
#include "tst_net.h"
-#include "tst_private.h"
#define DEFAULT_IPV4_PREFIX 24
#define DEFAULT_IPV6_PREFIX 64
@@ -68,22 +67,22 @@ int main(int argc, char *argv[])
prefix_str = strchr(ip_str, '/');
if (prefix_str)
- prefix = tst_get_prefix(ip_str, is_ipv6);
+ prefix = get_prefix(ip_str, is_ipv6);
else
prefix = is_ipv6 ? DEFAULT_IPV6_PREFIX : DEFAULT_IPV4_PREFIX;
/* checks for validity of IP string */
if (is_ipv6)
- tst_get_in6_addr(ip_str, &ip6);
+ get_in6_addr(ip_str, &ip6);
else
- tst_get_in_addr(ip_str, &ip);
+ get_in_addr(ip_str, &ip);
if (is_ipv6) {
print_ivar(is_rhost ? "IPV6_RPREFIX" : "IPV6_LPREFIX", prefix);
- tst_print_svar(is_rhost ? "IPV6_RHOST" : "IPV6_LHOST", ip_str);
+ print_svar(is_rhost ? "IPV6_RHOST" : "IPV6_LHOST", ip_str);
} else {
print_ivar(is_rhost ? "IPV4_RPREFIX" : "IPV4_LPREFIX", prefix);
- tst_print_svar(is_rhost ? "IPV4_RHOST" : "IPV4_LHOST", ip_str);
+ print_svar(is_rhost ? "IPV4_RHOST" : "IPV4_LHOST", ip_str);
}
exit(EXIT_SUCCESS);
diff --git a/testcases/lib/tst_net_vars.c b/testcases/lib/tst_net_vars.c
index e7bf0e56a..7c5507ed7 100644
--- a/testcases/lib/tst_net_vars.c
+++ b/testcases/lib/tst_net_vars.c
@@ -22,7 +22,6 @@
#include "tst_test.h"
#include "tst_net.h"
-#include "tst_private.h"
#define BASE_IPV4_PREFIX 8
#define BASE_IPV6_PREFIX 16
@@ -218,7 +217,7 @@ static char *get_ipv4_net16_unused(const struct in_addr *ip,
DEFAULT_IPV4_UNUSED_PART2);
sprintf(buf, "%s.0.0", net_unused);
- tst_get_in_addr(buf, &network);
+ get_in_addr(buf, &network);
if (!is_in_subnet_ipv4(ip, &mask, &network))
return strdup(net_unused);
@@ -230,7 +229,7 @@ static char *get_ipv4_net16_unused(const struct in_addr *ip,
(rand() % 128) + (((ip->s_addr >> 8) & 0xff) < 128 ? 128 : 0));
sprintf(buf, "%s.0.0", net_unused);
- tst_get_in_addr(buf, &network);
+ get_in_addr(buf, &network);
if (!is_in_subnet_ipv4(ip, &mask, &network))
return strdup(net_unused);
@@ -240,7 +239,7 @@ static char *get_ipv4_net16_unused(const struct in_addr *ip,
< 128 ? 128 : 0), DEFAULT_IPV4_UNUSED_PART2);
sprintf(buf, "%s.0.0", net_unused);
- tst_get_in_addr(buf, &network);
+ get_in_addr(buf, &network);
if (!is_in_subnet_ipv4(ip, &mask, &network))
return strdup(net_unused);
@@ -282,7 +281,7 @@ static char *get_ipv6_net32_unused(const struct in6_addr *ip6,
DEFAULT_IPV6_UNUSED_PART2);
sprintf(buf, "%s::", net_unused);
- tst_get_in6_addr(buf, &network);
+ get_in6_addr(buf, &network);
if (!is_in_subnet_ipv6(ip6, &mask, &network))
return strdup(net_unused);
@@ -295,7 +294,7 @@ static char *get_ipv6_net32_unused(const struct in6_addr *ip6,
DEFAULT_IPV6_UNUSED_PART2);
sprintf(buf, "%s::", net_unused);
- tst_get_in6_addr(buf, &network);
+ get_in6_addr(buf, &network);
if (!is_in_subnet_ipv6(ip6, &mask, &network))
return strdup(net_unused);
@@ -306,7 +305,7 @@ static char *get_ipv6_net32_unused(const struct in6_addr *ip6,
128 : 0), DEFAULT_IPV6_UNUSED_PART2);
sprintf(buf, "%s::", net_unused);
- tst_get_in6_addr(buf, &network);
+ get_in6_addr(buf, &network);
if (!is_in_subnet_ipv6(ip6, &mask, &network))
return strdup(net_unused);
@@ -504,8 +503,8 @@ static void get_ipv4_info(const char *lip_str, const char *rip_str, int lprefix,
lprefix_round = round_down_prefix(lprefix, 0);
rprefix_round = round_down_prefix(rprefix, 0);
- tst_get_in_addr(lip_str, &lip);
- tst_get_in_addr(rip_str, &rip);
+ get_in_addr(lip_str, &lip);
+ get_in_addr(rip_str, &rip);
vars.ipv4_lbroadcast = get_ipv4_broadcast(lip, lprefix);
vars.ipv4_rbroadcast = get_ipv4_broadcast(rip, rprefix);
@@ -531,8 +530,8 @@ static void get_ipv6_info(const char *lip_str, const char *rip_str,
lprefix_round = round_down_prefix(lprefix, 1);
rprefix_round = round_down_prefix(rprefix, 1);
- tst_get_in6_addr(lip_str, &lip);
- tst_get_in6_addr(rip_str, &rip);
+ get_in6_addr(lip_str, &lip);
+ get_in6_addr(rip_str, &rip);
vars.ipv6_lnetmask = get_ipv6_netmask(lprefix);
vars.ipv6_rnetmask = get_ipv6_netmask(rprefix);
@@ -549,23 +548,23 @@ static void get_ipv6_info(const char *lip_str, const char *rip_str,
static void print_vars(int is_ipv6)
{
if (is_ipv6) {
- tst_print_svar("IPV6_LNETMASK", vars.ipv6_lnetmask);
- tst_print_svar_change("IPV6_RNETMASK", vars.ipv6_rnetmask);
- tst_print_svar("IPV6_LNETWORK", vars.ipv6_lnetwork);
- tst_print_svar("IPV6_RNETWORK", vars.ipv6_rnetwork);
- tst_print_svar("LHOST_IPV6_HOST", vars.lhost_ipv6_host);
- tst_print_svar("RHOST_IPV6_HOST", vars.rhost_ipv6_host);
- tst_print_svar("IPV6_NET32_UNUSED", vars.ipv6_net32_unused);
+ print_svar("IPV6_LNETMASK", vars.ipv6_lnetmask);
+ print_svar_change("IPV6_RNETMASK", vars.ipv6_rnetmask);
+ print_svar("IPV6_LNETWORK", vars.ipv6_lnetwork);
+ print_svar("IPV6_RNETWORK", vars.ipv6_rnetwork);
+ print_svar("LHOST_IPV6_HOST", vars.lhost_ipv6_host);
+ print_svar("RHOST_IPV6_HOST", vars.rhost_ipv6_host);
+ print_svar("IPV6_NET32_UNUSED", vars.ipv6_net32_unused);
} else {
- tst_print_svar("IPV4_LBROADCAST", vars.ipv4_lbroadcast);
- tst_print_svar_change("IPV4_RBROADCAST", vars.ipv4_rbroadcast);
- tst_print_svar("IPV4_LNETMASK", vars.ipv4_lnetmask);
- tst_print_svar_change("IPV4_RNETMASK", vars.ipv4_rnetmask);
- tst_print_svar("IPV4_LNETWORK", vars.ipv4_lnetwork);
- tst_print_svar("IPV4_RNETWORK", vars.ipv4_rnetwork);
- tst_print_svar("LHOST_IPV4_HOST", vars.lhost_ipv4_host);
- tst_print_svar("RHOST_IPV4_HOST", vars.rhost_ipv4_host);
- tst_print_svar("IPV4_NET16_UNUSED", vars.ipv4_net16_unused);
+ print_svar("IPV4_LBROADCAST", vars.ipv4_lbroadcast);
+ print_svar_change("IPV4_RBROADCAST", vars.ipv4_rbroadcast);
+ print_svar("IPV4_LNETMASK", vars.ipv4_lnetmask);
+ print_svar_change("IPV4_RNETMASK", vars.ipv4_rnetmask);
+ print_svar("IPV4_LNETWORK", vars.ipv4_lnetwork);
+ print_svar("IPV4_RNETWORK", vars.ipv4_rnetwork);
+ print_svar("LHOST_IPV4_HOST", vars.lhost_ipv4_host);
+ print_svar("RHOST_IPV4_HOST", vars.rhost_ipv4_host);
+ print_svar("IPV4_NET16_UNUSED", vars.ipv4_net16_unused);
}
}
@@ -587,19 +586,19 @@ int main(int argc, char *argv[])
rip_str = argv[2];
is_ipv6 = !!strchr(lip_str, ':');
- lprefix = tst_get_prefix(lip_str, is_ipv6);
- rprefix = tst_get_prefix(rip_str, is_ipv6);
+ lprefix = get_prefix(lip_str, is_ipv6);
+ rprefix = get_prefix(rip_str, is_ipv6);
if (is_ipv6)
- tst_get_in6_addr(lip_str, &ip6);
+ get_in6_addr(lip_str, &ip6);
else
- tst_get_in_addr(lip_str, &ip);
+ get_in_addr(lip_str, &ip);
tmp = !!strchr(rip_str, ':');
if (tmp)
- tst_get_in6_addr(rip_str, &ip6);
+ get_in6_addr(rip_str, &ip6);
else
- tst_get_in_addr(rip_str, &ip);
+ get_in_addr(rip_str, &ip);
if (is_ipv6 != tmp)
tst_brk_comment("mixed IPv4 and IPv6 addresses ('%s', '%s')",
diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
index 7ae6ddb61..7d033bbc5 100644
--- a/testcases/lib/tst_security.sh
+++ b/testcases/lib/tst_security.sh
@@ -27,7 +27,7 @@ _tst_check_security_modules()
tst_res TINFO "loaded AppArmor profiles: $profiles"
fi
- if tst_selinux_enforced; then
+ if tst_selinux_enabled; then
tst_res TINFO "SELinux enabled in enforcing mode, this may affect test results"
[ "$TST_DISABLE_SELINUX" = 1 ] || \
@@ -63,9 +63,9 @@ tst_apparmor_used_profile()
# Detect whether SELinux is enabled in enforcing mode
# Return 0: enabled in enforcing mode
# Return 1: enabled in permissive mode or disabled
-tst_selinux_enforced()
+tst_selinux_enabled()
{
- local f="$(tst_get_enforce)"
+ local f="$(_tst_get_enforce)"
[ -f "$f" ] && [ "$(cat $f)" = "1" ]
}
@@ -95,7 +95,7 @@ tst_selinux_used_profile()
tst_disable_apparmor()
{
tst_res TINFO "trying to disable AppArmor (requires super/root)"
- tst_require_root
+ _tst_require_root
local f="aa-teardown"
local action
@@ -115,39 +115,19 @@ tst_disable_apparmor()
tst_disable_selinux()
{
tst_res TINFO "trying to disable SELinux (requires super/root)"
- tst_require_root
+ _tst_require_root
- local f="$(tst_get_enforce)"
+ local f="$(_tst_get_enforce)"
[ -f "$f" ] && cat 0 > $f
}
-# Get SELinux directory path
-tst_get_selinux_dir()
+# Get SELinux enforce file path
+_tst_get_enforce()
{
local dir="/sys/fs/selinux"
[ -d "$dir" ] || dir="/selinux"
- [ -d "$dir" ] && echo "$dir"
-}
-
-# Get SELinux enforce file path
-tst_get_enforce()
-{
- local dir=$(tst_get_selinux_dir)
- [ -z "$dir" ] || return
-
local f="$dir/enforce"
[ -f "$f" ] && echo "$f"
}
-
-tst_update_selinux_state()
-{
- local cur_val new_val
- local dir=$(tst_get_selinux_dir)
- [ -z "$dir" ] || return 1
-
- cur_val=$(cat $dir/checkreqprot)
- [ $cur_val = 1 ] && new_val=0 || new_val=1
- echo $new_val > $dir/checkreqprot
-}
diff --git a/testcases/lib/tst_supported_fs.c b/testcases/lib/tst_supported_fs.c
index 43eac194f..022a61508 100644
--- a/testcases/lib/tst_supported_fs.c
+++ b/testcases/lib/tst_supported_fs.c
@@ -22,7 +22,6 @@ static void usage(void)
int main(int argc, char *argv[])
{
- const char *skiplist[] = {"tmpfs", NULL};
const char *const *filesystems;
int i;
@@ -38,9 +37,9 @@ int main(int argc, char *argv[])
}
if (argv[1])
- return !tst_fs_is_supported(argv[1]);
+ return !tst_fs_is_supported(argv[1], 0);
- filesystems = tst_get_supported_fs_types(skiplist);
+ filesystems = tst_get_supported_fs_types(0);
for (i = 0; filesystems[i]; i++)
printf("%s\n", filesystems[i]);
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 3a5651c01..b98f86e8e 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2014-2021
+# Copyright (c) Linux Test Project, 2014-2019
# Author: Cyril Hrubis <chrubis@suse.cz>
#
# LTP test library for shell.
@@ -21,19 +21,15 @@ export TST_LIB_LOADED=1
. tst_security.sh
# default trap function
-trap "tst_brk TBROK 'test interrupted or timed out'" INT
+trap "tst_brk TBROK 'test interrupted'" INT
_tst_do_exit()
{
local ret=0
TST_DO_EXIT=1
- if [ -n "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then
- if type $TST_CLEANUP >/dev/null 2>/dev/null; then
- $TST_CLEANUP
- else
- tst_res TWARN "TST_CLEANUP=$TST_CLEANUP declared, but function not defined (or cmd not found)"
- fi
+ if [ -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then
+ $TST_CLEANUP
fi
if [ "$TST_NEEDS_DEVICE" = 1 -a "$TST_DEVICE_FLAG" = 1 ]; then
@@ -48,7 +44,10 @@ _tst_do_exit()
[ "$TST_TMPDIR_RHOST" = 1 ] && tst_cleanup_rhost
fi
- _tst_cleanup_timer
+ if [ -n "$_tst_setup_timer_pid" ]; then
+ kill $_tst_setup_timer_pid 2>/dev/null
+ wait $_tst_setup_timer_pid 2>/dev/null
+ fi
if [ $TST_FAIL -gt 0 ]; then
ret=$((ret|1))
@@ -74,7 +73,6 @@ _tst_do_exit()
echo "Summary:"
echo "passed $TST_PASS"
echo "failed $TST_FAIL"
- echo "broken $TST_BROK"
echo "skipped $TST_CONF"
echo "warnings $TST_WARN"
@@ -104,9 +102,9 @@ tst_res()
_tst_inc_res "$res"
- printf "$TST_ID $TST_COUNT " >&2
- tst_print_colored $res "$res: " >&2
- echo "$@" >&2
+ printf "$TST_ID $TST_COUNT "
+ tst_print_colored $res "$res: "
+ echo "$@"
}
tst_brk()
@@ -209,7 +207,7 @@ TST_RETRY_FN_EXP_BACKOFF()
fi
while true; do
- eval "$tst_fun"
+ $tst_fun
if [ "$?" = "$tst_exp" ]; then
break
fi
@@ -352,7 +350,7 @@ tst_require_cmds()
tst_check_cmds()
{
local cmd
- for cmd in $*; do
+ for cmd; do
if ! tst_cmd_available $cmd; then
tst_res TCONF "'$cmd' not found"
return 1
@@ -435,47 +433,6 @@ _tst_multiply_timeout()
return 0
}
-_tst_kill_test()
-{
- local i=10
-
- trap '' INT
- tst_res TBROK "Test timeouted, sending SIGINT! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1"
- kill -INT -$pid
- tst_sleep 100ms
-
- while kill -0 $pid >/dev/null 2>&1 && [ $i -gt 0 ]; do
- tst_res TINFO "Test is still running, waiting ${i}s"
- sleep 1
- i=$((i-1))
- done
-
- if kill -0 $pid >/dev/null 2>&1; then
- tst_res TBROK "Test still running, sending SIGKILL"
- kill -KILL -$pid
- fi
-}
-
-_tst_cleanup_timer()
-{
- if [ -n "$_tst_setup_timer_pid" ]; then
- kill -TERM $_tst_setup_timer_pid 2>/dev/null
- wait $_tst_setup_timer_pid 2>/dev/null
- fi
-}
-
-_tst_timeout_process()
-{
- local sleep_pid
-
- sleep $sec &
- sleep_pid=$!
- trap "kill $sleep_pid; exit" TERM
- wait $sleep_pid
- trap - TERM
- _tst_kill_test
-}
-
_tst_setup_timer()
{
TST_TIMEOUT=${TST_TIMEOUT:-300}
@@ -498,47 +455,18 @@ _tst_setup_timer()
tst_res TINFO "timeout per run is ${h}h ${m}m ${s}s"
- _tst_cleanup_timer
-
- _tst_timeout_process &
+ sleep $sec && tst_res TBROK "test killed, timeout! If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1" && kill -9 -$pid &
_tst_setup_timer_pid=$!
}
-tst_require_root()
+_tst_require_root()
{
if [ "$(id -ru)" != 0 ]; then
tst_brk TCONF "Must be super/root for this test!"
fi
}
-tst_require_module()
-{
- local _tst_module=$1
-
- for tst_module in "$_tst_module" \
- "$LTPROOT/testcases/bin/$_tst_module" \
- "$TST_STARTWD/$_tst_module"; do
-
- if [ -f "$tst_module" ]; then
- TST_MODPATH="$tst_module"
- break
- fi
- done
-
- if [ -z "$TST_MODPATH" ]; then
- tst_brk TCONF "Failed to find module '$_tst_module'"
- fi
-
- tst_res TINFO "Found module at '$TST_MODPATH'"
-}
-
-tst_set_timeout()
-{
- TST_TIMEOUT="$1"
- _tst_setup_timer
-}
-
tst_run()
{
local _tst_i
@@ -555,9 +483,9 @@ tst_run()
NEEDS_ROOT|NEEDS_TMPDIR|TMPDIR|NEEDS_DEVICE|DEVICE);;
NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);;
NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);;
- IPV6|IPV6_FLAG|IPVER|TEST_DATA|TEST_DATA_IFS);;
+ IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);;
RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);;
- NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG|NETLOAD_CLN_NUMBER);;
+ NET_MAX_PKT);;
*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
esac
done
@@ -586,7 +514,7 @@ tst_run()
tst_brk TBROK "Number of iterations (-i) must be > 0"
fi
- [ "$TST_NEEDS_ROOT" = 1 ] && tst_require_root
+ [ "$TST_NEEDS_ROOT" = 1 ] && _tst_require_root
[ "$TST_DISABLE_APPARMOR" = 1 ] && tst_disable_apparmor
[ "$TST_DISABLE_SELINUX" = 1 ] && tst_disable_selinux
@@ -601,7 +529,7 @@ tst_run()
_tst_setup_timer
- [ "$TST_NEEDS_DEVICE" = 1 ] && TST_NEEDS_TMPDIR=1
+ [ "$TST_NEEDS_DEVICE" = 1 ] && TST_TMPDIR=1
if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
if [ -z "$TMPDIR" ]; then
@@ -630,17 +558,28 @@ tst_run()
TST_DEVICE_FLAG=1
fi
- [ -n "$TST_NEEDS_MODULE" ] && tst_require_module "$TST_NEEDS_MODULE"
+ if [ -n "$TST_NEEDS_MODULE" ]; then
+ for tst_module in "$TST_NEEDS_MODULE" \
+ "$LTPROOT/testcases/bin/$TST_NEEDS_MODULE" \
+ "$TST_STARTWD/$TST_NEEDS_MODULE"; do
- if [ -n "$TST_SETUP" ]; then
- if type $TST_SETUP >/dev/null 2>/dev/null; then
- TST_DO_CLEANUP=1
- $TST_SETUP
+ if [ -f "$tst_module" ]; then
+ TST_MODPATH="$tst_module"
+ break
+ fi
+ done
+
+ if [ -z "$TST_MODPATH" ]; then
+ tst_brk TCONF "Failed to find module '$TST_NEEDS_MODULE'"
else
- tst_brk TBROK "TST_SETUP=$TST_SETUP declared, but function not defined (or cmd not found)"
+ tst_res TINFO "Found module at '$TST_MODPATH'"
fi
fi
+ if [ -n "$TST_SETUP" ]; then
+ $TST_SETUP
+ fi
+
#TODO check that test reports some results for each test function call
while [ $TST_ITERATIONS -gt 0 ]; do
if [ -n "$TST_TEST_DATA" ]; then
@@ -655,6 +594,7 @@ tst_run()
fi
TST_ITERATIONS=$((TST_ITERATIONS-1))
done
+
_tst_do_exit
}
@@ -663,7 +603,6 @@ _tst_run_tests()
local _tst_data="$1"
local _tst_i
- TST_DO_CLEANUP=1
for _tst_i in $(seq ${TST_CNT:-1}); do
if type ${TST_TESTFUNC}1 > /dev/null 2>&1; then
_tst_run_test "$TST_TESTFUNC$_tst_i" $_tst_i "$_tst_data"
@@ -699,7 +638,7 @@ else
fi
if [ -z "$TST_NO_DEFAULT_RUN" ]; then
- if TST_TEST_PATH=$(command -v $0) 2>/dev/null; then
+ if TST_TEST_PATH=$(which $0) 2>/dev/null; then
if ! grep -q tst_run "$TST_TEST_PATH"; then
tst_brk TBROK "Test $0 must call tst_run!"
fi
diff --git a/testcases/misc/crash/crash02.c b/testcases/misc/crash/crash02.c
index e46c2aa66..cddedc102 100644
--- a/testcases/misc/crash/crash02.c
+++ b/testcases/misc/crash/crash02.c
@@ -471,12 +471,6 @@ int in_blacklist(int sysno)
#if defined(__NR_clone) && __NR_clone
SYS_clone,
#endif
-#if defined(__NR_vhangup) && __NR_vhangup
- __NR_vhangup, /* int vhangup(void); - terminal logout */
-#endif
-#if defined(__NR_pause) && __NR_pause
- __NR_pause, /* int pause(void); - sleep indefinitely */
-#endif
-1
};
diff --git a/testcases/misc/lvm/Makefile b/testcases/misc/lvm/Makefile
deleted file mode 100644
index 27e3f6fec..000000000
--- a/testcases/misc/lvm/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS := generate_lvm_runfile.sh prepare_lvm.sh cleanup_lvm.sh
-
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/misc/lvm/cleanup_lvm.sh b/testcases/misc/lvm/cleanup_lvm.sh
deleted file mode 100755
index b41b41319..000000000
--- a/testcases/misc/lvm/cleanup_lvm.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
-#
-# Clean up LVM volume groups created by prepare_lvm.sh
-
-TST_TESTFUNC=cleanup_lvm
-TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="losetup umount vgremove"
-. tst_test.sh
-
-LVM_DIR="${LVM_DIR:-/tmp}"
-LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
-LVM_IMGDIR="$LVM_DIR/ltp/imgfiles"
-
-cleanup_lvm()
-{
- DEVLIST=`losetup -lnO NAME,BACK-FILE | grep "$LVM_IMGDIR" | cut -d ' ' -f 1`
-
- for dir in "$LVM_TMPDIR/"*; do
- tst_umount $dir
- done
-
- ROD vgremove -y ltp_test_vg1
- ROD vgremove -y ltp_test_vg2
-
- for devname in $DEVLIST; do
- ROD tst_device release $devname
- done
-
- rm -rf $LVM_DIR/ltp
- tst_res TPASS "LVM configuration for LTP removed successfully."
-}
-
-tst_run
diff --git a/testcases/misc/lvm/datafiles/Makefile b/testcases/misc/lvm/datafiles/Makefile
deleted file mode 100644
index 80178672e..000000000
--- a/testcases/misc/lvm/datafiles/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-top_srcdir ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-INSTALL_DIR := testcases/data/lvm
-INSTALL_TARGETS := runfile.tpl
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/misc/lvm/datafiles/runfile.tpl b/testcases/misc/lvm/datafiles/runfile.tpl
deleted file mode 100644
index 4c80e9391..000000000
--- a/testcases/misc/lvm/datafiles/runfile.tpl
+++ /dev/null
@@ -1,36 +0,0 @@
-# Check the {fsname} filesystem
-{fsname}_gf02 growfiles -W {fsname}_gf02 -d {tempdir}/{fsname} -b -e 1 -L 10 -B 805306368 -i 100 -I p -S 2 -u -f gf03_
-{fsname}_gf03 growfiles -W {fsname}_gf03 -d {tempdir}/{fsname} -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
-{fsname}_gf04 growfiles -W {fsname}_gf04 -d {tempdir}/{fsname} -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
-{fsname}_gf05 growfiles -W {fsname}_gf05 -d {tempdir}/{fsname} -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
-{fsname}_gf16 growfiles -W {fsname}_gf16 -d {tempdir}/{fsname} -b -e 1 -i 0 -L 120 -B 805306368 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
-{fsname}_gf17 growfiles -W {fsname}_gf17 -d {tempdir}/{fsname} -b -e 1 -i 0 -L 120 -B 805306368 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
-{fsname}_gf18 growfiles -W {fsname}_gf18 -d {tempdir}/{fsname} -b -e 1 -i 0 -L 120 -B 805306368 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
-{fsname}_gf19 growfiles -W {fsname}_gf19 -d {tempdir}/{fsname} -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
-{fsname}_gf12 mkfifo {tempdir}/{fsname}/gffifo17; growfiles -W {fsname}_gf12 -b -e 1 -u -i 0 -L 30 -B 805306368 {tempdir}/{fsname}/gffifo17
-{fsname}_gf13 mkfifo {tempdir}/{fsname}/gffifo18; growfiles -W {fsname}_gf13 -b -e 1 -u -i 0 -L 30 -B 805306368 -I r -r 1-4096 {tempdir}/{fsname}/gffifo18
-{fsname}_gf01 growfiles -W {fsname}_gf01 -b -e 1 -u -i 0 -L 20 -B 805306368 -w -C 1 -l -I r -T 10 {tempdir}/{fsname}/glseek20 {tempdir}/{fsname}/glseek20.2
-{fsname}_gf06 growfiles -W {fsname}_gf06 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -B 805306368 -C 1 {tempdir}/{fsname}/g_rand10 {tempdir}/{fsname}/g_rand10.2
-{fsname}_gf07 growfiles -W {fsname}_gf07 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -B 805306368 -C 1 -I p {tempdir}/{fsname}/g_rand13 {tempdir}/{fsname}/g_rand13.2
-{fsname}_gf08 growfiles -W {fsname}_gf08 -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -B 805306368 -C 1 {tempdir}/{fsname}/g_rand11 {tempdir}/{fsname}/g_rand11.2
-{fsname}_gf09 growfiles -W {fsname}_gf09 -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -B 805306368 -C 1 -I p {tempdir}/{fsname}/g_rand12 {tempdir}/{fsname}/g_rand12.2
-{fsname}_gf10 growfiles -W {fsname}_gf10 -b -e 1 -u -r 1-5000 -i 0 -L 30 -B 805306368 -C 1 -I l {tempdir}/{fsname}/g_lio14 {tempdir}/{fsname}/g_lio14.2
-{fsname}_gf11 growfiles -W {fsname}_gf11 -b -e 1 -u -r 1-5000 -i 0 -L 30 -B 805306368 -C 1 -I L {tempdir}/{fsname}/g_lio15 {tempdir}/{fsname}/g_lio15.2
-{fsname}_gf14 growfiles -W {fsname}_gf14 -b -e 1 -u -i 0 -L 20 -B 805306368 -w -l -C 1 -T 10 {tempdir}/{fsname}/glseek19 {tempdir}/{fsname}/glseek19.2
-{fsname}_gf15 growfiles -W {fsname}_gf15 -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 -B 805306368 {tempdir}/{fsname}/Lgfile1
-{fsname}_gf20 growfiles -W {fsname}_gf20 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 {tempdir}/{fsname}/gfbigio-$$
-{fsname}_gf21 growfiles -W {fsname}_gf21 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 {tempdir}/{fsname}/gf-bld-$$
-{fsname}_gf22 growfiles -W {fsname}_gf22 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 {tempdir}/{fsname}/gf-bldf-$$
-{fsname}_gf23 growfiles -W {fsname}_gf23 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 {tempdir}/{fsname}/gf-inf-$$
-{fsname}_gf24 growfiles -W {fsname}_gf24 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 {tempdir}/{fsname}/gf-jbld-$$
-{fsname}_gf25 growfiles -W {fsname}_gf25 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 {tempdir}/{fsname}/gf-large-gs-$$
-{fsname}_gf26 growfiles -W {fsname}_gf26 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 {tempdir}/{fsname}/gfsmallio-$$
-{fsname}_gf27 growfiles -W {fsname}_gf27 -b -D 0 -w -g 8b -C 1 -b -i 1000 -u {tempdir}/{fsname}/gfsparse-1-$$
-{fsname}_gf28 growfiles -W {fsname}_gf28 -b -D 0 -w -g 16b -C 1 -b -i 1000 -u {tempdir}/{fsname}/gfsparse-2-$$
-{fsname}_gf29 growfiles -W {fsname}_gf29 -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -B 805306368 -C 1 -u {tempdir}/{fsname}/gfsparse-3-$$
-{fsname}_gf30 growfiles -W {fsname}_gf30 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 {tempdir}/{fsname}/gf-sync-$$
-{fsname}_rwtest01 rwtest -N {fsname}_rwtest01 -c -q -i 60s -f sync 10%25000:rw-sync-$$ 500b:{tempdir}/{fsname}/rwtest01%f
-{fsname}_rwtest02 rwtest -N {fsname}_rwtest02 -c -q -i 60s -f buffered 10%25000:rw-buffered-$$ 500b:{tempdir}/{fsname}/rwtest02%f
-{fsname}_rwtest03 rwtest -N {fsname}_rwtest03 -c -q -i 60s -n 2 -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:{tempdir}/{fsname}/rwtest03%f
-{fsname}_rwtest04 rwtest -N {fsname}_rwtest04 -c -q -i 60s -n 2 -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:{tempdir}/{fsname}/rwtest04%f
-{fsname}_rwtest05 rwtest -N {fsname}_rwtest05 -c -q -i 50 -T 64b 500b:{tempdir}/{fsname}/rwtest05%f
diff --git a/testcases/misc/lvm/generate_lvm_runfile.sh b/testcases/misc/lvm/generate_lvm_runfile.sh
deleted file mode 100755
index 02a797219..000000000
--- a/testcases/misc/lvm/generate_lvm_runfile.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
-#
-# Generate LTP runfile for LVM tests (runtest/lvm.local)
-
-TST_TESTFUNC=generate_runfile
-TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="sed"
-. tst_test.sh
-
-LVM_DIR="${LVM_DIR:-/tmp}"
-LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
-
-generate_runfile()
-{
- trap 'tst_brk TBROK "Cannot create LVM runfile"' ERR
- INFILE="$LTPROOT/testcases/data/lvm/runfile.tpl"
- OUTFILE="$LTPROOT/runtest/lvm.local"
- FS_LIST=`tst_supported_fs`
- echo -n "" >"$OUTFILE"
-
- for fsname in $FS_LIST; do
- # Btrfs needs too much space for reliable stress testing
- if [ "x$fsname" != "xbtrfs" ]; then
- sed -e "s/{fsname}/$fsname/g; s^{tempdir}^$LVM_TMPDIR^g" "$INFILE" >>"$OUTFILE"
- fi
- done
-
- tst_res TPASS "Runfile $OUTFILE successfully created"
-}
-
-tst_run
diff --git a/testcases/misc/lvm/prepare_lvm.sh b/testcases/misc/lvm/prepare_lvm.sh
deleted file mode 100755
index b6557f221..000000000
--- a/testcases/misc/lvm/prepare_lvm.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
-#
-# Create and mount LVM volume groups for lvm.local runfile
-
-TST_TESTFUNC=prepare_lvm
-TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="mount pvcreate vgcreate lvcreate"
-. tst_test.sh
-
-LVM_DIR="${LVM_DIR:-/tmp}"
-LVM_TMPDIR="$LVM_DIR/ltp/growfiles"
-LVM_IMGDIR="$LVM_DIR/ltp/imgfiles"
-
-error_check()
-{
- if [ $? -ne 0 ]; then
- tst_brk TBROK "LVM setup failed"
- fi
-}
-
-create_volume()
-{
- fsname=$2
- ROD mkdir -p $fsname
-
- # If the FS isn't supported, only create the mountpoint and exit
- if ! tst_supported_fs $fsname; then
- return
- fi
-
- vgname=$1
- lvname="ltp_lv_$fsname"
- lvdev="/dev/$vgname/$lvname"
-
- ROD lvcreate -L 1G $vgname -n "$lvname"
- tst_mkfs $fsname "$lvdev"
- ROD mount "$lvdev" $fsname
-}
-
-prepare_mounts()
-{
- FSNAME1=$1
- FSNAME2=$2
- shift 2
- LVM_DEV1=`tst_device acquire 1040 "$LVM_IMGDIR/lvm_pv1.img"`
- error_check
- LVM_DEV2=`tst_device acquire 1040 "$LVM_IMGDIR/lvm_pv2.img"`
- error_check
-
- # DEVSIZE=($# * 1GB / 2) + 16MB. The extra 16MB is for LVM physical
- # volume headers
- DEVSIZE=$(( $# * 512 + 16 ))
- LVM_DEV3=`tst_device acquire $DEVSIZE "$LVM_IMGDIR/lvm_pv3.img"`
- error_check
- LVM_DEV4=`tst_device acquire $DEVSIZE "$LVM_IMGDIR/lvm_pv4.img"`
- error_check
- ROD pvcreate $LVM_DEV1 $LVM_DEV2 $LVM_DEV3 $LVM_DEV4
- ROD vgcreate ltp_test_vg1 $LVM_DEV1 $LVM_DEV2
- ROD vgcreate ltp_test_vg2 $LVM_DEV3 $LVM_DEV4
-
- for fsname in $FSNAME1 $FSNAME2; do
- create_volume ltp_test_vg1 $fsname
- done
-
- for fsname in $@; do
- create_volume ltp_test_vg2 $fsname
- done
-}
-
-prepare_lvm()
-{
- FS_LIST=`tst_supported_fs | sort -u`
- ROD mkdir -p "$LVM_TMPDIR"
- ROD mkdir -p "$LVM_IMGDIR"
- chmod 777 "$LVM_TMPDIR"
- cd "$LVM_TMPDIR"
- error_check
- prepare_mounts $FS_LIST
- tst_res TPASS "LVM mounts are ready"
-}
-
-tst_run
diff --git a/testcases/misc/math/abs/abs01.c b/testcases/misc/math/abs/abs01.c
index b05cf46ad..c62bf0303 100644
--- a/testcases/misc/math/abs/abs01.c
+++ b/testcases/misc/math/abs/abs01.c
@@ -63,7 +63,7 @@ static int blexit(void);
/********************************/
/*--------------------------------------------------------------*/
-int main(void)
+int main(int argc, char *argv[])
{
register long long i;
register int j, k, l, m;
diff --git a/testcases/misc/math/atof/atof01.c b/testcases/misc/math/atof/atof01.c
index 98d085abb..6e8ca8b88 100644
--- a/testcases/misc/math/atof/atof01.c
+++ b/testcases/misc/math/atof/atof01.c
@@ -67,7 +67,7 @@ static int numin(char *, double *);
static int checkbuf(char *, int, int);
/*--------------------------------------------------------------*/
-int main(void)
+int main(int argc, char *argv[])
{
register int i, j;
double r1, r2, x;
diff --git a/testcases/misc/math/float/Makefile b/testcases/misc/math/float/Makefile
index 5f4cb0f6c..79dda35d6 100644
--- a/testcases/misc/math/float/Makefile
+++ b/testcases/misc/math/float/Makefile
@@ -27,6 +27,6 @@ include $(top_srcdir)/include/mk/testcases.mk
LDLIBS += -lpthread -lm
# main.c doesn't compile...
-MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(sort $(wildcard $(abs_srcdir)/float*.c)))
+MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/float*.c))
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/misc/math/fptests/fptest01.c b/testcases/misc/math/fptests/fptest01.c
index 2072dced6..ee29913f9 100644
--- a/testcases/misc/math/fptests/fptest01.c
+++ b/testcases/misc/math/fptests/fptest01.c
@@ -95,7 +95,7 @@ int gcount; /* # calls to gauss */
static struct event *nextevent(void);
-int main(void)
+int main(int argc, char **argv)
{
struct event *ev;
diff --git a/testcases/misc/math/fptests/fptest02.c b/testcases/misc/math/fptests/fptest02.c
index e6b49feb9..04cdc6b11 100644
--- a/testcases/misc/math/fptests/fptest02.c
+++ b/testcases/misc/math/fptests/fptest02.c
@@ -94,7 +94,7 @@ int critfree; /* TRUE if critical section not occupied */
static struct event *nextevent(void );
-int main(void)
+int main(int argc, char *argv[])
{
struct event *ev;
diff --git a/testcases/network/Makefile b/testcases/network/Makefile
index 7b42614ba..f7097e164 100644
--- a/testcases/network/Makefile
+++ b/testcases/network/Makefile
@@ -1,6 +1,24 @@
-# Copyright (C) 2009, Cisco Systems Inc.
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
+#
+# network test suite Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, July 2009
+#
top_srcdir ?= ../..
@@ -21,7 +39,7 @@ ifeq ($(ANDROID),1)
FILTER_OUT_DIRS += lib6 rpc sockets
endif
-ifeq ($(HAVE_RPC),)
+ifeq ($(TIRPC_LIBS),)
FILTER_OUT_DIRS += rpc
endif
diff --git a/testcases/network/README.md b/testcases/network/README.md
index a0a1d3d95..3a9c98125 100644
--- a/testcases/network/README.md
+++ b/testcases/network/README.md
@@ -1,89 +1,91 @@
# LTP Network Tests
+## Pre-requisites
+Enable all the networking services on test machine(s): rshd, nfsd, fingerd.
+
## Single Host Configuration
-It's the default configuration (if the `RHOST` environment variable is not
-defined). LTP adds `ltp_ns` network namespace and auto-configure `veth` pair
-according to LTP network environment variables.
+It is a default configuration ('RHOST' is not defined). LTP adds 'ltp_ns'
+network namespace and auto-configure 'veth' pair according to LTP network
+environment variables.
## Two Host Configuration
-This setup requires the `RHOST` environment variable to be set properly and
-configured SSH access to a remote host.
-
-The `RHOST` variable must be set to the hostname of the server (test management
-link) and public key setup or login without password is required.
+This setup requires 'RHOST' environment variable to be set properly and
+configured SSH or RSH (default) access to a remote host.
-SSH server needs to be configured to allow root login and use Public Key
-Authentication (`PermitRootLogin yes` and `PubkeyAuthentication yes` in
-`/etc/ssh/sshd_config`).
+The 'RHOST' variable name must be set to the hostname of the server
+(test management link) and PASSWD should be set to the root password
+of the remote server.
-Some of the network stress tests which hasn't been ported to network API were
-designed to be tested with `rsh` via `LTP_RSH` environment variable. Now it's
-by default used `ssh`, for details see `testcases/network/stress/README`.
+In order to have RSH access:
+* Edit the "/root/.rhosts" file. Please note that the file may not exist,
+so you must create one if it does not. You must add the fully qualified
+hostname of the machine you are testing on to this file. By adding the test
+machine's hostname to this file, you will be allowing the machine to rsh to itself,
+as root, without the requirement of a password.
-## Server Services Configuration
-Tests have various external dependencies, exit with `TCONF` when not installed.
-Some tests require additional setup.
+```sh
+echo $client_hostname >> /root/.rhosts
+```
-### FTP and telnet setup
-FTP stress tests and telnet server tests require environment variables `RHOST`
-(remote machine), `RUSER` (remote user) and `PASSWD` (remote password). NOTE:
-`RHOST` will imply two host configuration for other tests.
+You may need to re-label '.rhost' file to make sure rlogind will have access to it:
-If `RUSER` is set to `root`, either of these steps is required:
+```sh
+/sbin/restorecon -v /root/.rhosts
+```
-* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
-"root" string. This file lists all those users who are not given access to do ftp
-on the current system.
+* Add rlogin, rsh, rexec into /etc/securetty file:
-* If you don’t want to do the previous step, put following entry into `/root/.netrc`:
-```
-machine <remote_server_name>
-login root
-password <remote_root_password>
+```sh
+for i in rlogin rsh rexec; do echo $i >> /etc/securetty; done
```
-### HTTP setup
-HTTP stress tests require configured and running web server (Apache2, Nginx, etc.).
+## Server Services Configuration
+Verify that the below daemon services are running. If not, please install
+and start them:
+rsh-server, telnet-server, finger-server, rdist, rsync, dhcp-server, http-server.
-### NFS setup
-NFS tests require running NFS server, enable and start `nfs-server.service`
-(Debian/Ubuntu and openSUSE/SLES: `nfs-kernel-server` package, others:
-`nfs-server` package).
+Note: If any of the above daemon is not running on server, the test related to
+that service running from client will fail.
-There is no detection whether service is running, test will simply fail without
-warning.
+### FTP setup
+* In “/etc/ftpusers†[or vi /etc/vsftpd.ftpusers], comment the line containing
+“root†string. This file lists all those users who are not given access to do ftp
+on the current system.
-### TI-RPC / Sun RPC setup
-TI-RPC (or glibc legacy Sun RPC) tests require running rpcbind (or portmap on
-old distributions), enable and start `rpcbind.service`.
+* If you don’t want to do the previous step, put following entry into /root/.netrc
+machine <remote_server_name> login root password <remote_root_password>.
+Otherwise, ftp,rlogin & telnet fails for ‘root’ user & hence needs to be
+executed using ‘test’ user to get successful results.
## LTP setup
-Install LTP testsuite (see INSTALL). In case of two hosts configuration, LTP
-needs to be installed the same exact location and `LTPROOT` and `PATH`
-environment variables set on *both* client and server machines. This is
-required because some tests expect to find server files in certain locations.
+Install LTP testsuite. In case of two hosts configuration, make sure LTP is installed
+on both client and server machines.
-Example for the default prefix `/opt/ltp`:
+Testcases and network tools must be in PATH, e.g.:
```sh
-export LTPROOT="/opt/ltp"; export PATH="$LTPROOT/testcases/bin:$PATH"
+export PATH=/opt/ltp/testcases/bin:/usr/bin:$PATH
```
+Default values for all LTP network variables are set in testcases/lib/tst_net.sh.
+If you need to override some parameters please export them before test run or
+specify them when running ltp-pan or testscripts/network.sh.
## Running the tests
-The network tests are executed by running the network.sh script:
+To run the test type the following:
```sh
TEST_VARS ./network.sh OPTIONS
```
Where
-* `TEST_VARS` - non-default network parameters
-* `OPTIONS` - test group(s), use `-h` to see available ones.
+* TEST_VARS - non-default network parameters (see testcases/lib/tst_net.sh), they
+ could be exported before test run;
+* OPTIONS - test group(s), use '-h' to see available ones.
-Default values for all LTP network parameters are set in `testcases/lib/tst_net.sh`.
-Network stress parameters are documented in `testcases/network/stress/README`.
+## Analyzing the results
+Generally this test must be run more than 24 hours. When you want to stop the test
+press CTRL+C to stop ./network.sh.
-## Debugging
-Both single and two host configurations support debugging via
-`TST_NET_RHOST_RUN_DEBUG=1` environment variable.
+Search failed tests in LTP logfile using grep FAIL <logfile>. For any failures,
+run the individual tests and then try to come to the conclusion.
diff --git a/testcases/network/busy_poll/busy_poll01.sh b/testcases/network/busy_poll/busy_poll01.sh
index d306d1be8..0023f6cef 100755
--- a/testcases/network/busy_poll/busy_poll01.sh
+++ b/testcases/network/busy_poll/busy_poll01.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2015-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
#
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
@@ -47,7 +47,13 @@ test()
tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x
done
- tst_netload_compare $(cat res_0) $(cat res_50) 1
+ local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
+
+ if [ "$poll_cmp" -lt 1 ]; then
+ tst_res TFAIL "busy poll result is '$poll_cmp' %"
+ else
+ tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
+ fi
}
tst_run
diff --git a/testcases/network/busy_poll/busy_poll02.sh b/testcases/network/busy_poll/busy_poll02.sh
index d02aa7342..1f25b7373 100755
--- a/testcases/network/busy_poll/busy_poll02.sh
+++ b/testcases/network/busy_poll/busy_poll02.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2015-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
#
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
@@ -37,7 +37,13 @@ test()
tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x -b $x
done
- tst_netload_compare $(cat res_0) $(cat res_50) 1
+ local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
+
+ if [ "$poll_cmp" -lt 1 ]; then
+ tst_res TFAIL "busy poll result is '$poll_cmp' %"
+ else
+ tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
+ fi
}
tst_run
diff --git a/testcases/network/busy_poll/busy_poll03.sh b/testcases/network/busy_poll/busy_poll03.sh
index f6f1ac134..3c7029927 100755
--- a/testcases/network/busy_poll/busy_poll03.sh
+++ b/testcases/network/busy_poll/busy_poll03.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2016-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2016-2018 Oracle and/or its affiliates.
#
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
@@ -40,7 +40,13 @@ test()
-b $x -T $2
done
- tst_netload_compare $(cat res_0) $(cat res_50) 1
+ local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
+
+ if [ "$poll_cmp" -lt 1 ]; then
+ tst_res TFAIL "busy poll result is '$poll_cmp' %"
+ else
+ tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
+ fi
}
tst_run
diff --git a/testcases/network/can/Makefile b/testcases/network/can/Makefile
index a69f6be87..31744534a 100644
--- a/testcases/network/can/Makefile
+++ b/testcases/network/can/Makefile
@@ -22,4 +22,6 @@ top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
+INSTALL_TARGETS := *.sh
+
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/can/filter-tests/00_Descriptions.txt b/testcases/network/can/filter-tests/00_Descriptions.txt
index 0c54c6521..89610982c 100644
--- a/testcases/network/can/filter-tests/00_Descriptions.txt
+++ b/testcases/network/can/filter-tests/00_Descriptions.txt
@@ -5,6 +5,5 @@ information on the CAN network protocol family PF_CAN is contained in
<Kernel/Documentation/networking/can.txt>.
For any issue(s) with CAN tests please write to:
-<ltp@lists.linux.it>
-Oliver Hartkopp <socketcan@hartkopp.net>
-Linux-CAN ML <linux-can@vger.kernel.org>
+<socketcan-users@lists.berlios.de>,
+Oliver Hartkopp <oliver.hartkopp@volkswagen.de>,
diff --git a/testcases/network/can/filter-tests/COPYING b/testcases/network/can/filter-tests/COPYING
deleted file mode 100644
index 2fa5eb911..000000000
--- a/testcases/network/can/filter-tests/COPYING
+++ /dev/null
@@ -1,35 +0,0 @@
-Copyright (c) 2010-2011 Volkswagen Group Electronic Research
-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. Neither the name of Volkswagen nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-Alternatively, provided that this notice is retained in full, this
-software may be distributed under the terms of the GNU General
-Public License ("GPL") version 2, in which case the provisions of the
-GPL apply INSTEAD OF those given above.
-
-The provided data structures and external interfaces from this code
-are not restricted to be used by modules with a GPL compatible license.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"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 COPYRIGHT
-OWNER OR CONTRIBUTORS 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.
diff --git a/testcases/network/can/filter-tests/INSTALL b/testcases/network/can/filter-tests/INSTALL
index 7d62d65fe..e549aed0f 100644
--- a/testcases/network/can/filter-tests/INSTALL
+++ b/testcases/network/can/filter-tests/INSTALL
@@ -12,8 +12,7 @@ enable CAN protocol, please see ltp/README file.
$ make
2) To Run the tests from this directory, do:
-$ ./can_filter
-$ ./can_rcv_own_msgs
+$ ./run_ltp-can_tests.sh
3) To let LTP run the tests from $LTPROOT, execute:
$ ./runltp -f can
diff --git a/testcases/network/can/filter-tests/Makefile b/testcases/network/can/filter-tests/Makefile
index bd57c7fff..6a9474164 100644
--- a/testcases/network/can/filter-tests/Makefile
+++ b/testcases/network/can/filter-tests/Makefile
@@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Send feedback to <socketcan-users@lists.berlios.de>
top_srcdir ?= ../../../..
@@ -21,4 +23,6 @@ include $(top_srcdir)/include/mk/testcases.mk
CPPFLAGS += -DETH_P_CAN=0x000C -DPF_CAN=29 -DAF_CAN=PF_CAN
+INSTALL_TARGETS := *.sh
+
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/can/filter-tests/can_common.h b/testcases/network/can/filter-tests/can_common.h
deleted file mode 100644
index af0cf5f00..000000000
--- a/testcases/network/can/filter-tests/can_common.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 SUSE LLC
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include "tst_cmd.h"
-#include "tst_safe_stdio.h"
-#include "tst_safe_file_ops.h"
-
-#include <linux/if.h>
-#include <linux/can.h>
-#include <linux/can/raw.h>
-
-static char *can_dev_name;
-static int can_created_dev;
-
-static void can_cmd(const char *const argv[])
-{
- tst_cmd(argv, NULL, NULL, TST_CMD_TCONF_ON_MISSING);
-}
-
-#define CAN_CMD(...) can_cmd((const char *const[]){ __VA_ARGS__, NULL })
-
-static void can_setup_vcan(void)
-{
- unsigned int flags;
- char *path;
-
- if (can_dev_name)
- goto check_echo;
-
- can_dev_name = "vcan0";
-
- tst_res(TINFO, "Creating vcan0 device; use -D option to avoid this");
-
- CAN_CMD("modprobe", "-r", "vcan");
- CAN_CMD("modprobe", "vcan", "echo=1");
-
- can_created_dev = 1;
-
- CAN_CMD("ip", "link", "add", "dev", "vcan0", "type", "vcan");
- CAN_CMD("ip", "link", "set", "dev", "vcan0", "up");
-
-check_echo:
- SAFE_ASPRINTF(&path, "/sys/class/net/%s/flags", can_dev_name);
- if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO)) {
- tst_res(TWARN,
- "Could not determine if ECHO is set on %s. This may effect code coverage.",
- can_dev_name);
- }
-}
-
-static void can_cleanup_vcan(void)
-{
- if (!can_created_dev)
- return;
-
- CAN_CMD("ip", "link", "set", "dev", "vcan0", "down");
- CAN_CMD("ip", "link", "del", "dev", "vcan0");
- CAN_CMD("modprobe", "-r", "vcan");
-}
diff --git a/testcases/network/can/filter-tests/can_filter.c b/testcases/network/can/filter-tests/can_filter.c
index ed35b08e7..db017451a 100644
--- a/testcases/network/can/filter-tests/can_filter.c
+++ b/testcases/network/can/filter-tests/can_filter.c
@@ -1,15 +1,63 @@
-// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
/*
+ * tst-filter.c
+ *
* Copyright (c) 2011 Volkswagen Group Electronic Research
- * Copyright (c) 2021 SUSE LLC
+ * 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. Neither the name of Volkswagen nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * Alternatively, provided that this notice is retained in full, this
+ * software may be distributed under the terms of the GNU General
+ * Public License ("GPL") version 2, in which case the provisions of the
+ * GPL apply INSTEAD OF those given above.
+ *
+ * The provided data structures and external interfaces from this code
+ * are not restricted to be used by modules with a GPL compatible license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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 COPYRIGHT
+ * OWNER OR CONTRIBUTORS 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.
+ *
+ * Send feedback to <socketcan-users@lists.berlios.de>
+ *
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <net/if.h>
#include "config.h"
-#include "tst_test.h"
+#include "tst_res_flags.h"
#ifdef HAVE_LINUX_CAN_H
-#include "can_common.h"
+#include <linux/can.h>
+#include <linux/can/raw.h>
#define ID 0x123
#define TC 18 /* # of testcases */
@@ -18,9 +66,7 @@ const int rx_res[TC] = { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 };
const int rxbits_res[TC] = { 4369, 4369, 4369, 4369, 17, 4352, 17, 4352, 257,
257, 4112, 4112, 1, 256, 16, 4096, 1, 256 };
-static int s;
-
-static canid_t calc_id(int testcase)
+canid_t calc_id(int testcase)
{
canid_t id = ID;
@@ -32,7 +78,7 @@ static canid_t calc_id(int testcase)
return id;
}
-static canid_t calc_mask(int testcase)
+canid_t calc_mask(int testcase)
{
canid_t mask = CAN_SFF_MASK;
@@ -47,151 +93,174 @@ static canid_t calc_mask(int testcase)
return mask;
}
-static void setup(void)
+int main(int argc, char **argv)
{
+ fd_set rdfs;
+ struct timeval tv;
+ int s;
struct sockaddr_can addr;
- struct ifreq ifr;
+ struct can_filter rfilter;
+ struct can_frame frame;
+ int testcase;
+ int have_rx;
+ int rx;
+ int rxbits, rxbitval;
+ int ret;
int recv_own_msgs = 1;
+ struct ifreq ifr;
- can_setup_vcan();
-
- s = SAFE_SOCKET(PF_CAN, SOCK_RAW, CAN_RAW);
+ /* check command line options */
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <device>\n", argv[0]);
+ return TFAIL;
+ }
- strcpy(ifr.ifr_name, can_dev_name);
- SAFE_IOCTL(s, SIOCGIFINDEX, &ifr);
+ s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ if (s < 0) {
+ perror("socket");
+ return TFAIL;
+ }
+ strcpy(ifr.ifr_name, argv[1]);
+ if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
+ perror("SIOCGIFINDEX");
+ return TFAIL;
+ }
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
- SAFE_SETSOCKOPT(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS,
- &recv_own_msgs, sizeof(recv_own_msgs));
-
- SAFE_BIND(s, (struct sockaddr *)&addr, sizeof(addr));
-}
-
-static void cleanup(void)
-{
- if (s)
- SAFE_CLOSE(s);
-
- can_cleanup_vcan();
-}
-
-static void run(unsigned int n)
-{
- fd_set rdfs;
- struct timeval tv;
- struct can_frame frame;
- static struct can_filter rfilter;
- int testcase = n;
- int have_rx = 1;
- int rx = 0;
- int rxbits = 0, rxbitval;
-
- rfilter.can_id = calc_id(testcase);
- rfilter.can_mask = calc_mask(testcase);
- SAFE_SETSOCKOPT(s, SOL_CAN_RAW, CAN_RAW_FILTER,
- &rfilter, sizeof(rfilter));
-
- tst_res(TINFO, "testcase %2d filters : can_id = 0x%08X can_mask = "
- "0x%08X", testcase, rfilter.can_id, rfilter.can_mask);
+ setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS,
+ &recv_own_msgs, sizeof(recv_own_msgs));
- tst_res(TINFO, "testcase %2d sending patterns ... ", testcase);
-
- frame.can_dlc = 1;
- frame.data[0] = testcase;
-
- frame.can_id = ID;
- SAFE_WRITE(1, s, &frame, sizeof(frame));
+ if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ perror("bind");
+ return TFAIL;
+ }
- frame.can_id = (ID | CAN_RTR_FLAG);
- SAFE_WRITE(1, s, &frame, sizeof(frame));
+ printf("---\n");
- frame.can_id = (ID | CAN_EFF_FLAG);
- SAFE_WRITE(1, s, &frame, sizeof(frame));
+ for (testcase = 0; testcase < TC; testcase++) {
- frame.can_id = (ID | CAN_EFF_FLAG | CAN_RTR_FLAG);
- SAFE_WRITE(1, s, &frame, sizeof(frame));
+ rfilter.can_id = calc_id(testcase);
+ rfilter.can_mask = calc_mask(testcase);
+ setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER,
+ &rfilter, sizeof(rfilter));
- tst_res(TPASS, "testcase %2d Sent patterns", testcase);
+ printf("testcase %2d filters : can_id = 0x%08X can_mask = "
+ "0x%08X\n", testcase, rfilter.can_id, rfilter.can_mask);
- while (have_rx) {
+ printf("testcase %2d sending patterns ... ", testcase);
- have_rx = 0;
- FD_ZERO(&rdfs);
- FD_SET(s, &rdfs);
- tv.tv_sec = 0;
- tv.tv_usec = 50000; /* 50ms timeout */
+ frame.can_dlc = 1;
+ frame.data[0] = testcase;
- if (select(s + 1, &rdfs, NULL, NULL, &tv) < 0)
- tst_brk(TBROK | TERRNO, "select");
+ frame.can_id = ID;
+ if (write(s, &frame, sizeof(frame)) < 0) {
+ perror("write");
+ exit(1);
+ }
+ frame.can_id = (ID | CAN_RTR_FLAG);
+ if (write(s, &frame, sizeof(frame)) < 0) {
+ perror("write");
+ exit(1);
+ }
+ frame.can_id = (ID | CAN_EFF_FLAG);
+ if (write(s, &frame, sizeof(frame)) < 0) {
+ perror("write");
+ exit(1);
+ }
+ frame.can_id = (ID | CAN_EFF_FLAG | CAN_RTR_FLAG);
+ if (write(s, &frame, sizeof(frame)) < 0) {
+ perror("write");
+ exit(1);
+ }
- if (FD_ISSET(s, &rdfs)) {
- have_rx = 1;
- SAFE_READ(1, s, &frame, sizeof(struct can_frame));
+ printf("ok\n");
- if ((frame.can_id & CAN_SFF_MASK) != ID)
- tst_res(TFAIL, "received wrong can_id!");
+ have_rx = 1;
+ rx = 0;
+ rxbits = 0;
- if (frame.data[0] != testcase)
- tst_res(TFAIL, "received wrong testcase!");
+ while (have_rx) {
- /* test & calc rxbits */
- rxbitval = 1 << ((frame.can_id &
- (CAN_EFF_FLAG | CAN_RTR_FLAG |
- CAN_ERR_FLAG)) >> 28);
+ have_rx = 0;
+ FD_ZERO(&rdfs);
+ FD_SET(s, &rdfs);
+ tv.tv_sec = 0;
+ tv.tv_usec = 50000; /* 50ms timeout */
- /* only receive a rxbitval once */
- if ((rxbits & rxbitval) == rxbitval) {
- tst_res(TFAIL, "received rxbitval %d twice!",
- rxbitval);
+ ret = select(s + 1, &rdfs, NULL, NULL, &tv);
+ if (ret < 0) {
+ perror("select");
+ exit(1);
}
- rxbits |= rxbitval;
- rx++;
- tst_res(TINFO, "testcase %2d rx : can_id = 0x%08X rx = "
- "%d rxbits = %d", testcase,
- frame.can_id, rx, rxbits);
+ if (FD_ISSET(s, &rdfs)) {
+ have_rx = 1;
+ ret = read(s, &frame, sizeof(struct can_frame));
+ if (ret < 0) {
+ perror("read");
+ exit(1);
+ }
+ if ((frame.can_id & CAN_SFF_MASK) != ID) {
+ fprintf(stderr,
+ "received wrong can_id!\n");
+ exit(1);
+ }
+ if (frame.data[0] != testcase) {
+ fprintf(stderr,
+ "received wrong testcase!\n");
+ exit(1);
+ }
+
+ /* test & calc rxbits */
+ rxbitval = 1 << ((frame.can_id &
+ (CAN_EFF_FLAG | CAN_RTR_FLAG |
+ CAN_ERR_FLAG)) >> 28);
+
+ /* only receive a rxbitval once */
+ if ((rxbits & rxbitval) == rxbitval) {
+ fprintf(stderr,
+ "received rxbitval %d twice!\n",
+ rxbitval);
+ exit(1);
+ }
+ rxbits |= rxbitval;
+ rx++;
+
+ printf("testcase %2d rx : can_id = 0x%08X rx = "
+ "%d rxbits = %d\n", testcase,
+ frame.can_id, rx, rxbits);
+ }
}
+ /* rx timed out -> check the received results */
+ if (rx_res[testcase] != rx) {
+ fprintf(stderr,
+ "wrong rx value in testcase %d : %d (expected "
+ "%d)\n", testcase, rx, rx_res[testcase]);
+ exit(1);
+ }
+ if (rxbits_res[testcase] != rxbits) {
+ fprintf(stderr,
+ "wrong rxbits value in testcase %d : %d "
+ "(expected %d)\n", testcase, rxbits,
+ rxbits_res[testcase]);
+ exit(1);
+ }
+ printf("testcase %2d ok\n---\n", testcase);
}
- /* rx timed out -> check the received results */
- if (rx_res[testcase] != rx) {
- tst_brk(TBROK,
- "wrong rx value in testcase %d : %d (expected "
- "%d)", testcase, rx, rx_res[testcase]);
- }
- if (rxbits_res[testcase] != rxbits) {
- tst_brk(TBROK,
- "wrong rxbits value in testcase %d : %d "
- "(expected %d)", testcase, rxbits,
- rxbits_res[testcase]);
- }
- tst_res(TPASS, "testcase %2d ok", testcase);
-}
-static struct tst_test test = {
- .tcnt = TC,
- .options = (struct tst_option[]) {
- {"D:", &can_dev_name, "-D <device> CAN device name"},
- {}
- },
- .setup = setup,
- .cleanup = cleanup,
- .test = run,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_REQ, CAP_NET_RAW),
- TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
- {}
- },
- .needs_drivers = (const char *const[]) {
- "vcan",
- "can-raw",
- NULL
- }
-};
+ close(s);
+
+ return TPASS;
+}
#else
-TST_TEST_TCONF("The linux/can.h was missing upon compilation");
+int main(void)
+{
+ printf("The linux/can.h was missing upon compilation.\n");
+ return TCONF;
+}
#endif /* HAVE_LINUX_CAN_H */
diff --git a/testcases/network/can/filter-tests/can_rcv_own_msgs.c b/testcases/network/can/filter-tests/can_rcv_own_msgs.c
index dc29d195a..8ad51d298 100644
--- a/testcases/network/can/filter-tests/can_rcv_own_msgs.c
+++ b/testcases/network/can/filter-tests/can_rcv_own_msgs.c
@@ -1,31 +1,88 @@
-// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
/*
- * Copyright (c) 2011 Volkswagen Group Electronic Research
- * Copyright (c) 2021 SUSE LLC
+ * tst-rcv-own-msgs.c
+ *
+ * Copyright (c) 2010 Volkswagen Group Electronic Research
+ * 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. Neither the name of Volkswagen nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * Alternatively, provided that this notice is retained in full, this
+ * software may be distributed under the terms of the GNU General
+ * Public License ("GPL") version 2, in which case the provisions of the
+ * GPL apply INSTEAD OF those given above.
+ *
+ * The provided data structures and external interfaces from this code
+ * are not restricted to be used by modules with a GPL compatible license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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 COPYRIGHT
+ * OWNER OR CONTRIBUTORS 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.
+ *
+ * Send feedback to <socketcan-users@lists.berlios.de>
+ *
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <net/if.h>
#include "config.h"
-#include "tst_test.h"
+#include "tst_res_flags.h"
+#include "tst_minmax.h"
#ifdef HAVE_LINUX_CAN_H
-#include "can_common.h"
-#include "tst_minmax.h"
+#include <linux/can.h>
+#include <linux/can/raw.h>
-static int s, t;
+struct rxs {
+ int s;
+ int t;
+};
-static void test_sockets(canid_t can_id, int expect_rxs, int expect_rxt)
+struct rxs test_sockets(int s, int t, canid_t can_id)
{
fd_set rdfs;
struct timeval tv;
int m = MAX(s, t) + 1;
int have_rx = 1;
struct can_frame frame;
- int rxs = 0, rxt = 0;
+ struct rxs rx;
+ int ret;
frame.can_id = can_id;
frame.can_dlc = 0;
- SAFE_WRITE(1, s, &frame, sizeof(frame));
+ if (write(s, &frame, sizeof(frame)) < 0) {
+ perror("write");
+ exit(1);
+ }
+
+ rx.s = rx.t = 0;
while (have_rx) {
@@ -36,124 +93,164 @@ static void test_sockets(canid_t can_id, int expect_rxs, int expect_rxt)
tv.tv_usec = 50000; /* 50ms timeout */
have_rx = 0;
- if (select(m, &rdfs, NULL, NULL, &tv) < 0)
- tst_brk(TBROK | TERRNO, "select");
+ ret = select(m, &rdfs, NULL, NULL, &tv);
+ if (ret < 0) {
+ perror("select");
+ exit(1);
+ }
if (FD_ISSET(s, &rdfs)) {
have_rx = 1;
- SAFE_READ(1, s, &frame, sizeof(struct can_frame));
-
- if (frame.can_id != can_id)
- tst_res(TFAIL, "received wrong can_id!");
-
- rxs++;
+ ret = read(s, &frame, sizeof(struct can_frame));
+ if (ret < 0) {
+ perror("read");
+ exit(1);
+ }
+ if (frame.can_id != can_id) {
+ fprintf(stderr, "received wrong can_id!\n");
+ exit(1);
+ }
+ rx.s++;
}
if (FD_ISSET(t, &rdfs)) {
have_rx = 1;
- SAFE_READ(1, t, &frame, sizeof(struct can_frame));
-
- if (frame.can_id != can_id)
- tst_res(TFAIL, "received wrong can_id!");
-
- rxt++;
+ ret = read(t, &frame, sizeof(struct can_frame));
+ if (ret < 0) {
+ perror("read");
+ exit(1);
+ }
+ if (frame.can_id != can_id) {
+ fprintf(stderr, "received wrong can_id!\n");
+ exit(1);
+ }
+ rx.t++;
}
}
/* timeout */
- tst_res(rxs == expect_rxs && rxt == expect_rxt ? TPASS : TFAIL,
- "s received %d of %d, t received %d of %d",
- rxs, expect_rxs, rxt, expect_rxt);
+ return rx;
}
-static void setopts(int loopback, int recv_own_msgs)
+void setopts(int s, int loopback, int recv_own_msgs)
{
- SAFE_SETSOCKOPT(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &loopback,
- sizeof(loopback));
- SAFE_SETSOCKOPT(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, &recv_own_msgs,
- sizeof(recv_own_msgs));
+ setsockopt(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &loopback,
+ sizeof(loopback));
+ setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, &recv_own_msgs,
+ sizeof(recv_own_msgs));
- tst_res(TINFO, "set loopback = %d, recv_own_msgs = %d",
- loopback, recv_own_msgs);
+ printf("check loopback %d recv_own_msgs %d ... ", loopback,
+ recv_own_msgs);
}
-static void setup(void)
+int main(int argc, char **argv)
{
+ int s, t;
struct sockaddr_can addr;
struct ifreq ifr;
+ struct rxs rx;
- can_setup_vcan();
-
- s = SAFE_SOCKET(PF_CAN, SOCK_RAW, CAN_RAW);
- t = SAFE_SOCKET(PF_CAN, SOCK_RAW, CAN_RAW);
+ /* check command line options */
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <device>\n", argv[0]);
+ return TFAIL;
+ }
- strcpy(ifr.ifr_name, can_dev_name);
- SAFE_IOCTL(s, SIOCGIFINDEX, &ifr);
+ s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ if (s < 0) {
+ perror("socket");
+ return TFAIL;
+ }
+ t = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ if (t < 0) {
+ perror("socket");
+ return TFAIL;
+ }
+ strcpy(ifr.ifr_name, argv[1]);
+ if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
+ perror("SIOCGIFINDEX");
+ return TFAIL;
+ }
addr.can_ifindex = ifr.ifr_ifindex;
addr.can_family = AF_CAN;
- SAFE_BIND(s, (struct sockaddr *)&addr, sizeof(addr));
- SAFE_BIND(t, (struct sockaddr *)&addr, sizeof(addr));
-}
+ if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ perror("bind");
+ return TFAIL;
+ }
+ if (bind(t, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ perror("bind");
+ return TFAIL;
+ }
-static void cleanup(void)
-{
- if (s)
- SAFE_CLOSE(s);
- if (t)
- SAFE_CLOSE(t);
+ printf("Starting PF_CAN frame flow test.\n");
+ printf("checking socket default settings ... ");
+ rx = test_sockets(s, t, 0x340);
+ if (rx.s == 0 && rx.t == 1)
+ printf("ok.\n");
+ else {
+ printf("failure!\n");
+ return TFAIL;
+ }
- can_cleanup_vcan();
-}
+ /* check loopback 0 recv_own_msgs 0 */
+ setopts(s, 0, 0);
+ rx = test_sockets(s, t, 0x341);
+ if (rx.s == 0 && rx.t == 0)
+ printf("ok.\n");
+ else {
+ printf("failure!\n");
+ return TFAIL;
+ }
-static void run(void)
-{
- tst_res(TINFO, "Starting PF_CAN frame flow test.");
- tst_res(TINFO, "checking socket default settings");
- test_sockets(0x340, 0, 1);
+ /* check loopback 0 recv_own_msgs 1 */
+ setopts(s, 0, 1);
+ rx = test_sockets(s, t, 0x342);
+ if (rx.s == 0 && rx.t == 0)
+ printf("ok.\n");
+ else {
+ printf("failure!\n");
+ return TFAIL;
+ }
- setopts(0, 0);
- test_sockets(0x341, 0, 0);
+ /* check loopback 1 recv_own_msgs 0 */
+ setopts(s, 1, 0);
+ rx = test_sockets(s, t, 0x343);
+ if (rx.s == 0 && rx.t == 1)
+ printf("ok.\n");
+ else {
+ printf("failure!\n");
+ return TFAIL;
+ }
- setopts(0, 1);
- test_sockets(0x342, 0, 0);
+ /* check loopback 1 recv_own_msgs 1 */
+ setopts(s, 1, 1);
+ rx = test_sockets(s, t, 0x344);
+ if (rx.s == 1 && rx.t == 1)
+ printf("ok.\n");
+ else {
+ printf("failure!\n");
+ return TFAIL;
+ }
- setopts(1, 0);
- test_sockets(0x343, 0, 1);
+ printf("PF_CAN frame flow test was successful.\n");
- setopts(1, 1);
- test_sockets(0x344, 1, 1);
+ close(s);
+ close(t);
- /* Return to defaults for when -i is used */
- setopts(1, 0);
+ return TPASS;
}
-static struct tst_test test = {
- .options = (struct tst_option[]) {
- {"D:", &can_dev_name, "-D <device> CAN device name"},
- {}
- },
- .setup = setup,
- .cleanup = cleanup,
- .test_all = run,
- .caps = (struct tst_cap []) {
- TST_CAP(TST_CAP_REQ, CAP_NET_RAW),
- TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
- {}
- },
- .needs_drivers = (const char *const[]) {
- "vcan",
- "can-raw",
- NULL
- }
-};
-
#else
-TST_TEST_TCONF("The linux/can.h was missing upon compilation");
+int main(void)
+{
+ printf("The linux/can.h was missing upon compilation.\n");
+ return TCONF;
+}
#endif /* HAVE_LINUX_CAN_H */
diff --git a/testcases/network/can/filter-tests/can_run_tests.sh b/testcases/network/can/filter-tests/can_run_tests.sh
new file mode 100755
index 000000000..762d90eca
--- /dev/null
+++ b/testcases/network/can/filter-tests/can_run_tests.sh
@@ -0,0 +1,106 @@
+#!/bin/sh
+################################################################################
+## Copyright (c) Oliver Hartkopp <oliver.hartkopp@volkswagen.de>, 2011 ##
+## Copyright (c) International Business Machines Corp., 2009 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software Foundation, ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+################################################################################
+
+TCID="$1"
+TST_TOTAL=1
+export TST_COUNT
+
+. test.sh
+
+setup()
+{
+ tst_require_root
+
+ # load needed CAN networklayer modules
+ modprobe can
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_brkm TCONF "modprobe can failed: ret - $ret"
+ fi
+
+ modprobe can_raw
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_brkm TCONF "modprobe can_raw failed: ret - $ret"
+ fi
+
+ # ensure the vcan driver to perform the ECHO on driver level
+ modprobe -r vcan
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_brkm TCONF "modprobe -r vcan failed: ret - $ret"
+ fi
+
+ modprobe vcan echo=1
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_brkm TCONF "modprobe vcan echo=1 failed: ret - $ret"
+ fi
+
+ VCAN=vcan0
+
+ # create virtual CAN device
+ ip link add dev $VCAN type vcan
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_brkm TBROK \
+ "ip link add dev $VCAN type vcan failed: ret - $ret"
+ fi
+
+ ip link set dev $VCAN up
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_brkm TBROK "ip link set dev $VCAN up failed: ret - $ret"
+ fi
+
+ # check precondition for CAN frame flow test
+ HAS_ECHO=`ip link show $VCAN | grep -c ECHO`
+ if [ $HAS_ECHO -ne 1 ]; then
+ tst_brkm TBROK "ECHO is not 1"
+ fi
+}
+
+cleanup()
+{
+ ip link set dev $VCAN down
+ ip link del dev $VCAN
+ modprobe -r vcan
+ modprobe -r can_raw
+ modprobe -r can
+}
+
+if [ $# -ne 1 ]; then
+ tst_brkm TBROK "Usage: $0 [can_filter | can_rcv_own_msgs]"
+fi
+
+setup
+TST_CLEANUP=cleanup
+
+"$1" "$VCAN"
+ret=$?
+case "$ret" in
+0) tst_resm TPASS "Test $1 PASS";;
+1) tst_resm TFAIL "Test $1 FAIL";;
+32) tst_resm TCONF "$1 is not appropriate for configuration flag";;
+*) tst_resm TBROK "Invalid resm type $ret";;
+esac
+
+tst_exit
diff --git a/testcases/network/dccp/dccp01.sh b/testcases/network/dccp/dccp01.sh
index 4d8e6e0d4..d18ac6f18 100755
--- a/testcases/network/dccp/dccp01.sh
+++ b/testcases/network/dccp/dccp01.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2017-2018 Oracle and/or its affiliates. All Rights Reserved.
TST_CNT=3
TST_TESTFUNC="test"
@@ -9,6 +9,17 @@ TST_NEEDS_ROOT=1
. tst_net.sh
+compare()
+{
+ local per=$(( $res0 * 100 / $res1 - 100 ))
+
+ if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then
+ tst_res TFAIL "$1 performance $per %"
+ else
+ tst_res TPASS "$1 performance $per % in range -100 ... 100 %"
+ fi
+}
+
test1()
{
tst_res TINFO "run UDP"
@@ -20,14 +31,14 @@ test2()
tst_res TINFO "compare UDP/DCCP performance"
tst_netload -H $(tst_ipaddr rhost) -T dccp
res1="$(cat tst_netload.res)"
- tst_netload_compare $res0 $res1 -100 100
+ compare DCCP
}
test3()
{
tst_res TINFO "compare UDP/UDP-Lite performance"
tst_netload -H $(tst_ipaddr rhost) -T udp_lite
res1="$(cat tst_netload.res)"
- tst_netload_compare $res0 $res1 -100 100
+ compare UDP-Lite
}
tst_run
diff --git a/testcases/network/dhcp/dhcp_lib.sh b/testcases/network/dhcp/dhcp_lib.sh
index 730bdad87..634d6ab43 100755
--- a/testcases/network/dhcp/dhcp_lib.sh
+++ b/testcases/network/dhcp/dhcp_lib.sh
@@ -37,12 +37,6 @@ stop_dhcp()
dhcp_lib_setup()
{
- if [ $HAVE_SYSTEMCTL -eq 1 ] && \
- systemctl --no-pager -p Id show network.service | grep -q Id=wicked.service; then
- [ $TST_IPV6 ] && tst_brk TCONF "wicked not supported on IPv6"
- is_wicked=1
- fi
-
[ -z "$log" ] && log="$PWD/$(basename $0 '.sh').log"
if [ $TST_IPV6 ]; then
@@ -135,7 +129,8 @@ test01()
tst_brk TBROK "Failed to start $dhcp_name"
fi
- if [ "$is_wicked" ]; then
+ if [ $HAVE_SYSTEMCTL -eq 1 ] && \
+ systemctl --no-pager -p Id show network.service | grep -q Id=wicked.service; then
tst_res TINFO "wicked is running, don't start dhclient"
if [ ! -f "$wicked_cfg" ]; then
cat <<EOF > $wicked_cfg
diff --git a/testcases/network/dhcp/dnsmasq_tests.sh b/testcases/network/dhcp/dnsmasq_tests.sh
index 855a74263..f80ce1e0b 100755
--- a/testcases/network/dhcp/dnsmasq_tests.sh
+++ b/testcases/network/dhcp/dnsmasq_tests.sh
@@ -12,7 +12,7 @@ dhcp_name="dnsmasq"
log="/var/log/dnsmasq.tst.log"
lease_dir="/var/lib/misc"
-tst_selinux_enforced && lease_dir="/var/lib/dnsmasq"
+tst_selinux_enabled && lease_dir="/var/lib/dnsmasq"
lease_file="$lease_dir/dnsmasq.tst.leases"
common_opt="--no-hosts --no-resolv --dhcp-authoritative \
diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
index 1527445d4..41c515696 100755
--- a/testcases/network/iproute/ip_tests.sh
+++ b/testcases/network/iproute/ip_tests.sh
@@ -13,7 +13,6 @@ TST_CLEANUP="cleanup"
TST_NEEDS_TMPDIR=1
TST_NEEDS_ROOT=1
TST_NEEDS_CMDS="cat awk diff"
-TST_NEEDS_DRIVERS="dummy"
. tst_net.sh
@@ -26,10 +25,10 @@ init()
iface=ltp_dummy
lsmod | grep -q dummy || rm_dummy=1
- ROD ip link add $iface type dummy
+ ROD ip li add $iface type dummy
ip4_addr=${IPV4_NET16_UNUSED}.6.6
- ROD ip addr add ${ip4_addr}/24 dev $iface
+ ROD ip a add ${ip4_addr}/24 dev $iface
cat > tst_ip02.exp <<-EOF
1:
@@ -47,12 +46,12 @@ init()
cleanup()
{
- [ -n "$iface" -a -d /sys/class/net/$iface ] && ip link del $iface
+ [ -n "$iface" -a -d /sys/class/net/$iface ] && ip li del $iface
[ "$rm_dummy" ] && modprobe -r dummy
# test #5
- [ "$ip4_addr" ] && ip route show | grep -q $ip4_addr && ip route del $ip4_addr
+ ip route show | grep $ip4_addr && ip route del $ip4_addr
}
test1()
diff --git a/testcases/network/lib6/asapi_03.c b/testcases/network/lib6/asapi_03.c
index 2124ba7d9..c6e2c8e34 100644
--- a/testcases/network/lib6/asapi_03.c
+++ b/testcases/network/lib6/asapi_03.c
@@ -269,7 +269,7 @@ static void so_test(struct soent *psoe)
TEST(setsockopt(sr, SOL_IPV6, psoe->so_opt, &psoe->so_setval,
psoe->so_valsize));
if (TEST_RETURN != 0) {
- tst_resm(TFAIL | TTERRNO, "%s set-get: setsockopt",
+ tst_resm(TFAIL | TERRNO, "%s set-get: setsockopt",
psoe->so_tname);
return;
}
@@ -277,7 +277,7 @@ static void so_test(struct soent *psoe)
valsize = psoe->so_valsize;
TEST(getsockopt(sr, SOL_IPV6, psoe->so_opt, &sobuf, &valsize));
if (TEST_RETURN != 0) {
- tst_brkm(TBROK | TTERRNO, NULL, "%s set-get: getsockopt",
+ tst_brkm(TBROK | TERRNO, NULL, "%s set-get: getsockopt",
psoe->so_tname);
} else if (memcmp(&psoe->so_setval, &sobuf, psoe->so_valsize)) {
tst_resm(TFAIL, "%s set-get optval != setval", psoe->so_tname);
diff --git a/testcases/network/mpls/mpls02.sh b/testcases/network/mpls/mpls02.sh
index 2fd3ec5bf..c263f8aa8 100755
--- a/testcases/network/mpls/mpls02.sh
+++ b/testcases/network/mpls/mpls02.sh
@@ -43,7 +43,7 @@ do_test()
local max_size=$TST_NET_MAX_PKT
if [ "$type" = "icmp" ]; then
- tst_ping -I $ip_loc -H $ip_rmt -s "10 100 1000 2000 $max_size"
+ tst_ping $ip_loc $ip_rmt 10 100 1000 2000 $max_size
else
tst_netload -S $ip_loc -H $ip_rmt -T $type -n 10 -N 10
tst_netload -S $ip_loc -H $ip_rmt -T $type -A $max_size
diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh
index 30e069581..8ebedba0f 100755
--- a/testcases/network/mpls/mpls_lib.sh
+++ b/testcases/network/mpls/mpls_lib.sh
@@ -87,8 +87,8 @@ mpls_virt_test()
local max_size=$TST_NET_MAX_PKT
if [ "$type" = "icmp" ]; then
- tst_ping -I $ip_virt_local -H $ip_virt_remote -s "10 100 1000 2000 $max_size"
- tst_ping -I $ip6_virt_local -H $ip6_virt_remote -s "10 100 1000 2000 $max_size"
+ tst_ping $ip_virt_local $ip_virt_remote 10 100 1000 2000 $max_size
+ tst_ping $ip6_virt_local $ip6_virt_remote 10 100 1000 2000 $max_size
else
tst_netload -S $ip_virt_local -H $ip_virt_remote -T $type -n 10 -N 10
tst_netload -S $ip6_virt_local -H $ip6_virt_remote -T $type -n 10 -N 10
diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c
index c46bc86c3..76d2fdb04 100644
--- a/testcases/network/netstress/netstress.c
+++ b/testcases/network/netstress/netstress.c
@@ -29,14 +29,6 @@
#include "tst_safe_stdio.h"
#include "tst_safe_pthread.h"
#include "tst_test.h"
-#include "tst_safe_net.h"
-
-#if !defined(HAVE_RAND_R)
-static int rand_r(LTP_ATTRIBUTE_UNUSED unsigned int *seed)
-{
- return rand();
-}
-#endif
static const int max_msg_len = (1 << 16) - 1;
static const int min_msg_len = 5;
@@ -69,7 +61,6 @@ static const int end_byte = 0x0a;
static int init_cln_msg_len = 32;
static int init_srv_msg_len = 128;
static int max_rand_msg_len;
-static int init_seed;
/*
* The number of requests from client after
@@ -352,11 +343,10 @@ union net_size_field {
uint16_t value;
};
-static void make_client_request(char client_msg[], int *cln_len, int *srv_len,
- unsigned int *seed)
+static void make_client_request(char client_msg[], int *cln_len, int *srv_len)
{
if (max_rand_msg_len)
- *cln_len = *srv_len = min_msg_len + rand_r(seed) % max_rand_msg_len;
+ *cln_len = *srv_len = min_msg_len + rand() % max_rand_msg_len;
memset(client_msg, client_byte, *cln_len);
client_msg[0] = start_byte;
@@ -371,7 +361,7 @@ static void make_client_request(char client_msg[], int *cln_len, int *srv_len,
client_msg[*cln_len - 1] = end_byte;
}
-void *client_fn(void *id)
+void *client_fn(LTP_ATTRIBUTE_UNUSED void *arg)
{
int cln_len = init_cln_msg_len,
srv_len = init_srv_msg_len;
@@ -380,14 +370,13 @@ void *client_fn(void *id)
char client_msg[max_msg_len];
int i = 0;
intptr_t err = 0;
- unsigned int seed = init_seed ^ (intptr_t)id;
inf.raddr_len = sizeof(inf.raddr);
inf.etime_cnt = 0;
inf.timeout = wait_timeout;
inf.pmtu_err_cnt = 0;
- make_client_request(client_msg, &cln_len, &srv_len, &seed);
+ make_client_request(client_msg, &cln_len, &srv_len);
/* connect & send requests */
inf.fd = client_connect_send(client_msg, cln_len);
@@ -417,7 +406,7 @@ void *client_fn(void *id)
}
if (max_rand_msg_len)
- make_client_request(client_msg, &cln_len, &srv_len, &seed);
+ make_client_request(client_msg, &cln_len, &srv_len);
SAFE_SEND(1, inf.fd, client_msg, cln_len, send_flags);
@@ -452,6 +441,19 @@ static int parse_client_request(const char *msg)
static struct timespec tv_client_start;
static struct timespec tv_client_end;
+static void setup_addrinfo(const char *src_addr, const char *port,
+ const struct addrinfo *hints,
+ struct addrinfo **addr_info)
+{
+ int err = getaddrinfo(src_addr, port, hints, addr_info);
+
+ if (err)
+ tst_brk(TBROK, "getaddrinfo failed, %s", gai_strerror(err));
+
+ if (!*addr_info)
+ tst_brk(TBROK, "failed to get the address");
+}
+
static void client_init(void)
{
if (clients_num >= MAX_THREADS) {
@@ -469,8 +471,8 @@ static void client_init(void)
hints.ai_protocol = 0;
if (source_addr)
- SAFE_GETADDRINFO(source_addr, NULL, &hints, &local_addrinfo);
- SAFE_GETADDRINFO(server_addr, tcp_port, &hints, &remote_addrinfo);
+ setup_addrinfo(source_addr, NULL, &hints, &local_addrinfo);
+ setup_addrinfo(server_addr, tcp_port, &hints, &remote_addrinfo);
tst_res(TINFO, "Running the test over IPv%s",
(remote_addrinfo->ai_family == AF_INET6) ? "6" : "4");
@@ -478,9 +480,9 @@ static void client_init(void)
family = remote_addrinfo->ai_family;
clock_gettime(CLOCK_MONOTONIC_RAW, &tv_client_start);
- intptr_t i;
+ int i;
for (i = 0; i < clients_num; ++i)
- SAFE_PTHREAD_CREATE(&thread_ids[i], &attr, client_fn, (void *)i);
+ SAFE_PTHREAD_CREATE(&thread_ids[i], 0, client_fn, NULL);
}
static void client_run(void)
@@ -506,7 +508,7 @@ static void client_run(void)
int msg_len = min_msg_len;
max_rand_msg_len = 0;
- make_client_request(client_msg, &msg_len, &msg_len, NULL);
+ make_client_request(client_msg, &msg_len, &msg_len);
/* ask server to terminate */
client_msg[0] = start_fin_byte;
int cfd = client_connect_send(client_msg, msg_len);
@@ -665,7 +667,7 @@ static void server_init(void)
if (source_addr && !strchr(source_addr, ':'))
SAFE_ASPRINTF(&src_addr, "::ffff:%s", source_addr);
- SAFE_GETADDRINFO(src_addr ? src_addr : source_addr, tcp_port,
+ setup_addrinfo(src_addr ? src_addr : source_addr, tcp_port,
&hints, &local_addrinfo);
free(src_addr);
@@ -747,6 +749,8 @@ static void server_run(void)
struct sockaddr_in6 addr6;
socklen_t addr_size = sizeof(addr6);
+ pthread_attr_init(&attr);
+
/*
* detaching threads allow to reclaim thread's resources
* once a thread finishes its work.
@@ -869,9 +873,10 @@ static void setup(void)
if (max_rand_msg_len) {
max_rand_msg_len -= min_msg_len;
- init_seed = max_rand_msg_len ^ client_max_requests;
- srand(init_seed); /* in case rand_r() is missing */
- tst_res(TINFO, "rand start seed 0x%x", init_seed);
+ unsigned int seed = max_rand_msg_len ^ client_max_requests;
+
+ srand(seed);
+ tst_res(TINFO, "srand() seed 0x%x", seed);
}
/* if client_num is not set, use num of processors */
@@ -962,7 +967,7 @@ static void setup(void)
/* dccp* modules can be blacklisted, load them manually */
const char * const argv[] = {"modprobe", "dccp_ipv6", NULL};
- if (tst_cmd(argv, NULL, NULL, TST_CMD_PASS_RETVAL))
+ if (tst_run_cmd(argv, NULL, NULL, 1))
tst_brk(TCONF, "Failed to load dccp_ipv6 module");
tst_res(TINFO, "DCCP %s", (client_mode) ? "client" : "server");
@@ -978,12 +983,6 @@ static void setup(void)
break;
}
- if ((errno = pthread_attr_init(&attr)))
- tst_brk(TBROK | TERRNO, "pthread_attr_init failed");
-
- if ((errno = pthread_attr_setstacksize(&attr, 256*1024)))
- tst_brk(TBROK | TERRNO, "pthread_attr_setstacksize(256*1024) failed");
-
net.init();
}
@@ -992,36 +991,40 @@ static void do_test(void)
net.run();
}
+static struct tst_option options[] = {
+ {"f", &fastopen_api, "-f Use TFO API, default is old API"},
+ {"F", &fastopen_sapi,
+ "-F TCP_FASTOPEN_CONNECT socket option and standard API"},
+ {"t:", &targ, "-t x Set tcp_fastopen value"},
+
+ {"S:", &source_addr, "-S x Source address to bind"},
+ {"g:", &tcp_port, "-g x x - server port"},
+ {"b:", &barg, "-b x x - low latency busy poll timeout"},
+ {"T:", &type, "-T x tcp (default), udp, udp_lite, dccp, sctp"},
+ {"z", &zcopy, "-z enable SO_ZEROCOPY"},
+ {"P:", &reuse_port, "-P enable SO_REUSEPORT"},
+ {"D:", &dev, "-D x bind to device x\n"},
+
+ {"H:", &server_addr, "Client:\n-H x Server name or IP address"},
+ {"l", &client_mode, "-l Become client, default is server"},
+ {"a:", &aarg, "-a x Number of clients running in parallel"},
+ {"r:", &rarg, "-r x Number of client requests"},
+ {"n:", &narg, "-n x Client message size"},
+ {"N:", &Narg, "-N x Server message size"},
+ {"m:", &Targ, "-m x Receive timeout in milliseconds (not used by UDP/DCCP client)"},
+ {"d:", &rpath, "-d x x is a path to file where result is saved"},
+ {"A:", &Aarg, "-A x x max payload length (generated randomly)\n"},
+
+ {"R:", &Rarg, "Server:\n-R x x requests after which conn.closed"},
+ {"q:", &qarg, "-q x x - TFO queue"},
+ {"B:", &server_bg, "-B x run in background, x - process directory"},
+ {NULL, NULL, NULL}
+};
+
static struct tst_test test = {
.test_all = do_test,
.forks_child = 1,
.setup = setup,
.cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"f", &fastopen_api, "-f Use TFO API, default is old API"},
- {"F", &fastopen_sapi, "-F TCP_FASTOPEN_CONNECT socket option and standard API"},
- {"t:", &targ, "-t x Set tcp_fastopen value"},
- {"S:", &source_addr, "-S x Source address to bind"},
- {"g:", &tcp_port, "-g x x - server port"},
- {"b:", &barg, "-b x x - low latency busy poll timeout"},
- {"T:", &type, "-T x tcp (default), udp, udp_lite, dccp, sctp"},
- {"z", &zcopy, "-z enable SO_ZEROCOPY"},
- {"P:", &reuse_port, "-P enable SO_REUSEPORT"},
- {"D:", &dev, "-D x bind to device x\n"},
-
- {"H:", &server_addr, "Client:\n-H x Server name or IP address"},
- {"l", &client_mode, "-l Become client, default is server"},
- {"a:", &aarg, "-a x Number of clients running in parallel"},
- {"r:", &rarg, "-r x Number of client requests"},
- {"n:", &narg, "-n x Client message size"},
- {"N:", &Narg, "-N x Server message size"},
- {"m:", &Targ, "-m x Receive timeout in milliseconds (not used by UDP/DCCP client)"},
- {"d:", &rpath, "-d x x is a path to file where result is saved"},
- {"A:", &Aarg, "-A x x max payload length (generated randomly)\n"},
-
- {"R:", &Rarg, "Server:\n-R x x requests after which conn.closed"},
- {"q:", &qarg, "-q x x - TFO queue"},
- {"B:", &server_bg, "-B x run in background, x - process directory"},
- {}
- },
+ .options = options
};
diff --git a/testcases/network/nfs/nfs_stress/nfs05_make_tree.c b/testcases/network/nfs/nfs_stress/nfs05_make_tree.c
index 23c520d9d..25809e1a3 100644
--- a/testcases/network/nfs/nfs_stress/nfs05_make_tree.c
+++ b/testcases/network/nfs/nfs_stress/nfs05_make_tree.c
@@ -82,7 +82,7 @@ static void run_targets(const char *dirname, char *cfile, pid_t tid)
snprintf(cfile, PATH_MAX, "%s%s/%d.%d.%d",
dirname, subdir, tid, i, k);
- tst_cmd(cmd_run, output_file, NULL, 0);
+ tst_run_cmd(cmd_run, output_file, NULL, 0);
fd = SAFE_OPEN(output_file, O_RDONLY);
SAFE_READ(1, fd, buf, 11);
@@ -104,7 +104,7 @@ static void *thread_fn(LTP_ATTRIBUTE_UNUSED void *args)
"\treturn 0;\n}\n";
const char make_buf_n[] = "CFLAGS := -O -w -g\n"
- "SRCS=$(sort $(wildcard *.c))\n"
+ "SRCS=$(wildcard *.c)\n"
"TARGETS=$(SRCS:.c=)\n"
"all: $(TARGETS)\n"
"$(TARGETS): %: %.c\n"
@@ -114,7 +114,7 @@ static void *thread_fn(LTP_ATTRIBUTE_UNUSED void *args)
const char make_buf[] = "CFLAGS := -O -w -g\n"
"SUBDIR = dir\n"
- "SRCS=$(sort $(wildcard *.c))\n"
+ "SRCS=$(wildcard *.c)\n"
"TARGETS=$(SRCS:.c=)\n"
"all: $(SUBDIR) $(TARGETS)\n"
"$(TARGETS): %: %.c\n"
@@ -179,11 +179,11 @@ static void *thread_fn(LTP_ATTRIBUTE_UNUSED void *args)
const char *const cmd_make_clean[] = {
"make", "-C", dirname, "-s", "clean", NULL};
- tst_cmd(cmd_make, NULL, NULL, 0);
+ tst_run_cmd(cmd_make, NULL, NULL, 0);
run_targets(dirname, cfile, tid);
- tst_cmd(cmd_make_clean, NULL, NULL, 0);
+ tst_run_cmd(cmd_make_clean, NULL, NULL, 0);
free(dirname);
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 1bd057717..5a2760a7d 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -27,15 +27,10 @@ TST_PARSE_ARGS=nfs_parse_args
TST_USAGE=nfs_usage
TST_NEEDS_TMPDIR=1
TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs"
+TST_NEEDS_CMDS="${TST_NEEDS_CMDS:-mount exportfs}"
TST_SETUP="${TST_SETUP:-nfs_setup}"
TST_CLEANUP="${TST_CLEANUP:-nfs_cleanup}"
-# When set and test is using netns ($TST_USE_NETNS set) NFS traffic will go
-# through lo interface instead of ltp_ns_veth* netns interfaces (useful for
-# debugging whether test failures are related to veth/netns).
-LTP_NFS_NETNS_USE_LO=${LTP_NFS_NETNS_USE_LO:-}
-
. tst_net.sh
get_socket_type()
@@ -51,19 +46,17 @@ get_socket_type()
done
}
-nfs_server_udp_enabled()
-{
- local config f
-
- tst_rhost_run -c "[ -f /etc/nfs.conf ]" || return 0
- config=$(tst_rhost_run -c 'for f in $(grep ^include.*= '/etc/nfs.conf' | cut -d = -f2); do [ -f $f ] && printf "$f "; done')
-
- tst_rhost_run -c "grep -q \"^[# ]*udp *= *y\" /etc/nfs.conf $config"
-}
-
nfs_setup_server()
{
- local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
+ local export_cmd="exportfs -i -o no_root_squash,rw *:$remote_dir"
+
+ if [ -n "$LTP_NETNS" ]; then
+ if [ ! -d $remote_dir ]; then
+ mkdir -p $remote_dir
+ ROD $export_cmd
+ fi
+ return
+ fi
if ! tst_rhost_run -c "test -d $remote_dir"; then
tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd"
@@ -86,18 +79,12 @@ nfs_mount()
local mnt_cmd="mount -t nfs $opts $mount_dir $local_dir"
tst_res TINFO "Mounting NFS: $mnt_cmd"
- if [ -n "$LTP_NETNS" ] && [ -z "$LTP_NFS_NETNS_USE_LO" ]; then
- tst_rhost_run -c "$mnt_cmd"
- else
- $mnt_cmd > /dev/null
+ if [ -n "$LTP_NETNS" ]; then
+ tst_rhost_run -s -c "$mnt_cmd"
+ return
fi
- if [ $? -ne 0 ]; then
- if [ "$type" = "udp" -o "$type" = "udp6" ] && tst_kvcmp -ge 5.6; then
- tst_brk TCONF "UDP support disabled with the kernel config NFS_DISABLE_UDP_SUPPORT?"
- fi
- tst_brk TBROK "mount command failed"
- fi
+ ROD $mnt_cmd
}
nfs_setup()
@@ -119,10 +106,6 @@ nfs_setup()
type=$(get_socket_type $n)
tst_res TINFO "setup NFSv$i, socket type $type"
- if [ "$type" = "udp" -o "$type" = "udp6" ] && ! nfs_server_udp_enabled; then
- tst_brk TCONF "UDP support disabled on NFS server"
- fi
-
local_dir="$TST_TMPDIR/$i/$n"
remote_dir="$TST_TMPDIR/$i/$type"
mkdir -p $local_dir
diff --git a/testcases/network/nfs/nfslock01/Makefile b/testcases/network/nfs/nfslock01/Makefile
index 978749a81..a07a99ea9 100644
--- a/testcases/network/nfs/nfslock01/Makefile
+++ b/testcases/network/nfs/nfslock01/Makefile
@@ -12,4 +12,4 @@ INSTALL_TARGETS := nfslock01
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: nfs_flock_func.o
+$(MAKE_TARGETS): %: %.o nfs_flock_func.o
diff --git a/testcases/network/nfsv4/acl/acl1.c b/testcases/network/nfsv4/acl/acl1.c
index ad778cd33..aae9484e5 100644
--- a/testcases/network/nfsv4/acl/acl1.c
+++ b/testcases/network/nfsv4/acl/acl1.c
@@ -302,7 +302,7 @@ void test_acl_default(char *dir, acl_t acl)
char *cmd = malloc(256);
strcpy(cmd, "chmod 7777 ");
- printf(cmd, NULL);
+ printf(cmd);
strcat(cmd, dir);
system(cmd);
acl2 = acl_get_file(path, ACL_TYPE_ACCESS);
diff --git a/testcases/network/nfsv4/locks/Makefile b/testcases/network/nfsv4/locks/Makefile
index 05941c892..5812dea3a 100644
--- a/testcases/network/nfsv4/locks/Makefile
+++ b/testcases/network/nfsv4/locks/Makefile
@@ -28,6 +28,6 @@ MAKE_TARGETS := locktests
LDLIBS += -lpthread
-$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(sort $(wildcard $(abs_srcdir)/*.c)))
+$(MAKE_TARGETS): $(patsubst $(abs_srcdir)/%.c,%.o,$(wildcard $(abs_srcdir)/*.c))
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfsv4/locks/locktests.c b/testcases/network/nfsv4/locks/locktests.c
index d2c766bc1..961354e42 100644
--- a/testcases/network/nfsv4/locks/locktests.c
+++ b/testcases/network/nfsv4/locks/locktests.c
@@ -563,7 +563,7 @@ void masterClient(void)
/* Receive the END(ish) instruction */
/* Repeat it to the slaves */
- printf("Exiting...\n");
+ printf("Exitting...\n");
serverSendLocal();
/* Ok, we can quit */
diff --git a/testcases/network/rpc/basic_tests/Makefile b/testcases/network/rpc/basic_tests/Makefile
index 7862e41e5..66e9d5675 100644
--- a/testcases/network/rpc/basic_tests/Makefile
+++ b/testcases/network/rpc/basic_tests/Makefile
@@ -21,7 +21,6 @@
#
top_srcdir ?= ../../../..
-INSTALL_TARGETS := rpc_lib.sh
include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.c b/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.c
index 5248e4e91..7a292dece 100644
--- a/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.c
+++ b/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.c
@@ -16,7 +16,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "rpc.h"
+#include "lapi/rpc.h"
#include "librpc01.h"
bool_t xdr_receive_data(XDR *xdrs, struct data **buffer)
diff --git a/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.h b/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.h
index 3bd0e864b..76bc3d882 100644
--- a/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.h
+++ b/testcases/network/rpc/basic_tests/rpc01/lib/librpc01.h
@@ -19,7 +19,7 @@
#ifndef __LIBRPC_H__
#define __LIBRPC_H__
-#include "rpc.h"
+#include "lapi/rpc.h"
struct data {
long address;
diff --git a/testcases/network/rpc/basic_tests/rpc01/rpc01.sh b/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
index 9ca5daae6..7cc69f0fa 100755
--- a/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
+++ b/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
@@ -1,16 +1,29 @@
#!/bin/sh
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines Corp., 2000
-
-TST_TESTFUNC=do_test
-TST_SETUP=do_setup
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+TCID="rpc01"
+TST_TOTAL=6
TST_CLEANUP=do_cleanup
-TST_NEEDS_CMDS="pkill rpcinfo"
-. rpc_lib.sh
-NUMLOOPS=${NUMLOOPS:-3}
-DATAFILES="${DATAFILES:-file.1 file.2}"
+TST_USE_LEGACY_API=1
+. tst_net.sh
+
+NUMLOOPS=${NUMLOOPS:=3}
+DATAFILES=${DATAFILES:="file.1 file.2"}
do_cleanup()
{
@@ -19,30 +32,32 @@ do_cleanup()
do_setup()
{
- check_portmap_rpcbind
+ tst_resm TINFO "start rpc_server"
+ rpc_server
- tst_res TINFO "start rpc_server"
- ROD rpc_server
-
- tst_res TINFO "wait for server to be registered"
+ tst_resm TINFO "wait for server to be registered"
for i in $(seq 1 30); do
rpcinfo -T udp $(tst_ipaddr) 2000333 10 >/dev/null 2>&1 && break
- [ "$i" -eq 30 ] && tst_brk TBROK "server not registered"
+ [ "$i" -eq 30 ] && tst_brkm TBROK "server not registered"
tst_sleep 100ms
done
}
do_test()
{
- tst_res TINFO "starting client process"
+ local thost="$(tst_ipaddr)"
+ tst_resm TINFO "starting client process"
local cnt=1
while [ $cnt -le $NUMLOOPS ]; do
for f in $DATAFILES; do
- EXPECT_RHOST_PASS rpc1 -s $(tst_ipaddr) -f $TST_DATAROOT/$f
+ EXPECT_RHOST_PASS rpc1 -s $thost -f $LTP_DATAROOT/$f
done
cnt=$(($cnt + 1))
done
}
-tst_run
+do_setup
+do_test
+
+tst_exit
diff --git a/testcases/network/rpc/basic_tests/rpc01/rpc_server.c b/testcases/network/rpc/basic_tests/rpc01/rpc_server.c
index 383c3d132..21a45ffeb 100644
--- a/testcases/network/rpc/basic_tests/rpc01/rpc_server.c
+++ b/testcases/network/rpc/basic_tests/rpc01/rpc_server.c
@@ -6,7 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
#include "librpc01.h"
int debug = 0;
diff --git a/testcases/network/rpc/basic_tests/rpc_lib.sh b/testcases/network/rpc/basic_tests/rpc_lib.sh
deleted file mode 100644
index c7c868709..000000000
--- a/testcases/network/rpc/basic_tests/rpc_lib.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-
-. tst_net.sh
-
-check_portmap_rpcbind()
-{
- if pgrep portmap > /dev/null; then
- PORTMAPPER="portmap"
- else
- pgrep rpcbind > /dev/null && PORTMAPPER="rpcbind" || \
- tst_brk TCONF "portmap or rpcbind is not running"
- fi
- tst_res TINFO "using $PORTMAPPER"
-}
diff --git a/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh b/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
index 811f79ef7..afdfdb351 100755
--- a/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
+++ b/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
@@ -1,32 +1,54 @@
#!/bin/sh
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines Corp., 2000
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-TST_TESTFUNC=do_test
-TST_SETUP=do_setup
-TST_NEEDS_TMPDIR=1
-TST_NEEDS_CMDS="rpcinfo wc"
-. rpc_lib.sh
+TCID="rpcinfo01"
+TST_TOTAL=16
+TST_CLEANUP=tst_rmdir
+
+TST_USE_LEGACY_API=1
+. tst_net.sh
do_setup()
{
- check_portmap_rpcbind
+ tst_resm TINFO "Checking for portmap or rpcbind"
+
+ if pgrep portmap > /dev/null; then
+ PORTMAPPER="portmap"
+ else
+ pgrep rpcbind > /dev/null && PORTMAPPER="rpcbind" || \
+ tst_brkm TCONF "portmap or rpcbind is not running"
+ fi
+
+ tst_tmpdir
# Create file with 1 tcp and 1 udp line. Use for variable assignments.
rpcinfo -p $(tst_ipaddr) | grep tcp | sed -n 2p > rpc_out
rpcinfo -p $(tst_ipaddr) | grep udp | sed -n 2p >> rpc_out
- wc -l rpc_out | grep -q "2" || \
- tst_brk TBROK "Not enough programs registered on $(tst_ipaddr)"
+ wc -l rpc_out | grep "2" > /dev/null || \
+ tst_brkm TBROK "Not enough programs registered on $(tst_ipaddr)"
# Using "rpc_out" file created above, assign variables for rpcinfo opts
- TPNUM=$(grep tcp rpc_out | awk '{print $1}')
- TVNUM=$(grep tcp rpc_out | awk '{print $2}')
- TCPNAME=$(grep tcp rpc_out | awk '{print $5}')
- UPNUM=$(grep udp rpc_out | awk '{print $1}')
- UVNUM=$(grep udp rpc_out | awk '{print $2}')
- UDPNAME=$(grep udp rpc_out | awk '{print $5}')
+ TPNUM=`grep tcp rpc_out | awk '{print $1}'`
+ TVNUM=`grep tcp rpc_out | awk '{print $2}'`
+ TCPNAME=`grep tcp rpc_out | awk '{print $5}'`
+ UPNUM=`grep udp rpc_out | awk '{print $1}'`
+ UVNUM=`grep udp rpc_out | awk '{print $2}'`
+ UDPNAME=`grep udp rpc_out | awk '{print $5}'`
}
do_test()
@@ -43,7 +65,7 @@ do_test()
EXPECT_RHOST_PASS rpcinfo -u $thost portmapper
EXPECT_RHOST_PASS rpcinfo -u $thost portmapper 2
- tst_res TINFO "Test rpcinfo with missing or bad options"
+ tst_resm TINFO "Test rpcinfo with missing or bad options"
EXPECT_RHOST_FAIL rpcinfo -p bogushost
EXPECT_RHOST_FAIL rpcinfo -bogusflag
EXPECT_RHOST_FAIL rpcinfo -t $thost
@@ -53,4 +75,7 @@ do_test()
EXPECT_RHOST_FAIL rpcinfo -u $thost 100000 5
}
-tst_run
+do_setup
+do_test
+
+tst_exit
diff --git a/testcases/network/rpc/rpc-tirpc/.gitignore b/testcases/network/rpc/rpc-tirpc/.gitignore
index 6954e00d4..15b7c4d9c 100644
--- a/testcases/network/rpc/rpc-tirpc/.gitignore
+++ b/testcases/network/rpc/rpc-tirpc/.gitignore
@@ -7,6 +7,10 @@
/tests_pack/tirpc_svc_3/tirpc_svc_3
/tests_pack/tirpc_svc_4/tirpc_svc_4
/tests_pack/tirpc_svc_5/tirpc_svc_5
+/tests_pack/tirpc_svc_6/tirpc_svc_6
+/tests_pack/tirpc_svc_7/tirpc_svc_7
+/tests_pack/tirpc_svc_8/tirpc_svc_8
+/tests_pack/tirpc_svc_9/tirpc_svc_9
/tests_pack/tirpc_svc_11/tirpc_svc_11
/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control
/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_control/rpc_clnt_control_dataint
diff --git a/testcases/network/rpc/rpc-tirpc/rpc_test.sh b/testcases/network/rpc/rpc-tirpc/rpc_test.sh
index ffb58769d..a4f9a5308 100755
--- a/testcases/network/rpc/rpc-tirpc/rpc_test.sh
+++ b/testcases/network/rpc/rpc-tirpc/rpc_test.sh
@@ -1,94 +1,100 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
#!/bin/sh
+#
# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2017-2020 Petr Vorel <pvorel@suse.cz>
-
-SERVER=
-CLIENT=
-CLIENT_EXTRA_OPTS=
-CLEANER=
+# Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# This is a wrapper script to execute tests from the RPC/TI-RPC tests
+# suite (http://nfsv4.bullopensource.org/doc/rpc_testsuite.php) in LTP.
+
+SERVER=""
+CLIENT=""
+CLIENT_EXTRA_OPTS=""
+CLEANER=""
# Program number to register the services to rpcbind
PROGNUMNOSVC=536875000
-TST_TESTFUNC=do_test
-TST_USAGE=usage
-TST_OPTS="c:e:s:"
-TST_SETUP=setup
-TST_CLEANUP=cleanup
-TST_PARSE_ARGS=rpc_parse_args
-TST_NEEDS_CMDS="pkill rpcinfo"
-. rpc_lib.sh
+cleanup()
+{
+ if [ ! -z "$SERVER" ]; then
+ killall -9 $SERVER
+ $CLEANER $PROGNUMNOSVC
+ fi
+}
usage()
{
cat << EOF
USAGE: $0 [-s sprog] -c clprog [ -e extra ]
-Connect to the remote host and start sprog.
-Then execute clprog and passing it the remote host value.
+sprog - server program binary
+clprog - client program binary
+extra - extra client options
--c clprog client program binary
--s sprog server program binary
--e extra extra client options
+This scripts connects to the remote host and starts sprog there. After that it
+executes clprog passing it the remote host value.
+
+After the test completes, this script kills sprog on remote and performs a
+cleaning operation.
EOF
+
+ exit 1
}
-rpc_parse_args()
-{
- case "$1" in
- c) CLIENT="$OPTARG" ;;
- e) tst_check_cmds sed
- CLIENT_EXTRA_OPTS="$(echo $OPTARG | sed 's/,/ /')" ;;
+while getopts s:c:e:h arg; do
+ case $arg in
s) SERVER="$OPTARG" ;;
+ c) CLIENT="$OPTARG" ;;
+ e) CLIENT_EXTRA_OPTS="$OPTARG" ;;
+ h) usage ;;
esac
-}
+done
+shift $(($OPTIND - 1))
-setup()
-{
- check_portmap_rpcbind
-
- if [ -n "$SERVER" ]; then
- CLEANER="rpc_cleaner"
- if echo "$SERVER" | grep -q '^tirpc'; then
- CLEANER="tirpc_cleaner"
- fi
+if [ ! -z "$SERVER" ]; then
+ CLEANER="rpc_cleaner"
+ if echo "$SERVER" | grep -q '^tirpc'; then
+ CLEANER="tirpc_cleaner"
fi
+fi
- [ -n "$CLIENT" ] || tst_brk TBROK "client program not set"
- tst_check_cmds $CLIENT $SERVER || tst_brk TCONF "LTP compiled without TI-RPC support?"
-
- tst_cmd_available ldd which || return
- if ldd $(which $CLIENT) |grep -q /libtirpc\.so; then
- tst_res TINFO "using libtirpc: yes"
- else
- tst_res TINFO "using libtirpc: no (probably using glibc)"
- fi
-}
+if [ -z "$CLIENT" ]; then
+ echo "client program not set"
+ echo ""
+ usage
+fi
-cleanup()
-{
- if [ "$SERVER_STARTED" ]; then
- pkill -13 -x $SERVER
- $CLEANER $PROGNUMNOSVC
- fi
-}
+TCID="$CLIENT"
+TST_TOTAL=1
+TST_COUNT=1
+TST_CLEANUP=cleanup
-do_test()
-{
- local i
+TST_USE_LEGACY_API=1
+. tst_net.sh
- if [ -n "$SERVER" ]; then
- $SERVER $PROGNUMNOSVC &
- SERVER_STARTED=1
+if [ ! -z "$SERVER" ]; then
+ $SERVER $PROGNUMNOSVC &
- for i in $(seq 1 10); do
- rpcinfo -p localhost | grep -q $PROGNUMNOSVC && break
- [ "$i" -eq 30 ] && tst_brk TBROK "server not registered"
- tst_sleep 100ms
- done
- fi
+ for i in $(seq 1 10); do
+ rpcinfo -p localhost | grep -q $PROGNUMNOSVC && break
+ [ "$i" -eq 30 ] && tst_brkm TBROK "server not registered"
+ tst_sleep 100ms
+ done
+fi
- EXPECT_RHOST_PASS $CLIENT $(tst_ipaddr) $PROGNUMNOSVC $CLIENT_EXTRA_OPTS
-}
+EXPECT_RHOST_PASS $CLIENT $(tst_ipaddr) $PROGNUMNOSVC $CLIENT_EXTRA_OPTS
-tst_run
+tst_exit
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile
index 49ec2a522..42d111f9b 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile
@@ -1,5 +1,20 @@
-# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
top_srcdir ?= ../../../../..
@@ -9,13 +24,6 @@ LIBDIR := lib
FILTER_OUT_DIRS := $(LIBDIR)
LIB := $(LIBDIR)/librpc-tirpc.a
-# keep only rpc_*
-ifeq ($(LIBTIRPC_LIBS),)
-FILTER_OUT_MAKE_TARGETS += tirpc_cleaner
-FILTER_OUT_DIRS += tirpc_svc_1 tirpc_svc_2 tirpc_svc_3 tirpc_svc_4 tirpc_svc_5 tirpc_svc_6 tirpc_svc_7 tirpc_svc_8 tirpc_svc_9 tirpc_svc_11
-endif
-
-
$(LIBDIR):
mkdir -p "$@"
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc b/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc
index a5e66d202..c7093352a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/Makefile.inc
@@ -1,5 +1,20 @@
-# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
LIBRELDIR := testcases/network/rpc/rpc-tirpc/tests_pack/lib
LIBDIR := $(abs_top_builddir)/$(LIBRELDIR)
@@ -15,5 +30,5 @@ $(LIBRPC-TIRPC): $(LIBDIR)
MAKE_DEPS += $(LIBRPC-TIRPC)
LDFLAGS += -L$(LIBDIR)
-LDLIBS += $(LIBTIRPC_LIBS) -lrpc-tirpc
-CFLAGS += $(LIBTIRPC_CFLAGS) -I$(LIBSRCDIR) -I$(LIBSRCDIR)/../include -pthread
+LDLIBS += $(TIRPC_LIBS) -lrpc-tirpc
+CPPFLAGS += $(TIRPC_CPPFLAGS) -I$(LIBSRCDIR) -pthread
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/include/rpc.h b/testcases/network/rpc/rpc-tirpc/tests_pack/include/rpc.h
deleted file mode 100644
index b6db0d316..000000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/include/rpc.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#ifndef RPC_H__
-#define RPC_H__
-
-#include "config.h"
-
-#include <rpc/rpc.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/svc.h>
-
-/*
- * For pmap_unset() and clnt_broadcast().
- * Needed for glibc, which does not include <rpc/pmap_clnt.h> in <rpc/rpc.h>.
- */
-#include <rpc/pmap_clnt.h>
-
-#endif /* RPC_H__ */
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/lib/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/lib/Makefile
index 5a6f5d41c..3563d2dc5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/lib/Makefile
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/lib/Makefile
@@ -20,6 +20,6 @@ top_srcdir ?= ../../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-INTERNAL_LIB := librpc-tirpc.a
+LIB := librpc-tirpc.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_cleaner.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_cleaner.c
index 9ce603672..e17430fb4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_cleaner.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_cleaner.c
@@ -18,7 +18,7 @@
*/
#include <stdio.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
#define VERSNUM 1 /* Default version used in the test binaries */
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/Makefile
index 8ac0987af..c8ac0dd9f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/Makefile
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/Makefile
@@ -1,13 +1,22 @@
-# Copyright (C) 2009, Cisco Systems Inc.
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
top_srcdir ?= ../../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-
-ifeq ($(LIBTIRPC_LIBS),)
-FILTER_OUT_DIRS += tirpc
-endif
-
-include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/Makefile
index 647759adf..45bc8a67a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/Makefile
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/Makefile
@@ -1,15 +1,22 @@
-# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
top_srcdir ?= ../../../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-
-ifeq ($(LIBTIRPC_LIBS),)
-# glibc does not define registerrpc() in <rpc/rpc.h>
-# registerrpc() is deprecated in libtirpc, it should be replaced by rpc_reg()
-FILTER_OUT_DIRS += rpc_regunreg_registerrpc
-endif
-
-include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_getport/rpc_pmap_getport.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_getport/rpc_pmap_getport.c
index fa51f899a..67f1e6e02 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_getport/rpc_pmap_getport.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_getport/rpc_pmap_getport.c
@@ -29,8 +29,8 @@
#include <stdio.h>
#include <rpc/rpc.h>
#include <netinet/in.h>
+#include <rpc/pmap_clnt.h>
#include <netdb.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall.c
index 91f51701c..e98a76b09 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall.c
@@ -27,9 +27,9 @@
#include <stdlib.h>
#include <stdio.h>
+#include <rpc/rpc.h>
#include <errno.h>
#include <netdb.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_performance.c
index be4c26754..80952618f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_performance.c
@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
+#include <rpc/rpc.h>
#include <errno.h>
#include <netdb.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_stress.c
index fe3cf68ac..4d19b7f56 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_rmtcall/rpc_pmap_rmtcall_stress.c
@@ -27,9 +27,9 @@
#include <stdlib.h>
#include <stdio.h>
+#include <rpc/rpc.h>
#include <errno.h>
#include <netdb.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_set/rpc_pmap_set.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_set/rpc_pmap_set.c
index 01e75e5ed..4601154d7 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_set/rpc_pmap_set.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_set/rpc_pmap_set.c
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_unset/rpc_pmap_unset.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_unset/rpc_pmap_unset.c
index 535742ef3..1f71f67de 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_unset/rpc_pmap_unset.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_addrmanagmt_pmap_unset/rpc_pmap_unset.c
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast.c
index 5f024f113..e4b9efe45 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_complex.c
index c6e55cd81..348df868e 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_complex.c
@@ -28,9 +28,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <rpc/rpc.h>
#include <sys/socket.h>
#include <netdb.h>
-#include "rpc.h"
+#include <rpc/pmap_clnt.h>
//Standard define
#define PROCNUM 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c
index fdf1e31a2..17b960651 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define INTPROCNUM 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_performance.c
index 11ba64fab..d958149b6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_scalability.c
index 57ea25349..89646aa9d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_scalability.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_stress.c
index d5d7d85d1..da85b86ea 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_stress.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
index 3becf4600..3778f36bc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
@@ -28,10 +28,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <rpc/rpc.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <utmp.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c
index 4b1331b82..99129cf7d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c
@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <rpc/rpc.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c
index 0e7145a6f..8f0b6de68 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c
@@ -28,9 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <rpc/rpc.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include "rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_complex.c
index f95934567..1f81d1dbf 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_complex.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCPROC 10000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c
index 68c84ac60..cdec0c081 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c
index 4d52fe4d3..c4860a500 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c
index 342476de9..e32582364 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include <rpc/rpc.h>
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr.c
index 8211b010e..05faaf5be 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr_limits.c
index 9bfed452e..b1a31d95f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getaddr/tirpc_rpcb_getaddr_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getmaps/tirpc_rpcb_getmaps.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getmaps/tirpc_rpcb_getmaps.c
index cf9494770..32220d1cb 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getmaps/tirpc_rpcb_getmaps.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_addrmanagmt_rpcb_getmaps/tirpc_rpcb_getmaps.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authnone_create/tirpc_authnone_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authnone_create/tirpc_authnone_create.c
index 2b80c46fe..fe96218ab 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authnone_create/tirpc_authnone_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authnone_create/tirpc_authnone_create.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <netdb.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create/tirpc_authsys_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create/tirpc_authsys_create.c
index 951856ee0..c7cbb4c57 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create/tirpc_authsys_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create/tirpc_authsys_create.c
@@ -30,7 +30,7 @@
#include <time.h>
#include <unistd.h>
#include <netdb.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create_default/tirpc_authsys_create_default.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create_default/tirpc_authsys_create_default.c
index 88de398fb..f4f98b8bf 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create_default/tirpc_authsys_create_default.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authsys_create_default/tirpc_authsys_create_default.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <netdb.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call.c
index f62bdff36..47875c60b 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include "librpc-tirpc.h"
-#include "rpc.h"
+#include "lapi/rpc.h"
#define PROCNUM 1
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_complex.c
index f2e120af6..11af0296d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_complex.c
@@ -30,7 +30,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCTHREADPROC 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c
index 0311cd29d..514c34588 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c
index 85eda63f5..7c41734f6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_performance.c
index 72268817f..8614eba01 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c
index dc3c29b1b..05d25ab04 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_stress.c
index 35feb51b7..b91cc6a4b 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_stress.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create.c
index 6178e219c..51be072ea 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include "librpc-tirpc.h"
-#include "rpc.h"
+#include "lapi/rpc.h"
#define PROCNUM 1
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create_limits.c
index 9192ee70b..e47d2fc05 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_dg_create/tirpc_clnt_dg_create_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create.c
index ec41ae55d..63ed92e83 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include "librpc-tirpc.h"
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create_limits.c
index 47a095155..75d80c166 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_vc_create/tirpc_clnt_vc_create_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create.c
index 5a61aa70e..91f9663c9 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include "librpc-tirpc.h"
-#include "rpc.h"
+#include "lapi/rpc.h"
#define PROCNUM 1
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create_limits.c
index 71a75bffd..8d9e1bc98 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_dg_create/tirpc_svc_dg_create_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create.c
index cfe55be18..d7e9882e6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include "librpc-tirpc.h"
-#include "rpc.h"
+#include "lapi/rpc.h"
#define PROCNUM 1
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create_limits.c
index 1ca25debf..ba84f987c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_svc_vc_create/tirpc_svc_vc_create_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c
index 029d158ff..01eee329a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_pcreateerror/tirpc_clnt_pcreateerror.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c
index a1b16416a..836fffb52 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno_complex.c
index d48932206..d63b60a85 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perrno/tirpc_clnt_perrno_complex.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c
index 445ecfd32..d18f56fbe 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c
index e363e00b9..ac5484e4b 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_clnt_perror/tirpc_clnt_perror_complex.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noproc/tirpc_svcerr_noproc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noproc/tirpc_svcerr_noproc.c
index fc00e9eca..02ac04067 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noproc/tirpc_svcerr_noproc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noproc/tirpc_svcerr_noproc.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 667
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noprog/tirpc_svcerr_noprog.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noprog/tirpc_svcerr_noprog.c
index 8f71f6bae..ef630b00f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noprog/tirpc_svcerr_noprog.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_noprog/tirpc_svcerr_noprog.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_progvers/tirpc_svcerr_progvers.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_progvers/tirpc_svcerr_progvers.c
index fcd67a465..cc057a1d5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_progvers/tirpc_svcerr_progvers.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_progvers/tirpc_svcerr_progvers.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_systemerr/tirpc_svcerr_systemerr.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_systemerr/tirpc_svcerr_systemerr.c
index 04cba96e4..6fde3607f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_systemerr/tirpc_svcerr_systemerr.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_systemerr/tirpc_svcerr_systemerr.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_weakauth/tirpc_svcerr_weakauth.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_weakauth/tirpc_svcerr_weakauth.c
index f135d001f..1d21c3ac5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_weakauth/tirpc_svcerr_weakauth.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_weakauth/tirpc_svcerr_weakauth.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 100
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call.c
index 8cec8bf74..6436021f8 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c
index 480a8c122..114682768 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCTHREADPROC 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c
index 284bdc051..26644e25e 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c
index 7404b9434..040f0809a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_performance.c
index ddac940a6..5aa0f9260 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c
index fbc10edc7..ceedc1901 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_stress.c
index 4855a31ba..2fcc64702 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_stress.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create.c
index b6f70e43d..f068143b6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create_limits.c
index ead9a1983..ee3d4b58f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_tli_create/tirpc_clnt_tli_create_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall.c
index 512fad057..25638bd7f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c
index e22ed098e..d0d1091b4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCTHREADPROC 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c
index 0bbf87740..ecb8d3ccd 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c
index 7cf9f4725..8cbe5b992 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_performance.c
index aa55bdb82..bc7ed1785 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c
index 9fd403e13..405f9c283 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_stress.c
index 0a6eb5591..5381db5a1 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_stress.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_set/tirpc_rpcb_set.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_set/tirpc_rpcb_set.c
index 15dfa5074..de65165b3 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_set/tirpc_rpcb_set.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_set/tirpc_rpcb_set.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
#define PROCNUM 1
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_unset/tirpc_rpcb_unset.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_unset/tirpc_rpcb_unset.c
index f0816c816..ab4ddd5ba 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_unset/tirpc_rpcb_unset.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_unset/tirpc_rpcb_unset.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
#define PROCNUM 1
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg.c
index 721085cea..7ba2ac18a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c
index b9d058517..8473c0414 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_stress.c
index b2a4b4a10..862387e6f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_stress.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create.c
index a3ee981cd..342071704 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create_limits.c
index dbe152e9f..d20ffbb28 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_tli_create/tirpc_svc_tli_create_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg.c
index 5ec21f672..721e41406 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c
index 6aad7fb2e..00bcc881e 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_stress.c
index 2c6c14069..6871c87c2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_stress.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <netinet/in.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call.c
index ecd1f0d4a..5bb86ed50 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c
index 62ebd8a98..3464ff23d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCTHREADPROC 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c
index 8adca4547..b9ed6dafa 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c
index 06fcd4abf..8e8bbc2e6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_performance.c
index 924d177f0..27a4509f7 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c
index f21e2866f..c40be764c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_stress.c
index 7aa055342..2a12df325 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_stress.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control.c
index 0dd7d26ec..f6b4bd418 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control_limits.c
index 1b2c4b273..6b34aa7ab 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create/tirpc_clnt_tp_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create/tirpc_clnt_tp_create.c
index 7c7e5adab..b98f99304 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create/tirpc_clnt_tp_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create/tirpc_clnt_tp_create.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed.c
index ccdfa21fb..a3103bada 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed_limits.c
index 68211b607..f626d02ee 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create_timed/tirpc_clnt_tp_create_timed_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_svc_tp_create/tirpc_svc_tp_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_svc_tp_create/tirpc_svc_tp_create.c
index 91a34a0bd..8a00a3104 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_svc_tp_create/tirpc_svc_tp_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_svc_tp_create/tirpc_svc_tp_create.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast.c
index e31a93535..767860993 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_complex.c
index 9bf1ff993..fb19a0af2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_complex.c
@@ -30,7 +30,7 @@
#include <time.h>
#include <sys/socket.h>
#include <netdb.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PINGPROC 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c
index 1a9e4914c..30ffd931a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c
index cc39c8572..1e773a1b5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_performance.c
index 69e8f8bd6..3e06d58f4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c
index 3a3ee94d7..372f7420b 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_stress.c
index 5e0d12e57..7edde968c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_stress.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp.c
index f633e277c..a4da3a53a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_complex.c
index 45ccdf1d8..10e24af3f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_complex.c
@@ -30,7 +30,7 @@
#include <time.h>
#include <sys/socket.h>
#include <netdb.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PINGPROC 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c
index 02876d02f..b358af532 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_limits.c
index 2e3334240..e077bb6ae 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c
index 849b7d493..65189fad3 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_performance.c
index e09166080..2a6925bb3 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c
index 4817a05db..dea6d82cc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_stress.c
index 38b1df9c3..8338310dd 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_stress.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c
index 783cc65ac..1dc533d0c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c
index 0f0f3d869..5a44bf42f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCTHREADPROC 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c
index b61ea1306..6ff385175 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c
index c5a7554c5..06ffdd2f4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c
index 45a2dae49..1a609751a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c
index 707446122..4641da752 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c
index d5c1f0204..264e24c45 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg.c
index 54c3cc887..248dbdb17 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c
index b3b68a7b7..b1eb8433d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_stress.c
index dab536f93..4d54b0974 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_stress.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call.c
index 27718b627..7143e3133 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c
index a9fa73fe9..2f965e534 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define CALCTHREADPROC 1000
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c
index 52092a61a..e94f2037d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define INTPROCNUM 10
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c
index 7d2f3b945..2ffaa8219 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c
@@ -31,7 +31,7 @@
#include <time.h>
#include <pthread.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_performance.c
index 4d1264edc..264d65bc0 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_performance.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c
index 4d2ef26b6..12664fca8 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c
@@ -31,7 +31,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_stress.c
index 2ecff3ede..25f626ce3 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_stress.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c
index eaca14747..d6584ac09 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create/tirpc_clnt_create.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c
index 43df4d95f..c671649fb 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed_limits.c
index 3b7475c1b..238267be3 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed_limits.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_destroy/tirpc_clnt_destroy.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_destroy/tirpc_clnt_destroy.c
index 939ff3e4a..becd6a46c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_destroy/tirpc_clnt_destroy.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_destroy/tirpc_clnt_destroy.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_create/tirpc_svc_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_create/tirpc_svc_create.c
index 448a1b1d0..519aa4ef4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_create/tirpc_svc_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_create/tirpc_svc_create.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_destroy/tirpc_svc_destroy.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_destroy/tirpc_svc_destroy.c
index 49cff80ad..102660b5d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_destroy/tirpc_svc_destroy.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_svc_destroy/tirpc_svc_destroy.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <time.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c
index d1c4df97f..275774923 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c
@@ -27,8 +27,8 @@
#include <stdio.h>
#include <string.h>
+#include <rpc/rpc.h>
#include <utmp.h>
-#include "rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c
index 66a8444b2..a2d18cc43 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c
@@ -27,8 +27,8 @@
#include <stdio.h>
#include <string.h>
+#include <rpc/rpc.h>
#include <utmp.h>
-#include "rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_cleaner.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_cleaner.c
index 6303528c3..a938aec22 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_cleaner.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_cleaner.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_1/tirpc_svc_1.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_1/tirpc_svc_1.c
index 1acf927c4..231f671a5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_1/tirpc_svc_1.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_1/tirpc_svc_1.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c
index 73715d65d..121ae97e8 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c
@@ -30,7 +30,7 @@
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_2/tirpc_svc_2.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_2/tirpc_svc_2.c
index ba36bf26e..7a4667ef6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_2/tirpc_svc_2.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_2/tirpc_svc_2.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c
index ea762f728..c28f412fc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <sys/socket.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c
index 315182b7d..566b6fcf6 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <sys/socket.h>
#include <errno.h>
-#include "rpc.h"
+#include "lapi/rpc.h"
//Standard define
#define VERSNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c
index 53f48a741..ebf577717 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c
@@ -33,7 +33,7 @@
#include <netinet/in.h>
#include <unistd.h>
#include "librpc-tirpc.h"
-#include "rpc.h"
+#include "lapi/rpc.h"
#define VERSNUM 1
#define PROCSIMPLEPING 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/Makefile
new file mode 100644
index 000000000..b5d08aa8b
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+top_srcdir ?= ../../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(abs_srcdir)/../Makefile.inc
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c
new file mode 100644
index 000000000..1dd421e1c
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) Bull S.A. 2007 All Rights Reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it would be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*
+* Further, this software is distributed without any warranty that it is
+* free of the rightful claim of any third person regarding infringement
+* or the like. Any license provided herein, whether implied or
+* otherwise, applies only to this software file. Patent licenses, if
+* any, provided herein do not apply to combinations of this program with
+* other software, or any other product whatsoever.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program; if not, write the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* History:
+* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
+*
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <pthread.h>
+#include <netinet/in.h>
+#include "lapi/rpc.h"
+
+//Standard define
+#define VERSNUM 1
+#define PROCSIMPLEPING 1
+#define PROGSYSERROR 10
+#define PROGAUTHERROR 100
+
+static void exm_proc();
+int progNum;
+int run_mode;
+
+void *server_thread_process(void *arg)
+{
+ //Server process in a thread
+ int err = 0;
+
+ if (run_mode == 1) {
+ printf("Server #%d launched\n", atoi(arg));
+ printf("Server Nb : %d\n", progNum + atoi(arg));
+ }
+
+ svc_unreg(progNum + (long)arg, VERSNUM);
+
+ err = svc_create(exm_proc, progNum + atoi(arg), VERSNUM, "VISIBLE");
+
+ if (err == 0) {
+ fprintf(stderr, "Cannot create service.\n");
+ exit(1);
+ }
+
+ svc_run();
+
+ fprintf(stderr, "svc_run() returned. ERROR has occurred.\n");
+ svc_unreg(progNum, VERSNUM);
+
+ pthread_exit(0);
+}
+
+//****************************************//
+//*** Main Function ***//
+//****************************************//
+int main(int argn, char *argc[])
+{
+ //Server parameter is : argc[1] : Server Program Number
+ // argc[2] : Number of threads
+ // others arguments depend on server program
+ run_mode = 0;
+ int threadNb = atoi(argc[2]);
+ long i;
+ //Thread declaration
+ pthread_t *pThreadArray;
+ void *ret;
+
+ progNum = atoi(argc[1]);
+
+ pThreadArray = malloc(threadNb * sizeof(pthread_t));
+ for (i = 0; i < threadNb; i++) {
+ if (run_mode == 1)
+ fprintf(stderr, "Try to create Thread Server %ld\n", i);
+ if (pthread_create
+ (&pThreadArray[i], NULL, server_thread_process, (void*)i) < 0) {
+ fprintf(stderr, "pthread_create error for thread 1\n");
+ exit(1);
+ }
+ }
+
+ //Clean threads
+ for (i = 0; i < threadNb; i++) {
+ (void)pthread_join(pThreadArray[i], &ret);
+ }
+
+ return 1;
+}
+
+//****************************************//
+//*** Remotes Procedures ***//
+//****************************************//
+char *simplePing(char *in)
+{
+ //printf("*** in Ping Func.\n");
+ //Simple function, returns what received
+ static int result = 0;
+ result = *in;
+ return (char *)&result;
+
+}
+
+//****************************************//
+//*** Dispatch Function ***//
+//****************************************//
+static void exm_proc(struct svc_req *rqstp, SVCXPRT * transp)
+{
+ //printf("* in Dispatch Func.\n");
+ union {
+ int varIn;
+ } argument;
+
+ char *result;
+ xdrproc_t xdr_argument;
+ xdrproc_t xdr_result;
+ int *(*proc) (int *);
+
+ switch (rqstp->rq_proc) {
+ case PROCSIMPLEPING:
+ {
+ //printf("** in PROCPONG dispatch Func.\n");
+ xdr_argument = (xdrproc_t) xdr_int;
+ xdr_result = (xdrproc_t) xdr_int;
+ proc = (int *(*)(int *))simplePing;
+ break;
+ }
+ case PROGSYSERROR:
+ {
+ //Simulate an error
+ svcerr_systemerr(transp);
+ return;
+ }
+ case PROGAUTHERROR:
+ {
+ //Simulate an authentification error
+ svcerr_weakauth(transp);
+ return;
+ }
+ default:
+ {
+ //Proc is unavaible
+ svcerr_noproc(transp);
+ return;
+ }
+ }
+ memset((int *)&argument, (int)0, sizeof(argument));
+ if (svc_getargs(transp, xdr_argument, (int *)&argument) == FALSE) {
+ svcerr_decode(transp);
+ return;
+ }
+
+ result = (char *)(*proc) ((int *)&argument);
+
+ if ((result != NULL)
+ && (svc_sendreply(transp, xdr_result, result) == FALSE)) {
+ svcerr_systemerr(transp);
+ }
+ if (svc_freeargs(transp, xdr_argument, (int *)&argument) == FALSE) {
+ (void)fprintf(stderr, "unable to free arguments\n");
+ exit(1);
+ }
+}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/Makefile
new file mode 100644
index 000000000..b5d08aa8b
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+top_srcdir ?= ../../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(abs_srcdir)/../Makefile.inc
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c
new file mode 100644
index 000000000..559ef7f97
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) Bull S.A. 2007 All Rights Reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it would be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*
+* Further, this software is distributed without any warranty that it is
+* free of the rightful claim of any third person regarding infringement
+* or the like. Any license provided herein, whether implied or
+* otherwise, applies only to this software file. Patent licenses, if
+* any, provided herein do not apply to combinations of this program with
+* other software, or any other product whatsoever.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program; if not, write the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* History:
+* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
+*
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include "lapi/rpc.h"
+
+//Standard define
+#define VERSNUM 1
+//Define limits test proc
+#define PROCSIMPLEPING 1
+//Define DataInt procs
+#define INTPROCNUM 10
+#define DBLPROCNUM 20
+#define LNGPROCNUM 30
+#define STRPROCNUM 40
+
+static void exm_proc();
+
+union u_argument {
+ int varInt;
+ double dbl;
+ long lng;
+ char *str;
+} argument;
+
+//****************************************//
+//*** Main Function ***//
+//****************************************//
+int main(int argn, char *argc[])
+{
+ int progNum = atoi(argc[1]);
+ SVCXPRT *transp = NULL;
+ struct netconfig *nconf;
+
+ //Initialization
+ svc_unreg(progNum, VERSNUM);
+
+ if ((nconf = getnetconfigent("udp")) == NULL) {
+ fprintf(stderr, "Cannot get netconfig entry for UDP\n");
+ exit(1);
+ }
+
+ transp = svc_tp_create(exm_proc, progNum, VERSNUM, nconf);
+
+ if (transp == NULL) {
+ fprintf(stderr, "Cannot create service.\n");
+ exit(1);
+ }
+
+ if (!svc_reg(transp, progNum, VERSNUM, exm_proc, nconf)) {
+ fprintf(stderr, "svc_reg failed!!\n");
+ exit(1);
+ }
+
+ svc_run();
+
+ fprintf(stderr, "svc_run() returned. ERROR has occurred.\n");
+ svc_unreg(progNum, VERSNUM);
+
+ return 1;
+}
+
+//****************************************//
+//*** Remotes Procedures ***//
+//****************************************//
+char *simplePing(union u_argument *in)
+{
+ //printf("*** in Ping Func.\n");
+ //Simple function, returns what received
+ static int result;
+ result = in->varInt;
+ return (char *)&result;
+}
+
+char *intTestProc(union u_argument *in)
+{
+ //printf("*** in intTestProc.\n");
+ //returns what received
+ static int result;
+ result = in->varInt;
+ //printf("%d\n", result);
+ return (char *)&result;
+}
+
+char *lngTestProc(union u_argument *in)
+{
+ //printf("*** in lngTestProc.\n");
+ //returns what received
+ static long result;
+ result = in->lng;
+ //printf("%ld\n", result);
+ return (char *)&result;
+}
+
+char *dblTestProc(union u_argument *in)
+{
+ //printf("*** in dblTestProc.\n");
+ //returns what received
+ static double result;
+ result = in->dbl;
+ //printf("%lf\n", result);
+ return (char *)&result;
+}
+
+char *strTestProc(union u_argument *in)
+{
+ //printf("*** in strTestProc.\n");
+ //returns what received
+ static char *result;
+ result = in->str;
+ //printf("%s\n", result);
+ return (char *)&result;
+}
+
+//****************************************//
+//*** Dispatch Function ***//
+//****************************************//
+static void exm_proc(struct svc_req *rqstp, SVCXPRT * transp)
+{
+ char *result;
+ xdrproc_t xdr_argument;
+ xdrproc_t xdr_result;
+ char *(*proc) (union u_argument *);
+
+ switch (rqstp->rq_proc) {
+ case PROCSIMPLEPING:
+ {
+ xdr_argument = (xdrproc_t) xdr_int;
+ xdr_result = (xdrproc_t) xdr_int;
+ proc = (char *(*)(union u_argument *))simplePing;
+ break;
+ }
+ case INTPROCNUM:
+ {
+ xdr_argument = (xdrproc_t) xdr_int;
+ xdr_result = (xdrproc_t) xdr_int;
+ proc = (char *(*)(union u_argument *))intTestProc;
+ break;
+ }
+ case DBLPROCNUM:
+ {
+ xdr_argument = (xdrproc_t) xdr_double;
+ xdr_result = (xdrproc_t) xdr_double;
+ proc = (char *(*)(union u_argument *))dblTestProc;
+ break;
+ }
+ case LNGPROCNUM:
+ {
+ xdr_argument = (xdrproc_t) xdr_long;
+ xdr_result = (xdrproc_t) xdr_long;
+ proc = (char *(*)(union u_argument *))lngTestProc;
+ break;
+ }
+ case STRPROCNUM:
+ {
+ xdr_argument = (xdrproc_t) xdr_wrapstring;
+ xdr_result = (xdrproc_t) xdr_wrapstring;
+ proc = (char *(*)(union u_argument *))strTestProc;
+ break;
+ }
+ default:
+ {
+ //Proc is unavaible
+ svcerr_noproc(transp);
+ return;
+ }
+ }
+ memset((char *)&argument, (int)0, sizeof(argument));
+ if (svc_getargs(transp, xdr_argument, (char *)&argument) == FALSE) {
+ svcerr_decode(transp);
+ return;
+ }
+
+ result = (char *)(*proc) ((union u_argument *)&argument);
+
+ if ((result != NULL)
+ && (svc_sendreply(transp, xdr_result, (char *)result) == FALSE)) {
+ svcerr_systemerr(transp);
+ }
+ if (svc_freeargs(transp, xdr_argument, (char *)&argument) == FALSE) {
+ (void)fprintf(stderr, "unable to free arguments\n");
+ exit(1);
+ }
+}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/Makefile
new file mode 100644
index 000000000..b5d08aa8b
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+top_srcdir ?= ../../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(abs_srcdir)/../Makefile.inc
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c
new file mode 100644
index 000000000..fd516e4dd
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) Bull S.A. 2007 All Rights Reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it would be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*
+* Further, this software is distributed without any warranty that it is
+* free of the rightful claim of any third person regarding infringement
+* or the like. Any license provided herein, whether implied or
+* otherwise, applies only to this software file. Patent licenses, if
+* any, provided herein do not apply to combinations of this program with
+* other software, or any other product whatsoever.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program; if not, write the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* History:
+* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
+*
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include "lapi/rpc.h"
+
+//Standard define
+#define VERSNUM 1
+#define PINGPROC 1
+#define PROGSYSERROR 10
+#define PROGAUTHERROR 100
+
+static void exm_proc();
+int progNum;
+int run_mode;
+
+void *server_thread_process(void *arg)
+{
+ //Server process in a thread
+ int err = 0;
+ int i = (long)arg;
+
+ if (run_mode == 1) {
+ printf("Server #%d launched\n", i);
+ printf("Server Nb : %d\n", progNum + i);
+ }
+
+ svc_unreg(progNum + atoi(arg), VERSNUM);
+
+ err = svc_create(exm_proc, progNum + atoi(arg), VERSNUM, "VISIBLE");
+
+ if (err == 0) {
+ fprintf(stderr, "Cannot create service.\n");
+ exit(1);
+ }
+
+ svc_run();
+
+ fprintf(stderr, "svc_run() returned. ERROR has occurred.\n");
+ svc_unreg(progNum, VERSNUM);
+
+ pthread_exit(0);
+}
+
+//****************************************//
+//*** Main Function ***//
+//****************************************//
+int main(int argn, char *argc[])
+{
+ //Server parameter is : argc[1] : Server Program Number
+ // argc[2] : Number of threads
+ // others arguments depend on server program
+ run_mode = 0;
+ int threadNb = atoi(argc[2]);
+ long i;
+ //Thread declaration
+ pthread_t *pThreadArray;
+ void *ret;
+
+ progNum = atoi(argc[1]);
+
+ pThreadArray = malloc(threadNb * sizeof(pthread_t));
+ for (i = 0; i < threadNb; i++) {
+ if (run_mode == 1)
+ fprintf(stderr, "Try to create Thread Server %ld\n", i);
+ if (pthread_create
+ (&pThreadArray[i], NULL, server_thread_process, (void*)i) < 0) {
+ fprintf(stderr, "pthread_create error for thread 1\n");
+ exit(1);
+ }
+ }
+
+ //Clean threads
+ for (i = 0; i < threadNb; i++) {
+ (void)pthread_join(pThreadArray[i], &ret);
+ }
+
+ return 1;
+}
+
+//****************************************//
+//*** Remotes Procedures ***//
+//****************************************//
+char *pingProc(int *dt)
+{
+ //Makes a + b * c from structure dt and returns double
+ //printf("*** In calcProc ***\n");
+ static int result = 0;
+ result = *dt;
+ //printf("Received : %lf, %lf, %lf\n", dt->a, dt->b, dt->c);
+ return (char *)&result;
+}
+
+//****************************************//
+//*** Dispatch Function ***//
+//****************************************//
+static void exm_proc(struct svc_req *rqstp, SVCXPRT * transp)
+{
+ //printf("* in Dispatch Func.\n");
+
+ char *result;
+ xdrproc_t xdr_argument;
+ xdrproc_t xdr_result;
+ int *(*proc) (int *);
+
+ union {
+ int varIn;
+ } argument;
+
+ switch (rqstp->rq_proc) {
+ case PINGPROC:
+ {
+ //printf("** in PROCPONG dispatch Func.\n");
+ xdr_argument = (xdrproc_t) xdr_int;
+ xdr_result = (xdrproc_t) xdr_int;
+ proc = (int *(*)(int *))pingProc;
+ break;
+ }
+ case PROGSYSERROR:
+ {
+ //Simulate an error
+ svcerr_systemerr(transp);
+ return;
+ }
+ case PROGAUTHERROR:
+ {
+ //Simulate an authentification error
+ svcerr_weakauth(transp);
+ return;
+ }
+ default:
+ {
+ //Proc is unavaible
+ svcerr_noproc(transp);
+ return;
+ }
+ }
+ memset((int *)&argument, (int)0, sizeof(argument));
+ if (svc_getargs(transp, xdr_argument, (char *)&argument) == FALSE) {
+ svcerr_decode(transp);
+ return;
+ }
+
+ result = (char *)(*proc) ((int *)&argument);
+
+ if ((result != NULL)
+ && (svc_sendreply(transp, xdr_result, result) == FALSE)) {
+ svcerr_systemerr(transp);
+ }
+ if (svc_freeargs(transp, xdr_argument, (char *)&argument) == FALSE) {
+ (void)fprintf(stderr, "unable to free arguments\n");
+ exit(1);
+ }
+}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/Makefile
new file mode 100644
index 000000000..b5d08aa8b
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+top_srcdir ?= ../../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(abs_srcdir)/../Makefile.inc
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c
new file mode 100644
index 000000000..2fd9b4fc9
--- /dev/null
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) Bull S.A. 2007 All Rights Reserved.
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it would be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*
+* Further, this software is distributed without any warranty that it is
+* free of the rightful claim of any third person regarding infringement
+* or the like. Any license provided herein, whether implied or
+* otherwise, applies only to this software file. Patent licenses, if
+* any, provided herein do not apply to combinations of this program with
+* other software, or any other product whatsoever.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program; if not, write the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* History:
+* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
+*
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include "lapi/rpc.h"
+
+//Standard define
+#define VERSNUM 1
+#define PROGSYSERROR 10
+#define PROGAUTHERROR 100
+#define CALCTHREADPROC 1000
+
+static void exm_proc();
+int progNum;
+int run_mode;
+
+struct datas {
+ double a;
+ double b;
+ double c;
+} argument;
+
+//XDR Struct function
+bool_t xdr_datas(XDR * pt_xdr, struct datas *pt)
+{
+ return (xdr_double(pt_xdr, &(pt->a)) &&
+ xdr_double(pt_xdr, &(pt->b)) && xdr_double(pt_xdr, &(pt->c)));
+}
+
+void *server_thread_process(void *arg)
+{
+ //Server process in a thread
+ int err = 0;
+ int i = (long)arg;
+
+ if (run_mode == 1) {
+ printf("Server #%d launched\n", i);
+ printf("Server Nb : %d\n", progNum + i);
+ }
+
+ svc_unreg(progNum + atoi(arg), VERSNUM);
+
+ err = svc_create(exm_proc, progNum + atoi(arg), VERSNUM, "VISIBLE");
+
+ if (err == 0) {
+ fprintf(stderr, "Cannot create service.\n");
+ exit(1);
+ }
+
+ svc_run();
+
+ fprintf(stderr, "svc_run() returned. ERROR has occurred.\n");
+ svc_unreg(progNum, VERSNUM);
+
+ pthread_exit(0);
+}
+
+//****************************************//
+//*** Main Function ***//
+//****************************************//
+int main(int argn, char *argc[])
+{
+ //Server parameter is : argc[1] : Server Program Number
+ // argc[2] : Number of threads
+ // others arguments depend on server program
+ run_mode = 0;
+ int threadNb = atoi(argc[2]);
+ long i;
+ //Thread declaration
+ pthread_t *pThreadArray;
+ void *ret;
+
+ progNum = atoi(argc[1]);
+
+ pThreadArray = malloc(threadNb * sizeof(pthread_t));
+ for (i = 0; i < threadNb; i++) {
+ if (run_mode == 1)
+ fprintf(stderr, "Try to create Thread Server %ld\n", i);
+ if (pthread_create
+ (&pThreadArray[i], NULL, server_thread_process, (void*)i) < 0) {
+ fprintf(stderr, "pthread_create error for thread 1\n");
+ exit(1);
+ }
+ }
+
+ //Clean threads
+ for (i = 0; i < threadNb; i++) {
+ (void)pthread_join(pThreadArray[i], &ret);
+ }
+
+ return 1;
+}
+
+//****************************************//
+//*** Remotes Procedures ***//
+//****************************************//
+char *calcProc(struct datas *dt)
+{
+ //Makes a + b * c from structure dt and returns double
+ //printf("*** In calcProc ***\n");
+ static double result = 0;
+ result = dt->a + (dt->b * dt->c);
+ //printf("Received : %lf, %lf, %lf\n", dt->a, dt->b, dt->c);
+ return (char *)&result;
+}
+
+//****************************************//
+//*** Dispatch Function ***//
+//****************************************//
+static void exm_proc(struct svc_req *rqstp, SVCXPRT * transp)
+{
+ //printf("* in Dispatch Func.\n");
+
+ char *result;
+ xdrproc_t xdr_argument;
+ xdrproc_t xdr_result;
+ int *(*proc) (struct datas *);
+
+ switch (rqstp->rq_proc) {
+ case CALCTHREADPROC:
+ {
+ //printf("** in PROCPONG dispatch Func.\n");
+ xdr_argument = (xdrproc_t) xdr_datas;
+ xdr_result = (xdrproc_t) xdr_double;
+ proc = (int *(*)(struct datas *))calcProc;
+ break;
+ }
+ case PROGSYSERROR:
+ {
+ //Simulate an error
+ svcerr_systemerr(transp);
+ return;
+ }
+ case PROGAUTHERROR:
+ {
+ //Simulate an authentification error
+ svcerr_weakauth(transp);
+ return;
+ }
+ default:
+ {
+ //Proc is unavaible
+ svcerr_noproc(transp);
+ return;
+ }
+ }
+ memset((int *)&argument, (int)0, sizeof(argument));
+ if (svc_getargs(transp, xdr_argument, (char *)&argument) == FALSE) {
+ svcerr_decode(transp);
+ return;
+ }
+
+ result = (char *)(*proc) ((struct datas *)&argument);
+
+ if ((result != NULL)
+ && (svc_sendreply(transp, xdr_result, result) == FALSE)) {
+ svcerr_systemerr(transp);
+ }
+ if (svc_freeargs(transp, xdr_argument, (char *)&argument) == FALSE) {
+ (void)fprintf(stderr, "unable to free arguments\n");
+ exit(1);
+ }
+}
diff --git a/testcases/network/sctp/sctp01.sh b/testcases/network/sctp/sctp01.sh
index a42bd4975..a66020061 100755
--- a/testcases/network/sctp/sctp01.sh
+++ b/testcases/network/sctp/sctp01.sh
@@ -23,7 +23,13 @@ test()
tst_netload -S $(tst_ipaddr) -H $(tst_ipaddr rhost) -T sctp -R 3 $opts
local res1="$(cat tst_netload.res)"
- tst_netload_compare $res0 $res1 -200 200
+ local per=$(( $res0 * 100 / $res1 - 100 ))
+
+ if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then
+ tst_res TFAIL "sctp performance $per %"
+ else
+ tst_res TPASS "sctp performance $per % in range -100 ... 100 %"
+ fi
}
tst_run
diff --git a/testcases/network/sctp/sctp_big_chunk.c b/testcases/network/sctp/sctp_big_chunk.c
index 8b584bac1..7b397652b 100644
--- a/testcases/network/sctp/sctp_big_chunk.c
+++ b/testcases/network/sctp/sctp_big_chunk.c
@@ -172,15 +172,17 @@ static void run(void)
tst_res(TPASS, "test doesn't cause crash");
}
+static struct tst_option options[] = {
+ {"a:", &addr_param, "-a number of additional IP address params"},
+ {NULL, NULL, NULL}
+};
+
static struct tst_test test = {
.needs_root = 1,
.setup = setup,
.forks_child = 1,
.test_all = run,
- .options = (struct tst_option[]) {
- {"a:", &addr_param, "-a number of additional IP address params"},
- {}
- },
+ .options = options,
.tags = (const struct tst_tag[]) {
{"CVE", "2018-5803"},
{"linux-git", "07f2c7ab6f8d"},
diff --git a/testcases/network/stress/README b/testcases/network/stress/README
index b9537b1ce..bc51a4cc9 100644
--- a/testcases/network/stress/README
+++ b/testcases/network/stress/README
@@ -48,9 +48,10 @@ To run the network stress testcases, use network.sh script, located in
testscripts directory. For documentation about using network.sh see INSTALL
and testcases/network/README.md
-Some stress tests originally designed to be tested with rsh for accessing
-remote host are now using ssh using the current user. Old behavior (using rsh
-can be achieved with setting LTP_RSH variable).
+Unfortunately some stress tests still depend on rsh for accessing remote host, even
+you decide to use SSH or network namespaces with network.sh.
+Instead of rsh, you can use ssh to set the environment variable LTP_RSH.
+Please refer the `Environment Variable' section of this document.
The behaviour of network stress tests is configurable with environment
variables (See `Environment Variable' section).
@@ -145,7 +146,7 @@ Optional environment variables
------------------------------
o LTP_RSH
- The name of the remote shell command, namely ssh (the default) or rsh.
+ The name of the remote shell command, namely rsh or ssh.
In ether case, the remote host must accept the login from the local host
without password.
diff --git a/testcases/network/stress/icmp/icmp-uni-basic.sh b/testcases/network/stress/icmp/icmp-uni-basic.sh
index 2ae616cc3..5980b81e5 100755
--- a/testcases/network/stress/icmp/icmp-uni-basic.sh
+++ b/testcases/network/stress/icmp/icmp-uni-basic.sh
@@ -19,7 +19,7 @@ do_setup()
do_test()
{
- tst_ping -s $2
+ tst_ping $(tst_iface) $(tst_ipaddr rhost) $2
}
tst_run
diff --git a/testcases/network/stress/icmp/icmp-uni-vti.sh b/testcases/network/stress/icmp/icmp-uni-vti.sh
index 18bc71cfb..24eca177c 100755
--- a/testcases/network/stress/icmp/icmp-uni-vti.sh
+++ b/testcases/network/stress/icmp/icmp-uni-vti.sh
@@ -18,7 +18,7 @@ do_setup()
do_test()
{
- tst_ping -I $tst_vti -H $ip_rmt_tun -s $2
+ tst_ping $tst_vti $ip_rmt_tun $2
}
tst_run
diff --git a/testcases/network/stress/interface/if-mtu-change.sh b/testcases/network/stress/interface/if-mtu-change.sh
index 7161680e6..b945fb6ce 100755
--- a/testcases/network/stress/interface/if-mtu-change.sh
+++ b/testcases/network/stress/interface/if-mtu-change.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
# Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2005
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
@@ -10,15 +10,10 @@ TST_SETUP="do_setup"
TST_CLEANUP="do_cleanup"
. if-lib.sh
-# CHANGE_INTERVAL: The interval of the mtu change
-TST_TIMEOUT=1
-if tst_net_use_netns; then
- CHANGE_INTERVAL=${CHANGE_INTERVAL:-100ms}
-else
- CHANGE_INTERVAL=${CHANGE_INTERVAL:-5}
-fi
-tst_is_int $CHANGE_INTERVAL && TST_TIMEOUT=$CHANGE_INTERVAL
-TST_TIMEOUT=$(((TST_TIMEOUT + 30) * MTU_CHANGE_TIMES))
+# The interval of the mtu change [second]
+CHANGE_INTERVAL=${CHANGE_INTERVAL:-5}
+
+TST_TIMEOUT=$(((CHANGE_INTERVAL + 30) * MTU_CHANGE_TIMES))
# The array of the value which MTU is changed into sequentially
# 552 - net.ipv4.route.min_pmtu
@@ -26,55 +21,11 @@ CHANGE_VALUES="784 1142 552 1500 552 1500 552 748 552 1142 1500"
CHANGE6_VALUES="1280 1445 1335 1390 1500 1280 1500 1280 1335 1500"
saved_mtu=
-MAX_PACKET_SIZE=65507
-
-set_mtu()
-{
- local mtu="$1"
- local cmd="$2"
- local ret=0
- local iface=$(tst_iface)
- local iface_rmt=$(tst_iface rhost)
-
- case $cmd in
- ifconfig) ifconfig $iface mtu $mtu || ret=1
- tst_rhost_run -c "ifconfig $iface_rmt mtu $mtu" || ret=1
- ;;
- ip) ip link set $iface mtu $mtu || ret=1
- tst_rhost_run -c "ip link set $iface_rmt mtu $mtu" || ret=1
- ;;
- *) tst_brk TBROK "unknown cmd '$cmd'"
- ;;
- esac
-
- return $ret
-}
-
-find_ipv4_max_packet_size()
-{
- local min_mtu=552
- local size=$MAX_PACKET_SIZE
-
- set_mtu $min_mtu $CMD || tst_brk TBROK "failed to set MTU to $mtu"
- tst_res TINFO "checking max MTU"
- while [ $size -gt 0 ]; do
- if ping -I $(tst_iface) -c1 -w1 -s $size $(tst_ipaddr rhost) >/dev/null; then
- tst_res TINFO "use max MTU $size"
- MAX_PACKET_SIZE=$size
- return
- fi
- size=$((size - 500))
- done
- tst_brk TBROK "failed to find max MTU"
-}
-
do_setup()
{
-
[ "$TST_IPV6" ] && CHANGE_VALUES=$CHANGE6_VALUES
if_setup
saved_mtu="$(cat /sys/class/net/$(tst_iface)/mtu)"
- [ "$TST_IPV6" ] || find_ipv4_max_packet_size
}
do_cleanup()
@@ -89,10 +40,13 @@ do_cleanup()
test_body()
{
local cmd="$CMD"
- local msg="'$cmd' changes MTU $MTU_CHANGE_TIMES times every $CHANGE_INTERVAL"
- tst_is_int $CHANGE_INTERVAL && msg="$msg seconds"
- tst_res TINFO "$msg"
+ local iface=$(tst_iface)
+ local iface_rmt=$(tst_iface rhost)
+ [ "$TST_IPV6" ] && local netmask=64 || local netmask=16
+
+ tst_res TINFO "'$cmd' changes MTU $MTU_CHANGE_TIMES times" \
+ "every $CHANGE_INTERVAL seconds"
mtu_array_len=$(echo $CHANGE_VALUES | wc -w)
local cnt=0
@@ -106,14 +60,24 @@ test_body()
make_background_tcp_traffic
tst_res TINFO "set MTU to $mtu $cnt/$MTU_CHANGE_TIMES"
- if ! set_mtu $mtu $cmd; then
- tst_res TFAIL "failed to change MTU to $mtu at $cnt time"
+ local ret=0
+ case $cmd in
+ ifconfig) ifconfig $iface mtu $mtu || ret=1
+ tst_rhost_run -c "ifconfig $iface_rmt mtu $mtu"
+ ;;
+ ip) ip link set $iface mtu $mtu || ret=1
+ tst_rhost_run -c "ip link set $iface_rmt mtu $mtu"
+ ;;
+ esac
+
+ if [ $? -ne 0 -o $ret -ne 0 ]; then
+ tst_res TFAIL "Failed to change the mtu at $cnt time"
return
fi
tst_sleep $CHANGE_INTERVAL
- tst_ping -s "1 $((mtu / 2)) $mtu $MAX_PACKET_SIZE"
+ tst_ping $(tst_ipaddr) $(tst_ipaddr rhost) "1 1000 65507"
done
}
diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index e395e1ff3..d40941d45 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -83,7 +83,7 @@ ipsec_lib_setup()
ALGR=
if [ -n "$IPSEC_MODE" ]; then
- tst_net_run -q "tst_check_drivers xfrm_user" || \
+ tst_net_run "tst_check_drivers xfrm_user" || \
tst_brk TCONF "xfrm_user driver not available on lhost or rhost"
cleanup_xfrm=1
fi
@@ -295,12 +295,11 @@ tst_ipsec_setup_vti()
tst_ipsec_vti lhost $ip_loc $ip_rmt $tst_vti
tst_ipsec_vti rhost $ip_rmt $ip_loc $tst_vti
- local mask address_opt
+ local mask=
if [ "$TST_IPV6" ]; then
ip_loc_tun="${IPV6_NET32_UNUSED}::1";
ip_rmt_tun="${IPV6_NET32_UNUSED}::2";
mask=64
- address_opt=nodad
ROD ip -6 route add ${IPV6_NET32_UNUSED}::/$mask dev $tst_vti
else
ip_loc_tun="${IPV4_NET16_UNUSED}.1.1";
@@ -312,6 +311,6 @@ tst_ipsec_setup_vti()
tst_res TINFO "Add IPs to vti tunnel, " \
"loc: $ip_loc_tun/$mask, rmt: $ip_rmt_tun/$mask"
- ROD ip a add $ip_loc_tun/$mask dev $tst_vti $address_opt
+ ROD ip a add $ip_loc_tun/$mask dev $tst_vti nodad
tst_rhost_run -s -c "ip a add $ip_rmt_tun/$mask dev $tst_vti"
}
diff --git a/testcases/network/stress/multicast/grp-operation/Makefile b/testcases/network/stress/multicast/grp-operation/Makefile
index af11867ee..a57b72d0f 100644
--- a/testcases/network/stress/multicast/grp-operation/Makefile
+++ b/testcases/network/stress/multicast/grp-operation/Makefile
@@ -24,7 +24,7 @@ top_srcdir ?= ../../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-INSTALL_TARGETS := mcast*.sh
+INSTALL_TARGETS := mcast*
MAKE_TARGETS :=
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket b/testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket
new file mode 100644
index 000000000..7b79b42df
--- /dev/null
+++ b/testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+ # Increase the maximum number of open file descriptors
+ if [ $(ulimit -n) -lt $MCASTNUM_HEAVY ]; then
+ ulimit -n $MCASTNUM_HEAVY || tst_brk TCONF \
+ "Failed to set the maximum number of open file descriptors to $MCASTNUM_HEAVY"
+ fi
+
+ mcast_setup $MCASTNUM_HEAVY
+}
+
+do_test()
+{
+ tst_res TINFO "joining $MCASTNUM_HEAVY IPv$TST_IPVER multicast groups on multiple sockets"
+ do_multicast_test_multiple_join $MCASTNUM_HEAVY true
+}
+
+tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh b/testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh
deleted file mode 100644
index abd2dabb3..000000000
--- a/testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) International Business Machines Corp., 2006
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="do_setup"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_setup()
-{
- # Increase the maximum number of open file descriptors
- if [ $(ulimit -n) -lt $MCASTNUM_HEAVY ]; then
- ulimit -n $MCASTNUM_HEAVY || tst_brk TCONF \
- "Failed to set the maximum number of open file descriptors to $MCASTNUM_HEAVY"
- fi
-
- mcast_setup $MCASTNUM_HEAVY
-}
-
-do_test()
-{
- tst_res TINFO "joining $MCASTNUM_HEAVY IPv$TST_IPVER multicast groups on multiple sockets"
- do_multicast_test_multiple_join $MCASTNUM_HEAVY true
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-same-group b/testcases/network/stress/multicast/grp-operation/mcast-group-same-group
new file mode 100644
index 000000000..e10f16c09
--- /dev/null
+++ b/testcases/network/stress/multicast/grp-operation/mcast-group-same-group
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+ mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+ tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
+ do_multicast_test_join_leave $MCASTNUM_NORMAL
+}
+
+tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh b/testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh
deleted file mode 100644
index 33df2e422..000000000
--- a/testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) International Business Machines Corp., 2006
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
- do_multicast_test_join_leave $MCASTNUM_NORMAL
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-single-socket b/testcases/network/stress/multicast/grp-operation/mcast-group-single-socket
new file mode 100644
index 000000000..ff58152cb
--- /dev/null
+++ b/testcases/network/stress/multicast/grp-operation/mcast-group-single-socket
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+ mcast_setup $MCASTNUM_HEAVY
+}
+
+do_test()
+{
+ tst_res TINFO "joining $MCASTNUM_HEAVY IPv$TST_IPVER multicast groups on a single socket"
+ do_multicast_test_multiple_join $MCASTNUM_HEAVY
+}
+
+tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh b/testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh
deleted file mode 100644
index 10c65918f..000000000
--- a/testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) International Business Machines Corp., 2006
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="do_setup"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_setup()
-{
- mcast_setup $MCASTNUM_HEAVY
-}
-
-do_test()
-{
- tst_res TINFO "joining $MCASTNUM_HEAVY IPv$TST_IPVER multicast groups on a single socket"
- do_multicast_test_multiple_join $MCASTNUM_HEAVY
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-source-filter b/testcases/network/stress/multicast/grp-operation/mcast-group-source-filter
new file mode 100644
index 000000000..df70344da
--- /dev/null
+++ b/testcases/network/stress/multicast/grp-operation/mcast-group-source-filter
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+ mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+ tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group with a different source filters on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
+ do_multicast_test_join_leave $MCASTNUM_NORMAL true
+}
+
+tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh b/testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh
deleted file mode 100644
index 19bd426a4..000000000
--- a/testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) International Business Machines Corp., 2006
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group with a different source filters on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
- do_multicast_test_join_leave $MCASTNUM_NORMAL true
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-lib.sh b/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
index cfc8a1b49..381ab6bdf 100644
--- a/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
+++ b/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
@@ -1,11 +1,15 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
# Copyright (c) International Business Machines Corp., 2006
# Author: Petr Vorel <pvorel@suse.cz>
#
# Setup script for multicast stress tests.
+TST_SETUP="do_setup"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
+TST_NEEDS_TMPDIR=1
. tst_net_stress.sh
mcast_setup4()
@@ -55,18 +59,6 @@ mcast_setup()
[ "$TST_IPV6" ] && mcast_setup6 || mcast_setup4 $max
}
-mcast_setup_normal()
-{
- mcast_setup $MCASTNUM_NORMAL
-}
-
-mcast_setup_normal_udp()
-{
- mcast_setup_normal
- MCAST_LCMD="ns-mcast_receiver"
- MCAST_RCMD="ns-udpsender"
-}
-
mcast_cleanup4()
{
[ -n "$SYSFS_IGMP_MAX_MEMBERSHIPS" ] && sysctl -q -w net.ipv4.igmp_max_memberships=$SYSFS_IGMP_MAX_MEMBERSHIPS
@@ -148,19 +140,3 @@ do_multicast_test_join_leave()
tst_res TPASS "test is finished successfully"
}
-
-do_multicast_test_join_single_socket()
-{
- local extra="$1"
- local prefix="$MCAST_IPV4_ADDR_PREFIX"
- [ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
-
- # Run a multicast join tool
- local tmpfile=$$
- EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix \> $tmpfile
- tst_res TINFO "joined $(grep groups $tmpfile)"
-
- local params
- [ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
- EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params $extra
-}
diff --git a/testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh b/testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh
deleted file mode 100755
index cc1b8410c..000000000
--- a/testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining a multicast group with
-# a single socket, then receiving a large number of UDP packets at the socket
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal_udp"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining an IPv${TST_IPVER} multicast group with a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION seconds"
-
- local addr="$MCAST_IPV4_ADDR"
- [ "$TST_IPV6" ] && addr="$MCAST_IPV6_ADDR"
-
- local port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
- [ $? -ne 0 ] && tst_brk TBROK "no free udp port available"
-
- # Run a receiver
- ROD $MCAST_LCMD -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
-
- # Run a sender
- tst_rhost_run -s -c "$MCAST_RCMD -D $addr -f $TST_IPVER -p $port -s 32767 -m -I $(tst_iface rhost) -t $NS_DURATION"
-
- tst_res TPASS "test finished successfully"
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh b/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh
deleted file mode 100755
index 3394e0262..000000000
--- a/testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining multiple multicast
-# groups on separate sockets, then receiving a large number of UDP
-# packets at each socket
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal_udp"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"
-
- local addr port
- local n=0
-
- while [ $n -lt $MCASTNUM_NORMAL ]; do
- # Define the multicast address
- if [ "$TST_IPV6" ]; then
- local n_hex=$(printf "%x" $n)
- addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}
- else
- local x=$((n / 254))
- local y=$((n % 254 + 1))
- addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
- fi
-
- port=$(tst_get_unused_port ipv${TST_IPVER} dgram)
- [ $? -ne 0 ] && tst_brk TBROK "no free udp port available"
-
- # Run a receiver
- ROD $MCAST_LCMD -f $TST_IPVER -I $(tst_iface lhost) -m $addr -p $port -b
-
- # Run a sender
- tst_rhost_run -s -c "$MCAST_RCMD -D $addr -f $TST_IPVER -p $port -m -I $(tst_iface rhost) -b -t $NS_DURATION"
-
- n=$((n+1))
- done
-
- sleep $NS_DURATION
-
- tst_res TPASS "test finished successfully"
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01 b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
new file mode 100644
index 000000000..c1ee513d4
--- /dev/null
+++ b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
@@ -0,0 +1,207 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-pktfld01
+#
+# Description:
+# Verify that the kernel is not crashed when joining a IPv4 multicast group
+# a single socket, then receiving a large number of UDP packets at the socket
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-pktfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Multicast Address
+MCAST_ADDR=224.10.0.1
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # Unset the maximum number of processes
+ ulimit -u unlimited
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining a IPv4 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
+
+do_setup
+
+# Find the available consecutive ports
+mcast_port=`find_portbundle udp 1025 1`
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "No port is available."
+ exit 1
+fi
+
+# Run a receiver
+ns-mcast_receiver -f 4 -I $lhost_ifname -m $MCAST_ADDR -p $mcast_port -b
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast receiver"
+ exit 1
+fi
+
+# Run a sender
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $MCAST_ADDR -f 4 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast sender"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0
diff --git a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02 b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02
new file mode 100644
index 000000000..b3b6134c3
--- /dev/null
+++ b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02
@@ -0,0 +1,225 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-pktfld02
+#
+# Description:
+# Verify that the kernel is not crashed when joining plural IPv4 multicast
+# groups on separate sockets, then receiving a large number of UDP packets at
+# the each socket
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-pktfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the multicast address
+MCAST_ADDR_PREFIX=224.10
+
+# Number of the multicast connection
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # Unset the maximum number of processes
+ ulimit -u unlimited
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=$MCASTNUM_NORMAL >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
+
+# Make sure the value of LTPROOT
+do_setup
+
+mcastnum=0
+mcast_port_range=`find_portbundle udp 1025 $MCASTNUM_NORMAL`
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get enough port"
+ exit 1
+fi
+mcast_port_top=`echo $mcast_port_range | cut -f 1 -d '-'`
+
+while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ x=`expr $mcastnum \/ 254`
+ y=`expr $mcastnum % 254 + 1`
+ if [ $x -gt 254 ]; then
+ tst_resm TINFO "The number of the connection is less than $mcastnum"
+ break
+ fi
+ mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+ # Run a receiver
+ mcast_port=`expr $mcast_port_top + $mcastnum`
+ ns-mcast_receiver -f 4 -I $lhost_ifname -m $mcast_addr -p $mcast_port -b
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast receiver"
+ exit 1
+ fi
+
+ # Run a sender
+ $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $mcast_addr -f 4 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION
+
+ mcastnum=`expr $mcastnum + 1`
+done
+
+sleep $NS_DURATION
+do_cleanup
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0
diff --git a/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01 b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01
new file mode 100644
index 000000000..e9d932b43
--- /dev/null
+++ b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01
@@ -0,0 +1,203 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-pktfld01
+#
+# Description:
+# Verify that the kernel is not crashed when joining a IPv6 multicast group
+# a single socket, then receiving a large number of UDP packets at the socket
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 6 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-pktfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Multicast Address
+MCAST_ADDR=ff0e::1111:1
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # Unset the maximum number of processes
+ ulimit -u unlimited
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining a IPv6 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
+
+do_setup
+
+# Find the available consecutive ports
+mcast_port=`find_portbundle udp 1025 1`
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "No port is available."
+ exit 1
+fi
+
+# Run a receiver
+ns-mcast_receiver -f 6 -I $lhost_ifname -m $MCAST_ADDR -p $mcast_port -b
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast receiver"
+ exit 1
+fi
+
+# Run a sender
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $MCAST_ADDR -f 6 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast sender"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0
diff --git a/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02 b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02
new file mode 100644
index 000000000..e8187b1a6
--- /dev/null
+++ b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02
@@ -0,0 +1,220 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-pktfld02
+#
+# Description:
+# Verify that the kernel is not crashed when joining plural IPv6 multicast
+# groups on separate sockets, then receiving a large number of UDP packets at
+# the each socket
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-pktfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the multicast address
+MCAST_ADDR_PREFIX=ff0e::1111
+
+# Number of the multicast connection
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # Unset the maximum number of processes
+ ulimit -u unlimited
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
+
+# Make sure the value of LTPROOT
+do_setup
+
+mcastnum=0
+mcast_port_range=`find_portbundle udp 1025 $MCASTNUM_NORMAL`
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get enough port"
+ exit 1
+fi
+mcast_port_top=`echo $mcast_port_range | cut -f 1 -d '-'`
+
+while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ if [ $mcastnum -gt 65535 ]; then
+ tst_resm TINFO "The number of the connection is less than 65535"
+ break
+ fi
+ mcastnum_hex=`printf "%x" $mcastnum`
+ mcast_addr=${MCAST_ADDR_PREFIX}:${mcastnum_hex}
+
+ # Run a receiver
+ mcast_port=`expr $mcast_port_top + $mcastnum`
+ ns-mcast_receiver -f 6 -I $lhost_ifname -m $mcast_addr -p $mcast_port -b
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast receiver"
+ exit 1
+ fi
+
+ # Run a sender
+ $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $mcast_addr -f 6 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION
+
+ mcastnum=`expr $mcastnum + 1`
+done
+
+sleep $NS_DURATION
+do_cleanup
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
deleted file mode 100755
index e80026720..000000000
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining a multicast group
-# on a single socket, then receiving a large number of General Queries
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of General Queries in $NS_DURATION seconds"
-
- # Send General Query from the remote host
- do_multicast_test_join_single_socket
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
deleted file mode 100755
index 8773bd86b..000000000
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining a multicast group
-# on a single socket, then receiving a large number of Multicast Address
-# Specific Query
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION seconds"
-
- local extra="-m $MCAST_IPV4_ADDR"
- [ "$TST_IPV6" ] && extra="-D $MCAST_IPV6_ADDR"
-
- # Send IGMP Multicast Address Specific Query from the remote host
- do_multicast_test_join_single_socket "$extra"
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh
deleted file mode 100755
index 8ab9af544..000000000
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining a multicast group
-# on a single socket, then receiving a large number of Multicast Address
-# and Source Specific Queries
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-SRC_ADDR_IPV4="10.10.10.1"
-SRC_ADDR_IPV6="fec0:100:100:100::1"
-FILTER_MODE="include"
-
-do_test()
-{
- tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Queries in $NS_DURATION seconds"
-
- local prefix="$MCAST_IPV4_ADDR_PREFIX"
- local src_addr="$SRC_ADDR_IPV4"
- if [ "$TST_IPV6" ]; then
- prefix="$MCAST_IPV6_ADDR_PREFIX"
- src_addr="$SRC_ADDR_IPV6"
- fi
-
- # Run a multicast join tool
- local tmpfile=$$
- EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile
- tst_res TINFO "joined $(grep groups $tmpfile)"
-
- # Send Multicast Address and Source Specific Queries from the remote host
- local params="-m $MCAST_IPV4_ADDR -s $src_addr"
- [ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR -a $src_addr"
- EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh
deleted file mode 100755
index 5947562f1..000000000
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining multiple multicast
-# groups on separate socket, then receiving a large number of General Queries
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate socket, then receiving a large number of General Queries in $NS_DURATION seconds"
-
- local prefix="$MCAST_IPV4_ADDR_PREFIX"
- [ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
-
- # Run a multicast join tool
- local tmpfile=$$
- EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $prefix \> $tmpfile
- tst_res TINFO "joined $(grep groups $tmpfile)"
-
- # Send General Queries from the remote host
- local params
- [ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
- EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh
deleted file mode 100755
index 3c064842f..000000000
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining multiple
-# multicast groups on separate sockets, then receiving a large number of
-# Multicast Address Specific Queries
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-do_test()
-{
- tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Queries in $NS_DURATION seconds"
-
- local prefix="$MCAST_IPV4_ADDR_PREFIX"
- [ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
-
- # Run a multicast join tool
- local tmpfile=$$
- EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $prefix \> $tmpfile
- tst_res TINFO "joined $(grep groups $tmpfile)"
-
- # Send IGMP Multicast Address Specific Query from the remote host
- local n=0
- while [ $n -lt $MCASTNUM_NORMAL ]; do
- # Define the multicast address
- if [ "$TST_IPV6" ]; then
- local n_hex=$(printf "%x" $n)
- local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}
- else
- local x=$((n / 254))
- local y=$((n % 254 + 1))
- local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
- fi
-
- local params="-m $addr"
- [ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $addr"
- tst_rhost_run -c "$MCAST_RCMD -t $NS_DURATION -r 0 -b $params"
-
- n=$((n+1))
- done
-
- sleep $NS_DURATION
-
- tst_res TPASS "test finished successfully"
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh
deleted file mode 100755
index bda064f7d..000000000
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify that the kernel is not crashed when joining multiple
-# multicast groups on separate sockets, then receiving a large number of
-# Multicast Address and Source Specific Queries
-
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_SETUP="mcast_setup_normal"
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-. mcast-lib.sh
-
-SRC_ADDR_IPV4=10.10.10.1
-SRC_ADDR_IPV6=fec0:100:100:100::1
-FILTER_MODE="include"
-
-do_test()
-{
- tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Queries in $NS_DURATION seconds"
-
- local prefix="$MCAST_IPV4_ADDR_PREFIX"
- local src_addr="$SRC_ADDR_IPV4"
- if [ "$TST_IPV6" ]; then
- prefix="$MCAST_IPV6_ADDR_PREFIX"
- src_addr="$SRC_ADDR_IPV6"
- fi
-
- # Run a multicast join tool
- local tmpfile=$$
- EXPECT_PASS $MCAST_LCMD -n $MCASTNUM_NORMAL -p $prefix -s $src_addr -F $FILTER_MODE \> $tmpfile
- tst_res TINFO "joined $(grep groups $tmpfile)"
-
- # Send Multicast Address Specific Queries from the remote host
- local n=0
- while [ $n -lt $MCASTNUM_NORMAL ]; do
- # Define the multicast address
- if [ "$TST_IPV6" ]; then
- local n_hex=$(printf "%x" $n)
- local addr=${MCAST_IPV6_ADDR_PREFIX}:${n_hex}
- else
- local x=$((n / 254))
- local y=$((n % 254 + 1))
- local addr=${MCAST_IPV4_ADDR_PREFIX}.${x}.${y}
- fi
-
- local params="-m $addr -s $src_addr"
- [ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $addr -a $src_addr"
- tst_rhost_run -c "$MCAST_RCMD -t $NS_DURATION -r 0 -b $params"
-
- n=$((n+1))
- done
-
- sleep $NS_DURATION
-
- tst_res TPASS "test finished successfully"
-}
-
-tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld01 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld01
new file mode 100644
index 000000000..992cf423e
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld01
@@ -0,0 +1,199 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-queryfld01
+#
+# Description:
+# Verify that the kernel is not crashed when joining an IPv4 multicast group
+# on a single socket, then receiving a large number of General Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send IGMP General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start IGMP querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld02 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld02
new file mode 100644
index 000000000..b731e0218
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld02
@@ -0,0 +1,202 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-queryfld02
+#
+# Description:
+# Verify that the kernel is not crashed when joining an IPv4 multicast group
+# on a single socket, then receiving a large number of Multicast Address
+# Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+# Multicast Address
+MCAST_ADDR=224.10.0.1 # If you modify this, please refer ns-mcast_join.c
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send IGMP Multicast Address Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start IGMP querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld03 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld03
new file mode 100644
index 000000000..568178b32
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld03
@@ -0,0 +1,208 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-queryfld03
+#
+# Description:
+# Verify that the kernel is not crashed when joining an IPv4 multicast group
+# on a single socket, then receiving a large number of Multicast Address
+# and Source Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld03
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+# Multicast Address
+MCAST_ADDR=224.10.0.1 # If you modify this, please refer ns-mcast_join.c
+
+# Source Address
+SRC_ADDR=10.10.10.1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send IGMP Multicast Address and Source Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -s $SRC_ADDR -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start IGMP querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld04 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld04
new file mode 100644
index 000000000..f89393ffc
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld04
@@ -0,0 +1,202 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-queryfld04
+#
+# Description:
+# Verify that the kernel is not crashed when joining plural IPv4 multicast
+# groups on separate socket, then receiving a large number of General Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld04
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send IGMP General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start IGMP querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld05 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld05
new file mode 100644
index 000000000..6d73027a6
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld05
@@ -0,0 +1,213 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-queryfld05
+#
+# Description:
+# Verify that the kernel is not crashed when joining joining plural IPv4
+# multicast groups on separate socket, then receiving a large number of
+# Multicast Address Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld05
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send IGMP Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ x=`expr $querier_num \/ 254`
+ y=`expr $querier_num % 254 + 1`
+ if [ $x -gt 254 ]; then
+ tst_resm TINFO "The number of the connection is less than $querier_num"
+ break
+ fi
+ mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+ $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $mcast_addr -t $NS_DURATION -r 0 -b
+
+ querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld06 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld06
new file mode 100644
index 000000000..b45162045
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld06
@@ -0,0 +1,219 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast4-queryfld06
+#
+# Description:
+# Verify that the kernel is not crashed when joining joining plural IPv4
+# multicast groups on separate socket, then receiving a large number of
+# Multicast Address and Source Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld06
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+# Source Address
+SRC_ADDR=10.10.10.1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv4 addresses to the interfaces
+ set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv4 address of the local/remote host
+ lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv4 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send IGMP Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ x=`expr $querier_num \/ 254`
+ y=`expr $querier_num % 254 + 1`
+ if [ $x -gt 254 ]; then
+ tst_resm TINFO "The number of the connection is less than $querier_num"
+ break
+ fi
+ mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+ $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $mcast_addr -s $SRC_ADDR -t $NS_DURATION -r 0 -b
+
+ querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld01 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld01
new file mode 100644
index 000000000..8c09d4897
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld01
@@ -0,0 +1,197 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-queryfld01
+#
+# Description:
+# Verify that the kernel is not crashed when joining an IPv6 multicast
+# group on a single socket, then receiving a large number of General Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+ rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send MLD General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION' ; echo $?'`
+
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start MLD querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld02 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld02
new file mode 100644
index 000000000..17cdae75d
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld02
@@ -0,0 +1,199 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-queryfld02
+#
+# Description:
+# Verify that the kernel is not crashed when joining an IPv6 multicast group
+# on a single socket, then receiving a large number of Multicast Address
+# Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+# Multicast Address
+MCAST_ADDR=ff0e::1 # If you modify this, please refer ns-mcast_join.c
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+ rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send MLD Multicast Address Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start MLD querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld03 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld03
new file mode 100644
index 000000000..bac7726a9
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld03
@@ -0,0 +1,205 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-queryfld03
+#
+# Description:
+# Verify that the kernel is not crashed when joining an IPv6 multicast group
+# on a single socket, then receiving a large number of Multicast Address
+# and Source Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld03
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+# Multicast Address
+MCAST_ADDR=ff0e::1 # If you modify this, please refer ns-mcast_join.c
+
+# Source Address
+SRC_ADDR=fec0:100:100:100::1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+ rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send MLD Multicast Address and Source Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -a $SRC_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start MLD querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld04 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld04
new file mode 100644
index 000000000..cd56d4b40
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld04
@@ -0,0 +1,199 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-queryfld04
+#
+# Description:
+# Verify that the kernel is not crashed when joining plural IPv6 multicast
+# groups on separate socket, then receiving a large number of General Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld04
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+ rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send MLD General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to start MLD querier"
+ exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld05 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld05
new file mode 100644
index 000000000..84c2ee109
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld05
@@ -0,0 +1,209 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-queryfld05
+#
+# Description:
+# Verify that the kernel is not crashed when joining joining plural IPv6
+# multicast groups on separate socket, then receiving a large number of
+# Multicast Address Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld05
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+ rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send MLD Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ if [ $querier_num -gt 65535 ]; then
+ tst_resm TINFO "The number of the querier is less than 65535"
+ break
+ fi
+ querier_num_hex=`printf "%x" $querier_num`
+ mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
+
+ $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -r 0 -t $NS_DURATION -b
+
+ querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld06 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld06
new file mode 100644
index 000000000..d94a78efe
--- /dev/null
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld06
@@ -0,0 +1,213 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# mcast6-queryfld06
+#
+# Description:
+# Verify that the kernel is not crashed when joining joining plural IPv6
+# multicast groups on separate socket, then receiving a large number of
+# Multicast Address and Source Specific Query
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld06
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2" # local host
+RHOST_HOST_PART=":1" # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+# Source Address
+SRC_ADDR=fec0:100:100:100::1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+# Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+ # Clean up each interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+# Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Initialize the system configuration
+ do_cleanup
+
+ # Call do_cleanup function before exit
+ trap do_cleanup 0
+
+ # name of interface of the local/remote host
+ lhost_ifname=`get_ifname lhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ rhost_ifname=`get_ifname rhost $LINK_NUM`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Set IPv6 addresses to the interfaces
+ add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+
+ add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ # IPv6 address of the local/remote host
+ lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+ rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+ rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+ # Make sure the connectvity
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "There is no IPv6 connectivity."
+ exit 1
+ fi
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+ exit $TST_TOTAL
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
+if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+ exit 1
+fi
+
+# Send MLD Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ if [ $querier_num -gt 65535 ]; then
+ tst_resm TINFO "The number of the querier is less than 65535"
+ break
+ fi
+ querier_num_hex=`printf "%x" $querier_num`
+ mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
+
+ $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -a $SRC_ADDR -r 0 -t $NS_DURATION -b
+ querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0
diff --git a/testcases/network/stress/ns-tools/Makefile b/testcases/network/stress/ns-tools/Makefile
index 5f4d17343..49a05232f 100644
--- a/testcases/network/stress/ns-tools/Makefile
+++ b/testcases/network/stress/ns-tools/Makefile
@@ -1,6 +1,24 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2009, Cisco Systems Inc.
+#
+# network/stress/ns-tools test suite Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, July 2009
+#
top_srcdir ?= ../../../..
@@ -17,4 +35,4 @@ FILTER_OUT_MAKE_TARGETS := ns-common
include $(top_srcdir)/include/mk/generic_leaf_target.mk
-$(MAKE_TARGETS): %: ns-common.o
+$(MAKE_TARGETS): %: %.o ns-common.o
diff --git a/testcases/network/stress/ns-tools/tst_net_stress.sh b/testcases/network/stress/ns-tools/tst_net_stress.sh
index 4b00ee7f8..ae040bcf1 100644
--- a/testcases/network/stress/ns-tools/tst_net_stress.sh
+++ b/testcases/network/stress/ns-tools/tst_net_stress.sh
@@ -69,7 +69,7 @@ check_connectivity()
tst_res TINFO "ping through $src_iface iface to ${dst_addr}$cnt_msg"
- tst_ping -I $src_iface -H $dst_addr
+ tst_ping $src_iface $dst_addr
}
# check_connectivity_interval CNT [RESTORE] [SRC_IFACE] [DST_ADDR]
diff --git a/testcases/network/stress/route/.gitignore b/testcases/network/stress/route/.gitignore
deleted file mode 100644
index 4ed647a55..000000000
--- a/testcases/network/stress/route/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/route-change-netlink
diff --git a/testcases/network/stress/route/00_Descriptions.txt b/testcases/network/stress/route/00_Descriptions.txt
index d148d51d9..e0e2e42c6 100644
--- a/testcases/network/stress/route/00_Descriptions.txt
+++ b/testcases/network/stress/route/00_Descriptions.txt
@@ -1,26 +1,36 @@
route{4,6}-change-dst
- Change IPv4/IPv6 route destination by ip command
+ Verify the IPv4/IPv6 is not broken when ip command changes route
+ destination many times
route{4,6}-change-gw
- Change IPv4/IPv6 route gateway by ip command
+ Verify the IPv4/IPv6 is not broken when ip command changes route
+ gateway many times
route{4,6}-change-if
- Change IPv4/IPv6 route interface by ip command
+ Verify the IPv4/IPv6 is not broken when ip command changes route
+ interface many times
-route{4,6}-change-netlink-dst
- Change IPv4/IPv6 route destination by Netlink API via libmnl
+route4-redirect01
+ Verify the kernel is not crashed when the IPv4 route is modified by
+ ICMP Redirects frequently
-route{4,6}-change-netlink-gw
- Change IPv4/IPv6 route gateway by Netlink API via libmnl
+route4-rmmod01
+ Verify the kernel is not crashed when IPv4 route is add by route command
+ then it is deleted by the removing network driver
-route{4,6}-change-netlink-if
- Change IPv4/IPv6 route interface by Netlink API via libmnl
+route4-rmmod02
+ Verify the kernel is not crashed when IPv4 route is add by ip command
+ then it is deleted by the removing network driver
-route{4,6}-redirect01
- Change IPv4/IPv6 route by ICMP Redirects frequently
-route{4,6}-rmmod01
- Add IPv4/IPv6 route by route command then delete it by the removing network driver
+route6-redirect01
+ Verify the kernel is not crashed when the IPv6 route is modified by
+ ICMP Redirects frequently
-route{4,6}-rmmod02
- Add IPv4/IPv6 route by ip command then delete it by the removing network driver
+route6-rmmod01
+ Verify the kernel is not crashed when IPv6 route is add by route command
+ then it is deleted by the removing network driver
+
+route6-rmmod02
+ Verify the kernel is not crashed when IPv6 route is add by ip command
+ then it is deleted by the removing network driver
diff --git a/testcases/network/stress/route/Makefile b/testcases/network/stress/route/Makefile
index b4e6409be..2e5eaa2f2 100644
--- a/testcases/network/stress/route/Makefile
+++ b/testcases/network/stress/route/Makefile
@@ -1,15 +1,29 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (C) 2009, Cisco Systems Inc.
-# Copyright (c) Linux Test Project, 2006-2020
+#
+# network/stress/route test suite Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
# Ngie Cooper, October 2009
+#
top_srcdir ?= ../../../..
-include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/env_pre.mk
-INSTALL_TARGETS += route[4-6]-* *.sh
-
-route-change-netlink: CFLAGS += $(LIBMNL_CFLAGS)
-route-change-netlink: LDLIBS += $(LIBMNL_LIBS)
+INSTALL_TARGETS := route*
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/route/route-change-dst.sh b/testcases/network/stress/route/route-change-dst.sh
index 2d88b5f73..fff79fa6e 100755
--- a/testcases/network/stress/route/route-change-dst.sh
+++ b/testcases/network/stress/route/route-change-dst.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
# Copyright (c) International Business Machines Corp., 2006
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
# Rewrite into new shell API: Petr Vorel
@@ -8,15 +8,12 @@
# Change route destination
# lhost: 10.0.0.2, rhost: 10.23.x.1
-TST_SETUP="setup"
-TST_CLEANUP="route_cleanup"
TST_TESTFUNC="test_dst"
. route-lib.sh
-TST_CNT=$ROUTE_CHANGE_IP
setup()
{
- tst_res TINFO "change IPv$TST_IPVER route destination $ROUTE_CHANGE_IP times"
+ tst_res TINFO "change IPv$TST_IPVER route destination $NS_TIMES times"
}
test_dst()
diff --git a/testcases/network/stress/route/route-change-gw.sh b/testcases/network/stress/route/route-change-gw.sh
index 6c650befd..d9eeb8184 100755
--- a/testcases/network/stress/route/route-change-gw.sh
+++ b/testcases/network/stress/route/route-change-gw.sh
@@ -1,23 +1,25 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
# Copyright (c) International Business Machines Corp., 2006
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
# Rewrite into new shell API: Petr Vorel
#
# Change route gateway
-# lhost: 10.23.1.1, gw (on rhost): 10.23.1.x, rhost: 10.23.0.1
+# lhost: 10.23.x.2, gw (on rhost): 10.23.x.1, rhost: 10.23.0.1
-TST_SETUP="setup"
-TST_CLEANUP="route_cleanup"
TST_TESTFUNC="test_gw"
. route-lib.sh
-TST_CNT=$ROUTE_CHANGE_IP
setup()
{
- tst_res TINFO "change IPv$TST_IPVER route gateway $ROUTE_CHANGE_IP times"
- setup_gw
+ tst_res TINFO "change IPv$TST_IPVER route gateway $NS_TIMES times"
+
+ rt="$(tst_ipaddr_un -p 0 0)"
+ lhost="$(tst_ipaddr_un 1 1)"
+ rhost="$(tst_ipaddr_un 0 1)"
+ tst_add_ipaddr -s -q -a $lhost
+ tst_add_ipaddr -s -q -a $rhost rhost
}
test_gw()
diff --git a/testcases/network/stress/route/route-change-if.sh b/testcases/network/stress/route/route-change-if.sh
index 7e9c15fe4..75d70e9be 100755
--- a/testcases/network/stress/route/route-change-if.sh
+++ b/testcases/network/stress/route/route-change-if.sh
@@ -1,23 +1,64 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
# Copyright (c) International Business Machines Corp., 2006
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-# Rewrite into new shell API: Petr Vorel
#
# Change route interface
# lhost: 10.23.x.2, gw (on rhost): 10.23.x.1, rhost: 10.23.0.1, switching ifaces on lhost
-TST_SETUP="setup"
-TST_CLEANUP="cleanup_if"
TST_TESTFUNC="test_if"
. route-lib.sh
-TST_CNT=$ROUTE_CHANGE_IP
+TST_CLEANUP="cleanup"
+
+add_macvlan()
+{
+ local action="add"
+ local OPTIND
+ while getopts d opt; do
+ case "$opt" in
+ d) action="del";;
+ esac
+ done
+ shift $((OPTIND - 1))
+
+ local iface="$1"
+ local type="${2:-lhost}"
+
+ cmd="ip link $action $iface link $(tst_iface $type) type macvlan mode bridge"
+ if [ $type = "lhost" ]; then
+ ROD $cmd
+ [ "$action" = "add" ] || return
+ LHOST_IFACES="$LHOST_IFACES $iface"
+ else
+ tst_rhost_run -s -c "$cmd"
+ [ "$action" = "add" ] || return
+ RHOST_IFACES="$RHOST_IFACES $iface"
+ fi
+ tst_init_iface $type 1
+}
setup()
{
- tst_res TINFO "change IPv$TST_IPVER route interface $ROUTE_CHANGE_IP times"
- setup_if
+ tst_res TINFO "change IPv$TST_IPVER route interface $NS_TIMES times"
+
+ rt="$(tst_ipaddr_un -p 0)"
+ rhost="$(tst_ipaddr_un 0 1)"
+ tst_add_ipaddr -s -q -a $rhost rhost
+
+ if [ $(tst_get_ifaces_cnt) -lt 2 ]; then
+ new_liface="ltp_mv2"
+ tst_res TINFO "2 or more local ifaces required, adding $new_liface"
+ add_macvlan $new_liface
+ fi
+
+ if [ $(tst_get_ifaces_cnt rhost) -lt 2 ]; then
+ new_riface="ltp_mv1"
+ tst_res TINFO "2 or more remote ifaces required, adding $new_riface"
+ add_macvlan $new_riface rhost
+ fi
+
+
}
test_if()
@@ -38,4 +79,11 @@ test_if()
tst_del_ipaddr -s -q -a $gw rhost $link_num
}
+cleanup()
+{
+ [ "$new_liface" ] && add_macvlan -d $new_liface
+ [ "$new_riface" ] && add_macvlan -d $new_riface rhost
+ route_cleanup
+}
+
tst_run
diff --git a/testcases/network/stress/route/route-change-netlink-dst.sh b/testcases/network/stress/route/route-change-netlink-dst.sh
deleted file mode 100755
index 0740d0963..000000000
--- a/testcases/network/stress/route/route-change-netlink-dst.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-#
-# Change route destination via netlink
-# rhost: 10.23.x.1
-# lhost (iface set, but not specified in Netlink API): 10.0.0.2
-
-TST_SETUP="setup"
-TST_CLEANUP="route_cleanup"
-TST_TESTFUNC="test_netlink"
-. route-lib.sh
-
-setup()
-{
- tst_res TINFO "change IPv$TST_IPVER route destination $ROUTE_CHANGE_NETLINK times"
-
- local cnt=0
- local gw rhost rhost_all rt
-
- check_max_ip
-
- while [ $cnt -lt $ROUTE_MAX_IP ]; do
- rt="$(tst_ipaddr_un -p $cnt)"
- rhost="$(tst_ipaddr_un $cnt 1)"
- rhost_all="$rhost$IP_ADDR_DELIM$rhost_all"
-
- tst_add_ipaddr -s -q -a $rhost rhost
- ROD ip route add $rt dev $(tst_iface)
- cnt=$((cnt+1))
- done
-
- ROUTE_CHANGE_NETLINK_PARAMS="-d $(tst_iface) -r '$rhost_all'"
-}
-
-tst_run
diff --git a/testcases/network/stress/route/route-change-netlink-gw.sh b/testcases/network/stress/route/route-change-netlink-gw.sh
deleted file mode 100755
index 3119a1b31..000000000
--- a/testcases/network/stress/route/route-change-netlink-gw.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-#
-# Change route gateway via netlink
-# gw (on rhost): 10.23.1.x, rhost: 10.23.0.1
-# lhost (iface set, but not specified in Netlink API): 10.23.1.1
-
-TST_SETUP="setup"
-TST_CLEANUP="route_cleanup"
-TST_TESTFUNC="test_netlink"
-. route-lib.sh
-
-setup()
-{
- local cnt=0
-
- tst_res TINFO "change IPv$TST_IPVER route gateway $ROUTE_CHANGE_NETLINK times"
-
- check_max_ip
- setup_gw
-
- while [ $cnt -lt $ROUTE_MAX_IP ]; do
- gw="$(tst_ipaddr_un -h 2,$max_ip_limit 1 $(($cnt + 1)))"
- gw_all="$gw$IP_ADDR_DELIM$gw_all"
- tst_add_ipaddr -s -q -a $gw rhost
- cnt=$((cnt+1))
- done
-
- ROUTE_CHANGE_NETLINK_PARAMS="-d $(tst_iface) -g "$gw_all" -r $rhost"
-}
-
-tst_run
diff --git a/testcases/network/stress/route/route-change-netlink-if.sh b/testcases/network/stress/route/route-change-netlink-if.sh
deleted file mode 100755
index d1e64a40e..000000000
--- a/testcases/network/stress/route/route-change-netlink-if.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-#
-# Change route interface
-# gw (on rhost): 10.23.x.1, rhost: 10.23.0.1, switching ifaces on lhost
-# lhost (iface set, but not specified in Netlink API): 10.23.x.2
-
-TST_SETUP="setup"
-TST_CLEANUP="cleanup_if"
-TST_TESTFUNC="test_netlink"
-. route-lib.sh
-
-setup()
-{
- local gw gw_all iface iface_all
- local cnt=0
-
- tst_res TINFO "change IPv$TST_IPVER route interface $ROUTE_CHANGE_NETLINK times"
- setup_if
-
- while [ $cnt -lt $(tst_get_ifaces_cnt) ]; do
- gw="$(tst_ipaddr_un -n1 $cnt 1)"
- iface="$(tst_iface lhost $cnt)"
- lhost="$(tst_ipaddr_un -n1 $cnt 2)"
-
- tst_add_ipaddr -s -q -a $lhost lhost $cnt
- tst_add_ipaddr -s -q -a $gw rhost $cnt
-
- gw_all="$gw$IP_ADDR_DELIM$gw_all"
- iface_all="$iface$IP_ADDR_DELIM$iface_all"
-
- cnt=$((cnt+1))
- done
-
- ROUTE_CHANGE_NETLINK_PARAMS="-d '$iface_all' -g '$gw_all' -r $rhost"
-}
-
-tst_run
diff --git a/testcases/network/stress/route/route-change-netlink.c b/testcases/network/stress/route/route-change-netlink.c
deleted file mode 100644
index 3c49b7adc..000000000
--- a/testcases/network/stress/route/route-change-netlink.c
+++ /dev/null
@@ -1,324 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
- */
-
-#include "config.h"
-#include "tst_test.h"
-
-#ifdef HAVE_LIBMNL
-
-#include <string.h>
-
-#include <libmnl/libmnl.h>
-#include <linux/rtnetlink.h>
-#include <net/if.h>
-#include <netdb.h>
-#include <netinet/in.h>
-
-#include "tst_net.h"
-#include "tst_safe_net.h"
-#include "tst_safe_stdio.h"
-
-#define IP_ADDR_DELIM ','
-#define STR(x) #x
-#define CHR2STR(x) STR(x)
-
-static char *c_opt, *d_opt, *g_opt, *ipv6_opt, *p_opt, *r_opt;
-
-static int family = AF_INET;
-static int fd, num_loops, port;
-
-static unsigned int is_ipv6, max, prefix;
-
-static struct mnl_socket *nl;
-static struct addrinfo hints;
-
-struct iface {
- unsigned int index;
- struct iface *next;
- char iface[IFNAMSIZ];
-};
-
-struct ip_addr {
- struct addrinfo *ip;
- struct ip_addr *next;
- char ip_str[INET6_ADDRSTRLEN];
-};
-
-static struct ip_addr *dst, *gw, *rhost;
-static struct iface *iface;
-static unsigned int gw_len, iface_len, rhost_len;
-
-void save_iface(void **data, const char *item)
-{
- struct iface *n = SAFE_MALLOC(sizeof(*n));
- struct iface **list = (struct iface**)data;
-
- strncpy(n->iface, item, sizeof(n->iface));
- n->iface[sizeof(n->iface)-1] = '\0';
-
- n->index = if_nametoindex(item);
- if (!n->index)
- tst_brk(TBROK, "if_nametoindex failed, '%s' not found", item);
- n->next = *list;
- *list = n;
-}
-
-void save_ip(void **data, const char *item)
-{
- struct ip_addr *n = SAFE_MALLOC(sizeof(*n));
- struct ip_addr **list = (struct ip_addr**)data;
-
- strncpy(n->ip_str, item, sizeof(n->ip_str));
- n->ip_str[sizeof(n->ip_str)-1] = '\0';
-
- SAFE_GETADDRINFO(item, p_opt, &hints, &n->ip);
- n->next = *list;
- *list = n;
-}
-
-int save_item(void **list, char *item, void (*callback)(void **, const char *))
-{
- int len = 0;
-
- while ((item = strtok(item, CHR2STR(IP_ADDR_DELIM))) != NULL) {
- callback(list, item);
- item = NULL;
- len++;
- }
-
- return len;
-}
-
-static void setup(void)
-{
- prefix = 24;
- if (ipv6_opt) {
- family = AF_INET6;
- is_ipv6 = 1;
- prefix = 64;
- }
-
- if (!c_opt)
- tst_brk(TBROK, "missing number of loops (-c num)");
-
- if (!d_opt)
- tst_brk(TBROK, "missing iface (-d iface)");
-
- if (!p_opt)
- tst_brk(TBROK, "missing rhost port (-p port)");
-
- if (!r_opt)
- tst_brk(TBROK, "missing rhost IP (-r IP)");
-
- if (tst_parse_int(p_opt, &port, 1, 65535))
- tst_brk(TBROK, "invalid rhost port '%s'", p_opt);
-
- if (tst_parse_int(c_opt, &num_loops, 1, INT_MAX)) {
- num_loops = INT_MAX;
- tst_res(TWARN, "invalid number of loops (-c %s), using: %d",
- c_opt, num_loops);
- }
-
- iface_len = save_item((void **)&iface, d_opt, save_iface);
- rhost_len = save_item((void **)&rhost, r_opt, save_ip);
-
- max = MAX(iface_len, rhost_len);
- if (iface_len > 1 && rhost_len > 1 && iface_len != max)
- tst_brk(TBROK, "-d specifies more NICs and -r more IPs, they need to have the same count");
-
- if (g_opt) {
- gw_len = save_item((void **)&gw, g_opt, save_ip);
- max = MAX(gw_len, max);
-
- if (gw_len > 1 && max > 1 && gw_len != max) {
- if (iface_len == max)
- tst_brk(TBROK, "-d specifies more NICs and -r more IPs, they need to have the same count");
- else
- tst_brk(TBROK, "-g and -r specify more IP, they need to have the same count");
- }
- }
-
- struct ip_addr *p_rhost = rhost;
-
- while (p_rhost) {
- char dst_str[INET6_ADDRSTRLEN];
-
- if (!strncpy(dst_str, p_rhost->ip_str, sizeof(dst_str)))
- tst_brk(TBROK, "failed copy IP '%s'", p_rhost->ip_str);
- dst_str[strlen(p_rhost->ip_str)-1] = '\0';
-
- if (!strcat(dst_str, "0"))
- tst_brk(TBROK, "strcat failed: '%s'", dst_str);
-
- save_ip((void **)&dst, dst_str);
- p_rhost = p_rhost->next;
- }
-
- fd = SAFE_SOCKET(family, SOCK_DGRAM, IPPROTO_UDP);
-
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = family;
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_flags = 0;
- hints.ai_protocol = 0;
- hints.ai_addr = INADDR_ANY;
-}
-
-static void cleanup(void)
-{
- if (fd > 0)
- close(fd);
-
- if (nl)
- mnl_socket_close(nl);
-}
-
-static void brk_on_route_error(const char *msg, int iface,
- struct sockaddr *dst, struct sockaddr *gw, int type)
-{
- char dst_str[INET6_ADDRSTRLEN], gw_str[INET6_ADDRSTRLEN];
- tst_sock_addr(dst, sizeof(dst), dst_str, sizeof(dst_str));
- if (gw)
- tst_sock_addr(gw, sizeof(gw), gw_str, sizeof(gw_str));
-
- tst_res(TINFO, "type: %s, iface: %d, dst: %s, gw: %s",
- type == RTM_NEWROUTE ? "RTM_NEWROUTE" : "RTM_DELROUTE",
- iface, dst_str, gw ? gw_str : "null");
- tst_brk(TBROK, "%s failed (errno=%d): %s", msg, errno, strerror(errno));
-}
-
-static void rtnl_route(int iface, struct addrinfo *dst, struct addrinfo *gw,
- int type)
-{
- struct mnl_socket *nl;
- char buf[MNL_SOCKET_BUFFER_SIZE];
- struct nlmsghdr *nlh;
- struct rtmsg *rtm;
- uint32_t seq, portid;
- struct in6_addr dst_in6, gw_in6;
- in_addr_t dst_ip, gw_ip;
- int ret;
-
- nlh = mnl_nlmsg_put_header(buf);
- nlh->nlmsg_type = type;
-
- nlh->nlmsg_flags = NLM_F_ACK;
- if (type == RTM_NEWROUTE)
- nlh->nlmsg_flags |= NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE;
-
- nlh->nlmsg_seq = seq = time(NULL);
-
- rtm = mnl_nlmsg_put_extra_header(nlh, sizeof(struct rtmsg));
- rtm->rtm_family = family;
- rtm->rtm_dst_len = prefix;
- rtm->rtm_src_len = 0;
- rtm->rtm_tos = 0;
- rtm->rtm_protocol = RTPROT_STATIC;
- rtm->rtm_table = RT_TABLE_MAIN;
- rtm->rtm_type = RTN_UNICAST;
- rtm->rtm_scope = gw ? RT_SCOPE_UNIVERSE : RT_SCOPE_LINK;
- rtm->rtm_flags = 0;
-
- if (is_ipv6) {
- dst_in6 = ((struct sockaddr_in6 *)dst->ai_addr)->sin6_addr;
- mnl_attr_put(nlh, RTA_DST, sizeof(struct in6_addr), &dst_in6);
- } else {
- dst_ip = ((struct sockaddr_in *)dst->ai_addr)->sin_addr.s_addr;
- mnl_attr_put_u32(nlh, RTA_DST, dst_ip);
- }
-
- mnl_attr_put_u32(nlh, RTA_OIF, iface);
-
- if (gw) {
- if (is_ipv6) {
- gw_in6 = ((struct sockaddr_in6 *)gw->ai_addr)->sin6_addr;
- mnl_attr_put(nlh, RTA_GATEWAY, sizeof(struct in6_addr), &gw_in6);
- } else {
- gw_ip = ((struct sockaddr_in *)gw->ai_addr)->sin_addr.s_addr;
- mnl_attr_put_u32(nlh, RTA_GATEWAY, gw_ip);
- }
- }
-
- nl = mnl_socket_open(NETLINK_ROUTE);
- if (nl == NULL)
- brk_on_route_error("mnl_socket_open", iface, dst->ai_addr, gw ?
- gw->ai_addr : NULL, type);
-
- if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0)
- brk_on_route_error("mnl_socket_bind", iface, dst->ai_addr, gw ?
- gw->ai_addr : NULL, type);
-
- portid = mnl_socket_get_portid(nl);
-
- if (mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0)
- brk_on_route_error("mnl_socket_sendto", iface, dst->ai_addr, gw
- ? gw->ai_addr : NULL, type);
-
- ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
- if (ret < 0)
- brk_on_route_error("mnl_socket_recvfrom", iface, dst->ai_addr,
- gw ? gw->ai_addr : NULL, type);
-
- ret = mnl_cb_run(buf, ret, seq, portid, NULL, NULL);
- if (ret < 0)
- brk_on_route_error("mnl_cb_run", iface, dst->ai_addr, gw ?
- gw->ai_addr : NULL, type);
-
- mnl_socket_close(nl);
-}
-
-static void send_udp(struct addrinfo *rhost_addrinfo)
-{
- const char *msg = "foo";
-
- SAFE_SENDTO(1, fd, msg, sizeof(msg), MSG_CONFIRM,
- rhost_addrinfo->ai_addr, rhost_addrinfo->ai_addrlen);
-}
-
-static void run(void)
-{
- int i;
-
- tst_res(TINFO, "adding and deleting route %d times", num_loops);
-
- struct ip_addr *p_dst = dst, *p_gw = gw, *p_rhost = rhost;
- struct iface *p_iface = iface;
-
- for (i = 0; i < num_loops; i++) {
- rtnl_route(p_iface->index, p_dst->ip, gw ? p_gw->ip : NULL,
- RTM_NEWROUTE);
- send_udp(p_rhost->ip);
- rtnl_route(p_iface->index, p_dst->ip, gw ? p_gw->ip : NULL,
- RTM_DELROUTE);
-
- if (gw)
- p_gw = p_gw->next ?: gw;
- p_dst = p_dst->next ?: dst;
- p_iface = p_iface->next ?: iface;
- p_rhost = p_rhost->next ?: rhost;
- }
-
- tst_res(TPASS, "routes created and deleted");
-}
-
-static struct tst_test test = {
- .test_all = run,
- .needs_root = 1,
- .setup = setup,
- .cleanup = cleanup,
- .options = (struct tst_option[]) {
- {"6", &ipv6_opt, "-6 Use IPv6 (default is IPv4)"},
- {"c:", &c_opt, "-c x Num loops (mandatory)"},
- {"d:", &d_opt, "-d iface Interface to work on (mandatory)"},
- {"g:", &g_opt, "-g x Gateway IP"},
- {"p:", &p_opt, "-p port Rhost port (mandatory)"},
- {"r:", &r_opt, "-r x Rhost IP (mandatory)\n\n-g, -r IP parameter can contain more IP, separated by "
- CHR2STR(IP_ADDR_DELIM)},
- {}
- },
-};
-#else
- TST_TEST_TCONF("libmnl library and headers are required");
-#endif /* HAVE_LIBMNL */
diff --git a/testcases/network/stress/route/route-lib.sh b/testcases/network/stress/route/route-lib.sh
index 194bd40cc..4afbe6323 100644
--- a/testcases/network/stress/route/route-lib.sh
+++ b/testcases/network/stress/route/route-lib.sh
@@ -1,109 +1,17 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019-2020 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
TST_NEEDS_ROOT=1
+TST_SETUP="setup"
+TST_CLEANUP="route_cleanup"
TST_NEEDS_CMDS="ip"
-. tst_net.sh
-
-ROUTE_RHOST_PORT=${ROUTE_RHOST_PORT:-65535}
-ROUTE_MAX_IP=${ROUTE_MAX_IP:-5}
-
-IP_ADDR_DELIM=','
-
-add_macvlan()
-{
- local action="add"
- local OPTIND
- while getopts d opt; do
- case "$opt" in
- d) action="del";;
- esac
- done
- shift $((OPTIND - 1))
-
- local iface="$1"
- local type="${2:-lhost}"
-
- cmd="ip link $action $iface link $(tst_iface $type) type macvlan mode bridge"
- if [ $type = "lhost" ]; then
- ROD $cmd
- [ "$action" = "add" ] || return
- LHOST_IFACES="$LHOST_IFACES $iface"
- else
- tst_rhost_run -s -c "$cmd"
- [ "$action" = "add" ] || return
- RHOST_IFACES="$RHOST_IFACES $iface"
- fi
- tst_init_iface $type 1
-}
-
-check_max_ip()
-{
- local max_ip_limit=254
- [ "$TST_IPV6" ] && max_ip_limit=65534
+TST_CNT=$NS_TIMES
- tst_is_int "$ROUTE_MAX_IP" || tst_brk TBROK "\$ROUTE_MAX_IP not int ($ROUTE_MAX_IP)"
- [ $ROUTE_MAX_IP -gt $max_ip_limit ] && ROUTE_MAX_IP=$max_ip_limit
- [ $ROUTE_MAX_IP -gt $ROUTE_CHANGE_NETLINK ] && ROUTE_MAX_IP=$ROUTE_CHANGE_NETLINK
-}
-
-cleanup_if()
-{
- [ "$new_liface" ] && add_macvlan -d $new_liface
- [ "$new_riface" ] && add_macvlan -d $new_riface rhost
- route_cleanup
-}
+. tst_net.sh
route_cleanup()
{
tst_restore_ipaddr
tst_restore_ipaddr rhost
}
-
-setup_gw()
-{
- rt="$(tst_ipaddr_un -p 0 0)"
- lhost="$(tst_ipaddr_un 1 1)"
- rhost="$(tst_ipaddr_un 0 1)"
- tst_add_ipaddr -s -q -a $lhost
- tst_add_ipaddr -s -q -a $rhost rhost
-}
-
-setup_if()
-{
- rt="$(tst_ipaddr_un -p 0)"
- rhost="$(tst_ipaddr_un 0 1)"
- tst_add_ipaddr -s -q -a $rhost rhost
-
- if [ $(tst_get_ifaces_cnt) -lt 2 ]; then
- new_liface="ltp_mv2"
- tst_res TINFO "2 or more local ifaces required, adding '$new_liface'"
- add_macvlan $new_liface
- fi
-
- if [ $(tst_get_ifaces_cnt rhost) -lt 2 ]; then
- new_riface="ltp_mv1"
- tst_res TINFO "2 or more remote ifaces required, adding '$new_riface'"
- add_macvlan $new_riface rhost
- fi
-}
-
-test_netlink()
-{
- local opt="-c $ROUTE_CHANGE_NETLINK $TST_IPV6_FLAG -p $ROUTE_RHOST_PORT $ROUTE_CHANGE_NETLINK_PARAMS"
- local cmd="route-change-netlink"
- local ret=0
-
- tst_res TINFO "running $cmd $opt"
- $cmd $opt || ret=$?
- if [ "$ret" -ne 0 ]; then
- [ $((ret & 3)) -ne 0 ] && \
- tst_brk TFAIL "$cmd failed"
- [ $((ret & 32)) -ne 0 ] && \
- tst_brk TCONF "not supported configuration"
- [ $((ret & 4)) -ne 0 ] && \
- tst_res TWARN "$cmd has warnings"
- fi
- tst_res TPASS "$cmd passed"
-}
diff --git a/testcases/network/stress/route/route-redirect.sh b/testcases/network/stress/route/route-redirect.sh
deleted file mode 100755
index d77c37a7d..000000000
--- a/testcases/network/stress/route/route-redirect.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2006 International Business Machines Corp.
-# Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# Verify the kernel is not crashed when the route is modified by
-# ICMP Redirects frequently
-
-TST_SETUP=setup
-TST_CLEANUP=cleanup
-TST_TESTFUNC=do_test
-TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="ip"
-
-. route-lib.sh
-
-DST_HOST=
-DST_PORT="7"
-
-setup()
-{
- local lhost_ifname=$(tst_iface lhost)
- local rhost_ifname=$(tst_iface rhost)
- local rhost_net="$(tst_ipaddr_un -p 1)"
-
- DST_HOST="$(tst_ipaddr_un 1 5)"
-
- # Remove the link-local address of the remote host
- tst_rhost_run -s -c "ip addr flush dev $rhost_ifname"
-
- # Add route to the initial gateway
- ip route add $rhost_net dev $lhost_ifname
-
- # Make sure the sysctl value is set for accepting the redirect
- sysctl -w net.ipv${TST_IPVER}.conf.${lhost_ifname}.accept_redirects=1 > /dev/null
- [ ! "$TST_IPV6" ] && sysctl -w net.ipv4.conf.${lhost_ifname}.secure_redirects=0 > /dev/null
-
- tst_rhost_run -s -c "ns-icmp_redirector -I $rhost_ifname -b"
-}
-
-cleanup()
-{
- tst_rhost_run -c "killall -SIGHUP ns-icmp_redirector"
- route_cleanup
-}
-
-do_test()
-{
- local cnt=0
-
- tst_res TINFO "modify route by ICMP redirects $NS_TIMES times"
-
- while [ $cnt -lt $NS_TIMES ]; do
- ROD ns-udpsender -f $TST_IPVER -D $DST_HOST -p $DST_PORT -o -s 8
- cnt=$((cnt+1))
- done
-
- tst_res TPASS "test finished successfully"
-}
-
-tst_run
diff --git a/testcases/network/stress/route/route4-redirect b/testcases/network/stress/route/route4-redirect
new file mode 100644
index 000000000..53df9abf2
--- /dev/null
+++ b/testcases/network/stress/route/route4-redirect
@@ -0,0 +1,212 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# route4-redirect
+#
+# Description:
+# Verify the kernel is not crashed when the IPv4 route is modified by
+# ICMP Redirects frequently
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# Apr 07 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=route4-redirect01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Test description
+tst_resm TINFO "Verify the kernel is not crashed when the IPv4 route is modified by ICMP Redirects frequently"
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# The number of times where route is changed
+NS_TIMES=${NS_TIMES:-10000}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of for the tested network
+IPV4_NETMASK_NUM=24
+
+# Broadcast address of the tested network
+IPV4_BROADCAST=${IPV4_NETWORK}.255
+
+# Host portion of the IPv4 address
+LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"1"} # src
+RHOST_IPV4_HOST="2" # gateway
+
+# The destination network
+DST_NETWORK="10.10.0" # destination network would be 10.10.0.0/24
+DST_HOST="5"
+DST_PORT="7"
+
+
+#-----------------------------------------------------------------------
+#
+# NAME:
+# do_cleanup
+#
+# DESCRIPTION:
+# Recover the tested interfaces
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Kill the redirector utility
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmp_redirector >/dev/null 2>&1
+
+ # Initialize the interfaces
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# NAME:
+# do_setup
+#
+# DESCRIPTION:
+# Set the initial route and start icmp redirect on the remote host
+#
+# SET VALUES:
+# rhost_ipv4addr - IPv4 Address of the remote host
+# lhost_ifname - Interface name of the local host
+# rhost_ifname - Interface name of the remote host
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Make sure to clean up
+ do_cleanup
+
+ # Get the Interface name of local host
+ lhost_ifname=`get_ifname lhost ${LINK_NUM}`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ # Get the Interface name of remote host
+ rhost_ifname=`get_ifname rhost ${LINK_NUM}`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Remove the link-local address of the remote host
+ sleep 3
+ $LTP_RSH $RHOST "ip addr flush dev $rhost_ifname" > /dev/null
+
+ # Assign IPv4 address to the interface of the local host
+ set_ipv4addr lhost ${LINK_NUM} ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to assign an IPv4 address at the local host"
+ return 1
+ fi
+
+ # Add route to the initial gateway
+ route add -net ${DST_NETWORK}.0 netmask 255.255.255.0 gw ${IPV4_NETWORK}.${RHOST_IPV4_HOST} dev $lhost_ifname
+
+ # Make sure the sysctl value is set for accepting the redirect
+ sysctl -w net.ipv4.conf.${lhost_ifname}.accept_redirects=1 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.secure_redirects=0 >/dev/null
+
+ # Run the redirector utility at the remote host
+ ret=`$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmp_redirector -I $rhost_ifname -b ; "'echo $?'`
+ if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to run icmp redirector at the remote host"
+ exit $TST_TOTAL
+ fi
+}
+
+
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION:
+# test_body
+#
+# DESCRIPTION:
+# main code of the test
+#
+# Arguments:
+# None
+#
+#-----------------------------------------------------------------------
+test_body()
+{
+ # Loop for changing the route
+ cnt=0
+ while [ $cnt -lt $NS_TIMES ]; do
+ ns-udpsender -f 4 -D ${DST_NETWORK}.${DST_HOST} -p $DST_PORT -o -s 8
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to run udp packet sender"
+ return 1
+ fi
+ cnt=`expr $cnt + 1`
+ done
+
+ tst_resm TPASS "Test is finished correctly."
+ return 0
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+# Exit Value:
+# The number of the failure
+#
+#-----------------------------------------------------------------------
+RC=0
+do_setup
+test_body || RC=`expr $RC + 1`
+do_cleanup
+
+exit $RC
diff --git a/testcases/network/stress/route/route4-rmmod b/testcases/network/stress/route/route4-rmmod
index 7aa195810..5947bb3cf 100644
--- a/testcases/network/stress/route/route4-rmmod
+++ b/testcases/network/stress/route/route4-rmmod
@@ -125,9 +125,6 @@ do_setup()
exit $TST_TOTAL
fi
- # The module name of the interface at the local host
- lhost_module=
-
# Make sure to clean up
do_cleanup
diff --git a/testcases/network/stress/route/route6-redirect b/testcases/network/stress/route/route6-redirect
new file mode 100644
index 000000000..e12c7c816
--- /dev/null
+++ b/testcases/network/stress/route/route6-redirect
@@ -0,0 +1,207 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2006 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# route6-redirect
+#
+# Description:
+# Verify the kernel is not crashed when the route is modified by
+# ICMP Redirects frequently
+#
+# Setup:
+# See testcases/network/stress/README
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# Apr 07 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=route6-redirect01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Test description
+tst_resm TINFO "Verify the kernel is not crashed when the IPv6 route is modified by ICMP Redirects frequently"
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# The number of times where route is changed
+NS_TIMES=${NS_TIMES:-10000}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+IPV6_NETWORK="fec0:1:1:1"
+
+# Netmask of for the tested network
+IPV6_NETMASK_NUM=64
+
+# Host portion of the IPv6 address
+LHOST_IPV6_HOST=":1" # src
+RHOST_IPV6_HOST=":2" # gateway
+
+# The destination network
+DST_NETWORK="fec0:100:100:100" # destination network
+DST_HOST=":5"
+DST_PORT="7"
+
+
+#-----------------------------------------------------------------------
+#
+# NAME:
+# do_cleanup
+#
+# DESCRIPTION:
+# Recover the tested interfaces
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Kill the redirector utility
+ $LTP_RSH $RHOST killall -SIGHUP ns-icmp_redirector >/dev/null 2>&1
+
+ # Initialize the interfaces
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# NAME:
+# do_setup
+#
+# DESCRIPTION:
+# Set the initial route and start icmp redirect on the remote host
+#
+# SET VALUES:
+# rhost_ipv6addr - IPv6 Address of the remote host
+# lhost_ifname - Interface name of the local host
+# rhost_ifname - Interface name of the remote host
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ # Make sure to cleanup the test environment
+ do_cleanup
+
+ # Get the Interface name of local host
+ lhost_ifname=`get_ifname lhost ${LINK_NUM}`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ # Get the Interface name of remote host
+ rhost_ifname=`get_ifname rhost ${LINK_NUM}`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the remote host"
+ exit $TST_TOTAL
+ fi
+
+ # Remove the link-local address of the remote host
+ sleep 5
+ $LTP_RSH $RHOST "ip addr flush dev $rhost_ifname" > /dev/null
+
+ # Assign IPv6 address to the interface of the local host
+ add_ipv6addr lhost ${LINK_NUM} ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to assign an IPv6 address at the local host"
+ return 1
+ fi
+
+ # Add route to the initial gateway
+ route -A inet6 add ${DST_NETWORK}::/64 gw fe80:${RHOST_IPV6_HOST} dev $lhost_ifname
+
+ # Make sure the sysctl value is set for accepting the redirect
+ sysctl -w net.ipv6.conf.${lhost_ifname}.accept_redirects=1 >/dev/null
+
+ # Run the redirector utility at the remote host
+ ret=`$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmp_redirector -I $rhost_ifname -b ; "'echo $?'`
+ if [ $ret -ne 0 ]; then
+ tst_resm TBROK "Failed to run icmp redirector at the remote host"
+ exit $TST_TOTAL
+ fi
+}
+
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION:
+# test_body
+#
+# DESCRIPTION:
+# main code of the test
+#
+# Arguments:
+# None
+#
+#-----------------------------------------------------------------------
+test_body()
+{
+ # Loop for changing the route
+ cnt=0
+ while [ $cnt -lt $NS_TIMES ]; do
+ ns-udpsender -f 6 -D ${DST_NETWORK}:${DST_HOST} -p $DST_PORT -o -s 8
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to run udp packet sender"
+ return 1
+ fi
+ cnt=`expr $cnt + 1`
+ done
+
+ tst_resm TPASS "Test is finished correctly."
+ return 0
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+# Exit Value:
+# The number of the failure
+#
+#-----------------------------------------------------------------------
+RC=0
+do_setup
+test_body || RC=`expr $RC + 1`
+do_cleanup
+
+exit $RC
diff --git a/testcases/network/stress/route/route6-rmmod b/testcases/network/stress/route/route6-rmmod
index 765a57ae6..73f26f232 100644
--- a/testcases/network/stress/route/route6-rmmod
+++ b/testcases/network/stress/route/route6-rmmod
@@ -121,9 +121,6 @@ do_setup()
exit $TST_TOTAL
fi
- # The module name of the interface at the local host
- lhost_module=
-
# Make sure to clean up
do_cleanup
diff --git a/testcases/network/tcp_cc/bbr01.sh b/testcases/network/tcp_cc/bbr01.sh
index e26abb188..a6592b32d 100755
--- a/testcases/network/tcp_cc/bbr01.sh
+++ b/testcases/network/tcp_cc/bbr01.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2018-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
TST_SETUP="setup"
TST_TESTFUNC="do_test"
@@ -27,7 +27,7 @@ setup()
do_test()
{
- tcp_cc_test01 bbr -100
+ tcp_cc_test01 bbr -50
}
tst_run
diff --git a/testcases/network/tcp_cc/bbr02.sh b/testcases/network/tcp_cc/bbr02.sh
index 714983807..b04c0c173 100755
--- a/testcases/network/tcp_cc/bbr02.sh
+++ b/testcases/network/tcp_cc/bbr02.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2018-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
TST_SETUP="setup"
TST_TESTFUNC="do_test"
@@ -34,7 +34,7 @@ setup()
do_test()
{
tcp_cc_set_qdisc $2 || return
- tcp_cc_test01 bbr -100
+ tcp_cc_test01 bbr -50
}
tst_run
diff --git a/testcases/network/tcp_cc/tcp_cc_lib.sh b/testcases/network/tcp_cc/tcp_cc_lib.sh
index dff8cef19..815cc9c0e 100755
--- a/testcases/network/tcp_cc/tcp_cc_lib.sh
+++ b/testcases/network/tcp_cc/tcp_cc_lib.sh
@@ -101,5 +101,11 @@ tcp_cc_test01()
tst_netload -H $(tst_ipaddr rhost) -A $TST_NET_MAX_PKT
local res1="$(cat tst_netload.res)"
- tst_netload_compare $res0 $res1 $threshold
+ local per=$(( $res0 * 100 / $res1 - 100 ))
+
+ if [ "$per" -lt "$threshold" ]; then
+ tst_res TFAIL "$alg performance $per %"
+ else
+ tst_res TPASS "$alg performance $per %"
+ fi
}
diff --git a/testcases/network/tcp_cmds/Makefile b/testcases/network/tcp_cmds/Makefile
index 5719b1fe3..748e02469 100644
--- a/testcases/network/tcp_cmds/Makefile
+++ b/testcases/network/tcp_cmds/Makefile
@@ -26,7 +26,7 @@ top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
ifneq ($(WITH_EXPECT),yes)
-FILTER_OUT_SUBDIRS := ftp ssh telnet
+FILTER_OUT_SUBDIRS := ftp rlogin ssh telnet
endif
INSTALL_DEPS := ../datafiles/bin.sm
diff --git a/testcases/network/tcp_cmds/host/host01.sh b/testcases/network/tcp_cmds/host/host01.sh
index 18b91027c..1308870f7 100755
--- a/testcases/network/tcp_cmds/host/host01.sh
+++ b/testcases/network/tcp_cmds/host/host01.sh
@@ -1,33 +1,87 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020
-# Copyright (c) Manoj Iyer <manjo@mail.utexas.edu> 2003
-# Copyright (c) Robbie Williamson <robbiew@us.ibm.com> 2001
-# Copyright (c) International Business Machines Corp., 2000
+#
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+# FILE : host
+#
+# PURPOSE: To test the basic functionality of the `host` command.
+#
+# SETUP: If "RHOST" is not exported, then the local hostname is used.
+#
+# HISTORY:
+# 06/06/03 Manoj Iyer manjo@mail.utexas.edu
+# - Modified to use LTP tests APIs
+# 03/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Ported
+#
+#
+#-----------------------------------------------------------------------
-TST_TESTFUNC="do_test"
-TST_NEEDS_CMDS="awk grep host hostname tail"
+do_setup()
+{
+ NUMLOOPS=${NUMLOOPS:-1}
+ SLEEPTIME=${SLEEPTIME:-0}
+
+ tst_setup
-. tst_net.sh
+ exists awk host hostname
+
+ RHOST=${RHOST:-`hostname`}
+
+}
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION: do_test
+#
+#-----------------------------------------------------------------------
do_test()
{
- local lhost="${HOSTNAME:-$(hostname)}"
- local addr
-
- tst_res TINFO "test basic functionality of the host command"
- tst_res TINFO "lhost: $lhost"
-
- if addr=$(host $lhost); then
- addr=$(echo "$addr" | grep address | tail -1 | awk '{print $NF}')
- if [ -z "$addr" ]; then
- tst_brk TFAIL "empty address"
- fi
- EXPECT_PASS host $addr \>/dev/null
- else
- tst_brk TFAIL "host $lhost on local machine failed"
- fi
+
+ tst_resm TINFO "test basic functionality of the \`$TC' command."
+
+ while [ $TST_COUNT -lt $NUMLOOPS ]; do
+
+ if rhost_addr=$(host $RHOST); then
+ rhost_addr=$(echo "$rhost_addr" | awk -F, '{print $NF}') >/dev/null 2>&1
+ if ! host $rhost_addr >/dev/null 2>&1; then
+ end_testcase "reverse lookup with host failed"
+ fi
+
+ else
+ end_testcase "host $RHOST on local machine failed"
+ fi
+
+ incr_tst_count
+ sleep $SLEEPTIME
+
+ done
+
}
-tst_run
+#-----------------------------------------------------------------------
+# FUNCTION: MAIN
+#-----------------------------------------------------------------------
+. net_cmdlib.sh
+
+read_opts $*
+do_setup
+do_test
+end_testcase
diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
index 6ad987c49..e15dd708c 100755
--- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
+++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
@@ -20,14 +20,14 @@ do_setup()
case $CMD in
ip)
SHOW_CMD="ip neigh show"
- DEL_CMD="ROD ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
+ DEL_CMD="ip neigh del $(tst_ipaddr rhost) dev $(tst_iface)"
;;
arp)
if [ -n "$TST_IPV6" ]; then
tst_brk TCONF "'arp' doesn't support IPv6"
fi
SHOW_CMD="arp -a"
- DEL_CMD="ROD arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
+ DEL_CMD="arp -d $(tst_ipaddr rhost) -i $(tst_iface)"
;;
*)
tst_brk TBROK "unknown or missing command, use -c [ arp | ip ]"
@@ -75,7 +75,7 @@ do_test()
[ "$ret" -ne 0 ] && \
tst_brk TFAIL "$entry_name entry '$(tst_ipaddr rhost)' not listed"
- $DEL_CMD
+ $DEL_CMD || tst_brk TFAIL "fail to delete entry"
$SHOW_CMD | grep -q "$(tst_ipaddr rhost).*$(tst_hwaddr rhost)" && \
tst_brk TFAIL "'$DEL_CMD' failed, entry has " \
diff --git a/testcases/network/tcp_cmds/netstat/netstat01.sh b/testcases/network/tcp_cmds/netstat/netstat01.sh
index a7c8d6112..3c2d1bb5f 100755
--- a/testcases/network/tcp_cmds/netstat/netstat01.sh
+++ b/testcases/network/tcp_cmds/netstat/netstat01.sh
@@ -1,26 +1,88 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020
-# Copyright (c) Manoj Iyer <manjo@mail.utexas.edu> 2003
-# Copyright (c) Robbie Williamson <robbiew@us.ibm.com> 2001
-# Copyright (c) International Business Machines Corp., 2000
+#***********************************************************************
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+# FILE : host
+#
+# PURPOSE: To test the basic functionality of the `netstat` command.
+#
+# HISTORY:
+# 06/06/03 Manoj Iyer manjo@mail.utexas.edu
+# - Modified test to use LTP harness API
+# - Fixed bugs.
+# 03/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Ported
+#
+#
+#-----------------------------------------------------------------------
-TST_TESTFUNC="do_test"
-TST_NEEDS_CMDS="netstat"
+do_setup()
+{
+ NUMLOOPS=${NUMLOOPS:-1}
+ SLEEPTIME=${SLEEPTIME:-0}
-. tst_net.sh
+ tst_setup
+
+ exists netstat
+}
+
+#-------------------------------------------------------------------------
+# FUNCTION: do_test
+# PURPOSE:
+# To loop for LOOPCOUNT times
+# If MAXCOUNT is "-1" the "while"
+# loop will execute until terminated by "intr" signal.
+# INPUT: None.
+# OUTPUT: Informational messages are logged into the run log.
+#
+#-----------------------------------------------------------------------
+
+do_test() {
+
+ while [ $TST_COUNT -le $NUMLOOPS ]; do
+
+ for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
+ if ! netstat $flag 1>/dev/null 2>&1; then
+ end_testcase "netstat $flag failed"
+ fi
+ done
+
+ incr_tst_count
+
+ sleep $SLEEPTIME
+
+ done
-do_test()
-{
- local flag
-
- for flag in "-s" "-rn" "-i" "-gn" "-apn"; do
- if netstat $flag 2>&1 | grep -q "invalid option"; then
- tst_res TCONF "$flag flag not supported"
- else
- EXPECT_PASS netstat $flag \>/dev/null
- fi
- done
}
-tst_run
+#-----------------------------------------------------------------------
+#
+# FUNCTION: MAIN
+# PURPOSE: To invoke functions that perform the tasks as described in
+# the design in the prolog above.
+# INPUT: See SETUP in the prolog above.
+# OUTPUT: Logged run results written to testcase run log
+#
+#-----------------------------------------------------------------------
+. net_cmdlib.sh
+
+read_opts $*
+do_setup
+do_test
+end_testcase
diff --git a/testcases/network/tcp_cmds/ping/ping02.sh b/testcases/network/tcp_cmds/ping/ping02.sh
index 07a713531..e0a63c5f6 100755
--- a/testcases/network/tcp_cmds/ping/ping02.sh
+++ b/testcases/network/tcp_cmds/ping/ping02.sh
@@ -2,15 +2,34 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2016-2019 Oracle and/or its affiliates. All Rights Reserved.
+TST_SETUP="do_setup"
TST_TESTFUNC="do_test"
TST_NEEDS_ROOT=1
. tst_net.sh
+do_setup()
+{
+ COUNT=${COUNT:-3}
+ PACKETSIZES=${PACKETSIZES:-"8 16 32 64 128 256 512 1024 2048 4064"}
+
+ PING=ping${TST_IPV6}
+
+ tst_require_cmds $PING
+}
+
do_test()
{
- tst_ping -s "${PACKETSIZES:-8 16 32 64 128 256 512 1024 2048 4064}" \
- -p "000102030405060708090a0b0c0d0e0f" -c "${COUNT:-3}"
+ local pat="000102030405060708090a0b0c0d0e0f"
+
+ tst_res TINFO "flood $PING: ICMP packets filled with pattern '$pat'"
+
+ local ipaddr=$(tst_ipaddr rhost)
+ local s
+
+ for s in $PACKETSIZES; do
+ EXPECT_PASS $PING -c $COUNT -f -s $s $ipaddr -p "$pat" \>/dev/null
+ done
}
tst_run
diff --git a/testcases/network/tcp_cmds/rcp/Makefile b/testcases/network/tcp_cmds/rcp/Makefile
new file mode 100644
index 000000000..f8131a986
--- /dev/null
+++ b/testcases/network/tcp_cmds/rcp/Makefile
@@ -0,0 +1,30 @@
+#
+# network/tcp_cmds/rcp testcases Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Ngie Cooper, September 2009
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(abs_srcdir)/../Makefile.inc
+
+INSTALL_TARGETS := rcp01.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/rcp/rcp01.sh b/testcases/network/tcp_cmds/rcp/rcp01.sh
new file mode 100755
index 000000000..4eaeca175
--- /dev/null
+++ b/testcases/network/tcp_cmds/rcp/rcp01.sh
@@ -0,0 +1,144 @@
+#!/bin/sh
+#
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+# FILE : rcp
+#
+# PURPOSE: To test the basic functionality of the `rcp` command.
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the machine
+# where the test is executed.
+#
+# HISTORY:
+# 06/06/03 Manoj Iyer manjo@mail.utexas.edu
+# - Modified testcases to use test APIS and fixed bugs
+# 03/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Ported
+#
+#
+#-----------------------------------------------------------------------
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION: do_setup
+#
+#-----------------------------------------------------------------------
+
+do_setup()
+{
+
+ TCtmp=${TCtmp:-$LTPROOT/testcases/bin/$TC${EXEC_SUFFIX}$$}
+ TCdat=${TCdat:-$LTPROOT/testcases/bin/datafiles}
+ LHOST=`hostname`
+ RHOST=${RHOST:-$LHOST}
+ SLEEPTIME=${SLEEPTIME:-0}
+ FILES=${FILES:-"bin.sm bin.med bin.lg bin.jmb"}
+
+ tst_setup
+
+ exists awk rcp rsh sum
+
+ if ! rsh -n -l root $RHOST mkdir -p $TCtmp >/dev/null 2>&1; then
+ end_testcase "Remote mkdir failed"
+ fi
+
+ trap do_cleanup EXIT
+
+}
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION: do_test
+#
+#-----------------------------------------------------------------------
+
+do_test()
+{
+
+ for j in $FILES; do
+
+ if ! rcp $TCdat/$j $RHOST:$TCtmp/$j; then
+ end_testcase "Failed to rcp file."
+ fi
+
+ SUM1=`sum $TCdat/$j | awk '{print $1}'`
+ SUM2=`rsh -n -l root $RHOST sum $TCtmp/$j | awk '{print $1}'`
+ rsh -n -l root $RHOST "rm -f $TCtmp/$j"
+ sleep $SLEEPTIME
+
+ if [ "$SUM1" = "$SUM2" ]; then
+ tst_resm TINFO "rcp $TCdat/$j $RHOST:$TCtmp/$j successful"
+ else
+ end_testcase "FAILED: wrong sum in transfer to $RHOST"
+ fi
+
+ sleep $SLEEPTIME
+
+ done
+
+ for j in $FILES; do
+
+ tst_resm TINFO "remote copying $RHOST:$TCdat/$j to $TCtmp/$j"
+ if ! rcp $RHOST:$TCdat/$j $TCtmp/$j >/dev/null 2>&1; then
+ tst_resm TFAIL "Failed to rcp file."; continue
+ fi
+
+ SUM1=`sum $TCtmp/$j | awk '{print $1}'`
+ SUM2=`rsh -n -l root $RHOST sum $TCdat/$j | awk '{print $1}'`
+ rm -f $TCtmp/$j
+ sleep $SLEEPTIME
+
+ if [ "$SUM1" = "$SUM2" ]; then
+ tst_resm TINFO "rcp $RHOST:$TCdat/$j $TCtmp/$j successful"
+ else
+ end_testcase "FAILED: wrong sum in transfer to $LHOST from $RHOST"
+ fi
+ sleep $SLEEPTIME
+
+ done
+
+}
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION: do_cleanup
+#
+#-----------------------------------------------------------------------
+
+do_cleanup()
+{
+ rsh -n -l root $RHOST rmdir $TCtmp
+ tst_cleanup
+}
+
+#----------------------------------------------------------------------
+# FUNCTION: MAIN
+# PURPOSE: To invoke the functions to perform the tasks described in
+# the prologue.
+# INPUT: None.
+# OUTPUT: A testcase run log with the results of the execution of this
+# test.
+#----------------------------------------------------------------------
+. net_cmdlib.sh
+
+read_opts $*
+do_setup
+do_test
+end_testcase
diff --git a/testcases/network/tcp_cmds/rlogin/Makefile b/testcases/network/tcp_cmds/rlogin/Makefile
new file mode 100644
index 000000000..1e8d10ea4
--- /dev/null
+++ b/testcases/network/tcp_cmds/rlogin/Makefile
@@ -0,0 +1,31 @@
+#
+# network/tcp_cmds/rlogin testcases Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Ngie Cooper, July 2009
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := rlogin01.sh
+
+MAKE_TARGETS :=
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/rlogin/rlogin01.sh b/testcases/network/tcp_cmds/rlogin/rlogin01.sh
new file mode 100755
index 000000000..c34ab1c4e
--- /dev/null
+++ b/testcases/network/tcp_cmds/rlogin/rlogin01.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# 03/01 Robbie Williamson (robbiew@us.ibm.com)
+
+TCID="rlogin01"
+TST_TOTAL=1
+
+TST_USE_LEGACY_API=1
+. tst_net.sh
+
+setup()
+{
+ tst_require_cmds rlogin expect
+
+ if [ -z $RUSER ]; then
+ RUSER=root
+ fi
+
+ if [ -z $PASSWD ]; then
+ tst_brkm TCONF "Please set PASSWD for $RUSER."
+ fi
+
+ if [ -z $RHOST ]; then
+ tst_brkm TCONF "Please set RHOST."
+ fi
+
+ if [ -z $LOOPCOUNT ]; then
+ LOOPCOUNT=25
+ fi
+}
+
+do_test()
+{
+ tst_resm TINFO "Starting"
+
+ for i in $(seq 1 ${LOOPCOUNT})
+ do
+ rlogin_test || return 1
+ done
+}
+
+rlogin_test()
+{
+ tst_resm TINFO "login with rlogin($i/$LOOPCOUNT)"
+
+ expect -c "
+ spawn rlogin $RHOST -l $RUSER
+
+ expect {
+ \"Password:\" {
+ send \"$PASSWD\r\"; exp_continue
+ } \"incorrect\" {
+ exit 1
+ } \"$RUSER@\" {
+ send \"LC_ALL=C; ls -l /etc/hosts | \\
+ wc -w > $RUSER.$RHOST\rexit\r\";
+ exp_continue
+ }
+ }
+ " > /dev/null || return 1
+
+ tst_resm TINFO "checking rlogin status($i/$LOOPCOUNT)"
+ tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$RHOST" || return 1
+ tst_rhost_run -u $RUSER -c "rm -f $RUSER.$RHOST"
+}
+
+setup
+
+do_test
+if [ $? -ne 0 ]; then
+ tst_resm TFAIL "Test $TCID failed."
+else
+ tst_resm TPASS "Test $TCID succeeded."
+fi
+
+tst_exit
diff --git a/testcases/network/tcp_cmds/rsh/Makefile b/testcases/network/tcp_cmds/rsh/Makefile
new file mode 100644
index 000000000..00ae49d8b
--- /dev/null
+++ b/testcases/network/tcp_cmds/rsh/Makefile
@@ -0,0 +1,31 @@
+#
+# network/tcp_cmds/rsh testcases Makefile.
+#
+# Copyright (C) 2009, Cisco Systems Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Ngie Cooper, July 2009
+#
+
+top_srcdir ?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := rsh01.sh
+
+MAKE_TARGETS :=
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/rsh/rsh01.sh b/testcases/network/tcp_cmds/rsh/rsh01.sh
new file mode 100755
index 000000000..3968f9056
--- /dev/null
+++ b/testcases/network/tcp_cmds/rsh/rsh01.sh
@@ -0,0 +1,115 @@
+#!/bin/sh
+#
+# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+# FILE : rsh
+#
+# PURPOSE: To test the basic functionality of the `rsh` command.
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the machine
+# where the test is executed.
+#
+# HISTORY:
+# 03/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Ported
+#
+#
+#
+#----------------------------------------------------------------------
+
+do_setup()
+{
+
+ FAIL_IMMEDIATELY=${FAIL_IMMEDIATELY:-1}
+ SLEEPTIME=${SLEEPTIME:-0}
+ NUMLOOPS=${NUMLOOPS:-1}
+
+ export TST_TOTAL=$NUMLOOPS
+
+ tst_setup
+
+ exists awk hostname rsh
+
+ RHOST=${RHOST:-`hostname`}
+
+}
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION: do_test
+#
+#-----------------------------------------------------------------------
+
+do_test()
+{
+
+ while [ $TST_COUNT -le $NUMLOOPS ]; do
+
+ PASSED=0
+
+ if OUT=$(rsh -n -l root $RHOST 'ls -l /etc/hosts'); then
+
+ #
+ # Successful output would be something of the form:
+ #
+ # gcooper@orangebox ~ $ ls -l /etc/hosts
+ # -rw-r--r-- 1 root root 463 Jul 5 09:26 /etc/hosts
+ #
+ echo "$OUT" |
+ awk 'BEGIN { RET=1 } NF == 9 && $NF == "/etc/hosts" { RET=0 } END { exit RET }' \
+ > /dev/null 2>&1
+
+ if [ $? -eq 0 ] ; then
+ tst_resm TPASS "rsh to $RHOST test succeeded"
+ PASSED=1
+ fi
+
+ fi
+
+ if [ $PASSED -ne 1 ] ; then
+ tst_resm TFAIL "rsh to $RHOST failed"
+ # If the first rsh failed, the likelihood that the rest will
+ # succeed is low.
+ if [ "$FAIL_IMMEDIATELY" = "1" ] && [ $TST_COUNT -eq 1 ]; then
+ exit 2
+ fi
+ fi
+
+ sleep $SLEEPTIME
+ incr_tst_count
+
+ done
+
+}
+
+#----------------------------------------------------------------------
+# FUNCTION: MAIN
+# PURPOSE: To invoke the functions to perform the tasks described in
+# the prologue.
+# INPUT: None.
+# OUTPUT: A testcase run log with the results of the execution of this
+# test.
+#----------------------------------------------------------------------
+. net_cmdlib.sh
+
+read_opts $*
+do_setup
+do_test
+end_testcase
diff --git a/testcases/network/tcp_cmds/sendfile/sendfile01.sh b/testcases/network/tcp_cmds/sendfile/sendfile01.sh
index 7104de7aa..1e4739ad2 100755
--- a/testcases/network/tcp_cmds/sendfile/sendfile01.sh
+++ b/testcases/network/tcp_cmds/sendfile/sendfile01.sh
@@ -1,53 +1,111 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) Linux Test Project, 2001-2013
-# Copyright (c) Manoj Iyer <manjo@mail.utexas.edu> 2003
-# Copyright (c) Robbie Williamson <robbiew@us.ibm.com> 2002-2003
# Copyright (c) International Business Machines Corp., 2000
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# PURPOSE: Copy files from server to client using the sendfile()
+# function.
+#
+#
+# SETUP: The home directory of root on the machine exported as "RHOST"
+# MUST have a ".rhosts" file with the hostname of the client
+# machine, where the test is executed.
+#
+# HISTORY:
+# 06/09/2003 Manoj Iyer manjo@mail.utexas.edu
+# - Modified to use LTP APIs, and added check to if commands used in test
+# exists.
+# 03/01 Robbie Williamson (robbiew@us.ibm.com)
+# -Ported
+#
+#
+#***********************************************************************
-TST_SETUP=do_setup
+TST_TOTAL=1
+TCID="sendfile01"
TST_CLEANUP=do_cleanup
-TST_TESTFUNC=do_test
-TST_NEEDS_TMPDIR=1
-TST_NEEDS_CMDS="diff ss stat"
-. tst_net.sh
do_setup()
{
+ TCdat=${TCdat:-$LTPROOT/testcases/bin/datafiles}
- tst_res TINFO "copy files from server to client using the sendfile() on IPv$TST_IPVER"
+ CLIENT="testsf_c${TST_IPV6}"
+ SERVER="testsf_s${TST_IPV6}"
- client="testsf_c${TST_IPV6}"
- server="testsf_s${TST_IPV6}"
+ FILES=${FILES:-"ascii.sm ascii.med ascii.lg ascii.jmb"}
- port=$(tst_rhost_run -s -c "tst_get_unused_port ipv$TST_IPVER stream")
- [ -z "$port" ] && tst_brk TBROK "failed to get unused port"
+ tst_require_cmds diff stat
- tst_rhost_run -s -b -c "$server $(tst_ipaddr rhost) $port"
- server_started=1
- tst_res TINFO "wait for the server to start"
- TST_RETRY_FUNC "tst_rhost_run -c 'ss -ltp' | grep -q '$port.*testsf'" 0
+ tst_tmpdir
}
do_test()
{
- local file lfile size
+ tst_resm TINFO "Doing $0."
+
+ local ipv="ipv${TST_IPV6:-"4"}"
+ local ipaddr=$(tst_ipaddr rhost)
+ local port=$(tst_rhost_run -s -c "tst_get_unused_port $ipv stream")
+ [ -z "$port" ] && tst_brkm TBROK "failed to get unused port"
+
+ tst_rhost_run -s -b -c "$SERVER $ipaddr $port"
+ server_started=1
+ sleep 10
+
+ for clnt_fname in $FILES; do
+ serv_fname=${TCdat}/$clnt_fname
+ local size=$(stat -c '%s' $serv_fname)
- for file in $(ls $TST_NET_DATAROOT/ascii.*); do
- lfile="$(basename $file)"
- size=$(stat -c '%s' $file)
- tst_res TINFO "test IP: $(tst_ipaddr rhost), port: $port, file: $lfile"
+ tst_resm TINFO \
+ "$CLIENT ip '$ipaddr' port '$port' file '$clnt_fname'"
- ROD $client $(tst_ipaddr rhost) $port $lfile $file $size \> /dev/null
- EXPECT_PASS diff $file $lfile
+ $CLIENT $ipaddr $port $clnt_fname $serv_fname $size >\
+ /dev/null 2>&1
+
+ local ret=$?
+ if [ $ret -ne 0 ]; then
+ tst_resm TFAIL "$CLIENT returned error '$ret'"
+ return;
+ fi
+
+ diff $serv_fname $clnt_fname > /dev/null 2>&1
+ local diff_res=$?
+ if [ $diff_res -gt 1 ]; then
+ tst_resm TFAIL "ERROR: Cannot compare files"
+ return
+ fi
+
+ if [ $diff_res -eq 1 ]; then
+ tst_resm TFAIL "The file copied differs from the original"
+ return
+ fi
done
+ tst_resm TPASS "test finished successfully"
}
do_cleanup()
{
- [ -n "$server_started" ] && tst_rhost_run -c "pkill $server"
+ [ -n "$server_started" ] && tst_rhost_run -s -c "pkill $SERVER"
+ tst_rmdir
}
-tst_run
+TST_USE_LEGACY_API=1
+. tst_net.sh
+
+do_setup
+do_test
+
+tst_exit
diff --git a/testcases/network/tcp_cmds/sendfile/testsf_s.c b/testcases/network/tcp_cmds/sendfile/testsf_s.c
index 817ddb2b0..bce8dd1e3 100644
--- a/testcases/network/tcp_cmds/sendfile/testsf_s.c
+++ b/testcases/network/tcp_cmds/sendfile/testsf_s.c
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
/* open socket */
if ((s = socket(AFI, SOCK_STREAM, 0)) < 0) {
- tst_brkm(TBROK, NULL, "socket error = %d", errno);
+ tst_brkm(TBROK, NULL, "socket error = %d\n", errno);
}
signal(SIGCHLD, SIG_IGN); /* ignore signals from children */
@@ -74,14 +74,14 @@ int main(int argc, char *argv[])
/* bind IP and port to socket */
if (bind(s, (sa_t *) & sa, sizeof(sa)) < 0) {
- tst_resm(TBROK, "bind error = %d", errno);
+ tst_resm(TBROK, "bind error = %d\n", errno);
close(s);
tst_exit();
}
/* start to listen socket */
if (listen(s, LISTEN_BACKLOG) < 0) {
- tst_resm(TBROK, "listen error = %d", errno);
+ tst_resm(TBROK, "listen error = %d\n", errno);
close(s);
tst_exit();
}
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
/* accept a connection from a client */
if ((as = accept(s, &from, &fromlen)) < 0) {
- tst_resm(TBROK, "accept error = %d", errno);
+ tst_resm(TBROK, "accept error = %d\n", errno);
if (errno == EINTR)
continue;
close(s);
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
/* create a process to manage the connection */
if ((pid = fork()) < 0) {
- tst_resm(TBROK, "fork error = %d", errno);
+ tst_resm(TBROK, "fork error = %d\n", errno);
close(as);
tst_exit();
}
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
/* get client request information */
if ((nbytes = read(as, rbuf, PATH_MAX)) <= 0) {
- tst_resm(TBROK, "socket read error = %d", errno);
+ tst_resm(TBROK, "socket read error = %d\n", errno);
close(as);
tst_exit();
}
@@ -140,10 +140,10 @@ int main(int argc, char *argv[])
/* the file name */
lp++;
- tst_resm(TINFO, "The file to send is %s", lp);
+ tst_resm(TINFO, "The file to send is %s\n", lp);
/* open requested file to send */
if ((fd = open(lp, O_RDONLY)) < 0) {
- tst_resm(TBROK, "file open error = %d", errno);
+ tst_resm(TBROK, "file open error = %d\n", errno);
close(as);
tst_exit();
}
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
if ((rc = sendfile(as, fd, offset, flen)) != flen) {
if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
tst_resm(TBROK,
- "sendfile error = %d, rc = %d",
+ "sendfile error = %d, rc = %d\n",
errno, rc);
close(as);
close(fd);
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
}
chunks++;
} while (rc != 0);
- tst_resm(TINFO, "File %s sent in %d parts", lp, chunks);
+ tst_resm(TINFO, "File %s sent in %d parts\n", lp, chunks);
close(as); /* close connection */
close(fd); /* close requested file */
diff --git a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh
index 0e59ed506..a4b542220 100755
--- a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh
+++ b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh
@@ -11,7 +11,6 @@ TST_MIN_KVER="3.7"
TST_NEEDS_TMPDIR=1
TST_NEEDS_ROOT=1
TST_NEEDS_CMDS="tc"
-TST_NEEDS_DRIVERS="sch_netem"
TST_OPTS="R:"
TST_USAGE=tcp_fastopen_usage
TST_PARSE_ARGS=tcp_fastopen_parse_args
@@ -37,6 +36,17 @@ cleanup()
tc qdisc del dev $(tst_iface) root netem delay 100 >/dev/null
}
+compare()
+{
+ tfo_cmp=$(( 100 - ($time_tfo_on * 100) / $time_tfo_off ))
+
+ if [ "$tfo_cmp" -lt 3 ]; then
+ tst_res TFAIL "$1 perf result is '$tfo_cmp' percent"
+ else
+ tst_res TPASS "$1 perf result is '$tfo_cmp' percent"
+ fi
+}
+
setup()
{
if tst_kvcmp -lt "3.16" && [ "$TST_IPV6" ]; then
@@ -56,7 +66,7 @@ test1()
tst_netload -H $(tst_ipaddr rhost) -f -t 3 -R $srv_replies
time_tfo_on=$(cat tst_netload.res)
- tst_netload_compare $time_tfo_off $time_tfo_on 3
+ compare
}
test2()
@@ -68,7 +78,7 @@ test2()
tst_netload -H $(tst_ipaddr rhost) -F -t 3 -R $srv_replies
time_tfo_on=$(cat tst_netload.res)
- tst_netload_compare $time_tfo_off $time_tfo_on 3
+ compare
}
tst_run
diff --git a/testcases/network/traceroute/traceroute01.sh b/testcases/network/traceroute/traceroute01.sh
index 0140aef9a..821853f0e 100755
--- a/testcases/network/traceroute/traceroute01.sh
+++ b/testcases/network/traceroute/traceroute01.sh
@@ -13,12 +13,9 @@ TST_NEEDS_TMPDIR=1
setup()
{
-
- TRACEROUTE=traceroute${TST_IPV6}
- tst_require_cmds $TRACEROUTE
-
- tst_res TINFO "$TRACEROUTE version:"
- tst_res TINFO $($TRACEROUTE -V 2>&1)
+ tst_res TINFO "traceroute version:"
+ tst_res TINFO $(traceroute --version 2>&1)
+ [ "$TST_IPV6" ] && tst_res TINFO "NOTE: tracepath6 from iputils is not supported"
}
run_trace()
@@ -27,23 +24,18 @@ run_trace()
local ip=$(tst_ipaddr rhost)
local pattern="^[ ]+1[ ]+$ip([ ]+[0-9]+[.][0-9]+ ms){3}"
- if $TRACEROUTE $opts 2>&1 | grep -q "invalid option"; then
- tst_res TCONF "$opts flag not supported"
- return
- fi
-
# According to man pages, default sizes:
local bytes=60
[ "$TST_IPV6" ] && bytes=80
- EXPECT_PASS $TRACEROUTE $ip $bytes -n -m 2 $opts \>out.log
+ EXPECT_PASS traceroute $ip $bytes -n -m 2 $opts \>out.log 2>&1
grep -q "$bytes byte" out.log
if [ $? -ne 0 ]; then
cat out.log
tst_res TFAIL "'$bytes byte' not found"
else
- tst_res TPASS "$TRACEROUTE use $bytes bytes"
+ tst_res TPASS "traceroute use $bytes bytes"
fi
tail -1 out.log | grep -qE "$pattern"
@@ -51,19 +43,19 @@ run_trace()
cat out.log
tst_res TFAIL "pattern '$pattern' not found in log"
else
- tst_res TPASS "$TRACEROUTE test completed with 1 hop"
+ tst_res TPASS "traceroute test completed with 1 hop"
fi
}
test1()
{
- tst_res TINFO "run $TRACEROUTE with ICMP ECHO"
+ tst_res TINFO "run traceroute with ICMP ECHO"
run_trace -I
}
test2()
{
- tst_res TINFO "run $TRACEROUTE with TCP SYN"
+ tst_res TINFO "run traceroute with TCP SYN"
run_trace -T
}
diff --git a/testcases/network/virt/fou01.sh b/testcases/network/virt/fou01.sh
deleted file mode 100755
index 903cb38f6..000000000
--- a/testcases/network/virt/fou01.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2021 Oracle and/or its affiliates. All Rights Reserved.
-
-TST_TESTFUNC=virt_netperf_rand_sizes
-TST_SETUP=do_setup
-TST_CLEANUP=do_cleanup
-TST_NEEDS_TMPDIR=1
-TST_OPTS="t:"
-TST_PARSE_ARGS="parse_args"
-
-virt_type="fou"
-. virt_lib.sh
-
-GRE_IP_PROTO=47
-
-parse_args()
-{
- case $1 in
- t) virt_type="$2";;
- esac
-}
-
-do_cleanup()
-{
- if [ "$FOU_PORT" ]; then
- tst_net_run -l $FOU_PORT -r $FOU_PORT_RMT \
- "ip fou del $FOU_PROTO ${TST_IPV6_FLAG} port"
- fi
-
- virt_cleanup_rmt
- virt_cleanup
-}
-
-do_setup()
-{
- local get_port_cmd="tst_get_unused_port ipv${TST_IPVER} dgram"
- local encap_cmd="encap $virt_type encap-sport auto encap-dport"
- local loc_ip=$(tst_ipaddr)
- local rmt_ip=$(tst_ipaddr rhost)
- local fou="fou$TST_IPV6"
-
- case $virt_type in
- fou) FOU_PROTO="ipproto $GRE_IP_PROTO";;
- gue) FOU_PROTO="gue";;
- esac
-
- tst_require_drivers $fou
- tst_net_run -s modprobe $fou
-
- FOU_PORT=$($get_port_cmd)
- FOU_PORT_RMT=$(tst_rhost_run -c "$get_port_cmd")
-
- tst_net_run -s -l $FOU_PORT -r $FOU_PORT_RMT \
- "ip fou add $FOU_PROTO ${TST_IPV6_FLAG} port"
-
- virt_setup "local $loc_ip remote $rmt_ip $encap_cmd $FOU_PORT_RMT" \
- "local $rmt_ip remote $loc_ip $encap_cmd $FOU_PORT"
-}
-
-tst_run
diff --git a/testcases/network/virt/geneve01.sh b/testcases/network/virt/geneve01.sh
index b731343c8..9a746d5df 100755
--- a/testcases/network/virt/geneve01.sh
+++ b/testcases/network/virt/geneve01.sh
@@ -23,6 +23,10 @@ VIRT_PERF_THRESHOLD_MIN=160
do_test()
{
+ if [ -z $ip_local -o -z $ip_remote ]; then
+ tst_brk TBROK "you must specify IP address"
+ fi
+
tst_res TINFO "the same VNI must work"
# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE" "id 0xFFFFFE"
diff --git a/testcases/network/virt/sit01.sh b/testcases/network/virt/sit01.sh
index 27fa0ee77..4ecc1f8c0 100755
--- a/testcases/network/virt/sit01.sh
+++ b/testcases/network/virt/sit01.sh
@@ -11,7 +11,7 @@ virt_type="sit"
do_setup()
{
- [ -n "$TST_IPV6" ] && tst_brk TBROK "invalid option '-6' for sit tunnel"
+ [ -n "$TST_IPV6" ] && tst_res TBROK "invalid option '-6' for sit tunnel"
virt_lib_setup
diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
index f511d3f92..f488932ff 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2018-2019 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) 2014-2021 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
#
# VxLAN
@@ -61,9 +61,11 @@ virt_lib_setup()
TST_NEEDS_ROOT=1
. tst_net.sh
+ip_local=$(tst_ipaddr)
ip_virt_local="$(TST_IPV6= tst_ipaddr_un)"
ip6_virt_local="$(TST_IPV6=6 tst_ipaddr_un)"
+ip_remote=$(tst_ipaddr rhost)
ip_virt_remote="$(TST_IPV6= tst_ipaddr_un rhost)"
ip6_virt_remote="$(TST_IPV6=6 tst_ipaddr_un rhost)"
@@ -99,19 +101,6 @@ virt_cleanup()
virt_cleanup_rmt
}
-_get_gue_fou_tnl()
-{
- local enc_type="$1"
- local tnl=sit
-
- if [ "$enc_type" = "gue" ]; then
- [ -n "$TST_IPV6" ] && tnl="ip6tnl"
- else
- [ -n "$TST_IPV6" ] && tnl="ip6gre" || tnl="gre"
- fi
- echo "$tnl"
-}
-
virt_add()
{
local vname=$1
@@ -131,21 +120,18 @@ virt_add()
[ -z "$opt" ] && \
opt="remote $(tst_ipaddr rhost) dev $(tst_iface)"
;;
- sit|gue|fou)
+ sit)
[ -z "$opt" ] && opt="remote $(tst_ipaddr rhost) local $(tst_ipaddr)"
;;
esac
case $virt_type in
- vxlan|geneve|sit|wireguard)
+ vxlan|geneve|sit)
ip li add $vname type $virt_type $opt
;;
gre|ip6gre)
ip -f inet$TST_IPV6 tu add $vname mode $virt_type $opt
;;
- gue|fou)
- ip link add name $vname type $(_get_gue_fou_tnl $virt_type) $opt
- ;;
*)
ip li add link $(tst_iface) $vname type $virt_type $opt
;;
@@ -161,17 +147,13 @@ virt_add_rhost()
[ "$vxlan_dstport" -eq 1 ] && opt="$opt dstport 0"
tst_rhost_run -s -c "ip li add ltp_v0 type $virt_type $@ $opt"
;;
- sit|wireguard)
+ sit)
tst_rhost_run -s -c "ip link add ltp_v0 type $virt_type $@"
;;
gre|ip6gre)
tst_rhost_run -s -c "ip -f inet$TST_IPV6 tu add ltp_v0 \
mode $virt_type $@"
;;
- gue|fou)
- tst_rhost_run -s -c "ip link add name ltp_v0 \
- type $(_get_gue_fou_tnl $virt_type) $@"
- ;;
*)
tst_rhost_run -s -c "ip li add link $(tst_iface rhost) ltp_v0 \
type $virt_type $@"
@@ -249,13 +231,10 @@ virt_minimize_timeout()
local mac_loc="$(cat /sys/class/net/ltp_v0/address)"
local mac_rmt="$(tst_rhost_run -c 'cat /sys/class/net/ltp_v0/address')"
- if [ "$mac_loc" ]; then
- ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
- $mac_rmt nud permanent dev ltp_v0"
- tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
- $mac_loc nud permanent dev ltp_v0"
- fi
-
+ ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
+ $mac_rmt nud permanent dev ltp_v0"
+ tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
+ $mac_loc nud permanent dev ltp_v0"
virt_tcp_syn=$(sysctl -n net.ipv4.tcp_syn_retries)
ROD sysctl -q net.ipv4.tcp_syn_retries=1
}
@@ -313,13 +292,30 @@ virt_compare_netperf()
local vt="$(cat res_ipv4)"
local vt6="$(cat res_ipv6)"
- tst_netload -H $(tst_ipaddr rhost) $opts -d res_lan
+ tst_netload -H $ip_remote $opts -d res_ipv4
+
+ local lt="$(cat res_ipv4)"
+ tst_res TINFO "time lan($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
- local lt="$(cat res_lan)"
- tst_res TINFO "time lan IPv${TST_IPVER}($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
+ per=$(( $vt * 100 / $lt - 100 ))
+ per6=$(( $vt6 * 100 / $lt - 100 ))
- tst_netload_compare $lt $vt "-$VIRT_PERF_THRESHOLD"
- tst_netload_compare $lt $vt6 "-$VIRT_PERF_THRESHOLD"
+ case "$virt_type" in
+ vxlan|geneve)
+ tst_res TINFO "IP4 $virt_type over IP$TST_IPVER slower by $per %"
+ tst_res TINFO "IP6 $virt_type over IP$TST_IPVER slower by $per6 %"
+ ;;
+ *)
+ tst_res TINFO "IP4 $virt_type slower by $per %"
+ tst_res TINFO "IP6 $virt_type slower by $per6 %"
+ esac
+
+ if [ "$per" -ge "$VIRT_PERF_THRESHOLD" -o \
+ "$per6" -ge "$VIRT_PERF_THRESHOLD" ]; then
+ tst_res TFAIL "Test failed, threshold: $VIRT_PERF_THRESHOLD %"
+ else
+ tst_res TPASS "Test passed, threshold: $VIRT_PERF_THRESHOLD %"
+ fi
}
virt_check_cmd()
@@ -380,6 +376,10 @@ virt_gre_setup()
[ "$TST_IPV6" ] && virt_type="ip6gre"
virt_lib_setup
+ if [ -z $ip_local -o -z $ip_remote ]; then
+ tst_brk TBROK "you must specify IP address"
+ fi
+
tst_res TINFO "test $virt_type"
virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost) dev $(tst_iface)" \
"local $(tst_ipaddr rhost) remote $(tst_ipaddr) dev $(tst_iface rhost)"
diff --git a/testcases/network/virt/vlan03.sh b/testcases/network/virt/vlan03.sh
index b7125ae7a..adadd76fd 100755
--- a/testcases/network/virt/vlan03.sh
+++ b/testcases/network/virt/vlan03.sh
@@ -24,10 +24,18 @@ TST_NEEDS_TMPDIR=1
TST_TEST_DATA=",$p0 $lb0 $rh1,$p1 $lb1 $rh1"
TST_TEST_DATA_IFS=","
TST_TESTFUNC=do_test
-TST_SETUP=virt_lib_setup
+TST_SETUP=do_setup
TST_CLEANUP=virt_cleanup
. virt_lib.sh
+do_setup()
+{
+ if [ -z $ip_local -o -z $ip_remote ]; then
+ tst_brk TBROK "you must specify IP address"
+ fi
+ virt_lib_setup
+}
+
do_test()
{
virt_check_cmd virt_add ltp_v0 id 0 $2 || return
diff --git a/testcases/network/virt/vxlan03.sh b/testcases/network/virt/vxlan03.sh
index 7e5453222..9ca303930 100755
--- a/testcases/network/virt/vxlan03.sh
+++ b/testcases/network/virt/vxlan03.sh
@@ -36,7 +36,11 @@ VIRT_PERF_THRESHOLD_MIN=160
do_test()
{
- virt_check_cmd virt_add ltp_v0 id 0 $2 || return
+ if [ -z $ip_local -o -z $ip_remote ]; then
+ tst_brk TBROK "you must specify IP address"
+ fi
+
+ virt_check_cmd virt_add ltp_v0 id 0 $2 || continue
tst_res TINFO "the same VNI must work"
# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
diff --git a/testcases/network/virt/vxlan04.sh b/testcases/network/virt/vxlan04.sh
index 2418e5edd..0351ea80f 100755
--- a/testcases/network/virt/vxlan04.sh
+++ b/testcases/network/virt/vxlan04.sh
@@ -20,7 +20,11 @@ VIRT_PERF_THRESHOLD_MIN=160
do_test()
{
- virt_check_cmd virt_add ltp_v0 id 0 $2 || return
+ if [ -z $ip_local -o -z $ip_remote ]; then
+ tst_brk TBROK "you must specify IP address"
+ fi
+
+ virt_check_cmd virt_add ltp_v0 id 0 $2 || continue
tst_res TINFO "the same VNI must work"
# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
diff --git a/testcases/network/virt/wireguard01.sh b/testcases/network/virt/wireguard01.sh
deleted file mode 100755
index ff0c7e92b..000000000
--- a/testcases/network/virt/wireguard01.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Oracle and/or its affiliates. All Rights Reserved.
-
-TST_NEEDS_CMDS="tc"
-TST_SETUP=setup
-TST_CLEANUP=cleanup
-TST_TESTFUNC=test
-TST_CNT=3
-
-. wireguard_lib.sh
-
-setup()
-{
- if [ -n "$LTP_NETNS" -a "$VIRT_PERF_THRESHOLD" -lt 700 ]; then
- tst_res TINFO "Adjust threshold for veth (no encap/encrypt)"
- VIRT_PERF_THRESHOLD=700
- fi
-
- local netem_opt="reorder 30% 50% delay 1"
- tst_res TINFO "Use netem $netem_opt"
- ROD tc qdisc add dev $(tst_iface) root netem $netem_opt
- wireguard_lib_setup
-}
-
-cleanup()
-{
- tc qdisc del dev $(tst_iface) root netem >/dev/null 2>&1
- wireguard_lib_cleanup
-}
-
-test1()
-{
- tst_res TINFO "Using correct wireguard configuration"
- virt_netperf_msg_sizes
- wireguard_lib_cleanup
-}
-
-test2()
-{
- tst_res TINFO "Invalid configuration with allowed IPs"
- wireguard_lib_setup invalid_allowed_ips
- virt_minimize_timeout
- virt_compare_netperf "fail"
- wireguard_lib_cleanup
-}
-
-test3()
-{
- tst_res TINFO "Invalid configuration with public keys"
- wireguard_lib_setup invalid_pub_keys
- virt_minimize_timeout
- virt_compare_netperf "fail"
-}
-
-tst_run
diff --git a/testcases/network/virt/wireguard02.sh b/testcases/network/virt/wireguard02.sh
deleted file mode 100755
index c16ae68d1..000000000
--- a/testcases/network/virt/wireguard02.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Oracle and/or its affiliates. All Rights Reserved.
-
-TST_CLEANUP=cleanup
-TST_TESTFUNC=test1
-TST_SETUP=wireguard_lib_setup
-
-. ipsec_lib.sh
-. wireguard_lib.sh
-
-IPSEC_MODE="tunnel"
-IPSEC_PROTO="esp_aead"
-AEALGO="rfc4106_256"
-EALGO="aes"
-AALGO="sha256"
-
-cleanup()
-{
- wireguard_lib_cleanup
- tst_ipsec_cleanup
-}
-
-test1()
-{
- local wgaddr
- local clients_num="$TST_NETLOAD_CLN_NUMBER"
-
- # Enforce multi-threading test, at least with 10 TCP clients
- [ $clients_num -lt 10 ] && clients_num=10
-
- tst_res TINFO "test wireguard"
-
- [ -n "$TST_IPV6" ] && wgaddr="$ip6_virt_remote" || wgaddr="$ip_virt_remote"
- tst_netload -H $wgaddr -a $clients_num -D ltp_v0
- local time_wg=$(cat tst_netload.res)
- wireguard_lib_cleanup
-
- tst_res TINFO "test IPSec $IPSEC_MODE/$IPSEC_PROTO $EALGO"
- tst_ipsec_setup_vti
- tst_netload -H $ip_rmt_tun -a $clients_num -D $tst_vti
- local time_ipsec=$(cat tst_netload.res)
- tst_ipsec_cleanup
-
- tst_netload_compare $time_ipsec $time_wg -100
-}
-
-tst_run
diff --git a/testcases/network/virt/wireguard_lib.sh b/testcases/network/virt/wireguard_lib.sh
deleted file mode 100755
index 2e36bce30..000000000
--- a/testcases/network/virt/wireguard_lib.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Oracle and/or its affiliates. All Rights Reserved.
-
-TST_NEEDS_TMPDIR=1
-TST_NEEDS_CMDS="$TST_NEEDS_CMDS wg"
-TST_TESTFUNC=${TST_TESTFUNC:-virt_netperf_msg_sizes}
-TST_SETUP=${TST_SETUP:-wireguard_lib_setup}
-TST_CLEANUP=${TST_CLEANUP:-wireguard_lib_cleanup}
-TST_NEEDS_DRIVERS="wireguard"
-VIRT_PERF_THRESHOLD_MIN=${VIRT_PERF_THRESHOLD_MIN:-200}
-
-virt_type="wireguard"
-. virt_lib.sh
-
-# Usage: wireguard_lib_setup [TYPE]
-# TYPE: [ default | invalid_allowed_ips | invalid_pub_keys ]
-wireguard_lib_setup()
-{
- local type="${1:-default}"
- local pub_key0="$(wg genkey | tee wg0.key | wg pubkey)"
- local pub_key1="$(wg genkey | tee wg1.key | wg pubkey)"
-
- local port_loc="$(tst_get_unused_port ipv${TST_IPVER} dgram)"
- local port_rmt=$(tst_rhost_run -c "tst_get_unused_port ipv${TST_IPVER} dgram")
-
- # copy private key to remote host
- tst_rhost_run -s -c "echo '$(cat wg1.key)' > wg1.key"
-
- tst_res TINFO "setup wireguard UDPv${TST_IPVER} tunnel, port $port_loc/$port_rmt"
- tst_res TINFO "lhost[$(tst_ipaddr)] <-> rhost[$(tst_ipaddr rhost)]"
-
- virt_setup
-
- local ka_opt="persistent-keepalive 1"
- local allow_ip_loc="${ip_virt_local}/32,${ip6_virt_local}/128"
- local allow_ip_rmt="${ip_virt_remote}/32,${ip6_virt_remote}/128"
-
- case $type in
- invalid_allowed_ips)
- allow_ip_loc="${ip_virt_remote}/32,${ip6_virt_remote}/128"
- allow_ip_rmt="${ip_virt_local}/32,${ip6_virt_local}/128"
- tst_res TINFO "Allowed IPs are source IPs only"
- ;;
- invalid_pub_keys)
- pub_key0="$(wg genkey | wg pubkey)"
- tst_res TINFO "Invalid peer public key of lhost"
- ;;
- esac
-
- ROD wg set ltp_v0 listen-port $port_loc private-key wg0.key
- ROD wg set ltp_v0 peer $pub_key1 endpoint \
- $(tst_ipaddr rhost):$port_rmt $ka_opt \
- allowed-ips $allow_ip_rmt
-
- tst_rhost_run -s -c \
- "wg set ltp_v0 listen-port $port_rmt private-key wg1.key"
- tst_rhost_run -s -c "wg set ltp_v0 peer $pub_key0 \
- endpoint $(tst_ipaddr):$port_loc $ka_opt \
- allowed-ips $allow_ip_loc"
-}
-
-wireguard_lib_cleanup()
-{
- virt_cleanup
-}
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index f7f5db7bc..e2c2dfd8d 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -1,27 +1,42 @@
#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
# Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2001
-
-TST_SETUP="setup"
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+TCID=xinetd
+TST_TOTAL=2
TST_CLEANUP="cleanup"
-TST_NEEDS_CMDS="diff telnet in.telnetd xinetd"
-TST_NEEDS_TMPDIR=1
-TST_TESTFUNC="do_test"
-TST_CNT=2
. daemonlib.sh
+TST_USE_LEGACY_API=1
. tst_net.sh
setup()
{
[ -f "/usr/lib/systemd/system/telnet.socket" ] && \
- tst_brk TCONF "xinetd doesn't manage telnet"
+ tst_brkm TCONF "xinetd doesn't manage telnet"
+
+ tst_tmpdir
+
+ tst_require_cmds xinetd diff telnet
check_addr="127.0.0.1"
ip a | grep -q inet6 && check_addr="$check_addr ::1"
+ # Create custom xinetd.conf file.
+ # tst_xinetd.conf.1 config file has telnet service disabled.
cat > tst_xinetd.conf.1 <<-EOF
defaults
{
@@ -55,58 +70,76 @@ service telnet
flags = IPv6
}
EOF
+
+ # create a backup of the original xinetd.conf file.
ROD mv /etc/xinetd.conf xinetd.conf.orig
}
cleanup()
{
+ # restore the original xinetd.conf if a back up exits.
[ -f xinetd.conf.orig ] && \
mv xinetd.conf.orig /etc/xinetd.conf
+ # restoring original services
restart_daemon xinetd
+
+ tst_rmdir
}
restart_xinetd()
{
- tst_res TINFO "restart xinetd"
+ tst_resm TINFO "restart xinetd"
+ # restart xinetd to re-start the services
restart_daemon xinetd > tst_xinetd.out 2>&1
if [ $? -ne 0 ]; then
cat tst_xinetd.out
- tst_brk TBROK "unable to restart service with telnet disabled"
+ tst_brkm TBROK "unable to restart service with telnet disabled"
fi
+ # even if xinetd restart has zero exit value,
+ # make certain there was no failure.
grep -qi "fail" tst_xinetd.out && \
- tst_brk TBROK "xinetd failed to restart"
+ tst_brkm TBROK "xinetd failed to restart"
}
-xinetd_test()
+# Description: - Test that xinetd reads the configuration file and starts or
+# stops services.
+# - restart xinetd with configuration file with telnet disabled.
+# - telnet to locahost should fail.
+# - restart xinetd with configuration file with telnet enabled.
+# - telnet to locahost should work.
+test01()
{
- local cnt=$1
- local desc="$2"
- local pattern="$3"
- local a p
+ tst_resm TINFO "install the new config file with telnet disabled"
+ ROD mv tst_xinetd.conf.1 /etc/xinetd.conf
+ restart_xinetd
- tst_res TINFO "install the new config file with telnet $desc"
- ROD mv tst_xinetd.conf.$cnt /etc/xinetd.conf
+ for a in $check_addr; do
+ echo '' | telnet $a 2>&1 | grep -qi \
+ "telnet: connect to address $a: Connection refused"
+ [ $? -ne 0 ] && \
+ tst_brkm TFAIL "not expected output for 'telnet $a'"
+ done
+
+ tst_resm TPASS "expected output with telnet disabled"
+
+ tst_resm TINFO "install the xinetd config file with telnet enabled"
+ ROD mv tst_xinetd.conf.2 /etc/xinetd.conf
restart_xinetd
for a in $check_addr; do
- p=$(echo $pattern | sed "s/ADDR/$a/")
- echo '' | telnet $a 2>&1 | grep -qiE "$p"
+ echo '' | telnet $a 2>&1 | grep -qi \
+ "Connection closed by foreign host"
[ $? -ne 0 ] && \
- tst_brk TFAIL "not expected output for 'telnet $a'"
+ tst_brkm TFAIL "not expected output for 'telnet $a'"
done
- tst_res TPASS "expected output with telnet $desc"
-}
-do_test()
-{
- case $1 in
- 1) xinetd_test $1 "disabled" \
- "telnet: (connect to address ADDR|Unable to connect to remote host): Connection refused";;
- 2) xinetd_test $1 "enabled" \
- "Connection closed by foreign host";;
- esac
+ tst_resm TPASS "expected output with telnet enabled"
}
-tst_run
+setup
+
+test01
+
+tst_exit
diff --git a/testcases/open_posix_testsuite/.gitignore b/testcases/open_posix_testsuite/.gitignore
index a134c02a4..7ddf3cd90 100644
--- a/testcases/open_posix_testsuite/.gitignore
+++ b/testcases/open_posix_testsuite/.gitignore
@@ -13,5 +13,3 @@
/bin/t0
run.sh
-
-logfile
diff --git a/testcases/open_posix_testsuite/conformance/definitions/aio_h/1-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/aio_h/1-2-buildonly.c
index fdba063cd..39fcc9be6 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/aio_h/1-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/aio_h/1-2-buildonly.c
@@ -10,4 +10,4 @@
#include <aio.h>
-static struct aiocb dummy;
+struct aiocb dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/aio_h/3-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/aio_h/3-1-buildonly.c
index 5998abb09..3927403a5 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/aio_h/3-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/aio_h/3-1-buildonly.c
@@ -10,11 +10,11 @@
#include <aio.h>
-static int dummy0 = AIO_ALLDONE;
-static int dummy1 = AIO_CANCELED;
-static int dummy2 = AIO_NOTCANCELED;
-static int dummy3 = LIO_NOP;
-static int dummy4 = LIO_NOWAIT;
-static int dummy5 = LIO_READ;
-static int dummy6 = LIO_WAIT;
-static int dummy7 = LIO_WRITE;
+int dummy0 = AIO_ALLDONE;
+int dummy1 = AIO_CANCELED;
+int dummy2 = AIO_NOTCANCELED;
+int dummy3 = LIO_NOP;
+int dummy4 = LIO_NOWAIT;
+int dummy5 = LIO_READ;
+int dummy6 = LIO_WAIT;
+int dummy7 = LIO_WRITE;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/aio_h/4-1.c b/testcases/open_posix_testsuite/conformance/definitions/aio_h/4-1.c
index f30f14df2..6f3b2092e 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/aio_h/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/aio_h/4-1.c
@@ -8,15 +8,15 @@
#include <aio.h>
-static int (*dummy0) (int, struct aiocb*) = aio_cancel;
-static int (*dummy1) (const struct aiocb*) = aio_error;
-static int (*dummy2) (int, struct aiocb*) = aio_fsync;
-static int (*dummy3) (struct aiocb*) = aio_read;
-static ssize_t (*dummy4) (struct aiocb*) = aio_return;
-static int (*dummy5) (const struct aiocb* const[], int,
+int (*dummy0) (int, struct aiocb*) = aio_cancel;
+int (*dummy1) (const struct aiocb*) = aio_error;
+int (*dummy2) (int, struct aiocb*) = aio_fsync;
+int (*dummy3) (struct aiocb*) = aio_read;
+ssize_t (*dummy4) (struct aiocb*) = aio_return;
+int (*dummy5) (const struct aiocb* const[], int,
const struct timespec *) = aio_suspend;
-static int (*dummy6) (struct aiocb *) = aio_write;
-static int (*dummy7) (int, struct aiocb *restrict const [restrict],
+int (*dummy6) (struct aiocb *) = aio_write;
+int (*dummy7) (int, struct aiocb *restrict const [restrict],
int, struct sigevent *restrict) = lio_listio;
int main(void)
diff --git a/testcases/open_posix_testsuite/conformance/definitions/errno_h/2-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/errno_h/2-1-buildonly.c
index 16a177695..00727391d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/errno_h/2-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/errno_h/2-1-buildonly.c
@@ -6,9 +6,9 @@
#include <errno.h>
-static int errno_test;
+int errno_test;
-static int dummyfcn(void)
+int dummyfcn(void)
{
errno_test = errno;
return 0;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-1-buildonly.c
index 75b6c4aea..a93d15425 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-1-buildonly.c
@@ -7,92 +7,92 @@
#include <errno.h>
-static int dummy1 = E2BIG;
-static int dummy2 = EACCES;
-static int dummy3 = EADDRINUSE;
-static int dummy4 = EADDRNOTAVAIL;
-static int dummy5 = EAFNOSUPPORT;
-static int dummy6 = EAGAIN;
-static int dummy7 = EALREADY;
-static int dummy8 = EBADF;
+int dummy1 = E2BIG;
+int dummy2 = EACCES;
+int dummy3 = EADDRINUSE;
+int dummy4 = EADDRNOTAVAIL;
+int dummy5 = EAFNOSUPPORT;
+int dummy6 = EAGAIN;
+int dummy7 = EALREADY;
+int dummy8 = EBADF;
#ifdef EBADMSG
-static int dummy9 = EBADMSG;
+int dummy9 = EBADMSG;
#endif
-static int dummy10 = EBUSY;
-static int dummy11 = ECANCELED;
-static int dummy12 = ECHILD;
-static int dummy13 = ECONNABORTED;
-static int dummy14 = ECONNREFUSED;
-static int dummy15 = ECONNRESET;
-static int dummy16 = EDEADLK;
-static int dummy17 = EDESTADDRREQ;
-static int dummy18 = EDOM;
-static int dummy19 = EDQUOT;
-static int dummy20 = EEXIST;
-static int dummy21 = EFAULT;
-static int dummy22 = EFBIG;
-static int dummy23 = EHOSTUNREACH;
-static int dummy24 = EIDRM;
-static int dummy25 = EILSEQ;
-static int dummy26 = EINPROGRESS;
-static int dummy27 = EINTR;
-static int dummy28 = EINVAL;
-static int dummy29 = EIO;
-static int dummy30 = EISCONN;
-static int dummy31 = EISDIR;
-static int dummy32 = ELOOP;
-static int dummy33 = EMFILE;
-static int dummy34 = EMLINK;
-static int dummy35 = EMSGSIZE;
-static int dummy36 = EMULTIHOP;
-static int dummy37 = ENAMETOOLONG;
-static int dummy38 = ENETDOWN;
-static int dummy39 = ENETRESET;
-static int dummy40 = ENETUNREACH;
-static int dummy41 = ENFILE;
-static int dummy42 = ENOBUFS;
+int dummy10 = EBUSY;
+int dummy11 = ECANCELED;
+int dummy12 = ECHILD;
+int dummy13 = ECONNABORTED;
+int dummy14 = ECONNREFUSED;
+int dummy15 = ECONNRESET;
+int dummy16 = EDEADLK;
+int dummy17 = EDESTADDRREQ;
+int dummy18 = EDOM;
+int dummy19 = EDQUOT;
+int dummy20 = EEXIST;
+int dummy21 = EFAULT;
+int dummy22 = EFBIG;
+int dummy23 = EHOSTUNREACH;
+int dummy24 = EIDRM;
+int dummy25 = EILSEQ;
+int dummy26 = EINPROGRESS;
+int dummy27 = EINTR;
+int dummy28 = EINVAL;
+int dummy29 = EIO;
+int dummy30 = EISCONN;
+int dummy31 = EISDIR;
+int dummy32 = ELOOP;
+int dummy33 = EMFILE;
+int dummy34 = EMLINK;
+int dummy35 = EMSGSIZE;
+int dummy36 = EMULTIHOP;
+int dummy37 = ENAMETOOLONG;
+int dummy38 = ENETDOWN;
+int dummy39 = ENETRESET;
+int dummy40 = ENETUNREACH;
+int dummy41 = ENFILE;
+int dummy42 = ENOBUFS;
#ifdef ENODATA
-static int dummy43 = ENODATA;
+int dummy43 = ENODATA;
#endif
-static int dummy44 = ENODEV;
-static int dummy45 = ENOENT;
-static int dummy46 = ENOEXEC;
-static int dummy47 = ENOLCK;
-static int dummy48 = ENOLINK;
-static int dummy49 = ENOMEM;
-static int dummy50 = ENOMSG;
-static int dummy51 = ENOPROTOOPT;
-static int dummy52 = ENOSPC;
+int dummy44 = ENODEV;
+int dummy45 = ENOENT;
+int dummy46 = ENOEXEC;
+int dummy47 = ENOLCK;
+int dummy48 = ENOLINK;
+int dummy49 = ENOMEM;
+int dummy50 = ENOMSG;
+int dummy51 = ENOPROTOOPT;
+int dummy52 = ENOSPC;
#ifdef ENOSR
-static int dummy53 = ENOSR;
+int dummy53 = ENOSR;
#endif
#ifdef ENOSTR
-static int dummy54 = ENOSTR;
+int dummy54 = ENOSTR;
#endif
-static int dummy55 = ENOSYS;
-static int dummy56 = ENOTCONN;
-static int dummy57 = ENOTDIR;
-static int dummy58 = ENOTEMPTY;
-static int dummy59 = ENOTSOCK;
-static int dummy60 = ENOTSUP;
-static int dummy61 = ENOTTY;
-static int dummy62 = ENXIO;
-static int dummy63 = EOPNOTSUPP;
-static int dummy64 = EOVERFLOW;
-static int dummy65 = EPERM;
-static int dummy66 = EPIPE;
-static int dummy67 = EPROTO;
-static int dummy68 = EPROTONOSUPPORT;
-static int dummy69 = EPROTOTYPE;
-static int dummy70 = ERANGE;
-static int dummy71 = EROFS;
-static int dummy72 = ESPIPE;
-static int dummy73 = ESRCH;
-static int dummy74 = ESTALE;
+int dummy55 = ENOSYS;
+int dummy56 = ENOTCONN;
+int dummy57 = ENOTDIR;
+int dummy58 = ENOTEMPTY;
+int dummy59 = ENOTSOCK;
+int dummy60 = ENOTSUP;
+int dummy61 = ENOTTY;
+int dummy62 = ENXIO;
+int dummy63 = EOPNOTSUPP;
+int dummy64 = EOVERFLOW;
+int dummy65 = EPERM;
+int dummy66 = EPIPE;
+int dummy67 = EPROTO;
+int dummy68 = EPROTONOSUPPORT;
+int dummy69 = EPROTOTYPE;
+int dummy70 = ERANGE;
+int dummy71 = EROFS;
+int dummy72 = ESPIPE;
+int dummy73 = ESRCH;
+int dummy74 = ESTALE;
#ifdef ETIME
-static int dummy75 = ETIME;
+int dummy75 = ETIME;
#endif
-static int dummy76 = ETIMEDOUT;
-static int dummy77 = ETXTBSY;
-static int dummy78 = EWOULDBLOCK;
-static int dummy79 = EXDEV;
+int dummy76 = ETIMEDOUT;
+int dummy77 = ETXTBSY;
+int dummy78 = EWOULDBLOCK;
+int dummy79 = EXDEV;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-2.c b/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-2.c
index 97aa1f5b5..852ca5f2d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/errno_h/3-2.c
@@ -18,7 +18,7 @@
#define PTP_UNINITIATED 6
#define PTP_NORESULT 7
-static struct unique {
+struct unique {
int value;
char *name;
int duplicate;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/errno_h/4-1.c b/testcases/open_posix_testsuite/conformance/definitions/errno_h/4-1.c
index d43a21672..977771627 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/errno_h/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/errno_h/4-1.c
@@ -14,7 +14,7 @@
#define PTP_UNINITIATED 6
#define PTP_NORESULT 7
-static struct unique {
+struct unique {
int value;
char *name;
} sym[] = { {
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/10-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/10-1-buildonly.c
index c616ac3ad..081bdc12d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/10-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/10-1-buildonly.c
@@ -8,7 +8,7 @@
#include <time.h>
#include "posixtest.h"
-static void test_mq_timedsend_prototype(void)
+void test_mq_timedsend_prototype(void)
{
mqd_t mqdes;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/11-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/11-1-buildonly.c
index 387ae567b..3e6b9b01e 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/11-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/11-1-buildonly.c
@@ -7,7 +7,7 @@ line 9696 of the Base Definitions document
#include <mqueue.h>
#include "posixtest.h"
-static void test_mqueue_unlink_prototype()
+void test_mqueue_unlink_prototype()
{
const char *name = "bogus";
int err;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/2-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/2-1-buildonly.c
index 0d7c401a6..fd3cd4c7b 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/2-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/2-1-buildonly.c
@@ -7,7 +7,7 @@
#include <mqueue.h>
#include "posixtest.h"
-static void test_mq_close_prototype(void)
+void test_mq_close_prototype(void)
{
mqd_t mqdes;
int err;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/3-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/3-1-buildonly.c
index 401de7a10..959f85c28 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/3-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/3-1-buildonly.c
@@ -7,7 +7,7 @@
#include <mqueue.h>
#include "posixtest.h"
-static void test_mq_getattr_prototype(void)
+void test_mq_getattr_prototype(void)
{
mqd_t mqdes;
struct mq_attr mqs;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/4-1-buildonly.c
index 1b88ee571..0e092cddf 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/4-1-buildonly.c
@@ -9,7 +9,7 @@
#include "posixtest.h"
-static void test_mq_notify_prototype(void)
+void test_mq_notify_prototype(void)
{
mqd_t mqdes;
struct sigevent *notification;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/5-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/5-1-buildonly.c
index 1aa52488d..6ab1f70b0 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/5-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/5-1-buildonly.c
@@ -8,7 +8,7 @@
#include <mqueue.h>
#include "posixtest.h"
-static void test_mq_open_prototype(void)
+void test_mq_open_prototype(void)
{
mqd_t res;
int oflag = O_RDONLY;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/6-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/6-1-buildonly.c
index 803665052..f1a8421f3 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/6-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/6-1-buildonly.c
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void test_mq_receive_prototype(void)
+void test_mq_receive_prototype(void)
{
mqd_t mqdes;
ssize_t msg_size;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/7-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/7-1-buildonly.c
index 21bb0e15e..54c35e200 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/7-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/7-1-buildonly.c
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void test_mq_send_prototype(void)
+void test_mq_send_prototype(void)
{
mqd_t mqdes;
size_t msg_len;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/8-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/8-1-buildonly.c
index 043cb98b9..057c65955 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/8-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/8-1-buildonly.c
@@ -8,7 +8,7 @@
#include "posixtest.h"
#include <stdio.h>
-static void test_mq_setattr_prototype(void)
+void test_mq_setattr_prototype(void)
{
mqd_t mqdes;
struct mq_attr mqs, omqs;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/9-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/9-1-buildonly.c
index 1da486f52..d97279b4a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/9-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/mqueue_h/9-1-buildonly.c
@@ -8,7 +8,7 @@
#include <time.h>
#include "posixtest.h"
-static void test_mq_timedreceive_prototype(void)
+void test_mq_timedreceive_prototype(void)
{
mqd_t mqdes;
struct timespec abstime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/10-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/10-buildonly.c
index f0ad7d4d7..b3604a8f2 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/10-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/10-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_attr_t a;
+pthread_attr_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_attr_init(&a);
return;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/11-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/11-1-buildonly.c
index d164e043c..d319bb269 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/11-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/11-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_attr_t a;
+pthread_attr_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_attr_destroy(&a);
return;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/12-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/12-1-buildonly.c
index 55be67d80..9e24b1352 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/12-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/12-1-buildonly.c
@@ -12,10 +12,10 @@
#include <pthread.h>
-static pthread_attr_t a;
-static int *detachstate;
+pthread_attr_t a;
+int *detachstate;
-static void dummy_func()
+void dummy_func()
{
pthread_attr_getdetachstate(&a, detachstate);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/13-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/13-1-buildonly.c
index ab845d733..901da9b5a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/13-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/13-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_attr_t a;
+pthread_attr_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/14-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/14-1-buildonly.c
index 4282f6cc2..6c4ca570f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/14-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/14-1-buildonly.c
@@ -13,9 +13,9 @@
#include <pthread.h>
-static pthread_mutex_t a;
+pthread_mutex_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutex_init(&a, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/15-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/15-1-buildonly.c
index a83c20e04..b7756a370 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/15-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/15-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_mutex_t a;
+pthread_mutex_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutex_destroy(&a);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/16-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/16-1-buildonly.c
index cd5d8dc4c..ec4b4a02b 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/16-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/16-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_mutex_t a;
+pthread_mutex_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutex_lock(&a);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/17-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/17-1-buildonly.c
index 29c0a7d3a..d85cfdc25 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/17-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/17-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_mutex_t a;
+pthread_mutex_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutex_trylock(&a);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/18-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/18-1-buildonly.c
index c6aa02d51..fbe8ec71a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/18-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/18-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_mutex_t a;
+pthread_mutex_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutex_unlock(&a);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/19-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/19-1-buildonly.c
index 336f33498..330c06f60 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/19-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/19-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_mutexattr_t a;
+pthread_mutexattr_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutexattr_init(&a);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/20-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/20-1-buildonly.c
index 4ee967b0d..55b205c2d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/20-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/20-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_mutexattr_t a;
+pthread_mutexattr_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_mutexattr_destroy(&a);
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-1-buildonly.c
index e8290b541..158eafe47 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-1-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_attr_t dummy;
+pthread_attr_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-10-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-10-buildonly.c
index 355054f55..fe3f64df3 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-10-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-10-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_rwlock_t dummy;
+pthread_rwlock_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-11-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-11-buildonly.c
index 017932820..a0feb409e 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-11-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-11-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_rwlockattr_t dummy;
+pthread_rwlockattr_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-12-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-12-buildonly.c
index be4a5a54e..fbf1b2cb1 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-12-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-12-buildonly.c
@@ -11,4 +11,4 @@
#include <pthread.h>
-static pthread_spinlock_t dummy;
+pthread_spinlock_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-13-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-13-buildonly.c
index 1ddbb9c20..6ddcf6d30 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-13-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-13-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_t dummy;
+pthread_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-2-buildonly.c
index 359293afb..1087d3c9c 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-2-buildonly.c
@@ -11,4 +11,4 @@
#include <pthread.h>
-static pthread_barrier_t dummy;
+pthread_barrier_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-3-buildonly.c
index 8c703b1cb..b97784899 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-3-buildonly.c
@@ -11,4 +11,4 @@
#include <pthread.h>
-static pthread_barrierattr_t dummy;
+pthread_barrierattr_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-4-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-4-buildonly.c
index 36247142f..da0400aa4 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-4-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-4-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_cond_t dummy;
+pthread_cond_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-5-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-5-buildonly.c
index 75a6bf10d..63f0b4778 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-5-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-5-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_condattr_t dummy;
+pthread_condattr_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-6-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-6-buildonly.c
index 26d233861..732428a05 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-6-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-6-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_key_t dummy;
+pthread_key_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-7-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-7-buildonly.c
index e1793d8bc..68c0902ee 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-7-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-7-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_mutex_t dummy;
+pthread_mutex_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-8-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-8-buildonly.c
index 730456d97..fa3f8a9d6 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-8-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-8-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_mutexattr_t dummy;
+pthread_mutexattr_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-9-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-9-buildonly.c
index 083a34afc..bb648d0ee 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-9-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/3-9-buildonly.c
@@ -10,4 +10,4 @@
#include <pthread.h>
-static pthread_once_t dummy;
+pthread_once_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/4-1-buildonly.c
index f5157f272..d9b35ce0b 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/4-1-buildonly.c
@@ -14,12 +14,12 @@
#include <pthread.h>
#include "posixtest.h"
-static void *thread_function(void *arg PTS_ATTRIBUTE_UNUSED)
+void *thread_function(void *arg LTP_ATTRIBUTE_UNUSED)
{
return NULL;
}
-static void dummy_func()
+void dummy_func()
{
pthread_t a_thread;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/5-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/5-1-buildonly.c
index 10fe69097..f6ec85f66 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/5-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/5-1-buildonly.c
@@ -12,7 +12,7 @@
#include <pthread.h>
-static void dummy_func()
+void dummy_func()
{
pthread_exit(NULL);
return;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/6-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/6-1-buildonly.c
index 70960c0e0..c9e4f0772 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/6-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/6-1-buildonly.c
@@ -12,7 +12,7 @@
#include <pthread.h>
-static void dummy_func()
+void dummy_func()
{
pthread_t ptid = pthread_self();
if (ptid == 0)
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/7-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/7-1-buildonly.c
index 9e83ce677..c724ac0fb 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/7-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/7-1-buildonly.c
@@ -12,10 +12,10 @@
#include <pthread.h>
-static pthread_t a, b;
-static int tmp;
+pthread_t a, b;
+int tmp;
-static void dummy_func()
+void dummy_func()
{
tmp = pthread_equal(a, b);
return;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/8-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/8-1-buildonly.c
index 0eeae3eee..d834a0c14 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/8-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/8-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_t a;
+pthread_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_join(a, NULL);
return;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/9-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/9-1-buildonly.c
index 20126f746..772b83b15 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/pthread_h/9-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/pthread_h/9-1-buildonly.c
@@ -12,9 +12,9 @@
#include <pthread.h>
-static pthread_t a;
+pthread_t a;
-static void dummy_func()
+void dummy_func()
{
pthread_detach(a);
return;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/10-1.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/10-1.c
index 7a1452d45..9a9c08ef6 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/10-1.c
@@ -17,7 +17,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct unique {
+struct unique {
int value;
char *name;
} sym[] = {
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/11-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/11-1-buildonly.c
index d2579758d..851cb96ad 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/11-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/11-1-buildonly.c
@@ -17,7 +17,7 @@
typedef int (*sched_get_priority_max_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_get_priority_max_test dummyvar;
dummyvar = sched_get_priority_max;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/12-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/12-1-buildonly.c
index 830cce20b..c9f9ecac8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/12-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/12-1-buildonly.c
@@ -17,7 +17,7 @@
typedef int (*sched_get_priority_min_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_get_priority_min_test dummyvar;
dummyvar = sched_get_priority_min;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/13-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/13-1-buildonly.c
index f2b9aeb4d..41bf01023 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/13-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/13-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*sched_getparam_test) (pid_t, struct sched_param *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_getparam_test dummyvar;
dummyvar = sched_getparam;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/14-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/14-1-buildonly.c
index ec6b7aea1..3ace96e71 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/14-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/14-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*sched_getscheduler_test) (pid_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_getscheduler_test dummyvar;
dummyvar = sched_getscheduler;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/15-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/15-1-buildonly.c
index 9678066db..18f9dd8eb 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/15-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/15-1-buildonly.c
@@ -19,7 +19,7 @@
typedef int (*sched_rr_get_interval_test) (pid_t, struct timespec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_rr_get_interval_test dummyvar;
dummyvar = sched_rr_get_interval;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/16-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/16-1-buildonly.c
index 657816d0e..05f1b9ff3 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/16-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/16-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*sched_setparam_test) (pid_t, const struct sched_param *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_setparam_test dummyvar;
dummyvar = sched_setparam;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/17-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/17-1-buildonly.c
index b8499c1f4..7ea1603f3 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/17-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/17-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*sched_setscheduler_test) (pid_t, int, const struct sched_param *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_setscheduler_test dummyvar;
dummyvar = sched_setscheduler;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/18-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/18-1-buildonly.c
index 6c0495b70..ba4af03c5 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/18-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/18-1-buildonly.c
@@ -17,7 +17,7 @@
typedef int (*sched_yield_test) (void);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sched_yield_test dummyvar;
dummyvar = sched_yield;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/19-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/19-1-buildonly.c
index 1afc097ef..ef52c6538 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/19-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/19-1-buildonly.c
@@ -16,4 +16,4 @@
#include <sched.h>
-static struct tm *mytime;
+struct tm *mytime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/2-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/2-1-buildonly.c
index d8b0301b0..a81d11c6f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/2-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/2-1-buildonly.c
@@ -13,9 +13,9 @@
*/
#include <sched.h>
-static struct sched_param this_type_should_exist, s;
+struct sched_param this_type_should_exist, s;
-static int dummyfcn(void)
+int dummyfcn(void)
{
s.sched_priority = 0;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/3-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/3-1-buildonly.c
index 91ce11038..a5772deb4 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/3-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/3-1-buildonly.c
@@ -20,9 +20,9 @@
#if defined(_POSIX_SPORADIC_SERVER) && _POSIX_SPORADIC_SERVER != -1
-static struct sched_param s;
+struct sched_param s;
-static int dummyfcn(void)
+int dummyfcn(void)
{
struct timespec ss_repl_period, ss_init_budget;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sched_h/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sched_h/4-1-buildonly.c
index bafeba7c0..bf43cbde7 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sched_h/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sched_h/4-1-buildonly.c
@@ -20,9 +20,9 @@
#if defined(_POSIX_SPORADIC_SERVER) && _POSIX_SPORADIC_SERVER != -1
-static struct sched_param s;
+struct sched_param s;
-static int dummyfcn(void)
+int dummyfcn(void)
{
struct timespec ss_repl_period, ss_init_budget;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/14-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/14-1-buildonly.c
index e939b77b1..c8b9070d8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/14-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/14-1-buildonly.c
@@ -4,35 +4,35 @@
#include <signal.h>
-static int dummy1 = SIGABRT;
-static int dummy2 = SIGALRM;
-static int dummy3 = SIGBUS;
-static int dummy4 = SIGCHLD;
-static int dummy5 = SIGCONT;
-static int dummy6 = SIGFPE;
-static int dummy7 = SIGHUP;
-static int dummy8 = SIGILL;
-static int dummy9 = SIGINT;
-static int dummy10 = SIGKILL;
-static int dummy11 = SIGPIPE;
-static int dummy12 = SIGQUIT;
-static int dummy13 = SIGSEGV;
-static int dummy14 = SIGSTOP;
-static int dummy15 = SIGTERM;
-static int dummy16 = SIGTSTP;
-static int dummy17 = SIGTTIN;
-static int dummy18 = SIGTTOU;
-static int dummy19 = SIGUSR1;
-static int dummy20 = SIGUSR2;
+int dummy1 = SIGABRT;
+int dummy2 = SIGALRM;
+int dummy3 = SIGBUS;
+int dummy4 = SIGCHLD;
+int dummy5 = SIGCONT;
+int dummy6 = SIGFPE;
+int dummy7 = SIGHUP;
+int dummy8 = SIGILL;
+int dummy9 = SIGINT;
+int dummy10 = SIGKILL;
+int dummy11 = SIGPIPE;
+int dummy12 = SIGQUIT;
+int dummy13 = SIGSEGV;
+int dummy14 = SIGSTOP;
+int dummy15 = SIGTERM;
+int dummy16 = SIGTSTP;
+int dummy17 = SIGTTIN;
+int dummy18 = SIGTTOU;
+int dummy19 = SIGUSR1;
+int dummy20 = SIGUSR2;
#ifdef SIGPOLL
-static int dummy21 = SIGPOLL;
+int dummy21 = SIGPOLL;
#endif
#ifdef SIGPROF
-static int dummy22 = SIGPROF;
+int dummy22 = SIGPROF;
#endif
-static int dummy23 = SIGSYS;
-static int dummy24 = SIGTRAP;
-static int dummy25 = SIGURG;
-static int dummy26 = SIGVTALRM;
-static int dummy27 = SIGXCPU;
-static int dummy28 = SIGXFSZ;
+int dummy23 = SIGSYS;
+int dummy24 = SIGTRAP;
+int dummy25 = SIGURG;
+int dummy26 = SIGVTALRM;
+int dummy27 = SIGXCPU;
+int dummy28 = SIGXFSZ;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/15-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/15-1-buildonly.c
index a4862a092..b5473ceca 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/15-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/15-1-buildonly.c
@@ -4,13 +4,13 @@
#include <signal.h>
-static struct sigaction this_type_should_exist, t;
+struct sigaction this_type_should_exist, t;
extern void signal_handler(int);
-static sigset_t *set;
-static int flags;
+sigset_t *set;
+int flags;
extern void signal_action(int, siginfo_t *, void *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
t.sa_handler = signal_handler;
set = &t.sa_mask;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/16-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/16-1-buildonly.c
index 24a9c8b60..875615524 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/16-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/16-1-buildonly.c
@@ -4,17 +4,17 @@
#include <signal.h>
-static int dummy1 = SA_NOCLDSTOP;
-static int dummy2 = SIG_BLOCK;
-static int dummy3 = SIG_UNBLOCK;
-static int dummy4 = SIG_SETMASK;
-static int dummy5 = SA_ONSTACK;
-static int dummy6 = SA_RESETHAND;
-static int dummy7 = SA_RESTART;
-static int dummy8 = SA_SIGINFO;
-static int dummy9 = SA_NOCLDWAIT;
-static int dummy10 = SA_NODEFER;
-static int dummy11 = SS_ONSTACK;
-static int dummy12 = SS_DISABLE;
-static int dummy13 = MINSIGSTKSZ;
-static int dummy14 = SIGSTKSZ;
+int dummy1 = SA_NOCLDSTOP;
+int dummy2 = SIG_BLOCK;
+int dummy3 = SIG_UNBLOCK;
+int dummy4 = SIG_SETMASK;
+int dummy5 = SA_ONSTACK;
+int dummy6 = SA_RESETHAND;
+int dummy7 = SA_RESTART;
+int dummy8 = SA_SIGINFO;
+int dummy9 = SA_NOCLDWAIT;
+int dummy10 = SA_NODEFER;
+int dummy11 = SS_ONSTACK;
+int dummy12 = SS_DISABLE;
+int dummy13 = MINSIGSTKSZ;
+int dummy14 = SIGSTKSZ;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/17-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/17-1-buildonly.c
index 3bfc98a3b..5624fd5ed 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/17-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/17-1-buildonly.c
@@ -4,4 +4,4 @@
#include <ucontext.h>
-static ucontext_t dummy;
+ucontext_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/18-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/18-1-buildonly.c
index 3bfc98a3b..5624fd5ed 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/18-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/18-1-buildonly.c
@@ -4,4 +4,4 @@
#include <ucontext.h>
-static ucontext_t dummy;
+ucontext_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/19-1.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/19-1.c
index e641bc279..d9f11edb9 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/19-1.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/19-1.c
@@ -5,10 +5,10 @@
#include <sys/types.h>
#include <signal.h>
-static stack_t this_type_should_exist, t;
-static void *sp;
-static size_t size;
-static int flags;
+stack_t this_type_should_exist, t;
+void *sp;
+size_t size;
+int flags;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-1-buildonly.c
index 90f1ef135..a6775ead0 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-1-buildonly.c
@@ -4,4 +4,4 @@
#include <signal.h>
-static void (*dummy) (int) = SIG_DFL;
+void (*dummy) (int) = SIG_DFL;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-2-buildonly.c
index a0744061e..46a2a8d7f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-2-buildonly.c
@@ -4,4 +4,4 @@
#include <signal.h>
-static void (*dummy) (int) = SIG_ERR;
+void (*dummy) (int) = SIG_ERR;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-3-buildonly.c
index a5bec5a2f..cb60e1a18 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-3-buildonly.c
@@ -6,4 +6,4 @@
#include <signal.h>
-static void (*dummy) (int) = SIG_HOLD;
+void (*dummy) (int) = SIG_HOLD;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-4-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-4-buildonly.c
index 2721d9ded..c3ce008c6 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-4-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/2-4-buildonly.c
@@ -4,4 +4,4 @@
#include <signal.h>
-static void (*dummy) (int) = SIG_IGN;
+void (*dummy) (int) = SIG_IGN;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/21-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/21-1-buildonly.c
index 83c8d383d..14bda3bcc 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/21-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/21-1-buildonly.c
@@ -5,18 +5,18 @@
#include <signal.h>
#include <sys/types.h>
-static siginfo_t this_type_should_exist, t;
-static int tsigno;
-static int terrno;
-static int tcode;
-static pid_t tpid;
-static uid_t tuid;
-static void *taddr;
-static int tstatus;
-static long tband;
-static union sigval tvalue;
+siginfo_t this_type_should_exist, t;
+int tsigno;
+int terrno;
+int tcode;
+pid_t tpid;
+uid_t tuid;
+void *taddr;
+int tstatus;
+long tband;
+union sigval tvalue;
-static int dummyfcn(void)
+int dummyfcn(void)
{
tsigno = t.si_signo;
terrno = t.si_errno;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/24-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/24-1-buildonly.c
index b8c355a9e..b4c5e5ed9 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/24-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/24-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*kill_test) (pid_t, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
kill_test dummyvar;
dummyvar = kill;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/25-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/25-1-buildonly.c
index 5a61e8ae1..4ee38b098 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/25-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/25-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*killpg_test) (pid_t, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
killpg_test dummyvar;
dummyvar = killpg;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/27-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/27-1-buildonly.c
index 255c7f2d1..e6af43bf3 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/27-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/27-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*pthread_sigmask_test) (int, const sigset_t *, sigset_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
pthread_sigmask_test dummyvar;
dummyvar = pthread_sigmask;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/28-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/28-1-buildonly.c
index be83e74cb..0ee606c8b 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/28-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/28-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*raise_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
raise_test dummyvar;
dummyvar = raise;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/29-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/29-1-buildonly.c
index 9e5fd5992..884d531db 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/29-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/29-1-buildonly.c
@@ -11,7 +11,7 @@
typedef int (*sigaction_test) (int, const struct sigaction *,
struct sigaction *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigaction_test dummyvar;
dummyvar = sigaction;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/3-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/3-1-buildonly.c
index 3605cc3b7..17de4298a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/3-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/3-1-buildonly.c
@@ -4,4 +4,4 @@
#include <signal.h>
-static sig_atomic_t dummy;
+sig_atomic_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/30-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/30-1-buildonly.c
index b540e3fcf..86731bfbc 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/30-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/30-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigaddset_test) (sigset_t *, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigaddset_test dummyvar;
dummyvar = sigaddset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c
index a128e00e3..6b41c2491 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c
@@ -10,7 +10,7 @@
typedef int (*sigaltstack_test) (const stack_t *, stack_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigaltstack_test dummyvar;
dummyvar = sigaltstack;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/32-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/32-1-buildonly.c
index 6c4b8d29d..c09452b43 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/32-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/32-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigdelset_test) (sigset_t *, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigdelset_test dummyvar;
dummyvar = sigdelset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/33-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/33-1-buildonly.c
index 4be18f32b..a74fb9c67 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/33-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/33-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigemptyset_test) (sigset_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigemptyset_test dummyvar;
dummyvar = sigemptyset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/34-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/34-1-buildonly.c
index 6e0c542cc..d1d0743cc 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/34-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/34-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigfillset_test) (sigset_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigfillset_test dummyvar;
dummyvar = sigfillset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/35-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/35-1-buildonly.c
index b6638f077..03121e92c 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/35-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/35-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sighold_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sighold_test dummyvar;
dummyvar = sighold;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/36-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/36-1-buildonly.c
index affa50621..a19191de8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/36-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/36-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sigignore_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigignore_test dummyvar;
dummyvar = sigignore;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/37-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/37-1-buildonly.c
index f4a841657..7743fa9ca 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/37-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/37-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*siginterrupt_test) (int, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
siginterrupt_test dummyvar;
dummyvar = siginterrupt;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/38-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/38-1-buildonly.c
index 77906db08..8df018dbd 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/38-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/38-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigismember_test) (const sigset_t *, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigismember_test dummyvar;
dummyvar = sigismember;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/39-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/39-1-buildonly.c
index 52b98450f..7d39c30b4 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/39-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/39-1-buildonly.c
@@ -8,7 +8,7 @@
typedef void (*(*signal_test) (int, void (*)(int))) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
signal_test dummyvar;
dummyvar = signal;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/4-1-buildonly.c
index dc38a6716..b95d33173 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/4-1-buildonly.c
@@ -4,4 +4,4 @@
#include <signal.h>
-static sigset_t dummy;
+sigset_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/40-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/40-1-buildonly.c
index c013336b7..9ef41a47a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/40-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/40-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sigpause_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigpause_test dummyvar;
dummyvar = sigpause;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/41-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/41-1-buildonly.c
index f34ce4358..e5713832f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/41-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/41-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sigpending_test) (sigset_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigpending_test dummyvar;
dummyvar = sigpending;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/42-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/42-1-buildonly.c
index b6ef92905..69f7c47a8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/42-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/42-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sigprocmask_test) (int, const sigset_t *, sigset_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigprocmask_test dummyvar;
dummyvar = sigprocmask;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/43-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/43-1-buildonly.c
index 93f12323c..1d3745dd4 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/43-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/43-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sigqueue_test) (pid_t, int, const union sigval);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigqueue_test dummyvar;
dummyvar = sigqueue;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/44-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/44-1-buildonly.c
index c625a2bdc..6d793afca 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/44-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/44-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigrelse_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigrelse_test dummyvar;
dummyvar = sigrelse;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/45-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/45-1-buildonly.c
index 6b312c75e..867577353 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/45-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/45-1-buildonly.c
@@ -8,7 +8,7 @@
typedef void (*(*sigset_test) (int, void (*)(int))) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigset_test dummyvar;
dummyvar = sigset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/46-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/46-1-buildonly.c
index c0476a709..ee51e6de9 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/46-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/46-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigsuspend_test) (const sigset_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigsuspend_test dummyvar;
dummyvar = sigsuspend;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/47-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/47-1-buildonly.c
index 4e537aa02..139252fda 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/47-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/47-1-buildonly.c
@@ -12,7 +12,7 @@ typedef int (*sigtimedwait_test) (const sigset_t * restrict,
siginfo_t * restrict,
const struct timespec * restrict);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigtimedwait_test dummyvar;
dummyvar = sigtimedwait;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/48-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/48-1-buildonly.c
index 9c0280d8b..f820615e5 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/48-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/48-1-buildonly.c
@@ -8,7 +8,7 @@
typedef int (*sigwait_test) (const sigset_t * restrict, int *restrict);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigwait_test dummyvar;
dummyvar = sigwait;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/49-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/49-1-buildonly.c
index 65e33bdff..722434028 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/49-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/49-1-buildonly.c
@@ -9,7 +9,7 @@
typedef int (*sigwaitinfo_test) (const sigset_t * restrict,
siginfo_t * restrict);
-static int dummyfcn(void)
+int dummyfcn(void)
{
sigwaitinfo_test dummyvar;
dummyvar = sigwaitinfo;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/5-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/5-1-buildonly.c
index e7551306a..ca36b152c 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/5-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/5-1-buildonly.c
@@ -4,4 +4,4 @@
#include <sys/types.h>
-static pid_t dummy;
+pid_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/signal_h/50-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/signal_h/50-1-buildonly.c
index e4fc24773..70ffaee0c 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/signal_h/50-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/signal_h/50-1-buildonly.c
@@ -6,4 +6,4 @@
#include <signal.h>
-static struct tm *mytime;
+struct tm *mytime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/10-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/10-1-buildonly.c
index 8cd3287f4..52ad65ab0 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/10-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/10-1-buildonly.c
@@ -19,9 +19,9 @@
#if defined(_POSIX_TYPED_MEMORY_OBJECTS) && _POSIX_TYPED_MEMORY_OBJECTS != -1
-static struct posix_typed_mem_info this_type_should_exist, t;
+struct posix_typed_mem_info this_type_should_exist, t;
-static int dummyfcn(void)
+int dummyfcn(void)
{
size_t sz = 0;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/11-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/11-1-buildonly.c
index 0a50940d7..d20e07cd1 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/11-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/11-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*mlock_test) (const void *, size_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
mlock_test dummyvar;
dummyvar = mlock;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/12-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/12-1-buildonly.c
index d8f7805f2..f2a9baa88 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/12-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/12-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*mlockall_test) (int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
mlockall_test dummyvar;
dummyvar = mlockall;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/13-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/13-1-buildonly.c
index 4f2779e10..93f9344ef 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/13-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/13-1-buildonly.c
@@ -20,7 +20,7 @@
typedef void *(*mmap_test) (void *, size_t, int, int, int, off_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
mmap_test dummyvar;
dummyvar = mmap;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/14-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/14-1-buildonly.c
index 61812f77b..32e1685b8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/14-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/14-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*mprotect_test) (void *, size_t, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
mprotect_test dummyvar;
dummyvar = mprotect;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/15-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/15-1-buildonly.c
index 64b3b2226..9d78dc732 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/15-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/15-1-buildonly.c
@@ -19,7 +19,7 @@
typedef int (*msync_test) (void *, size_t, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
msync_test dummyvar;
dummyvar = msync;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/16-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/16-1-buildonly.c
index 008d020ea..45e7c880e 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/16-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/16-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*munlock_test) (const void *, size_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
munlock_test dummyvar;
dummyvar = munlock;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/17-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/17-1-buildonly.c
index fe50265f2..f84f36b33 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/17-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/17-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*munlockall_test) (void);
-static int dummyfcn(void)
+int dummyfcn(void)
{
munlockall_test dummyvar;
dummyvar = munlockall;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/18-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/18-1-buildonly.c
index 38590442e..800b6eaa8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/18-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/18-1-buildonly.c
@@ -20,7 +20,7 @@
typedef int (*munmap_test) (void *, size_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
munmap_test dummyvar;
dummyvar = munmap;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/19-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/19-1-buildonly.c
index 48e809537..3493fcf20 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/19-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/19-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*posix_madvise_test) (void *, size_t, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
posix_madvise_test dummyvar;
dummyvar = posix_madvise;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/20-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/20-1-buildonly.c
index 60c66cab7..c65f7eb26 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/20-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/20-1-buildonly.c
@@ -24,7 +24,7 @@ typedef int (*posix_mem_offset_test) (const void *restrict, size_t,
off_t * restrict, size_t * restrict,
int *restrict);
-static int dummyfcn(void)
+int dummyfcn(void)
{
posix_mem_offset_test dummyvar;
dummyvar = posix_mem_offset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/21-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/21-1-buildonly.c
index 3e6209549..d263fc482 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/21-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/21-1-buildonly.c
@@ -22,7 +22,7 @@
typedef int (*posix_typed_mem_get_info_test) (int,
struct posix_typed_mem_info *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
posix_typed_mem_get_info_test dummyvar;
dummyvar = posix_typed_mem_get_info;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/22-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/22-1-buildonly.c
index 7fbf7e704..b1ee8876f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/22-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/22-1-buildonly.c
@@ -21,7 +21,7 @@
typedef int (*posix_typed_mem_open_test) (const char *, int, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
posix_typed_mem_open_test dummyvar;
dummyvar = posix_typed_mem_open;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/23-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/23-1-buildonly.c
index 6738ebc2c..51a411160 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/23-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/23-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*shm_open_test) (const char *, int, mode_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
shm_open_test dummyvar;
dummyvar = shm_open;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/24-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/24-1-buildonly.c
index f4bcfee40..51bc6da15 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/24-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/24-1-buildonly.c
@@ -18,7 +18,7 @@
typedef int (*shm_unlink_test) (const char *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
shm_unlink_test dummyvar;
dummyvar = shm_unlink;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-1-buildonly.c
index 387f08ea9..8c06f825f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-1-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/mman.h>
-static mode_t this_type_should_exist;
+mode_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-2-buildonly.c
index d8bb678e7..a666fea7e 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-2-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/mman.h>
-static off_t this_type_should_exist;
+off_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-3-buildonly.c
index 62da406b6..f5fcb7119 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h/9-3-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/mman.h>
-static size_t this_type_should_exist;
+size_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/10-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/10-1-buildonly.c
index 0c77dc819..e86747725 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/10-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/10-1-buildonly.c
@@ -16,7 +16,7 @@
typedef int (*shmdt_test) (const void *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
shmdt_test dummyvar;
dummyvar = shmdt;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/11-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/11-1-buildonly.c
index 4a8ede4fc..2cd03c9f2 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/11-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/11-1-buildonly.c
@@ -16,7 +16,7 @@
typedef int (*shmget_test) (key_t, size_t, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
shmget_test dummyvar;
dummyvar = shmget;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-2-buildonly.c
index 32d81137e..ff0fa2c1f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-2-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/shm.h>
-static struct ipc_perm this_type_should_exist;
+struct ipc_perm this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-3-buildonly.c
index ee19352b6..568de6446 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/12-3-buildonly.c
@@ -16,7 +16,7 @@
typedef key_t(*ftok_test) (const char *, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
ftok_test dummyvar;
dummyvar = ftok;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/4-1-buildonly.c
index 81da1438e..14358bd47 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/4-1-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/shm.h>
-static shmatt_t this_type_should_exist;
+shmatt_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/5-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/5-1-buildonly.c
index 363b54d1e..70f5ff3cf 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/5-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/5-1-buildonly.c
@@ -17,6 +17,6 @@
/* The minimun acceptable value for USHRT_MAX */
#define MIN_USHRT_MAX 65535
-static shmatt_t tmin = 0;
-static shmatt_t tmax = USHRT_MAX;
-static shmatt_t tminmax = MIN_USHRT_MAX;
+shmatt_t tmin = 0;
+shmatt_t tmax = USHRT_MAX;
+shmatt_t tminmax = MIN_USHRT_MAX;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/6-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/6-1-buildonly.c
index 59771bbdd..f8cadcd70 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/6-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/6-1-buildonly.c
@@ -21,9 +21,9 @@
#include <sys/shm.h>
-static struct shmid_ds this_type_should_exist, t;
+struct shmid_ds this_type_should_exist, t;
-static int dummyfcn(void)
+int dummyfcn(void)
{
struct ipc_perm perm = { 0 };
size_t sz = 0;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-1-buildonly.c
index 7e34414bb..b621b86fd 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-1-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/shm.h>
-static pid_t this_type_should_exist;
+pid_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-2-buildonly.c
index cbb85660d..f3a3360db 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-2-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/shm.h>
-static time_t this_type_should_exist;
+time_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-3-buildonly.c
index 86ff2523c..895a23bdd 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-3-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/shm.h>
-static key_t this_type_should_exist;
+key_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-4-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-4-buildonly.c
index 98399df4d..dc7ef9c11 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-4-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/7-4-buildonly.c
@@ -12,4 +12,4 @@
#include <sys/shm.h>
-static size_t this_type_should_exist;
+size_t this_type_should_exist;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/8-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/8-1-buildonly.c
index 9637c3564..1beb2ce01 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/8-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/8-1-buildonly.c
@@ -16,7 +16,7 @@
typedef void *(*shmat_test) (int, const void *, int);
-static int dummyfcn(void)
+int dummyfcn(void)
{
shmat_test dummyvar;
dummyvar = shmat;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/9-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/9-1-buildonly.c
index 33f0ba478..cce174527 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/9-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h/9-1-buildonly.c
@@ -16,7 +16,7 @@
typedef int (*shmctl_test) (int, int, struct shmid_ds *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
shmctl_test dummyvar;
dummyvar = shmctl;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/10-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/10-1-buildonly.c
index 1f66bf3f7..bb4d3c34a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/10-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/10-1-buildonly.c
@@ -14,7 +14,7 @@
typedef clock_t(*clock_test) (void);
-static int dummyfcn(void)
+int dummyfcn(void)
{
clock_test dummyvar;
dummyvar = clock;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/11-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/11-1-buildonly.c
index 0f00ffcb1..ebe1981cd 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/11-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/11-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*clock_getcpuclockid_test) (pid_t, clockid_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
clock_getcpuclockid_test dummyvar;
dummyvar = clock_getcpuclockid;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/12-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/12-1-buildonly.c
index 5af5824f9..1637c90e8 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/12-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/12-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*clock_getres_test) (clockid_t, struct timespec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
clock_getres_test dummyvar;
dummyvar = clock_getres;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/13-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/13-1-buildonly.c
index 88fbf7326..e56937cf4 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/13-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/13-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*clock_gettime_test) (clockid_t, struct timespec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
clock_gettime_test dummyvar;
dummyvar = clock_gettime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/14-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/14-1-buildonly.c
index 7869e72f5..5127c6efa 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/14-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/14-1-buildonly.c
@@ -17,7 +17,7 @@
typedef int (*clock_nanosleep_test) (clockid_t, int, const struct timespec *,
struct timespec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
clock_nanosleep_test dummyvar;
dummyvar = clock_nanosleep;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/15-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/15-1-buildonly.c
index ebf0bdc71..5cb0d84d9 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/15-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/15-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*clock_settime_test) (clockid_t, const struct timespec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
clock_settime_test dummyvar;
dummyvar = clock_settime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/16-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/16-1-buildonly.c
index aa6411678..095dd312b 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/16-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/16-1-buildonly.c
@@ -14,7 +14,7 @@
typedef char *(*ctime_test) (const time_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
ctime_test dummyvar;
dummyvar = ctime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/17-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/17-1-buildonly.c
index c5230269b..a0aff02e1 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/17-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/17-1-buildonly.c
@@ -15,7 +15,7 @@
typedef char *(*ctime_r_test) (const time_t *, char *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
ctime_r_test dummyvar;
dummyvar = ctime_r;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/18-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/18-1-buildonly.c
index 538632d54..fe4b7ea9c 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/18-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/18-1-buildonly.c
@@ -14,7 +14,7 @@
typedef double (*difftime_test) (time_t, time_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
difftime_test dummyvar;
dummyvar = difftime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/19-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/19-1-buildonly.c
index 846463189..2be4dc7f3 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/19-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/19-1-buildonly.c
@@ -15,7 +15,7 @@
typedef struct tm *(*getdate_test) (const char *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
getdate_test dummyvar;
dummyvar = getdate;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/2-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/2-1-buildonly.c
index df8990178..f651f7aa2 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/2-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/2-1-buildonly.c
@@ -9,9 +9,9 @@
*/
#include <time.h>
-static struct tm this_type_should_exist, t;
+struct tm this_type_should_exist, t;
-static int dummyfcn(void)
+int dummyfcn(void)
{
int week, year, dst;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/20-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/20-1-buildonly.c
index 7d518642e..e3f553886 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/20-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/20-1-buildonly.c
@@ -14,7 +14,7 @@
typedef struct tm *(*gmtime_test) (const time_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
gmtime_test dummyvar;
dummyvar = gmtime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/21-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/21-1-buildonly.c
index 887f9284d..5a7a79beb 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/21-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/21-1-buildonly.c
@@ -15,7 +15,7 @@
typedef struct tm *(*gmtime_r_test) (const time_t *, struct tm *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
gmtime_r_test dummyvar;
dummyvar = gmtime_r;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/22-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/22-1-buildonly.c
index 8e4d5c854..112db6789 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/22-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/22-1-buildonly.c
@@ -14,7 +14,7 @@
typedef struct tm *(*localtime_test) (const time_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
localtime_test dummyvar;
dummyvar = localtime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/23-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/23-1-buildonly.c
index fb4089744..9ac7a20f6 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/23-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/23-1-buildonly.c
@@ -15,7 +15,7 @@
typedef struct tm *(*localtime_r_test) (const time_t *, struct tm *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
localtime_r_test dummyvar;
dummyvar = localtime_r;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/24-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/24-1-buildonly.c
index 06ddc7810..693ae8b5d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/24-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/24-1-buildonly.c
@@ -14,7 +14,7 @@
typedef time_t(*mktime_test) (struct tm *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
mktime_test dummyvar;
dummyvar = mktime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/25-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/25-1-buildonly.c
index 78d64cf6f..cf8cc25fb 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/25-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/25-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*nanosleep_test) (const struct timespec *, struct timespec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
nanosleep_test dummyvar;
dummyvar = nanosleep;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/26-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/26-1-buildonly.c
index 6999c99ec..9e95ab34d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/26-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/26-1-buildonly.c
@@ -15,7 +15,7 @@
typedef size_t(*strftime_test) (char *, size_t, const char *,
const struct tm *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
strftime_test dummyvar;
dummyvar = strftime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/27-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/27-1-buildonly.c
index c86554277..7a0642fbb 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/27-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/27-1-buildonly.c
@@ -15,7 +15,7 @@
typedef char *(*strptime_test) (const char *, const char *, struct tm *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
strptime_test dummyvar;
dummyvar = strptime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/28-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/28-1-buildonly.c
index 79df6e43d..33fd1a359 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/28-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/28-1-buildonly.c
@@ -14,7 +14,7 @@
typedef time_t(*time_test) (time_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
time_test dummyvar;
dummyvar = time;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/29-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/29-1-buildonly.c
index 269379b05..03bef09ff 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/29-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/29-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*timer_create_test) (clockid_t, struct sigevent *, timer_t *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
timer_create_test dummyvar;
dummyvar = timer_create;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/30-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/30-1-buildonly.c
index bfbc078c4..b73c75be1 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/30-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/30-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*timer_delete_test) (timer_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
timer_delete_test dummyvar;
dummyvar = timer_delete;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/31-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/31-1-buildonly.c
index 2a8c0cbb2..9adeb47ec 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/31-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/31-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*timer_gettime_test) (timer_t, struct itimerspec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
timer_gettime_test dummyvar;
dummyvar = timer_gettime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/32-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/32-1-buildonly.c
index e4bd01e63..afdb6379c 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/32-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/32-1-buildonly.c
@@ -15,7 +15,7 @@
typedef int (*timer_getoverrun_test) (timer_t);
-static int dummyfcn(void)
+int dummyfcn(void)
{
timer_getoverrun_test dummyvar;
dummyvar = timer_getoverrun;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/33-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/33-1-buildonly.c
index c76515ae4..a0ff2f51f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/33-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/33-1-buildonly.c
@@ -17,7 +17,7 @@
typedef int (*timer_settime_test) (timer_t, int, const struct itimerspec *,
struct itimerspec *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
timer_settime_test dummyvar;
dummyvar = timer_settime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/34-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/34-1-buildonly.c
index 7a616d857..33a350df1 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/34-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/34-1-buildonly.c
@@ -14,7 +14,7 @@
typedef void (*tzset_test) (void);
-static int dummyfcn(void)
+int dummyfcn(void)
{
tzset_test dummyvar;
dummyvar = tzset;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/35-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/35-1-buildonly.c
index 510532bc5..f6510279d 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/35-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/35-1-buildonly.c
@@ -11,7 +11,7 @@
#include <time.h>
-static int dummyfcn(void)
+int dummyfcn(void)
{
int dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/35-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/35-2-buildonly.c
index d1ed77af5..bdf07345a 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/35-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/35-2-buildonly.c
@@ -10,7 +10,7 @@
#include <time.h>
-static int dummyfcn(void)
+int dummyfcn(void)
{
long dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/35-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/35-3-buildonly.c
index 7fd3aa6ab..1cd37d197 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/35-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/35-3-buildonly.c
@@ -14,7 +14,7 @@
/* Include for printf */
#include <stdio.h>
-static int dummyfcn(void)
+int dummyfcn(void)
{
printf("%s\n", tzname[0]);
return 0;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/4-1-buildonly.c
index 5d356c427..d93bc5c4f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/4-1-buildonly.c
@@ -9,9 +9,9 @@
*/
#include <time.h>
-static struct timespec this_type_should_exist, t;
+struct timespec this_type_should_exist, t;
-static int dummyfcn(void)
+int dummyfcn(void)
{
time_t sec;
long nsec;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/5-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/5-1-buildonly.c
index 5cf6171eb..582e7493f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/5-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/5-1-buildonly.c
@@ -9,9 +9,9 @@
*/
#include <time.h>
-static struct itimerspec this_type_should_exist, t;
+struct itimerspec this_type_should_exist, t;
-static int dummyfcn(void)
+int dummyfcn(void)
{
struct timespec interval;
struct timespec value;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-1-buildonly.c
index e360cc541..77e6d501f 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-1-buildonly.c
@@ -10,4 +10,4 @@
#include <sys/types.h>
-static clock_t dummy;
+clock_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-2-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-2-buildonly.c
index 5b40b48e6..b916e5384 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-2-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-2-buildonly.c
@@ -10,4 +10,4 @@
#include <sys/types.h>
-static size_t dummy;
+size_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-3-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-3-buildonly.c
index 3ca117234..2492f1dfa 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-3-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-3-buildonly.c
@@ -10,4 +10,4 @@
#include <sys/types.h>
-static time_t dummy;
+time_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-4-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-4-buildonly.c
index f7b12624a..b307337c7 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-4-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-4-buildonly.c
@@ -10,4 +10,4 @@
#include <sys/types.h>
-static clockid_t dummy;
+clockid_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-5-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-5-buildonly.c
index e91fe96e0..b4fef66e6 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/7-5-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/7-5-buildonly.c
@@ -10,4 +10,4 @@
#include <sys/types.h>
-static timer_t dummy;
+timer_t dummy;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/8-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/8-1-buildonly.c
index c96330ee9..abb7bf219 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/8-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/8-1-buildonly.c
@@ -14,7 +14,7 @@
typedef char *(*asctime_test) (const struct tm *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
asctime_test dummyvar;
dummyvar = asctime;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/time_h/9-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/time_h/9-1-buildonly.c
index 3edfbc589..dd9b3c8e4 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/time_h/9-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/time_h/9-1-buildonly.c
@@ -15,7 +15,7 @@
typedef char *(*asctime_r_test) (const struct tm *, char *);
-static int dummyfcn(void)
+int dummyfcn(void)
{
asctime_r_test dummyvar;
dummyvar = asctime_r;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/unistd_h/1-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/unistd_h/1-1-buildonly.c
index 4b5122277..44721eaf2 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/unistd_h/1-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/unistd_h/1-1-buildonly.c
@@ -13,7 +13,7 @@
typedef int (*fsync_test) (int fildes);
-static int dummyfcn(void)
+int dummyfcn(void)
{
fsync_test dummyvar;
dummyvar = fsync;
diff --git a/testcases/open_posix_testsuite/conformance/definitions/unistd_h/2-1-buildonly.c b/testcases/open_posix_testsuite/conformance/definitions/unistd_h/2-1-buildonly.c
index e769cc855..0c5773659 100644
--- a/testcases/open_posix_testsuite/conformance/definitions/unistd_h/2-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/definitions/unistd_h/2-1-buildonly.c
@@ -16,7 +16,7 @@
typedef int (*ftruncate_test) (int fildes, off_t length);
-static int dummyfcn(void)
+int dummyfcn(void)
{
ftruncate_test dummyvar;
dummyvar = ftruncate;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/1-1.c
index c5c9b8d23..314121fff 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/1-1.c
@@ -31,13 +31,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/1-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 1024
char buf[BUF_SIZE];
struct timespec processing_completion_ts = {0, 10000000};
@@ -47,7 +46,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-1.c
index 63dc6b0ec..cf681755c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-1.c
@@ -36,13 +36,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/2-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 1024
char buf[BUF_SIZE];
int fd, err;
@@ -51,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_2_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-2.c
index fa782767a..9b1df5a0c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/2-2.c
@@ -32,19 +32,19 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/2-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_2_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_2_2_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/3-1.c
index b74d11c6c..9a034cc32 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/3-1.c
@@ -40,7 +40,6 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/3-1.c"
@@ -50,8 +49,8 @@
static volatile int countdown = BUF_NB;
static volatile int canceled;
-static void sig_handler(int signum PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sig_handler(int signum LTP_ATTRIBUTE_UNUSED, siginfo_t *info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
struct aiocb *a = info->si_value.sival_ptr;
@@ -65,7 +64,7 @@ static void sig_handler(int signum PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocb_list[BUF_NB];
struct aiocb *aiocb;
@@ -78,7 +77,8 @@ int main(void)
return PTS_UNSUPPORTED;
}
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_3_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/4-1.c
index ef615ae64..512f8ea6c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/4-1.c
@@ -37,7 +37,6 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/4-1.c"
@@ -46,7 +45,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocb[BUF_NB];
int i;
@@ -55,7 +54,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
index 5ed4f6d42..03937e5d9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c
@@ -35,7 +35,6 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/5-1.c"
@@ -44,7 +43,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocb[BUF_NB];
char *buf[BUF_NB];
@@ -55,7 +54,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_5_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_5_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c
index c35aeee9a..6cc23f2d6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/6-1.c
@@ -38,7 +38,6 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/6-1.c"
@@ -47,7 +46,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocb[BUF_NB];
int i;
@@ -57,7 +56,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_6_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_6_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
index 34b263245..0a19ff99f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/7-1.c
@@ -36,7 +36,6 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/7-1.c"
@@ -45,7 +44,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocb[BUF_NB];
int i;
@@ -55,7 +54,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_7_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_7_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/8-1.c
index f11e06709..c64520f55 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/8-1.c
@@ -33,13 +33,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_cancel/8-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 1024
char buf[BUF_SIZE];
int fd;
@@ -50,7 +49,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_cancel_8_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_cancel_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/1-1.c
index 70b0a9dbb..a212c4ff7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/1-1.c
@@ -31,13 +31,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_error/1-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd, ret;
@@ -47,7 +46,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_error_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c
index c35bcfd9a..3c8e30299 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/2-1.c
@@ -31,7 +31,6 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_error/2-1.c"
@@ -40,7 +39,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocb[BUF_NB];
int i;
@@ -49,7 +48,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_error_2_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c
index 102d99274..9ccda055e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c
@@ -30,14 +30,13 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_error/3-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
int fd;
@@ -47,7 +46,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_error_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c
index 6f6f190e1..dce60c2a0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c
@@ -18,13 +18,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/14-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_14_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_14_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c
index 6faa20a04..3ca9c75b8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/2-1.c
@@ -18,7 +18,6 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/2-1.c"
@@ -26,7 +25,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
int fd, ret;
struct aiocb aiocb_write;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_2_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
index fa5adb463..678045e71 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
@@ -18,7 +18,6 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/3-1.c"
@@ -26,7 +25,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
int fd, ret;
struct aiocb aiocb_write;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_3_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-1.c
index 172b12f34..31fa74b29 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/4-1.c
@@ -19,13 +19,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/4-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/5-1.c
index 2f6c2a164..83c765d9c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/5-1.c
@@ -18,7 +18,6 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/5-1.c"
@@ -26,7 +25,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
int fd;
struct aiocb aiocb_write;
@@ -37,7 +36,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_5_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_5_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-1.c
index 69378e71b..0d44b1830 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-1.c
@@ -18,13 +18,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/8-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_8_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-2.c
index ee0d25c75..57347a30d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-2.c
@@ -18,13 +18,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/8-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_8_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_2_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-3.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-3.c
index 867fbf0c0..ed85d268d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-3.c
@@ -18,13 +18,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/8-3.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_8_3");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_3_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-4.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-4.c
index 0db00ca14..8bbb080d6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/8-4.c
@@ -18,13 +18,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/8-4.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_8_4");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_8_4_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/9-1.c
index 658c1a1e4..725eb7f36 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/9-1.c
@@ -18,13 +18,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_fsync/9-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -36,7 +35,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_fsync_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_9_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/1-1.c
index 37fd557ad..43d33887f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/1-1.c
@@ -29,13 +29,12 @@
#include <unistd.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/1-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define WBUF_SIZE 1024
char buf[WBUF_SIZE];
#define RBUF_SIZE 256
@@ -51,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-1.c
index 8f78970e0..01834e4e5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-1.c
@@ -33,13 +33,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/11-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -48,7 +47,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_11_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_11_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-2.c
index 4c1cba6ac..ff43ca153 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/11-2.c
@@ -32,13 +32,12 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/11-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -47,7 +46,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_11_2");
+ 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) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-1.c
index 00250cbd9..d5af0dbdf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-1.c
@@ -30,13 +30,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/3-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -47,7 +46,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_3_1");
+ 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) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-2.c
index b19c2b3be..67716971a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/3-2.c
@@ -30,13 +30,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/3-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 1024
char buf[BUF_SIZE];
int fd;
@@ -47,7 +46,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_3_2");
+ 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) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/4-1.c
index d80a65575..55c3e48b1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/4-1.c
@@ -30,13 +30,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/4-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
unsigned char buf[BUF_SIZE * 2];
unsigned char check[BUF_SIZE];
@@ -48,7 +47,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_4_1");
+ 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) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/5-1.c
index ce9c09a43..7d553225e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/5-1.c
@@ -31,13 +31,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/5-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
unsigned char buf[BUF_SIZE];
unsigned char check[BUF_SIZE];
@@ -49,7 +48,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_5_1");
+ 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) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
index a5d3ef7a0..67abafe73 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
@@ -31,13 +31,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/7-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
unsigned char check[BUF_SIZE];
int fd;
@@ -48,7 +47,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_7_1");
+ 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) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c
index e1ae59e3b..a1b7de2b1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/9-1.c
@@ -31,9 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_read/9-1.c"
@@ -41,7 +39,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
int fd;
@@ -55,7 +53,8 @@ int main(void)
|| sysconf(_SC_AIO_MAX) == -1)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_read_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/1-1.c
index 70499a0ae..2bc7c32b4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/1-1.c
@@ -32,14 +32,13 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_return/1-1.c"
#define BUF_SIZE 111
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
struct aiocb aiocb;
int fd, retval;
@@ -48,7 +47,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_return_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/2-1.c
index dc929c5fa..ac9873200 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/2-1.c
@@ -28,16 +28,15 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "posixtest.h"
#include <time.h>
-#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_return/2-1.c"
#define BUF_SIZE 111
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
struct aiocb aiocb;
int fd, retval;
@@ -46,7 +45,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_return_2_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-1.c
index 32ca22d9a..218d9ddf7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-1.c
@@ -35,14 +35,13 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_return/3-1.c"
#define BUF_SIZE 4096
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
struct aiocb aiocb;
int fd, retval;
@@ -51,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_return_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_3_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-2.c
index 30a850dbd..883823bac 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-2.c
@@ -33,14 +33,13 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_return/3-2.c"
#define BUF_SIZE 4096
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
struct aiocb aiocb;
int fd, retval;
@@ -49,7 +48,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_return_3_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_3_2_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c
index a243b3e98..7a039b13f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c
@@ -33,14 +33,13 @@
#include <unistd.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_return/4-1.c"
#define BUF_SIZE 111
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char buf[BUF_SIZE];
struct aiocb aiocb;
struct aiocb aiocb2;
@@ -50,7 +49,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_return_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_return_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/1-1.c
index 04f6d2b7f..623a2a0d0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/1-1.c
@@ -43,7 +43,6 @@
#include <unistd.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_suspend/1-1.c"
@@ -53,15 +52,15 @@
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED, void *context PTS_ATTRIBUTE_UNUSED)
+static void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED, void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb **aiocbs;
@@ -77,7 +76,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_suspend_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
index 615b97ddf..46046f3ca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/3-1.c
@@ -31,7 +31,6 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_suspend/2-1.c"
@@ -40,7 +39,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 1024
char buf[BUF_SIZE];
int fd;
@@ -53,7 +52,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_suspend_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/4-1.c
index 0de8c9a96..6e312b6fa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/4-1.c
@@ -33,7 +33,6 @@
#include <unistd.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_suspend/4-1.c"
@@ -61,7 +60,7 @@ static void sigrt2_handler(int signum)
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
struct aiocb aiocbs[NUM_AIOCBS];
struct aiocb *aiolist[NUM_AIOCBS];
struct aiocb *plist[2];
@@ -75,7 +74,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_suspend_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_SYNC | O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/9-1.c
index d7cdf0d87..ba776a5a2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/9-1.c
@@ -36,7 +36,6 @@
#include <unistd.h>
#include "posixtest.h"
-#include "tempfile.h"
#define WAIT_FOR_AIOCB 6
@@ -50,7 +49,7 @@ static void sigrt1_handler()
static int do_test(int num_aiocbs, size_t buf_size)
{
struct timespec processing_completion_ts = {0, 10000000};
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[num_aiocbs];
struct aiocb *plist[2];
@@ -62,7 +61,8 @@ static int do_test(int num_aiocbs, size_t buf_size)
int err = PTS_UNRESOLVED;
int i;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_suspend_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_suspend_9_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-1.c
index 299d19472..c885fa4e2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-1.c
@@ -33,13 +33,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/1-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
char check[BUF_SIZE + 1];
@@ -52,7 +51,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-2.c
index 650cec2d2..f7424fbfc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/1-2.c
@@ -34,13 +34,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/1-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 1024
char buf[BUF_SIZE];
char check[BUF_SIZE * 2];
@@ -53,7 +52,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_1_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_1_2_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/2-1.c
index 2dbfcd1f0..86c9f714f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/2-1.c
@@ -33,13 +33,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/2-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE0 512
char buf0[BUF_SIZE0];
#define BUF_SIZE1 1024
@@ -60,7 +59,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_2_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_APPEND | O_RDWR | O_EXCL,
S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/3-1.c
index ea3f9aa11..8481af357 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/3-1.c
@@ -33,13 +33,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/3-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
char check[BUF_SIZE];
@@ -52,7 +51,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_3_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/5-1.c
index c56f7ebed..b41edcba5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/5-1.c
@@ -32,13 +32,12 @@
#include <time.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/5-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
int fd;
@@ -50,7 +49,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_5_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_5_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c
index 277573a38..016e2e06b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/7-1.c
@@ -31,9 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/7-1.c"
@@ -41,7 +39,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
int fd;
@@ -55,7 +53,8 @@ int main(void)
|| sysconf(_SC_AIO_MAX) == -1)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_7_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/8-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/8-2.c
index 3cc3fd5c1..a2e96fd7e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/8-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/8-2.c
@@ -32,13 +32,12 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/8-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
int fd;
@@ -49,7 +48,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_8_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_8_2_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDONLY | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-1.c
index 68d4d0bdf..402c5c952 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-1.c
@@ -35,13 +35,12 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/9-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 111
char buf[BUF_SIZE];
int fd;
@@ -51,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_9_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-2.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-2.c
index d9ddcb30b..c0ed1f9ae 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_write/9-2.c
@@ -35,13 +35,12 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "aio_write/9-2.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
char buf[BUF_SIZE];
int fd;
@@ -51,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
return PTS_UNSUPPORTED;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_aio_write_9_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_write_9_2_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/1-1.c
index 745df9cc5..14cf174f4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_getcpuclockid/1-1.c
@@ -21,7 +21,7 @@
#include "posixtest.h"
#define LARGENUMBER 900000
-static void dosomething(void)
+void dosomething(void)
{
int i;
for (i = 0; i < LARGENUMBER; i++) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/4-1.c
index a75567437..0830ee19b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_gettime/4-1.c
@@ -19,7 +19,7 @@
#include "posixtest.h"
#define LARGENUMBER 900000
-static void dosomething()
+void dosomething()
{
int i;
for (i = 0; i < LARGENUMBER; i++) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c
index 98de93a9e..125407cec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c
@@ -25,7 +25,7 @@
#define SLEEPSEC 30
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c
index f6adcc938..5dfc2ea48 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c
@@ -21,7 +21,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
index 330618877..dab0a4a90 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
@@ -26,7 +26,7 @@
#define SLEEPSEC 30
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
index 04ef0a2cc..dca43ba45 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
@@ -25,7 +25,7 @@
#define OKDELTA 1
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-2.c
index a431c7656..73c3f69fc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/4-2.c
@@ -32,9 +32,9 @@
#define SIGTOTEST SIGALRM
-static struct timespec tpreset;
+struct timespec tpreset;
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c
index 75fa591e0..62171c71c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c
@@ -34,7 +34,7 @@
#define SIGTOTEST SIGALRM
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c
index b8a60028c..c4ff141a7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c
@@ -34,7 +34,7 @@
#define SIGTOTEST SIGALRM
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h
index 133a579af..f78ee6e71 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/helpers.h
@@ -12,7 +12,7 @@
* in certain tests, they make use of some libraries already included
* by those tests.
*/
-static int getBeforeTime(struct timespec *tpget)
+int getBeforeTime(struct timespec *tpget)
{
if (clock_gettime(CLOCK_REALTIME, tpget) != 0) {
perror("clock_gettime() did not return success\n");
@@ -22,7 +22,7 @@ static int getBeforeTime(struct timespec *tpget)
return PTS_PASS;
}
-static int setBackTime(struct timespec tpset)
+int setBackTime(struct timespec tpset)
{
if (clock_settime(CLOCK_REALTIME, &tpset) != 0) {
perror("clock_settime() did not return success\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-3.c
index befba33eb..78a4f0851 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-3.c
@@ -43,9 +43,9 @@
#define SIGTOTEST SIGALRM
-static int caught = 0;
+int caught = 0;
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-4.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-4.c
index bc9e354fa..10f6076ab 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-4.c
@@ -41,9 +41,9 @@
#define SIGTOTEST SIGALRM
-static int caught = 0;
+int caught = 0;
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
index e31f3896f..a43bc274c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
@@ -47,7 +47,7 @@ static int child(int fd)
if (fcntl(fd, F_SETLK, &fl) == -1) {
if (errno == EACCES || errno == EAGAIN) {
- printf("PASSED: Child locked file already locked by parent\n");
+ printf("PASSED: child did not inherit the lock\n");
return PTS_PASS;
}
@@ -56,7 +56,7 @@ static int child(int fd)
return PTS_UNRESOLVED;
}
- printf("Child did not inherit the lock\n");
+ printf("Child locked file already locked by parent\n");
return PTS_FAIL;
}
@@ -106,6 +106,5 @@ int main(void)
cleanup:
close(fd);
- unlink(path_template);
return result;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/19-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/19-1.c
index 071db60cd..f4c642813 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fork/19-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/19-1.c
@@ -95,7 +95,7 @@ int main(void)
if (mqa.mq_curmsgs != 1) {
mq_close(mq);
mq_unlink(queue_name);
- printf("The queue information does not show the new message\n");
+ printf("The queue information does not show the new message");
return PTS_UNRESOLVED;
}
@@ -153,7 +153,7 @@ int main(void)
if (!WIFEXITED(status) || (WEXITSTATUS(status) != PTS_PASS)) {
mq_close(mq);
mq_unlink(queue_name);
- printf("Child exited abnormally\n");
+ printf("Child exited abnormally");
return PTS_FAIL;
}
@@ -170,7 +170,7 @@ int main(void)
if (mqa.mq_curmsgs != 0) {
mq_close(mq);
mq_unlink(queue_name);
- printf("The message received in child was not dequeued.\n");
+ printf("The message received in child was not dequeued.");
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/2-1.c
index d8b78a734..977d7fe3e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fork/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/2-1.c
@@ -55,7 +55,7 @@ struct test_struct {
void *four;
};
-static void handler(int sig)
+void handler(int sig)
{
(void)sig;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c
index aaf1403f9..75b5f2eb6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c
@@ -49,17 +49,16 @@
#define MESSCAT_IN "messcat.txt"
#define MESSCAT_OUT "messcat.cat"
-static void read_catalog(nl_catd cat, char *who)
+void read_catalog(nl_catd cat, char *who)
{
char *msg = NULL;
int i, j;
+ errno = 0;
#if VERBOSE > 0
output("Reading the message catalog from %s...\n", who);
#endif
- errno = 0;
-
for (i = 1; i <= 2; i++) {
for (j = 1; j <= 2; j++) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fsync/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fsync/4-1.c
index c20087816..8e27c98ab 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fsync/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fsync/4-1.c
@@ -22,20 +22,18 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "fsync/4-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char *data;
int total_size = 1024;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_fsync_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_fsync_4_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-1.c
index 348d8cb73..f5c4745fc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-1.c
@@ -23,7 +23,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-2.c
index d69cebeca..fa2c4ae2b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/killpg/1-2.c
@@ -27,7 +27,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo)
+void myhandler(int signo)
{
(void) signo;
_exit(1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/1-1.c
index 06381002e..5ddaa33d3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/1-1.c
@@ -30,9 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/1-1.c"
@@ -41,16 +39,16 @@
static volatile int received_all = 0;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb **aiocbs;
@@ -65,7 +63,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/10-1.c
index 87ecdf63b..7021de81a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/10-1.c
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/10-1.c"
@@ -41,22 +39,22 @@
static volatile int received_selected;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED, siginfo_t* info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED, siginfo_t* info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_selected = info->si_value.sival_int;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -71,7 +69,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_10_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_10_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/12-1.c
index fe3163da5..db73cb50e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/12-1.c
@@ -28,9 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/12-1.c"
@@ -39,7 +37,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -52,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_12_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_12_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/13-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/13-1.c
index 33915a440..240f343f5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/13-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/13-1.c
@@ -28,9 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/13-1.c"
@@ -39,7 +37,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -52,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_13_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_13_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/14-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/14-1.c
index f398f44a6..640acf227 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/14-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/14-1.c
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/14-1.c"
@@ -41,23 +39,23 @@
static volatile int num_received;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
num_received++;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -72,7 +70,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_14_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_14_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/15-1.c
index a72d6d6e7..2144fba0e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/15-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/15-1.c
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/15-1.c"
@@ -41,23 +39,23 @@
static volatile int num_received;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
num_received++;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -72,7 +70,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_15_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_15_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/18-1.c
index 4b3ecf818..130f7dfbe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/18-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/18-1.c
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/18-1.c"
@@ -40,7 +38,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -50,7 +48,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_18_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_18_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/2-1.c
index 4f458a06b..251089cc9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/2-1.c
@@ -28,9 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/2-1.c"
@@ -40,23 +38,23 @@
static volatile int received_selected;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_selected = info->si_value.sival_int;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -71,7 +69,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_2_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_2_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/3-1.c
index ad3c2814b..ef22e2d4a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/3-1.c
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/3-1.c"
@@ -41,22 +39,22 @@
static volatile int received_selected;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED, siginfo_t *info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_selected = info->si_value.sival_int;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -71,7 +69,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_3_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/4-1.c
index 5d7a99873..023640e6f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/4-1.c
@@ -29,9 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/4-1.c"
@@ -41,23 +39,23 @@
static volatile int num_received;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
num_received++;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -72,7 +70,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/5-1.c
index 7eb64481f..e0d58ad79 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/5-1.c
@@ -31,9 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define NUM_AIOCBS 3
#define BUF_SIZE 1024
@@ -42,7 +40,7 @@
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -55,7 +53,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_5_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/7-1.c
index 4e8afb608..075ff2b9c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/7-1.c
@@ -30,9 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/7-1.c"
@@ -42,23 +40,23 @@
static volatile int num_received;
static volatile int received_all;
-static void sigrt1_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt1_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
num_received++;
}
-static void sigrt2_handler(int signum PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void sigrt2_handler(int signum LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
received_all = 1;
}
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int fd;
struct aiocb *aiocbs[NUM_AIOCBS];
@@ -73,7 +71,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_7_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/8-1.c
index 86803da99..c2cff0c1d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/8-1.c
@@ -31,13 +31,12 @@
#include <aio.h>
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/8-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
unsigned char buf[BUF_SIZE];
unsigned char check[BUF_SIZE];
@@ -51,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_8_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_8_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/9-1.c
index abf9cc06c..13585a120 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/lio_listio/9-1.c
@@ -30,15 +30,13 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "lio_listio/9-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
#define BUF_SIZE 512
unsigned char buf[BUF_SIZE];
unsigned char check[BUF_SIZE];
@@ -52,7 +50,8 @@ int main(void)
if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
exit(PTS_UNSUPPORTED);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_lio_listio_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_lio_listio_9_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/localtime/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/localtime/1-1.c
index 96300dde1..93a646024 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/localtime/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/localtime/1-1.c
@@ -24,7 +24,7 @@ int main(void)
timeptr = localtime(&current_time);
if (timeptr != NULL) {
- printf("date: %s, ", (asctime(localtime((&current_time)))));
+ printf("date: %s", (asctime(localtime((&current_time)))));
puts("Test PASSED");
return PTS_PASS;
} else {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mktime/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mktime/1-1.c
index aa19695d6..a3b329f1f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mktime/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mktime/1-1.c
@@ -15,8 +15,8 @@
#include <time.h>
#include "posixtest.h"
-static struct tm tm_ptr;
-static time_t tps;
+struct tm tm_ptr;
+time_t tps;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mlock/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mlock/12-1.c
index 3f04b1510..d7c32bd04 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mlock/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mlock/12-1.c
@@ -27,7 +27,7 @@
#define BUFSIZE 8
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
struct rlimit rlim;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mlock/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mlock/8-1.c
index d8722c7f6..d9569008b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mlock/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mlock/8-1.c
@@ -12,14 +12,6 @@
* valid mapped pages in the address space of the process.
*
* Assume that the value LONG_MAX is an invalid pointer.
- *
- * aarch64 linux versions v5.4-rc1 up to v5.6-rc3 may incorrectly report
- * EINVAL instead of ENOMEM, the fix patch see:
- * 597399d0cb91 ("arm64: tags: Preserve tags for addresses translated via TTBR1")
- * d0022c0ef29b ("arm64: memory: Add missing brackets to untagged_addr() macro")
- *
- * this bug was introduced because of the following commit, see:
- * 057d3389108e ("mm: untag user pointers passed to memory syscalls")
*/
#include <sys/mman.h>
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mlock/speculative/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mlock/speculative/12-1.c
index 234f374e2..e180d818f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mlock/speculative/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mlock/speculative/12-1.c
@@ -28,7 +28,7 @@
#define BUFSIZE 8
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
struct rlimit rlim;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mlockall/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mlockall/15-1.c
index 1f486092e..09ddd1ca2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mlockall/15-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mlockall/15-1.c
@@ -24,7 +24,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
struct rlimit rlim;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mlockall/speculative/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mlockall/speculative/15-1.c
index 1f486092e..09ddd1ca2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mlockall/speculative/15-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mlockall/speculative/15-1.c
@@ -24,7 +24,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
struct rlimit rlim;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/1-1.c
index 5174800a3..4b9b47d40 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/1-1.c
@@ -24,19 +24,17 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
ssize_t len = 1024;
char data[len];
void *pa;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_1_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/10-1.c
index 2e6c77deb..4248b43b4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/10-1.c
@@ -26,9 +26,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define LOOP_NUM 100000
@@ -37,7 +35,7 @@ int main(void)
int rc;
unsigned long cnt;
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long total_size;
void *pa;
@@ -47,7 +45,7 @@ int main(void)
total_size = 1024;
size = total_size;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_10_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_10_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-1.c
index 3d78a35c9..ef982bb48 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-1.c
@@ -31,13 +31,11 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long page_size;
long total_size;
@@ -50,7 +48,7 @@ int main(void)
total_size = 3 * page_size;
size = page_size;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_11_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c
index d63949418..39aae12dd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-2.c
@@ -29,13 +29,11 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1)
-static void sigbus_handler(int signum)
+void sigbus_handler(int signum)
{
if (signum == SIGBUS) {
WRITE("SIGBUS triggered\n");
@@ -50,7 +48,7 @@ int main(void)
printf("_POSIX_MEMORY_PROTECTION is not defined\n");
return PTS_UNTESTED;
#endif
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long page_size;
long total_size;
@@ -74,7 +72,7 @@ int main(void)
sigaction(SIGBUS, &sa, NULL);
/* Create tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_11_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_2_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c
index 073b64ef9..71455794b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-3.c
@@ -33,7 +33,7 @@
#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1)
-static void sigbus_handler(int signum)
+void sigbus_handler(int signum)
{
if (signum == SIGBUS) {
WRITE("SIGBUS triggered\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c
index 45dc746f3..565e1cf0c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c
@@ -39,19 +39,16 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-#include <limits.h>
#ifdef __linux__
#include <sys/vfs.h>
#endif
-
#include "posixtest.h"
-#include "tempfile.h"
#define TYPE_TMPFS_MAGIC 0x01021994
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long page_size;
char *pa;
@@ -66,11 +63,10 @@ int main(void)
/* mmap will create a partial page */
len = page_size / 2;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_11_4");
#ifdef __linux__
struct statfs buf;
- if (statfs(pts_get_tmpdir(), &buf)) {
+ if (statfs("/tmp", &buf)) {
printf("Error at statfs(): %s\n", strerror(errno));
return PTS_UNRESOLVED;
}
@@ -81,6 +77,7 @@ int main(void)
}
#endif
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_5_%d", getpid());
child = fork();
switch (child) {
case 0:
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-6.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-6.c
index d1f899101..9c1383498 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/11-6.c
@@ -38,13 +38,11 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long page_size;
char *pa, ch;
@@ -59,7 +57,7 @@ int main(void)
/* mmap will create a partial page */
len = page_size / 2;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_11_6");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_11_5_%d", getpid());
child = fork();
switch (child) {
case 0:
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/12-1.c
index b5c6e0def..9c4023c57 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/12-1.c
@@ -30,18 +30,16 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
ssize_t size = 1024;
int fd, i;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_12_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_12_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/13-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/13-1.c
index 611ba85af..d04060cae 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/13-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/13-1.c
@@ -30,14 +30,12 @@
#include <string.h>
#include <errno.h>
#include <time.h>
-
#include "noatime.h"
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
ssize_t size = 1024;
char data[size];
void *pa;
@@ -48,12 +46,12 @@ int main(void)
char *ch;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_13_1");
- if (mounted_noatime(pts_get_tmpdir()) == 1) {
- printf("UNTESTED: The tmpdir is mounted noatime\n");
+ if (mounted_noatime("/tmp") == 1) {
+ printf("UNTESTED: The /tmp is mounted noatime\n");
return PTS_UNTESTED;
}
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_13_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/14-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/14-1.c
index 788b374c4..bcbb4e67c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/14-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/14-1.c
@@ -29,13 +29,11 @@
#include <string.h>
#include <errno.h>
#include <time.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
ssize_t size = 1024;
char data[size];
void *pa;
@@ -46,7 +44,7 @@ int main(void)
char *ch;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_14_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_14_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c
index 113d01b8c..1c151f43d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c
@@ -35,7 +35,7 @@
#include "posixtest.h"
/* Set the euid of this process to a non-root uid */
-static int set_nonroot(void)
+int set_nonroot(void)
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c
index 8ac110c35..ce0e5ef8f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/21-1.c
@@ -24,20 +24,18 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int flag = ~0;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_21_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_21_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
index 6cc8349e1..3d9e4b180 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
@@ -43,7 +43,7 @@ int main(void)
size_t mapped_size = 0;
- snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_24_1_%d", getpid());
+ snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_25_1_%d", getpid());
/* Create shared object */
shm_unlink(tmpfname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/27-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/27-1.c
index 3b2ad0298..b69274364 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/27-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/27-1.c
@@ -27,20 +27,18 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
int total_size = 1024;
void *pa;
size_t len = total_size;
int fd, err = 0;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_27_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_27_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/3-1.c
index c92e30641..18867d95b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/3-1.c
@@ -29,15 +29,13 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#ifdef MAP_FIXED
int main(void)
{
- char tmpfname[PATH_MAX];
- char tmpfname2[PATH_MAX];
+ char tmpfname[256];
+ char tmpfname2[256];
char *data;
long total_size;
long page_size;
@@ -59,8 +57,10 @@ int main(void)
/* Size of the file */
total_size = 2 * page_size;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_3_1_1");
- PTS_GET_TMP_FILENAME(tmpfname2, "pts_mmap_3_1_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_3_1_%d_1",
+ getpid());
+ snprintf(tmpfname2, sizeof(tmpfname2), "/tmp/pts_mmap_3_1_%d_2",
+ getpid());
unlink(tmpfname);
unlink(tmpfname2);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/31-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/31-1.c
index 7420d4496..4c594da7b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/31-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/31-1.c
@@ -34,13 +34,11 @@
#include <string.h>
#include <errno.h>
#include <sys/utsname.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t len;
@@ -49,7 +47,7 @@ int main(void)
/* check for 64 bit arch */
if (sizeof(void *) == 8) {
- printf("UNSUPPORTED: Cannot be tested on 64 bit architecture\n");
+ printf("USUPPORTED: Cannot be tested on 64 bit architecture\n");
return PTS_UNSUPPORTED;
}
@@ -67,7 +65,7 @@ int main(void)
long page_size = sysconf(_SC_PAGE_SIZE);
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_31_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_31_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/32-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/32-1.c
index d58fc8c4f..7ab526066 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/32-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/32-1.c
@@ -20,18 +20,16 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_32_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_31_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c
index bcb330da6..6d846538d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/5-1.c
@@ -30,16 +30,14 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
-static struct testcase {
+struct testcase {
int prot;
int flags;
};
-static struct testcase testcases[] = {
+struct testcase testcases[] = {
{.flags = MAP_SHARED,.prot = PROT_NONE},
{.flags = MAP_SHARED,.prot = PROT_READ},
{.flags = MAP_SHARED,.prot = PROT_WRITE},
@@ -89,13 +87,13 @@ static void print_error(struct testcase *t, int saved_errno)
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int fd, fail = 0;
unsigned int i;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_5_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_5_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-1.c
index 609102904..ebded92be 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-1.c
@@ -36,14 +36,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
#ifdef _POSIX_MEMORY_PROTECTION
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int fd;
@@ -52,7 +50,7 @@ int main(void)
int status;
int sig_num;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_6_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-2.c
index 6d06dbf98..0ffa82052 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-2.c
@@ -37,14 +37,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
#ifdef _POSIX_MEMORY_PROTECTION
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
ssize_t size = 1024;
char data[size];
void *pa;
@@ -54,7 +52,7 @@ int main(void)
int status;
int sig_num;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_6_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_2_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-3.c
index 9aef16c45..fd413b35b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-3.c
@@ -37,14 +37,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
#ifdef _POSIX_MEMORY_PROTECTION
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int fd;
@@ -53,7 +51,7 @@ int main(void)
int status;
int sig_num;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_6_3");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_2_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-4.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-4.c
index 44a616e3b..27f3cbd65 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-4.c
@@ -29,18 +29,16 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_6_4");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_4_%d", getpid());
/* Create a tmp file */
unlink(tmpfname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c
index 33c0575c5..a21432fd6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c
@@ -29,19 +29,17 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int fd;
/* Create the file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_6_5");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_5_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-6.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-6.c
index b707a2cb5..6672c96c3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/6-6.c
@@ -28,19 +28,17 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
void *pa;
size_t size = 1024;
int fd;
/* Create the tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_6_6");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_6_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-1.c
index 6be5e52e7..d7cfdde67 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-1.c
@@ -35,19 +35,17 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
ssize_t size = 1024;
char data[size];
void *pa;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_7_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_7_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-2.c
index b923e1b2c..e90f812f8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/7-2.c
@@ -35,19 +35,17 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
ssize_t size = 1024;
char data[size];
void *pa;
int fd;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_7_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_7_2_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/9-1.c
index 883003351..8130ce768 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/9-1.c
@@ -29,13 +29,11 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long page_size;
long total_size;
@@ -49,7 +47,7 @@ int main(void)
size = total_size;
/* Create tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_mmap_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_9_1_%d", getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
index dc03d21db..3574fccca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_close/2-1.c
@@ -35,10 +35,10 @@
#define PIPE_READ 0
#define PIPE_WRITE 1
-static int parent_process(char *qname, int read_pipe, int write_pipe, pid_t child_pid);
-static int child_process(char *qname, int read_pipe, int write_pipe);
-static mqd_t open_queue(char *qname, int oflag, int mode);
-static int send_receive(int read_pipe, int write_pipe, char send, char *reply);
+int parent_process(char *qname, int read_pipe, int write_pipe, pid_t child_pid);
+int child_process(char *qname, int read_pipe, int write_pipe);
+mqd_t open_queue(char *qname, int oflag, int mode);
+int send_receive(int read_pipe, int write_pipe, char send, char *reply);
int main(void)
{
@@ -92,8 +92,8 @@ int main(void)
return PTS_UNRESOLVED;
}
-static int parent_process(char *qname, int read_pipe, int write_pipe,
- pid_t child_pid PTS_ATTRIBUTE_UNUSED)
+int parent_process(char *qname, int read_pipe, int write_pipe,
+ pid_t child_pid LTP_ATTRIBUTE_UNUSED)
{
mqd_t queue;
struct sigevent se;
@@ -153,7 +153,7 @@ static int parent_process(char *qname, int read_pipe, int write_pipe,
}
}
-static int child_process(char *qname, int read_pipe, int write_pipe)
+int child_process(char *qname, int read_pipe, int write_pipe)
{
mqd_t queue;
struct sigevent se;
@@ -202,7 +202,7 @@ static int child_process(char *qname, int read_pipe, int write_pipe)
return 0;
}
-static mqd_t open_queue(char *qname, int oflag, int mode)
+mqd_t open_queue(char *qname, int oflag, int mode)
{
mqd_t queue;
@@ -214,7 +214,7 @@ static mqd_t open_queue(char *qname, int oflag, int mode)
return queue;
}
-static int send_receive(int read_pipe, int write_pipe, char send, char *reply)
+int send_receive(int read_pipe, int write_pipe, char send, char *reply)
{
ssize_t bytes;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/1-1.c
index 6c1a7122e..ed7e76649 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/1-1.c
@@ -36,14 +36,14 @@
#define NAMESIZE 50
#define MSG_SIZE 50
-static int enter_handler = 0;
+int enter_handler = 0;
-static void msg_handler()
+void msg_handler()
{
enter_handler = 1;
}
-static void mqclean(mqd_t queue, const char *qname)
+void mqclean(mqd_t queue, const char *qname)
{
mq_close(queue);
mq_unlink(qname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/2-1.c
index 379ed0e75..79cf5a319 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/2-1.c
@@ -33,7 +33,7 @@
#define NAMESIZE 50
-static void mqclean(mqd_t queue, const char *qname)
+void mqclean(mqd_t queue, const char *qname)
{
mq_close(queue);
mq_unlink(qname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/3-1.c
index bc4a061e6..2ddc68baa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/3-1.c
@@ -36,14 +36,14 @@
#define MSG_SIZE 50
#define NAMESIZE 50
-static int enter_handler = 0;
+int enter_handler = 0;
-static void msg_handler()
+void msg_handler()
{
enter_handler = 1;
}
-static void mqclean(mqd_t queue, const char *qname)
+void mqclean(mqd_t queue, const char *qname)
{
mq_close(queue);
mq_unlink(qname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/4-1.c
index 3fe7c78ad..d94d6bdb8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/4-1.c
@@ -33,14 +33,14 @@
#define MSG_SIZE 50
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static int enter_handler = 0;
+int enter_handler = 0;
-static void msg_handler()
+void msg_handler()
{
enter_handler = 1;
}
-static void mqclean(mqd_t queue, const char *qname)
+void mqclean(mqd_t queue, const char *qname)
{
mq_close(queue);
mq_unlink(qname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/5-1.c
index f8119b0f7..bf5ce5970 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/5-1.c
@@ -44,14 +44,14 @@
#define MSG_SIZE 40
#define BUFFER 40
-static int enter_handler = 0;
+int enter_handler = 0;
-static void msg_handler()
+void msg_handler()
{
enter_handler = 1;
}
-static void mqclean(mqd_t queue, const char *qname)
+void mqclean(mqd_t queue, const char *qname)
{
mq_close(queue);
mq_unlink(qname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/9-1.c
index edb58d5a4..3a3cb3e2b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_notify/9-1.c
@@ -32,7 +32,7 @@
#define NAMESIZE 50
-static void mqclean(mqd_t queue, const char *qname)
+void mqclean(mqd_t queue, const char *qname)
{
mq_close(queue);
mq_unlink(qname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c
index eee55a748..b7d064b06 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/16-1.c
@@ -31,16 +31,15 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
+#define NAMESIZE 50
#define TNAME "mq_open/16-1.c"
int main(void)
{
- char qname[NAME_MAX];
- char fname[PATH_MAX];
+ char qname[NAMESIZE];
+ char fname[NAMESIZE];
int pid, succeeded = 0;
int fd;
void *pa = NULL;
@@ -54,7 +53,7 @@ int main(void)
sprintf(qname, "/mq_open_16-1_%d", getpid());
- PTS_GET_TMP_FILENAME(fname, "pts_mq_open_16_1");
+ sprintf(fname, "/tmp/pts_mq_open_16_1_%d", getpid());
unlink(fname);
fd = open(fname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/2-1.c
index 81648d720..57f88dd94 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/2-1.c
@@ -37,7 +37,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
return;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/20-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/20-1.c
index 92deec705..09966ec9e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/20-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/20-1.c
@@ -26,7 +26,7 @@
#define NAMESIZE 50
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
#ifdef DEBUG
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/7-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/7-2.c
index a74c94db9..db1e7c435 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/7-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/7-2.c
@@ -34,7 +34,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
return;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/8-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/8-2.c
index d05603ce8..35d1683e8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/8-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/8-2.c
@@ -34,7 +34,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
return;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/9-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/9-2.c
index fc69d09f6..35459b071 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_open/9-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_open/9-2.c
@@ -34,7 +34,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo)
+void handler(int signo)
{
(void) signo;
return;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_receive/13-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_receive/13-1.c
index d0e684ee8..03ac62c43 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_receive/13-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_receive/13-1.c
@@ -33,7 +33,7 @@
#define NAMESIZE 50
#define BUFFER 40
-static void stopreceive(int signo PTS_ATTRIBUTE_UNUSED)
+void stopreceive(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/12-1.c
index 9a1dc1b36..f63b50d89 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/12-1.c
@@ -39,14 +39,14 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void justreturn_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void justreturn_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c
index a2b3025d4..f5675ff73 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-1.c
@@ -44,12 +44,12 @@
#define BUFFER 40
#define MAXMSG 5
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
-static int sync_pipes[2];
+int sync_pipes[2];
-static int cleanup_for_exit(int gqueue, char *gqname, int ret)
+int cleanup_for_exit(int gqueue, char *gqname, int ret)
{
mq_close(gqueue);
mq_unlink(gqname);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-2.c
index 541558d76..c06d94d51 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_send/5-2.c
@@ -37,14 +37,14 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void justreturn_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void justreturn_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-1.c
index 7d0521a66..e8dc56197 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-1.c
@@ -35,8 +35,8 @@
#define BUFFER 40
#define TIMEOUT 3
-static int blocking;
-static void exit_handler(int signo PTS_ATTRIBUTE_UNUSED)
+int blocking;
+void exit_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("FAIL: the case is blocking, exit anyway\n");
blocking = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-2.c
index 7f4bd71cc..05802b60e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/18-2.c
@@ -36,8 +36,8 @@
#define BUFFER 40
#define TIMEOUT 3
-static int blocking;
-static void exit_handler(int signo PTS_ATTRIBUTE_UNUSED)
+int blocking;
+void exit_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("FAIL: the case is blocking, exit anyway\n");
blocking = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-2.c
index 31fa2fde7..9398327fd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-2.c
@@ -35,8 +35,8 @@
#define TIMEOUT 3
#define THRESHOLD (TIMEOUT - 1)
-static int blocking;
-static void exit_handler(int signo PTS_ATTRIBUTE_UNUSED)
+int blocking;
+void exit_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("FAIL: the case is blocking, exit anyway\n");
blocking = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
index a843c13ee..f062cd760 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-3.c
@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <time.h>
#include "posixtest.h"
#define TEST "5-3"
@@ -38,7 +37,7 @@
#define NAMESIZE 50
#define BUFFER 40
-static void stopreceive(int signo PTS_ATTRIBUTE_UNUSED)
+void stopreceive(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
@@ -55,8 +54,7 @@ int main(void)
sprintf(mqname, "/" FUNCTION "_" TEST "_%d", getpid());
attr.mq_msgsize = BUFFER;
- attr.mq_maxmsg = 1;
-
+ attr.mq_maxmsg = BUFFER;
mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
if (mqdes == (mqd_t) - 1) {
perror(ERROR_PREFIX "mq_open");
@@ -72,21 +70,20 @@ int main(void)
sigemptyset(&act.sa_mask);
sigaction(SIGABRT, &act, 0);
- ts.tv_sec = time(NULL) + 5;
+ ts.tv_sec = INT32_MAX;
ts.tv_nsec = 0;
if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) == -1) {
+ wait(NULL);
if (EINTR != errno) {
printf("errno != EINTR\n");
failure = 1;
}
} else {
- printf("mq_timedreceive() succeeded unexpectedly\n");
+ wait(NULL);
+ printf("mq_timedreceive() succeed unexpectly\n");
failure = 1;
}
-
- wait(NULL);
-
if (mq_close(mqdes) != 0) {
perror("mq_close() did not return success");
unresolved = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/8-1.c
index 69428111f..b1f9a3e96 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/8-1.c
@@ -32,8 +32,8 @@
#define BUFFER 40
#define TIMEOUT 3
-static int blocking;
-static void exit_handler(int signo PTS_ATTRIBUTE_UNUSED)
+int blocking;
+void exit_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("FAIL: the case is blocking, exit anyway\n");
blocking = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/12-1.c
index f76c8bd7e..f75ef6481 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/12-1.c
@@ -51,18 +51,18 @@ static volatile int in_handler;
/* errno returned by mq_timedsend() */
static int mq_timedsend_errno = -1;
-static pthread_barrier_t barrier;
+pthread_barrier_t barrier;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void justreturn_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void justreturn_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
in_handler++;
}
-static void *a_thread_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *a_thread_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int i, ret;
struct sigaction act;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/15-1.c
index 80452fd73..e86cd6074 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/15-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/15-1.c
@@ -37,10 +37,10 @@
#define BUFFER 40
#define MAXMSG 5
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
-static void testfailed_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void testfailed_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Timeout never happened\n");
printf("Test FAILED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/16-1.c
index 88360cd29..bfd58b550 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/16-1.c
@@ -44,14 +44,14 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void stopsleep_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void stopsleep_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/19-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/19-1.c
index dd25c0119..93667a161 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/19-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/19-1.c
@@ -32,7 +32,7 @@
#define BUFFER 40
#define MAXMSG 5
-static int invalid_tests[NUMTESTS] = { -1, INT32_MIN, 1000000000, 1000000001,
+int invalid_tests[NUMTESTS] = { -1, INT32_MIN, 1000000000, 1000000001,
INT32_MAX
};
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/20-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/20-1.c
index d2a4e13c3..54e65f099 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/20-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/20-1.c
@@ -37,10 +37,10 @@
#define BUFFER 40
#define MAXMSG 5
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
-static void testfailed_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void testfailed_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Timeout never happened\n");
printf("Test FAILED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
index fb4a81fef..7d8ddf82c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
@@ -40,14 +40,14 @@
#define BUFFER 40
#define MAXMSG 5
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void stopsleep_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void stopsleep_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c
index c3f36b20c..05e6bbef6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c
@@ -38,14 +38,14 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void justreturn_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void justreturn_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-3.c
index 3b17b1aa4..b910c8b1b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-3.c
@@ -41,14 +41,14 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static char gqname[NAMESIZE];
-static mqd_t gqueue;
+char gqname[NAMESIZE];
+mqd_t gqueue;
/*
* This handler is just used to catch the signal and stop sleep (so the
* parent knows the child is still busy sending signals).
*/
-static void stopsleep_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void stopsleep_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-1.c
index 70257b570..e8865da02 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-1.c
@@ -44,9 +44,9 @@
#define NAMESIZE 50
-static int parent_process(char *mqname, int read_pipe, int write_pipe, pid_t child_pid);
-static int child_process(char *mqname, int read_pipe, int write_pipe);
-static int send_receive(int read_pipe, int write_pipe, char send, char *reply);
+int parent_process(char *mqname, int read_pipe, int write_pipe, pid_t child_pid);
+int child_process(char *mqname, int read_pipe, int write_pipe);
+int send_receive(int read_pipe, int write_pipe, char send, char *reply);
int main(void)
{
@@ -93,8 +93,8 @@ int main(void)
}
}
-static int parent_process(char *mqname, int read_pipe, int write_pipe,
- pid_t child_pid PTS_ATTRIBUTE_UNUSED)
+int parent_process(char *mqname, int read_pipe, int write_pipe,
+ pid_t child_pid LTP_ATTRIBUTE_UNUSED)
{
mqd_t mqdes;
char reply;
@@ -136,7 +136,7 @@ static int parent_process(char *mqname, int read_pipe, int write_pipe,
return PTS_UNRESOLVED;
}
-static int child_process(char *mqname, int read_pipe, int write_pipe)
+int child_process(char *mqname, int read_pipe, int write_pipe)
{
mqd_t mqdes;
int rval;
@@ -160,7 +160,7 @@ static int child_process(char *mqname, int read_pipe, int write_pipe)
return 0;
}
-static int send_receive(int read_pipe, int write_pipe, char send, char *reply)
+int send_receive(int read_pipe, int write_pipe, char send, char *reply)
{
ssize_t bytes;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-2.c
index 3445ebaea..5668f901f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_unlink/2-2.c
@@ -39,9 +39,9 @@
#define FUNCTION "mq_unlink"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static int parent_process(char *mqname, int read_pipe, int write_pipe, pid_t child_pid);
-static int child_process(char *mqname, int read_pipe, int write_pipe);
-static int send_receive(int read_pipe, int write_pipe, char send, char *reply);
+int parent_process(char *mqname, int read_pipe, int write_pipe, pid_t child_pid);
+int child_process(char *mqname, int read_pipe, int write_pipe);
+int send_receive(int read_pipe, int write_pipe, char send, char *reply);
int main(void)
{
@@ -88,8 +88,8 @@ int main(void)
}
}
-static int parent_process(char *mqname, int read_pipe, int write_pipe,
- pid_t child_pid PTS_ATTRIBUTE_UNUSED)
+int parent_process(char *mqname, int read_pipe, int write_pipe,
+ pid_t child_pid LTP_ATTRIBUTE_UNUSED)
{
mqd_t mqdes;
char reply;
@@ -138,7 +138,7 @@ static int parent_process(char *mqname, int read_pipe, int write_pipe,
return PTS_UNRESOLVED;
}
-static int child_process(char *mqname, int read_pipe, int write_pipe)
+int child_process(char *mqname, int read_pipe, int write_pipe)
{
mqd_t mqdes;
int rval;
@@ -176,7 +176,7 @@ static int child_process(char *mqname, int read_pipe, int write_pipe)
return 0;
}
-static int send_receive(int read_pipe, int write_pipe, char send, char *reply)
+int send_receive(int read_pipe, int write_pipe, char send, char *reply)
{
ssize_t bytes;
if (send) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/munlock/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/munlock/10-1.c
index e1c13d5fc..cf870289b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/munlock/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/munlock/10-1.c
@@ -12,14 +12,6 @@
* valid mapped pages in the address space of the process.
*
* Assume that the value LONG_MAX is an invalid pointer.
- *
- * aarch64 linux versions v5.4-rc1 up to v5.6-rc3 may incorrectly report
- * EINVAL instead of ENOMEM, the fix patch see:
- * 597399d0cb91 ("arm64: tags: Preserve tags for addresses translated via TTBR1")
- * d0022c0ef29b ("arm64: memory: Add missing brackets to untagged_addr() macro")
- *
- * this bug was introduced because of the following commit, see:
- * 057d3389108e ("mm: untag user pointers passed to memory syscalls")
*/
#include <sys/mman.h>
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-1.c
index 9a17063cb..7f8b9ca6b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-1.c
@@ -30,13 +30,11 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "munmap/1-1.c"
-static void sigsegv_handler(int signum PTS_ATTRIBUTE_UNUSED)
+void sigsegv_handler(int signum LTP_ATTRIBUTE_UNUSED)
{
printf("Got SIGSEGV\n");
printf("Test PASSED\n");
@@ -45,7 +43,7 @@ static void sigsegv_handler(int signum PTS_ATTRIBUTE_UNUSED)
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long file_size;
void *pa = NULL;
@@ -73,7 +71,8 @@ int main(void)
len = page_size + 1;
/* Create tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_munmap_1_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-2.c
index 31f2109a4..59e63300e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/munmap/1-2.c
@@ -30,13 +30,11 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "munmap/1-2.c"
-static void sigsegv_handler(int signum PTS_ATTRIBUTE_UNUSED)
+void sigsegv_handler(int signum LTP_ATTRIBUTE_UNUSED)
{
printf("Got SIGSEGV\n");
printf("Test PASSED\n");
@@ -45,7 +43,7 @@ static void sigsegv_handler(int signum PTS_ATTRIBUTE_UNUSED)
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long file_size;
void *pa = NULL;
@@ -73,7 +71,8 @@ int main(void)
len = page_size + 1;
/* Create tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_munmap_1_2");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/munmap/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/munmap/3-1.c
index 18797195b..cca9028c8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/munmap/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/munmap/3-1.c
@@ -24,15 +24,13 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "munmap/3-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long file_size;
void *pa = NULL;
@@ -54,7 +52,8 @@ int main(void)
len = page_size + 1;
/* Create tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_munmap_3_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/munmap/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/munmap/4-1.c
index 3c05ab042..7e90a97a4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/munmap/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/munmap/4-1.c
@@ -30,9 +30,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "munmap/4-1.c"
@@ -40,7 +38,7 @@ int main(void)
{
int rc;
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
char *data;
int total_size = 1024;
@@ -54,7 +52,8 @@ int main(void)
char *ch;
- PTS_GET_TMP_FILENAME(tmpfname, "pts_munmap_4_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_4_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/munmap/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/munmap/9-1.c
index 371e3b0b6..ce0b06f35 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/munmap/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/munmap/9-1.c
@@ -21,15 +21,13 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-
#include "posixtest.h"
-#include "tempfile.h"
#define TNAME "munmap/9-1.c"
int main(void)
{
- char tmpfname[PATH_MAX];
+ char tmpfname[256];
long file_size;
void *pa = NULL;
@@ -49,7 +47,8 @@ int main(void)
len = page_size + 1;
/* Create tmp file */
- PTS_GET_TMP_FILENAME(tmpfname, "pts_munmap_9_1");
+ snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
+ getpid());
unlink(tmpfname);
fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
if (fd == -1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c
index 31ac00858..9f227f966 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/1-3.c
@@ -16,7 +16,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("In handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-1.c
index bc6f7fbab..7f4e4a86e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/3-1.c
@@ -22,7 +22,7 @@
#define CHILDSUCCESS 1
#define CHILDFAIL 0
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Received signal - exit success\n");
exit(CHILDSUCCESS);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/5-2.c
index ecb8bd828..ac3c3c7f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/5-2.c
@@ -19,7 +19,7 @@
#define CHILDSUCCESS 1
#define CHILDFAILURE 0
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("In handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-1.c
index e9c8ebe51..17a49081f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-1.c
@@ -20,7 +20,7 @@
#define CHILDSUCCESS 1
#define CHILDFAILURE 0
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("In handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c
index caf4470e4..8e761be47 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/nanosleep/7-2.c
@@ -22,7 +22,7 @@
#define OKDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("In handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-1.c
index f4f2dcfdc..ac61f42a5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-1.c
@@ -34,9 +34,9 @@
#define HANDLER_NOTCALLED 0
#define HANDLER_CALLED 1
-static int prep_val;
-static int parent_val;
-static int child_val;
+int prep_val;
+int parent_val;
+int child_val;
static void prepare_handler()
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-2.c
index 6e89b8a05..bd86920a6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-2.c
@@ -86,28 +86,28 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static pthread_t threads[3];
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-static pthread_t ch;
+pthread_t threads[3];
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+pthread_t ch;
/* at fork handlers */
-static void prepare(void)
+void prepare(void)
{
threads[0] = pthread_self();
}
-static void parent(void)
+void parent(void)
{
threads[1] = pthread_self();
}
-static void child(void)
+void child(void)
{
threads[2] = pthread_self();
}
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, status;
pid_t child, ctl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/2-2.c
index a19b029bc..8aca4a4fa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/2-2.c
@@ -75,8 +75,8 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int iPrepare = 0, iParent = 0, iChild = 0;
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+int iPrepare = 0, iParent = 0, iChild = 0;
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
/* pthread_atfork handlers */
/* 0: NULL NULL NULL (1)
@@ -89,53 +89,53 @@ static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
The ultimate combination is already tested in other testcase.
tot: 50 84 104
*/
-static void p1(void)
+void p1(void)
{
iPrepare |= 1 << 1;
}
-static void p4(void)
+void p4(void)
{
iPrepare |= 1 << 4;
}
-static void p5(void)
+void p5(void)
{
iPrepare |= 1 << 5;
}
-static void pa2(void)
+void pa2(void)
{
iParent |= 1 << 2;
}
-static void pa4(void)
+void pa4(void)
{
iParent |= 1 << 4;
}
-static void pa6(void)
+void pa6(void)
{
iParent |= 1 << 6;
}
-static void c3(void)
+void c3(void)
{
iChild |= 1 << 3;
}
-static void c5(void)
+void c5(void)
{
iChild |= 1 << 5;
}
-static void c6(void)
+void c6(void)
{
iChild |= 1 << 6;
}
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, status;
pid_t child, ctl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-2.c
index e90a06a5c..d630ee6ab 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-2.c
@@ -75,28 +75,28 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-static int controls[3] = { 0, 0, 0 };
+int controls[3] = { 0, 0, 0 };
/* pthread_atfork handlers */
-static void prepare(void)
+void prepare(void)
{
controls[0]++;
}
-static void parent(void)
+void parent(void)
{
controls[1]++;
}
-static void child(void)
+void child(void)
{
controls[2]++;
}
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, status;
pid_t child, ctl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-3.c
index 32b91872b..5757c572b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-3.c
@@ -77,15 +77,15 @@
/***************************** Test case *********************************/
/******************************************************************************/
-static volatile char do_it = 1;
-static unsigned long count_ope = 0;
+char do_it = 1;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -95,7 +95,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -134,7 +134,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -145,7 +145,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -155,23 +155,23 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
#endif
}
-static void prepare(void)
+void prepare(void)
{
return;
}
-static void parent(void)
+void parent(void)
{
return;
}
-static void child(void)
+void child(void)
{
return;
}
/* Test function -- calls pthread_setschedparam() and checks that EINTR is never returned. */
-static void *test(void *arg PTS_ATTRIBUTE_UNUSED)
+void *test(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/4-1.c
index 98a7d9101..23ff6b4e2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/4-1.c
@@ -76,13 +76,13 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-static int control = 0;
-static int nerrors = 0;
+int control = 0;
+int nerrors = 0;
/* pthread_atfork handlers */
-static void pre3(void)
+void pre3(void)
{
control++;
@@ -90,7 +90,7 @@ static void pre3(void)
nerrors++;
}
-static void pre2(void)
+void pre2(void)
{
control++;
@@ -98,7 +98,7 @@ static void pre2(void)
nerrors++;
}
-static void pre1(void)
+void pre1(void)
{
control++;
@@ -106,7 +106,7 @@ static void pre1(void)
nerrors++;
}
-static void par1(void)
+void par1(void)
{
control++;
@@ -114,7 +114,7 @@ static void par1(void)
nerrors++;
}
-static void par2(void)
+void par2(void)
{
control++;
@@ -122,7 +122,7 @@ static void par2(void)
nerrors++;
}
-static void par3(void)
+void par3(void)
{
control++;
@@ -130,7 +130,7 @@ static void par3(void)
nerrors++;
}
-static void chi1(void)
+void chi1(void)
{
control += 2;
@@ -138,7 +138,7 @@ static void chi1(void)
nerrors++;
}
-static void chi2(void)
+void chi2(void)
{
control += 2;
@@ -146,7 +146,7 @@ static void chi2(void)
nerrors++;
}
-static void chi3(void)
+void chi3(void)
{
control += 2;
@@ -155,7 +155,7 @@ static void chi3(void)
}
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, status;
pid_t child, ctl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_destroy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_destroy/1-1.c
index a425d9fa0..7f0ea9aff 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_destroy/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_destroy/1-1.c
@@ -24,7 +24,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c
index 78e843c86..cd983afce 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getinheritsched/1-1.c
@@ -26,7 +26,7 @@
#define EXPLICIT PTHREAD_EXPLICIT_SCHED
#define INHERIT PTHREAD_INHERIT_SCHED
-static int verify_inheritsched(pthread_attr_t * attr, int schedtype)
+int verify_inheritsched(pthread_attr_t * attr, int schedtype)
{
int rc;
int inheritsched;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c
index 82bf960d5..9d8bb064a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedparam/1-1.c
@@ -28,7 +28,7 @@
#define RRPOLICY SCHED_RR
#define OTHERPOLICY SCHED_OTHER
-static int verify_param(pthread_attr_t * attr, int priority)
+int verify_param(pthread_attr_t * attr, int priority)
{
int rc;
struct sched_param param;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c
index 70818e29e..6c3a2dd36 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getschedpolicy/2-1.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include "posixtest.h"
-#define TEST "2-1"
+#define TEST "1-1"
#define FUNCTION "pthread_attr_getschedpolicy"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
@@ -27,7 +27,7 @@
#define RRPOLICY SCHED_RR
#define OTHERPOLICY SCHED_OTHER
-static int verify_policy(pthread_attr_t * attr, int policytype)
+int verify_policy(pthread_attr_t * attr, int policytype)
{
int rc;
int policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getscope/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getscope/1-1.c
index 93116aa89..230e24e99 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getscope/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getscope/1-1.c
@@ -28,7 +28,7 @@
#define SYSTEMSCOPE PTHREAD_SCOPE_SYSTEM
#define PROCESSSCOPE PTHREAD_SCOPE_PROCESS
-static int verify_scope(pthread_attr_t * attr, int scopetype)
+int verify_scope(pthread_attr_t * attr, int scopetype)
{
int rc;
int scope;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/2-1.c
index f2b2a546f..0add4ce78 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/2-1.c
@@ -31,9 +31,9 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
+int sem1; /* Manual semaphore */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Indicate to main() that the thread was created. */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/3-1.c
index aeca480bc..d35779510 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_init/3-1.c
@@ -23,7 +23,7 @@
#define NUM_THREADS 5
-static void *a_thread_func(void *attr PTS_ATTRIBUTE_UNUSED)
+void *a_thread_func(void *attr LTP_ATTRIBUTE_UNUSED)
{
pthread_exit(NULL);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setdetachstate/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setdetachstate/2-1.c
index bda3831d1..f7fcc592b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setdetachstate/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setdetachstate/2-1.c
@@ -25,7 +25,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c
index 19bb3b5e0..6b67404d1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/1-1.c
@@ -26,7 +26,7 @@
#define EXPLICIT PTHREAD_EXPLICIT_SCHED
#define INHERIT PTHREAD_INHERIT_SCHED
-static int verify_inheritsched(pthread_attr_t * attr, int schedtype)
+int verify_inheritsched(pthread_attr_t * attr, int schedtype)
{
int rc;
int inheritsched;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c
index 15fa9df51..edded2116 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-1.c
@@ -29,8 +29,8 @@
#define FUNCTION "pthread_attr_setinheritsched"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static const long int policy = SCHED_FIFO;
-static void *thread_func()
+const long int policy = SCHED_FIFO;
+void *thread_func()
{
int rc;
int new_policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c
index 1901df032..db31de4eb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-2.c
@@ -34,9 +34,9 @@
#define FUNCTION "pthread_attr_setinheritsched"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static const long int policy = SCHED_FIFO;
-static const long int old_policy = SCHED_OTHER;
-static void *thread_func(void *arg PTS_ATTRIBUTE_UNUSED)
+const long int policy = SCHED_FIFO;
+const long int old_policy = SCHED_OTHER;
+void *thread_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
int new_policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c
index ae268c822..4d8d496dc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-3.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include "posixtest.h"
-#define TEST "2-3"
+#define TEST "4-1"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -29,10 +29,10 @@
#define POLICY SCHED_FIFO
/* Flags that the threads use to indicate events */
-static int policy_correct = -1;
-static int priority_correct = -1;
+int policy_correct = -1;
+int priority_correct = -1;
-static void *thread(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *thread(void *tmp LTP_ATTRIBUTE_UNUSED)
{
struct sched_param param;
int policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c
index dbc6abfc7..b716c4323 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setinheritsched/2-4.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include "posixtest.h"
-#define TEST "2-4"
+#define TEST "4-2"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -29,10 +29,10 @@
#define POLICY SCHED_RR
/* Flags that the threads use to indicate events */
-static int policy_correct = -1;
-static int priority_correct = -1;
+int policy_correct = -1;
+int priority_correct = -1;
-static void *thread(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *thread(void *tmp LTP_ATTRIBUTE_UNUSED)
{
struct sched_param param;
int policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c
index ba91fbcf5..bee2aa067 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-1.c
@@ -25,9 +25,9 @@
#define FIFOPOLICY SCHED_FIFO
-static volatile int thread_created = 0;
+volatile int thread_created = 0;
-static void *thread_func()
+void *thread_func()
{
thread_created = 1;
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c
index 58829ffb6..30f3add0e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-2.c
@@ -26,9 +26,9 @@
#define RRPOLICY SCHED_RR
-static volatile int thread_created = 0;
+volatile int thread_created = 0;
-static void *thread_func()
+void *thread_func()
{
thread_created = 1;
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c
index a09227d8d..16eb3c7a8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-3.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include "posixtest.h"
-#define TEST "1-3"
+#define TEST "3-1"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -29,12 +29,12 @@
#define POLICY SCHED_FIFO
/* the thread uses this to indicate to main or success */
-static int policy_correct = -1;
+int policy_correct = -1;
/* the thread uses this to indicate to main or success */
-static int priority_correct = -1;
+int priority_correct = -1;
/* Thread function which checks the scheduler settings for itself */
-static void *thread(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *thread(void *tmp LTP_ATTRIBUTE_UNUSED)
{
struct sched_param param;
int policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c
index ee06d4390..72b0246a0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include "posixtest.h"
-#define TEST "1-4"
+#define TEST "3-2"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -29,12 +29,12 @@
#define POLICY SCHED_RR
/* the thread uses this to indicate to main or success */
-static int policy_correct = -1;
+int policy_correct = -1;
/* the thread uses this to indicate to main or success */
-static int priority_correct = -1;
+int priority_correct = -1;
/* Thread function which checks the scheduler settings for itself */
-static void *thread(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *thread(void *tmp LTP_ATTRIBUTE_UNUSED)
{
struct sched_param param;
int policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c
index c06c372fa..189209117 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/speculative/3-2.c
@@ -19,7 +19,7 @@
#include "posixtest.h"
#define TEST "3-2"
-#define FUNCTION "pthread_attr_setschedparam"
+#define FUNCTION "pthread_attr_setschedpaarm"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
#define RRPOLICY SCHED_RR
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
index 388897eeb..947238116 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/2-1.c
@@ -49,7 +49,7 @@ static int thread_started;
exit(PTS_UNRESOLVED); \
}
-static void *thread_func(void *data PTS_ATTRIBUTE_UNUSED)
+static void *thread_func(void *data LTP_ATTRIBUTE_UNUSED)
{
struct sched_param sp;
int policy;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/5-1.c
index 51b10305b..2ed0d2084 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedpolicy/5-1.c
@@ -27,7 +27,7 @@
#define ERR_MSG(p, f, rc) printf("Failed: %s function: %s error: %s (%u)\n", \
p, f, strerror(rc), rc)
-static int set_policy(char *label, int policy)
+int set_policy(char *label, int policy)
{
int rc;
int status;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setscope/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setscope/1-1.c
index cb32430b7..603b1e701 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setscope/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setscope/1-1.c
@@ -27,7 +27,7 @@
#define CONSCOPE PTHREAD_SCOPE_SYSTEM
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/1-1.c
index 14aeed176..6fdb78a81 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/1-1.c
@@ -30,9 +30,9 @@
#define STACKADDROFFSET 0x8000000
static void *stack_addr;
-static size_t stack_size;
+size_t stack_size;
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c
index 15971e986..980d23930 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/2-1.c
@@ -33,9 +33,9 @@
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
static void *stack_addr;
-static size_t stack_size;
+size_t stack_size;
-static void *thread_func()
+void *thread_func()
{
pthread_attr_t attr;
void *saddr;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/4-1.c
index 264ebb103..2fada7342 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/4-1.c
@@ -32,14 +32,14 @@
#define STACKADDROFFSET 0x8000000
static void *stack_addr;
-static size_t stack_size;
+size_t stack_size;
-static int teststack()
+int teststack()
{
return 0;
}
-static void *thread_func()
+void *thread_func()
{
/* execute a function to test the read/right of the stack */
if (teststack() != 0) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c
index 5eac212f9..38aa5bccb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/6-1.c
@@ -29,9 +29,9 @@
#define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE)
static void *stack_addr;
-static size_t stack_size;
+size_t stack_size;
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c
index bc7f4f415..649400abd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstack/7-1.c
@@ -30,9 +30,9 @@
#define OFFSET 0x7
static void *stack_addr;
-static size_t stack_size;
+size_t stack_size;
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c
index 364d22424..a9697e332 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/1-1.c
@@ -29,7 +29,7 @@
#define STACKADDROFFSET 0x8000000
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c
index 2364f579d..b480cd2cb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c
@@ -32,10 +32,10 @@
#define FUNCTION "pthread_attr_setstacksize"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static size_t stack_size;
-static void *stack_addr;
+size_t stack_size;
+void *stack_addr;
-static void *thread_func()
+void *thread_func()
{
pthread_attr_t attr;
size_t ssize;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c
index b229d7052..ede811d53 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/4-1.c
@@ -28,7 +28,7 @@
#define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE)
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c
index 93e8c648f..161cc4653 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c
@@ -53,7 +53,7 @@ static void *fn_chld(void *arg)
else if (rc != 0)
perror("child: pthread_barrier_wait");
else
- printf("child: pthread_barrier_wait returned success\n");
+ printf("child: pthread_barrier_wait returned success");
thread_state = EXITING_THREAD;
return arg;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_init/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_init/4-1.c
index 301eb1053..6524e0b5a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_init/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_init/4-1.c
@@ -35,7 +35,7 @@ static int thread_state;
#define EXITING_THREAD 3
/* child thread */
-static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_chld(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
@@ -58,7 +58,7 @@ static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void sig_handler()
+void sig_handler()
{
printf("Interrupted by SIGALRM\n");
printf("Test PASSED: main blocked on barrier init\n");
@@ -114,7 +114,7 @@ int main(void)
rc = pthread_barrier_init(&barrier, NULL, 2);
if (rc == EBUSY) {
- printf("main: pthread_barrier_init() correctly got EBUSY\n");
+ printf("main: pthread_barrier_init() correctly got EBUSY");
printf("Test PASSED\n");
} else {
printf("main: got return code: %d, %s\n", rc, strerror(rc));
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/1-1.c
index 1951a0880..9f874c3f7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/1-1.c
@@ -32,7 +32,7 @@ static int thread_state;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_chld(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
thread_state = ENTERED_THREAD;
@@ -53,7 +53,7 @@ static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void sig_handler()
+void sig_handler()
{
printf("Interrupted by SIGALRM\n");
printf("Test FAILED: main blocked on barrier wait\n");
@@ -139,7 +139,7 @@ int main(void)
}
if (pthread_barrier_destroy(&barrier) != 0) {
- printf("Error at pthread_barrier_destroy()\n");
+ printf("Error at pthread_barrier_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/2-1.c
index e279bcc82..327ac1d9a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/2-1.c
@@ -112,7 +112,7 @@ int main(void)
}
if (pthread_barrier_destroy(&barrier) != 0) {
- printf("Error at pthread_barrier_destroy()\n");
+ printf("Error at pthread_barrier_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-1.c
index 0460e8cca..8a6e7bb04 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-1.c
@@ -39,13 +39,13 @@ static int sig_rcvd;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void sig_handler()
+void sig_handler()
{
sig_rcvd = 1;
printf("thread: interrupted by SIGUSR1\n");
}
-static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_chld(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
struct sigaction act;
@@ -169,7 +169,7 @@ int main(void)
}
if (pthread_barrier_destroy(&barrier) != 0) {
- printf("Error at pthread_barrier_destroy()\n");
+ printf("Error at pthread_barrier_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-2.c
index 5b99055d0..e04d91202 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_wait/3-2.c
@@ -38,7 +38,7 @@ static int barrier_waited;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void sig_handler()
+void sig_handler()
{
struct timespec ts;
sig_rcvd = 1;
@@ -51,7 +51,7 @@ static void sig_handler()
}
}
-static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_chld(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
struct sigaction act;
@@ -161,7 +161,7 @@ int main(void)
}
if (pthread_barrier_destroy(&barrier) != 0) {
- printf("Error at pthread_barrier_destroy()\n");
+ printf("Error at pthread_barrier_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c
index b1a99a4c2..bf8708aa6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/1-1.c
@@ -49,7 +49,7 @@ int main(void)
rc = pthread_barrierattr_destroy(&ba);
if (rc != 0) {
printf("Error at pthread_barrierattr_destroy() "
- "return code: %d, %s\n", rc, strerror(rc));
+ "return code: %d, %s", rc, strerror(rc));
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c
index a21a5a507..b3883f388 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_getpshared/2-1.c
@@ -40,7 +40,7 @@
#define LOOP_NUM 10
-static void sig_handler()
+void sig_handler()
{
printf("Interrupted by SIGALRM\n");
printf("Test Fail: block on pthread_barrier_wait()\n");
@@ -198,7 +198,7 @@ int main(void)
/* Cleanup */
if (pthread_barrier_destroy(barrier) != 0) {
- printf("Error at pthread_barrier_destroy()\n");
+ printf("Error at pthread_barrier_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c
index e42496edb..b031a15f3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/1-1.c
@@ -53,7 +53,7 @@ int main(void)
rc = pthread_barrierattr_destroy(&ba);
if (rc != 0) {
printf("Error at pthread_barrierattr_destroy() "
- "return code: %d, %s\n", rc, strerror(rc));
+ "return code: %d, %s", rc, strerror(rc));
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c
index 612759686..9342339a4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrierattr_init/2-1.c
@@ -50,7 +50,7 @@ int main(void)
rc = pthread_barrierattr_destroy(&ba);
if (rc != 0) {
printf("Error at pthread_barrierattr_destroy() "
- "return code: %d, %s\n", rc, strerror(rc));
+ "return code: %d, %s", rc, strerror(rc));
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-1.c
index 58696b537..6a0e41feb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-1.c
@@ -33,19 +33,19 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag;
+int sem1; /* Manual semaphore */
+int cleanup_flag;
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is -1, it means that the thread was canceled. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = 1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-2.c
index 68dd88c18..ac24ac4a3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-2.c
@@ -33,20 +33,20 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag;
+int sem1; /* Manual semaphore */
+int cleanup_flag;
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is -1, it means that the thread was canceled, meaning
* the test will fail. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = -1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-3.c
index a0f0a13ca..4ee24414f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/1-3.c
@@ -39,20 +39,20 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
+int sem1; /* Manual semaphore */
+int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = -1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-1.c
index e87d519ab..7584ebc7b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-1.c
@@ -22,13 +22,13 @@
#include <unistd.h>
#include "posixtest.h"
-static int sem; /* Manual semaphore */
-static int cleanup_flag; /* Made global so that the cleanup function
+int sem; /* Manual semaphore */
+int cleanup_flag; /* Made global so that the cleanup function
can manipulate the value as well. */
/* A cleanup function that sets the cleanup_flag to 1, meaning that the
* cleanup function was reached. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = 1;
sem = 0;
@@ -40,7 +40,7 @@ static void a_cleanup_func()
* loop, never reaching the cleanup_pop function. So the only way the cleanup
* function can be called is when the thread is canceled and all the cleanup
* functions are supposed to be popped. */
-static void *a_thread_func()
+void *a_thread_func()
{
/* To enable thread immediate cancelation, since the default
* is PTHREAD_CANCEL_DEFERRED. */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-2.c
index 8417984ff..1937aaea4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-2.c
@@ -27,16 +27,16 @@
#define FUNCTION "pthread_cancel"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static int cleanup_flag = 0;
-static int sem = 0; /* manual semaphore */
+int cleanup_flag = 0;
+int sem = 0; /* manual semaphore */
-static void destructor(void *tmp PTS_ATTRIBUTE_UNUSED)
+void destructor(void *tmp LTP_ATTRIBUTE_UNUSED)
{
cleanup_flag = 1;
}
/* Thread's function. */
-static void *a_thread_func(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *a_thread_func(void *tmp LTP_ATTRIBUTE_UNUSED)
{
pthread_key_t key;
int value = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-3.c
index 94a8387d3..def886bba 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/2-3.c
@@ -29,15 +29,15 @@
#define FUNCTION "pthread_cancel"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static int cleanup_flag = 0;
-static int destructor_flag = 0;
-static int sem = 0; /* manual semaphore */
-static struct timespec destructor_time, cleanup_time;
+int cleanup_flag = 0;
+int destructor_flag = 0;
+int sem = 0; /* manual semaphore */
+struct timespec destructor_time, cleanup_time;
/*
Destructor for the Thread Specific Data
*/
-static void destructor(void *tmp PTS_ATTRIBUTE_UNUSED)
+void destructor(void *tmp LTP_ATTRIBUTE_UNUSED)
{
clock_gettime(CLOCK_REALTIME, &destructor_time);
destructor_flag = 1;
@@ -46,14 +46,14 @@ static void destructor(void *tmp PTS_ATTRIBUTE_UNUSED)
/*
Cleanup Handler for the Thread
*/
-static void cleanup_function()
+void cleanup_function()
{
clock_gettime(CLOCK_REALTIME, &cleanup_time);
cleanup_flag = 1;
}
/* Thread's function. */
-static void *a_thread_func(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *a_thread_func(void *tmp LTP_ATTRIBUTE_UNUSED)
{
pthread_key_t key;
int value = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c
index 3527d57fd..6bac75856 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/3-1.c
@@ -26,7 +26,7 @@ static volatile int after_cancel;
static volatile int thread_sleep_time;
static sem_t sem;
-static void cleanup_func(PTS_ATTRIBUTE_UNUSED void *unused)
+static void cleanup_func(LTP_ATTRIBUTE_UNUSED void *unused)
{
struct timespec cleanup_ts = {0, SLEEP_MS*1000000};
do {
@@ -35,7 +35,7 @@ static void cleanup_func(PTS_ATTRIBUTE_UNUSED void *unused)
} while (after_cancel == 0 && thread_sleep_time < TIMEOUT_MS);
}
-static void *thread_func(PTS_ATTRIBUTE_UNUSED void *unused)
+static void *thread_func(LTP_ATTRIBUTE_UNUSED void *unused)
{
int waited_for_cancel_ms = 0;
struct timespec cancel_wait_ts = {0, SLEEP_MS*1000000};
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/4-1.c
index 769c82d72..91fe55051 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/4-1.c
@@ -20,8 +20,8 @@
#include <unistd.h>
#include "posixtest.h"
-static int sem; /* Manual semaphore */
-static void *a_thread_func()
+int sem; /* Manual semaphore */
+void *a_thread_func()
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/5-1.c
index 0937c6fe1..71d2e494b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/5-1.c
@@ -24,7 +24,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c
index e38e6c5a7..ff431dd12 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-1.c
@@ -30,18 +30,18 @@
#define INTHREAD 0
#define INMAIN 1
-static int sem1; /* Manual semaphore */
-static int cleanup_flag;
+int sem1; /* Manual semaphore */
+int cleanup_flag;
/* Cleanup handler */
-static void a_cleanup_func(void *flag_val)
+void a_cleanup_func(void *flag_val)
{
cleanup_flag = (long)flag_val;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_cleanup_push(a_cleanup_func, (void *)CLEANUP_CALLED);
pthread_cleanup_pop(1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c
index 4ac4462bb..17b24667c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-2.c
@@ -30,18 +30,18 @@
#define INTHREAD 0
#define INMAIN 1
-static int sem1; /* Manual semaphore */
-static int cleanup_flag;
+int sem1; /* Manual semaphore */
+int cleanup_flag;
/* Cleanup handler */
-static void a_cleanup_func(void *flag_val)
+void a_cleanup_func(void *flag_val)
{
cleanup_flag = (long)flag_val;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_cleanup_push(a_cleanup_func, (void *)CLEANUP_CALLED);
pthread_cleanup_pop(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c
index fae4e9380..1dec926ac 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_pop/1-3.c
@@ -27,25 +27,25 @@
#define CLEANUP_NOTCALLED 0
#define CLEANUP_CALLED 1
-static int cleanup_flag[3]; /* Array to hold the cleanup flags for the 3 cleanup handlers */
-static int i;
+int cleanup_flag[3]; /* Array to hold the cleanup flags for the 3 cleanup handlers */
+int i;
/* 3 Cleanup handlers */
-static void a_cleanup_func1(void *flag_val PTS_ATTRIBUTE_UNUSED)
+void a_cleanup_func1(void *flag_val LTP_ATTRIBUTE_UNUSED)
{
cleanup_flag[i] = 1;
i++;
return;
}
-static void a_cleanup_func2(void *flag_val PTS_ATTRIBUTE_UNUSED)
+void a_cleanup_func2(void *flag_val LTP_ATTRIBUTE_UNUSED)
{
cleanup_flag[i] = 2;
i++;
return;
}
-static void a_cleanup_func3(void *flag_val PTS_ATTRIBUTE_UNUSED)
+void a_cleanup_func3(void *flag_val LTP_ATTRIBUTE_UNUSED)
{
cleanup_flag[i] = 3;
i++;
@@ -53,7 +53,7 @@ static void a_cleanup_func3(void *flag_val PTS_ATTRIBUTE_UNUSED)
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_cleanup_push(a_cleanup_func1, NULL);
pthread_cleanup_push(a_cleanup_func2, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-1.c
index d16b227b2..80b83b089 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-1.c
@@ -34,17 +34,17 @@
#define CLEANUP_NOTCALLED 0
#define CLEANUP_CALLED 1
-static int cleanup_flag;
+int cleanup_flag;
/* Cleanup handler */
-static void a_cleanup_func(void *flag_val)
+void a_cleanup_func(void *flag_val)
{
cleanup_flag = (long)flag_val;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_cleanup_push(a_cleanup_func, (void *)CLEANUP_CALLED);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-2.c
index cfee63c95..b7c54d50e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-2.c
@@ -36,11 +36,11 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag;
+int sem1; /* Manual semaphore */
+int cleanup_flag;
/* The cleanup handler */
-static void a_cleanup_func(void *flag_val)
+void a_cleanup_func(void *flag_val)
{
cleanup_flag = (long)flag_val;
sem1 = INMAIN;
@@ -48,7 +48,7 @@ static void a_cleanup_func(void *flag_val)
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-3.c
index 20a8b7227..6617c996a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cleanup_push/1-3.c
@@ -33,17 +33,17 @@
#define CLEANUP_NOTCALLED 0
#define CLEANUP_CALLED 1
-static int cleanup_flag;
+int cleanup_flag;
/* Cleanup handler */
-static void a_cleanup_func(void *flag_val)
+void a_cleanup_func(void *flag_val)
{
cleanup_flag = (long)flag_val;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_cleanup_push(a_cleanup_func, (void *)CLEANUP_CALLED);
pthread_cleanup_pop(1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c
index 3c7b5975c..e61041ae8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-1.c
@@ -19,7 +19,7 @@
#define THREAD_NUM 3
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
@@ -27,7 +27,7 @@ static struct testdata {
static int start_num;
static int waken_num;
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
pthread_t self = pthread_self();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c
index 22e7c3638..1c871db7e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c
@@ -97,7 +97,7 @@ static int max_thread_children = 1000;
#endif
-static struct _scenar {
+struct _scenar {
int m_type;
int mc_pshared;
int c_clock;
@@ -164,10 +164,10 @@ struct testdata {
clockid_t cid; /* clock used in the condvar */
char fork; /* the children are processes */
};
-static struct testdata *td;
+struct testdata *td;
/* Child function (either in a thread or in a process) */
-static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *child(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
struct timespec ts;
@@ -229,15 +229,15 @@ typedef struct _children {
struct _children *next;
} children_t;
-static children_t sentinel = {.next = NULL };
+children_t sentinel = {.next = NULL };
-static children_t *children = &sentinel;
+children_t *children = &sentinel;
/* Timeout thread */
-static sem_t sem_tmr;
+sem_t sem_tmr;
-static void *timer(void *arg PTS_ATTRIBUTE_UNUSED)
+void *timer(void *arg LTP_ATTRIBUTE_UNUSED)
{
unsigned int to = TIMEOUT;
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c
index cd39dbd93..22e4aae94 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-1.c
@@ -20,7 +20,7 @@
#define THREAD_NUM 3
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
@@ -28,7 +28,7 @@ static struct testdata {
static int start_num;
static int waken_num;
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
pthread_t self = pthread_self();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-2.c
index 2ae84f477..71f3ef40a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-2.c
@@ -23,7 +23,7 @@
#define THREAD_NUM 3
#define TIMEOUT (THREAD_NUM * 2)
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
@@ -31,7 +31,7 @@ static struct testdata {
static int start_num;
static int waken_num;
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-3.c
index d82f6773d..4098661a8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/2-3.c
@@ -80,7 +80,7 @@
#endif
-static struct _scenar {
+struct _scenar {
int m_type;
int mc_pshared;
int c_clock;
@@ -139,7 +139,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0]))
-static struct testdata {
+struct testdata {
int count;
pthread_cond_t cnd;
pthread_mutex_t mtx;
@@ -149,7 +149,7 @@ static struct testdata {
char fork;
} *td;
-static struct {
+struct {
union {
pthread_t t;
pid_t p;
@@ -157,7 +157,7 @@ static struct {
int nb;
} children;
-static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *child(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
int timed;
@@ -228,7 +228,7 @@ static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *timer(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *timer(void *arg LTP_ATTRIBUTE_UNUSED)
{
unsigned int to = TIMEOUT;
do {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c
index 09d5fdff7..a0ad4f03b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-1.c
@@ -19,7 +19,7 @@
#define THREAD_NUM 5
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
@@ -27,7 +27,7 @@ static struct testdata {
static int start_num;
static int waken_num;
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
pthread_t self = pthread_self();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-2.c
index d7082d07d..a26088eac 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/4-2.c
@@ -49,8 +49,8 @@ static char do_it = 1;
static char woken;
static unsigned long count_cnd_sig, count_cnd_wup;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
+sem_t semsig1;
+sem_t semsig2;
static unsigned long count_sig;
#endif
@@ -63,7 +63,7 @@ struct thestruct {
#endif
};
-static struct {
+struct {
pthread_mutex_t mtx;
pthread_cond_t cnd;
} data;
@@ -102,7 +102,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+static void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig1))
@@ -111,7 +111,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+static void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig2))
@@ -121,7 +121,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
/* The following function will wait on the cond
* it does check that no error code of EINTR is returned */
-static void *waiter(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *waiter(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
@@ -152,7 +152,7 @@ static void *waiter(void *arg PTS_ATTRIBUTE_UNUSED)
}
/* The next function will signal the condition */
-static void *worker(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *worker(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/1-1.c
index 8f06066ec..2e827909c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/1-1.c
@@ -15,8 +15,8 @@
#include <stdio.h>
#include "posixtest.h"
-static pthread_cond_t cond1, cond2;
-static pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER;
+pthread_cond_t cond1, cond2;
+pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/2-1.c
index 63363bbea..364052dc8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/2-1.c
@@ -112,7 +112,7 @@
#endif
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -205,10 +205,10 @@ typedef struct {
clockid_t cid; /* clock used in the condvar */
char fork; /* the children are processes */
} testdata_t;
-static testdata_t *td;
+testdata_t *td;
/* Child function (either in a thread or in a process) */
-static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
+void *child(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
struct timespec ts;
@@ -308,7 +308,7 @@ static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
}
/* Timeout thread */
-static void *timer(void *arg)
+void *timer(void *arg)
{
pid_t *pchildren = (pid_t *) arg;
unsigned int to = TIMEOUT;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c
index 7813a5617..b447a2ffe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_destroy/speculative/4-1.c
@@ -22,10 +22,10 @@
#include <string.h>
#include "posixtest.h"
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static void *thread(void *tmp)
+void *thread(void *tmp)
{
int rc = 0;
@@ -52,7 +52,7 @@ static void *thread(void *tmp)
return tmp;
}
-static void *watchdog(void *arg)
+void *watchdog(void *arg)
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c
index 4a60f7098..134de3f0f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_init/2-1.c
@@ -14,7 +14,7 @@
#include <stdio.h>
#include "posixtest.h"
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c
index d638190f3..ecbae0a66 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c
@@ -20,18 +20,18 @@
#define THREAD_NUM 3
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static pthread_t thread[THREAD_NUM];
+pthread_t thread[THREAD_NUM];
-static int start_num = 0;
-static int waken_num = 0;
+int start_num = 0;
+int waken_num = 0;
/* Alarm handler */
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
int i;
printf("Error: failed to wakeup all threads\n");
@@ -42,7 +42,7 @@ static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
exit(PTS_UNRESOLVED);
}
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
pthread_t self = pthread_self();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-2.c
index 89e20171d..a030d8b67 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-2.c
@@ -111,7 +111,7 @@
#endif
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -202,10 +202,10 @@ typedef struct {
clockid_t cid; /* clock used in the condvar */
char fork; /* the children are processes */
} testdata_t;
-static testdata_t *td;
+testdata_t *td;
/* Child function (either in a thread or in a process) */
-static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
+void *child(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
struct timespec ts;
@@ -266,7 +266,7 @@ static void *child(void *arg PTS_ATTRIBUTE_UNUSED)
}
/* Timeout thread */
-static void *timer(void *arg)
+void *timer(void *arg)
{
pid_t *pchildren = (pid_t *) arg;
unsigned int to = TIMEOUT;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-1.c
index 6db863954..947bf8eb7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-1.c
@@ -21,18 +21,18 @@
#define THREAD_NUM 3
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static pthread_t thread[THREAD_NUM];
+pthread_t thread[THREAD_NUM];
-static int start_num = 0;
-static int waken_num = 0;
+int start_num = 0;
+int waken_num = 0;
/* Alarm handler */
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
int i;
printf("Error: failed to wakeup all threads\n");
@@ -43,7 +43,7 @@ static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
exit(PTS_UNRESOLVED);
}
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
pthread_t self = pthread_self();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-2.c
index 375afdbd6..d411530fd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/2-2.c
@@ -23,15 +23,15 @@
#define THREAD_NUM 3
#define TIMEOUT THREAD_NUM * 2
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static int start_num = 0;
-static int waken_num = 0;
+int start_num = 0;
+int waken_num = 0;
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-1.c
index 54d3a1b88..46e5b6158 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-1.c
@@ -20,18 +20,18 @@
#define THREAD_NUM 5
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static pthread_t thread[THREAD_NUM];
+pthread_t thread[THREAD_NUM];
-static int start_num = 0;
-static int waken_num = 0;
+int start_num = 0;
+int waken_num = 0;
/* Alarm handler */
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
int i;
printf("Error: failed to wakeup all threads\n");
@@ -42,7 +42,7 @@ static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
exit(PTS_UNRESOLVED);
}
-static void *thr_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *thr_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
pthread_t self = pthread_self();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-2.c
index 39fc0a089..f11c83794 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/4-2.c
@@ -75,16 +75,16 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static char woken = 0;
-static unsigned long count_cnd_sig = 0, count_cnd_wup = 0;
+char do_it = 1;
+char woken = 0;
+unsigned long count_cnd_sig = 0, count_cnd_wup = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -93,13 +93,13 @@ typedef struct {
#endif
} thestruct;
-static struct {
+struct {
pthread_mutex_t mtx;
pthread_cond_t cnd;
} data;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -134,7 +134,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig1)) {
@@ -144,7 +144,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig2)) {
@@ -155,7 +155,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
/* The following function will wait on the cond
* it does check that no error code of EINTR is returned */
-static void *waiter(void *arg PTS_ATTRIBUTE_UNUSED)
+void *waiter(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
@@ -191,7 +191,7 @@ static void *waiter(void *arg PTS_ATTRIBUTE_UNUSED)
}
/* The next function will signal the condition */
-static void *worker(void *arg PTS_ATTRIBUTE_UNUSED)
+void *worker(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c
index 5673887c9..8ff240cb5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/1-1.c
@@ -21,15 +21,15 @@
#define TIMEOUT 5
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static int t1_start = 0;
-static int signaled = 0;
+int t1_start = 0;
+int signaled = 0;
-static void *t1_func(void *arg)
+void *t1_func(void *arg)
{
int rc;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c
index abad5fd24..1bc4a723f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-1.c
@@ -28,15 +28,15 @@
#define INTERVAL 1
#define TIMEOUT 5
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static int t1_start = 0;
-static int signaled = 0;
+int t1_start = 0;
+int signaled = 0;
-static void *t1_func(void *arg)
+void *t1_func(void *arg)
{
int rc;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c
index c5c5097fa..893c8e565 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-2.c
@@ -24,14 +24,14 @@
#define INTERVAL 5
#define TIMEOUT 1
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static int t1_start = 0;
+int t1_start = 0;
-static void *t1_func(void *arg)
+void *t1_func(void *arg)
{
int rc;
struct timeval curtime;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c
index e01115ab5..bfdc4eefc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-3.c
@@ -23,14 +23,14 @@
#define INTERVAL 2
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static int t1_start = 0;
+int t1_start = 0;
-static void *t1_func(void *arg)
+void *t1_func(void *arg)
{
int rc;
struct timeval curtime;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c
index 13aef05ff..efc85691f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-4.c
@@ -68,7 +68,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -148,7 +148,7 @@ static struct _scenar {
#endif
};
-static void *tf(void *arg)
+void *tf(void *arg)
{
int ret = 0;
struct timespec ts;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c
index 0407d6831..14b4c80b8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-5.c
@@ -62,7 +62,7 @@
#ifndef WITHOUT_XOPEN
-static struct _td {
+struct _td {
pthread_mutex_t mtx1, mtx2; /* The two mutex m1 and m2 */
pthread_cond_t cnd; /* The cond var c */
char boolcnd; /* The boolean predicate b associated with c */
@@ -72,7 +72,7 @@ static struct _td {
int stopped; /* # of threads which are terminated */
} data;
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c
index b84750675..d1c56b315 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-6.c
@@ -48,7 +48,7 @@
#define USE_ALTCLK /* make tests with MONOTONIC CLOCK if supported */
#endif
-static struct {
+struct {
pthread_mutex_t mtx;
pthread_cond_t cnd;
int type;
@@ -61,7 +61,7 @@ static struct {
/**** First handler that will be poped
* This one works only with recursive mutexes
*/
-static void clnp1(void *arg)
+void clnp1(void *arg)
{
int ret;
@@ -85,7 +85,7 @@ static void clnp1(void *arg)
/**** Second handler
* This one will trigger an action in main thread, while we are owning the mutex
*/
-static void clnp2(void *arg)
+void clnp2(void *arg)
{
int ret;
@@ -111,7 +111,7 @@ static void clnp2(void *arg)
/**** Third handler
* Will actually unlock the mutex, then try to unlock second time to check an error is returned
*/
-static void clnp3(void *arg)
+void clnp3(void *arg)
{
int ret;
@@ -138,7 +138,7 @@ static void clnp3(void *arg)
* This function will lock the mutex, then install the cleanup handlers
* and wait for the cond. At this point it will be canceled.
*/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c
index e3ad45071..31b2b3b85 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/2-7.c
@@ -69,7 +69,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -149,7 +149,7 @@ static struct _scenar {
#endif
};
-static void *tf(void *arg)
+void *tf(void *arg)
{
int ret = 0;
struct timespec ts;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c
index 33146ebbe..eb93e46e1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/3-1.c
@@ -21,15 +21,15 @@
#define INTERVAL 1
#define TIMEOUT 5
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static int t1_start = 0;
-static int signaled = 0;
+int t1_start = 0;
+int signaled = 0;
-static void *t1_func(void *arg)
+void *t1_func(void *arg)
{
int rc;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c
index e49117e0d..cb02e7a2c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-1.c
@@ -21,12 +21,12 @@
#define TIMEOUT 3
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static void *t1_func(void *arg)
+void *t1_func(void *arg)
{
int rc;
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c
index 6c0ec8e7a..1b9110d06 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-2.c
@@ -67,7 +67,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -147,7 +147,7 @@ static struct _scenar {
#endif
};
-static struct {
+struct {
long sec_val; /* Value for seconds */
short sec_is_offset; /* Seconds value is added to current time or is absolute */
long nsec_val; /* Value for nanoseconds */
@@ -161,7 +161,7 @@ static struct {
-3, 1, 2000000000, 0}
};
-static void *tf(void *arg)
+void *tf(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c
index 5a49ffc35..27d21b34e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_timedwait/4-3.c
@@ -49,15 +49,15 @@
#define TIMEOUT (1000) /* ns, timeout parameter for pthread_cond_timedwait */
#define INTERVAL (700) /* ns, frequency (actually, period) for the condition signaling */
-static char do_it = 1;
-static unsigned long count_cnd_sig = 0, count_cnd_wup = 0;
+char do_it = 1;
+unsigned long count_cnd_sig = 0, count_cnd_wup = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -66,13 +66,13 @@ typedef struct {
#endif
} thestruct;
-static struct {
+struct {
pthread_mutex_t mtx;
pthread_cond_t cnd;
} data;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -107,7 +107,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig)
+void sighdl1(int sig)
{
(void) sig;
#ifdef WITH_SYNCHRO
@@ -118,7 +118,7 @@ static void sighdl1(int sig)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig)
+void sighdl2(int sig)
{
(void) sig;
#ifdef WITH_SYNCHRO
@@ -130,7 +130,7 @@ static void sighdl2(int sig)
/* The following function will timedwait on the cond
* it does check that no error code of EINTR is returned */
-static void *waiter(void *arg)
+void *waiter(void *arg)
{
int ret;
struct timespec ts;
@@ -187,7 +187,7 @@ static void *waiter(void *arg)
}
/* The next function will signal the condition at periodic interval */
-static void *worker(void *arg)
+void *worker(void *arg)
{
int ret = 0;
struct timespec ts, tsrem;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/1-1.c
index fd2752927..4d9674535 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/1-1.c
@@ -18,25 +18,25 @@
#include <signal.h>
#include "posixtest.h"
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static pthread_t thread1;
+pthread_t thread1;
-static int t1_start = 0;
-static int signaled = 0;
+int t1_start = 0;
+int signaled = 0;
/* Alarm handler */
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Error: failed to wakeup thread\n");
pthread_cancel(thread1);
exit(PTS_UNRESOLVED);
}
-static void *t1_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *t1_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-1.c
index 8ee37f1fb..a6bf755fb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-1.c
@@ -18,25 +18,25 @@
#include <signal.h>
#include "posixtest.h"
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static pthread_t thread1;
+pthread_t thread1;
-static int t1_start = 0;
-static int signaled = 0;
+int t1_start = 0;
+int signaled = 0;
/* Alarm handler */
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Error: failed to wakeup thread\n");
pthread_cancel(thread1);
exit(PTS_UNRESOLVED);
}
-static void *t1_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *t1_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-2.c
index fd2f9035c..11f25d8ad 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-2.c
@@ -96,7 +96,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -178,7 +178,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0]))
-static void *tf(void *arg)
+void *tf(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-3.c
index eaa248888..7287f9bc4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/2-3.c
@@ -78,7 +78,7 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static struct {
+struct {
pthread_mutex_t mtx;
pthread_cond_t cnd;
int type;
@@ -90,7 +90,7 @@ static struct {
/**** First handler that will be poped
* This one works only with recursive mutexes
*/
-static void clnp1(void *arg PTS_ATTRIBUTE_UNUSED)
+void clnp1(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
if (data.type == PTHREAD_MUTEX_RECURSIVE) {
@@ -111,7 +111,7 @@ static void clnp1(void *arg PTS_ATTRIBUTE_UNUSED)
/**** Second handler
* This one will trigger an action in main thread, while we are owning the mutex
*/
-static void clnp2(void *arg PTS_ATTRIBUTE_UNUSED)
+void clnp2(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
do {
@@ -134,7 +134,7 @@ static void clnp2(void *arg PTS_ATTRIBUTE_UNUSED)
/**** Third handler
* Will actually unlock the mutex, then try to unlock second time to check an error is returned
*/
-static void clnp3(void *arg PTS_ATTRIBUTE_UNUSED)
+void clnp3(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
@@ -159,7 +159,7 @@ static void clnp3(void *arg PTS_ATTRIBUTE_UNUSED)
* This function will lock the mutex, then install the cleanup handlers
* and wait for the cond. At this point it will be canceled.
*/
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/3-1.c
index e9dec867d..8116dafc3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/3-1.c
@@ -17,25 +17,25 @@
#include <signal.h>
#include "posixtest.h"
-static struct testdata {
+struct testdata {
pthread_mutex_t mutex;
pthread_cond_t cond;
} td;
-static pthread_t thread1;
+pthread_t thread1;
-static int t1_start = 0;
-static int signaled = 0;
+int t1_start = 0;
+int signaled = 0;
/* Alarm handler */
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Error: failed to wakeup thread\n");
pthread_cancel(thread1);
exit(PTS_UNRESOLVED);
}
-static void *t1_func(void *arg PTS_ATTRIBUTE_UNUSED)
+void *t1_func(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/4-1.c
index 30f8a636e..5f102f762 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_wait/4-1.c
@@ -77,16 +77,16 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static char woken = 0;
-static unsigned long count_cnd_sig = 0, count_cnd_wup = 0;
+char do_it = 1;
+char woken = 0;
+unsigned long count_cnd_sig = 0, count_cnd_wup = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -95,13 +95,13 @@ typedef struct {
#endif
} thestruct;
-static struct {
+struct {
pthread_mutex_t mtx;
pthread_cond_t cnd;
} data;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -136,7 +136,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig1)) {
@@ -146,7 +146,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig2)) {
@@ -157,7 +157,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
/* The following function will wait on the cond
* it does check that no error code of EINTR is returned */
-static void *waiter(void *arg PTS_ATTRIBUTE_UNUSED)
+void *waiter(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
@@ -198,7 +198,7 @@ static void *waiter(void *arg PTS_ATTRIBUTE_UNUSED)
}
/* The next function will signal the condition at periodic interval */
-static void *worker(void *arg PTS_ATTRIBUTE_UNUSED)
+void *worker(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c
index 30fcfe0e9..2dda147dc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-3.c
@@ -27,10 +27,10 @@
#include <string.h>
#include "posixtest.h"
-static void *a_thread_function();
-static void alarm_handler();
+void *a_thread_function();
+void alarm_handler();
-static pthread_t a;
+pthread_t a;
int main(void)
{
@@ -62,7 +62,7 @@ int main(void)
}
/* A never-ending thread function */
-static void *a_thread_function()
+void *a_thread_function()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
@@ -75,7 +75,7 @@ static void *a_thread_function()
#define WRITE(str) write(STDOUT_FILENO, str, sizeof(str) - 1)
/* If this handler is called, that means that the test has failed. */
-static void alarm_handler()
+void alarm_handler()
{
WRITE("Test FAILED: Alarm fired while waiting for cancelation\n");
_exit(PTS_FAIL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c
index c4756ab6f..8f806eb57 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-5.c
@@ -97,7 +97,7 @@
/********************************************************************************************/
/* The overflow function is used to test the stack overflow */
-static void *overflow(void *arg)
+void *overflow(void *arg)
{
void *current;
void *pad[50]; /* We want to consume the stack quickly */
@@ -147,7 +147,7 @@ static void *overflow(void *arg)
}
}
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-6.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-6.c
index 8c1239e27..fe151c84d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/1-6.c
@@ -54,7 +54,7 @@ static void alarm_handler()
flag = 0;
}
-static void *do_work(void *arg)
+void *do_work(void *arg)
{
(void) arg;
@@ -188,7 +188,7 @@ enum tprio {
MAX_1,
};
-static struct tcase tcases[] = {
+struct tcase tcases[] = {
{SCHED_FIFO, MIN},
{SCHED_FIFO, HALF},
{SCHED_FIFO, MAX_1},
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c
index e8c003fd4..70bfc9515 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/15-1.c
@@ -90,7 +90,7 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static void *teststack(void *arg)
+void *teststack(void *arg)
{
int ret = 0;
*(int **)arg = &ret;
@@ -98,7 +98,7 @@ static void *teststack(void *arg)
}
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
int *child_stack;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/2-1.c
index 93cc618ff..b5494fd7f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/2-1.c
@@ -26,7 +26,7 @@
#include <string.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
return NULL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-1.c
index ea4a33588..7a24c4871 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-1.c
@@ -32,7 +32,7 @@
static volatile int sem;
-static void *a_thread_func()
+void *a_thread_func()
{
sem = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c
index a508fc45e..ab97ff31b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_create/3-2.c
@@ -102,10 +102,10 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static sem_t semsync[2]; /* These semaphores will only be used in child process! */
+sem_t semsync[2]; /* These semaphores will only be used in child process! */
/* The overflow function is used to test the stack overflow */
-static void *overflow(void *arg)
+void *overflow(void *arg)
{
void *current;
void *pad[50]; /* We want to consume the stack quickly */
@@ -173,7 +173,7 @@ static void *overflow(void *arg)
If newsize is not 0, the stack size in ta will be set to this value once the thread is created.
*/
-static int test_stack(pthread_attr_t * ta, size_t newsize)
+int test_stack(pthread_attr_t * ta, size_t newsize)
{
pid_t child, ctrl;
int status;
@@ -310,7 +310,7 @@ typedef struct {
struct sched_param param;
} testdata_t;
-static void *schedtest(void *arg)
+void *schedtest(void *arg)
{
testdata_t *td = (testdata_t *) arg;
int newpol, ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-1.c
index d4511cdf3..1d77335f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-1.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c
index a6eb391ef..2cdbebbe9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/1-2.c
@@ -91,7 +91,7 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-1.c
index f3175fbf8..6258b751e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-1.c
@@ -23,7 +23,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c
index 8a406fe44..5cc7131bd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/2-2.c
@@ -92,9 +92,9 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static sem_t sem_sync;
+sem_t sem_sync;
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/3-1.c
index 4217afa4b..bb7c4919e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/3-1.c
@@ -23,7 +23,7 @@
#include "posixtest.h"
/* Thread function */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-1.c
index b1fe57039..4a3de9e91 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-1.c
@@ -28,7 +28,7 @@
#include "posixtest.h"
/* Thread function */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
index 28b93ffea..67662296f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
@@ -29,7 +29,7 @@
#include "posixtest.h"
/* Thread function */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
index fc3a50bef..a1f810b57 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
@@ -69,7 +69,7 @@ struct thestruct {
#endif
};
-static unsigned long long current_time_usec()
+unsigned long long current_time_usec()
{
struct timeval now;
SAFE_FUNC(gettimeofday(&now, NULL));
@@ -216,7 +216,7 @@ static void *test(void *arg)
return NULL;
}
-static void do_child()
+void do_child()
{
int ret;
pthread_t th_work, th_sig1;
@@ -279,7 +279,7 @@ static void do_child()
UNRESOLVED(ret, "Worker thread join failed");
}
-static void main_loop()
+void main_loop()
{
int child_count = 0;
int stat_pipe[2];
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-1.c
index 451adf137..7f2561826 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-1.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-2.c
index bf2ee4664..a6e9d78bf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/1-2.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/2-1.c
index 9b43ccd8f..8a93fff52 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_equal/2-1.c
@@ -75,15 +75,15 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static volatile int do_it = 1;
-static unsigned long count_ope = 0;
+volatile int do_it = 1;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -93,7 +93,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -127,7 +127,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig1)) {
@@ -137,7 +137,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig2)) {
@@ -147,7 +147,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
}
/* Test function -- calls pthread_equal() and checks that EINTR is never returned. */
-static void *test(void *arg)
+void *test(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-1.c
index b7d216aa9..a9db78023 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-1.c
@@ -28,10 +28,10 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem; /* Manual semaphore used to indicate when the thread has been created. */
+int sem; /* Manual semaphore used to indicate when the thread has been created. */
/* Thread's function. */
-static void *a_thread_func()
+void *a_thread_func()
{
sem = INMAIN;
pthread_exit((void *)RETURN_CODE);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c
index 82be6f982..046d21aac 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/1-2.c
@@ -91,7 +91,7 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
pthread_exit(NULL + 1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-1.c
index dff55f0ac..844e55ac7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-1.c
@@ -25,11 +25,11 @@
#include <unistd.h>
#include "posixtest.h"
-static int i[3], j;
+int i[3], j;
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func1()
+void a_cleanup_func1()
{
i[j] = 1;
j++;
@@ -38,7 +38,7 @@ static void a_cleanup_func1()
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func2()
+void a_cleanup_func2()
{
i[j] = 2;
j++;
@@ -47,7 +47,7 @@ static void a_cleanup_func2()
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func3()
+void a_cleanup_func3()
{
i[j] = 3;
j++;
@@ -55,7 +55,7 @@ static void a_cleanup_func3()
}
/* Thread's function. */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set up 3 cleanup handlers */
pthread_cleanup_push(a_cleanup_func1, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c
index 2fc3ff700..46a983b4f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/2-2.c
@@ -89,10 +89,10 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static int global = 0;
-static int tab[3];
+int global = 0;
+int tab[3];
-#define CLEANUP(n) static void clnp##n(void * arg)\
+#define CLEANUP(n) void clnp##n(void * arg)\
{\
tab[global]=n; \
global++; \
@@ -102,7 +102,7 @@ CLEANUP(1)
CLEANUP(2)
CLEANUP(3)
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
pthread_cleanup_push(clnp3, NULL);
pthread_cleanup_push(clnp2, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-1.c
index e0dfd24ed..26df586be 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-1.c
@@ -29,15 +29,15 @@
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
/* Flag to indicate that the destructor was called */
-static int cleanup_flag = 0;
+int cleanup_flag = 0;
-static void destructor(void *tmp PTS_ATTRIBUTE_UNUSED)
+void destructor(void *tmp LTP_ATTRIBUTE_UNUSED)
{
cleanup_flag = 1;
}
/* Thread's function. */
-static void *a_thread_func(void *tmp PTS_ATTRIBUTE_UNUSED)
+void *a_thread_func(void *tmp LTP_ATTRIBUTE_UNUSED)
{
pthread_key_t key;
int value = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c
index 5fa6c8b50..5b64fc61b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/3-2.c
@@ -90,11 +90,11 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static int global = 0;
-static int tab[4];
-static pthread_key_t tld[3];
+int global = 0;
+int tab[4];
+pthread_key_t tld[3];
-#define CLEANUP(n) static void clnp##n(void * arg)\
+#define CLEANUP(n) void clnp##n(void * arg)\
{\
tab[global]=n; \
global++; \
@@ -106,13 +106,13 @@ CLEANUP(1)
CLEANUP(3)
/* TLD destructor */
-static void destructor(void *arg)
+void destructor(void *arg)
{
*(int *)arg += global;
}
/* Thread routine */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c
index 1252d5619..73246872b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/4-1.c
@@ -89,21 +89,21 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static int global = 0;
+int global = 0;
/* atexit() routines */
-static void at1(void)
+void at1(void)
{
global +=1;
}
-static void at2(void)
+void at2(void)
{
global +=2;
}
/* Thread routine */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c
index 730b751eb..b66109af1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/5-1.c
@@ -88,28 +88,28 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static int atctl = 0;
-static pthread_key_t tld[3];
+int atctl = 0;
+pthread_key_t tld[3];
/* atexit() routines */
-static void at1(void)
+void at1(void)
{
atctl += 1;
}
-static void at2(void)
+void at2(void)
{
atctl += 2;
}
/* TLD destructor */
-static void destructor(void *arg)
+void destructor(void *arg)
{
*(int *)arg += 1;
}
/* Thread routine */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c
index b21e43d7b..451f171b6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-1.c
@@ -96,16 +96,16 @@
/********************************************************************************************/
/* This will be used to control that atexit() has been called */
-static int *ctl;
-static long mf;
+int *ctl;
+long mf;
-static void clnp(void)
+void clnp(void)
{
*ctl = 1;
}
/* Thread routine */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-2.c
index 2946cb260..858881fe9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_exit/6-2.c
@@ -90,7 +90,7 @@
/********************************************************************************************/
/* Thread routine */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c
index 4a27aa83e..284d79e6f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/1-1.c
@@ -27,7 +27,7 @@
#define FUNCTION "pthread_getcpuclockid"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static void *thread_func()
+void *thread_func()
{
int rc;
clockid_t cid;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c
index 1bb53cb58..730823f21 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/speculative/3-1.c
@@ -28,7 +28,7 @@
#define FUNCTION "pthread_getcpuclockid"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static void *thread_func()
+void *thread_func()
{
pthread_exit(0);
return NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/1-2.c
index 4b44242da..8b7c42b07 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/1-2.c
@@ -27,7 +27,7 @@
#define ERR_MSG(f, rc) printf("Failed: func %s rc: %s (%u)\n", \
f, strerror(rc), rc)
-static void *thread_func(void* arg PTS_ATTRIBUTE_UNUSED)
+void *thread_func(void* arg LTP_ATTRIBUTE_UNUSED)
{
struct sched_param sparam;
int policy, priority, policy_1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c
index b7bc56eac..97411ec51 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/4-1.c
@@ -45,10 +45,10 @@
#include "../testfrmw/threads_scenarii.c"
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
/* 1st thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
@@ -65,7 +65,7 @@ static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
}
/* Canceled thread */
-static void *joiner_func(void *arg)
+void *joiner_func(void *arg)
{
(void)pthread_join(*(pthread_t *) arg, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c
index 7325defc3..f97f0396e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c
@@ -55,7 +55,7 @@ static sem_t semsig2;
static unsigned long count_sig;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
struct thestruct {
int sig;
@@ -96,7 +96,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+static void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig1))
@@ -105,7 +105,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+static void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig2))
@@ -113,13 +113,13 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
#endif
}
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
sched_yield();
return NULL;
}
-static void *test(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *test(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
pthread_t child;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-1.c
index 097d16185..3861df9dd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-1.c
@@ -29,7 +29,7 @@
#define NUM_OF_KEYS 10
#define KEY_VALUE 0
-static pthread_key_t keys[NUM_OF_KEYS];
+pthread_key_t keys[NUM_OF_KEYS];
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-2.c
index 553d2dae5..f77573a22 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/1-2.c
@@ -27,11 +27,11 @@
#define NUM_OF_THREADS 10
#define KEY_VALUE 1000
-static pthread_key_t keys[NUM_OF_THREADS];
-static int i;
+pthread_key_t keys[NUM_OF_THREADS];
+int i;
/* Thread function that sets the key to KEY_VALUE */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set the key to KEY_VALUE */
if (pthread_setspecific(keys[i], (void *)(KEY_VALUE)) != 0) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/3-1.c
index 7e46d2d07..8e07b1434 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_create/3-1.c
@@ -28,17 +28,17 @@
#define KEY_VALUE 1000
-static pthread_key_t key;
-static int dest_cnt;
+pthread_key_t key;
+int dest_cnt;
/* Destructor function */
-static void dest_func(void *p PTS_ATTRIBUTE_UNUSED)
+void dest_func(void *p LTP_ATTRIBUTE_UNUSED)
{
dest_cnt++;
}
/* Thread function */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set the value of the key to a value */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_delete/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_delete/2-1.c
index b30bebcb6..8aba51cac 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_delete/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_key_delete/2-1.c
@@ -26,11 +26,11 @@
#define KEY_VALUE 1000
-static pthread_key_t key;
-static int dest_cnt;
+pthread_key_t key;
+int dest_cnt;
/* Destructor function */
-static void dest_func(void *p PTS_ATTRIBUTE_UNUSED)
+void dest_func(void *p LTP_ATTRIBUTE_UNUSED)
{
dest_cnt++;
/* Delete the key and check if an error has occured */
@@ -40,7 +40,7 @@ static void dest_func(void *p PTS_ATTRIBUTE_UNUSED)
}
/* Thread function */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set the value of the key to a value */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-1.c
index 534972d8a..5c3ca6563 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-1.c
@@ -48,14 +48,14 @@
static int sem1; /* Manual semaphore */
static volatile int handler_called;
-static void handler()
+void handler()
{
printf("signal was called\n");
handler_called = 1;
return;
}
-static void *a_thread_func()
+void *a_thread_func()
{
struct sigaction act;
act.sa_flags = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-2.c
index f4c7eea5a..006623d8e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-2.c
@@ -79,10 +79,10 @@
/******************************************************************************/
static volatile int handler_called;
-static pthread_t ch;
+pthread_t ch;
/* Signal handler */
-static void handler(int sig)
+void handler(int sig)
{
handler_called = sig;
@@ -93,7 +93,7 @@ static void handler(int sig)
}
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rebours = 3;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c
index a462ba8e0..e146b59cb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/6-1.c
@@ -21,7 +21,7 @@
#include <string.h>
#include "posixtest.h"
-static void *thread_function(void *arg PTS_ATTRIBUTE_UNUSED)
+void *thread_function(void *arg LTP_ATTRIBUTE_UNUSED)
{
/* Does nothing */
pthread_exit(NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c
index 086a0cf5c..353922721 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c
@@ -75,15 +75,15 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static volatile char do_it = 1;
-static unsigned long count_ope = 0;
+char do_it = 1;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -93,7 +93,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -132,7 +132,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -143,7 +143,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -153,16 +153,16 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
#endif
}
-static int init_ctl;
+int init_ctl;
/* Init function */
-static void initializer(void)
+void initializer(void)
{
init_ctl++;
return;
}
/* Test function -- calls pthread_kill() and checks that EINTR is never returned. */
-static void *test(void *arg PTS_ATTRIBUTE_UNUSED)
+void *test(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c
index 75ea46188..3a86b3fa8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c
@@ -15,8 +15,8 @@
#include <stdio.h>
#include "posixtest.h"
-static pthread_mutex_t mutex1, mutex2;
-static pthread_mutex_t mutex3 = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mutex1, mutex2;
+pthread_mutex_t mutex3 = PTHREAD_MUTEX_INITIALIZER;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c
index e8c39b204..18adc683c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/2-2.c
@@ -69,7 +69,7 @@
/********************************************************************************************/
#ifndef WITHOUT_XOPEN
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
char *descr; /* Case description */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c
index 61cec1790..96c9ec1d7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-1.c
@@ -13,7 +13,7 @@
#include <unistd.h>
#include "posixtest.h"
-static pthread_mutex_t mutex;
+pthread_mutex_t mutex;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c
index 0425a3f31..22ea7135b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_destroy/5-2.c
@@ -70,7 +70,7 @@
/********************************************************************************************/
#ifndef WITHOUT_XOPEN
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
char *descr; /* Case description */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c
index 017d1c00d..9b3a60654 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/1-1.c
@@ -71,7 +71,7 @@ int main(void)
printf("Prioceiling returned: %d\n", prioceiling);
return PTS_PASS;
#else
- printf("pthread_mutex_getprioceiling not supported\n");
+ printf("pthread_mutex_getprioceiling not supported");
return PTS_UNSUPPORTED;
#endif
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-1.c
index ba92e5d7d..1b8d7360e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-1.c
@@ -65,7 +65,7 @@ int main(void)
return (error == EINVAL ? PTS_PASS : PTS_FAIL);
#else
- printf("pthread_mutex_getprioceiling not supported\n");
+ printf("pthread_mutex_getprioceiling not supported");
return PTS_UNSUPPORTED;
#endif
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-2.c
index e75cbaa64..98449bfe4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-2.c
@@ -78,7 +78,7 @@ int main(void)
return (error == EINVAL ? PTS_PASS : PTS_FAIL);
#else
- printf("pthread_mutex_getprioceiling not supported\n");
+ printf("pthread_mutex_getprioceiling not supported");
return PTS_UNSUPPORTED;
#endif
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-3.c
index b1f459435..bdfed508f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling/3-3.c
@@ -80,7 +80,7 @@ int main(void)
return (error == EINVAL ? PTS_PASS : PTS_UNRESOLVED);
#else
- printf("pthread_mutex_getprioceiling not supported\n");
+ printf("pthread_mutex_getprioceiling not supported");
return PTS_UNSUPPORTED;
#endif
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/1-2.c
index 99286d9cf..ff6177ed0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/1-2.c
@@ -85,21 +85,21 @@
/********************************************************************************************/
/**** global variables ****/
-static pthread_mutex_t *p_mtx;
-static int retval = 0;
-static int returned = 0;
-static int canceled = 0;
-static sem_t semA, semB;
+pthread_mutex_t *p_mtx;
+int retval = 0;
+int returned = 0;
+int canceled = 0;
+sem_t semA, semB;
/***** Cancelation handlers *****/
-static void cleanup_deadlk(void *arg PTS_ATTRIBUTE_UNUSED)
+void cleanup_deadlk(void *arg LTP_ATTRIBUTE_UNUSED)
{
canceled = 1;
pthread_mutex_unlock(p_mtx);
}
/***** Threads functions *****/
-static void *deadlk_issue(void *arg PTS_ATTRIBUTE_UNUSED)
+void *deadlk_issue(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, tmp;
@@ -131,7 +131,7 @@ static void *deadlk_issue(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *unlock_issue(void *arg PTS_ATTRIBUTE_UNUSED)
+void *unlock_issue(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c
index 9ee86a5db..de0bf7888 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-1.c
@@ -20,7 +20,7 @@ typedef struct my_data {
int value; /* Access protected by mutex */
} my_data_t;
-static my_data_t data = { PTHREAD_MUTEX_INITIALIZER, 0 };
+my_data_t data = { PTHREAD_MUTEX_INITIALIZER, 0 };
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-2.c
index 53e4122c6..cefe21eb1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_init/3-2.c
@@ -91,21 +91,21 @@
/********************************************************************************************/
/**** global variables ****/
-static pthread_mutex_t *p_mtx;
-static int retval = 0;
-static int returned = 0;
-static int canceled = 0;
-static sem_t semA, semB;
+pthread_mutex_t *p_mtx;
+int retval = 0;
+int returned = 0;
+int canceled = 0;
+sem_t semA, semB;
/***** Cancelation handlers *****/
-static void cleanup_deadlk(void *arg PTS_ATTRIBUTE_UNUSED)
+void cleanup_deadlk(void *arg LTP_ATTRIBUTE_UNUSED)
{
canceled = 1;
pthread_mutex_unlock(p_mtx);
}
/***** Threads functions *****/
-static void *deadlk_issue(void *arg PTS_ATTRIBUTE_UNUSED)
+void *deadlk_issue(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, tmp;
@@ -137,7 +137,7 @@ static void *deadlk_issue(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *unlock_issue(void *arg PTS_ATTRIBUTE_UNUSED)
+void *unlock_issue(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c
index 913251914..a647f210d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/1-1.c
@@ -29,10 +29,10 @@
#define THREAD_NUM 5
#define LOOPS 4
-static void *f1(void *parm);
+void *f1(void *parm);
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static int value; /* value protected by mutex */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+int value; /* value protected by mutex */
int main(void)
{
@@ -69,7 +69,7 @@ int main(void)
return PTS_PASS;
}
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
int i, tmp;
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/3-1.c
index 78685af3d..91fa0ee77 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/3-1.c
@@ -79,16 +79,16 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static unsigned long count_ope = 0;
-static pthread_mutex_t count_protect = PTHREAD_MUTEX_INITIALIZER;
+char do_it = 1;
+unsigned long count_ope = 0;
+pthread_mutex_t count_protect = PTHREAD_MUTEX_INITIALIZER;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sem_t semsync;
-static sem_t semsync2;
+sem_t semsync;
+sem_t semsync2;
typedef struct {
pthread_t *thr;
@@ -100,7 +100,7 @@ typedef struct {
/* the following function keeps on sending the signal to the thread pointed by arg
* If WITH_SYNCHRO is defined, the target thread has a handler for the signal */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -122,7 +122,7 @@ static void *sendsig(void *arg)
}
/* Next are the signal handlers. */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if ((sem_post(&semsig1))) {
@@ -131,7 +131,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
#endif
}
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if ((sem_post(&semsig2))) {
@@ -143,7 +143,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
/* The following function loops on init/destroy some mutex (with different attributes)
* it does check that no error code of EINTR is returned */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
pthread_mutexattr_t ma[4], *pma[5];
pthread_mutex_t m[5];
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/4-1.c
index 9529f6cc0..d4275a1ca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/4-1.c
@@ -86,11 +86,11 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static pthread_mutex_t mtx;
-static sem_t sem;
+pthread_mutex_t mtx;
+sem_t sem;
/** child thread function **/
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
/* Try to lock the mutex once. The call must fail here. */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/5-1.c
index 3984d6b92..4c7eccaad 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_lock/5-1.c
@@ -86,12 +86,12 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static pthread_mutex_t mtx[5];
-static sem_t semsig, semstart;
-static int ctrl = 0;
+pthread_mutex_t mtx[5];
+sem_t semsig, semstart;
+int ctrl = 0;
/********* signal handler **********/
-static void sighdl(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl(int sig LTP_ATTRIBUTE_UNUSED)
{
if (sem_post(&semsig)) {
UNRESOLVED(errno, "Sem_post in signal handler");
@@ -99,7 +99,7 @@ static void sighdl(int sig PTS_ATTRIBUTE_UNUSED)
}
/********** thread *********/
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret, i;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_setprioceiling/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_setprioceiling/1-1.c
index 5aa1113c4..12b6cec03 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_setprioceiling/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_setprioceiling/1-1.c
@@ -71,7 +71,7 @@ int main(void)
printf("Prioceiling returned: %d\n", prioceiling);
return PTS_PASS;
#else
- printf("pthread_mutex_getprioceiling not supported\n");
+ printf("pthread_mutex_getprioceiling not supported");
return PTS_UNSUPPORTED;
#endif
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c
index 9955929ea..f1a1ac664 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/1-1.c
@@ -34,10 +34,10 @@
#define TIMEOUT 3 /* 3 seconds of timeout time for
pthread_mutex_timedlock(). */
-static void *f1(void *parm);
+void *f1(void *parm);
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
-static struct timeval currsec1, currsec2; /* Variables for saving time before
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
+struct timeval currsec1, currsec2; /* Variables for saving time before
and after locking the mutex using
pthread_mutex_timedlock(). */
/****************************
@@ -106,7 +106,7 @@ int main(void)
* f1()
*
* *************************/
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c
index 8015dd2e9..2c39b4bf6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/2-1.c
@@ -37,10 +37,10 @@
#define TIMEOUT 3 /* 3 seconds of timeout time for
pthread_mutex_timedlock(). */
-static void *f1(void *parm);
+void *f1(void *parm);
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
-static struct timeval currsec1, currsec2; /* Variables for saving time before
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
+struct timeval currsec1, currsec2; /* Variables for saving time before
and after locking the mutex using
pthread_mutex_timedlock(). */
/****************************
@@ -109,7 +109,7 @@ int main(void)
* f1()
*
* *************************/
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout, ts;
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c
index a7099688b..458df2685 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/4-1.c
@@ -27,12 +27,12 @@
#define TIMEOUT 3 /* 3 seconds of timeout time for
pthread_mutex_timedlock(). */
-static void *f1(void *parm);
+void *f1(void *parm);
-static int ret; /* Save return value of
+int ret; /* Save return value of
pthread_mutex_timedlock(). */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
-static time_t currsec1, currsec2; /* Variables for saving time before
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
+time_t currsec1, currsec2; /* Variables for saving time before
and afer locking the mutex using
pthread_mutex_timedlock(). */
/****************************
@@ -72,7 +72,7 @@ int main(void)
* f1()
*
* *************************/
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c
index 077bfe76d..18d3a9908 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-1.c
@@ -35,12 +35,12 @@
'abs_timeout. */
#define TIMEOUT 3 /* 3 seconds of timeout time for
pthread_mutex_timedlock(). */
-static void *f1(void *parm);
+void *f1(void *parm);
-static int ret; /* Save return value of
+int ret; /* Save return value of
pthread_mutex_timedlock(). */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
-static time_t currsec1, currsec2; /* Variables for saving time before
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
+time_t currsec1, currsec2; /* Variables for saving time before
and afer locking the mutex using
pthread_mutex_timedlock(). */
/****************************
@@ -81,7 +81,7 @@ int main(void)
* f1()
*
* *************************/
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c
index 0eda6e58f..515f2f6a7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-2.c
@@ -35,12 +35,12 @@
'abs_timeout. */
#define TIMEOUT 3 /* 3 seconds of timeout time for
pthread_mutex_timedlock(). */
-static void *f1(void *parm);
+void *f1(void *parm);
-static int ret; /* Save return value of
+int ret; /* Save return value of
pthread_mutex_timedlock(). */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
-static time_t currsec1, currsec2; /* Variables for saving time before
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
+time_t currsec1, currsec2; /* Variables for saving time before
and afer locking the mutex using
pthread_mutex_timedlock(). */
/****************************
@@ -81,7 +81,7 @@ int main(void)
* f1()
*
* *************************/
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c
index baf429503..43d699762 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_timedlock/5-3.c
@@ -31,12 +31,12 @@
#define TIMEOUT 3 /* 3 seconds of timeout time for
pthread_mutex_timedlock(). */
-static void *f1(void *parm);
+void *f1(void *parm);
-static int ret; /* Save return value of
+int ret; /* Save return value of
pthread_mutex_timedlock(). */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
-static time_t currsec1, currsec2; /* Variables for saving time before
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* The mutex */
+time_t currsec1, currsec2; /* Variables for saving time before
and afer locking the mutex using
pthread_mutex_timedlock(). */
/****************************
@@ -95,7 +95,7 @@ int main(void)
* f1()
*
* *************************/
-static void *f1(void *parm PTS_ATTRIBUTE_UNUSED)
+void *f1(void *parm LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c
index ee3f4587c..70123e40d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-1.c
@@ -27,11 +27,11 @@
#include <unistd.h>
#include "posixtest.h"
-static void *func(void *parm);
+void *func(void *parm);
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static int t1_start = 0;
-static int t1_pause = 1;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+int t1_start = 0;
+int t1_pause = 1;
int main(void)
{
@@ -84,7 +84,7 @@ int main(void)
return PTS_PASS;
}
-static void *func(void *parm PTS_ATTRIBUTE_UNUSED)
+void *func(void *parm LTP_ATTRIBUTE_UNUSED)
{
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c
index 7901115f0..72825fb05 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/1-2.c
@@ -81,7 +81,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */
@@ -127,7 +127,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
/* The test function will only perform a trylock operation then return. */
-static void *tf(void *arg)
+void *tf(void *arg)
{
testdata_t *td = (testdata_t *) arg;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c
index 203d03cb5..32c9ec870 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/2-1.c
@@ -86,7 +86,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */
@@ -104,7 +104,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
/* The test function will only perform a trylock operation then return. */
-static void *tf(void *arg)
+void *tf(void *arg)
{
testdata_t *td = (testdata_t *) arg;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c
index b2a55d861..688ccc629 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-1.c
@@ -21,7 +21,7 @@
#include <errno.h>
#include "posixtest.h"
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c
index eef5dd8db..4139ada5b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-2.c
@@ -79,7 +79,7 @@ typedef struct {
int status; /* error code */
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
int fork; /* 0: Test between threads. ~ !0: Test across processes, if supported (mmap) */
@@ -125,7 +125,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
/* The test function will only perform a trylock operation then return. */
-static void *tf(void *arg)
+void *tf(void *arg)
{
testdata_t *td = (testdata_t *) arg;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c
index e7e86bfa8..f57786e60 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_trylock/4-3.c
@@ -72,7 +72,7 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
char *descr; /* Case description */
@@ -102,16 +102,16 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
-static char do_it = 1;
-static char woken = 0;
-static unsigned long count_ope = 0;
+char do_it = 1;
+char woken = 0;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -121,7 +121,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -155,7 +155,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig1)) {
@@ -165,7 +165,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
if (sem_post(&semsig2)) {
@@ -175,7 +175,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
}
/* Test function -- This one calls pthread_mutex_trylock and check that no EINTR is returned. */
-static void *test(void *arg PTS_ATTRIBUTE_UNUSED)
+void *test(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
int i;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c
index db6b3b326..db9fcfccd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/1-1.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include "posixtest.h"
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c
index 27f0ee3d7..6b46df334 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/2-1.c
@@ -32,10 +32,10 @@
#define THREAD_NUM 6
#define LOOPS 3
-static void *func(void *parm);
+void *func(void *parm);
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static int value; /* value protected by mutex */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+int value; /* value protected by mutex */
int main(void)
{
@@ -65,7 +65,7 @@ int main(void)
return PTS_PASS;
}
-static void *func(void *parm PTS_ATTRIBUTE_UNUSED)
+void *func(void *parm LTP_ATTRIBUTE_UNUSED)
{
int i, tmp;
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c
index f413e55cf..0519c7b73 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_unlock/5-1.c
@@ -76,10 +76,10 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static pthread_mutex_t m;
+pthread_mutex_t m;
/** child thread function **/
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
ret = pthread_mutex_unlock(&m);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c
index 909b53bf4..4bbeb9599 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/1-1.c
@@ -37,7 +37,7 @@
#include <stdio.h>
#include "posixtest.h"
-static pthread_mutex_t new_mutex; /* The mutex. */
+pthread_mutex_t new_mutex; /* The mutex. */
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c
index 614471042..d22c5db85 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/2-1.c
@@ -42,7 +42,7 @@ int main(void)
/* Set the attribute to PTHREAD_PROCESS_PRIVATE. */
ret = pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_PRIVATE);
if (ret != 0) {
- printf("Test FAILED: Expected return code 0, got: %d\n", ret);
+ printf("Test FAILED: Expected return code 0, got: %d", ret);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-1.c
index 0db84c4f2..49b16d0fd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-1.c
@@ -44,7 +44,7 @@ int main(void)
return PTS_PASS;
}
- printf("Test FAILED: Expected return code 0 or EINVAL, got: %d\n",
+ printf("Test FAILED: Expected return code 0 or EINVAL, got: %d",
ret);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c
index 27abbd00e..bdaccb571 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setpshared/3-2.c
@@ -47,7 +47,7 @@ int main(void)
return PTS_PASS;
}
- printf("Test FAILED: Expected return code 0 or EINVAL, got: %d\n",
+ printf("Test FAILED: Expected return code 0 or EINVAL, got: %d",
ret);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c
index 96c2d4744..a9e9e6f0c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/2-1.c
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void alarm_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void alarm_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Got SIGALRM after 1 second\n");
printf("Test PASSED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c
index cd2b669ca..9ab92a817 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_settype/3-2.c
@@ -30,13 +30,13 @@
#include <errno.h>
#include "posixtest.h"
-static pthread_t thread1;
-static pthread_mutex_t mutex;
-static pthread_mutexattr_t mta;
+pthread_t thread1;
+pthread_mutex_t mutex;
+pthread_mutexattr_t mta;
-static int ret; /* Return value of the thread unlocking the mutex. */
+int ret; /* Return value of the thread unlocking the mutex. */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Try to unlock the mutex that main already locked. */
ret = pthread_mutex_unlock(&mutex);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-1.c
index 92a757930..bb212c0e9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-1.c
@@ -29,7 +29,7 @@
static int init_flag;
/* The init function that pthread_once calls */
-static void an_init_func(void)
+void an_init_func(void)
{
init_flag++;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-2.c
index 572a242e5..c8383cbe0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-2.c
@@ -73,9 +73,9 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static int control;
+int control;
-static void my_init(void)
+void my_init(void)
{
control = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-3.c
index 9c55fe8cc..9f1ad0c75 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/1-3.c
@@ -75,10 +75,10 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static int control;
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+int control;
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-static void my_init(void)
+void my_init(void)
{
int ret = 0;
ret = pthread_mutex_lock(&mtx);
@@ -99,7 +99,7 @@ static void my_init(void)
}
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/2-1.c
index 1b507f895..0339e16c9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/2-1.c
@@ -72,9 +72,9 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static int control;
+int control;
-static void my_init(void)
+void my_init(void)
{
sleep(1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/3-1.c
index 6f8fa9e97..34709ae44 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/3-1.c
@@ -26,13 +26,13 @@
#include "posixtest.h"
/* Keeps track of how many times the init function has been called. */
-static int init_flag;
+int init_flag;
/* Global pthread_once_t object */
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+pthread_once_t once_control = PTHREAD_ONCE_INIT;
/* The init function that pthread_once calls */
-static void *an_init_func()
+void *an_init_func()
{
/* Indicate to main() that the init function has been reached */
init_flag = 1;
@@ -49,7 +49,7 @@ static void *an_init_func()
}
/* Thread function */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Make the thread cancelable immediately */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
@@ -59,7 +59,7 @@ static void *a_thread_func()
}
/* 2nd init function used by the 2nd call of pthread_once */
-static void *an_init_func2()
+void *an_init_func2()
{
/* Indicate to main() that this init function has been reached */
init_flag = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c
index 6e519962b..fc862cbf9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/4-1-buildonly.c
@@ -12,4 +12,4 @@
#include <pthread.h>
-static pthread_once_t dummy = PTHREAD_ONCE_INIT;
+pthread_once_t dummy = PTHREAD_ONCE_INIT;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/6-1.c
index 018ad6b0c..802e830bb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_once/6-1.c
@@ -74,15 +74,15 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static unsigned long count_ope = 0;
+char do_it = 1;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -92,7 +92,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -131,7 +131,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -142,7 +142,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -152,16 +152,16 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
#endif
}
-static int init_ctl;
+int init_ctl;
/* Init function */
-static void initializer(void)
+void initializer(void)
{
init_ctl++;
return;
}
/* Test function -- calls pthread_equal() and checks that EINTR is never returned. */
-static void *test(void *arg PTS_ATTRIBUTE_UNUSED)
+void *test(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/1-1.c
index 6dca3ce1d..187719571 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/1-1.c
@@ -25,7 +25,7 @@
static pthread_rwlock_t rwlock;
static int thread_state;
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = 2;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/2-1.c
index 31ed137de..436b27efa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_init/2-1.c
@@ -25,7 +25,7 @@
static pthread_rwlock_t rwlock;
static int thread_state;
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = 2;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c
index 724ecc390..0f201fa25 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/1-1.c
@@ -42,7 +42,7 @@ static int thread_state;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
thread_state = ENTERED_THREAD;
@@ -177,7 +177,7 @@ int main(void)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c
index 288eb3e35..a2e8b8f4e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-1.c
@@ -260,7 +260,7 @@ int main(void)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c
index 3593e4c79..d51a0659f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c
@@ -259,7 +259,7 @@ int main(void)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c
index 40170dbb2..605ffd12a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-3.c
@@ -245,7 +245,7 @@ int main(void)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c
index 176262713..ae45bf97a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/4-1.c
@@ -54,7 +54,7 @@ static void sig_handler()
}
}
-static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *th_fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct sigaction act;
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c
index a37b06793..70f06afc8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/5-1.c
@@ -46,14 +46,14 @@ int main(void)
for (i = 0; i < COUNT; i++) {
if (pthread_rwlock_unlock(&rwlock) != 0) {
printf
- ("Test FAILED: main cannot unlock rwlock number %d\n",
+ ("Test FAILED: main cannot unlock rwlock number %d",
i);
return PTS_FAIL;
}
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c
index f13e8c414..0b2251073 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/1-1.c
@@ -47,7 +47,7 @@ static pthread_rwlock_t rwlock;
static int thread_state;
static struct timeval currsec1, currsec2;
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c
index 2e57403aa..4f703a43a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/2-1.c
@@ -45,7 +45,7 @@ static int thread_state;
static time_t currsec1, currsec2;
static int expired;
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct timespec abs_timeout;
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c
index 2585fddc5..f4c9e18b7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/3-1.c
@@ -50,7 +50,7 @@ static pthread_rwlock_t rwlock;
static int thread_state;
static struct timeval currsec1, currsec2;
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c
index da48575ef..64aeba16a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/5-1.c
@@ -37,7 +37,7 @@ static int thread_state;
static time_t currsec1;
static int expired;
-static void *fn_rd_1(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd_1(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
struct timespec abs_timeout;
@@ -74,7 +74,7 @@ static void *fn_rd_1(void *arg PTS_ATTRIBUTE_UNUSED)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("thread1: Error at pthread_rwlockattr_destroy()\n");
+ printf("thread1: Error at pthread_rwlockattr_destroy()");
exit(PTS_UNRESOLVED);
}
thread_state = EXITING_THREAD;
@@ -82,7 +82,7 @@ static void *fn_rd_1(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *fn_rd_2(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd_2(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
struct timespec abs_timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c
index ba09b981b..b13656293 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-1.c
@@ -69,7 +69,7 @@ static void sig_handler()
}
}
-static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *th_fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct sigaction act;
struct timespec abs_timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c
index d3f812b4f..01ca8663a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/6-2.c
@@ -78,7 +78,7 @@ static void sig_handler()
handler_state = 3;
}
-static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *th_fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct sigaction act;
struct timespec abs_timeout;
@@ -106,10 +106,10 @@ static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
printf("thread: correctly acquired read lock\n");
expired = 0;
} else if (rc == ETIMEDOUT) {
- printf("thread: timer expired, did not acquire read lock\n");
+ printf("thread: timer expired, did not acquire read lock");
expired = 1;
} else {
- printf("Error at pthread_rwlock_timedrdlock()\n");
+ printf("Error at pthread_rwlock_timedrdlock()");
exit(PTS_UNRESOLVED);
}
@@ -155,7 +155,7 @@ int main(void)
printf("main: fire SIGUSR1 to thread\n");
if (pthread_kill(sig_thread, SIGUSR1) != 0) {
- printf("Error in pthread_kill()\n");
+ printf("Error in pthread_kill()");
exit(PTS_UNRESOLVED);
}
@@ -206,12 +206,12 @@ int main(void)
}
if (pthread_join(sig_thread, NULL) != 0) {
- printf("Error at pthread_join()\n");
+ printf("Error at pthread_join()");
return PTS_UNRESOLVED;
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_destroy()\n");
+ printf("Error at pthread_destroy()");
exit(PTS_UNRESOLVED);
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c
index cdf9d6074..03f91b58f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/1-1.c
@@ -51,7 +51,7 @@ static int expired;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_wr(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout;
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c
index 5bf76b8d5..dfeb7d74c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/2-1.c
@@ -46,7 +46,7 @@ static int expired;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct timespec abs_timeout;
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c
index 9dd3f7091..163439bc1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/3-1.c
@@ -53,7 +53,7 @@ static int expired;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_wr(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct timespec timeout, ts;
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c
index 53a192fbb..f5bebca58 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/5-1.c
@@ -44,7 +44,7 @@ static int expired;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_wr_1(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr_1(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
struct timespec abs_timeout;
@@ -81,7 +81,7 @@ static void *fn_wr_1(void *arg PTS_ATTRIBUTE_UNUSED)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("thread1: Error at pthread_rwlockattr_destroy()\n");
+ printf("thread1: Error at pthread_rwlockattr_destroy()");
exit(PTS_UNRESOLVED);
}
thread_state = EXITING_THREAD;
@@ -89,7 +89,7 @@ static void *fn_wr_1(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *fn_wr_2(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr_2(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
struct timespec abs_timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c
index 8253485d1..05be6e61a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-1.c
@@ -69,7 +69,7 @@ static void sig_handler()
}
}
-static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *th_fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct sigaction act;
struct timespec abs_timeout;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c
index e9949f855..08c17478b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/6-2.c
@@ -78,7 +78,7 @@ static void sig_handler()
handler_state = 3;
}
-static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *th_fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct sigaction act;
struct timespec abs_timeout;
@@ -106,7 +106,7 @@ static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
printf("thread: correctly acquired write lock\n");
expired = 0;
} else if (rc == ETIMEDOUT) {
- printf("thread: timer expired, did not acquire write lock\n");
+ printf("thread: timer expired, did not acquire write lock");
expired = 1;
} else {
printf("Error %d at pthread_rwlock_timedwrlock()\n", rc);
@@ -155,7 +155,7 @@ int main(void)
printf("main: fire SIGUSR1 to thread\n");
if (pthread_kill(sig_thread, SIGUSR1) != 0) {
- printf("Error in pthread_kill()\n");
+ printf("Error in pthread_kill()");
exit(PTS_UNRESOLVED);
}
@@ -206,12 +206,12 @@ int main(void)
}
if (pthread_join(sig_thread, NULL) != 0) {
- printf("Error at pthread_join()\n");
+ printf("Error at pthread_join()");
return PTS_UNRESOLVED;
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_destroy()\n");
+ printf("Error at pthread_destroy()");
exit(PTS_UNRESOLVED);
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c
index d107d80df..00690d800 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_tryrdlock/1-1.c
@@ -44,7 +44,7 @@ static int thread_state;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_rd_1(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd_1(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
@@ -67,7 +67,7 @@ static void *fn_rd_1(void *arg PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *fn_rd_2(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd_2(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
thread_state = ENTERED_THREAD;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c
index b92232878..c5a14b2a7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_trywrlock/1-1.c
@@ -42,7 +42,7 @@ static int get_ebusy;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_wr(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
int rc;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c
index 624dec055..deaea14d7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/1-1.c
@@ -47,7 +47,7 @@ static int thread_state;
#define PASSED_RLOCK2 4
#define EXITING_THREAD 5
-static void *fn_rd(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_rd(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c
index b35c141c5..ea3c0c488 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/2-1.c
@@ -40,7 +40,7 @@ static int thread_state;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_wr(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c
index 81d9ec43f..2a7b6b477 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/3-1.c
@@ -365,7 +365,7 @@ int main(void)
}
if (pthread_rwlock_destroy(&rwlock) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c
index 6b52b938a..5a5c8ecc6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/4-2.c
@@ -41,7 +41,7 @@ static int rc, thread_state;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_unlk(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_unlk(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
printf("un_thread: unlock read lock\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c
index 6786238e7..17f495937 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/1-1.c
@@ -41,7 +41,7 @@ static int thread_state;
#define ENTERED_THREAD 2
#define EXITING_THREAD 3
-static void *fn_wr(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_wr(void *arg LTP_ATTRIBUTE_UNUSED)
{
thread_state = ENTERED_THREAD;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c
index 774deb4d9..68158c196 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/2-1.c
@@ -54,7 +54,7 @@ static void sig_handler()
}
}
-static void *th_fn(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *th_fn(void *arg LTP_ATTRIBUTE_UNUSED)
{
struct sigaction act;
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c
index 3ffdc0cea..4530cf161 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_getpshared/2-1.c
@@ -33,7 +33,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct shmstruct {
+struct shmstruct {
pthread_rwlock_t rwl;
int data;
} *rwlock_data;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c
index 171accf95..63a0892e4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlockattr_setpshared/1-1.c
@@ -78,7 +78,7 @@ int main(void)
}
if (pthread_rwlockattr_destroy(&rwla) != 0) {
- printf("Error at pthread_rwlockattr_destroy()\n");
+ printf("Error at pthread_rwlockattr_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_self/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_self/1-1.c
index d48329df6..7bcbb653c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_self/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_self/1-1.c
@@ -23,10 +23,10 @@
#include <stdio.h>
#include "posixtest.h"
-static pthread_t new_th2; /* Global thread to hold the value of when pthread_self
+pthread_t new_th2; /* Global thread to hold the value of when pthread_self
returns from the thread function. */
-static void *a_thread_func()
+void *a_thread_func()
{
new_th2 = pthread_self();
pthread_exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-1.c
index 4157be420..fdcf44770 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-1.c
@@ -31,11 +31,11 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cancel_flag;
+int sem1; /* Manual semaphore */
+int cancel_flag;
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set cancel state to ENABLE, meaning it should honor all cancel requests. */
/* Set cancel type to ASYNCHRONOUS so that it honors cancel requests immediately. */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-2.c
index 626390170..ca980b5aa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/1-2.c
@@ -31,11 +31,11 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cancel_flag;
+int sem1; /* Manual semaphore */
+int cancel_flag;
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set cancel state to DISABLE, meaning it shouldn't honor any cancel requests. */
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/2-1.c
index c48be7a47..3f4afdbc6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/2-1.c
@@ -26,11 +26,11 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cancel_flag;
+int sem1; /* Manual semaphore */
+int cancel_flag;
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set default cancel state should be ENABLE, meaning it should honor all
* cancel requests. */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/3-1.c
index 895af8980..27b3486e6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcancelstate/3-1.c
@@ -25,10 +25,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int ret; /* Return value of pthread_setcancelstate(). */
+int ret; /* Return value of pthread_setcancelstate(). */
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set cancel state to an invalid integer and save the return value. */
ret = pthread_setcancelstate(-100, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-1.c
index 95bdf6f9e..5ca86b7ca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-1.c
@@ -35,20 +35,20 @@
#define INMAIN 1 /* Control going to or is already for Main */
#define TIMEOUT 10 /* Time out time in seconds */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
+int sem1; /* Manual semaphore */
+int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = 1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-2.c
index 2614e4623..75f8935e3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/1-2.c
@@ -38,20 +38,20 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
+int sem1; /* Manual semaphore */
+int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = -1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/2-1.c
index 92cd2b30c..c19e65ad5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setcanceltype/2-1.c
@@ -34,20 +34,20 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
+int sem1; /* Manual semaphore */
+int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = -1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-1.c
index 3137d2af2..ded12184b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-1.c
@@ -13,7 +13,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
struct sched_param sparam;
int policy, priority, policy_1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-2.c
index f945f6ad2..3170e52f4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-2.c
@@ -74,7 +74,7 @@
/******************************************************************************/
/* This function checks the thread policy & priority */
-static void check_param(pthread_t thread, int policy, int priority)
+void check_param(pthread_t thread, int policy, int priority)
{
int ret = 0;
@@ -105,7 +105,7 @@ static void check_param(pthread_t thread, int policy, int priority)
}
/* thread function 1 */
-static void *controler(void *arg)
+void *controler(void *arg)
{
int ret = 0;
@@ -125,7 +125,7 @@ static void *controler(void *arg)
}
/* thread function 2 */
-static void *changer(void *arg)
+void *changer(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/4-1.c
index d09e05673..2f9c6b4ec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/4-1.c
@@ -76,7 +76,7 @@
/******************************************************************************/
/* This function checks the thread policy & priority */
-static void check_param(pthread_t thread, int policy, int priority)
+void check_param(pthread_t thread, int policy, int priority)
{
int ret = 0;
@@ -107,7 +107,7 @@ static void check_param(pthread_t thread, int policy, int priority)
}
/* thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/5-1.c
index 23dfb2659..5ebc0a643 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/5-1.c
@@ -76,15 +76,15 @@
/***************************** Test case *********************************/
/******************************************************************************/
-static volatile char do_it = 1;
-static unsigned long count_ope = 0;
+char do_it = 1;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -94,7 +94,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -133,7 +133,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -144,7 +144,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -155,7 +155,7 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
}
/* Test function -- calls pthread_setschedparam() and checks that EINTR is never returned. */
-static void *test(void *arg)
+void *test(void *arg)
{
int ret = 0;
int pol1, pol2;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedprio/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedprio/1-1.c
index 166ba88c7..7f076449a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedprio/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedprio/1-1.c
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
struct sched_param sparam;
int policy, priority, policy_1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setspecific/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setspecific/1-2.c
index f1fc485ef..053910f47 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_setspecific/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_setspecific/1-2.c
@@ -30,11 +30,11 @@
#define KEY_VALUE_1 100
#define KEY_VALUE_2 200
-static pthread_key_t key;
-static void *rc1;
-static void *rc2;
+pthread_key_t key;
+void *rc1;
+void *rc2;
-static void *a_thread_func()
+void *a_thread_func()
{
/* Bind a value to key for this thread (this will be different from the value
* that we bind for the main thread) */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/10-1.c
index 3876f6616..bcd3057c2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/10-1.c
@@ -16,7 +16,7 @@
#include <stdio.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
sigset_t set1, set2;
int pthread_sigmask_return_val = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/12-1.c
index 0807479d5..aaed3a7be 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/12-1.c
@@ -27,7 +27,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
@@ -59,7 +59,7 @@ static int is_changed(sigset_t set, int sig)
return 0;
}
-static int get_rand()
+int get_rand()
{
int r;
@@ -70,7 +70,7 @@ static int get_rand()
return r;
}
-static void *a_thread_func()
+void *a_thread_func()
{
int r = get_rand();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/14-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/14-1.c
index e2b7bf152..d8c852183 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/14-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/14-1.c
@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void *a_thread_func()
+void *a_thread_func()
{
sigset_t actl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/16-1.c
index 9d57d031e..2c67cfc87 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/16-1.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static int get_rand()
+int get_rand()
{
int r;
@@ -31,7 +31,7 @@ static int get_rand()
return r;
}
-static void *a_thread_func()
+void *a_thread_func()
{
int r = get_rand();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c
index 81ba4ea9b..bfbdaf673 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c
@@ -75,15 +75,15 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static volatile char do_it = 1;
-static unsigned long count_ope = 0;
+char do_it = 1;
+unsigned long count_ope = 0;
#ifdef WITH_SYNCHRO
-static sem_t semsig1;
-static sem_t semsig2;
-static unsigned long count_sig = 0;
+sem_t semsig1;
+sem_t semsig2;
+unsigned long count_sig = 0;
#endif
-static sigset_t usersigs;
+sigset_t usersigs;
typedef struct {
int sig;
@@ -93,7 +93,7 @@ typedef struct {
} thestruct;
/* the following function keeps on sending the signal to the process */
-static void *sendsig(void *arg)
+void *sendsig(void *arg)
{
thestruct *thearg = (thestruct *) arg;
int ret;
@@ -132,7 +132,7 @@ static void *sendsig(void *arg)
/* Next are the signal handlers. */
/* This one is registered for signal SIGUSR1 */
-static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl1(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -143,7 +143,7 @@ static void sighdl1(int sig PTS_ATTRIBUTE_UNUSED)
}
/* This one is registered for signal SIGUSR2 */
-static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl2(int sig LTP_ATTRIBUTE_UNUSED)
{
#ifdef WITH_SYNCHRO
@@ -153,16 +153,16 @@ static void sighdl2(int sig PTS_ATTRIBUTE_UNUSED)
#endif
}
-static int init_ctl;
+int init_ctl;
/* Init function */
-static void initializer(void)
+void initializer(void)
{
init_ctl++;
return;
}
/* Test function -- calls pthread_sigmask() and checks that EINTR is never returned. */
-static void *test(void *arg PTS_ATTRIBUTE_UNUSED)
+void *test(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret = 0;
sigset_t set;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/4-1.c
index b02a1aef8..ca337583b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/4-1.c
@@ -34,12 +34,12 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
-static void *a_thread_func()
+void *a_thread_func()
{
struct sigaction act;
sigset_t blocked_set1, blocked_set2, pending_set;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/5-1.c
index 63f6721c8..66a91baba 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/5-1.c
@@ -36,12 +36,12 @@ that SIG_SETMASK removed the old signal from the set.
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
-static void *a_thread_func()
+void *a_thread_func()
{
struct sigaction act;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/6-1.c
index 3f8e706cb..d2eb1827a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/6-1.c
@@ -34,12 +34,12 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
-static void *a_thread_func()
+void *a_thread_func()
{
struct sigaction act;
sigset_t set1, set2, pending_set;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c
index aa9c6b96e..4753d6dbc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c
@@ -21,7 +21,7 @@ returned by the pthread_sigmask functions.
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static void *a_thread_func()
+void *a_thread_func()
{
sigset_t oactl, tempset;
int i, j, test_failed = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-1.c
index 6b4e99ef9..546c4afb6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-1.c
@@ -21,7 +21,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
@@ -53,7 +53,7 @@ static int is_changed(sigset_t set, int sig)
return 0;
}
-static void *a_thread_func()
+void *a_thread_func()
{
sigset_t actl, oactl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-2.c
index 2f7a664c1..56d7631fe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-2.c
@@ -23,7 +23,7 @@ At
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
@@ -55,7 +55,7 @@ static int is_changed(sigset_t set, int sig)
return 0;
}
-static void *a_thread_func()
+void *a_thread_func()
{
sigset_t actl, oactl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-3.c
index c83f04e15..3066c14c6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/8-3.c
@@ -21,7 +21,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
@@ -53,7 +53,7 @@ static int is_changed(sigset_t set, int sig)
return 0;
}
-static void *a_thread_func()
+void *a_thread_func()
{
sigset_t actl, oactl;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/9-1.c
index 1b9affc4f..b5ebd5f84 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/9-1.c
@@ -25,9 +25,9 @@
#include "posixtest.h"
static volatile int handler_called;
-static int pthread_sigmask_return_val = 1; /* some value that's not a 1 or 0 */
+int pthread_sigmask_return_val = 1; /* some value that's not a 1 or 0 */
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
if (pthread_sigmask_return_val != 1) {
@@ -37,7 +37,7 @@ static void handler(int signo PTS_ATTRIBUTE_UNUSED)
}
}
-static void *a_thread_func()
+void *a_thread_func()
{
struct sigaction act;
sigset_t blocked_set1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/1-1.c
index 1d7395b22..f9e7b2230 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/1-1.c
@@ -56,7 +56,7 @@ int main(void)
printf("main: destroy spin lock\n");
rc = pthread_spin_destroy(&spinlock);
if (rc != 0) {
- printf("Test FAILED: Error at pthread_spin_destroy(), "
+ printf("Test FAILED: Error at pthread_spin_destroy()"
"Return code : %d\n", rc);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/3-1.c
index b3fdf821f..d763567ae 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_destroy/3-1.c
@@ -31,7 +31,7 @@
static pthread_spinlock_t spinlock;
-static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_chld(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-1.c
index b7dd9e05e..2b83de558 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-1.c
@@ -32,7 +32,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct shmstruct {
+struct shmstruct {
pthread_spinlock_t spinlock;
int data;
} *spinlock_data;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-2.c
index f3cb9b2a3..a74287371 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/2-2.c
@@ -39,7 +39,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct shmstruct {
+struct shmstruct {
pthread_spinlock_t spinlock;
int data;
} *spinlock_data;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/4-1.c
index f454290c6..1a0108bb0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_init/4-1.c
@@ -33,7 +33,7 @@
static pthread_spinlock_t spinlock;
static int pshared;
-static void *fn_chld(void *arg PTS_ATTRIBUTE_UNUSED)
+static void *fn_chld(void *arg LTP_ATTRIBUTE_UNUSED)
{
int rc;
/* child: initialize a spin lock being locked by main thread */
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c
index 10c7961f2..6541051dd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c
@@ -142,7 +142,7 @@ int main(void)
/* Destroy the spinlock */
if (pthread_spin_destroy(&spinlock) != 0) {
- printf("Error at pthread_spin_destroy()\n");
+ printf("Error at pthread_spin_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/3-2.c
index 8de3b433d..113592e0f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/3-2.c
@@ -22,7 +22,7 @@
#include <string.h>
#include "posixtest.h"
-static int rc;
+int rc;
static void sig_handler()
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-1.c
index 44772d9a3..c20567840 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-1.c
@@ -118,7 +118,7 @@ int main(void)
}
if (pthread_spin_destroy(&spinlock) != 0) {
- printf("Error at pthread_spin_destroy()\n");
+ printf("Error at pthread_spin_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-2.c
index 43f75e45e..5f714127a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/1-2.c
@@ -137,7 +137,7 @@ int main(void)
}
if (pthread_spin_destroy(&spinlock) != 0) {
- printf("Error at pthread_spin_destroy()\n");
+ printf("Error at pthread_spin_destroy()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/3-1.c
index 0a52cd8f4..409da6368 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_unlock/3-1.c
@@ -66,7 +66,7 @@ static void *fn_chld(void *arg)
pthread_spin_unlock(&spinlock);
if (pthread_spin_destroy(&spinlock) != 0) {
- printf("Error at pthread_spin_destroy()\n");
+ printf("Error at pthread_spin_destroy()");
exit(PTS_UNRESOLVED);
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/1-1.c
index 196c84044..654b054df 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/1-1.c
@@ -38,20 +38,20 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
+int sem1; /* Manual semaphore */
+int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* Mutex */
/* Cleanup function that the thread executes when it is canceled. So if
* cleanup_flag is 1, it means that the thread was canceled. */
-static void a_cleanup_func()
+void a_cleanup_func()
{
cleanup_flag = -1;
return;
}
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/2-1.c
index d63af5bf1..e02b79553 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_testcancel/2-1.c
@@ -27,11 +27,11 @@
#define INTHREAD 0 /* Control going to or is already for Thread */
#define INMAIN 1 /* Control going to or is already for Main */
-static int sem1; /* Manual semaphore */
-static int cancel_flag;
+int sem1; /* Manual semaphore */
+int cancel_flag;
/* Function that the thread executes upon its creation */
-static void *a_thread_func()
+void *a_thread_func()
{
/* Set cancel state to DISABLE, meaning it shouldn't honor any cancel requests. */
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/raise/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/raise/1-1.c
index eae549ee6..1ebd8bba8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/raise/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/raise/1-1.c
@@ -22,7 +22,7 @@
#define SIGTOTEST SIGABRT
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal being tested!\n");
printf("Test PASSED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/raise/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/raise/1-2.c
index 474e85a11..61eb0cc1d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/raise/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/raise/1-2.c
@@ -32,13 +32,13 @@
#define SIGTOTEST SIGABRT
-static void parenthandler(int signo PTS_ATTRIBUTE_UNUSED)
+void parenthandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal from parent!\n");
exit(-1);
}
-static void childhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void childhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal from child!\n");
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/raise/10000-1.c b/testcases/open_posix_testsuite/conformance/interfaces/raise/10000-1.c
index c41c89fb1..6938784e8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/raise/10000-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/raise/10000-1.c
@@ -51,7 +51,7 @@ static int invalid_tests[NUMINVALIDTESTS] = {
INT32_MIN, INT32_MAX, 2147483647, -2147483647, -1073743192, 1073743192
};
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal being tested!\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/raise/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/raise/2-1.c
index 1dfee2efe..7cf805c18 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/raise/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/raise/2-1.c
@@ -32,9 +32,9 @@
#define BEFOREHANDLER 1
#define INHANDLER 2
#define LEAVINGHANDLER 3
-static int globalStatus = BEFOREHANDLER;
+int globalStatus = BEFOREHANDLER;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
globalStatus = INHANDLER;
printf("Caught signal being tested!\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/raise/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/raise/4-1.c
index 1a6ebb23e..dcecede5b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/raise/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/raise/4-1.c
@@ -27,7 +27,7 @@
#define SIGTOTEST SIGABRT
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal being tested!\n");
printf("Test PASSED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/6-1.c
index 9bd01a66a..7c3c4bc40 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/6-1.c
@@ -29,7 +29,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/3-1.c
index a5bd452fd..be283980d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/3-1.c
@@ -16,7 +16,7 @@
#include <errno.h>
#include "posixtest.h"
-static struct unique {
+struct unique {
int value;
char *name;
} sym[] = {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/7-1.c
index 7d0e500ea..3b1e2050e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/7-1.c
@@ -21,7 +21,7 @@
#include "posixtest.h"
/* Set the euid of this process to a non-root uid */
-static int set_nonroot(void)
+int set_nonroot(void)
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c
index 954179201..f7cfc9e66 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void child_proc()
+void child_proc()
{
sigset_t signalset;
int sig;
@@ -106,7 +106,7 @@ int main(void)
result = sched_setparam(child_pid, &param);
if (result == 0 && param.sched_priority == new_priority) {
- printf("Test PASSED\n");
+ printf("Test PASSED");
kill(child_pid, SIGUSR1);
return PTS_PASS;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c
index 889ff1767..54a2deee6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c
@@ -48,11 +48,11 @@
#define STDOUT 1
#define STDERR 2
-static int nb_child; /* Number of child processes == number of CPUs */
-static int count = 0;
-static int the_pipe[2];
+int nb_child; /* Number of child processes == number of CPUs */
+int count = 0;
+int the_pipe[2];
-static void child_process(int id)
+void child_process(int id)
{
int i;
struct sched_param param;
@@ -67,7 +67,7 @@ static void child_process(int id)
}
}
-static void sigterm_handler(int signum PTS_ATTRIBUTE_UNUSED)
+void sigterm_handler(int signum LTP_ATTRIBUTE_UNUSED)
{
close(STDOUT);
close(the_pipe[0]);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c
index 1456b9731..9c21c0280 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c
@@ -49,11 +49,11 @@
#define STDOUT 1
#define STDERR 2
-static int nb_child; /* Number of child processes == number of CPUs */
-static int count = 0;
-static int the_pipe[2];
+int nb_child; /* Number of child processes == number of CPUs */
+int count = 0;
+int the_pipe[2];
-static void child_process(int id)
+void child_process(int id)
{
int i;
struct sched_param param;
@@ -68,7 +68,7 @@ static void child_process(int id)
}
}
-static void sigterm_handler(int signum PTS_ATTRIBUTE_UNUSED)
+void sigterm_handler(int signum LTP_ATTRIBUTE_UNUSED)
{
close(STDOUT);
close(the_pipe[0]);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/20-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/20-1.c
index d323c1ff9..821afeee5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/20-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/20-1.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg PTS_ATTRIBUTE_UNUSED)
+void *runner(void *arg LTP_ATTRIBUTE_UNUSED)
{
while (1)
@@ -46,7 +46,7 @@ int main(void)
sched_get_priority_min(policy) : max_priority;
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -54,11 +54,11 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
@@ -69,7 +69,7 @@ int main(void)
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-1.c
index b03526e50..7382b4945 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-1.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg PTS_ATTRIBUTE_UNUSED)
+void *runner(void *arg LTP_ATTRIBUTE_UNUSED)
{
while (1)
@@ -50,7 +50,7 @@ int main(void)
}
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -58,16 +58,16 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-2.c
index afe03e9ae..d6e1c2ae7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-2.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg PTS_ATTRIBUTE_UNUSED)
+void *runner(void *arg LTP_ATTRIBUTE_UNUSED)
{
while (1)
@@ -50,7 +50,7 @@ int main(void)
}
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -58,16 +58,16 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-6.c
index 5e1964956..50f87e867 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-6.c
@@ -22,7 +22,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/26-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/26-1.c
index 93b784480..d62ecc081 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/26-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/26-1.c
@@ -21,7 +21,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/1-1.c
index 515f6e5f5..04234dd44 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/1-1.c
@@ -22,7 +22,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct unique {
+struct unique {
int value;
char *name;
} sym[] = {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-1.c
index a7324e8db..56ef0c628 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-1.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg)
+void *runner(void *arg)
{
(void) arg;
@@ -40,7 +40,7 @@ int main(void)
SCHED_RR : SCHED_FIFO;
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -48,11 +48,11 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
@@ -68,7 +68,7 @@ int main(void)
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-2.c
index 5fa6f7099..316dcab91 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-2.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg)
+void *runner(void *arg)
{
(void) arg;
@@ -46,7 +46,7 @@ int main(void)
sched_get_priority_min(SCHED_FIFO) : max_priority;
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -54,11 +54,11 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
@@ -74,7 +74,7 @@ int main(void)
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-1.c
index f0d49aeb6..99cc96a07 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-1.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct unique {
+struct unique {
int value;
char *name;
} sym[] = {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-6.c
index 04b9d03f3..b0698e626 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-6.c
@@ -29,7 +29,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-1.c
index f4043c91a..5f2a54331 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-1.c
@@ -20,7 +20,7 @@
#include <unistd.h>
#include "posixtest.h"
-static struct unique {
+struct unique {
int value;
char *name;
} sym[] = {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/20-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/20-1.c
index 0cc8591b2..34d30782b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/20-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/20-1.c
@@ -27,7 +27,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-1.c
index 7eb3109d7..791ec6915 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-1.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg)
+void *runner(void *arg)
{
(void) arg;
@@ -56,7 +56,7 @@ int main(void)
}
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -64,16 +64,16 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-2.c
index 83c8c599c..5e3c502de 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-2.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include "posixtest.h"
-static void *runner(void *arg)
+void *runner(void *arg)
{
(void) arg;
@@ -55,7 +55,7 @@ int main(void)
}
if (pthread_attr_init(&attr) != 0) {
- printf("An error occurs when calling pthread_attr_init()\n");
+ printf("An error occurs when calling pthread_attr_init()");
return PTS_UNRESOLVED;
}
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS);
@@ -63,16 +63,16 @@ int main(void)
printf("Process contention scope threads are not supported.\n");
return PTS_UNSUPPORTED;
} else if (result != 0) {
- printf("An error occurs when calling pthread_attr_setscope()\n");
+ printf("An error occurs when calling pthread_attr_setscope()");
return PTS_UNRESOLVED;
}
if (pthread_create(&tid, &attr, runner, NULL) != 0) {
- printf("An error occurs when calling pthread_create()\n");
+ printf("An error occurs when calling pthread_create()");
return PTS_UNRESOLVED;
}
if (pthread_getschedparam(tid, &policy, &param) != 0) {
- printf("An error occurs when calling pthread_getschedparam()\n");
+ printf("An error occurs when calling pthread_getschedparam()");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_destroy/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_destroy/3-1.c
index 2a02a7532..f0b96b0bb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_destroy/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_destroy/3-1.c
@@ -25,14 +25,14 @@
#define FUNCTION "sem_destroy"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static sem_t psem, csem;
-static int n;
-static void *producer(void *);
-static void *consumer(void *);
+sem_t psem, csem;
+int n;
int main(void)
{
pthread_t prod, cons;
+ void *producer(void *);
+ void *consumer(void *);
long cnt = 3;
n = 0;
@@ -65,7 +65,7 @@ int main(void)
}
}
-static void *producer(void *arg)
+void *producer(void *arg)
{
int i, cnt;
cnt = (long)arg;
@@ -77,7 +77,7 @@ static void *producer(void *arg)
return NULL;
}
-static void *consumer(void *arg)
+void *consumer(void *arg)
{
int i, cnt;
cnt = (long)arg;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_getvalue/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_getvalue/2-2.c
index 9d1d54386..7c9f547ac 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_getvalue/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_getvalue/2-2.c
@@ -77,7 +77,7 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-1.c
index d3d8b6261..1392bc650 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-1.c
@@ -25,35 +25,14 @@
#define FUNCTION "sem_init"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
-static sem_t psem, csem;
-static int n;
-
-static void *producer(void *arg)
-{
- int i, cnt;
- cnt = (long)arg;
- for (i = 0; i < cnt; i++) {
- sem_wait(&psem);
- n++;
- sem_post(&csem);
- }
- return NULL;
-}
-
-static void *consumer(void *arg)
-{
- int i, cnt;
- cnt = (long)arg;
- for (i = 0; i < cnt; i++) {
- sem_wait(&csem);
- sem_post(&psem);
- }
- return NULL;
-}
+sem_t psem, csem;
+int n;
int main(void)
{
pthread_t prod, cons;
+ void *producer(void *);
+ void *consumer(void *);
long cnt = 3;
n = 0;
@@ -85,3 +64,26 @@ int main(void)
return PTS_FAIL;
}
}
+
+void *producer(void *arg)
+{
+ int i, cnt;
+ cnt = (long)arg;
+ for (i = 0; i < cnt; i++) {
+ sem_wait(&psem);
+ n++;
+ sem_post(&csem);
+ }
+ return NULL;
+}
+
+void *consumer(void *arg)
+{
+ int i, cnt;
+ cnt = (long)arg;
+ for (i = 0; i < cnt; i++) {
+ sem_wait(&csem);
+ sem_post(&psem);
+ }
+ return NULL;
+}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_open/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_open/3-1.c
index ae1aa6b62..0fec4ec04 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_open/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_open/3-1.c
@@ -28,7 +28,7 @@
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/5-1.c
index d83f9c9b2..f20dfdc70 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/5-1.c
@@ -33,9 +33,9 @@
#define SEMINITVAL 0 //initial value of semaphore = 0
-static sem_t *gsemp;
+sem_t *gsemp;
-static void sighdl(int sig PTS_ATTRIBUTE_UNUSED)
+void sighdl(int sig LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/6-1.c
index 009e8ba43..8769ebd59 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/6-1.c
@@ -32,9 +32,9 @@
#define SEMINITVAL 0 //initial value of semaphore = 0
-static sem_t *gsemp;
+sem_t *gsemp;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
if (sem_post(gsemp) == -1) {
perror(ERROR_PREFIX "sem_post");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
index 40579776e..c18e1b20f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c
@@ -51,7 +51,7 @@
static char semname[28];
static char semname_1[28]; /* Used to record state */
-static int set_my_prio(int priority)
+int set_my_prio(int priority)
{
struct sched_param sp;
sp.sched_priority = priority;
@@ -64,7 +64,7 @@ static int set_my_prio(int priority)
return 0;
}
-static int get_my_prio(void)
+int get_my_prio(void)
{
struct sched_param sp;
@@ -76,7 +76,7 @@ static int get_my_prio(void)
return sp.sched_priority;
}
-static int child_fn(int priority, int id)
+int child_fn(int priority, int id)
{
sem_t *sem, *sem_1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/3-1.c
index fb6f2e6cb..dd42bbd91 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/3-1.c
@@ -20,6 +20,7 @@
#endif
#include <semaphore.h>
#include <stdio.h>
+#include <strings.h>
#include <time.h>
#include <unistd.h>
#include "posixtest.h"
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-2.c
index 1ad0fad33..f957191bf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-2.c
@@ -22,7 +22,7 @@
#include <time.h>
#include "posixtest.h"
-#define TEST "6-2"
+#define TEST "5-1"
#define FUNCTION "sem_timedwait"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/7-1.c
index 73e174682..79de0af7f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/7-1.c
@@ -21,6 +21,7 @@
#endif
#include <semaphore.h>
#include <stdio.h>
+#include <strings.h>
#include <time.h>
#include <unistd.h>
#include "posixtest.h"
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/9-1.c
index f9175839d..83d760de3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/9-1.c
@@ -29,7 +29,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("In handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/2-2.c
index 1e9096b23..fbc585aa8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/2-2.c
@@ -76,14 +76,14 @@
#define VERBOSE 1
#endif
-#define SEM_NAME "/sem_unlink_2_2"
+#define SEM_NAME "/sem_unlink_9_1"
/******************************************************************************/
/*************************** Test case ***********************************/
/******************************************************************************/
/* Operations common to all processes on the semaphore*/
-static sem_t *common()
+sem_t *common()
{
int ret;
sem_t *sem;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/3-1.c
index 8919d82f5..036da6a15 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/3-1.c
@@ -89,7 +89,7 @@
/* Set the euid of this process to a non-root uid */
/* (from ../sem_open/3-1.c) */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/5-1.c
index 47567ddd8..e1e1597d3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/5-1.c
@@ -81,14 +81,6 @@
#define SEM_NAME "/sem_unlink_5_1"
-#ifdef PATH_MAX
-#undef PATH_MAX
-#endif
-
-#ifdef NAME_MAX
-#undef NAME_MAX
-#endif
-
/******************************************************************************/
/*************************** Test case ***********************************/
/******************************************************************************/
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/7-1.c
index 22118c3fd..3515c1669 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/7-1.c
@@ -79,7 +79,7 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/9-1.c
index 24a575ff9..55dfb1428 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/9-1.c
@@ -82,9 +82,9 @@
/******************************************************************************/
/*************************** Test case ***********************************/
/******************************************************************************/
-static int volatile thread_state = 0;
+int thread_state = 0;
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
thread_state = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/1-2.c
index bbfe45250..ad2e47519 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/1-2.c
@@ -20,7 +20,7 @@
#include <signal.h>
#include "posixtest.h"
-#define TEST "1-2"
+#define TEST "2-1"
#define FUNCTION "sem_wait"
#define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/13-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/13-1.c
index 998100f80..42cec356d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/13-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/13-1.c
@@ -51,7 +51,7 @@
static sem_t sem;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+static void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
ret = sem_post(&sem);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/7-1.c
index 744667055..e10f69bae 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_wait/7-1.c
@@ -27,7 +27,7 @@
#define CHILDPASS 1
#define CHILDFAIL 0
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("In handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/23-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/23-1.c
index 84da8c214..81ce258c6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/23-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/23-1.c
@@ -44,11 +44,11 @@
#define NPROCESS 1000 /* Number of concurrent processes */
#define NLOOP 1000 /* Number of shared memory object */
-static char name[NAME_SIZE];
-static int *create_cnt;
-static sem_t *sem;
+char name[NAME_SIZE];
+int *create_cnt;
+sem_t *sem;
-static int child_func(void)
+int child_func(void)
{
int i, fd;
struct timespec ts = {.tv_sec = 0,.tv_nsec = 0 };
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/32-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/32-1.c
index 0c3ecacb6..58e4f13c7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/32-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/32-1.c
@@ -28,7 +28,7 @@
#define SHM_NAME "posixtest_32-1"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/34-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/34-1.c
index efe31c973..394fcf969 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/34-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/34-1.c
@@ -28,7 +28,7 @@
#define SHM_NAME "posixtest_34-1"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/37-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/37-1.c
index 09b4d6657..9bb0adcdc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/37-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/37-1.c
@@ -1,65 +1,65 @@
-// SPDX-License-Identifier: GPL-2.0
/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
* Test that the shm_open() function sets errno = EINVAL if the shm_open()
* operation is not supported for the given name.
*
* The supported names are implementation-defined, so the test is done for
- * several different names. The test pass for a given name if shm_open make no
+ * several differents names. The test pass for a given name if shm_open make no
* error or set errno to EINVAL.
*/
#include <stdio.h>
-#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "posixtest.h"
-struct test_data {
- const char *desc;
- const char *name;
-};
-
-struct test_data testdata[] = {
- {
- "char which are in portable character set, "
- "but not in portable filename character set",
- "$#\n@\t\a,~}"
- },
- {
- "chars which are not in portable character set "
- "(accentuated char and c cedilla)",
- "\xe9\xea\xee\xf4\xe7\xe0"
- },
- { "parent directory", ".." },
- { "root directory", "/" },
- { "double slash", "//" },
- { "non-existent directory", "/abc" }
+char *shm_name[] = {
+ /* char which are in portable character set but not in portable
+ filename character set */
+ "$#\n@\t\a,~}",
+ /* char which are not in portable character set (accentuated char and c
+ cedilla) */
+ "éêîôçà",
+ /* some file or directory which should exist */
+ "..",
+ "/",
+ "//",
+ "/abc",
+ NULL
};
int main(void)
{
- unsigned int i;
- int fd, result = PTS_PASS;
+ int fd, i = 0, result = PTS_PASS;
- for (i = 0; i < ARRAY_SIZE(testdata); i++) {
+ while (shm_name[i]) {
fflush(stderr);
- printf("Test: %s\n", testdata[i].desc);
+ printf("Name: '%s'\n", shm_name[i]);
fflush(stdout);
- fd = shm_open(testdata[i].name, O_RDWR | O_CREAT, 0);
+ fd = shm_open(shm_name[i], O_RDWR | O_CREAT, 0);
+
if (fd == -1 && errno == EINVAL) {
printf(" OK: errno == EINVAL\n");
} else if (fd != -1) {
- printf(" OK: open with success.\n");
- close(fd);
+ printf(" OK: open with success.\n");
} else {
perror(" Unexpected error");
result = PTS_FAIL;
}
- shm_unlink(testdata[i].name);
+ shm_unlink(shm_name[i]);
+
+ i++;
}
if (result == PTS_PASS)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/5-1.c
index 940812016..7e23e36eb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/shm_open/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_open/5-1.c
@@ -37,9 +37,9 @@
#define BUF_SIZE 8
#define SHM_NAME "/posixtest_5-1"
-static char str[BUF_SIZE] = "qwerty";
+char str[BUF_SIZE] = "qwerty";
-static int child_process()
+int child_process()
{
int fd;
char *buf;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/11-1.c
index 6d0ff515b..1d92e44f4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/11-1.c
@@ -35,7 +35,7 @@ int main(void)
return PTS_UNRESOLVED;
}
- printf("shm_unlink() success.\n");
+ printf("shm_unlink() success.");
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-1.c
index 2e77bd127..bd1dc69b9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-1.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-10.c
index 31c6e38ef..aee661482 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-10.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-11.c
index 299821a9e..0a03e4b41 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-11.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-12.c
index 73d763393..f4db16f14 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-12.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-13.c
index dab4b280f..97b06777e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-13.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-14.c
index 88f7ff642..c7a53ac50 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-14.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-15.c
index bc6c7c7ee..70e2b1fb6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-15.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-16.c
index 42daccd25..dddecb0c4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-16.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-17.c
index 14803fd06..5946e25e9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-17.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-18.c
index 79a955605..1f19c1049 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-18.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-19.c
index 542640315..13f161c18 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-19.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-2.c
index 79a955605..1f19c1049 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-2.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-20.c
index 0a38ce4f6..dead6c574 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-20.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-21.c
index cb7957d4f..625cb7a0e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-21.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-22.c
index d252300c0..763a5d056 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-22.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-23.c
index 06163a609..9e28ff120 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-23.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-24.c
index 12efdbf58..75d127f31 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-24.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-25.c
index 80ff5f053..04098e7f4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-25.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-26.c
index d52da61e8..49c0a8351 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-26.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-3.c
index 43d02fea4..085fa1a38 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-3.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-4.c
index a5876a562..236312712 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-4.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-5.c
index 2640b0750..db177e5ee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-5.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-6.c
index 3e45abc49..a0936a5c2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-6.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-7.c
index f5d465c36..2e89bee96 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-7.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-8.c
index 3ea22e0ea..d720d73a0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-8.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-9.c
index 361a44f80..0eb081bc4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/1-9.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/10-1.c
index 02150a150..3675917ef 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/10-1.c
@@ -23,8 +23,8 @@ static volatile int child_stopped;
static volatile int child_continued;
static volatile int notification;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED, siginfo_t *info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
if (!info)
return;
@@ -43,7 +43,7 @@ static void handler(int signo PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
}
}
-static void wait_for_notification(int val)
+void wait_for_notification(int val)
{
struct timeval tv;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/11-1.c
index 41db84865..af0f5075d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/11-1.c
@@ -30,8 +30,8 @@
static volatile int child_continued;
static volatile int waiting = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED, siginfo_t *info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
if (info && info->si_code == CLD_CONTINUED) {
printf("Child has been stopped\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-1.c
index 207e41f71..0d62ad263 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-1.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-10.c
index 6f8d30a3b..c135456ff 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-10.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-11.c
index 8967b032b..505a5e36f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-11.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-12.c
index a3cef8e26..9be6b14f3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-12.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-13.c
index 6e1bc43fc..ac140bc21 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-13.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-14.c
index efb6a8aaa..1ddac1b06 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-14.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-15.c
index 4b196a6ee..33f14bb88 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-15.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-16.c
index f38bf17e2..94231af29 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-16.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-17.c
index 0c2662aa2..a2bcc0fab 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-17.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-18.c
index 07b193fd8..6172c8748 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-18.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-19.c
index 07b193fd8..6172c8748 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-19.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-2.c
index 07b193fd8..6172c8748 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-2.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-20.c
index 507fa068e..f6965e2c0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-20.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-21.c
index e83a50577..54b62300d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-21.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-22.c
index e65cbece4..701e9da84 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-22.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-23.c
index 7c1780703..c0f21d982 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-23.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-24.c
index 544890a55..193c5f831 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-24.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-25.c
index 490a37f3d..c4e8f5f0e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-25.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-26.c
index fcd017711..64ba65c3d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-26.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-27.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-27.c
index 2820e8ad0..1be2d6ee3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-27.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-27.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-28.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-28.c
index 48067add8..2b81c380b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-28.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-28.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-29.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-29.c
index 603f52656..c0f2bdedc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-29.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-29.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-3.c
index 2de66a68b..a97e0ab0c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-3.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-30.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-30.c
index 284ca8c25..f0bbc13d7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-30.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-30.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-31.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-31.c
index 515d11801..f7533c242 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-31.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-31.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-32.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-32.c
index 222aaedbd..376bbcc6b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-32.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-32.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-33.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-33.c
index 24cb0150f..125136d70 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-33.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-33.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-34.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-34.c
index 658041327..d1a4372ed 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-34.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-34.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-35.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-35.c
index 9d5d71b8d..13bb741e3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-35.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-35.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-36.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-36.c
index a8db824a9..9347a9c34 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-36.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-36.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-37.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-37.c
index 80836bd17..b3a68f977 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-37.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-37.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-38.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-38.c
index 80cafc6c2..19daef0de 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-38.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-38.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-39.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-39.c
index d329344e7..acb47eeda 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-39.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-39.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-4.c
index 292f24aa8..29b19381c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-4.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-40.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-40.c
index 745ee813d..ac95a3eb0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-40.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-40.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-41.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-41.c
index 036a034e8..ad944574e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-41.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-41.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-42.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-42.c
index 07d443771..42913bad3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-42.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-42.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-43.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-43.c
index 33a52bdc9..2102f68f6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-43.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-43.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-44.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-44.c
index 48067add8..2b81c380b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-44.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-44.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-45.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-45.c
index 48067add8..2b81c380b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-45.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-45.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-46.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-46.c
index 69b4432a9..fed1534e1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-46.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-46.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-47.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-47.c
index ebff7d171..c7fdf3991 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-47.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-47.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-48.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-48.c
index 50a74ae06..ca460a9ce 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-48.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-48.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-49.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-49.c
index 6ce3fb6b6..689709b29 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-49.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-49.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-5.c
index f5870180c..d7d944271 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-5.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-50.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-50.c
index f48d7c35f..b25289fe8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-50.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-50.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-51.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-51.c
index 73e675467..bbfdadbd9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-51.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-51.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-52.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-52.c
index ff4a8e7d5..8dc293561 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-52.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-52.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-6.c
index 4ad282966..b06f52e38 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-6.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-7.c
index 9f7657380..58abfdbe1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-7.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-8.c
index 295548523..c04fdea63 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-8.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-9.c
index beb0f2e26..d2f2307e3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/12-9.c
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-1.c
index 69d123619..4c9d104ea 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-1.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-10.c
index 85932092a..559dae90d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-10.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-11.c
index ea3e41e00..1918a38f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-11.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-12.c
index 5df208ce6..d0adb5cca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-12.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-13.c
index d4044d9c6..cc022ae42 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-13.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-14.c
index 01758234c..4790df548 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-14.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-15.c
index a4dedd19f..ccb7f9bb7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-15.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-16.c
index 152a5f8e8..4eea7ad08 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-16.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-17.c
index 9bddb4120..95999c942 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-17.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-18.c
index 9ce3e5af5..47f5aa643 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-18.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-19.c
index 9ce3e5af5..47f5aa643 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-19.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-2.c
index 9ce3e5af5..47f5aa643 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-2.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-20.c
index 4270861ec..f752e1013 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-20.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-21.c
index 42c19d27f..a15f7f7dc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-21.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-22.c
index 34b7912b9..95cb28f97 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-22.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-23.c
index 6d29caf14..67c3c76a9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-23.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-24.c
index 55651486c..5696e9a27 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-24.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-25.c
index c606099e3..569f991b2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-25.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-26.c
index eb9e26ebf..67d4e7a7f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-26.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-3.c
index 00bca9005..e5bae0415 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-3.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-4.c
index 549665c71..bf045227f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-4.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-5.c
index 527596025..c2db08fb5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-5.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-6.c
index 833f5915a..ce659a85e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-6.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-7.c
index 73cb94648..c8aa30cd7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-7.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-8.c
index 7d1784818..12921850c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-8.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-9.c
index 75dadd75a..b0ffb4363 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/13-9.c
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
index bae8637cc..74e58d4f3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c
@@ -85,7 +85,7 @@ static volatile int ready;
static sem_t sem;
/* Lookup */
-static struct sig_info *lookup(int signo)
+struct sig_info *lookup(int signo)
{
struct sig_info *s = &sigs[0];
@@ -98,7 +98,7 @@ static struct sig_info *lookup(int signo)
}
/* Handler function */
-static void handler(int signo)
+void handler(int signo)
{
struct sig_info *s;
@@ -108,7 +108,7 @@ static void handler(int signo)
}
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int rc;
int status = PTS_PASS;
@@ -143,7 +143,7 @@ static void *threaded(void *arg)
return (void *)((long)status);
}
-static int test_sig(struct sig_info *s)
+int test_sig(struct sig_info *s)
{
int rc;
int status = PTS_UNRESOLVED;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-1.c
index bb5d60584..608935524 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-1.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGABRT\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-10.c
index 68b21e92f..ee37e4022 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-10.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGPIPE\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-11.c
index 5c3584e7e..a5b84b270 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-11.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGQUIT\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-12.c
index cf9b45609..bd5863154 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-12.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGSEGV\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-13.c
index 36d1da95d..d18cda791 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-13.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTERM\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-14.c
index 46e88137f..0076712ee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-14.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTSTP\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-15.c
index c7a531d0f..769eb91c4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-15.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTTIN\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-16.c
index ff7583645..27bfe7ca3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-16.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTTOU\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-17.c
index 208dc8ed7..6f4f010d8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-17.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGUSR1\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-18.c
index 4e2ec064f..67a773b1a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-18.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGUSR2\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-19.c
index baede765c..ddfcc5a46 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-19.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
wakeup++;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-2.c
index 5f4c10503..1b511cb18 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-2.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGALRM\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-20.c
index a90627802..791e00542 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-20.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGPROF\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-21.c
index 4cf3b2d88..649714814 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-21.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGSYS\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-22.c
index 13adff8e0..12560807c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-22.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTRAP\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-23.c
index 8569ba58e..5e12bf8c6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-23.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGURG\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-24.c
index 2969f11ad..fb5f84c39 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-24.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGVTALRM\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-25.c
index 16fa963d0..90ec46cc4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-25.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGXCPU\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-26.c
index 4285781bc..6e1be65a4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-26.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGXFSZ\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-3.c
index 0dffc9f28..545fdbc6e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-3.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGBUS\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-4.c
index 8158a700a..725b2a4bd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-4.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGCHLD\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-5.c
index 39df520ac..034a4d15b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-5.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGCONT\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-6.c
index 96d4901b9..1f4442573 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-6.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGFPE\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-7.c
index 1ba685231..36da244b7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-7.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGHUP\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-8.c
index 4911c4f4c..2406274d8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-8.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGILL\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-9.c
index a1391e4eb..29502ebf6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/17-9.c
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGINT\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-1.c
index 2421a8e20..c40a81ac6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-1.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-10.c
index fdad7cd38..a17882aca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-10.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-11.c
index e3cf6a91b..5d1a1b625 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-11.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-12.c
index c2458191d..f50cad424 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-12.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-13.c
index 80915af32..5e8326c33 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-13.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-14.c
index 59ed6c252..1fa69b48f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-14.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-15.c
index 581058985..c918e3cd3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-15.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-16.c
index b5e2e0bcd..cfb077e0d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-16.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-17.c
index df8bd4967..454c9039e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-17.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-18.c
index 117efcd61..75484cfe8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-18.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-19.c
index 3565a97b6..afde4761f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-19.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-2.c
index 3565a97b6..afde4761f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-2.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-20.c
index eaa6da11a..6fb538ff9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-20.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-21.c
index bc48f9806..7c4ca1196 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-21.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-22.c
index f947ee5eb..f604eee1d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-22.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-23.c
index 178bfb422..552924c8a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-23.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-24.c
index 64e9d957c..d953a4d74 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-24.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-25.c
index 3b39e342e..8b1ff1b4f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-25.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-26.c
index c570d6e08..92c1c2fda 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-26.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-3.c
index 18a159656..77891de0c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-3.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-4.c
index 9fdeca2e4..a92d2ba02 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-4.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-5.c
index 01119afce..93ad40778 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-5.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-6.c
index 54d9a4583..e91227814 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-6.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-7.c
index 1122cc81d..dc3ec2f40 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-7.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-8.c
index 11ad5a3d0..db3717231 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-8.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-9.c
index 582dde8d2..d9c98e251 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/2-9.c
@@ -21,11 +21,11 @@
#include <stdio.h>
#include "posixtest.h"
-static void handler1(int signo PTS_ATTRIBUTE_UNUSED)
+void handler1(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static void handler2(int signo PTS_ATTRIBUTE_UNUSED)
+void handler2(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/21-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/21-1.c
index ec7803cb0..351e3cbaf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/21-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/21-1.c
@@ -13,7 +13,7 @@
#include <errno.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGCHLD\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-1.c
index 01b85efb7..c09fb656f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-1.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-10.c
index 4d8c9c09c..e1e5b20dc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-10.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-11.c
index 1390779f2..de8961a21 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-11.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-12.c
index 79d61572e..bed8b6eec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-12.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-13.c
index 174775e9b..2c3d771a2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-13.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-14.c
index ec6f83611..c6f90141c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-14.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-15.c
index a524f8a96..d582637be 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-15.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-16.c
index 810ac6880..7ce29c068 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-16.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-17.c
index 38019e9ad..87f501108 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-17.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-18.c
index 283e7cd83..d64308138 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-18.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-19.c
index 283e7cd83..d64308138 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-19.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-2.c
index 283e7cd83..d64308138 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-2.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-20.c
index d465bc064..9df7e2c3b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-20.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-21.c
index 7d128cb22..34624205d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-21.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-22.c
index 2c0d4c249..e4f9419a4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-22.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-23.c
index c13b5fa35..c31d9d07a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-23.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-24.c
index 1b1906130..eb6cb9d71 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-24.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-25.c
index 17ececc21..70cf2aa98 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-25.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-26.c
index 709ebe164..f56ed879d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-26.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-3.c
index e85f47638..5af45aecd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-3.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-4.c
index ec2837070..8cd4e965f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-4.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-5.c
index 5942430d6..f9c3f24c5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-5.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-6.c
index a5118f4db..01afca2e9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-6.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-7.c
index bc27c272c..5abcaa7cc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-7.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-8.c
index 4fb388bd5..3a70b1e7c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-8.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-9.c
index 2edaa6e14..338bac493 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/22-9.c
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-1.c
index d1a11ffe6..d85194ffb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-1.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-10.c
index ae3c43738..105f2a791 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-10.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-11.c
index eb4349c0c..66673b1a6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-11.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-12.c
index ff045cc92..b9aa54503 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-12.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-13.c
index 5a8a33daa..19fbec116 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-13.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-14.c
index 23e9a1cc0..bbd8e7de7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-14.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-15.c
index 3eb7d768e..e3de35715 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-15.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-16.c
index 1df6d0dd5..7c4671e68 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-16.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-17.c
index 366a00a5b..9ce9c6573 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-17.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-18.c
index c10f4bd60..af6378660 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-18.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-19.c
index e0bf1c50d..e325ceac7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-19.c
@@ -70,9 +70,9 @@
#define SIGNAL SIGALRM
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-2.c
index 966945fa4..baa881366 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-2.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-20.c
index ac6329479..e2af39047 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-20.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-21.c
index abc2bd39a..30f6ba2ad 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-21.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-22.c
index 541fd7034..327d3fb20 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-22.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-23.c
index 6abf0d6bf..976147bc5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-23.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-24.c
index 10edaab39..d530f0c20 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-24.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-25.c
index 303e3bdeb..ef0a6a9c5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-25.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-26.c
index bcae46282..1c298c9bc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-26.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-3.c
index fbab86dfb..de9595b31 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-3.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-4.c
index fbc8fc1db..43de3e27c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-4.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-5.c
index 4f4015d9c..38cdaabc1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-5.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-6.c
index ead73d7a0..7b46479ee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-6.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-7.c
index d2e1b478d..cbbf66703 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-7.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-8.c
index ba284a70f..e173a7d6f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-8.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-9.c
index 339941796..6cdd9f67b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/23-9.c
@@ -78,9 +78,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED)
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-1.c
index ce52d7e17..d8bbf1b8e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-1.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-10.c
index a9e056433..15a2ddfc2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-10.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-11.c
index 757a2f2d5..b48fd8a69 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-11.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-12.c
index 41dabf7e3..c3ffb940b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-12.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-13.c
index 6e69d986c..61d672368 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-13.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-14.c
index ff0b05f81..1f607eafe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-14.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-15.c
index ad2e6aa42..b94bb9e07 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-15.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-16.c
index 003612c9b..d740ea5c7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-16.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-17.c
index 768ba5299..0652927ed 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-17.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-18.c
index bf41e8daa..5e2befa9a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-18.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-19.c
index bf41e8daa..5e2befa9a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-19.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-2.c
index bf41e8daa..5e2befa9a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-2.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-20.c
index 98fef5f0f..8ab9fb8c2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-20.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-21.c
index 70d5e95cf..378b3adbb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-21.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-22.c
index 6ced35c5e..dd3a5df49 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-22.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-23.c
index 201e41570..0e2b7d14f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-23.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-24.c
index 0ca43c2cc..21ce6b963 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-24.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-25.c
index 49990d65f..0396a142b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-25.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-26.c
index 44b80c80d..8b0f344d5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-26.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-3.c
index e52fde8f9..b235b6848 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-3.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-4.c
index f0cb4d842..1ecc121e9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-4.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-5.c
index 42e6f57c5..f2494f7ef 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-5.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-6.c
index b971cddfa..ff5dad8b7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-6.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-7.c
index fa76618d9..2ad60ca6b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-7.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-8.c
index bd73963d8..d86e1cbeb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-8.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-9.c
index b34fcafd6..c20a21156 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/25-9.c
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/29-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/29-1.c
index 5069efc50..22e18ce72 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/29-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/29-1.c
@@ -86,8 +86,8 @@
static volatile sig_atomic_t latest;
-static void handler(int sig PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int sig LTP_ATTRIBUTE_UNUSED, siginfo_t *info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
if (info->si_signo != SIGRTMAX) {
output("Received unexpected signal %d\n", info->si_signo);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-1.c
index 2d88215fe..eff8301e9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-1.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-10.c
index 8c586a480..2c6eba322 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-10.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-11.c
index 462808f83..e39c6fb2b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-11.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-12.c
index c6cdd2b27..7c6555f88 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-12.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-13.c
index 8a9cbe56b..6953547e0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-13.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-14.c
index ed4432f7d..0e1ad421e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-14.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-15.c
index 43d365955..56f7f2d07 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-15.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-16.c
index 9df835116..2d6fb1884 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-16.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-17.c
index e18f03db4..0bbf33aca 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-17.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-18.c
index f59dd7167..a86962d7d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-18.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-19.c
index f59dd7167..a86962d7d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-19.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-2.c
index f59dd7167..a86962d7d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-2.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-20.c
index dd3932bbe..908d9dd2f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-20.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-21.c
index 940589213..ea4d66260 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-21.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-22.c
index f25f9cb68..ec9504233 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-22.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-23.c
index 8928ad1c2..27745baab 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-23.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-24.c
index 798cf36b2..48961fcde 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-24.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-25.c
index 07a7130ff..3f0f73c84 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-25.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-26.c
index c1f3828d4..3d6cf6b8f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-26.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-3.c
index 3a5d5d749..58cf13a78 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-3.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-4.c
index 59a22beb9..b96023208 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-4.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-5.c
index 683e4737c..a584e81f6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-5.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-6.c
index 961c71554..29d850ab9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-6.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-7.c
index 684cced4b..a213f053e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-7.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-8.c
index e3f8c39ef..66c305954 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-8.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-9.c
index 22e10231c..d5e462e93 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/3-9.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/30-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/30-1.c
index 0251e49fc..9223fc91d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/30-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/30-1.c
@@ -80,7 +80,7 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-1.c
index 596e56dcf..a08fd339f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-1.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-10.c
index 5f8e79ea2..0874fe29c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-10.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-100.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-100.c
index e49fc9aa8..9e2554865 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-100.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-100.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-101.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-101.c
index 006b884a5..4f19c252f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-101.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-101.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-102.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-102.c
index 053fda365..735b488f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-102.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-102.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-103.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-103.c
index 425678524..64ebdd9b2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-103.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-103.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-104.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-104.c
index cd9c075ab..745fd1102 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-104.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-104.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-11.c
index 57d7f63c6..3462db4a3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-11.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-12.c
index 79b786496..d50ab0290 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-12.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-13.c
index 8d7f33724..b23c56949 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-13.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-14.c
index 334d39367..3c948de98 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-14.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-15.c
index fff90d000..e57228dbe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-15.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-16.c
index f86b4103b..89e6854de 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-16.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-17.c
index c99a06ac6..a62688746 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-17.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-18.c
index f8bea65fd..2117782cd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-18.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-19.c
index f8bea65fd..2117782cd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-19.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-2.c
index f8bea65fd..2117782cd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-2.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-20.c
index 0c759120e..62fe61682 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-20.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-21.c
index ba014a5ab..5687a2bee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-21.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-22.c
index 2822977f0..01758106c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-22.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-23.c
index b9cdc2a59..76d16edd7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-23.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-24.c
index ee9b9823d..028441449 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-24.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-25.c
index 259dd7d9a..48509a507 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-25.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-26.c
index 09ee6b0fc..20e56fe51 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-26.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-27.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-27.c
index a460dfb3a..d1a1746ef 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-27.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-27.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-28.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-28.c
index 715cdba44..306a89564 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-28.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-28.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-29.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-29.c
index 234ad5b0d..a3702ae4a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-29.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-29.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-3.c
index a63605023..1350e463c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-3.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-30.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-30.c
index dca9a1d8d..70cb6d048 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-30.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-30.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-31.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-31.c
index 4e697b35d..69b554c27 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-31.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-31.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-32.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-32.c
index 7927567f8..441e80ed1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-32.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-32.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-33.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-33.c
index a60910077..04d93cb62 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-33.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-33.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-34.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-34.c
index e5e8fa2b1..86bace6a9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-34.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-34.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-35.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-35.c
index a3b515701..29e458567 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-35.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-35.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-36.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-36.c
index d4208c466..0c5be395c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-36.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-36.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-37.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-37.c
index 40c1effe2..0df283da9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-37.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-37.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-38.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-38.c
index 58e44c9cc..987a32f1d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-38.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-38.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-39.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-39.c
index 90b032684..8394e8a5f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-39.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-39.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-4.c
index d5d0869f9..490bd5afa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-4.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-40.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-40.c
index c4a192d98..30c11ff94 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-40.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-40.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-41.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-41.c
index 1c73ceffc..a57a3faf0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-41.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-41.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-42.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-42.c
index 959f3216b..90b95fac7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-42.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-42.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-43.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-43.c
index 736f67c28..8d16d2047 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-43.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-43.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-44.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-44.c
index 715cdba44..306a89564 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-44.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-44.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-45.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-45.c
index 715cdba44..306a89564 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-45.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-45.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-46.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-46.c
index 185776ee7..d46a05d34 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-46.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-46.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-47.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-47.c
index 96722c6c0..8c83f9fd1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-47.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-47.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-48.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-48.c
index 643b36ec0..bd12bd09e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-48.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-48.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-49.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-49.c
index 624d576bf..7a631fcff 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-49.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-49.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-5.c
index 0e1de9efb..2a123015f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-5.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-50.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-50.c
index bf53fd04a..42486e03c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-50.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-50.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-51.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-51.c
index 4fd3c889a..ad649aec0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-51.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-51.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-52.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-52.c
index 2bcda90c7..1944484b8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-52.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-52.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-53.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-53.c
index 6b4107a34..daa9caedf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-53.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-53.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-54.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-54.c
index 8267ed2ba..3604c2886 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-54.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-54.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-55.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-55.c
index 50aa80c18..db937df2e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-55.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-55.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-56.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-56.c
index 08f059b48..c7d381120 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-56.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-56.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-57.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-57.c
index 43d4cba41..568c53052 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-57.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-57.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-58.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-58.c
index 9cf85191c..139297cd3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-58.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-58.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-59.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-59.c
index 3a9c1e00d..d0f04a268 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-59.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-59.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-6.c
index 018e745b6..864f9a262 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-6.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-60.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-60.c
index 0e3bc9d3e..dd82ea00d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-60.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-60.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-61.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-61.c
index aa08b220f..a404e07ad 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-61.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-61.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-62.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-62.c
index 192cae683..59b598488 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-62.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-62.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-63.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-63.c
index 2a28dfe15..7a981da82 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-63.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-63.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-64.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-64.c
index 7262039b4..0bcd26559 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-64.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-64.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-65.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-65.c
index 2bd830212..adce41390 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-65.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-65.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-66.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-66.c
index bef063761..bdaa4b277 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-66.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-66.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-67.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-67.c
index 62b3ee0c2..8051d58b2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-67.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-67.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-68.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-68.c
index a8b9927e6..881e176f5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-68.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-68.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-69.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-69.c
index a90a76031..02640944b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-69.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-69.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-7.c
index 8f8905d68..9415b4358 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-7.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-70.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-70.c
index bbb35adf1..58b2089f0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-70.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-70.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-71.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-71.c
index 8267ed2ba..3604c2886 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-71.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-71.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-72.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-72.c
index 47ed9c146..d714e125b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-72.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-72.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-73.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-73.c
index 694301ad2..9bf5cc8b8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-73.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-73.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-74.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-74.c
index 4eb18e08d..ad5a56b1d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-74.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-74.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-75.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-75.c
index 66b8579de..bef6329af 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-75.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-75.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-76.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-76.c
index e90c37282..ab42bdd1c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-76.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-76.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-77.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-77.c
index 8a9aa8af8..777a66cab 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-77.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-77.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-78.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-78.c
index 4bb1e1122..d264ac694 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-78.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-78.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-79.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-79.c
index ce3afda49..636d56f56 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-79.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-79.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-8.c
index f8ccf6224..70c9d9895 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-8.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-80.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-80.c
index ba2646d5e..db6b95ae2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-80.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-80.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-81.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-81.c
index 2f210586a..411621f3b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-81.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-81.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-82.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-82.c
index d0a688c50..5f4ac98ae 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-82.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-82.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-83.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-83.c
index aa853f2ed..89f496e76 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-83.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-83.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-84.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-84.c
index 52ea39be7..0a9302530 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-84.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-84.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-85.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-85.c
index 0c332440a..d452dd4dc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-85.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-85.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-86.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-86.c
index 25551cc4f..b7a7c6c6c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-86.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-86.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-87.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-87.c
index b858f00eb..d5926dc4b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-87.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-87.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-88.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-88.c
index 7bdd4a7a3..5cc7b6bdc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-88.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-88.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-89.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-89.c
index 5d184df35..7de7b413b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-89.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-89.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-9.c
index af9e2e409..5fbfa916c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-9.c
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-90.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-90.c
index f96f798f1..793f2bbfa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-90.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-90.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-91.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-91.c
index 5d60676e9..19d03d5b9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-91.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-91.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-92.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-92.c
index e607a28c5..181fc6627 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-92.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-92.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-93.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-93.c
index 83b5ead40..60ed16352 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-93.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-93.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-94.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-94.c
index 6cf5086e1..13845ac82 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-94.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-94.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-95.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-95.c
index a207d888b..f3279f3ea 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-95.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-95.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-96.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-96.c
index 256ccded0..77e38269e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-96.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-96.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-97.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-97.c
index ba2646d5e..db6b95ae2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-97.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-97.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-98.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-98.c
index 56031b9ab..127cfe66b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-98.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-98.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-99.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-99.c
index 0d4da954b..56f1afec3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-99.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/4-99.c
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-1.c
index d9646716e..fe36d210c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-1.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-10.c
index a80c91b36..b31c4aaff 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-10.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-11.c
index 1a0c62853..3766ff52a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-11.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-12.c
index 3c85e679a..6d72adf87 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-12.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-13.c
index 9b4217917..a3f9844a7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-13.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-14.c
index 85fb4e222..5c95eecec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-14.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-15.c
index dbf199f8b..410795ba3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-15.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-16.c
index 94ee1cc2a..8776c1fed 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-16.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-17.c
index 79a730ed9..dfe944c81 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-17.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-18.c
index 5fa60e8ac..f3087348e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-18.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-19.c
index 5fa60e8ac..f3087348e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-19.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-2.c
index 5fa60e8ac..f3087348e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-2.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-20.c
index 5e9534cb1..e936f926e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-20.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-21.c
index 19270c24c..77e9416e1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-21.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-22.c
index 05fcf55c9..22d78507c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-22.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-23.c
index 810aee370..8a53a0ee0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-23.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-24.c
index 23f3ab3f9..2abef7803 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-24.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-25.c
index 76efdd2d3..581b12384 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-25.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-26.c
index df5c80de4..767351196 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-26.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-3.c
index 4d98c90a4..341919125 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-3.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-4.c
index 77ae20b8c..191f573fa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-4.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-5.c
index 1034c7325..dddeefc88 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-5.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-6.c
index 282dbe2f6..a022b38f9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-6.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-7.c
index 142485f6e..50e88c96c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-7.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-8.c
index fd7f1104e..d61c71a9a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-8.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-9.c
index 353eb779c..63f349143 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/6-9.c
@@ -20,9 +20,9 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-1.c
index c9b530e7b..adb4c1759 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-1.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGXFSZ_count = 0;
+int SIGXFSZ_count = 0;
-static void SIGXFSZ_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGXFSZ_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGXFSZ_count++;
printf("Caught SIGXFSZ\n");
}
-static void SIGABRT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGABRT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGABRT\n");
raise(SIGXFSZ);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-10.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-10.c
index c51c996a7..5e387358c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-10.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-10.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGINT_count = 0;
+int SIGINT_count = 0;
-static void SIGINT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGINT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGINT_count++;
printf("Caught SIGINT\n");
}
-static void SIGPIPE_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGPIPE_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGPIPE\n");
raise(SIGINT);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-11.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-11.c
index 9ea72cc6a..3452b2192 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-11.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-11.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGPIPE_count = 0;
+int SIGPIPE_count = 0;
-static void SIGPIPE_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGPIPE_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGPIPE_count++;
printf("Caught SIGPIPE\n");
}
-static void SIGQUIT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGQUIT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGQUIT\n");
raise(SIGPIPE);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-12.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-12.c
index 2ff2a3287..ff2a2ee3c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-12.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-12.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGQUIT_count = 0;
+int SIGQUIT_count = 0;
-static void SIGQUIT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGQUIT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGQUIT_count++;
printf("Caught SIGQUIT\n");
}
-static void SIGSEGV_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGSEGV_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGSEGV\n");
raise(SIGQUIT);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-13.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-13.c
index dba7f9935..823686bf2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-13.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-13.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGSEGV_count = 0;
+int SIGSEGV_count = 0;
-static void SIGSEGV_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGSEGV_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGSEGV_count++;
printf("Caught SIGSEGV\n");
}
-static void SIGTERM_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTERM_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTERM\n");
raise(SIGSEGV);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-14.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-14.c
index 1b2984884..24964e6f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-14.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-14.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGTERM_count = 0;
+int SIGTERM_count = 0;
-static void SIGTERM_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTERM_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGTERM_count++;
printf("Caught SIGTERM\n");
}
-static void SIGTSTP_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTSTP_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTSTP\n");
raise(SIGTERM);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-15.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-15.c
index 0167d8e7d..97ddbbb59 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-15.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-15.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGTSTP_count = 0;
+int SIGTSTP_count = 0;
-static void SIGTSTP_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTSTP_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGTSTP_count++;
printf("Caught SIGTSTP\n");
}
-static void SIGTTIN_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTTIN_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTTIN\n");
raise(SIGTSTP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-16.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-16.c
index 755b88d92..725b72523 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-16.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-16.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGTTIN_count = 0;
+int SIGTTIN_count = 0;
-static void SIGTTIN_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTTIN_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGTTIN_count++;
printf("Caught SIGTTIN\n");
}
-static void SIGTTOU_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTTOU_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTTOU\n");
raise(SIGTTIN);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-17.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-17.c
index c7a603c5c..20f0f7131 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-17.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-17.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGTTOU_count = 0;
+int SIGTTOU_count = 0;
-static void SIGTTOU_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTTOU_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGTTOU_count++;
printf("Caught SIGTTOU\n");
}
-static void SIGUSR1_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR1_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGUSR1\n");
raise(SIGTTOU);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-18.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-18.c
index c5c4d6659..872e3de96 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-18.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-18.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGUSR1_count = 0;
+int SIGUSR1_count = 0;
-static void SIGUSR1_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR1_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGUSR1_count++;
printf("Caught SIGUSR1\n");
}
-static void SIGUSR2_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR2_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGUSR2\n");
raise(SIGUSR1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-19.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-19.c
index f67ea540d..00772e2d0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-19.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-19.c
@@ -18,14 +18,14 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGUSR2_count = 0;
+int SIGUSR2_count = 0;
-static void SIGUSR2_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR2_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGUSR2_count++;
}
-static void SIGUSR1_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR1_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
raise(SIGUSR2);
if (SIGUSR2_count) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-2.c
index af19bab27..94c5142c7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-2.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGABRT_count = 0;
+int SIGABRT_count = 0;
-static void SIGABRT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGABRT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGABRT_count++;
printf("Caught SIGABRT\n");
}
-static void SIGUSR2_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR2_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGUSR2\n");
raise(SIGABRT);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-20.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-20.c
index edf80952e..5fe20b16e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-20.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-20.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGUSR2_count = 0;
+int SIGUSR2_count = 0;
-static void SIGUSR2_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR2_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGUSR2_count++;
printf("Caught SIGUSR2\n");
}
-static void SIGPROF_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGPROF_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGPROF\n");
raise(SIGUSR2);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-21.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-21.c
index 8118c99f7..68d957304 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-21.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-21.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGPROF_count = 0;
+int SIGPROF_count = 0;
-static void SIGPROF_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGPROF_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGPROF_count++;
printf("Caught SIGPROF\n");
}
-static void SIGSYS_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGSYS_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGSYS\n");
raise(SIGPROF);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-22.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-22.c
index 7ca6a7155..c209de8a8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-22.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-22.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGSYS_count = 0;
+int SIGSYS_count = 0;
-static void SIGSYS_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGSYS_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGSYS_count++;
printf("Caught SIGSYS\n");
}
-static void SIGTRAP_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTRAP_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGTRAP\n");
raise(SIGSYS);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-23.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-23.c
index a04db1706..1271d3b9a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-23.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-23.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGTRAP_count = 0;
+int SIGTRAP_count = 0;
-static void SIGTRAP_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGTRAP_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGTRAP_count++;
printf("Caught SIGTRAP\n");
}
-static void SIGURG_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGURG_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGURG\n");
raise(SIGTRAP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-24.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-24.c
index f343eb9df..f4dde6fbb 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-24.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-24.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGURG_count = 0;
+int SIGURG_count = 0;
-static void SIGURG_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGURG_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGURG_count++;
printf("Caught SIGURG\n");
}
-static void SIGVTALRM_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGVTALRM_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGVTALRM\n");
raise(SIGURG);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-25.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-25.c
index 0688e5947..227c9e888 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-25.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-25.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGVTALRM_count = 0;
+int SIGVTALRM_count = 0;
-static void SIGVTALRM_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGVTALRM_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGVTALRM_count++;
printf("Caught SIGVTALRM\n");
}
-static void SIGXCPU_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGXCPU_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGXCPU\n");
raise(SIGVTALRM);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-26.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-26.c
index 81878cd74..96b0ee056 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-26.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-26.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGXCPU_count = 0;
+int SIGXCPU_count = 0;
-static void SIGXCPU_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGXCPU_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGXCPU_count++;
printf("Caught SIGXCPU\n");
}
-static void SIGXFSZ_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGXFSZ_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGXFSZ\n");
raise(SIGXCPU);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-3.c
index 2f78ec9bf..d6636eda0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-3.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGUSR2_count = 0;
+int SIGUSR2_count = 0;
-static void SIGUSR2_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR2_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGUSR2_count++;
printf("Caught SIGUSR2\n");
}
-static void SIGBUS_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGBUS_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGBUS\n");
raise(SIGUSR2);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-4.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-4.c
index c5a2f5dfe..884ac27b7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-4.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGBUS_count = 0;
+int SIGBUS_count = 0;
-static void SIGBUS_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGBUS_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGBUS_count++;
printf("Caught SIGBUS\n");
}
-static void SIGCHLD_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGCHLD_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGCHLD\n");
raise(SIGBUS);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-5.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-5.c
index 018d94bcb..be918122a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-5.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGCHLD_count = 0;
+int SIGCHLD_count = 0;
-static void SIGCHLD_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGCHLD_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGCHLD_count++;
printf("Caught SIGCHLD\n");
}
-static void SIGCONT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGCONT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGCONT\n");
raise(SIGCHLD);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-6.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-6.c
index fab686b3e..01a9263ee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-6.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-6.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGCONT_count = 0;
+int SIGCONT_count = 0;
-static void SIGCONT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGCONT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGCONT_count++;
printf("Caught SIGCONT\n");
}
-static void SIGFPE_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGFPE_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGFPE\n");
raise(SIGCONT);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-7.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-7.c
index 119f8fdbb..1b049448b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-7.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-7.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGFPE_count = 0;
+int SIGFPE_count = 0;
-static void SIGFPE_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGFPE_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGFPE_count++;
printf("Caught SIGFPE\n");
}
-static void SIGHUP_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGHUP_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGHUP\n");
raise(SIGFPE);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-8.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-8.c
index bd887ded9..dd2d4df94 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-8.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-8.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGHUP_count = 0;
+int SIGHUP_count = 0;
-static void SIGHUP_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGHUP_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGHUP_count++;
printf("Caught SIGHUP\n");
}
-static void SIGILL_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGILL_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGILL\n");
raise(SIGHUP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-9.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-9.c
index 0601917aa..c3c1d08fe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-9.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/8-9.c
@@ -18,15 +18,15 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGILL_count = 0;
+int SIGILL_count = 0;
-static void SIGILL_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGILL_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
SIGILL_count++;
printf("Caught SIGILL\n");
}
-static void SIGINT_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGINT_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught SIGINT\n");
raise(SIGILL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/9-1.c
index 1d45c09c6..fcc637f22 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/9-1.c
@@ -31,8 +31,8 @@
static volatile int child_stopped;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED, siginfo_t *info,
- void *context PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED, siginfo_t *info,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
if (info && info->si_code == CLD_STOPPED) {
printf("Child has been stopped\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_1-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_1-1.in
index 62a6bf7f1..7b31ce396 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_1-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_1-1.in
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void handler(int signo)
+void handler(int signo)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-1.in
index 6a62b09de..c5ab2e8af 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-1.in
@@ -22,9 +22,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t alt_ss;
+stack_t alt_ss;
-static void handler(int signo)
+void handler(int signo)
{
stack_t ss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-2.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-2.in
index 25867c5f6..8b369805f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-2.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_12-2.in
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo)
+void handler(int signo)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_13-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_13-1.in
index 362246cfe..1435962c4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_13-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_13-1.in
@@ -21,9 +21,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static stack_t current;
+stack_t current;
-static void handler(int signo)
+void handler(int signo)
{
stack_t oss;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_16-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_16-1.in
index 6868f57b3..1d85d4643 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_16-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_16-1.in
@@ -89,11 +89,11 @@ Anyway, a false negative status cannot be returned.
/*************************** Test case ***********************************/
/******************************************************************************/
-static volatile sig_atomic_t caught = 0;
-static sem_t sem;
+volatile sig_atomic_t caught = 0;
+sem_t sem;
/* Handler function */
-static void handler( int signo )
+void handler( int signo )
{
printf( "Caught signal %d\n", signo );
caught++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_17-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_17-1.in
index ab193c1c8..acb75d142 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_17-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_17-1.in
@@ -25,9 +25,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile sig_atomic_t wakeup = 1;
+volatile sig_atomic_t wakeup = 1;
-static void handler(int signo)
+void handler(int signo)
{
printf("Caught %%MYSIG%%\n");
wakeup++;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_2-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_2-1.in
index 7d81ddedc..e96be3d42 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_2-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_2-1.in
@@ -23,11 +23,11 @@
static volatile int handler_called;
-static void handler1(int signo)
+void handler1(int signo)
{
}
-static void handler2(int signo)
+void handler2(int signo)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_22-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_22-1.in
index 87e64e9f5..d804ea190 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_22-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_22-1.in
@@ -34,9 +34,9 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
+int handler_count = 0;
-static void handler(int signo)
+void handler(int signo)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_23-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_23-1.in
index 97acd4294..29567e924 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_23-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_23-1.in
@@ -80,9 +80,9 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int called = 0;
+int called = 0;
-static void handler( int sig )
+void handler( int sig )
{
int ret;
sigset_t pending;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_25-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_25-1.in
index 4b981c0cf..fd1c5db70 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_25-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_25-1.in
@@ -31,10 +31,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int handler_count = 0;
-static int handler_error = 0;
+int handler_count = 0;
+int handler_error = 0;
-static void handler(int signo)
+void handler(int signo)
{
static int inside_handler = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_3-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_3-1.in
index 11fab3147..17eb0d5b9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_3-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_3-1.in
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void handler(int signo)
+void handler(int signo)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-1.in
index 14a9e2f8a..50c206558 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-1.in
@@ -29,7 +29,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo)
+void handler(int signo)
{
raise(SIGKILL);
exit(0);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-2.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-2.in
index 6a5fcc810..004622672 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-2.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-2.in
@@ -30,7 +30,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo)
+void handler(int signo)
{
printf("About to stop child\n");
raise(SIGSTOP);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-3.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-3.in
index 842d96a62..ff5e03e64 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-3.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-3.in
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo)
+void handler(int signo)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-4.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-4.in
index de0f20a6a..be0c2b3fc 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-4.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_4-4.in
@@ -18,7 +18,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo)
+void handler(int signo)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_6-1.in b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_6-1.in
index 15464a0a2..a97f52d09 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_6-1.in
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaction/templates/template_6-1.in
@@ -20,7 +20,7 @@
static volatile int handler_called;
-static void handler(int signo, siginfo_t *info, void *context)
+void handler(int signo, siginfo_t *info, void *context)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/1-1.c
index f744191d0..f7087c388 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/1-1.c
@@ -27,9 +27,9 @@
#define SIGTOTEST SIGUSR1
-static stack_t alternate_s;
+stack_t alternate_s;
-static void handler()
+void handler()
{
int i = 0;
if ((void *)&i < (alternate_s.ss_sp)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/10-1.c
index 5d1729f31..141ee5ea6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/10-1.c
@@ -17,9 +17,9 @@
#define SIGTOTEST SIGUSR1
-static stack_t alternate_s;
+stack_t alternate_s;
-static void handler()
+void handler()
{
printf("Just a dummy handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/11-1.c
index fee060675..0ff047922 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/11-1.c
@@ -26,9 +26,9 @@
#define SIGTOTEST SIGUSR1
-static stack_t altstack1;
+stack_t altstack1;
-static void handler()
+void handler()
{
printf("Just a dummy handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/12-1.c
index c0bd0bdda..1430b69fe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/12-1.c
@@ -26,9 +26,9 @@
#define SIGTOTEST SIGUSR1
-static stack_t altstack1;
+stack_t altstack1;
-static void handler()
+void handler()
{
printf("Just a dummy handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/2-1.c
index 4c74da1f1..f0a149f06 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/2-1.c
@@ -30,7 +30,7 @@
static stack_t alternate_s, original_s;
-static void handler()
+void handler()
{
stack_t handler_s;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/3-1.c
index 33597ebab..46dc12aa3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/3-1.c
@@ -32,7 +32,7 @@
static stack_t alternate_s;
-static void handler()
+void handler()
{
stack_t handler_s;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/5-1.c
index c86c6b3f9..2fbaef05d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/5-1.c
@@ -18,7 +18,7 @@
#define SIGTOTEST SIGUSR1
-static void handler()
+void handler()
{
printf("Do nothing useful\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/6-1.c
index e3fd178e2..9f54d0355 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/6-1.c
@@ -28,7 +28,7 @@
static stack_t alternate_s;
-static void handler()
+void handler()
{
stack_t handler_s;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/7-1.c
index 831a434e2..d694583ee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/7-1.c
@@ -28,7 +28,7 @@
static stack_t altstack1;
-static void handler()
+void handler()
{
stack_t altstack2;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/8-1.c
index 0ab9731ce..cff8b7c64 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/8-1.c
@@ -28,7 +28,7 @@
static stack_t alternate_s;
-static void handler()
+void handler()
{
stack_t handler_s;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sighold/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sighold/1-1.c
index d00e4e11f..632596a84 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sighold/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sighold/1-1.c
@@ -21,7 +21,7 @@
static int handler_called = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+static void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigignore/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigignore/1-1.c
index 97a926f19..69c5886e3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigignore/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigignore/1-1.c
@@ -20,7 +20,7 @@ signal is ever raised.
static int handler_called = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+static void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigismember/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigismember/4-1.c
index 51bcb5b4c..5dfad8dce 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigismember/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigismember/4-1.c
@@ -24,7 +24,7 @@ int main(void)
}
if (sigismember(&signalset, SIGABRT) != 0) {
- printf("sigismember dit not return 0\n");
+ printf("sigismember dit not return 0");
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/signal/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/signal/1-1.c
index c4ebf5bec..193f7489d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/signal/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/signal/1-1.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
handler_called = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/signal/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/signal/2-1.c
index 35b7f49ea..1dfc08a37 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/signal/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/signal/2-1.c
@@ -23,7 +23,7 @@
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
handler_called = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/signal/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/signal/3-1.c
index 914be5971..83ef0721f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/signal/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/signal/3-1.c
@@ -21,7 +21,7 @@
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
handler_called = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/signal/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/signal/5-1.c
index e07399d33..6e0e649e8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/signal/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/signal/5-1.c
@@ -22,12 +22,12 @@
#include <stdlib.h>
#include "posixtest.h"
-static void SIGUSR1_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR1_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("do nothing useful\n");
}
-static void SIGUSR2_handler(int signo PTS_ATTRIBUTE_UNUSED)
+void SIGUSR2_handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("do nothing useful\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/signal/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/signal/6-1.c
index e49045ad1..ad58161e6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/signal/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/signal/6-1.c
@@ -17,7 +17,7 @@
#include <errno.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("handler does nothing useful.\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/signal/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/signal/7-1.c
index f70f85eec..553cbd0ec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/signal/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/signal/7-1.c
@@ -17,7 +17,7 @@
#include <errno.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("handler does nothing useful.\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-2.c
index 3537ce85f..009e1fa92 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-2.c
@@ -32,7 +32,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
sigset_t pendingset;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-3.c
index 80aa4a6d7..8dedfbc95 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-3.c
@@ -33,7 +33,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
sigset_t pendingset;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/12-1.c
index a6c5a3f44..3f79c32ec 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/12-1.c
@@ -25,7 +25,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set)
+int is_changed(sigset_t set)
{
int i;
@@ -51,7 +51,7 @@ static int is_changed(sigset_t set)
return 0;
}
-static int get_rand(void)
+int get_rand(void)
{
int r;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/4-1.c
index fac3229f8..c6de97156 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/4-1.c
@@ -17,7 +17,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/5-1.c
index d00af5a81..c941c2389 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/5-1.c
@@ -15,7 +15,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/6-1.c
index 395a5f409..e53bcaa34 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/6-1.c
@@ -17,7 +17,7 @@
static volatile int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-1.c
index fcd5de325..2ceba40dd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-1.c
@@ -21,7 +21,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-2.c
index 0e36a6b34..8343d8ef3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-2.c
@@ -22,7 +22,7 @@ At
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-3.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-3.c
index 58b06e87e..e213f190e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/8-3.c
@@ -21,7 +21,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/9-1.c
index ef197e53d..748697a32 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigprocmask/9-1.c
@@ -24,9 +24,9 @@
#include "posixtest.h"
static volatile int handler_called;
-static int sigprocmask_return_val = 1; /* some value that's not a 1 or 0 */
+int sigprocmask_return_val = 1; /* some value that's not a 1 or 0 */
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
if (sigprocmask_return_val != 1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/1-1.c
index e456c4829..f614169aa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/1-1.c
@@ -29,7 +29,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo, siginfo_t *info, void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo, siginfo_t *info, void *context LTP_ATTRIBUTE_UNUSED)
{
if (signo == SIGTOTEST && info->si_value.sival_int == VALTOTEST) {
printf
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/12-1.c
index ed1ee883f..d913a700a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/12-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/12-1.c
@@ -25,7 +25,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/3-1.c
index 3867f43fa..8ea6a687c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/3-1.c
@@ -28,7 +28,7 @@
#include "posixtest.h"
/** Set the euid of this process to a non-root uid */
-static int set_nonroot()
+int set_nonroot()
{
struct passwd *pw;
setpwent();
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/4-1.c
index a38fa7a49..3eff87db9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/4-1.c
@@ -31,9 +31,9 @@
static volatile int counter;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
counter++;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/5-1.c
index 87e997d84..d6256ef7d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/5-1.c
@@ -29,9 +29,9 @@
#include <errno.h>
#include "posixtest.h"
-static volatile int counter = 0;
+int counter = 0;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
counter++;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/6-1.c
index 25b7ac670..f0e8302e7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/6-1.c
@@ -37,9 +37,9 @@
static int return_val = 1;
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
if (return_val != 1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/7-1.c
index fac11ea43..e57f63f3b 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/7-1.c
@@ -34,8 +34,8 @@
static int last_signal;
static volatile int test_failed;
-static void myhandler(int signo, siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo, siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
printf("%d, ", signo);
if (last_signal >= signo) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/8-1.c
index e7d1ec802..65d4a5ba8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/8-1.c
@@ -32,9 +32,9 @@
static volatile int counter;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
counter++;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigrelse/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigrelse/1-1.c
index 60d0a95cb..ad212ce4e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigrelse/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigrelse/1-1.c
@@ -25,7 +25,7 @@
static int handler_called;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+static void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/1-1.c
index 80dfdf328..ade19c2ed 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/1-1.c
@@ -25,7 +25,7 @@
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
handler_called = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/2-1.c
index a3edbdd61..dd11f1cd6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/2-1.c
@@ -24,7 +24,7 @@
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGUSR1 called. Inside handler\n");
handler_called = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/3-1.c
index 39e0531c5..32c881e40 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/3-1.c
@@ -22,7 +22,7 @@
static volatile int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
handler_called = 1;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/4-1.c
index 3634caec0..e7a38bb63 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/4-1.c
@@ -16,9 +16,9 @@
#include <stdlib.h>
#include "posixtest.h"
-static int signal_blocked = 0;
+int signal_blocked = 0;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
sigset_t mask;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/5-1.c
index 1b91717c9..cc4f00d24 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/5-1.c
@@ -24,7 +24,7 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static int is_empty(sigset_t * set)
+int is_empty(sigset_t * set)
{
int i;
@@ -50,7 +50,7 @@ static int is_empty(sigset_t * set)
return 1;
}
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c
index 25c4f16aa..4de898c22 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/6-1.c
@@ -27,7 +27,7 @@
#define ERR_MSG(f, rc) printf("Failed: func: %s rc: %u errno: %s\n", \
f, rc, strerror(errno))
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGCHLD called. Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c
index d4082cc49..a6254bbfe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/7-1.c
@@ -34,7 +34,7 @@
static int handler_called;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+static void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
handler_called = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigset/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigset/9-1.c
index 4e5d74e8c..bccc2cce7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigset/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigset/9-1.c
@@ -16,7 +16,7 @@
#include <stdlib.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("SIGUSR1 called. Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/1-1.c
index 7076f1b88..2eba74f08 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/1-1.c
@@ -46,10 +46,10 @@
#include <unistd.h>
#include "posixtest.h"
-static int SIGUSR1_called = 0;
-static int SIGUSR2_called = 0;
+int SIGUSR1_called = 0;
+int SIGUSR2_called = 0;
-static void handler(int signo)
+void handler(int signo)
{
if (signo == SIGUSR1) {
printf("SIGUSR1 called. Inside handler\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/4-1.c
index b3b0c4c19..346cd1ce5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/4-1.c
@@ -35,11 +35,11 @@
#define NUMSIGNALS (sizeof(siglist) / sizeof(siglist[0]))
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
}
-static int is_changed(sigset_t set, int sig)
+int is_changed(sigset_t set, int sig)
{
int i;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/6-1.c
index 727610799..c0240a497 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigsuspend/6-1.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Now inside signal handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/1-1.c
index 785751295..44ef3b054 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/1-1.c
@@ -45,7 +45,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf
("Test FAILED: %d seconds have elapsed and sigtimedwait() has not yet returned.\n",
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/2-1.c
index 4677a12ea..f23db0be3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/2-1.c
@@ -46,7 +46,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf
("Test FAILED: %d seconds have elapsed and sigtimedwait() has not yet returned.\n",
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/4-1.c
index c3cd42f18..b52955490 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/4-1.c
@@ -26,7 +26,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/5-1.c
index 9496764ee..569a1c328 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/5-1.c
@@ -39,7 +39,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf
("Test FAILED: %d seconds have elapsed and sigtimedwait() has not yet returned.\n",
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/6-1.c
index ac5eee49b..d8cece87f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigtimedwait/6-1.c
@@ -41,7 +41,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf
("Test FAILED: %d seconds have elapsed and sigtimedwait() has not yet returned.\n",
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwait/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwait/4-1.c
index 461902040..1c79b2829 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwait/4-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwait/4-1.c
@@ -49,7 +49,7 @@ int main(void)
/* Read clock */
if (gettimeofday(&tv_ref, NULL) != 0) {
- printf("Failed to get time of day\n");
+ printf("Failed to get time of day");
return PTS_UNRESOLVED;
}
@@ -65,7 +65,7 @@ int main(void)
/* Re-read clock */
if (gettimeofday(&tv_cur, NULL) != 0) {
- printf("Failed to get time of day\n");
+ printf("Failed to get time of day");
return PTS_UNRESOLVED;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-1.c
index 1d1fddedd..3a8e618da 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-1.c
@@ -81,11 +81,11 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static volatile int n_awaken = 0;
-static sigset_t setusr;
+int n_awaken = 0;
+sigset_t setusr;
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
int sig;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-2.c
index a1f49a651..f3209c2fd 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-2.c
@@ -80,12 +80,12 @@
/*************************** Test case ***********************************/
/******************************************************************************/
-static int n_awaken = 0;
-static pthread_t last_awaken;
-static sigset_t setusr;
+int n_awaken = 0;
+pthread_t last_awaken;
+sigset_t setusr;
/* Thread function */
-static void *threaded(void *arg PTS_ATTRIBUTE_UNUSED)
+void *threaded(void *arg LTP_ATTRIBUTE_UNUSED)
{
int ret;
int sig;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/1-1.c
index 2449055c7..5fa4d1622 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/1-1.c
@@ -26,7 +26,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/2-1.c
index 6983eda12..11066184a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/2-1.c
@@ -28,9 +28,9 @@
#include <errno.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
printf("Inside dummy handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/3-1.c
index 3983a3dbc..0712119b3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/3-1.c
@@ -26,7 +26,7 @@
#include <unistd.h>
#include "posixtest.h"
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Inside dummy handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/5-1.c
index 4e33fca30..0c7d1f9c8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/5-1.c
@@ -25,9 +25,9 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
printf("Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/6-1.c
index 197aae55c..82836cce3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/6-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/6-1.c
@@ -25,9 +25,9 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
printf("Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/7-1.c
index 2ed4ca81b..28b0b24ee 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/7-1.c
@@ -30,11 +30,11 @@
#include <errno.h>
#include "posixtest.h"
-static int counter;
+int counter;
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
counter++;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/8-1.c
index f999aa37d..d603f59f7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/8-1.c
@@ -31,9 +31,9 @@
#include <errno.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED,
- siginfo_t *info PTS_ATTRIBUTE_UNUSED,
- void *context PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED,
+ siginfo_t *info LTP_ATTRIBUTE_UNUSED,
+ void *context LTP_ATTRIBUTE_UNUSED)
{
printf("Just a dummy handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/9-1.c
index 97b06382d..2be9ab3f1 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sigwaitinfo/9-1.c
@@ -25,7 +25,7 @@
#include <sys/wait.h>
#include "posixtest.h"
-static void myhandler(int signo PTS_ATTRIBUTE_UNUSED)
+void myhandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Inside handler\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/strchr/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/strchr/1-1.c
index 2c3042375..611a64daf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/strchr/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/strchr/1-1.c
@@ -37,7 +37,7 @@
#define SKIP_CHAR 'n'
#define MATCH_CHAR 's'
-static char *random_string(int len, int char_pos)
+char *random_string(int len, int char_pos)
{
int i;
char *output_string = malloc(len + 1);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/strcpy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/strcpy/1-1.c
index f71cd3870..adfbfc38a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/strcpy/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/strcpy/1-1.c
@@ -28,7 +28,7 @@
#define STEP_COUNT 2000
#define TNAME "strcpy/1-1.c"
-static char *random_string(int len)
+char *random_string(int len)
{
int i;
char *output_string;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/strlen/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/strlen/1-1.c
index 0ac993726..2f0d385cf 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/strlen/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/strlen/1-1.c
@@ -26,7 +26,7 @@
#define STEP_COUNT 2000
#define TNAME "strlen/1-1.c"
-static char *random_string(int len)
+char *random_string(int len)
{
int i;
char *output_string;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c
index 55def092e..b67d09dc5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/strncpy/1-1.c
@@ -30,7 +30,7 @@
#define STEP_COUNT 2000
#define TNAME "strncpy/1-1.c"
-static char *random_string(int len)
+char *random_string(int len)
{
int i;
char *output_string = NULL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/strncpy/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/strncpy/2-1.c
index 1e4752d80..2a2087263 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/strncpy/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/strncpy/2-1.c
@@ -31,7 +31,7 @@
#define TNAME "strncpy/2-1.c"
#define EXTRA_BYTES 10
-static char *random_string(int len)
+char *random_string(int len)
{
int i;
char *output_string;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c b/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c
index 433ed70a7..3aad7f30c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/testfrmw.c
@@ -34,12 +34,12 @@
/* We use a mutex to avoid conflicts in traces */
static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
-static void output_init(void)
+void output_init(void)
{
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
struct tm *now;
@@ -51,9 +51,9 @@ static void output(char *string, ...)
nw = time(NULL);
now = localtime(&nw);
if (now == NULL)
- printf("[??:??:??]\n");
+ printf("[??:??:??]");
else
- printf("[%2.2d:%2.2d:%2.2d]\n",
+ printf("[%2.2d:%2.2d:%2.2d]",
now->tm_hour, now->tm_min, now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -62,7 +62,7 @@ static void output(char *string, ...)
pthread_setcancelstate(oldstate, NULL);
}
-static void output_fini(void)
+void output_fini(void)
{
return;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c b/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c
index baf30a87c..d8658d68c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/testfrmw/threads_scenarii.c
@@ -22,7 +22,7 @@
* scenar_fini(): function to call after end of use of the scenarii array.
*/
-static struct __scenario {
+struct __scenario {
/*
* Object to hold the given configuration,
* and which will be used to create the threads
@@ -191,7 +191,7 @@ CASE_UNK(0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param"),
* This function will initialize every pthread_attr_t object
* in the scenarii array
*/
-static void scenar_init(void)
+void scenar_init(void)
{
int ret = 0;
unsigned int i;
@@ -462,7 +462,7 @@ static void scenar_init(void)
* This function will free all resources consumed
* in the scenar_init() routine
*/
-static void scenar_fini(void)
+void scenar_fini(void)
{
int ret = 0;
unsigned int i;
@@ -482,11 +482,11 @@ static void scenar_fini(void)
}
}
-static unsigned int sc;
+unsigned int sc;
#ifdef STD_MAIN
-static void *threaded(void *arg);
+extern void *threaded(void *arg);
int main(void)
{
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/1-1.c
index 89a1cab80..3dee5958e 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/1-1.c
@@ -34,7 +34,7 @@
#define SLEEPDELTA 3
#define ACCEPTABLEDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/10-1.c
index 9cec5d7da..4c6198503 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/10-1.c
@@ -23,7 +23,7 @@
static volatile int caught_signal;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+static void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
caught_signal = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/11-1.c
index 34afee0d2..388441336 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/11-1.c
@@ -23,7 +23,7 @@
static volatile int caught_signal;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+static void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
caught_signal = 1;
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/3-1.c
index a843d02af..fb25ef20c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/3-1.c
@@ -24,7 +24,7 @@
#define SIGTOTEST SIGALRM
#define SLEEPTIME 3
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/7-1.c
index d6c8d2475..ad9280aa6 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/7-1.c
@@ -24,7 +24,7 @@
#define SLEEPDELTA 3
#define ACCEPTABLEDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/8-1.c
index fe771a559..49ffb1cd2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/8-1.c
@@ -43,12 +43,12 @@
#define CHILDSUCCESS 1
#define CHILDFAILURE 0
-static void parenthandler(int signo PTS_ATTRIBUTE_UNUSED)
+void parenthandler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Expected - Caught signal\n");
}
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Not expected - Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/9-1.c
index a68879389..fdf33b8a3 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/9-1.c
@@ -29,7 +29,7 @@
#define SLEEPDELTA 3
#define ACCEPTABLEDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/2-1.c
index 0b800f58a..916f8a3aa 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/2-1.c
@@ -21,7 +21,7 @@
#include <limits.h>
#include "posixtest.h"
-static int compare(const void *key, const void *amemb)
+int compare(const void *key, const void *amemb)
{
if (*(timer_t *) key == *(timer_t *) amemb) {
return 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/5-1.c
index a2c06f706..846d67f12 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_create/speculative/5-1.c
@@ -42,7 +42,7 @@
#define SLEEPDELTA 3
#define ACCEPTABLEDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/1-1.c
index c4bfb490e..e0dff6d41 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/1-1.c
@@ -31,7 +31,7 @@
#define SIGTOTEST SIGALRM
#define TIMERSEC 3
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Should not have caught signal\n");
exit(PTS_FAIL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c
index e8f4459bb..1e9c82562 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c
@@ -26,7 +26,7 @@
#define SIGTOTEST SIGALRM
#define TIMERSEC 3
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Should not have caught signal\n");
exit(PTS_FAIL);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/1-1.c
index 70fb9941b..e540a363f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/1-1.c
@@ -25,9 +25,9 @@
#define TIMERVAL 2
#define TIMERINTERVAL 3
-static int madeit = 0;
+int madeit = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
madeit++;
if (madeit > 1) {
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-1.c
index 512f93dba..b8854e54c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-1.c
@@ -36,7 +36,7 @@
#define SLEEPDELTA 3
#define ACCEPTABLEDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-2.c
index 25e07adbb..2568d570d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/1-2.c
@@ -28,7 +28,7 @@
#define ACCEPTABLEDELTA 1
#define NUMTESTS 6
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-1.c
index 315849213..0cf4b0fed 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-1.c
@@ -30,7 +30,7 @@
#define SIGTOTEST SIGALRM
#define SLEEPDELTA 3
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Incorrectly in signal handler\n");
printf("Test FAILED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-2.c
index f81da9408..4e90677d2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-2.c
@@ -22,7 +22,7 @@
#define SIGTOTEST SIGALRM
#define TIMEREXPIRE 3
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Incorrectly in signal handler\n");
printf("Test FAILED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-3.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-3.c
index b9fc829a6..21e9e570c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/3-3.c
@@ -24,7 +24,7 @@
#define SIGTOTEST SIGALRM
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("OK to be in once\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-1.c
index 3425294bf..900d41b6a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-1.c
@@ -31,7 +31,7 @@
#define SLEEPDELTA 3
#define ACCEPTABLEDELTA 1
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-2.c
index 51e533530..79d4cabef 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-2.c
@@ -34,7 +34,7 @@
#define LONGSLEEPTIME 10
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
printf("Test PASSED\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-3.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-3.c
index 708046c6c..36c47b268 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/5-3.c
@@ -33,9 +33,9 @@
#define SUBTRACTAMOUNT 1000
-static int fails = 0, passes = 0;
+int fails = 0, passes = 0;
-static void handler(int signo PTS_ATTRIBUTE_UNUSED)
+void handler(int signo LTP_ATTRIBUTE_UNUSED)
{
printf("Caught signal\n");
passes += 1;
diff --git a/testcases/open_posix_testsuite/functional/Makefile b/testcases/open_posix_testsuite/functional/Makefile
index 3b22c89af..b647f0796 100644
--- a/testcases/open_posix_testsuite/functional/Makefile
+++ b/testcases/open_posix_testsuite/functional/Makefile
@@ -10,4 +10,4 @@ all clean install test:
done
distclean-makefiles:
- @find */ -name 'Makefile*' | grep -v threads/Makefile | grep -v timers/Makefile | xargs rm -f
+ @find */ -name 'Makefile*' | grep -v threads/Makefile | xargs rm -f
diff --git a/testcases/open_posix_testsuite/functional/mqueues/send_rev_2.c b/testcases/open_posix_testsuite/functional/mqueues/send_rev_2.c
index a0a49d159..3f61710a3 100644
--- a/testcases/open_posix_testsuite/functional/mqueues/send_rev_2.c
+++ b/testcases/open_posix_testsuite/functional/mqueues/send_rev_2.c
@@ -30,13 +30,13 @@
#define MSG_SIZE 128
#define MAX_MSG 3
-static const char *s_msg_ptr[] = { "msg test 1", "msg test 2", "msg test 3" };
+const char *s_msg_ptr[] = { "msg test 1", "msg test 2", "msg test 3" };
-static char r_msg_ptr_1[MAX_MSG][MSG_SIZE];
-static char r_msg_ptr_2[MAX_MSG][MSG_SIZE];
-static pthread_t send1, send2, rev1, rev2;
+char r_msg_ptr_1[MAX_MSG][MSG_SIZE];
+char r_msg_ptr_2[MAX_MSG][MSG_SIZE];
+pthread_t send1, send2, rev1, rev2;
-static int *send_1(void *mq)
+int *send_1(void *mq)
{
int i;
mqd_t mq1 = *(mqd_t *) mq;
@@ -54,7 +54,7 @@ static int *send_1(void *mq)
}
-static int *send_2(void *mq)
+int *send_2(void *mq)
{
int i;
mqd_t mq2 = *(mqd_t *) mq;
@@ -71,7 +71,7 @@ static int *send_2(void *mq)
pthread_exit(NULL);
}
-static int *receive_1(void *mq)
+int *receive_1(void *mq)
{
int i;
mqd_t mq1 = *(mqd_t *) mq;
@@ -88,7 +88,7 @@ static int *receive_1(void *mq)
pthread_exit(NULL);
}
-static int *receive_2(void *mq)
+int *receive_2(void *mq)
{
int i;
mqd_t mq2 = *(mqd_t *) mq;
diff --git a/testcases/open_posix_testsuite/functional/semaphores/sem_conpro.c b/testcases/open_posix_testsuite/functional/semaphores/sem_conpro.c
index 5d60de775..891cb64bf 100644
--- a/testcases/open_posix_testsuite/functional/semaphores/sem_conpro.c
+++ b/testcases/open_posix_testsuite/functional/semaphores/sem_conpro.c
@@ -33,9 +33,9 @@ typedef struct {
sem_t lock;
} buf_t;
-static int in, out;
+int in, out;
-static int *producer(buf_t * buf)
+int *producer(buf_t * buf)
{
int data;
int i;
@@ -65,7 +65,7 @@ static int *producer(buf_t * buf)
pthread_exit(NULL);
}
-static int *consumer(buf_t * buf)
+int *consumer(buf_t * buf)
{
int data;
int i;
diff --git a/testcases/open_posix_testsuite/functional/semaphores/sem_philosopher.c b/testcases/open_posix_testsuite/functional/semaphores/sem_philosopher.c
index 0e02c633b..dbd9fe8df 100644
--- a/testcases/open_posix_testsuite/functional/semaphores/sem_philosopher.c
+++ b/testcases/open_posix_testsuite/functional/semaphores/sem_philosopher.c
@@ -27,24 +27,24 @@
#define hungry 1
#define eating 2
-static sem_t ph[PH_NUM];
-static sem_t lock;
+sem_t ph[PH_NUM];
+sem_t lock;
-static int state[PH_NUM];
+int state[PH_NUM];
-static int think(int ID)
+int think(int ID)
{
printf("Philosoper [%d] is thinking... \n", ID);
return 0;
}
-static int eat(int ID)
+int eat(int ID)
{
printf("Philosoper [%d] is eating... \n", ID);
return 0;
}
-static int test(int ID)
+int test(int ID)
{
int preID = 0, postID = 0;
if ((ID - 1) < 0)
@@ -66,7 +66,7 @@ static int test(int ID)
}
-static int philosopher(void *ID)
+int philosopher(void *ID)
{
int PhID = *(int *)ID;
int prePH, postPH;
diff --git a/testcases/open_posix_testsuite/functional/semaphores/sem_readerwriter.c b/testcases/open_posix_testsuite/functional/semaphores/sem_readerwriter.c
index 38b4ea5a0..d76cd9973 100644
--- a/testcases/open_posix_testsuite/functional/semaphores/sem_readerwriter.c
+++ b/testcases/open_posix_testsuite/functional/semaphores/sem_readerwriter.c
@@ -28,24 +28,24 @@
#define READ_NUM 10
#define WRITE_NUM 15
-static sem_t r_lock, w_lock;
-static int reader_count = 0;
-static int data = 0;
+sem_t r_lock, w_lock;
+int reader_count = 0;
+int data = 0;
-static int read_fun(int ID PTS_ATTRIBUTE_UNUSED)
+int read_fun(int ID LTP_ATTRIBUTE_UNUSED)
{
printf("read the board, data=%d \n", data);
return 0;
}
-static int write_fun(int ID)
+int write_fun(int ID)
{
data = 100 * ID + ID;
printf("write the board, data=%d \n", data);
return 0;
}
-static int *reader(void *ID)
+int *reader(void *ID)
{
int ThID = *(int *)ID;
if (-1 == sem_wait(&r_lock)) {
@@ -86,7 +86,7 @@ static int *reader(void *ID)
pthread_exit(NULL);
}
-static int *writer(void *ID)
+int *writer(void *ID)
{
int ThID = *(int *)ID;
/* When ThID is equal to WRITE_NUM/2, sleep 2 second and let reader read the data */
diff --git a/testcases/open_posix_testsuite/functional/semaphores/sem_sleepingbarber.c b/testcases/open_posix_testsuite/functional/semaphores/sem_sleepingbarber.c
index 0488c5fcc..915ccb8ec 100644
--- a/testcases/open_posix_testsuite/functional/semaphores/sem_sleepingbarber.c
+++ b/testcases/open_posix_testsuite/functional/semaphores/sem_sleepingbarber.c
@@ -25,12 +25,12 @@
#define CUS_NUM 10
#define LOOP_NUM 30
-static sem_t customer;
-static sem_t barber;
-static sem_t lock;
-static sem_t print;
+sem_t customer;
+sem_t barber;
+sem_t lock;
+sem_t print;
-static int waiting = 0;
+int waiting = 0;
#ifdef __GNUC__
#define my_printf(x...) do { \
@@ -42,7 +42,7 @@ static int waiting = 0;
#define my_printf printf
#endif
-static void mdelay(unsigned msecs)
+void mdelay(unsigned msecs)
{
struct timespec req;
req.tv_sec = msecs / 1000;
@@ -50,7 +50,7 @@ static void mdelay(unsigned msecs)
nanosleep(&req, NULL);
}
-static void *barbers(void *unused PTS_ATTRIBUTE_UNUSED)
+void *barbers(void *unused LTP_ATTRIBUTE_UNUSED)
{
int i;
for (i = 0; i < LOOP_NUM; i++) {
@@ -92,7 +92,7 @@ static void *barbers(void *unused PTS_ATTRIBUTE_UNUSED)
return NULL;
}
-static void *customers(void *ID)
+void *customers(void *ID)
{
int CusID;
CusID = *(int *)ID;
diff --git a/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_1.c b/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_1.c
index 9226c50b6..b2ad5463f 100644
--- a/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_1.c
+++ b/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_1.c
@@ -27,7 +27,7 @@
#include "posixtest.h"
#include "safe_helpers.h"
-#define TEST "pthread_cond_wait_1"
+#define TEST "5-1"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -36,21 +36,21 @@
#define RUNTIME 5
#define POLICY SCHED_RR
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
/* Flags that the threads use to indicate events */
static volatile int woken_up;
static volatile int low_done;
-static float timediff(struct timespec t2, struct timespec t1)
+float timediff(struct timespec t2, struct timespec t1)
{
float diff = t2.tv_sec - t1.tv_sec;
diff += (t2.tv_nsec - t1.tv_nsec) / 1000000000.0;
return diff;
}
-static void *hi_prio_thread(void *tmp)
+void *hi_prio_thread(void *tmp)
{
struct sched_param param;
int policy;
@@ -79,7 +79,7 @@ static void *hi_prio_thread(void *tmp)
return NULL;
}
-static void *low_prio_thread(void *tmp)
+void *low_prio_thread(void *tmp)
{
struct timespec start_time, current_time;
struct sched_param param;
diff --git a/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_2.c b/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_2.c
index 5073e9c9d..a7826cd04 100644
--- a/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_2.c
+++ b/testcases/open_posix_testsuite/functional/threads/condvar/pthread_cond_wait_2.c
@@ -27,7 +27,7 @@
#include "posixtest.h"
#include "safe_helpers.h"
-#define TEST "pthread_cond_wait_2"
+#define TEST "5-1"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -36,21 +36,21 @@
#define RUNTIME 5
#define POLICY SCHED_RR
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
/* Flags that the threads use to indicate events */
static volatile int woken_up;
static volatile int low_done;
-static float timediff(struct timespec t2, struct timespec t1)
+float timediff(struct timespec t2, struct timespec t1)
{
float diff = t2.tv_sec - t1.tv_sec;
diff += (t2.tv_nsec - t1.tv_nsec) / 1000000000.0;
return diff;
}
-static void *hi_prio_thread(void *tmp)
+void *hi_prio_thread(void *tmp)
{
struct sched_param param;
int policy;
@@ -79,7 +79,7 @@ static void *hi_prio_thread(void *tmp)
return NULL;
}
-static void *low_prio_thread(void *tmp)
+void *low_prio_thread(void *tmp)
{
struct timespec start_time, current_time;
struct sched_param param;
diff --git a/testcases/open_posix_testsuite/functional/threads/schedule/1-1.c b/testcases/open_posix_testsuite/functional/threads/schedule/1-1.c
index b221809d9..9d9e12b09 100644
--- a/testcases/open_posix_testsuite/functional/threads/schedule/1-1.c
+++ b/testcases/open_posix_testsuite/functional/threads/schedule/1-1.c
@@ -28,7 +28,7 @@
#include "posixtest.h"
#include "safe_helpers.h"
-#define TEST "1-1"
+#define TEST "5-4"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -36,18 +36,18 @@
#define LOW_PRIORITY 5
#define RUNTIME 5
-static pthread_barrier_t barrier;
+pthread_barrier_t barrier;
static volatile int woken_up;
static volatile int low_done;
-static float timediff(struct timespec t2, struct timespec t1)
+float timediff(struct timespec t2, struct timespec t1)
{
float diff = t2.tv_sec - t1.tv_sec;
diff += (t2.tv_nsec - t1.tv_nsec) / 1000000000.0;
return diff;
}
-static int my_pthread_barrier_wait(pthread_barrier_t *p)
+int my_pthread_barrier_wait(pthread_barrier_t *p)
{
int rc;
@@ -57,7 +57,7 @@ static int my_pthread_barrier_wait(pthread_barrier_t *p)
return rc;
}
-static void *hi_prio_thread(void *tmp)
+void *hi_prio_thread(void *tmp)
{
struct sched_param param;
int policy;
@@ -82,7 +82,7 @@ static void *hi_prio_thread(void *tmp)
pthread_exit(NULL);
}
-static void *low_prio_thread(void *tmp)
+void *low_prio_thread(void *tmp)
{
struct timespec start_timespec, current_timespec;
struct sched_param param;
diff --git a/testcases/open_posix_testsuite/functional/threads/schedule/1-2.c b/testcases/open_posix_testsuite/functional/threads/schedule/1-2.c
index 8614d5733..92e3ef153 100644
--- a/testcases/open_posix_testsuite/functional/threads/schedule/1-2.c
+++ b/testcases/open_posix_testsuite/functional/threads/schedule/1-2.c
@@ -27,7 +27,7 @@
#include "posixtest.h"
#include "safe_helpers.h"
-#define TEST "1-2"
+#define TEST "5-5"
#define AREA "scheduler"
#define ERROR_PREFIX "unexpected error: " AREA " " TEST ": "
@@ -36,19 +36,19 @@
#define LOW_PRIORITY 5
#define RUNTIME 5
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static volatile int woken_up;
static volatile int low_done;
-static float timediff(struct timespec t2, struct timespec t1)
+float timediff(struct timespec t2, struct timespec t1)
{
float diff = t2.tv_sec - t1.tv_sec;
diff += (t2.tv_nsec - t1.tv_nsec) / 1000000000.0;
return diff;
}
-static void *hi_prio_thread(void *tmp)
+void *hi_prio_thread(void *tmp)
{
struct sched_param param;
int policy;
@@ -78,7 +78,7 @@ static void *hi_prio_thread(void *tmp)
pthread_exit(NULL);
}
-static void *low_prio_thread(void *tmp)
+void *low_prio_thread(void *tmp)
{
struct timespec current_time, start_time;
struct sched_param param;
diff --git a/testcases/open_posix_testsuite/functional/timers/Makefile b/testcases/open_posix_testsuite/functional/timers/Makefile
deleted file mode 100644
index 6cf8b0642..000000000
--- a/testcases/open_posix_testsuite/functional/timers/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Read COPYING for licensing details.
-#
-# Ngie Cooper, June 2010
-#
-
-all clean install test:
- @for dir in `ls -d */Makefile 2>/dev/null | sed -e 's,/Makefile$$,,g'`; do \
- $(MAKE) -C $$dir $@; \
- done
diff --git a/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c b/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c
index d4116b1e9..2ebf7f0b0 100644
--- a/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c
+++ b/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c
@@ -5,7 +5,7 @@
* of this license, see the COPYING file at the top level of this
* source tree.
*
- * Test that the clock time can be set to a large number, Y2K
+ * Test that the clock time can be set to 0, a large number, Y2K
* critical dates, and times around daylight savings.
*
* Test for CLOCK_REALTIME. (N/A for CLOCK_MONOTONIC as that clock
@@ -16,11 +16,13 @@
#include <stdint.h>
#include "posixtest.h"
-#define NUMTESTS 5
+#define NUMTESTS 6
-#define ACCEPTABLESECDELTA 2
+#define ACCEPTABLESECDELTA 0
+#define ACCEPTABLENSECDELTA 5000
static int testtimes[NUMTESTS][2] = {
+ {0, 0}, // zero
{INT32_MAX, 999999999}, // large number
{946713600, 999999999}, // Y2K - Jan 1, 2000
{951811200, 999999999}, // Y2K - Feb 29, 2000
@@ -28,7 +30,7 @@ static int testtimes[NUMTESTS][2] = {
{1049623200, 999999999}, // daylight savings 2003
};
-int main(void)
+int main(int argc, char *argv[])
{
struct timespec tpset, tpget, tsreset;
int secdelta, nsecdelta;
@@ -43,6 +45,9 @@ int main(void)
for (i = 0; i < NUMTESTS; i++) {
tpset.tv_sec = testtimes[i][0];
tpset.tv_nsec = testtimes[i][1];
+#ifdef DEBUG
+ printf("Test: %ds %dns\n", testtimes[i][0], testtimes[i][1]);
+#endif
if (clock_settime(CLOCK_REALTIME, &tpset) == 0) {
if (clock_gettime(CLOCK_REALTIME, &tpget) == -1) {
printf("Error in clock_gettime()\n");
@@ -54,13 +59,16 @@ int main(void)
nsecdelta = nsecdelta + 1000000000;
secdelta = secdelta - 1;
}
-
- if ((secdelta > ACCEPTABLESECDELTA)
- || (secdelta < 0)) {
- printf("FAIL: test(%d,%d), secdelta: %d,"
- " nsecdelta: %d\n",
- testtimes[i][0], testtimes[i][1],
- secdelta, nsecdelta);
+#ifdef DEBUG
+ printf("Delta: %ds %dns\n", secdelta, nsecdelta);
+#endif
+ if ((secdelta > ACCEPTABLESECDELTA) || (secdelta < 0)) {
+ printf("clock does not appear to be set\n");
+ failure = 1;
+ }
+ if ((nsecdelta > ACCEPTABLENSECDELTA) ||
+ (nsecdelta < 0)) {
+ printf("clock does not appear to be set\n");
failure = 1;
}
} else {
diff --git a/testcases/open_posix_testsuite/functional/timers/timers/LDLIBS b/testcases/open_posix_testsuite/functional/timers/timers/LDLIBS
deleted file mode 100644
index 08f7cd60c..000000000
--- a/testcases/open_posix_testsuite/functional/timers/timers/LDLIBS
+++ /dev/null
@@ -1 +0,0 @@
--lrt
diff --git a/testcases/open_posix_testsuite/functional/timers/timers/twoevtimers.c b/testcases/open_posix_testsuite/functional/timers/timers/twoevtimers.c
index c372b5af8..4b26b57ed 100644
--- a/testcases/open_posix_testsuite/functional/timers/timers/twoevtimers.c
+++ b/testcases/open_posix_testsuite/functional/timers/timers/twoevtimers.c
@@ -22,16 +22,16 @@
#define CHILDPASS 1
-static int caughtabort = 0;
-static int caughtalarm = 0;
+int caughtabort = 0;
+int caughtalarm = 0;
-static void handler_abrt(int signo)
+void handler_abrt(int signo)
{
printf("Caught abort signal\n");
caughtabort++;
}
-static void handler_alrm(int signo)
+void handler_alrm(int signo)
{
printf("Caught alarm signal\n");
caughtalarm++;
diff --git a/testcases/open_posix_testsuite/functional/timers/timers/twoptimers.c b/testcases/open_posix_testsuite/functional/timers/timers/twoptimers.c
index aa9a7f766..84bea3f0a 100644
--- a/testcases/open_posix_testsuite/functional/timers/timers/twoptimers.c
+++ b/testcases/open_posix_testsuite/functional/timers/timers/twoptimers.c
@@ -17,7 +17,8 @@
#include <unistd.h>
#include "posixtest.h"
-#define EXPIREDELTA 2
+#define EXPIREDELTA 3
+#define LONGTIME 5
#define CHILDPASS 1
@@ -50,10 +51,6 @@ int main(int argc, char *argv[])
return PTS_UNRESOLVED;
}
- if (sigprocmask(SIG_BLOCK, &set, NULL) == -1) {
- perror("sigprocmask() failed\n");
- return PTS_UNRESOLVED;
- }
ev.sigev_notify = SIGEV_SIGNAL;
ev.sigev_signo = SIGABRT;
if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) {
@@ -76,14 +73,10 @@ int main(int argc, char *argv[])
perror("sigwait() failed\n");
return PTS_UNRESOLVED;
}
+ printf("Got it! Child\n");
- if (sig == SIGABRT) {
- printf("Got it! Child\n");
- return CHILDPASS;
- }
-
- printf("Got another signal! Child\n");
- return PTS_FAIL;
+ sleep(LONGTIME);
+ return CHILDPASS;
} else {
/*parent */
struct sigevent ev;
@@ -104,11 +97,6 @@ int main(int argc, char *argv[])
return PTS_UNRESOLVED;
}
- if (sigprocmask(SIG_BLOCK, &set, NULL) == -1) {
- perror("sigaprocmask() failed\n");
- return PTS_UNRESOLVED;
- }
-
ev.sigev_notify = SIGEV_SIGNAL;
ev.sigev_signo = SIGALRM;
if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) {
@@ -131,13 +119,7 @@ int main(int argc, char *argv[])
perror("sigwait() failed\n");
return PTS_UNRESOLVED;
}
-
- if (sig != SIGALRM) {
- printf("Got another signal! Parent\n");
- return PTS_FAIL;
- }
-
- printf("Got it! Parent\n");
+ printf("Got it! Parent\n");
if (wait(&i) == -1) {
perror("Error waiting for child to exit\n");
diff --git a/testcases/open_posix_testsuite/include/noatime.h b/testcases/open_posix_testsuite/include/noatime.h
index 781267e4c..a9173765c 100644
--- a/testcases/open_posix_testsuite/include/noatime.h
+++ b/testcases/open_posix_testsuite/include/noatime.h
@@ -79,14 +79,14 @@ int mounted_noatime(const char *path)
struct statfs _statfs;
if (statfs(path, &_statfs) == -1) {
- printf("statfs for %s failed: %s\n", path, strerror(errno));
+ printf("statfs for %s failed: %s", path, strerror(errno));
return -1;
}
return (_statfs.f_flags & MNT_NOATIME);
}
#else
-int mounted_noatime(const char *path PTS_ATTRIBUTE_UNUSED)
+int mounted_noatime(const char *path LTP_ATTRIBUTE_UNUSED)
{
return 0;
}
diff --git a/testcases/open_posix_testsuite/include/posixtest.h b/testcases/open_posix_testsuite/include/posixtest.h
index 833488280..cf0952cbf 100644
--- a/testcases/open_posix_testsuite/include/posixtest.h
+++ b/testcases/open_posix_testsuite/include/posixtest.h
@@ -20,6 +20,6 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
-#define PTS_ATTRIBUTE_NORETURN __attribute__((noreturn))
-#define PTS_ATTRIBUTE_UNUSED __attribute__((unused))
-#define PTS_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
+#define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn))
+#define LTP_ATTRIBUTE_UNUSED __attribute__((unused))
+#define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
diff --git a/testcases/open_posix_testsuite/include/proc.h b/testcases/open_posix_testsuite/include/proc.h
index befb837fc..ac40729b4 100644
--- a/testcases/open_posix_testsuite/include/proc.h
+++ b/testcases/open_posix_testsuite/include/proc.h
@@ -58,8 +58,8 @@ int tst_process_state_wait3(pid_t pid, const char state,
return 1;
}
#else
-int tst_process_state_wait3(pid_t pid PTS_ATTRIBUTE_UNUSED,
- const char state PTS_ATTRIBUTE_UNUSED, long maxwait_s)
+int tst_process_state_wait3(pid_t pid LTP_ATTRIBUTE_UNUSED,
+ const char state LTP_ATTRIBUTE_UNUSED, long maxwait_s)
{
struct timespec maxwait_ts;
diff --git a/testcases/open_posix_testsuite/include/tempfile.h b/testcases/open_posix_testsuite/include/tempfile.h
deleted file mode 100644
index 0fd27cee3..000000000
--- a/testcases/open_posix_testsuite/include/tempfile.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2021 Joerg Vehlow <lkml@jv-coder.de>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-
-#define PTS_GET_TMP_FILENAME(target, prefix) \
- snprintf(target, sizeof(target), \
- "%s/" prefix "_pid-%d", pts_get_tmpdir(), getpid());
-
-static inline const char *pts_get_tmpdir(void)
-{
- const char *tmpdir_env;
- tmpdir_env = getenv("TMPDIR");
- return tmpdir_env ? tmpdir_env : "/tmp";
-}
diff --git a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
index 4b3aaa4a0..7b11c98bd 100755
--- a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
+++ b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
@@ -24,7 +24,7 @@ generate_locate_test_makefile() {
echo "Generating $maketype Makefiles"
- locate-test --$maketype | sed -e 's,^./,,g' | sort > make-gen.$maketype
+ locate-test --$maketype | sed -e 's,^./,,g' > make-gen.$maketype
generate_makefiles make-gen.$maketype $*
@@ -148,12 +148,8 @@ EOF
fi
- if [ ! -z "${tests}" ]; then
- cat >> "$makefile.2" <<EOF
-INSTALL_TARGETS+= ${tests}
-EOF
- fi
cat >> "$makefile.2" <<EOF
+INSTALL_TARGETS+= ${tests}
MAKE_TARGETS+= ${targets}
EOF
diff --git a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c
index e70d0a7e1..308a25bbc 100644
--- a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c
+++ b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c
@@ -35,7 +35,7 @@ typedef struct {
mqd_t mqID;
} mq_info;
-static int *msend(void *info)
+int *send(void *info)
{
int i;
@@ -57,7 +57,7 @@ static int *msend(void *info)
}
-static int *mreceive(void *info)
+int *receive(void *info)
{
int i;
char r_msg_ptr[MAX_MSG][MSG_SIZE];
@@ -120,8 +120,8 @@ int main(int argc, char *argv[])
for (i = 0; i < num; i++) {
info[i].ThreadID = i;
info[i].mqID = mq[i];
- pthread_create(&sed[i], NULL, (void *)msend, (void *)&info[i]);
- pthread_create(&rev[i], NULL, (void *)mreceive,
+ pthread_create(&sed[i], NULL, (void *)send, (void *)&info[i]);
+ pthread_create(&rev[i], NULL, (void *)receive,
(void *)&info[i]);
}
for (i = 0; i < num; i++) {
diff --git a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c
index 20ab88f97..def2bc451 100644
--- a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c
+++ b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c
@@ -30,12 +30,12 @@
#define MAX_MSG 5
#define Max_Threads 100
-static const char *s_msg_ptr[] =
+const char *s_msg_ptr[] =
{ "send_1 1", "send_1 2", "send_1 3", "send_1 4", "send_1 5" };
-static char r_msg_ptr[Max_Threads][MAX_MSG][MSG_SIZE];
-static mqd_t mq = 0;
+char r_msg_ptr[Max_Threads][MAX_MSG][MSG_SIZE];
+mqd_t mq = 0;
-static int *msend(void *ID)
+int *send(void *ID)
{
int i;
int ThreadID = *(int *)ID;
@@ -53,7 +53,7 @@ static int *msend(void *ID)
}
-static int *mreceive(void *ID)
+int *receive(void *ID)
{
int i;
int ThreadID = *(int *)ID;
@@ -106,9 +106,9 @@ int main(int argc, char *argv[])
for (i = 0; i < num; i++) {
ThreadID[i] = i;
- pthread_create(&sed[i], NULL, (void *)msend,
+ pthread_create(&sed[i], NULL, (void *)send,
(void *)&ThreadID[i]);
- pthread_create(&rev[i], NULL, (void *)mreceive,
+ pthread_create(&rev[i], NULL, (void *)receive,
(void *)&ThreadID[i]);
}
diff --git a/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c b/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c
index 850c1ef84..f986707d0 100644
--- a/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c
+++ b/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c
@@ -34,10 +34,10 @@ typedef struct {
sem_t lock;
} buf_t;
-static buf_t *buf;
-static int in, out;
+buf_t *buf;
+int in, out;
-static int *producer(void *ID)
+int *producer(void *ID)
{
int data;
int i;
@@ -103,7 +103,7 @@ static int *producer(void *ID)
pthread_exit(NULL);
}
-static int *consumer(void *ID)
+int *consumer(void *ID)
{
int data;
int ThreadID = *(int *)ID;
diff --git a/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c b/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c
index 7b98f4c92..344d1d337 100644
--- a/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c
@@ -97,10 +97,10 @@ typedef struct __mes_t {
} mes_t;
/* Forward declaration */
-static int parse_measure(mes_t * measures);
+int parse_measure(mes_t * measures);
-static sem_t *sem_synchro;
-static sem_t *sem_ending;
+sem_t *sem_synchro;
+sem_t *sem_ending;
int main(int argc, char *argv[])
{
@@ -397,7 +397,7 @@ int main(int argc, char *argv[])
* The function returns 0 when r1 is the best for all cases (latency is constant) and !0 otherwise.
*/
-static struct row {
+struct row {
long X; /* the X values -- copied from function argument */
long Y; /* the Y values -- copied from function argument */
long _x; /* Value X - Xavg */
@@ -408,7 +408,7 @@ static struct row {
double _lny; /* Value LnY - LnYavg */
};
-static int parse_measure(mes_t * measures)
+int parse_measure(mes_t * measures)
{
int ret, r;
diff --git a/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/helper.c b/testcases/open_posix_testsuite/stress/threads/helper.c
index a36d08f5e..a0a0f530d 100644
--- a/testcases/open_posix_testsuite/stress/threads/helper.c
+++ b/testcases/open_posix_testsuite/stress/threads/helper.c
@@ -56,15 +56,15 @@ done
#include <assert.h>
#include <time.h>
-static pid_t child;
-static int timeout;
+pid_t child;
+int timeout;
/* Note that there could be a race between
the moment the stress test terminates and
when the timeout expires. As this is highly
improbable, we don't care... */
-static void *timer(void *arg)
+void *timer(void *arg)
{
int ret = 0;
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
if (!WIFEXITED(status)) {
printf("The stress sample did not exit\n");
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c
index bfd549de2..67121469f 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c
@@ -75,10 +75,10 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static char do_it = 1;
+char do_it = 1;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
do {
do_it = 0;
@@ -86,10 +86,10 @@ static void sighdl(int sig)
while (do_it);
}
-static long long canceled, ended;
+long long canceled, ended;
/* The canceled thread */
-static void *th(void *arg)
+void *th(void *arg)
{
int ret = 0;
ret = pthread_barrier_wait(arg);
@@ -102,7 +102,7 @@ static void *th(void *arg)
}
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
pthread_t child;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c
index de2cc9a07..6a5c70a82 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/s-c.c
@@ -66,8 +66,6 @@
* Those may be used to output information.
*/
-#ifndef WITHOUT_XOPEN
-
/********************************************************************************************/
/********************************** Configuration ******************************************/
/********************************************************************************************/
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/stress.c
index e9e9c5779..9ab252a4c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/stress.c
@@ -73,12 +73,12 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static pthread_mutex_t cnt_mtx = PTHREAD_MUTEX_INITIALIZER;
-static unsigned long long cnt = 0;
+char do_it = 1;
+pthread_mutex_t cnt_mtx = PTHREAD_MUTEX_INITIALIZER;
+unsigned long long cnt = 0;
/******** Threads function *********/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int me = (int)arg;
pthread_cond_t cnd;
@@ -208,7 +208,7 @@ static void *threaded(void *arg)
}
/******** Signal handler ************/
-static void sighdl(int sig)
+void sighdl(int sig)
{
do {
do_it = 0;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c
index 38b8f8cfe..e8269bec8 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c
@@ -34,13 +34,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
@@ -50,7 +50,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c
index 3faab1743..2b012118d 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c
@@ -95,7 +95,7 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static long altclk_ok, pshared_ok;
+long altclk_ok, pshared_ok;
typedef struct {
pthread_cond_t *cnd;
@@ -104,7 +104,7 @@ typedef struct {
int *tnum;
} test_t;
-static struct {
+struct {
int mutex_type;
int pshared;
clockid_t cid;
@@ -168,7 +168,7 @@ static struct {
#define NSCENAR (sizeof(test_scenar) / sizeof(test_scenar[0]))
-static pthread_attr_t ta;
+pthread_attr_t ta;
/* The next structure is used to save the tests measures */
typedef struct __mes_t {
@@ -182,7 +182,7 @@ typedef struct __mes_t {
* Once the timedwait times out, it will read the clock cid then
* compute the difference and put it into ts.
* This function must be called once test is ready, as the timeout will be very short. */
-static void do_measure(pthread_mutex_t * mtx, pthread_cond_t * cnd, clockid_t cid,
+void do_measure(pthread_mutex_t * mtx, pthread_cond_t * cnd, clockid_t cid,
struct timespec *ts)
{
int ret, rc;
@@ -244,7 +244,7 @@ static void do_measure(pthread_mutex_t * mtx, pthread_cond_t * cnd, clockid_t ci
return;
}
-static void *waiter(void *arg)
+void *waiter(void *arg)
{
test_t *dt = (test_t *) arg;
@@ -287,7 +287,7 @@ static void *waiter(void *arg)
* < 0 if function was not able to create enough threads.
* cumulated # of nanoseconds otherwise.
*/
-static long do_threads_test(int nthreads, mes_t * measure)
+long do_threads_test(int nthreads, mes_t * measure)
{
int ret;
@@ -547,7 +547,7 @@ static long do_threads_test(int nthreads, mes_t * measure)
}
/* Forward declaration */
-static int parse_measure(mes_t * measures);
+int parse_measure(mes_t * measures);
/* Main
*/
@@ -669,7 +669,7 @@ int main(int argc, char *argv[])
* The function returns 0 when r1 is the best for all cases (latency is constant) and !0 otherwise.
*/
-static struct row {
+struct row {
long X; /* the X values -- copied from function argument */
long Y[NSCENAR]; /* the Y values -- copied from function argument */
long _x; /* Value X - Xavg */
@@ -680,7 +680,7 @@ static struct row {
double _lny[NSCENAR]; /* Value LnY - LnYavg */
};
-static int parse_measure(mes_t * measures)
+int parse_measure(mes_t * measures)
{
int ret, i, r;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c
index d25ec835d..197372bb8 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c
@@ -112,7 +112,7 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -196,7 +196,7 @@ static struct _scenar {
#define NTOT (NSCENAR * SCALABILITY_FACTOR * NCHILDREN)
-static struct childdata {
+struct childdata {
pthread_mutex_t mtx;
pthread_cond_t cnd;
clockid_t cid;
@@ -209,12 +209,12 @@ typedef struct {
int boolean;
} testdata_t;
-static pthread_attr_t ta;
+pthread_attr_t ta;
/***
* The grand child function (either sub-thread or sub-process)
*/
-static void *threaded_B(void *arg)
+void *threaded_B(void *arg)
{
int ret;
struct timespec ts;
@@ -265,7 +265,7 @@ static void *threaded_B(void *arg)
/***
* The child function (always in the main thread)
*/
-static void *threaded_A(void *arg)
+void *threaded_A(void *arg)
{
struct childdata *cd = (struct childdata *)arg;
int ret, status;
@@ -360,12 +360,12 @@ static void *threaded_A(void *arg)
return NULL;
}
-static int *pBoolean = NULL;
+int *pBoolean = NULL;
/***
* Signal handler
*/
-static void sighdl(int sig)
+void sighdl(int sig)
{
#if VERBOSE > 1
output("Received the USR1 signal; stopping everything\n");
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c
index 2b94974d9..d2bc38a9f 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c
@@ -88,7 +88,7 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -171,7 +171,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
/* This is the shared structure for all threads related to the same condvar */
-static struct celldata {
+struct celldata {
pthread_t workers[NCHILDREN * SCALABILITY_FACTOR + 2];
pthread_t signaler;
@@ -188,10 +188,10 @@ static struct celldata {
long cnttotal;
} cells[NSCENAR * SCALABILITY_FACTOR];
-static char do_it = 1;
-static pthread_attr_t ta;
+char do_it = 1;
+pthread_attr_t ta;
-static void cleanup(void *arg)
+void cleanup(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -204,7 +204,7 @@ static void cleanup(void *arg)
}
-static void *worker(void *arg)
+void *worker(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -263,7 +263,7 @@ static void *worker(void *arg)
return NULL;
}
-static void *signaler(void *arg)
+void *signaler(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -299,7 +299,7 @@ static void *signaler(void *arg)
return NULL;
}
-static void *cellmanager(void *arg)
+void *cellmanager(void *arg)
{
int ret, i;
struct celldata *cd = (struct celldata *)arg;
@@ -397,7 +397,7 @@ static void *cellmanager(void *arg)
return NULL;
}
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
do {
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c
index 38b8f8cfe..e8269bec8 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c
@@ -34,13 +34,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
@@ -50,7 +50,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c
index 90c2a56fa..7dfaa171c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c
@@ -97,7 +97,7 @@
#endif
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -180,7 +180,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
/* This is the shared structure for all threads related to the same condvar */
-static struct celldata {
+struct celldata {
pthread_t workers[NCHILDREN * SCALABILITY_FACTOR + 2];
pthread_t signaler;
@@ -197,10 +197,10 @@ static struct celldata {
long cnttotal;
} cells[NSCENAR * SCALABILITY_FACTOR];
-static char do_it = 1;
-static pthread_attr_t ta;
+char do_it = 1;
+pthread_attr_t ta;
-static void cleanup(void *arg)
+void cleanup(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -213,7 +213,7 @@ static void cleanup(void *arg)
}
-static void *worker(void *arg)
+void *worker(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -272,7 +272,7 @@ static void *worker(void *arg)
return NULL;
}
-static void *signaler(void *arg)
+void *signaler(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -308,7 +308,7 @@ static void *signaler(void *arg)
return NULL;
}
-static void *cellmanager(void *arg)
+void *cellmanager(void *arg)
{
int ret, i;
struct celldata *cd = (struct celldata *)arg;
@@ -406,7 +406,7 @@ static void *cellmanager(void *arg)
return NULL;
}
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
do {
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c
index aa8227fc5..e453c753c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c
@@ -122,7 +122,7 @@
#endif
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -206,7 +206,7 @@ static struct _scenar {
#define NTOT (NSCENAR * SCALABILITY_FACTOR * NCHILDREN)
-static struct childdata {
+struct childdata {
pthread_mutex_t mtx;
pthread_cond_t cnd;
int fork;
@@ -218,12 +218,12 @@ typedef struct {
int boolean;
} testdata_t;
-static pthread_attr_t ta;
+pthread_attr_t ta;
/***
* The grand child function (either sub-thread or sub-process)
*/
-static void *threaded_B(void *arg)
+void *threaded_B(void *arg)
{
int ret;
struct childdata *cd = (struct childdata *)arg;
@@ -264,7 +264,7 @@ static void *threaded_B(void *arg)
/***
* The child function (always in the main process)
*/
-static void *threaded_A(void *arg)
+void *threaded_A(void *arg)
{
struct childdata *cd = (struct childdata *)arg;
int ret, status;
@@ -348,12 +348,12 @@ static void *threaded_A(void *arg)
return NULL;
}
-static int *pBoolean = NULL;
+int *pBoolean = NULL;
/***
* Signal handler
*/
-static void sighdl(int sig)
+void sighdl(int sig)
{
if (sig == SIGUSR1) {
#if VERBOSE > 1
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c
index 90c2a56fa..7dfaa171c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c
@@ -97,7 +97,7 @@
#endif
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int mc_pshared; /* 0: mutex and cond are process-private (default) ~ !0: Both are process-shared, if supported */
int c_clock; /* 0: cond uses the default clock. ~ !0: Cond uses monotonic clock, if supported. */
@@ -180,7 +180,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
/* This is the shared structure for all threads related to the same condvar */
-static struct celldata {
+struct celldata {
pthread_t workers[NCHILDREN * SCALABILITY_FACTOR + 2];
pthread_t signaler;
@@ -197,10 +197,10 @@ static struct celldata {
long cnttotal;
} cells[NSCENAR * SCALABILITY_FACTOR];
-static char do_it = 1;
-static pthread_attr_t ta;
+char do_it = 1;
+pthread_attr_t ta;
-static void cleanup(void *arg)
+void cleanup(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -213,7 +213,7 @@ static void cleanup(void *arg)
}
-static void *worker(void *arg)
+void *worker(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -272,7 +272,7 @@ static void *worker(void *arg)
return NULL;
}
-static void *signaler(void *arg)
+void *signaler(void *arg)
{
int ret;
struct celldata *cd = (struct celldata *)arg;
@@ -308,7 +308,7 @@ static void *signaler(void *arg)
return NULL;
}
-static void *cellmanager(void *arg)
+void *cellmanager(void *arg)
{
int ret, i;
struct celldata *cd = (struct celldata *)arg;
@@ -406,7 +406,7 @@ static void *cellmanager(void *arg)
return NULL;
}
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
do {
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c b/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c
index c8e40e5fa..46235c53e 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c
@@ -107,11 +107,11 @@ typedef struct __mes_t {
} mes_t;
/* Forward declaration */
-static int parse_measure(mes_t * measures);
+int parse_measure(mes_t * measures);
-static pthread_mutex_t m_synchro = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t m_synchro = PTHREAD_MUTEX_INITIALIZER;
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
@@ -445,7 +445,7 @@ int main(int argc, char *argv[])
* The function returns 0 when r1 is the best for all cases (latency is constant) and !0 otherwise.
*/
-static struct row {
+struct row {
long X; /* the X values -- copied from function argument */
long Y[NSCENAR]; /* the Y values -- copied from function argument */
long _x[NSCENAR]; /* Value X - Xavg */
@@ -456,7 +456,7 @@ static struct row {
double _lny[NSCENAR]; /* Value LnY - LnYavg */
};
-static int parse_measure(mes_t * measures)
+int parse_measure(mes_t * measures)
{
int ret, i, r;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c b/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c
index a1f19dd92..0a8c6ea31 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c
@@ -23,7 +23,7 @@
*
*/
-static struct __scenario {
+struct __scenario {
/* Object to hold the given configuration, and which will be used to create the threads */
pthread_attr_t ta;
/* General parameters */
@@ -138,7 +138,7 @@ static struct __scenario {
#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0]))
/* This function will initialize every pthread_attr_t object in the scenarii array */
-static void scenar_init()
+void scenar_init()
{
int ret = 0;
int i;
@@ -416,7 +416,7 @@ static void scenar_init()
}
/* This function will free all resources consumed in the scenar_init() routine */
-static void scenar_fini(void)
+void scenar_fini(void)
{
int ret = 0, i;
@@ -437,7 +437,7 @@ static void scenar_fini(void)
}
}
-static int sc = 0; /* This might be very dirty... but is much simpler */
+int sc = 0; /* This might be very dirty... but is much simpler */
#ifdef STD_MAIN /* We want main to be defined here */
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_exit/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_exit/stress.c
index d0f1a5a7b..7905573a4 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_exit/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_exit/stress.c
@@ -93,11 +93,11 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static long long iterations = 0;
+char do_it = 1;
+long long iterations = 0;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
do {
@@ -107,7 +107,7 @@ static void sighdl(int sig)
}
/* Cleanup handler to make sure the thread is exiting */
-static void cleanup(void *arg)
+void cleanup(void *arg)
{
int ret = 0;
sem_t *sem = (sem_t *) arg;
@@ -123,7 +123,7 @@ static void cleanup(void *arg)
}
/* Thread routine */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
pthread_cleanup_push(cleanup, &scenarii[sc].sem);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c b/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c
index a1f19dd92..0a8c6ea31 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c
@@ -23,7 +23,7 @@
*
*/
-static struct __scenario {
+struct __scenario {
/* Object to hold the given configuration, and which will be used to create the threads */
pthread_attr_t ta;
/* General parameters */
@@ -138,7 +138,7 @@ static struct __scenario {
#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0]))
/* This function will initialize every pthread_attr_t object in the scenarii array */
-static void scenar_init()
+void scenar_init()
{
int ret = 0;
int i;
@@ -416,7 +416,7 @@ static void scenar_init()
}
/* This function will free all resources consumed in the scenar_init() routine */
-static void scenar_fini(void)
+void scenar_fini(void)
{
int ret = 0, i;
@@ -437,7 +437,7 @@ static void scenar_fini(void)
}
}
-static int sc = 0; /* This might be very dirty... but is much simpler */
+int sc = 0; /* This might be very dirty... but is much simpler */
#ifdef STD_MAIN /* We want main to be defined here */
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c
index b5f359d73..248f37e30 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c
@@ -76,11 +76,11 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static long long iterations = 0;
+char do_it = 1;
+long long iterations = 0;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
do {
do_it = 0;
@@ -94,10 +94,10 @@ typedef struct _tdata {
pthread_t thread;
} testdata_t;
-static testdata_t td[4];
+testdata_t td[4];
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
int i = 0;
@@ -131,7 +131,7 @@ static void *threaded(void *arg)
}
/* alternative policy threads */
-static void *rt_thread(void *arg)
+void *rt_thread(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c
index 631174b34..b9d575e26 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c
@@ -74,11 +74,11 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static long long iterations = 0;
+char do_it = 1;
+long long iterations = 0;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
@@ -88,14 +88,14 @@ static void sighdl(int sig)
while (do_it);
}
-static void floodsighdl(int sig)
+void floodsighdl(int sig)
{
/* Nothing to do */
return;
}
/* Signals flood receiver thread */
-static void *flood_receiver(void *arg)
+void *flood_receiver(void *arg)
{
int ret = 0;
/* register the signal handler for this one thread */
@@ -123,7 +123,7 @@ static void *flood_receiver(void *arg)
}
/* Signal flood threads */
-static void *flooder_1(void *arg)
+void *flooder_1(void *arg)
{
int ret = 0;
@@ -139,7 +139,7 @@ static void *flooder_1(void *arg)
return NULL;
}
-static void *flooder_2(void *arg)
+void *flooder_2(void *arg)
{
int ret = 0;
@@ -156,15 +156,15 @@ static void *flooder_2(void *arg)
}
/* Synchronized threads */
-static int sync;
-static void syncsighdl(int sig)
+int sync;
+void syncsighdl(int sig)
{
/* signal we have been called */
sync = 1;
return;
}
-static void *sync_rec(void *arg)
+void *sync_rec(void *arg)
{
int ret = 0;
@@ -185,7 +185,7 @@ static void *sync_rec(void *arg)
return NULL;
}
-static void *sync_send(void *arg)
+void *sync_send(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/s-c.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/s-c.c
index d5c5ac1b1..04ccca949 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/s-c.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/s-c.c
@@ -90,13 +90,12 @@ typedef struct _teststruct {
struct _teststruct *prev;
} teststruct_t;
-static int types[] = { PTHREAD_MUTEX_NORMAL,
+int types[] = { PTHREAD_MUTEX_NORMAL,
PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT
};
-#ifndef WITHOUT_XOPEN
int main(int argc, char *argv[])
{
struct rlimit rl;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/stress.c
index 6c3a15704..bdf94be69 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/stress.c
@@ -71,9 +71,9 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
+char do_it = 1;
#ifndef WITHOUT_XOPEN
-static int types[] = { PTHREAD_MUTEX_NORMAL,
+int types[] = { PTHREAD_MUTEX_NORMAL,
PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT
@@ -81,7 +81,7 @@ static int types[] = { PTHREAD_MUTEX_NORMAL,
#endif
/******** Threads function *********/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int me = (int)arg;
pthread_mutex_t mtx;
@@ -159,7 +159,7 @@ static void *threaded(void *arg)
}
/******** Signal handler ************/
-static void sighdl(int sig)
+void sighdl(int sig)
{
do {
do_it = 0;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c
index 38b8f8cfe..e8269bec8 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c
@@ -34,13 +34,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
@@ -50,7 +50,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c1.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c1.c
index d6c750102..0c52e4b21 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c1.c
@@ -78,7 +78,7 @@
/********************************************************************************************/
#ifndef WITHOUT_XOPEN
-static int types[] = {
+int types[] = {
PTHREAD_MUTEX_NORMAL,
PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE,
@@ -87,21 +87,21 @@ static int types[] = {
#endif
/* The mutex the threads will block on */
-static pthread_mutex_t mtx[5];
+pthread_mutex_t mtx[5];
/* The condition used to signal the main thread to go to the next step */
-static pthread_cond_t cnd;
-static pthread_mutex_t m;
+pthread_cond_t cnd;
+pthread_mutex_t m;
/* The shared data used to control the results of the test */
-static unsigned long nbthOK[5];
-static unsigned long nbthNOK[5];
-static unsigned long nbthTOT;
+unsigned long nbthOK[5];
+unsigned long nbthNOK[5];
+unsigned long nbthTOT;
/*****
*
*/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret;
int i;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c2.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c2.c
index 0593d0c34..4e077383e 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c2.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/s-c2.c
@@ -87,7 +87,7 @@
/********************************************************************************************/
#ifndef WITHOUT_XOPEN
-static int types[] = {
+int types[] = {
PTHREAD_MUTEX_NORMAL,
PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE,
@@ -96,17 +96,17 @@ static int types[] = {
#endif
/* The condition used to signal the main thread to go to the next step */
-static pthread_cond_t cnd;
-static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
-static char do_it;
-static unsigned long counter;
+pthread_cond_t cnd;
+pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+char do_it;
+unsigned long counter;
/* Mutex attribute objects and pointers */
-static pthread_mutexattr_t *pma[6];
+pthread_mutexattr_t *pma[6];
#ifdef WITHOUT_XOPEN
-static pthread_mutexattr_t ma[1];
+pthread_mutexattr_t ma[1];
#else
-static pthread_mutexattr_t ma[5];
+pthread_mutexattr_t ma[5];
#endif
/* Test data type */
@@ -119,12 +119,12 @@ typedef struct _td {
} testdata_t;
/* Thread attribute object */
-static pthread_attr_t ta;
+pthread_attr_t ta;
/*****
* Level 2 - grandchild function
*/
-static void *sub(void *arg)
+void *sub(void *arg)
{
testdata_t *td = (testdata_t *) arg;
td->error = pthread_mutex_lock(&(td->mtx));
@@ -146,7 +146,7 @@ static void *sub(void *arg)
/*****
* Level 1 - child function
*/
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
testdata_t *td = (testdata_t *) arg;
int ret;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/stress.c
index 42c7fbfae..187568f78 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/stress.c
@@ -102,9 +102,9 @@
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
+char do_it = 1;
#ifndef WITHOUT_XOPEN
-static int types[] = { PTHREAD_MUTEX_NORMAL,
+int types[] = { PTHREAD_MUTEX_NORMAL,
PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT
@@ -125,11 +125,11 @@ typedef struct {
unsigned long long sigcnt, opcnt; /* We count every iteration */
} cell_t;
-static pthread_key_t _c; /* this key will always contain a pointer to the thread's cell */
+pthread_key_t _c; /* this key will always contain a pointer to the thread's cell */
/***** The next function is in charge of sending signal USR2 to
* all the other threads in its cell, until the end of the test. */
-static void *sigthr(void *arg)
+void *sigthr(void *arg)
{
int ret;
int i = 0;
@@ -178,7 +178,7 @@ static void *sigthr(void *arg)
/***** The next function is the signal handler
* for all the others threads in the cell */
-static void sighdl(int sig)
+void sighdl(int sig)
{
int ret;
cell_t *c = (cell_t *) pthread_getspecific(_c);
@@ -190,7 +190,7 @@ static void sighdl(int sig)
/***** The next function can return only when the sigthr has terminated.
* This avoids the signal thread try to kill a terminated thread. */
-static void waitsigend(cell_t * c)
+void waitsigend(cell_t * c)
{
while (c->sigok == 0) {
sched_yield();
@@ -199,7 +199,7 @@ static void waitsigend(cell_t * c)
/***** The next function aims to control that no other thread
* owns the mutex at the same time */
-static void control(cell_t * c, char *loc)
+void control(cell_t * c, char *loc)
{
*loc++; /* change the local control value */
if (c->ctrl != 0) {
@@ -222,7 +222,7 @@ static void control(cell_t * c, char *loc)
/***** The next 3 functions are the worker threads
*/
-static void *lockthr(void *arg)
+void *lockthr(void *arg)
{
int ret;
char loc; /* Local value for control */
@@ -269,7 +269,7 @@ static void *lockthr(void *arg)
return NULL;
}
-static void *timedlockthr(void *arg)
+void *timedlockthr(void *arg)
{
int ret;
char loc; /* Local value for control */
@@ -326,7 +326,7 @@ static void *timedlockthr(void *arg)
return NULL;
}
-static void *trylockthr(void *arg)
+void *trylockthr(void *arg)
{
int ret;
char loc; /* Local value for control */
@@ -378,7 +378,7 @@ static void *trylockthr(void *arg)
/***** The next function initializes a cell_t object
* This includes running the threads */
-static void cell_init(int id, cell_t * c, pthread_mutexattr_t * pma)
+void cell_init(int id, cell_t * c, pthread_mutexattr_t * pma)
{
int ret, i;
pthread_attr_t pa; /* We will specify a minimal stack size */
@@ -479,7 +479,7 @@ static void cell_init(int id, cell_t * c, pthread_mutexattr_t * pma)
/***** The next function destroys a cell_t object
* This includes stopping the threads */
-static void cell_fini(int id,
+void cell_fini(int id,
cell_t * c,
unsigned long long *globalopcount,
unsigned long long *globalsigcount)
@@ -528,7 +528,7 @@ static void cell_fini(int id,
/**** Next function is called when the process is killed with SIGUSR1
* It tells every threads in every cells to stop their work.
*/
-static void globalsig(int sig)
+void globalsig(int sig)
{
output("Signal received, processing. Please wait...\n");
do {
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c
index 38b8f8cfe..e8269bec8 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c
@@ -34,13 +34,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
@@ -50,7 +50,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/stress.c
index a7311da97..e23e20ba0 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/stress.c
@@ -93,10 +93,10 @@
/*********************************** Test case *****************************************/
/********************************************************************************************/
-static char do_it = 1;
+char do_it = 1;
/* Signal handler which will stop the stress run */
-static void sighdl(int sig)
+void sighdl(int sig)
{
do {
do_it = 0;
@@ -105,7 +105,7 @@ static void sighdl(int sig)
}
/* Timeout thread */
-static void *timer(void *arg)
+void *timer(void *arg)
{
unsigned int to = TIMEOUT;
do {
@@ -118,14 +118,14 @@ static void *timer(void *arg)
}
/* Test specific data */
-static char go_on = 0;
+char go_on = 0;
typedef struct {
pthread_mutex_t *mtx;
pthread_barrier_t *bar;
} testdata_t;
-static struct _scenar {
+struct _scenar {
int m_type; /* Mutex type to use */
int m_pshared; /* 0: mutex is process-private (default) ~ !0: mutex is process-shared, if supported */
char *descr; /* Case description */
@@ -155,7 +155,7 @@ static struct _scenar {
#define NSCENAR (sizeof(scenarii)/sizeof(scenarii[0]))
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0, ret2 = 0;
testdata_t *td = (testdata_t *) arg;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c
index a9a48bcc3..9a693bfd3 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c
@@ -75,11 +75,11 @@
/*********************************** Test cases *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static long long iterations = 0;
+char do_it = 1;
+long long iterations = 0;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
do {
do_it = 0;
@@ -87,11 +87,11 @@ static void sighdl(int sig)
while (do_it);
}
-static pthread_once_t once_ctl;
-static int once_chk;
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+pthread_once_t once_ctl;
+int once_chk;
+pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-static void init_routine(void)
+void init_routine(void)
{
int ret = 0;
ret = pthread_mutex_lock(&mtx);
@@ -112,7 +112,7 @@ static void init_routine(void)
}
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_self/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_self/stress.c
index 5aee8d197..1767040c0 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_self/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_self/stress.c
@@ -86,11 +86,11 @@
/*********************************** Real Test *****************************************/
/********************************************************************************************/
-static char do_it = 1;
-static long long iterations = 0;
+char do_it = 1;
+long long iterations = 0;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
do {
@@ -100,17 +100,17 @@ static void sighdl(int sig)
}
/* Protect concurrent access to the shared data */
-static pthread_mutex_t m_synchro = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t m_synchro = PTHREAD_MUTEX_INITIALIZER;
/* Signaled when all threads are running */
-static pthread_cond_t c_synchro = PTHREAD_COND_INITIALIZER;
-static int c_boolean;
+pthread_cond_t c_synchro = PTHREAD_COND_INITIALIZER;
+int c_boolean;
/* Thread ID returned by pthread_self */
-static pthread_t running[NSCENAR];
+pthread_t running[NSCENAR];
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
int me = *(int *)arg;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c b/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c
index 519215a32..0c2744421 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c
@@ -23,7 +23,7 @@
*
*/
-static struct __scenario {
+struct __scenario {
/* Object to hold the given configuration, and which will be used to create the threads */
pthread_attr_t ta;
/* General parameters */
@@ -205,7 +205,7 @@ static struct __scenario {
#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0]))
/* This function will initialize every pthread_attr_t object in the scenarii array */
-static void scenar_init()
+void scenar_init()
{
int ret = 0;
int i;
@@ -483,7 +483,7 @@ static void scenar_init()
}
/* This function will free all resources consumed in the scenar_init() routine */
-static void scenar_fini(void)
+void scenar_fini(void)
{
int ret = 0, i;
@@ -504,7 +504,7 @@ static void scenar_fini(void)
}
}
-static int sc = 0; /* This might be very dirty... but is much simpler */
+int sc = 0; /* This might be very dirty... but is much simpler */
#ifdef STD_MAIN /* We want main to be defined here */
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c
index 3099f0a1f..1a6068e06 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c
@@ -67,11 +67,11 @@
#define INIT_VAL 0
-static char do_it = 1;
-static long long iterations = 0;
+char do_it = 1;
+long long iterations = 0;
/* Handler for user request to terminate */
-static void sighdl(int sig)
+void sighdl(int sig)
{
/* do_it = 0 */
@@ -81,7 +81,7 @@ static void sighdl(int sig)
}
/* Thread function */
-static void *threaded(void *arg)
+void *threaded(void *arg)
{
int ret = 0;
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c b/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c
index 792bfd9ee..4a5d9d851 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c
@@ -99,7 +99,7 @@ typedef struct __mes_t {
} mes_t;
/* Forward declaration */
-static int parse_measure(mes_t * measures);
+int parse_measure(mes_t * measures);
/* Structure to store created semaphores */
@@ -372,7 +372,6 @@ int main(int argc, char *argv[])
PASSED;
}
-}
/***
* The next function will seek for the better model for each series of measurements.
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c b/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
index 14ad4ea2c..7a20b187e 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
@@ -98,7 +98,7 @@ typedef struct __mes_t {
} mes_t;
/* Forward declaration */
-static int parse_measure(mes_t * measures);
+int parse_measure(mes_t * measures);
/* Structure to store created semaphores */
@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
* The function returns 0 when r1 is the best for all cases (latency is constant) and !0 otherwise.
*/
-static struct row {
+struct row {
long X; /* the X values -- copied from function argument */
long Y_o; /* the Y values -- copied from function argument */
long Y_c; /* the Y values -- copied from function argument */
@@ -414,7 +414,7 @@ static struct row {
double _lny_c; /* Value LnY - LnYavg */
};
-static int parse_measure(mes_t * measures)
+int parse_measure(mes_t * measures)
{
int ret, r;
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c
index ce3cbb473..97a1c3ddf 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c
@@ -37,13 +37,13 @@ static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************************/
/* The following functions will output to stdout */
#if (1)
-static void output_init()
+void output_init()
{
/* do nothing */
return;
}
-static void output(char *string, ...)
+void output(char *string, ...)
{
va_list ap;
char *ts = "[??:??:??]";
@@ -56,7 +56,7 @@ static void output(char *string, ...)
if (now == NULL)
printf(ts);
else
- printf("[%2.2d:%2.2d:%2.2d]\n", now->tm_hour, now->tm_min,
+ printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min,
now->tm_sec);
va_start(ap, string);
vprintf(string, ap);
@@ -64,7 +64,7 @@ static void output(char *string, ...)
pthread_mutex_unlock(&m_trace);
}
-static void output_fini()
+void output_fini()
{
/*do nothing */
return;
diff --git a/testcases/open_posix_testsuite/tools/t0.c b/testcases/open_posix_testsuite/tools/t0.c
index 1c40b2581..0581220d9 100644
--- a/testcases/open_posix_testsuite/tools/t0.c
+++ b/testcases/open_posix_testsuite/tools/t0.c
@@ -43,9 +43,9 @@
#include <string.h>
#include <unistd.h>
-static pid_t pid_to_monitor;
+pid_t pid_to_monitor;
-static void sighandler(int sig)
+void sighandler(int sig)
{
if (0 < pid_to_monitor) {
if (kill(pid_to_monitor, SIGKILL) == -1) {
diff --git a/testcases/realtime/configure.ac b/testcases/realtime/configure.ac
index e483caf0d..3956773d3 100644
--- a/testcases/realtime/configure.ac
+++ b/testcases/realtime/configure.ac
@@ -9,6 +9,8 @@ AC_CONFIG_FILES([ \
AC_CHECK_HEADERS_ONCE([ \
pthread.h \
])
+AM_CONDITIONAL(CROSS_COMPILATION, test x$cross_compiling = xyes)
+
AC_CANONICAL_HOST
AC_PROG_CC
@@ -36,6 +38,7 @@ else
fi
REALTIME_CHECK_PRIO_INHERIT
+REALTIME_CHECK_ROBUST_APIS
LTP_CHECK_EXP10
diff --git a/testcases/realtime/func/pi-tests/parse-testpi2.py b/testcases/realtime/func/pi-tests/parse-testpi2.py
index a4558437f..69b2748f0 100644
--- a/testcases/realtime/func/pi-tests/parse-testpi2.py
+++ b/testcases/realtime/func/pi-tests/parse-testpi2.py
@@ -49,8 +49,10 @@ class TestPi2(Log):
flag=True
elif count == 0:
return False
- prev_line=line
+
+
+ prev_line=line
if count>=2:
return True
else:
diff --git a/testcases/realtime/func/pi-tests/sbrk_mutex.c b/testcases/realtime/func/pi-tests/sbrk_mutex.c
index 7ed7969d9..c0431d7da 100644
--- a/testcases/realtime/func/pi-tests/sbrk_mutex.c
+++ b/testcases/realtime/func/pi-tests/sbrk_mutex.c
@@ -45,6 +45,8 @@
#include <unistd.h>
#include "librttest.h"
+#if HAS_PTHREAD_MUTEXTATTR_ROBUST_APIS
+
#define NUM_MUTEXES 5000
#define NUM_THREADS 50
#define NUM_CONCURRENT_LOCKS 50
@@ -148,3 +150,12 @@ int main(int argc, char *argv[])
return 0;
}
+
+#else
+int main(void)
+{
+ printf
+ ("Your system doesn't support the pthread robust mutexattr APIs\n");
+ return 1;
+}
+#endif
diff --git a/testcases/realtime/func/pi-tests/testpi-6.c b/testcases/realtime/func/pi-tests/testpi-6.c
index 637d38355..96321f622 100644
--- a/testcases/realtime/func/pi-tests/testpi-6.c
+++ b/testcases/realtime/func/pi-tests/testpi-6.c
@@ -41,6 +41,7 @@
#include <unistd.h>
#include <librttest.h>
+#if HAS_PTHREAD_MUTEXTATTR_ROBUST_APIS
pthread_mutex_t child_mutex;
void *child_thread(void *arg)
@@ -91,5 +92,12 @@ int do_test(int argc, char **argv)
return 0;
}
+#else
+int do_test(int argc, char **argv)
+{
+ printf("Your system doesn't have robust pthread mutex support\n");
+ return 1;
+}
+#endif
#include "test-skeleton.c"
diff --git a/testcases/realtime/include/librttest.h b/testcases/realtime/include/librttest.h
index b829f4089..c18236200 100644
--- a/testcases/realtime/include/librttest.h
+++ b/testcases/realtime/include/librttest.h
@@ -66,6 +66,7 @@ extern char *optarg;
#define _MAXTHREADS 256
#define CALIBRATE_LOOPS 100000
+unsigned long iters_per_us;
#define NS_PER_MS 1000000
#define NS_PER_US 1000
diff --git a/testcases/realtime/lib/Makefile b/testcases/realtime/lib/Makefile
index 0efe4ca62..2986938ff 100644
--- a/testcases/realtime/lib/Makefile
+++ b/testcases/realtime/lib/Makefile
@@ -31,6 +31,6 @@ CFLAGS += -D_GNU_SOURCE\
LDLIBS += -lpthread -lrt -lm
-INTERNAL_LIB := librealtime.a
+LIB := librealtime.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/testcases/realtime/lib/librttest.c b/testcases/realtime/lib/librttest.c
index 722d99d50..36790581e 100644
--- a/testcases/realtime/lib/librttest.c
+++ b/testcases/realtime/lib/librttest.c
@@ -63,7 +63,6 @@
static LIST_HEAD(_threads);
static atomic_t _thread_count = { -1 };
-static unsigned long iters_per_us;
pthread_mutex_t _buffer_mutex;
char *_print_buffer = NULL;
diff --git a/testcases/realtime/m4/check.m4 b/testcases/realtime/m4/check.m4
index e60ae1928..5aa53bd42 100644
--- a/testcases/realtime/m4/check.m4
+++ b/testcases/realtime/m4/check.m4
@@ -12,3 +12,13 @@ else
AC_MSG_RESULT(no)
fi
])
+
+AC_DEFUN([REALTIME_CHECK_ROBUST_APIS],[
+ AC_CHECK_DECLS([pthread_mutexattr_getrobust, pthread_mutexattr_setrobust],[],[has_robust="no"],[[#include <pthread.h>]])
+ AC_MSG_CHECKING([for pthread_mutexattr_*robust* APIs])
+if test "x$has_robust" != "xno"; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+])
diff --git a/testcases/realtime/scripts/parser.py b/testcases/realtime/scripts/parser.py
index 2acbe7d67..85226deb6 100644
--- a/testcases/realtime/scripts/parser.py
+++ b/testcases/realtime/scripts/parser.py
@@ -33,15 +33,15 @@ class Log:
def __init__(self,filename):
if filename:
log_file=filename
- try:
- self.__log_file = open(log_file, "r")
- except IOError as errmsg:
- sys.exit(errmsg)
+ try:
+ self.__log_file = open(log_file, "r")
+ except IOError as errmsg:
+ sys.exit(errmsg)
def read(self):
for line in self.__log_file.read().split("\n"):
yield line
- self.__log_file.close()
+ self.__log_file.close()
def eval(self):
pass
diff --git a/testscripts/exportfs.sh b/testscripts/exportfs.sh
new file mode 100755
index 000000000..8afe017d8
--- /dev/null
+++ b/testscripts/exportfs.sh
@@ -0,0 +1,208 @@
+#!/bin/bash
+
+
+##############################################################
+#
+# Copyright (c) International Business Machines Corp., 2003
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+# the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# FILE : exportfs.sh
+# USAGE : exportfs.sh -h <nfs_server> -d <nfs_server_disk_partition>
+# -t <server_fs_type>
+#
+# DESCRIPTION : A script that will test exportfs on Linux system.
+# REQUIREMENTS:
+# 1) NFS Server system with rsh enabled between client & server.
+# 2) 100MB Disk partition on NFS server.
+#
+# HISTORY :
+# 06/18/2003 Prakash Narayana (prakashn@us.ibm.com)
+#
+# CODE COVERAGE: 7.1% - fs/exportfs (Total Coverage)
+# 7.1% - fs/exportfs/expfs.c
+#
+##############################################################
+
+
+NFS_SERVER=""
+REM_DISK_PART=""
+FS_TYPE=""
+MNT_POINT="/tmp/exportfs_$$"
+
+USAGE="$0 -h <nfs_server> -d <nfs_server_disk_partition> -t <server_fs_type>"
+
+
+##############################################################
+#
+# Make sure that uid=root is running this script.
+# Validate the command line arguments.
+# Make sure that NFS Server is up with rsh is enabled.
+# Make sure that FS_TYPE package has been installed on NFS Server side.
+# Make sure that FS_TYPE module is built into the kernel or loaded
+# on NFS Server side.
+#
+##############################################################
+
+if [ $UID != 0 ]
+then
+ echo "FAILED: Must have root access to execute this script"
+ exit 1
+fi
+
+while getopts h:d:t: args
+do
+ case $args in
+ h) NFS_SERVER=$OPTARG ;;
+ d) REM_DISK_PART=$OPTARG ;;
+ t) FS_TYPE=$OPTARG ;;
+ \?) echo $USAGE ; exit 1 ;;
+ esac
+done
+
+if [ -z "$NFS_SERVER" ]
+then
+ echo $USAGE
+ echo "FAILED: NFS Server not specificed"
+ exit 1
+fi
+
+if [ -z "$REM_DISK_PART" ]
+then
+ echo $USAGE
+ echo "FAILED: NFS Server disk partition not specified"
+ exit 1
+fi
+
+if [ -z "$FS_TYPE" ]
+then
+ echo $USAGE
+ echo "FAILED: NFS Server file system type not specified"
+ exit 1
+fi
+
+#
+# How to check if it a valid block special device on NFS Server ???
+# Add code here.
+
+
+ping -c 2 -w 15 $NFS_SERVER >/dev/null 2>&1
+if [ $? != 0 ]
+then
+ echo "FAILED: ping $NFS_SERVER failed"
+ exit 1
+fi
+
+rsh -n -l root $NFS_SERVER "ls -l /etc" >/dev/null 2>&1
+if [ $? != 0 ]
+then
+ echo "FAILED: rsh -n -l root $NFS_SERVER "ls -l /etc" failed"
+ exit 1
+fi
+
+rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE >/dev/null 2>&1
+if [ $? != 0 ]
+then
+ rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
+ if [ $? != 0 ]
+ then
+ rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
+ if [ $? != 0 ]
+ then
+ echo "FAILED: $FS_TYPE package is not installed or loaded on $NFS_SERVER"
+ exit 1
+ fi
+ fi
+fi
+
+if [ "$FS_TYPE" = "reiserfs" ]
+then
+# rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
+ rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 >/dev/null 2>&1"
+ echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
+else
+# rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART >/dev/null 2>&1"
+ QUIETFLAG=
+ if [ "$FS_TYPE" = "jfs" ]
+ then
+ QUIETFLAG="-q"
+ fi
+ rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART >/dev/null 2>&1"
+ if [ $? != 0 ]
+ then
+ echo "FAILED: Could not /sbin/mkfs -t $FS_TYPE $REM_DISK_PART on $NFS_SERVER"
+ exit 1
+ fi
+fi
+
+rsh -n -l root $NFS_SERVER "mkdir -p -m 777 $MNT_POINT"
+if [ $? != 0 ]
+then
+ echo "FAILED: Could not mkdir -p -m 777 $MNT_POINT on $NFS_SERVER"
+ exit 1
+fi
+
+rsh -n -l root $NFS_SERVER "mount -t $FS_TYPE $REM_DISK_PART $MNT_POINT"
+if [ $? != 0 ]
+then
+ echo "FAILED: Could not mount -t $FS_TYPE $REM_DISK_PART on $MNT_POINT"
+ exit 1
+fi
+
+rsh -n -l root $NFS_SERVER "chmod 777 $MNT_POINT"
+if [ $? != 0 ]
+then
+ echo "FAILED: Could not chmod 777 $MNT_POINT on $NFS_SERVER"
+ exit 1
+fi
+
+rsh -n -l root $NFS_SERVER "/usr/sbin/exportfs -i -o no_root_squash,rw *:$MNT_POINT"
+if [ $? != 0 ]
+then
+ rsh -n -l root $NFS_SERVER "umount $MNT_POINT"
+ rsh -n -l root $NFS_SERVER "rm -rf $MNT_POINT"
+ echo "FAILED: Could not export remote directory $MNT_POINT"
+ exit 1
+fi
+sleep 15
+
+# Here is the code coverage for fs/exportfs
+#
+mkdir -p -m 777 $MNT_POINT
+mount -t nfs $NFS_SERVER:$MNT_POINT $MNT_POINT
+if [ $? != 0 ]
+then
+ echo "FAILED: NFS mount failed"
+ exit 1
+fi
+
+mkdir -p -m 777 $MNT_POINT/test_dir
+echo "NFS mount of $FS_TYPE file system and I/O to NFS mount point generates the fs/exportfs code coverage" > $MNT_POINT/test_dir/exportfs_coverage
+
+
+#######################################################
+#
+# Just before exit, perform NFS CLIENT & SERVER cleanup
+#
+#######################################################
+
+umount $MNT_POINT
+rm -rf $MNT_POINT
+
+rsh -n -l root $NFS_SERVER "/usr/sbin/exportfs -u :$MNT_POINT"
+rsh -n -l root $NFS_SERVER "umount $MNT_POINT"
+rsh -n -l root $NFS_SERVER "rm -rf $MNT_POINT"
+echo "PASSED: $0 passed!"
+exit 0
diff --git a/testscripts/ltpfslvm.sh b/testscripts/ltpfslvm.sh
new file mode 100755
index 000000000..a90d06574
--- /dev/null
+++ b/testscripts/ltpfslvm.sh
@@ -0,0 +1,200 @@
+#!/bin/sh
+# This script should be run prior to running executing the filesystem tests.
+# valid devices need to be passed for Device Mapper to work correctly
+# 03/14/03 mridge@us.ibm.com added instance and time command line options
+# 05/16/03 changed script paths
+# 05/20/03 Added instructions on setup and warnings
+# 05/03/2004 hien1@us.ibm.com Added resize2fs and resize_reiserfs after extend and reduce LVs
+# 05/03/2004 Moved the mount after resizing
+# 05/03/2004 Modified /dev/ram to /dev/ram0
+
+cd `dirname $0`
+export LTPROOT=${PWD}
+echo $LTPROOT | grep testscripts > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+ cd ..
+ export LTPROOT=${PWD}
+fi
+
+export TMPBASE="/tmp"
+
+
+usage()
+{
+ cat <<-END >&2
+ usage: ${0##*/} [ -a part1 ] [ -b part2 ] [ -c part3 ]
+ [ -d part4 ] [ -n nfsmount ]
+ defaults:
+ part1=$part1
+ part2=$part2
+ part3=$part3
+ part4=$part4
+ nfsmount=$nfsmount
+ ltproot=$TPROOT
+ tmpdir=$TMPBASE
+
+ example: ${0##*/} -a hdc1 -b hdc2 -c hdc3 -d hdc4 -n mytesthost:/testmountdir
+
+ fdisk needs to be run and the 4 HD partitions marked as 0x8e -- Linux LVM
+
+ - If this is run on a 2.4 kernel system then LVM must be configured and the kernel rebuilt. In a 2.5 environment
+ you must configure Device Mapper and install LVM2 from www.systina.com for the testcase to run correctly.
+
+ - These operations are destructive so do NOT point the tests to partitions where the data shouldn't be overwritten.
+ Once these tests are started all data in the partitions you point to will be destroyed.
+
+ END
+exit
+}
+
+while getopts :a:b:c:d:e:n:v: arg
+do case $arg in
+ a) part1=$OPTARG;;
+ b) part2=$OPTARG;;
+ c) part3=$OPTARG;;
+ d) part4=$OPTARG;;
+ n) nfsmount=$OPTARG;;
+ v) verb=$OPTARG;;
+
+ \?) echo "************** Help Info: ********************"
+ usage;;
+ esac
+done
+
+if [ ! -n "$part1" ]; then
+ echo "Missing 1st partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$part2" ]; then
+ echo "Missing 2nd partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$part3" ]; then
+ echo "Missing 3rd partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$part4" ]; then
+ echo "Missing 4th partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$nfsmount" ]; then
+ echo "Missing NFS partition. You must pass an NFS mount point for testing"
+ usage;
+ exit
+fi
+
+export PATH="${PATH}:${LTPROOT}/testcases/bin"
+
+
+mkdir /test >/dev/null 2>&1
+mkdir /test/growfiles >/dev/null 2>&1
+mkdir /test/growfiles/ext2 >/dev/null 2>&1
+mkdir /test/growfiles/msdos >/dev/null 2>&1
+mkdir /test/growfiles/reiser >/dev/null 2>&1
+mkdir /test/growfiles/minix >/dev/null 2>&1
+mkdir /test/growfiles/nfs >/dev/null 2>&1
+mkdir /test/growfiles/jfs >/dev/null 2>&1
+mkdir /test/growfiles/ramdisk >/dev/null 2>&1
+
+vgscan
+vgchange -a y
+
+pvcreate -v /dev/$part1 /dev/$part2 /dev/$part3 /dev/$part4
+vgcreate -v ltp_test_vg1 /dev/$part1 /dev/$part2
+vgcreate -v ltp_test_vg2 /dev/$part3 /dev/$part4
+vgcfgbackup -v
+lvcreate -v -L 100 ltp_test_vg1 -n ltp_test_lv1
+lvcreate -v -L 100 ltp_test_vg1 -n ltp_test_lv2 -i 2
+lvcreate -v -L 100 ltp_test_vg2 -n ltp_test_lv3
+lvcreate -v -L 100 ltp_test_vg2 -n ltp_test_lv4
+
+mkfs -V -t ext2 /dev/ltp_test_vg1/ltp_test_lv1
+mkfs -V -t msdos /dev/ltp_test_vg1/ltp_test_lv2
+mkreiserfs /dev/ltp_test_vg2/ltp_test_lv3 <yesenter.txt
+mkfs -V -t minix /dev/ltp_test_vg2/ltp_test_lv4
+
+### there is no /dev/ram - has /dev/ram0 ... /dev/ram15
+mkfs -V -t ext3 /dev/ram0
+
+
+lvmdiskscan -v
+lvscan -v
+vgdisplay -v
+lvextend -v -l +5000 /dev/ltp_test_vg1/ltp_test_lv1
+lvreduce -v -f -l -20 /dev/ltp_test_vg1/ltp_test_lv1
+
+### Need to be resize to get LV to the correct size
+resize2fs -f /dev/ltp_test_vg1/ltp_test_lv1
+lvextend -v -l +5000 /dev/ltp_test_vg1/ltp_test_lv2
+lvreduce -v -f -l -20 /dev/ltp_test_vg1/ltp_test_lv2
+
+### Need to be resize to get LV to the correct size
+resize_reiserfs -f /dev/ltp_test_vg1/ltp_test_lv2
+lvextend -v -l +20 /dev/ltp_test_vg2/ltp_test_lv3
+lvreduce -v -f -l -20 /dev/ltp_test_vg2/ltp_test_lv3
+lvextend -v -l +20 /dev/ltp_test_vg2/ltp_test_lv4
+lvreduce -v -f -l -20 /dev/ltp_test_vg2/ltp_test_lv4
+
+vgreduce -v /dev/ltp_test_vg1 /dev/$part2
+vgextend -v /dev/ltp_test_vg1 /dev/$part2
+vgck -v
+
+### Move mount filesystems to the last since resize can't work on a mounted filesystem.
+mount -v -t nfs $nfsmount /test/growfiles/nfs
+mount -v /dev/ltp_test_vg1/ltp_test_lv1 /test/growfiles/ext2
+mount -v /dev/ltp_test_vg1/ltp_test_lv2 /test/growfiles/msdos
+mount -v /dev/ltp_test_vg2/ltp_test_lv3 /test/growfiles/reiser
+mount -v /dev/ltp_test_vg2/ltp_test_lv4 /test/growfiles/minix
+mount -v /dev/ram /test/growfiles/ramdisk
+
+echo "************ Running tests "
+sort -R ${LTPROOT}/runtest/lvm.part1 -o ${TMPBASE}/lvm.part1
+
+${LTPROOT}/bin/ltp-pan -e -S -a lvmpart1 -n lvmpart1 -l lvmlogfile -f ${TMPBASE}/lvm.part1 &
+
+wait $!
+
+
+
+umount -v -t nfs $nfsmount
+umount -v /dev/ltp_test_vg1/ltp_test_lv1
+umount -v /dev/ltp_test_vg1/ltp_test_lv2
+umount -v /dev/ltp_test_vg2/ltp_test_lv3
+umount -v /dev/ltp_test_vg2/ltp_test_lv4
+umount -v /dev/ram
+
+lvremove -f -v /dev/ltp_test_vg1/ltp_test_lv1
+lvremove -f -v /dev/ltp_test_vg1/ltp_test_lv2
+lvremove -f -v /dev/ltp_test_vg2/ltp_test_lv3
+lvremove -f -v /dev/ltp_test_vg2/ltp_test_lv4
+
+lvscan -v
+vgchange -a n
+vgremove -v /dev/ltp_test_vg1
+vgremove -v /dev/ltp_test_vg2
+
+mkfs -V -t ext3 /dev/$part4
+mkfs -V -t jfs /dev/$part1 <yesenter.txt
+
+mount -v -t ext3 /dev/$part4 /test/growfiles/ext3
+mount -v -t jfs /dev/hdc1 /test/growfiles/jfs
+
+echo "************ Running EXT3 & JFS tests... "
+sort -R ${LTPROOT}/runtest/lvm.part2 -o ${TMPBASE}/lvm.part2
+
+${LTPROOT}/bin/ltp-pan -e -S -a lvmpart2 -n lvmpart2 -l lvmlogfile -f ${TMPBASE}/lvm.part2 &
+
+wait $!
+
+umount -v /dev/$part1
+umount -v /dev/$part4
+
+
diff --git a/testscripts/ltpfsnolvm.sh b/testscripts/ltpfsnolvm.sh
new file mode 100755
index 000000000..26dac0108
--- /dev/null
+++ b/testscripts/ltpfsnolvm.sh
@@ -0,0 +1,150 @@
+#!/bin/sh
+# This script should be run prior to running executing the filesystem tests.
+# valid devices need to be passed for Device Mapper to work correctly
+# 03/14/03 mridge@us.ibm.com added instance and time command line options
+# 05/16/03 changed script paths
+# 05/20/03 Added instructions on setup and warnings
+
+cd `dirname $0`
+export LTPROOT=${PWD}
+echo $LTPROOT | grep testscripts > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+ cd ..
+ export LTPROOT=${PWD}
+fi
+
+export TMPBASE="/tmp"
+
+
+usage()
+{
+ cat <<-END >&2
+ usage: ${0##*/} [ -a part1 ] [ -b part2 ] [ -c part3 ]
+ [ -d part4 ] [ -n nfsmount ]
+ defaults:
+ part1=$part1
+ part2=$part2
+ part3=$part3
+ part4=$part4
+ nfsmount=$nfsmount
+ ltproot=$TPROOT
+ tmpdir=$TMPBASE
+
+ example: ${0##*/} -a hdc1 -b hdc2 -c hdc3 -d hdc4 -n mytesthost:/testmountdir
+
+ fdisk needs to be run and the 4 HD partitions marked as 0x8e -- Linux LVM
+
+ - If this is run on a 2.4 kernel system then LVM must be configured and the kernel rebuilt. In a 2.5 environment
+ you must configure Device Mapper and install LVM2 from www.systina.com for the testcase to run correctly.
+
+ - These operations are destructive so do NOT point the tests to partitions where the data shouldn't be overwritten.
+ Once these tests are started all data in the partitions you point to will be destroyed.
+
+ END
+exit
+}
+
+while getopts :a:b:c:d:e:n:v: arg
+do case $arg in
+ a) part1=$OPTARG;;
+ b) part2=$OPTARG;;
+ c) part3=$OPTARG;;
+ d) part4=$OPTARG;;
+ n) nfsmount=$OPTARG;;
+ v) verb=$OPTARG;;
+
+ \?) echo "************** Help Info: ********************"
+ usage;;
+ esac
+done
+
+if [ ! -n "$part1" ]; then
+ echo "Missing 1st partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$part2" ]; then
+ echo "Missing 2nd partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$part3" ]; then
+ echo "Missing 3rd partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$part4" ]; then
+ echo "Missing 4th partition. You must pass 4 partitions for testing"
+ usage;
+ exit
+fi
+
+if [ ! -n "$nfsmount" ]; then
+ echo "Missing NFS partition. You must pass an NFS mount point for testing"
+ usage;
+ exit
+fi
+
+export PATH="${PATH}:${LTPROOT}/testcases/bin"
+
+
+mkdir /test >/dev/null 2>&1
+mkdir /test/growfiles >/dev/null 2>&1
+mkdir /test/growfiles/ext2 >/dev/null 2>&1
+mkdir /test/growfiles/ext3 >/dev/null 2>&1
+mkdir /test/growfiles/msdos >/dev/null 2>&1
+mkdir /test/growfiles/reiser >/dev/null 2>&1
+mkdir /test/growfiles/minix >/dev/null 2>&1
+mkdir /test/growfiles/nfs >/dev/null 2>&1
+mkdir /test/growfiles/jfs >/dev/null 2>&1
+mkdir /test/growfiles/ramdisk >/dev/null 2>&1
+
+mkfs -V -t ext2 /dev/$part1
+mkfs -V -t msdos /dev/$part2
+mkreiserfs /dev/$part3
+mkfs -V -t minix /dev/$part4
+
+
+mount -v -t nfs $nfsmount /test/growfiles/nfs
+mount -v /dev/$part1 /test/growfiles/ext2
+mount -v /dev/$part2 /test/growfiles/msdos
+mount -v /dev/$part3 /test/growfiles/reiser
+mount -v /dev/$part4 /test/growfiles/minix
+mount -v /dev/ram /test/growfiles/ramdisk
+
+echo "************ Running tests "
+sort -R ${LTPROOT}/../runtest/lvm.part1 -o ${TMPBASE}/lvm.part1
+
+${LTPROOT}/../bin/ltp-pan -e -S -a lvmpart1 -n lvmpart1 -l lvmlogfile -f ${TMPBASE}/lvm.part1 &
+
+wait $!
+
+
+
+umount -v -t nfs $nfsmount
+umount -v /dev/$part1
+umount -v /dev/$part2
+umount -v /dev/$part3
+umount -v /dev/$part4
+umount -v /dev/ram
+
+mkfs -V -t ext3 /dev/$part4
+mkfs -V -t jfs /dev/$part1 <yesenter.txt
+
+mount -v -t ext3 /dev/$part4 /test/growfiles/ext3
+mount -v -t jfs /dev/$part1 /test/growfiles/jfs
+
+echo "************ Running EXT3 & JFS tests... "
+sort -R ${LTPROOT}/../runtest/lvm.part2 -o ${TMPBASE}/lvm.part2
+
+${LTPROOT}/../bin/ltp-pan -e -S -a lvmpart2 -n lvmpart2 -l lvmlogfile -f ${TMPBASE}/lvm.part2 &
+
+wait $!
+
+umount -v /dev/$part1
+umount -v /dev/$part4
+
+
diff --git a/testscripts/lvmtest.sh b/testscripts/lvmtest.sh
deleted file mode 100755
index 8407a2227..000000000
--- a/testscripts/lvmtest.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
-#
-# Run the new LVM testsuite, including initialization and cleanup.
-
-cd $(dirname $0)
-export LTPROOT=${LTPROOT:-"$PWD"}
-echo $LTPROOT | grep -q testscripts
-if [ $? -eq 0 ]; then
- cd ..
- export LTPROOT=${PWD}
-fi
-
-export PATH="${PATH}:${LTPROOT}:${LTPROOT}/bin:${LTPROOT}/testcases/bin"
-
-generate_lvm_runfile.sh && prepare_lvm.sh && runltp -f lvm.local
-cleanup_lvm.sh
diff --git a/tools/apicmds/ltpapicmd.c b/tools/apicmds/ltpapicmd.c
index ac58c90cc..c4fab3218 100644
--- a/tools/apicmds/ltpapicmd.c
+++ b/tools/apicmds/ltpapicmd.c
@@ -108,7 +108,7 @@ void tst_cat_file(const char *filename)
{
const char *cmd[] = {"cat", filename, NULL};
- tst_cmd(NULL, cmd, NULL, NULL, 0);
+ tst_run_cmd(NULL, cmd, NULL, NULL, 0);
}
void apicmd_brk(int argc, char *argv[])
diff --git a/travis/alpine.sh b/travis/alpine.sh
index f90962099..cef627b65 100755
--- a/travis/alpine.sh
+++ b/travis/alpine.sh
@@ -1,18 +1,15 @@
#!/bin/sh
-# Copyright (c) 2019-2020 Petr Vorel <petr.vorel@gmail.com>
-set -ex
+# Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+set -e
apk update
apk add \
acl-dev \
- asciidoc \
- asciidoctor \
autoconf \
automake \
clang \
gcc \
- git \
keyutils-dev \
libaio-dev \
libacl \
@@ -25,19 +22,30 @@ apk add \
musl-dev \
numactl-dev \
openssl-dev \
- perl-json \
pkgconfig
+echo "=== /etc/os-release ==="
cat /etc/os-release
echo "WARNING: remove unsupported tests (until they're fixed)"
cd ..
rm -rfv \
+ testcases/kernel/pty/pty01.c \
+ testcases/kernel/pty/pty02.c \
+ testcases/kernel/pty/ptem01.c \
testcases/kernel/sched/process_stress/process.c \
+ testcases/kernel/syscalls/accept4/accept4_01.c \
testcases/kernel/syscalls/confstr/confstr01.c \
testcases/kernel/syscalls/fmtmsg/fmtmsg01.c \
testcases/kernel/syscalls/getcontext/getcontext01.c \
+ testcases/kernel/syscalls/getdents/getdents01.c \
+ testcases/kernel/syscalls/getdents/getdents02.c \
+ testcases/kernel/syscalls/ioctl/ioctl01.c \
+ testcases/kernel/syscalls/ioctl/ioctl02.c \
testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c \
+ testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c \
testcases/kernel/syscalls/timer_create/timer_create01.c \
testcases/kernel/syscalls/timer_create/timer_create03.c \
+ testcases/misc/crash/crash01.c \
+ utils/benchmark/ebizzy-0.3
cd -
diff --git a/travis/debian.cross-compile.aarch64.sh b/travis/debian.cross-compile.aarch64.sh
new file mode 100755
index 000000000..4b07f186f
--- /dev/null
+++ b/travis/debian.cross-compile.aarch64.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+set -e
+
+apt install -y --no-install-recommends \
+ gcc-aarch64-linux-gnu \
+ libc6-dev-arm64-cross
diff --git a/travis/debian.cross-compile.ppc64le.sh b/travis/debian.cross-compile.ppc64le.sh
new file mode 100755
index 000000000..d8431bd52
--- /dev/null
+++ b/travis/debian.cross-compile.ppc64le.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+set -e
+
+apt install -y --no-install-recommends \
+ gcc-powerpc64le-linux-gnu \
+ libc6-dev-ppc64el-cross
diff --git a/travis/debian.cross-compile.sh b/travis/debian.cross-compile.sh
deleted file mode 100755
index 0a7ef7710..000000000
--- a/travis/debian.cross-compile.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
-
-if [ -z "$ARCH" ]; then
- echo "missing \$ARCH!" >&2
- exit 1
-fi
-
-case "$ARCH" in
-arm64) gcc_arch="aarch64";;
-ppc64el) gcc_arch="powerpc64le";;
-s390x) gcc_arch="$ARCH";;
-*) echo "unsupported arch: '$ARCH'!" >&2; exit 1;;
-esac
-
-dpkg --add-architecture $ARCH
-apt update
-
-apt install -y --no-install-recommends \
- gcc-${gcc_arch}-linux-gnu \
- libc6-dev-${ARCH}-cross \
- libmnl-dev:$ARCH \
- libtirpc-dev:$ARCH
diff --git a/travis/debian.i386.sh b/travis/debian.i386.sh
index 707a23ca6..51a77e11d 100755
--- a/travis/debian.i386.sh
+++ b/travis/debian.i386.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+set -e
dpkg --add-architecture i386
apt update
@@ -16,5 +16,4 @@ apt install -y --no-install-recommends \
libkeyutils1:i386 \
libnuma1:i386 \
libssl-dev:i386 \
- libtirpc-dev:i386 \
- pkg-config:i386
+ libtirpc-dev:i386
diff --git a/travis/debian.minimal.sh b/travis/debian.minimal.sh
index 5e6ba8662..822de636a 100755
--- a/travis/debian.minimal.sh
+++ b/travis/debian.minimal.sh
@@ -1,12 +1,8 @@
#!/bin/sh
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+set -e
-apt="apt remove -y"
-
-$apt \
- asciidoc \
- asciidoctor \
+apt remove -y \
libacl1-dev \
libaio-dev \
libaio1 \
@@ -21,5 +17,3 @@ $apt \
libsepol1-dev \
libssl-dev \
libtirpc-dev
-
-$apt asciidoc-base ruby-asciidoctor || true
diff --git a/travis/debian.sh b/travis/debian.sh
index 743b79001..e1be4bb05 100755
--- a/travis/debian.sh
+++ b/travis/debian.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
+# Copyright (c) 2018-2019 Petr Vorel <pvorel@suse.cz>
+set -e
# workaround for missing oldstable-updates repository
# W: Failed to fetch http://deb.debian.org/debian/dists/oldstable-updates/main/binary-amd64/Packages
@@ -8,12 +8,8 @@ grep -v oldstable-updates /etc/apt/sources.list > /tmp/sources.list && mv /tmp/s
apt update
-apt="apt install -y --no-install-recommends"
-
-$apt \
+apt install -y --no-install-recommends \
acl-dev \
- asciidoc \
- asciidoctor \
autoconf \
automake \
build-essential \
@@ -21,7 +17,6 @@ $apt \
devscripts \
clang \
gcc \
- git \
libacl1 \
libacl1-dev \
libaio-dev \
@@ -30,11 +25,9 @@ $apt \
libcap2 \
libc6 \
libc6-dev \
- libjson-perl \
libkeyutils-dev \
libkeyutils1 \
libmm-dev \
- libmnl-dev \
libnuma-dev \
libnuma1 \
libselinux1-dev \
@@ -42,9 +35,4 @@ $apt \
libssl-dev \
libtirpc-dev \
linux-libc-dev \
- lsb-release \
- pkg-config
-
-$apt ruby-asciidoctor-pdf || true
-
-df -hT
+ lsb-release
diff --git a/travis/fedora.sh b/travis/fedora.sh
index 959f3af20..a4633333e 100755
--- a/travis/fedora.sh
+++ b/travis/fedora.sh
@@ -1,26 +1,12 @@
#!/bin/sh
-# Copyright (c) 2018-2021 Petr Vorel <pvorel@suse.cz>
-set -ex
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+set -e
-yum="yum -y install"
-
-$yum \
- asciidoc \
+yum -y install \
autoconf \
automake \
make \
clang \
gcc \
- git \
findutils \
- numactl-devel \
- libtirpc \
- libtirpc-devel \
- perl-JSON \
- perl-libwww-perl \
- pkg-config \
redhat-lsb-core
-
-# CentOS 8 fixes
-$yum libmnl-devel || $yum libmnl
-$yum rubygem-asciidoctor || true
diff --git a/travis/tumbleweed.sh b/travis/tumbleweed.sh
index 43ca3252a..c57257120 100755
--- a/travis/tumbleweed.sh
+++ b/travis/tumbleweed.sh
@@ -1,17 +1,12 @@
#!/bin/sh
-# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
+# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
+set -e
-zyp="zypper --non-interactive install --force-resolution --no-recommends"
-
-$zyp \
- asciidoc \
+zypper --non-interactive install --no-recommends \
autoconf \
automake \
clang \
- findutils \
gcc \
- git \
gzip \
make \
kernel-default-devel \
@@ -19,14 +14,9 @@ $zyp \
libacl-devel \
libaio-devel \
libcap-devel \
- libmnl-devel \
libnuma-devel \
libopenssl-devel \
libselinux-devel \
libtirpc-devel \
linux-glibc-devel \
- lsb-release \
- perl-JSON \
- pkg-config
-
-$zyp ruby2.7-rubygem-asciidoctor || $zyp ruby2.5-rubygem-asciidoctor
+ lsb-release
diff --git a/utils/benchmark/ebizzy-0.3/ebizzy.c b/utils/benchmark/ebizzy-0.3/ebizzy.c
index 54b047130..5bb8eff56 100644
--- a/utils/benchmark/ebizzy-0.3/ebizzy.c
+++ b/utils/benchmark/ebizzy-0.3/ebizzy.c
@@ -215,10 +215,10 @@ static void read_options(int argc, char *argv[])
"\"never mmap\" option specified\n");
usage();
}
-#ifdef __GLIBC__
+
if (never_mmap)
mallopt(M_MMAP_MAX, 0);
-#endif
+
if (chunk_size < record_size) {
fprintf(stderr, "Chunk size %u smaller than record size %u\n",
chunk_size, record_size);
@@ -230,7 +230,7 @@ static void touch_mem(char *dest, size_t size)
{
int i;
if (touch_pages) {
- for (i = 0; i < (long)size; i += page_size)
+ for (i = 0; i < size; i += page_size)
*(dest + i) = 0xff;
}
}
@@ -281,14 +281,14 @@ static void my_memcpy(void *dest, void *src, size_t len)
char *s = (char *)src;
int i;
- for (i = 0; i < (long)len; i++)
+ for (i = 0; i < len; i++)
d[i] = s[i];
return;
}
static void allocate(void)
{
- unsigned int i;
+ int i;
mem = alloc_mem(chunks * sizeof(record_t *));
@@ -313,7 +313,7 @@ static void allocate(void)
static void write_pattern(void)
{
- unsigned int i, j;
+ int i, j;
for (i = 0; i < chunks; i++) {
for (j = 0; j < chunk_size / record_size; j++)
@@ -421,8 +421,9 @@ static unsigned int search_mem(void)
return (i);
}
-static void *thread_run(void *arg __attribute__((unused)))
+static void *thread_run(void *arg)
{
+
if (verbose > 1)
printf("Thread started\n");
diff --git a/utils/sctp/func_tests/Makefile b/utils/sctp/func_tests/Makefile
index a17107853..d296c652a 100644
--- a/utils/sctp/func_tests/Makefile
+++ b/utils/sctp/func_tests/Makefile
@@ -30,7 +30,7 @@ LDFLAGS += $(addprefix -L$(abs_builddir)/../,lib testlib)
LDLIBS += -lsctputil -lsctp -lpthread
-V4_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(sort $(wildcard $(abs_srcdir)/*.c)))
+V4_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*.c))
V6_TARGETS := test_basic_v6 test_fragments_v6 test_getname_v6 \
test_inaddr_any_v6 test_peeloff_v6 \
diff --git a/utils/sctp/func_tests/test_1_to_1_accept_close.c b/utils/sctp/func_tests/test_1_to_1_accept_close.c
index 801496246..22f8e2a2b 100644
--- a/utils/sctp/func_tests/test_1_to_1_accept_close.c
+++ b/utils/sctp/func_tests/test_1_to_1_accept_close.c
@@ -63,7 +63,6 @@
#include <netinet/sctp.h>
#include <sys/uio.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 10;
@@ -72,7 +71,7 @@ int TST_CNT = 0;
#define SK_MAX 10
int
-main(void)
+main(int argc, char *argv[])
{
socklen_t len;
int i;
@@ -84,9 +83,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_addrs.c b/utils/sctp/func_tests/test_1_to_1_addrs.c
index 4b846d86a..5d5691856 100644
--- a/utils/sctp/func_tests/test_1_to_1_addrs.c
+++ b/utils/sctp/func_tests/test_1_to_1_addrs.c
@@ -69,14 +69,13 @@
#include <netinet/sctp.h>
#include <sys/uio.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 10;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int error;
socklen_t len;
@@ -99,9 +98,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
struct sockaddr_in *addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_connect.c b/utils/sctp/func_tests/test_1_to_1_connect.c
index bec16e1dd..e1993e4f0 100644
--- a/utils/sctp/func_tests/test_1_to_1_connect.c
+++ b/utils/sctp/func_tests/test_1_to_1_connect.c
@@ -58,7 +58,6 @@
#include <sys/uio.h>
#include <netinet/sctp.h>
#include "sctputil.h"
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 10;
@@ -67,7 +66,7 @@ int TST_CNT = 0;
#define SK_MAX 10
int
-main(void)
+main(int argc, char *argv[])
{
int error,i;
socklen_t len;
@@ -78,9 +77,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_connectx.c b/utils/sctp/func_tests/test_1_to_1_connectx.c
index 16479a818..04e20bf1b 100644
--- a/utils/sctp/func_tests/test_1_to_1_connectx.c
+++ b/utils/sctp/func_tests/test_1_to_1_connectx.c
@@ -58,7 +58,6 @@
#include <sys/uio.h>
#include <netinet/sctp.h>
#include "sctputil.h"
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 10;
@@ -67,7 +66,7 @@ int TST_CNT = 0;
#define SK_MAX 10
int
-main(void)
+main(int argc, char *argv[])
{
int error,i;
socklen_t len;
@@ -77,9 +76,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,acpt_addr;
struct sockaddr *tmp_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_events.c b/utils/sctp/func_tests/test_1_to_1_events.c
index 447845ff3..352534680 100644
--- a/utils/sctp/func_tests/test_1_to_1_events.c
+++ b/utils/sctp/func_tests/test_1_to_1_events.c
@@ -44,14 +44,13 @@
#include <netinet/sctp.h>
#include <sctputil.h>
#include <string.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 4;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk,acpt_sk;
struct sockaddr_in svr_loop, clt_loop,acpt_loop;
@@ -69,9 +68,6 @@ main(void)
uint32_t ppid;
uint32_t stream;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c
index 98013cd30..3743679fe 100644
--- a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c
+++ b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c
@@ -110,8 +110,4 @@ static void test_sctp(unsigned int n)
static struct tst_test test = {
.test = test_sctp,
.tcnt = ARRAY_SIZE(testcase_list),
- .needs_drivers = (const char *[]) {
- "sctp",
- NULL
- },
};
diff --git a/utils/sctp/func_tests/test_1_to_1_nonblock.c b/utils/sctp/func_tests/test_1_to_1_nonblock.c
index 05cc0a29d..1179fb16b 100644
--- a/utils/sctp/func_tests/test_1_to_1_nonblock.c
+++ b/utils/sctp/func_tests/test_1_to_1_nonblock.c
@@ -55,14 +55,13 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 5;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int error,msg_count;
socklen_t len;
@@ -80,9 +79,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,svr_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbufferd
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_recvfrom.c b/utils/sctp/func_tests/test_1_to_1_recvfrom.c
index 45005a55d..0ede5628d 100644
--- a/utils/sctp/func_tests/test_1_to_1_recvfrom.c
+++ b/utils/sctp/func_tests/test_1_to_1_recvfrom.c
@@ -55,14 +55,13 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 7;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int msg_count;
socklen_t len;
@@ -75,9 +74,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,svr_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_recvmsg.c b/utils/sctp/func_tests/test_1_to_1_recvmsg.c
index aa89c4fa4..5f06bb673 100644
--- a/utils/sctp/func_tests/test_1_to_1_recvmsg.c
+++ b/utils/sctp/func_tests/test_1_to_1_recvmsg.c
@@ -56,14 +56,13 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 8;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
socklen_t len;
int sk,pf_class,lstn_sk,acpt_sk;
@@ -80,9 +79,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,svr_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_rtoinfo.c b/utils/sctp/func_tests/test_1_to_1_rtoinfo.c
index 98e4ea185..cb46e3920 100644
--- a/utils/sctp/func_tests/test_1_to_1_rtoinfo.c
+++ b/utils/sctp/func_tests/test_1_to_1_rtoinfo.c
@@ -52,7 +52,6 @@
#include <sys/uio.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 3;
@@ -67,9 +66,6 @@ main(void)
struct sctp_rtoinfo srtoinfo; /*setting the variables*/
struct sctp_rtoinfo grtoinfo; /*Getting the variables*/
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
sd = test_socket (PF_INET, SOCK_STREAM, IPPROTO_SCTP);
len = sizeof(struct sctp_rtoinfo);
diff --git a/utils/sctp/func_tests/test_1_to_1_send.c b/utils/sctp/func_tests/test_1_to_1_send.c
index 3f072da8d..8d9516cac 100644
--- a/utils/sctp/func_tests/test_1_to_1_send.c
+++ b/utils/sctp/func_tests/test_1_to_1_send.c
@@ -56,14 +56,13 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 8;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
socklen_t len,len_snd;
int msg_count;
@@ -75,9 +74,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,svr_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_sendmsg.c b/utils/sctp/func_tests/test_1_to_1_sendmsg.c
index d99f1f051..13c920d29 100644
--- a/utils/sctp/func_tests/test_1_to_1_sendmsg.c
+++ b/utils/sctp/func_tests/test_1_to_1_sendmsg.c
@@ -63,14 +63,13 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 14;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
socklen_t len;
int msg_count;
@@ -90,9 +89,6 @@ main(void)
int fd, err_no = 0;
char filename[21];
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_sendto.c b/utils/sctp/func_tests/test_1_to_1_sendto.c
index 0c9b45c57..8f5804ce1 100644
--- a/utils/sctp/func_tests/test_1_to_1_sendto.c
+++ b/utils/sctp/func_tests/test_1_to_1_sendto.c
@@ -52,14 +52,13 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 4;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int msg_count;
socklen_t len;
@@ -70,9 +69,6 @@ main(void)
struct sockaddr_in conn_addr,lstn_addr,svr_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbufferd
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_shutdown.c b/utils/sctp/func_tests/test_1_to_1_shutdown.c
index 8a6528b06..c20949886 100644
--- a/utils/sctp/func_tests/test_1_to_1_shutdown.c
+++ b/utils/sctp/func_tests/test_1_to_1_shutdown.c
@@ -52,7 +52,6 @@
#include <string.h>
#include <stdlib.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 6;
@@ -61,7 +60,7 @@ int TST_CNT = 0;
#define MAX_CLIENTS 10
int
-main(void)
+main(int argc, char *argv[])
{
int clnt_sk[MAX_CLIENTS], acpt_sk[MAX_CLIENTS],sk;
int lstn_sk;
@@ -74,9 +73,6 @@ main(void)
int fd, err_no = 0;
char filename[21];
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c b/utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c
index 436a0b785..06c68471f 100644
--- a/utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c
+++ b/utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c
@@ -71,7 +71,6 @@
#include <netinet/sctp.h>
#include <sys/uio.h>
#include <sctputil.h>
-#include "tst_kernel.h"
#define SCTP_RESERVED_PORT 7
#define SCTP_INV_LOOPBACK "172.31.43.112"
@@ -81,7 +80,7 @@ int TST_TOTAL = 15;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int sk,pf_class;
int error = 0;
@@ -91,9 +90,6 @@ main(void)
struct sockaddr_in bind_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_sockopt.c b/utils/sctp/func_tests/test_1_to_1_sockopt.c
index b5af66d0d..436b344e9 100644
--- a/utils/sctp/func_tests/test_1_to_1_sockopt.c
+++ b/utils/sctp/func_tests/test_1_to_1_sockopt.c
@@ -72,7 +72,6 @@
#include <netinet/sctp.h>
#include <sys/uio.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 22;
@@ -102,9 +101,6 @@ main(void)
int fd, err_no = 0;
char filename[21];
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_1_to_1_threads.c b/utils/sctp/func_tests/test_1_to_1_threads.c
index 2cf96b186..e2a7eeeed 100644
--- a/utils/sctp/func_tests/test_1_to_1_threads.c
+++ b/utils/sctp/func_tests/test_1_to_1_threads.c
@@ -49,7 +49,6 @@
#include <sys/uio.h>
#include <linux/socket.h>
#include <sctputil.h>
-#include "tst_kernel.h"
#define THREADS 10 /* FIXME should be 500 instead of 10 */
#define THREAD_SND_RCV_LOOPS 10
@@ -147,9 +146,6 @@ main(void)
socklen_t len = sizeof(struct sockaddr_in);
struct sockaddr_in svr_addr;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
diff --git a/utils/sctp/func_tests/test_assoc_abort.c b/utils/sctp/func_tests/test_assoc_abort.c
index 02d3974cf..7e9a0b509 100644
--- a/utils/sctp/func_tests/test_assoc_abort.c
+++ b/utils/sctp/func_tests/test_assoc_abort.c
@@ -53,7 +53,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 1;
@@ -62,7 +61,7 @@ int TST_CNT = 0;
#define MAX_CLIENTS 10
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk[MAX_CLIENTS];
sockaddr_storage_t svr_loop, clt_loop[MAX_CLIENTS];
@@ -85,9 +84,6 @@ main(void)
struct sctp_status status;
socklen_t status_len;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_assoc_shutdown.c b/utils/sctp/func_tests/test_assoc_shutdown.c
index 1545bb1e9..dcdb37794 100644
--- a/utils/sctp/func_tests/test_assoc_shutdown.c
+++ b/utils/sctp/func_tests/test_assoc_shutdown.c
@@ -58,10 +58,9 @@ int TST_TOTAL = 1;
int TST_CNT = 0;
#define MAX_CLIENTS 10
-#include "tst_kernel.h"
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk[MAX_CLIENTS];
sctp_assoc_t svr_associd[MAX_CLIENTS];
@@ -84,9 +83,6 @@ main(void)
struct sctp_status status;
socklen_t status_len;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_autoclose.c b/utils/sctp/func_tests/test_autoclose.c
index 096efdf0b..b5368e70a 100644
--- a/utils/sctp/func_tests/test_autoclose.c
+++ b/utils/sctp/func_tests/test_autoclose.c
@@ -53,14 +53,13 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 1;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int sk1, sk2;
sockaddr_storage_t loop1, loop2;
@@ -71,9 +70,6 @@ main(void)
char *message = "hello, world!\n";
uint32_t autoclose;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_basic.c b/utils/sctp/func_tests/test_basic.c
index 0044a25f6..b8d4eaea1 100644
--- a/utils/sctp/func_tests/test_basic.c
+++ b/utils/sctp/func_tests/test_basic.c
@@ -56,7 +56,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 15;
@@ -93,9 +92,6 @@ int main(void)
struct sockaddr_in6 *in6_addr;
void *addr_buf;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_connect.c b/utils/sctp/func_tests/test_connect.c
index f8fc1c2d5..333c283ed 100644
--- a/utils/sctp/func_tests/test_connect.c
+++ b/utils/sctp/func_tests/test_connect.c
@@ -49,14 +49,13 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 5;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk1, clt_sk2, peeloff_sk;
sctp_assoc_t svr_associd1;
@@ -68,9 +67,6 @@ main(void)
char *big_buffer;
int flags;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_connectx.c b/utils/sctp/func_tests/test_connectx.c
index dba612d0e..24772417c 100644
--- a/utils/sctp/func_tests/test_connectx.c
+++ b/utils/sctp/func_tests/test_connectx.c
@@ -49,7 +49,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 9;
@@ -65,7 +64,7 @@ int TST_CNT = 0;
((unsigned char *)&addr)[3]
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk1, clt_sk2, peeloff_sk;
sctp_assoc_t associd, svr_associd1, svr_associd2, clt_associd1, clt_associd2;
@@ -82,9 +81,6 @@ main(void)
struct sockaddr_in clt_loop3[NUMADDR];
sockaddr_storage_t svr_test[NUMADDR], clt_test1[NUMADDR], clt_test2[NUMADDR];
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_fragments.c b/utils/sctp/func_tests/test_fragments.c
index ce836bf9d..86262ce1e 100644
--- a/utils/sctp/func_tests/test_fragments.c
+++ b/utils/sctp/func_tests/test_fragments.c
@@ -64,7 +64,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 4;
@@ -73,7 +72,7 @@ int TST_CNT = 0;
int msg_sizes[] = {1353, 2000, 5000, 10000, 20000, 32768};
int
-main(void)
+main(int argc, char *argv[])
{
int sk1, sk2;
sockaddr_storage_t loop1;
@@ -96,9 +95,6 @@ main(void)
int disable_frag;
socklen_t optlen;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_getname.c b/utils/sctp/func_tests/test_getname.c
index 2d7916ccd..f7070a34a 100644
--- a/utils/sctp/func_tests/test_getname.c
+++ b/utils/sctp/func_tests/test_getname.c
@@ -49,7 +49,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 13;
@@ -58,7 +57,7 @@ int TST_CNT = 0;
#define MAX_CLIENTS 10
int
-main(void)
+main(int argc, char *argv[])
{
int clt_sk, svr_sk, accept_sk;
sockaddr_storage_t svr_loop, accept_loop;
@@ -70,9 +69,6 @@ main(void)
int fd, err_no = 0;
char filename[21];
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_inaddr_any.c b/utils/sctp/func_tests/test_inaddr_any.c
index 11405e04d..722a7025f 100644
--- a/utils/sctp/func_tests/test_inaddr_any.c
+++ b/utils/sctp/func_tests/test_inaddr_any.c
@@ -56,7 +56,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 2;
@@ -85,9 +84,6 @@ main(void)
uint32_t stream;
socklen_t namelen;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_peeloff.c b/utils/sctp/func_tests/test_peeloff.c
index e3a7ee65f..8fb7a00ea 100644
--- a/utils/sctp/func_tests/test_peeloff.c
+++ b/utils/sctp/func_tests/test_peeloff.c
@@ -51,7 +51,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 6;
@@ -60,7 +59,7 @@ int TST_CNT = 0;
#define MAX_CLIENTS 10
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk[MAX_CLIENTS], peeloff_sk[MAX_CLIENTS];
sctp_assoc_t svr_associd[MAX_CLIENTS];
@@ -82,9 +81,6 @@ main(void)
char *message = "hello, world!\n";
int pf_class;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_recvmsg.c b/utils/sctp/func_tests/test_recvmsg.c
index 4f0a91455..b16cceb41 100644
--- a/utils/sctp/func_tests/test_recvmsg.c
+++ b/utils/sctp/func_tests/test_recvmsg.c
@@ -53,14 +53,13 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 2;
int TST_CNT = 0;
int
-main(void)
+main(int argc, char *argv[])
{
int svr_sk, clt_sk;
struct sockaddr_in svr_loop, clt_loop;
@@ -71,9 +70,6 @@ main(void)
char *big_buffer;
void *msg_buf;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_sctp_sendrecvmsg.c b/utils/sctp/func_tests/test_sctp_sendrecvmsg.c
index e9781a15d..70b0ce7c8 100644
--- a/utils/sctp/func_tests/test_sctp_sendrecvmsg.c
+++ b/utils/sctp/func_tests/test_sctp_sendrecvmsg.c
@@ -54,7 +54,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 10;
@@ -71,7 +70,7 @@ static char *nottlmsg = "This should NOT time out!\n";
static char ttlfrag[SMALL_MAXSEG*3] = {0};
static char *message = "Hello world\n";
-int main(void)
+int main(int argc, char *argv[])
{
int sk1, sk2;
sockaddr_storage_t loop1;
@@ -93,9 +92,6 @@ int main(void)
socklen_t len, oldlen;
struct sctp_status gstatus;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_sockopt.c b/utils/sctp/func_tests/test_sockopt.c
index 80bd74995..a31c5d3ab 100644
--- a/utils/sctp/func_tests/test_sockopt.c
+++ b/utils/sctp/func_tests/test_sockopt.c
@@ -56,7 +56,6 @@
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 29;
@@ -102,9 +101,6 @@ main(void)
struct sctp_status status;
struct sctp_assoc_value value;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_tcp_style.c b/utils/sctp/func_tests/test_tcp_style.c
index e993aeac5..f4f835a7b 100644
--- a/utils/sctp/func_tests/test_tcp_style.c
+++ b/utils/sctp/func_tests/test_tcp_style.c
@@ -50,7 +50,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 22;
@@ -59,7 +58,7 @@ int TST_CNT = 0;
#define MAX_CLIENTS 10
int
-main(void)
+main(int argc, char *argv[])
{
int clt_sk[MAX_CLIENTS], accept_sk[MAX_CLIENTS];
int listen_sk, clt2_sk, accept2_sk;
@@ -82,9 +81,6 @@ main(void)
char *big_buffer;
struct iovec iov;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/func_tests/test_timetolive.c b/utils/sctp/func_tests/test_timetolive.c
index ff1b073fb..3a920d604 100644
--- a/utils/sctp/func_tests/test_timetolive.c
+++ b/utils/sctp/func_tests/test_timetolive.c
@@ -68,7 +68,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sctputil.h>
-#include "tst_kernel.h"
char *TCID = __FILE__;
int TST_TOTAL = 6;
@@ -88,7 +87,7 @@ static char *nottlmsg = "This should NOT time out!\n";
static char ttlfrag[SMALL_MAXSEG*3] = {0};
static char *message = "Hello world\n";
-int main(void)
+int main(int argc, char *argv[])
{
int sk1, sk2;
sockaddr_storage_t loop1;
@@ -115,9 +114,6 @@ int main(void)
int orig_len;
struct sctp_status gstatus;
- if (tst_check_driver("sctp"))
- tst_brkm(TCONF, tst_exit, "sctp driver not available");
-
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
*/
diff --git a/utils/sctp/lib/Makefile b/utils/sctp/lib/Makefile
index 54438b61c..c0cb35b4e 100644
--- a/utils/sctp/lib/Makefile
+++ b/utils/sctp/lib/Makefile
@@ -26,6 +26,6 @@ include $(top_srcdir)/include/mk/env_pre.mk
CPPFLAGS += -I$(abs_srcdir)/../include
-INTERNAL_LIB := libsctp.a
+LIB := libsctp.a
include $(top_srcdir)/include/mk/lib.mk
diff --git a/utils/sctp/testlib/Makefile b/utils/sctp/testlib/Makefile
index 84ed02040..2977f45b3 100644
--- a/utils/sctp/testlib/Makefile
+++ b/utils/sctp/testlib/Makefile
@@ -28,7 +28,7 @@ CPPFLAGS += -DLTP -I$(abs_srcdir)/../include
LDLIBS += -lltp -lsctp
-INTERNAL_LIB := libsctputil.a
+LIB := libsctputil.a
#
#DEPLIBDIR := ../lib
diff --git a/utils/sctp/testlib/sctputil.c b/utils/sctp/testlib/sctputil.c
index 9a38149f6..cb291e591 100644
--- a/utils/sctp/testlib/sctputil.c
+++ b/utils/sctp/testlib/sctputil.c
@@ -93,11 +93,11 @@ test_print_cmsg(sctp_cmsg_t type, sctp_cmsg_data_t *data)
/* This function prints the message. */
void
-test_print_message(int sk LTP_ATTRIBUTE_UNUSED, struct msghdr *msg, size_t msg_len)
+test_print_message(int sk, struct msghdr *msg, size_t msg_len)
{
sctp_cmsg_data_t *data;
struct cmsghdr *cmsg;
- unsigned int i;
+ int i;
int done = 0;
char save;
union sctp_notification *sn;
@@ -114,10 +114,10 @@ test_print_message(int sk LTP_ATTRIBUTE_UNUSED, struct msghdr *msg, size_t msg_l
/* Make sure that everything is printable and that we
* are NUL terminated...
*/
- printf("DATA(%ld): ", msg_len);
+ printf("DATA(%d): ", msg_len);
while ( msg_len > 0 ) {
char *text;
- unsigned int len;
+ int len;
text = msg->msg_iov[index].iov_base;
len = msg->msg_iov[index].iov_len;
@@ -231,7 +231,7 @@ test_check_msg_notification(struct msghdr *msg, int datalen,
* stream and ppid.
*/
void
-test_check_buf_data(void *buf LTP_ATTRIBUTE_UNUSED, int datalen, int msg_flags,
+test_check_buf_data(void *buf, int datalen, int msg_flags,
struct sctp_sndrcvinfo *sinfo, int expected_datalen,
int expected_msg_flags, uint16_t expected_stream,
uint32_t expected_ppid)
@@ -248,7 +248,7 @@ test_check_buf_data(void *buf LTP_ATTRIBUTE_UNUSED, int datalen, int msg_flags,
"Got a datamsg of unexpected length:%d, expected length:%d",
datalen, expected_datalen);
- if (((int)(msg_flags & ~0x80000000)) != expected_msg_flags)
+ if ((msg_flags & ~0x80000000) != expected_msg_flags)
tst_brkm(TBROK, tst_exit,
"Unexpected msg_flags:0x%x expecting:0x%x",
msg_flags, expected_msg_flags);
diff --git a/utils/sctp/testlib/sctputil.h b/utils/sctp/testlib/sctputil.h
index 6c3371c96..347c91bde 100644
--- a/utils/sctp/testlib/sctputil.h
+++ b/utils/sctp/testlib/sctputil.h
@@ -5,7 +5,7 @@
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
- *
+ *
* The SCTP implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
@@ -56,9 +56,9 @@
#include <string.h>
typedef union {
- struct sockaddr_in v4;
+ struct sockaddr_in v4;
struct sockaddr_in6 v6;
- struct sockaddr sa;
+ struct sockaddr sa;
} sockaddr_storage_t;
@@ -68,7 +68,7 @@ typedef union {
#ifdef PROT_SOCK
#define SCTP_TESTPORT_1 PROT_SOCK
#else
-#define SCTP_TESTPORT_1 1024
+#define SCTP_TESTPORT_1 1024
#endif
#define SCTP_TESTPORT_2 (SCTP_TESTPORT_1+1)
@@ -189,8 +189,9 @@ static inline int test_accept(int sk, struct sockaddr *addr, socklen_t *addrlen)
static inline int test_send(int sk, const void *msg, size_t len, int flags)
{
int error = send(sk, msg, len, flags);
- if ((long)len != error)
- tst_brkm(TBROK, tst_exit, "send: error:%d errno:%d", error, errno);
+ if (len != error)
+ tst_brkm(TBROK, tst_exit, "send: error:%d errno:%d",
+ error, errno);
return error;
}
@@ -198,8 +199,9 @@ static inline int test_sendto(int sk, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
int error = sendto(sk, msg, len, flags, to, tolen);
- if ((long)len != error)
- tst_brkm(TBROK, tst_exit, "sendto: error:%d errno:%d", error, errno);
+ if (len != error)
+ tst_brkm(TBROK, tst_exit, "sendto: error:%d errno:%d",
+ error, errno);
return error;
}
@@ -273,21 +275,21 @@ static inline int test_sctp_sendmsg(int s, const void *msg, size_t len,
{
int error = sctp_sendmsg(s, msg, len, to, tolen, ppid, flags, stream_no,
timetolive, context);
- if ((long)len != error)
+ if (len != error)
tst_brkm(TBROK, tst_exit, "sctp_sendmsg: error:%d errno:%d",
error, errno);
- return error;
+ return error;
}
static inline int test_sctp_send(int s, const void *msg, size_t len,
- const struct sctp_sndrcvinfo *sinfo,
+ const struct sctp_sndrcvinfo *sinfo,
int flags)
{
int error = sctp_send(s, msg, len, sinfo, flags);
- if ((long)len != error)
+ if (len != error)
tst_brkm(TBROK, tst_exit, "sctp_send: error:%d errno:%d",
error, errno);
- return error;
+ return error;
}
static inline int test_sctp_recvmsg(int sk, void *msg, size_t len,
@@ -298,7 +300,7 @@ static inline int test_sctp_recvmsg(int sk, void *msg, size_t len,
int error = sctp_recvmsg(sk, msg, len, from, fromlen, sinfo, msg_flags);
if (-1 == error)
tst_brkm(TBROK, tst_exit, "sctp_recvmsg: %s", strerror(errno));
- return error;
+ return error;
}
static inline void *test_malloc(size_t size)