Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7a89f5f authored by Yabin Cui's avatar Yabin Cui Committed by Android Git Automerger
Browse files

am a3131862: Merge "kill HAVE_INOTIFY"

* commit 'a3131862':
  kill HAVE_INOTIFY
parents 89f48e69 a3131862
Loading
Loading
Loading
Loading
+23 −27
Original line number Original line Diff line number Diff line
@@ -29,7 +29,7 @@
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <errno.h>


#ifdef HAVE_INOTIFY
#if defined(__linux__)
#include <sys/inotify.h>
#include <sys/inotify.h>
#endif
#endif


@@ -39,20 +39,16 @@ static jmethodID method_onEvent;


static jint android_os_fileobserver_init(JNIEnv* env, jobject object)
static jint android_os_fileobserver_init(JNIEnv* env, jobject object)
{
{
#ifdef HAVE_INOTIFY
#if defined(__linux__)

    return (jint)inotify_init();
    return (jint)inotify_init();

#else
#else // HAVE_INOTIFY

    return -1;
    return -1;

#endif
#endif // HAVE_INOTIFY
}
}


static void android_os_fileobserver_observe(JNIEnv* env, jobject object, jint fd)
static void android_os_fileobserver_observe(JNIEnv* env, jobject object, jint fd)
{
{
#ifdef HAVE_INOTIFY
#if defined(__linux__)


    char event_buf[512];
    char event_buf[512];
    struct inotify_event* event;
    struct inotify_event* event;
@@ -99,14 +95,14 @@ static void android_os_fileobserver_observe(JNIEnv* env, jobject object, jint fd
        }
        }
    }
    }


#endif // HAVE_INOTIFY
#endif
}
}


static jint android_os_fileobserver_startWatching(JNIEnv* env, jobject object, jint fd, jstring pathString, jint mask)
static jint android_os_fileobserver_startWatching(JNIEnv* env, jobject object, jint fd, jstring pathString, jint mask)
{
{
    int res = -1;
    int res = -1;


#ifdef HAVE_INOTIFY
#if defined(__linux__)


    if (fd >= 0)
    if (fd >= 0)
    {
    {
@@ -117,18 +113,18 @@ static jint android_os_fileobserver_startWatching(JNIEnv* env, jobject object, j
        env->ReleaseStringUTFChars(pathString, path);
        env->ReleaseStringUTFChars(pathString, path);
    }
    }


#endif // HAVE_INOTIFY
#endif


    return res;
    return res;
}
}


static void android_os_fileobserver_stopWatching(JNIEnv* env, jobject object, jint fd, jint wfd)
static void android_os_fileobserver_stopWatching(JNIEnv* env, jobject object, jint fd, jint wfd)
{
{
#ifdef HAVE_INOTIFY
#if defined(__linux__)


    inotify_rm_watch((int)fd, (uint32_t)wfd);
    inotify_rm_watch((int)fd, (uint32_t)wfd);


#endif // HAVE_INOTIFY
#endif
}
}


static JNINativeMethod sMethods[] = {
static JNINativeMethod sMethods[] = {