Skip to content

Commit

Permalink
refact header file
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Oct 19, 2023
1 parent 05c5234 commit 8d0a043
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion psutil/_psutil_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

static PyMethodDef mod_methods[] = {
// --- per-process functions
#if PSUTIL_HAVE_IOPRIO
#ifdef PSUTIL_HAVE_IOPRIO
{"proc_ioprio_get", psutil_proc_ioprio_get, METH_VARARGS},
{"proc_ioprio_set", psutil_proc_ioprio_set, METH_VARARGS},
#endif
Expand Down
2 changes: 1 addition & 1 deletion psutil/arch/linux/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../../_psutil_common.h"


#if PSUTIL_HAVE_IOPRIO
#ifdef PSUTIL_HAVE_IOPRIO
enum {
IOPRIO_WHO_PROCESS = 1,
};
Expand Down
15 changes: 9 additions & 6 deletions psutil/arch/linux/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
#include <sched.h> // CPU_ALLOC

// Linux >= 2.6.13
#define PSUTIL_HAVE_IOPRIO defined(__NR_ioprio_get) && defined(__NR_ioprio_set)
#if defined(__NR_ioprio_get) && defined(__NR_ioprio_set)
#define PSUTIL_HAVE_IOPRIO

PyObject *psutil_proc_ioprio_get(PyObject *self, PyObject *args);
PyObject *psutil_proc_ioprio_set(PyObject *self, PyObject *args);
#endif

// Should exist starting from CentOS 6 (year 2011).
#ifdef CPU_ALLOC
#define PSUTIL_HAVE_CPU_AFFINITY
#endif

PyObject *psutil_proc_cpu_affinity_get(PyObject *self, PyObject *args);
PyObject *psutil_proc_cpu_affinity_set(PyObject *self, PyObject *args);
PyObject *psutil_proc_ioprio_get(PyObject *self, PyObject *args);
PyObject *psutil_proc_ioprio_set(PyObject *self, PyObject *args);
PyObject *psutil_proc_cpu_affinity_get(PyObject *self, PyObject *args);
PyObject *psutil_proc_cpu_affinity_set(PyObject *self, PyObject *args);
#endif

0 comments on commit 8d0a043

Please sign in to comment.