vpl.h
Go to the documentation of this file.
1 // This is core/vpl/vpl.h
2 #ifndef vpl_h_
3 #define vpl_h_
4 //:
5 // \file
6 // \brief Access to certain POSIX functions.
7 
8 #include <cstddef>
9 #include "vpl/vpl_export.h"
10 
11 //: Get the pathname of the current working directory.
12 //
13 // If \a buf is not NULL, then \a size must be at least 1 greater
14 // than the length of the pathname to be returned and the pathname
15 // will be stored in \a buf. If \a buf is NULL then the pathname
16 // will be returned and the returned pointer may be passed to free()
17 // by the caller.
18 //
19 // See also: getcwd(3) manpage.
20 
21 extern VPL_EXPORT char *vpl_getcwd( char *buf, std::size_t buf_size );
22 
23 //: Create a new directory \a dir with permissions \a mode.
24 extern VPL_EXPORT int vpl_mkdir( const char *dir, unsigned short mode );
25 
26 //: Remove the directory \a dir.
27 extern VPL_EXPORT int vpl_rmdir( const char *dir );
28 
29 //: Change the working directory to \a dir.
30 extern VPL_EXPORT int vpl_chdir( const char *dir );
31 
32 //: Remove the file \a file.
33 extern VPL_EXPORT int vpl_unlink( const char *file );
34 
35 //: Sleep for \a t seconds.
36 extern VPL_EXPORT unsigned int vpl_sleep( unsigned int t );
37 
38 //: Sleep for \a t microseconds.
39 extern VPL_EXPORT int vpl_usleep( unsigned int t );
40 
41 //: Set environment variable
42 // \param envvar should contain the environment variable name and value
43 // separated by an equals sign, e.g. "VARNAME=VALUE"
44 extern VPL_EXPORT int vpl_putenv ( const char * envvar );
45 
46 //: Get the process identifier.
47 extern VPL_EXPORT unsigned vpl_getpid( );
48 
49 //: Get the current machine's hostname.
50 extern VPL_EXPORT int vpl_gethostname(char *name, std::size_t len );
51 
52 #endif // vpl_h_
VPL_EXPORT int vpl_gethostname(char *name, std::size_t len)
Get the current machine's hostname.
Definition: vpl.cxx:66
VPL_EXPORT int vpl_mkdir(const char *dir, unsigned short mode)
Create a new directory dir with permissions mode.
Definition: vpl.cxx:23
VPL_EXPORT int vpl_rmdir(const char *dir)
Remove the directory dir.
Definition: vpl.cxx:29
VPL_EXPORT unsigned int vpl_sleep(unsigned int t)
Sleep for t seconds.
Definition: vpl.cxx:47
VPL_EXPORT int vpl_usleep(unsigned int t)
Sleep for t microseconds.
Definition: vpl.cxx:53
VPL_EXPORT int vpl_unlink(const char *file)
Remove the file file.
Definition: vpl.cxx:41
VPL_EXPORT char * vpl_getcwd(char *buf, std::size_t buf_size)
Get the pathname of the current working directory.
Definition: vpl.cxx:17
VPL_EXPORT int vpl_chdir(const char *dir)
Change the working directory to dir.
Definition: vpl.cxx:35
VPL_EXPORT unsigned vpl_getpid()
Get the process identifier.
Definition: vpl.cxx:69
VPL_EXPORT int vpl_putenv(const char *envvar)
Set environment variable.
Definition: vpl.cxx:79