summaryrefslogtreecommitdiff
path: root/ace/OS_NS_pwd.inl
diff options
context:
space:
mode:
authordhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-11-01 11:15:26 +0000
committerdhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-11-01 11:15:26 +0000
commit746f4ee6169d6cd8d8e5f8d6b3b368d3ac128ac6 (patch)
tree9a2cd7fff6f9e796968703bf3bb2cb7ca5c5bf82 /ace/OS_NS_pwd.inl
parenta288d4fc55907205181362fee9979dc5cd9b9d07 (diff)
downloadATCD-746f4ee6169d6cd8d8e5f8d6b3b368d3ac128ac6.tar.gz
ChangeLogTag:Sat Nov 1 05:40:21 UTC 2003 Don Hinton <dhinton@dresystems.com>
Diffstat (limited to 'ace/OS_NS_pwd.inl')
-rw-r--r--ace/OS_NS_pwd.inl131
1 files changed, 130 insertions, 1 deletions
diff --git a/ace/OS_NS_pwd.inl b/ace/OS_NS_pwd.inl
index fc532b41367..b5d10ec914b 100644
--- a/ace/OS_NS_pwd.inl
+++ b/ace/OS_NS_pwd.inl
@@ -1,4 +1,133 @@
// -*- C++ -*-
// $Id$
-// This is a placeholder.
+#include "ace/OS_NS_errno.h"
+
+// Accessors to PWD file.
+
+ACE_INLINE void
+ACE_OS::endpwent (void)
+{
+#if !defined (ACE_LACKS_PWD_FUNCTIONS)
+# if !defined (ACE_WIN32)
+ ::endpwent ();
+# else
+# endif /* ACE_WIN32 */
+#else
+#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
+}
+
+ACE_INLINE struct passwd *
+ACE_OS::getpwent (void)
+{
+#if !defined (ACE_LACKS_PWD_FUNCTIONS)
+# if !defined (ACE_WIN32)
+ return ::getpwent ();
+# else
+ ACE_NOTSUP_RETURN (0);
+# endif /* ACE_WIN32 */
+#else
+ ACE_NOTSUP_RETURN (0);
+#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
+}
+
+ACE_INLINE struct passwd *
+ACE_OS::getpwnam (const char *name)
+{
+#if !defined (ACE_LACKS_PWD_FUNCTIONS)
+# if !defined (ACE_WIN32)
+ return ::getpwnam (name);
+# else
+ ACE_UNUSED_ARG (name);
+ ACE_NOTSUP_RETURN (0);
+# endif /* ACE_WIN32 */
+#else
+ ACE_UNUSED_ARG (name);
+ ACE_NOTSUP_RETURN (0);
+#endif /* ACE_LACKS_PWD_FUNCTIONS */
+}
+
+ACE_INLINE struct passwd *
+ACE_OS::getpwnam_r (const char *name, struct passwd *pwent,
+ char *buffer, int buflen)
+{
+#if defined (ACE_HAS_POSIX_GETPWNAM_R)
+ struct passwd *result;
+ int status;
+
+ status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
+
+ if (status != 0)
+ {
+ errno = status;
+ result = 0;
+ }
+ return result;
+#elif !defined (ACE_LACKS_PWD_FUNCTIONS)
+# if defined (ACE_HAS_REENTRANT_FUNCTIONS)
+# if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
+# if defined (ACE_HAS_PTHREADS_STD) && \
+ !defined (ACE_HAS_STHREADS) || \
+ defined (HPUX_11) || \
+ defined (__USLC__) // Added by Roland Gigler for SCO UnixWare 7.
+ struct passwd *result;
+ int status;
+# if defined (DIGITAL_UNIX)
+ ::_Pgetpwnam_r (name, pwent, buffer, buflen, &result);
+# else
+ // VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined
+ // in pwd.h, and that redefinition is used here
+# if defined (__IBMCPP__) && (__IBMCPP__ >= 400) /* VAC++ 4 */
+ status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result);
+# else
+ status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
+# endif /* __IBMCPP__ && (__IBMCPP__ >= 400) */
+ if (status != 0)
+ {
+ errno = status;
+ result = 0;
+ }
+# endif /* (DIGITAL_UNIX) */
+ return result;
+# elif defined (AIX) || defined (HPUX_10)
+ if (::getpwnam_r (name, pwent, buffer, buflen) == -1)
+ return 0;
+ else
+ return pwent;
+# else
+ return ::getpwnam_r (name, pwent, buffer, buflen);
+# endif /* ACE_HAS_PTHREADS_STD */
+# else
+ ACE_UNUSED_ARG (name);
+ ACE_UNUSED_ARG (pwent);
+ ACE_UNUSED_ARG (buffer);
+ ACE_UNUSED_ARG (buflen);
+ ACE_NOTSUP_RETURN (0);
+# endif /* ! ACE_LACKS_PWD_REENTRANT_FUNCTIONS */
+# else
+ ACE_UNUSED_ARG (name);
+ ACE_UNUSED_ARG (pwent);
+ ACE_UNUSED_ARG (buffer);
+ ACE_UNUSED_ARG (buflen);
+ ACE_NOTSUP_RETURN (0);
+# endif /* ACE_HAS_REENTRANT_FUNCTIONS */
+#else
+ ACE_UNUSED_ARG (name);
+ ACE_UNUSED_ARG (pwent);
+ ACE_UNUSED_ARG (buffer);
+ ACE_UNUSED_ARG (buflen);
+ ACE_NOTSUP_RETURN (0);
+#endif /* ACE_HAS_POSIX_GETPWNAM_R */
+}
+
+ACE_INLINE void
+ACE_OS::setpwent (void)
+{
+#if !defined (ACE_LACKS_PWD_FUNCTIONS)
+# if !defined (ACE_WIN32)
+ ::setpwent ();
+# else
+# endif /* ACE_WIN32 */
+#else
+#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
+}