svn commit: trunk/uClibc/libpthread/linuxthreads.old

psm at uclibc.org psm at uclibc.org
Tue Jan 24 17:41:04 UTC 2006


Author: psm
Date: 2006-01-24 09:41:01 -0800 (Tue, 24 Jan 2006)
New Revision: 13564

Log:
Don't use __getpid/__getpagesize

Modified:
   trunk/uClibc/libpthread/linuxthreads.old/attr.c
   trunk/uClibc/libpthread/linuxthreads.old/manager.c
   trunk/uClibc/libpthread/linuxthreads.old/pthread.c


Changeset:
Modified: trunk/uClibc/libpthread/linuxthreads.old/attr.c
===================================================================
--- trunk/uClibc/libpthread/linuxthreads.old/attr.c	2006-01-24 17:18:19 UTC (rev 13563)
+++ trunk/uClibc/libpthread/linuxthreads.old/attr.c	2006-01-24 17:41:01 UTC (rev 13564)
@@ -15,7 +15,6 @@
 /* changed for uClibc */
 #define __sched_get_priority_min sched_get_priority_min
 #define __sched_get_priority_max sched_get_priority_max
-#define __getpagesize getpagesize
 
 /* Handling of thread attributes */
 
@@ -33,7 +32,7 @@
 //int __pthread_attr_init_2_1(pthread_attr_t *attr)
 int pthread_attr_init(pthread_attr_t *attr)
 {
-  size_t ps = __getpagesize ();
+  size_t ps = getpagesize ();
 
   attr->__detachstate = PTHREAD_CREATE_JOINABLE;
   attr->__schedpolicy = SCHED_OTHER;
@@ -155,7 +154,7 @@
 
 int __pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
 {
-  size_t ps = __getpagesize ();
+  size_t ps = getpagesize ();
 
   /* First round up the guard size.  */
   guardsize = roundup (guardsize, ps);

Modified: trunk/uClibc/libpthread/linuxthreads.old/manager.c
===================================================================
--- trunk/uClibc/libpthread/linuxthreads.old/manager.c	2006-01-24 17:18:19 UTC (rev 13563)
+++ trunk/uClibc/libpthread/linuxthreads.old/manager.c	2006-01-24 17:41:01 UTC (rev 13564)
@@ -14,10 +14,6 @@
 
 /* The "thread manager" thread: manages creation and termination of threads */
 
-/* mods for uClibc: getpid and getpagesize are the syscalls */
-#define __getpid getpid
-#define __getpagesize getpagesize
-
 #include <features.h>
 #include <errno.h>
 #include <sched.h>
@@ -282,7 +278,7 @@
   PDEBUG("\n");
   /* Make sure our pid field is initialized, just in case we get there
      before our father has initialized it. */
-  THREAD_SETMEM(self, p_pid, __getpid());
+  THREAD_SETMEM(self, p_pid, getpid());
   /* Initial signal mask is that of the creating thread. (Otherwise,
      we'd just inherit the mask of the thread manager.) */
   sigprocmask(SIG_SETMASK, &self->p_start_args.mask, NULL);
@@ -327,7 +323,7 @@
 #endif
   /* Make sure our pid field is initialized, just in case we get there
      before our father has initialized it. */
-  THREAD_SETMEM(self, p_pid, __getpid());
+  THREAD_SETMEM(self, p_pid, getpid());
   /* Get the lock the manager will free once all is correctly set up.  */
   __pthread_lock (THREAD_GETMEM(self, p_lock), NULL);
   /* Free it immediately.  */
@@ -477,7 +473,7 @@
   pthread_t new_thread_id;
   char *guardaddr = NULL;
   size_t guardsize = 0;
-  int pagesize = __getpagesize();
+  int pagesize = getpagesize();
   int saved_errno = 0;
 
   /* First check whether we have to change the policy and if yes, whether

Modified: trunk/uClibc/libpthread/linuxthreads.old/pthread.c
===================================================================
--- trunk/uClibc/libpthread/linuxthreads.old/pthread.c	2006-01-24 17:18:19 UTC (rev 13563)
+++ trunk/uClibc/libpthread/linuxthreads.old/pthread.c	2006-01-24 17:41:01 UTC (rev 13564)
@@ -38,11 +38,8 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 
-/* mods for uClibc: getpwd and getpagesize are the syscalls */
-#define __getpid getpid
-#define __getpagesize getpagesize
 /* mods for uClibc: __libc_sigaction is not in any standard headers */
-extern int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact);
+extern __typeof(sigaction) __libc_sigaction;
 
 
 /* These variables are used by the setup code.  */
@@ -379,7 +376,7 @@
   __pthread_initial_thread_bos =
     (char *)(((long)CURRENT_STACK_FRAME - 2 * STACK_SIZE) & ~(STACK_SIZE - 1));
   /* Update the descriptor for the initial thread. */
-  __pthread_initial_thread.p_pid = __getpid();
+  __pthread_initial_thread.p_pid = getpid();
   /* If we have special thread_self processing, initialize that for the
      main thread now.  */
 #ifdef INIT_THREAD_SELF
@@ -413,7 +410,7 @@
   /* We cannot allocate a huge chunk of memory to mmap all thread stacks later
    * on a non-MMU system. Thus, we don't need the rlimit either. -StS */
   getrlimit(RLIMIT_STACK, &limit);
-  max_stack = STACK_SIZE - 2 * __getpagesize();
+  max_stack = STACK_SIZE - 2 * getpagesize();
   if (limit.rlim_cur > max_stack) {
     limit.rlim_cur = max_stack;
     setrlimit(RLIMIT_STACK, &limit);
@@ -424,7 +421,7 @@
    * malloc other stack frames such that they don't overlap. -StS
    */
   __pthread_initial_thread_tos =
-    (char *)(((long)CURRENT_STACK_FRAME + __getpagesize()) & ~(__getpagesize() - 1));
+    (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
   __pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */
   PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n",
 	 __pthread_initial_thread_bos, __pthread_initial_thread_tos);
@@ -847,7 +844,7 @@
   }
 
   /* Update the pid of the main thread */
-  THREAD_SETMEM(self, p_pid, __getpid());
+  THREAD_SETMEM(self, p_pid, getpid());
   /* Make the forked thread the main thread */
   __pthread_main_thread = self;
   THREAD_SETMEM(self, p_nextlive, self);
@@ -1089,7 +1086,7 @@
 {
   char buffer[1024];
   va_list args;
-  sprintf(buffer, "%05d : ", __getpid());
+  sprintf(buffer, "%05d : ", getpid());
   va_start(args, fmt);
   vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args);
   va_end(args);




More information about the uClibc-cvs mailing list