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>
lib/parse_opts.c: Remove a few unused assigments.

Some of the ENV variables are only checked for existence so there is no
need to store the return value into the ptr variable. (this change
silences warnings)

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
fs/ftest{04,08}: Remove unused allocated buffer.

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

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/mmap: Remove check for getpagesize() < 0

1. The getpagesize() never fails

2. The condition is always false due to conversion
   to unsigned size_t

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/chmod02: Fix test file creation + cleanup

1. Cleanup the code, remove useless comments.

2. The code to create the file is broken and overly complicated,
   replace it with SAFE_FILE_PRINTF().

Reported-by: jungsoo.son <jungsoo.son@lge.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
syscalls/chown01: Fix test file creation

There is a bug in the code to create the file and the code is
very intricate. So replace it with SAFE_FILE_PRINTF().

Signed-off-by: jungsoo.son <jungsoo.son@lge.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
prot_hsymlinks & cgroup_xattr: fix copyright header

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
lib: safe_macros: Add SAFE_FOPEN(), SAFE_FCLOSE()

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
mmap/mmap13.c: new case to test SIGBUS error of mmap

Test SIGBUS error by accessing to a portion of the buffer that does not
correspond to the file.

Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
lib: Add lib/ltp_priv.h header for internal API.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
dup2/dup205: close all fds before tst_rmdir()

Close all open fds before calling tst_rmdir() to avoid TWARN caused by
NFS silly rename when removing temp dir.

dup205      0  TWARN  :  tst_rmdir: rmobj(/mnt/nfs/dupbA5J5i) failed: unlink(/mnt/nfs/dupbA5J5i/.nfs0000000000f4805b00000005) failed; errno=16: Device or resource busy

Signed-off-by: Eryu Guan <eguan@redhat.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Caspar Zhang <caspar@casparzhang.com>
new testcase: kmsg01

Test /dev/kmsg based on kernel doc: Documentation/ABI/testing/dev-kmsg
 - read() blocks
 - non-blocking read() fails with EAGAIN
 - partial read fails (buffer smaller than message)
 - can write to /dev/kmsg and message seqno grows
 - first read() after open() returns same message
 - if messages get overwritten, read() returns -EPIPE
 - device supports SEEK_SET, SEEK_END, SEEK_DATA

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>