00001 /* 00002 * $Id: Unix.h 562 2007-12-02 08:04:16Z mindstorm2600 $ 00003 * 00004 * X-VR2 00005 * 00006 * Copyright (C) Juan V. Guerrero 2007 00007 * 00008 * Juan V. Guerrero <mindstorm2600@users.sourceforge.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License Version 2. See the LICENSE file 00012 * at the top of the source tree. 00013 */ 00014 #ifndef __XVR2_UNIX_H__ 00015 #define __XVR2_UNIX_H__ 00016 #include<xvr2/System.h> 00017 #include<xvr2/Mutex.h> 00018 #include<xvr2/String.h> 00019 #include<xvr2/CoreExceptions.h> 00020 00021 namespace xvr2{ 00022 00025 class Unix:public System{ 00026 protected: 00028 char *sysname; 00029 char *nodename; 00030 char *release; 00031 char *k_version; 00032 char *machine; 00033 //static Mutex OSMutex; 00034 Mutex OSMutex; 00037 void destroyAll(); 00038 public: 00039 Unix(); 00040 ~Unix(); 00041 00043 static int getuid(); 00044 00046 static int getuid(const String &username); 00047 00055 static int getgid(); 00056 00058 static int getgid(const String &groupname); 00059 00067 static int chown(const String &fname, int userid, int groupid = -1); 00069 static int chown(const String &fname, const String &owner); 00071 static int chgrp(const String &fname, int userid); 00073 static int chgrp(const String &fname, const String &groupname); 00074 00075 00076 00078 00079 00081 void getKernelInfo(); 00083 const char *getUnixName(); 00085 const char *getNodeName(); 00087 const char *getKernelRelease(); 00089 const char *getKernelReleaseVersion(); 00091 const char *getHostMachine(); 00092 }; 00093 00094 //extern Unix *OS; 00095 } 00096 00097 #endif