Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!news From: postmaster@nrl3.arpa (SMTP MAILER) Newsgroups: comp.unix.wizards Subject: Mail not delivered yet, still trying Message-ID: <22059@adm.BRL.MIL> Date: 11 Jan 90 23:17:18 GMT Sender: news@adm.BRL.MIL Lines: 603 ----Mail status follows---- Have been unable to send your mail to , will keep trying for a total of three days. At that time your mail will be returned. ----Transcript of message follows---- Date: 11 Jan 90 09:29:00 EST From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V9#044 To: "whitis" Return-Path: <@nrl3.arpa:unix-wizards-request@sem.brl.mil> Received: from nrl3.arpa by nrl3.arpa with SMTP ; Thu, 11 Jan 90 09:27:47 EST Received: from SEM.BRL.MIL by nrl3.arpa with SMTP ; Thu, 11 Jan 90 06:20:05 EST Received: from SEM.BRL.MIL by SEM.brl.MIL id aa07083; 11 Jan 90 2:52 EST Received: from sem.brl.mil by SEM.BRL.MIL id aa07051; 11 Jan 90 2:45 EST Date: Thu, 11 Jan 90 02:45:12 EST From: The Moderator (Mike Muuss) To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V9#044 Message-ID: <9001110245.aa07051@SEM.BRL.MIL> UNIX-WIZARDS Digest Thu, 11 Jan 1990 V9#044 Today's Topics: more nroff help needed Re: Number of chars in input queue - terminal, keyboard Re: How to delete a file with ^? chars in the name? Re: Need a Tape Drive Hardware guru memory allocation package wanted Re: memory allocation package wanted Re: Wanted: fast tar across ether read on a pipe vs. SIGCHLD Re: AWK/shell quoting tcsh and process groups ----------------------------------------------------------------- From: Jim Harkins Subject: more nroff help needed Keywords: I have not yet begun to fight Date: 10 Jan 90 01:44:39 GMT To: unix-wizards@sem.brl.mil Hi, I was asking a few days ago about moving page numbers from the top of the page to the bottom in nroff. I got it working, thanks to those who responded. I've now got a new problem. I want to imbed my source into my document (remember, this is the military. If it makes sense we can't do it). I started out with .nf, .na, and .cs commands to keep it from munging my text. No go. There are 2 general problems. First, lines that start with an asterisk or a slash get joined to the preceeding line. For example: .nf .na .cs /*-------*/ /* data dictionary entry for fred. /* They don't really look like this, this is an example fred (data flow) = * Type: something * 0x24 Becomes /*------*/ /* data dictionary entry for fred. /* They don't really look like this, this is an example fred (data flow) = * Type: something* 0x24. (The *s are comment delimiters). I tried using \(** and \(sl instead of stars and slashes and it made no difference. Second, the source is in 80 column line format and I'm having trouble getting them to stay that way. I've been adjusting the page offset and line length (.nr PO x.y, .po x.y, .nr LL z, .ll z) with no luck. For example, assuming 20 column lines: 00000000011111111112 12345678901234567890 mary had a little lamb it's fle Becomes something like 0000 0000011111111112 123456789 01234567890 mary had a litt le lamb it's fle As far as I can tell there is no ryme or reason as to where and why it breaks lines and whether or not it will honor the indenting in the source file. So what am I doing wrong? To summarize, I basically have a file of about 70 pages that I want printed as is in my document. All I want done is for each page to have the same headers/footers as the rest of the document. I'm trying to do it like: .nr PO x.y .nr LL x .po x.y .ll x .nf .na .cs (by the way, how do I undo this command?) .so src/foo ( file 1 ) .bp .so src/bar ( file 2 ) .bp .so src/blatz ( file 3 ) .fi .ad I'm using the ms macro package. Please respond by email. Thanks in advance. jim jharkins@sagpd1 "Only dead fish go with the flow" ----------------------------- From: Doug Gwyn Subject: Re: Number of chars in input queue - terminal, keyboard Date: 10 Jan 90 09:28:42 GMT To: unix-wizards@sem.brl.mil In article <1439@sas.UUCP> jwd@sas.UUCP (John W. DeBoskey) writes: > A BSD answer is to use FIONREAD, but sVr3 doesn't have it, and I've >been unable to duplicate it. There really is no even semi-standard way to obtain this information, and in many UNIX implementations it cannot be obtained at all by unprivileged processes. Therefore the question should be asked, why do you think you need this information? I have NEVER in many years of UNIX system programming needed such information, which makes me suspect you don't really need it either. If all you want to do is to avoid blocking on a read from the terminal (the most common motivation for such queries), other methods will accomplish that. System V also provides a way to control input burst size, which may be what you desire. Without more information about the application it is hard to give good advice. ----------------------------- From: "T. William Wells" Subject: Re: Number of chars in input queue - terminal, keyboard Keywords: QUEUE TERM KEYBOARD ISC 1.0.6 Date: 10 Jan 90 09:47:41 GMT To: unix-wizards@sem.brl.mil In article <1439@sas.UUCP> jwd@sas.UUCP (John W. DeBoskey) writes: : The subject almost says it all. I'm running ISC 1.0.6. I want to : find out how many characters are available to read from the terminal : if there are any. ie: avail = in_queue(term_id). As far as I know, it can't be done without kernel hacking. --- Bill { uunet | novavax | ankh | sunvice } !twwells!bill bill@twwells.com ----------------------------- From: "Roy M. Silvernail" Subject: Re: How to delete a file with ^? chars in the name? Date: 10 Jan 90 09:57:03 GMT To: unix-wizards@sem.brl.mil In article <7711@unix.SRI.COM>, ubi@ginger.sri.com (Ron Ueberschaer x4399) writes: > I have a file which is named ^?^?^?H01.b (delete character?) and can't > find a way to delete it. Here's one way to do it: /bin/ls>foo edit foo with vi to delete all other lines and insert rm in front of the filename in question. Save it and 'sh foo' -- _R_o_y _M_. _S_i_l_v_e_r_n_a_i_l | UUCP: uunet!comcon!roy | "Every race must arrive at this #include ;#define opinions MINE | point in its history" SnailMail: P.O. Box 210856, Anchorage, | ........Mr. Slippery Alaska, 99521-0856, U.S.A., Earth, etc. | ----------------------------- From: "Jeremy J. Epstein" Subject: Re: How to delete a file with ^? chars in the name? Date: 10 Jan 90 14:31:11 GMT To: unix-wizards@sem.brl.mil In article <130045@sun.Eng.Sun.COM>, lm@snafu.Sun.COM (Larry McVoy) writes: > In article <7711@unix.SRI.COM> ubi@ginger.sri.com (Ron Ueberschaer x4399) writes: > >I have a file which is named ^?^?^?H01.b (delete character?) and can't > >find a way to delete it. An ls -s on the directory produces: > > > > .. ... (other files) > > 1 ???H01.b > > > > $ cat > xxx.c > #include > main() > { > char buf[255]; > > while (gets(buf)) > if (unlink(buf)) > perror(buf); > } > ^D > $ cc xxx.c > $ a.out > ????H01.b > ^D Unfortunately this won't work since the shell is responsible for expanding the ? and * wildcard characters, not the kernel (just for fun, consider implementing a shell which used different wildcard characters...it's only confusing to the user). Try this: main() { unlink("\177\177\177H01.b"); } It also might be worth using "od" to examine the directory...if the high order bit is on in any of the bytes in the file name, then the shell won't show them (since most shells strip the high order bit). If that's the case, then you would need to use: main() { unlink("\377\377\377H01.b"); } -- Jeremy Epstein TRW Systems Division 703-876-4202 jje@virtech.uu.net ----------------------------- From: Ira Rampil Subject: Re: Need a Tape Drive Hardware guru Keywords: Tape, guru, $$$$ Date: 10 Jan 90 17:02:49 GMT To: unix-wizards@sem.brl.mil Summary says it all! Again, thanks to the dozen or so folks who responded with names or suggestions. My colleague should be in touch with the named parties when he returns to town. Regards, Ira ----------------------------- From: ned Subject: memory allocation package wanted Date: 10 Jan 90 19:58:50 GMT To: unix-wizards@sem.brl.mil I'm developing a device driver that requires varying amounts of shared memory to be dynamically allocated and deallocated. I'm looking for a public domain memory allocation package which is functionally equivalent to malloc, but is designed so that buffer information (pointers, flags, etc.) are maintained in an area that is separate from the arena itself (i.e. does not use a linked list as malloc classic does). My particular application requires that memory be allocated at interrupt level, so critical sections of code need to be fast and few. Can anyone help? Thanks. -- Ned Robie uunet!h-three!ned ----------------------------- From: Andrew Valencia Subject: Re: memory allocation package wanted Date: 11 Jan 90 00:40:58 GMT To: unix-wizards@sem.brl.mil In article <758@h-three.UUCP> ned@h-three.UUCP (ned) writes: >My particular application requires that memory be allocated at >interrupt level, so critical sections of code need to be >fast and few. Take a look at kern_malloc.c/malloc.h from the 4.3-tahoe distribution. The public portions of it are available on uunet. Although the files are from kernel source, I've successfully converted them into user-level routines also. They contain no AT&T-owned source, so their use is reasonable in other products. Andy Valencia ...!{uunet, sun}!sequent!vandys ----------------------------- From: Bob Sutterfield Subject: Re: Wanted: fast tar across ether Date: 10 Jan 90 21:12:56 GMT Sender: USENET Administrator To: unix-wizards@sem.brl.mil In article <1430@gould.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes: I am in urgent need of a way to write tar output to a remote tape drive, an exabyte, over ethernet very quickly - preferably allowing the exabyte to stream. I currently use the gnu-tar, which does a pretty good job but I really something faster. This SparcStation-1 has a local Wren-VI and an Exabyte on the same SCSI bus, and I use GNU Tar for backups of it and several other machines. I can get about 30% better throughput when backing up the local disk than when backing up a disk attached to a 4/110 on the same Ethernet, but even the local speed is about 40% short of what the Exabyte specs say would cause it to stream. Paul Placeway did some improvements to dump while he was at Ohio State and was (I believe) able to drive tapes at device speed either locally or across an Ethernet. The improvements involved some nifty sliding-window acknowledgement schemes. You'd need to do something similar if you intend to make tar much faster. ----------------------------- From: David Steffens Subject: read on a pipe vs. SIGCHLD Date: 10 Jan 90 21:21:05 GMT To: unix-wizards@sem.brl.mil This problem was found when porting a version of TCSH which works under 4.3bsd (uVAX II, VAX750) and SunOS4.0.3 (SUN4) to RTU4.1A on a Concurrent (nee Masscomp) SLS5450. Compilation was done in the bsd (as opposed to att) universe. The problem appeared in backquote evaluation -- echo `tty` would fail (nothing printed) about 15-20% of the time. Concurrent's own version of CSH always worked. On every other system I tested, the attached program always prints: /dev/ttyXX SIGCHLD Well, almost always. On a SUN4 about 20% of the time it will print: SIGCHLD /dev/ttyXX But the net result is always the same -- the parent reliably reads and prints the message from its child. Under RTU4.1A (bsd universe) on a Concurrent SLS5450, things are quite different. The following results are obtained in the indicated proportions based on about 1000 repetitions: 85% /dev/ttyp0 SIGCHLD 10% /dev/ttyp0 SIGCHLD backq: read error -- Interrupted system call 5% SIGCHLD backq: read error -- Interrupted system call once /dev/ttyp0 SIGCHLD backq: wait -- Interrupted system call It seems that the SIGCHLD from the child is occasionally interrupting one of the two pipe reads in the parent. If the second read is interrupted, nothing is lost because the read loop handles EOF and error similarly. But if the first read is interrupted, the loop terminates prematurely and the message is lost. Lest you think this is just an academic exercise, this code is intended to simulate 4.3bsd csh/sh.glob.c quite closely. Instrumentation installed directly in tcsh/sh.glob.c gives similar results. The RTU4.1A signal stuff appears to be a mish-mash of _three_ different implementations -- the original v7 implementation as carried over to SYSV, an early 4.1bsd (!) implementation, and a recent 4.2bsd implementation. The latter is the one I'm _supposed_ to get when in the bsd universe. The _behavior_ seems more like the old v7 implementation, however! Is it proper behavior for SIGCHLD to interrupt a pipe read? Can this occur on other flavors of UNIX, or is RTU just plain brain-damaged? Assuming no bug fix from Concurrent, there seem to be two work-arounds: 1) block SIGCHLD before entering the read loop; release after EOF. 2) On read error, retry the read if errno == EINTR (aka v7!) Which is to be preferred? Is there anything better? advTHANKSance. -------------------- /* backq.c -- simulate csh/tcsh backquote processing, DAS JAN-90 */ #include #include #include char *whoami; #ifdef masscomp void exit(); #endif #ifdef sun void #endif catch() { (void) printf("SIGCHLD\n"); } main(argc, argv) int argc; char *argv[]; { int n, pid, pfd[2]; char buf[BUFSIZ]; extern char **environ; whoami = *argv++; --argc; (void) signal(SIGCHLD, catch); if (pipe(pfd) < 0) fatalperror("can't open pipe"); if ((pid = fork()) < 0) fatalperror("can't fork"); if (pid == 0) { /* child */ (void) close(pfd[0]); if (pfd[1] != 1) { (void) close(1); (void) dup(pfd[1]); } (void) execle("/bin/tty", "tty", 0, environ); (void) execle("/usr/bin/tty", "tty", 0, environ); fatalperror("can't exec"); } /* parent */ (void) close(pfd[1]); if (pfd[0] != 0) { (void) close(0); (void) dup(pfd[0]); } do { n = read(0, buf, sizeof(buf)); if (n < 0) fatalperror("read error"); else if (n > 0) #ifdef masscomp (void) write(1, buf, (unsigned)n); #else (void) write(1, buf, n); #endif } while (n > 0); n = wait((union wait *)0); if (n < 0) fatalperror("wait"); if (n != pid) (void) printf("%s: expecting pid %d, got pid %d\n", whoami, pid, n); exit(0); /* NOTREACHED */ } /* Print system error message and die. */ fatalperror(msg) char *msg; { extern int errno; extern char *sys_errlist[]; char *syserr = sys_errlist[errno]; (void) printf("%s: %s", whoami, msg); (void) printf(" -- %s\n", syserr); exit(1); /* NOTREACHED */ } -- {harvard,mit-eddie,think}!eplunix!das David Allan Steffens 243 Charles St., Boston, MA 02114 Eaton-Peabody Laboratory (617) 573-3748 Mass. Eye & Ear Infirmary ----------------------------- From: "ihor.j.kinal" Subject: Re: AWK/shell quoting Date: 10 Jan 90 21:43:34 GMT To: unix-wizards@sem.brl.mil Why not this: awk "BEGIN { print \"'\" } " Yes, I've tried it, and it does work [and it's simpler than the other suggestions]. Ihor Kinal att!cbnewsh!ijk ----------------------------- From: Maarten Litmaath Subject: Re: AWK/shell quoting Date: 10 Jan 90 22:57:26 GMT To: unix-wizards@sem.brl.mil In article <2368@leah.Albany.Edu> emb978@leah.Albany.Edu (Eric M. Boehm) writes: \In article <6954@lindy.Stanford.EDU> karish@forel.stanford.edu (Chuck Karish) writes: \>>awk 'BEGIN { print "\'" }' \> \>Have you tried it? \... \Yes, I did try it. However, I did forget that the rules for the c shell \are not those for the Bourne shell. [...] You didn't check the abovementioned example in the Bourne shell either. -- 1755 EST, Dec 14, 1992: Henry Spencer is put on a one-way mission to the moon.| Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart ----------------------------- From: brnstnd@stealth.acf.nyu.edu Subject: Re: AWK/shell quoting Date: 11 Jan 90 03:48:28 GMT X-Shell-Quoting-Expertise: Guru To: unix-wizards@sem.brl.mil In article <7277@cbnewsh.ATT.COM> ijk@cbnewsh.ATT.COM (ihor.j.kinal) writes: > awk "BEGIN { print \"'\" } " Congratulations for testing your solution before posting it, but it only works under sh. In contrast, awk 'BEGIN { print "'\''" } ' works under sh and csh. (More complicated? Give me a break.) ---Dan ----------------------------- From: David Steffens Subject: tcsh and process groups Date: 10 Jan 90 21:47:38 GMT To: unix-wizards@sem.brl.mil Late last summer (August?) there was a discussion in this group about how csh/tcsh handles process groups. The problem as I remember was that under SunOS on a SUN4, you don't want to use vfork(). But vfork() enforces a certain processing order which is absent otherwise. So if you don't use vfork(), you end up with the following annoyance: % egrep foo bar.c | less Stopped (tty output) % The discussion seemed to revolve around how process groups are set up for pipelines. Chris Torek (I think) said that there was a race. I don't remember whether it was ever explained why this problem doesn't occur with the SunOS4.0 version of csh. At this point I lost track of the discussion -- too much work to keep up with the volume in this group! -- so I never did hear if there ever was a fix posted or suggested. Anyone know what I'm talking about? Can you fill me in? Tell me where I can get a fix? advTHANKSance -- {harvard,mit-eddie,think}!eplunix!das David Allan Steffens 243 Charles St., Boston, MA 02114 Eaton-Peabody Laboratory (617) 573-3748 Mass. Eye & Ear Infirmary ----------------------------- End of UNIX-WIZARDS Digest **************************