+int is_appid2pid_supported(void) {
+
+ if (access(APPID2PID_PATH, F_OK) == 0) {
+ /* It is necessary to confirm that it is possible
+ * to run "appid2pid" in the sdk user/group privileges. */
+ struct stat st;
+ if (stat(APPID2PID_PATH, &st) == 0) {
+ D("appid2pid uid=%d, gid=%d, mode=0x%x.\n", st.st_uid, st.st_gid, st.st_mode);
+ if ( (st.st_uid == STATIC_SDK_USER_ID && st.st_mode & S_IXUSR)
+ || (st.st_gid == STATIC_SDK_GROUP_ID && st.st_mode & S_IXGRP)
+ || (st.st_mode & S_IXOTH) ) {
+ D("appid2pid is supported.\n");
+ return 1;
+ }
+ }
+ } else {
+ D("failed to access appid2pid file: %d\n", errno);
+ }
+
+ D("appid2pid is NOT supported.\n");
+ return 0;
+}
+