diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-09-08 20:39:49 +0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-09-08 20:39:49 +0800 |
commit | 147a35addd1b476a39b06221dc0e13fdff9562ac (patch) | |
tree | 7f8658fe9ba72ad6248b762887ca27e55431bfcd | |
parent | 9e4b231df96138e7dc0425978f64b52f194c3b3e (diff) | |
parent | c15fb0d09f6dd89238fc341e15b839815d3bc078 (diff) | |
download | psutil-147a35addd1b476a39b06221dc0e13fdff9562ac.tar.gz |
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r-- | HISTORY.rst | 4 | ||||
-rw-r--r-- | psutil/arch/freebsd/proc_socks.c | 36 |
2 files changed, 40 insertions, 0 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index 6379930e..1213db2c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,10 @@ XXXX-XX-XX - 1124_: documentation moved to http://psutil.readthedocs.io +**Big fixes** + +- 1105_: [FreeBSD] psutil does not compile on FreeBSD 12. + **Compatibility notes** - 1120_: .exe files for Windows are no longer uploaded on PYPI as per PEP-527; diff --git a/psutil/arch/freebsd/proc_socks.c b/psutil/arch/freebsd/proc_socks.c index 9b03e059..c5b19a0d 100644 --- a/psutil/arch/freebsd/proc_socks.c +++ b/psutil/arch/freebsd/proc_socks.c @@ -136,20 +136,36 @@ psutil_search_tcplist(char *buf, struct kinfo_file *kif) { if (kif->kf_sock_domain == AF_INET) { if (!psutil_sockaddr_matches( AF_INET, inp->inp_lport, &inp->inp_laddr, +#if __FreeBSD_version < 1200031 &kif->kf_sa_local)) +#else + &kif->kf_un.kf_sock.kf_sa_local)) +#endif continue; if (!psutil_sockaddr_matches( AF_INET, inp->inp_fport, &inp->inp_faddr, +#if __FreeBSD_version < 1200031 &kif->kf_sa_peer)) +#else + &kif->kf_un.kf_sock.kf_sa_peer)) +#endif continue; } else { if (!psutil_sockaddr_matches( AF_INET6, inp->inp_lport, &inp->in6p_laddr, +#if __FreeBSD_version < 1200031 &kif->kf_sa_local)) +#else + &kif->kf_un.kf_sock.kf_sa_local)) +#endif continue; if (!psutil_sockaddr_matches( AF_INET6, inp->inp_fport, &inp->in6p_faddr, +#if __FreeBSD_version < 1200031 &kif->kf_sa_peer)) +#else + &kif->kf_un.kf_sock.kf_sa_peer)) +#endif continue; } @@ -243,19 +259,35 @@ psutil_proc_connections(PyObject *self, PyObject *args) { inet_ntop( kif->kf_sock_domain, psutil_sockaddr_addr(kif->kf_sock_domain, +#if __FreeBSD_version < 1200031 &kif->kf_sa_local), +#else + &kif->kf_un.kf_sock.kf_sa_local), +#endif lip, sizeof(lip)); inet_ntop( kif->kf_sock_domain, psutil_sockaddr_addr(kif->kf_sock_domain, +#if __FreeBSD_version < 1200031 &kif->kf_sa_peer), +#else + &kif->kf_un.kf_sock.kf_sa_peer), +#endif rip, sizeof(rip)); lport = htons(psutil_sockaddr_port(kif->kf_sock_domain, +#if __FreeBSD_version < 1200031 &kif->kf_sa_local)); +#else + &kif->kf_un.kf_sock.kf_sa_local)); +#endif rport = htons(psutil_sockaddr_port(kif->kf_sock_domain, +#if __FreeBSD_version < 1200031 &kif->kf_sa_peer)); +#else + &kif->kf_un.kf_sock.kf_sa_peer)); +#endif // construct python tuple/list py_laddr = Py_BuildValue("(si)", lip, lport); @@ -287,7 +319,11 @@ psutil_proc_connections(PyObject *self, PyObject *args) { else if (kif->kf_sock_domain == AF_UNIX) { struct sockaddr_un *sun; +#if __FreeBSD_version < 1200031 sun = (struct sockaddr_un *)&kif->kf_sa_local; +#else + sun = (struct sockaddr_un *)&kif->kf_un.kf_sock.kf_sa_local; +#endif snprintf( path, sizeof(path), "%.*s", (int)(sun->sun_len - (sizeof(*sun) - sizeof(sun->sun_path))), |