libqi  1.14
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Classes | Namespaces | Macros | Functions
os.hpp File Reference
#include <string>
#include <map>
#include <vector>
#include <qi/config.hpp>

Go to the source code of this file.

Classes

struct  qi::os::timeval
 qi::os::timeval struct similar to POSIX timeval More...

Namespaces

namespace  qi
 qi general namespace
namespace  qi::os
 OS abstraction layer.

Functions

QI_API FILE * qi::os::fopen (const char *filename, const char *mode)
 Open a file.
QI_API int qi::os::stat (const char *filename, struct stat *pstat)
 Get file status.
QI_API int qi::os::checkdbg ()
 Check if the current program is running under a debugger.
QI_API std::string qi::os::home ()
 Return path to the current user's HOME.
QI_API std::string qi::os::mktmpdir (const char *prefix="")
 Return a writable temporary directory.

     The caller is responsible of destroying the returned directory.
     This will create a unique directory in the temporary directory returned by qi::os::tmp().
     The specified prefix will be prefixed to a generated unique name.

.

QI_API std::string qi::os::tmp ()
 Return the system's temporary directory.

     The directory is writeable and exits.
     The caller is responsible of destroying the temporary
     file create.

.

QI_API std::string qi::os::gethostname ()
 Get the system's hostname.

    An empty string is returned on failure.

.

QI_API int qi::os::getpid ()
QI_API int qi::os::kill (int pid, int sig)
QI_API bool qi::os::hostIPAddrs (std::map< std::string, std::vector< std::string > > &ifsMap)
QI_API_DEPRECATED QI_API
std::string 
qi::os::tmpdir (const char *prefix="")
 Return a temporary directory.

     look at qi::os::mktmpdir

.

Environment Functions
QI_API std::string qi::os::getenv (const char *var)
 Get an environment variable.
QI_API int qi::os::setenv (const char *var, const char *value)
 Change or add an environment variable.
Time Functions
QI_API void qi::os::sleep (unsigned int seconds)
 Sleep for the specified number of seconds.
QI_API void qi::os::msleep (unsigned int milliseconds)
 Sleep for the specified number of milliseconds.
QI_API int qi::os::gettimeofday (qi::os::timeval *tp)
 The gettimeofday() function shall obtain the current time, expressed as seconds and microseconds since the Epoch, and store it in the timeval structure pointed to by tp. The resolution of the system clock is unspecified. This clock is subject to NTP adjustments.
Shared Library Functions
QI_API void * qi::os::dlopen (const char *filename, int flag=-1)
 Loads dynamic library.
QI_API int qi::os::dlclose (void *handle)
 Decrements the reference count on the dynamic library.
QI_API void * qi::os::dlsym (void *handle, const char *symbol)
 Get the address where the symbol is loaded into memory.
QI_API const char * qi::os::dlerror (void)
 Returns a human readable string.
Process Functions
QI_API int qi::os::spawnvp (char *const argv[])
 Create and execute a new process.
QI_API int qi::os::spawnlp (const char *argv,...)
 Create and execute a new process.
QI_API int qi::os::system (const char *command)
 Execute a shell command.
QI_API int qi::os::waitpid (int pid, int *status)
 Wait for process to change state.
QI_API unsigned short qi::os::findAvailablePort (unsigned short port)
 Find the first available port starting at port.

Detailed Description

Definition in file os.hpp.