YARP
Yet Another Robot Platform
PlatformUnistd.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_OS_IMPL_PLATFORMUNISTD_H
7 #define YARP_OS_IMPL_PLATFORMUNISTD_H
8 
9 #include <yarp/conf/system.h>
10 #ifdef YARP_HAS_ACE
11 # include <ace/OS_NS_unistd.h>
12 // In one the ACE headers there is a definition of "main" for WIN32
13 # ifdef main
14 # undef main
15 # endif
16 #else
17 # include <unistd.h>
18 #endif
19 
20 namespace yarp {
21 namespace os {
22 namespace impl {
23 
24 #if defined(YARP_HAS_ACE)
25 using ACE_OS::rmdir;
26 inline int gethostname(char* name, size_t len)
27 {
28  return ACE_OS::hostname(name, len);
29 }
30 using ACE_OS::chdir;
31 using ACE_OS::getcwd;
32 using ACE_OS::getpid;
33 using ACE_OS::getppid;
34 using ACE_OS::isatty;
35 using ACE_OS::unlink;
36 #else
37 using ::chdir;
41 using ::getppid;
42 using ::isatty;
44 using ::unlink;
45 #endif
46 
47 } // namespace impl
48 } // namespace os
49 } // namespace yarp
50 
51 
52 #endif // YARP_OS_IMPL_PLATFORMUNISTD_H
char * getcwd(char *buf, size_t size)
Portable wrapper for the getcwd() function.
Definition: Os.cpp:112
int getpid()
Portable wrapper for the getppid() function.
Definition: Os.cpp:91
int rmdir(const char *p)
Portable wrapper for the rmdir() function.
Definition: Os.cpp:75
void gethostname(char *hostname, size_t size)
Portable wrapper for the gethostname() function.
Definition: Os.cpp:97
The main, catch-all namespace for YARP.
Definition: dirs.h:16