• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/netatalk-2.2.0/libatalk/util/

Lines Matching refs:child

10  * child initialization and kills during server shutdown, this is
55 /* hash/child functions: hash OR's pid */
64 int parent_or_child; /* 0: parent, 1: child */
67 struct server_child_data *child)
71 table = &htable[HASH(child->pid)];
72 if ((child->next = *table) != NULL)
73 (*table)->prevp = &child->next;
74 *table = child;
75 child->prevp = table;
78 static inline void unhash_child(struct server_child_data *child)
80 if (child->prevp) {
81 if (child->next)
82 child->next->prevp = child->prevp;
83 *(child->prevp) = child->next;
89 struct server_child_data *child;
91 for (child = table[HASH(pid)]; child; child = child->next) {
92 if (child->pid == pid)
96 return child;
121 * add a child
127 afp_child_t *child = NULL;
131 * chance to add the child in. */
136 /* it's possible that the child could have already died before the
144 if (child = resolve_child(fork->table, pid))
147 if ((child = calloc(1, sizeof(afp_child_t))) == NULL)
150 child->pid = pid;
151 child->valid = 0;
152 child->killed = 0;
153 child->ipc_fds[0] = ipc_fds[0];
154 child->ipc_fds[1] = ipc_fds[1];
156 hash_child(fork->table, child);
161 return child;
164 /* remove a child and free it */
169 struct server_child_data *child;
172 if (!(child = resolve_child(fork->table, pid)))
175 unhash_child(child);
176 if (child->clientid) {
177 free(child->clientid);
178 child->clientid = NULL;
182 fd = child->ipc_fds[0];
183 if (child->ipc_fds[0] != -1) {
184 close(child->ipc_fds[0]);
185 child->ipc_fds[0] = -1;
187 if (child->ipc_fds[1] != -1) {
188 close(child->ipc_fds[1]);
189 child->ipc_fds[1] = -1;
192 free(child);
206 struct server_child_data *child, *tmp;
212 child = fork->table[j]; /* start at the beginning */
213 while (child) {
214 tmp = child->next;
215 if (child->clientid) {
216 free(child->clientid);
218 free(child);
219 child = tmp;
227 /* send signal to all child processes */
231 struct server_child_data *child, *tmp;
236 child = fork->table[i];
237 while (child) {
238 tmp = child->next;
239 kill(child->pid, sig);
240 child = tmp;
245 /* send kill to a child processes.
249 static int kill_child(struct server_child_data *child)
251 if (!child->killed) {
252 kill(child->pid, SIGTERM);
254 child->killed = 1;
257 LOG(log_info, logtype_default, "Unresponsive child[%d], sending SIGKILL", child->pid);
258 kill(child->pid, SIGKILL);
276 struct server_child_data *child;
280 if ((child = resolve_child(fork->table, pid)) == NULL) {
281 LOG(log_note, logtype_default, "Reconnect: no child[%u]", pid);
295 if (!child->valid) {
297 LOG(log_error, logtype_default, "Reconnect: invalidated child[%u]", pid);
299 } else if (child->uid != uid) {
300 LOG(log_error, logtype_default, "Reconnect: child[%u] not the same user", pid);
304 LOG(log_note, logtype_default, "Reconnect: transfering session to child[%u]", pid);
306 if (writet(child->ipc_fds[0], &DSI_requestID, 2, 0, 2) != 2) {
307 LOG(log_error, logtype_default, "Reconnect: error sending DSI id to child[%u]", pid);
311 EC_ZERO_LOG(send_fd(child->ipc_fds[0], afp_socket));
327 struct server_child_data *child, *tmp;
333 child = fork->table[i];
334 while (child) {
335 tmp = child->next;
336 if ( child->pid != pid) {
337 if (child->idlen == idlen && memcmp(child->clientid, id, idlen) == 0) {
338 if ( child->time != boottime ) {
340 if (uid == child->uid) {
341 kill_child(child);
343 "Terminated disconnected child[%u], client rebooted.",
344 child->pid);
347 "Session with different pid[%u]", child->pid);
352 "Found another session[%u] for client[%u]", child->pid, pid);
357 child->time = boottime;
358 if (child->clientid)
359 free(child->clientid);
360 LOG(log_debug, logtype_default, "Setting client ID for %u", child->pid);
361 child->uid = uid;
362 child->valid = 1;
363 child->idlen = idlen;
364 child->clientid = id;
366 child = tmp;