blob: e9c7cb9f2938baa9ef55bb3dc1c7d0f6526ab47c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* SPDX-License-Identifier: ISC */
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include "initsock.h"
int init_socket_send_request(int fd, E_INIT_REQUEST rq, ...)
{
init_request_t request;
ssize_t ret;
va_list ap;
memset(&request, 0, sizeof(request));
request.rq = rq;
va_start(ap, rq);
switch (rq) {
case EIR_STATUS:
request.arg.status.filter = va_arg(ap, E_SERVICE_STATE);
break;
default:
break;
}
va_end(ap);
retry:
ret = write(fd, &request, sizeof(request));
if (ret < 0) {
if (errno == EINTR)
goto retry;
perror(INIT_SOCK_PATH);
return -1;
}
return 0;
}
|