Blame src/xcbint.h

Packit Service 612474
/*
Packit Service 612474
 * Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
Packit Service 612474
 * All Rights Reserved.
Packit Service 612474
 *
Packit Service 612474
 * Permission is hereby granted, free of charge, to any person obtaining a
Packit Service 612474
 * copy of this software and associated documentation files (the "Software"),
Packit Service 612474
 * to deal in the Software without restriction, including without limitation
Packit Service 612474
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Packit Service 612474
 * and/or sell copies of the Software, and to permit persons to whom the
Packit Service 612474
 * Software is furnished to do so, subject to the following conditions:
Packit Service 612474
 * 
Packit Service 612474
 * The above copyright notice and this permission notice shall be included in
Packit Service 612474
 * all copies or substantial portions of the Software.
Packit Service 612474
 * 
Packit Service 612474
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit Service 612474
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit Service 612474
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Packit Service 612474
 * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit Service 612474
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit Service 612474
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service 612474
 * 
Packit Service 612474
 * Except as contained in this notice, the names of the authors or their
Packit Service 612474
 * institutions shall not be used in advertising or otherwise to promote the
Packit Service 612474
 * sale, use or other dealings in this Software without prior written
Packit Service 612474
 * authorization from the authors.
Packit Service 612474
 */
Packit Service 612474
Packit Service 612474
#ifndef __XCBINT_H
Packit Service 612474
#define __XCBINT_H
Packit Service 612474
Packit Service 612474
#include "bigreq.h"
Packit Service 612474
Packit Service 612474
#ifdef HAVE_CONFIG_H
Packit Service 612474
#include "config.h"
Packit Service 612474
#endif
Packit Service 612474
Packit Service 612474
#ifdef GCC_HAS_VISIBILITY
Packit Service 612474
#pragma GCC visibility push(hidden)
Packit Service 612474
#endif
Packit Service 612474
Packit Service 612474
enum workarounds {
Packit Service 612474
    WORKAROUND_NONE,
Packit Service 612474
    WORKAROUND_GLX_GET_FB_CONFIGS_BUG,
Packit Service 612474
    WORKAROUND_EXTERNAL_SOCKET_OWNER
Packit Service 612474
};
Packit Service 612474
Packit Service 612474
enum lazy_reply_tag
Packit Service 612474
{
Packit Service 612474
    LAZY_NONE = 0,
Packit Service 612474
    LAZY_COOKIE,
Packit Service 612474
    LAZY_FORCED
Packit Service 612474
};
Packit Service 612474
Packit Service 612474
#define XCB_PAD(i) (-(i) & 3)
Packit Service 612474
Packit Service 612474
#define XCB_SEQUENCE_COMPARE(a,op,b)    ((int64_t) ((a) - (b)) op 0)
Packit Service 612474
Packit Service 612474
#ifndef offsetof
Packit Service 612474
#define offsetof(type,member) ((size_t) &((type *)0)->member)
Packit Service 612474
#endif
Packit Service 612474
Packit Service 612474
#ifndef MIN
Packit Service 612474
#define MIN(x,y) ((x) < (y) ? (x) : (y))
Packit Service 612474
#endif
Packit Service 612474
Packit Service 612474
#define container_of(pointer,type,member) ((type *)(((char *)(pointer)) - offsetof(type, member)))
Packit Service 612474
Packit Service 612474
/* xcb_list.c */
Packit Service 612474
Packit Service 612474
typedef void (*xcb_list_free_func_t)(void *);
Packit Service 612474
Packit Service 612474
typedef struct _xcb_map _xcb_map;
Packit Service 612474
Packit Service 612474
_xcb_map *_xcb_map_new(void);
Packit Service 612474
void _xcb_map_delete(_xcb_map *q, xcb_list_free_func_t do_free);
Packit Service 612474
int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
Packit Service 612474
void *_xcb_map_remove(_xcb_map *q, unsigned int key);
Packit Service 612474
Packit Service 612474
Packit Service 612474
/* xcb_out.c */
Packit Service 612474
Packit Service 612474
#if HAVE_SENDMSG
Packit Service 612474
#define XCB_MAX_PASS_FD 16
Packit Service 612474
Packit Service 612474
typedef struct _xcb_fd {
Packit Service 612474
    int fd[XCB_MAX_PASS_FD];
Packit Service 612474
    int nfd;
Packit Service 612474
    int ifd;
Packit Service 612474
} _xcb_fd;
Packit Service 612474
#endif
Packit Service 612474
Packit Service 612474
typedef struct _xcb_out {
Packit Service 612474
    pthread_cond_t cond;
Packit Service 612474
    int writing;
Packit Service 612474
Packit Service 612474
    pthread_cond_t socket_cond;
Packit Service 612474
    void (*return_socket)(void *closure);
Packit Service 612474
    void *socket_closure;
Packit Service 612474
    int socket_moving;
Packit Service 612474
Packit Service 612474
    char queue[XCB_QUEUE_BUFFER_SIZE];
Packit Service 612474
    int queue_len;
Packit Service 612474
Packit Service 612474
    uint64_t request;
Packit Service 612474
    uint64_t request_written;
Packit Service 612474
Packit Service 612474
    pthread_mutex_t reqlenlock;
Packit Service 612474
    enum lazy_reply_tag maximum_request_length_tag;
Packit Service 612474
    union {
Packit Service 612474
        xcb_big_requests_enable_cookie_t cookie;
Packit Service 612474
        uint32_t value;
Packit Service 612474
    } maximum_request_length;
Packit Service 612474
#if HAVE_SENDMSG
Packit Service 612474
    _xcb_fd out_fd;
Packit Service 612474
#endif
Packit Service 612474
} _xcb_out;
Packit Service 612474
Packit Service 612474
int _xcb_out_init(_xcb_out *out);
Packit Service 612474
void _xcb_out_destroy(_xcb_out *out);
Packit Service 612474
Packit Service 612474
int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count);
Packit Service 612474
void _xcb_out_send_sync(xcb_connection_t *c);
Packit Service 612474
int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request);
Packit Service 612474
Packit Service 612474
Packit Service 612474
/* xcb_in.c */
Packit Service 612474
Packit Service 612474
typedef struct _xcb_in {
Packit Service 612474
    pthread_cond_t event_cond;
Packit Service 612474
    int reading;
Packit Service 612474
Packit Service 612474
    char queue[4096];
Packit Service 612474
    int queue_len;
Packit Service 612474
Packit Service 612474
    uint64_t request_expected;
Packit Service 612474
    uint64_t request_read;
Packit Service 612474
    uint64_t request_completed;
Packit Service 612474
    struct reply_list *current_reply;
Packit Service 612474
    struct reply_list **current_reply_tail;
Packit Service 612474
Packit Service 612474
    _xcb_map *replies;
Packit Service 612474
    struct event_list *events;
Packit Service 612474
    struct event_list **events_tail;
Packit Service 612474
    struct reader_list *readers;
Packit Service 612474
    struct special_list *special_waiters;
Packit Service 612474
Packit Service 612474
    struct pending_reply *pending_replies;
Packit Service 612474
    struct pending_reply **pending_replies_tail;
Packit Service 612474
#if HAVE_SENDMSG
Packit Service 612474
    _xcb_fd in_fd;
Packit Service 612474
#endif
Packit Service 612474
    struct xcb_special_event *special_events;
Packit Service 612474
} _xcb_in;
Packit Service 612474
Packit Service 612474
int _xcb_in_init(_xcb_in *in);
Packit Service 612474
void _xcb_in_destroy(_xcb_in *in);
Packit Service 612474
Packit Service 612474
void _xcb_in_wake_up_next_reader(xcb_connection_t *c);
Packit Service 612474
Packit Service 612474
int _xcb_in_expect_reply(xcb_connection_t *c, uint64_t request, enum workarounds workaround, int flags);
Packit Service 612474
void _xcb_in_replies_done(xcb_connection_t *c);
Packit Service 612474
Packit Service 612474
int _xcb_in_read(xcb_connection_t *c);
Packit Service 612474
int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
Packit Service 612474
Packit Service 612474
Packit Service 612474
/* xcb_xid.c */
Packit Service 612474
Packit Service 612474
typedef struct _xcb_xid {
Packit Service 612474
    pthread_mutex_t lock;
Packit Service 612474
    uint32_t last;
Packit Service 612474
    uint32_t base;
Packit Service 612474
    uint32_t max;
Packit Service 612474
    uint32_t inc;
Packit Service 612474
} _xcb_xid;
Packit Service 612474
Packit Service 612474
int _xcb_xid_init(xcb_connection_t *c);
Packit Service 612474
void _xcb_xid_destroy(xcb_connection_t *c);
Packit Service 612474
Packit Service 612474
Packit Service 612474
/* xcb_ext.c */
Packit Service 612474
Packit Service 612474
typedef struct _xcb_ext {
Packit Service 612474
    pthread_mutex_t lock;
Packit Service 612474
    struct lazyreply *extensions;
Packit Service 612474
    int extensions_size;
Packit Service 612474
} _xcb_ext;
Packit Service 612474
Packit Service 612474
int _xcb_ext_init(xcb_connection_t *c);
Packit Service 612474
void _xcb_ext_destroy(xcb_connection_t *c);
Packit Service 612474
Packit Service 612474
Packit Service 612474
/* xcb_conn.c */
Packit Service 612474
Packit Service 612474
struct xcb_connection_t {
Packit Service 612474
    /* This must be the first field; see _xcb_conn_ret_error(). */
Packit Service 612474
    int has_error;
Packit Service 612474
Packit Service 612474
    /* constant data */
Packit Service 612474
    xcb_setup_t *setup;
Packit Service 612474
    int fd;
Packit Service 612474
Packit Service 612474
    /* I/O data */
Packit Service 612474
    pthread_mutex_t iolock;
Packit Service 612474
    _xcb_in in;
Packit Service 612474
    _xcb_out out;
Packit Service 612474
Packit Service 612474
    /* misc data */
Packit Service 612474
    _xcb_ext ext;
Packit Service 612474
    _xcb_xid xid;
Packit Service 612474
};
Packit Service 612474
Packit Service 612474
void _xcb_conn_shutdown(xcb_connection_t *c, int err);
Packit Service 612474
Packit Service 612474
xcb_connection_t *_xcb_conn_ret_error(int err);
Packit Service 612474
Packit Service 612474
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
Packit Service 612474
Packit Service 612474
Packit Service 612474
/* xcb_auth.c */
Packit Service 612474
Packit Service 612474
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
Packit Service 612474
Packit Service 612474
#ifdef GCC_HAS_VISIBILITY
Packit Service 612474
#pragma GCC visibility pop
Packit Service 612474
#endif
Packit Service 612474
Packit Service 612474
#endif