[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))
   #ifdef UNIX_CYGWIN32 /* for Woe95 and xterm/rxvt, and WoeXP /dev/null */
    if ((errno != EBADF) && (errno != EACCES) && (errno != EBADRQC))
   #ifdef UNIX_DARWIN
    if ((errno != EOPNOTSUPP) && (errno != ENOTSUP) && (errno != ENODEV))
    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
on Irix,
on cygwin &c, and
by default.


Sam Steingold <http://sds.podval.org>

reply via email to

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