OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen OpenCFD Solutions Contact OpenFOAM

OSspecific.H File Reference


Detailed Description

View OSspecific.H
License
This file is part of OpenFOAM.

OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Functions used by FOAM which are specific to the unix operating system,
and need to be replaced or simulated on any other system.

Definition in file OSspecific.H.

Go to the source code of this file.


Namespaces

namespace  Foam

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 &name)
 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.
fileName cwd ()
 Return home directory path name.
bool chDir (const fileName &dir)
 Change the current directory to the one given and return true,.
fileName dotFoam (const fileName &name)
 Return .foam directory path name.
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: FILE or DIRECTORY.
bool exists (const fileName &name)
 Does the name exist in the filing system?
bool file (const fileName &)
 Does the file exist?
bool dir (const fileName &)
 Does the directory exist?
off_t size (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 &srcFile, const fileName &destFile)
 Copy, recursively if necessary, the source to the destination.
bool ln (const fileName &srcFile, const fileName &destFile)
 Create a softlink. destFile should not exist. Returns true if successful.
bool mv (const fileName &srcFile, const fileName &destFile)
 Rename srcFile destFile.
bool rm (const fileName &)
 Remove a file returning true if successful otherwise false.
bool rmDir (const fileName &)
 Remove a dirctory and it's 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 ping port 22 = ssh and 222 = rsh.
Copyright © 2000-2007 OpenCFD Ltd