libqi-api  2.0.6.8
Classes | Namespaces | Functions
/home/opennao/work/master/sdk/libqi/qi/os.hpp File Reference
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <qi/api.hpp>
#include <qi/types.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

FILE * qi::os::fopen (const char *filename, const char *mode)
 Open a file and returns and handle on it.
int qi::os::stat (const char *filename, struct stat *pstat)
 Get file status.
int qi::os::checkdbg ()
std::string qi::os::home ()
 Return path to the current user's HOME.
std::string qi::os::mktmpdir (const char *prefix="")
 Return a writable temporary directory.
std::string qi::os::tmp ()
 Return the system's temporary directory.
std::string qi::os::gethostname ()
 Get the system's hostname.
int qi::os::isatty (int fd=1)
 Test if descriptor represents a terminal.
bool qi::os::fnmatch (const std::string &pattern, const std::string &string)
char * qi::os::strdup (const char *src)
int qi::os::snprintf (char *str, size_t size, const char *format,...)
 Implement POSIX compliant snprintf.
std::string qi::os::getenv (const char *var)
 Get an environment variable.
int qi::os::setenv (const char *var, const char *value)
 Change or add an environment variable.
std::string qi::os::timezone ()
 Return the timezone.
void qi::os::sleep (unsigned int seconds)
 Sleep for the specified number of seconds.
void qi::os::msleep (unsigned int milliseconds)
 Sleep for the specified number of milliseconds.
int qi::os::gettimeofday (qi::os::timeval *tp)
 The gettimeofday() function shall obtain the current time.
qi::int64_t qi::os::ustime ()
 Return elapsed time since program started in microseconds.
std::pair< int64_t, int64_t > qi::os::cputime ()
 Return CPU time used by the calling thread as a pair (userTime, systemTime) in microseconds.
qi::os::timeval qi::os::operator+ (const qi::os::timeval &lhs, const qi::os::timeval &rhs)
qi::os::timeval qi::os::operator+ (const qi::os::timeval &lhs, long us)
qi::os::timeval qi::os::operator- (const qi::os::timeval &lhs, const qi::os::timeval &rhs)
qi::os::timeval qi::os::operator- (const qi::os::timeval &lhs, long us)
void * qi::os::dlopen (const char *filename, int flag=-1)
 Load a dynamic library.
int qi::os::dlclose (void *handle)
 Decrements the reference count on the dynamic library.
void * qi::os::dlsym (void *handle, const char *symbol)
 Get the address where the symbol is loaded into memory.
const char * qi::os::dlerror (void)
 Returns a human readable string of the error code.
int qi::os::spawnvp (char *const argv[])
 Create and execute a new process.
int qi::os::spawnlp (const char *argv,...)
 Create and execute a new process.
int qi::os::system (const char *command)
 Execute a shell command.
int qi::os::getpid ()
 Get the process identifier.
int qi::os::gettid ()
 Get the thread identifier.
int qi::os::waitpid (int pid, int *status)
 Wait for process to change state.
int qi::os::kill (int pid, int sig)
 Send a signal to a process.
unsigned short qi::os::findAvailablePort (unsigned short port)
 Find the first available port starting at port number in parameter.
std::map< std::string,
std::vector< std::string > > 
qi::os::hostIPAddrs (bool ipv6Addr=false)
 Find all network adapters and corresponding IPs.
void qi::os::setCurrentThreadName (const std::string &name)
 Set the current thread name to the string in parameter.
std::string qi::os::currentThreadName ()
 returns the current thread name as a std::string
bool qi::os::setCurrentThreadCPUAffinity (const std::vector< int > &cpus)
long qi::os::numberOfCPUs ()
std::string qi::os::getMachineId ()
 Returns an unique uuid for the machine.
std::string qi::os::generateUuid ()
 Generate a universally unique identifier.
size_t qi::os::memoryUsage (unsigned int pid)
 Get the memory usage of a process.
QI_API_DEPRECATED std::string qi::os::tmpdir (const char *prefix="")
 Return a temporary directory.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines