+ } else {
+ uint64_t a = 0;
+
+ while (1) { // for all memory regions
+ // processing next address
+ buf_used = proc_pidinfo(pid, PROC_PIDREGIONPATHINFO2, a, &rwpi, sizeof(rwpi));
+ if (buf_used <= 0) {
+ if ((errno == ESRCH) || (errno == EINVAL)) {
+ // if no more text information is available for this process.
+ break;
+ }
+ return -1;
+ } else if (buf_used < sizeof(rwpi)) {
+ // if we didn't get enough information
+ return -1;
+ }
+
+ status = check_file(info, &rwpi.prp_vip.vip_vi.vi_stat);
+ if (status != 0) {
+ // if error or match
+ return status;
+ }
+
+ a = rwpi.prp_prinfo.pri_address + rwpi.prp_prinfo.pri_size;
+ }