summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2021-01-07 11:36:35 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2021-01-07 11:36:35 +0100
commit0476278bc4d3c8aebfd5df1181620c5a88c71c50 (patch)
treec62fb05589c2180bf0993e806ce24d1d57bc6a30
parent06e51f7b441c929211a77f416487a04ee14b2e39 (diff)
downloadpsutil-0476278bc4d3c8aebfd5df1181620c5a88c71c50.tar.gz
add debug prints
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
-rw-r--r--psutil/_psutil_osx.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index 3197420d..ee40bc9c 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -130,6 +130,7 @@ psutil_proc_list_fds(pid_t pid, int *num_fds) {
fds_size += PROC_PIDLISTFD_SIZE * 32;
}
+ psutil_debug("list_fds: allocate buf size %i", fds_size);
if (fds_pointer != NULL) {
free(fds_pointer);
}
@@ -149,6 +150,7 @@ psutil_proc_list_fds(pid_t pid, int *num_fds) {
}
if (ret + (int)PROC_PIDLISTFD_SIZE >= fds_size) {
+ psutil_debug("list_fds: make room for 1 extra fd");
ret = fds_size + (int)PROC_PIDLISTFD_SIZE;
continue;
}
@@ -927,11 +929,9 @@ psutil_proc_open_files(PyObject *self, PyObject *args) {
int num_fds;
int i;
unsigned long nb;
-
struct proc_fdinfo *fds_pointer = NULL;
struct proc_fdinfo *fdp_pointer;
struct vnode_fdinfowithpath vi;
-
PyObject *py_retlist = PyList_New(0);
PyObject *py_tuple = NULL;
PyObject *py_path = NULL;
@@ -1013,14 +1013,12 @@ error:
static PyObject *
psutil_proc_connections(PyObject *self, PyObject *args) {
pid_t pid;
- int num_fds = 0;
+ int num_fds;
int i;
unsigned long nb;
-
struct proc_fdinfo *fds_pointer = NULL;
struct proc_fdinfo *fdp_pointer;
struct socket_fdinfo si;
-
PyObject *py_retlist = PyList_New(0);
PyObject *py_tuple = NULL;
PyObject *py_laddr = NULL;
@@ -1041,9 +1039,6 @@ psutil_proc_connections(PyObject *self, PyObject *args) {
goto error;
}
- if (pid == 0)
- return py_retlist;
-
fds_pointer = psutil_proc_list_fds(pid, &num_fds);
if (fds_pointer == NULL)
goto error;