From 59985331432ac6ce490f8a202d4c65d65a170049 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 10 2020 04:06:48 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/pflags b/pflags index 9c45600..abfcfe9 100755 --- a/pflags +++ b/pflags @@ -1,4 +1,4 @@ -#! /usr/bin/python3 +#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- # print process flags @@ -14,9 +14,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. - +from __future__ import print_function import procfs, re, fnmatch, sys -import argparse from functools import reduce from six.moves import map @@ -39,24 +38,17 @@ def main(argv): global ps ps = procfs.pidstats() - parser = argparse.ArgumentParser(description='Print process flags') - parser.add_argument('pid', nargs='*', help='a list of pids or names') - args = parser.parse_args() - if (len(argv) > 1): - pids = args.pid - pids = reduce(lambda i, j: i + j, list(map(thread_mapper, pids))) + pids = reduce(lambda i, j: i + j, list(map(thread_mapper, argv[1].split(",")))) else: pids = list(ps.processes.keys()) pids.sort() - len_comms = [len(ps[pid]["stat"]["comm"]) for pid in pids if pid in ps] - max_comm_len = max(len_comms, default=0) + len_comms = [len(ps[pid]["stat"]["comm"]) for pid in pids] + max_comm_len = max(len_comms) del(len_comms) for pid in pids: - if pid not in ps: - continue flags = ps[pid].stat.process_flags() # Remove flags that were superseeded if "PF_THREAD_BOUND" in flags and "PF_NO_SETAFFINITY" in flags: diff --git a/procfs/procfs.py b/procfs/procfs.py index b0ce251..c70fe2a 100755 --- a/procfs/procfs.py +++ b/procfs/procfs.py @@ -21,7 +21,6 @@ from __future__ import absolute_import from __future__ import print_function import os, time -from functools import reduce from .utilist import bitmasklist from six.moves import range @@ -459,15 +458,12 @@ class pidstats: self.processes[pid] = process(pid, self.basedir) def reload_threads(self): - to_remove = [] for pid in self.processes.keys(): try: self.processes[pid].load_threads() except OSError: # process vanished, remove it - to_remove.append(pid) - for pid in to_remove: - del self.processes[pid] + del self.processes[pid] def find_by_name(self, name): name = name[:15] diff --git a/procfs/sysctl.py b/procfs/sysctl.py index 6a91455..8b256ab 100755 --- a/procfs/sysctl.py +++ b/procfs/sysctl.py @@ -61,7 +61,7 @@ class sysctl: f.close() def refresh(self): - for key in self.cache.keys(): + for key in self.cache(): del self.cache[key] value = self.read(key) if value != None: