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 (#2321)

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().
"""
  • Loading branch information
hroncok committed Oct 24, 2023
1 parent 0c3a1c5 commit e9dabbb
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 e9dabbb

Please sign in to comment.