postmaster@[unknown] (SMTP MAILER) (04/01/89)
----Reason for mail failure follows---- Sending mail to host drum : Unrecognized host name or address. ----Transcript of message follows---- Date: 31 Mar 89 14:45:00 WET From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V7#036 To: "baynes" <baynes@drum> Return-Path: <unix-wizards-request@sem.brl.mil> Received: from SEM.BRL.MIL by nusc.arpa with SMTP ; Fri, 31 Mar 89 14:40:27 EST Received: from SEM.BRL.MIL by SEM.brl.MIL id aa08972; 31 Mar 89 2:56 EST Received: from sem.brl.mil by SEM.BRL.MIL id aa08937; 31 Mar 89 2:45 EST Date: Fri, 31 Mar 89 02:45:37 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V7#036 Message-ID: <8903310245.aa08937@SEM.BRL.MIL> UNIX-WIZARDS Digest Fri, 31 Mar 1989 V7#036 Today's Topics: Re: friendly messages Re: /etc/rmt on suns -- does it work? Having trouble, TFM doesn't help Wanted: POSIX and ANSI C, details and libraries Re^2: Using sigvec & sigcontext Re: help needed on a unix system-call question Re: Wanted: POSIX and ANSI C, details and libraries Re: micro-code upgrade (and VMS vs. Unix stats) Re: namei broken Re: Implications of large memory systems ranlib: out of memory Re: Reading raw input from /dev/tty using shell RCS Can I tell if my console output is redirected (TIOCCONS)? processor problems...or just ugliness? Re: RCS Re: namei broken Problems using ACC ACP5250 under 4.3-tahoe Re: Indent posting Re: Re^2: Using sigvec & sigcontext find: bad status-- /u/tu Re: friendly messages Re: Problems using ACC ACP5250 under 4.3-tahoe Re: modems dmf-32s Re: namei broken 386s and implied OS support GALACTIC HACKER PARTY Re: Wanted: POSIX and ANSI C, details and libraries Re: RCS Re: micro-code upgrade (and VMS vs. Unix stats) Re: namei broken Re: find: bad status-- /u/tu Re: micro-code upgrade (and VMS vs. Unix stats) Re: Indent posting Re: ranlib: out of memory Re: friendly messages Booting PWB Unix1.0 to single user Re: Re^2: Using sigvec & sigcontext Re: friendly messages Locking errors uucp killing Re: micro-code upgrade (and VMS vs. Unix stats) mk doesn't work the way I expect Re: friendly messages ----------------------------------------------------------------- From: Jim Prescott <jgp@moscom.uucp> Subject: Re: friendly messages Date: 29 Mar 89 06:23:02 GMT To: unix-wizards@sem.brl.mil In article <3314@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >Perhaps we (the usenet community) should spec a better interface: A nice quick 90% solution is a printf-like function that writes to stderr, prepends the program name to the message, and can append the system error message. Something like: if (open(fname, O_RDRW, 0) == -1) errmsg("Cannot open \"%s\" for read/write -- ", fname); would output: prog: Cannot open "somefile" for read/write -- Read-only file system This makes it fairly painless for the programmer to come up with an informative message without worrying about the little details. Trying to use perror to get a nice message is too much work, which is probably why it isn't used as often as it should be. The problems in implementing this are: - finding the program name; most likely needs to be stashed away while in main(). (It would have been nice if the ANSI-C folks had invented some globals to hold copies of main's arguments. (I know it isn't their job to invent :-).) - deciding where to put the system error. The code below tacks it on the end of the message iff it doesn't end in a newline. Not a great solution but certainly much simpler than doing a new % escape. An enhancement would be introduce error levels (we use FATAL, ERROR, INFO and DEBUG) and provide some way to specify which you want to see (we default to FATAL & ERROR). I've even enclosed a function to implement it below (about 99% of which is from an article on varargs by Chris Torek). I'm not sure how portable vsprintf is, its on our sun but wasn't in V7 so it probably isn't universal. If anyone can tell me where to get a pd vsprintf I'd be grateful. While we're on the subject, Guy mentioned TECO error messages but not how nifty they actually are. You can tell it to print just the 3 letter code (eg. ?FNF), to print the 1 line error (eg. ?FNF File not found.) or to print the 1 line message followed by a couple of likely paragraphs out of the manual (this is called "war and peace" mode). Its flexible even if not overly useful (I can't imagine using anything other than 1 line messages. Maybe the 3 letter only would be good on 110 baud ttys). ========= varargs version #include <varargs.h> int errmsg(va_alist) va_dcl /* N.B.: no semicolon */ { int ret; char *fmt; va_list ap; char buf[1024]; /* shouldn't be fixed size */ va_start(ap); fmt = va_arg(ap, char *); ret = vsprintf(buf, fmt, ap); va_end(ap); fprintf(stderr, "%s: %s", Progname, buf); if (*(buf + strlen(buf) - 1) != '\n') perror(""); return ret; } #endif ========= stdarg version #include <stdarg.h> int errmsg(char *fmt, ...) /* the `...'s are part of the syntax */ { int ret; va_list ap; char buf[1024]; /* shouldn't be fixed size */ va_start(ap, fmt); ret = vsprintf(buf, fmt, ap); va_end(ap); fprintf(stderr, "%s: %s", Progname, buf); if (*(buf + strlen(buf) - 1) != '\n') perror(""); return ret; } -- Jim Prescott moscom!jgp@cs.rochester.edu {rutgers,ames,harvard}!rochester!moscom!jgp ----------------------------- From: "David C. Cornutt" <dcornutt@uahcs1.uucp> Subject: Re: /etc/rmt on suns -- does it work? Having trouble, TFM doesn't help Date: 29 Mar 89 03:18:04 GMT To: unix-wizards@sem.brl.mil In article <3274@ttrdc.UUCP>, levy@ttrdc.UUCP (Daniel R. Levy) writes: > I have made the apparent mistake of believing the SUN manpage rmt(8C) for > /etc/rmt, the remote magtape daemon. According to the documentation, as I > read it, I should be able to start /etc/rmt and feed it commands and data, and > expect acknowledgments and data back from it. Well, that doesn't seem to work > very well (read: at ALL). I tried it locally (that shouldn't matter, should > it?) and here's what happens with a tape, write protect turned off (i.e. > writeable), in drive /dev/rst0, on a SUN4 under SunOS 4.0: > > O /dev/rst0 438 [me -- note that 438 decimal is 0666 octal] ^^^^^^^^^ ^^^ > Daniel R. Levy UNIX(R) mail: att!ttbcad!levy I went through this same exercise about a year ago. If I remember right (which I frequently don't), you have to put each of the arguments to every command on a line by itself; i.e., separate the command args with newlines instead of spaces. Sorry about not having a signature or return path. I just got back on the net after a long absence, and I haven't learned the local topology yet. David Cornutt uahcs1 ----------------------------- From: Lee McLoughlin <lmjm@doc.imperial.ac.uk> Subject: Wanted: POSIX and ANSI C, details and libraries Date: 28 Mar 89 17:30:00 GMT Sender: lmjm@doc.ic.ac.uk To: unix-wizards@sem.brl.mil I'm working on large program that I want to be as portable as possible. Although it is mainly aimed at Unix boxes I thought I'd throw caution to the wind and write it using the emerging standards: POSIX and ANSI C. The first problem is how do I get ahold of the POSIX spec' in the UK? Although I've heard a lot of discussion about POSIX and seen some libraries that a POSIX compatiable (Doug Gwyn's directory scanning code for example) I don't recall seeing the name of a book, or whatever, detailing POSIX. ANSI C is easier to get ahold of details. I just bought the 2nd edition of K&R. It seems to be a good general guide, but stddef.h, errno.h and locale.h don't seem to be documented anywhere. I'd really like pointers to official publications detailing POSIX and ANSI C. If anyone knows how to get them in the UK I'd be very grateful. While I'm asking I'd like public or freely available implementation of POSIX or ANSI C libraries so that I can port to a wider range of systems. So far I've only Doug Gwyn's directory stuff and a couple of programs for converting ANSI C to K&R C (ansi2kr an agcp). Any other contributions would be greatly appreciated. thanx in advance Lee -- Lee McLoughlin 01 589 5111 X 5028 Department of Computing,Imperial College,180 Queens Gate,London SW7 2BZ, UK Janet: lmjm@uk.ac.ic.doc Uucp: lmjm@icdoc.UUCP, ukc!icdoc!lmjm DARPA: lmjm@doc.ic.ac.uk (or lmjm%uk.ac.ic.doc@nss.cs.ucl.ac.uk) ----------------------------- From: Rene' Seindal <seindal@skinfaxe.diku.dk> Subject: Re^2: Using sigvec & sigcontext Date: 28 Mar 89 01:30:32 GMT Sender: news@freja.diku.dk To: unix-wizards@sem.brl.mil chris@mimsy.UUCP (Chris Torek) writes: > In article <4549@freja.diku.dk> seindal@skinfaxe.diku.dk (Rene' Seindal) writes: > >On 4.3BSD on Vaxen, the struct sigcontext has the same contents as a > >``jmp_buf'' (??), > Not so: > % egrep jmp_buf /usr/include/setjmp.h > typedef int jmp_buf[10]; > % egrep sc\|\{\|\} /sys/h/signal.h > struct sigvec { > }; > struct sigstack { > }; > struct sigcontext { > int sc_onstack; /* sigstack state to restore */ > int sc_mask; /* signal mask to restore */ > int sc_sp; /* sp to restore */ > int sc_fp; /* fp to restore */ > int sc_ap; /* ap to restore */ > int sc_pc; /* pc to restore */ > int sc_ps; /* psl to restore */ > }; > As you can see, sigcontext is not an array of 10 int's. I hate to argue with you. You are right too often :-) I said same contents, not same type. A close look at setjmp will reveal that is only uses the first seven longwords of the jmp_buf, for exactly the values shown above. A comment even says "# construct sigcontext"! jmp_buf is probably only declared as an array, so people don't have to take the address themselves. (I am looking in MORE/bsd sources from Mt. Xinu, marked "@(#)setjmp.s 5.5 (Berkeley) 3/9/86"). > >Even more amusing, the is an undocumented system call (no. 139) in at least > >4.3 (and 4.2) from Berkeley, Ultrix 2.0, and SunOS 3.X (and 4.0, according to > >adb. I haven't tried), which is used by longjmp(3) to restore the saved > >context. It takes a jmp_buf/struct sigcontext as the sole argument. It is a > >kind of simplified sigreturn(2). Don't look in sysent for it, since it will > >probably not be there. > 139 is (was) the `sigcleanup' syscall, used in 4.2BSD to exit from > signal handlers, and indeed undocumented. It did not take *any* > arguments; rather, it found a sigcontext structure via the user stack > pointer pushed by the `chmk' trap, an awful and bloody thing to do, > which is of course why it was fixed in 4.3BSD.... You are right about the argument passing. It does, however, look the same from user code. Code like pushl <addr of sigcontext or a jmp_buf> chmk $139 will do a longjmp (without restoring register contents, as 4.[23] longjmp does). Syscall 139 still exists in the 4.3 I use (MORE/bsd), even though it isn't listed in sysent. Look in the top of syscall(). That is an awful and bloody thing to do too. Was it left in only because of longjmp(), which is able to use sigreturn() instead (more awful and bloody code), or because other programs depended on it (even more awful and bloody)? > I have no idea how SunOS actually handles osigcleanup(). I haven't got sources to SunOS 4.0, but it look like it uses the 4.2 scheme. It has sigcleanup listed as syscall 139 in sysent, taking no arguments. The code for sigcleanup looks similar, fetching a sigcontext pointer from the user stack, followed by a copyin of the necessary parts of the sigcontext, and assignment to the saved registers in the user structure. SunOS hasn't got sigreturn either, so those parts of the kernel might be from 4.2. Rene' Seindal (seindal@diku.dk). ----------------------------- From: der Mouse <mouse@mcgill-vision.uucp> Subject: Re: help needed on a unix system-call question Date: 29 Mar 89 11:57:12 GMT Keywords: signal, system-call, read, unix v Posted: Wed Mar 29 06:57:12 1989 To: unix-wizards@sem.brl.mil In article <7553@june.cs.washington.edu>, ka@june.cs.washington.edu (Kenneth Almquist) writes: > guy@auspex.UUCP (Guy Harris) writes: >> Assuming by "is it possible to lose the partially read data" you >> mean "if the 'read' blocks, and then transfers some data and blocks >> waiting for more data, and *then* gets interrupted by a signal, is >> the data it transferred more-or-less lost", the answer is "yes, and >> [...]" [...]. > Reads on cooked tty devices block until an entire line is available > and then copy in the entire line at once. The original posting seems to have expired here. There is one common case which *looks* like "partially read" data being "lost", even though this is not really true: when the signal coming in is due to a special character (interrupt or quit, for example) being typed on the tty that's being read from. In this case, the input buffer is generally flushed, losing any partial line that's been typed. Until you realize that the partial line is being buffered in the kernel and not transferred to the user's buffer until you push return (and therefore isn't partially read at all), this looks a lot like "losing partially read data". The original question probably belonged in comp.unix.questions, but we all know nobody pays any attention to the distinction any longer :-(. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu ----------------------------- From: Joseph Boykin <boykin@calliope.encore.com> Subject: Re: Wanted: POSIX and ANSI C, details and libraries Date: 29 Mar 89 14:54:18 GMT Sender: news@encore.com Followup-To: comp.std.c To: unix-wizards@sem.brl.mil In article <746@gould.doc.ic.ac.uk> lmjm@doc.ic.ac.uk (Lee McLoughlin) writes: >The first problem is how do I get ahold of the POSIX spec' in the UK? Firstly, POSIX is actually the name for what will become a set of standards. The only one currently approved is 1003.1, the system interface definition (i.e. system calls). P1003.2 recently went through its first ballot. I haven't heard what the results were, but generally it takes about 6-9 months before all the balloting objections are taken care of and a final ballot is taken. So, while "POSIX" may not be more than one standard today, there will be more than one by the end of the year. There are numerous others in development as well. Information on obtaining a coy of the 1003.1 standard is below. If you are interested in becoming active in the POSIX effort, which can mean anything from just obtaining a copy of the draft documents to actively participating in meetings, you should contact: Jim Isaak Chair, Technical Committee on Operating Systems Subcommittee on Operating System Standards (TCOS-SS for short!) DEC, MS ZK03-3/Y25 110 Spit Brook Road Nashua, NH 03062 603-881-0480 You can obtain a copy of the 1003.1 document from either the IEEE Service Center, or from IEEE-CS Publications. The catalog for the IEEE was the top-most on my desk, so here's the information: Standard Number: 1003.1-1988 Code: SH12211 Cost: $32.00 ($16 for IEEE Members) Provide Name, Address and IEEE Membership number and send your check or credit card number to: IEEE Service Center 445 Hoes Lane PO Box 1331 Piscataway, NJ 08855 in Canada: IEEE Canada 7061 Yonge Street Thornhill, Ontario L3T 2A6 Hope this helps. ---- Joe Boykin Encore Computer Corp Vice-Chair, IEEE Computer Societies' Technical Activities Board UUCP: encore!boykin ARPA: boykin@encore.com ----------------------------- From: Roy Smith <roy@phri.uucp> Subject: Re: micro-code upgrade (and VMS vs. Unix stats) Date: 29 Mar 89 17:56:02 GMT To: unix-wizards@sem.brl.mil dodgson@cs.wmich.edu (Harry Dodgson) writes: > The DEC rep will be in this Tuesday to upgrade the microcode to > level 103. He doesn't know anything about Unix. Some number of years ago, when our 750 was fairly new, DEC came out with a "rev 7" upgrade, which was some minor change in the memory controller having to do with catching cache parity errors, or something like that (I don't remember exactly, but the details are not that important). DEC insisted on installing it on our 750 and I foolishly let them. The result was weeks (or was it months?) of agony. It never worked right and DEC insisted on putting the blame on the fact that we were running Unix. Eventually, after GOK how many board swaps, they got us a board that worked, claiming that they were special-testing boards to find ones that ran under Unix. When I say I "foolishly" let them install it, what I mean is that until they did the upgrade, we didn't have any problems; we never had the symptoms that the upgrade was supposed to cure and after the upgrade we had *lots* of problems. My advice is to ask DEC just *why* they want to install the new microcode, and don't let them unless they have a damn good reason. If your machine works as it is, what do you have to gain by changing something? heins@atanasoff.cs.iastate.edu (Leeland Heins) writes: > ** opinion on :-) ** Does any DEC rep ever say anything but "buy VMS"? :-) I saw an interesting statistic in (of all places) MacWEEK (21 March 1989, page 60). They did a (somewhat silly) survey of Macs connected to bigger machines at 269 "very large Macintosh sites". They found that of Vaxen with "connected" Macs, 54% run only Ultrix (which I take to mean Unix of various flavors), 37% run a mix of Ultrix and VMS, and only 1% run strictly VMS. They didn't mention if these were academic or commercial sites. I hope this doesn't start another VMS vs. Unix war. -- Roy Smith, System Administrator Public Health Research Institute {allegra,philabs,cmcl2,rutgers,hombre}!phri!roy -or- roy@phri.nyu.edu "The connector is the network" ----------------------------- From: Barry Shein <bzs@bu-cs.bu.edu> Subject: Re: namei broken Date: 29 Mar 89 19:04:59 GMT To: unix-wizards@sem.brl.mil > namei() doesn't work! > > It's BROKEN!! What I'm trying to understand is, if it's true, how the guy posted the message or how any of us are reading or replying to it. -- -Barry Shein, Software Tool & Die There's nothing more terrifying to hardware vendors than satisfied customers. ----------------------------- From: Unix Consultation Mailbox <consult@osiris.uucp> Subject: Re: Implications of large memory systems Date: 29 Mar 89 17:57:34 GMT To: unix-wizards@sem.brl.mil In article <13433@steinmetz.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes: > If the machine is a >workstation rather than being used for timesharing (many schools try to >put 32 users on an 8MB Sun), the total memory in use is probably 4-12MB. We have a pilot system running on a number of single-user diskless Sun 3/50s and I'll tell you exactly how much memory is in use on each of those workstations: the entire 4Mb. We had to double the size of all the server swap partitions just to keep the systems running. And even after taking the -g's and -gx's out of all the makefiles, *and* stripping all the executables, it's still Page City. >Do most users need that in a workstation? I don't, as long as I have >access to a large machine for those rare problems which can use that >much memory. I never needed more than the 4Mb in a 3/50 myself. Of course I was still doing most of my work on the Pyramids, which helps a lot. (They've all got >= 16M main memory and hundreds of Mb swap. Zippy!) phil ----------------------------- From: David Brown <david@pyr.gatech.edu> Subject: ranlib: out of memory Date: 29 Mar 89 18:45:15 GMT To: unix-wizards@sem.brl.mil Hiya. It seems that my ranlib is broken. I'm using a Sun 3/60 running SunOS4.0. I've got a directory of .o files that I want in an archive...so I: ar crv libjunk.a file1.o file2.o file3.o ... fileN.o a - file1.o a - file2.o a - file3.o ... a - fileN.o ranlib libjunk.a ranlib: ran out of memory All together, these files don't add up to 200K. Is ranlib on SunOS4.0 broken? I looked over the 'fixes' on the 4.0.1 tape, but there's nothing on ranlib. And yes, I've tried my WONDERFUL Sun software support ... I've been waiting for a return call for 6 days now. I don't have source to pick through, unfortunately. Anyone out there in netland know of a way around this? Any and all help greatly appreciated! David Brown david@pyr.gatech.edu (912) 927-5342 ps: If anyone at Sun is the least bit interested, the service order number is 284573. ----------------------------- From: Jimmy Aitken <jimmy@pyrps5> Subject: Re: Reading raw input from /dev/tty using shell Date: 29 Mar 89 19:17:17 GMT Sender: daemon@pyramid.pyramid.com To: unix-wizards@sem.brl.mil In article <52@crdgw1.crd.ge.com> barnett@crdgw1.crd.ge.com (Bruce Barnett) writes: >Does anyone know a clever method of reading raw data from /dev/tty >using a shell script and standard Unix tools? This is the method that I shell script that I use to chnage attributes of a sun window. The main program has lots of options and needs to know the current position of the window read via escape sequences. Note that you musn't type anything whilst it's trying to read the input as it would get messed up with the stuff that the sun window is "typing". This runs fine under sunOS 3.5 The code fragment goes something like: stty raw > /dev/tty echo -n "escape sequencs that causes the string to be returned" > /dev/tty ch=`dd </dev/tty count=1 2>/dev/null` stty cooked > /dev/tty This can be used e.g: echo -n "${esc}[18t" to get the size of the window >Call me a purist, but I was wondering if I could replace a 10 line C program >with a 5 line shell script? :-) Or even 4 line... ----------------------------- From: Mike McNally <m5@lynx.uucp> Subject: RCS Date: 29 Mar 89 21:01:36 GMT To: unix-wizards@sem.brl.mil When a file is checked out (with co) of an RCS directory, it seems to me that it would be nice if the modification date were set to the date of the revision. This would keep "make" happy. Because I've just started using RCS in an attempt to bring some sanity to our software, I might easily be confused. Perhaps there's a good reason that the file time should be the time of check-out, and I'm just not really in the RCS groove. Any explanations are welcome. -- Mike McNally Lynx Real-Time Systems uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go. ----------------------------- From: Dave Cohrs <dave@romano.cs.wisc.edu> Subject: Can I tell if my console output is redirected (TIOCCONS)? Date: 29 Mar 89 23:22:16 GMT Sender: news@spool.cs.wisc.edu Keywords: TIOCCONS, SunOS To: unix-wizards@sem.brl.mil I'm running SunOS 4.0.1, and I'd like to find out if my console output is redirected to a pty, and if so, take some action. How do I tell if the console output is redirected? thanks -- Dave Cohrs +1 608 262-6617 UW-Madison Computer Sciences Department dave@cs.wisc.edu ...!{harvard,rutgers,ucbvax}!uwvax!dave ----------------------------- From: Dick Dunn <rcd@ico.isc.com> Subject: processor problems...or just ugliness? Date: 27 Mar 89 20:00:48 GMT To: unix-wizards@sem.brl.mil jfh@rpp386.Dallas.TX.US (John F. Haugh II) wrote a flame about the 286. First item of note is that he directed followups to "junk". I don't get it; was he afraid that someone might try to post a substantive response? > The 80286 does have problems. Meaning what? That it's uglier than last week's roadkill? Perhaps so, but: >...I doubt that a fully functional and > robust operating system for an 80286 can ever be had... There are existence proofs to the contrary. Even the Microport system, which has some long-standing bugs, *could* be fixed...people are frustrated with the bugs in the Microport AT stuff precisely because they know they can be fixed. There is nothing that I know of in the 286 architecture which prevents one from constructing, say, a correct implementation of UNIX in which processes are completely protected from one another as they should be, and in which the kernel is protected from processes such that no process could cause a kernel panic. If anyone has any concrete, substantive reason that a 286 cannot support a correct, robust operating system, I'd like to know what it is. What I'm looking for is, for example, a way that a program in user mode can cause an exception that the kernel can't defend against. Let's even include the usual support chips for the 286 since (a) it doesn't have any useful interrupt control on-chip, and (b) the 286, as ugly as it is, is actually rather pleasant next to the cascaded pair of 8259's normally used with it. I'm not much swayed by an argument like: >...The chip is brain dead and a waste of good silicon... since it's a content-free statement, and: >...Various modes of failure > cause the program to be completely aborted, and if that program > happens to be your operating system, tough luck. amounts to nothing since the same is true of "various modes of failure" on most processors. Try things like a bad kernel stack pointer, nonexistent address for load/store, etc., and see what it does to a 680x0, a VAX, a PDP-11... > ...Others of us are disgusted with bogus hardware. > The 80286 is such an example of a total loser implemented on silicon. No, it's not a total loser. That's nonsense. It IS an unpleasant processor in many ways. I won't defend the architecture, but just because it's ugly doesn't mean it's not usable. In fact, if you get in to the real details of most processors, you'll find that there are lots of warts. A very few processors are exceptionally clean in design, like the PDP-11...but even there if you go looking at the Unibus map or the memory protection, you'll find things are more ornate than you might like. Of course, the PDP-11 is probably two orders of magnitude (?quantitative subjectivity?:-) cleaner than the 286, BUT the 286 is still usable. It works (or at least if it doesn't, nobody has posted a reason yet). The 286 has a rather baroque memory protection scheme, but at least it has one. Contrast with the 680x0, which didn't have either an internal MMU or any accepted external MMU for years. That made it impossible to produce a UNIX port "for the processor" since the port depended on box-specific memory management. If you have a chance to influence architecture, it's great to complain about all the things that make an operating system ugly or slow...but if the hardware already exists, you need to take a different tack: See if everything you need to do is *possible* (note: NOT easy or clean, just possible)...then get down to it. Let me try to keep my views in perspective: I've done OS-level work on the 286, and believe me, I complained about the architecture all along. It was often painful to do things, but it was possible and the result was usable. -- Dick Dunn UUCP: {ncar,nbires}!ico!rcd (303)449-2870 ...Never offend with style when you can offend with substance. ----------------------------- From: Chris Torek <chris@mimsy.uucp> Subject: Re: RCS Date: 30 Mar 89 00:07:55 GMT To: unix-wizards@sem.brl.mil In article <5372@lynx.UUCP> m5@lynx.uucp (Mike McNally) writes: >When a file is checked out (with co) of an RCS directory, it seems to me >that it would be nice if the modification date were set to the date of >the revision. This would keep "make" happy. Since `co' expands RCS keywords, this would be wrong. For instance: % co -l foo.c 1.1 locked % edit foo.c ... % make ... % ./test foo works % ci foo.c ... % co foo.c % make `foo' is up to date. % ident foo $Header: ... chris Locked $ % Other than the single `extra' recompilation (not always unnecessary, as above), if you keep a copy co'd all the time, this is no problem. Alternatively, you can use a variant of `make' that knows about RCS files. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris ----------------------------- From: Rahul Dhesi <dhesi@bsu-cs.uucp> Subject: Re: RCS Date: 29 Mar 89 23:26:00 GMT To: unix-wizards@sem.brl.mil In article <5372@lynx.UUCP> m5@lynx.UUCP (Mike McNally) writes: [about timestaps of files checked out with RCS]: >Perhaps there's a good reason >that the file time should be the time of check-out... ...As opposed to the revision time. Yes, there is. Suppose you check out all files and compile. Now you change your mind and check out an earlier revision of one of the source files and type "make" again. -- Rahul Dhesi UUCP: <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi ARPA: dhesi@bsu-cs.bsu.edu ----------------------------- From: Roy Smith <roy@phri.uucp> Subject: Re: namei broken Date: 30 Mar 89 02:16:40 GMT To: unix-wizards@sem.brl.mil In article <29045@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes: > What I'm trying to understand is, if it's true, how the guy posted the > [namei() doesn't work!, It's BROKEN!!] message or how any of us are > reading or replying to it. Oh come on Barry, there you go showing your narrow-minded view of the universe again :-). There *are* systems capable of posting news articles that don't have namei() in them. Maybe he used a VMS system? -- Roy Smith, System Administrator Public Health Research Institute {allegra,philabs,cmcl2,rutgers,hombre}!phri!roy -or- roy@phri.nyu.edu "The connector is the network" ----------------------------- From: Patrick Barron <pdb@sei.cmu.edu> Subject: Problems using ACC ACP5250 under 4.3-tahoe Date: 29 Mar 89 23:16:31 GMT To: unix-wizards@sem.brl.mil Has anyone successfully gotten ACC's ACP5250 driver working under 4.3-tahoe? I'm having a problem in which the kernel panics when turning the ACP5250 board on (using acpconfig); the proximate cause of the crashes is that, when the driver is trying to write to Unibus map registers (or what passes for such on a Q-bus...), the pointer it's using contains garbage, and it goes off and tries to poke at non-existent memory. This very same driver works just fine under Wisconsin 4.3BSD+NFS - did something change in the way I/O mapping is handled in the kernel? ACC *is* working on the problem, but I was just curious to know if anyone had seen it before. The sooner I can get this fixed, the better.... --Pat. ----------------------------- From: Ozan Yigit <oz@yunexus.uucp> Subject: Re: Indent posting Date: 29 Mar 89 22:33:03 GMT Keywords: indent To: unix-wizards@sem.brl.mil In article <18835@adm.BRL.MIL> gaspar@st-louis-emh2.army.mil (Al Gaspar) writes: > >... has done a great job in getting the Berkeley/Sun version >of indent into the public domain. I did not do much, except to ask/bug some people, contact its original author, and those others who worked on it, to clarify its original status, copyright issues etc. >I noticed that the -bg, -dj, -ndf, -pb, and -npb options from the older >public domain version are missing from Oz's version of indent posted >to unix-sources. What I would like to know is if there is someone >else still working on indent that plans on incorporating the older >public domain version into Oz's Berkeley/Sun version? I do not know if you can call the original version public-domain, but certainly assumed to be publicly-distributable: there is some work afoot to find ways to babysit the code, and include patches, further enhancements etc. in a coordinated manner. Some folks at BSD are planning to do major revisions, and I am sure just about every option to typeset C code will be included in due time. (tomorrow ? :-) oz -- ... and I say to them, Usenet: oz@nexus.yorku.ca `Where the hell were you ......!uunet!utai!yunexus!oz when the page was blank?' Bitnet: oz@[yulibra|yuyetti] Harlan Ellison Phonet: +1 416 736-5257x3976 ----------------------------- From: Chris Torek <chris@mimsy.uucp> Subject: Re: Re^2: Using sigvec & sigcontext Date: 30 Mar 89 04:04:29 GMT To: unix-wizards@sem.brl.mil >>In article <4549@freja.diku.dk> seindal@skinfaxe.diku.dk (Rene' Seindal) wrote: >>>On 4.3BSD on Vaxen, the struct sigcontext has the same contents as a >>>``jmp_buf'' (??), >to which I said >>Not so: In article <4557@freja.diku.dk> seindal@skinfaxe.diku.dk (Rene' Seindal) replies: >I said same contents, not same type. Ah: I misinterpreted. >[setjmp] uses [only] the first seven longwords of the jmp_buf.... Indeed it does. >jmp_buf is probably only declared as an array, so people don't have >to take the address themselves. Historically, jmp_buf has always been an array; and according to the pANS for C, it must be so. In fact the array was once used to hold r6 through r15 (in the days of 4.1BSD), and its size is a holdover. But the two are not interchangeable, aside from an accident of implementation (well, of design, in this case). It is reasonable for setjmp and longjmp to want to preserve more state than a sigcontext (register contents, for instance, on 680x0s, where the call frame does not let you restore registers by unwinding). Sticking with jmp_bufs for longjmp and sigcontexts for signals is much safer. >Syscall 139 still exists in the 4.3 I use (MORE/bsd) ... (and in 4.3tahoe) >Was it left in only because of longjmp() ... or because other >programs depended on it ... ? It was left in for backwards compatibility. 4.3BSD-tahoe will still run most 4.1BSD binaries. (Exceptions are things using the jobs library, and things using vread and/or vwrite. There may be others.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris ----------------------------- From: Bob Ames <bob@rush.howp.com> Subject: find: bad status-- /u/tu Date: 29 Mar 89 06:56:13 GMT Followups-To: unix-pc.general To: unix-wizards@sem.brl.mil Anybody seen this:? 3.51# find /u -print [...] /u/tutor /u/tutor/Filecabinet [...] /u/tutor/Filecabinet/Profiles/9600bps:A2 find: bad status-- /u/tutor/Filecabinet/practice/sample6.clf find: bad status-- /u/tutor/Filecabinet/practice/sample5.clf [...] find: bad status-- /u/tutor/Filecabinet/practice/sample1.clf /u/tutor/Wastebasket /u/tutor/Clipboard /u/tutor/.history find: bad status-- /u/hello find: bad status-- /u/dummy find: bad status-- /u/someone [...] 3.51# The bad status messages continue for the rest of the /u directory. The only command which seems to be bothered at all with the /u directory is find. I can cd, ls, od ., anything. All the files are there and intact. The only reason this error was discovered is that the Tape Backup software gave the same errors during the "Checking the file systems" phase of the "Complete Backup". I did an od -cx /u and the output looked somewhat reasonable for a directory. There's plenty of space left on the disk. I tried rebooting. It seems like permissions, but I'm root. This all started after we brought the machine back from ATT for a new power supply |-) Bob Bob Ames The National Organization for the Reform of Marijuana Laws, NORML "Pot is the world's best source of complete protein, alcohol fuel, and paper, is the best fire de-erosion seed, and is america's largest cash crop," USDA bob@rush.cts.com or ncr-sd!rush!bob@nosc.mil or rutgers!ucsd!ncr-sd!rush!bob 619-743-2546 "We each pay a fabulous price for our visions of paradise," Rush ----------------------------- From: Chris Torek <chris@mimsy.uucp> Subject: Re: friendly messages Date: 30 Mar 89 04:16:50 GMT To: unix-wizards@sem.brl.mil In article <1411@moscom.UUCP> jgp@moscom.UUCP (Jim Prescott) writes: [much deleted; these are retained in order] > ret = vsprintf(buf, fmt, ap); > fprintf(stderr, "%s: %s", Progname, buf); > perror(""); Beware, beware! His flashing eyes, his floating exception! Oops, a bit of stream of unconsciousness there. This can produce the infamous sendmail-style message: Cannot exec /bin/mail: Not a typewriter because fprintf() can call isatty() which can set errno to ENOTTY. To fix this you should either save and restore errno, or change the code to fish the error message directly out of sys_errmsg[], or use strerror() (if your C library has it). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris ----------------------------- From: Chris Torek <chris@mimsy.uucp> Subject: Re: Problems using ACC ACP5250 under 4.3-tahoe Date: 30 Mar 89 04:26:27 GMT To: unix-wizards@sem.brl.mil In article <3104@ci.sei.cmu.edu> pdb@sei.cmu.edu (Patrick Barron) writes: >Has anyone successfully gotten ACC's ACP5250 driver working under >4.3-tahoe? ... the kernel panics when turning the ACP5250 board on ... >... when the driver is trying to write to Unibus map registers ... the pointer >it's using contains garbage, and it goes off and tries to poke at >non-existent memory. Easy: Between 4.3BSD and 4.3-tahoe, Mike fixed the Unibus code so that it understands having map registers at a different location from Unibus adapter registers (if any), and to catch bugs, set the `adapter' register address to 0xc0000000. That one got caught. The map registers are now at uhp->uh_mr, rather than &uhp->uh_uba->uba_map[0]. This does not affect well-behaved vaxif drivers, as they all go through vaxif/if_uba.c. (The ACC drivers are not well-behaved.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris ----------------------------- From: "David E. Miran" <dem@uwslh.uucp> Subject: Re: modems dmf-32s Date: 29 Mar 89 21:12:31 GMT To: unix-wizards@sem.brl.mil In <400@lclark.UUCP> dan@lclark writes > > What I'm trying to do is to connect some 1200/2400 baud modems to our > VAX 750 (4.3bsd unix) to use as dial-in ports. (The modems are > 'Hayes compatible' Practical Peripherals...) followed by a description of the problems involved in trying to handle multispeed modems, especially with PC terminal emulators that cannot send a break. There is a very satisfactory solution to this possible (if you are willing to buy better modems). Get some Multitech MT224EH modems (or better yet MT696EH). These are multispeed modems which run at 2400 baud (9600 for the MT696EH). These modems have the very useful feature that their phone line speed does NOT have to match the speed to the computer. They can answer the phone at speeds of 300, 1200, 2400, 4800 ( with MNP 5 compression) (also 9600 and 19,200 for the MT696EH) while always talking to the computer at a fixed speed (like 9600). The modem then uses xon/xoff to do flow control. We have some of the MT224EH modems and really like them. We are planning to get some MT696EH modems in the near furture. We can buy them for $323 for the MT224EH and $395 for the MT696EH. Of course, this is a state contract price but you should be able to get close to these prices. These modems are the ideal solution to the speed recognition problem for us. Hope this helps. -- David E. Miran ...!{rutgers,ucbvax,harvard}!uwvax!uwslh!dem Wisconsin State Hygiene Lab or dem%uwslh.uucp@cs.wisc.edu University of Wisconsin (608) 262-0019 465 Henry Mall Madison, WI 53706 ----------------------------- From: Barry Shein <bzs@bu-cs.bu.edu> Subject: Re: namei broken Date: 30 Mar 89 13:32:29 GMT To: unix-wizards@sem.brl.mil > Oh come on Barry, there you go showing your narrow-minded view of >the universe again :-). There *are* systems capable of posting news >articles that don't have namei() in them. Maybe he used a VMS system? >-- >Roy Smith, System Administrator Tell ya what, we'll shut off all the Unix systems on the USENET and he can try posting it again... >"The connector is the network" Indeed. -- -Barry Shein, Software Tool & Die There's nothing more terrifying to hardware vendors than satisfied customers. ----------------------------- From: David Collier-Brown <daveb@geaclib.uucp> Subject: 386s and implied OS support Date: 30 Mar 89 03:01:54 GMT To: unix-wizards@sem.brl.mil From article <18250@gatech.edu>, by ken@gatech.edu (Ken Seefried iii): > I thought about that, but it is my understanding (which surely could > be wrong) that multics is based on dynamicly allocated, variable size > segments of potentially large size. Certainly, the 80286 doesn't fit > this criteria with its fixed size, 64K segments. Also, doesn't > Multics use more than 4 rings of protection? [...] > The 80386 *IS*, however, Multics-on-a-chip... > > ...ken seefried iii > ken@gatech.edu Well, its a "superset of Unix on a chip", but it falls a bit short of a good target machine for Multics. One of the big wins with Mutlicks was the integration of the file system managment with the active segment managment, which allows one to fold about three very large special cases into one (possibly overcomplex) function. This implies: a "known segment" table of large and variable size a large number of segments (ie, not four) a simple mapping from segments to pages (to cut down redundant descriptor information) This is, in my humble opinion, HARD on a 386. Not impossible, but not a shoe-in by any means. To paraphrase Henry, they shold have spent more time building implementation capabilities into the hardware, instead of building policy in... --dave (its easier to put multics on something like the GE machine with 1 accumulator and four address registers [intel segments!] than on a 386) c-b -- David Collier-Brown. | yunexus!lethe!dave Interleaf Canada Inc. | 1550 Enterprise Rd. | He's so smart he's dumb. Mississauga, Ontario | --Joyce C-B ----------------------------- From: ROP GONGGRIJP <rop@neabbs.uucp> Subject: GALACTIC HACKER PARTY Date: 29 Mar 89 05:19:45 GMT To: unix-wizards@sem.brl.mil GALACTIC HACKER PARTY 2nd, 3rd, 4th of August 1989 PARADISO, AMSTERDAM, HOLLAND During the summer of 1989 the world as we know it will go into overload. An interstellar particle stream of hackers, phone phreaks, radioactivists and assorted technological subversives will be fusing their energies into a media melt-down as the global village plugs into Amsterdam for three electrifying days of information interchange and electronic capers. Aided by the advanced communications technology to which they are accustomed, the hacker forces will discuss strategies, play games, and generally have a good time. Free access to permanently open on-line facilities will enable them to keep in touch with home base -- wherever that is. Those who rightly fear the threat of information tyranny and want to learn what they can do about it are urgently invited to interface in Amsterdam in August. There will be much to learn from people who know. Celebrity guests with something to say will be present in body or electronic spirit. The Force must be nurtured. If you are refused transport because your laptop looks like a bomb, cut off behind enemy lines, or unable to attend for any other reason, then join us on the networks. Other hacker groups are requested to organize similar gatherings to coincide with ours. We can provide low-cost international communications links during the conference. For further information, take up contact as soon as possible with: HACK-TIC PARADISO P.O. box 22953 Weteringschans 6-8 1100 DL Amsterdam 1017 SG Amsterdam The Netherlands The Netherlands tel: +31 20 6001480 tel: +31 20 264521 / +31 20 237348 fax: +31 20 763706 fax: +31 20 222721 uucp : ..!mcvax!neabbs!rop fido : 2:280/1 Hack Tic telex: 12969 neabs nl Please relay this announcement through all channels of communication that you can access. SPREAD THE BYTE, SPREAD THE BYTE, SPREAD THE BYTE, SPREAD THE BYTE -----------------Amsterdam, spring 1989--------------------------- ----------------------------- From: Nick Maclaren <nmm@computer-lab.cambridge.ac.uk> Subject: Re: Wanted: POSIX and ANSI C, details and libraries Date: 29 Mar 89 19:31:40 GMT Sender: news@cl.cam.ac.uk Posted: Wed Mar 29 20:31:40 1989 To: unix-wizards@sem.brl.mil The people to contact about both POSIX and ANSI C in this country are the BSI. There is likely to be another ISO Draft Proposal on ANSI C, with a corresponding BSI DP, and that is a good opportunity to get a copy of the current draft. POSIX I am less in touch with. I am not sure of the best address to contact in the BSI, and it is a somewhat rambling organisation (several locations in London, Milton Keynes etc.) Try chasing up via one of the London locations. WARNING: do NOT rely on the second edition of K&R. They 'jumped the gun' and predicted the future wrong; I believe that they are working on a corrected second edition. I would also suggest working from the real standard, unless K&R second edition is considerably more thorough than the first edition. Nick Maclaren University of Cambridge Computer Laboratory nmm@uk.ac.cam.cl ----------------------------- From: Mike McNally <m5@lynx.uucp> Subject: Re: RCS Date: 30 Mar 89 15:37:06 GMT To: unix-wizards@sem.brl.mil In article <16623@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >Since `co' expands RCS keywords, this would be wrong. For instance: ... In article <6389@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: >Yes, there is. Suppose you check out all files and compile. Now you >change your mind and check out an earlier revision of one of the source >files and type "make" again. OK, I see. I admit that the obvious (and nearly transparent) solution of keeping all the sources checked out (read only) is correct. In addition to these two responses, a more clued-in person here tipped me off to the scene. On the subject of RCS: I saw, in a message from some archive somewhere, mention of some sort of registration that should be carried out with the creator of the RCS system. I can't find any mention of this in the sources I have (which I think came from the usenet archive). -- Mike McNally Lynx Real-Time Systems uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go. ----------------------------- From: Karl Kleinpaste <karl@triceratops.cis.ohio-state.edu> Subject: Re: RCS Date: 30 Mar 89 18:27:43 GMT Sender: news@tut.cis.ohio-state.edu To: unix-wizards@sem.brl.mil m5@lynx.uucp (Mike McNally) writes: On the subject of RCS: I saw, in a message from some archive somewhere, mention of some sort of registration that should be carried out with the creator of the RCS system. I can't find any mention of this in the sources I have (which I think came from the usenet archive). See the file rcs/src/READ_ME in your RCS distribution tree. ----------------------------- From: Rick Ace <rta@pixar.uucp> Subject: Re: micro-code upgrade (and VMS vs. Unix stats) Date: 30 Mar 89 17:02:08 GMT To: unix-wizards@sem.brl.mil In article <3729@phri.UUCP>, roy@phri.UUCP (Roy Smith) writes: > Some number of years ago, when our 750 was fairly new, DEC came out > with a "rev 7" upgrade, which was some minor change in the memory controller > having to do with catching cache parity errors, or something like that (I > don't remember exactly, but the details are not that important). DEC > insisted on installing it on our 750 and I foolishly let them. > > The result was weeks (or was it months?) of agony. It never worked > right and DEC insisted on putting the blame on the fact that we were running > Unix. Eventually, after GOK how many board swaps, they got us a board that > worked, claiming that they were special-testing boards to find ones that ran > under Unix. When I say I "foolishly" let them install it, what I mean is > that until they did the upgrade, we didn't have any problems; we never had > the symptoms that the upgrade was supposed to cure and after the upgrade we > had *lots* of problems. > > My advice is to ask DEC just *why* they want to install the new > microcode, and don't let them unless they have a damn good reason. If your > machine works as it is, what do you have to gain by changing something? I suspect DEC will answer like this: "Because Field Service will soon refuse to support Vax-11/750 systems that are not up to Rev 7." This is true of hardware and software alike. It makes no economic sense for a vendor to support previous versions of products when the current versions are supersets of their predecessors. Now in Roy's case, the Rev 7 upgrade did not deliver a superset of what it replaced. However, it's probably true that DEC had no idea that things were going to get worse when they did the upgrade. (As an example, Field Service upgraded two 750s at NYIT to Rev 7 a few years ago, and outside of my having to figure out how to make 4.2bsd load the microcode, both upgrades went smoothly.) Roy, the best thing you could have done was to demand that DEC commit to a date (as early as you bargain for) by which they will either make Rev 7 work or return you to your previous revision level. If the local F-S manager won't buy into that, talk to his/her superior(s) until you get satisfaction. Rick Ace Pixar 3240 Kerner Blvd, San Rafael CA 94901 ...!{sun,ucbvax}!pixar!rta ----------------------------- From: "Brian V. Smith" <envbvs@epb2.lbl.gov> Subject: Re: namei broken Date: 30 Mar 89 19:07:40 GMT Sender: usenet@helios.ee.lbl.gov To: unix-wizards@sem.brl.mil I hate to sound stupid when I'm just ignorant, but what is namei()? Neither our Ultrix nor SunOs systems have a manual entry for it. _____________________________________ Brian V. Smith (bvsmith@lbl.gov) Lawrence Berkeley Laboratory We don't need no stinking signatures! ----------------------------- From: Mike Wescott <wescott@ncrcae.columbia.ncr.com> Subject: Re: find: bad status-- /u/tu Date: 30 Mar 89 16:30:34 GMT To: unix-wizards@sem.brl.mil In article <948@rush.howp.com> bob@rush.howp.com (Bob Ames) writes: > /u/tutor/Filecabinet/Profiles/9600bps:A2 > find: bad status-- /u/tutor/Filecabinet/practice/sample6.clf > /u/tutor/.history > find: bad status-- /u/hello > The bad status messages continue for the rest of the /u directory. One of the directories that find goes through right before the "bad status" messages start probably has a ".." that is not the parent that find used to get to the directory. Try this in /u and some other directories: ls -id . */.. Each time you should get the same inode number for each directory. Any mismatch causes find to take the wrong path in trying to get back to where it started from. You can use /etc/link and /etc/unlink to fix. ----------------------------- From: Rahul Dhesi <dhesi@bsu-cs.uucp> Subject: Re: micro-code upgrade (and VMS vs. Unix stats) Date: 30 Mar 89 20:17:16 GMT To: unix-wizards@sem.brl.mil In article <3623@pixar.UUCP> rta@pixar.UUCP (Rick Ace) writes: >However, it's >probably true that DEC had no idea that things were going to >get worse when they did the upgrade. Doubtful. It's a well-known and unfortunate fact of life that many changes in DEC hardware and software are done mostly to break third-party products. -- Rahul Dhesi UUCP: <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi ARPA: dhesi@bsu-cs.bsu.edu ----------------------------- From: Rich Salz <rsalz@bbn.com> Subject: Re: Indent posting Date: 30 Mar 89 19:30:50 GMT To: unix-wizards@sem.brl.mil In article <18835@adm.BRL.MIL> gaspar@st-louis-emh2.army.mil (Al Gaspar) writes: =... has done a great job in getting the Berkeley/Sun version =of indent into the public domain. In <1421@yunexus.UUCP> oz@yunexus.UUCP (Ozan Yigit) writes: =I did not do much, except to ask/bug some people, contact its original =author, and those others who worked on it, to clarify its original status, =copyright issues etc. You did a lot. This kind of nitty-gritty detail work can be a real drag, and the work who did is really appreciated! = there is some work =afoot to find ways to babysit the code Keith Bostic of UCB <bostic@okeeffe.berkeley.edu> has someone working on it, and I've had anyone who wrote patches, or who volunteered to work on the code, to contact him. When the new version is ready, it will appear in comp.sources.unix /r$ -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. ----------------------------- From: "John F. Haugh II" <jfh@rpp386.dallas.tx.us> Subject: Re: ranlib: out of memory Date: 30 Mar 89 15:25:01 GMT To: unix-wizards@sem.brl.mil In article <7758@pyr.gatech.EDU> david@pyr.gatech.edu (David Brown) writes: >I don't have source to pick through, unfortunately. Anyone out there in >netland know of a way around this? Any and all help greatly appreciated! Try tsort and lorder. -- John F. Haugh II +-Quote of the Week:------------------- VoiceNet: (214) 250-3311 Data: -6272 | "Do not drink and bake" InterNet: jfh@rpp386.Dallas.TX.US | -- Arnold Swartzenegger UucpNet : <backbone>!killer!rpp386!jfh +-------------------------------------- ----------------------------- From: Peter da Silva <peter@ficc.uu.net> Subject: Re: friendly messages Date: 30 Mar 89 15:41:16 GMT To: unix-wizards@sem.brl.mil Neither of these solutions is correct: In article <1411@moscom.UUCP>, jgp@moscom.UUCP (Jim Prescott) writes: > fprintf(stderr, "%s: %s", Progname, buf); > if (*(buf + strlen(buf) - 1) != '\n') > perror(""); If this is the first time I/O is done, on at least some machines stdio will call isatty(0) to determine if stdout should be unbuffered. It will not save and restore errno. Your program may give such useful advice as: foobar: can't open file barfoo -- Not a typewriter. or: foobar: can't open file barfoo -- Inappropriate ioctl for device. -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Business: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. Personal: ...!texbell!sugar!peter, peter@sugar.hackercorp.com. ----------------------------- From: Quentin Fennessy <quentin@umb.umb.edu> Subject: Booting PWB Unix1.0 to single user Date: 30 Mar 89 20:18:19 GMT To: unix-wizards@sem.brl.mil I previously asked: >I just found an old PDP11/44 in the back of our computer room. Until today >I thought it ran only RSX, but I found an old Unix manual with it. I have been >told that Unix is still on the disk. >I would love to boot this machine, especially with the chance of finding >source, (old, but source nonetheless) on it. >The manual calls it PWB/UNIX Edition 1.0, with dates all in 1977. Well, it has booted, but not to single user. Unfortunately all passwords are history, and all I get is login: When the machine boots, it says something like: rc 1.5 booting pwbe0604 to multi-user and then runs fsck on the system disk. It finds one file system corrupt, tells me to find the sysadmin, and tells me to press HALT. At this point everything I type is merely echoed. If I type <DEL>, I get a login prompt. I cannot get this to singleuser. If anyone can help me, I would really appreciate it. Thanks a lot for your help. Email is best, and if there is interest I will document my progress for the net. Quentin Fennessy home 617-327-0660 work 617-499-4200 harvard!hub.umb.edu!quentin harvard!hub!umb!quentin ----------------------------- From: Guy Harris <guy@auspex.uucp> Subject: Re: Re^2: Using sigvec & sigcontext Date: 30 Mar 89 23:11:07 GMT To: unix-wizards@sem.brl.mil >I said same contents, not same type. A close look at setjmp will reveal that >is only uses the first seven longwords of the jmp_buf, for exactly the values >shown above. A comment even says "# construct sigcontext"! jmp_buf is >probably only declared as an array, so people don't have to take the address >themselves. Well, it's declared as an array because it antedates "struct sigcontext", because it was done that way in good old V7, and because you're supposed to use the name of the "jmp_buf" in calls to "setjmp", which means that, since C generally supports call-by-value, the value had better be a pointer into the "jmp_buf", which means that (unless "setjmp" is a macro - which the dpANS for C says it must be - *and* inserts the "&" for you), "jmp_buf" must be an array (in fact, said dpANS says it's an array). >> 139 is (was) the `sigcleanup' syscall, used in 4.2BSD to exit from >> signal handlers, and indeed undocumented. It did not take *any* >> arguments; rather, it found a sigcontext structure via the user stack >> pointer pushed by the `chmk' trap, an awful and bloody thing to do, >> which is of course why it was fixed in 4.3BSD.... > >You are right about the argument passing. It does, however, look the same >from user code. Code like > > pushl <addr of sigcontext or a jmp_buf> > chmk $139 > >will do a longjmp (without restoring register contents, as 4.[23] >longjmp does). Which isn't quite the same as "finding the structure via the user stack pointer pushed by the 'chmk' trap"; I read that as meaning that no explicit argument is provided, and that the structure is assumed to be at a specific location on the stack. Instead, "syscall 139" *does* take an argument; it just happens to be passed a little differently. Given that neither it nor "sigreturn" are, in general, usable from machine-independent code ("sigreturn" doesn't load up all the registers, which means you need machine-dependent glue around it anyway, if you want something that amounts to a "machine-independent user-mode context switch" call), I don't see this as being particularly awful or bloody. There *was* some problem with the 4.2BSD "syscall 139"; I don't remember what it was, but as I remember it did *not* exist in the SunOS "syscall 139". >Syscall 139 still exists in the 4.3 I use (MORE/bsd), even though it isn't >listed in sysent. Look in the top of syscall(). That is an awful and bloody >thing to do too. Was it left in only because of longjmp(), which is able to >use sigreturn() instead (more awful and bloody code), or because other >programs depended on it (even more awful and bloody)? "longjmp" in 4.3 *does* use "sigreturn". I presume it was left in so that 4.2BSD binaries would continue to run. >I haven't got sources to SunOS 4.0, but it look like it uses the 4.2 scheme. >It has sigcleanup listed as syscall 139 in sysent, taking no arguments. The >code for sigcleanup looks similar, fetching a sigcontext pointer from the user >stack, followed by a copyin of the necessary parts of the sigcontext, and >assignment to the saved registers in the user structure. SunOS hasn't got >sigreturn either, so those parts of the kernel might be from 4.2. SunOS doesn't have "sigreturn" because it didn't need it; as indicated, "sigreturn" isn't a machine-independent interface to a general "context switch" function, and since making such a function out of "sigreturn" would require additional machine-language glue to load up the other registers anyway, it wasn't deemed worth adding as a "real" system call. That part of the kernel isn't from 4.2, though, except on those versions of SunOS 3.0 ported to the VAX - neither VAX nor Tahoe code works as is on the 68K, the 80386, or the SPARC.... ----------------------------- From: Guy Harris <guy@auspex.uucp> Subject: Re: friendly messages Date: 30 Mar 89 23:27:57 GMT To: unix-wizards@sem.brl.mil >A nice quick 90% solution is a printf-like function that writes to stderr, >prepends the program name to the message, and can append the system error >message. Something like: > if (open(fname, O_RDRW, 0) == -1) > errmsg("Cannot open \"%s\" for read/write -- ", fname); >would output: > prog: Cannot open "somefile" for read/write -- Read-only file system CAREful - you may want to call this function for errors that *don't* cause "errno" to be set. You might want to have some way to indicate whether it should use "errno" or not - or, perhaps, just use the (dp)ANSI C routine "strerror", which takes an "errno" as argument and returns a pointer to the appropriate error message string, and just stick "%s"es into the message string and calls to "strerror" into the argument list. (If your implementation doesn't have "strerror", it's probably a 5-minute job to whip one up, at least under UNIX.) >This makes it fairly painless for the programmer to come up with an >informative message without worrying about the little details. Trying >to use perror to get a nice message is too much work, which is probably >why it isn't used as often as it should be. Yes, but unfortunately burying the call to "perror" in "errmsg" has its own problems. Note also that there are places other than "errno" where errors are reported (by other packages, such as TLI, ONC RPC, database libraries, etc.), often with their own families of error codes and messages, so you may end up having to stick calls to the "return error message" code in *anyway* in some cases.... ----------------------------- From: "Chris A. Anderson" <caanders@sactoh0.uucp> Subject: Locking errors Date: 30 Mar 89 23:03:34 GMT Keywords: lock tables informix c-isam To: unix-wizards@sem.brl.mil I'm having a nasty problem with locking using C-ISAM (v. 1.20) on a Plexus P-95 (SysV.2 K1.7 k80 m68). Specifically, we're getting a errno=34 when a program attempts to open a file. In <sys/errno.h>, this is doubly defined: as ERANGE, and as EDEADLK. Informix thinks that EDEADLK is the most probable definition for errno=34 in this case. Lock table overflow seems to be the most likely reason to get EDEADLK... in <sys/params.h>, NFLOCK is defined as 100. We've confirmed by testing that lock table over- flow is what the problem is. How do we change NFLOCK? To relink the kernel we'd need some source from Plexus (this may be difficult :-) ). Is there any other way? If we did redefine NFLOCK, what other side-effects could we run into? Any help would be appreciated! Thanks in advance. Chris -- Chris Anderson email: ...!pacbell!sactoh0!utgard!chris QMA, Inc. or: ...!csusac!fenris -------------------------------------------------------------------- ----------------------------- From: "James C. Benz" <jcbst3@cisunx.uucp> Subject: uucp killing Date: 30 Mar 89 20:54:39 GMT To: unix-wizards@sem.brl.mil For my peace of mind, is there some way to kill all spooled jobs for a given machine queued for uucp? Let me put that a little more clearly. Suppose I have a machine foobar, and I have ten jobs queued for uucp to foobar. Foobar has just been relegated to the scrap heap, so these jobs will never get sent, or maybe I just discovered an error in the list of files that I sent to foobar. Anyway, I want to kill all jobs queued for sending to foobar. I can sit here and type "uustat -k{idnum}" ten times, which seems like an enormous waste of time (it is - I do it a lot). What I would like to do is something like "uustat -kfoobar*", which doesn't work (can't find job foobar*- not killed). I suppose I could do something like "uustat -sfoobar|shellscript" but then I have to write a shellscript and keep a copy on each machine I work on just for this. Does anyone know of a way to structure the uustat call so I can do this generically? (running ATTsysV on a 3B2) (If this seems trivial, I guess its just because I'm a little bored today :-} ) -- Jim Benz jcbst3@unix.cis.pittsburgh.edu If a modem University of Pittsburgh answers, UCIR (412) 648-5930 hang up! ----------------------------- From: Roy Smith <roy@phri.uucp> Subject: Re: micro-code upgrade (and VMS vs. Unix stats) Date: 31 Mar 89 02:50:37 GMT To: unix-wizards@sem.brl.mil In article <3623@pixar.UUCP> rta@pixar.UUCP (Rick Ace) writes: > It makes no economic sense for a vendor to support previous versions of > products when the current versions are supersets of their predecessors. > [...] Roy, the best thing you could have done was to demand that DEC > commit to a date (as early as you bargain for) by which they will either > make Rev 7 work or return you to your previous revision level. Rick is, of course, right. In the end, what happened was essentially what Rick suggested; I demanded that if they couldn't fix they they had to put it back to how it was before they started, which eventually they did (fix it, that is). For the record, once the bugs were ironed out, it did work, and has worked fine for years since. Those of you who have followed my rantings over the years know that I'm pretty cynical when it comes to DEC field service; sometimes I get carried away. As a case in point, on the AppleTalk network I try to administer, I don't let anybody plug in a Mac unless they are running the latest version of the system software (or, in the case of 6.0, the latest version that I decree to be working properly). I suppose some people get pissed at me when I demand that they upgrade their system software when what they are running now works fine for them. -- Roy Smith, System Administrator Public Health Research Institute {allegra,philabs,cmcl2,rutgers,hombre}!phri!roy -or- roy@phri.nyu.edu "The connector is the network" ----------------------------- From: Guy Middleton <gamiddleton@watmath.waterloo.edu> Subject: mk doesn't work the way I expect Date: 31 Mar 89 02:54:49 GMT To: unix-wizards@sem.brl.mil We just got mk, and I tried running this mkfile: PROGS = host addr hostaddr all:V: $PROGS $PROGS: $CC -o $target $target.c I expected this to happen: cc -o host host.c cc -o addr addr.c cc -o hostaddr hostaddr.c Instead, I got this: cc -o host addr hostaddr host addr hostaddr.c I got what I expected when the "all:V: $PROGS" line was removed. Why does it work this way? Am I missing something obvious? -Guy Middleton, University of Waterloo gamiddleton@watmath.waterloo.edu ----------------------------- From: Dave Hammond <daveh@marob.masa.com> Subject: Re: friendly messages Date: 30 Mar 89 22:54:36 GMT To: unix-wizards@sem.brl.mil In article <1411@moscom.UUCP> jgp@moscom.UUCP posts his favorite error message printer. I note that for a return value it provides the return from vsprintf. Since error message printers are typically invoked prior to a return, or exit, I opt to have my favorite error printer return -1. While this, perhaps, bastardizes the significance of the function's return value, it (more often than not) makes for convenient error handling: ... if (an_error_occurred) return(errmsg(errcode, "Can't open file %s.", fname)); Obviously this presumes that the calling function normally returns -1 as an its error condition value. Functions which don't employ a -1 error return just void the return from the error printer. -- Dave Hammond daveh@marob.masa.com ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@sandia.gov (SMTP MAILER) (03/19/90)
----Reason for mail failure follows---- Sending mail to <math!ckaul@cs.sandia.gov> : Could not be delivered for three days. ----Transcript of message follows---- Date: 15 Mar 90 07:25:00 MST From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V9#094 To: "math!ckaul" <math!ckaul@cs.sandia.gov> Return-Path: <incoming-unix-wizards-request@sandia.gov> Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Thu, 15 Mar 90 06:48:44 MST Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa06497; 15 Mar 90 5:59 EST Received: from sem.brl.mil by SEM.BRL.MIL id aa06456; 15 Mar 90 5:45 EST Date: Thu, 15 Mar 90 05:45:04 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V9#094 Message-ID: <9003150545.aa06456@SEM.BRL.MIL> UNIX-WIZARDS Digest Thu, 15 Mar 1990 V9#094 Today's Topics: System V kernel panic not syncing Re: Which is more portable: stty < or stty > Use of ssignal() in Sys V. Re: Use of ssignal() in Sys V. Setting multiple timers from a single process. Re: Setting multiple timers from a single process. serious awk bug Re: serious awk bug Re: Raw disk I/O repeatability of select() Re: repeatability of select() (correction) Re: ADDING TO TAPE ARCHIVES - AHA1540+2150s Re: Dr David G Korn to speak at SVNet Re: Large Unix, SYS5.4 on Unisys mac postscript in ditroff input? Re: Setting the access/modify time on a file ----------------------------------------------------------------- From: neal@mnopltd.uucp Subject: System V kernel panic not syncing Date: 13 Mar 90 15:03:53 GMT Posted: Tue Mar 13 10:03:53 1990 To: unix-wizards@sem.brl.mil ->Anyone know how to get the SCO UNIX System V/386 r3.2 kernel ->to do sync when it panics so fsck is happy when you start up again? -> ->I'm told that BSD can do this, and I have a use for this while ->running this OS on a 'beta' CPU which will cause a panic under ->certain circumstances. Wait a second... This doesn't make sense. Panics are frequently situations where the kernel code is not confident to continue processing. Doing a sync in this situation is like painting over rust. For any degree of system stability you need to fsck and "take your medecine"... ------------------------------------------------------------------------------ Neal Rhodes MNOP Ltd (404)- 972-5430 President Lilburn (atlanta) GA 30247 Fax: 978-4741 uunet!emory!jdyx!mnopltd!neal Or uunet!gatech!stiatl!mnopltd!neal ------------------------------------------------------------------------------ ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Which is more portable: stty < or stty > Date: 13 Mar 90 19:18:10 GMT To: unix-wizards@sem.brl.mil >Currently, 4.0.3 defaults to using the native stty. According to a >Sun rep, the next release (4.1) will default to the System V version, >although the next version (5.0) will not have any "preference" (his >word, which he could not explain). It actually sounded to me like >that have simply not yet decided. It sounds to *me* like your Sun rep is seriously confused. (If he couldn't explain his use of "preference", why was he using it? Yeesh.) As of when I left Sun, the intent was to have the BSD environment be the "default", in the sense that if the environment variable PATH isn't set, the "default" path will *not* have "/usr/5bin" before "/bin" or "/usr/bin" (BTW, in SunOS 4.x, there's no point in having "/bin" in your path at all, if you have "/usr/bin" there - "/bin" is just a symlink to "/usr/bin"). "5.0" has not necessarily been chosen as the name for Sun's System V Release 4-based release. If the rep was thinking of that release, the "stty" in "/usr/bin" or wherever will, as one would expect, have the System V behavior. I don't know if System V Release 4 from AT&T will have a "/usr/ucb/stty" that provides the BSD behavior or not; even if they don't, Sun might put one into their release. >Will POSIX provide an answer, or perhaps, provide a stty90 which has a >real interface? According to my copy of Draft 9 of 1003.2: The "stty" utility sets or reports on terminal I/O characteristics for the device that is its standard input. I don't think this is the latest draft, but I'd be surprised if they changed this in a later draft. ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Which is more portable: stty < or stty > Date: 13 Mar 90 19:22:38 GMT To: unix-wizards@sem.brl.mil >The former is the 7th Ed. UNIX and 4BSD behavior. >System V assumes you may want to redirect the output somewhere other >than the terminal being probed. You can do that with the V7 and BSD one, it's just more painful - you have to redirect the standard error. The S5 behavior is a bit more natural, in that its output goes to, well, the standard output; the only reason I can see for the V7 behavior is that it makes it possible to set the modes on a tty other than one on which you're logged in without being super-user, since traditionally ttys have been publicly writable but not publicly readable. While in some environments this would be considered a feature ("Hey, Jane, I screwed up my tty settings; could you fix them for me? I'm on '/dev/tty73'."), it would be considered a problem in others ("stty erase 's' kill 't' intr 'y' >/dev/tty73"). Given that in 4.3BSD and now S5R4 ttys are *not* publicly writeable, but writeable only by a special group, to which programs like "write" are set-GID (so that you can't send things like the "transmit screen to host" escape sequence to somebody else's terminal), the V7 behavior doesn't buy you anything any more. ----------------------------- From: "Frank I. Reiter" <frank@rsoft.bc.ca> Subject: Re: Which is more portable: stty < or stty > Date: 14 Mar 90 15:40:19 GMT To: unix-wizards@sem.brl.mil In article <3354@muffin.cme.nist.gov> libes@cme.nist.gov (Don Libes) writes: >According to the man page (SunOS 4.0.3) ... >The native SunOS stty(1) acts on the device that is the current stdout >while their System V stty acts on the device that is the current stdin. Why not both? stty </dev/x >/dev/x -- _____________________________________________________________________________ Frank I. Reiter UUCP: {uunet,ubc-cs}!van-bc!rsoft!frank Reiter Software Inc. frank@rsoft.bc.ca, a2@mindlink.UUCP Surrey, British Columbia BBS: Mind Link @ (604)576-1214, login as Guest ----------------------------- From: Johan Vromans <jv@mh.nl> Subject: Re: Which is more portable: stty < or stty > Date: 14 Mar 90 20:08:58 GMT Sender: news@mhres.mh.nl To: unix-wizards@sem.brl.mil In article <JV.90Mar13162312@squirrel.mh.nl> jv@mh.nl (Johan Vromans) writes: `[SystemV:] ` ` STTY_FLAGS=`stty -g < /dev/tty` ` sane() { stty ${STTY_FLAGS}; } ` `You can't do this from your BSD .login . To which andyb@coat.com (Andy Behrens) replies: ` STTY_OUTPUT=`stty 2>&1 >/dev/tty` ` `Of course, BSD doesn't support 'stty -g', but that's another issue. My BSD system (Ultrix) does. But I mentioned a '.login' file for Csh. Maarten "als iemand 't kan, is hij het wel" Lithmaat replies: `Indeed. But if BSD's stty(1) would have had `-g', you *could* have done: ` ` set STTY_FLAGS="`(stty -g > /dev/tty) |& cat`" Now this works. Johan -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500 ------------------------ "Arms are made for hugging" ------------------------- ----------------------------- From: Ravi Ramachandran <rr@csuna.cs.uh.edu> Subject: Use of ssignal() in Sys V. Date: 14 Mar 90 05:28:16 GMT Sender: nntppost@uhnix1.uh.edu To: unix-wizards@sem.brl.mil The man pages for ssignal & gsignal on Sys V are as succint as usual. I tried looking up a few adv. Unix books, but none of them ever mention ssignal. The way I have used it is to use ssignal to initialize the software signal, and then use gsignal to raise it. But this seems more like another version of using setjmp() or calling a procedure. Is there any use for ssignal()? Can I use it between processes (I tried it & it didn't seem to work)? I know the man pages says that the C compiler uses it. But unless there is some way a parallel thread can send a signal, it does not seem too useful. Thanx for shedding any light (I SAID BUD LITE), --ravi- ----------------------------- From: Doug Gwyn <gwyn@smoke.brl.mil> Subject: Re: Use of ssignal() in Sys V. Date: 15 Mar 90 00:24:18 GMT To: unix-wizards@sem.brl.mil In article <24199@uhnix1.uh.edu> rr@cs.uh.edu writes: >Is there any use for ssignal()? Can I use it between processes ...? While one can figure out ways to use ssignal/gsignal, they are not essential. Certainly they cannot be used for IPC, only within one process. I suggest never using them. ----------------------------- From: Ravi Ramachandran <rr@csuna.cs.uh.edu> Subject: Setting multiple timers from a single process. Date: 14 Mar 90 05:41:31 GMT Sender: nntppost@uhnix1.uh.edu To: unix-wizards@sem.brl.mil The subj line says it; I want to set multiple timers from a single process. Using alarm() & catching SIGALARM will permit only a single timer. I need to set different values for the different timers concurrently, and need the ability to restart them or to cancel them. My solution at the moment; each time I need a timer (a max of 4 will be needed concurrently), I spawn a child and store the pid returned to uniquely identify thst timer. The child does a sleep(time) for the required time. After which SIGCLD goes off. In my interrupt routine of my main process, I track down which child expired and determine which timer expired. Dirty, and difficult to manage, but still workable. As they said when tearing down the Berlin Wall, "Open to better suggestions." --ravi- ----------------------------- From: Don Libes <libes@cme.nist.gov> Subject: Re: Setting multiple timers from a single process. Date: 14 Mar 90 20:43:36 GMT To: unix-wizards@sem.brl.mil In article <24200@uhnix1.uh.edu> rr@cs.uh.edu writes: >The subj line says it; I want to set multiple timers from a single >process. Using alarm() & catching SIGALARM will permit only a single >timer. I need to set different values for the different timers > >My solution at the moment; [spawn child processes for each timer] Simulate them by waiting for the shortest one, and keeping track of the others yourself. I've done exactly this. Anyone who wants code (4.2BSD) can mail me. Just watch out for things like 1) a timer interrupting your timer management code, 2) trying to cancel one this is in the process of going off (or will be by the time you return), 3) getting a new timer which is shorter than the current one you are waiting for, and 4) the possibility of several being scheduled for the same time. Don Libes libes@cme.nist.gov ...!uunet!cme-durer!libes ----------------------------- From: Tom Stockfisch <tps@chem.ucsd.edu> Subject: serious awk bug Keywords: awk Date: 14 Mar 90 06:02:46 GMT To: unix-wizards@sem.brl.mil The following awk script doesn't behave properly: #! /bin/sh awk '/^a*[^b]/ { print "1:", $0 } /^a*b/ { print "2:", $0 } ' When given the following input b ab It produces the following output 2: b 1: ab 2: ab Basically, the line "ab" should match only rule 2, but it matches both rules. The following script: #! /bin/sh awk '/^a*[^b]c/ { print "1:", $0 } /^a*bc/ { print "2:", $0 } ' works, producing the output 2: bc 2: abc The corresponding lex program works fine. I have run the awk script with both the new awk and old awk, on both a system V machine (silicon graphics iris) and a 4BSD machine (celerity) and all seem to fail. -- || Tom Stockfisch, UCSD Chemistry tps@chem.ucsd.edu ----------------------------- From: Mike McNally <m5@lynx.uucp> Subject: Re: serious awk bug Keywords: awk Date: 14 Mar 90 15:25:00 GMT To: unix-wizards@sem.brl.mil tps@chem.ucsd.edu (Tom Stockfisch) writes: >The following awk script doesn't behave properly: >#! /bin/sh >awk '/^a*[^b]/ { print "1:", $0 } >/^a*b/ { print "2:", $0 } >' >When given the following input >b >ab >It produces the following output >2: b >1: ab >2: ab >Basically, the line "ab" should match only rule 2 . . . I disagree: a*[^b] => <null>[^b] => <null>a The a* is matching the empty string, and the [^b] is matching the a. -- Mike McNally Lynx Real-Time Systems uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go. ----------------------------- From: Randal Schwartz <merlyn@iwarp.intel.com> Subject: Re: serious awk bug Keywords: awk Date: 14 Mar 90 17:12:58 GMT Sender: news@iwarp.intel.com Followup-To: poster To: unix-wizards@sem.brl.mil In article <702@chem.ucsd.EDU>, tps@chem (Tom Stockfisch) writes: | | The following awk script doesn't behave properly: | | #! /bin/sh | | awk '/^a*[^b]/ { print "1:", $0 } | /^a*b/ { print "2:", $0 } | ' | | When given the following input | | b | ab | | It produces the following output | | 2: b | 1: ab | 2: ab | | Basically, the line "ab" should match only rule 2, but it matches both | rules. [This doesn't belong in WIZARDS. Sorry.] But, it *does* match rule 1! Look carefully. If you take zero 'a's, and one 'not b', you can get line "ab"! In Perl: perl -ne 'print "1: $_" if /^a*[^b]/; print "2: $_" if /^a*b/;' <<EOF b ab EOF produces: 2: b 1: ab 2: ab Just like awk. Amazing. No problem. Just another Perl and awk hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: Craig Leres <leres@ace.ee.lbl.gov> Subject: Re: Raw disk I/O Date: 14 Mar 90 06:58:26 GMT Sender: usenet@helios.ee.lbl.gov Followup-To: comp.unix.wizards X-Local-Date: 13 Mar 90 22:58:26 PST To: unix-wizards@sem.brl.mil (Sorry to jump into this so late but it seems like I never have time to read news.) Folks interested in raw disk I/O will also be interested in the little disk bench mark package we've thrown together. Eventually, I'd like to it to include a complete tutorial on How To Tune Your Filesystem; for now the (limited) documentation really only deals with how to measure raw disk speeds. The package is easy to use; the primary part is the "disktest" script which does raw reads at block sizes ranging from 4k to 128k. There's a simple line fitting program that allows you to munch "disktest" runs down to the throughput (in KB/sec) and fixed overhead (in ms) numbers. For example, I've measured 2094.07 KB/sec, 1.49 ms on my Sun 3/180 which runs SunOS 3.5 and has Fujitsu M2344's on an Interphase 4400 controller. There are also some scripts for use with xgraph. The disktest package is available via anonymous ftp from the host ftp.ee.lbl.gov (128.3.254.68) in the file disktest.shar.Z. As usual, use binary mode for best results. Craig ----------------------------- From: Jonathan Hue <hue@netcom.uucp> Subject: repeatability of select() Date: 14 Mar 90 08:27:37 GMT To: unix-wizards@sem.brl.mil Under what conditions would the following code fragments not be equivalent? case #1: n = select(nfds, rdset, wrset, exset, timeout_p); case #2: select(nfds, rdset, wrset, exset, timeout_p); /* reset rdset, wrset, and exset to their original values */ ... n = select(nfds, rdset, wrset, exset, (struct timeval *) 0); I'm interested in the behavior on any version of UNIX. Assume for the moment that select() isn't getting interrupted by a signal or anything like that. One case I can think of is HP-UX and a graphics display. You can detect vertical retrace interrupts or blitter interrupts by setting the bit corresponding to an open frame buffer in the exception mask. If you called it again without reenabling the interrupt you wouldn't see the second one. Are there any other cases like this? -Jonathan ----------------------------- From: Jonathan Hue <hue@netcom.uucp> Subject: Re: repeatability of select() (correction) Date: 14 Mar 90 17:57:59 GMT To: unix-wizards@sem.brl.mil In article <9156@netcom.UUCP> hue@netcom.UUCP (Jonathan Hue) writes: >case #2: > select(nfds, rdset, wrset, exset, timeout_p); > /* reset rdset, wrset, and exset to their original values */ > ... > n = select(nfds, rdset, wrset, exset, (struct timeval *) 0); I screwed up, instead of that last line there it should have been something like: zero.tv_sec = 0; zero.tv_usec = 0; n = select(nfds, rdset, wrset, exset, &zero); -Jonathan ----------------------------- From: Steve Watt <steve@wattres.uucp> Subject: Re: ADDING TO TAPE ARCHIVES - AHA1540+2150s Date: 14 Mar 90 09:30:21 GMT To: unix-wizards@sem.brl.mil In article <262@netdev.Comsys.COM> root@netdev.Comsys.COM (Alex Huppenthal) writes: < How can I add to the end of tar archives ? tar cv, tar cv works, but < tape rewind, tape rfm, tar cv - does not! < < 1. Change the /etc/default/tar file to archive=/dev/nrct0 < 2. Change the /etc/default/tape file to /dev/nrct0 < 3. tar cv file1 < 4. tar cv file2 < 5. tape rewind < 6. tape rfm - moves you to the end of file one < 7. tape rfm - moves you to the end of file two < 8. tape rfm - this is not a failure, it's a *feature* :-) Actually, this moves you beyond the end of the file mark, because the previous tape rfm leaves it at the file mark. < 9. tar cv file3 < 10. tape rewind < 11. tape rfm < 12. tape rfm < 13. tape rfm - now you are positioned at the end of the second file. < 14. tar tvf ( or xvf ) /dev/rct0 ( can you beleive this? I can't ) < 15. THIS WORKS..... ^^^^--- notice *rct0* not nrct0, - ask SCO why! It doesn't matter which you choose, unless you want to add another file after this one. The nrct driver means "don't rewind _ON_CLOSE_". Only use the rct driver if you want the tape rewound after each close. [minor (probably unwarranted; most are) flame against SCO removed] You could, of course use "tar rv files files files", and get them added on to the end of the current archive, so you didn't have to run tar 3 times to get all the data off of the tape. -- Steve Watt ...!claris!wattres!steve wattres!steve@claris.com also works If you torture your data long enough, it'll eventually confess. ----------------------------- From: "Dr A. N. Walker" <anw@maths.nott.ac.uk> Subject: Re: Dr David G Korn to speak at SVNet Date: 14 Mar 90 17:03:47 GMT To: unix-wizards@sem.brl.mil In article <1990Mar11.160403.27949@sobeco.com> roe@sobeco.com (r.peterson) writes: >And even more to do with the fact that Bourne used the preprocessor >to turn C into a bizarre pascal-lookalike. Truly the most difficult >code I've ever tried to modify. Actually, he used it to turn an Algol lookalike [not very!] into C. Some of us old-timers found it quite readable. I've seen much worse code over the years. -- Andy Walker, Maths Dept., Nott'm Univ., UK. anw@maths.nott.ac.uk ----------------------------- From: Doug Gwyn <gwyn@smoke.brl.mil> Subject: Re: Large Unix, SYS5.4 on Unisys Date: 15 Mar 90 00:34:20 GMT To: unix-wizards@sem.brl.mil In article <22750@adm.BRL.MIL> archunix@stl-08sima.army.mil (Bernie J. Potter) writes: >In addition, I have been asked to locate alternate sources >(besides Unisys) for a System V Release 4 based operating >system for a Unisys 5000/80 machine. We are unable to >upgrade to Release 4 under our current Unisys contract >and would like to find another source for doing so. By far your best source for an operating system would be the vendor, even if it means writing a separate procurement action (which you would have to do anyway no matter what the source of the off-contract software). Since UNIX System V Release 4.0 has just been released, it may have not yet been ported to your hardware even if the vendor plans to do so. If Unisys tells you definitely that they have no plans to upgrade their current OS to SVR4.0 (quite apart from considerations of the DA MINIS contract), then try contacting Arete who as I recall actually developed the system you are now using (resold by Unisys). I'm not sure that Arete is still in business under the same name, however; this industry changes its infrastructure too frequently for me to keep up with such details. ----------------------------- From: Ed Arnold <era@ncar.ucar.edu> Subject: mac postscript in ditroff input? Date: 14 Mar 90 22:46:33 GMT Sender: news@ncar.ucar.edu To: unix-wizards@sem.brl.mil I'm interested in corresponding with anyone who has succeeded in merging postscript generated by Mac applications such as MacDraw or Illustrator, into ditroff input, to get merged ditroff text & Apple postscript graphics on the same page. I've tried this using: TranScript 2.1 (psdit) LaserPrep 5.2 SunOS 4.0.3 Apple LaserWriter Plus (sort of works) Imagen 2308 with ultrascript and Apple dictionary dictv52.ps (doesn't work; quits with error message) I followed the suggestions given on the psdit man page to merge in the postscript, and various permutations thereof, but ditroff text is either lost, or appears on the next page, when printing to the LaserWriter. Adobe doesn't seem to know whether this is possible; but they won't talk with me anyway, since I'm not an Adobe developer. I'm not particularly eager to learn the entire Apple dictionary. :-( -- Ed Arnold * NCAR * POB 3000, Boulder, CO 80307-3000 * 303-497-1253(w) era@ncar.ucar.edu [128.117.64.4] * era@ncario.bitnet * era@ncar.uucp "See, the human mind is kind of like ... a pinata. When it breaks open, there's a lot of surprises inside." --Jane Wagner/Lily Tomlin ----------------------------- From: Mike Thompson <yohn@tumult.sgi.com> Subject: Re: Setting the access/modify time on a file Date: 14 Mar 90 23:00:46 GMT Sender: yohn@tumult.sgi.com To: unix-wizards@sem.brl.mil In article <1413@watserv1.waterloo.edu>, tom@mims-iris.waterloo.edu (Tom Haapanen) writes: > I wish to update a file (with an advisory lock), and then to close it, > setting the access and modify times to (almost) the same time. Here > is what I'm attempting: > > FILE *fp; > long times; > > fp = fopen("filename", "w"); > flock(fileno(fp), LOCK_EX); > > ... much i/o to the file ... > > fflush(fp); > times[1] = time(×[0]) - (long)2; > utime(mailfile, times); > > flock(fileno(fp), LOCK_UN); > fclose(fp); > > Now, at what point does the modify time get set? the utime() call appears > to set the access time, but the modify time appears to be set AGAIN after > the access time. Where SHOULD it get set? And what should I do to make > sure that my access time > modify time? > > The OS is IRIX 3.2 -- aka System V.3. Thanks for any and all replies! This is a bug in 3.2 -- the Extent File System routine which is deallocating preallocated file blocks on close is (mistakenly) forcing the modify time to be set (to the close time). It has been fixed for the upcoming release. For now, reopen the file after the fclose, and *then* call utime and reclose the file. The deallocation routine will not be called (actually, will return without doing anything) since there had been no file activity since the open. Michael Thompson ----------------------------- End of UNIX-WIZARDS Digest **************************
markw@hpdmd48.HP.COM (Mark Wolfe) (03/24/90)
/ hpdmd48:comp.unix.wizards / postmaster@sandia.gov (SMTP MAILER) / 2:52 pm Mar 18, 1990 / ----Reason for mail failure follows---- Sending mail to <math!ckaul@cs.sandia.gov> : Could not be delivered for three days. ----Transcript of message follows---- Date: 15 Mar 90 07:25:00 MST From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V9#094 To: "math!ckaul" <math!ckaul@cs.sandia.gov> Return-Path: <incoming-unix-wizards-request@sandia.gov> Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Thu, 15 Mar 90 06:48:44 MST Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa06497; 15 Mar 90 5:59 EST Received: from sem.brl.mil by SEM.BRL.MIL id aa06456; 15 Mar 90 5:45 EST Date: Thu, 15 Mar 90 05:45:04 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V9#094 Message-ID: <9003150545.aa06456@SEM.BRL.MIL> UNIX-WIZARDS Digest Thu, 15 Mar 1990 V9#094 Today's Topics: System V kernel panic not syncing Re: Which is more portable: stty < or stty > Use of ssignal() in Sys V. Re: Use of ssignal() in Sys V. Setting multiple timers from a single process. Re: Setting multiple timers from a single process. serious awk bug Re: serious awk bug Re: Raw disk I/O repeatability of select() Re: repeatability of select() (correction) Re: ADDING TO TAPE ARCHIVES - AHA1540+2150s Re: Dr David G Korn to speak at SVNet Re: Large Unix, SYS5.4 on Unisys mac postscript in ditroff input? Re: Setting the access/modify time on a file ----------------------------------------------------------------- From: neal@mnopltd.uucp Subject: System V kernel panic not syncing Date: 13 Mar 90 15:03:53 GMT Posted: Tue Mar 13 10:03:53 1990 To: unix-wizards@sem.brl.mil ->Anyone know how to get the SCO UNIX System V/386 r3.2 kernel ->to do sync when it panics so fsck is happy when you start up again? -> ->I'm told that BSD can do this, and I have a use for this while ->running this OS on a 'beta' CPU which will cause a panic under ->certain circumstances. Wait a second... This doesn't make sense. Panics are frequently situations where the kernel code is not confident to continue processing. Doing a sync in this situation is like painting over rust. For any degree of system stability you need to fsck and "take your medecine"... ------------------------------------------------------------------------------ Neal Rhodes MNOP Ltd (404)- 972-5430 President Lilburn (atlanta) GA 30247 Fax: 978-4741 uunet!emory!jdyx!mnopltd!neal Or uunet!gatech!stiatl!mnopltd!neal ------------------------------------------------------------------------------ ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Which is more portable: stty < or stty > Date: 13 Mar 90 19:18:10 GMT To: unix-wizards@sem.brl.mil >Currently, 4.0.3 defaults to using the native stty. According to a >Sun rep, the next release (4.1) will default to the System V version, >although the next version (5.0) will not have any "preference" (his >word, which he could not explain). It actually sounded to me like >that have simply not yet decided. It sounds to *me* like your Sun rep is seriously confused. (If he couldn't explain his use of "preference", why was he using it? Yeesh.) As of when I left Sun, the intent was to have the BSD environment be the "default", in the sense that if the environment variable PATH isn't set, the "default" path will *not* have "/usr/5bin" before "/bin" or "/usr/bin" (BTW, in SunOS 4.x, there's no point in having "/bin" in your path at all, if you have "/usr/bin" there - "/bin" is just a symlink to "/usr/bin"). "5.0" has not necessarily been chosen as the name for Sun's System V Release 4-based release. If the rep was thinking of that release, the "stty" in "/usr/bin" or wherever will, as one would expect, have the System V behavior. I don't know if System V Release 4 from AT&T will have a "/usr/ucb/stty" that provides the BSD behavior or not; even if they don't, Sun might put one into their release. >Will POSIX provide an answer, or perhaps, provide a stty90 which has a >real interface? According to my copy of Draft 9 of 1003.2: The "stty" utility sets or reports on terminal I/O characteristics for the device that is its standard input. I don't think this is the latest draft, but I'd be surprised if they changed this in a later draft. ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Which is more portable: stty < or stty > Date: 13 Mar 90 19:22:38 GMT To: unix-wizards@sem.brl.mil >The former is the 7th Ed. UNIX and 4BSD behavior. >System V assumes you may want to redirect the output somewhere other >than the terminal being probed. You can do that with the V7 and BSD one, it's just more painful - you have to redirect the standard error. The S5 behavior is a bit more natural, in that its output goes to, well, the standard output; the only reason I can see for the V7 behavior is that it makes it possible to set the modes on a tty other than one on which you're logged in without being super-user, since traditionally ttys have been publicly writable but not publicly readable. While in some environments this would be considered a feature ("Hey, Jane, I screwed up my tty settings; could you fix them for me? I'm on '/dev/tty73'."), it would be considered a problem in others ("stty erase 's' kill 't' intr 'y' >/dev/tty73"). Given that in 4.3BSD and now S5R4 ttys are *not* publicly writeable, but writeable only by a special group, to which programs like "write" are set-GID (so that you can't send things like the "transmit screen to host" escape sequence to somebody else's terminal), the V7 behavior doesn't buy you anything any more. ----------------------------- From: "Frank I. Reiter" <frank@rsoft.bc.ca> Subject: Re: Which is more portable: stty < or stty > Date: 14 Mar 90 15:40:19 GMT To: unix-wizards@sem.brl.mil In article <3354@muffin.cme.nist.gov> libes@cme.nist.gov (Don Libes) writes: >According to the man page (SunOS 4.0.3) ... >The native SunOS stty(1) acts on the device that is the current stdout >while their System V stty acts on the device that is the current stdin. Why not both? stty </dev/x >/dev/x -- _____________________________________________________________________________ Frank I. Reiter UUCP: {uunet,ubc-cs}!van-bc!rsoft!frank Reiter Software Inc. frank@rsoft.bc.ca, a2@mindlink.UUCP Surrey, British Columbia BBS: Mind Link @ (604)576-1214, login as Guest ----------------------------- From: Johan Vromans <jv@mh.nl> Subject: Re: Which is more portable: stty < or stty > Date: 14 Mar 90 20:08:58 GMT Sender: news@mhres.mh.nl To: unix-wizards@sem.brl.mil In article <JV.90Mar13162312@squirrel.mh.nl> jv@mh.nl (Johan Vromans) writes: `[SystemV:] ` ` STTY_FLAGS=`stty -g < /dev/tty` ` sane() { stty ${STTY_FLAGS}; } ` `You can't do this from your BSD .login . To which andyb@coat.com (Andy Behrens) replies: ` STTY_OUTPUT=`stty 2>&1 >/dev/tty` ` `Of course, BSD doesn't support 'stty -g', but that's another issue. My BSD system (Ultrix) does. But I mentioned a '.login' file for Csh. Maarten "als iemand 't kan, is hij het wel" Lithmaat replies: `Indeed. But if BSD's stty(1) would have had `-g', you *could* have done: ` ` set STTY_FLAGS="`(stty -g > /dev/tty) |& cat`" Now this works. Johan -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500 ------------------------ "Arms are made for hugging" ------------------------- ----------------------------- From: Ravi Ramachandran <rr@csuna.cs.uh.edu> Subject: Use of ssignal() in Sys V. Date: 14 Mar 90 05:28:16 GMT Sender: nntppost@uhnix1.uh.edu To: unix-wizards@sem.brl.mil The man pages for ssignal & gsignal on Sys V are as succint as usual. I tried looking up a few adv. Unix books, but none of them ever mention ssignal. The way I have used it is to use ssignal to initialize the software signal, and then use gsignal to raise it. But this seems more like another version of using setjmp() or calling a procedure. Is there any use for ssignal()? Can I use it between processes (I tried it & it didn't seem to work)? I know the man pages says that the C compiler uses it. But unless there is some way a parallel thread can send a signal, it does not seem too useful. Thanx for shedding any light (I SAID BUD LITE), --ravi- ----------------------------- From: Doug Gwyn <gwyn@smoke.brl.mil> Subject: Re: Use of ssignal() in Sys V. Date: 15 Mar 90 00:24:18 GMT To: unix-wizards@sem.brl.mil In article <24199@uhnix1.uh.edu> rr@cs.uh.edu writes: >Is there any use for ssignal()? Can I use it between processes ...? While one can figure out ways to use ssignal/gsignal, they are not essential. Certainly they cannot be used for IPC, only within one process. I suggest never using them. ----------------------------- From: Ravi Ramachandran <rr@csuna.cs.uh.edu> Subject: Setting multiple timers from a single process. Date: 14 Mar 90 05:41:31 GMT Sender: nntppost@uhnix1.uh.edu To: unix-wizards@sem.brl.mil The subj line says it; I want to set multiple timers from a single process. Using alarm() & catching SIGALARM will permit only a single timer. I need to set different values for the different timers concurrently, and need the ability to restart them or to cancel them. My solution at the moment; each time I need a timer (a max of 4 will be needed concurrently), I spawn a child and store the pid returned to uniquely identify thst timer. The child does a sleep(time) for the required time. After which SIGCLD goes off. In my interrupt routine of my main process, I track down which child expired and determine which timer expired. Dirty, and difficult to manage, but still workable. As they said when tearing down the Berlin Wall, "Open to better suggestions." --ravi- ----------------------------- From: Don Libes <libes@cme.nist.gov> Subject: Re: Setting multiple timers from a single process. Date: 14 Mar 90 20:43:36 GMT To: unix-wizards@sem.brl.mil In article <24200@uhnix1.uh.edu> rr@cs.uh.edu writes: >The subj line says it; I want to set multiple timers from a single >process. Using alarm() & catching SIGALARM will permit only a single >timer. I need to set different values for the different timers > >My solution at the moment; [spawn child processes for each timer] Simulate them by waiting for the shortest one, and keeping track of the others yourself. I've done exactly this. Anyone who wants code (4.2BSD) can mail me. Just watch out for things like 1) a timer interrupting your timer management code, 2) trying to cancel one this is in the process of going off (or will be by the time you return), 3) getting a new timer which is shorter than the current one you are waiting for, and 4) the possibility of several being scheduled for the same time. Don Libes libes@cme.nist.gov ...!uunet!cme-durer!libes ----------------------------- From: Tom Stockfisch <tps@chem.ucsd.edu> Subject: serious awk bug Keywords: awk Date: 14 Mar 90 06:02:46 GMT To: unix-wizards@sem.brl.mil The following awk script doesn't behave properly: #! /bin/sh awk '/^a*[^b]/ { print "1:", $0 } /^a*b/ { print "2:", $0 } ' When given the following input b ab It produces the following output 2: b 1: ab 2: ab Basically, the line "ab" should match only rule 2, but it matches both rules. The following script: #! /bin/sh awk '/^a*[^b]c/ { print "1:", $0 } /^a*bc/ { print "2:", $0 } ' works, producing the output 2: bc 2: abc The corresponding lex program works fine. I have run the awk script with both the new awk and old awk, on both a system V machine (silicon graphics iris) and a 4BSD machine (celerity) and all seem to fail. -- || Tom Stockfisch, UCSD Chemistry tps@chem.ucsd.edu ----------------------------- From: Mike McNally <m5@lynx.uucp> Subject: Re: serious awk bug Keywords: awk Date: 14 Mar 90 15:25:00 GMT To: unix-wizards@sem.brl.mil tps@chem.ucsd.edu (Tom Stockfisch) writes: >The following awk script doesn't behave properly: >#! /bin/sh >awk '/^a*[^b]/ { print "1:", $0 } >/^a*b/ { print "2:", $0 } >' >When given the following input >b >ab >It produces the following output >2: b >1: ab >2: ab >Basically, the line "ab" should match only rule 2 . . . I disagree: a*[^b] => <null>[^b] => <null>a The a* is matching the empty string, and the [^b] is matching the a. -- Mike McNally Lynx Real-Time Systems uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go. ----------------------------- From: Randal Schwartz <merlyn@iwarp.intel.com> Subject: Re: serious awk bug Keywords: awk Date: 14 Mar 90 17:12:58 GMT Sender: news@iwarp.intel.com Followup-To: poster To: unix-wizards@sem.brl.mil In article <702@chem.ucsd.EDU>, tps@chem (Tom Stockfisch) writes: | | The following awk script doesn't behave properly: | | #! /bin/sh | | awk '/^a*[^b]/ { print "1:", $0 } | /^a*b/ { print "2:", $0 } | ' | | When given the following input | | b | ab | | It produces the following output | | 2: b | 1: ab | 2: ab | | Basically, the line "ab" should match only rule 2, but it matches both | rules. [This doesn't belong in WIZARDS. Sorry.] But, it *does* match rule 1! Look carefully. If you take zero 'a's, and one 'not b', you can get line "ab"! In Perl: perl -ne 'print "1: $_" if /^a*[^b]/; print "2: $_" if /^a*b/;' <<EOF b ab EOF produces: 2: b 1: ab 2: ab Just like awk. Amazing. No problem. Just another Perl and awk hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: Craig Leres <leres@ace.ee.lbl.gov> Subject: Re: Raw disk I/O Date: 14 Mar 90 06:58:26 GMT Sender: usenet@helios.ee.lbl.gov Followup-To: comp.unix.wizards X-Local-Date: 13 Mar 90 22:58:26 PST To: unix-wizards@sem.brl.mil (Sorry to jump into this so late but it seems like I never have time to read news.) Folks interested in raw disk I/O will also be interested in the little disk bench mark package we've thrown together. Eventually, I'd like to it to include a complete tutorial on How To Tune Your Filesystem; for now the (limited) documentation really only deals with how to measure raw disk speeds. The package is easy to use; the primary part is the "disktest" script which does raw reads at block sizes ranging from 4k to 128k. There's a simple line fitting program that allows you to munch "disktest" runs down to the throughput (in KB/sec) and fixed overhead (in ms) numbers. For example, I've measured 2094.07 KB/sec, 1.49 ms on my Sun 3/180 which runs SunOS 3.5 and has Fujitsu M2344's on an Interphase 4400 controller. There are also some scripts for use with xgraph. The disktest package is available via anonymous ftp from the host ftp.ee.lbl.gov (128.3.254.68) in the file disktest.shar.Z. As usual, use binary mode for best results. Craig ----------------------------- From: Jonathan Hue <hue@netcom.uucp> Subject: repeatability of select() Date: 14 Mar 90 08:27:37 GMT To: unix-wizards@sem.brl.mil Under what conditions would the following code fragments not be equivalent? case #1: n = select(nfds, rdset, wrset, exset, timeout_p); case #2: select(nfds, rdset, wrset, exset, timeout_p); /* reset rdset, wrset, and exset to their original values */ ... n = select(nfds, rdset, wrset, exset, (struct timeval *) 0); I'm interested in the behavior on any version of UNIX. Assume for the moment that select() isn't getting interrupted by a signal or anything like that. One case I can think of is HP-UX and a graphics display. You can detect vertical retrace interrupts or blitter interrupts by setting the bit corresponding to an open frame buffer in the exception mask. If you called it again without reenabling the interrupt you wouldn't see the second one. Are there any other cases like this? -Jonathan ----------------------------- From: Jonathan Hue <hue@netcom.uucp> Subject: Re: repeatability of select() (correction) Date: 14 Mar 90 17:57:59 GMT To: unix-wizards@sem.brl.mil In article <9156@netcom.UUCP> hue@netcom.UUCP (Jonathan Hue) writes: >case #2: > select(nfds, rdset, wrset, exset, timeout_p); > /* reset rdset, wrset, and exset to their original values */ > ... > n = select(nfds, rdset, wrset, exset, (struct timeval *) 0); I screwed up, instead of that last line there it should have been something like: zero.tv_sec = 0; zero.tv_usec = 0; n = select(nfds, rdset, wrset, exset, &zero); -Jonathan ----------------------------- From: Steve Watt <steve@wattres.uucp> Subject: Re: ADDING TO TAPE ARCHIVES - AHA1540+2150s Date: 14 Mar 90 09:30:21 GMT To: unix-wizards@sem.brl.mil In article <262@netdev.Comsys.COM> root@netdev.Comsys.COM (Alex Huppenthal) writes: < How can I add to the end of tar archives ? tar cv, tar cv works, but < tape rewind, tape rfm, tar cv - does not! < < 1. Change the /etc/default/tar file to archive=/dev/nrct0 < 2. Change the /etc/default/tape file to /dev/nrct0 < 3. tar cv file1 < 4. tar cv file2 < 5. tape rewind < 6. tape rfm - moves you to the end of file one < 7. tape rfm - moves you to the end of file two < 8. tape rfm - this is not a failure, it's a *feature* :-) Actually, this moves you beyond the end of the file mark, because the previous tape rfm leaves it at the file mark. < 9. tar cv file3 < 10. tape rewind < 11. tape rfm < 12. tape rfm < 13. tape rfm - now you are positioned at the end of the second file. < 14. tar tvf ( or xvf ) /dev/rct0 ( can you beleive this? I can't ) < 15. THIS WORKS..... ^^^^--- notice *rct0* not nrct0, - ask SCO why! It doesn't matter which you choose, unless you want to add another file after this one. The nrct driver means "don't rewind _ON_CLOSE_". Only use the rct driver if you want the tape rewound after each close. [minor (probably unwarranted; most are) flame against SCO removed] You could, of course use "tar rv files files files", and get them added on to the end of the current archive, so you didn't have to run tar 3 times to get all the data off of the tape. -- Steve Watt ...!claris!wattres!steve wattres!steve@claris.com also works If you torture your data long enough, it'll eventually confess. ----------------------------- From: "Dr A. N. Walker" <anw@maths.nott.ac.uk> Subject: Re: Dr David G Korn to speak at SVNet Date: 14 Mar 90 17:03:47 GMT To: unix-wizards@sem.brl.mil In article <1990Mar11.160403.27949@sobeco.com> roe@sobeco.com (r.peterson) writes: >And even more to do with the fact that Bourne used the preprocessor >to turn C into a bizarre pascal-lookalike. Truly the most difficult >code I've ever tried to modify. Actually, he used it to turn an Algol lookalike [not very!] into C. Some of us old-timers found it quite readable. I've seen much worse code over the years. -- Andy Walker, Maths Dept., Nott'm Univ., UK. anw@maths.nott.ac.uk ----------------------------- From: Doug Gwyn <gwyn@smoke.brl.mil> Subject: Re: Large Unix, SYS5.4 on Unisys Date: 15 Mar 90 00:34:20 GMT To: unix-wizards@sem.brl.mil In article <22750@adm.BRL.MIL> archunix@stl-08sima.army.mil (Bernie J. Potter) writes: >In addition, I have been asked to locate alternate sources >(besides Unisys) for a System V Release 4 based operating >system for a Unisys 5000/80 machine. We are unable to >upgrade to Release 4 under our current Unisys contract >and would like to find another source for doing so. By far your best source for an operating system would be the vendor, even if it means writing a separate procurement action (which you would have to do anyway no matter what the source of the off-contract software). Since UNIX System V Release 4.0 has just been released, it may have not yet been ported to your hardware even if the vendor plans to do so. If Unisys tells you definitely that they have no plans to upgrade their current OS to SVR4.0 (quite apart from considerations of the DA MINIS contract), then try contacting Arete who as I recall actually developed the system you are now using (resold by Unisys). I'm not sure that Arete is still in business under the same name, however; this industry changes its infrastructure too frequently for me to keep up with such details. ----------------------------- From: Ed Arnold <era@ncar.ucar.edu> Subject: mac postscript in ditroff input? Date: 14 Mar 90 22:46:33 GMT Sender: news@ncar.ucar.edu To: unix-wizards@sem.brl.mil I'm interested in corresponding with anyone who has succeeded in merging postscript generated by Mac applications such as MacDraw or Illustrator, into ditroff input, to get merged ditroff text & Apple postscript graphics on the same page. I've tried this using: TranScript 2.1 (psdit) LaserPrep 5.2 SunOS 4.0.3 Apple LaserWriter Plus (sort of works) Imagen 2308 with ultrascript and Apple dictionary dictv52.ps (doesn't work; quits with error message) I followed the suggestions given on the psdit man page to merge in the postscript, and various permutations thereof, but ditroff text is either lost, or appears on the next page, when printing to the LaserWriter. Adobe doesn't seem to know whether this is possible; but they won't talk with me anyway, since I'm not an Adobe developer. I'm not particularly eager to learn the entire Apple dictionary. :-( -- Ed Arnold * NCAR * POB 3000, Boulder, CO 80307-3000 * 303-497-1253(w) era@ncar.ucar.edu [128.117.64.4] * era@ncario.bitnet * era@ncar.uucp "See, the human mind is kind of like ... a pinata. When it breaks open, there's a lot of surprises inside." --Jane Wagner/Lily Tomlin ----------------------------- From: Mike Thompson <yohn@tumult.sgi.com> Subject: Re: Setting the access/modify time on a file Date: 14 Mar 90 23:00:46 GMT Sender: yohn@tumult.sgi.com To: unix-wizards@sem.brl.mil In article <1413@watserv1.waterloo.edu>, tom@mims-iris.waterloo.edu (Tom Haapanen) writes: > I wish to update a file (with an advisory lock), and then to close it, > setting the access and modify times to (almost) the same time. Here > is what I'm attempting: > > FILE *fp; > long times; > > fp = fopen("filename", "w"); > flock(fileno(fp), LOCK_EX); > > ... much i/o to the file ... > > fflush(fp); > times[1] = time(×[0]) - (long)2; > utime(mailfile, times); > > flock(fileno(fp), LOCK_UN); > fclose(fp); > > Now, at what point does the modify time get set? the utime() call appears > to set the access time, but the modify time appears to be set AGAIN after > the access time. Where SHOULD it get set? And what should I do to make > sure that my access time > modify time? > > The OS is IRIX 3.2 -- aka System V.3. Thanks for any and all replies! This is a bug in 3.2 -- the Extent File System routine which is deallocating preallocated file blocks on close is (mistakenly) forcing the modify time to be set (to the close time). It has been fixed for the upcoming release. For now, reopen the file after the fclose, and *then* call utime and reclose the file. The deallocation routine will not be called (actually, will return without doing anything) since there had been no file activity since the open. Michael Thompson ----------------------------- End of UNIX-WIZARDS Digest ************************** ----------
postmaster@sandia.gov (SMTP MAILER) (06/06/90)
----Reason for mail failure follows---- Sending mail to <ckaul%math@cs.sandia.gov> : Could not be delivered for three days. ----Transcript of message follows---- Date: 3 Jun 90 06:49:00 MDT From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#049 To: "ckaul" <ckaul%math@cs.sandia.gov> Return-Path: <incoming-unix-wizards-request@sandia.gov> Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Sun, 3 Jun 90 06:30:17 MDT Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa23416; 3 Jun 90 5:52 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa23376; 3 Jun 90 5:45 EDT Date: Sun, 03 Jun 90 05:45:05 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#049 Message-ID: <9006030545.aa23376@SEM.BRL.MIL> UNIX-WIZARDS Digest Sun, 03 Jun 1990 V10#049 Today's Topics: Re: C0WABUNGA!! To which devices does select apply? Re: REVISED: How do I send e-mail to lots of users at a remote unix site? Re: How can a parent find out if one of its children is still alive Re: lpadmin(8) question Re: ksh discriminates background processes Re: SEX! or, how do I mail to a lot of unix users? Re: ksh discriminates background processes Init S on System V 3.2 need help with 'curses' Re: ksh discriminates background processes Lex man page flame (was Re: Lex and initial start conditions) can Sys. V Rel. 3.2 support > 16MB RAM when can only DMA to <= 16MB? Re: can Sys. V Rel. 3.2 support > 16MB RAM when can only DMA to <= 16MB? Re: Removing garbage files time dep login ----------------------------------------------------------------- From: "Gil Pilz@Eng@Banyan" <gil@banyan.uucp> Subject: Re: C0WABUNGA!! Keywords: stuffed-shirt Date: 1 Jun 90 22:44:32 GMT To: unix-wizards@sem.brl.mil In article <574@lad.scs.com> lad@lad.scs.com (Lawrence A. Deleski) writes: > >From article <901508516356BIFF@BIFFVM.BIT.NET>, by BIFF@BIFFVM.BIT.NET (THE >BIFFMAN COMETH): >> HIYA D00DS!! ICUZ MY BBROTHER <--BIG BROTHER, NEET HUH? WUZ BBSITTING ME >AND MY> MOM WULD KILL HIM IF ANYTING HAPENED TO ME. THEES SHUR R >Is there anything we can do about this 'dude'? He's cross-posted to every >damn group he could. I really hate this type of trash. one . . two . . three . . four . . "Lighten up Lawrence !" It's a *joke* son ! Get it !? "when Jim calls out the infantry to save the likes of you and me and planes are falling from they sky then there's no need to wonder why it's BIFF !" Gilbert Pilz Jr. "sick, and proud of it" gil@banyan.com ----------------------------- From: "Aryeh M. Weiss" <aryeh@eddie.mit.edu> Subject: To which devices does select apply? Keywords: select pipes Date: 2 Jun 90 13:42:31 GMT To: unix-wizards@sem.brl.mil What devices does select apply? I know select() is designed to be used with serial and event devices, but does it apply to pipes or ordinary files? Under SCO Xenix V/386 R2.3.2 select() *always* indicates data is available from a pipe, including empty pipes. Is there a standard for select()'s behavior on pipes? -- ----------------------------- From: Larry McVoy <lm@snafu.sun.com> Subject: Re: REVISED: How do I send e-mail to lots of users at a remote unix site? Date: 31 May 90 19:59:39 GMT Sender: news@sun.eng.sun.com Followup-To: comp.unix.questions To: unix-wizards@sem.brl.mil In article <900531093547.30e0dca3@Csa2.LBL.Gov> thermal%solgel.hepnet@CSA2.LBL.GOV writes: >I would like to be able to send a mail message to all the users on >ANOTHER unix machine via Internet. Of course, I could do it the long >and tedious way, that is, by sending a mail message to each user, one >at a time. Is there a quicker way? (it seems to me there could be two >or three different ways, such as setting up a mailing list file on my >machine which will automatically mail the message to all on the list, >or sending one message to the remote machine and somehow instruct it >to distribute the message to all the users). Obviously, I'm not a >unix guru or wizard, so make your explanation understandable, please. You'll have to get cooperation from the remote machine. Let's assume that you are mailing to a remote machine that runs sendmail. Then you can get the remote admin to edit /etc/aliases and add a line like: kernel: lm,auspex!guy,shannon,limes,glenn,dave@cs.wisc.edu Then if you mail kernel@remote.host.whatever the message will be exploded on remote.host.whatever instead of the local host. You may need to run "newaliases" which massages the alias file into a database that sendmail uses. If you are sending to a remote host that doesn't run sendmail or any other mailer that provides an aliasing service then I don't know what you can do. This message is more appropriate for comp.unix.questions so I've directed follow ups there. --- Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com ----------------------------- From: Tom Armistead <toma@ozdaltx.uucp> Subject: Re: How can a parent find out if one of its children is still alive Date: 2 Jun 90 05:14:48 GMT To: unix-wizards@sem.brl.mil In article <30408@cup.portal.com>, DeadHead@cup.portal.com (Bruce M Ong) writes: > I am sure there is a very easy way to do this, but I just havent > figured this one out: > > How can a parent find out if one of its children is still alive > or not without ..... If you have the process id of the child you can use kill(2) to find out if it is still there. i.e.: if( kill( child_pid, 0 ) == -1 ) puts( "The child is dead" ); Signal 0 is called the NULL signal and is used to validate a process id, no signal is actually sent to the destination process. Will this do it for you? Tom -- ------------------------------- {uunet,smu}!sulaco!ozdaltx!toma (Tom Armistead @ Garland, Texas) {uunet,smu}!sulaco!ozdaltx!swsrv1!toma ----------------------------- From: "Conor P. Cahill" <cpcahil@virtech.uucp> Subject: Re: lpadmin(8) question Keywords: lp systemv Date: 2 Jun 90 03:41:51 GMT To: unix-wizards@sem.brl.mil In article <453@van-bc.UUCP> sl@van-bc.UUCP (Stuart Lynne) writes: >In the man page for lpadmin: > > -vdevice ..... Note that there is nothng to stop a system > manager from associating the same device with more > than one printer. > >Does this mean that there is nothing to stop you from doing this so don't do >it? No. What it means is that you can do it, but you must set things up so that they work correctly. This has been used lots of times to have a printer with several kinds of paper that can be loaded and each type of paper will get it's own queue while the device for all of the queues is the same. In this scenario, the system administrator must enable 1 and only 1 of the queues at the same time (hopefully just after he placed the appropriate paper into the printer). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170 ----------------------------- From: Bill Irwin <bill@twg.bc.ca> Subject: Re: lpadmin(8) question Keywords: lp systemv Date: 2 Jun 90 10:19:42 GMT Expires: Sender: Followup-To: To: unix-wizards@sem.brl.mil In article <453@van-bc.UUCP> sl@van-bc.UUCP (Stuart Lynne) writes: >Which is what I need to do. I have two different packages that want to >install specialized lp destinations with appropriate filters. Can I install >both and have lp figure out how multiplex the requests for the two >destinations to the one physical printer? > >Or will I have to hack the two interfaces together and add options? > >What I wanted was for file1 to be printed, followed by file2. What I got was >file1 intermingled with file2 being printed. I have had this same problem. I have one printer that is used for four lp destinations. When jobs are queued to two or more of the destinations at the same time, you get garbage. The solution I came up with works very well. It involves adding some lines to the models which will check to see if there is a lock file in place for this physical printer, wait if there is; make a lock file if there isn't; print the job(s); then remove the lock. I have attached excerpts from one of my models. : computer_pr # Looks for print jobs on any printer on the same port as # computer_pr, and waits until there are no jobs before # continuing. # if [ -f /tmp/computer.lock ] then while [ -f /tmp/computer.lock ] do sleep 60 done fi touch /tmp/computer.lock # # Copyright (C) The Santa Cruz Operation, 1985, 1986. # This Module contains Proprietary Information of # The Santa Cruz Operation, Microsoft Corporation # and AT&T, and should be treated as Confidential. # #! computer_pr # Options: lp -ob no banner # . [rest of the standard model here] . . # send the file(s) to the standard out $copies times while [ "$copies" -gt 0 ] do for file do echo -n " 0 6 F66" # Oki 32x codes cat "$file" 2>&1 echo "\f\c" echo -n " 0 6 F66" # Oki 32x codes done copies=`expr $copies - 1` done rm /tmp/computer.lock stty -hupcl 0<&1 exit 0 The only drawback with this approach that I have encountered is when you cancel a print job the lock is not removed. You have to remember to "rm /tmp/computer.lock" after your cancel, otherwise you next jobs will never print. I remember trying to solve this once by trapping the rm lock sequence inside the model, but it didn't work. I would be interested in finding a better solution than this which doesn't force the user to remember to remove a dead lock file. Good luck. -- Bill Irwin - TWG The Westrheim Group - Vancouver, BC, Canada ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uunet!van-bc!twg!bill (604) 431-9600 (voice) | UNIX Systems Bill.Irwin@twg.bc.ca (604) 431-4629 (fax) | Integration ----------------------------- From: Eduardo Krell <ekrell@ulysses.att.com> Subject: Re: ksh discriminates background processes Keywords: ksh, nice, errr... ugly Date: 2 Jun 90 13:51:16 GMT Sender: netnews@ulysses.att.com To: unix-wizards@sem.brl.mil In article <siebren.644249314@piring.cwi.nl> siebren@cwi.nl (Siebren van der Zee) writes: >Does anybody know why the new Korn shell lowers the priority >of background processes? Because you have the "bgnice" option on. Type "set -o" and you'll see a line that says bgnice off This is the default behavior. If you want this changed, add "set +o bgnice" to your ENV file. Eduardo Krell AT&T Bell Laboratories, Murray Hill, NJ UUCP: {att,decvax,ucbvax}!ulysses!ekrell Internet: ekrell@ulysses.att.com ----------------------------- From: "Jay A. Konigsberg" <jak@sactoh0.uucp> Subject: Re: SEX! or, how do I mail to a lot of unix users? Date: 2 Jun 90 07:58:42 GMT To: unix-wizards@sem.brl.mil In article <900531083151.30e0b91a@Csa2.LBL.Gov> thermal%solgel.hepnet@CSA2.LBL.GOV writes: >I would like to be able to send a mail message to all the users on >a unix machine. Of course, I could do it the long way, that is, >do a 'finger' or 'who', thus getting a list of all the users, and >then sending a mail message to each, one at a time. Is there a >quicker way? (it seems to me there could be two or three different >ways, such as setting up a mailing list, or some nifty command that >will do this on one stroke of the finger). Obviously, I'm not a >unix guru or wizard, so make your explanation understandable, please. > >Thanks, Dana Write a shell script named "mall" (mail all - but I love the name). It scans the /etc/passwd file and extracts those login names with UID >= 100. You can also have an optional filename with the login names you want the message sent to. One note: doing this will probably mean that some of the mail will sit unread in /usr/mail (or /usr/spool/mail), so be careful how you write it. Accuctally, someone out there might have already written it. ----------------------------- From: Eduardo Krell <ekrell@ulysses.att.com> Subject: Re: ksh discriminates background processes Keywords: ksh, nice, errr... ugly Date: 2 Jun 90 16:49:52 GMT Sender: netnews@ulysses.att.com To: unix-wizards@sem.brl.mil In article <13051@ulysses.att.com> I said: >bgnice off > >This is the default behavior. Oops. The default bgnice behavior is "on". I copied the above from my shell output where I turn it off. Eduardo Krell AT&T Bell Laboratories, Murray Hill, NJ UUCP: {att,decvax,ucbvax}!ulysses!ekrell Internet: ekrell@ulysses.att.com ----------------------------- From: Marc Wiz <wizm@mbf.uucp> Subject: Init S on System V 3.2 Keywords: init single user mode Date: 1 Jun 90 22:25:07 GMT To: unix-wizards@sem.brl.mil I and another engineer here are in need of some net wisdom. Here's the problem: on system V 3.2 performing an init S puts the system into single user mode. It also makes the terminal that executed the init S the system console. Also according to the man page init(1M), all mounted file systems are left mounted and only processes spawned by init are killed. What the man page and documentation does not say is that any processes i.e. daemons that were created via script files in /etc/rc* are still running. Which means that if you perform an init 2 from this state then there will be two copies of every daemon running. Obviously this is not a desire- able state! :-) The easy thing to do is just perform an init 6 which will reboot the system. In the interests of getting the system back up to multi-user mode in the shortest time, the ideal would be the init 2. What can we do to go back to run state 2 without rebooting? And is this a bug or a feature? Thanks in advance for the help. Marc -- : Marc Wiz : : Yes, that really is my last name. MAI Basic Four, Inc. : : Tustin, CA 92680 : : UUCP:sun!sequent!mbf!wizm Ma Bell:1-714-730-2602 : : uunet!ccicpg!mbf!wizm : ----------------------------- From: Quan Tang <qt@beach.cis.ufl.edu> Subject: need help with 'curses' Date: 2 Jun 90 18:45:25 GMT Sender: news@bikini.cis.ufl.edu To: unix-wizards@sem.brl.mil I am going to use 'curses', but I have no references except man pages, I will appreciate it very much if any unix expert send me some information about it including your experience. ----------------------------- From: carl brandauer <cbrandau@nyx.uucp> Subject: Re: ksh discriminates background processes Keywords: ksh, nice, errr... ugly Date: 2 Jun 90 19:40:39 GMT To: unix-wizards@sem.brl.mil every shell i have used in the last 13 years has lowered the priority of background processes - makes sense to me ----------------------------- From: Martin Weitzel <martin@mwtech.uucp> Subject: Lex man page flame (was Re: Lex and initial start conditions) Date: 2 Jun 90 13:11:14 GMT Posted: Sat Jun 2 14:11:14 1990 To: unix-wizards@sem.brl.mil In article <116@bohra.cpg.oz> ejp@bohra.cpg.oz.au (Esmond Pitt) writes: >In article <1990May30.174745.1161@csrd.uiuc.edu> pommu@iis.ethz.ch (Claude Pommerell) writes: >> [about changing start conditions at entry to yylex()] > >There are two even simpler ways. `Simpler' mostly depends on your view and expectations ... > >Instead of effectively changing the initial condition to <Text>, either: > >1. Ensure each start-state is equipped with enough rules to handle any >possible input, and, as the documentation does state, place all the >unlabelled rules after all the labelled rules, and/or Sounds not simpler to me. > >2. Label all the rules you only want applied in the INITAL state with ><INITIAL>, so they won't be applied as defaults in other states. This trades off one undocumented feature (stuff *after* the first '%%' line and *before* the first rule) against another undocumented feature. But to be fair: Strictly following some man pages for lex nearly every a nontrivial lex applications would use some undocumented feautures. I just looked up for the purpose of writing this: 1.) SVID (1986) 2.) XPG3 (1989) 3.) ISC Programmers Reference Manual 4.) ISC Programmers Guide (1988) .FLAME ON Not any single mentioning of start conditions in (4) at all (neither the syntax in rules, nor the special action BEGIN). Worse in some example the the advice is for a lex program to #define BEGIN 1 (believe it or not) as a `good programming style' for returning tokens. This finally reveals that the author can have never heard something about start conditions. The example of the lex program has a line: begin return (BEGIN); Please ISC, could you send the person who has written this guide to a lex+yacc course (BTW: I'm teaching some :-)) before a revised version is produced. Well, there is mentioned that yacc contains a feature to supply token-defines, but it's bad practice to give advices that turn out to be not only unnecessary, but dangerous too. The only advice in this guide that isn't near to worthless is to look into the paper about Lex written by Mike Lesk. (You were better advised printing this paper in the guide than the section that's in by now.) An other advice there is to check out the reference manual (3). Be aware: IF YOU TRY TO USE LEX WITH THIS REFERENCE, YOU WILL BE ABSOLUTELY LOST. (Better save your time trying, rather end work soon, go out and have a nice evening - or, again, look for the Lesk-paper.) Ehhm, we are talking about start conditions. The reference manual is *very* silent about them - in fact no mentioning. On the other hand: The author was quite careful to mention, that the "-r option is not yet fully operational". (What this option tells is that lex should produce RATFOR source instead of C. Oh, how many times I needed that an wondered why it just didn't "fully" work - but good news, not "yet", that is, the day will come when I finally can switch from C to RATFOR :-).) But before we beat ISC too much: I suppose they took what they got from somewhere (AT&T?) and only made it a little worse. Let's look at (1) - and don't say a reference dated from 1986 is too old today: The stuff we are talking about is *much* longer in lex. SVID does the good job of printing a table which shows the regular expression syntax for lex rules (it's quite similar as the "extended regular expressions" of egrep and awk, but there are some differences). In this table you'll find the syntax of start conditions, but not the least mentioning of them and BEGIN in the rest of the text. So, if you read the table you probably think you must be stupid, if you don't know lex and hence you don't understand what <s>r the occurence of the regular expression r only when the program is in start condition (state) s shall tell you. (Again, start conditions or states and the special action BEGIN is not mentioned anywhere else in the section). Finally to (2), which seems a not so bad re-work of the SVID in other areas. A quick scan thru the lex section reveals that it is quite similar to (1), but the table with the regular expression syntax is ommitted in favor of a difference list to extended regular expressions. (BTW: The difference list is not complete.) The same sentence concerning the <s>r-Syntax as in (1) appears but again nothing about start conditions, states, and BEGIN in the rest of the section. .FLAME OFF Hello AT&T, anybody listening: If you haven't revised the manuals recently, please do a complete rewrite of the lex section but find somebody as author who has sufficient experience with lex+yacc in non-trivial applications *and* who can explain understandable to mortals. (From many publications I know such people are working at AT&T - I'm volunteering doing a proof-read.) > >Placing non-labelled rules before labelled rules is probably the single >most common error in writing LEX scripts, even after 15 years. > >I don't know why. After reading the above, you probably know why many novices struggle with lex. Concerning your the problem, here are the THREE BIG DISAMBIGUATING RULES 1) leftmost 2) longer 3) first in source which tells us: Take the input stream and write it down in one line from left to right: Then, in case two rules might match some part of the input stream, lex chooses the rule that matches more to the left, that matches the longer regular expression or that matches the regular expression which appears first in (lex) source, with (1) having higher priority than (2) having higher priority than (3). This is well choosen, because it enables us to do the following: "if" { ... action for keyword if ... } [a-z]+ { ... action for identifier ... } which triggers the second for " fif " (because of 1), as well as for " iff " (because of 2), but the first for " if " (because of 3). Start conditions are no exceptions from this rule! -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83 ----------------------------- From: Scott Weikart <weikart@arisia.xerox.com> Subject: can Sys. V Rel. 3.2 support > 16MB RAM when can only DMA to <= 16MB? Date: 3 Jun 90 00:56:39 GMT To: unix-wizards@sem.brl.mil First, some details for those of you who are interested in IBM PC/AT compatible, Intel 80386-based computers. I'm trying to use more than 16MB of main memory on an AT/386 running Interactive 386/ix 2.0.2 (V.3.2). I'm using the latet Chantal SCSI driver with the Adaptec AHA1542 SCSI host adapter. The AHA1542 has an on-board DMA for doing data transfers; since it uses the AT bus, it only works with 24 bits of address, i.e. it can access at most 16MB of memory. But I'd like to buy a motherboard that will hold 32MB of memory, because I'm starting to thrash. So, my machine would have more than 16MB of memory, but the DMA on my disk controller will access at most 16MB of memory. How can I make this work? I have two ideas on how to do this. One is to only use block devices on the local machine (so that all disk DMA is done to the disk cache, which is always in low memory), and put raw devices on remote machines accessible via RFS over ethernet. Although tty devices are raw, they always do their transfers to kernel buffers as near as I can figure. I'd put my tape devices on remote machines. The tricky part is the swap device; although it's a block device, it does transfers directly into user space without going through the disk cache [acording to Bach]. To get a swap device, I'd remote mount a disk partition from another machine using RFS: I would boot the machine with a local swap region, then start up RFS, then mount an unused partition from a remote machine, then use /etc/swap to setup the remote partition as a swap device, then use /etc/swap to delete the partitin on the local machine. Note that I'm not too worried about performance loss from swapping/paging across ethernet, because I'll be reducing swap/page activity drastically by doubling the amount of RAM available. But can V.3.2 handle a swap partition on a remote machine? The second idea is to use a feature that's (maybe) specific to V/386. There's a file /etc/default/boot that contains boot time parameters (described by boot(1)). The MEMRANGE parameter lets you specify a number of different ranges of physical address space where RAM can found; for each range of address space, you can specify whether or not DMA accesses work to this range. If I specify not to use DMA for memory above 16MB, will all my problems be magically solved? If so, how is it done? For example, Bach says that when swapping a process the whole process is stored in contiguous sectors of the swap device; will the kernel grab some blocks from the disk cache and do the swapping in chunks, using the disk cache blocks as the DMA-accessible intermediary? And will the kernel do all the chunking with disk cache blocks transparently to the disk driver, or will the driver have to get the MEMRANGE parameters and do its own special tricks for transferring into memory where DMA can't work? Any other ideas on how to handle this problem? Please send me comments in email, since I din't normally read these newsgroups. I'll post any feedback I receive. -- Scott Weikart Community Data Processing (415)322-9069 weikart@arisia.xerox.com pyramid!cdp!scott ----------------------------- From: Scott Weikart <weikart@arisia.xerox.com> Subject: Re: can Sys. V Rel. 3.2 support > 16MB RAM when can only DMA to <= 16MB? Date: 3 Jun 90 02:46:41 GMT To: unix-wizards@sem.brl.mil In article <9628@arisia.Xerox.COM>, weikart@arisia.Xerox.COM (Scott Weikart) writes: > > But can V.3.2 handle a swap partition on a > remote machine? I just read the "386/ix Network Connections Facilities Release Notes - Release 2.0". The next to last item in the list of bugs is "Swap devices cannot be remote...". So much for that idea. How about my other idea: will the kernel support the MEMRANGE no-DMA parameter in /etc/default/boot without any assistance from the disk driver? -- Scott Weikart Community Data Processing (415)322-9069 weikart@arisia.xerox.com pyramid!cdp!scott ----------------------------- From: Ronald Pikkert <ronald@atcmp.nl> Subject: Re: Removing garbage files Date: 2 Jun 90 21:00:53 GMT To: unix-wizards@sem.brl.mil From article <156@TWG.UUCP>, by bill@TWG.UUCP (Bill Irwin): > Here is one that has got me beat, frustrated and down right angry. I > have some files in a directory that I can't remove. Your shell probably strips the high order bit which causes rm to be unable to delete these files. You can remove them using a c-program. I wrote a shell script that creates a c-program that does the job: ------------------- cut here ------------------ echo "main() {" ls -b | sed 's/\(\\\)\([^0]\)/\10\2/g s/\\$/\\\\/ s/"/\\"/g s/^/unlink(\"/ s/$/");/ ' echo "}" ------------------- cut here ------------------ Run this script in the directory and it will generate a program dl.c Compile the program (cc dl.c -o dl). The run ./dl and there will be no need to reformat your anymore disk :-) - Ronald Pikkert E-mail: ronald@atcmp.nl @ AT Computing b.v. Tel: 080 - 566880 Toernooiveld 6525 ED Nijmegen ----------------------------- From: George Bron Faison <Bron@cup.portal.com> Subject: time dep login Date: 3 Jun 90 04:36:09 GMT To: unix-wizards@sem.brl.mil 9A couple of ideas you might puruse... Placing a program in passwd in place of /bin/sh to check the time and display a nice message (vs. just failing as some of the other suggestions imply) if your user is out of his time limits; or to invoke a login sh if he/she is within time bounds, etc. If you have more than one user to monitor, maybe something invoked by /etc/profile? If your user is "tied" to s specific port, an alternate getty with the appropriate code might suffice? (Or use inittab to "close" that port?) If YOU control the ".profile" for your users, you could do it there also (you can also handle this by having user log into a common directory for processing before being switched to their HOME directories). I'm sure there are lots of other ways, too. George "Bron" Faison Modern Office Systems Technology, Inc. (804) 730-1467 or Bron@cup.portal.com or 6006-B Mechanicsville 'Pike, Mech. VA. 23111 ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@ecf.ncsl.nist.gov (SMTP MAILER) (08/11/90)
----Reason for mail failure follows---- Sending mail to host ecf.ncsl.nist.gov : Fatal reply code to command 'RCPT TO:<ise.ncsl.nist.gov@ecf.ncsl.nist.gov>': 550 User "ise.ncsl.nist.gov" Unknown. ----Transcript of message follows---- Date: 11 Aug 90 06:45:00 EST From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#113 To: "ise.ncsl.nist.gov" <ise.ncsl.nist.gov@ecf.ncsl.nist.gov> Return-Path: <unixwiz-request@ecf.ncsl.nist.gov> Received: from SEM.BRL.MIL by ecf.ncsl.nist.gov with SMTP ; Sat, 11 Aug 90 06:44:47 EST Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa03279; 11 Aug 90 5:57 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa03234; 11 Aug 90 5:45 EDT Date: Sat, 11 Aug 90 05:45:11 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#113 Message-ID: <9008110545.aa03234@SEM.BRL.MIL> UNIX-WIZARDS Digest Sat, 11 Aug 1990 V10#113 Today's Topics: Re: Cron - First Saturday of the month Re: Streams message allocation nested loops Re: nested loops waitpid() ??? unix sys v - uptime question Interesting keyboard read problem (ioctl, function keys) sockets and signals (in C) Re: sockets and signals (in C) Re: Re.: UNdeleting files seeking information about file system details. evaluating ${10} and above in sh/ksh Re: How variables can be specified as arguments Re: ln -f ----------------------------------------------------------------- From: Bob Strait <rls@svcs1.uucp> Subject: Re: Cron - First Saturday of the month Date: 9 Aug 90 17:13:32 GMT To: unix-wizards@sem.brl.mil In article <19744@orstcs.CS.ORST.EDU> curt@oce.orst.edu (Curt Vandetta) writes: > I'm wondering if anyone has a way of making cron run a job on the > first Saturday of every month? > How about running your job each of the first seven days of every month, and have the job first test whether it's Saturday and exit if it's not. There are several easy ways to do the test: 'date | grep Sat' comes to mind. -- BUBBA (aka Bob Strait) ...!mips!svcs1!rls Silicon Valley Computer Society Sunnyvale, CA -- ----------------------------- From: Bob McGowen x4312 dept208 <bob@wyse.wyse.com> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 02:40:29 GMT Sender: news@wyse.wyse.com To: unix-wizards@sem.brl.mil In article <1990Aug8.185745.16606@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article <19744@orstcs.CS.ORST.EDU>, curt@oce (Curt Vandetta) writes: >| I'm wondering if anyone has a way of making cron run a job on the >| first Saturday of every month? > >3 4 1-7 * 6 command > >to make 'command' run at 4:03am... adjust the first two fields as >necessary. Remember, the parameters are "and"-ed together. ...flame deleted My documentation states that a line like the one you have provided would cause the command to run on EVERY Saturday as well as on each of the first seven days in the month. My flame-- I would be very interested if you could provide a cron only method of getting my cron to execute on the first Saturday (or any other day) such that it executes on that single day only. My attempts at solving this have been to combine cron to run the command on Saturday and have command be a script that checks the date to be sure it is less than or equal to 7. But this only works for the first 13 days so I have to figure out the next exclusion, probably to limit between a start and stop. In any case, getting cron to do what Curt wants is a little more difficult. Possibly (probably, I think) even wizard caliber. Bob McGowan (standard disclaimer, these are my own ...) Product Support, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com ----------------------------- From: Michael van Elst <p554mve@mpirbn.mpifr-bonn.mpg.de> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 14:28:35 GMT Posted: Fri Aug 10 15:28:35 1990 To: unix-wizards@sem.brl.mil In article <1990Aug8.185745.16606@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article <19744@orstcs.CS.ORST.EDU>, curt@oce (Curt Vandetta) writes: >| I'm wondering if anyone has a way of making cron run a job on the >| first Saturday of every month? >3 4 1-7 * 6 command >to make 'command' run at 4:03am... adjust the first two fields as >necessary. Remember, the parameters are "and"-ed together. From the SunOS4.03 Manual: Note: the specification of days may be made by two fields (day of the month and day of the week). If both are specified as a list of elements, both are adhered to. For example: 0 0 1,15 * 1 command would run a command on the first and the fifteenth of each month, as well as on every Monday. . . Seems that, at least here, your suggestion doesn't work. -- Michael van Elst UUCP: universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve Internet: p554mve@mpirbn.mpifr-bonn.mpg.de "A potential Snark may lurk in every tree." ----------------------------- From: Ed Anselmo <anselmo-ed@cs.yale.edu> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 16:42:38 GMT Sender: news@cs.yale.edu Nntp-Posting-Host: bigbird.cf.cs.yale.edu To: unix-wizards@sem.brl.mil I peeked at the sources -- the BSD cron "ands" all the fields together. I don't have Sun 4.x sources, but under SunOS 4.0.3, I saw the same behavior as David Canzi saw. So, with a crontab like: 28 12 1-5 * 5 anselmo date > /homes/facility/anselmo/temp/www 28 12 7-11 * 1 anselmo date > /homes/facility/anselmo/temp/xxx 28 12 1-5 * 1 anselmo date > /homes/facility/anselmo/temp/yyy 28 12 7-11 * 5 anselmo date > /homes/facility/anselmo/temp/zzz running on Fri Aug 10, under the BSD cron, only zzz got created. Running under Sun 4.x cron (with the crontab entries suitably modified), www, xxx, and zzz got created. -- Ed Anselmo anselmo-ed@cs.yale.edu {harvard,cmcl2}!yale!anselmo-ed ----------------------------- From: Maarten Litmaath <maart@cs.vu.nl> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 17:26:39 GMT Sender: news@cs.vu.nl To: unix-wizards@sem.brl.mil The manual (man 5 crontab on SunOS 4.0.3c): [...] Note: the specification of days may be made by two fields (day of the month and day of the week). If both are speci- fied as a list of elements, both are adhered to. For exam- ple, 0 0 1,15 * 1 would run a command on the first and fifteenth of each month, as well as on every Monday. To specify days by only one field, the other field should be set to *. For example, 0 0 * * 1 would run a command only on Mondays. [...] The code: int match(cp, loct) register char **cp; register struct tm *loct; { int cancel_ex = 0; *cp = cmp(*cp, loct->tm_min, &cancel_ex); *cp = cmp(*cp, loct->tm_hour, &cancel_ex); *cp = cmp(*cp, loct->tm_mday, &cancel_ex); *cp = cmp(*cp, loct->tm_mon, &cancel_ex); *cp = cmp(*cp, loct->tm_wday, &cancel_ex); return(!cancel_ex); } char * cmp(p, v, cancel_ex) char *p; int *cancel_ex; { register char *cp; cp = p; switch(*cp++) { case EXACT: if (*cp++ != v) (*cancel_ex)++; return(cp); case ANY: return(cp); case LIST: while(*cp != LIST) if(*cp++ == v) { while(*cp++ != LIST) ; return(cp); } (*cancel_ex)++; return(cp+1); case RANGE: if(cp[0] < cp[1]) { if(!(cp[0]<=v && cp[1]>=v)) (*cancel_ex)++; } else if(!(v>=cp[0] || v<=cp[1])) (*cancel_ex)++; return(cp+2); } if(cp[-1] != v) (*cancel_ex)++; return(cp); } The conclusion: the manual and the code contradict each other! The example 0 0 1,15 * 1 ...will run the job on each monday whose date is either the 1st or the 15th! It might be too late to fix the manual... (Grrrr!) -- "UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." (Doug Gwyn) ----------------------------- From: Chip Salzenberg <chip@tct.uucp> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 17:46:26 GMT To: unix-wizards@sem.brl.mil According to dmcanzi@watserv1.waterloo.edu (David Canzi): >if [ `date | sed 's/^... ... *\([^ ]*\) .*/\1/'` -le 7 ] At least on SysV, this is working too hard! Use this instead: if [ "`date +%d`" -le 7 ] Manual pages are wonderful things... -- Chip Salzenberg at ComDev/TCT <chip@tct.uucp>, <uunet!ateng!tct!chip> ----------------------------- From: Maarten Litmaath <maart@cs.vu.nl> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 18:13:28 GMT 6@star.cs.vu Sender: news@cs.vu.nl To: unix-wizards@sem.brl.mil In article <7286@star.cs.vu.nl>, I wrote: )The manual (man 5 crontab on SunOS 4.0.3c): )... )The code: )... I forgot to mention the code is _not_ SunOS 4.0.3c (still no up to date sources...) Anyway, my point still stands: _anding_ the fields is preferred (as Randal already explained), but it might be too late to fix the specifications... -- "UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." (Doug Gwyn) ----------------------------- From: Ronald S H Khoo <ronald@robobar.co.uk> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 19:05:17 GMT To: unix-wizards@sem.brl.mil In article <1990Aug10.063819.5253@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: > Sigh. Sorry. I'll crawl under my rock now. Cron's only for the > heavyweights, anyway. System V cron isn't just for heavyweights, though, it's got per-user crontabs, remember, so joe-random-non-wizard who has his own crontab has to understand the manpage. Sigh. Someone once mentioned wanting to write a System V-like cron in perl so he could have per-user crontabs on his machine. I wonder who it was, and how he parsed the manpage ? -- Eunet: Ronald.Khoo@robobar.Co.Uk Phone: +44 81 991 1142 Fax: +44 81 998 8343 Paper: Robobar Ltd. 22 Wadsworth Road, Perivale, Middx., UB6 7JD ENGLAND. ----------------------------- From: Randal Schwartz <merlyn@iwarp.intel.com> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 22:43:31 GMT 6@star.cs.vu Sender: news@iwarp.intel.com To: unix-wizards@sem.brl.mil In article <7286@star.cs.vu.nl>, maart@cs (Maarten Litmaath) writes: | The code: [deleted to protect my eyes, but it *is* the code I remember ...] | The conclusion: the manual and the code contradict each other! | The example | | 0 0 1,15 * 1 | | ...will run the job on each monday whose date is either the 1st or the 15th! | It might be too late to fix the manual... (Grrrr!) Yes, this is my point. Actually, what I think happened is that you posted the V7-derived cron, and Sunos4.1 went to the user-crontab System (blech) V cron, and I suspect that they put some widgets in there to do this stupid "OR" logic that I complained about in my last two postings. Anyone with access to system V source care to comment? Are there some yucky kludges in there? Just another System V disliker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: David Canzi <dmcanzi@watserv1.waterloo.edu> Subject: Re: Cron - First Saturday of the month Date: 11 Aug 90 03:08:18 GMT To: unix-wizards@sem.brl.mil In article <1990Aug8.214539.1264@watserv1.waterloo.edu> I wrote: >In a sh script, it can be done by: > >if [ `date | sed 's/^... ... *\([^ ]*\) .*/\1/'` -le 7 ]; then > ... >fi This is better done using awk: if [ `date | awk '{print $3}'` -le 7 ]; then ... fi -- David Canzi ----------------------------- From: Larry McVoy <lm@snafu.sun.com> Subject: Re: Streams message allocation Keywords: streams deadlock Date: 9 Aug 90 17:21:06 GMT Sender: news@sun.eng.sun.com To: unix-wizards@sem.brl.mil In article <1990Aug2.043059.578@cbnewsl.att.com> sar0@cbnewsl.att.com (stephen.a.rago) writes: >The number of messages needed per buffer class (size) is something that >can only be determined statistically or empirically. In the absence of >information like inter-arrival rate of allocation requests and message >hold times, the best way to proceed is to start with an educated guess >of how many messages you may need. Here's a package I wrote a few years ago when tuning STREAMS for SCO XENIX (I was porting the LAI TCP/IP to XENIX and tuning was really critical). Use this while your system is under a "normal" load and it will give you a pretty good idea of where to set things. No promises that it works - it worked on SCO XENIX a while ago, beyond that you're on your own. If you have SCO XENIX & TCP/IP you should have this program already. # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # Makefile mode.c sw.1 sw.c term.h termcap.c echo x - Makefile cat > "Makefile" << '//E*O*F Makefile//' O = sw.o termcap.o mode.o S = Makefile sw.1 sw.c termcap.c mode.c term.h #CFLAGS=-DUNIX=\"/xenix\" -DKMEM=\"/dev/mem\" -DSAVECNT=0 BIN=/usr/local/bin all sw: $O cc $O -ltermlib -o sw install: sw cp sw $(BIN) chown root $(BIN)/sw chmod 4755 $(BIN)/sw clean: rm -f $O a.out core shar clobber: clean rm -f sw shar: shar $S > shar //E*O*F Makefile// echo x - mode.c cat > "mode.c" << '//E*O*F mode.c//' /* * copyright (C) 1986 by Larry McVoy * MUST be distributed in source form only. */ # include <stdio.h> # include <sgtty.h> # include <fcntl.h> static struct sgttyb buf; static done = 0; delay(on) { if (on) { int flags; fcntl(0, F_GETFL, &flags); flags &= ~O_NDELAY; return fcntl(0, F_SETFL, flags); } else { return fcntl(0, F_SETFL, O_NDELAY); } } cbreak(on) { if (!done) { ioctl(fileno(stdin), TIOCGETP, &buf); done++; } if (on) { buf.sg_flags |= CBREAK; ioctl(fileno(stdin), TIOCSETP, &buf); } else { buf.sg_flags &= ~CBREAK; ioctl(fileno(stdin), TIOCSETP, &buf); } } echo(on) { if (!done) { ioctl(fileno(stdin), TIOCGETP, &buf); done++; } if (on) { buf.sg_flags |= ECHO; ioctl(fileno(stdin), TIOCSETP, &buf); } else { buf.sg_flags &= ~ECHO; ioctl(fileno(stdin), TIOCSETP, &buf); } } //E*O*F mode.c// echo x - sw.1 cat > "sw.1" << '//E*O*F sw.1//' .TH SW 1 .UC 4 .SH NAME sw - (stream watch) watch streams resources on System V .SH SYNOPSIS .B sw .SH DESCRIPTION .I Sw digs into kmem to find out how many streams, queues, message blocks, and data blocks are in use. It find this in the \fIstruct strstat strst\fR variable. For each category mentioned above the following fields are printed: .IP Use (strst.use) How many of the resource in question are in use. .IP "Ave10, Ave30, Ave60, Ave120" As above, only the value is averaged over the last N iterations (an iteration is about one second). .IP Total (strst.total) The total number of the resource used since boot time or the last time it was cleared. .IP Max (strst.max) The maximum number of the resource allocated at the same time. .IP Fail (strst.fail) The number of times a request was made, for the resource, that could not be granted. .PP The data block section is further broken down into sub classes. This section has a slightly different format; in the title section the field is \fISiz<#> Count <#>\fR, where the first number is the data block size and the second number is the number of data blocks statically allocated. .PP The screen is managed by curses. It will respond to: .IP c clear the total max & fail fields (you have to have write permission on /dev/mem). .IP ^L redraw the screen. .IP N Where N is 0-9. Set the number of seconds between interations. .IP q (quit) Quit the program. .IP ^L (Control-L) Refresh the screen. .SH FILES .DT /dev/kmem kernel memory .br /unix for getting variable addresses .SH BUGS The definitions of the various fields is my best guess, they do not reflect any AT&T documentation that I've read. .SH COPYRIGHT \fBSw\fR is copyright 1988 by Larry McVoy. Permission is hereby granted to publish strings in source or object form as long as all copyright notices are retained. Object-only distributions are permitted only if the source is also freely available from the distributer. Any fee charged for such publication may consist only of a reasonable charge for any media used. .SH AUTHOR Larry McVoy (lm@eng.sun.com) //E*O*F sw.1// echo x - sw.c cat > "sw.c" << '//E*O*F sw.c//' /* * copyright 1988 by Larry McVoy. All rights reserved. * If you redistribute this you must distribute in source form. */ #include "term.h" #include <signal.h> #ifdef M_XENIX #include <a.out.h> #else #include <nlist.h> #endif #include <ctype.h> #include <stdio.h> #include <sys/types.h> #include <sys/stream.h> #include <sys/stropts.h> #include <sys/strstat.h> #include <sys/var.h> #if defined(M_XENIX) || defined(sys5) #include <sys/utsname.h> #endif #ifndef UNIX #define UNIX "/vmunix" #endif #ifndef KMEM #define KMEM "/dev/kmem" #endif #ifdef M_XENIX #define v_nblk4096 v_nblk8192 #endif #ifdef sun #define NCLASS 9 #endif #ifndef SAVECNT #define SAVECNT 121 #endif #define kbytes(x) ( ((x)+1023) >> 10) #ifdef M_XENIX #define nlist xlist #define n_value xl_value #define n_name xl_name struct nlist nl[] = { #define NL_STRST 0 {0,0,0,"_strst"}, #define NL_RBSIZE 1 {0,0,0,"_rbsize"}, #define NL_V 2 {0,0,0,"_v"}, #define NL_DBALLOC 3 {0,0,0,"_dballoc"}, #define NL_NMBLOCK 4 {0,0,0,"_nmblock"}, {0,0,0,(char *) 0}, }; #else #ifdef sys5 struct nlist nl[] = { #define NL_STRST 0 {"_strst"}, #define NL_RBSIZE 1 {"_rbsize"}, #define NL_V 2 {"_v"}, #define NL_DBALLOC 3 {"_dballoc"}, #define NL_NMBLOCK 4 {"_nmblock"}, { 0 }, }; #else #ifdef sun char* nl_names[] = { #define NL_STRST 0 "_strst", #define NL_RBSIZE 1 "_rbsize", #define NL_NDBLKS 2 "_ndblks", #define NL_DBALLOC 3 "_dballoc", #define NL_NMBLOCK 4 "_nmblock", "", }; struct nlist nl[sizeof(nl_names)/sizeof(char*)]; #endif /* sun */ #endif /* sys5 */ #endif /* M_XENIX */ ushort rbsize[NCLASS]; short cnt[NCLASS]; struct dbalcst dballoc[NCLASS]; int total, ndblock, nmblock, fd, sleeptime = 1; #ifndef sun struct var v; #endif typedef struct { alcdat stream; alcdat queue; alcdat mblock; alcdat dblock; alcdat dblk[NCLASS]; } Strstat; Strstat strst; /* * It's the main thing... */ main(ac, av) char** av; { int* p; int i; int done(); for (i=1; i<ac; ++i) { if (av[i][0] == '-') if (isdigit(av[i][1])) sleeptime = atoi(&av[i][1]); } /* * get stuff from kmem */ # ifdef sun for (i=0; i<sizeof(nl_names)/sizeof(char*); ++i) nl[i].n_name = nl_names[i]; # endif if (nlist(UNIX, nl)) error("nlist"); if (((fd = open(KMEM, 2)) == -1) && ((fd = open(KMEM, 0)) == -1)) error(KMEM); readstuff(); # ifdef sun for (i=0; i<NCLASS; ndblock += cnt[i++]) ; # else for (i=0, p= &v.v_nblk4096; i<NCLASS; ndblock += (cnt[NCLASS - ++i] = *p++)) ; # endif /* * screen/mode stuff */ termcap();; echo(0); cbreak(1); delay(0); signal(SIGHUP, done); signal(SIGINT, done); signal(SIGQUIT, done); signal(SIGTERM, done); screen(); /* * display until quit */ for ( ;; ) { if (lseek(fd, nl[NL_STRST].n_value, 0) == -1) error("lseek"); if (read(fd, &strst, sizeof(strst)) != sizeof(strst)) error("read"); dump(&strst); for (i=0; i<sleeptime; ++i) { if (input()) break; sleep(1); } input(); } } /* * look for commands; expect to be in cbreak mode */ input() { char c; if (read(0, &c, 1) != 1) return 0; switch (c) { case 'c': clearstuff(); return 1; case '': screen(); return 1; case 'q': done(); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': sleeptime = c - '0'; Pause(); return 1; case '?': case 'h': clear(); tprint("", 0, 0); printf("\nOptions are\n"); printf("\tc\tclear total, max, and fail fields\n"); printf("\t^L\trefresh the screen\n"); printf("\tq\tquit\n"); printf("\tN\twhere N is a number 0..9 for the delay between refresh\n"); printf("Hit any key to continue....\n"); while (read(0, &c, 1) != 1) sleep(1); screen(); return 1; default: return 0; } } /* * clear the total, max, and fail fields * * N.B. assumes acldat is use, total, max, fail * and there are NCLASS+4 acldat's in a strstat */ clearstuff() { static int clr[3]; register i; clear(); lseek(fd, nl[NL_STRST].n_value+sizeof(int), 0); for (i=0; i<NCLASS+4; ++i) { if (write(fd, clr, sizeof(clr)) != sizeof(clr)) perror("write"); lseek(fd, sizeof(int), 1); } screen(); } /* * display the "once only" stuff */ screen() { char buf[200]; register i; #if defined(M_XENIX) || defined(sys5) struct utsname u; #else char host[100]; #endif clear(); #if defined(M_XENIX) || defined(sys5) uname(&u); sprintf(buf, "Host=%s", u.nodename); #else gethostname(host, sizeof(host)); sprintf(buf, "Host=%s", host); #endif tprint(buf, 50, 0); # if SAVECNT > 0 sprintf(buf, "%11s%5s%6s%6s%6s%6s%7s%8s%8s%8s", "Resource", "Cnt", "Use", "Ave10", "Ave30", "Ave60", "Ave120", "Total", "Max", "Fail"); # else sprintf(buf, "%11s%5s%10s%8s%8s%8s", "Resource", "Cnt", "Use", "Total", "Max", "Fail"); # endif tprint(buf, 0, 2); # ifdef sun sprintf(buf, "%11s:%4s", "stream", "?"); tprint(buf, 0, 3); sprintf(buf, "%11s:%4s", "queue", "?"); tprint(buf, 0, 4); # else sprintf(buf, "%11s:%4d", "stream", v.v_nstream); tprint(buf, 0, 3); sprintf(buf, "%11s:%4d", "queue", v.v_nqueue); tprint(buf, 0, 4); # endif sprintf(buf, "%11s:%4d", "mblock", nmblock); tprint(buf, 0, 5); sprintf(buf, "%11s:%4d", "dblk totals", ndblock); tprint(buf, 0, 6); # if SAVECNT > 0 sprintf(buf, "%4s%4s%4s%4s%6s%6s%6s%6s%7s%8s%8s%8s", "Size", "Cnt", "Med", "Low", "Use", "Ave10", "Ave30", "Ave60", "Ave120", "Total", "Max", "Fail"); # else sprintf(buf, "%-4s%4s%4s%4s%4s%6s%8s%8s%8s", "Mem", "Size", "Cnt", "Med", "Low", "Use", "Total", "Max", "Fail"); # endif tprint(buf, 0, 8); for (total=i=0; i<NCLASS; ++i) { register lo = dballoc[i].dba_lo; register med = dballoc[i].dba_med; total += rbsize[i] * cnt[i]; # if SAVECNT > 0 sprintf(buf, "%4d %3d %3d %3d", rbsize[i], cnt[i], med, lo); # else sprintf(buf, "%3d %4d %3d %3d %3d", kbytes(rbsize[i] * cnt[i]), rbsize[i], cnt[i], med, lo); # endif tprint(buf, 0, 9 + i); } sprintf(buf, "Buffers (used/total) = "); tprint(buf, 0, 23); Pause(); } Pause() { char buf[40]; sprintf(buf, "Pause=%d", sleeptime); tprint(buf, 0, 0); } # if SAVECNT == 0 /* * display the information, called once per second (about) * * No averaging version */ dump(s) register struct strstat* s; { char buf[80]; register i, mem = 0; static calls = 0; sprintf(buf, "%6d%8d%8d%8d", s->stream.use, s->stream.total, s->stream.max, s->stream.fail); tprint(buf, 20, 3); sprintf(buf, "%6d%8d%8d%8d", s->queue.use, s->queue.total, s->queue.max, s->queue.fail); tprint(buf, 20, 4); sprintf(buf, "%6d%8d%8d%8d", s->mblock.use, s->mblock.total, s->mblock.max, s->mblock.fail); tprint(buf, 20, 5); sprintf(buf, "%6d%8d%8d%8d", s->dblock.use, s->dblock.total, s->dblock.max, s->dblock.fail); tprint(buf, 20, 6); for (i=0; i<NCLASS; ++i) { mem += s->dblk[i].use * rbsize[i]; sprintf(buf, "%6d%8d%8d%8d", s->dblk[i].use, s->dblk[i].total, s->dblk[i].max, s->dblk[i].fail); tprint(buf, 20, 9 + i); } sprintf(buf, "%d/%d Kbytes", kbytes(mem), kbytes(total)); tprint(buf, 23, 23); calls++; sprintf(buf, "Calls=%d", calls); tprint(buf, 10, 0); } # else /* * display the information, called once per second (about) * * Averaging version */ dump(s) register struct strstat* s; { char buf[80]; register i, j, b10, b30, b60, b120, mem = 0; static struct strstat pst[SAVECNT]; static struct strstat sum10, sum30, sum60, sum120; static calls = 0; j = calls % SAVECNT; b10 = (j + SAVECNT - 10) % SAVECNT; b30 = (j + SAVECNT - 30) % SAVECNT; b60 = (j + SAVECNT - 60) % SAVECNT; b120 = (j + SAVECNT - 120) % SAVECNT; memcpy(&pst[j], s, sizeof(struct strstat)); addstrst(s, &sum10); addstrst(s, &sum30); addstrst(s, &sum60); addstrst(s, &sum120); if (!calls) { mulstrst(&sum10, 10); mulstrst(&sum30, 30); mulstrst(&sum60, 60); mulstrst(&sum120, 120); for (i=1; i<SAVECNT; ++i) memcpy(&pst[i], s, sizeof(struct strstat)); } else { substrst(&pst[b10], &sum10); substrst(&pst[b30], &sum30); substrst(&pst[b60], &sum60); substrst(&pst[b120], &sum120); } sprintf(buf, "%6d%6d%6d%6d%7d%8d%8d%8d", s->stream.use, sum10.stream.use / 10, sum30.stream.use / 30, sum60.stream.use / 60, sum120.stream.use / 120, s->stream.total, s->stream.max, s->stream.fail); tprint(buf, 16, 3); sprintf(buf, "%6d%6d%6d%6d%7d%8d%8d%8d", s->queue.use, sum10.queue.use / 10, sum30.queue.use / 30, sum60.queue.use / 60, sum120.queue.use / 120, s->queue.total, s->queue.max, s->queue.fail); tprint(buf, 16, 4); sprintf(buf, "%6d%6d%6d%6d%7d%8d%8d%8d", s->mblock.use, sum10.mblock.use / 10, sum30.mblock.use / 30, sum60.mblock.use / 60, sum120.mblock.use / 120, s->mblock.total, s->mblock.max, s->mblock.fail); tprint(buf, 16, 5); sprintf(buf, "%6d%6d%6d%6d%7d%8d%8d%8d", s->dblock.use, sum10.dblock.use / 10, sum30.dblock.use / 30, sum60.dblock.use / 60, sum120.dblock.use / 120, s->dblock.total, s->dblock.max, s->dblock.fail); tprint(buf, 16, 6); for (i=0; i<NCLASS; ++i) { mem += s->dblk[i].use * rbsize[i]; sprintf(buf, "%6d%6d%6d%6d%7d%8d%8d%8d", s->dblk[i].use, sum10.dblk[i].use / 10, sum30.dblk[i].use / 30, sum60.dblk[i].use / 60, sum120.dblk[i].use / 120, s->dblk[i].total, s->dblk[i].max, s->dblk[i].fail); tprint(buf, 16, 9 + i); } sprintf(buf, "%d/%d Kbytes", kbytes(mem), kbytes(total)); tprint(buf, 23, 23); calls++; sprintf(buf, "Calls=%d", calls); tprint(buf, 10, 0); } /* * add a to be, leave result in b * * N.B. Assumes that elements are ints */ addstrst(a, b) register alcdat* a; register alcdat* b; { register i; for (i=sizeof(struct strstat)/sizeof(*a); i--; (b++)->use += (a++)->use) ; } /* * subtract a from be, result in b */ substrst(a, b) register alcdat* a; register alcdat* b; { register i; for (i=sizeof(struct strstat)/sizeof(*a); i--; (b++)->use -= (a++)->use) ; } /* * multiply a by b, result in a */ mulstrst(a, b) register alcdat* a; register int b; { register i; for (i=sizeof(struct strstat)/sizeof(*a); i--; (a++)->use *= b) ; } # endif /* SAVECNT */ /* * nasty cleanup */ error(s) char* s; { perror(s); done(); } /* * nice cleanup */ done() { echo(1); cbreak(0); delay(1); tprint("", cols -1, lines - 1); printf("\n"); exit(0); } /* * read all once only stuff from kmem */ readstuff() { register i; if (!nl[NL_RBSIZE].n_value) { printf("%s: no value\n", nl[NL_RBSIZE].n_name); exit(1); } if (!nl[NL_STRST].n_value) { printf("%s: no value\n", nl[NL_STRST].n_name); exit(1); } # ifdef sun if (!nl[NL_NDBLKS].n_value) { printf("%s: no value\n", nl[NL_NDBLKS].n_name); # else if (!nl[NL_V].n_value) { printf("%s: no value\n", nl[NL_V].n_name); # endif exit(1); } if (!nl[NL_DBALLOC].n_value) { printf("%s: no value\n", nl[NL_DBALLOC].n_name); exit(1); } if (!nl[NL_NMBLOCK].n_value) { printf("%s: no value\n", nl[NL_NMBLOCK].n_name); exit(1); } if (lseek(fd, nl[NL_RBSIZE].n_value, 0) == -1) error("lseek"); if (read(fd, rbsize, sizeof(rbsize)) != sizeof(rbsize)) error("read"); # ifdef sun if (lseek(fd, nl[NL_NDBLKS].n_value, 0) == -1) error("lseek"); if (read(fd, cnt, sizeof(cnt)) != sizeof(cnt)) error("read"); # else if (lseek(fd, nl[NL_V].n_value, 0) == -1) error("lseek"); if (read(fd, &v, sizeof(v)) != sizeof(v)) error("read"); # endif # ifdef sun if (lseek(fd, nl[NL_DBALLOC].n_value, 0) == -1) error("lseek"); if (read(fd, &nl[NL_DBALLOC].n_value, sizeof(int)) != sizeof(int)) error("read"); # endif if (lseek(fd, nl[NL_DBALLOC].n_value, 0) == -1) error("lseek"); if (read(fd, dballoc, sizeof(dballoc)) != sizeof(dballoc)) error("read"); if (lseek(fd, nl[NL_NMBLOCK].n_value, 0) == -1) error("lseek"); if (read(fd, &nmblock, sizeof(nmblock)) != sizeof(nmblock)) error("read"); # ifdef sun if (lseek(fd, nl[NL_STRST].n_value, 0) == -1) error("lseek"); if (read(fd, &nl[NL_STRST].n_value, sizeof(int)) != sizeof(int)) error("read"); # endif } //E*O*F sw.c// echo x - term.h cat > "term.h" << '//E*O*F term.h//' # ifndef _TERM_H_ #include <stdio.h> #include <sgtty.h> char *getenv(); char *tgetstr(); char PC; short ospeed; short lines; short cols; char ceolbuf[20]; char clbuf[20]; char pcbuf[20]; char cmbuf[20]; #undef putchar int putchar(); char term_buf[1024]; # endif _TERM_H_ //E*O*F term.h// echo x - termcap.c cat > "termcap.c" << '//E*O*F termcap.c//' /* * copyright (C) 1986 by Larry McVoy * MUST be distributed in source form only. */ # include "term.h" char* tgoto(); /*------------------------------------------------------------------15/Dec/86-* * init_term - read in the termcap stuff *----------------------------------------------------------------larry mcvoy-*/ termcap() { char *cp = getenv("TERM"); char *foo; char garbage[10]; struct sgttyb tty; gtty(1, &tty); ospeed = tty.sg_ospeed; if (cp == (char *) 0) return -1; if (tgetent(term_buf, cp) != 1) exit(1); foo = garbage; foo = tgetstr("pc", &foo); if (foo) PC = *foo; foo = clbuf; tgetstr("cl", &foo); foo = ceolbuf; tgetstr("ce", &foo); foo = cmbuf; tgetstr("cm", &foo); lines = tgetnum("li"); cols = tgetnum("co"); return 0; } /* clear to end of line */ ceol(col, row) { char *foo = tgoto(cmbuf, col, row); write(1, foo, strlen(foo)); tputs(ceolbuf, 1, putchar); } /* clear screen */ clear() { tputs(clbuf, lines, putchar); } /*------------------------------------------------------------------15/Dec/86-* * tputchar(c, col, row) - put a single char on the screen * * Inputs ----> (char), (int), (int) * * Bugs ------> Assumes that the coords make sense * * Revisions: *----------------------------------------------------------------larry mcvoy-*/ tputchar(c, col, row) char c; { register char* foo; foo = tgoto(cmbuf, col, row); tputs(foo, lines, putchar); write(1, &c, 1); } /*------------------------------------------------------------------15/Dec/86-* * tprint(s, col, row) - put a string on the screen * * Inputs ----> (char), (int), (int) * * Results ---> Puts the string out iff it will fit. * * Revisions: *----------------------------------------------------------------larry mcvoy-*/ tprint(s, col, row) register char* s; { register char* foo; if (row > lines || col > cols) return -1; if (strlen(s) > cols - col) return -2; foo = tgoto(cmbuf, col, row); tputs(foo, lines, putchar); return write(1, s, strlen(s)); } /* fake putchar for tputs */ putchar(c) char c; { write(1, &c, 1); } //E*O*F termcap.c// echo Possible errors detected by \'wc\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 17 53 336 Makefile 57 120 878 mode.c 63 359 2087 sw.1 563 1521 12403 sw.c 19 36 278 term.h 104 281 2203 termcap.c 823 2370 18185 total !!! wc Makefile mode.c sw.1 sw.c term.h termcap.c | sed 's=[^ ]*/==' | diff -b $temp - exit 0 --- Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com ----------------------------- From: iccad <adley@herbie.misemi> Subject: nested loops Date: 9 Aug 90 19:17:28 GMT To: unix-wizards@sem.brl.mil Hi, We are trying to write a Bourne shell script that includes two nested loops as follows !# /bin/sh this="one two three" that="four five six seven" them="eight nine ten" all="this that them" # for i in $all do for j in $`echo $i` do echo $i $j done done we want (and expected!) the output: this one this two this three that four that five that six that seven them eight them nine them ten The problem lies in the $`echo $i` statment the `echo $i` preforms as expected and the result is one of this, that, or them the $ infront of this statment however is taken as a literal $ and does not return the value of the variable this or that or them instead it returns $this or $that or $them. Does anybody know why this happens or how we can get the results that would be expected here (with the exception of doing it in a C shell or in a C program). Thanks. ----------------------------- From: Gilles Courcoux <gilles@pase60.convergent.com> Subject: Re: nested loops Date: 10 Aug 90 16:15:51 GMT Sender: root@risky.convergent.com To: unix-wizards@sem.brl.mil In article <4103@herbie.misemi> you wrote: >The problem lies in the $`echo $i` statment Right, double variable expansion like that is resolved through the use of the eval(1) command as in : eval echo '$'$i When the shell read the command, it expands it into eval echo $them # the first time ! and then eval(1) do his job : evaluating its arguments, including variables expansion and then execute the command which is by now : echo one two three The echo(1) command is needed because eval(1) then exec(2)utes its first argument. Your script become : this="one two three" that="four five six seven" them="eight nine ten" all="this that them" # for i in $all do for j in `eval echo '$'$i` do echo $i $j done done Have a nice day, Gilles Courcoux E-mail: sun!pyramid!ctnews!pase60!gilles Unisys Network Computing Group Phone: (408) 435-7692 ----------------------------- From: Chet Ramey <chet@cwns1.INS.CWRU.Edu> Subject: Re: nested loops Date: 10 Aug 90 19:28:41 GMT Sender: news@usenet.ins.cwru.edu To: unix-wizards@sem.brl.mil In article <4103@herbie.misemi> adley@herbie.misemi ( iccad) writes: $ !# /bin/sh $ this="one two three" $ that="four five six seven" $ them="eight nine ten" $ all="this that them" $ # $ for i in $all $ do $ for j in $`echo $i` $ do $ echo $i $j $ done $ done $ The problem lies in the $`echo $i` statment $ the `echo $i` preforms as expected and the result is one of this, $ that, or them $ the $ infront of this statment however is taken as a literal $ $ and does not return the value of the variable this or that or them $ instead it returns $this or $that or $them. Use `eval'. Chet -- Chet Ramey ``Levi Stubbs' tears run down Network Services Group his face...'' Case Western Reserve University chet@ins.CWRU.Edu ----------------------------- From: Mitch Wright <mitch@hq.af.mil> Subject: waitpid() ??? Date: 10 Aug 90 04:20:07 GMT Sender: mitch@hq.af.mil To: unix-wizards@sem.brl.mil Greetings! I was recently flipping through the source of ksh(1), humbly admiring the work of David Korn, when I came across a function called waitpid(). I quickly grep'ed through the code to see if I could find where this function was defined, since I was not aware of a system call by this name. Well, I found no definition for this call in the code or in the few SYSV programming manuals that I have. Does anyone have an idea exactly what this call does? Since it is in the middle of the job control routines, I'd assume it was similar to wait3() in the Bezerkely world, but the parameters seem to be out of whack, and all three of them are integers instead of 1 int, 1 union wait *, and a struct rusage *. A man-page would be fine, but I'd prefer not only a man page, but a *real* description of what this puppy does. Thanks! -- ..mitch mitch@hq.af.mil (Mitch Wright) | The Pentagon, 1B1046 | (202) 695-0262 The two most common things in the universe are hydrogen and stupidity, but not necessarily in that order. ----------------------------- From: Boy named Superuser <root@storm.uucp> Subject: unix sys v - uptime question Date: 10 Aug 90 06:00:43 GMT To: unix-wizards@sem.brl.mil Does anyone out there know how to get Unix sys V/386 (sco) to display load averages. The man pages say that uptime "displays the load averages over 1 5 and 15 minutes" on "systems that maintain the necessary data." However, I cannot seem to find out how to get the system to keep the necessary data. Can anyone out there help? Thanks! root@storm.uucp@skinner.cs.uoregon.edu ----------------------------- From: Devon Tuck <tuck@iris.ucdavis.edu> Subject: Interesting keyboard read problem (ioctl, function keys) Date: 10 Aug 90 08:10:33 GMT Sender: usenet@ucdavis.ucdavis.edu To: unix-wizards@sem.brl.mil Hey wizards, I have been working with an intersting problem... How to write a keyboard input routine that does not mess up its' transmission of repeated function keys. You might have noticed that even in vi, and in the C-shell, if you sit on an arrow key or some other function key that maps to a character sequence, you get intermittent beeps, or stray characters, respectively. I am porting an editor for a bunch of users who are in deep wedlock with their function keys, and they MUST be able to sit on their little arrow keys and not lose any characters, BUT character throughput must be VERY FAST. The problem is that this editor is very bulky, and spends too much time away from the keyboard input routine, so that if I do the logical thing and set VMIN=1 and VTIME=0, portions of the home key sequence (<ESC>[H), for example, get split across network packets and arrive with too much gap for the keyboard driver to consider it a valid screen movement sequence. Has anyone solved this problem? I think I might have it with a routine that forks on its' first call, after setting up a pipe and ioctl calls, (VMIN=0, VTIME=0) and thus leaves a small subprocess running alongside the editor acting as a slave to the keyboard and sending all characters into a pipe to be read at the leasure of the main character input routine. How do other editors do it? How do Crisp, emacs, etc. handle this? (as I mentioned, vi doesn't..) Thanks, Devon Tuck tuck@iris.ucdavis.edu PS - Incidentally, when I use a straight character read with VMIN>=1, VTIME=1 the input is still too slow. ----------------------------- From: Steve Perryman <skp@stl.stc.co.uk> Subject: sockets and signals (in C) Date: 10 Aug 90 08:45:16 GMT Sender: news@stl.stc.co.uk To: unix-wizards@sem.brl.mil Does anyone know of a way to set up a signal handler such that if a flood of data comes in to a socket, the SIGIO/SIGPOLL (maybe even SIGURG) signal can invoke a handler fast enough such that a variable can be incremented to represent the correct number of data items at the socket. The signal handler will be : void catch() { signal(SIGIO,catch) ; count++ ; ... /* Process the signal */ ... } I've used fcntl to allow the socket to interrupt : fcntl(sock,F_SETOWN,getpid()) ; fcntl(sock,F_SETFL,F_ASYNC) ; ... ... This works but it can't log the correct number of items received if they come in as bursts of data (5+ items per burst). Can this timing problem be resolved using SIGIO , or is another way required ??? skp ----------------------------- From: Larry McVoy <lm@snafu.sun.com> Subject: Re: sockets and signals (in C) Date: 10 Aug 90 18:49:12 GMT Sender: news@sun.eng.sun.com To: unix-wizards@sem.brl.mil In article <3304@stl.stc.co.uk> "Steve Perryman " <skp@stl.stc.co.uk> writes: > >Does anyone know of a way to set up a signal handler such that if a flood >of data comes in to a socket, the SIGIO/SIGPOLL (maybe even SIGURG) signal >can invoke a handler fast enough such that a variable can be incremented to >represent the correct number of data items at the socket. > >This works but it can't log the correct number of items received if they come >in as bursts of data (5+ items per burst). Can this timing problem be resolved >using SIGIO , or is another way required ??? This can't be done with Unix signals. Unix signals don't stack, i.e., if you hit yout interrupt character several times before the kernel delivers the signal, the application will only see one signal. About the best you can do for you application is to use sigio as a hint that there is data waiting and schedule a timeout every second or so to collect what you might have missed. It's also a good idea to code your processing like so: for ( ;; ) { sigpause(0); while (more_data()) { process_data(); } } rather than for ( ;; ) { sigpause(0); if (more_data()) { process_data(); } } --- Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com ----------------------------- From: Kishore Seshadri <kseshadr@quasar.intel.com> Subject: Re: Re.: UNdeleting files Date: 10 Aug 90 14:51:06 GMT Sender: news@inews.intel.com To: unix-wizards@sem.brl.mil In article <7410002@hpfcmgw.HP.COM>, munir@hpfcmgw (Munir Mallal) writes: >>>A similar thing has just happened here, and we don't have fsdb either. >>>The machine has been untouched since the directory was deleted. >>>Any suggestions ? >> > >Whether done with fsdb or not, the task is to read the disk > >partition block by block, check each block to determine whether > >it's part of the data to be recovered, and reassemble the recovered > >blocks. > >You can use adb if you have it, but will have to do a lot of math to determine >offsets etc. > I have a binary file modifier called fm that I pulled off comp.sources.misc that can be used to edit devices and binary files. Once again if you do the math beforehand this program may be of help in this situation. The devices can be edited in either hex or ascii modes and simple string searches can be handled. You should probably have a good understanding of the way the file system has been implemented before fooling with this. Kishore Seshadri ---------------------------------------------------------------------------- Kishore Seshadri <kseshadr@mipos3.intel.com> or <..!intelca!mipos3!kseshadr> "The nice thing about standards is that you have so many to choose from." ----------------------------- From: Scott McGregor <mcgregor@hemlock.atherton.com> Subject: seeking information about file system details. Date: 10 Aug 90 17:12:33 GMT Sender: news@athertn.atherton.com To: unix-wizards@sem.brl.mil I am curious as to how accesses to multiple concurrent types of file systems are implemented under SysV and BSD. I've read the Bach book and the BSD book, as well as books on device drivers. But what I am more interested in is at the switchable file system layer. Explanations of what goes on in the following example are welcome, recommendations of books that cover this stuff is even more heartily desired. I know that mount takes a file type. I know how the file system tree is traced using inodes, and I have heard of vnodes (which is what I think I want to know more about) but I haven't found anything written on vnodes. I am aware that several vendors support multiple varieties of file systems (Bell, BSD, NFS, MS-DOS) all accessable on the same system, and the files on them can be accessed using standard o/s calls and stdio library routines. I guess what I am interested in is if I have a non-unix file system and I want to allow the this file system to be mounted as a unix file system, and accessed using open, creat, read, write, close, et al, what interface translators would I have to create between my own file system and the unix system calls, and how and where would I add typically add these translators. I presume that a new type would have to be tested for in mount, and that the open, etc. commands would have to know what type of file system they were operating on and that a case statement switch would have to be supported by them for each new type of file system to be supported. Is this correct, or is there some other way that the switching between file systems is handled. Mail can be directed to: mcgregor@atherton.com or ...!sun!atherton!mcgregor Scott McGregor Atherton Technology ----------------------------- From: Chris Bertin <chrisb@risky.convergent.com> Subject: evaluating ${10} and above in sh/ksh Keywords: sh, ksh, eval Date: 10 Aug 90 17:58:37 GMT To: unix-wizards@sem.brl.mil There doesn't seem to be a way, in sh or ksh, to evaluate $10 and higher. $10 and higher are evaluated as ${1}0, ${1}1, etc... instead of ${10}, ${11}, etc... I have tried many different ways and they all fail. Do you know one that will work? #! /bin/sh set a b c d e f g h i j k l arg=0 while [ $arg -le $# ]; do echo "evaluating \$$arg" eval echo $"$arg" eval echo $"${arg}" eval echo "$`eval echo $arg`" # Now, some of the crazy things I tried. # ( The parens are there when eval causes an error ) echo "\${$arg} results in \c" ( eval echo "\${$arg}" ) echo "$`echo '{'``eval echo $arg``echo '}'` results in \c" ( eval echo "$`echo '{'``eval echo $arg``echo '}'`" ) arg=`expr $arg + 1` done -- Chris Bertin | chrisb@risky.Convergent.COM Unisys | or (408) 435-3762 | ...!uunet!pyramid!ctnews!risky!chrisb ----------------------------- From: Chet Ramey <chet@cwns1.cwru.edu> Subject: Re: How variables can be specified as arguments Date: 10 Aug 90 19:24:41 GMT Sender: news@usenet.ins.cwru.edu To: unix-wizards@sem.brl.mil In article <7298@helios.TAMU.EDU> skdutta@cs.tamu.edu (Saumen K Dutta) writes: $ read_KEY1 "key" $ $ should define a new variable called key and $ assigns it's value according to what user types. $ $ I am not able to solve this ! Please help me Use `eval'. Chet -- Chet Ramey ``Levi Stubbs' tears run down Network Services Group his face...'' Case Western Reserve University chet@ins.CWRU.Edu ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: ln -f Date: 10 Aug 90 20:19:01 GMT To: unix-wizards@sem.brl.mil >Why don't the versions of ln that you know of on 4.3 BSD and SunOS 4 >use the rename system call? Because they're named "ln", not "mv". "rename()" is *NOT* an atomic operation that removes the target and makes an *additional* link from the source with the name of the target. It's an atomic operation that *renames* the source to the target, and if it succeeds does *not* leave the source behind. ----------------------------- From: "David J. MacKenzie" <djm@eng.umd.edu> Subject: Re: ln -f Date: 10 Aug 90 22:54:43 GMT Sender: The News System <news@eng.umd.edu> To: unix-wizards@sem.brl.mil > Why don't the versions of ln that you know of on 4.3 BSD and SunOS 4 > use the rename system call? Because rename doesn't do the same thing as ln. If before you run ln, the file has n links, after you run ln successfully the file will have n + 1 links. If you just rename the file, it will still have n links, but one of them will be different from before. -- David J. MacKenzie <djm@eng.umd.edu> <djm@ai.mit.edu> ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@ecf.ncsl.nist.gov (SMTP MAILER) (08/12/90)
----Reason for mail failure follows---- Sending mail to host ecf.ncsl.nist.gov : Fatal reply code to command 'RCPT TO:<ise.ncsl.nist.gov@ecf.ncsl.nist.gov>': 550 User "ise.ncsl.nist.gov" Unknown. ----Transcript of message follows---- Date: 12 Aug 90 06:39:00 EST From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#114 To: "ise.ncsl.nist.gov" <ise.ncsl.nist.gov@ecf.ncsl.nist.gov> Return-Path: <unixwiz-request@ecf.ncsl.nist.gov> Received: from SEM.BRL.MIL by ecf.ncsl.nist.gov with SMTP ; Sun, 12 Aug 90 06:39:09 EST Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa06918; 12 Aug 90 5:56 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa06856; 12 Aug 90 5:45 EDT Date: Sun, 12 Aug 90 05:45:05 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#114 Message-ID: <9008120545.aa06856@SEM.BRL.MIL> UNIX-WIZARDS Digest Sun, 12 Aug 1990 V10#114 Today's Topics: Re: Help needed with System V message queues Re: Cron - First Saturday of the month waitpid() ??? seeking information about file system details. Re: cd failure killing script [Re: Interactive 2.2 File zapper] Re: sockets and signals (in C) Re: nested loops Re: ln -f Re: Getting CPU information on unterminatted child processes Reading escape sequences (arrow keys and escape alone) ----------------------------------------------------------------- From: George Bogatko <bogatko@lzga.att.com> Subject: Re: Help needed with System V message queues Keywords: SYSV messagequeue Date: 8 Aug 90 16:51:25 GMT To: unix-wizards@sem.brl.mil Postnews (or something) trashed the ending of the message queue article. Here's the ending. ****** When sending messages, the third parameter must be the size of the actual message, not the size of the 'struct msgbuf', which will be sizeof(long) bytes bigger. If you don't pay attention to this, you will get message trashing. I can't recall now how, when, or why this happens, but I guarantee that it will be mysterious, and usually fatal. struct msgbuf { long mtype; /* message type */ char mtext[1]; /* message text */ }; So the safe way to use 'msgsnd' is: typedef struct { long mtype; struct { char buf[10]; int xxx; double yyy; etc... } mtext; } MSG; MSG message; 1. msgsnd( msqid, &message, sizeof(message.mtext), 0); OR 2. msgsnd( msqid, &message, sizeof(message)-sizeof(long), 0); I prefer #1. I also prefer to send message with the fourth parameter as 0. This will make the message block if there is no room at the time. It is more normal for the message to block in a heavily loaded system then not, so you will probably NOT want to die if you can't send the message because there's no room. If you are worried about deadlock, put in an alarm call so you can time out. When receiving messages, check for EINTR if you get a -1. You will usually want to just wrap around and try again if you get an interrupt (usually from an alarm call, or some other friendly signal). Hope this (long-winded) yakking helps somebody. GB ----------------------------- From: Bob Strait <rls@svcs1.uucp> Subject: Re: Cron - First Saturday of the month Date: 9 Aug 90 17:13:32 GMT To: unix-wizards@sem.brl.mil In article <19744@orstcs.CS.ORST.EDU> curt@oce.orst.edu (Curt Vandetta) writes: > I'm wondering if anyone has a way of making cron run a job on the > first Saturday of every month? > How about running your job each of the first seven days of every month, and have the job first test whether it's Saturday and exit if it's not. There are several easy ways to do the test: 'date | grep Sat' comes to mind. -- BUBBA (aka Bob Strait) ...!mips!svcs1!rls Silicon Valley Computer Society Sunnyvale, CA -- ----------------------------- From: Bob McGowen x4312 dept208 <bob@wyse.wyse.com> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 02:40:29 GMT Sender: news@wyse.wyse.com To: unix-wizards@sem.brl.mil In article <1990Aug8.185745.16606@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article <19744@orstcs.CS.ORST.EDU>, curt@oce (Curt Vandetta) writes: >| I'm wondering if anyone has a way of making cron run a job on the >| first Saturday of every month? > >3 4 1-7 * 6 command > >to make 'command' run at 4:03am... adjust the first two fields as >necessary. Remember, the parameters are "and"-ed together. ...flame deleted My documentation states that a line like the one you have provided would cause the command to run on EVERY Saturday as well as on each of the first seven days in the month. My flame-- I would be very interested if you could provide a cron only method of getting my cron to execute on the first Saturday (or any other day) such that it executes on that single day only. My attempts at solving this have been to combine cron to run the command on Saturday and have command be a script that checks the date to be sure it is less than or equal to 7. But this only works for the first 13 days so I have to figure out the next exclusion, probably to limit between a start and stop. In any case, getting cron to do what Curt wants is a little more difficult. Possibly (probably, I think) even wizard caliber. Bob McGowan (standard disclaimer, these are my own ...) Product Support, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com ----------------------------- From: Ronald S H Khoo <ronald@robobar.co.uk> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 19:05:17 GMT To: unix-wizards@sem.brl.mil In article <1990Aug10.063819.5253@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: > Sigh. Sorry. I'll crawl under my rock now. Cron's only for the > heavyweights, anyway. System V cron isn't just for heavyweights, though, it's got per-user crontabs, remember, so joe-random-non-wizard who has his own crontab has to understand the manpage. Sigh. Someone once mentioned wanting to write a System V-like cron in perl so he could have per-user crontabs on his machine. I wonder who it was, and how he parsed the manpage ? -- Eunet: Ronald.Khoo@robobar.Co.Uk Phone: +44 81 991 1142 Fax: +44 81 998 8343 Paper: Robobar Ltd. 22 Wadsworth Road, Perivale, Middx., UB6 7JD ENGLAND. ----------------------------- From: kpc <kpc00@juts.ccc.amdahl.com> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 21:49:09 GMT Sender: kpc00@ccc.amdahl.com To: unix-wizards@sem.brl.mil In article <1990Aug10.063819.5253@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: So, they really mucked up when they OR-ed in that day-of-week field. Sigh. Sorry. I'll crawl under my rock now. Cron's only for the heavyweights, anyway. Because it's job security through obscurity :-)? Your posting was good. One might hope that HLL boolean expressions were at least considered in the design of cron. (I hope that this offends nobody. In particular, I hope that the designer of cron is not reading this or is not offended -- it really is a wonderful tool, but why was APL-minus-minus chosen as the time description language? :-)) For UNIX historians: Was an HLL expression syntax ever considered? (Or was the original machine thought to be too slow for it?) Also, now that the OR is in there, which of merlyn's possibilities was correct? It makes one wonder what things, if any, are not possible in cron without putting something in the command to be executed. -- Neither representing any company nor, necessarily, myself. ----------------------------- From: Randal Schwartz <merlyn@iwarp.intel.com> Subject: Re: Cron - First Saturday of the month Date: 10 Aug 90 22:43:31 GMT 6@star.cs.vu Sender: news@iwarp.intel.com To: unix-wizards@sem.brl.mil In article <7286@star.cs.vu.nl>, maart@cs (Maarten Litmaath) writes: | The code: [deleted to protect my eyes, but it *is* the code I remember ...] | The conclusion: the manual and the code contradict each other! | The example | | 0 0 1,15 * 1 | | ...will run the job on each monday whose date is either the 1st or the 15th! | It might be too late to fix the manual... (Grrrr!) Yes, this is my point. Actually, what I think happened is that you posted the V7-derived cron, and Sunos4.1 went to the user-crontab System (blech) V cron, and I suspect that they put some widgets in there to do this stupid "OR" logic that I complained about in my last two postings. Anyone with access to system V source care to comment? Are there some yucky kludges in there? Just another System V disliker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: David Canzi <dmcanzi@watserv1.waterloo.edu> Subject: Re: Cron - First Saturday of the month Date: 11 Aug 90 03:08:18 GMT To: unix-wizards@sem.brl.mil In article <1990Aug8.214539.1264@watserv1.waterloo.edu> I wrote: >In a sh script, it can be done by: > >if [ `date | sed 's/^... ... *\([^ ]*\) .*/\1/'` -le 7 ]; then > ... >fi This is better done using awk: if [ `date | awk '{print $3}'` -le 7 ]; then ... fi -- David Canzi ----------------------------- From: Mitch Wright <mitch@hq.af.mil> Subject: waitpid() ??? Date: 10 Aug 90 04:20:07 GMT Sender: mitch@hq.af.mil To: unix-wizards@sem.brl.mil Greetings! I was recently flipping through the source of ksh(1), humbly admiring the work of David Korn, when I came across a function called waitpid(). I quickly grep'ed through the code to see if I could find where this function was defined, since I was not aware of a system call by this name. Well, I found no definition for this call in the code or in the few SYSV programming manuals that I have. Does anyone have an idea exactly what this call does? Since it is in the middle of the job control routines, I'd assume it was similar to wait3() in the Bezerkely world, but the parameters seem to be out of whack, and all three of them are integers instead of 1 int, 1 union wait *, and a struct rusage *. A man-page would be fine, but I'd prefer not only a man page, but a *real* description of what this puppy does. Thanks! -- ..mitch mitch@hq.af.mil (Mitch Wright) | The Pentagon, 1B1046 | (202) 695-0262 The two most common things in the universe are hydrogen and stupidity, but not necessarily in that order. ----------------------------- From: Scott McGregor <mcgregor@hemlock.atherton.com> Subject: seeking information about file system details. Date: 10 Aug 90 17:12:33 GMT Sender: news@athertn.atherton.com To: unix-wizards@sem.brl.mil I am curious as to how accesses to multiple concurrent types of file systems are implemented under SysV and BSD. I've read the Bach book and the BSD book, as well as books on device drivers. But what I am more interested in is at the switchable file system layer. Explanations of what goes on in the following example are welcome, recommendations of books that cover this stuff is even more heartily desired. I know that mount takes a file type. I know how the file system tree is traced using inodes, and I have heard of vnodes (which is what I think I want to know more about) but I haven't found anything written on vnodes. I am aware that several vendors support multiple varieties of file systems (Bell, BSD, NFS, MS-DOS) all accessable on the same system, and the files on them can be accessed using standard o/s calls and stdio library routines. I guess what I am interested in is if I have a non-unix file system and I want to allow the this file system to be mounted as a unix file system, and accessed using open, creat, read, write, close, et al, what interface translators would I have to create between my own file system and the unix system calls, and how and where would I add typically add these translators. I presume that a new type would have to be tested for in mount, and that the open, etc. commands would have to know what type of file system they were operating on and that a case statement switch would have to be supported by them for each new type of file system to be supported. Is this correct, or is there some other way that the switching between file systems is handled. Mail can be directed to: mcgregor@atherton.com or ...!sun!atherton!mcgregor Scott McGregor Atherton Technology ----------------------------- From: Chip Salzenberg <chip@tct.uucp> Subject: Re: cd failure killing script [Re: Interactive 2.2 File zapper] Date: 10 Aug 90 17:40:46 GMT To: unix-wizards@sem.brl.mil According to davidsen@sixhub.UUCP (bill davidsen): >Yes, only ksh gives you the choice of catching the failure. Bash 1.05 also continues after a "cd" failure. -- Chip Salzenberg at ComDev/TCT <chip@tct.uucp>, <uunet!ateng!tct!chip> ----------------------------- From: Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> Subject: Re: cd failure killing script [Re: Interactive 2.2 File zapper] Date: 11 Aug 90 19:10:53 GMT To: unix-wizards@sem.brl.mil In article <26C2F1A0.205B@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: : According to davidsen@sixhub.UUCP (bill davidsen): : >Yes, only ksh gives you the choice of catching the failure. : : Bash 1.05 also continues after a "cd" failure. Likewise Perl. The idiom to catch the failure is chdir $dir || die "Can't cd to $dir: $!\n"; Larry Wall lwall@jpl-devvax.jpl.nasa.gov ----------------------------- From: Larry McVoy <lm@snafu.sun.com> Subject: Re: sockets and signals (in C) Date: 10 Aug 90 18:49:12 GMT Sender: news@sun.eng.sun.com To: unix-wizards@sem.brl.mil In article <3304@stl.stc.co.uk> "Steve Perryman " <skp@stl.stc.co.uk> writes: > >Does anyone know of a way to set up a signal handler such that if a flood >of data comes in to a socket, the SIGIO/SIGPOLL (maybe even SIGURG) signal >can invoke a handler fast enough such that a variable can be incremented to >represent the correct number of data items at the socket. > >This works but it can't log the correct number of items received if they come >in as bursts of data (5+ items per burst). Can this timing problem be resolved >using SIGIO , or is another way required ??? This can't be done with Unix signals. Unix signals don't stack, i.e., if you hit yout interrupt character several times before the kernel delivers the signal, the application will only see one signal. About the best you can do for you application is to use sigio as a hint that there is data waiting and schedule a timeout every second or so to collect what you might have missed. It's also a good idea to code your processing like so: for ( ;; ) { sigpause(0); while (more_data()) { process_data(); } } rather than for ( ;; ) { sigpause(0); if (more_data()) { process_data(); } } --- Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com ----------------------------- From: Chet Ramey <chet@cwns1.cwru.edu> Subject: Re: nested loops Date: 10 Aug 90 19:28:41 GMT Sender: news@usenet.ins.cwru.edu To: unix-wizards@sem.brl.mil In article <4103@herbie.misemi> adley@herbie.misemi ( iccad) writes: $ !# /bin/sh $ this="one two three" $ that="four five six seven" $ them="eight nine ten" $ all="this that them" $ # $ for i in $all $ do $ for j in $`echo $i` $ do $ echo $i $j $ done $ done $ The problem lies in the $`echo $i` statment $ the `echo $i` preforms as expected and the result is one of this, $ that, or them $ the $ infront of this statment however is taken as a literal $ $ and does not return the value of the variable this or that or them $ instead it returns $this or $that or $them. Use `eval'. Chet -- Chet Ramey ``Levi Stubbs' tears run down Network Services Group his face...'' Case Western Reserve University chet@ins.CWRU.Edu ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: ln -f Date: 10 Aug 90 20:19:01 GMT To: unix-wizards@sem.brl.mil >Why don't the versions of ln that you know of on 4.3 BSD and SunOS 4 >use the rename system call? Because they're named "ln", not "mv". "rename()" is *NOT* an atomic operation that removes the target and makes an *additional* link from the source with the name of the target. It's an atomic operation that *renames* the source to the target, and if it succeeds does *not* leave the source behind. ----------------------------- From: "David J. MacKenzie" <djm@eng.umd.edu> Subject: Re: ln -f Date: 10 Aug 90 22:54:43 GMT Sender: The News System <news@eng.umd.edu> To: unix-wizards@sem.brl.mil > Why don't the versions of ln that you know of on 4.3 BSD and SunOS 4 > use the rename system call? Because rename doesn't do the same thing as ln. If before you run ln, the file has n links, after you run ln successfully the file will have n + 1 links. If you just rename the file, it will still have n links, but one of them will be different from before. -- David J. MacKenzie <djm@eng.umd.edu> <djm@ai.mit.edu> ----------------------------- From: "Jay A. Konigsberg" <jak@sactoh0.uucp> Subject: Re: Getting CPU information on unterminatted child processes Date: 11 Aug 90 09:43:04 GMT To: unix-wizards@sem.brl.mil In article <1990Aug7.215320.13715@mozart.amd.com> leight@mozart.amd.com (Timothy Leight) writes: >I am interested in getting accurate cpu usage information >on unterminated child processes. The getrusage() and/or times() >system calls only return information on terminated children. > >What is the best method for getting this information? > Well, I don't know the best method, but I think I can point you in the right direction (since no one else did). ps -lf will provide much of the information needed, though it may not produce enough and any way you invoke it (peopen or shell script), it will be slow. Another aproach is to get the information directly out of /dev/kmem. However, all I know how to do there is get overall system usage parameters. Specific information of /dev/kmem is probably system specific and un-portable. However, the Sys V and Xenix 2.3.? header file is: /usr/include/sys/sysinfo.h Getting information about kernel level data structures on the net is a little like asking for the moon, no one seems to have it. Anyway, perhaps this post will generate a little discussion. I would like to know more specifics about the Sys V kernel myself. -- ------------------------------------------------------------- Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak If something is worth doing, its worth doing correctly. ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Getting CPU information on unterminatted child processes Date: 11 Aug 90 21:24:08 GMT To: unix-wizards@sem.brl.mil >Getting information about kernel level data structures on the net is >a little like asking for the moon, no one seems to have it. No, it's more like asking for the moon if you're on Jupiter; the appropriate response is "which moon"? Kernel-level data structures differ between different UNIX implementations. ----------------------------- From: David Wright <dwright@wheaton.uucp> Subject: Reading escape sequences (arrow keys and escape alone) Keywords: non-blocking i/o, timers, escape sequences Date: 12 Aug 90 02:26:16 GMT To: unix-wizards@sem.brl.mil System: Ultrix 2.0, vt100 terminals. I am currently writing a C program that takes as input an escape alone, and escape sequences (such as the arrow keys generate, e.g. ^[[A). When my program receives an escape I go into non-blocking mode to check and see if there are any other key-strokes availabile. If there aren't then I assume that an escape by itself has been pressed. If there are, I read them to find out which arrow key was pressed (assuming it was an arrow-key). Unfortunately, this doesn't work to well. If an arrow-key is pressed the individual key-strokes sometimes arrive at a considerable interval. When I check in non-blocking mode to see if there is a character after the initial escape, the next character (e.g. "[") sometimes has not arrived yet, so that it appears as though an escape only was pressed. I have tried to read continuously in non-blocking mode after an escape was pressed. This guarantees that I will see the arrow-key, if one was pressed. However this makes for awkward parsing when I try to see whether an escape only was pressed. If the user presses an escape, followed by a regular character, I have provide for 'ungetting' that character in some way. This is not too hard but seems to lack elegance. Also, it becomes very difficult if the escape is followed by something like another arrow-key. Then there are three characters available after the escape, and this is a mess. What I am wondering is if there is some elegant solution for waiting a set period of time after esape is pressed? Then I could wait for a while, say 1/2 second, and check if there are any characters after the escape. I have tried a sleep(1), but this can result in a wait of up to 2 seconds. I know there is way of doing what I want to do on SYS V. (Turning off ICANON and using VMIN and VTIME). Please respond via E-mail, unless you think it's something everyone would benefit from. I will sumarize. Sections of code welcomed. Thanks in advance for your help, David Wright, dwright@wheaton.uucp ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@ecf.ncsl.nist.gov (SMTP MAILER) (08/13/90)
----Reason for mail failure follows---- Sending mail to host ecf.ncsl.nist.gov : Fatal reply code to command 'RCPT TO:<ise.ncsl.nist.gov@ecf.ncsl.nist.gov>': 550 User "ise.ncsl.nist.gov" Unknown. ----Transcript of message follows---- Date: 13 Aug 90 06:45:00 EST From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#115 To: "ise.ncsl.nist.gov" <ise.ncsl.nist.gov@ecf.ncsl.nist.gov> Return-Path: <unixwiz-request@ecf.ncsl.nist.gov> Received: from SEM.BRL.MIL by ecf.ncsl.nist.gov with SMTP ; Mon, 13 Aug 90 06:44:51 EST Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa02332; 13 Aug 90 5:59 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa02296; 13 Aug 90 5:45 EDT Date: Mon, 13 Aug 90 05:45:04 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#115 Message-ID: <9008130545.aa02296@SEM.BRL.MIL> UNIX-WIZARDS Digest Mon, 13 Aug 1990 V10#115 Today's Topics: Re: Help needed with System V message queues Re: nested loops evaluating ${10} and above in sh/ksh Re: Getting CPU information on unterminatted child processes Re: Cron - First Saturday of the month ----------------------------------------------------------------- From: George Bogatko <bogatko@lzga.att.com> Subject: Re: Help needed with System V message queues Keywords: SYSV messagequeue Date: 8 Aug 90 16:36:56 GMT To: unix-wizards@sem.brl.mil HI: A while ago, I got sick of wondering what the tunables for messages meant. The result was a writeup which was begun, interrupted, and never finished. This is what remains of it. It is 500+ lines long, so you may want to skip all this if message queues leave you cold. After it, in a second posting is a 'pic' file of how messages are stored in memory. This may answer some questions about message queues, and how they work. If I see enough interest, I may finish the writeup. ************ OVERVIEW In /etc/master.d there is a file, called msg that contains the tunable parameters for the device driver that handles the UNIXTM message queue system. This file contains lines similar to the following: MSGMAP = 100 MSGMAX = 2048 MSGMNB = 4096 MSGMNI = 50 MSGSSZ = 8 MSGTQL = 40 MSGSEG = 1024 The meaning of these parameters, as stated in the manual Operations and Administration Series: Performance Mangement under the chapter Tunable Parameters Definitions is: MSGMAP specifies the size of the memory control map used to manage message segments. If this value is insufficient to handle the message type facilities, a warning message is sent ot the console. MSGMAX specifies in bytes the maximum size of a message sent. When receiving a message, a value larger than this parameter can be used to ensure that the whole message is received and not truncated. MSGMNB specifies the maximum length, in bytes of a message queue. The owner of a facility can lower this value, but only the superuser can raise it. MSGSEG Specifies the number of message segments in the system. MSGSEG * MSGSSZ should be less than 131,072 bytes (128 kilobytes). MSGSSZ specifies the size in bytes of a message segment as stored in memory. Each message is stored in a contiguous message segment. The larger the segments are, the greater the chance of having wasted memory at the end of each message. MSGSSZ * MSGSEG should be less than 131,072 bytes (128 kilobytes). MSGTQL specifies the number of message queue headers on all message queues sytem-wide, and thus, the number of outstanding messages. These values are stored in a structure called "struct msginfo" which looks like this: struct msginfo { int msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql; ushort msgseg; }; This structure is used when the MSG driver is initialized. Notice that the values are stored as INTS. This bites you in the butt later on when the value of 'msgmnb' is put into 'msg_qbytes'. All the structures described here are found in '/usr/include/sys/msg.h' There are four data structures used in the message queue universe. struct msgbuf This is actually a template used by the user to hold the message; it is assumed (incorrectly) that the user knows enough to re-write this template to suit their needs. The structure given in the header file msg.h is never used. The only thing that must be here is the member "long mtype". which must always be the first member. The template looks like this: struct msgbuf { long mtype; /* message type */ char mtext[1]; /* message text */ }; Notice that the size of mtext is one (1). This is not enough size to hold anything useful. Newcomers to UNIXTM messages almost always bark their shins on this one. struct msg This is the structure that points to the address of the actual message in the message pool. It looks like this: struct msg { struct msg *msg_next; long msg_type; short msg_ts; short msg_spot; }; The message queue driver keeps these structures, called message headers in an array, whose size is determined by the tunable parameter MSGTQL. Each outstanding message, i.e. a message that has been sent but not yet received, has one of these headers associated with it. Thus the number of outstanding messages handled by the driver is determined by the setting of MSGTQL. The members of the structure are used as: msg_next Even though these headers are in an array, they are handled like a linked list. This member points to the next header, which is located somewhere in the array. msg_type This corresponds to the long mtype member of the msgbuf structure shown above. msg_ts This is the precise length in bytes of the message that is stored in the message pool. msg_spot This is the location in the message pool of the message. Notice that it is not a pointer. It is really an offset. struct msqid_ds This is the structure that keeps vital statistics about a particular message queue that is being serviced by the driver. It looks like this: struct msqid_ds { struct ipc_perm msg_perm struct msg *msg_first; struct msg *msg_last; ushort msg_cbytes; ushort msg_qnum ushort msg_qbytes; ushort msg_lspid; ushort msg_lrpid; time_t msg_stime; time_t msg_rtime; time_t msg_ctime; }; The driver keeps these structures in an array, whose size is determined by the tunable parameter MSGMNI. Thus the maximum number of message queues handled by the driver is determined by the setting of MSGMNI. The members of the structure are used as: msg_perm This is a structure located in ipc.h that contains various permissions and ids. It looks like this: struct ipc_perm { ushort uid; /* owner's user id */ ushort gid; /* owner's group id */ ushort cuid; /* creator's user id */ ushort cgid; /* creator's group id */ ushort mode; /* access modes */ ushort seq; /* slot usage sequence number */ key_t key; /* key */ }; This structure is used by all the drivers in the IPC system. The meaning of these variables is clear from their names, and the comments; except for seq. This variable holds a sequence number that is used to determine the msqid that is returned from the msgget() call. By constantly incrementing this number, one can be sure that the same message queue header will not have the same msqid returned when it is re-allocated. msg_first This is a pointer to the first struct msg member in the linked list of struct msg message headers. msg_last This is a pointer to the last struct msg member in the linked list of struct msg message headers. msg_cbytes This is the total number of bytes currently on the queue. It represents the accumulated total of all the values of the struct msg member msg_ts in the linked list of outstanding message headers for that particular queue. msg_qnum This is how many messages are outstanding on the queue; and thus how many struct msg message headers are linked to this queue header. msg_qbytes This is an upper limit of how many bytes can be outstanding on the queue. This is an arbitrary value, which is set from the value of the tunable parameter MSGMNB. This means that raising or lowering this value does not alter how many total messages you can have handled by the driver. That is determined by the size of the message pool. This value can be altered by either the owner/creator of the message queue, or the super-user, without having to change the value of MSGMNB. msg_lspid The process id of the last process to send a message. msg_lrpid The process id of the last process to receive a message. msg_stime The last time a message was put on this queue. msg_rtime The last time a message was taken off this queue. msg_ctime The last time anything at all happened regarding this header. The message pool There is no formal name for the pool in the msg.h structure. The message pool is an amorphous blob of memory. It is obtained by a call to the kernel function kseg() which returns the base address of a segment of kernel memory. This address is cast to type paddr_t (physical address type) which on the 3B2 line is a long. It is treated as a contiguous array of single bytes. Think of it as a char array. This size of this blob is determined by multiplying the values in the two tunable parameters MSGSEG and MSGSSZ. The result of the multiplication is then rounded up to the nearest page size. This size is passed as a parameter to kseg(). The argument to kseg() is a request for pages of memory, in the range 1 - 64. 64 pages (128K) is the upper limit of memory that will be returned by kseg(). This is why the tunable parameters guide mentioned above says: "MSGSSZ * MSGSEG should be less than 131,072 bytes (128 kilobytes)." SENDING A MESSAGE Before diving in to how the driver handles messages, it might be best to present a general picture of how outstanding messages are stored. Recall from part 1 that there are four data structures involved in the process: struct msgbuf, struct msg, struct msqid_ds, and the memory pool. Briefly, the msqid_ds structure points to the first instance of a message header, which is a msg structure. Each message header points to the next message header in the linked list of outstanding messages. Each message header contains the offset in the memory pool where the actual message is being stored. The memory pool is logically divided into segments (of size MSGSSZ), and total number of these segments is of size MSGSEG. When a message is actually stored, it will occupy as much space as necessary, rounded up to the nearest segment size. From this it can be seen that unless the message size aligns with the MSGSSZ segment size, there will be some wasted bytes associated with each stored message. The enclosed diagram Mapping a Message Queue ID to a 28 Byte Message in Kernal Memory displays the association of all these data structures in the job of holding a 28 byte message in memory. **** SEE FOLLOWING POSTING FOR PIC FILE **** 3.1 Conversion of a user supplied message queue ID (msqid) to a pointer to a struct msqid_ds queue header This is a fundamental algorighm in the whole process, and is called from many places in the driver; algorithm 'msgconv' convert msqid to msqid_ds structure { 1. pointer = address of array, offset by msqid modulo MSGMNI 2. lock the reference to the structure 3. if(the structure is not in use) || the sequence number doesn't equal the msqid divided by MSGMNI) return EINVAL 4. return the pointer found in step 1. } step 1. convert msqid to pointer Remember that the msqid_ds structures are held in an array of size MSGMNI. Assuming that the call msgget() works correctly (it does), the msqid that is returned from that call will always be the result of an incrementing sequence number (remember struct ipc_perm.ushort seq?) times the value of MSGMNI, plus the offset into the msqid_ds array of the assigned message header. Thus if MSGMNI is 100, the sequence number 3, and the offset 30, the message queue id returned by msgget() would be 330. The line that converts the msqid back to the offset is simply: qp = &msgque[id % msginfo.msgmni]; Which is to say that the offset of the array (here msgque) is msqid modulo MSGMNI. In our example, this would be 30, which is indeed the offset of the array. step 2. Lock the reference to the structure A parallel char array, of size MSGMNI is kept. Once the offset is found, it is used to find the associated lock value in this lock array. As long as this value is 1, the process sleeps (lines 1 and two following). 1 while (*lockp) 2 sleep(lockp, PMSG); 3 *lockp = 1; When another process, which is using this message header, is done, it sets the value of this lock to 0, and issues a wakeup(). Our process then wakes up and now finds the value to be 0. It then stops going to sleep, and locks the value (line 3). This is what allows message queues to act "atomicly" step 3. check the msqid value for validity The value of qp->msg_perm.seq is checked against the value of msqid divided by MSGMNI and if they don't match, then errno is set to EINVAL and the system call returns with an error (-1). In our example, if the msqid is 330, then 330/100 (in integer arithmetic) yields 3, which is indeed the sequence number. Thus the msqid is successfully converted to a valid and active message header. step 4. return the queue pointer 3.2 Sending_a_message Sending a message consists of receiving a buffer from the user, and putting it into the message pool, with proper labeling so that a receive request can copy that message out of the message pool. algorithm 'msgsnd' send a message { 1. convert msqid to msqid_ds pointer (algorighm msgconv) 2. if(access denied by incorrect permissions) return EACCES 3. if(byte count <= 0 || byte count > MSGMAX) return EINVAL 4. copy the message type from the user area return EFAULT on error 5. if(message type <= 0) return EINVAL GETRES: 6. if(queue has been removed or changed) return EIDRM 7. if( (total bytes in queue > MSGMNB) || (no free msg headers available [MSGTQL]) { 8. if(IPC_NOWAIT set) return EAGAIN 9. sleep 10. if(sleep was interrupted) return EINTR 11. goto GETRES } 12. call 'malloc()' to find free slot in message pool. 13. if(no free space in message pool) { if(IPC_NOWAIT set) return EAGAIN sleep if(sleep was interrupted) return EINTR goto GETRES } 14. assuming all is OK, copy from user to message pool. 15. if(system error during copy) { call 'mfree' to mark slot as free return EFAULT } 16. update 'msqid_ds' header 17. initialize 'msg' header 18. link 'msg' header into chain of related 'msg' headers. 19. return 0 } ***************** At this point I was interrupted by real work, and never returned to the writeup. The "Bach Book" has a good writeup on this stuff. A few points however: MSGMAX is not MSGMNB. MSGMAX is the largest message you can send. You can't find out the value of MSGMAX from the msqid_ds structure. MSGMNB can be found out from "msg_qbytes". Recall from the above, that you can reset this to a higher value if you are super-user and always to a lower value if you are the owner. What is important to note however is that this number has nothing to do with capacity of the driver. It is just a number that is compared against. MSGMNB is stored in "struct msginfo" as an INT, but when the driver is initialized, it is transfered to "struct msqid_ds" in member "msg_qbytes" which is a "ushort". Thus while some documentation may say that you can have a high message queue maximum, you can only have the upper limits of a ushort (65535). If you set MSGMNB to a higher value than this, it will wrap, and you will wind up with a lower value. If you want to increase the size of the message pool, increase MSGSEG. NEVER INCREASE MSGSSZ. Recall from above: "The memory pool is logically divided into segments (of size MSGSSZ), and total number of these segments is of size MSGSEG. When a message is actually stored, it will occupy as much space as necessary, rounded up to the nearest segment size. From this it can be seen that unless the message size aligns with the MSGSSZ segment size, there will be some wasted bytes associated with each stored message." This means that if MSGSSZ is 50 bytes, and you have a 10 byte message, you will occupy one slot, and have 40 bytes of wasted storage hanging around. But if you keep the value of 8, then you will occupy 2 slots and have 6 bytes of wasted storage hanging around. See the following posting for a pic file of how this storage works. In the msgsnd description above is: 12. call 'malloc()' to find free slot in message pool. 13. if(no free space in message pool) { if(IPC_NOWAIT set) return EAGAIN sleep if(sleep was interrupted) return EINTR goto GETRES } Notice that there no escape from this if the size of the message you are trying to send is greater then the total amount of memory in the message pool. Thus you can hang forever waiting for enough room to become available. This will be allowed if MSGMNB is set to be greater than ( MSGSSZ * MSGSEG * (sizeof page on your machine (2048 on 3B's) ) ). Be careful when setting the tunables!!! When sending messages, the third parameter must be the size of the actual message, not the size of the 'struct msgbuf', which will be sizeof(long) bytes bigger. If you don't pay attention to this, you will get message trashing. I can't recall now how, when, or why this happens, but I guarantee that it will be mysterious, and usually fatal. struct msgbuf { long mtype; /* message type */ char mtext[1]; /* message text */ }; So the safe way to use 'msgsnd' is: typedef struct { long mtype; struct { char buf[10]; int xxx; double yyy; etc... } mtext; } MSG; MSG message; 1. msgsnd( msqid, &message, sizeof(message.mtext), 0); OR 2. msgsnd( msqid, &message, sizeof(message)-sizeof(long), 0); I prefer #1. I also prefer to send message with the fourth parameter as 0. This will make the message block if there is no room at the time. It is more normal for the message to block in a heavily loaded system then not, so you will probably NOT want to die if you can't send the message because there's no room. If you are worried about deadlock, put in an alarm call so you can time out. When receiving messages, check for EINTR if you get a -1. You will usually want to just wrap around and try again if you get an interrupt (usually from an alarm call, or some other friendly signal). Hope this (long-winded) yakking helps somebody. GB ----------------------------- From: George Bogatko <bogatko@lzga.att.com> Subject: Re: Help needed with System V message queues Keywords: SYSV messagequeue Date: 8 Aug 90 16:38:08 GMT To: unix-wizards@sem.brl.mil HI: here is the pic file for the previous article. ******* .nf .PS scale=100 define t851 | [ box invis ht 74 wid 320 with .sw at 0,0 "\fR\s16\&Mapping a Message Queue ID \f1\s0" at 160,62 "\fR\s16\&to A 28 Byte Message\f1\s0" at 160,37 "\fR\s16\&in Kernal Memory\f1\s0" at 160,12 ] | define t850 | [ box invis ht 56 wid 82 with .sw at 0,0 "\fR\s12\&MESSAGE\f1\s0" at 41,47 "\fR\s12\&QUEUE\f1\s0" at 41,28 "\fR\s12\&ID\f1\s0" at 41,9 ] | define t849 | [ box invis ht 96 wid 16 with .sw at 0,0 "\fR\s10\&M\f1\s0" at 8,88 "\fR\s10\&S\f1\s0" at 8,72 "\fR\s10\&G\f1\s0" at 8,56 "\fR\s10\&T\f1\s0" at 8,40 "\fR\s10\&Q\f1\s0" at 8,24 "\fR\s10\&L\f1\s0" at 8,8 ] | define t848 | [ box invis ht 64 wid 8 with .sw at 0,0 "\fR\s10\&.\f1\s0" at 4,56 "\fR\s10\&.\f1\s0" at 4,40 "\fR\s10\&.\f1\s0" at 4,24 "\fR\s10\&\f1\s0" at 4,8 ] | define t833 | [ box invis ht 96 wid 16 with .sw at 0,0 "\fR\s10\&M\f1\s0" at 8,88 "\fR\s10\&S\f1\s0" at 8,72 "\fR\s10\&G\f1\s0" at 8,56 "\fR\s10\&M\f1\s0" at 8,40 "\fR\s10\&N\f1\s0" at 8,24 "\fR\s10\&I\f1\s0" at 8,8 ] | define t829 | [ box invis ht 64 wid 8 with .sw at 0,0 "\fR\s10\&.\f1\s0" at 4,56 "\fR\s10\&.\f1\s0" at 4,40 "\fR\s10\&.\f1\s0" at 4,24 "\fR\s10\&\f1\s0" at 4,8 ] | define t823 | [ box invis ht 96 wid 40 with .sw at 0,0 "\fR\s10\&M\f1\s0" at 20,88 "\fR\s10\&S\f1\s0" at 20,72 "\fR\s10\&G\f1\s0" at 20,56 "\fR\s10\& S \f1\s0" at 20,40 "\fR\s10\&E\f1\s0" at 20,24 "\fR\s10\&G\f1\s0" at 20,8 ] | define t809 | [ box invis ht 64 wid 8 with .sw at 0,0 "\fR\s10\&.\f1\s0" at 4,56 "\fR\s10\&.\f1\s0" at 4,40 "\fR\s10\&.\f1\s0" at 4,24 "\fR\s10\&\f1\s0" at 4,8 ] | define t800 | [ box invis ht 192 wid 16 with .sw at 0,0 "\fR\s10\&M\f1\s0" at 8,184 "\fR\s10\&A\f1\s0" at 8,168 "\fR\s10\&P\f1\s0" at 8,152 "\fR\s10\&P\f1\s0" at 8,136 "\fR\s10\&E\f1\s0" at 8,120 "\fR\s10\&D\f1\s0" at 8,104 "\fR\s10\&\f1\s0" at 8,88 "\fR\s10\&S\f1\s0" at 8,72 "\fR\s10\&L\f1\s0" at 8,56 "\fR\s10\&O\f1\s0" at 8,40 "\fR\s10\&T\f1\s0" at 8,24 "\fR\s10\&S\f1\s0" at 8,8 ] | define m0 | [ box invis ht 96 wid 32 with .sw at 0,0 line from 16,0 to 16,96 line from 0,0 to 32,0 ] | box invis ht 784 wid 512 with .sw at 0,0 t851 with .nw at 114,780 line from 464,688 to 464,648 line -> from 104,624 to 176,624 t850 with .nw at 11,645 box ht 72 wid 104 with .nw at 0,656 t849 with .nw at 456,634 t848 with .nw at 396,474 "\fR\s10\&struct msg\f1\s0" at 400,406 "\fR\s10\&struct msg\f1\s0" at 400,486 "\fR\s10\&struct msg\f1\s0" at 400,518 "\fR\s10\&struct msg\f1\s0" at 400,502 "\fR\s10\&struct msg\f1\s0" at 400,534 "\fR\s10\&struct msg\f1\s0" at 400,550 "\fR\s10\&struct msg\f1\s0" at 400,566 "\fR\s10\&struct msg\f1\s0" at 400,582 "\fR\s10\&struct msg\f1\s0" at 400,598 "\fR\s10\&struct msg\f1\s0" at 400,614 "\fR\s10\&struct msg\f1\s0" at 400,630 "\fR\s10\&struct msg\f1\s0" at 400,662 "\fR\s10\&struct msg\f1\s0" at 400,646 "\fR\s10\&struct msg\f1\s0" at 400,678 line from 360,416 to 440,416 line from 360,480 to 440,480 line from 360,496 to 440,496 line from 360,512 to 440,512 line from 360,528 to 440,528 line from 360,544 to 440,544 line from 360,560 to 440,560 line from 360,576 to 440,576 line from 360,592 to 440,592 line from 360,608 to 440,608 line from 360,624 to 440,624 line from 360,640 to 440,640 line from 360,656 to 440,656 line from 360,672 to 440,672 box ht 288 wid 80 with .nw at 360,688 line from 448,400 to 480,400 line from 448,688 to 480,688 t833 with .nw at 144,590 "\fR\s10\&struct msqid_ds\f1\s0" at 236,570 "\fR\s10\&struct msqid_ds\f1\s0" at 236,594 "\fR\s10\&struct msqid_ds\f1\s0" at 236,618 t829 with .nw at 232,506 box ht 264 wid 112 with .nw at 176,680 line from 176,440 to 288,440 line from 176,512 to 288,512 line from 176,536 to 288,536 line from 176,560 to 288,560 line from 176,584 to 288,584 line from 176,608 to 288,608 line from 176,632 to 288,632 line from 176,656 to 288,656 "\fR\s10\&struct msqid_ds\f1\s0" at 236,666 "\fR\s10\&struct msqid_ds\f1\s0" at 236,642 "\fR\s10\&struct msqid_ds\f1\s0" at 232,426 "\fR\s10\&struct msqid_ds\f1\s0" at 236,522 "\fR\s10\&struct msqid_ds\f1\s0" at 236,546 line from 136,416 to 168,416 line from 136,680 to 168,680 line from 152,416 to 152,488 line from 152,680 to 152,600 line from 296,320 to 296,280 line from 280,320 to 312,320 line from 296,0 to 296,64 line from 280,0 to 312,0 m0 with .nw at 136,96 line from 152,320 to 152,216 line from 136,320 to 168,320 t823 with .nw at 132,202 line from 176,344 to 192,344 line from 176,328 to 176,360 "\fR\s10\&MSGSSZ\f1\s0" at 224,342 line from 272,328 to 272,360 line from 272,344 to 256,344 line from 272,248 to 336,304 dotted line from 336,248 to 496,248 dotted box ht 240 wid 160 with .nw at 336,304 "\fR\s16\&1-8\f1\s0" at 372,273 "\fR\s12\&USED\f1\s0" at 444,273 "\fR\s16\&17-24\f1\s0" at 376,177 "\fR\s12\&USED\f1\s0" at 448,177 "\fR\s12\&USED\f1\s0" at 444,225 "\fR\s16\&9-16\f1\s0" at 376,225 "\fR\s16\&29-32\f1\s0" at 444,125 "\fR\s16\&25-28\f1\s0" at 376,125 "\fR\s12\&WASTED\f1\s0" at 452,89 "\fR\s12\&USED\f1\s0" at 376,89 line from 408,152 to 336,152 dotted line from 408,152 to 408,64 line from 408,152 to 496,152 line from 336,200 to 496,200 dotted "\fR\s12\&8\f1\s0" at 224,233 "\fR\s12\&8\f1\s0" at 224,305 t809 with .nw at 220,94 box ht 320 wid 96 with .nw at 176,320 line from 176,32 to 272,32 line from 176,104 to 272,104 line from 176,128 to 272,128 line from 176,152 to 272,152 line from 176,176 to 272,176 line from 176,200 to 272,200 line from 176,224 to 272,224 line from 176,248 to 272,248 line from 176,272 to 272,272 line from 176,296 to 272,296 "\fR\s12\&8\f1\s0" at 224,281 "\fR\s12\&8\f1\s0" at 224,257 "\fR\s12\&8\f1\s0" at 224,113 "\fR\s12\&8\f1\s0" at 224,13 "\fR\s12\&8\f1\s0" at 224,137 "\fR\s12\&8\f1\s0" at 224,161 "\fR\s12\&8\f1\s0" at 224,185 "\fR\s12\&8\f1\s0" at 224,209 line from 272,152 to 336,64 dotted spline -> from 440,536\ to 512,536\ to 512,376\ to 120,376\ to 120,248\ to 176,248 spline -> from 360,536\ to 312,512\ to 360,488 spline -> from 360,584\ to 320,552\ to 360,536 spline -> from 360,632\ to 328,600\ to 360,584 line -> from 288,624 to 360,632 t800 with .nw at 288,262 "\fR\s10\&SLOT 7\f1\s0" at 532,110 "\fR\s10\&SLOT 6\f1\s0" at 532,178 "\fR\s10\&SLOT 5\f1\s0" at 532,222 "\fR\s10\&SLOT 4\f1\s0" at 532,274 line from 464,400 to 464,528 .PE .fi ----------------------------- From: Gilles Courcoux <gilles@pase60.convergent.com> Subject: Re: nested loops Date: 10 Aug 90 16:15:51 GMT Sender: root@risky.convergent.com To: unix-wizards@sem.brl.mil In article <4103@herbie.misemi> you wrote: >The problem lies in the $`echo $i` statment Right, double variable expansion like that is resolved through the use of the eval(1) command as in : eval echo '$'$i When the shell read the command, it expands it into eval echo $them # the first time ! and then eval(1) do his job : evaluating its arguments, including variables expansion and then execute the command which is by now : echo one two three The echo(1) command is needed because eval(1) then exec(2)utes its first argument. Your script become : this="one two three" that="four five six seven" them="eight nine ten" all="this that them" # for i in $all do for j in `eval echo '$'$i` do echo $i $j done done Have a nice day, Gilles Courcoux E-mail: sun!pyramid!ctnews!pase60!gilles Unisys Network Computing Group Phone: (408) 435-7692 ----------------------------- From: Chris Bertin <chrisb@risky.convergent.com> Subject: evaluating ${10} and above in sh/ksh Keywords: sh, ksh, eval Date: 10 Aug 90 17:58:37 GMT To: unix-wizards@sem.brl.mil There doesn't seem to be a way, in sh or ksh, to evaluate $10 and higher. $10 and higher are evaluated as ${1}0, ${1}1, etc... instead of ${10}, ${11}, etc... I have tried many different ways and they all fail. Do you know one that will work? #! /bin/sh set a b c d e f g h i j k l arg=0 while [ $arg -le $# ]; do echo "evaluating \$$arg" eval echo $"$arg" eval echo $"${arg}" eval echo "$`eval echo $arg`" # Now, some of the crazy things I tried. # ( The parens are there when eval causes an error ) echo "\${$arg} results in \c" ( eval echo "\${$arg}" ) echo "$`echo '{'``eval echo $arg``echo '}'` results in \c" ( eval echo "$`echo '{'``eval echo $arg``echo '}'`" ) arg=`expr $arg + 1` done -- Chris Bertin | chrisb@risky.Convergent.COM Unisys | or (408) 435-3762 | ...!uunet!pyramid!ctnews!risky!chrisb ----------------------------- From: "Jay A. Konigsberg" <jak@sactoh0.uucp> Subject: Re: Getting CPU information on unterminatted child processes Date: 11 Aug 90 09:43:04 GMT To: unix-wizards@sem.brl.mil In article <1990Aug7.215320.13715@mozart.amd.com> leight@mozart.amd.com (Timothy Leight) writes: >I am interested in getting accurate cpu usage information >on unterminated child processes. The getrusage() and/or times() >system calls only return information on terminated children. > >What is the best method for getting this information? > Well, I don't know the best method, but I think I can point you in the right direction (since no one else did). ps -lf will provide much of the information needed, though it may not produce enough and any way you invoke it (peopen or shell script), it will be slow. Another aproach is to get the information directly out of /dev/kmem. However, all I know how to do there is get overall system usage parameters. Specific information of /dev/kmem is probably system specific and un-portable. However, the Sys V and Xenix 2.3.? header file is: /usr/include/sys/sysinfo.h Getting information about kernel level data structures on the net is a little like asking for the moon, no one seems to have it. Anyway, perhaps this post will generate a little discussion. I would like to know more specifics about the Sys V kernel myself. -- ------------------------------------------------------------- Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak If something is worth doing, its worth doing correctly. ----------------------------- From: Randal Schwartz <merlyn@iwarp.intel.com> Subject: Re: Cron - First Saturday of the month Date: 12 Aug 90 05:27:30 GMT 00.90Aug1014 Sender: news@iwarp.intel.com To: unix-wizards@sem.brl.mil In article <KPC00.90Aug10144909@JUTS.ccc.amdahl.com>, kpc00@JUTS (kpc) writes: | Also, now that the OR is in there, which of merlyn's possibilities was | correct? It makes one wonder what things, if any, are not possible in | cron without putting something in the command to be executed. Well, we already have one. The original request! (See Subject: :-) Sigh. -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@sandia.gov (SMTP MAILER) (08/18/90)
----Reason for mail failure follows---- Sending mail to <math!ckaul@cs.sandia.gov> : Could not be delivered for three days. ----Transcript of message follows---- Date: 15 Aug 90 05:37:00 MDT From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#117 To: "math!ckaul" <math!ckaul@cs.sandia.gov> Return-Path: <incoming-unix-wizards-request@sandia.gov> Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Wed, 15 Aug 90 05:23:48 MDT Received: from SEM.BRL.MIL by SEM.BRL.MIL id ac10635; 15 Aug 90 5:54 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa10597; 15 Aug 90 5:45 EDT Date: Wed, 15 Aug 90 05:45:07 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#117 Message-ID: <9008150545.aa10597@SEM.BRL.MIL> UNIX-WIZARDS Digest Wed, 15 Aug 1990 V10#117 Today's Topics: CORRECTED CALL FOR VOTES: Reorganization of comp.unix.* Archives of c.u.wizards Re: evaluating ${10} and above in sh/ksh Re: I_FDINSERT in streamio(4) Repost: Can one driver call another directly? Re: Interesting keyboard read problem (ioctl, function keys) Re: cd failure killing script [Re: Interactive 2.2 File zapper] Re: csh weirdness (HELP!) sendmail config file question Re: get terminal speed from shell script Wanted: NQS software Re: seeking information about file system details. Re: Please add me to User list directory "indexer" Re: Getting CPU information on unterminatted child processes Curses question redirecting standard i/o from an exec'ed programme ----------------------------------------------------------------- From: Chip Salzenberg <uunet!tct!chip@ncar.ucar.edu> Subject: CORRECTED CALL FOR VOTES: Reorganization of comp.unix.* Date: 5 Aug 90 21:41:11 GMT Sender: lear@turbo.bio.net Followup-To: news.groups Approved: lear@turbo.bio.net To: unix-wizards@sem.brl.mil [ Document created: $Date: 90/07/27 18:31:22 $ ] +----------------------------------------------------------+ | OOPS. | | | | I posted the original Call For Votes for the comp.unix.* | | reorganization with an incorrect Reply-To: address. | | There is no such domain as "pdn.com". | | Please send votes to <chip%tct@pdn.paradyne.com>. | | | | Mea culpa, mea culpa, mea maxima culpa. | +----------------------------------------------------------+ This article is a CALL FOR VOTES on a reorganization of the comp.unix.* hierarchy. This reorganization will add various "obvious" missing groups and rename several groups which have misleading names. PLEASE EXAMINE THE ENTIRE PROPOSAL BEFORE VOTING ON IT. +----------+ | PROPOSAL | +----------+ Create: comp.unix.admin UNIX system administration. comp.unix.msdos MS-DOS running under UNIX by whatever means. comp.unix.large UNIX on mainframes and in large networks. comp.unix.misc General discussions regarding UNIX. comp.unix.programmer UNIX programming. comp.unix.shell UNIX shell usage and programming. comp.unix.xenix.sco XENIX versions from the Santa Cruz Operation. [*] [*] NOTE: If comp.unix.xenix.sco passes, then comp.unix.xenix will be renamed to comp.unix.xenix.misc, since its charter will have changed to cover only non-SCO versions of XENIX. I didn't want to make two changes based on one vote, but in this case I think it's necessary. Experience teaches that parent groups frequently draw inappropriate crossposting from their children. Peer groups are better insulated from each other. Rename: comp.unix.microport --> comp.unix.sysv286 UNIX System V (not XENIX) on the '286. comp.unix.i386 --> comp.unix.sysv386 UNIX System V (not XENIX) on the '386. comp.unix.wizards --> comp.unix.internals UNIX internals: kernel hacking, etc. For completeness, here is a list of comp.unix groups for which NO change is proposed: comp.unix Discussion of UNIX* features and bugs. (Moderated) comp.unix.aix IBM's version of UNIX. comp.unix.aux The version of UNIX for Apple Macintosh II computers. comp.unix.cray Cray computers and their operating systems. comp.unix.questions Questions and answers about UNIX. comp.unix.ultrix Discussion about DEC's Ultrix. +---------------+ | VOTING METHOD | +---------------+ Send votes to the mailbox "vote" on the machine "tct". Possible ways to address votes include: vote%tct@pdn.paradyne.com vote@tct.uucp uunet!pdn!tct!vote Each vote must use this form: ======== START VOTING FORM ========= admin yes/no/abstain msdos yes/no/abstain large yes/no/abstain misc yes/no/abstain programmer yes/no/abstain shell yes/no/abstain xenix.sco yes/no/abstain sysv286 yes/no/abstain sysv386 yes/no/abstain internals yes/no/abstain ======== END VOTING FORM ========= A valid vote MUST specify either "yes", "no" or "abstain" for EACH proposed change. Each proposed newsgroup creation or renaming will stand on its own. Extra verbiage and/or quoting characters will be ignored, so don't panic if you send a vote with ">" characters still in place. I will use a Perl script to tabulate well-formed votes. If a badly-formed vote is complete and its meaning is obvious, I will fix it. Otherwise, I will reply to the voter with a form message that explains how to cast a valid vote -- essentially, another copy of this article. +----------+ | SCHEDULE | +----------+ 1. Voting: The vote will run for 21 days from the time the Call For Votes appears in news.announce.newgroups, or until Sunday, August 18, whichever is longer. I will post a second Call For Votes, and possibly a list of unreachable return addresses, during the voting period. When the vote is over, I will post the final results. 2. Waiting Period: I will observe the normal waiting period of five days from the time that the final results appear in news.announce.newgroups. During this time, people may report lost votes and/or impugn the fairness of the vote taker. :-) 3. Consummation: After the waiting period, I will issue the appropriate control messages to create all new groups and/or new names for renamed groups. About one week later, I will re-issue the creation control messages, and also issue removal control messages for old names of renamed groups. If all goes as planned, whatever parts of the reorganization that pass will take effect by the end of August. -- Chip Salzenberg at ComDev/TCT <chip@tct.uucp>, <uunet!ateng!tct!chip> ----------------------------- From: Joe Ammond <KITBASH@mtus5.bitnet> Subject: Archives of c.u.wizards Date: 13 Aug 90 16:03:20 GMT To: unix-wizards@sem.brl.mil Apollogies if this is a FAQ or RTFM(news) question, but, is there an archive of comp.unix.wizards anywhere, for uucp or ftp (ftp preferred)? I'd rather read the old questions & answers than posting my own problems if they've already been solved. ++thanks, ja. Joe Ammond Computer Consultant, Mich. Tech. Univ. Summer Programmer, Ford Motor Co. ----------------------------- From: Robert Hartman <hartman@ide.com> Subject: Re: evaluating ${10} and above in sh/ksh Keywords: sh, ksh, eval Date: 13 Aug 90 16:35:32 GMT Sender: Bert Beaton <bert@ide.com> To: unix-wizards@sem.brl.mil In article <514@risky.Convergent.COM> chrisb@risky.Convergent.COM (Chris Bertin) writes: >There doesn't seem to be a way, in sh or ksh, to evaluate $10 and higher. >$10 and higher are evaluated as ${1}0, ${1}1, etc... > instead of ${10}, ${11}, etc... >I have tried many different ways and they all fail. Do you know one >that will work? > This is what the shift builtin is for: # sort out arguments while [ $# -gt 0 ] ; do case $1 in -a) a=true ;; -b) b=true ;; -*) "echo illegal option" ;; *) "$files $i" ;; esac shift done This will process through all of your arguments and build a list of filenames. It doesn't work if options can have arguments of their own. For cases like this, I use getopts to parse out the command line. There's a good example in the getopts man page. -r ----------------------------- From: "Gordon C. Galligher" <gorpong@ping.uucp> Subject: Re: evaluating ${10} and above in sh/ksh Keywords: sh, ksh, eval Date: 14 Aug 90 03:36:14 GMT To: unix-wizards@sem.brl.mil In article <514@risky.Convergent.COM> chrisb@risky.Convergent.COM (Chris Bertin) writes: >There doesn't seem to be a way, in sh or ksh, to evaluate $10 and higher. >$10 and higher are evaluated as ${1}0, ${1}1, etc... > instead of ${10}, ${11}, etc... >I have tried many different ways and they all fail. Do you know one >that will work? I realize this is hardly what you wish to read, but the only way to gain access to the others is by using 'shift' to get them. You could, on the other hand set up a loop to grab all of them into your own variables: argv0=$0 start=1 pred=argv for i do eval "${pred}${start}='$i'" # Be sure to quote the $i !! start=`expr $start + 1` done argc=`expr $start - 1` This would give you variables $argv0, $argv1, $argv2 up to and including $argv$argc. To simply print them out: echo " 0 - $argv0" start=1 while [ $start -le $argc ] do echo " $start - `eval echo '$'${pred}${start}`" # Yes, ugly start=`expr $start + 1` done No, it is not pretty, but it is workable. There may not be many times you would want to print option 'x' without knowing what 'x' was. If you always wanted to check the first option, then it is just $argv1. If you find yourself always parsing through the command line options, then you should probably put a case inside of the for and then do with them what you will. -- Gordon. -- Gordon C. Galligher 9127 Potter Rd. #2E Des. Plaines, Ill. 60016 telxon!ping%gorpong@uunet.uu.net (not tested) (Is this even legal??) ...!uunet!telxon!ping!gorpong (tested) (And it works!) "It seems to me, Golan, that the advance of civilization is nothing but an ----------------------------- From: "stephen.a.rago" <sar0@cbnewsl.att.com> Subject: Re: I_FDINSERT in streamio(4) Date: 13 Aug 90 17:20:58 GMT To: unix-wizards@sem.brl.mil In article <WS.90Aug9184533@karl.tools.uucp>, ws@tools.uucp (Wolfgang Solfrank) writes: > Currently I'm trying to write a trace module and/or driver for > streams tracing. I need it for easier testing and debugging of > a streams protocol stack we are developping here. I'd like to > let the traced driver/modules and the application as much alone > as possible. So I face the problem of duplicating all messages > that are sent thru the protocol stack to the trace application. > > How do I tell the trace driver what streams stack to intercept? Make the trace driver both a module and a driver, and push it on the stream in the place you'd like to debug. Use the module to log messages and use the driver to recover them. Steve Rago sar@attunix.att.com ----------------------------- From: Doug Toppin <toppin@melpar.uucp> Subject: Repost: Can one driver call another directly? Keywords: driver, motorola Date: 13 Aug 90 19:54:57 GMT To: unix-wizards@sem.brl.mil Is it possible for a device driver to call another device driver directly? I have the following problem: I need to send a command to a serial device in less than 100 milliseconds of receiving data from a custom device. I would like to have my custom driver call the serial driver directly and pass it the data to send. Is it possible to call an entry point of the serial driver directly from another driver? In the past I have done something similar on a different operating system by putting data into the clist and calling the line discipline entry point of the serial driver. I would like a more direct (and documented) means of doing this. Here are the specifics: * I am using Motorola Unix R3V5 on the MVME-147A (68030) * serial card is the MVME-332XT device, 19.2K rate * I cannot afford overhead of bubbling up to an application and back down Please respond by mail or post. thanks Doug Toppin uunet!melpar!toppin ----------------------------- From: Leslie Mikesell <les@chinet.chi.il.us> Subject: Re: Interesting keyboard read problem (ioctl, function keys) Date: 13 Aug 90 21:10:07 GMT To: unix-wizards@sem.brl.mil In article <7562@ucdavis.ucdavis.edu> tuck@iris.ucdavis.edu (Devon Tuck) writes: >I have been working with an intersting problem... How to write a keyboard >input routine that does not mess up its' transmission of repeated function >keys. You might have noticed that even in vi, and in the C-shell, if you >sit on an arrow key or some other function key that maps to a character >sequence, you get intermittent beeps, or stray characters, respectively. >The problem is that this editor is very bulky, and spends too much time >away from the keyboard input routine, so that if I do the logical thing >and set VMIN=1 and VTIME=0, portions of the home key sequence (<ESC>[H), >for example, get split across network packets and arrive with too much gap >for the keyboard driver to consider it a valid screen movement sequence. Doesn't look logical to me. How about setting VMIN=1, VTIME=2 and make your read()'s request many characters at once in order to always catch up with the keyboard in one syscall? >Has anyone solved this problem? I think I might have it with a routine that >forks on its' first call, after setting up a pipe and ioctl calls, (VMIN=0, >VTIME=0) and thus leaves a small subprocess running alongside the editor >acting as a slave to the keyboard and sending all characters into a pipe >to be read at the leasure of the main character input routine. This is a reasonable approach but shouldn't really be necessary unless you are waiting for slow operations like a screen redraw to complete before checking for keyboard input. You certainly wouldn't want to set VMIN=0 though, or you will be making hundreds of syscalls/second and consume most of the CPU. A subprocess would want to block when there is no input since it would have nothing else to do. An alternative would be to make your output routine check for input every so often. A little math involving chars/sec. should generate a suitable number to catch all the input without swamping the machine. (Use ioctl() to set O_NDELAY temporarily so you can do a non-blocking read into a buffer). >How do other editors do it? How do Crisp, emacs, etc. handle this? (as I >mentioned, vi doesn't..) If you don't use a bare "escape" as a command, there is no need to do any funny timing to detect escape sequences. If you do need the timing, the best approach under sysV would be to let the driver do it by setting VTIME appropriately (and you will still probably miss once in a while). Les Mikesell les@chinet.chi.il.us ----------------------------- From: Leslie Mikesell <les@chinet.chi.il.us> Subject: Re: cd failure killing script [Re: Interactive 2.2 File zapper] Date: 13 Aug 90 21:17:16 GMT To: unix-wizards@sem.brl.mil In article <9118@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >In article <26C2F1A0.205B@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >: According to davidsen@sixhub.UUCP (bill davidsen): >: >Yes, only ksh gives you the choice of catching the failure. >: >: Bash 1.05 also continues after a "cd" failure. >Likewise Perl. The idiom to catch the failure is > chdir $dir || die "Can't cd to $dir: $!\n"; This is reasonable behaviour for perl since it doesn't claim any compatibility with /bin/sh scripts. Those other two mentioned above will cause serious problems when executing scripts that are perfectly valid for /bin/sh. They could (should) have required a "set" option to be done to make them operate differently. Les Mikesell les@chinet.chi.il.us ----------------------------- From: Matt Cross <mcross@pennies.sw.stratus.com> Subject: Re: csh weirdness (HELP!) Date: 13 Aug 90 21:52:32 GMT Sender: usenet@lectroid.sw.stratus.com To: unix-wizards@sem.brl.mil In article <1990Aug13.151415.14575@elroy.jpl.nasa.gov>, alan@cogswell.Jpl.Nasa.Gov (Alan S. Mazer) writes: |>Someone came to me with the following problem and I'm clueless. |>If I type (SunOS 4.0.3) |> |> kill `ps | grep a.out | awk '{printf("%d ",$1);}'` |> |>to kill every instance of a.out I get |> |> `ps | grep a.out | awk '{printf("%d ",$1);}'`: Ambiguous. |> |>Any idea why? It's not the $1 (changing that doesn't affect anything), and |>it works if the command is in a shell script, or if instead of kill one uses |>/bin/kill. It also works great inside the Bourne shell. Using echo instead |>of kill produces the expected string of space-separated pid's. |> Are you using the shell built-in kill? That would explain the difference. When I tried it a sun here, it said: kill: Arguments should be jobs or process id's. But, I'm using tcsh. It seems to me that the internal commands handle the backquotes differently... That's as much as I could figure out... -- These are my views, and in no way reflect the views of Stratus Computer, Inc. Mail to: mcross@es.stratus.com or profesor@wpi.wpi.edu ----------------------------- From: davy@intrepid.itstd.sri.com Subject: sendmail config file question Date: 13 Aug 90 23:46:54 GMT Sender: davy@sparkyfs.istc.sri.com To: unix-wizards@sem.brl.mil We're getting ready to change our domain name, and I want to make sendmail clever enough to handle mapping the old domain to the new one. Problem is, we're already doing that from the domain name of about a year ago. Basically, right now I have: DDitstd.sri.com current domain name DEistc.sri.com old domain name S1 R$*<@$-.$E>$* $1<@$2.$D>$3 change domain name R$*<@$E>$* $1<@$D>$2 change domain name and likewise for S2. Now, to handle both old domain names, I figured I could use a class: DDerg.sri.com new domain name CDistc.sri.com itstd.sri.com old domain names S1 R$*<@$-.$=D>$* $1<@$2.$D>$3 change domain name R$*<@$=D>$* $1<@$D>$2 change domain name and likewise for S2. But this doesn't work; the matches against the class fail. Reading the sendmail manual, it mentions something about "token" being the unit of a class. I'm assuming the match is failing because "istc.sri.com" and "itstd.sri.com" are three tokens each rather than one. Is this right? If so, is there a way to do what I want with classes? Thanks, Dave Curry SRI International ----------------------------- From: George Turczynski <george@hls0.hls.oz> Subject: Re: get terminal speed from shell script Date: 14 Aug 90 00:36:45 GMT To: unix-wizards@sem.brl.mil On SunOS 4.0.3 (and probably the rest too), if you have installed /usr/5bin then use: speed=`/usr/5bin/stty speed` in your shell scripts. This works. By the way, the SUN manuals point out quite clearly that "the settings are reported on the standard error." for /bin/stty, and "the settings are reported on the standard output" for /usr/5bin/stty. Be sure to re-read the manual to check that the different versions apply to the device you want. ie /bin/stty sets/reports the stdout device, whilst /usr/5bin/stty sets/reports the stdin device. Hope this is of some use to you... -- | George P. J. Turczynski. |---------------------------------------------------- | Computer Systems Engineer. | ACSnet: george@highland.oz | I can't speak for the | | Highland Logic Pty. Ltd. | Phone: +61 48 683490 | company, I can barely | | Suite 1, 348-354 Argyle St | Fax: +61 48 683474 | speak for myself... | | Moss Vale. NSW. Australia. 2577 |---------------------------------------------------- ----------------------------- From: Bob McGowen x4312 dept208 <bob@wyse.wyse.com> Subject: Re: get terminal speed from shell script Date: 14 Aug 90 01:21:24 GMT Sender: news@wyse.wyse.com Followup-To: comp.unix.questions To: unix-wizards@sem.brl.mil In article <90Aug12.135618edt.18763@me.utoronto.ca> sun@hammer.me.UUCP (Andy Sun Anu-guest) writes: >Hi Net, > >The question I have is: > >Is there a way to get the terminal speed from a (sh or csh) script? > >I used to be able to do the following in a Bourne shell script: > > speed=`stty speed` > >and got the terminal speed assigned to variable speed. As various OS >gets updated (e.g. Ultrix 3.1 and SUN OS 4.0.3), this won't work anymore >because all stty outputs are being sent to stderr, not stdout, thus no >piping or redirection is possible. Is there any similar commands that can You CAN still cause redirection to occur. >get terminal speed inside a shell script? I just tried the following: date>date.data echo 'echo date.data >&2 # sends file name to standard error' > errout chmod +x errout cat `errout` # date.data appeared on screen, cat read terminal # this is the expected result cat `errout 2>&1` # the date stored in the file was cat'ed to the screen Of course, this is the Bourne shell, not csh. I cannot vouch for how or if this is possible with csh. Bob McGowan (standard disclaimer, these are my own ...) Product Support, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com ----------------------------- From: Gerry Roderick Singleton <gerry@jts.com> Subject: Re: get terminal speed from shell script Date: 14 Aug 90 18:10:10 GMT To: unix-wizards@sem.brl.mil In article <90Aug13.095129edt.18647@me.utoronto.ca> sun@me.utoronto.ca (Andy Sun Anu-guest) writes: >In article <1990Aug13.005849.23223@jarvis.csri.toronto.edu> ruhtra@turing.toronto.edu (Arthur Tateishi) writes: >>In artcle <90Aug12.135618edt.18763@me.utoronto.ca> sun@me.utoronto.ca (Andy Sun Anu-guest) writes: >> >>>Is there a way to get the terminal speed from a (sh or csh) script? >>>I used to be able to do the following in a Bourne shell script: >>> speed=`stty speed` [lines deleted] > >I guess it depends on which version of SUN OS. "speed=`stty speed`" works >for a Sun 3/60 running (I think) SUN OS 3.x. So it does went through stdout. [more lines deleted] >>other than a proper tty device, I came up with the following. >> speed=`stty speed 3>&2 2>&1 1>&3` [more lines deleted] I like to add my two penny's worth, to query the speed of the tty device shouldn't one accept input from the device rather than perform output to it before getting the answer? The question is rhetorcal so don't bother answering it. It apppears to me to be valid in this case for BSD4.3 running on an ISIv24. Here's my little sample: #! /bin/sh speed=`stty speed </dev/tty 2>&1` echo $speed and the results: /usr/local/src >%[530] sh -vx foo #! /bin/sh speed=`stty speed </dev/tty 2>&1` + stty speed speed=9600 echo $speed + echo 9600 9600 /usr/local/src >%[531] I believe this satisfies Andy's requirements and I hope it's what he wanted. Anyways it'll fuel the discussion. Cheers, ger -- -- G. Roderick Singleton, System and Network Administrator, JTS Computers {uunet | geac | torsqnt}!gerry@jtsv16.jts.com ----------------------------- From: "BURNS,JIM" <gt0178a@prism.gatech.edu> Subject: Re: get terminal speed from shell script Date: 15 Aug 90 05:42:34 GMT Followup-To: comp.unix.questions To: unix-wizards@sem.brl.mil in article <1990Aug14.181010.29571@jts.com>, gerry@jts.com (Gerry Roderick Singleton ) says: > #! /bin/sh > > speed=`stty speed </dev/tty 2>&1` > echo $speed Nope, on SunOS 4.0, you get: {richsun12:/usr} [196] t=`stty speed </dev/tty 2>&1` {richsun12:/usr} [197] echo $t stty: Operation not supported on socket {richsun12:/usr} [198] -- BURNS,JIM Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332 uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a Internet: gt0178a@prism.gatech.edu ----------------------------- From: Roy Laor <roy@taux01.nsc.com> Subject: Wanted: NQS software Date: 14 Aug 90 08:50:21 GMT To: unix-wizards@sem.brl.mil I am interested in NQS (Network Queuing System) for submitting jobs on a UNIX system. I have heard that it's a public domain. Does anybody know where can I get these sources from ? Thanks, Roy roy@taux01.nsc.com ----------------------------- From: Richard Tobin <richard@aiai.ed.ac.uk> Subject: Re: seeking information about file system details. Date: 14 Aug 90 11:36:24 GMT To: unix-wizards@sem.brl.mil In article <28595@athertn.Atherton.COM> mcgregor@hemlock.Atherton.COM (Scott McGregor) writes: >I guess what I am interested in is if I have a non-unix file system >and I want to allow the this file system to be mounted as a unix >file system, and accessed using open, creat, read, write, close, et al, If your system already has NFS, you can do this without kernel modifications, by writing an NFS server for your device. NFS mounting works by passing the kernel the address of a socket through which it can send and receive messages from the filesystem. I recently hacked up such a thing so that I can mount Minix floopies on a Sun. I can send you the code if you're interested. -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin ----------------------------- From: Don Lewis <del@thrush.mlb.semi.harris.com> Subject: Re: seeking information about file system details. Date: 15 Aug 90 05:40:05 GMT Sender: news@mlb.semi.harris.com To: unix-wizards@sem.brl.mil In article <3199@skye.ed.ac.uk> richard@aiai.UUCP (Richard Tobin) writes: >In article <28595@athertn.Atherton.COM> mcgregor@hemlock.Atherton.COM (Scott McGregor) writes: >>I guess what I am interested in is if I have a non-unix file system >>and I want to allow the this file system to be mounted as a unix >>file system, and accessed using open, creat, read, write, close, et al, > >If your system already has NFS, you can do this without kernel >modifications, by writing an NFS server for your device. NFS mounting >works by passing the kernel the address of a socket through which it >can send and receive messages from the filesystem. I recently hacked >up such a thing so that I can mount Minix floopies on a Sun. > >I can send you the code if you're interested. I did this for an automatic version of /usr/hosts. It periodically reads the hosts YP map and emulates a directory of symbolic links to /usr/ucb/rsh for the map entries. I have another application in mind where I would like to build my own filesystem type. It would not be a complete filesystem implementation. The reason that I can't do it with an NFS server is that I need to know what syscall a process is executing when the process is doing a lookup in my filesystem. -- Don "Truck" Lewis Harris Semiconductor Internet: del@mlb.semi.harris.com PO Box 883 MS 62A-028 Phone: (407) 729-5205 Melbourne, FL 32901 ----------------------------- From: Grant Grundler <grant@pescara.orc.olivetti.com> Subject: Re: Please add me to User list Date: 14 Aug 90 17:19:18 GMT Sender: news@orc.olivetti.com To: unix-wizards@sem.brl.mil In article <24129@adm.BRL.MIL>, genesis@BRL.MIL (MAJ. Kindel) writes: > Please add me to your user list. I am with the US Army > Computer Science School. > > Thank You > Info Center > USA Computer Science School > AV 780-3245 COMM(404)791-3245 Looks like the somebody needs to learn how to use "rn"! grant ----------------------------- From: Saumen K Dutta <skdutta@CSSUN.TAMU.EDU> Subject: Re: Please add me to User list Date: 14 Aug 90 22:45:43 GMT Sender: usenet@TAMU.EDU To: unix-wizards@sem.brl.mil From: grant@Pescara.ORC.Olivetti.Com (Grant Grundler) Subject: Re: Please add me to User list Message-ID: <49280@ricerca.UUCP> Date: 14 Aug 90 17:19:18 GMT References: <24129@adm.BRL.MIL> Sender: news@orc.Olivetti.Com Reply-To: grant@Pescara.ORC.Olivetti.Com (Grant Grundler) Organization: Olivetti Research California Lines: 13 In article <49280@ricerca.UUCP>, grant@Pescara.ORC.Olivetti.Com (Grant Grundler) writes: :In article <24129@adm.BRL.MIL>, genesis@BRL.MIL (MAJ. Kindel) writes: :> Please add me to your user list. I am with the US Army :> Computer Science School. :> :> Thank You :> Info Center :> USA Computer Science School :> AV 780-3245 COMM(404)791-3245 : : :Looks like the somebody needs to learn how to use "rn"! : :grant : Or is there any mailing list which simultaneouly post the news to various addresses. In any case why flaming new users ? -- _ ||Internet: skdutta@cssun.tamu.edu ( /_ _ / --/-/- _ ||Bitnet : skd8107@tamvenus.bitnet __)_/(_____(_/_(_/_(_(__(_/_______ ||Uucp : uunet!cssun.tamu.edu!skdutta .. ||Yellnet: (409) 846-8803 ----------------------------- From: Keith Gabryelski <ag@cbmvax.commodore.com> Subject: Re: Please add me to User list Date: 14 Aug 90 22:56:05 GMT To: unix-wizards@sem.brl.mil In article <49280@ricerca.UUCP> grant@Pescara.ORC.Olivetti.Com (Grant Grundler) writes: >In article <24129@adm.BRL.MIL>, genesis@BRL.MIL (MAJ. Kindel) writes: >> Please add me to your user list. I am with the US Army >> Computer Science School. >> >> Thank You >> Info Center >> USA Computer Science School >> AV 780-3245 COMM(404)791-3245 > > >Looks like the somebody needs to learn how to use "rn"! A lot of people read news as if it came from a mailing list (Ie, they send their mail address to a list keeper and use their mail reader to read all incoming mail). Inefficient, but workable for a small number of groups. This Kindel guy is probably one of them. Pax, Keith ----------------------------- From: Ted Persky <tpersky@suntory.dcrt.nih.gov> Subject: directory "indexer" Keywords: search,directory,index Date: 14 Aug 90 15:16:23 GMT Sender: news@nih-csl.nih.gov Followup-To: comp.unix.questions To: unix-wizards@sem.brl.mil It has come to my attention that our staff on the whole spends a great deal of time during the day searching for that one certain file in a large directory tree. For example, try finding a certain fragment of source code in the X11 distribution. The people in our lab always seem to be asking each other to help them locate the path name for "foo.c". What I'm wondering is whether anyone knows of a tool where one can define a directory as being the root of a "large file tree" and have an index of some sort placed at that root. After that is created, each person who creates a file in that particular sub-tree would type in some sort of librarian command to create an entry in the index with a brief description of the file. Then the index (in database form, preferably) could be queried to locate the path name for a desired file. This would be ideal if people such as MIT could create this for their distributions of X, or UNIX vendors for their source distributions. If you could send me e-mail concerning this, I'd greatly appreciate it. Thanx, Ted Persky phone: (301) 496-2963 Building 12A, Room 2031 Internet: tpersky@alw.nih.gov National Institutes of Health Bethesda, MD 20892 ----------------------------- From: Grant Grundler <grant@pescara.orc.olivetti.com> Subject: Re: Getting CPU information on unterminatted child processes Date: 14 Aug 90 16:56:55 GMT Sender: news@orc.olivetti.com To: unix-wizards@sem.brl.mil System Vr4 has a /proc file system which allows the average user to read process memory space as if it where a file. The user must normally have access to the process. On sysV4, ps also gets the info from here. On older systems I would also use "ps" as suggested by jak@sactoh0.UUCP. grant ----------------------------- From: Keith Gabryelski <ag@cbmvax.commodore.com> Subject: Re: Getting CPU information on unterminatted child processes Date: 14 Aug 90 21:48:01 GMT To: unix-wizards@sem.brl.mil In article <3699@sactoh0.UUCP> jak@sactoh0.UUCP (Jay A. Konigsberg) writes: >In article <3879@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: >>>Getting information about kernel level data structures on the net is >>>a little like asking for the moon, no one seems to have it. >> >>No, it's more like asking for the moon if you're on Jupiter; the >>appropriate response is "which moon"? Kernel-level data structures >>differ between different UNIX implementations. > >This is true, however, the number of Sys V/Xenix and BSD/Sun systems >out there cover the majority of systems. I would say not. For instance, getting the user structure for a certain process is different depending the version of Xenix you are running (2.1 or 3.2) and what machine you are running on (286 or 386). Some Unix Systems use a system call to find such information; 3b2 use sys3b(); 3b1 use syslocal(). System V Release 4.0 does the /proc thing. That is six different ways (no Xenix 3.2/286) of handling the same operation under systems you would group under SysV/Xenix; Ackphfffftt! Guy is correct--``Which moon'' is the response you should expect if you ask about kernel specifics without giving any detail about the target system. Pax, Keith ----------------------------- From: Glenn Pitcher <gpitcher@edpmgt.uucp> Subject: Curses question Keywords: key interpretation problems Date: 14 Aug 90 17:23:52 GMT To: unix-wizards@sem.brl.mil (editor's note: This may be a duplicate transmision. Sorry if you got it twice) I'm attempting to write my first curses program and have already run into a couple of problems. The first one involves interpretation of input keys. How can one tell the difference between the forward and backward tabs?? When I run my test program, I get 0x09 for both. In addition, the code I'm getting in my test program for a return is different that the code which is returned in the real program (0x0a vs. 0x0d) and yes, these two programs are being run on the same system. Sooo, could some curses guru out there possibly tell me what's going on??? Thanks, -- Glenn Pitcher UUCP: {crash,ucsd}!edpmgt!gpitcher Programmer/Analyst & hp-sdd!teamnet!gpitcher Unix Guru in training EDP Management, Inc. * Proud member of Team.Net * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ----------------------------- From: Michael Katzmann <michael@fe2o3.uucp> Subject: redirecting standard i/o from an exec'ed programme Keywords: popen, io, exec, system Date: 14 Aug 90 17:45:05 GMT Followup-To: comp.unix.questions To: unix-wizards@sem.brl.mil I have a task that requires the ability to fork off another programme but to supply it's standard input and output. The SysV manuals describe FILE *popen( command, type ) char *command, *type; which execs the command a la "system()" and creates a pipe. "type" and be "r" if you want to read from the standard output of "command", or "w" if you want to write to standard input. However there doesn't seem to be any way to use this routine to do both similtaneously. What is the usual way to to this? Important points: The exec'ed command must run asynchronously (obvious if the parent is supplying input.) The child process id must be available to the parent. (so that it can be killed if necessary) Any ideas would be appreciated. --------------------------------------------------------------------- email to UUCP: uunet!mimsy!{arinc,fe2o3}!vk2bea!michael _ _ _ _ Amateur | VK2BEA (Australia) ' ) ) ) / // Radio | G4NYV (United Kingdom) / / / o _. /_ __. _ // Stations| NV3Z (United States) / ' (_<_(__/ /_(_/|_</_</_ Michael Katzmann Broadcast Sports Technology. 2135 Espey Ct. #4 Crofton Md. 21114 USA Ph: +1 301 721 5151 ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@sandia.gov (SMTP MAILER) (08/19/90)
----Reason for mail failure follows---- Sending mail to <math!ckaul@cs.sandia.gov> : Could not be delivered for three days. ----Transcript of message follows---- Date: 16 Aug 90 05:36:00 MDT From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#118 To: "math!ckaul" <math!ckaul@cs.sandia.gov> Return-Path: <incoming-unix-wizards-request@sandia.gov> Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Thu, 16 Aug 90 05:22:53 MDT Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa21242; 16 Aug 90 5:57 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa21187; 16 Aug 90 5:45 EDT Date: Thu, 16 Aug 90 05:45:08 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#118 Message-ID: <9008160545.aa21187@SEM.BRL.MIL> UNIX-WIZARDS Digest Thu, 16 Aug 1990 V10#118 Today's Topics: Re: evaluating ${10} and above in sh/ksh Re: csh weirdness (HELP!) Re: waitpid() ??? Re: Cron - First Saturday of the month Re: Please add me to User list AT&T 3B2, PC-NFS, Curses - reverse video with werase() Re: sendmail config file question Re: Is HDB locking safe? Broadcast UDP packets shmat() system call? Re: shmat() system call? Re: Curses question Re: Another "why won't this work" program How to restrict commands in rsh? Vi fails on a Sun-4 Directory compression ----------------------------------------------------------------- From: Bob Desinger <bd@hpopd.hp.com> Subject: Re: evaluating ${10} and above in sh/ksh Date: 14 Aug 90 15:35:15 GMT To: unix-wizards@sem.brl.mil > There doesn't seem to be a way, in sh or ksh, to evaluate $10 and higher. In /bin/sh this never worked, although individual vendors may have modified their /bin/sh. I don't know of any that have, by the way. It looks like your ksh is broken. Version 06/03/86 (or at least that version shipped with HP-UX at 7.0 on Series 300 and 800) does the right thing: set a b c d e f g h i j k l print 9 is $9, 10 is ${10}, 11 is ${11}, 12 is ${12}. alias i='echo Number 9' alias j='echo Number 10' alias k='echo Number 11' alias l='echo Number 12' eval $9 eval ${10} eval ${11} eval ${12} The new ksh88, Version 11/16/88, also does the right thing. Both versions of ksh generate the correct output: 9 is i, 10 is j, 11 is k, 12 is l. Number 9 Number 10 Number 11 Number 12 I invoked the script with `ksh script' and `ksh88 script'. Then I also tested it with a first line of `#! /usr/local/bin/ksh88' and `#! /bin/ksh'. All four cases generated the same output. Uh, ksh88 isn't shipped with HP-UX; we bought it from the AT&T Toolchest. Your script lines are considerably more complex than mine, though. In fact, I stopped trying to figure out what the script was trying to do and just ran your script. I mailed my output to you; we can follow this up offline. Summarize to the net? -- bd ----------------------------- From: Bob Desinger <bd@hpopd.hp.com> Subject: Re: csh weirdness (HELP!) Date: 14 Aug 90 15:49:12 GMT To: unix-wizards@sem.brl.mil > to kill every instance of a.out I get > `ps | grep a.out | awk '{printf("%d ",$1);}'`: Ambiguous. Can you work around this by changing the awk program to generate the kill commands, then piping the awk output to the shell? As in: ps | grep a.out | awk '{print "kill", $1}' | sh -- bd ----------------------------- From: Dave Decot <decot@hpisod2.cup.hp.com> Subject: Re: waitpid() ??? Date: 15 Aug 90 00:26:26 GMT To: unix-wizards@sem.brl.mil > >Does anyone have an idea exactly what [waitpid()] does? > > waitpid() is a POSIX function: > > int waitpid(int pid, int *status, int options) > > where the `pid' argument is the process ID of the process to wait > for, or WAIT_ANY to wait for any child; WAIT_ANY does not exist in POSIX. The correct value to wait for any child is -1. Dave Decot ----------------------------- From: Steve Alter <alter@ttidca.tti.com> Subject: Re: Cron - First Saturday of the month Date: 15 Aug 90 01:46:48 GMT To: unix-wizards@sem.brl.mil In article <19744@orstcs.CS.ORST.EDU> curt@oce.orst.edu (Curt Vandetta) writes: } I'm wondering if anyone has a way of making cron run a job on the } first Saturday of every month? I'm going to totally side-step the fight that has been waged over whether the day-of-week is logically ANDed or ORed with the day-of-month. You can set it up using a combination of cron and "at". For example, let's assume that you want the job to run at 1 a.m. on the first Saturday of each month. You put in a cron job to run at 12:30 a.m. on the 1st DAY of each month, and have that cron job launch an "at" job to run at 1 a.m. on the next Saturday, which could be as soon as 30 minutes later. Tweak the names and numbers to your heart's delight, but the concept remains. The cron line (SunOS 4.x): 30 0 1 * * /home/myacct/bin/next.Saturday The next.Saturday script (mode 755): at -c 0100 Sat first.Saturday.of.month File "first.Saturday.of.month" contains... oh, you can figure it out. -- Steve Alter <alter@ttidca.tti.com> {csun,philabs,psivax,pyramid,quad1,rdlvax,retix}!ttidca!alter Citicorp/TTI, Santa Monica CA (213) 450-9111 x2541 ----------------------------- From: Dave Corcoran <dave@aspect.uucp> Subject: Re: Cron - First Saturday of the month Date: 15 Aug 90 13:38:07 GMT To: unix-wizards@sem.brl.mil In article <1990Aug11.030818.28876@watserv1.waterloo.edu>, dmcanzi@watserv1.waterloo.edu (David Canzi) writes: > This is better done using awk: > > if [ `date | awk '{print $3}'` -le 7 ]; then or: if [ `date +%d` -le 7 ] -- David Corcoran -@@ uunet!aspect!dave ~ Good, fast, cheap; pick any two. ----------------------------- From: B|rje Josefsson <bj@dc.luth.se> Subject: Re: Cron - First Saturday of the month Date: 15 Aug 90 17:26:59 GMT To: unix-wizards@sem.brl.mil Slightly a side question according to the Subject:, but how to setup a command for execution on the LAST day of the month ONLY? I could use: 0 0 31 1 * command 0 0 28 2 * command 0 0 31 3 * command and so on but that will not work on leap years... --Borje ----------------------------------------------------------------------------- Borje Josefsson, Computer centre, University of Lulea, S-951 87 Lulea, Sweden Tel: +46 920 91 262 (direct), +46 920 91 000 (operator). Fax: +46 920 972 88 Domain: bj@dc.luth.se Path: {uunet,mcsun,sunic}!dc.luth.se!bj ----------------------------- From: Christopher R Volpe <volpe@underdog.crd.ge.com> Subject: Re: Cron - First Saturday of the month Date: 15 Aug 90 20:57:54 GMT Sender: news@crdgw1.crd.ge.com To: unix-wizards@sem.brl.mil In article <1489@hagbard.dc.luth.se>, bj@dc.luth.se (B|rje Josefsson) writes: |>Slightly a side question according to the Subject:, but how to setup a |>command for execution on the LAST day of the month ONLY? |> |>I could use: |> 0 0 31 1 * command |> 0 0 28 2 * command |> 0 0 31 3 * command |> and so on |>but that will not work on leap years... |> |>--Borje Set the date on your machine to one day ahead of the real date, and tell cron to run your application on the first of each month. ( 1/2 :-) ) ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com ----------------------------- From: Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> Subject: Re: Cron - First Saturday of the month Date: 15 Aug 90 23:14:42 GMT To: unix-wizards@sem.brl.mil In article <1489@hagbard.dc.luth.se> bj@dc.luth.se (B|rje Josefsson) writes: : Slightly a side question according to the Subject:, but how to setup a : command for execution on the LAST day of the month ONLY? : : I could use: : 0 0 31 1 * command : 0 0 28 2 * command : 0 0 31 3 * command : and so on : but that will not work on leap years... I'd suggest (surprise, surprise) 0 0 * * * perl -e '(localtime(time + 24*60*60))[3] == 1 && exec "command"' or, more concisely 0 0 * * * perl -e 'exit+(localtime time+86400)[3]-1' && command Larry Wall lwall@jpl-devvax.jpl.nasa.gov ----------------------------- From: David Canzi <dmcanzi@watserv1.waterloo.edu> Subject: Re: Cron - First Saturday of the month Date: 16 Aug 90 00:22:29 GMT To: unix-wizards@sem.brl.mil In article <3706@aspect.UUCP> dave@aspect.UUCP (Dave Corcoran) writes: >In article <1990Aug11.030818.28876@watserv1.waterloo.edu>, dmcanzi@watserv1.waterloo.edu (David Canzi) writes: >> if [ `date | awk '{print $3}'` -le 7 ]; then > >or: >if [ `date +%d` -le 7 ] This doesn't work on all the machines I have access to, so I prefer the solution using awk. -- David Canzi ----------------------------- From: "LCDR Michael E. Dobson" <rdc30med@nmrdc1.nmrdc.nnmc.navy.mil> Subject: Re: Please add me to User list Date: 15 Aug 90 13:02:42 GMT To: unix-wizards@sem.brl.mil Periodicly we see these types of messages appearing in the various news groups that also include gatewayed mailing lists. This is generaly caused by two mechanisms. The first is posting the request to the gatewayed mailing list, ie info-unix@sem.brl.mil or unix-wizards@sem.brl.mil, instead of the administrative list, ie info-unix-request@sem.brl.mil. This is due to ignorance on the part of the person trying to get on the list (they may not have news on their system). The second and more serious reason is the request mail address being incorrectly gatewayed into the newsgroup. If this is happening, flames should be directed to the list maintainer, not the poor user who has no control over how his message is treated once it reaches the mail gateway system. -- Mike Dobson, Sys Admin for | Internet: rdc30med@nmrdc1.nmrdc.nnmc.navy.mil nmrdc1.nmrdc.nnmc.navy.mil | UUCP: ...uunet!mimsy!nmrdc1!rdc30med AT&T 3B2/600G Sys V R 3.2.2 | BITNET: dobson@usuhsb.bitnet WIN/TCP for 3B2 | MCI-Mail: 377-2719 or 0003772719@mcimail.com ----------------------------- From: Grant Grundler <grant@pescara.orc.olivetti.com> Subject: Re: Please add me to User list Date: 15 Aug 90 17:17:16 GMT Control: cancel <49280@ricerca.UUCP> Sender: news@orc.olivetti.com To: unix-wizards@sem.brl.mil ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Please add me to User list Date: 15 Aug 90 17:35:13 GMT To: unix-wizards@sem.brl.mil >Looks like the somebody needs to learn how to use "rn"! No, somebody just needs to have the protocol for joining/leaving mailing lists explained to them before being told about those mailing lists. There's no guarantee that his machine necessarily *gets* netnews; if it doesn't, "rn" (or any other newsreader) won't do him a lot of good.... ----------------------------- From: dxg@cai.com Subject: AT&T 3B2, PC-NFS, Curses - reverse video with werase() Keywords: ATT 3B2, PC-NFS, CURSES Date: 15 Aug 90 14:12:17 GMT To: unix-wizards@sem.brl.mil /********************************************************************** * * I am using PC-NFS Version 3.0 to connect to an AT&T 3B2 running UNIX * System V Release 3.2.1. My environment variable TERM is 'vt100'. * * I am developing a large application using Curses and have run into * a problem. I have to output a string to a window, in reverse video * and then clear this window. But for some reason when the window * is cleared the row that contains the reverse video character(s) * and all the rows that follow are cleared (output) in reverse video. * * This problem occurs when the last character output is in reverse video. * * The problem does not occur, if the last non-blank character output is * not in reverse video. * * The following source file is a small scale version of the problem. * * The compile command that I am using is: * cc $*.c -o $* -lm -lcurses * * Please let me know how I can work around this problem, or what I * am doing wrong. * * Thanks, * Constantine "Dean" Grammas * Computer Associates International * 201 University Avenue * Westwood MA, 02090 * (617) 329-7700 x3314 * */ /********************* **** TEST ROUTINE **** **********************/ #include <curses.h> /* * Repaint the the specified window */ rep_win( wid ) WINDOW *wid; { /* just for arguments sake, turn off the reverse video attribute */ wattroff( wid, A_REVERSE ); wnoutrefresh( wid ); touchwin( wid ); doupdate(); } /* END rep_win */ /* * Repaint the specified window and wait for a key stroke */ get_key( wid ) WINDOW *wid; { /* just for arguments sake, turn off the reverse video attribute */ wattroff( wid, A_REVERSE ); rep_win( wid ); beep(); wgetch( wid ); } /* END get_key */ /* * Clear the specified window and then repaint it */ clr_win( wid ) WINDOW *wid; { /* just for arguments sake, turn off the reverse video attribute */ wattroff( wid, A_REVERSE ); werase( wid ); rep_win( wid ); } /* END clr_win */ main() { WINDOW *wid; stdscr = initscr(); /* output a line of text in reverse video, and wait for a key stroke */ wattrset( stdscr, A_REVERSE ); mvwaddstr( stdscr, 10,10, "Press any key." ); wattroff( stdscr, A_REVERSE ); wattrset( stdscr, A_NORMAL ); get_key( stdscr ); /* clear the window, and wait for a keystroke * * NOTE: this is where the problem occurs. */ wattrset( stdscr, A_NORMAL ); clr_win( stdscr ); get_key( stdscr ); endwin(); } /* END main */ ----------------------------- From: MSHAW@wl9.prime.com Subject: Re: sendmail config file question Date: 15 Aug 90 14:49:00 GMT Nf-ID: #R:sparkyfs.istc.sri.com:-3255900:WL9:16300003:000:2301 Nf-From: WL9.Prime.COM!MSHAW Aug 15 14:49:00 1990 To: unix-wizards@sem.brl.mil I'm not a sendmail guru yet but here's my help anyway. To recap you put..... | We're getting ready to change our domain name, and I want to make sendmail | clever enough to handle mapping the old domain to the new one. Problem is, | we're already doing that from the domain name of about a year ago. | | Basically, right now I have: | | DDitstd.sri.com current domain name | DEistc.sri.com old domain name | | S1 | R$*<@$-.$E>$* $1<@$2.$D>$3 change domain name | R$*<@$E>$* $1<@$D>$2 change domain name | | and likewise for S2. Now, to handle both old domain names, I figured I | could use a class: | | DDerg.sri.com new domain name | CDistc.sri.com itstd.sri.com old domain names | | S1 | R$*<@$-.$=D>$* $1<@$2.$D>$3 change domain name | R$*<@$=D>$* $1<@$D>$2 change domain name | | and likewise for S2. | | But this doesn't work; the matches against the class fail. Reading the | sendmail manual, it mentions something about "token" being the unit of | a class. I'm assuming the match is failing because "istc.sri.com" and | "itstd.sri.com" are three tokens each rather than one. | | Is this right? If so, is there a way to do what I want with classes? | Unless you've done a typo' then you've defined a macro (with the D) and a class (with the C) both the macro and the class have the same name (D). I'd write something like the below instead. # # Define Macro N (New-domain-name) # and Class O (Old-domain-names) # DNerg.sri.com new domain name COistc.sri.com itstd.sri.com old domain names S1 R$*<@$-.$=O>$* $1<@$2.$O>$3 change domain name R$*<@$=O>$* $1<@$O>$2 change domain name Of course I'd also have the old domains defined in a file and then use the F command instead of C thus: FO/usr/lib/domains.old old domain names domains.old would contain.. istc.sri.com itstd.sri.com Then I'd be able to update the list of old domains without having to restart and reconfigure sendmail (just in case I moved yet again). Mike Shaw. /* The opinions expressed in this notice are my own and not those of Prime Computer Inc. */ ----------------------------- From: Neil Rickert <rickert@mp.cs.niu.edu> Subject: Re: sendmail config file question Date: 15 Aug 90 22:41:30 GMT To: unix-wizards@sem.brl.mil In article <16300003@WL9.Prime.COM> MSHAW@WL9.Prime.COM writes: > >I'm not a sendmail guru yet but here's my help anyway. > >Unless you've done a typo' then you've defined a macro (with the D) and a >class (with the C) both the macro and the class have the same name (D). I'd >write something like the below instead. There is nothing wrong with a macro and a class having the same name. If they are related it may even be a good idea. > >Of course I'd also have the old domains defined in a file and then use the >F command instead of C thus: > >FO/usr/lib/domains.old old domain names > >domains.old would contain.. > >istc.sri.com >itstd.sri.com > >Then I'd be able to update the list of old domains without having to restart >and reconfigure sendmail (just in case I moved yet again). > Wrong! You wouldn't have to change sendmail.cf. But you would still need to rebuild the freeze file (if used) with sendmail -bz, and you would still need to kill and restart the daemon. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Sci Dept, Northern Illinois U., DeKalb IL 60115 rickert@cs.niu.edu +1-815-753-6940 =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= ----------------------------- From: Thomas Truscott <trt@rti.rti.org> Subject: Re: Is HDB locking safe? Date: 15 Aug 90 19:46:12 GMT To: unix-wizards@sem.brl.mil > ... HDB assumes that if the pid recorded > in the lock file no longer corresponds to an active process, the lock file is > defunct and can safely be removed. I can't for the life of me figure out a > safe way of doing this. A crucial detail in recovering from a breakdown in the lock protocol is avoiding a race between two or more processes that are simultaneously attempting recovery. Usually a strategic pause is all that is needed, and as you can see in the HDB code below there is just such a pause. > static int > checklock(lockfile) > char *lockfile; > { > ... > if ((lfd = open(lockfile, 0)) < 0) > return(0); > ... > if ((kill(lckpid, 0) == -1) && (errno == ESRCH)) { > /* > * If the kill was unsuccessful due to an ESRCH error, > * that means the process is no longer active and the > * lock file can be safely removed. > */ > unlink(lockfile); > sleep(5); /* avoid a possible race */ > return(1); > } > > In this code there is no guarantee that lfd and lockfile correspond to the > same file at the time of the unlink. But there *is* a guarantee -- the "sleep(5);"!! [I changed the sleep() line to match the one in 4.3 BSD uucp "ulockf.c"] Consider a process "X" that discovers that the locking process has terminated. X unlinks the lockfile, but then it *pauses* before it attempts to grab the lock for itself (done by code not shown above). Now consider scenario #1 for another process "Y": At nearly the same instant Y discovers the dead lock, so it also unlinks the lockfile (of course only one unlink can succeed) and it *also pauses*. Whenever X and/or Y resume there is no lock present, so attempts to grab it proceed in the usual way (code not shown above). Now consider scenario #2 for Y: Just after X has unlinked the lockfile, Y calls checklock() and discovers no lock is present. No problem, it just attempts to grab the lock in the usual way (code not shown above). When X awakes from its slumber it will discover that Y has already grabbed the lock, so X will just have to wait. The HDB code is nice, but does have flaws: (a) A "sleep(1);" is not enough to avoid a race on a very busy system. (b) Lock recovery is obscure, so the sleep() call should be commented. (c) Protocol breakdown is a bad thing, and should be reported: logent(lockfile, "DEAD LOCK"); The 4.3 BSD ulockf.c routine has all of these nice features. Tom Truscott ----------------------------- From: Claude Goutier <goutier@iro.umontreal.ca> Subject: Re: Is HDB locking safe? Date: 16 Aug 90 09:17:30 GMT Sender: news@iro.umontreal.ca To: unix-wizards@sem.brl.mil In article <4024@rtifs1.UUCP> trt@rti.rti.org (Thomas Truscott) writes: > >A crucial detail in recovering from a breakdown in the lock protocol >is avoiding a race between two or more processes that are simultaneously >attempting recovery. Usually a strategic pause is all that is needed, >and as you can see in the HDB code below there is just such a pause. > > ... > >The HDB code is nice, but does have flaws: >(a) A "sleep(1);" is not enough to avoid a race on a very busy system. >(b) Lock recovery is obscure, so the sleep() call should be commented. >(c) Protocol breakdown is a bad thing, and should be reported: > logent(lockfile, "DEAD LOCK"); >The 4.3 BSD ulockf.c routine has all of these nice features. > > Tom Truscott If a sleep(1) is not long enough, why does a sleep(5) is? If something is not prohibited to happen by construction (read solid and serious interlock), whatever small the probability of it to happen, it WILL happen! One should never try to be smarter than a race condition. The only way is to use true and solid interlocks (which should be provided in the kernel and with the cooperation of the hardware). Have you ever programmed on a machine with a fast CPU and ten peripheral processors all accessing the same memory at the same time ? -- Claude Goutier Services informatiques, Universite de Montreal C.P. 6128, Succ "A", Montreal (Quebec) goutier@jsp.umontreal.ca Canada H3C 3J7 ----------------------------- From: Roar Steen <roar@hpserv1.uit.no> Subject: Broadcast UDP packets Date: 15 Aug 90 19:56:59 GMT Sender: USENET News System <news@hod.uit.no> To: unix-wizards@sem.brl.mil Is there anybody out there who has some piece of code that demonstrates broadcast of UDP-packets. My system is a HP9000/375 workstation running HP-UX 7.0. -- //// Roar Steen // N-9001 TROMSOE, NORWAY / /// Computer Science Department // Phone : + 47 83 44051 // // University of Tromsoe // Telefax: + 47 83 44580 /// / NORWAY // Email: roar@sfd.uit.no //// ----------------------------- From: 8592x2 <jeff@astph.uucp> Subject: shmat() system call? Keywords: shmat() systemV Date: 15 Aug 90 20:11:02 GMT To: unix-wizards@sem.brl.mil Question concerning the shared memory attach call: I am writing a shared memory allocation manager for a multi-user database. This manager will allow several processes to be attached to the same memory segment at the same time. The first process to attach to the shared memory segment will be returned a memory address that points to the shared memory block. I need to know if additional attaches by other processes will be guaranteed to return the same address as that the first process was returned. I am aware that you can request a particular address, but why bother communicating that information between the processes if the same address is returned anyway? I would appreciate any answers or direction to documentation. Thanks jeff martin astph!jeff@psuvax1 philadelphia phillies ----------------------------- From: Warren Tucker <wht@n4hgf.mt-park.ga.us> Subject: Re: shmat() system call? Keywords: shmat() systemV Date: 16 Aug 90 02:37:45 GMT To: unix-wizards@sem.brl.mil In article <27@astph.UUCP> jeff@astph.UUCP (8592x2) writes: > >Question concerning the shared memory attach call: > >I am writing a shared memory allocation manager for a multi-user >database. >I need to know if additional attaches by other processes will be >guaranteed to return the same address as that the first process >was returned. To be sure, specify the attach address, regardless of what the FM says. Make a small program that passes 0 for the address and see what it returns. Then, use that value hardcoded, possibly #defined for each arcitecture you plan to run the program on. I.E., /*---------------------- header file --------------------*/ #if defined(M_I286) #define SHMPTR char far * #define SYSPTR struct system_control * #else #define SHMPTR char * #define SYSPTR struct system_control * #endif #if defined(M_SYS5) #if defined(M_I386) #define SHM_ATTACH_ADDR ((SHMPTR)0x67000000L) /* 386 */ #else #define SHM_ATTACH_ADDR ((SHMPTR)0x00670000L) /* 286 */ #endif #else /* not xenix */ #ifdef (pyr) #define SHM_ATTACH_ADDR ((SHMPTR)0xC0000000L) /* PYRAMID */ #else #define SHM_ATTACH_ADDR ErrorInHeaderFile #endif #endif /*---------------------- code file --------------------*/ if((sys = shmat(*pshmid,SHM_ATTACH_ADDR,0)) != (SHMPTR)SHM_ATTACH_ADDR) { /* attach error: either returned (SHMPTR)-1 or wrong address */ } ----------------------------------------------------------------------- Warren Tucker, TuckerWare gatech!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US "Tell the moon; don't tell the March Hare: He is here. Do look around." ----------------------------- From: "BURNS,JIM" <gt0178a@prism.gatech.edu> Subject: Re: shmat() system call? Date: 16 Aug 90 05:41:44 GMT To: unix-wizards@sem.brl.mil in article <27@astph.UUCP>, jeff@astph.UUCP (8592x2) says: > > > Question concerning the shared memory attach call: > > I am writing a shared memory allocation manager for a multi-user > database. This manager will allow several processes to be attached > to the same memory segment at the same time. The first process to > attach to the shared memory segment will be returned a memory address > that points to the shared memory block. > > I need to know if additional attaches by other processes will be > guaranteed to return the same address as that the first process > was returned. I am aware that you can request a particular address, > but why bother communicating that information between the processes > if the same address is returned anyway? I would appreciate any > answers or direction to documentation. I don't see why not. The shmget(2) routine specifies the memory block size. All the shmat(2) routine does is return a pointer to the beginning of that block (by default). The same block is returned to different processes if they use the same shmid returned by shmget(2). Adapted from the HP 9000/800 HP-UX Real Time Programmers Manual: On shmget(2): "If your communication application consists of related processes, you should call shmget(2) with the key parameter set to IPC_PRIVATE in the following way: myshmid = shmget (IPC_PRIVATE, 4096, 0600); "This call to shmget(2) returns a unique shared memory identifier (shmid), which is saved in the variable myshmid, for the newly created shared memory segment. The size of the segment is 4096 bytes and its access permissions are read and write permission for the owner. This call to shmget(2) should appear in your program sometime before the fork() statement so that the child processes in your communication application will inherit myshmid. "If your communication application consists of unrelated processes, you should call shmget(2) with the key parameter set to the return value of the ftok() subroutine [or just use an ascii representation of a 4 character string that you know will be unique. - JB ] [...] As an example, all unrelated processes in a communication application can call shmget(2) in the following [altered - JB ] way:" myshmid = shmget (0x50485331, 4096, IPC_CREAT|600); to use a key of "PHS1". On shmat(2): "Once a process has a valid shmid, it usually wants to attach, perhaps to lock, to read and/or to write to, and then to detach the shared memory segment. [...] "A process must invoke the shmat() system call to attach a shared memory segment to the data space of the process. The man page for shmop(2) lists three parameters for shmat(): shmid, shmaddr, and shmflg. "The first parameter, shmid, must be a valid shared memory identifier as explained in the previous section. "The second parameter, shmaddr, is the attach address of the shmid parameter. Parameter shmaddr should be 0 in almost all cases. Only at certain times and only in certain implementations of HP-UX can shmaddr be other than 0. If a previous shmat() has not been called on the shmid; that is, if the shared memory segment has not already been attached, then the only correct value for shmaddr is 0. If, however, some process has already called shmat() on the specified shmid, then the shmaddr can be 0 or some other implementation - dependent value. [...] [As it turns out, non-zero parameters aren't supported at all on the model 800 architechture - only the 300. -JB ] "The third parameter of shmat(), shmflg, is used only to further restrict the owner's access permissions to the shared memory segment. [...]" Hope this answers your question. -- BURNS,JIM Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332 uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a Internet: gt0178a@prism.gatech.edu ----------------------------- From: "BURNS,JIM" <gt0178a@prism.gatech.edu> Subject: Re: shmat() system call? Date: 16 Aug 90 06:32:18 GMT To: unix-wizards@sem.brl.mil in article <187@n4hgf.Mt-Park.GA.US>, wht@n4hgf.Mt-Park.GA.US (Warren Tucker) says: < In article <27@astph.UUCP> jeff@astph.UUCP (8592x2) writes: < To be sure, specify the attach address, regardless of what the FM says. < Make a small program that passes 0 for the address and see what it < returns. Then, use that value hardcoded, possibly #defined for each < arcitecture you plan to run the program on. What if yours is not the only application creating and deleting shared memory segments? Are you saying you always get the same address? ~ ~ ~ ~ ~ ~ ~ ~ ~ "/usr/tmp/vn002876" 13 lines, 646 characters still want to post it ? n not posted :more (34%): -- BURNS,JIM Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332 uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a Internet: gt0178a@prism.gatech.edu ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Curses question Keywords: key interpretation problems Date: 15 Aug 90 20:33:18 GMT To: unix-wizards@sem.brl.mil >(editor's note: This may be a duplicate transmision. Sorry if you got it >twice) I only saw it once, but I did see the matching posting in "comp.sys.sun".... >The first one involves interpretation of input keys. How can one tell the >difference between the forward and backward tabs?? When I run my test >program, I get 0x09 for both. As noted, the problem here is that in a "shelltool" window, there *is* no difference. What's more, different terminals may transmit different things for the "backward tab", assuming they even have one; the BSD "curses" doesn't have any way of recognizing the particular terminal's notion of a "backward tab" sequence and translating it into some common code for "backward tab". The S5 "curses" might be able to do that. >In addition, the code I'm getting in my test program for a return is >different that the code which is returned in the real program (0x0a vs. >0x0d) and yes, these two programs are being run on the same system. But probably *not* with the same modes. 0x0a is NL, and 0x0d is CR. The RETURN key on most terminals - including the "terminal" emulated by a "shelltool" - sends CR; however, in some modes the UNIX tty driver turns CR into NL. Check out such "curses" functions as "nl()" and "nonl()", which affect whether this mapping is in effect.... ----------------------------- From: William Kucharski <kucharsk@number6.solbourne.com> Subject: Re: Another "why won't this work" program Date: 16 Aug 90 00:26:38 GMT Sender: news@solbourne.com To: unix-wizards@sem.brl.mil In article <24183@adm.BRL.MIL> BKEHOE@widener writes: >/* > * This is being run on a Sun SS1 under 4.0.3. > * Theoretically, according to the Design & Implementation of 4.3BSD Unix, > * this should print out the ascii version of each process's current > * directory...instead, it chokes on u->u_cwd->cw_dir, which is in the > * u struct in sys/user.h .. any help, suggestions, etc would be greatly > * appreciated. > > */ > >/* > * cc -o cwd cwd.c -lkvm > */ > >#include <stdio.h> >#include <kvm.h> >#include <fcntl.h> >#include <ctype.h> >#include <pwd.h> >#include <sys/param.h> >#include <sys/time.h> >#include <sys/proc.h> >#include <sys/user.h> ... > (void) printf("Name\t\tDir\n"); > kvm_setproc (kd); > while ((proc = kvm_nextproc (kd))) > if (proc->p_stat != SZOMB && proc->p_uid) { > if (!(user = kvm_getu(kd, proc))) > continue; > (void) printf("%s\n", (getpwuid(proc->p_uid))->pw_name); >/* Curtains & Slow Music */ > (void) printf("%s\n", user->u_cwd->cw_dir); >/* It dies, but the user structure's fine (printing user->u_comm works); I > stepped thru it with gdb & discovered that the pointer user->u_cwd is off in > never-never-land; is it a valid entry in >the user structure? */ > } >} That's because the user->u_cwd pointer is really a pointer into the kernel's memory space, rather than user memory space. You need to do something like the following to read the contents of the kernel memory in question into user space: ... char dir[MAXPATHLEN]; char rootdir[MAXPATHLEN]; struct ucwd cwd; if (kvm_read(kd, (unsigned long)userp->u_cwd, (char *)&cwd, sizeof(struct ucwd)) == sizeof(struct ucwd)) { if ((kvm_read(kd, (unsigned long)cwd.cw_dir, dir, MAXPATHLEN) == MAXPATHLEN) && (kvm_read(kd, (unsigned long)cwd.cw_root, rootdir, MAXPATHLEN) == MAXPATHLEN)) { if ((*rootdir) || (*dir)) printf("cwd: %s%s\n", rootdir, dir); else printf("cwd: /\n"); } } ... -- =============================================================================== | Internet: kucharsk@Solbourne.COM | William Kucharski | | uucp: ...!{boulder,sun,uunet}!stan!kucharsk | Solbourne Computer, Inc. | === The sentiments expressed above are MY opinions, NOT those of Solbourne. === ----------------------------- From: "jeffrey.n.jones" <jeffj@cbnewsm.att.com> Subject: How to restrict commands in rsh? Date: 15 Aug 90 21:37:00 GMT To: unix-wizards@sem.brl.mil A co-worker and I were trying to figure out how to restrict the commands a user can use in rsh. In the manual there is a mention of a directory where you can put the commands that you want to restrict called /usr/rbin How do you do this? Do you put all of the commands in a single file? What do you call this file? Thanks ahead of time for any help! Jeff Jones -- Jeff Jones | Prediction is very difficult, especially UUCP uunet!seeker!jeffj | about the future. Infolinc BBS 415-778-5929 | Niels Bohr ----------------------------- From: Bertrand Meyer <bertrand@eiffel.uucp> Subject: Vi fails on a Sun-4 Keywords: Illegal instruction Date: 15 Aug 90 22:09:47 GMT To: unix-wizards@sem.brl.mil Has anyone run into the following problem, which is becoming an increasing nuisance for me? Vi (on a Sun-4, running SunOS 4.0) fails according to totally unpredictable patterns. For example (vg is an alias that uses vi): > [Rome] bm 592 - vg instruction > Illegal instruction (core dumped) > [Rome] bm 593 - vi Grammar/instruction > Illegal instruction (core dumped) > [Rome] bm 594 - vi Grammar/instruction > Illegal instruction (core dumped) > [Rome] bm 595 - cd Grammar > [Rome] bm 596 - vi instruction > Illegal instruction (core dumped) I have experienced similar problems for a long time, but it used to be only when calling vi with several file arguments (I have many scripts which do this, based on grep searching). Now, as the above shows, it's occurring even with just one file! Another example occurred as I was trying to send mail (describing the problem!) and the ~v command of mail failed with ``Fatal error in "usr/ucb/vi"''. The problem does not occur identically in different windows. Usually command windows fail less often than shell windows. Yesterday, I experienced a situation with two windows, where vi would work in window A (a command window) except if the number of file arguments was equal to 2, and would work in window B (a shell window) for 1 or 2 arguments, but apparently for no other number of arguments! I would be grateful if anyone has any suggestion about what is going on (other than ``switch to Emacs''). A text editor seems a pretty basic tool to me, and after all these years one might hope that vi would work. I don't suspect Bill Joy reads this, however. I would appreciate mail replies to bertrand@eiffel.com. If I receive anything of general interest I will post a summary. Thanks in advance. -- Bertrand Meyer Interactive Software Engineering, Santa Barbara, CA. bertrand@eiffel.com ----------------------------- From: Mike McNally <m5@lynx.uucp> Subject: Directory compression Keywords: 4.3BSD Date: 15 Aug 90 23:03:16 GMT To: unix-wizards@sem.brl.mil Does 4.3BSD (or anything else) dynamically compress directories when entries are removed? If so, how does the system deal with consistency? Like if I'm reading while something else is unlinking and the directory is being compressed, how does the world go on living? -- Mike McNally Lynx Real-Time Systems uucp: {voder,daver}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go. ----------------------------- End of UNIX-WIZARDS Digest **************************
postmaster@sandia.gov (SMTP MAILER) (08/20/90)
----Reason for mail failure follows---- Sending mail to <math!ckaul@cs.sandia.gov> : Could not be delivered for three days. ----Transcript of message follows---- Date: 17 Aug 90 05:23:00 MDT From: unix-wizards@BRL.MIL Subject: UNIX-WIZARDS Digest V10#119 To: "math!ckaul" <math!ckaul@cs.sandia.gov> Return-Path: <incoming-unix-wizards-request@sandia.gov> Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Fri, 17 Aug 90 05:13:44 MDT Received: from SEM.BRL.MIL by SEM.BRL.MIL id aa01304; 17 Aug 90 5:55 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa01271; 17 Aug 90 5:45 EDT Date: Fri, 17 Aug 90 05:45:03 EST From: The Moderator (Mike Muuss) <Unix-Wizards-Request@BRL.MIL> To: UNIX-WIZARDS@BRL.MIL Reply-To: UNIX-WIZARDS@BRL.MIL Subject: UNIX-WIZARDS Digest V10#119 Message-ID: <9008170545.aa01271@SEM.BRL.MIL> UNIX-WIZARDS Digest Fri, 17 Aug 1990 V10#119 Today's Topics: "to big" error on PDP-11/73 Re: sed bug? Re: csh weirdness (HELP!) Re: shmat() system call? UNIX System Administration/Programming Positions Available Re: Vi fails on a Sun-4 Re: Checkpoint/Restart (was "no subject - file transmission") Re: Another "why won't this work" program Re: Is HDB locking safe? Problems with DIGIBOARD PC/4 ----------------------------------------------------------------- From: "Jay A. Snyder" <jay@gdx.uucp> Subject: "to big" error on PDP-11/73 Date: 15 Aug 90 21:28:40 GMT To: unix-wizards@sem.brl.mil I compiled C-Kermit ver. 4E on a Tektronix model 8061 (DEC LSI 11/73). The OS is called TNIX (tek's version of V7). When I tried to run the executable, it said: kermit: to big The machine has 512K of RAM and 4700 blocks of swap. The executable is only 114K. The largest executables I could find on the machine where less than 64K. Is there a limit to the executable size on 11/73's? I'm also trying to get Micro-Emacs to compile, and I get "too many defines" error from the c-compiler. Any one have any ideas there? Thanks, J ...uunet!wa3wbu!gdx!jay -- ============================================================================== Jay A. Snyder "Let Me Up! I've had enough" wa3wbu!gdx!jay@uunet.uu.net uunet!wa3wbu!gdx!jay ----------------------------- From: "John F. Haugh II" <jfh@rpp386.cactus.org> Subject: Re: sed bug? Date: 16 Aug 90 04:40:16 GMT X-Clever-Slogan: Recycle or Die. To: unix-wizards@sem.brl.mil In article <24172@adm.BRL.MIL> stanonik@nprdc.navy.mil (Ron Stanonik) writes: >We've run into what appears to be a sed bug in sunos4.X (sun3 snd sun4) >and in sysVr3 (on a 3b2). Here's a little sed program to demonstrate it > >1 s/.*/&/p >d > >I'd expect this to print only the first line, and indeed that's what happens >in 4.3bsd (on a vax 780). In sunos4.X and sysVr3, however, nothing is printed. By all accounts it is fixed in BSD 4.3 and broken in every other version of SED I've had my hands on. The way the bug was reported for AIX 3.1 was % sed -e 's/abc/ABC/p' -e d << EOF abc abc123 EOF and the output should have been ABC ABC123 but instead, nothing at all was printed. >Bug? Yes. Bug. -- John F. Haugh II UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 832-8832 Domain: jfh@rpp386.cactus.org ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: sed bug? Date: 16 Aug 90 19:41:54 GMT To: unix-wizards@sem.brl.mil >Bug? Or misfeature, although some scripts in S5 (among others, "lint", I think) depend on that behavior. As I remember, the behavior exhibited by S5 was also exhibited in UNIX/32V (or, at least, the part of the code that differs was basically the same as in S5), while in V7 it worked the BSD way. I think the 32V code was older (yes, 32V was allegedly a V7 port to the VAX, but they may have started with something older than V7), so it *seems* the change from the 32V/S5 behavior to the V7/BSD behavior might have been intended as a bug fix or improvement. I think the S5 "lint"s dependency on the 32V/S5 behavior can be fixed; I think there are cases where dependency on the V7/BSD behavior cannot. POSIX 1003.2 may specify that this has to be done the V7/BSD way. ----------------------------- From: Rob McMahon <cudcv@warwick.ac.uk> Subject: Re: csh weirdness (HELP!) Date: 16 Aug 90 09:04:17 GMT Sender: Network news <news@warwick.ac.uk> To: unix-wizards@sem.brl.mil In article <8000007@hpopd.HP.COM> bd@hpopd.HP.COM (Bob Desinger) writes: >> to kill every instance of a.out I get >> `ps | grep a.out | awk '{printf("%d ",$1);}'`: Ambiguous. > >Can you work around this by changing the awk program to generate the >kill commands, then piping the awk output to the shell? ... The best workaround is just to use \kill `ps | grep a.out | awk '{printf("%d ",$1);}'` to avoid using the shell builtin. Rob -- UUCP: ...!mcsun!ukc!warwick!cudcv PHONE: +44 203 523037 JANET: cudcv@uk.ac.warwick INET: cudcv@warwick.ac.uk Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England ----------------------------- From: Thomas Tornblom <thomas@uplog.se> Subject: Re: shmat() system call? Date: 16 Aug 90 10:32:52 GMT Sender: Thomas Tornblom <thomas@uplog.se> To: unix-wizards@sem.brl.mil In article <187@n4hgf.Mt-Park.GA.US> wht@n4hgf.Mt-Park.GA.US (Warren Tucker) writes: In article <27@astph.UUCP> jeff@astph.UUCP (8592x2) writes: > >Question concerning the shared memory attach call: > >I am writing a shared memory allocation manager for a multi-user >database. >I need to know if additional attaches by other processes will be >guaranteed to return the same address as that the first process >was returned. To be sure, specify the attach address, regardless of what the FM says. Make a small program that passes 0 for the address and see what it returns. Then, use that value hardcoded, possibly #defined for each arcitecture you plan to run the program on. [example deleted] This is not guaranteed to work. Typically the kernel allocates the addresses depending of the memory layout of the running process. Our sysV.2 68k kernel uses the current end of bss rounded up with some constant as the lowest base for shm. It also checks that the segment doesn't overlap into the stack or other shared memory segments. If you must have the same addresses between the processes (which is nice for pointers and stuff) I'd pick some high constant address, say 0x[48c]0000000 or so that isn't likely to map onto anything on the architectures you're using. Thomas -- Real life: Thomas Tornblom Email: thomas@uplog.se Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden ----------------------------- From: Christopher R Volpe <volpe@underdog.crd.ge.com> Subject: Re: shmat() system call? Date: 16 Aug 90 17:47:23 GMT Sender: news@crdgw1.crd.ge.com To: unix-wizards@sem.brl.mil In article <THOMAS.90Aug16123252@uplog.uplog.se>, thomas@uplog.se (Thomas Tornblom) writes: |> |>If you must have the same addresses between the processes (which is nice for |>pointers and stuff) I'd pick some high constant address, say 0x[48c]0000000 |>or so that isn't likely to map onto anything on the architectures you're using. |> I was working on a project with a couple of people last summer where we had to use shared memory segments and processes had to exchange pointers. We decided is just wasn't worth it to take chances on a hardcoded address that might fail on any particular run because the kernel couldn't attach the segment at the address specified. So we just did all the pointer exchanging in terms of offsets from the base address of the segment and let each individual process convert between offsets and virtual addresses. It's a little tedious at most (like when you're sharing linked lists), but the added flexibility and reliability is worth the effort, IMHO. ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com ----------------------------- From: Warren Tucker <wht@n4hgf.mt-park.ga.us> Subject: Re: shmat() system call? Date: 16 Aug 90 19:15:40 GMT To: unix-wizards@sem.brl.mil In article <THOMAS.90Aug16123252@uplog.uplog.se> thomas@uplog.se (Thomas Tornblom) writes: >In article <187@n4hgf.Mt-Park.GA.US> wht@n4hgf.Mt-Park.GA.US (Warren Tucker) writes: > > In article <27@astph.UUCP> jeff@astph.UUCP (8592x2) writes: > To be sure, specify the attach address, regardless of what the FM says. >This is not guaranteed to work. Typically the kernel allocates the addresses >depending of the memory layout of the running process. In all of the implementations I have used, the kernel performs this optimzation. And of course, it has been working me for 4 years. ----------------------------------------------------------------------- Warren Tucker, TuckerWare gatech!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US "Tell the moon; don't tell the March Hare: He is here. Do look around." ----------------------------- From: Warren Tucker <wht@n4hgf.mt-park.ga.us> Subject: Re: shmat() system call? Date: 16 Aug 90 19:17:35 GMT To: unix-wizards@sem.brl.mil In article <12638@hydra.gatech.EDU> gt0178a@prism.gatech.EDU (BURNS,JIM) writes: >in article <187@n4hgf.Mt-Park.GA.US>, wht@n4hgf.Mt-Park.GA.US (Warren Tucker) says: >< In article <27@astph.UUCP> jeff@astph.UUCP (8592x2) writes: >< To be sure, specify the attach address, regardless of what the FM says. >< Make a small program that passes 0 for the address and see what it >< returns. Then, use that value hardcoded, possibly #defined for each >< arcitecture you plan to run the program on. > >What if yours is not the only application creating and deleting shared >memory segments? Are you saying you always get the same address? Yes, in a virtual system where the shmat'd address is virtual. ----------------------------------------------------------------------- Warren Tucker, TuckerWare gatech!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US "Tell the moon; don't tell the March Hare: He is here. Do look around." ----------------------------- From: Suu Quan <quan@hpcc01.hp.com> Subject: Re: shmat() system call? Date: 16 Aug 90 19:39:15 GMT To: unix-wizards@sem.brl.mil / hpcc01:comp.unix.wizards / jeff@astph.UUCP (8592x2) / 1:11 pm Aug 15, 1990 / > >Question concerning the shared memory attach call: > >I need to know if additional attaches by other processes will be >guaranteed to return the same address as that the first process >was returned. I am aware that you can request a particular address, >but why bother communicating that information between the processes >if the same address is returned anyway? I would appreciate any >answers or direction to documentation. In spite of other positive answers, the real answer is NO. The exactly same program, run on different kernels, will most probably result in different attached address. The attached address depends on too many different kernel parameters to discuss here in a few lines. On the other hand, if you want to request a particular address, the down side of it is that you don't know whether any other applications has used that segment of address or not. This practice is definitely not recommended. ----------------------------- From: Randolph Gary Smith <ut-emx!gary@emx.utexas.edu> Subject: UNIX System Administration/Programming Positions Available Keywords: UNIX,Mach,MIMD,SIMD,kernel,UNICOS,CONVEX,SunOS Date: 16 Aug 90 12:52:54 GMT Sender: fpst@hubcap.clemson.edu Approved: parallel@hubcap.clemson.edu To: unix-wizards@sem.brl.mil Following are two Senior Operating System Specialist job positions currently available at The University of Texas System Center for High Performance Com- puting located in northwest Austin, Texas. Instructions for applying follow the job descriptions. ------------------------------------------------------------------------------ Position 1: Senior Operating System Specialist Posting Number: 0-08-01-07-9365 Monthly Salary: $3017 or more Date Available: 8/8/90 40 hours/week; work hours flexible Required Qualifications: Bachelor's degree and five years of programming or systems analysis experience, of which two years are in operating systems programming; or high school graduation or equivalent and nine years of programming or systems analysis experience, of which two years are in operating systems programming Initial Qualifications: Extensive experience as a system administrator for large-scale UNIX production system(s). Experience in coding in C an FORTRAN. Expe- rience with computer networking concepts, including experience with Sun's NFS, Apollo's NCS, and the lower-level protocols on which they are built. Preferred Qualifications: Knowledge of the fundamental algorithms and data structures implemen- ting the System V UNIX operating system or the 4.2/4.3 BSD UNIX ope- rating system, including the file subsystem and process control sub- system of the kernel. Understanding of the kernel system call inter- face to user-level processes. Experience with the CRAY UNICOS, CONVEX UNIX, and SunOS UNIX systems at the system administration and develop- ment levels. Experience with computer networking administration. Thorough knowledge and understanding of computer architecture. Job Duties: To be explained during interview. ------------------------------------------------------------------------------- Position 2: Senior Operating System Specialist Posting Number: 0-08-09-02-9365 Monthly Salary: $3017 or more Date Available: 9/1/90 40 hours/week; work hours flexible Required Qualifications: Bachelor's degree and five years of programming or systems analysis experience, of which two years are in operating systems programming; or high school graduation or equivalent and nine years of programming or systems analysis experience, of which two years are in operating systems programming Initial Qualifications: Extensive experience as a system administrator and resource scheduling and accounting software developer for UNIX and/or Mach systems. Under- standing of the fundamental opportunities and limitations in moderately to massively parallel SIMD and MIMD computer systems. Preferred Qualifications : Extensive experience with systems software development on massively parallel SIMD and MIMD computer systems in a distributed computing environment. Familiarity with architectural details of most massively parallel SIMD/MIMD distributed- and shared-memory computer systems. Bachelor's degree in computer science or engineering. Job Duties: To be explained during interview. ------------------------------------------------------------------------------- If you are interested in either position, send a current resume to: Janet McCord UT System CHPC Balcones Research Center 10100 Burnet Rd Austin, TX 78758-4497 Telephone: 512/471-2418 FAX: 512/471-2445 email: jnet@hermes.chpc.utexas.edu ----------------------------- From: Bertrand Meyer <bertrand@eiffel.uucp> Subject: Re: Vi fails on a Sun-4 Keywords: Illegal instruction Date: 16 Aug 90 17:23:50 GMT To: unix-wizards@sem.brl.mil In the article referenced above I mentioned a problem I was having with vi under csh, failing in inexplicable ways on a Sun-4 running 4.0. Many thanks to the several people who responded overnight and allowed me to correct the problem. For the benefit of others, here is one of the responses by Nick W. Holloway, I believe from the University of Warwick: > This is a bug with SunOS 4.0 (even up to 4.0.3). If the size of your > environment and the arguments passed to vi are of a magic size, then vi > will core dump with an illegal instruction. It is not unique to vi, it > just happens that it occurs frequently with vi. If you have access to > back issues of sunspots, have a look at the message in Volume 7, Issue > 26, Subject "Obscure SunOS Bug". This particular bug is fixed in 4.1. > > I imagine the reason that it fails differently in different windows is > that the environment is different sizes. To see this, try using the > command 'printenv | wc -c'. > > The workaround is to just put some junk environment variables in your > environment to take it over this magic number, or remove some to take > it under. The workaround suggested by Mr. Holloway (and several others in essentially equivalent terms) does work so far for me. Thank you very much. -- -- Bertrand Meyer bertrand@eiffel.com ----------------------------- From: Randolph Langley <langley@ds1.scri.fsu.edu> Subject: Re: Checkpoint/Restart (was "no subject - file transmission") Date: 16 Aug 90 21:29:15 GMT Sender: news@sun13.scri.fsu.edu To: unix-wizards@sem.brl.mil There is a paper, "Job and Process Recovery In A UNIX-based Operating System", by Brent Kingsbury and John Kline, that talks about UNICOS's checkpointing/restarting capabilities. It is available in the Cray documentation distribution, and I would guess directly from Cray. I also note that the authors have e-mail addresses: they are brent@yafs.cray.com and jtk@hall.cray.com. rdl ----------------------------- From: Guy Harris <guy@auspex.auspex.com> Subject: Re: Another "why won't this work" program Date: 16 Aug 90 19:35:50 GMT To: unix-wizards@sem.brl.mil "BKEHOE@widener" isn't a very usable email address, and the Path: line ended with "news", so I was unable to mail this. Methinks you should have a talk with your mail or netnews administrator, asking them to fix the From: line on outgoing postings.... >/* > * This is being run on a Sun SS1 under 4.0.3. > * Theoretically, according to the Design & Implementation of 4.3BSD Unix, > * this should print out the ascii version of each process's current > * directory...instead, it chokes on u->u_cwd->cw_dir, which is in the > * u struct in sys/user.h .. any help, suggestions, etc would be greatly > * appreciated. Well, actually, 4.3BSD UNIX doesn't *have* a "u_cwd" member of the "u" structure, so I'd hope that the BSD book *doesn't* suggest that it should work. That field is a SunOS-ism, introduced as part of the C2 security stuff so that the auditing code can get the full pathname of a file. > while ((proc = kvm_nextproc (kd))) > if (proc->p_stat != SZOMB && proc->p_uid) { > if (!(user = kvm_getu(kd, proc))) > continue; > (void) printf("%s\n", (getpwuid(proc->p_uid))->pw_name); Well, you probably want to call "getpwuid()" and store the result somewhere, and then check if it's NULL, before using it; it may not be *likely* to fail, but it *can* fail. >/* Curtains & Slow Music */ > (void) printf("%s\n", user->u_cwd->cw_dir); >/* It dies, but the user structure's fine (printing user->u_comm works); I > stepped thru it with gdb & discovered that the pointer user->u_cwd > is off in never-never-land; is it a valid entry in the user structure? */ Do you mean "is 'u_cwd' a valid entry in the user structure?" Well, maybe. I'm not sure if it's kept up-to-date if you haven't configured the C2 security stuff into your kernel (SYSAUDIT). However, even if it *is* kept up-to-date, it doesn't quite point into user-mode data, obviously. You'll have to grab the pointer value from "u_cwd" and use "kvm_read()" to read it from the *kernel's* address space into a private copy. Then, once you've done that, bear in mind that the "cw_dir" and "cw_root" members of the structure pointed to by "u_cwd" are *themselves* pointers into the kernel's address space, and read the strings to which they point using "kvm_read()" as well. Stepping through kernel data structures is more subtle than you might think. Pointers in kernel data structures *cannot*, in most systems, simply be dereferenced; even if the kernel-mode and user-mode address spaces are common, the kernel data is probably read-protected (for obvious reasons!). ----------------------------- From: Peter da Silva <peter@ficc.ferranti.com> Subject: Re: Is HDB locking safe? Date: 16 Aug 90 19:49:10 GMT To: unix-wizards@sem.brl.mil In article <4024@rtifs1.UUCP> trt@rti.rti.org (Thomas Truscott) writes: > (a) A "sleep(1);" is not enough to avoid a race on a very busy system. No sleep is ever enough. The system could simply be busier than you ever imagined. You don't solve a race problem by narrowing the window: try checking the return value of the "unlink": that's the point of failure. -- Peter da Silva. `-_-' +1 713 274 5180. 'U` peter@ferranti.com (currently not working) peter@hackercorp.com ----------------------------- From: John Palmer <jpp@ddmi.com> Subject: Problems with DIGIBOARD PC/4 Date: 17 Aug 90 00:28:27 GMT Followup-To: comp.unix.xenix To: unix-wizards@sem.brl.mil I'm running SCO Xenix 2.3.2 on a AT clone (386/20MHz) and I have a DIGIBOARD PC/4 (4 ports, dumb controller chips). I'm having some problems with this setup: 1> Sometimes, when someone hangs up, the modem is left in such a state that it will not answer the phone until it is power-cycled. The RD (rcv data) and SD (send data) lights remain on and the modem will not answer the phone. 2> Many times, output gets garbled, especially right before a read operation. I have heard that the I/O chips on this board can be replaced by more "intelligent" chips. Is this the case, and if so, what is the part number of the intelligent chip. On a related topic, is there anyway to flush typeahead in Xenix?? I am using the Xenix equivalent of cbreak() (by setting various flags with ioctl()). fflush(stdin) doesn't seem to work, although it doesn't return an error code. Thanks ahead of time. jpp@ddmi.com -- = CAT-TALK Conferencing Network, Prototype Computer Conferencing System = - 1-800-825-3069, 300/1200/2400/9600 baud, 8/N/1. New users use 'new' - = as a login id. E-Mail Address: jpp@ThunderCat.COM = - <<<Redistribution to GEnie PROHIBITED!!!>>>> - ----------------------------- End of UNIX-WIZARDS Digest **************************