Skip to content

Commit

Permalink
Fix #2412, [macOS]: can't compile on macOS 10.4 PowerPC due to missin…
Browse files Browse the repository at this point in the history
…g `MNT_` constants.
  • Loading branch information
giampaolo committed Jun 11, 2024
1 parent 89b6096 commit 5f80c12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
- 2365_, [macOS]: can't compile on macOS < 10.9. (patch by Ryan Schmidt)
- 2395_, [OpenBSD]: `pid_exists()`_ erroneously return True if the argument is
a thread ID (TID) instead of a PID (process ID).
- 2412_, [macOS]: can't compile on macOS 10.4 PowerPC due to missing `MNT_`
constants.

**Porting notes**

Expand Down
20 changes: 13 additions & 7 deletions psutil/arch/osx/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
strlcat(opts, ",async", sizeof(opts));
if (flags & MNT_EXPORTED)
strlcat(opts, ",exported", sizeof(opts));
if (flags & MNT_QUARANTINE)
strlcat(opts, ",quarantine", sizeof(opts));
if (flags & MNT_LOCAL)
strlcat(opts, ",local", sizeof(opts));
if (flags & MNT_QUOTA)
Expand All @@ -108,10 +106,6 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
strlcat(opts, ",nouserxattr", sizeof(opts));
if (flags & MNT_DEFWRITE)
strlcat(opts, ",defwrite", sizeof(opts));
if (flags & MNT_MULTILABEL)
strlcat(opts, ",multilabel", sizeof(opts));
if (flags & MNT_NOATIME)
strlcat(opts, ",noatime", sizeof(opts));
if (flags & MNT_UPDATE)
strlcat(opts, ",update", sizeof(opts));
if (flags & MNT_RELOAD)
Expand All @@ -120,7 +114,19 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
strlcat(opts, ",force", sizeof(opts));
if (flags & MNT_CMDFLAGS)
strlcat(opts, ",cmdflags", sizeof(opts));

// requires macOS >= 10.5
#ifdef MNT_QUARANTINE
if (flags & MNT_QUARANTINE)
strlcat(opts, ",quarantine", sizeof(opts));
#endif
#ifdef MNT_MULTILABEL
if (flags & MNT_MULTILABEL)
strlcat(opts, ",multilabel", sizeof(opts));
#endif
#ifdef MNT_NOATIME
if (flags & MNT_NOATIME)
strlcat(opts, ",noatime", sizeof(opts));
#endif
py_dev = PyUnicode_DecodeFSDefault(fs[i].f_mntfromname);
if (! py_dev)
goto error;
Expand Down

0 comments on commit 5f80c12

Please sign in to comment.