[Editor's Note: In the July/August issue of Sys Admin,
an article by Eric Horne entitled "newping: Remote
Downtime Detection." The article proved very interesting
several of whom contacted us to mention a problem with
the code and
to offer both solutions to the problem and enhancements
of the program.
We are printing Eric's corrected code here, along with
from Adam Zell. We'd be interested in hearing from other
worked with the newping code.]
Eric Horne writes:
It would seem that, in spite of the errors I introduced
into the newping code, people really found newping a
useful utility. An overwhelming number of readers sent
in their comments
about how useful the application was, or how they were
going to use
it. One particular reader went on to suggest that newping
called tcping. His logic was that when the next version
newping comes out, the older version won't be new anymore.
So I have adopted the new name, tcping, for my application.
Just goes to show that I learned as much from the readers,
as (I hope)
the readers did from me. Thank you!!
And reader Adam Zell writes:
The newping article by Eric Horne in the July/August
issue of SysAdmin was very informative, but unfortunately
The major problem area of the program is in its signal
handling. It uses the earlier signal() call, which is
If the alarm() goes off while inside the alarm signal
the handler itself may by interrupted. This could lead
By using System V's sigaction, this can be avoided.
All alarm signals generated while in an alarm signal
handler are blocked
until the handler exits.
Another potential problem area in newping.c
is the definitions of global variables. All of the global
are accessed from the signal handlers, and thus should
volatile. Labeling a variable volatile tells the compiler
not to optimize,
and should be used on all variables accessed from a
Otherwise, the compiler may keep a variable's value
in a register, not storing it immediately back into
a signal may occur at any time, if the value is not
the signal handler may be left with an old value.
There are also some minor bugs dealt with, in
terms of option processing, K&R C, and older BSD
extraneous variables were taken out and generally cleaned
The resultant program (Listing 2) is ANSI and SVR4 compliant.
About the Author
Eric T. Horne is a graduating senior from Cal Poly
at San Luis
Obispo. He worked as a programmer analyst for 9 months
Inc. (ST division), where he assisted system administrators
several utility sh scripts to help manage and measure
of systems. He will be graduating hopefully sometime
in August, 1993.
You may contact Eric at 40 San Antonio Street, Newbury
Park, CA 91320