[openbeosnetteam] Re: our package

Hi guys,

> > Anyway, since we're currently talking about packages made from our
> > networking stack, I think it would be reasonable to just change the
> > location to something that won't hurt the potential user of that
> > package.
> Hrrm, we can put it on our TODO list, but I think it is already well-placed
> at /etc.
> Which of those files would you like to see in home/config/etc, too?
> We have
> protocols   - makes no sense to allow overriding it by the user
> services    - well, I do not think this is necessary
> resolv.conf    - that one might be useful
> networks    - should not be needed
> So, we only have resolv.conf which could be needed. Shall I put it on my
> (libbind's) TODO list?
> If anybody else does it, please document the change in libbind/DEVNOTES.
> The function for getting the nameservers is in libbind/resolv/res_init.c.
> Just search for _PATH_RESCONF.
> As it seems, we will have to copy-paste the whole code section because it
> references too many variables...

We may hide _PATH_* by using macros, like we do to support thread-safe h_errno.
It may just need to twist a little bit more our headers/posix/netdb.h:

enum {

extern const char * netdb_path(int);

#define _PATH_HEQUIV    netdb_path(NETDB_HEQUIV);
#define _PATH_HOSTS     netdb_path(NETDB_HOSTS);
#define _PATH_NETWORKS  netdb_path(NETDB_NETWORKS);
#define _PATH_SERVICES  netdb_path(NETDB_SERVICES);

_PATH_RESCONF is not defined in netdb.h but in resolv.h. Anyway, I guess that
could be adapted/used for _PATH_RESCONF too without many issue.

#include <netdb.h>
#define _PATH_RESCONF   netdb_path(NETDB_RESOLV_CONF);

It's just a matter to link in our libbind.so and libnet.so this small
netdb_path(). Or a better named one, suggestions are welcomed. :-)
Obviously, netdb_path() should use find_directory().
We then could change at will these files locations without screwing BIND & co.

BTW, we already have some duplicated code in libsocket/socket.c and
libnet/socket.c, including stack_driver_path(), maybe it's time to move them
out in a src/kits/network/shared directory, and add a netdb_path.c there.

I know, that's an ugly macro-driven hack suggestion. But that's often the cost
of using ports on too-foreign target. We, or at least I don't want Haiku to
morph into an Unix because of a too monolithic network stuffs. And we can't
afford to write from scratch a DNS resolver. Not for R1, at least.

What do you think?
The quicker I go back to bed, the better?!

- Philippe "in sleepy mode" Houdoin.

Other related posts: