From b0403788201afc178b376735f889c3790efc2a06 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 24 Jan 2006 17:41:01 +0000 Subject: Don't use __getpid/__getpagesize --- libpthread/linuxthreads.old/attr.c | 5 ++--- libpthread/linuxthreads.old/manager.c | 10 +++------- libpthread/linuxthreads.old/pthread.c | 15 ++++++--------- 3 files changed, 11 insertions(+), 19 deletions(-) (limited to 'libpthread') diff --git a/libpthread/linuxthreads.old/attr.c b/libpthread/linuxthreads.old/attr.c index 287f2636d..9deeee0ef 100644 --- a/libpthread/linuxthreads.old/attr.c +++ b/libpthread/linuxthreads.old/attr.c @@ -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_getscope(const pthread_attr_t *attr, int *scope) 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); diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index b4938aaca..8a33b1ca2 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -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 #include #include @@ -282,7 +278,7 @@ pthread_start_thread(void *arg) 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 @@ pthread_start_thread_event(void *arg) #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 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, 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 diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index e902aa987..ddf98a1db 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -38,11 +38,8 @@ #include #include -/* 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 @@ static void pthread_initialize(void) __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 @@ static void pthread_initialize(void) /* 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 @@ static void pthread_initialize(void) * 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 @@ void __pthread_reset_main_thread() } /* 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 @@ void __pthread_message(char * fmt, ...) { 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); -- cgit v1.2.3