xref: /openbmc/phosphor-ipmi-flash/internal/sys.cpp (revision 7b91cbc101f36f1038d595f99a7423ee4de6575b)
1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "sys.hpp"
18 
19 #include <fcntl.h>
20 #include <sys/ioctl.h>
21 #include <sys/mman.h>
22 #include <unistd.h>
23 
24 namespace blobs
25 {
26 namespace flash
27 {
28 namespace internal
29 {
30 
31 int SysImpl::open(const char* pathname, int flags) const
32 {
33     return ::open(pathname, flags);
34 }
35 
36 int SysImpl::close(int fd) const
37 {
38     return ::close(fd);
39 }
40 
41 void* SysImpl::mmap(void* addr, size_t length, int prot, int flags, int fd,
42                     off_t offset) const
43 {
44     return ::mmap(addr, length, prot, flags, fd, offset);
45 }
46 
47 int SysImpl::munmap(void* addr, size_t length) const
48 {
49     return ::munmap(addr, length);
50 }
51 
52 int SysImpl::getpagesize() const
53 {
54     return ::getpagesize();
55 }
56 
57 int SysImpl::ioctl(int fd, unsigned long request, void* param) const
58 {
59     return ::ioctl(fd, request, param);
60 }
61 
62 SysImpl sys_impl;
63 
64 } // namespace internal
65 } // namespace flash
66 } // namespace blobs
67