summaryrefslogtreecommitdiff
path: root/sal/osl/unx/system.c
diff options
context:
space:
mode:
authorFrancois Tigeot <ftigeot@wolfpond.org>2011-05-11 07:58:23 +0200
committerFrancois Tigeot <ftigeot@wolfpond.org>2011-05-11 07:58:23 +0200
commit036b7d16ddc71adc0708c82b6024237e78cb8593 (patch)
treeb9649925fe4401d9223fa5b62dbca56ba36d4f1d /sal/osl/unx/system.c
parentef78447e8d5793b23f2fab4acc3ed0c1007fe7f5 (diff)
Remove an implementation of getpwnam_r for old versions of NetBSD.
NetBSD 2.x and previous releases are long gone.
Diffstat (limited to 'sal/osl/unx/system.c')
-rw-r--r--sal/osl/unx/system.c154
1 files changed, 0 insertions, 154 deletions
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c
index b6fa769d293c..e077291f99d8 100644
--- a/sal/osl/unx/system.c
+++ b/sal/osl/unx/system.c
@@ -33,160 +33,6 @@
static pthread_mutex_t getrtl_mutex = PTHREAD_MUTEX_INITIALIZER;
/* struct passwd differs on some platforms */
-#if defined NETBSD && (__NetBSD_Version__ < 299001000)
-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, nclass, ngecos, ndir;
-
- nname= strlen(res->pw_name)+1;
- npasswd= strlen(res->pw_passwd)+1;
- nclass= strlen(res->pw_class)+1;
- ngecos= strlen(res->pw_gecos)+1;
- ndir= strlen(res->pw_dir)+1;
-
- if (nname+npasswd+nclass+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_class);
- s->pw_class = buffer;
- buffer += nclass;
-
- 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);
-}
-
-int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
- size_t buflen, struct passwd **result)
-{
- struct passwd* res;
- int retval = 0;
-
- pthread_mutex_lock(&getrtl_mutex);
-
- if ( (res = getpwuid(uid)) )
- {
- size_t pw_name, pw_passwd, pw_class, pw_gecos, pw_dir, pw_shell;
-
- pw_name = strlen(res->pw_name)+1;
- pw_passwd = strlen(res->pw_passwd)+1;
- pw_class = strlen(res->pw_class)+1;
- pw_gecos = strlen(res->pw_gecos)+1;
- pw_dir = strlen(res->pw_dir)+1;
- pw_shell = strlen(res->pw_shell)+1;
-
- if (pw_name+pw_passwd+pw_class+pw_gecos
- +pw_dir+pw_shell < buflen)
- {
- memcpy(pwd, res, sizeof(struct passwd));
-
- strncpy(buffer, res->pw_name, pw_name);
- pwd->pw_name = buffer;
- buffer += pw_name;
-
- strncpy(buffer, res->pw_passwd, pw_passwd);
- pwd->pw_passwd = buffer;
- buffer += pw_passwd;
-
- strncpy(buffer, res->pw_class, pw_class);
- pwd->pw_class = buffer;
- buffer += pw_class;
-
- strncpy(buffer, res->pw_gecos, pw_gecos);
- pwd->pw_gecos = buffer;
- buffer += pw_gecos;
-
- strncpy(buffer, res->pw_dir, pw_dir);
- pwd->pw_dir = buffer;
- buffer += pw_dir;
-
- strncpy(buffer, res->pw_shell, pw_shell);
- pwd->pw_shell = buffer;
- buffer += pw_shell;
-
- *result = pwd ;
- retval = 0 ;
-
- }
- else
- retval = ENOMEM;
- }
- else
- retval = errno ;
-
- pthread_mutex_unlock(&getrtl_mutex);
-
- return retval;
-}
-
-struct tm *localtime_r(const time_t *timep, struct tm *buffer)
-{
- struct tm* res;
-
- pthread_mutex_lock(&getrtl_mutex);
-
- if ( (res = localtime(timep)))
- {
- memcpy(buffer, res, sizeof(struct tm));
- res = buffer;
- }
-
- pthread_mutex_unlock(&getrtl_mutex);
-
- return res;
-}
-
-struct tm *gmtime_r(const time_t *timep, struct tm *buffer)
-{
- struct tm* res;
-
- pthread_mutex_lock(&getrtl_mutex);
-
- if ( (res = gmtime(timep)) )
- {
- memcpy(buffer, res, sizeof(struct tm));
- res = buffer;
- }
-
- pthread_mutex_unlock(&getrtl_mutex);
-
- return res;
-}
-#endif /* defined NETBSD */
-
#if !defined(FREEBSD) || (__FreeBSD_version < 601103)
extern int h_errno;