tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: The lamentation of proplib(3)

   Date: Tue, 28 Jan 2014 18:44:57 +0000
   From: Mindaugas Rasiukevicius <>

   Many developers have been dissatisfied with proplib(3) for quite a while
   and my own dissatisfaction has reached the point where I decided to raise
   the question.  The question of replacing proplib(3) with a better library.

I don't think there's much disagreement that proplib is wrong, but a
proposal to replace it ought to include concrete examples of how
current uses of proplib (or C structs or other wire data transmission
formats) should be replaced, not just general murmuring that proplib
sucks and there are better options.  That said...

libnv may be more type-safe as an API itself than proplib, but if we
are going to seriously adopt something for formal protocols, it ought
to have schemas that support enforcement in the C type system so that
the protocols can have type-safe APIs too.

It's mildly helpful for the compiler to reject nvlist_add_int32(nvl,
"xyz", "frobnitz"), but the compiler should also inform you that you
misspelled "xyzzy" or that the ioctl command you're trying to invoke
actually takes a double for the xyz argument.

I'm inclined to say we ought to use protocol buffers -- it supports
C-enforceable schemas, has been widely adopted in the world, and
satisfies more or less all your desiderata.  Parts of the wire format
are a little wacky, but whatever.  The only trouble is we'd have to
write a C-only implementation, but that shouldn't be too hard.

Home | Main Index | Thread Index | Old Index