• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/netatalk-2.2.5/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
146 if (child = resolve_child(fork->table, pid))
149 if ((child = calloc(1, sizeof(afp_child_t))) == NULL)
152 child->pid = pid;
153 child->valid = 0;
154 child->killed = 0;
155 child->ipc_fd = ipc_fd;
157 hash_child(fork->table, child);
162 return child;
165 /* remove a child and free it */
170 struct server_child_data *child;
173 if (!(child = resolve_child(fork->table, pid)))
176 unhash_child(child);
177 if (child->clientid) {
178 free(child->clientid);
179 child->clientid = NULL;
183 fd = child->ipc_fd;
187 free(child);
201 struct server_child_data *child, *tmp;
207 child = fork->table[j]; /* start at the beginning */
208 while (child) {
209 tmp = child->next;
210 close(child->ipc_fd);
211 if (child->clientid) {
212 free(child->clientid);
214 free(child);
215 child = tmp;
223 /* send signal to all child processes */
227 struct server_child_data *child, *tmp;
232 child = fork->table[i];
233 while (child) {
234 tmp = child->next;
235 kill(child->pid, sig);
236 child = tmp;
241 /* send kill to a child processes.
245 static int kill_child(struct server_child_data *child)
247 if (!child->killed) {
248 kill(child->pid, SIGTERM);
250 child->killed = 1;
253 LOG(log_info, logtype_default, "Unresponsive child[%d], sending SIGKILL", child->pid);
254 kill(child->pid, SIGKILL);
272 struct server_child_data *child;
276 if ((child = resolve_child(fork->table, pid)) == NULL) {
277 LOG(log_note, logtype_default, "Reconnect: no child[%u]", pid);
291 if (!child->valid) {
293 LOG(log_error, logtype_default, "Reconnect: invalidated child[%u]", pid);
295 } else if (child->uid != uid) {
296 LOG(log_error, logtype_default, "Reconnect: child[%u] not the same user", pid);
300 LOG(log_note, logtype_default, "Reconnect: transfering session to child[%u]", pid);
302 if (writet(child->ipc_fd, &DSI_requestID, 2, 0, 2) != 2) {
303 LOG(log_error, logtype_default, "Reconnect: error sending DSI id to child[%u]", pid);
307 EC_ZERO_LOG(send_fd(child->ipc_fd, afp_socket));
323 struct server_child_data *child, *tmp;
329 child = fork->table[i];
330 while (child) {
331 tmp = child->next;
332 if ( child->pid != pid) {
333 if (child->idlen == idlen && memcmp(child->clientid, id, idlen) == 0) {
334 if ( child->time != boottime ) {
336 if (uid == child->uid) {
337 kill_child(child);
339 "Terminated disconnected child[%u], client rebooted.",
340 child->pid);
343 "Session with different pid[%u]", child->pid);
348 "Found another session[%u] for client[%u]", child->pid, pid);
353 child->time = boottime;
354 if (child->clientid)
355 free(child->clientid);
356 LOG(log_debug, logtype_default, "Setting client ID for %u", child->pid);
357 child->uid = uid;
358 child->valid = 1;
359 child->idlen = idlen;
360 child->clientid = id;
362 child = tmp;