00001
00002
00003
00004
00005 #include "ace/OS_NS_errno.h"
00006
00007 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009
00010
00011 ACE_INLINE void
00012 ACE_OS::endpwent (void)
00013 {
00014 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00015 ::endpwent ();
00016 #endif
00017 }
00018
00019 ACE_INLINE struct passwd *
00020 ACE_OS::getpwent (void)
00021 {
00022 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00023 return ::getpwent ();
00024 #else
00025 ACE_NOTSUP_RETURN (0);
00026 #endif
00027 }
00028
00029 ACE_INLINE struct passwd *
00030 ACE_OS::getpwnam (const char *name)
00031 {
00032 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00033 return ::getpwnam (name);
00034 # else
00035 ACE_UNUSED_ARG (name);
00036 ACE_NOTSUP_RETURN (0);
00037 #endif
00038 }
00039
00040 ACE_INLINE struct passwd *
00041 ACE_OS::getpwnam_r (const char *name, struct passwd *pwent,
00042 char *buffer, int buflen)
00043 {
00044 #if defined (ACE_HAS_POSIX_GETPWNAM_R)
00045 struct passwd *result;
00046 int status;
00047
00048 status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
00049
00050 if (status != 0)
00051 {
00052 errno = status;
00053 result = 0;
00054 }
00055 return result;
00056 #elif !defined (ACE_LACKS_PWD_FUNCTIONS)
00057 # if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00058 # if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
00059 # if defined (ACE_HAS_PTHREADS_STD) && \
00060 !defined (ACE_HAS_STHREADS) || \
00061 defined (HPUX_11) || \
00062 defined (__USLC__) // Added by Roland Gigler for SCO UnixWare 7.
00063 struct passwd *result;
00064 int status;
00065 # if defined (DIGITAL_UNIX)
00066 ::_Pgetpwnam_r (name, pwent, buffer, buflen, &result);
00067 # else
00068
00069
00070 # if defined (__IBMCPP__) && (__IBMCPP__ >= 400)
00071 status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result);
00072 # else
00073 status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
00074 # endif
00075 if (status != 0)
00076 {
00077 errno = status;
00078 result = 0;
00079 }
00080 # endif
00081 return result;
00082 # elif defined (AIX)
00083 if (::getpwnam_r (name, pwent, buffer, buflen) == -1)
00084 return 0;
00085 else
00086 return pwent;
00087 # else
00088 return ::getpwnam_r (name, pwent, buffer, buflen);
00089 # endif
00090 # else
00091 ACE_UNUSED_ARG (name);
00092 ACE_UNUSED_ARG (pwent);
00093 ACE_UNUSED_ARG (buffer);
00094 ACE_UNUSED_ARG (buflen);
00095 ACE_NOTSUP_RETURN (0);
00096 # endif
00097 # else
00098 ACE_UNUSED_ARG (name);
00099 ACE_UNUSED_ARG (pwent);
00100 ACE_UNUSED_ARG (buffer);
00101 ACE_UNUSED_ARG (buflen);
00102 ACE_NOTSUP_RETURN (0);
00103 # endif
00104 #else
00105 ACE_UNUSED_ARG (name);
00106 ACE_UNUSED_ARG (pwent);
00107 ACE_UNUSED_ARG (buffer);
00108 ACE_UNUSED_ARG (buflen);
00109 ACE_NOTSUP_RETURN (0);
00110 #endif
00111 }
00112
00113 ACE_INLINE void
00114 ACE_OS::setpwent (void)
00115 {
00116 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00117 ::setpwent ();
00118 #endif
00119 }
00120
00121 ACE_END_VERSIONED_NAMESPACE_DECL