rutz::unixcall Namespace Reference

Wrappers of OS/system calls. More...


Functions

void chmod (const char *path, mode_t mode)
void rename (const char *oldpath, const char *newpath)
void remove (const char *pathname)
rutz::fstring getcwd ()
 Get the absolute pathname of the current working directory.
pid_t get_file_user_pid (const char *fname)
 Check if any processes (other than self) are using the file.


Detailed Description

Wrappers of OS/system calls.

Function Documentation

void rutz::unixcall::chmod ( const char *  path,
mode_t  mode 
)

DESCRIPTION The mode of the file given by path is changed.

Modes are specified by or'ing the following:

ERRORS Throws a rutz::error on error if an error occurs. The more general errors for chmod are listed below:

EPERM The effective user id does not match the owner of the file, and is not zero. EROFS The named file resides on a read-only file system. EFAULT path points outside your accessible address space. ENAMETOOLONG path is too long. ENOENT The file does not exist. ENOMEM Insufficient kernel memory was available. ENOTDIR A component of the path prefix is not a directory. EACCES Search permission is denied on a component of the path prefix. ELOOP Too many symbolic links were encountered in resolving path. EIO An I/O error occurred.

Definition at line 81 of file unixcall.cc.

References SRC_POS.

Referenced by ExptDriver::storeData().

pid_t rutz::unixcall::get_file_user_pid ( const char *  fname  ) 

Check if any processes (other than self) are using the file.

Returns the pid of the first process that has the file open, or 0 if no processes are using the file.

Definition at line 136 of file unixcall.cc.

References rutz::fstring::c_str(), and rutz::sfmt().

void rutz::unixcall::remove ( const char *  pathname  ) 

DESCRIPTION remove deletes a name from the filesystem. If that name was the last link to a file and no processes have the file open the file is deleted and the space it was using is made available for reuse.

If the name was the last link to a file but any processes still have the file open the file will remain in existence until the last file descriptor referring to it is closed.

If the name referred to a symbolic link the link is removed.

If the name referred to a socket, fifo or device the name for it is removed but processes which have the object open may continue to use it.

ERRORS Throws a rutz::error on error if an error occurs.

Definition at line 101 of file unixcall.cc.

References SRC_POS.

void rutz::unixcall::rename ( const char *  oldpath,
const char *  newpath 
)

DESCRIPTION rename renames a file, moving it between directories if required.

Any other hard links to the file (as created using link) are unaffected.

If newpath already exists it will be atomically overwrit- ten (subject to a few conditions - see ERRORS below), so that there is no point at which another process attempting to access newpath will find it missing.

If newpath exists but the operation fails for some reason or the system crashes rename guarantees to leave an instance of newpath in place.

However, when overwriting there will probably be a window in which both oldpath and newpath refer to the file being renamed.

If oldpath refers to a symbolic link the link is renamed; if newpath refers to a symbolic link the link will be overwritten.

ERRORS Throws a rutz::error on error if an error occurs.

Definition at line 91 of file unixcall.cc.

References SRC_POS.


The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:56:47 2008 by Doxygen version 1.5.5.