freebsd-skq/lib/libc
Bill Paul 456ebbf8f5 ypbind.c: Major overhaul.
- Moved to a more client-driven model. We aggressively attempt to keep
the default domain bound (as before) but we give up on non-default
domains if we lose contact with a server and fail to get a response
after one round of broadcasting. This helps drastically reduce the
amount of network bandwitdh that ypbind consumes: if a client references
the secondary domain at some later point, this will prod ypbind into
establishing a new binding anyway, so continuously broadcasting without
need is pointless.

Note that we still actively seek out a binding for our default domain
even if no client program has queried us yet. I'm not exactly sure if
this matches SunOS's behavior or not, but I decided to do it this way
since we can get into all sorts of trouble if our default domain comes
unbound. Even so, we're still much quieter than we used to be.

- Removed a bunch of no-longer pertinent comments and a couple of
chunks of #ifdef 0'ed code that no longer fit in to the new layout.

- Theo deRaadt must have become frustrated with the callback mechanism
in clnt_broadcast(), because he shamelessly stole the clnt_broadcast()
code right out of the RPC library and hacked it up to suit his needs.
(Comments and all! :)

I can understand why: clnt_broadcast() blocks while awaiting replies.
Changing this behavior requires surgery. However, you can work around
this: fork the broadcast into a child process and relay the results
back to the parent via a pipe. (Careful obervation has shown that the
SunOS ypbind forks children for broadcasting too, though I can only
guess what sort of interprocess communication it uses. pipe() seems to
do the job well enough.)

This may seem like the long way around, but it's not really that
hard to implement, and I'd prefer to use documented RPC library functions
wherever possible. We're careful to limit the number of simultaneous
broadcasters to avoid swamping the system (the current limit is 5).
Each clnt_broadcast() call only sends out a small number of packets
at increasing intervals. We're also careful not to spawn more than one
bradcaster for a given domain.

- Used clntudp_bufcreate() and clnt_call() to implement a ping()
function for directly querying a particular server so that we can
check if it's still alive. This lets me completely remove the old
bradcasting code and use actual RPC library calls instead, at the
cost of more than a few handfulls of torn-out hair. (Make no mistake
folks: I *HATE* RPC.) Currently, the ping interval is one minute.

- Fixed another potential 'nfds too big for select()' bug: use
_rpc_dtablesize() instead of getdtablesize().

- Quieted gcc -Wall a bit.

- Probably a bunch of other stuff that I've forgotten.

ypbind.8:

- Updated man page to reflect modifications.

ypwhich.c:

- Small mind-o fix from last time: decode error results from
ypbind correctly (*groan*)

yplib.c:

- same as above

- Change behavior of _yp_dobind() a little: if we get back a 'Domain
not bound' error for a given domain, retry a few times before giving
up and passing the error back to the caller. We have to sleep for a
few seconds between tries since the 'Domain not bound' error comes
back immediately (by repeatedly looping, we end up pounding on ypbind).
We retry at most 20 times at 5 second intervals. This gives us a full
minute to get a response. This seems to deviate a bit from SunOS
behavior -- it appears to wait forever -- but I don't like the idea
of perpetually hanging inside a library call.

Note that this should fix the problems some people have with bindings
not being established fast enough at boot time; sometimes amd is started
in /etc/rc after ypbind has run but before it gets a binding set up. The
automounter gets annoyed at this and tends to exit. By pausing ther YP
calls until a binding is ready, we avoid this situation.

- Another _yp_dobind() change: if we determine that our binding files
are unlocked or nonexistent, jump directly to code that pokes ypbind
into restablishing the binding. Again, if it fails, we'll time out
eventually and return.
1995-04-26 19:03:16 +00:00
..
amd64 First round of changes to clean up the RCSID mess in libc: 1995-01-23 01:30:24 +00:00
compat-43 Remove setre*id*. 1995-04-25 10:00:04 +00:00
db Added the mpool.3 manpage to the installed manpages. It is referred from the 1994-12-11 22:03:05 +00:00
gen in _freecaches(): strdup() allocates us memory -- remember to free it. 1995-04-22 17:28:04 +00:00
gmon Added support for kernel profiling to mcount.c 1994-09-15 16:00:41 +00:00
i386 First round of changes to clean up the RCSID mess in libc: 1995-01-23 01:30:24 +00:00
locale Reviewed by: ache and wollman (long ago) 1995-04-07 11:52:17 +00:00
net Add an ethers(3) man page. 1995-04-12 22:28:49 +00:00
nls Fix manpage rule 1995-04-02 19:35:40 +00:00
quad BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
regex First crack at making libc work with the new make macros. It compiles on 1994-08-05 01:19:12 +00:00
rpc 'Fix' for esoteric misfeature discovered while searching for another bug: 1995-04-04 05:53:22 +00:00
stdio Obtained from: 1.1.5 (originally by jtc) 1995-04-06 16:28:15 +00:00
stdlib Fix a missing _hash() to prevent namespace pollution with the db/hash routines. 1995-03-28 08:41:02 +00:00
stdtime On snap 950210, format %s (print seconds from the epoch) is missing 1995-03-01 23:08:40 +00:00
string If locale not available, fallback to strcasecmp, not to strcmp 1995-04-16 22:43:45 +00:00
sys Add setreuid/setregid to MAN section 1995-04-23 15:06:16 +00:00
xdr More directory cleanup after YP merge. 1994-08-07 22:21:14 +00:00
yp ypbind.c: Major overhaul. 1995-04-26 19:03:16 +00:00
Makefile Add nls include to Makefile. 1995-03-30 12:46:36 +00:00