[Openmp-commits] [PATCH] D55486: [openmp] [runtime] Remove wrong assertion about /proc/1 being first file

Michał Górny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Dec 9 03:53:10 PST 2018


mgorny created this revision.
mgorny added reviewers: jlpeyton, krytarowski, jcownie.
Herald added a subscriber: guansong.

Remove the wrong assertion that '1' will be the first directory entry
read from /proc.  This is not true on NetBSD where /proc/0 also exists,
and which seems not to be used anyway.  Also remove the otherwise unused
total_processes variable to avoid someone wrongly trying to use
the assertion.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D55486

Files:
  runtime/src/z_Linux_util.cpp


Index: runtime/src/z_Linux_util.cpp
===================================================================
--- runtime/src/z_Linux_util.cpp
+++ runtime/src/z_Linux_util.cpp
@@ -2084,7 +2084,6 @@
   int stat_file = -1;
   int stat_path_fixed_len;
 
-  int total_processes = 0; // Total number of processes in system.
   int total_threads = 0; // Total number of threads in system.
 
   double call_time = 0.0;
@@ -2132,15 +2131,6 @@
     // process' directory.
     if (proc_entry->d_type == DT_DIR && isdigit(proc_entry->d_name[0])) {
 
-      ++total_processes;
-      // Make sure init process is the very first in "/proc", so we can replace
-      // strcmp( proc_entry->d_name, "1" ) == 0 with simpler total_processes ==
-      // 1. We are going to check that total_processes == 1 => d_name == "1" is
-      // true (where "=>" is implication). Since C++ does not have => operator,
-      // let us replace it with its equivalent: a => b == ! a || b.
-      KMP_DEBUG_ASSERT(total_processes != 1 ||
-                       strcmp(proc_entry->d_name, "1") == 0);
-
       // Construct task_path.
       task_path.used = task_path_fixed_len; // Reset task_path to "/proc/".
       __kmp_str_buf_cat(&task_path, proc_entry->d_name,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55486.177408.patch
Type: text/x-patch
Size: 1231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20181209/f3574143/attachment.bin>


More information about the Openmp-commits mailing list