Lines Matching refs:statep
76 * risk accidental sharing of other statep.
89 } *statep;
141 header_iovec[2].iov_base = statep->utsname.sysname;
142 header_iovec[2].iov_len = strlen(statep->utsname.sysname);
169 sock = accept(statep->listen_sock, NULL, NULL);
183 if (statep->hts[i].hts_pid != 0)
184 (void)kill(statep->hts[i].hts_pid, SIGTERM);
230 statep = (struct state *)pagebuffer;
232 if (uname(&statep->utsname) < 0)
235 statep->listen_sock = socket(PF_INET, SOCK_STREAM, 0);
236 if (statep->listen_sock < 0)
248 statep->path = argv[1];
249 if (statep->path != NULL) {
250 statep->data_file = open(statep->path, O_RDONLY);
251 if (statep->data_file < 0)
252 err(-1, "open: %s", statep->path);
254 statep->hts[i].hts_fd = statep->data_file;
260 statep->hts[i].hts_fd = mkstemp(temppath);
261 if (statep->hts[i].hts_fd < 0)
264 len = write(statep->hts[i].hts_fd, filebuffer,
273 if (bind(statep->listen_sock, (struct sockaddr *)&sin,
277 if (listen(statep->listen_sock, -1) < 0)
282 if (pthread_create(&statep->hts[i].hts_thread, NULL,
283 httpd_worker, &statep->hts[i]) != 0)
294 httpd_worker(&statep->hts[i]);
295 statep->hts[i].hts_pid = pid;
301 if (pthread_join(statep->hts[i].hts_thread, NULL)
305 pid = waitpid(statep->hts[i].hts_pid, NULL, 0);
306 if (pid == statep->hts[i].hts_pid)
307 statep->hts[i].hts_pid = 0;