Blog posts for tags/new-platform

  1. AIX support

    After a long wait psutil finally supports a new exotic platform: AIX!

    Honestly I'm not sure how many AIX Python users are out there (probably not many), but here it is.

    For this we have to thank Arnon Yaari, who started working on the port a couple of years ago (#605). I was skeptical at first, because AIX is the only platform I can't virtualize and test on my laptop, so that made me a bit nervous. Arnon did a great job. The final PR-1123 is huge: it required a considerable amount of work on his part, and a review of more than 140 messages exchanged between us over about a month, during which I was travelling through China.

    The end result is very good: almost all original unit tests pass, and code quality is awesome, which (I must say) is fairly unusual for an external contribution like this. Kudos to you, Arnon! ;-)

    Other changes

    Besides AIX support, release 5.4.0 also includes a couple of important bug fixes for psutil.sensors_temperatures() and psutil.sensors_fans() on Linux, and a fix for a bug on macOS that could cause a segmentation fault when using Process.open_files(). The complete list of bug fixes is in the changelog.

    The future

    Looking ahead at other exotic, still-unsupported platforms, two contributions are worth mentioning: a (still incomplete) PR for Cygwin which looks promising (PR-998), and Mingw32 compiler support on Windows (PR-845).

    psutil is gradually reaching a point where adding new features is becoming rarer, so it's a good moment to welcome new platforms while the API is mature and stable.

    Future work along these lines could also include Android and (hopefully) iOS support. Now that would be really awesome to have.

    Stay tuned.

    Discussion

  2. NetBSD support

    Roughly two months have passed since I last announced that psutil added support for OpenBSD. Today I'm happy to announce that it's the turn of NetBSD! This was contributed by Thomas Klausner, Ryo Onodera and myself in PR-557.

    Differences with FreeBSD (and OpenBSD)

    The NetBSD implementation has limitations similar to the ones I encountered with OpenBSD. Again, FreeBSD remains the BSD variant with the best support in terms of kernel functionality.

    • Process.memory_maps() is not implemented. The kernel provides the necessary pieces, but I haven't done this yet (hopefully later).
    • Process.num_ctx_switches()'s involuntary field is always 0. The kinfo_proc() syscall provides this info, but it's always set to 0.
    • Process.cpu_affinity() (get and set) is not supported.
    • psutil.cpu_count(logical=False) always returns None.

    As for the rest: it is all there. All memory, disk, network and process APIs are fully supported and functioning.

    Other enhancements available in this psutil release

    Besides NetBSD support, this release has a couple of interesting enhancements:

    • #708: [Linux] psutil.net_connections() and Process.connections() can be up to 3x faster when there are many connections.
    • #718: psutil.process_iter() is now thread safe.

    You can read the rest in the changelog, as usual.

    Move to Prague

    As a personal note I'd like to add that I'm currently in Prague (Czech Republic) and I'm thinking about moving down here for a while.

    Discussion

  3. OpenBSD support

    Starting from version 3.3.0 (released just now) psutil officially supports OpenBSD. This was contributed by Landry Breuil and myself in PR-615.

    Differences with FreeBSD

    As expected, the OpenBSD implementation is very similar to FreeBSD's, so I merged most of it into a single C file (_psutil_bsd.c), with 2 separate files (freebsd.c, openbsd.c) for the parts that differ. Here are the functional differences with FreeBSD:

    • Process.memory_maps() is not implemented. The kernel provides the necessary pieces but I haven't done this yet (hopefully later).
    • Process.num_ctx_switches()'s involuntary field is always 0. kinfo_proc provides this info but it is always set to 0.
    • Process.cpu_affinity() (get and set) is not supported.
    • Process.exe() is determined by inspecting the command line, so it may not always be available (returns None).
    • psutil.swap_memory() sin and sout (swap in and swap out) values are not available, and are therefore always set to 0.
    • psutil.cpu_count(logical=False) always returns None.

    As with FreeBSD, Process.open_files() can't return file paths (FreeBSD can sometimes). Otherwise everything is there and I'm satisfied with the result.

    Considerations about BSD platforms

    psutil has supported FreeBSD since the beginning (year 2009). At the time, it made sense to prefer it as the preferred BSD variant as it's the most popular.

    Compared to FreeBSD, OpenBSD appears to be more "minimal", both in terms of kernel facilities and the number of CLI tools available. One thing I particularly appreciate about FreeBSD is that the source code for all CLI tools is available under /usr/src, which was a big help when implementing psutil APIs.

    OpenBSD source code is also available, but it uses CVS and I am not sure it includes the source code for all CLI tools.

    There are still two more BSD variants worth supporting: NetBSD and DragonFlyBSD (in this order). About a year ago, someone provided a patch adding basic NetBSD support, so that will likely happen sooner or later.

    Other enhancements available in this release

    The only other enhancement is #558, which allows specifying a different location for the /proc filesystem on Linux.

    Discussion

Social

Feed