blob: 895f2a83f97d2b4871811a8632bd0c56bb02794b [file] [log] [blame]
mukesh agrawalec533e02016-09-30 19:04:33 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
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 <time.h>
mukesh agrawalb8f8f6a2016-10-06 15:11:59 -070018#include <unistd.h>
mukesh agrawalec533e02016-09-30 19:04:33 -070019
mukesh agrawala5bb08c2016-10-26 14:38:52 -070020#include "cutils/sockets.h"
21
mukesh agrawalec533e02016-09-30 19:04:33 -070022#include "wifilogd/raw_os.h"
23
24namespace android {
25namespace wifilogd {
26
27RawOs::RawOs() {}
28RawOs::~RawOs() {}
29
30// All methods in RawOs should be thin wrappers over library/system calls.
31// In particular, the methods in RawOs should not have any logic in them.
32// Instead, all logic should be placed in Os, so that said logic can be tested.
33
34int RawOs::ClockGettime(clockid_t clock_id, struct timespec* ts) const {
35 return clock_gettime(clock_id, ts);
36}
37
mukesh agrawala5bb08c2016-10-26 14:38:52 -070038int RawOs::GetControlSocket(const char* socket_name) {
39 return android_get_control_socket(socket_name);
40}
41
mukesh agrawal960c8a82016-10-27 17:39:18 -070042int RawOs::Nanosleep(const struct timespec* req, struct timespec* rem) {
43 return nanosleep(req, rem);
44}
45
mukesh agrawald75fd9e2016-10-26 16:34:04 -070046ssize_t RawOs::Recv(int sockfd, void* buf, size_t buflen, int flags) {
47 return recv(sockfd, buf, buflen, flags);
48}
49
mukesh agrawalb8f8f6a2016-10-06 15:11:59 -070050ssize_t RawOs::Write(int fd, const void* buf, size_t buflen) {
51 return write(fd, buf, buflen);
52}
53
mukesh agrawalec533e02016-09-30 19:04:33 -070054} // namespace wifilogd
55} // namespace android