[Gluster-devel] glusterfs on NetBSD

Emmanuel Dreyfus manu at netbsd.org
Tue Aug 24 15:48:42 UTC 2010


I am porting glusterfs to NetBSD. I reached the stage where I can mount,
cd, ls, cat, mkdir, rmdir, mknod, ln ... Obviously there are many bugs
remaining, but I am confident this is going to work.

I have 15 patches for now. I posted some of them previously, but had no 
reply. I would appreciate if a committer could review them.

The most troublesome issue is basename(3) and dirname(3) usage. While
Linux modify the given string and return it, the NetBSD flavor of those 
return static buffers, which is not thread safe. Both behavior are SUSv2
compliant: the functions are not supposed to be thread safe. Since they
are used, there is a portability problem here.

In order to fix that, I can add basename_r() and dirname_r(), and 
do this:
#ifdef __NetBSD__
#define basename(x) basename_r(x)
#define dirname(x) dirname_r(x)
#endif /* __NetBSD__ */

The question is: where in the code is the prefered way for adding
basename_r() and dirname_r()? And in what header should I add the 
defines above?

Emmanuel Dreyfus
manu at netbsd.org

More information about the Gluster-devel mailing list