Tuesday, 22 March 2016

Procenv 0.45 released


Yesterday, I released procenv 0.45.

Although not a huge amount has changed on the outside in this release, rather
dramatic changes have occurred on the inside, as evinced by the following:

$ git diff 0.44..0.45 --stat|grep "src/.*\.[ch]"
 src/messages.h                          |    41 +
 src/output.c                            |  2001 ++++++
 src/output.h                            |   179 +
 src/platform-headers.h                  |   243 +
 src/platform.h                          |   167 +
 src/platform/android/platform.c         |    46 +
 src/platform/freebsd/platform-freebsd.h |    43 +
 src/platform/freebsd/platform.c         |   479 ++
 src/platform/hurd/platform-hurd.h       |    38 +
 src/platform/hurd/platform.c            |    91 +
 src/platform/linux/platform-linux.h     |   174 +
 src/platform/linux/platform.c           |  2176 ++++++
 src/platform/minix/platform-minix.h     |    25 +
 src/platform/minix/platform.c           |   126 +
 src/platform/netbsd/platform-netbsd.h   |    25 +
 src/platform/netbsd/platform.c          |   237 +
 src/platform/openbsd/platform-openbsd.h |    25 +
 src/platform/openbsd/platform.c         |   199 +
 src/platform/platform-generic.c         |   922 +++
 src/platform/platform-generic.h         |    66 +
 src/platform/unknown/platform-unknown.h |    25 +
 src/platform/unknown/platform.c         |    89 +
 src/pr_list.c                           |     2 +-
 src/pr_list.h                           |     2 +-
 src/procenv.c                           | 11575 +++++++-----------------------
 src/procenv.h                           |   918 +--
 src/pstring.c                           |   309 +
 src/pstring.h                           |    55 +
 src/string-util.c                       |   543 ++
 src/string-util.h                       |    60 +
 src/types.h                             |    34 +
 src/util.c                              |   288 +
 src/util.h                              |    57 +


Partly driven by "#ifdef hell", and part inspired by Hisham's Fosdem presentation on htop, "Going cross-platform: how htop was made portable", I decided to modularise the code and introduce platform drivers encapsulating the O/S specifics and allowing procenv.c itself to be considerably simplified. This allows for easier maintenance and easier porting to new operating systems.

To prove it, procenv now runs on OpenBSD, NetBSD and Minix 3!

There is still further refactoring to do, but the code is now in much better shape for others to work with.

So, if you'd like to get involved in porting procenv to [insert-your-favourite-as-yet-unsupported-OS-here], get involved! I even wrote a simple porting guide to help get your started:


No comments:

Post a Comment