OSspecific.H File Reference

Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be replaced or emulated on other systems. More...

Include dependency graph for OSspecific.H:

Go to the source code of this file.

Namespaces

 Foam
 Namespace for OpenFOAM.
 

Functions

pid_t pid ()
 Return the PID of this process. More...
 
pid_t ppid ()
 Return the parent PID of this process. More...
 
pid_t pgid ()
 Return the group PID of this process. More...
 
bool env (const word &)
 Return true if environment variable of given name is defined. More...
 
string getEnv (const word &)
 Return environment variable of given name. More...
 
bool setEnv (const word &name, const std::string &value, const bool overwrite)
 Set an environment variable. More...
 
string hostName (const bool full=false)
 Return the system's host name, as per hostname(1) More...
 
string domainName ()
 Return the system's domain name, as per hostname(1) with the '-d' option. More...
 
string userName ()
 Return the user's login name. More...
 
bool isAdministrator ()
 Is user administrator. More...
 
fileName home ()
 Return home directory path name for the current user. More...
 
fileName home (const string &userName)
 Return home directory path name for a particular user. More...
 
fileName cwd ()
 Return current working directory path name. More...
 
bool chDir (const fileName &dir)
 Change the current directory to the one given and return true,. More...
 
bool mkDir (const fileName &, mode_t=0777)
 Make a directory and return an error if it could not be created. More...
 
bool chMod (const fileName &, const mode_t)
 Set the file mode. More...
 
mode_t mode (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Return the file mode. More...
 
fileType type (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Return the file type: directory or file. More...
 
bool exists (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Does the name exist (as directory or file) in the file system? More...
 
bool isDir (const fileName &, const bool followLink=true)
 Does the name exist as a directory in the file system? More...
 
bool isFile (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Does the name exist as a file in the file system? More...
 
off_t fileSize (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Return size of file. More...
 
time_t lastModified (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Return time of last file modification. More...
 
double highResLastModified (const fileName &, const bool checkVariants=true, const bool followLink=true)
 Return time of last file modification. More...
 
fileNameList readDir (const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
 Read a directory and return the entries as a string list. More...
 
bool cp (const fileName &src, const fileName &dst, const bool followLink=true)
 Copy, recursively if necessary, the source to the destination. More...
 
bool ln (const fileName &src, const fileName &dst)
 Create a softlink. dst should not exist. Returns true if successful. More...
 
bool mv (const fileName &src, const fileName &dst, const bool followLink=false)
 Rename src to dst. More...
 
bool mvBak (const fileName &, const std::string &ext="bak")
 Rename to a corresponding backup file. More...
 
bool rm (const fileName &)
 Remove a file, returning true if successful otherwise false. More...
 
bool rmDir (const fileName &)
 Remove a directory and its contents. More...
 
unsigned int sleep (const unsigned int)
 Sleep for the specified number of seconds. More...
 
void fdClose (const int)
 Close file descriptor. More...
 
bool ping (const string &, const label port, const label timeOut)
 Check if machine is up by pinging given port. More...
 
bool ping (const string &, const label timeOut=10)
 Check if machine is up by pinging port 22 (ssh) and 222 (rsh) More...
 
int system (const std::string &command)
 Execute the specified command. More...
 
void * dlOpen (const fileName &lib, const bool check=true)
 Open a shared library. Return handle to library. Print error message. More...
 
bool dlClose (void *)
 Close a dlopened library using handle. Return true if successful. More...
 
void * dlSym (void *handle, const std::string &symbol)
 Lookup a symbol in a dlopened library using handle to library. More...
 
bool dlSymFound (void *handle, const std::string &symbol)
 Report if symbol in a dlopened library could be found. More...
 
fileNameList dlLoaded ()
 Return all loaded libraries. More...
 

Detailed Description

Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be replaced or emulated on other systems.

Original source file OSspecific.H

InNamespace Foam

Source files

Definition in file OSspecific.H.