/
githubmirror
/
sssd
Обзор
Документация
Войти
/
githubmirror
/
sssd
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/tests/multihost/alltests/script/tevent_loop.c
52 строки
1 KB
Shridhar Gadekar
Test: porting of failing rfc2307bis testcase
02 фев 2023, 13:53
02 фев 2023, 13:53
d249154
Код
Авторство
О чём код?
#include <tevent.h> #include <talloc.h> #include <stdio.h> #include <signal.h> void sighandler(struct tevent_context *ev, struct tevent_signal *se, int signum, int count, void *siginfo, void *private_data) { return; } int main() { TALLOC_CTX *tmp_ctx = NULL; struct tevent_context *ev = NULL; struct tevent_signal *sig = NULL; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { fputs("Out of memory?", stderr); goto done; } ev = tevent_context_init(tmp_ctx); if (ev == NULL) { fputs("Out of memory?", stderr); goto done; } puts("Registering signal handler..."); sig = tevent_add_signal(ev, ev, SIGUSR1, 0, sighandler, NULL); if (sig == NULL) { fputs("Unable to register signal handler!", stderr); goto done; } puts("Unregistering signal handler..."); TALLOC_FREE(sig); puts("Entering tevent loop..."); tevent_loop_wait(ev); puts("We got through the loop! OK"); done: talloc_free(tmp_ctx); return 0; }