Lines Matching +full:- +full:- +full:pid

63 #include <atf-c.h>
74 int pid; in check_pidfile() local
81 if (fscanf(file, "%d", &pid) == -1) in check_pidfile()
82 errx(EXIT_FAILURE, "Failed to read pid from pidfile '%s'", in check_pidfile()
85 printf("Read pid %d, current pid %d\n", pid, getpid()); in check_pidfile()
86 if (pid != getpid()) in check_pidfile()
87 errx(EXIT_FAILURE, "Pid in pidfile (%d) does not match " in check_pidfile()
88 "current pid (%d)", pid, getpid()); in check_pidfile()
96 if (access(path, R_OK) != -1) { in ensure_deleted()
110 pid_t pid; in run_child() local
112 pid = fork(); in run_child()
113 ATF_REQUIRE(pid != -1); in run_child()
114 if (pid == 0) { in run_child()
122 ATF_REQUIRE(waitpid(pid, &status, 0) != -1); in run_child()
134 if (asprintf(&path, "%s%s.pid", _PATH_VARRUN, in generate_varrun_pidfile()
135 basename == NULL ? getprogname() : basename) == -1) { in generate_varrun_pidfile()
149 if (pidfile(NULL) == -1) in helper_default_path()
176 if (pidfile("custom-basename") == -1) in helper_custom_basename()
193 path = generate_varrun_pidfile("custom-basename"); in ATF_TC_BODY()
203 if (pidfile(path) == -1) in helper_custom_path()
213 ATF_REQUIRE(mkdir("var", 0777) != -1); in ATF_TC_BODY()
214 ATF_REQUIRE(mkdir("var/run", 0777) != -1); in ATF_TC_BODY()
216 run_child(helper_custom_path, "./var/run/my-pidfile.pid"); in ATF_TC_BODY()
218 ensure_deleted("./var/run/my-pidfile.pid"); in ATF_TC_BODY()
228 if (pidfile(NULL) == -1) in helper_change_basenames()
232 if (pidfile(NULL) == -1) in helper_change_basenames()
237 custom_path = generate_varrun_pidfile("custom-basename"); in helper_change_basenames()
238 if (pidfile("custom-basename") == -1) in helper_change_basenames()
243 if (pidfile("custom-basename") == -1) in helper_change_basenames()
266 custom_path = generate_varrun_pidfile("custom-basename"); in ATF_TC_BODY()
279 if (pidfile("./var/run/first.pid") == -1) in helper_change_paths()
281 "'./var/run/first.pid'"); in helper_change_paths()
282 check_pidfile("./var/run/first.pid"); in helper_change_paths()
284 if (pidfile("./second.pid") == -1) in helper_change_paths()
285 errx(EXIT_FAILURE, "Failed to create pidfile 'second.pid'"); in helper_change_paths()
286 ensure_deleted("./var/run/first.pid"); in helper_change_paths()
287 check_pidfile("./second.pid"); in helper_change_paths()
296 ATF_REQUIRE(mkdir("var", 0777) != -1); in ATF_TC_BODY()
297 ATF_REQUIRE(mkdir("var/run", 0777) != -1); in ATF_TC_BODY()
301 ensure_deleted("./var/run/my-pidfile.pid"); in ATF_TC_BODY()
302 ensure_deleted("second.pid"); in ATF_TC_BODY()
312 custom_path = generate_varrun_pidfile("custom-basename"); in helper_mix()
314 if (pidfile(NULL) == -1) in helper_mix()
318 if (pidfile("./second.pid") == -1) in helper_mix()
319 errx(EXIT_FAILURE, "Failed to create pidfile 'second.pid'"); in helper_mix()
321 check_pidfile("./second.pid"); in helper_mix()
323 if (pidfile("custom-basename") == -1) in helper_mix()
324 errx(EXIT_FAILURE, "Failed to create pidfile 'second.pid'"); in helper_mix()
326 ensure_deleted("./second.pid"); in helper_mix()
327 ensure_deleted("./custom-basename"); in helper_mix()
348 ensure_deleted("second.pid"); in ATF_TC_BODY()