aboutsummaryrefslogtreecommitdiff
path: root/nosession_libc/src/main/cpp/libc.cpp
blob: 060e83e69023c9318346ec772d9a42016339be56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <jni.h>
#include "unistd.h"
#include <fcntl.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     gq_malwarefight_nosession_linux_libc_Libc
 * Method:    geteuid
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_gq_malwarefight_nosession_linux_libc_Libc_geteuid
        (JNIEnv *, jclass) {
    return (int) geteuid();
}

/*
 * Class:     gq_malwarefight_nosession_linux_libc_Libc
 * Method:    unlink
 * Signature: (Ljava/lang/String;)I
 */
JNIEXPORT void JNICALL Java_gq_malwarefight_nosession_linux_libc_Libc_unlink
        (JNIEnv* env, jclass, jstring string) {
    const char* path =  env->GetStringUTFChars(string, NULL);
    unlink(path);
    env->ReleaseStringUTFChars(string, path);
}

#ifdef __cplusplus
}
#endif