Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-12

General error trapping

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hello all,
I am not totally familiar with how to go about error trapping in a Linux envrironment. Right now I am trying to trap a "broken pipe" error. I am assuming that this error would be written to linuxerror, but what directive do I put a + sign to that will stop the program from crashing? Also, if there is a general tutorial online about this sort of thing it would be really cool if I could check that out.

tia,
Matt

Unknown author
to Unknown author
Show quoted text 7 lines
Hello all, I am not totally familiar with how to go about error trapping in a Linux envrironment. Right now I am trying to trap a "broken pipe" error. I am assuming that this error would be written to linuxerror, but what directive do I put a + sign to that will stop the program from crashing? Also, if there is a general tutorial online about this sort of thing it would be really cool if I could check that out.

There is no general tutorial; the broken pipe error is a signal as far as I know (SIG_PIPE) . You must install a signal handler for this if you want to catch it.

Michael.

Unknown author

I am not sure of how to go about that. Are there any examples out there?

In a message dated 12/19/00 6:22:18 PM Eastern Standard Time, writes:

<< > there is a general tutorial online about this sort of thing it would be

really cool if I could check that out.

There is no general tutorial; the broken pipe error is a signal as far as I know (SIG_PIPE) . You must install a signal handler for this if you want to catch it.

Michael.

>
md
to Unknown author: There is no general tutorial; the broken pipe error is a signal as far as I know…

Error trapping with Try..Except is the best way for error trapping.

I have questioned the actual utility of the signal handlers.

I would also question the understanding which signals are actually used under linux
and the exact conditions that must exist for each signal to get executed and the ramification of a given signal tripping.

Some signals cause core dumps, some don't. There does not seem to be a good way to
of processing both before and after a core dump.

In fact, signals in general are a poor and loosely understood method of external program signaling.
(short of pouring through the source code of course)

They seem to be a loose holdover from the past with no ability for extensibility or customization without
significant kernel changes.

This is just a general observation.

Mark Diener

Show quoted text 20 lines
On Tue, 19 Dec 2000 wrote: > Hello all, > I am not totally familiar with how to go about error trapping in a Linux > envrironment. Right now I am trying to trap a "broken pipe" error. I am > assuming that this error would be written to linuxerror, but what directive > do I put a + sign to that will stop the program from crashing? Also, if > there is a general tutorial online about this sort of thing it would be > really cool if I could check that out. There is no general tutorial; the broken pipe error is a signal as far as I know (SIG_PIPE) . You must install a signal handler for this if you want to catch it. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Andrey Kubyshev
to Unknown author: I am not totally familiar with how to go about error trapping in a Linux envrironment. …

Hello BigMatt19,

BigMatt19> envrironment. Right now I am trying to trap a "broken pipe" error. I am BigMatt19> assuming that this error would be written to linuxerror, but what directive BigMatt19> do I put a + sign to that will stop the program from crashing? Also, if BigMatt19> there is a general tutorial online about this sort of thing it would be BigMatt19> really cool if I could check that out.

Is, one way is to set signal handler , another is mask that interrupt for your process and if you got this signal when you try to send data to socket closed from other side, you should specify last parameter as MSG_NOSIGNAL its equal 16384.

about signal handling with C lib :
http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html

Best regards, Kubyshev Andrey
Marco van de Voort
to Andrey Kubyshev
Show quoted text 13 lines
BigMatt19> envrironment. Right now I am trying to trap a "broken pipe" error. I am BigMatt19> assuming that this error would be written to linuxerror, but what directive BigMatt19> do I put a + sign to that will stop the program from crashing? Also, if BigMatt19> there is a general tutorial online about this sort of thing it would be BigMatt19> really cool if I could check that out. Is, one way is to set signal handler , another is mask that interrupt for your process and if you got this signal when you try to send data to socket closed from other side, you should specify last parameter as MSG_NOSIGNAL its equal 16384. about signal handling with C lib : http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html

The entry in the FPC Units manual for Linux.Sigaction probably also contains such example.