FreeBSD src
Go to file
Bill Paul faf215c7ad This commit changes the YPPROC_ALL procecdure so that it handles requests
_without_ using fork().

The problem with YPPROC_ALL is that it transmits an entire map through
a TCP pipe as the result of a single RPC call. First of all, this requires
certain hackery in the XDR filter. Second, if the map being sent is
large, the server can end up spending lots of time in the XDR filter
sending to just the one client, while requests for other clients will
go unanswered.

My original solution for this was to fork() the request into a child
process which terminates after the map has been transmitted (or the
transfer is interrupted due to an error). This leaves the parent free
to handle other requests. But this solution is kind of lame: fork()
is relatively expensive, and we have to keep a cap on the number of
child processes to keep from swamping the system.

What we do now is grab control of the service transport handle and XDR
handle from the RPC library and send the records one at a time ourselves
instead of letting the RPC library do it. We send a record, then go
back to the svc_run() loop and select() on the socket. If select() says
we can still write data, we send the next record. Then we call
svc_getreqset() and handle other RPCs and loop around again. This way,
we can handle other RPCs between records.

We manage multiple YPPROC_ALL requests using a circular queue. When a
request is done, we dequeue it and destroy the handle. We also tag
each request with a ttl which is decremented whevever we run the queue
and a handle isn't serviced. This lets us nuke requests that have sat
idle for too long (if we didn't do this, we might run out of socket
descriptors.)

Now all I have to do is come up with an async resolver, and ypserv
won't need to fork() at all. :)

Note: these changes should not go into 2.2 unless they get a very
throrough shakedown before the final cutoff date.
1996-11-30 22:38:44 +00:00
bin Bruce says: "You have been programming in the kernel for too long :-)." 1996-11-13 20:00:03 +00:00
contrib Use LANG=C, LC_CTYPE=C, LC_TIME=C 1996-11-26 08:58:57 +00:00
eBones First round of moving secure telnet (AKA kerberised telnet) to its new home 1996-10-26 17:20:52 +00:00
etc Add share/misc. Definite 2.2 candidate, if we want it to be consistent 1996-11-26 10:01:28 +00:00
games Fix minor typo/grammatical error 1996-11-22 22:16:25 +00:00
gnu Made the synopsis in the man page conform to the style guide. 1996-11-30 16:12:46 +00:00
include Update to more current reality. 1996-11-28 09:57:31 +00:00
lib Improve the Dangerously Dedidcated mode a bit. Not much, but a bit better. 1996-11-27 22:44:43 +00:00
libexec Truncate the file when opening it with write intent. Otherwise, 1996-11-30 20:59:32 +00:00
lkm Make snake 3.0-CURRENT here. 1996-11-11 14:18:40 +00:00
release Change boolean nature of "router" variable since it's not a boolean 1996-11-29 23:52:20 +00:00
sbin Fix lots of non-bug questionable code: 1996-11-21 19:36:09 +00:00
secure Secure telnet is now in eBones. 1996-11-07 14:42:57 +00:00
share Correcting Mark Huizer's address. 1996-11-30 18:05:48 +00:00
sys Fixed input of BREAKs when IGNPAR is set and IGNBRK is not set. BREAKs 1996-11-30 15:52:56 +00:00
tools Back out a little more of the previous changes. No longer change 1996-10-31 15:57:25 +00:00
usr.bin Made the synopsis in the man page conform to the style guide. 1996-11-30 16:12:46 +00:00
usr.sbin This commit changes the YPPROC_ALL procecdure so that it handles requests 1996-11-30 22:38:44 +00:00
COPYRIGHT This is the official 4.4 Lite copyright. 1994-09-11 07:53:28 +00:00
Makefile Use LC_TIME=C instead of LC_TIME= (POSIX) 1996-11-26 03:26:31 +00:00