3 // $Id: OS_NS_pwd.inl 80826 2008-03-04 14:51:23Z wotte $
5 #include "ace/OS_NS_errno.h"
7 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 // Accessors to PWD file.
12 ACE_OS::endpwent (void)
14 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
16 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
19 ACE_INLINE struct passwd *
20 ACE_OS::getpwent (void)
22 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
25 ACE_NOTSUP_RETURN (0);
26 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
29 ACE_INLINE struct passwd *
30 ACE_OS::getpwnam (const char *name)
32 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
33 return ::getpwnam (name);
35 ACE_UNUSED_ARG (name);
36 ACE_NOTSUP_RETURN (0);
37 #endif /* ACE_LACKS_PWD_FUNCTIONS */
40 ACE_INLINE struct passwd *
41 ACE_OS::getpwnam_r (const char *name, struct passwd *pwent,
42 char *buffer, int buflen)
44 #if defined (ACE_HAS_POSIX_GETPWNAM_R)
45 struct passwd *result = 0;
47 int const status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
55 #elif !defined (ACE_LACKS_PWD_FUNCTIONS)
56 # if defined (ACE_HAS_REENTRANT_FUNCTIONS)
57 # if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
58 # if defined (ACE_HAS_PTHREADS) && \
59 !defined (ACE_HAS_STHREADS) || \
60 defined (HPUX_11) || \
61 defined (__USLC__) // Added by Roland Gigler for SCO UnixWare 7.
62 struct passwd *result;
64 # if defined (DIGITAL_UNIX)
65 ::_Pgetpwnam_r (name, pwent, buffer, buflen, &result);
67 // VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined
68 // in pwd.h, and that redefinition is used here
69 # if defined (__IBMCPP__) && (__IBMCPP__ >= 400) /* VAC++ 4 */
70 status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result);
72 status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
73 # endif /* __IBMCPP__ && (__IBMCPP__ >= 400) */
79 # endif /* (DIGITAL_UNIX) */
82 if (::getpwnam_r (name, pwent, buffer, buflen) == -1)
87 return ::getpwnam_r (name, pwent, buffer, buflen);
88 # endif /* ACE_HAS_PTHREADS */
90 ACE_UNUSED_ARG (name);
91 ACE_UNUSED_ARG (pwent);
92 ACE_UNUSED_ARG (buffer);
93 ACE_UNUSED_ARG (buflen);
94 ACE_NOTSUP_RETURN (0);
95 # endif /* ! ACE_LACKS_PWD_REENTRANT_FUNCTIONS */
97 ACE_UNUSED_ARG (name);
98 ACE_UNUSED_ARG (pwent);
99 ACE_UNUSED_ARG (buffer);
100 ACE_UNUSED_ARG (buflen);
101 ACE_NOTSUP_RETURN (0);
102 # endif /* ACE_HAS_REENTRANT_FUNCTIONS */
104 ACE_UNUSED_ARG (name);
105 ACE_UNUSED_ARG (pwent);
106 ACE_UNUSED_ARG (buffer);
107 ACE_UNUSED_ARG (buflen);
108 ACE_NOTSUP_RETURN (0);
109 #endif /* ACE_HAS_POSIX_GETPWNAM_R */
113 ACE_OS::setpwent (void)
115 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
117 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
120 ACE_END_VERSIONED_NAMESPACE_DECL