about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--linuxthreads/ChangeLog10
-rw-r--r--linuxthreads/Examples/ex1.c7
-rw-r--r--linuxthreads/Examples/ex2.c5
-rw-r--r--linuxthreads/Examples/ex3.c24
-rw-r--r--linuxthreads/Examples/ex4.c6
-rw-r--r--linuxthreads/Examples/ex5.c2
-rw-r--r--linuxthreads/Examples/ex6.c38
-rw-r--r--linuxthreads/Makefile11
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h1
10 files changed, 81 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index cbb2f93c0e..4d02e81937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 1998-07-07  Ulrich Drepper  <drepper@cygnus.com>
 
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Add
+	__ino64_t definition.
 	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Define
 	__off64_t.  Reported by Felix von Leitner <leitner@math.fu-berlin.de>.
 
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 83c98565a2..c149bdde9c 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,13 @@
+1998-07-07 15:20  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile: Add rules to compile and run tests.
+	* Examples/ex1.c: Little changes to fix warnings.
+	* Examples/ex2.c: Likewise.
+	* Examples/ex3.c: Likewise.
+	* Examples/ex4.c: Likewise.
+	* Examples/ex5.c: Likewise.
+	* Examples/ex6.c: New file.
+
 1998-07-05 11:54  Ulrich Drepper  <drepper@cygnus.com>
 
 	* Versions: Add pthread_attr_init to GLIBC_2.1 version in libc.
diff --git a/linuxthreads/Examples/ex1.c b/linuxthreads/Examples/ex1.c
index c399fab894..f455ecfaf0 100644
--- a/linuxthreads/Examples/ex1.c
+++ b/linuxthreads/Examples/ex1.c
@@ -17,15 +17,15 @@ void * process(void * arg)
   return NULL;
 }
 
-int main()
+int main(void)
 {
   int retcode;
   pthread_t th_a, th_b;
   void * retval;
 
-  retcode = pthread_create(&th_a, NULL, process, "a");
+  retcode = pthread_create(&th_a, NULL, process, (void *) "a");
   if (retcode != 0) fprintf(stderr, "create a failed %d\n", retcode);
-  retcode = pthread_create(&th_b, NULL, process, "b");
+  retcode = pthread_create(&th_b, NULL, process, (void *) "b");
   if (retcode != 0) fprintf(stderr, "create b failed %d\n", retcode);
   retcode = pthread_join(th_a, &retval);
   if (retcode != 0) fprintf(stderr, "join a failed %d\n", retcode);
@@ -33,4 +33,3 @@ int main()
   if (retcode != 0) fprintf(stderr, "join b failed %d\n", retcode);
   return 0;
 }
-
diff --git a/linuxthreads/Examples/ex2.c b/linuxthreads/Examples/ex2.c
index 3f7f115fda..70cb6b3986 100644
--- a/linuxthreads/Examples/ex2.c
+++ b/linuxthreads/Examples/ex2.c
@@ -97,7 +97,7 @@ void * consumer(void * data)
   return NULL;
 }
 
-int main()
+int main(void)
 {
   pthread_t th_a, th_b;
   void * retval;
@@ -111,6 +111,3 @@ int main()
   pthread_join(th_b, &retval);
   return 0;
 }
-  
-
-
diff --git a/linuxthreads/Examples/ex3.c b/linuxthreads/Examples/ex3.c
index 002bc9042a..7557cc7983 100644
--- a/linuxthreads/Examples/ex3.c
+++ b/linuxthreads/Examples/ex3.c
@@ -1,6 +1,7 @@
 /* Multi-thread searching.
    Illustrates: thread cancellation, cleanup handlers. */
 
+#include <errno.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -19,9 +20,7 @@ pthread_t threads[NUM_THREADS];
 pthread_mutex_t lock;
 int tries;
 
-int main(argc, argv)
-     int argc;
-     char ** argv;
+int main(int argc, char ** argv)
 {
   int i;
   int pid;
@@ -31,14 +30,14 @@ int main(argc, argv)
   printf("Searching for the number = %d...\n", pid);
 
   /* Initialize the mutex lock */
-  pthread_mutex_init(&lock, NULL); 
+  pthread_mutex_init(&lock, NULL);
 
   /* Create the searching threads */
   for (i=0; i<NUM_THREADS; i++)
     pthread_create(&threads[i], NULL, search, (void *)pid);
 
   /* Wait for (join) all the searching threads */
-  for (i=0; i<NUM_THREADS; i++) 
+  for (i=0; i<NUM_THREADS; i++)
     pthread_join(threads[i], NULL);
 
   printf("It took %d tries to find the number.\n", tries);
@@ -47,7 +46,7 @@ int main(argc, argv)
   return 0;
 }
 
-/* This is the cleanup function that is called 
+/* This is the cleanup function that is called
    when the threads are cancelled */
 
 void print_it(void *arg)
@@ -59,7 +58,7 @@ void print_it(void *arg)
   tid = pthread_self();
 
   /* Print where the thread was in its search when it was cancelled */
-  printf("Thread %lx was canceled on its %d try.\n", tid, *try); 
+  printf("Thread %lx was canceled on its %d try.\n", tid, *try);
 }
 
 /* This is the search routine that is executed in each thread */
@@ -82,20 +81,20 @@ void *search(void *arg)
   ntries = 0;
 
   /* Set the cancellation parameters --
-     - Enable thread cancellation 
+     - Enable thread cancellation
      - Defer the action of the cancellation */
 
   pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
   pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
 
   /* Push the cleanup routine (print_it) onto the thread
-     cleanup stack.  This routine will be called when the 
+     cleanup stack.  This routine will be called when the
      thread is cancelled.  Also note that the pthread_cleanup_push
      call must have a matching pthread_cleanup_pop call.  The
-     push and pop calls MUST be at the same lexical level 
+     push and pop calls MUST be at the same lexical level
      within the code */
 
-  /* Pass address of `ntries' since the current value of `ntries' is not 
+  /* Pass address of `ntries' since the current value of `ntries' is not
      the one we want to use in the cleanup function */
 
   pthread_cleanup_push(print_it, (void *)&ntries);
@@ -118,7 +117,7 @@ void *search(void *arg)
       printf("Thread %lx found the number!\n", tid);
 
       /* Cancel all the other threads */
-      for (j=0; j<NUM_THREADS; j++) 
+      for (j=0; j<NUM_THREADS; j++)
         if (threads[j] != tid) pthread_cancel(threads[j]);
 
       /* Break out of the while loop */
@@ -141,4 +140,3 @@ void *search(void *arg)
   pthread_cleanup_pop(0);
   return((void *)0);
 }
-
diff --git a/linuxthreads/Examples/ex4.c b/linuxthreads/Examples/ex4.c
index 83bc54c913..8ad7454eb8 100644
--- a/linuxthreads/Examples/ex4.c
+++ b/linuxthreads/Examples/ex4.c
@@ -40,7 +40,7 @@ static void str_alloc_destroy_accu(void * accu);
 
 /* Thread-safe version of str_accumulate */
 
-char * str_accumulate(char * s)
+char * str_accumulate(const char * s)
 {
   char * accu;
 
@@ -97,8 +97,8 @@ int main(int argc, char ** argv)
   pthread_t th1, th2;
 
   res = str_accumulate("Result of ");
-  pthread_create(&th1, NULL, process, "first");
-  pthread_create(&th2, NULL, process, "second");
+  pthread_create(&th1, NULL, process, (void *) "first");
+  pthread_create(&th2, NULL, process, (void *) "second");
   res = str_accumulate("initial thread");
   printf("Thread %lx: \"%s\"\n", pthread_self(), res);
   pthread_join(th1, NULL);
diff --git a/linuxthreads/Examples/ex5.c b/linuxthreads/Examples/ex5.c
index 366668eb8c..475de0e0c5 100644
--- a/linuxthreads/Examples/ex5.c
+++ b/linuxthreads/Examples/ex5.c
@@ -86,7 +86,7 @@ void * consumer(void * data)
   return NULL;
 }
 
-int main()
+int main(void)
 {
   pthread_t th_a, th_b;
   void * retval;
diff --git a/linuxthreads/Examples/ex6.c b/linuxthreads/Examples/ex6.c
new file mode 100644
index 0000000000..32621d33df
--- /dev/null
+++ b/linuxthreads/Examples/ex6.c
@@ -0,0 +1,38 @@
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+
+void *
+test_thread (void *v_param)
+{
+  return NULL;
+}
+
+int
+main (void)
+{
+  unsigned long count;
+
+  for (count = 0; count < 2000; ++count)
+    {
+      pthread_t thread;
+      int status;
+
+      status = pthread_create (&thread, NULL, test_thread, NULL);
+      if (status != 0)
+	{
+	  printf ("status = %d, count = %lu: %s\n", status, count,
+		  strerror (errno));
+	  return 1;
+	}
+      else
+	{
+	  printf ("count = %lu\n", count);
+	}
+      /* pthread_detach (thread); */
+      pthread_join (thread, NULL);
+      usleep (50);
+    }
+  return 0;
+}
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index da92138111..b7444e7e4e 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -35,9 +35,20 @@ libpthread-routines := attr cancel condvar join manager mutex ptfork \
 		       ptlongjmp pthread signals specific errno lockfile \
 		       semaphore spinlock wrapsyscall rwlock
 
+vpath %.c Examples
+tests = ex1 ex2 ex3 ex4 ex5 ex6
+
 include ../Rules
 
 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
 # This ensures they will load libc.so for needed symbols if loaded by
 # a statically-linked program that hasn't already loaded it.
 $(objpfx)libpthread.so: $(common-objpfx)libc.so
+
+# Make sure we link with the thread library.
+$(objpfx)ex1: $(objpfx)libpthread.so
+$(objpfx)ex2: $(objpfx)libpthread.so
+$(objpfx)ex3: $(objpfx)libpthread.so
+$(objpfx)ex4: $(objpfx)libpthread.so
+$(objpfx)ex5: $(objpfx)libpthread.so
+$(objpfx)ex6: $(objpfx)libpthread.so
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 6a4133da20..88638143d6 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -49,6 +49,7 @@ typedef __u_long __dev_t;		/* Type of device numbers.  */
 typedef __u_int __uid_t;		/* Type of user identifications.  */
 typedef __u_int __gid_t;		/* Type of group identifications.  */
 typedef __u_long __ino_t;		/* Type of file serial numbers.  */
+typedef __u_long __ino64_t;		/* Type of file serial numbers.  */
 typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
 typedef __u_int __nlink_t; 		/* Type of file link counts.  */
 typedef long int __off_t;		/* Type of file sizes and offsets.  */