1 #include <fcntl.h>
2 #include <linux/gpio.h>
3 #include <sys/ioctl.h>
4 #include <unistd.h>
5
6 #include <gpioplus/internal/sys.hpp>
7
8 namespace gpioplus
9 {
10 namespace internal
11 {
12
open(const char * pathname,int flags) const13 int SysImpl::open(const char* pathname, int flags) const
14 {
15 return ::open(pathname, flags);
16 }
17
dup(int oldfd) const18 int SysImpl::dup(int oldfd) const
19 {
20 return ::dup(oldfd);
21 }
22
close(int fd) const23 int SysImpl::close(int fd) const
24 {
25 return ::close(fd);
26 }
27
read(int fd,void * buf,size_t count) const28 int SysImpl::read(int fd, void* buf, size_t count) const
29 {
30 return ::read(fd, buf, count);
31 }
32
fcntl_setfl(int fd,int flags) const33 int SysImpl::fcntl_setfl(int fd, int flags) const
34 {
35 return ::fcntl(fd, F_SETFL, flags);
36 }
37
fcntl_getfl(int fd) const38 int SysImpl::fcntl_getfl(int fd) const
39 {
40 return ::fcntl(fd, F_GETFL);
41 }
42
gpiohandle_get_line_values(int fd,struct gpiohandle_data * data) const43 int SysImpl::gpiohandle_get_line_values(int fd,
44 struct gpiohandle_data* data) const
45 {
46 return ::ioctl(fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, data);
47 }
48
gpiohandle_set_line_values(int fd,struct gpiohandle_data * data) const49 int SysImpl::gpiohandle_set_line_values(int fd,
50 struct gpiohandle_data* data) const
51 {
52 return ::ioctl(fd, GPIOHANDLE_SET_LINE_VALUES_IOCTL, data);
53 }
54
gpio_get_chipinfo(int fd,struct gpiochip_info * info) const55 int SysImpl::gpio_get_chipinfo(int fd, struct gpiochip_info* info) const
56 {
57 return ::ioctl(fd, GPIO_GET_CHIPINFO_IOCTL, info);
58 }
59
gpio_get_lineinfo(int fd,struct gpioline_info * info) const60 int SysImpl::gpio_get_lineinfo(int fd, struct gpioline_info* info) const
61 {
62 return ioctl(fd, GPIO_GET_LINEINFO_IOCTL, info);
63 }
64
gpio_get_linehandle(int fd,struct gpiohandle_request * request) const65 int SysImpl::gpio_get_linehandle(int fd,
66 struct gpiohandle_request* request) const
67 {
68 return ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, request);
69 }
70
gpio_get_lineevent(int fd,struct gpioevent_request * request) const71 int SysImpl::gpio_get_lineevent(int fd, struct gpioevent_request* request) const
72 {
73 return ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, request);
74 }
75
76 SysImpl sys_impl;
77
78 } // namespace internal
79 } // namespace gpioplus
80