This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

linuxthreads prototype fixes



Here's a patch to fix all remaining prototype warnings in the
linuxthreads sub directory (and two or three more).  I've tested the
patches on i386 and now get for linuxthreads the following warnings
that I don't intend to silence for now (you might get more warnings if
you enable more warning flags):

weaks.c:120: warning: function might be possible candidate for attribute `noreturn'
weaks.c:120: warning: function might be possible candidate for attribute `noreturn'
manager.c:216: warning: function might be possible candidate for attribute `noreturn'
manager.c:894: warning: function might be possible candidate for attribute `noreturn'
manager.c:894: warning: function might be possible candidate for attribute `noreturn'
manager.c:894: warning: function might be possible candidate for attribute `noreturn'
manager.c:216: warning: function might be possible candidate for attribute `noreturn'
manager.c:298: warning: function might be possible candidate for attribute `noreturn'
manager.c:894: warning: function might be possible candidate for attribute `noreturn'
manager.c:894: warning: function might be possible candidate for attribute `noreturn'
Examples/ex7.c:46: warning: function might be possible candidate for attribute `noreturn'
Examples/ex9.c:94: warning: function might be possible candidate for attribute `noreturn'
Examples/ex10.c:105: warning: function might be possible candidate for attribute `noreturn'
Examples/ex13.c:74: warning: function might be possible candidate for attribute `noreturn'
unload.c:46: warning: function might be possible candidate for attribute `noreturn'

Ok to commit?

Andreas

2000-12-27  Andreas Jaeger  <aj@suse.de>

	* include/sys/wait.h: Add some prototypes.
	* Rules (dummy.c): Create also prototype to shut up GCC.

For linuxthreads:
2000-12-27  Andreas Jaeger  <aj@suse.de>

	* Examples/ex13.c: Make local functions static.
	* ecmutex.c: Likewise.
	* Examples/ex14.c: Likewise.

	* Examples/ex2.c: Make local functions static; reformat.
	* Examples/ex1.c: Likewise.
	* Examples/ex4.c: Likewise.
	* Examples/ex5.c: Likewise.
	* Examples/ex7.c: Likewise.

	* oldsemaphore.c: Add prototypes to shut up GCC.
	* pt-machine.c: Likewise.

	* weaks.c: Add prototype for pthread_exit.

	* internals.h: Add some prototypes, format prototypes and add
	missing externs.
	Move __libc_waitpid prototype to include/sys/wait.h.

	* rwlock.c: Include <bits/libc-lock.h> for prototypes.
	* mutex.c: Likewise.
	* specific.c: Likewise.
	* ptfork.c: Likewise.

	* lockfile.c: Include internals.h to get prototypes.
	* events.c: Likewise.
	* sysdeps/alpha/pspinlock.c: Likewise.
	* sysdeps/arm/pspinlock.c: Likewise.
	* sysdeps/hppa/pspinlock.c: Likewise.
	* sysdeps/i386/pspinlock.c: Likewise.
	* sysdeps/ia64/pspinlock.c: Likewise.
	* sysdeps/m68k/pspinlock.c: Likewise.
	* sysdeps/mips/pspinlock.c: Likewise.
	* sysdeps/powerpc/pspinlock.c: Likewise.
	* sysdeps/s390/pspinlock.c: Likewise.
	* sysdeps/sh/pspinlock.c: Likewise.
	* sysdeps/sparc/sparc32/pspinlock.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/pspinlock.c: Likewise.
	* sysdeps/sparc/sparc64/pspinlock.c: Likewise.

============================================================
Index: linuxthreads/Examples/ex1.c
--- linuxthreads/Examples/ex1.c	1998/07/07 15:22:57	1.2
+++ linuxthreads/Examples/ex1.c	2000/12/27 13:23:05
@@ -7,29 +7,36 @@
 #include <unistd.h>
 #include "pthread.h"
 
-void * process(void * arg)
+static void *
+process (void *arg)
 {
   int i;
-  fprintf(stderr, "Starting process %s\n", (char *) arg);
-  for (i = 0; i < 10000; i++) {
-    write(1, (char *) arg, 1);
-  }
+  fprintf (stderr, "Starting process %s\n", (char *) arg);
+  for (i = 0; i < 10000; i++)
+    {
+      write (1, (char *) arg, 1);
+    }
   return NULL;
 }
 
-int main(void)
+int
+main (void)
 {
   int retcode;
   pthread_t th_a, th_b;
-  void * retval;
+  void *retval;
 
-  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, (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);
-  retcode = pthread_join(th_b, &retval);
-  if (retcode != 0) fprintf(stderr, "join b failed %d\n", retcode);
+  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, (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);
+  retcode = pthread_join (th_b, &retval);
+  if (retcode != 0)
+    fprintf (stderr, "join b failed %d\n", retcode);
   return 0;
 }
============================================================
Index: linuxthreads/Examples/ex13.c
--- linuxthreads/Examples/ex13.c	2000/08/24 14:10:38	1.3
+++ linuxthreads/Examples/ex13.c	2000/12/27 13:23:06
@@ -32,7 +32,7 @@
   int retval;
 };
 
-void
+static void
 dump_mut (pthread_mutex_t * mut)
 {
   int i;
@@ -43,7 +43,7 @@
 };
 
 /* Helper, the opposite of pthread_cond_wait (cond, mut).  */
-void
+static void
 pthr_cond_signal_mutex (pthread_cond_t * cond, pthread_mutex_t * mut)
 {
   int err;
@@ -59,7 +59,7 @@
 }
 
 
-void *
+static void *
 thread_start (void *ptr)
 {
   struct thr_ctrl *tc = ptr;
============================================================
Index: linuxthreads/Examples/ex14.c
--- linuxthreads/Examples/ex14.c	2000/11/20 17:37:16	1.3
+++ linuxthreads/Examples/ex14.c	2000/12/27 13:23:06
@@ -92,7 +92,7 @@
 
 #define TEST_FUNCTION do_test ()
 #define TIMEOUT 60
-int
+static int
 do_test (void)
 {
   pthread_t threads[NTHREADS];
============================================================
Index: linuxthreads/Examples/ex2.c
--- linuxthreads/Examples/ex2.c	1998/07/07 15:22:58	1.2
+++ linuxthreads/Examples/ex2.c	2000/12/27 13:23:06
@@ -10,61 +10,66 @@
 
 /* Circular buffer of integers. */
 
-struct prodcons {
-  int buffer[BUFFER_SIZE];      /* the actual data */
-  pthread_mutex_t lock;         /* mutex ensuring exclusive access to buffer */
-  int readpos, writepos;        /* positions for reading and writing */
-  pthread_cond_t notempty;      /* signaled when buffer is not empty */
-  pthread_cond_t notfull;       /* signaled when buffer is not full */
+struct prodcons
+{
+  int buffer[BUFFER_SIZE];	/* the actual data */
+  pthread_mutex_t lock;		/* mutex ensuring exclusive access to buffer */
+  int readpos, writepos;	/* positions for reading and writing */
+  pthread_cond_t notempty;	/* signaled when buffer is not empty */
+  pthread_cond_t notfull;	/* signaled when buffer is not full */
 };
 
 /* 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);
-  pthread_cond_init(&b->notfull, NULL);
+  pthread_mutex_init (&b->lock, NULL);
+  pthread_cond_init (&b->notempty, NULL);
+  pthread_cond_init (&b->notfull, NULL);
   b->readpos = 0;
   b->writepos = 0;
 }
 
 /* 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);
+  pthread_mutex_lock (&b->lock);
   /* Wait until buffer is not full */
-  while ((b->writepos + 1) % BUFFER_SIZE == b->readpos) {
-    pthread_cond_wait(&b->notfull, &b->lock);
-    /* pthread_cond_wait reacquired b->lock before returning */
-  }
+  while ((b->writepos + 1) % BUFFER_SIZE == b->readpos)
+    {
+      pthread_cond_wait (&b->notfull, &b->lock);
+      /* pthread_cond_wait reacquired b->lock before returning */
+    }
   /* Write the data and advance write pointer */
   b->buffer[b->writepos] = data;
   b->writepos++;
-  if (b->writepos >= BUFFER_SIZE) b->writepos = 0;
+  if (b->writepos >= BUFFER_SIZE)
+    b->writepos = 0;
   /* Signal that the buffer is now not empty */
-  pthread_cond_signal(&b->notempty);
-  pthread_mutex_unlock(&b->lock);
+  pthread_cond_signal (&b->notempty);
+  pthread_mutex_unlock (&b->lock);
 }
 
 /* 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);
+  pthread_mutex_lock (&b->lock);
   /* Wait until buffer is not empty */
-  while (b->writepos == b->readpos) {
-    pthread_cond_wait(&b->notempty, &b->lock);
-  }
+  while (b->writepos == b->readpos)
+    {
+      pthread_cond_wait (&b->notempty, &b->lock);
+    }
   /* Read the data and advance read pointer */
   data = b->buffer[b->readpos];
   b->readpos++;
-  if (b->readpos >= BUFFER_SIZE) b->readpos = 0;
+  if (b->readpos >= BUFFER_SIZE)
+    b->readpos = 0;
   /* Signal that the buffer is now not full */
-  pthread_cond_signal(&b->notfull);
-  pthread_mutex_unlock(&b->lock);
+  pthread_cond_signal (&b->notfull);
+  pthread_mutex_unlock (&b->lock);
   return data;
 }
 
@@ -75,39 +80,45 @@
 
 struct prodcons buffer;
 
-void * producer(void * data)
+static void *
+producer (void *data)
 {
   int n;
-  for (n = 0; n < 10000; n++) {
-    printf("%d --->\n", n);
-    put(&buffer, n);
-  }
-  put(&buffer, OVER);
+  for (n = 0; n < 10000; n++)
+    {
+      printf ("%d --->\n", n);
+      put (&buffer, n);
+    }
+  put (&buffer, OVER);
   return NULL;
 }
 
-void * consumer(void * data)
+static void *
+consumer (void *data)
 {
   int d;
-  while (1) {
-    d = get(&buffer);
-    if (d == OVER) break;
-    printf("---> %d\n", d);
-  }
+  while (1)
+    {
+      d = get (&buffer);
+      if (d == OVER)
+	break;
+      printf ("---> %d\n", d);
+    }
   return NULL;
 }
 
-int main(void)
+int
+main (void)
 {
   pthread_t th_a, th_b;
-  void * retval;
+  void *retval;
 
-  init(&buffer);
+  init (&buffer);
   /* Create the threads */
-  pthread_create(&th_a, NULL, producer, 0);
-  pthread_create(&th_b, NULL, consumer, 0);
+  pthread_create (&th_a, NULL, producer, 0);
+  pthread_create (&th_b, NULL, consumer, 0);
   /* Wait until producer and consumer finish. */
-  pthread_join(th_a, &retval);
-  pthread_join(th_b, &retval);
+  pthread_join (th_a, &retval);
+  pthread_join (th_b, &retval);
   return 0;
 }
============================================================
Index: linuxthreads/Examples/ex4.c
--- linuxthreads/Examples/ex4.c	2000/10/31 04:10:12	1.4
+++ linuxthreads/Examples/ex4.c	2000/12/27 13:23:06
@@ -14,10 +14,11 @@
 
 #if 0
 
-char * str_accumulate(char * s)
+char *
+str_accumulate (char *s)
 {
   static char accu[1024] = { 0 };
-  strcat(accu, s);
+  strcat (accu, s);
   return accu;
 }
 
@@ -35,73 +36,80 @@
 static pthread_once_t str_alloc_key_once = PTHREAD_ONCE_INIT;
 
 /* Forward functions */
-static void str_alloc_key(void);
-static void str_alloc_destroy_accu(void * accu);
+static void str_alloc_key (void);
+static void str_alloc_destroy_accu (void *accu);
 
 /* Thread-safe version of str_accumulate */
 
-char * str_accumulate(const char * s)
+static char *
+str_accumulate (const char *s)
 {
-  char * accu;
+  char *accu;
 
   /* Make sure the key is allocated */
-  pthread_once(&str_alloc_key_once, str_alloc_key);
+  pthread_once (&str_alloc_key_once, str_alloc_key);
   /* Get the thread-specific data associated with the key */
-  accu = (char *) pthread_getspecific(str_key);
+  accu = (char *) pthread_getspecific (str_key);
   /* It's initially NULL, meaning that we must allocate the buffer first. */
-  if (accu == NULL) {
-    accu = malloc(1024);
-    if (accu == NULL) return NULL;
-    accu[0] = 0;
-    /* Store the buffer pointer in the thread-specific data. */
-    pthread_setspecific(str_key, (void *) accu);
-    printf("Thread %lx: allocating buffer at %p\n", pthread_self(), accu);
-  }
+  if (accu == NULL)
+    {
+      accu = malloc (1024);
+      if (accu == NULL)
+	return NULL;
+      accu[0] = 0;
+      /* Store the buffer pointer in the thread-specific data. */
+      pthread_setspecific (str_key, (void *) accu);
+      printf ("Thread %lx: allocating buffer at %p\n", pthread_self (), accu);
+    }
   /* Now we can use accu just as in the non thread-safe code. */
-  strcat(accu, s);
+  strcat (accu, s);
   return accu;
 }
 
 /* Function to allocate the key for str_alloc thread-specific data. */
 
-static void str_alloc_key(void)
+static void
+str_alloc_key (void)
 {
-  pthread_key_create(&str_key, str_alloc_destroy_accu);
-  printf("Thread %lx: allocated key %d\n", pthread_self(), str_key);
+  pthread_key_create (&str_key, str_alloc_destroy_accu);
+  printf ("Thread %lx: allocated key %d\n", pthread_self (), str_key);
 }
 
 /* Function to free the buffer when the thread exits. */
 /* Called only when the thread-specific data is not NULL. */
 
-static void str_alloc_destroy_accu(void * accu)
+static void
+str_alloc_destroy_accu (void *accu)
 {
-  printf("Thread %lx: freeing buffer at %p\n", pthread_self(), accu);
-  free(accu);
+  printf ("Thread %lx: freeing buffer at %p\n", pthread_self (), accu);
+  free (accu);
 }
 
 /* Test program */
 
-void * process(void * arg)
+static void *
+process (void *arg)
 {
-  char * res;
-  res = str_accumulate("Result of ");
-  res = str_accumulate((char *) arg);
-  res = str_accumulate(" thread");
-  printf("Thread %lx: \"%s\"\n", pthread_self(), res);
+  char *res;
+  res = str_accumulate ("Result of ");
+  res = str_accumulate ((char *) arg);
+  res = str_accumulate (" thread");
+  printf ("Thread %lx: \"%s\"\n", pthread_self (), res);
   return NULL;
 }
 
-int main(int argc, char ** argv)
+int
+main (int argc, char **argv)
 {
-  char * res;
+  char *res;
   pthread_t th1, th2;
 
-  res = str_accumulate("Result of ");
-  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);
-  pthread_join(th2, NULL);
+  res = str_accumulate ("Result of ");
+  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);
+  pthread_join (th2, NULL);
   return 0;
 }
============================================================
Index: linuxthreads/Examples/ex5.c
--- linuxthreads/Examples/ex5.c	1998/07/07 15:23:01	1.2
+++ linuxthreads/Examples/ex5.c	2000/12/27 13:23:06
@@ -10,50 +10,56 @@
 
 /* Circular buffer of integers. */
 
-struct prodcons {
-  int buffer[BUFFER_SIZE];      /* the actual data */
-  int readpos, writepos;        /* positions for reading and writing */
-  sem_t sem_read;               /* number of elements available for reading */
-  sem_t sem_write;              /* number of locations available for writing */
+struct prodcons
+{
+  int buffer[BUFFER_SIZE];	/* the actual data */
+  int readpos, writepos;	/* positions for reading and writing */
+  sem_t sem_read;		/* number of elements available for reading */
+  sem_t sem_write;		/* number of locations available for writing */
 };
 
 /* 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);
+  sem_init (&b->sem_write, 0, BUFFER_SIZE - 1);
+  sem_init (&b->sem_read, 0, 0);
   b->readpos = 0;
   b->writepos = 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);
+  sem_wait (&b->sem_write);
   /* Write the data and advance write pointer */
   b->buffer[b->writepos] = data;
   b->writepos++;
-  if (b->writepos >= BUFFER_SIZE) b->writepos = 0;
+  if (b->writepos >= BUFFER_SIZE)
+    b->writepos = 0;
   /* Signal that the buffer contains one more element for reading */
-  sem_post(&b->sem_read);
+  sem_post (&b->sem_read);
 }
 
 /* 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 */
-  sem_wait(&b->sem_read);
+  sem_wait (&b->sem_read);
   /* Read the data and advance read pointer */
   data = b->buffer[b->readpos];
   b->readpos++;
-  if (b->readpos >= BUFFER_SIZE) b->readpos = 0;
+  if (b->readpos >= BUFFER_SIZE)
+    b->readpos = 0;
   /* Signal that the buffer has now one more location for writing */
-  sem_post(&b->sem_write);
+  sem_post (&b->sem_write);
   return data;
 }
 
@@ -64,39 +70,45 @@
 
 struct prodcons buffer;
 
-void * producer(void * data)
+static void *
+producer (void *data)
 {
   int n;
-  for (n = 0; n < 10000; n++) {
-    printf("%d --->\n", n);
-    put(&buffer, n);
-  }
-  put(&buffer, OVER);
+  for (n = 0; n < 10000; n++)
+    {
+      printf ("%d --->\n", n);
+      put (&buffer, n);
+    }
+  put (&buffer, OVER);
   return NULL;
 }
 
-void * consumer(void * data)
+static void *
+consumer (void *data)
 {
   int d;
-  while (1) {
-    d = get(&buffer);
-    if (d == OVER) break;
-    printf("---> %d\n", d);
-  }
+  while (1)
+    {
+      d = get (&buffer);
+      if (d == OVER)
+	break;
+      printf ("---> %d\n", d);
+    }
   return NULL;
 }
 
-int main(void)
+int
+main (void)
 {
   pthread_t th_a, th_b;
-  void * retval;
+  void *retval;
 
-  init(&buffer);
+  init (&buffer);
   /* Create the threads */
-  pthread_create(&th_a, NULL, producer, 0);
-  pthread_create(&th_b, NULL, consumer, 0);
+  pthread_create (&th_a, NULL, producer, 0);
+  pthread_create (&th_b, NULL, consumer, 0);
   /* Wait until producer and consumer finish. */
-  pthread_join(th_a, &retval);
-  pthread_join(th_b, &retval);
+  pthread_join (th_a, &retval);
+  pthread_join (th_b, &retval);
   return 0;
 }
============================================================
Index: linuxthreads/Examples/ex7.c
--- linuxthreads/Examples/ex7.c	2000/05/07 21:22:32	1.1
+++ linuxthreads/Examples/ex7.c	2000/12/27 13:23:06
@@ -9,32 +9,37 @@
 #include <stdlib.h>
 #include <pthread.h>
 
-#define NTHREADS 20	/* number of threads */
+#define NTHREADS 20		/* number of threads */
 
-static void *thread(void *arg)
+static void *
+thread (void *arg)
 {
-  printf("thread terminating\n");
+  printf ("thread terminating\n");
   return 0;
 }
 
-void cleanup(void)
+static void
+cleanup (void)
 {
-  printf("atexit handler called\n");
+  printf ("atexit handler called\n");
 }
 
-int main(void)
+int
+main (void)
 {
   int i;
 
-  atexit(cleanup);
+  atexit (cleanup);
 
-  for (i = 0; i < NTHREADS; i++) {
-    pthread_t id;
-    if (pthread_create(&id, 0, thread, 0) != 0) {
-      fprintf(stderr, "pthread_create failed\n");
-      abort();
+  for (i = 0; i < NTHREADS; i++)
+    {
+      pthread_t id;
+      if (pthread_create (&id, 0, thread, 0) != 0)
+	{
+	  fprintf (stderr, "pthread_create failed\n");
+	  abort ();
+	}
     }
-  }
 
-  pthread_exit(0);
+  pthread_exit (0);
 }
============================================================
Index: linuxthreads/ecmutex.c
--- linuxthreads/ecmutex.c	2000/11/20 17:37:16	1.2
+++ linuxthreads/ecmutex.c	2000/12/27 13:23:06
@@ -130,7 +130,7 @@
 
 
 #define TEST_FUNCTION do_test ()
-int
+static int
 do_test (void)
 {
   pthread_t threads[NTHREADS];
============================================================
Index: linuxthreads/events.c
--- linuxthreads/events.c	1999/11/02 23:26:28	1.1
+++ linuxthreads/events.c	2000/12/27 13:23:06
@@ -1,5 +1,5 @@
 /* Event functions used while debugging.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 /* The functions contained here do nothing, they just return.  */
+
+#include "internals.h"
 
 void
 __linuxthreads_create_event (void)
============================================================
Index: linuxthreads/joinrace.c
--- linuxthreads/joinrace.c	2000/06/10 08:01:57	1.1
+++ linuxthreads/joinrace.c	2000/12/27 13:23:06
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-void *
+static void *
 sub1 (void *arg)
 {
   /* Nothing.  */
============================================================
Index: linuxthreads/lockfile.c
--- linuxthreads/lockfile.c	2000/09/01 08:55:38	1.6
+++ linuxthreads/lockfile.c	2000/12/27 13:23:06
@@ -20,6 +20,7 @@
 #include <bits/libc-lock.h>
 #include <stdio.h>
 #include <pthread.h>
+#include "internals.h"
 
 #ifdef USE_IN_LIBIO
 #include "../libio/libioP.h"
============================================================
Index: linuxthreads/mutex.c
--- linuxthreads/mutex.c	2000/10/05 18:09:53	1.24
+++ linuxthreads/mutex.c	2000/12/27 13:23:06
@@ -14,6 +14,7 @@
 
 /* Mutexes */
 
+#include <bits/libc-lock.h>
 #include <errno.h>
 #include <sched.h>
 #include <stddef.h>
============================================================
Index: linuxthreads/oldsemaphore.c
--- linuxthreads/oldsemaphore.c	2000/10/15 03:46:34	1.7
+++ linuxthreads/oldsemaphore.c	2000/12/27 13:23:07
@@ -34,6 +34,14 @@
     int sem_spinlock;
 } old_sem_t;
 
+extern int __old_sem_init (old_sem_t *__sem, int __pshared, unsigned int __value);
+extern int __old_sem_wait (old_sem_t *__sem);
+extern int __old_sem_trywait (old_sem_t *__sem);
+extern int __old_sem_post (old_sem_t *__sem);
+extern int __old_sem_getvalue (old_sem_t *__sem, int *__sval);
+extern int __old_sem_destroy (old_sem_t *__sem);
+
+
 /* Maximum value the semaphore can have.  */
 #define SEM_VALUE_MAX   ((int) ((~0u) >> 1))
 
============================================================
Index: linuxthreads/pt-machine.c
--- linuxthreads/pt-machine.c	1998/10/09 11:19:05	1.1
+++ linuxthreads/pt-machine.c	2000/12/27 13:23:07
@@ -19,4 +19,7 @@
 
 #define PT_EI
 
+extern long int testandset (int *spinlock);
+extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+
 #include <pt-machine.h>
============================================================
Index: linuxthreads/ptfork.c
--- linuxthreads/ptfork.c	2000/06/07 22:52:04	1.8
+++ linuxthreads/ptfork.c	2000/12/27 13:23:07
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include "pthread.h"
 #include "internals.h"
+#include <bits/libc-lock.h>
 
 struct handler_list {
   void (*handler)(void);
============================================================
Index: linuxthreads/rwlock.c
--- linuxthreads/rwlock.c	2000/08/03 07:19:14	1.17
+++ linuxthreads/rwlock.c	2000/12/27 13:23:09
@@ -19,6 +19,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <bits/libc-lock.h>
 #include <errno.h>
 #include <pthread.h>
 #include <stdlib.h>
============================================================
Index: linuxthreads/specific.c
--- linuxthreads/specific.c	2000/10/16 21:14:09	1.11
+++ linuxthreads/specific.c	2000/12/27 13:23:09
@@ -20,6 +20,8 @@
 #include "pthread.h"
 #include "internals.h"
 #include "spinlock.h"
+#include <bits/libc-lock.h>
+
 
 /* Table of keys. */
 
============================================================
Index: linuxthreads/weaks.c
--- linuxthreads/weaks.c	2000/06/28 19:44:22	1.10
+++ linuxthreads/weaks.c	2000/12/27 13:23:09
@@ -26,6 +26,7 @@
 extern int __pthread_return_0 (void);
 extern int __pthread_return_1 (void);
 extern void __pthread_return_void (void);
+extern void weak_function pthread_exit (void *__retval);
 
 /* Those are pthread functions which return 0 if successful. */
 weak_alias (__pthread_return_0, BP_SYM (__libc_pthread_attr_init_2_1))
============================================================
Index: linuxthreads/internals.h
--- linuxthreads/internals.h	2000/12/17 17:20:33	1.57
+++ linuxthreads/internals.h	2000/12/27 13:23:10
@@ -427,21 +427,22 @@
 
 /* Internal global functions */
 
-void __pthread_destroy_specifics(void);
-void __pthread_perform_cleanup(void);
-int __pthread_initialize_manager(void);
-void __pthread_message(char * fmt, ...);
-int __pthread_manager(void *reqfd);
-int __pthread_manager_event(void *reqfd);
-void __pthread_manager_sighandler(int sig);
-void __pthread_reset_main_thread(void);
-void __pthread_once_fork_prepare(void);
-void __pthread_once_fork_parent(void);
-void __pthread_once_fork_child(void);
-void __flockfilelist(void);
-void __funlockfilelist(void);
-void __fresetlockfiles(void);
-void __pthread_manager_adjust_prio(int thread_prio);
+extern void __pthread_destroy_specifics (void);
+extern void __pthread_perform_cleanup (void);
+extern int __pthread_initialize_manager (void);
+extern void __pthread_message (char * fmt, ...);
+extern int __pthread_manager (void *reqfd);
+extern int __pthread_manager_event (void *reqfd);
+extern void __pthread_manager_sighandler (int sig);
+extern void __pthread_reset_main_thread (void);
+extern void __pthread_once_fork_prepare (void);
+extern void __pthread_once_fork_parent (void);
+extern void __pthread_once_fork_child (void);
+extern void __flockfilelist (void);
+extern void __funlockfilelist (void);
+extern void __fresetlockfiles (void);
+extern void __pthread_manager_adjust_prio (int thread_prio);
+extern void __pthread_initialize_minimal (void);
 
 extern int __pthread_attr_setguardsize (pthread_attr_t *__attr,
 					size_t __guardsize);
@@ -455,24 +456,53 @@
 					size_t __stacksize);
 extern int __pthread_attr_getstacksize (const pthread_attr_t *__attr,
 					size_t *__stacksize);
+extern int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
+				    size_t __stacksize);
+extern int __pthread_attr_getstack (const pthread_attr_t *__attr, void **__stackaddr,
+				    size_t *__stacksize);
 extern int __pthread_getconcurrency (void);
 extern int __pthread_setconcurrency (int __level);
+extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
+				      const struct timespec *__abstime);
+extern int __pthread_mutexattr_getpshared (const pthread_mutexattr_t *__attr,
+					   int *__pshared);
+extern int __pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
+					   int __pshared);
 extern int __pthread_mutexattr_gettype (const pthread_mutexattr_t *__attr,
 					int *__kind);
 extern void __pthread_kill_other_threads_np (void);
 
-void __pthread_restart_old(pthread_descr th);
-void __pthread_suspend_old(pthread_descr self);
-int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abs);
+extern void __pthread_restart_old(pthread_descr th);
+extern void __pthread_suspend_old(pthread_descr self);
+extern int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abs);
+
+extern void __pthread_restart_new(pthread_descr th);
+extern void __pthread_suspend_new(pthread_descr self);
+extern int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abs);
+
+extern void __pthread_wait_for_restart_signal(pthread_descr self);
+
+extern int __pthread_yield (void);
+
+extern int __pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
+					 __const struct timespec *__restrict
+					 __abstime);
+extern int __pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
+					 __const struct timespec *__restrict
+					 __abstime);
+extern int __pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr);
+
+extern int __pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
+					     __restrict __attr,
+					     int *__restrict __pshared);
+
+extern int __pthread_spin_lock (pthread_spinlock_t *__lock);
+extern int __pthread_spin_trylock (pthread_spinlock_t *__lock);
+extern int __pthread_spin_unlock (pthread_spinlock_t *__lock);
+extern int __pthread_spin_init (pthread_spinlock_t *__lock, int __pshared);
+extern int __pthread_spin_destroy (pthread_spinlock_t *__lock);
 
-void __pthread_restart_new(pthread_descr th);
-void __pthread_suspend_new(pthread_descr self);
-int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abs);
 
-void __pthread_wait_for_restart_signal(pthread_descr self);
-
-int __pthread_yield (void);
-
 /* Global pointers to old or new suspend functions */
 
 extern void (*__pthread_restart)(pthread_descr);
@@ -484,10 +514,25 @@
 extern int __libc_close (int fd);
 extern int __libc_nanosleep (const struct timespec *requested_time,
 			     struct timespec *remaining);
-extern pid_t __libc_waitpid (pid_t pid, int *stat_loc, int options);
-
 /* Prototypes for some of the new semaphore functions.  */
 extern int __new_sem_post (sem_t * sem);
+extern int __new_sem_init (sem_t *__sem, int __pshared, unsigned int __value);
+extern int __new_sem_wait (sem_t *__sem);
+extern int __new_sem_trywait (sem_t *__sem);
+extern int __new_sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval);
+extern int __new_sem_destroy (sem_t *__sem);
+
+/* Prototypes for compatibility functions.  */
+extern int __pthread_attr_init_2_1 (pthread_attr_t *__attr);
+extern int __pthread_attr_init_2_0 (pthread_attr_t *__attr);
+extern int __pthread_create_2_1 (pthread_t *__restrict __thread,
+				 const pthread_attr_t *__attr,
+				 void *(*__start_routine) (void *),
+				 void *__restrict __arg);
+extern int __pthread_create_2_0 (pthread_t *__restrict thread,
+				 const pthread_attr_t *__attr,
+				 void *(*__start_routine) (void *),
+				 void *__restrict arg);
 
 /* The functions called the signal events.  */
 extern void __linuxthreads_create_event (void);
============================================================
Index: include/sys/wait.h
--- include/sys/wait.h	1999/11/23 17:20:31	1.5
+++ include/sys/wait.h	2000/12/27 13:23:10
@@ -4,6 +4,8 @@
 /* Now define the internal interfaces.  */
 extern __pid_t __waitpid (__pid_t __pid, int *__stat_loc,
 			  int __options);
+extern __pid_t __libc_waitpid (pid_t __pid, int *__stat_loc, int __options);
+extern __pid_t __libc_wait (int *__stat_loc);
 extern __pid_t __wait3 (__WAIT_STATUS __stat_loc,
 			int __options, struct rusage * __usage);
 extern __pid_t __wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc,
============================================================
Index: linuxthreads/sysdeps/alpha/pspinlock.c
--- linuxthreads/sysdeps/alpha/pspinlock.c	2000/05/25 05:28:00	1.1
+++ linuxthreads/sysdeps/alpha/pspinlock.c	2000/12/27 13:23:10
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
+#include "internals.h"
 
 
 /* This implementation is similar to the one used in the Linux kernel.
============================================================
Index: linuxthreads/sysdeps/arm/pspinlock.c
--- linuxthreads/sysdeps/arm/pspinlock.c	2000/05/25 05:28:08	1.1
+++ linuxthreads/sysdeps/arm/pspinlock.c	2000/12/27 13:23:10
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
+#include "internals.h"
 
 
 int
============================================================
Index: linuxthreads/sysdeps/i386/pspinlock.c
--- linuxthreads/sysdeps/i386/pspinlock.c	2000/05/25 05:28:16	1.1
+++ linuxthreads/sysdeps/i386/pspinlock.c	2000/12/27 13:23:10
@@ -19,7 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 /* This implementation is similar to the one used in the Linux kernel.
    But the kernel is byte instructions for the memory access.  This is
============================================================
Index: linuxthreads/sysdeps/m68k/pspinlock.c
--- linuxthreads/sysdeps/m68k/pspinlock.c	2000/05/25 05:28:25	1.1
+++ linuxthreads/sysdeps/m68k/pspinlock.c	2000/12/27 13:23:10
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
+#include "internals.h"
 
 
 int
============================================================
Index: linuxthreads/sysdeps/mips/pspinlock.c
--- linuxthreads/sysdeps/mips/pspinlock.c	2000/12/05 18:00:31	1.5
+++ linuxthreads/sysdeps/mips/pspinlock.c	2000/12/27 13:23:10
@@ -21,7 +21,7 @@
 #include <pthread.h>
 #include <sgidefs.h>
 #include <sys/tas.h>
-
+#include "internals.h"
 
 #if (_MIPS_ISA >= _MIPS_ISA_MIPS2)
 
============================================================
Index: linuxthreads/sysdeps/powerpc/pspinlock.c
--- linuxthreads/sysdeps/powerpc/pspinlock.c	2000/06/12 07:00:35	1.2
+++ linuxthreads/sysdeps/powerpc/pspinlock.c	2000/12/27 13:23:10
@@ -20,7 +20,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include <pt-machine.h>
-
+#include "internals.h"
 
 int
 __pthread_spin_lock (pthread_spinlock_t *lock)
============================================================
Index: linuxthreads/sysdeps/sparc/sparc32/pspinlock.c
--- linuxthreads/sysdeps/sparc/sparc32/pspinlock.c	2000/06/03 08:12:26	1.2
+++ linuxthreads/sysdeps/sparc/sparc32/pspinlock.c	2000/12/27 13:23:10
@@ -19,7 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 /* This implementation is similar to the one used in the Linux kernel.  */
 int
============================================================
Index: linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c
--- linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c	2000/06/04 16:39:00	1.2
+++ linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c	2000/12/27 13:23:10
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
+#include "internals.h"
 
 
 /* This implementation is similar to the one used in the Linux kernel.  */
============================================================
Index: linuxthreads/sysdeps/sparc/sparc64/pspinlock.c
--- linuxthreads/sysdeps/sparc/sparc64/pspinlock.c	2000/06/04 16:39:13	1.3
+++ linuxthreads/sysdeps/sparc/sparc64/pspinlock.c	2000/12/27 13:23:10
@@ -19,7 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 /* This implementation is similar to the one used in the Linux kernel.  */
 int
============================================================
Index: linuxthreads/sysdeps/sh/pspinlock.c
--- linuxthreads/sysdeps/sh/pspinlock.c	2000/06/12 20:00:05	1.1
+++ linuxthreads/sysdeps/sh/pspinlock.c	2000/12/27 13:23:10
@@ -19,7 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 int
 __pthread_spin_lock (pthread_spinlock_t *lock)
============================================================
Index: linuxthreads/sysdeps/ia64/pspinlock.c
--- linuxthreads/sysdeps/ia64/pspinlock.c	2000/07/27 21:59:39	1.1
+++ linuxthreads/sysdeps/ia64/pspinlock.c	2000/12/27 13:23:10
@@ -20,7 +20,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 /* This implementation is inspired by the implementation used in the
    Linux kernel. */
============================================================
Index: linuxthreads/sysdeps/s390/pspinlock.c
--- linuxthreads/sysdeps/s390/pspinlock.c	2000/08/02 12:20:32	1.1
+++ linuxthreads/sysdeps/s390/pspinlock.c	2000/12/27 13:23:10
@@ -20,7 +20,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 /* This implementation is similar to the one used in the Linux kernel.
    But the kernel is byte instructions for the memory access.  This is
============================================================
Index: linuxthreads/sysdeps/hppa/pspinlock.c
--- linuxthreads/sysdeps/hppa/pspinlock.c	2000/10/15 03:42:28	1.1
+++ linuxthreads/sysdeps/hppa/pspinlock.c	2000/12/27 13:23:10
@@ -19,7 +19,7 @@
 
 #include <errno.h>
 #include <pthread.h>
-
+#include "internals.h"
 
 int
 __pthread_spin_lock (pthread_spinlock_t *lock)
============================================================
Index: Rules
--- Rules	2000/10/16 00:50:53	1.99
+++ Rules	2000/12/27 13:23:10
@@ -74,7 +74,8 @@
 
 $(common-objpfx)dummy.c:
 	rm -f $@
-	echo 'void __dummy__ (void) { }' > $@
+	(echo 'extern void __dummy__ (void);'; \
+	 echo 'void __dummy__ (void) { }') > $@
 common-generated += dummy.o dummy.c
 
 # This makes all the auxiliary and test programs.


-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]