YARP
Yet Another Robot Platform
Os.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 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 #include <string>
17 
18 
19 namespace yarp {
20 namespace os {
21 
22 #ifndef YARP_NO_DEPRECATED // Since YARP 3.4.0
23 
33 YARP_DEPRECATED_MSG("Use std::getenv instead")
34 YARP_os_API const char* getenv(const char* var);
35 #endif // YARP_NO_DEPRECATED
36 
44 YARP_os_API int getpid();
45 
55 YARP_os_API void gethostname(char* hostname, size_t size);
56 
64 YARP_os_API std::string gethostname();
65 
76 YARP_os_API int mkdir(const char* p);
77 
88 YARP_os_API int mkdir_p(const char* p, int ignoreLevels = 0);
89 
98 YARP_os_API int rmdir(const char* p);
99 
110 YARP_os_API int rename(const char* oldname, const char* newname);
111 
120 YARP_os_API int stat(const char* path);
121 
134 YARP_os_API char* getcwd(char* buf, size_t size);
135 
147 YARP_os_API void setEnergySavingModeState(bool enabled);
148 
149 
150 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
151 
160 YARP_os_API void setprogname(const char* progname);
161 
171 YARP_DEPRECATED_MSG("This method is deprecated. Use yarp::os::SystemInfo::getProcessInfo().name instead")
172 YARP_os_API void getprogname(char* progname, size_t size);
173 
186 YARP_os_DEPRECATED_API_MSG("Use native fork()")
187 int fork();
188 #endif // YARP_NO_DEPRECATED
189 
190 
191 } // namespace os
192 } // namespace yarp
193 
194 #endif // YARP_OS_OS_H
yarp::os::getenv
const char * getenv(const char *var)
Portable wrapper for the getenv() function.
Definition: Os.cpp:34
YARP_DEPRECATED
#define YARP_DEPRECATED
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2882
api.h
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::getpid
int getpid()
Portable wrapper for the getppid() function.
Definition: Os.cpp:94
yarp::os::fork
int fork()
Portable wrapper for the fork() function.
Definition: Os.cpp:162
yarp::os::setEnergySavingModeState
void setEnergySavingModeState(bool enabled)
Toggle the OS energy saving feature.
Definition: Os.cpp:120
yarp::os::gethostname
void gethostname(char *hostname, size_t size)
Portable wrapper for the gethostname() function.
Definition: Os.cpp:100
yarp::os::getcwd
char * getcwd(char *buf, size_t size)
Portable wrapper for the getcwd() function.
Definition: Os.cpp:115
yarp::os::stat
int stat(const char *path)
Portable wrapper for the stat() function.
Definition: Os.cpp:88
yarp::os::rmdir
int rmdir(const char *p)
Portable wrapper for the rmdir() function.
Definition: Os.cpp:78
yarp::os::mkdir_p
int mkdir_p(const char *p, int ignoreLevels=0)
Create a directory and all parent directories needed.
Definition: Os.cpp:45
yarp::os::getprogname
void getprogname(char *progname, size_t size)
Portable wrapper for the getprogname() function.
Definition: Os.cpp:146
yarp::os::mkdir
int mkdir(const char *p)
Portable wrapper for the mkdir() function.
Definition: Os.cpp:40
YARP_DEPRECATED_MSG
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2883
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
YARP_os_DEPRECATED_API_MSG
#define YARP_os_DEPRECATED_API_MSG(X)
Definition: api.h:23
yarp::os::setprogname
void setprogname(const char *progname)
Portable wrapper for the setprogname() function.
Definition: Os.cpp:136
yarp::os::rename
int rename(const char *oldname, const char *newname)
Portable wrapper for the rename() function.
Definition: Os.cpp:83