OS_NS_pwd.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: OS_NS_pwd.inl 80826 2008-03-04 14:51:23Z wotte $
00004 
00005 #include "ace/OS_NS_errno.h"
00006 
00007 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 // Accessors to PWD file.
00010 
00011 ACE_INLINE void
00012 ACE_OS::endpwent (void)
00013 {
00014 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00015   ::endpwent ();
00016 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
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 /* ! ACE_LACKS_PWD_FUNCTIONS */
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 /* ACE_LACKS_PWD_FUNCTIONS */
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 = 0;
00046 
00047   int const status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
00048 
00049   if (status != 0)
00050   {
00051     errno = status;
00052     result = 0;
00053   }
00054   return result;
00055 #elif !defined (ACE_LACKS_PWD_FUNCTIONS)
00056 # if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00057 #   if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
00058 #     if defined (ACE_HAS_PTHREADS) && \
00059       !defined (ACE_HAS_STHREADS) || \
00060       defined (HPUX_11)  || \
00061       defined (__USLC__) // Added by Roland Gigler for SCO UnixWare 7.
00062   struct passwd *result;
00063   int status;
00064 #       if defined (DIGITAL_UNIX)
00065   ::_Pgetpwnam_r (name, pwent, buffer, buflen, &result);
00066 #       else
00067   // VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined
00068   // in pwd.h, and that redefinition is used here
00069 #         if defined (__IBMCPP__) && (__IBMCPP__ >= 400)   /* VAC++ 4 */
00070   status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result);
00071 #         else
00072   status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
00073 #         endif /* __IBMCPP__ && (__IBMCPP__ >= 400) */
00074   if (status != 0)
00075     {
00076       errno = status;
00077       result = 0;
00078     }
00079 #       endif /* (DIGITAL_UNIX) */
00080   return result;
00081 #     elif defined (AIX)
00082   if (::getpwnam_r (name, pwent, buffer, buflen) == -1)
00083     return 0;
00084   else
00085     return pwent;
00086 #     else
00087   return ::getpwnam_r (name, pwent, buffer, buflen);
00088 #     endif /* ACE_HAS_PTHREADS */
00089 #   else
00090   ACE_UNUSED_ARG (name);
00091   ACE_UNUSED_ARG (pwent);
00092   ACE_UNUSED_ARG (buffer);
00093   ACE_UNUSED_ARG (buflen);
00094   ACE_NOTSUP_RETURN (0);
00095 #   endif /* ! ACE_LACKS_PWD_REENTRANT_FUNCTIONS */
00096 # else
00097   ACE_UNUSED_ARG (name);
00098   ACE_UNUSED_ARG (pwent);
00099   ACE_UNUSED_ARG (buffer);
00100   ACE_UNUSED_ARG (buflen);
00101   ACE_NOTSUP_RETURN (0);
00102 # endif /* ACE_HAS_REENTRANT_FUNCTIONS */
00103 #else
00104   ACE_UNUSED_ARG (name);
00105   ACE_UNUSED_ARG (pwent);
00106   ACE_UNUSED_ARG (buffer);
00107   ACE_UNUSED_ARG (buflen);
00108   ACE_NOTSUP_RETURN (0);
00109 #endif /* ACE_HAS_POSIX_GETPWNAM_R */
00110 }
00111 
00112 ACE_INLINE void
00113 ACE_OS::setpwent (void)
00114 {
00115 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00116   ::setpwent ();
00117 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
00118 }
00119 
00120 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:41 2010 for ACE by  doxygen 1.4.7