diff options
Diffstat (limited to 'sal/osl/unx/system.c')
-rw-r--r-- | sal/osl/unx/system.c | 106 |
1 files changed, 5 insertions, 101 deletions
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index 0ea3b819438c..b6fa769d293c 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,7 @@ static pthread_mutex_t getrtl_mutex = PTHREAD_MUTEX_INITIALIZER; /* struct passwd differs on some platforms */ -#if defined NETBSD +#if defined NETBSD && (__NetBSD_Version__ < 299001000) struct passwd *getpwnam_r(const char* name, struct passwd* s, char* buffer, int size ) { struct passwd* res; @@ -186,106 +187,6 @@ struct tm *gmtime_r(const time_t *timep, struct tm *buffer) } #endif /* defined NETBSD */ -#ifdef SCO -#include <pwd.h> -#include <shadow.h> -#include <sys/types.h> - -struct spwd *getspnam_r(const char *name, struct spwd* s, char* buffer, int size ) -{ - struct spwd* res; - - pthread_mutex_lock(&getrtl_mutex); - - if ( res = getspnam(name) ) - { - int nnamp; - - nnamp = strlen(res->sp_namp)+1; - - if (nnamp+strlen(res->sp_pwdp) < size) { - memcpy(s, res, sizeof(struct spwd)); - - strcpy(buffer, res->sp_namp); - s->sp_namp = buffer; - buffer += nnamp; - - strcpy(buffer, res->sp_pwdp); - s->sp_pwdp = buffer; - - res = s; - } - else - res = 0; - } - - pthread_mutex_unlock(&getrtl_mutex); - - return res; -} - -struct passwd *getpwnam_r(const char* name, struct passwd* s, char* buffer, int size ) -{ - struct passwd* res; - - pthread_mutex_lock(&getrtl_mutex); - - if ( res = getpwnam(name) ) - { - int nname, npasswd, nage; - int ncomment, ngecos, ndir; - - nname= strlen(res->pw_name)+1; - npasswd= strlen(res->pw_passwd)+1; - nage= strlen(res->pw_age)+1; - ncomment= strlen(res->pw_comment)+1; - ngecos= strlen(res->pw_gecos)+1; - ndir= strlen(res->pw_dir)+1; - - if (nname+npasswd+nage+ncomment+ngecos+ndir - +strlen(res->pw_shell) < size) - { - memcpy(s, res, sizeof(struct passwd)); - - strcpy(buffer, res->pw_name); - s->pw_name = buffer; - buffer += nname; - - strcpy(buffer, res->pw_passwd); - s->pw_passwd = buffer; - buffer += npasswd; - - strcpy(buffer, res->pw_age); - s->pw_age = buffer; - buffer += nage; - - strcpy(buffer, res->pw_comment); - s->pw_comment = buffer; - buffer += ncomment; - - strcpy(buffer, res->pw_gecos); - s->pw_gecos = buffer; - buffer += ngecos; - - strcpy(buffer, res->pw_dir); - s->pw_dir = buffer; - buffer += ndir; - - strcpy(buffer, res->pw_shell); - s->pw_shell = buffer; - - res = s; - } - else - res = 0; - } - - pthread_mutex_unlock(&getrtl_mutex); - - return res; -} -#endif /* defined SCO */ - #if !defined(FREEBSD) || (__FreeBSD_version < 601103) extern int h_errno; @@ -485,6 +386,7 @@ pid_t getpid(void) #ifdef NO_PTHREAD_SEMAPHORES int sem_init(sem_t* sem, int pshared, unsigned int value) { + (void)pshared; pthread_mutex_init(&sem->mutex, PTHREAD_MUTEXATTR_DEFAULT); pthread_cond_init(&sem->increased, PTHREAD_CONDATTR_DEFAULT); @@ -597,3 +499,5 @@ char *fcvt(double value, int ndigit, int *decpt, int *sign) } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |