nscd.c (814aaaa7da4dab462d90e12e7b48b75f2093ccfd) nscd.c (b4b4b5304bd22eab265c9c049cb7fc6b55c4ef3f)
1/*-
2 * Copyright (c) 2005 Michael Bushkov <bushman@rsu.ru>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 153 unchanged lines hidden (view full) ---

162 struct timespec timeout;
163
164 struct runtime_env *retval;
165
166 TRACE_IN(init_runtime_env);
167 retval = calloc(1, sizeof(*retval));
168 assert(retval != NULL);
169
1/*-
2 * Copyright (c) 2005 Michael Bushkov <bushman@rsu.ru>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 153 unchanged lines hidden (view full) ---

162 struct timespec timeout;
163
164 struct runtime_env *retval;
165
166 TRACE_IN(init_runtime_env);
167 retval = calloc(1, sizeof(*retval));
168 assert(retval != NULL);
169
170 retval->sockfd = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0);
170 retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0);
171
172 if (config->force_unlink == 1)
173 unlink(config->socket_path);
174
175 memset(&serv_addr, 0, sizeof(struct sockaddr_un));
176 serv_addr.sun_family = PF_LOCAL;
177 strlcpy(serv_addr.sun_path, config->socket_path,
178 sizeof(serv_addr.sun_path));

--- 14 unchanged lines hidden (view full) ---

193 config->socket_path);
194
195 /*
196 * Here we're marking socket as non-blocking and setting its backlog
197 * to the maximum value
198 */
199 chmod(config->socket_path, config->socket_mode);
200 listen(retval->sockfd, -1);
171
172 if (config->force_unlink == 1)
173 unlink(config->socket_path);
174
175 memset(&serv_addr, 0, sizeof(struct sockaddr_un));
176 serv_addr.sun_family = PF_LOCAL;
177 strlcpy(serv_addr.sun_path, config->socket_path,
178 sizeof(serv_addr.sun_path));

--- 14 unchanged lines hidden (view full) ---

193 config->socket_path);
194
195 /*
196 * Here we're marking socket as non-blocking and setting its backlog
197 * to the maximum value
198 */
199 chmod(config->socket_path, config->socket_mode);
200 listen(retval->sockfd, -1);
201 fcntl(retval->sockfd, F_SETFL, O_NONBLOCK);
201
202 retval->queue = kqueue();
203 assert(retval->queue != -1);
204
205 EV_SET(&eventlist, retval->sockfd, EVFILT_READ, EV_ADD | EV_ONESHOT,
206 0, 0, 0);
207 memset(&timeout, 0, sizeof(struct timespec));
208 kevent(retval->queue, &eventlist, 1, NULL, 0, &timeout);

--- 661 unchanged lines hidden ---
202
203 retval->queue = kqueue();
204 assert(retval->queue != -1);
205
206 EV_SET(&eventlist, retval->sockfd, EVFILT_READ, EV_ADD | EV_ONESHOT,
207 0, 0, 0);
208 memset(&timeout, 0, sizeof(struct timespec));
209 kevent(retval->queue, &eventlist, 1, NULL, 0, &timeout);

--- 661 unchanged lines hidden ---