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()
272 struct socket_handler *sh = to_socket_handler(handler); in client_poll() local
289 console_data_out(sh->console, buf, rc); in client_poll()
311 struct socket_handler *sh = to_socket_handler(handler); in socket_poll() local
320 fd = accept(sh->sd, NULL, NULL); in socket_poll()
325 console_mux_activate(sh->console); in socket_poll()
330 client->sh = sh; in socket_poll()
332 client->poller = console_poller_register(sh->console, handler, in socket_poll()
336 sh->console, client_ringbuffer_poll, client); in socket_poll()
338 n = sh->n_clients++; in socket_poll()
344 sh->clients = in socket_poll()
345 reallocarray(sh->clients, sh->n_clients, sizeof(*sh->clients)); in socket_poll()
347 sh->clients[n] = client; in socket_poll()
358 struct socket_handler *sh = NULL; in dbus_create_socket_consumer() local
367 sh = to_socket_handler(console->handlers[i]); in dbus_create_socket_consumer()
372 if (!sh) { in dbus_create_socket_consumer()
391 client->sh = sh; in dbus_create_socket_consumer()
393 client->poller = console_poller_register(sh->console, &sh->handler, in dbus_create_socket_consumer()
397 sh->console, client_ringbuffer_poll, client); in dbus_create_socket_consumer()
404 n = sh->n_clients++; in dbus_create_socket_consumer()
411 sh->clients = in dbus_create_socket_consumer()
412 reallocarray(sh->clients, sh->n_clients, sizeof(*sh->clients)); in dbus_create_socket_consumer()
414 sh->clients[n] = client; in dbus_create_socket_consumer()
433 struct socket_handler *sh; in socket_init() local
439 sh = malloc(sizeof(*sh)); in socket_init()
440 if (!sh) { in socket_init()
444 sh->console = console; in socket_init()
445 sh->clients = NULL; in socket_init()
446 sh->n_clients = 0; in socket_init()
464 sh->sd = SD_LISTEN_FDS_START; in socket_init()
466 sh->sd = socket(AF_UNIX, SOCK_STREAM, 0); in socket_init()
467 if (sh->sd < 0) { in socket_init()
474 rc = bind(sh->sd, (struct sockaddr *)&addr, addrlen); in socket_init()
483 rc = listen(sh->sd, 1); in socket_init()
490 sh->poller = console_poller_register(console, &sh->handler, socket_poll, in socket_init()
491 NULL, sh->sd, POLLIN, NULL); in socket_init()
493 return &sh->handler; in socket_init()
496 close(sh->sd); in socket_init()
498 free(sh); in socket_init()
504 struct socket_handler *sh = to_socket_handler(handler); in socket_deselect() local
506 while (sh->n_clients) { in socket_deselect()
507 struct client *c = sh->clients[0]; in socket_deselect()
515 struct socket_handler *sh = to_socket_handler(handler); in socket_fini() local
517 while (sh->n_clients) { in socket_fini()
518 client_close(sh->clients[0]); in socket_fini()
521 if (sh->poller) { in socket_fini()
522 console_poller_unregister(sh->console, sh->poller); in socket_fini()
525 close(sh->sd); in socket_fini()
526 free(sh); in socket_fini()