CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS)
test check all: $(TARGETS)
+ @true
$(TARGETS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
$(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
extern int __pthread_once(void);
+void dltest(uint32_t **value1, uint32_t **value2);
void dltest(uint32_t **value1, uint32_t **value2)
{
*value1 = (uint32_t *) __pthread_once;
extern int libtest2_func(const char *s);
-
-void __attribute__((constructor)) libtest1_ctor(void)
+void __attribute__((constructor)) libtest1_ctor(void);
+void libtest1_ctor(void)
{
printf("libtest1: constructor!\n");
}
-void __attribute__((destructor)) libtest1_dtor(void)
+void __attribute__((destructor)) libtest1_dtor(void);
+void libtest1_dtor(void)
{
printf("libtest1: destructor!\n");
}
-void __attribute__((weak)) function1(void)
+void __attribute__((weak)) function1(void);
+void function1(void)
{
printf("libtest1: I am weak function1!\n");
}
+void function2(void);
void function2(void)
{
printf("libtest1: I am function2!\n");
}
-
+int dltest(const char *s);
int dltest(const char *s)
{
printf( "libtest1: function1 = %p\n"
#include <stdio.h>
#include <pthread.h>
-void __attribute__((constructor)) libtest2_ctor(void)
+void __attribute__((constructor)) libtest2_ctor(void);
+void libtest2_ctor(void)
{
printf("libtest2: constructor!\n");
}
-void __attribute__((destructor)) libtest2_dtor(void)
+void __attribute__((destructor)) libtest2_dtor(void);
+void libtest2_dtor(void)
{
printf("libtest2: destructor!\n");
}
+void function1(void);
void function1(void)
{
printf("libtest2: I am function1!\n");
}
-void __attribute__((weak)) function2(void)
+void __attribute__((weak)) function2(void);
+void function2(void)
{
printf("libtest2: I am weak function2!\n");
}
+int libtest2_func(const char *s);
int libtest2_func(const char *s)
{
printf( "libtest2: function1 = %p\n"
static char ifname[IF_NAMESIZE];
-void test_if_nameindex(void)
+static void test_if_nameindex(void)
{
size_t i;
struct if_nameindex *ret;
if_freenameindex(ret);
}
-void test_if_indextoname(void)
+static void test_if_indextoname(void)
{
if (if_indextoname(1, ifname) == NULL) {
perror("if_nameindex()");
printf("if_indextoname(1) = %s\n", ifname);
}
-void test_if_nametoindex(void)
+static void test_if_nametoindex(void)
{
int ifindex = if_nametoindex(ifname);
}
-int
+static int
do_test (void)
{
glob_t gl;
return 0;
}
#else
-int do_test (void) { return 0; }
+static int do_test (void) { return 0; }
#endif
#define TEST_FUNCTION do_test ()
#include <string.h>
#include <sys/types.h>
#include <stdarg.h>
-int foo(const char *format, ...)
+static int foo(const char *format, ...)
{
va_list ap;
size_t len;
#include <unistd.h>
#include "pthread.h"
-void *process(void * arg)
+static void *process(void * arg)
{
int i;
printf("Starting process %s\n", (char *)arg);
/* Initialize a buffer */
-void init(struct prodcons * b)
+static void init(struct prodcons * b)
{
pthread_mutex_init(&b->lock, NULL);
pthread_cond_init(&b->notempty, NULL);
/* Store an integer in the buffer */
-void put(struct prodcons * b, int data)
+static void put(struct prodcons * b, int data)
{
pthread_mutex_lock(&b->lock);
/* Wait until buffer is not full */
/* Read and remove an integer from the buffer */
-int get(struct prodcons * b)
+static int get(struct prodcons * b)
{
int data;
pthread_mutex_lock(&b->lock);
struct prodcons buffer;
-void * producer(void * data)
+static void * producer(void * data)
{
int n;
for (n = 0; n < 10000; n++) {
return NULL;
}
-void * consumer(void * data)
+static void * consumer(void * data)
{
int d;
while (1) {
#if 0
-char * str_accumulate(char * s)
+static char * str_accumulate(char * s)
{
static char accu[1024] = { 0 };
strcat(accu, s);
/* Thread-safe version of str_accumulate */
-char * str_accumulate(const char * s)
+static char * str_accumulate(const char * s)
{
char * accu;
/* Test program */
-void * process(void * arg)
+static void * process(void * arg)
{
char * res;
res = str_accumulate("Result of ");
/* Initialize a buffer */
-void init(struct prodcons * b)
+static void init(struct prodcons * b)
{
sem_init(&b->sem_write, 0, BUFFER_SIZE - 1);
sem_init(&b->sem_read, 0, 0);
/* Store an integer in the buffer */
-void put(struct prodcons * b, int data)
+static void put(struct prodcons * b, int data)
{
/* Wait until buffer is not full */
sem_wait(&b->sem_write);
/* Read and remove an integer from the buffer */
-int get(struct prodcons * b)
+static int get(struct prodcons * b)
{
int data;
/* Wait until buffer is not empty */
struct prodcons buffer;
-void * producer(void * data)
+static void * producer(void * data)
{
int n;
for (n = 0; n < 10000; n++) {
return NULL;
}
-void * consumer(void * data)
+static void * consumer(void * data)
{
int d;
while (1) {
#include <pthread.h>
#include <unistd.h>
-void *
+static void *
test_thread (void *v_param)
{
return NULL;
event_t main_event;
-void *
+static void *
test_thread (void *ms_param)
{
unsigned long status = 0;
int verbose = 0;
-int execute_child(const char *prog)
+static int execute_child(const char *prog)
{
int status;
pid_t child;
sigset_t orig_mask;
-int check_sig_mask(void)
+static int check_sig_mask(void)
{
int status;
pid_t child;
#include <unistd.h>
-void test_handler(int signo)
+#ifdef __ARCH_USE_MMU__
+
+static void test_handler(int signo)
{
write(1, "caught SIGCHLD\n", 15);
return;
}
-
-#ifdef __ARCH_USE_MMU__
-
-int main(void)
+int main(void)
{
pid_t mypid;
struct sigaction siga;
fprintf(stderr, "sigaction choked: %s!", strerror(errno));
exit(EXIT_FAILURE);
}
-
/* Setup a child process to exercise the sig handling for us */
mypid = getpid();
sleep(10);
if (waitpid(-1, NULL, WNOHANG | WUNTRACED) > 0)
break;
- write(1, "after sleep\n", 12);
+ write(1, "after sleep\n", 12);
}
printf("Bye-bye! All done!\n");
const char *it = "<UNSET>"; /* Routine name for message routines. */
size_t errors = 0;
-void check(int thing, int number)
+static void check(int thing, int number)
{
if (!thing) {
printf("%s: flunked test %d\n", it, number);
}
}
-void equal(const char *a, const char *b, int number)
+#if 0
+static void equal(const char *a, const char *b, int number)
{
check(a != NULL && b != NULL && (strcmp(a, b) == 0), number);
}
+#endif
/* -------------------------------------------------*/
int global_int = 0;
-void set_global_int_to_one(int signum)
+static void set_global_int_to_one(int signum)
{
printf ("Received signal %d (%s).\n", signum, strsignal(signum));
global_int = 1;
return;
}
-void signal_test_1(void)
+static void signal_test_1(void)
{
global_int = 0;
volatile int count;
-void
+static void
sh (int sig)
{
++count;
#include <assert.h>
#include <time.h>
-void show_stat(struct stat *st)
+static void show_stat(struct stat *st)
{
printf(
"------------------\n"
);
}
-int main()
+int main(void)
{
int ret;
int fd;
#include <unistd.h>
#include <stdlib.h>
-void print_struct_stat(char *msg, struct stat *s)
+static void print_struct_stat(char *msg, struct stat *s)
{
printf("%s\n", msg);
/* The casts are because glibc thinks it's cool */
#include <stdlib.h>
#include <unistd.h>
-int select_files(const struct dirent *dirbuf)
+static int select_files(const struct dirent *dirbuf)
{
- if (dirbuf->d_name[0] == '.')
- return 0;
- else
- return 1;
+ if (dirbuf->d_name[0] == '.')
+ return 0;
+ else
+ return 1;
}
-
int main(void)
{
- struct dirent **array;
- struct dirent *dirbuf;
+ struct dirent **array;
+ struct dirent *dirbuf;
- int i, numdir;
+ int i, numdir;
- chdir("/");
- numdir = scandir(".", &array, select_files, NULL);
- printf("\nGot %d entries from scandir().\n", numdir);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- free(array[i]);
- }
- free(array);
- numdir = scandir(".", &array, select_files, alphasort);
- printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- }
- printf("\nCalling qsort()\n");
- qsort(array, numdir, sizeof(struct dirent *), alphasort);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- free(array[i]);
- }
- free(array);
- return(0);
+ chdir("/");
+ numdir = scandir(".", &array, select_files, NULL);
+ printf("\nGot %d entries from scandir().\n", numdir);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ free(array[i]);
+ }
+ free(array);
+ numdir = scandir(".", &array, select_files, alphasort);
+ printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ }
+ printf("\nCalling qsort()\n");
+ qsort(array, numdir, sizeof(struct dirent *), alphasort);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ free(array[i]);
+ }
+ free(array);
+ return (0);
}
-
#define GOT3 (1 << 3)
#define ALLGOT (GOT1|GOT2|GOT3)
-void child_handler(int sig)
+static void child_handler(int sig)
{
printf("I got a SIGCHLD\n");
}
-int clone_main(void *arg)
+static int clone_main(void *arg)
{
unsigned long input = (unsigned long)arg;
int secs = (input / 10) * 4;
#include <sched.h>
#include "clone_cruft.h"
-int child_fn(void *arg)
+static int child_fn(void *arg)
{
fprintf(stderr, "in child_fn\n");
exit(1);
#ifdef __ARCH_USE_MMU__
-void child_handler(int sig)
+static void child_handler(int sig)
{
fprintf(stderr, "I got a SIGCHLD\n");
}