Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openbsd support (#562) #615

Merged
merged 34 commits into from
Nov 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0e63add
Build changes to try to support OpenBSD. Two new C files copied from …
landryb Dec 26, 2014
c217d34
First stab at merging patches from wip port against 0.4.1
landryb Dec 26, 2014
1aca8dc
It builds!
landryb Dec 26, 2014
0470086
Make this actuall build
landryb Dec 26, 2014
e1e0ef9
PAGESIZE should be 1 on OpenBSD, DEV_BSIZE is used in _psutil_openbsd.c
landryb Dec 28, 2014
51c48a6
Fix warn() invocations
landryb Dec 28, 2014
3b5edef
use the proper type in Py_BuildValue to return an unsigned long
landryb Dec 28, 2014
c6b4cfb
Add a kinfo_getfile() function mimic'ing what FreeBSD's one does in l…
landryb Dec 28, 2014
1174a60
Implement psutil_per_cpu_times()
landryb Dec 28, 2014
3bfd846
Remove unused utmpx code, is only for FreeBSD >= 9
landryb Dec 28, 2014
4858433
Return an empty string for psutil_proc_cwd() - there's no way to get …
landryb Dec 28, 2014
07b6d65
Proper implementation for psutil_proc_open_files(), returning empty p…
landryb Dec 28, 2014
eca6032
enable per_cpu_times method
landryb Dec 28, 2014
eef37e5
Implement psutil_disk_io_counters()
landryb Dec 28, 2014
6c97eab
remove #if 0 proc_exe implem, wont happen. return process name instead
landryb Dec 28, 2014
a0a3538
remove psutil_cpu_count_phys, wont be implemented
landryb Dec 28, 2014
ecf7f41
add function to get a string from an addru
landryb Dec 28, 2014
63d6dc5
Wip on psutil_proc_connections, lightly tested but seem to do the job
landryb Dec 28, 2014
b960e1a
return the same value for count_logical and count_physical on OpenBSD
landryb Dec 28, 2014
d545b81
Merge remote-tracking branch 'upstream/master' into openbsd
landryb Apr 5, 2015
3c5f259
need netdb.h on OpenBSD too for NI_* defines
landryb Apr 5, 2015
a606d7f
follow changes from #578
landryb Apr 5, 2015
93c5e92
treat OpenBSD as a BSD platform for tests
landryb Apr 5, 2015
e8954bd
more changes from #578
landryb Apr 5, 2015
d478f9b
OpenBSD has AF_LINK too
landryb Apr 5, 2015
3432cee
Fix after changes from #564
landryb Apr 5, 2015
54fa691
use the correct type for cptime2
landryb Apr 5, 2015
ccb461f
BSD-specific tests are in fact FreeBSD only
landryb Apr 7, 2015
5fd6a2a
Revert "BSD-specific tests are in fact FreeBSD only"
landryb Apr 7, 2015
e6febc6
alias SONPROC (process currently on processor) as SRUN
landryb Apr 7, 2015
5ce8351
actually return argv when sysctl call succeeds
landryb Apr 7, 2015
541f4ba
import sys to get uname
landryb Apr 7, 2015
b70a2cb
fix overflow in swap size calculation on 32-bits
landryb Apr 7, 2015
7edb559
enable net_if_stats implem on OpenBSD too, examples/ifconfig.py works
landryb Apr 7, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@
elif sys.platform.startswith("freebsd"):
from . import _psbsd as _psplatform

elif sys.platform.startswith("openbsd"):
from . import _psbsd as _psplatform

elif sys.platform.startswith("sunos"):
from . import _pssunos as _psplatform
from ._pssunos import (CONN_IDLE, # NOQA
Expand Down
5 changes: 5 additions & 0 deletions psutil/_psbsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import errno
import functools
import os
import sys
import xml.etree.ElementTree as ET
from collections import namedtuple

Expand Down Expand Up @@ -84,6 +85,8 @@ def virtual_memory():

def swap_memory():
"""System swap memory as (total, used, free, sin, sout) namedtuple."""
if sys.platform.startswith("openbsd"):
PAGESIZE = 1
total, used, free, sin, sout = [x * PAGESIZE for x in cext.swap_mem()]
percent = usage_percent(used, total, _round=1)
return _common.sswap(total, used, free, percent, sin, sout)
Expand Down Expand Up @@ -135,6 +138,8 @@ def cpu_count_physical():
# We may get None in case "sysctl kern.sched.topology_spec"
# is not supported on this BSD version, in which case we'll mimic
# os.cpu_count() and return None.
if sys.platform.startswith("openbsd"):
return cext.cpu_count_logical()
ret = None
s = cext.cpu_count_phys()
if s is not None:
Expand Down
Loading