Lines Matching refs:in
5 * to deal in the Software without restriction, including without limitation
10 * The above copyright notice and this permission notice shall be included in
20 * Except as contained in this notice, the names of the authors or their
21 * institutions shall not be used in advertising or otherwise to promote the
22 * sale, use or other dealings in this Software without prior written
119 int *ifds = &c->in.in_fd.fd[c->in.in_fd.ifd];
120 int infd = c->in.in_fd.nfd - c->in.in_fd.ifd;
125 c->in.in_fd.ifd += nfd;
151 for (special_event = c->in.special_events;
182 if(c->in.queue_len < length)
186 memcpy(&genrep, c->in.queue, sizeof(genrep));
191 uint64_t lastread = c->in.request_read;
192 c->in.request_read = (lastread & UINT64_C(0xffffffffffff0000)) | genrep.sequence;
193 if(XCB_SEQUENCE_COMPARE(c->in.request_read, <, lastread))
194 c->in.request_read += 0x10000;
195 if(XCB_SEQUENCE_COMPARE(c->in.request_read, >, c->in.request_expected))
196 c->in.request_expected = c->in.request_read;
198 if(c->in.request_read != lastread)
200 if(c->in.current_reply)
202 _xcb_map_put(c->in.replies, lastread, c->in.current_reply);
203 c->in.current_reply = 0;
204 c->in.current_reply_tail = &c->in.current_reply;
206 c->in.request_completed = c->in.request_read - 1;
209 while(c->in.pending_replies &&
210 c->in.pending_replies->workaround != WORKAROUND_EXTERNAL_SOCKET_OWNER &&
211 XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed))
213 pending_reply *oldpend = c->in.pending_replies;
214 c->in.pending_replies = oldpend->next;
216 c->in.pending_replies_tail = &c->in.pending_replies;
221 c->in.request_completed = c->in.request_read;
223 remove_finished_readers(&c->in.readers, c->in.request_completed);
228 pend = c->in.pending_replies;
230 !(XCB_SEQUENCE_COMPARE(pend->first_request, <=, c->in.request_read) &&
232 XCB_SEQUENCE_COMPARE(c->in.request_read, <=, pend->last_request))))
241 uint32_t *p = (uint32_t *) c->in.queue;
253 * the number of fds in the pad0 byte */
280 /* pull in XGE event data if available, append after event struct */
308 ((xcb_generic_event_t *) buf)->full_sequence = c->in.request_read;
323 *c->in.current_reply_tail = cur;
324 c->in.current_reply_tail = &cur->next;
325 if(c->in.readers && c->in.readers->request == c->in.request_read)
326 pthread_cond_signal(c->in.readers->data);
342 *c->in.events_tail = event;
343 c->in.events_tail = &event->next;
344 pthread_cond_signal(&c->in.event_cond);
351 struct event_list *cur = c->in.events;
353 if(!c->in.events)
356 c->in.events = cur->next;
358 c->in.events_tail = &c->in.events;
422 * them all and they're in the replies map. */
423 else if(XCB_SEQUENCE_COMPARE(request, <, c->in.request_read))
425 head = _xcb_map_remove(c->in.replies, request);
427 _xcb_map_put(c->in.replies, request, head->next);
431 else if(request == c->in.request_read && c->in.current_reply)
433 head = c->in.current_reply;
434 c->in.current_reply = head->next;
436 c->in.current_reply_tail = &c->in.current_reply;
440 else if(request == c->in.request_completed)
519 insert_reader(&c->in.readers, &reader, request, &cond);
525 remove_reader(&c->in.readers, &reader);
594 c->in.pending_replies_tail = &pend->next;
608 if(XCB_SEQUENCE_COMPARE(request, <=, c->in.request_completed))
612 for(prev_pend = &c->in.pending_replies; *prev_pend; prev_pend = &(*prev_pend)->next)
670 if(!ret && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
689 if(!ret && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
703 if(!_xcb_conn_wait(c, &c->in.event_cond, 0, 0))
719 if(!ret && !queued && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
745 if (XCB_SEQUENCE_COMPARE(request, >, c->in.request_completed))
747 if(XCB_SEQUENCE_COMPARE(request, >=, c->in.request_expected))
786 if(!event && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */
802 insert_special(&c->in.special_waiters, &special, se);
809 remove_special(&c->in.special_waiters, &special);
831 for (se = c->in.special_events; se; se = se->next) {
853 se->next = c->in.special_events;
854 c->in.special_events = se;
874 for (prev = &c->in.special_events; (s = *prev) != NULL; prev = &(s->next)) {
892 int _xcb_in_init(_xcb_in *in)
894 if(pthread_cond_init(&in->event_cond, 0))
896 in->reading = 0;
898 in->queue_len = 0;
900 in->request_read = 0;
901 in->request_completed = 0;
903 in->replies = _xcb_map_new();
904 if(!in->replies)
907 in->current_reply_tail = &in->current_reply;
908 in->events_tail = &in->events;
909 in->pending_replies_tail = &in->pending_replies;
914 void _xcb_in_destroy(_xcb_in *in)
916 pthread_cond_destroy(&in->event_cond);
917 free_reply_list(in->current_reply);
918 _xcb_map_delete(in->replies, (void (*)(void *)) free_reply_list);
919 while(in->events)
921 struct event_list *e = in->events;
922 in->events = e->next;
926 while(in->pending_replies)
928 pending_reply *pend = in->pending_replies;
929 in->pending_replies = pend->next;
937 if(c->in.readers)
938 pthreadret = pthread_cond_signal(c->in.readers->data);
939 else if(c->in.special_waiters)
940 pthreadret = pthread_cond_signal(&c->in.special_waiters->se->special_event_cond);
942 pthreadret = pthread_cond_signal(&c->in.event_cond);
959 *c->in.pending_replies_tail = pend;
960 c->in.pending_replies_tail = &pend->next;
967 if (c->in.pending_replies_tail != &c->in.pending_replies)
969 pend = container_of(c->in.pending_replies_tail, struct pending_reply, next);
979 struct pending_reply **prev_next = &c->in.pending_replies;
983 c->in.pending_replies_tail = prev_next;
996 .iov_base = c->in.queue + c->in.queue_len,
997 .iov_len = sizeof(c->in.queue) - c->in.queue_len,
1009 .msg_controllen = CMSG_SPACE(sizeof(int) * (XCB_MAX_PASS_FD - c->in.in_fd.nfd)),
1023 n = recv(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len, 0);
1033 memcpy(&c->in.in_fd.fd[c->in.in_fd.nfd], CMSG_DATA(hdr), nfd * sizeof (int));
1034 c->in.in_fd.nfd += nfd;
1039 c->in.total_read += n;
1040 c->in.queue_len += n;
1045 if (c->in.in_fd.nfd) {
1046 c->in.in_fd.nfd -= c->in.in_fd.ifd;
1047 memmove(&c->in.in_fd.fd[0],
1048 &c->in.in_fd.fd[c->in.in_fd.ifd],
1049 c->in.in_fd.nfd * sizeof (int));
1050 c->in.in_fd.ifd = 0;
1056 if (c->in.queue_len == 0 && c->in.in_fd.nfd != 0) {
1058 for (i = 0; i < c->in.in_fd.nfd; i++)
1059 close(c->in.in_fd.fd[i]);
1077 int done = c->in.queue_len;
1081 memcpy(buf, c->in.queue, done);
1082 c->in.queue_len -= done;
1083 memmove(c->in.queue, c->in.queue + done, c->in.queue_len);