GIOChannel error handling



The GIOError type is IMHO unsufficient for proper error
handling, in some cases one needs access to the real errno.

(E.g. reading from a device driver which can report buffer
under/overruns.)

In my code I currently just check errno directly when I get
G_IO_ERROR_UNKNOWN, which works with the current GIOChannel
implementation. However, the Glib API does not guarantee that
this is valid, and IMHO it also is somewhat unclean.


I therefore propose to add

  gint g_io_channel_unix_get_errno (GIOChannel *channel);

implemented by adding an "errno" member to struct _GIOUnixChannel
and setting it directly after every system call done in giounix.c.


I don't know if the concept of errno is really OS indenpendent,
so I propose it for UNIX only. It would make sense to provide
something similar for other OSs, too, though. Maybe it should
even be

  gint g_io_channel_get_errno (GIOChannel *channel);


Opinons?


Regards,
Johannes




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