inotify_add_watch(/proc/[pid]/mem) failed: (return EACCESS)

  android, android-ndk, c++, java-native-interface
char szPath[64];
sprintf(szPath,
        "/proc/%d/mem",
        getpid());

int mem_fd = inotify_add_watch(fd,
                  szPath,
                  IN_ALL_EVENTS);

log_error("%s: path=%s fd=%d, errno=%d",
          __FUNCTION__,
          szPath,
          mem_fd,
          errno);

file access list:

enter image description here

result: Thread_WatchProcMemery: path=/proc/32388/mem fd=-1, errno=13

When I set the debuggable=true of the APK package, the above problem does not exist!

So what’s the problem?

Source: Windows Questions C++

LEAVE A COMMENT