blob: 29f6a606ff35fc00d25d12af73b0af9c1df7578c [file] [log] [blame]
Wayne Ma790c83e2022-01-13 10:35:05 +08001/*
2 * Copyright (C) 2022 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
Motomu Utsumi424038f2023-11-07 17:37:54 +090017#include "bpf/BpfUtils.h"
Maciej Żenczykowski513474c2022-12-08 16:20:43 +000018
Wayne Ma790c83e2022-01-13 10:35:05 +080019#include <jni.h>
20#include <nativehelper/JNIHelp.h>
Wayne Ma790c83e2022-01-13 10:35:05 +080021
22namespace android {
23
Motomu Utsumi7abeaa42022-07-20 07:54:18 +000024static jint native_synchronizeKernelRCU(JNIEnv* env, jobject self) {
25 return -bpf::synchronizeKernelRCU();
26}
27
Wayne Ma790c83e2022-01-13 10:35:05 +080028/*
29 * JNI registration.
30 */
31// clang-format off
32static const JNINativeMethod gMethods[] = {
33 /* name, signature, funcPtr */
Motomu Utsumi7abeaa42022-07-20 07:54:18 +000034 {"native_synchronizeKernelRCU", "()I",
35 (void*)native_synchronizeKernelRCU},
Wayne Ma790c83e2022-01-13 10:35:05 +080036};
37// clang-format on
38
39int register_com_android_server_BpfNetMaps(JNIEnv* env) {
Mark53e71c32023-01-13 07:00:25 +000040 return jniRegisterNativeMethods(env, "android/net/connectivity/com/android/server/BpfNetMaps",
Maciej Żenczykowski932ef5b2022-05-24 13:36:20 +000041 gMethods, NELEM(gMethods));
Wayne Ma790c83e2022-01-13 10:35:05 +080042}
43
44}; // namespace android