[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: module request: EINVAL synonyms?
From: |
Bruno Haible |
Subject: |
Re: module request: EINVAL synonyms? |
Date: |
Thu, 17 Jun 2010 22:42:39 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Sam,
> Sometimes system calls fail not because the operation failed but
> because the argument was not appropriate.
> E.g., fsync(fd) may fail because fd is a TTY.
> Normally errno==EINVAL should indicate that, but on some platforms
> other errno's are used.
> ...
> I want a module einval which would export
> #define IS_EINVAL
> to config.h
> and IS_EINVAL would be defined to
> (errno==EINVAL)||(errno==ENOSYS))
> on Irix,
> (errno==EINVAL)||(errno==EBADF))||(errno==EACCES))||(errno==EBADRQC))
> on cygwin &c, and
> (errno==EINVAL)
> by default.
The outcome of this discussion thread on bug-gnulib
<http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00430.html>
<http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00433.html>
was that it is possible to have one such function for fsync, one for
sockets, one for ACLs, and so on. But one should better avoid a generic
function of this kind that is applied to different situations - because
the same errno value means different things in different situations.
Regarding fsync, coreutils/src/shred.c has this definition:
/* Return true when it's ok to ignore an fsync or fdatasync
failure that set errno to ERRNO_VAL. */
static bool
ignorable_sync_errno (int errno_val)
{
return (errno_val == EINVAL
|| errno_val == EBADF
/* HP-UX does this */
|| errno_val == EISDIR);
}
But of course, the 'shred' program is never applied to ttys, therefore
this function does not care to handle errno values that are specific to
fsync on ttys.
Bruno