mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-16 12:28:48 +02:00
gioerror: map some more values to G_IO_ERROR_NOT_SUPPORTED
Map EPROTONOSUPPORT, ESOCKTNOSUPPORT, EPFNOSUPPORT and EAFNOSUPPORT to G_IO_ERROR_NOT_SUPPORTED in g_io_error_from_errno(). (GSocket's socket_io_error_from_errno() already did this with the corresponding Winsock errors.) Also map EOPNOTSUPP, which on Linux is the same as ENOTSUP, but may not be on other platforms. Also, rewrite the EAGAIN/EWOULDBLOCK section to use the simpler idiom used by EEXIST/ENOTEMPTY and (now) ENOTSUP/EOPNOTSUPP.
This commit is contained in:
parent
0afd6d22eb
commit
9fc35dbfb6
@ -432,7 +432,7 @@ typedef enum {
|
|||||||
* @G_IO_ERROR_NO_SPACE: No space left on drive.
|
* @G_IO_ERROR_NO_SPACE: No space left on drive.
|
||||||
* @G_IO_ERROR_INVALID_ARGUMENT: Invalid argument.
|
* @G_IO_ERROR_INVALID_ARGUMENT: Invalid argument.
|
||||||
* @G_IO_ERROR_PERMISSION_DENIED: Permission denied.
|
* @G_IO_ERROR_PERMISSION_DENIED: Permission denied.
|
||||||
* @G_IO_ERROR_NOT_SUPPORTED: Operation not supported for the current backend.
|
* @G_IO_ERROR_NOT_SUPPORTED: Operation (or one of its parameters) not supported
|
||||||
* @G_IO_ERROR_NOT_MOUNTED: File isn't mounted.
|
* @G_IO_ERROR_NOT_MOUNTED: File isn't mounted.
|
||||||
* @G_IO_ERROR_ALREADY_MOUNTED: File is already mounted.
|
* @G_IO_ERROR_ALREADY_MOUNTED: File is already mounted.
|
||||||
* @G_IO_ERROR_CLOSED: File was closed.
|
* @G_IO_ERROR_CLOSED: File was closed.
|
||||||
|
@ -134,7 +134,8 @@ g_io_error_from_errno (gint err_no)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENOTEMPTY) && (!defined (EEXIST) || (ENOTEMPTY != EEXIST))
|
/* ENOTEMPTY == EEXIST on AIX for backward compatibility reasons */
|
||||||
|
#if defined (ENOTEMPTY) && (!defined (EEXIST) || (ENOTEMPTY != EEXIST))
|
||||||
case ENOTEMPTY:
|
case ENOTEMPTY:
|
||||||
return G_IO_ERROR_NOT_EMPTY;
|
return G_IO_ERROR_NOT_EMPTY;
|
||||||
break;
|
break;
|
||||||
@ -146,6 +147,37 @@ g_io_error_from_errno (gint err_no)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* EOPNOTSUPP == ENOTSUP on Linux, but POSIX considers them distinct */
|
||||||
|
#if defined (EOPNOTSUPP) && (!defined (ENOTSUP) || (EOPNOTSUPP != ENOTSUP))
|
||||||
|
case EOPNOTSUPP:
|
||||||
|
return G_IO_ERROR_NOT_SUPPORTED;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EPROTONOSUPPORT
|
||||||
|
case EPROTONOSUPPORT:
|
||||||
|
return G_IO_ERROR_NOT_SUPPORTED;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESOCKTNOSUPPORT
|
||||||
|
case ESOCKTNOSUPPORT:
|
||||||
|
return G_IO_ERROR_NOT_SUPPORTED;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EPFNOSUPPORT
|
||||||
|
case EPFNOSUPPORT:
|
||||||
|
return G_IO_ERROR_NOT_SUPPORTED;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EAFNOSUPPORT
|
||||||
|
case EAFNOSUPPORT:
|
||||||
|
return G_IO_ERROR_NOT_SUPPORTED;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ETIMEDOUT
|
#ifdef ETIMEDOUT
|
||||||
case ETIMEDOUT:
|
case ETIMEDOUT:
|
||||||
return G_IO_ERROR_TIMED_OUT;
|
return G_IO_ERROR_TIMED_OUT;
|
||||||
@ -158,30 +190,17 @@ g_io_error_from_errno (gint err_no)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* some magic to deal with EWOULDBLOCK and EAGAIN.
|
#ifdef EWOULDBLOCK
|
||||||
* apparently on HP-UX these are actually defined to different values,
|
|
||||||
* but on Linux, for example, they are the same.
|
|
||||||
*/
|
|
||||||
#if defined(EWOULDBLOCK) && defined(EAGAIN) && EWOULDBLOCK == EAGAIN
|
|
||||||
/* we have both and they are the same: only emit one case. */
|
|
||||||
case EAGAIN:
|
|
||||||
return G_IO_ERROR_WOULD_BLOCK;
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
/* else: consider each of them separately. this handles both the
|
|
||||||
* case of having only one and the case where they are different values.
|
|
||||||
*/
|
|
||||||
# ifdef EAGAIN
|
|
||||||
case EAGAIN:
|
|
||||||
return G_IO_ERROR_WOULD_BLOCK;
|
|
||||||
break;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef EWOULDBLOCK
|
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
return G_IO_ERROR_WOULD_BLOCK;
|
return G_IO_ERROR_WOULD_BLOCK;
|
||||||
break;
|
break;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
|
/* EWOULDBLOCK == EAGAIN on most systems, but POSIX considers them distinct */
|
||||||
|
#if defined (EAGAIN) && (!defined (EWOULDBLOCK) || (EWOULDBLOCK != EAGAIN))
|
||||||
|
case EAGAIN:
|
||||||
|
return G_IO_ERROR_WOULD_BLOCK;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EMFILE
|
#ifdef EMFILE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user