diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-10-24 21:20:58 +0300 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-10-24 21:20:58 +0300 |
commit | 1e1ca969454f6449efac3001add1df6a383bebfb (patch) | |
tree | bf345c9f1839ecc3bd9cdf15c859ffe8dfb48d6f /psutil/__init__.py | |
parent | 06c265bafc204be4b8cbc8bbf10213397750e7a0 (diff) | |
download | psutil-disk-part-ext.tar.gz |
implement posix max file/path lendisk-part-ext
Diffstat (limited to 'psutil/__init__.py')
-rw-r--r-- | psutil/__init__.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py index b2a6efd5..4efc6423 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -2002,7 +2002,24 @@ def disk_partitions(all=False): If *all* parameter is False return physical devices only and ignore all others. """ - return _psplatform.disk_partitions(all) + def getconf(mountp, name): + try: + return os.pathconf(mountp, name) + except (OSError, AttributeError): + pass + + ret = _psplatform.disk_partitions(all) + if POSIX: + new = [] + for item in ret: + nt = _common.sdiskpartext( + *item, + maxfile=getconf(item.mountpoint, 'PC_NAME_MAX'), + maxpath=getconf(item.mountpoint, 'PC_PATH_MAX')) + new.append(nt) + return new + else: + return ret def disk_io_counters(perdisk=False, nowrap=True): |