Skip to content

Commit

Permalink
Include <unistd.h> to avoid implicit-function-declaration for close a…
Browse files Browse the repository at this point in the history
…nd syscall

See https://docs.python.org/3.13/whatsnew/3.13.html

"""
Python.h no longer includes the <unistd.h> standard header file. If needed,
it should now be included explicitly.
For example, it provides the functions: read(), write(), close(), isatty(),
lseek(), getpid(), getcwd(), sysconf() and getpagesize().
"""

(I have not tested the additions to non-linux files.)
  • Loading branch information
hroncok committed Oct 23, 2023
1 parent 1b94083 commit c23c1b6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions psutil/_psutil_sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <arpa/inet.h>
#include <net/if.h>
#include <math.h> // fabs()
#include <unistd.h>

#include "_psutil_common.h"
#include "_psutil_posix.h"
Expand Down
1 change: 1 addition & 0 deletions psutil/arch/linux/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <sys/ioctl.h>
#include <linux/if.h>
#include <linux/version.h>
#include <unistd.h>

// see: https://github.com/giampaolo/psutil/issues/659
#ifdef PSUTIL_ETHTOOL_MISSING_TYPES
Expand Down
1 change: 1 addition & 0 deletions psutil/arch/linux/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <Python.h>
#include <sys/syscall.h>
#include <sched.h>
#include <unistd.h>

#include "proc.h"
#include "../../_psutil_common.h"
Expand Down
1 change: 1 addition & 0 deletions psutil/arch/solaris/environ.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <sys/procfs.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

#include "environ.h"

Expand Down

0 comments on commit c23c1b6

Please sign in to comment.