Internally used by get_pid() and get_tid().
356723
def __get_pid_and_tid(self):
        ""
        self.dwThreadId, self.dwProcessId = \
                            win32.GetWindowThreadProcessId(self.get_handle())
1234743
def getProcessName(self, pid):
        
        ps = subprocess.check_output(["ps", "aux"]).decode("ascii")
        processes = ps.split("\n")
        cols = len(processes[0].split()) - 1
        for row in processes[1:]:
            if row != "":
                proc = row.split(None, cols)
                if proc[1].strip() == str(pid):
                    return proc[-1]
286729
def _pid_to_id(self, pid):
        """"""
        return d1_common.url.joinPathElements(
            self._base_url,
            self._version_tag,
            "resolve",
            d1_common.url.encodePathElement(pid),
        )
54923
def getWindowPID(self, hwnd):
        
        pid = ctypes.c_ulong()
        ctypes.windll.user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
        return int(pid.value)
630676
def pid(name):
    '''
    
    '''
    try:
        return int(info(name).get('PID'))
    except (TypeError, ValueError) as exc:
        raise CommandExecutionError(
            'Unable to get PID for container \'{0}\': {1}'.format(name, exc)
        )
916834
def position_i(self):
        
        self._position_i, value = self.get_attr_int(self._position_i, 'hold_pid/Ki')
        return value
203202
def get_process_pids(self, process):
        """"""
        pids = []
        cmd_line_glob = "/proc/[0-9]*/cmdline"
        cmd_line_paths = glob.glob(cmd_line_glob)
        for path in cmd_line_paths:
            try:
                with open(path, 'r') as f:
                    cmd_line = f.read().strip()
                    if process in cmd_line:
                        pids.append(path.split("/")[2])
            except IOError as e:
                continue
        return pids
696432
function get(pid, callback) {
  var ps = processes[pid];
  if( typeof callback === 'function' ) return ps ? callback(null, ps) : callback(new Error('not exists pid:' + pid));
  else return ps;
}
574173
protected function getPid(): int
    {
        $pid = 0;

        if (is_readable($this->getConfig('swoole.pid_file'))) {
            $pid = file_get_contents($this->getConfig('swoole.pid_file'));
        }

        return $pid;
    }
425219
def get_params(self, tid):
        
        try:
            params = self.get_params_stack(tid)[-1]
        except IndexError:
            msg = "Hooked function called from thread %d already returned"
            raise IndexError(msg % tid)
        return params
1146574
def read_pid_constants(self):
        """"""
        p = self._read_as_int(Addr.PConstant, 4)
        i = self._read_as_int(Addr.IConstant, 4)
        d = self._read_as_int(Addr.DConstant, 4)
        
        return map(lambda x: x / (2 ** 16), (p, i, d))
575891
def get_pid(self):
        
        if self.dwProcessId is None:
            if self.__process is not None:
                # Infinite loop if self.__process is None
                self.dwProcessId = self.get_process().get_pid()
            else:
                try:
                    # I wish this had been implemented before Vista...
                    # XXX TODO find the real ntdll call under this api
                    hThread = self.get_handle(
                                        win32.THREAD_QUERY_LIMITED_INFORMATION)
                    self.dwProcessId = win32.GetProcessIdOfThread(hThread)
                except AttributeError:
                    # This method really sucks :P
                    self.dwProcessId = self.__get_pid_by_scanning()
        return self.dwProcessId
910956
def init_pid(self, kp, ki, kd):
        """"""
        p, i, d = map(lambda x: int(x * (2 ** 16)), (kp, ki, kd))
        self._set_as_int(Addr.PConstant, p, 4)
        self._set_as_int(Addr.IConstant, i, 4)
        self._set_as_int(Addr.DConstant, d, 4)
1031315
function pidFind(pid) {
  if (!_.isFinite(pid)) return false;
  try {
    if (runningAsRoot()) {
      return process.kill(pid, 0);
    } else {
      return !!ps(pid);
    }
  } catch (e) {
    return false;
  }
}
1091064
private function readInc($pid)
    {
        $res = shm_attach($pid);
        if (!shm_has_var($res, 0)) {
            shm_put_var($res, 0, 0);
        }

        $inc = shm_get_var($res, 0);
        if ($inc === 16777215) {
            $inc = 0;
        }

        ++$inc;

        shm_put_var($res, 0, $inc);

        return $inc;
    }
1103676
private long getPID() {
        String commandOutput = executeCommand("$pid").getCommandOutput();

        //Remove all non numeric characters
        commandOutput = commandOutput.replaceAll("\\D", "");

        if (!commandOutput.isEmpty()) {
            return Long.valueOf(commandOutput);
        }

        return -1;
    }
754641
def read_pid(self):
        
        try:
            with open(self._path, 'r') as f:
                s = f.read().strip()
                if not s:
                    return None
                return int(s)
        except IOError as e:
            if e.errno == errno.ENOENT:
                return None
            raise