YARP  2.3.70.1
Yet Another Robot Platform
Os.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2009 RobotCub Consortium
3 * Author: Lorenzo Natale
4 * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
5 */
6 
7 #ifndef YARP_OS_OS_H
8 #define YARP_OS_OS_H
9 
10 #include <yarp/os/api.h>
11 
12 #include <cstddef>
13 
14 
15 namespace yarp {
16  namespace os {
17 #ifndef YARP_NO_DEPRECATED // Since YARP 2.3.70
18  enum
19  {
22  };
23 
24  typedef void(*YarpSignalHandler)(int);
34  YARP_DEPRECATED_MSG("Use std::signal")
35  YARP_OS_API YarpSignalHandler signal(int signum, YarpSignalHandler sighandler);
36 #endif // YARP_NO_DEPRECATED
37 
38 #ifndef YARP_NO_DEPRECATED // Since YARP 2.3.70
39 
44  YARP_OS_DEPRECATED_API_MSG("Use std::exit()")
45  void exit(int exit_code); // FIXME noreturn
46 #endif // YARP_NO_DEPRECATED
47 
48 #ifndef YARP_NO_DEPRECATED // Since YARP 2.3.70
49 
54  YARP_OS_DEPRECATED_API_MSG("Use std::abort()")
55  void abort(bool verbose = false);
56 #endif // YARP_NO_DEPRECATED
57 
66  YARP_OS_API const char *getenv(const char *var);
67 
75  YARP_OS_API int getpid();
76 
84  YARP_OS_API void setprogname(const char *progname);
85 
94  YARP_OS_API void getprogname(char* progname, size_t size);
95 
105  YARP_OS_API void gethostname(char* hostname, size_t size);
106 
117  YARP_OS_API int mkdir(const char *p);
118 
129  YARP_OS_API int mkdir_p(const char *p, int ignoreLevels = 0);
130 
139  YARP_OS_API int rmdir(const char *p);
140 
151  YARP_OS_API int rename(const char *oldname, const char *newname);
152 
161  YARP_OS_API int stat(const char *path);
162 
177  YARP_OS_API char* getcwd(char *buf, size_t size);
178 
191  YARP_OS_API int fork(void);
192  }
193 }
194 
195 #endif // YARP_OS_OS_H
char * getcwd(char *buf, size_t size)
Portable wrapper for the getcwd() function.
Definition: Os.cpp:133
void setprogname(const char *progname)
Portable wrapper for the setprogname() function.
Definition: Os.cpp:97
The main, catch-all namespace for YARP.
const char * getenv(const char *var)
Portable wrapper for the getenv() function.
Definition: Os.cpp:60
int stat(const char *path)
Portable wrapper for the stat() function.
Definition: Os.cpp:85
void exit(int exit_code)
Portable wrapper for the exit() function.
Definition: Os.cpp:40
YarpSignalHandler signal(int signum, YarpSignalHandler sighandler)
Portable wrapper for the signal() function.
Definition: Os.cpp:26
bool verbose
Definition: yarpros.cpp:20
int rename(const char *oldname, const char *newname)
Portable wrapper for the rename() function.
Definition: Os.cpp:80
int getpid()
Portable wrapper for the getppid() function.
Definition: Os.cpp:91
void(* YarpSignalHandler)(int)
Definition: Os.h:24
int fork(void)
Portable wrapper for the fork() function.
Definition: Os.cpp:138
void getprogname(char *progname, size_t size)
Portable wrapper for the getprogname() function.
Definition: Os.cpp:108
void gethostname(char *hostname, size_t size)
Portable wrapper for the gethostname() function.
Definition: Os.cpp:125
int rmdir(const char *p)
Portable wrapper for the rmdir() function.
Definition: Os.cpp:75
int mkdir(const char *p)
Portable wrapper for the mkdir() function.
Definition: Os.cpp:65
void abort(bool verbose=false)
Portable wrapper for the abort() function.
Definition: Os.cpp:47
int mkdir_p(const char *p, int ignoreLevels=0)
Create a directory and all parent directories needed.
Definition: Os.cpp:70