semctl01.c: Pass the correct parameter

For SEM_STAT, the semid argument is not a semaphore identifier,  but instead an
index into the kernel’s internal array that maintains information about all
semaphore sets on the system.

Pass a correct index of the kernel' internal array intead of a semaphores id when
testing feature SEM_STAT.

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Create a function tst_resm_hexd() to print a buffer in hex

This new function behaves like the tst_resm() function. The difference is,
it in addition takes a buffer, its size and prints the buffer in hexadecimal
format in the end of the message.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
dup07:Close the file before unlink it.

When unlink() a file in nfs environment,it will rename the file to a
.nfs<xxxxx> file if any process still has that file open.And this file
could not be deleted until it is closed.So we always get the following
warning which makes testcase "dup07" failed:
0  TWARN  :  tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
failed:
unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
failed; errno=16: Device or resource busy

Close the created/dup file before unlink() it to fix this issue.

Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
shmctl/shmctl01.c: cleanup

1. Remove useless comments

2. Revise code to follow ltp-code-style

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
shmctl/shmctl01.c: Test features IPC_INFO, SHM_STAT, SHM_LOCK and SHM_UNLOCK.

Additional tests for features IPC_INFO, SHM_STAT, SHM_LOCK and SHM_UNLOCK.

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Unmap the mapped address region

It does not unmap the mapped address region,so we sometimes still get
such
warning when cleanup with nfs as TMPDIR although the file descriptor is
closed:
0  TWARN  :  tst_rmdir: rmobj(/mnt/nfsv3/ltp-MOeIFH7102/vma4FwRqb)
failed:
unlink(/mnt/nfsv3/ltp-MOeIFH7102/vma4FwRqb/.nfs000000000110cb3600000001)
failed; errno=16: Device or resource busy

Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
openposix: generate-makefiles.sh: Fix buildonly tests.

The buildonly tests were not compiled due to mistake
in the generate-makefiles script. Sorry.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
waitid02: cleanup

Remove useless comments, convert spaces to tabs
and fix long lines.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
waitid02: split code into separate testcases

Previous code in main was:
- using sleep for synchronization
  The sleep make take longer if run in overcommitted
  z/VM environment with considerably high steal time, which
  causes testcase to hang.
- missing wait for last child

This patch splits code from main() into separate testcases,
each with its own setup/cleanup and expected outcome.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-By: Cyril Hrubis <chrubis@suse.cz>
mmapstress10:Close the file descriptor

It does not close the file descriptor before return 1 in fileokey()
function which may cause the following warning with nfs as TMPDIR:
0  TWARN  :  tst_rmdir: rmobj(/mnt/nfsv3/ltp-SDrfq17456/mmaq7TOqt)
failed:
unlink(/mnt/nfsv3/ltp-SDrfq17456/mmaq7TOqt/.nfs000000000110cb3600000004)
failed; errno=16: Device or resource busy

Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
New core test of cgroups and extended attributes

Support of extended attributes in cgroups was added in Linux 3.7.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
su/su01_s1: fix mismatched double quotation marks

Expect code
* spawn su -c "/bin/su root -c \"echo \"\\\$TEST_LINE > $TEST_ENV_FILE\"\""
will be translated to
* spawn su -c /bin/su root -c "echo "\$TEST_LINE > /tmp/TEST_ENV_FILE_ROOT""
which actually should be
* spawn su -c /bin/su root -c "echo \$TEST_LINE > /tmp/TEST_ENV_FILE_ROOT"

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
syscalls/mprotect: Cleanup UCLINUX ifdefs.

Add mprotect directory to FILTER_OUT_DIRS on UCLINUX.

Remove the UCLINUX ifdefs from the code.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/mprotect: Cleanup.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/mprotect: Fix mmap() error checks.

The addr < 0 is always true. Make use of proper MAP_FAILED constant
instead.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/mprotect01: Straighten up the logic.

Pass the pointer to the current testcase to the setup function instead of
passing the values via global variables + various small fixes.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/mprotect03: Make use of SAFE_WRITE().

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/readdir02: Cleanup.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
openposix/.../mmap/27-1: Remove unused variable.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/stat01: Cleanup.

A little cleanup + remove the second call to parse_opts().

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>