[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
module request: EINVAL synonyms?
From: |
Sam Steingold |
Subject: |
module request: EINVAL synonyms? |
Date: |
Thu, 17 Jun 2010 14:35:15 -0400 |
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.
This results in this code in clisp/src/stream.d:
#ifdef UNIX_IRIX
if (!(errno==ENOSYS))
#endif
#ifdef UNIX_CYGWIN32 /* for Woe95 and xterm/rxvt, and WoeXP /dev/null */
if ((errno != EBADF) && (errno != EACCES) && (errno != EBADRQC))
#endif
#ifdef UNIX_DARWIN
if ((errno != EOPNOTSUPP) && (errno != ENOTSUP) && (errno != ENODEV))
#endif
if (!(errno==EINVAL))
{ OS_error(); }
i.e., errno==ENOSYS must be ignored on IRIX, EBADF on cygwin, ENODEV on mac os x
and EINVAL on all platforms.
I would love to outsource the maintenance of this nightmare to gnulib.
specifically, 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.
thanks!
--
Sam Steingold <http://sds.podval.org>
- module request: EINVAL synonyms?,
Sam Steingold <=