Lines Matching full:sh

41 	struct socket_handler *sh;  member
70 struct socket_handler *sh = client->sh; in client_close() local
75 console_poller_unregister(sh->console, client->poller); in client_close()
82 for (idx = 0; idx < sh->n_clients; idx++) { in client_close()
83 if (sh->clients[idx] == client) { in client_close()
88 assert(idx < sh->n_clients); in client_close()
93 sh->n_clients--; in client_close()
99 memmove(&sh->clients[idx], &sh->clients[idx + 1], in client_close()
100 sizeof(*sh->clients) * (sh->n_clients - idx)); in client_close()
101 if (sh->n_clients == 0) { in client_close()
102 free(sh->clients); in client_close()
103 sh->clients = NULL; in client_close()
105 sh->clients = reallocarray(sh->clients, sh->n_clients, in client_close()
106 sizeof(*sh->clients)); in client_close()
126 console_poller_set_events(client->sh->console, client->poller, events); in client_set_blocked()
233 console_poller_set_timeout(client->sh->console, client->poller, in client_ringbuffer_poll()
273 struct socket_handler *sh = to_socket_handler(handler); in client_poll() local
290 console_data_out(sh->console, buf, rc); in client_poll()
312 struct socket_handler *sh = to_socket_handler(handler); in socket_poll() local
321 fd = accept(sh->sd, NULL, NULL); in socket_poll()
326 console_mux_activate(sh->console); in socket_poll()
331 client->sh = sh; in socket_poll()
333 client->poller = console_poller_register(sh->console, handler, in socket_poll()
337 sh->console, client_ringbuffer_poll, client); in socket_poll()
339 n = sh->n_clients++; in socket_poll()
345 sh->clients = in socket_poll()
346 reallocarray(sh->clients, sh->n_clients, sizeof(*sh->clients)); in socket_poll()
348 sh->clients[n] = client; in socket_poll()
359 struct socket_handler *sh = NULL; in dbus_create_socket_consumer() local
368 sh = to_socket_handler(console->handlers[i]); in dbus_create_socket_consumer()
373 if (!sh) { in dbus_create_socket_consumer()
392 client->sh = sh; in dbus_create_socket_consumer()
394 client->poller = console_poller_register(sh->console, &sh->handler, in dbus_create_socket_consumer()
398 sh->console, client_ringbuffer_poll, client); in dbus_create_socket_consumer()
405 n = sh->n_clients++; in dbus_create_socket_consumer()
412 sh->clients = in dbus_create_socket_consumer()
413 reallocarray(sh->clients, sh->n_clients, sizeof(*sh->clients)); in dbus_create_socket_consumer()
415 sh->clients[n] = client; in dbus_create_socket_consumer()
434 struct socket_handler *sh; in socket_init() local
440 sh = malloc(sizeof(*sh)); in socket_init()
441 if (!sh) { in socket_init()
445 sh->console = console; in socket_init()
446 sh->clients = NULL; in socket_init()
447 sh->n_clients = 0; in socket_init()
465 sh->sd = SD_LISTEN_FDS_START; in socket_init()
467 sh->sd = socket(AF_UNIX, SOCK_STREAM, 0); in socket_init()
468 if (sh->sd < 0) { in socket_init()
475 rc = bind(sh->sd, (struct sockaddr *)&addr, addrlen); in socket_init()
484 rc = listen(sh->sd, 1); in socket_init()
491 sh->poller = console_poller_register(console, &sh->handler, socket_poll, in socket_init()
492 NULL, sh->sd, POLLIN, NULL); in socket_init()
494 return &sh->handler; in socket_init()
497 close(sh->sd); in socket_init()
499 free(sh); in socket_init()
505 struct socket_handler *sh = to_socket_handler(handler); in socket_deselect() local
507 while (sh->n_clients) { in socket_deselect()
508 struct client *c = sh->clients[0]; in socket_deselect()
516 struct socket_handler *sh = to_socket_handler(handler); in socket_fini() local
518 while (sh->n_clients) { in socket_fini()
519 client_close(sh->clients[0]); in socket_fini()
522 if (sh->poller) { in socket_fini()
523 console_poller_unregister(sh->console, sh->poller); in socket_fini()
526 close(sh->sd); in socket_fini()
527 free(sh); in socket_fini()