diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-01-15 03:22:16 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-01-15 03:22:16 +0000 |
commit | 1b2b2f98e2c3cc43af3a2ef234fc467eb0a3cffd (patch) | |
tree | 518aa3caf05f6ada5560eeb1ed3e3e611c343483 | |
parent | 5f6b22f6a36f4bcad45a8ab03ac52d5edb2ac2f0 (diff) | |
download | ATCD-1b2b2f98e2c3cc43af3a2ef234fc467eb0a3cffd.tar.gz |
.
-rw-r--r-- | ChangeLog-99b | 9 | ||||
-rw-r--r-- | ace/OS.h | 1 | ||||
-rw-r--r-- | ace/OS.i | 94 |
3 files changed, 60 insertions, 44 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index eab4802aff1..faf2aa4cb12 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,12 @@ +Thu Jan 14 20:41:33 1999 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/OS: Moved some code around to consolidate the getuid() and + isatty() functions. + + * ace/OS: Added support for the setuid() call. Thanks to Susan + Liebeskind <susan.liebeskind@gtri.gatech.edu> for suggesting + this. + Thu Jan 14 16:18:37 EST 1999 James CE Johnson <jcej@lads.com> * docs/tutorials/001/page02.html: @@ -4658,6 +4658,7 @@ public: static pid_t getpid (void); static pid_t getpgid (pid_t pid); static uid_t getuid (void); + static int setuid (uid_t); static pid_t setsid (void); static int system (const char *s); static pid_t wait (int * = 0); @@ -599,30 +599,6 @@ ACE_OS::getopt (int argc, char *const *argv, const char *optstring) # endif /* VXWORKS */ } -ACE_INLINE uid_t -ACE_OS::getuid (void) -{ - // ACE_TRACE ("ACE_OS::getuid"); -# if defined (VXWORKS) || defined(CHORUS) || defined (ACE_PSOS) - // getuid() is not supported: just one user anyways - return 0; -# else - ACE_OSCALL_RETURN (::getuid (), uid_t, (uid_t) -1); -# endif /* VXWORKS */ -} - -ACE_INLINE int -ACE_OS::isatty (ACE_HANDLE fd) -{ -# if defined (ACE_LACKS_ISATTY) - ACE_UNUSED_ARG (fd); - return 0; -#else - // ACE_TRACE ("ACE_OS::isatty"); - ACE_OSCALL_RETURN (::isatty (fd), int, -1); -# endif /* defined (ACE_LACKS_ISATTY) */ -} - # if !defined (ACE_HAS_MOSTLY_UNICODE_APIS) ACE_INLINE int ACE_OS::mkfifo (const char *file, mode_t mode) @@ -804,26 +780,6 @@ ACE_OS::getopt (int argc, char *const *argv, const char *optstring) ACE_NOTSUP_RETURN (-1); } -ACE_INLINE uid_t -ACE_OS::getuid (void) -{ - // ACE_TRACE ("ACE_OS::getuid"); - ACE_NOTSUP_RETURN (-1); -} - -ACE_INLINE int -ACE_OS::isatty (ACE_HANDLE handle) -{ -# if !defined (ACE_HAS_WINCE) - // ACE_TRACE ("ACE_OS::isatty"); - int fd = ::_open_osfhandle ((long) handle, 0); - ACE_OSCALL_RETURN (::_isatty ((int) fd), int, -1); -# else - ACE_UNUSED_ARG (handle); - return 0; -# endif /* ACE_HAS_WINCE */ -} - # if !defined (ACE_HAS_MOSTLY_UNICODE_APIS) ACE_INLINE int ACE_OS::mkfifo (const char *file, mode_t mode) @@ -10840,3 +10796,53 @@ ACE_OS::qsort (void *base, ACE_UNUSED_ARG (compar); #endif /* ACE_LACKS_QSORT */ } + +ACE_INLINE int +ACE_OS::setuid (uid_t uid) +{ + // ACE_TRACE ("ACE_OS::setuid"); +# if defined (VXWORKS) || defined (ACE_PSOS) + // setuid() is not supported: just one user anyways + return 0; +# elif defined (ACE_WIN32) || defined(CHORUS) + ACE_NOTSUP_RETURN (-1); +#else + ACE_OSCALL_RETURN (::setuid (uid), int, -1); +# endif /* VXWORKS */ +} + +ACE_INLINE uid_t +ACE_OS::getuid (void) +{ + // ACE_TRACE ("ACE_OS::getuid"); +# if defined (VXWORKS) || defined (ACE_PSOS) + // getuid() is not supported: just one user anyways + return 0; +# elif defined (ACE_WIN32) || defined(CHORUS) + // ACE_TRACE ("ACE_OS::getuid"); + ACE_NOTSUP_RETURN (-1); +#else + ACE_OSCALL_RETURN (::getuid (), uid_t, (uid_t) -1); +# endif /* VXWORKS */ +} + +ACE_INLINE int +ACE_OS::isatty (ACE_HANDLE fd) +{ +# if defined (ACE_LACKS_ISATTY) + ACE_UNUSED_ARG (fd); + return 0; +# elif defined (ACE_WIN32) +# if !defined (ACE_HAS_WINCE) + // ACE_TRACE ("ACE_OS::isatty"); + int fd = ::_open_osfhandle ((long) handle, 0); + ACE_OSCALL_RETURN (::_isatty ((int) fd), int, -1); +# else + ACE_UNUSED_ARG (handle); + return 0; +# endif /* ACE_HAS_WINCE */ +# else + // ACE_TRACE ("ACE_OS::isatty"); + ACE_OSCALL_RETURN (::isatty (fd), int, -1); +# endif /* defined (ACE_LACKS_ISATTY) */ +} |