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 82 of file unixcall.cc.

References SRC_POS.

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 137 of file unixcall.cc.

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

rutz::fstring rutz::unixcall::getcwd (  ) 

Get the absolute pathname of the current working directory.

Definition at line 112 of file unixcall.cc.

References rutz::dynamic_block< T >::resize(), rutz::dynamic_block< T >::size(), and SRC_POS.

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 102 of file unixcall.cc.

References SRC_POS.

Referenced by cimg_library::CImg< charT >::load_dcraw_external(), cimg_library::CImg< charT >::load_graphicsmagick_external(), cimg_library::CImg< charT >::load_gzip_external(), cimg_library::CImg< charT >::load_imagemagick_external(), cimg_library::CImg< charT >::load_medcon_external(), cimg_library::CImgList< charT >::save_ffmpeg_external(), cimg_library::CImg< charT >::save_graphicsmagick_external(), cimg_library::CImg< charT >::save_gzip_external(), cimg_library::CImgList< charT >::save_gzip_external(), cimg_library::CImg< charT >::save_imagemagick_external(), cimg_library::CImg< charT >::save_medcon_external(), and cimg_library::cimg::temporary_path().

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 92 of file unixcall.cc.

References SRC_POS.

Referenced by cimg_library::CImg< charT >::save_medcon_external().

Generated on Sun May 8 08:44:44 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3