With this patch series, nbdkit, the pluggable Network Block Device server, supports FreeBSD ≥ 11.2.
With this patch series, nbdkit, the pluggable Network Block Device server, supports FreeBSD ≥ 11.2.
This site uses Akismet to reduce spam. Learn how your comment data is processed.
I am Richard W.M. Jones, a computer programmer. I have strong opinions on how we write software, about Reason and the scientific method. Consequently I am an atheist [To nutcases: Please stop emailing me about this, I'm not interested in your views on it] By day I work for Red Hat on all things to do with virtualization. I am a "citizen of the world".
My motto is "often wrong". I don't mind being wrong (I'm often wrong), and I don't mind changing my mind.
This blog is not affiliated or endorsed by Red Hat and all views are entirely my own.
Thanks Richard, that’s really great. FreeBSD developer here — what is your use case for the reentrant random(3) functions? Usually people want good random numbers, in which case there are the thread-safe getrandom(2) or getentropy(3) APIs. I might even consider the old random() routines an undesirable legacy interface (which may explain why no one has added the reentrant APIs to FreeBSD).
Any other missing pieces that made this more painful for you than you would like? I’m interested to hear about any pain points in porting — I want to help make it as pain-free as possible. Gaps in documentation, gaps in APIs, you name it.
All the best,
Conrad
https://github.com/libguestfs/nbdkit/blob/cee9060625254c5c14aac84a0821333cc8803136/filters/error/error.c#L276
In this filter we’re using random numbers simply to inject random errors into the request stream for testing. In this case we could actually use
getrandom(2)
(although IIRC glibc didn’t provide bindings for this so it mght not work on Linux yet — edit: looks like latest glibc does have this now). We don’t really need the random numbers to be cryptographically secure for this application, although as long as they aren’t too onerous to generate it doesn’t matter. However we do need the function to be thread safe (the current FreeBSD code callingrandom(3)
probably is not and so will fail under various conditions).Other issues we had in no particular order:
It would be nice if bash was installed as
/bin/bash
as it is on every Linux distro.glibc has a useful (non-POSIX) function
get_current_dir_name
. It would be just a few lines of code to implement this on BSD for compatibility. https://github.com/libguestfs/nbdkit/blob/cee9060625254c5c14aac84a0821333cc8803136/src/utils.c#L49truncate
(command) doesn’t support long--size
option, so we had to change this to use-s
instead.There’s some problem with automake-generated Makefiles and BSD make. People can just use
gmake
so it’s not a serious issue, and it may also be a bug in automake or even in our own Makefile.am’s.Most of these are minor porting issues, and in all it wasn’t hard to port the code to FreeBSD (I didn’t try other BSDs yet).
Hi Rich,
I had a longer comment typed out but your blog is bouncing it for some reason. In any case, thanks for the feedback!
Sorry about any issues. Likely to be something to do with wordpress. If you find any other problems you can email libguestfs@redhat.com. No need to subscribe.