Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!cmcl2!brl-adm!adm!ultra!wayne@ames.arpa From: wayne@ames.arpa Newsgroups: comp.lang.c Subject: Re: Re: Types (about linkers optimizing near/far branches) Message-ID: <9183@brl-adm.ARPA> Date: Sat, 5-Sep-87 00:34:28 EDT Article-I.D.: brl-adm.9183 Posted: Sat Sep 5 00:34:28 1987 Date-Received: Wed, 9-Sep-87 02:22:12 EDT Sender: news@brl-adm.ARPA Lines: 45 Carol: Thanx much for the select poop; VERY thorough for something you "just slapped together"! However (isn't there always one?), I've still got one question (and a comment or two). First, the question: in your write-up, exactly what do you do to "terminate select" in the selwakeup routine? If I understand things, what you want to do is wake up the one sleeping process given by db->db_sel (now p); how do you wakeup a single process without waking everybody else that's sleeping on selwait? (By the way, my understanding is that if only one process is sleeping, then you wake only him; otherwise, you wakeup everybody in the whole system who is waiting for selects on any device, most of whom will go right back to sleep. Trade-off of infrequent inefficiency for simplicity. Correct?) Now a couple of comments on the write-up, mostly for feedback and to see if I really do understand. First, xxselect is called with "ds" as param but actually wants "db"; the call should be something like xxselqueue(ds.db), right? (Assuming the device buffer is an element of the device structure.) Also, at the top of - 3 -, the sentence "The key is that more than one process can try to select for the same event on the same process" should end with "device" rather than "process," no? Finally, in the code for selwakeup, why bother testing for SSEL before resetting it? And also a comment on the stuff being added to the driver-writing manual. It contains the sentence "The process number of the current process is in u.u_procp" which really isn't true (at least if you think of "process number" as synonymous with "process id"); shouldn't it be "A pointer to the current process's proc table entry ..."? Finally, a philosophical item. How does the xxselect routine know whether the user is in fact going to sleep? I mean, to quote your note, "On a poll, the driver xxselect routine is called just once from the kernel select routine." It seems to me the procedures you outlined will set db->db_sel in the poll case as well, although admittedly the test in selwakeup for (caddr_t)&selwait will prevent anything weird happening. Of course, if there's no way xxselect knows whether the user is polling or not, then ... Anyway, thanx again. Help with "terminate select" please? wayne