aboutsummaryrefslogtreecommitdiff
path: root/winsup/testsuite/winsup.api
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/testsuite/winsup.api')
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm01.c5
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm02.c4
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm03.c5
-rw-r--r--winsup/testsuite/winsup.api/ltp/exit02.c2
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl07.c2
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl07B.c2
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill02.c18
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap05.c2
-rw-r--r--winsup/testsuite/winsup.api/ltp/munmap01.c4
-rw-r--r--winsup/testsuite/winsup.api/ltp/munmap02.c4
-rw-r--r--winsup/testsuite/winsup.api/ltp/pause01.c4
-rw-r--r--winsup/testsuite/winsup.api/ltp/pipe01.c2
-rw-r--r--winsup/testsuite/winsup.api/ltp/sbrk01.c2
-rw-r--r--winsup/testsuite/winsup.api/ltp/signal03.c23
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink01.c172
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink08.c22
-rw-r--r--winsup/testsuite/winsup.api/pthread/cancel3.c3
-rw-r--r--winsup/testsuite/winsup.api/pthread/cancel5.c15
-rw-r--r--winsup/testsuite/winsup.api/pthread/cpu_relax.h12
19 files changed, 140 insertions, 163 deletions
diff --git a/winsup/testsuite/winsup.api/ltp/alarm01.c b/winsup/testsuite/winsup.api/ltp/alarm01.c
index 187e488..2ee1929 100644
--- a/winsup/testsuite/winsup.api/ltp/alarm01.c
+++ b/winsup/testsuite/winsup.api/ltp/alarm01.c
@@ -188,7 +188,7 @@ main(int ac, char **av)
void
setup()
{
- void trapper();
+ void trapper(int sig);
/* capture signals */
tst_sig(NOFORK, DEF_HANDLER, cleanup);
@@ -218,8 +218,7 @@ cleanup()
} /* End cleanup() */
void
-trapper(sig)
-int sig;
+trapper(int sig)
{
signal(SIGALRM, trapper);
}
diff --git a/winsup/testsuite/winsup.api/ltp/alarm02.c b/winsup/testsuite/winsup.api/ltp/alarm02.c
index 03a41b4..6ef7552 100644
--- a/winsup/testsuite/winsup.api/ltp/alarm02.c
+++ b/winsup/testsuite/winsup.api/ltp/alarm02.c
@@ -99,7 +99,7 @@
void setup();
void cleanup(void) __attribute__((noreturn));
-void alarm_received();
+void alarm_received(int sig);
@@ -232,7 +232,7 @@ cleanup()
tst_exit();
}
-void alarm_received()
+void alarm_received(int sig)
{
received_alarm = 1;
}
diff --git a/winsup/testsuite/winsup.api/ltp/alarm03.c b/winsup/testsuite/winsup.api/ltp/alarm03.c
index 871f6fa..f7d0c15 100644
--- a/winsup/testsuite/winsup.api/ltp/alarm03.c
+++ b/winsup/testsuite/winsup.api/ltp/alarm03.c
@@ -191,7 +191,7 @@ main(int ac, char **av)
void
setup()
{
- void trapper();
+ void trapper(int sig);
/* capture signals */
tst_sig(FORK, DEF_HANDLER, cleanup);
@@ -221,8 +221,7 @@ cleanup()
} /* End cleanup() */
void
-trapper(sig)
-int sig;
+trapper(int sig)
{
signal(SIGALRM, trapper);
}
diff --git a/winsup/testsuite/winsup.api/ltp/exit02.c b/winsup/testsuite/winsup.api/ltp/exit02.c
index 1503106..b6c741e 100644
--- a/winsup/testsuite/winsup.api/ltp/exit02.c
+++ b/winsup/testsuite/winsup.api/ltp/exit02.c
@@ -45,6 +45,7 @@
#include <signal.h>
#include <fcntl.h>
#include <sys/wait.h>
+#include <string.h>
#include "test.h"
#include "usctest.h"
@@ -69,7 +70,6 @@ main(int ac, char **av)
char wbuf[BUFSIZ], rbuf[BUFSIZ];
int len, rlen;
int rval = 0;
- char *strcpy();
int lc; /* loop counter */
const char *msg; /* message returned from parse_opts */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07.c b/winsup/testsuite/winsup.api/ltp/fcntl07.c
index e0082df..8d93873 100644
--- a/winsup/testsuite/winsup.api/ltp/fcntl07.c
+++ b/winsup/testsuite/winsup.api/ltp/fcntl07.c
@@ -142,7 +142,7 @@
#include "usctest.h"
#include "search_path.h"
-void setup();
+void setup(char *path);
void cleanup(void) __attribute__((noreturn));
void help();
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07B.c b/winsup/testsuite/winsup.api/ltp/fcntl07B.c
index db866fd..3d61e48 100644
--- a/winsup/testsuite/winsup.api/ltp/fcntl07B.c
+++ b/winsup/testsuite/winsup.api/ltp/fcntl07B.c
@@ -142,7 +142,7 @@
#include "usctest.h"
#include "search_path.h"
-void setup();
+void setup(char *path);
void cleanup(void) __attribute__((noreturn));
void help();
diff --git a/winsup/testsuite/winsup.api/ltp/kill02.c b/winsup/testsuite/winsup.api/ltp/kill02.c
index eba47cc..d4af44a 100644
--- a/winsup/testsuite/winsup.api/ltp/kill02.c
+++ b/winsup/testsuite/winsup.api/ltp/kill02.c
@@ -185,19 +185,19 @@ int alarm_flag = FALSE; /*This flag indicates an alarm time out. */
char who_am_i = '0'; /*This indicates which process is which when using */
/*interrupt routine usr1_rout. */
-void notify_timeout(); /*Signal handler that the parent enters if it times out */
+void notify_timeout(int sig); /*Signal handler that the parent enters if it times out */
/*waiting for the child to indicate its set up status. */
void parent_rout(); /*This is the parents routine. */
void child1_rout(); /*This is child 1's routine. */
void child2_rout(); /*This is child 2's routine. */
void childA_rout(); /*This is child A's routine. */
void childB_rout(); /*This is child B's routine. */
-void usr1_rout(); /*This routine is used by all children to indicate that */
+void usr1_rout(int sig); /*This routine is used by all children to indicate that */
/*they have caught signal SIGUSR1. */
void par_kill(); /*This routine is called by the original parent to */
/*remove child 2 and to indicate to child 1 to */
/*remove its children. */
-void chld1_kill(); /*This routine is used by child 1 to remove itself and */
+void chld1_kill(int sig); /*This routine is used by child 1 to remove itself and */
/*its children A and B. */
void setup();
@@ -515,7 +515,7 @@ void child1_rout()
if (signal(SIGUSR2,chld1_kill) == SIG_ERR) {
tst_brkm(TBROK,NULL,"Could not set to catch the parents signal.");
(void) write(pipe1_fd[1],CHAR_SET_FAILED,1);
- (void) chld1_kill();
+ (void) chld1_kill(SIGUSR1);
exit(0);
}
@@ -525,7 +525,7 @@ void child1_rout()
if (signal(SIGALRM,notify_timeout) == SIG_ERR) {
tst_brkm(TBROK,NULL,"Could not set to catch the childs time out alarm.");
(void) write(pipe1_fd[1],CHAR_SET_FAILED,1);
- (void) chld1_kill();
+ (void) chld1_kill(SIGUSR1);
exit(0);
}
@@ -550,7 +550,7 @@ void child1_rout()
*/
if (alarm_flag == TRUE) {
tst_brkm(TBROK,NULL,"The set up of the children failed by timing out.");
- (void) chld1_kill();
+ (void) chld1_kill(SIGUSR1);
(void) write(pipe1_fd[1],CHAR_SET_FAILED,1);
exit(0);
}
@@ -740,7 +740,7 @@ setup()
/***********************************************************
* This routine indicates that the process caught SIGUSR1.
**********************************************************/
-void usr1_rout()
+void usr1_rout(int sig)
{
char mesg[MAXMESG]; /*Used to buffer messages for tst_res. */
@@ -772,7 +772,7 @@ void usr1_rout()
* which occurs when the child fails to notify the parent
* the status of set up.
**********************************************************/
-void notify_timeout()
+void notify_timeout(int sig)
{
alarm_flag = TRUE;
@@ -810,7 +810,7 @@ void par_kill()
* This routine is executed by child 1 when the parent tells it to
* remove it's children and itself.
********************************************************************/
-void chld1_kill()
+void chld1_kill(int sig)
{
char mesg[MAXMESG]; /*Used to buffer messages for tst_resm. */
diff --git a/winsup/testsuite/winsup.api/ltp/mmap05.c b/winsup/testsuite/winsup.api/ltp/mmap05.c
index 600cd76..23a6589 100644
--- a/winsup/testsuite/winsup.api/ltp/mmap05.c
+++ b/winsup/testsuite/winsup.api/ltp/mmap05.c
@@ -97,7 +97,7 @@ sigjmp_buf env; /* environment for sigsetjmp/siglongjmp */
void setup(); /* Main setup function of test */
void cleanup(void) __attribute__((noreturn)); /* cleanup function for the test */
-void sig_handler(); /* signal handler to catch SIGSEGV */
+void sig_handler(int sig); /* signal handler to catch SIGSEGV */
int
main(int ac, char **av)
diff --git a/winsup/testsuite/winsup.api/ltp/munmap01.c b/winsup/testsuite/winsup.api/ltp/munmap01.c
index 0527201..91e06c5 100644
--- a/winsup/testsuite/winsup.api/ltp/munmap01.c
+++ b/winsup/testsuite/winsup.api/ltp/munmap01.c
@@ -88,7 +88,7 @@ unsigned int map_len; /* length of the region to be mapped */
void setup(); /* Main setup function of test */
void cleanup(void); /* cleanup function for the test */
-void sig_handler(); /* signal catching function */
+void sig_handler(int sig); /* signal catching function */
int
main(int ac, char **av)
@@ -244,7 +244,7 @@ setup()
* cleanup function and exit the program.
*/
void
-sig_handler()
+sig_handler(int sig)
{
tst_resm(TPASS, "Functionality of munmap() successful");
diff --git a/winsup/testsuite/winsup.api/ltp/munmap02.c b/winsup/testsuite/winsup.api/ltp/munmap02.c
index 7345e73..ddd9626 100644
--- a/winsup/testsuite/winsup.api/ltp/munmap02.c
+++ b/winsup/testsuite/winsup.api/ltp/munmap02.c
@@ -90,7 +90,7 @@ unsigned int map_len; /* length of the region to be mapped */
void setup(); /* Main setup function of test */
void cleanup(void); /* cleanup function for the test */
-void sig_handler(); /* signal catching function */
+void sig_handler(int sig); /* signal catching function */
int
main(int ac, char **av)
@@ -255,7 +255,7 @@ setup()
* cleanup function and exit the program.
*/
void
-sig_handler()
+sig_handler(int sig)
{
tst_resm(TPASS, "Functionality of munmap() successful");
diff --git a/winsup/testsuite/winsup.api/ltp/pause01.c b/winsup/testsuite/winsup.api/ltp/pause01.c
index 1c3b946..fbdc028 100644
--- a/winsup/testsuite/winsup.api/ltp/pause01.c
+++ b/winsup/testsuite/winsup.api/ltp/pause01.c
@@ -124,7 +124,7 @@ int TST_TOTAL=1; /* Total number of test cases. */
extern int Tst_count; /* Test Case counter for tst_* routines */
int exp_enos[]={EINTR, 0};
-void go();
+void go(int sig);
int
main(int ac, char **av)
@@ -224,6 +224,6 @@ cleanup()
/* routine to catch the alarm signal */
void
-go()
+go(int sig)
{
}
diff --git a/winsup/testsuite/winsup.api/ltp/pipe01.c b/winsup/testsuite/winsup.api/ltp/pipe01.c
index cc01cc9..2035071 100644
--- a/winsup/testsuite/winsup.api/ltp/pipe01.c
+++ b/winsup/testsuite/winsup.api/ltp/pipe01.c
@@ -44,6 +44,7 @@
* NONE
*/
#include <errno.h>
+#include <string.h>
#include "test.h"
#include "usctest.h"
@@ -64,7 +65,6 @@ main(int ac, char **av)
char wrbuf[BUFSIZ], rebuf[BUFSIZ];
int red, written; /* no. of chars read/written to pipe */
int greater, length;
- char *strcpy();
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
diff --git a/winsup/testsuite/winsup.api/ltp/sbrk01.c b/winsup/testsuite/winsup.api/ltp/sbrk01.c
index 700fb6b..ed30338 100644
--- a/winsup/testsuite/winsup.api/ltp/sbrk01.c
+++ b/winsup/testsuite/winsup.api/ltp/sbrk01.c
@@ -140,7 +140,7 @@ main(int ac, char **av)
***************************************************************/
if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit(0);
+ tst_exit();
}
/***************************************************************
diff --git a/winsup/testsuite/winsup.api/ltp/signal03.c b/winsup/testsuite/winsup.api/ltp/signal03.c
index 2a0923c..5a55ade 100644
--- a/winsup/testsuite/winsup.api/ltp/signal03.c
+++ b/winsup/testsuite/winsup.api/ltp/signal03.c
@@ -170,9 +170,9 @@
void setup();
void cleanup(void) __attribute__((noreturn));
-void do_test();
+void do_test(int test_case, int Tst_count);
void sigdfl_test();
-void update_timings();
+void update_timings(struct tblock atblock);
#if defined(linux)
# define SIG_PF sig_t /* This might need to be sighandler_t on some systems */
@@ -222,9 +222,7 @@ long Tret;
* M A I N
***********************************************************************/
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char *argv[])
{
int lc;
const char *msg;
@@ -278,18 +276,16 @@ char **argv;
*
***********************************************************************/
void
-do_test(test_case, tst_count)
-int test_case;
-int tst_count;
+do_test(int test_case, int tst_count)
{
int term_stat; /* Termination status of the child returned to */
/* the parent. */
char string[30];
int fd1[2]; /* ipc */
int rd_sz; /* size of read */
- void p_timeout_handler();
+ void p_timeout_handler(int sig);
void c_timeout_handler();
- void catchsig();
+ void catchsig(int sig);
Tst_count = tst_count;
@@ -620,7 +616,7 @@ cleanup()
* call cleanup.
***********************************************************************/
void
-p_timeout_handler()
+p_timeout_handler(int sig)
{
kill(Pid, SIGKILL);
cleanup();
@@ -643,7 +639,7 @@ c_timeout_handler()
* if called.
***********************************************************************/
void
-catchsig()
+catchsig(int sig)
{
exit_val = SIG_CAUGHT;
return;
@@ -653,8 +649,7 @@ catchsig()
* Update timing information
***********************************************************************/
void
-update_timings(atblock)
-struct tblock atblock;
+update_timings(struct tblock atblock)
{
tblock.tb_max += atblock.tb_max;
tblock.tb_min += atblock.tb_min;
diff --git a/winsup/testsuite/winsup.api/ltp/symlink01.c b/winsup/testsuite/winsup.api/ltp/symlink01.c
index 186a85b..a1441c6 100644
--- a/winsup/testsuite/winsup.api/ltp/symlink01.c
+++ b/winsup/testsuite/winsup.api/ltp/symlink01.c
@@ -288,26 +288,27 @@
#include "test.h"
#include "usctest.h"
+struct all_test_cases;
void setup();
void cleanup(void) __attribute__((noreturn));
void help();
-void delete_files();
-void do_EEXIST();
-void do_ENOENT();
-void do_ELOOP();
-void do_ENOTDIR();
-void do_EXDEV();
-void do_ENAMETOOLONG();
-void do_EINVAL();
-void do_readlink();
-void do_stat();
-void do_chdir();
-void do_link();
-void do_unlink();
-void do_chmod();
-void do_utime();
-void do_rename();
-void do_open();
+void delete_files(char *path1, char *path2);
+void do_EEXIST(struct all_test_cases *tc_ptr);
+void do_ENOENT(struct all_test_cases *tc_ptr);
+void do_ELOOP(struct all_test_cases *tc_ptr);
+void do_ENOTDIR(struct all_test_cases *tc_ptr);
+void do_EXDEV(struct all_test_cases *tc_ptr);
+void do_ENAMETOOLONG(struct all_test_cases *tc_ptr);
+void do_EINVAL(struct all_test_cases *tc_ptr);
+void do_readlink(struct all_test_cases *tc_ptr);
+void do_stat(struct all_test_cases *tc_ptr);
+void do_chdir(struct all_test_cases *tc_ptr);
+void do_link(struct all_test_cases *tc_ptr);
+void do_unlink(struct all_test_cases *tc_ptr);
+void do_chmod(struct all_test_cases *tc_ptr);
+void do_utime(struct all_test_cases *tc_ptr);
+void do_rename(struct all_test_cases *tc_ptr);
+void do_open(struct all_test_cases *tc_ptr);
#define S_FILE "symbolic" /* Name of symbolic link file */
#define O_FILE "object" /* Name of object file */
@@ -378,8 +379,14 @@ const char *msgs[] = {
/*
* Define test object setup and validation functions
*/
-int creat_both(), creat_symlink(), creat_path_max(), ck_symlink(),
- creat_object(), ck_object(), ck_both(), ck_path_max();
+int creat_both(const char *path1, const char *path2, const char *path3);
+int creat_symlink(const char *path1, const char *path2, const char *unused);
+int creat_path_max(const char *path1, const char *path2, const char *path3);
+int creat_object(const char *path1, const char *unused1, const char *unused2);
+int ck_symlink(const char *path1, const char *path2, const char *path3);
+int ck_object(const char *path1, const char *path2, const char *path3);
+int ck_both(const char *path1, const char *path2, const char *path3);
+int ck_path_max(const char *path1, const char *path2, const char *path3);
/*
@@ -391,10 +398,10 @@ struct all_test_cases
int test_fail;
int errno_val;
int pass_msg;
- int (*test_setup)();
- int (*ck_test)();
+ int (*test_setup)(const char *, const char *, const char *);
+ int (*ck_test)(const char *, const char *, const char *);
const char *fn_arg[3];
-
+
} test_objects[] = {
{SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}},
{SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
@@ -491,7 +498,6 @@ char test_msg[BUFMAX];
char full_path[PATH_MAX+1+1]; /* Add one for '\0' and another to exceed the PATH_MAX limit, see creat_path_max() */
extern int Tst_count;
extern char *TESTDIR;
-extern char *strrchr();
extern int errno;
struct stat asymlink, statter;
@@ -511,8 +517,8 @@ option_t Options[] = {
int
main(int argc, char *argv[])
{
- struct tcses *tcs_ptr, *get_tcs_info();
- int do_syscalltests();
+ struct tcses *tcs_ptr, *get_tcs_info(char *ptr);
+ int do_syscalltests(struct tcses *tcs);
void cleanup();
int lc; /* loop counter */
const char *msg; /* message returned from parse_opts */
@@ -589,8 +595,7 @@ main(int argc, char *argv[])
*
* Argument is path to program name.
***********************************************************************/
-struct tcses *get_tcs_info(ptr)
-char *ptr;
+struct tcses *get_tcs_info(char *ptr)
{
unsigned ctr;
struct tcses *tcs_ptr;
@@ -605,16 +610,14 @@ char *ptr;
}
#endif
-
for(ctr=0; ctr < (sizeof(all_tcses)/sizeof(struct tcses)); ctr++) {
- if ( strcmp(ptr, all_tcses[ctr].tcid) == 0 ||
+ if ( strcmp(ptr, all_tcses[ctr].tcid) == 0 ||
strcmp(ptr, all_tcses[ctr].syscall) == 0 ) {
tcs_ptr = &all_tcses[ctr];
TCID = all_tcses[ctr].tcid;
TST_TOTAL=tcs_ptr->test_cases;
return(tcs_ptr);
}
-
}
return(NULL);
}
@@ -628,8 +631,7 @@ char *ptr;
* link file and a minus one if the path doesn't point at a file.
***********************************************************************/
int
-see_if_a_symlink(path)
-char *path;
+see_if_a_symlink(const char *path)
{
if (lstat(path, &asymlink) < 0)
return(-1);
@@ -644,8 +646,7 @@ char *path;
* This function performs without any hesitation, file(s) deletions
***********************************************************************/
void
-delete_files(path1, path2)
-char *path1, *path2;
+delete_files(char *path1, char *path2)
{
unlink(path1);
unlink(path2);
@@ -660,8 +661,7 @@ char *path1, *path2;
*
***********************************************************************/
int
-creat_symlink(path1, path2)
-char *path1, *path2;
+creat_symlink(const char *path1, const char *path2, const char *unused)
{
TEST( symlink(path1, path2) );
errno=TEST_ERRNO;
@@ -671,7 +671,7 @@ char *path1, *path2;
"symlink(2) Failure when creating setup %s object file: errno:%d %s",
path1, errno, strerror(errno));
return(0);
- }
+ }
else {
sprintf(Buf, "symlink(%s, %s) was succesful.\n", path1, path2);
strcat(Buffer, Buf);
@@ -690,8 +690,7 @@ char *path1, *path2;
*
***********************************************************************/
int
-creat_object(path1)
-char *path1;
+creat_object(const char *path1, const char *unused1, const char *unused2)
{
int fd;
if ((fd=creat(path1, MODE)) == -1) {
@@ -700,7 +699,7 @@ char *path1;
"creat(2) Failure when creating setup %s object file: errno:%d %s",
path1, errno, strerror(errno));
return(0);
- }
+ }
else {
sprintf(Buf, "creat(%s, %#o) was succesful.\n", path1, MODE);
strcat(Buffer, Buf);
@@ -728,12 +727,11 @@ char *path1;
*
***********************************************************************/
int
-creat_both(path1, path2, path3)
-char *path1, *path2, *path3;
+creat_both(const char *path1, const char *path2, const char *path3)
{
- if (creat_symlink(path1, path2) == -1)
+ if (creat_symlink(path1, path2, NULL) == -1)
return(0);
- else if (creat_object(path3) == -1)
+ else if (creat_object(path3, NULL, NULL) == -1)
return(0);
return(1);
}
@@ -748,8 +746,7 @@ char *path1, *path2, *path3;
*
***********************************************************************/
int
-ck_symlink(path1, path2, path3)
-char *path1, *path2, *path3;
+ck_symlink(const char *path1, const char *path2, const char *path3)
{
int ret;
@@ -780,8 +777,7 @@ char *path1, *path2, *path3;
*
***********************************************************************/
int
-ck_both(path1, path2, path3)
-char *path1, *path2, *path3;
+ck_both(const char *path1, const char *path2, const char *path3)
{
if (ck_symlink(path1, path2, path3) == 0)
return(0);
@@ -804,7 +800,6 @@ char *path1, *path2, *path3;
return(0);
}
return(1);
-
}
/***********************************************************************
@@ -816,8 +811,7 @@ char *path1, *path2, *path3;
* Argument three is regular file name
***********************************************************************/
int
-creat_path_max(path1, path2, path3)
-char *path1, *path2, *path3;
+creat_path_max(const char *path1, const char *path2, const char *path3)
{
int ctr, to_go, size, whole_chunks;
char buf [PATH_MAX];
@@ -858,8 +852,7 @@ char *path1, *path2, *path3;
* Argument three is regular file name
***********************************************************************/
int
-ck_path_max(path1, path2, path3)
-char *path1, *path2, *path3;
+ck_path_max(const char *path1, const char *path2, const char *path3)
{
if (strlen(full_path) == (PATH_MAX+1))
return(1);
@@ -884,8 +877,7 @@ char *path1, *path2, *path3;
*
***********************************************************************/
int
-ck_object(path1, path2, path3)
-char *path1, *path2, *path3;
+ck_object(const char *path1, const char *path2, const char *path3)
{
int ret;
@@ -897,7 +889,7 @@ char *path1, *path2, *path3;
}
else if (ret == 1) {
TEST_RESULT=TFAIL;
- sprintf(test_msg,
+ sprintf(test_msg,
"lstat(2) detected a regular object file as a symbolic link file");
return(0);
}
@@ -912,7 +904,6 @@ char *path1, *path2, *path3;
sprintf(test_msg,
"lstat(2) and stat(2) do not return same inode information for an object file");
return(0);
-
}
return(1);
}
@@ -923,8 +914,7 @@ char *path1, *path2, *path3;
* Argument is a ptr into the all_tcses array of structures of type tcses
***********************************************************************/
int
-do_syscalltests(tcs)
-struct tcses *tcs;
+do_syscalltests(struct tcses *tcs)
{
int ctr, ret;
struct all_test_cases *tc_ptr;
@@ -957,20 +947,20 @@ struct tcses *tcs;
}
TEST_RESULT=TPASS;
delete_files(S_FILE, O_FILE);
- /*
+ /*
* Perform test case setup
*/
ret = (tc_ptr->test_setup)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1],
- tc_ptr->fn_arg[2], tc_ptr->errno_val);
+ tc_ptr->fn_arg[2]);
/* If an expected error, try it out */
if (tc_ptr->test_fail) {
- /*
+ /*
* Try to perform test verification function
*/
if (! (tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1],
- tc_ptr->fn_arg[2], tc_ptr->errno_val))
+ tc_ptr->fn_arg[2]))
tst_resm(TEST_RESULT, test_msg);
else if (tc_ptr->errno_val == EEXIST)
do_EEXIST(tc_ptr);
@@ -990,22 +980,22 @@ struct tcses *tcs;
tst_resm(TBROK, "Test Case Declaration Error");
}
else if (ret == 1) { /* No setup function error */
-
+
if (tc_ptr->errno_val != 0)
tst_resm(TBROK, "Test Case Declaration Error");
else {
- /*
+ /*
* Perform test verification function
*/
ret=(tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1],
- tc_ptr->fn_arg[2], tc_ptr->errno_val);
+ tc_ptr->fn_arg[2]);
/* Perform requested symbolic link system call test */
if ((cktcsid(tc_ptr->tcid, SYMLINK)) ||
(cktcsid(tc_ptr->tcid, LSTAT))) {
if (ret == 1)
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
+ tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
else
tst_resm(TEST_RESULT, test_msg);
}
@@ -1047,8 +1037,7 @@ struct tcses *tcs;
* all_test_cases
***********************************************************************/
void
-do_EEXIST(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_EEXIST(struct all_test_cases *tc_ptr)
{
if (cktcsid(tc_ptr->tcid, SYMLINK)) {
@@ -1109,8 +1098,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_ENOENT(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_ENOENT(struct all_test_cases *tc_ptr)
{
if (cktcsid(tc_ptr->tcid, STAT)) {
@@ -1204,8 +1192,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_ELOOP(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_ELOOP(struct all_test_cases *tc_ptr)
{
if (cktcsid(tc_ptr->tcid, STAT)) {
@@ -1314,8 +1301,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_ENOTDIR(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_ENOTDIR(struct all_test_cases *tc_ptr)
{
if (cktcsid(tc_ptr->tcid, RMDIR)) {
@@ -1350,8 +1336,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_EXDEV(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_EXDEV(struct all_test_cases *tc_ptr)
{
if (cktcsid(tc_ptr->tcid, RENAME)) {
@@ -1388,8 +1373,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_ENAMETOOLONG(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_ENAMETOOLONG(struct all_test_cases *tc_ptr)
{
int ret;
@@ -1440,8 +1424,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_EINVAL(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_EINVAL(struct all_test_cases *tc_ptr)
{
if (cktcsid(tc_ptr->tcid, READLINK)) {
TEST( readlink(tc_ptr->fn_arg[0], test_msg, BUFMAX) );
@@ -1473,8 +1456,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_readlink(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_readlink(struct all_test_cases *tc_ptr)
{
char scratch[PATH_MAX];
int ret;
@@ -1514,8 +1496,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_stat(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_stat(struct all_test_cases *tc_ptr)
{
if (statter.st_dev != asymlink.st_dev)
tst_resm(TFAIL,
@@ -1575,8 +1556,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_chdir(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_chdir(struct all_test_cases *tc_ptr)
{
if (mkdir(tc_ptr->fn_arg[2],MODE) == -1)
tst_resm(TFAIL, "Could not create a setup directory file");
@@ -1626,8 +1606,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_link(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_link(struct all_test_cases *tc_ptr)
{
struct stat stbuf;
@@ -1688,8 +1667,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_unlink(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_unlink(struct all_test_cases *tc_ptr)
{
if (stat(tc_ptr->fn_arg[2], &asymlink) == -1)
tst_resm(TBROK,
@@ -1730,8 +1708,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_chmod(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_chmod(struct all_test_cases *tc_ptr)
{
if (stat(tc_ptr->fn_arg[2], &asymlink) == -1)
tst_resm(TBROK,
@@ -1772,8 +1749,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_utime(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_utime(struct all_test_cases *tc_ptr)
{
struct utimbuf utimes;
@@ -1828,8 +1804,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_rename(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_rename(struct all_test_cases *tc_ptr)
{
int pts_at_object = 0;
@@ -1870,8 +1845,7 @@ struct all_test_cases *tc_ptr;
* all_test_cases
***********************************************************************/
void
-do_open(tc_ptr)
-struct all_test_cases *tc_ptr;
+do_open(struct all_test_cases *tc_ptr)
{
int fd = -1;
int ret, pts_at_object = 0;
diff --git a/winsup/testsuite/winsup.api/ltp/unlink08.c b/winsup/testsuite/winsup.api/ltp/unlink08.c
index e793b46..367b13d 100644
--- a/winsup/testsuite/winsup.api/ltp/unlink08.c
+++ b/winsup/testsuite/winsup.api/ltp/unlink08.c
@@ -129,15 +129,15 @@ extern int Tst_count; /* Test Case counter for tst_* routines */
int exp_enos[]={0, 0};
-int unwrite_dir_setup();
-int unsearch_dir_setup();
-int dir_setup();
-int no_setup();
+int unwrite_dir_setup(int flag);
+int unsearch_dir_setup(int flag);
+int dir_setup(int flag);
+int no_setup(int flag);
struct test_case_t {
const char *pathname;
const char *desc;
- int (*setupfunc)();
+ int (*setupfunc)(int flag);
int exp_ret; /* -1 means error, 0 means != -1 */
int exp_errno;
} Test_cases[] = {
@@ -306,8 +306,7 @@ cleanup()
*
******************************************************************/
int
-unwrite_dir_setup(flag)
-int flag;
+unwrite_dir_setup(int flag)
{
int fd;
@@ -358,8 +357,7 @@ int flag;
*
******************************************************************/
int
-unsearch_dir_setup(flag)
-int flag;
+unsearch_dir_setup(int flag)
{
int fd;
@@ -410,8 +408,7 @@ int flag;
*
******************************************************************/
int
-dir_setup(flag)
-int flag;
+dir_setup(int flag)
{
if (mkdir("regdir", 0777) == -1 ) {
tst_brkm(TBROK, cleanup,
@@ -425,8 +422,7 @@ int flag;
*
******************************************************************/
int
-no_setup(flag)
-int flag;
+no_setup(int flag)
{
return 0;
}
diff --git a/winsup/testsuite/winsup.api/pthread/cancel3.c b/winsup/testsuite/winsup.api/pthread/cancel3.c
index 8ed7d52..18caf23 100644
--- a/winsup/testsuite/winsup.api/pthread/cancel3.c
+++ b/winsup/testsuite/winsup.api/pthread/cancel3.c
@@ -40,6 +40,7 @@
*/
#include "test.h"
+#include "cpu_relax.h"
/*
* Create NUMTHREADS threads in addition to the Main thread.
@@ -88,7 +89,7 @@ mythread(void * arg)
{
int i;
for (i = 0; i < 1E7; i++)
- __asm__ volatile ("pause":::);
+ CPU_RELAX();
}
}
diff --git a/winsup/testsuite/winsup.api/pthread/cancel5.c b/winsup/testsuite/winsup.api/pthread/cancel5.c
index dd5be7b..05b8ef9 100644
--- a/winsup/testsuite/winsup.api/pthread/cancel5.c
+++ b/winsup/testsuite/winsup.api/pthread/cancel5.c
@@ -38,12 +38,13 @@
*
* Fail Criteria:
* - Process returns non-zero exit status.
- */
-
-#include "test.h"
-
-/*
- * Create NUMTHREADS threads in addition to the Main thread.
+ */
+
+#include "test.h"
+#include "cpu_relax.h"
+
+/*
+ * Create NUMTHREADS threads in addition to the Main thread.
*/
enum {
NUMTHREADS = 10
@@ -89,7 +90,7 @@ mythread(void * arg)
{
int i;
for (i = 0; i < 1E7; i++)
- __asm__ volatile ("pause":::);
+ CPU_RELAX();
}
}
diff --git a/winsup/testsuite/winsup.api/pthread/cpu_relax.h b/winsup/testsuite/winsup.api/pthread/cpu_relax.h
new file mode 100644
index 0000000..1936dc5
--- /dev/null
+++ b/winsup/testsuite/winsup.api/pthread/cpu_relax.h
@@ -0,0 +1,12 @@
+#ifndef CPU_RELAX_H
+#define CPU_RELAX_H
+
+#if defined(__x86_64__) || defined(__i386__) // Check for x86 architectures
+ #define CPU_RELAX() __asm__ volatile ("pause" :::)
+#elif defined(__aarch64__) || defined(__arm__) // Check for ARM architectures
+ #define CPU_RELAX() __asm__ volatile ("yield" :::)
+#else
+ #error unimplemented for this target
+#endif
+
+#endif