Lines Matching refs:se
120 SocketEntry *se;
123 se = xmalloc (sizeof (SocketEntry));
126 se->name = xmalloc (len);
128 strcpy (se->name, dir);
129 strcat (se->name, "/");
130 strcat (se->name, fname);
132 se->fd = -1;
134 se->status = SOCKET_UNKNOWN;
136 se->n_retries = 0;
138 return se;
142 free_socket_entry (SocketEntry *se)
144 if (se)
146 free (se->name);
147 if (se->fd >= 0)
148 close (se->fd);
149 free (se);
192 SocketEntry *se;
197 se = socket_entry_new (dir, dent->d_name);
205 entries[n_entries] = se;
216 open_socket (SocketEntry *se)
221 if (se->n_retries > 5)
224 se->name);
228 se->n_retries += 1;
230 se->fd = socket (AF_UNIX, SOCK_STREAM, 0);
231 if (se->fd < 0)
238 if (fcntl (se->fd, F_SETFL, O_NONBLOCK) < 0)
241 se->name, strerror (errno));
249 strncpy (saddr.sun_path, se->name, sizeof (saddr.sun_path) - 1);
253 ret = connect (se->fd, (struct sockaddr*) &saddr, sizeof (saddr));
270 se->name, strerror (errno));
288 SocketEntry *se;
291 se = entries[i];
294 if (se->fd >= 0)
297 se->status);
301 if (se->status != SOCKET_UNKNOWN)
304 status = open_socket (se);
310 if (unlink (se->name) < 0)
313 se->name, strerror (errno));
315 se->status = SOCKET_FAILED_TO_HANDLE;
318 se->status = SOCKET_UNLINKED;
327 se->status = status;
336 if (se->fd >= 0)
338 close (se->fd);
339 se->fd = -1;
342 if (se->status == SOCKET_UNKNOWN)