bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Propagating errors in proc


From: Igor Khavkine
Subject: Propagating errors in proc
Date: Tue, 21 Aug 2001 01:11:57 -0400
User-agent: Mutt/1.3.20i

Hi,

I'm looking through proc trying to fix malloc() bugs. There was one
place where malloc was used inside a void function. I had to change
it's return value to error_t so an error could be reported.

Anyway, the error is propagated to new_proc() which is supposed to
allocate a new proc structure. It's not used much in the code, but
when it's used it's expected to succed. Now on error new_proc() will
return a NULL. However where it is used NULL may be valid value if
it comes from somewhere else (e.g. a search for a particular pid
or task did not succed). However these two cases must be distinguished,
one reports an error and one does not. So there is a problem of how
exactle should the memory allocation error be propagated all the way
up to RPC service routines (those prefixed with S_*).

What I was thinking of is to set errno to 0 before the suspect part
of the code, then check it's value afterwards to see if there was
an error and wheather a NULL value indicates a valid value or not.
Or should I just change the interfaces of relevant internal functions
so propagating errors would be more straightforward?

Igor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]