00001 /* 00002 Copyright 2003 by Marc J. Rochkind. All rights reserved. 00003 May be copied only for purposes and under conditions described 00004 on the Web page www.basepath.com/aup/copyright.htm. 00005 00006 The Example Files are provided "as is," without any warranty; 00007 without even the implied warranty of merchantability or fitness 00008 for a particular purpose. The author and his publisher are not 00009 responsible for any damages, direct or incidental, resulting 00010 from the use or non-use of these Example Files. 00011 00012 The Example Files may contain defects, and some contain deliberate 00013 coding mistakes that were included for educational reasons. 00014 You are responsible for determining if and how the Example Files 00015 are to be used. 00016 00017 */ 00018 #ifndef _UXSYSTEM_HPP_ 00019 #define _UXSYSTEM_HPP_ 00020 00021 #include <sys/utsname.h> 00022 #include <pwd.h> 00023 #include <grp.h> 00024 00025 namespace Ux { 00026 00027 /** 00028 \ingroup Ux 00029 */ 00030 class System : public Base { 00031 protected: 00032 00033 public: 00034 System() 00035 { } 00036 00037 static size_t confstr(int name, char *buf, size_t len, long default_val = -1); 00038 static long sysconf(int name, long default_val = -1); 00039 static void uname(struct utsname *name); 00040 static struct group * getgrgid(gid_t gid); 00041 static void gethostname(char *name, size_t namelen); 00042 /** 00043 Calls gethostid. 00044 */ 00045 static long gethostid(void) 00046 { return ::gethostid(); } 00047 static char * getlogin(void); 00048 static struct passwd * getpwuid(uid_t uid); 00049 }; 00050 00051 } // namespace 00052 00053 #endif // _UXSYSTEM_HPP_