YARP
Yet Another Robot Platform
Os.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_OS_H
11 #define YARP_OS_OS_H
12 
13 #include <yarp/os/api.h>
14 
15 #include <cstddef>
16 
17 
18 namespace yarp {
19 namespace os {
20 
29 YARP_OS_API const char* getenv(const char* var);
30 
38 YARP_OS_API int getpid();
39 
49 YARP_OS_API void gethostname(char* hostname, size_t size);
50 
61 YARP_OS_API int mkdir(const char* p);
62 
73 YARP_OS_API int mkdir_p(const char* p, int ignoreLevels = 0);
74 
83 YARP_OS_API int rmdir(const char* p);
84 
95 YARP_OS_API int rename(const char* oldname, const char* newname);
96 
105 YARP_OS_API int stat(const char* path);
106 
119 YARP_OS_API char* getcwd(char* buf, size_t size);
120 
132 YARP_OS_API void setEnergySavingModeState(bool enabled);
133 
134 
135 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
136 
145 YARP_OS_API void setprogname(const char* progname);
146 
156 YARP_DEPRECATED_MSG("This method is deprecated. Use yarp::os::SystemInfo::getProcessInfo().name instead")
157 YARP_OS_API void getprogname(char* progname, size_t size);
158 
171 YARP_OS_DEPRECATED_API_MSG("Use native fork()")
172 int fork(void);
173 #endif // YARP_NO_DEPRECATED
174 
175 
176 } // namespace os
177 } // namespace yarp
178 
179 #endif // YARP_OS_OS_H
char * getcwd(char *buf, size_t size)
Portable wrapper for the getcwd() function.
Definition: Os.cpp:107
void setprogname(const char *progname)
Portable wrapper for the setprogname() function.
Definition: Os.cpp:128
#define YARP_OS_API
Definition: api.h:19
The main, catch-all namespace for YARP.
Definition: numeric.h:47
const char * getenv(const char *var)
Portable wrapper for the getenv() function.
Definition: Os.cpp:34
int stat(const char *path)
Portable wrapper for the stat() function.
Definition: Os.cpp:87
#define YARP_DEPRECATED
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2837
int rename(const char *oldname, const char *newname)
Portable wrapper for the rename() function.
Definition: Os.cpp:82
int getpid()
Portable wrapper for the getppid() function.
Definition: Os.cpp:93
void setEnergySavingModeState(bool enabled)
Toggle the OS energy saving feature.
Definition: Os.cpp:112
int fork(void)
Portable wrapper for the fork() function.
Definition: Os.cpp:154
void getprogname(char *progname, size_t size)
Portable wrapper for the getprogname() function.
Definition: Os.cpp:138
void gethostname(char *hostname, size_t size)
Portable wrapper for the gethostname() function.
Definition: Os.cpp:99
int rmdir(const char *p)
Portable wrapper for the rmdir() function.
Definition: Os.cpp:77
int mkdir(const char *p)
Portable wrapper for the mkdir() function.
Definition: Os.cpp:39
int mkdir_p(const char *p, int ignoreLevels=0)
Create a directory and all parent directories needed.
Definition: Os.cpp:44
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2838
#define YARP_OS_DEPRECATED_API_MSG(X)
Definition: api.h:23