1 /*
2  * Copyright 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 #include <unistd.h>
17 
18 #define LOG_TAG "VtsSyscall"
19 #include <utils/Log.h>
20 
21 #include <cerrno>
22 #include <cstdlib>
23 #include <iostream>
24 
main(int argc,char ** argv)25 int main(int argc, char **argv) {
26     if (argc != 2) {
27         ALOGE("syscall_exists: invalid argument");
28         return -EINVAL;
29     }
30     int syscall_id = atoi(argv[1]);
31     ALOGI("testing syscall [%d]", syscall_id);
32     int ret = syscall(syscall_id);
33     bool exists = !(ret == -1 && errno == ENOSYS);
34     ALOGI("syscall [%d] is %s", syscall_id, exists ? "enabled" : "disabled");
35     std::cout << (exists ? 'y' : 'n');
36     return 0;
37 }
38