[Top][All Lists]

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

Re: [DotGNU]Errno Weirdness & Need a `HAVE_RENAME'

From: Rhys Weatherley
Subject: Re: [DotGNU]Errno Weirdness & Need a `HAVE_RENAME'
Date: Wed, 18 Dec 2002 18:04:34 +1000
User-agent: KMail/1.4.3

On Wednesday 18 December 2002 11:18 am, Aditya P. Bansod wrote:

> When I enter into support/dir.c, I see the errno being already at 2
> (directory not found). I'm almost done with the Directory.Move function,
> but this oddity is holding me up. Should I ignore it? Or is there something
> else I should be worried about?

On entry to any I/O routine, errno will be set to whatever the last
failed system call said.  Just ignore it.  There is no need to clear it,
or do anything special.  Whenever you use a system call, and the
return value is 0, then everything is fine - "errno" may be non-zero
from the previous system call, but it isn't important.  If the return value
is -1, then a relevant error is in "errno", and will need to be converted.

> Currently, I'm just ignoring the errno if rename returns 0, otherwise I
> throw the errno, such as:
>       if(retVal == 0)
>               return IL_ERRNO_Success;
>       else
>               return ILSysIOConvertErrno(errno);

This is the correct behaviour.

As to "support" vs "engine" - the "support" directory provides the low
level wrapper for the operating system's routines.  It should export a
neutral interface.  The "engine" directory uses this neutral interface
to provide engine functionality.  Other programs may also use the
neutral interface (e.g. ILOpenDir is used by csant now to scan dirs).

The idea is that if we port to a new operating system, we may need to
replace the code in "support", but the code in "engine" will be generic.
There are a few exceptions to this, but as Gopal says, these are
technically wrong and will be fixed as time goes on.



reply via email to

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