[Xcb] [PATCH Xcb] Added more error states and removed global error_connection
Arvind Umrao
arvind.umrao at oracle.com
Mon Nov 7 02:48:10 PST 2011
On 11/07/11 15:59, Rami Ylimäki wrote:
> On 11/04/2011 03:36 PM, Arvind Umrao wrote:
>> @@ -209,7 +207,10 @@ static int write_vec(xcb_connection_t *c, struct
>> iovec **vector, int *count)
>>
>> if(n<= 0)
>> {
>> - _xcb_conn_shutdown(c);
>> + /* if bytes_write == 0 Write failed because of end of file!*/
>> + if(!n)
>> + errno = EPIPE;
>> + _xcb_conn_shutdown(c, XCB_CONN_ERROR);
>
> Are you setting errno so that you can print a correct error message in
> Xlib?
No, errno will not be used at Xlib. Just wanted to give correct errno
number, in case some one decide to use it, in future.
> Please don't do that, instead set a proper XCB shutdown code and use
> that in Xlib, don't use errno for this.
>
Already, we have added five connection error states and doing
xcb_conn_shutdown(c, XCB_CONN_ERROR). Do you want me to add more error
states? I thought you were happy with existing five error states.
+/** xcb connection shutdown because of connection errors for eg socket errors, pipe errors and other stream errors. */
+#define XCB_CONN_ERROR 1
+
+/** xcb connection shutdown because of extension not sppported */
+#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
+
+/** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */
+#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
+
+/** Connection closed, exceeding request length that server accepts. */
+#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
+
+/** Connection closed, error during parsing display string. */
+#define XCB_CONN_CLOSED_PARSE_ERR 5
Thanks and Regards
-Arvind
>> @@ -672,7 +672,9 @@ int _xcb_in_read(xcb_connection_t *c)
>> if((n> 0) || (n< 0&& WSAGetLastError() == WSAEWOULDBLOCK))
>> #endif /* !_WIN32 */
>> return 1;
>> - _xcb_conn_shutdown(c);
>> + /* if bytes_read == 0 Read failed because of end of file!*/
>> + errno = EPIPE;
>> + _xcb_conn_shutdown(c, XCB_CONN_ERROR);
>> return 0;
>> }
>
> Same here, signal the error with a separate XCB shutdown code and not
> with errno. Instead of ECHECK(EPIPE) in Xlib, you could just check the
> code in dpy->xcb->connection->has_error.
>
> -- Rami
>
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
More information about the Xcb
mailing list