Machine readable output from userland utilities

Project description

The output of many commands is intended to be read by humans. An unfortunate consequence is that machine parsing of these utilities is difficult and time consuming. The unfortunate effect is that retrieving most infomration requires either complex scripting and regular expressions, or it requires coding C directly to the system calls.

This proposal aims to fix that by providing an interface for userland utilities to emit machine readable output which can be easily parsed by other software components.

Commercial vendors have been modifying FreeBSD for many years to emit machine readable (XML/JSON/YAML) output for common commands to aid scripting against their implementations. A noteable example is JUNOS from Juniper Networking.

What we would do is leverage an existing library for emiting the most commmon scalar types (string, integer, float, array) and modify base FreeBSD utilities to call a library emit XML, JSON or YAML as opposed to directly calling printf.

Utilities we will tackle include:

Approach to solving the problem

I am going to use the existing libraries (libnv and libucl). In the process I will make some changes to these libraries (like adding XML support to libucl). I will convert command line utilities like ls, sysctl, ifconfig, netstat, iostat, vmstat, procstat, fstat, etc. to use these libraries as an output layer.


After this project is ready, it will be easy to add support for machine-readable output to any command line tool. The converted tools will serve as examples for future contributors.


The Code

SummerOfCode2014/MachineReadableFromUserlandUtils (last edited 2014-05-20T13:24:09+0000 by ZarkoKorchev)