therefore not marked with __THROW. */
# ifdef __USE_MISC
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getgrent_r (struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getgrnam_r (__const char *__restrict __name,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int fgetgrent_r (FILE *__restrict __stream,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
- defined _GNU_SOURCE || defined _SVID_SOURCE)
+ defined _GNU_SOURCE || defined _SVID_SOURCE || _SUN_SOURCE)
# define __FAVOR_BSD 1
#endif
+#if !defined(_SUN_SOURCE) && !defined(_POSIX_C_SOURCE)
+# define _POSIX_C_SOURCE 1
+#endif
+
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
#ifdef _GNU_SOURCE
# undef _ISOC99_SOURCE
# define _SVID_SOURCE 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1
+# ifndef _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE 1
+# endif
#endif
/* If nothing (other than _GNU_SOURCE) is defined,
# p
pthread_cond_reltimedwait_np; pthread_mutex_reltimedlock_np;
pthread_rwlock_reltimedrdlock_np; pthread_rwlock_reltimedwrlock_np;
+ pthread_key_create_once_np;
# r
rwlock_init; rwlock_destroy; rw_rdlock; rw_wrlock; rw_unlock; rw_tryrdlock;
# define PTHREAD_BARRIER_SERIAL_THREAD -1
#endif
+#ifdef __USE_MISC
+# define PTHREAD_ONCE_KEY_NP (pthread_key_t)(-1)
+#endif
+
__BEGIN_DECLS
¶m->__sched_priority);
}
-static inline int __cond_has_waiters (pthread_cond_t *cond)
+static inline int __cond_has_waiters (cond_t *cond)
{
return cond->cond_waiters_kernel;
}
/* Additional descr fields. */
# define PLATFORM_DESCR_FIELDS \
- int sigpipe_disabled; \
int main_thread; \
stack_t stack;
int rwlock_destroy (rwlock)
rwlock_t *rwlock;
{
- memset (0, rwlock, sizeof(rwlock_t));
+ memset (rwlock, 0, sizeof(rwlock_t));
return 0;
}
+++ /dev/null
-/* Copyright (C) 2008 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _SOCKET_PRIV_H
-#define _SOCKET_PRIV_H
-
-#include <pthreadP.h>
-#include <atomic.h>
-
-/* Helper code to handle MSG_NOSIGNAL. */
-
-#define SIGPIPE_DISABLE_DEFINE
-#define SIGPIPE_DISABLE \
- atomic_increment (&THREAD_SELF->sigpipe_disabled)
-#define SIGPIPE_ENABLE \
- atomic_decrement (&THREAD_SELF->sigpipe_disabled)
-#define SIGPIPE_IS_DISABLED \
- (THREAD_GETMEM (THREAD_SELF, sigpipe_disabled) != 0)
-
-#endif /* _SOCKET_PRIV_H */
return errval;
}
+
+weak_alias (thr_keycreate_once, pthread_key_create_once_np)
thread_t target_thread;
int priority;
{
+ return pthread_setschedprio (target_thread, priority);
}
DEFINE_DATABASE (rpc)
DEFINE_DATABASE (services)
DEFINE_DATABASE (shadow)
+#ifdef __OpenSolaris_kernel__
+DEFINE_DATABASE (user_attr)
+#endif
/*
Local Variables:
#define __need_clockid_t
#include <time.h>
-#ifdef __USE_XOPEN
+#if defined(__USE_XOPEN) || defined(__USE_SUN)
# ifndef __useconds_t_defined
typedef __useconds_t useconds_t;
# define __useconds_t_defined
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getpwent_r (struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
# endif
# endif
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getpwuid_r (__uid_t __uid,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
# endif
# endif
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getpwnam_r (__const char *__restrict __name,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int fgetpwent_r (FILE *__restrict __stream,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation they are cancellation points and
therefore not marked with __THROW. */
+# ifndef __USE_SUN
extern int getservent_r (struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+# else
+extern struct servent * __getservent_r_sun (
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen);
+
+extern struct servent * __getservbyname_r_sun (
+ __const char *__restrict __name,
+ __const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen);
+
+extern struct servent * __getservbyport_r_sun (int __port,
+ __const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen);
+# ifdef __REDIRECT
+extern struct servent * __REDIRECT (getservent_r, (
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen), __getservent_r_sun);
+
+extern struct servent * __REDIRECT (getservbyname_r, (
+ __const char *__restrict __name,
+ __const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen),
+ __getservbyname_r_sun);
+
+extern struct servent * __REDIRECT (getservbyport_r, (int __port,
+ __const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen),
+ __getservbyport_r_sun);
+# else
+# define getservent_r __getservent_r_sun
+# define getservbyname_r __getservbyname_r_sun
+# define getservbyport_r __getservbyport_r_sun
+# endif
+# endif
#endif /* misc */
cancellation point. But due to similarity with an POSIX interface
or due to the implementation they are cancellation points and
therefore not marked with __THROW. */
-# ifndef __SUN_COMPAT_MODE
+# ifndef __USE_SUN
extern int getprotoent_r (struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
extern struct rpcent *getrpcent (void) __THROW;
#ifdef __USE_MISC
+# ifndef __USE_SUN
extern int getrpcbyname_r (__const char *__name, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result) __THROW;
extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer,
size_t __buflen, struct rpcent **__result) __THROW;
+# else
+extern struct rpcent * __getrpcbyname_r_sun (__const char *__name,
+ struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen) __THROW;
+
+extern struct rpcent * __getrpcbynumber_r_sun (int __number,
+ struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen) __THROW;
+
+extern struct rpcent * __getrpcent_r_sun (struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen) __THROW;
+# ifdef __REDIRECT
+extern struct rpcent * __REDIRECT_NTH (getrpcbyname_r, (__const char *__name,
+ struct rpcent *__result_buf, char *__buffer, size_t __buflen),
+ __getrpcbyname_r_sun);
+
+extern struct rcpent * __REDIRECT_NTH (getrpcbynumber_r, (int __number,
+ struct rpcent *__result_buf, char *__buffer, size_t __buflen),
+ __getrpcbynumber_r_sun);
+
+extern struct rcpent * __REDIRECT_NTH (getrpcent_r, (struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen, struct rpcent **__result),
+ __getrpcent_r_sun);
+# else
+# define getrpcbyname_r __getrpcbyname_r_sun
+# define getrpcbynumber_r __getrpcbynumber_r_sun
+# define getrpcent_r __getrpcent_r_sun
+# endif
+# endif
#endif
__END_DECLS
sys_fstat sys_fstat64 sys_fstatat sys_fstatat64 sys_lstat \
sys_lstat64 sys_stat sys_stat64 sys_sendfilev sys_sendfilev64 \
sys_getcwd sys_pipe
+headers := $(filter-out sys/vfs.h, $(headers))
endif
ifeq ($(subdir),misc)
gethostent sigsendset sigsend stack_getbounds thr_sighndlrinfo sun_compat \
mkdev nss_getent nss_setent nss_endent nss_search nss_delete nss_misc \
_nss_XbyY_fgets _getexecprof _fgetuserattr priv_str _sbrk_grow_aligned \
- mntent_sun
+ mntent_sun cftime ascftime inet_ntoa_r
sysdep_routines += sys_fdsync sys_brk sys_fcntl sys_utssys sys_lwp_private \
sys_uname sys_getloadavg sys_utimes sys_getpeerucred sys_ucred_get \
sys_privsys sys_putmsg sys_putpmsg sys_meminfo sys_pset_getloadavg \
endif
ifeq ($(subdir),nss)
-databases += auth_attr bootparams netmasks printers prof_attr project
+databases += user_attr #auth_attr bootparams netmasks printers prof_attr project
+CFLAGS-files-user_attr.c = -Inss_files
endif
ifeq ($(subdir),nptl)
getnetmaskbyaddr;
# a
- acct; acctctl; acl; allocids;
+ acct; acctctl; acl; allocids; ascftime;
# atomic
atomic_add_8; atomic_add_char; atomic_add_16; atomic_add_short;
atomic_dec_ulong_nv; atomic_dec_64_nv; atomic_dec_ptr_nv;
# c
- closefrom; core_get_default_content; core_get_default_path;
+ cftime; closefrom; core_get_default_content; core_get_default_path;
core_get_global_content; core_get_global_path; core_get_options;
core_get_process_content; core_get_process_path; core_set_default_content;
core_set_default_path; core_set_global_content; core_set_global_path;
getpeerucred; getpflags; getppriv; getprivimplinfo; _getprofattr;
_getprofnam; getprojid; __getprotobyname_r_sun; __getprotobynumber_r_sun;
__getprotoent_r_sun; __getpwent_r_sun; __getpwnam_r_sun; __getpwuid_r_sun;
- getrctl; gettaskid; _getuserattr; _getusernam; getustack; getvfsany;
- getvfsent; getvfsfile; getvfsspec; getvmusage; getzoneid; getzoneidbyname;
- getzonenamebyid;
+ getrctl; __getrpcbyname_r_sun; __getrpcbynumber_r_sun; __getrpcent_r_sun;
+ __getservbyname_r_sun; __getservbyport_r_sun; __getservent_r_sun; gettaskid;
+ _getuserattr; _getusernam; getustack; getvfsany; getvfsent; getvfsfile;
+ getvfsspec; getvmusage; getzoneid; getzoneidbyname; getzonenamebyid;
# h
__hasmntopt_sun;
# i
- idmap_reg; idmap_unreg; __init_daemon_priv; __init_suid_priv; _insert;
- issetugid; is_system_labeled;
+ idmap_reg; idmap_unreg; inet_ntoa_r; __init_daemon_priv; __init_suid_priv;
+ _insert; issetugid; is_system_labeled;
# l
_link_aton; _link_ntoa; llseek; lltostr;
membar_consumer; memcntl; meminfo; __minor; modctl; mount;
# n
- nss_delete; nss_endent; nss_getent; nss_search; nss_setent;
- _nss_XbyY_fgets; ntp_adjtime; ntp_gettime;
+ nss_delete; nss_endent; _nss_files_parse_userattr; nss_getent; nss_search;
+ nss_setent; _nss_XbyY_fgets; ntp_adjtime; ntp_gettime;
# p
pc_sample; p_online; priocntl; priocntlset; __priv_bracket;
# s
_sbrk_grow_aligned; sendfilev; sendfilev64; _setauuser; _setauthattr;
_setexecattr; setpflags; setppriv; _setprofattr; setprojrctl; setrctl;
- settaskid; _setuserattr; setustack; sig2str; sigsend; sigsendset;
- __sigwait_sun; _so_accept; _so_bind; _so_connect; _so_getpeername;
- _so_getsockname; _so_getsockopt; _so_listen; _so_recv; _so_recvfrom;
- _so_recvmsg; _so_send; _so_sendmsg; _so_sendto; _so_setsockopt;
- _so_shutdown; _so_socket; _so_socketpair; stack_getbounds; str2sig; strlcat;
- strlcpy; swapctl; _sysconf; __systemcall; sysfs; systeminfo;
+ settaskid; _setuserattr; setustack; sig2str; _sigoff; _sigon; sigsend;
+ sigsendset; __sigwait_sun; _so_accept; _so_bind; _so_connect;
+ _so_getpeername; _so_getsockname; _so_getsockopt; _so_listen; _so_recv;
+ _so_recvfrom; _so_recvmsg; _so_send; _so_sendmsg; _so_sendto;
+ _so_setsockopt; _so_shutdown; _so_socket; _so_socketpair; stack_getbounds;
+ str2sig; strlcat; strlcpy; swapctl; _sysconf; __systemcall; sysfs;
+ systeminfo;
# t
thr_sighndlrinfo; _ttyname_dev;
libnsl {
GLIBC_2.7 {
_escape; _strdup_null; _strtok_escape; _strpbrk_escape; _unescape;
+ setnetconfig; endnetconfig; getnetconfig; getnetconfigent;
+ freenetconfigent; setnetpath; endnetpath; getnetpath; nc_perror;
+ nc_sperror;
}
}
+
+libnss_files {
+ GLIBC_PRIVATE {
+ _nss_files_getuserattr_r;
+ _nss_files_getusernam_r;
+}
-/* Copyright (C) 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 1998, 1999, 2008
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <user_attrP.h>
+#include <ctype.h>
+#include <errno.h>
#include <stdio.h>
-#include <assert.h>
-#include <stddef.h>
+#include <user_attrP.h>
+
+#ifdef USE_IN_LIBIO
+# define flockfile(s) _IO_flockfile (s)
+# define funlockfile(s) _IO_funlockfile (s)
+#endif
+
+/* Define a line parsing function using the common code
+ used in the nss_files module. */
+
+#define STRUCTURE userstr_s
+#define ENTNAME userattr
+struct userattr_data {};
+
+#include <nss/nss_files/files-parse.c>
+LINE_PARSER
+(,
+ STRING_FIELD (result->name, ISCOLON, 0);
+ STRING_FIELD (result->qualifier, ISCOLON, 0);
+ STRING_FIELD (result->res1, ISCOLON, 0);
+ STRING_FIELD (result->res2, ISCOLON, 0);
+ STRING_FIELD (result->attr, ISCOLON, 0);
+ )
-userstr_t * _fgetuserattr (FILE *f, userstr_t *result, char *buffer,
- int buflen)
+
+/* Read one entry from the given stream. */
+userstr_t *
+_fgetuserattr (FILE *stream, struct userstr_s *resbuf, char *buffer,
+ size_t buflen)
{
- assert (!"_fgetuserattr not implemented");
- return NULL;
+ char *p;
+
+ flockfile (stream);
+ do
+ {
+ buffer[buflen - 1] = '\xff';
+ p = fgets_unlocked (buffer, buflen, stream);
+ if (p == NULL && feof_unlocked (stream))
+ {
+ funlockfile (stream);
+ __set_errno (ENOENT);
+ return NULL;
+ }
+ if (p == NULL || buffer[buflen - 1] != '\xff')
+ {
+ funlockfile (stream);
+ __set_errno (ERANGE);
+ return NULL;
+ }
+
+ /* Skip leading blanks. */
+ while (isspace (*p))
+ ++p;
+ } while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
+ /* Parse the line. If it is invalid, loop to
+ get the next line of the file to parse. */
+ ! parse_line (p, resbuf, (void *) buffer, buflen, &errno));
+
+ funlockfile (stream);
+
+ return resbuf;
}
#include <auth_attrP.h>
#define LOOKUP_TYPE authstr_t
-#define SETFUNC_NAME _setauthattr
-#define GETFUNC_NAME _getauthattr
-#define ENDFUNC_NAME _endauthattr
+#define SETFUNC_NAME setauthattr
+#define GETFUNC_NAME getauthattr
+#define ENDFUNC_NAME endauthattr
#define DATABASE_NAME passwd
#define BUFLEN NSS_BUFLEN_AUTHATTR
authstr_t * _getauthattr (authstr_t *psbuf, char *buf, int buflen, int *errnop)
{
authstr_t *psbufp;
- int errval = _getauthattr_r (psbuf, buf, buflen, &psbufp);
+ int errval = getauthattr_r (psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
return errval ? NULL : psbuf;
}
+
+strong_alias (setauthattr, _setauthattr)
+strong_alias (endauthattr, _endauthattr)
#include <auth_attrP.h>
#define LOOKUP_TYPE authstr_t
-#define FUNCTION_NAME _getauthnam
+#define FUNCTION_NAME getauthnam
#define DATABASE_NAME passwd
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
int buflen, int *errnop)
{
authstr_t *psbufp;
- int errval = _getauthnam_r (name, psbuf, buf, buflen, &psbufp);
+ int errval = getauthnam_r (name, psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
#include <auditP.h>
#define LOOKUP_TYPE au_user_str_t
-#define SETFUNC_NAME _setauuser
-#define GETFUNC_NAME _getauuserent
-#define ENDFUNC_NAME _endauuser
+#define SETFUNC_NAME setauuser
+#define GETFUNC_NAME getauuserent
+#define ENDFUNC_NAME endauuser
#define DATABASE_NAME passwd
#define BUFLEN NSS_BUFLEN_AUDITUSER
au_user_str_t * _getauuserent (au_user_str_t *psbuf, char *buf, int buflen, int *errnop)
{
au_user_str_t *psbufp;
- int errval = _getauuserent_r (psbuf, buf, buflen, &psbufp);
+ int errval = getauuserent_r (psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
return errval ? NULL : psbuf;
}
+
+strong_alias (setauuser, _setauuser)
+strong_alias (endauuser, _endauuser)
#include <auditP.h>
#define LOOKUP_TYPE au_user_str_t
-#define FUNCTION_NAME _getauusernam
+#define FUNCTION_NAME getauusernam
#define DATABASE_NAME passwd
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
int buflen, int *errnop)
{
au_user_str_t *psbufp;
- int errval = _getauusernam_r (name, psbuf, buf, buflen, &psbufp);
+ int errval = getauusernam_r (name, psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
#include <exec_attrP.h>
#define LOOKUP_TYPE execstr_t
-#define SETFUNC_NAME _setexecattr
-#define GETFUNC_NAME _getexecattr
-#define ENDFUNC_NAME _endexecattr
+#define SETFUNC_NAME setexecattr
+#define GETFUNC_NAME getexecattr
+#define ENDFUNC_NAME endexecattr
#define DATABASE_NAME prof_attr
#define BUFLEN NSS_BUFLEN_EXECATTR
execstr_t * _getexecattr (execstr_t *esbuf, char *buf, int buflen, int *errnop)
{
execstr_t *esbufp;
- int errval = _getexecattr_r (esbuf, buf, buflen, &esbufp);
+ int errval = getexecattr_r (esbuf, buf, buflen, &esbufp);
if (errval && errnop)
*errnop = errval;
return errval ? NULL : esbuf;
}
+
+strong_alias (setexecattr, _setexecattr)
+strong_alias (endexecattr, _endexecattr)
#include <prof_attrP.h>
#define LOOKUP_TYPE profstr_t
-#define SETFUNC_NAME _setprofattr
-#define GETFUNC_NAME _getprofattr
-#define ENDFUNC_NAME _endprofattr
+#define SETFUNC_NAME setprofattr
+#define GETFUNC_NAME getprofattr
+#define ENDFUNC_NAME endprofattr
#define DATABASE_NAME prof_attr
#define BUFLEN NSS_BUFLEN_PROFATTR
profstr_t * _getprofattr (profstr_t *psbuf, char *buf, int buflen, int *errnop)
{
profstr_t *psbufp;
- int errval = _getprofattr_r (psbuf, buf, buflen, &psbufp);
+ int errval = getprofattr_r (psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
return errval ? NULL : psbuf;
}
+
+strong_alias (setprofattr, _setprofattr)
+strong_alias (endprofattr, _endprofattr)
#include <prof_attrP.h>
#define LOOKUP_TYPE profstr_t
-#define FUNCTION_NAME _getprofnam
+#define FUNCTION_NAME getprofnam
#define DATABASE_NAME prof_attr
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
int buflen, int *errnop)
{
profstr_t *psbufp;
- int errval = _getprofnam_r (name, psbuf, buf, buflen, &psbufp);
+ int errval = getprofnam_r (name, psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
#include <user_attrP.h>
#define LOOKUP_TYPE userstr_t
-#define SETFUNC_NAME _setuserattr
-#define GETFUNC_NAME _getuserattr
-#define ENDFUNC_NAME _enduserattr
-#define DATABASE_NAME passwd
+#define SETFUNC_NAME setuserattr
+#define GETFUNC_NAME getuserattr
+#define ENDFUNC_NAME enduserattr
+#define DATABASE_NAME user_attr
#define BUFLEN NSS_BUFLEN_PROFATTR
#include "../nss/getXXent_r.c"
userstr_t * _getuserattr (userstr_t *psbuf, char *buf, int buflen, int *errnop)
{
userstr_t *psbufp;
- int errval = _getuserattr_r (psbuf, buf, buflen, &psbufp);
+ int errval = getuserattr_r (psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
return errval ? NULL : psbuf;
}
+
+strong_alias (setuserattr, _setuserattr)
+strong_alias (enduserattr, _enduserattr)
#include <user_attrP.h>
#define LOOKUP_TYPE userstr_t
-#define FUNCTION_NAME _getusernam
-#define DATABASE_NAME passwd
+#define FUNCTION_NAME getusernam
+#define DATABASE_NAME user_attr
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
-#define BUFLEN NSS_BUFLEN_PROFATTR
+#define BUFLEN NSS_BUFLEN_USERATTR
#include <nss/getXXbyYY_r.c>
int buflen, int *errnop)
{
userstr_t *psbufp;
- int errval = _getusernam_r (name, psbuf, buf, buflen, &psbufp);
+ int errval = getusernam_r (name, psbuf, buf, buflen, &psbufp);
if (errval && errnop)
*errnop = errval;
char *ret = str;
if (!ret)
{
+ /* 2 chars + 1 colon per byte. */
ret = malloc (3 * size);
if (!ret)
return NULL;
break value and set actual_size to the difference of the resulting break
value and the low-aligned break value. */
+#include <unistd.h>
#include <errno.h>
extern void *__curbrk;
--- /dev/null
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+#include <stdlib.h>
+#include <limits.h>
+
+int ascftime (char *s, const char *format, const struct tm *timeptr)
+{
+ /* If format is null use CFTIME or %C. */
+ if (!format || *format == '\0' || !(format = getenv ("CFTIME")) ||
+ *format == '\0')
+ format = "%C";
+
+ /* The caller is responsible for ensuring that the buffer is large enough.
+ We just set max to INT_MAX (basically a really large number). */
+ return ((int)strftime (s, INT_MAX, format, timeptr));
+}
#define IPPROTO_ND 77
#define IPPROTO_EON 80
+#define IPPORT_CHARGEN 19
+
/* Options for use with `getsockopt' and `setsockopt' at the IP level.
The first word in the comment at the right is the data type used;
"bool" means a boolean value stored in an `int'. */
#define MAXHOSTNAMELEN 256
+#ifdef __USE_MISC
+# define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
+#endif
+
#endif /* __USE_MISC */
struct /* SI_RCTL */
{
- int32_t __entity;
+ __int32_t __entity;
} __rctl;
} __data;
} siginfo_t;
# define ECHOCTL 0001000
# define ECHOPRT 0002000
# define ECHOKE 0004000
-# define FLUSHO 0010000
+# define DEFECHO 0010000
+# define FLUSHO 0020000
# define PENDIN 0040000
#endif
#define IEXTEN 0100000
# define MICROSEC 1000000
# define NANOSEC 1000000000
+# include <bits/types.h>
+
+__BEGIN_DECLS
+
+extern int cftime (char *, const char *, const __time_t *) __THROW;
+extern int ascftime (char *, const char *, const struct tm *) __THROW;
+
+__END_DECLS
+
# define __time_misc_defined
#endif /* __time_misc_defined */
typedef unsigned long pfn_t;
typedef unsigned int k_fltset_t;
typedef void *timeout_id_t;
+typedef void *bufcall_id_t;
typedef long long len_t;
typedef __SLONG32_TYPE __t_scalar_t;
typedef __ULONG32_TYPE __t_uscalar_t;
# define __t_uscalar_t_defined
#endif
typedef __t_scalar_t t_scalar_t;
-typedef void *timeout_id_t;
-typedef void *bufcall_id_t;
-#ifdef __USE_POSIX
+#ifdef __USE_XOPEN
typedef enum
{
_B_FALSE,
/* Values for the `ut_type' field of a `struct utmpx'. */
#define EMPTY 0 /* No valid user accounting information. */
-#ifdef __USE_GNU
+#ifdef __USE_MISC
# define RUN_LVL 1 /* The system's runlevel. */
#endif
#define BOOT_TIME 2 /* Time of system boot. */
#define USER_PROCESS 7 /* Normal process. */
#define DEAD_PROCESS 8 /* Terminated process. */
-#ifdef __USE_GNU
+#ifdef __USE_MISC
# define ACCOUNTING 9 /* System accounting. */
+# define DOWN_TIME 10
+# define UTMAXTYPE DOWN_TIME
+#endif
+
+#ifdef __USE_MISC
+# define RUNLVL_MSG "run-level %c"
+# define BOOT_MSG "system boot"
+# define OTIME_MSG "old time"
+# define NTIME_MSG "new time"
+# define PSRADM_MSG "%03d %s"
+# define DOWN_MSG "system down"
#endif
--- /dev/null
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+
+int cftime (char *s, const char *format, const time_t *clock)
+{
+ struct tm res;
+ if (localtime_r (clock, &res) == NULL)
+ {
+ s[0] = '\0';
+ return 0;
+ }
+ else
+ {
+ return ascftime (s, format, &res);
+ }
+}
#include <stdlib.h>
#include <string.h>
-/* XXX: OpenSolaris uses a per-thread buffer. */
+static __thread FILE *deflt_fp = NULL;
+static __thread int deflt_flags = 0;
+static __thread char deflt_buf[_DEFLT_BUFSIZE];
-_DEFLT_INIT
int defopen (char *fn)
{
/* Close old file if open. */
- if (_DEFLT (fp))
- fclose (_DEFLT (fp));
- if (fn == NULL)
+ if (deflt_fp)
+ {
+ fclose (deflt_fp);
+ deflt_fp = NULL;
+ }
+ if (!fn)
return 0;
- _DEFLT (fp) = fopen (fn, "r");
- if (!_DEFLT (fp))
+ deflt_fp = fopen (fn, "r");
+ if (!deflt_fp)
return -1;
- /* Allocate line buffer. */
- if (_DEFLT (buf) == NULL)
- {
- _DEFLT (buf) = malloc (_DEFLT_BUFSIZE + 2);
- if (!_DEFLT (buf))
- return -1;
- }
-
/* Set default flags. */
- _DEFLT (flags) = DC_STD;
+ deflt_flags = DC_STD;
return 0;
}
char * defread (char *cp)
{
- if (_DEFLT (fp) == NULL)
+ if (!deflt_fp)
return NULL;
/* Rewind if needed. */
- if ((_DEFLT (flags) & DC_NOREWIND) == 0)
- rewind (_DEFLT (fp));
+ if ((deflt_flags & DC_NOREWIND) == 0)
+ rewind (deflt_fp);
size_t cplen = strlen (cp);
int (*strcmpfunc)(const char *, const char *, size_t) =
- (_DEFLT (flags) & DC_CASE) ? strncmp : strncasecmp;
- while (fgets (_DEFLT (buf), _DEFLT_BUFSIZE + 2, _DEFLT (fp)))
+ (deflt_flags & DC_CASE) ? strncmp : strncasecmp;
+ while (fgets (deflt_buf, _DEFLT_BUFSIZE + 2, deflt_fp))
{
- if (strlen (_DEFLT (buf)) > _DEFLT_BUFSIZE)
+ if (strlen (deflt_buf) > _DEFLT_BUFSIZE)
break;
/* Trim trailing newline. */
- size_t len = strlen (_DEFLT (buf));
- if (len && _DEFLT (buf)[len - 1] == '\n')
- _DEFLT (buf)[len - 1] = '\0';
+ size_t len = strlen (deflt_buf);
+ if (len && deflt_buf[len - 1] == '\n')
+ deflt_buf[len - 1] = '\0';
/* Eat spaces. */
- char *bufp = _DEFLT (buf) - 1;
+ char *bufp = deflt_buf - 1;
while (*++bufp == ' ') ;
if ((*strcmpfunc)(bufp, cp, cplen) == 0)
bufp += cplen;
/* Strip quotes. */
- if ((_DEFLT (flags) & DC_STRIP_QUOTES) && *bufp)
+ if ((deflt_flags & DC_STRIP_QUOTES) && *bufp)
{
/* Strip leading quote. */
if (*bufp == '"' || *bufp == '\'')
int defcntl (int cmd, int newflags)
{
- int oldflags = _DEFLT (flags);
+ int oldflags = deflt_flags;
switch (cmd)
{
case DC_GETFLAGS:
return oldflags;
case DC_SETFLAGS:
- _DEFLT (flags) = newflags;
+ deflt_flags = newflags;
return oldflags;
default:
return -1;
#ifndef _DEFLTP_H
#define _DEFLTP_H
-#include <stdio.h>
-
-#define _DEFLT_INIT \
- static FILE *__deflt_fp = NULL; \
- static int __deflt_flags = 0; \
- libc_freeres_ptr (static char *__deflt_buf) = NULL;
-
-#define _DEFLT(x) __deflt_##x
-
#define _DEFLT_BUFSIZE 1024
#define DC_GETFLAGS 0
static pid_t __door_private_pid, __door_unref_pid;
static void * door_server_create_default (door_info_t *);
-static door_server_func_t *door_server_create_proc = &door_server_create_default;
+door_server_func_t *door_server_create_proc = &door_server_create_default;
static int (*thr_create_ptr) (void *, size_t, void * (*)(void *), void *,
long, thread_t *);
--- /dev/null
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <user_attrP.h>
+
+#define STRUCTURE userstr_s
+#define ENTNAME userattr
+#define DATABASE "user_attr"
+struct userattrent_data {};
+
+/* Our parser function is already defined in _fgetuserattr.c, so use that
+ to parse lines from the database file. */
+#define EXTERN_PARSER
+#include "files-parse.c"
+#include GENERIC
+
+DB_LOOKUP (usernam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->name))
+ break;
+ }, const char *name)
For the second part, we need to pass the door results to the server
function. The first few fields of door_results matches the arguments of
the server function (probably by design) so we can just call the server
- function. */
+ function.
+
+ Since servers may block for any reason and to handle high-load doors, we
+ create a new server thread whenever there are none in the thread pool. */
ENTRY (__door_return)
L(restart):
/* TODO: adjust cfi. */
+ /* Check nservers. */
+ movl oDOOR_RESULTS_NSERVERS(%esp), %ecx
+ andl %ecx, %ecx
+ jg 1f
+
+ /* Create another server thread. */
+ movl oDOOR_RESULTS_DOOR_INFO(%esp), %ecx
+ pushl %ecx; cfi_adjust_cfa_offset (4);
+#ifdef PIC
+ call __i686.get_pc_thunk.cx
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx
+#endif
+
+#ifdef PIC
+ movl door_server_create_proc@GOTOFF(%ecx), %ecx
+#else
+ movl door_server_create_proc, %ecx
+#endif
+ call *%ecx
+ addl $4, %esp; cfi_adjust_cfa_offset (-4);
+
+1:
/* Call server function. */
- movl oDOOR_RESULTS_PC(%esp), %eax
- call *%eax
+ movl oDOOR_RESULTS_PC(%esp), %ecx
+ call *%ecx
/* The server function is supposed to call door_return... */
- pushl $0
+ pushl $0; cfi_adjust_cfa_offset (4);
call __pthread_exit
L(pseudo_end):
PSEUDO_END (__door_return)
#include <doorP.h>
oDOOR_RESULTS_PC offsetof (struct door_results, pc)
+oDOOR_RESULTS_NSERVERS offsetof (struct door_results, nservers)
+oDOOR_RESULTS_DOOR_INFO offsetof (struct door_results, door_info)
--- /dev/null
+/* Convert Inet number to ASCII representation.
+ Copyright (C) 1997, 1998, 2000, 2001, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <arpa/inet.h>
+
+
+char *
+inet_ntoa_r (struct in_addr in, char *buffer)
+{
+ unsigned char *bytes = (unsigned char *) ∈
+ __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d",
+ bytes[0], bytes[1], bytes[2], bytes[3]);
+
+ return buffer;
+}
# define DLOPEN_ALLOWED_FLAGS (RTLD_BINDING_MASK | RTLD_NOLOAD | \
RTLD_DEEPBIND | RTLD_GLOBAL | RTLD_LOCAL | RTLD_NODELETE)
+#define DLERR_USE_INTERNAL_MALLOC
+
#endif /* ldsodefs.h */
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
char * _strdup_null (char *str)
char * _unescape (char *str, char *escape)
{
- char *ret = malloc (strlen (str));
+ char *ret = malloc (strlen (str) + 1);
if (!ret)
return NULL;
char *names = malloc (len);
if (!names)
return -1;
+ if (rctllist (names, len) != 0)
+ {
+ free (names);
+ return -1;
+ }
char *namesptr = names;
while (*namesptr)
imsf->imsf_interface = interface;
imsf->imsf_fmode = fmode;
imsf->imsf_numsrc = numsrc;
- memcpy (slist, imsf->imsf_slist, numsrc * sizeof (struct in_addr));
+ memcpy (imsf->imsf_slist, slist, numsrc * sizeof (struct in_addr));
int res = ioctl (s, SIOCSIPMSFILTER, imsf);
if (res == -1)
memcpy (&gf->gf_group, group, SA_LEN (group));
gf->gf_fmode = fmode;
gf->gf_numsrc = numsrc;
- memcpy (slist, gf->gf_slist, numsrc * sizeof (struct sockaddr_storage));
+ memcpy (gf->gf_slist, slist, numsrc * sizeof (struct sockaddr_storage));
int res = ioctl (s, SIOCSMSFILTER, gf);
if (res == -1)
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
#include <sysdeps/posix/signal.c>
+
+/* XXX: These are racey. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int64_t, lwp_sigmask, int how, unsigned int bits0,
+ unsigned int bits1);
+
+static int64_t __thread __sigmask;
+
+void _sigoff (void)
+{
+ __sigmask = INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)-1, (unsigned int)-1);
+}
+
+void _sigon (void)
+{
+ rval_t mask;
+ mask.rval64 = __sigmask;
+ INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK, (unsigned int)mask.rval1,
+ (unsigned int)mask.rval2);
+}
/* Helper code to handle MSG_NOSIGNAL. */
-extern unsigned int __sigpipe_disabled;
-#define SIGPIPE_DISABLE_DEFINE unsigned int __sigpipe_disabled = 0;
+extern __thread unsigned int __sigpipe_disabled;
+#define SIGPIPE_DISABLE_DEFINE __thread unsigned int __sigpipe_disabled = 0;
#define SIGPIPE_DISABLE atomic_increment (&__sigpipe_disabled)
#define SIGPIPE_ENABLE atomic_decrement (&__sigpipe_disabled)
-#define SIGPIPE_IS_DISABLE (__sigpipe_disabled != 0)
+#define SIGPIPE_IS_DISABLED (__sigpipe_disabled != 0)
#endif /* _SOCKET_PRIV_H */
}
-struct protoent * __getprotoent_r_sun ()
+struct protoent * __getprotoent_r_sun (struct protoent *result, char *buf,
+ size_t buflen)
{
+ struct protoent *bufp;
+ return (getprotoent_r (result, buf, buflen, &bufp) == 0) ? bufp : NULL;
}
-struct protoent * __getprotobyname_r_sun ()
+struct protoent * __getprotobyname_r_sun (const char *name,
+ struct protoent *result, char *buf, size_t buflen)
{
+ struct protoent *bufp;
+ return (getprotobyname_r (name, result, buf, buflen, &bufp) == 0)
+ ? bufp : NULL;
}
-struct protoent * __getprotobynumber_r_sun ()
+struct protoent * __getprotobynumber_r_sun (int proto, struct protoent *result,
+ char *buf, size_t buflen)
{
+ struct protoent *bufp;
+ return (getprotobynumber_r (proto, result, buf, buflen, &bufp) == 0)
+ ? bufp : NULL;
+}
+
+
+struct servent * __getservent_r_sun (struct servent *result, char *buf,
+ size_t buflen)
+{
+ struct servent *bufp;
+ return (getservent_r (result, buf, buflen, &bufp) == 0) ? bufp : NULL;
+}
+
+
+struct servent * __getservbyname_r_sun (const char * name, const char *proto,
+ struct servent *result, char *buf, size_t buflen)
+{
+ struct servent *bufp;
+ return (getservbyname_r (name, proto, result, buf, buflen, &bufp) == 0)
+ ? bufp : NULL;
+}
+
+
+struct servent * __getservbyport_r_sun (int port, const char *proto,
+ struct servent *result, char *buf, size_t buflen)
+{
+ struct servent *bufp;
+ return (getservbyport_r (port, proto, result, buf, buflen, &bufp) == 0)
+ ? bufp : NULL;
+}
+
+
+struct rpcent * __getrpcbyname_r_sun (const char *name, struct rpcent *result,
+ char *buf, size_t buflen)
+{
+ struct rpcent *bufp;
+ return (getrpcbyname_r (name, result, buf, buflen, &bufp) == 0)
+ ? bufp : NULL;
+}
+
+
+struct rpcent * __getrpcbynumber_r_sun (int number, struct rpcent *result,
+ char *buf, size_t buflen)
+{
+ struct rpcent *bufp;
+ return (getservbyport_r (number, result, buf, buflen, &bufp) == 0)
+ ? bufp : NULL;
+}
+
+
+struct rpcent * __getrpcent_r_sun (struct rpcent *result, char *buf,
+ size_t buflen)
+{
+ struct rpcent *bufp;
+ return (getrpcent_r (result, buf, buflen, &bufp) == 0) ? bufp : NULL;
}
#ifndef _SYS_FEATURE_TESTS
#define _SYS_FEATURE_TESTS
-#if defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
-# define __XOPEN_OR_POSIX
-#endif
+/* Let glibc do the rest of most of the work. */
+#include <features.h>
+#include <sys/isa_defs.h>
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
# define _POSIX_C_SOURCE 1
# define _XPG3
#endif
-/* Let glibc do the rest of most of the work. */
-#include <features.h>
-#include <sys/isa_defs.h>
-
/* By default the large-file interfaces are available. */
#if !defined(_XOPEN_SOURCE) && !defined(__USE_LARGEFILE64)
# define __USE_LARGEFILE64 1
POP_OR,
POP_XOR
} idop_t;
-#endif
typedef struct procset
{
id_t p_rid;
} procset_t;
+#endif /* __USE_MISC */
+
#define setprocset(psp, op, lidtype, lid, ridtype, rid) \
(psp)->p_op = (op); \
(psp)->p_lidtype = (lidtype); \
--- /dev/null
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state. 4.4 BSD/generic GNU version.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define _SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x) (x&037)
+#define CEOF CTRL('d')
+#ifdef _POSIX_VDISABLE
+# define CEOL _POSIX_VDISABLE
+#else
+# define CEOL ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
+#endif
+#define CERASE 0177
+#define CINTR CTRL('c')
+#ifdef _POSIX_VDISABLE
+# define CSTATUS _POSIX_VDISABLE
+#else
+# define CSTATUS ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
+#endif
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034 /* FS, ^\ */
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CSWTCH CTRL('z')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+/* compat */
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef TTYDEFCHARS
+cc_t ttydefchars[NCCS] = {
+ CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
+ _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
+ CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE
+};
+#undef TTYDEFCHARS
+#endif
--- /dev/null
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME user_attr
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
#ifndef _USER_ATTRP_H
#define _USER_ATTRP_H
+#include <sys/types.h>
+
#define NSS_BUFLEN_USERATTR 1024
typedef struct userstr_s
char *attr;
} userstr_t;
+struct parser_data;
+extern int _nss_files_parse_userattr (char *line, struct userstr_s *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libc_hidden_proto (_nss_files_parse_userattr)
+
#endif /* _USER_ATTRP_H */
#include <vfsentP.h>
#include <string.h>
-/* XXX: OpenSolaris uses a per-thread buffer. */
-_VFS_INIT
+#define _VFS_DELIM " \t"
+#define _VFS_CMP(x, y, f) (!y->f || (y->f && strcmp (x->f, y->f) == 0))
+
+static __thread char vfs_buf[VFS_LINE_MAX + 2];
+
static inline int vfs_strtok_r (char *str, const char *delim,
char **saveptr, char **strt)
int getvfsent (FILE *fp, struct vfstab *vp)
{
- while (fgets (_VFS_BUF, VFS_LINE_MAX + 2, fp) != NULL)
+ while (fgets (vfs_buf, VFS_LINE_MAX + 2, fp) != NULL)
{
/* Check for long lines. */
- size_t len = strlen (_VFS_BUF);
+ size_t len = strlen (vfs_buf);
if (len > VFS_LINE_MAX)
return VFS_TOOLONG;
/* Trim leading spaces/tabs. */
- char *bufp = _VFS_BUF;
+ char *bufp = vfs_buf;
while (*bufp == ' ' || *bufp == '\t')
bufp++;
len = strlen (bufp);
#define VFS_TOOMANY 2
#define VFS_TOOFEW 3
-#define _VFS_INIT static char buf[VFS_LINE_MAX + 2];
-#define _VFS_BUF buf
-#define _VFS_DELIM " \t"
-
-#define _VFS_CMP(x, y, f) \
- (!y->f || (y->f && strcmp (x->f, y->f) == 0))
-
int getvfsany (FILE *, struct vfstab *vp, struct vfstab *vref);
#endif /* _VFSENTP_H */