================
@@ -133,7 +142,45 @@ static bool GetProcessAndStatInfo(::pid_t pid,
 
 uint32_t Host::FindProcessesImpl(const ProcessInstanceInfoMatch &match_info,
                                  ProcessInstanceInfoList &process_infos) {
-  return 0;
+  static const char procdir[] = "/proc/";
+
+  DIR *dirproc = opendir(procdir);
+  if (dirproc) {
+    struct dirent *direntry = nullptr;
+    const uid_t our_uid = getuid();
+    const lldb::pid_t our_pid = getpid();
+    bool all_users = match_info.GetMatchAllUsers();
+
+    while ((direntry = readdir(dirproc)) != nullptr) {
+      if (!IsDirNumeric(direntry->d_name))
+        continue;
+
+      lldb::pid_t pid = atoi(direntry->d_name);
----------------
labath wrote:

```suggestion
      lldb::pid_t pid;
      if (!llvm::to_integer(direntry->d_name, pid))
        continue;
```

.. and then delete IsDirNumeric

https://github.com/llvm/llvm-project/pull/138687
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to