summaryrefslogtreecommitdiff
path: root/ACE/ace/OS_NS_pwd.inl
blob: a6e0d43d0f64702b2e84ddc66dd5cb180fe69e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- C++ -*-
#include "ace/OS_NS_errno.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

// Accessors to PWD file.

ACE_INLINE void
ACE_OS::endpwent (void)
{
#if !defined (ACE_LACKS_PWD_FUNCTIONS)
  ::endpwent ();
#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
}

ACE_INLINE struct passwd *
ACE_OS::getpwent (void)
{
#if !defined (ACE_LACKS_PWD_FUNCTIONS)
  return ::getpwent ();
#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)
  return ::getpwnam (name);
# else
  ACE_UNUSED_ARG (name);
  ACE_NOTSUP_RETURN (0);
#endif /* ACE_LACKS_PWD_FUNCTIONS */
}

ACE_INLINE int
ACE_OS::getpwnam_r (const char *name,
                    struct passwd *pwd,
                    char *buffer,
                    size_t bufsize,
                    struct passwd **result)
{
#if defined (ACE_LACKS_PWD_FUNCTIONS)
  ACE_UNUSED_ARG (name);
  ACE_UNUSED_ARG (pwd);
  ACE_UNUSED_ARG (buffer);
  ACE_UNUSED_ARG (bufsize);
  ACE_UNUSED_ARG (result);
  ACE_NOTSUP_RETURN (0);
#elif defined (ACE_HAS_LYNXOS4_GETPWNAM_R)
  if (::getpwnam_r (pwd, const_cast<char*>(name), buffer, bufsize) == -1)
    {
      *result = 0;
      return -1;
    }
  *result = pwd;
  return 0;
#elif defined (ACE_HAS_SOLARIS11_GETPWNAM_R)
  if (::getpwnam_r (name, pwd, buffer, bufsize) == 0)
  {
    *result = 0;
    return -1;
  }
  *result = pwd;
  return 0;
#elif defined (ACE_HAS_STHREADS)
  if (::getpwnam_r (name, pwd, buffer, bufsize) != 0)
    {
      *result = 0;
      return -1;
    }
  *result = pwd;
  return 0;
#else
  return ::getpwnam_r (name, pwd, buffer, bufsize, result);
#endif /* ACE_LACKS_PWD_FUNCTIONS */
}

ACE_INLINE void
ACE_OS::setpwent (void)
{
#if !defined (ACE_LACKS_PWD_FUNCTIONS)
  ::setpwent ();
#endif /* ! ACE_LACKS_PWD_FUNCTIONS */
}

ACE_END_VERSIONED_NAMESPACE_DECL