Mail Delivery Problem
SMTP MAILER
postmaster at ecf.ncsl.nist.gov
Sun Aug 12 21:38:10 AEST 1990
----Reason for mail failure follows----
Sending mail to host ecf.ncsl.nist.gov :
Fatal reply code to command 'RCPT TO:<ise.ncsl.nist.gov at 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 at BRL.MIL
Subject: UNIX-WIZARDS Digest V10#114
To: "ise.ncsl.nist.gov" <ise.ncsl.nist.gov at ecf.ncsl.nist.gov>
Return-Path: <unixwiz-request at 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 at BRL.MIL>
To: UNIX-WIZARDS at BRL.MIL
Reply-To: UNIX-WIZARDS at BRL.MIL
Subject: UNIX-WIZARDS Digest V10#114
Message-ID: <9008120545.aa06856 at 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 at 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 at 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 at svcs1.uucp>
Subject: Re: Cron - First Saturday of the month
Date: 9 Aug 90 17:13:32 GMT
To: unix-wizards at sem.brl.mil
In article <19744 at orstcs.CS.ORST.EDU> curt at 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 at wyse.wyse.com>
Subject: Re: Cron - First Saturday of the month
Date: 10 Aug 90 02:40:29 GMT
Sender: news at wyse.wyse.com
To: unix-wizards at sem.brl.mil
In article <1990Aug8.185745.16606 at iwarp.intel.com> merlyn at iwarp.intel.com (Randal Schwartz) writes:
>In article <19744 at orstcs.CS.ORST.EDU>, curt at 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 at wyse.com
-----------------------------
From: Ronald S H Khoo <ronald at robobar.co.uk>
Subject: Re: Cron - First Saturday of the month
Date: 10 Aug 90 19:05:17 GMT
To: unix-wizards at sem.brl.mil
In article <1990Aug10.063819.5253 at iwarp.intel.com> merlyn at 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 at 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 at juts.ccc.amdahl.com>
Subject: Re: Cron - First Saturday of the month
Date: 10 Aug 90 21:49:09 GMT
Sender: kpc00 at ccc.amdahl.com
To: unix-wizards at sem.brl.mil
In article <1990Aug10.063819.5253 at iwarp.intel.com>
merlyn at 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 at iwarp.intel.com>
Subject: Re: Cron - First Saturday of the month
Date: 10 Aug 90 22:43:31 GMT
6 at star.cs.vu
Sender: news at iwarp.intel.com
To: unix-wizards at sem.brl.mil
In article <7286 at star.cs.vu.nl>, maart at 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 at 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 at watserv1.waterloo.edu>
Subject: Re: Cron - First Saturday of the month
Date: 11 Aug 90 03:08:18 GMT
To: unix-wizards at sem.brl.mil
In article <1990Aug8.214539.1264 at 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 at hq.af.mil>
Subject: waitpid() ???
Date: 10 Aug 90 04:20:07 GMT
Sender: mitch at hq.af.mil
To: unix-wizards at 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 at 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 at hemlock.atherton.com>
Subject: seeking information about file system details.
Date: 10 Aug 90 17:12:33 GMT
Sender: news at athertn.atherton.com
To: unix-wizards at 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 at atherton.com or ...!sun!atherton!mcgregor
Scott McGregor
Atherton Technology
-----------------------------
From: Chip Salzenberg <chip at 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 at sem.brl.mil
According to davidsen at 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 at tct.uucp>, <uunet!ateng!tct!chip>
-----------------------------
From: Larry Wall <lwall at 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 at sem.brl.mil
In article <26C2F1A0.205B at tct.uucp> chip at tct.uucp (Chip Salzenberg) writes:
: According to davidsen at 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 at jpl-devvax.jpl.nasa.gov
-----------------------------
From: Larry McVoy <lm at snafu.sun.com>
Subject: Re: sockets and signals (in C)
Date: 10 Aug 90 18:49:12 GMT
Sender: news at sun.eng.sun.com
To: unix-wizards at sem.brl.mil
In article <3304 at stl.stc.co.uk> "Steve Perryman " <skp at 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 at sun.com
-----------------------------
From: Chet Ramey <chet at cwns1.cwru.edu>
Subject: Re: nested loops
Date: 10 Aug 90 19:28:41 GMT
Sender: news at usenet.ins.cwru.edu
To: unix-wizards at sem.brl.mil
In article <4103 at herbie.misemi> adley at 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 at ins.CWRU.Edu
-----------------------------
From: Guy Harris <guy at auspex.auspex.com>
Subject: Re: ln -f
Date: 10 Aug 90 20:19:01 GMT
To: unix-wizards at 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 at eng.umd.edu>
Subject: Re: ln -f
Date: 10 Aug 90 22:54:43 GMT
Sender: The News System <news at eng.umd.edu>
To: unix-wizards at 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 at eng.umd.edu> <djm at ai.mit.edu>
-----------------------------
From: "Jay A. Konigsberg" <jak at sactoh0.uucp>
Subject: Re: Getting CPU information on unterminatted child processes
Date: 11 Aug 90 09:43:04 GMT
To: unix-wizards at sem.brl.mil
In article <1990Aug7.215320.13715 at mozart.amd.com> leight at 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 at auspex.auspex.com>
Subject: Re: Getting CPU information on unterminatted child processes
Date: 11 Aug 90 21:24:08 GMT
To: unix-wizards at 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 at 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 at 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 at wheaton.uucp
-----------------------------
End of UNIX-WIZARDS Digest
**************************
More information about the Comp.unix.wizards
mailing list