1 /*
2  * Copyright (C) 2023 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 "OS.h"
18 
19 #include <log/log.h>
20 
21 #include <syscall.h>
22 #include <cstdarg>
23 
24 #include <binder/Common.h>
25 
26 #ifdef __ANDROID__
27 #error "This module is not intended for Android, just bare Linux"
28 #endif
29 #ifdef __APPLE__
30 #error "This module is not intended for MacOS"
31 #endif
32 #ifdef _WIN32
33 #error "This module is not intended for Windows"
34 #endif
35 
36 namespace android::binder::os {
37 
trace_begin(uint64_t,const char *)38 void trace_begin(uint64_t, const char*) {}
39 
trace_end(uint64_t)40 void trace_end(uint64_t) {}
41 
trace_int(uint64_t,const char *,int32_t)42 void trace_int(uint64_t, const char*, int32_t) {}
43 
GetThreadId()44 uint64_t GetThreadId() {
45     return syscall(__NR_gettid);
46 }
47 
report_sysprop_change()48 bool report_sysprop_change() {
49     return false;
50 }
51 
52 } // namespace android::binder::os
53 
__android_log_print(int,const char *,const char * fmt,...)54 LIBBINDER_EXPORTED int __android_log_print(int /*prio*/, const char* /*tag*/, const char* fmt,
55                                            ...) {
56     va_list args;
57     va_start(args, fmt);
58     vfprintf(stderr, fmt, args);
59     va_end(args);
60 
61     return 1;
62 }
63