FreeFOAM The Cross-Platform CFD Toolkit
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...


Detailed Description

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

InNamespace Foam

Source files

Definition in file OSspecific.H.

+ Include dependency graph for OSspecific.H:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Foam
 Namespace for OpenFOAM.

Functions

pid_t pid ()
 Return the PID of this process.
pid_t ppid ()
 Return the parent PID of this process.
pid_t pgid ()
 Return the group PID of this process.
bool env (const word &)
 Return true if environment variable of given name is defined.
string getEnv (const word &)
 Return environment variable of given name.
bool setEnv (const word &name, const string &value, const bool overwrite)
 Set an environment variable.
word hostName ()
 Return the system's host name.
word userName ()
 Return the user's login name.
fileName home ()
 Return home directory path name for the current user.
fileName home (const word &userName)
 Return home directory path name for a particular user.
fileName cwd ()
 Return current working directory path name.
bool chDir (const fileName &dir)
 Change the current directory to the one given and return true,.
fileName findEtcFile (const fileName &, bool mandatory=false)
 Search for name in the following hierarchy:
bool mkDir (const fileName &, mode_t=0777)
 Make a directory and return an error if it could not be created.
bool chMod (const fileName &, const mode_t)
 Set the file mode.
mode_t mode (const fileName &)
 Return the file mode.
fileName::Type type (const fileName &)
 Return the file type: DIRECTORY or FILE.
bool exists (const fileName &, const bool checkGzip=true)
 Does the name exist (as DIRECTORY or FILE) in the file system?
bool isDir (const fileName &)
 Does the name exist as a DIRECTORY in the file system?
bool isFile (const fileName &, const bool checkGzip=true)
 Does the name exist as a FILE in the file system?
off_t fileSize (const fileName &)
 Return size of file.
time_t lastModified (const fileName &)
 Return time of last file modification.
fileNameList readDir (const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true)
 Read a directory and return the entries as a string list.
bool cp (const fileName &src, const fileName &dst)
 Copy, recursively if necessary, the source to the destination.
bool ln (const fileName &src, const fileName &dst)
 Create a softlink. dst should not exist. Returns true if successful.
bool mv (const fileName &src, const fileName &dst)
 Rename src to dst.
bool mvBak (const fileName &, const std::string &ext="bak")
 Rename to a corresponding backup file.
bool rm (const fileName &)
 Remove a file, returning true if successful otherwise false.
bool rmDir (const fileName &)
 Remove a dirctory and its contents.
unsigned int sleep (const unsigned int)
 Sleep for the specified number of seconds.
void fdClose (const int)
 Close file descriptor.
bool ping (const word &, const label port, const label timeOut)
 Check if machine is up by pinging given port.
bool ping (const word &, const label timeOut=10)
 Check if machine is up by pinging port 22 (ssh) and 222 (rsh)
int system (const string &command)
 Execute the specified command.