chiark / gitweb /
bc505ae29669c10ec51a924290d517786e185694
[elogind.git] / src / test / test-process-util.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 /***
3   Copyright 2010 Lennart Poettering
4   Copyright 2013 Thomas H.P. Andersen
5 ***/
6
7 #include <sched.h>
8 #include <sys/mount.h>
9 #include <sys/personality.h>
10 #include <sys/prctl.h>
11 #include <sys/stat.h>
12 #include <sys/types.h>
13 #include <sys/wait.h>
14 #include <unistd.h>
15 #if HAVE_VALGRIND_VALGRIND_H
16 #include <valgrind/valgrind.h>
17 #endif
18
19 #include "alloc-util.h"
20 //#include "architecture.h"
21 #include "fd-util.h"
22 #include "log.h"
23 #include "macro.h"
24 #include "parse-util.h"
25 #include "process-util.h"
26 #include "signal-util.h"
27 #include "stdio-util.h"
28 #include "string-util.h"
29 #include "terminal-util.h"
30 #include "test-helper.h"
31 #include "util.h"
32 #include "virt.h"
33
34 static void test_get_process_comm(pid_t pid) {
35         struct stat st;
36         _cleanup_free_ char *a = NULL, *c = NULL, *d = NULL, *f = NULL, *i = NULL;
37         _cleanup_free_ char *env = NULL;
38         char path[STRLEN("/proc//comm") + DECIMAL_STR_MAX(pid_t)];
39 #if 0 /// UNNEEDED by elogind
40         pid_t e;
41         uid_t u;
42         gid_t g;
43 #endif // 0
44         dev_t h;
45         int r;
46
47         xsprintf(path, "/proc/"PID_FMT"/comm", pid);
48
49         if (stat(path, &st) == 0) {
50                 assert_se(get_process_comm(pid, &a) >= 0);
51                 log_info("PID"PID_FMT" comm: '%s'", pid, a);
52         } else
53                 log_warning("%s not exist.", path);
54
55         assert_se(get_process_cmdline(pid, 0, true, &c) >= 0);
56         log_info("PID"PID_FMT" cmdline: '%s'", pid, c);
57
58         assert_se(get_process_cmdline(pid, 8, false, &d) >= 0);
59         log_info("PID"PID_FMT" cmdline truncated to 8: '%s'", pid, d);
60
61         free(d);
62         assert_se(get_process_cmdline(pid, 1, false, &d) >= 0);
63         log_info("PID"PID_FMT" cmdline truncated to 1: '%s'", pid, d);
64
65 #if 0 /// UNNEEDED by elogind
66         assert_se(get_process_ppid(pid, &e) >= 0);
67         log_info("PID"PID_FMT" PPID: "PID_FMT, pid, e);
68         assert_se(pid == 1 ? e == 0 : e > 0);
69 #endif // 0
70
71         assert_se(is_kernel_thread(pid) == 0 || pid != 1);
72
73         r = get_process_exe(pid, &f);
74         assert_se(r >= 0 || r == -EACCES);
75         log_info("PID"PID_FMT" exe: '%s'", pid, strna(f));
76
77 #if 0 /// UNNEEDED by elogind
78         assert_se(get_process_uid(pid, &u) == 0);
79         log_info("PID"PID_FMT" UID: "UID_FMT, pid, u);
80         assert_se(u == 0 || pid != 1);
81
82         assert_se(get_process_gid(pid, &g) == 0);
83         log_info("PID"PID_FMT" GID: "GID_FMT, pid, g);
84         assert_se(g == 0 || pid != 1);
85
86         r = get_process_environ(pid, &env);
87         assert_se(r >= 0 || r == -EACCES);
88         log_info("PID"PID_FMT" strlen(environ): %zi", pid, env ? (ssize_t)strlen(env) : (ssize_t)-errno);
89 #endif // 0
90
91         if (!detect_container())
92                 assert_se(get_ctty_devnr(pid, &h) == -ENXIO || pid != 1);
93
94         (void) getenv_for_pid(pid, "PATH", &i);
95         log_info("PID"PID_FMT" $PATH: '%s'", pid, strna(i));
96 }
97
98 static void test_get_process_comm_escape_one(const char *input, const char *output) {
99         _cleanup_free_ char *n = NULL;
100
101         log_info("input: <%s> — output: <%s>", input, output);
102
103         assert_se(prctl(PR_SET_NAME, input) >= 0);
104         assert_se(get_process_comm(0, &n) >= 0);
105
106         log_info("got: <%s>", n);
107
108         assert_se(streq_ptr(n, output));
109 }
110
111 static void test_get_process_comm_escape(void) {
112         _cleanup_free_ char *saved = NULL;
113
114         assert_se(get_process_comm(0, &saved) >= 0);
115
116         test_get_process_comm_escape_one("", "");
117         test_get_process_comm_escape_one("foo", "foo");
118         test_get_process_comm_escape_one("012345678901234", "012345678901234");
119         test_get_process_comm_escape_one("0123456789012345", "012345678901234");
120         test_get_process_comm_escape_one("äöüß", "\\303\\244\\303…");
121         test_get_process_comm_escape_one("xäöüß", "x\\303\\244…");
122         test_get_process_comm_escape_one("xxäöüß", "xx\\303\\244…");
123         test_get_process_comm_escape_one("xxxäöüß", "xxx\\303\\244…");
124         test_get_process_comm_escape_one("xxxxäöüß", "xxxx\\303\\244…");
125         test_get_process_comm_escape_one("xxxxxäöüß", "xxxxx\\303…");
126
127         assert_se(prctl(PR_SET_NAME, saved) >= 0);
128 }
129
130 static void test_pid_is_unwaited(void) {
131         pid_t pid;
132
133         pid = fork();
134         assert_se(pid >= 0);
135         if (pid == 0) {
136                 _exit(EXIT_SUCCESS);
137         } else {
138                 int status;
139
140                 waitpid(pid, &status, 0);
141                 assert_se(!pid_is_unwaited(pid));
142         }
143         assert_se(pid_is_unwaited(getpid_cached()));
144         assert_se(!pid_is_unwaited(-1));
145 }
146
147 static void test_pid_is_alive(void) {
148         pid_t pid;
149
150         pid = fork();
151         assert_se(pid >= 0);
152         if (pid == 0) {
153                 _exit(EXIT_SUCCESS);
154         } else {
155                 int status;
156
157                 waitpid(pid, &status, 0);
158                 assert_se(!pid_is_alive(pid));
159         }
160         assert_se(pid_is_alive(getpid_cached()));
161         assert_se(!pid_is_alive(-1));
162 }
163
164 #if 0 /// UNNEEDED by elogind
165 static void test_personality(void) {
166
167         assert_se(personality_to_string(PER_LINUX));
168         assert_se(!personality_to_string(PERSONALITY_INVALID));
169
170         assert_se(streq(personality_to_string(PER_LINUX), architecture_to_string(native_architecture())));
171
172         assert_se(personality_from_string(personality_to_string(PER_LINUX)) == PER_LINUX);
173         assert_se(personality_from_string(architecture_to_string(native_architecture())) == PER_LINUX);
174
175 #ifdef __x86_64__
176         assert_se(streq_ptr(personality_to_string(PER_LINUX), "x86-64"));
177         assert_se(streq_ptr(personality_to_string(PER_LINUX32), "x86"));
178
179         assert_se(personality_from_string("x86-64") == PER_LINUX);
180         assert_se(personality_from_string("x86") == PER_LINUX32);
181         assert_se(personality_from_string("ia64") == PERSONALITY_INVALID);
182         assert_se(personality_from_string(NULL) == PERSONALITY_INVALID);
183
184         assert_se(personality_from_string(personality_to_string(PER_LINUX32)) == PER_LINUX32);
185 #endif
186 }
187 #endif // 0
188
189 static void test_get_process_cmdline_harder(void) {
190         char path[] = "/tmp/test-cmdlineXXXXXX";
191         _cleanup_close_ int fd = -1;
192         _cleanup_free_ char *line = NULL;
193         pid_t pid;
194
195         if (geteuid() != 0)
196                 return;
197
198 #if HAVE_VALGRIND_VALGRIND_H
199         /* valgrind patches open(/proc//cmdline)
200          * so, test_get_process_cmdline_harder fails always
201          * See https://github.com/systemd/systemd/pull/3555#issuecomment-226564908 */
202         if (RUNNING_ON_VALGRIND)
203                 return;
204 #endif
205
206         pid = fork();
207         if (pid > 0) {
208                 siginfo_t si;
209
210                 (void) wait_for_terminate(pid, &si);
211
212                 assert_se(si.si_code == CLD_EXITED);
213                 assert_se(si.si_status == 0);
214
215                 return;
216         }
217
218         assert_se(pid == 0);
219         assert_se(unshare(CLONE_NEWNS) >= 0);
220
221         assert_se(mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) >= 0);
222
223         fd = mkostemp(path, O_CLOEXEC);
224         assert_se(fd >= 0);
225
226         if (mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) < 0) {
227                 /* This happens under selinux… Abort the test in this case. */
228                 log_warning_errno(errno, "mount(..., \"/proc/self/cmdline\", \"bind\", ...) failed: %m");
229                 assert(errno == EACCES);
230                 return;
231         }
232
233         assert_se(unlink(path) >= 0);
234
235         assert_se(prctl(PR_SET_NAME, "testa") >= 0);
236
237         assert_se(get_process_cmdline(getpid_cached(), 0, false, &line) == -ENOENT);
238
239         assert_se(get_process_cmdline(getpid_cached(), 0, true, &line) >= 0);
240         assert_se(streq(line, "[testa]"));
241         line = mfree(line);
242
243         assert_se(get_process_cmdline(getpid_cached(), 1, true, &line) >= 0);
244         assert_se(streq(line, ""));
245         line = mfree(line);
246
247         assert_se(get_process_cmdline(getpid_cached(), 2, true, &line) >= 0);
248         assert_se(streq(line, "["));
249         line = mfree(line);
250
251         assert_se(get_process_cmdline(getpid_cached(), 3, true, &line) >= 0);
252         assert_se(streq(line, "[."));
253         line = mfree(line);
254
255         assert_se(get_process_cmdline(getpid_cached(), 4, true, &line) >= 0);
256         assert_se(streq(line, "[.."));
257         line = mfree(line);
258
259         assert_se(get_process_cmdline(getpid_cached(), 5, true, &line) >= 0);
260         assert_se(streq(line, "[..."));
261         line = mfree(line);
262
263         assert_se(get_process_cmdline(getpid_cached(), 6, true, &line) >= 0);
264         assert_se(streq(line, "[...]"));
265         line = mfree(line);
266
267         assert_se(get_process_cmdline(getpid_cached(), 7, true, &line) >= 0);
268         assert_se(streq(line, "[t...]"));
269         line = mfree(line);
270
271         assert_se(get_process_cmdline(getpid_cached(), 8, true, &line) >= 0);
272         assert_se(streq(line, "[testa]"));
273         line = mfree(line);
274
275         assert_se(write(fd, "\0\0\0\0\0\0\0\0\0", 10) == 10);
276
277         assert_se(get_process_cmdline(getpid_cached(), 0, false, &line) == -ENOENT);
278
279         assert_se(get_process_cmdline(getpid_cached(), 0, true, &line) >= 0);
280         assert_se(streq(line, "[testa]"));
281         line = mfree(line);
282
283         assert_se(write(fd, "foo\0bar\0\0\0\0\0", 10) == 10);
284
285         assert_se(get_process_cmdline(getpid_cached(), 0, false, &line) >= 0);
286         assert_se(streq(line, "foo bar"));
287         line = mfree(line);
288
289         assert_se(get_process_cmdline(getpid_cached(), 0, true, &line) >= 0);
290         assert_se(streq(line, "foo bar"));
291         line = mfree(line);
292
293         assert_se(write(fd, "quux", 4) == 4);
294         assert_se(get_process_cmdline(getpid_cached(), 0, false, &line) >= 0);
295         assert_se(streq(line, "foo bar quux"));
296         line = mfree(line);
297
298         assert_se(get_process_cmdline(getpid_cached(), 0, true, &line) >= 0);
299         assert_se(streq(line, "foo bar quux"));
300         line = mfree(line);
301
302         assert_se(get_process_cmdline(getpid_cached(), 1, true, &line) >= 0);
303         assert_se(streq(line, ""));
304         line = mfree(line);
305
306         assert_se(get_process_cmdline(getpid_cached(), 2, true, &line) >= 0);
307         assert_se(streq(line, "."));
308         line = mfree(line);
309
310         assert_se(get_process_cmdline(getpid_cached(), 3, true, &line) >= 0);
311         assert_se(streq(line, ".."));
312         line = mfree(line);
313
314         assert_se(get_process_cmdline(getpid_cached(), 4, true, &line) >= 0);
315         assert_se(streq(line, "..."));
316         line = mfree(line);
317
318         assert_se(get_process_cmdline(getpid_cached(), 5, true, &line) >= 0);
319         assert_se(streq(line, "f..."));
320         line = mfree(line);
321
322         assert_se(get_process_cmdline(getpid_cached(), 6, true, &line) >= 0);
323         assert_se(streq(line, "fo..."));
324         line = mfree(line);
325
326         assert_se(get_process_cmdline(getpid_cached(), 7, true, &line) >= 0);
327         assert_se(streq(line, "foo..."));
328         line = mfree(line);
329
330         assert_se(get_process_cmdline(getpid_cached(), 8, true, &line) >= 0);
331         assert_se(streq(line, "foo..."));
332         line = mfree(line);
333
334         assert_se(get_process_cmdline(getpid_cached(), 9, true, &line) >= 0);
335         assert_se(streq(line, "foo b..."));
336         line = mfree(line);
337
338         assert_se(get_process_cmdline(getpid_cached(), 10, true, &line) >= 0);
339         assert_se(streq(line, "foo ba..."));
340         line = mfree(line);
341
342         assert_se(get_process_cmdline(getpid_cached(), 11, true, &line) >= 0);
343         assert_se(streq(line, "foo bar..."));
344         line = mfree(line);
345
346         assert_se(get_process_cmdline(getpid_cached(), 12, true, &line) >= 0);
347         assert_se(streq(line, "foo bar..."));
348         line = mfree(line);
349
350         assert_se(get_process_cmdline(getpid_cached(), 13, true, &line) >= 0);
351         assert_se(streq(line, "foo bar quux"));
352         line = mfree(line);
353
354         assert_se(get_process_cmdline(getpid_cached(), 14, true, &line) >= 0);
355         assert_se(streq(line, "foo bar quux"));
356         line = mfree(line);
357
358         assert_se(get_process_cmdline(getpid_cached(), 1000, true, &line) >= 0);
359         assert_se(streq(line, "foo bar quux"));
360         line = mfree(line);
361
362         assert_se(ftruncate(fd, 0) >= 0);
363         assert_se(prctl(PR_SET_NAME, "aaaa bbbb cccc") >= 0);
364
365         assert_se(get_process_cmdline(getpid_cached(), 0, false, &line) == -ENOENT);
366
367         assert_se(get_process_cmdline(getpid_cached(), 0, true, &line) >= 0);
368         assert_se(streq(line, "[aaaa bbbb cccc]"));
369         line = mfree(line);
370
371         assert_se(get_process_cmdline(getpid_cached(), 10, true, &line) >= 0);
372         assert_se(streq(line, "[aaaa...]"));
373         line = mfree(line);
374
375         assert_se(get_process_cmdline(getpid_cached(), 11, true, &line) >= 0);
376         assert_se(streq(line, "[aaaa...]"));
377         line = mfree(line);
378
379         assert_se(get_process_cmdline(getpid_cached(), 12, true, &line) >= 0);
380         assert_se(streq(line, "[aaaa b...]"));
381         line = mfree(line);
382
383         safe_close(fd);
384         _exit(EXIT_SUCCESS);
385 }
386
387 #if 0 /// UNNEEDED by elogind
388 static void test_rename_process_now(const char *p, int ret) {
389         _cleanup_free_ char *comm = NULL, *cmdline = NULL;
390         int r;
391
392         r = rename_process(p);
393         assert_se(r == ret ||
394                   (ret == 0 && r >= 0) ||
395                   (ret > 0 && r > 0));
396
397         if (r < 0)
398                 return;
399
400 #if HAVE_VALGRIND_VALGRIND_H
401         /* see above, valgrind is weird, we can't verify what we are doing here */
402         if (RUNNING_ON_VALGRIND)
403                 return;
404 #endif
405
406         assert_se(get_process_comm(0, &comm) >= 0);
407         log_info("comm = <%s>", comm);
408         assert_se(strneq(comm, p, TASK_COMM_LEN-1));
409
410         assert_se(get_process_cmdline(0, 0, false, &cmdline) >= 0);
411         /* we cannot expect cmdline to be renamed properly without privileges */
412         if (geteuid() == 0) {
413                 log_info("cmdline = <%s>", cmdline);
414                 assert_se(strneq(p, cmdline, STRLEN("test-process-util")));
415                 assert_se(startswith(p, cmdline));
416         } else
417                 log_info("cmdline = <%s> (not verified)", cmdline);
418 }
419
420 static void test_rename_process_one(const char *p, int ret) {
421         siginfo_t si;
422         pid_t pid;
423
424         pid = fork();
425         assert_se(pid >= 0);
426
427         if (pid == 0) {
428                 /* child */
429                 test_rename_process_now(p, ret);
430                 _exit(EXIT_SUCCESS);
431         }
432
433         assert_se(wait_for_terminate(pid, &si) >= 0);
434         assert_se(si.si_code == CLD_EXITED);
435         assert_se(si.si_status == EXIT_SUCCESS);
436 }
437
438 static void test_rename_process_multi(void) {
439         pid_t pid;
440
441         pid = fork();
442         assert_se(pid >= 0);
443
444         if (pid > 0) {
445                 siginfo_t si;
446
447                 assert_se(wait_for_terminate(pid, &si) >= 0);
448                 assert_se(si.si_code == CLD_EXITED);
449                 assert_se(si.si_status == EXIT_SUCCESS);
450
451                 return;
452         }
453
454         /* child */
455         test_rename_process_now("one", 1);
456         test_rename_process_now("more", 0); /* longer than "one", hence truncated */
457         (void) setresuid(99, 99, 99); /* change uid when running privileged */
458         test_rename_process_now("time!", 0);
459         test_rename_process_now("0", 1); /* shorter than "one", should fit */
460         test_rename_process_one("", -EINVAL);
461         test_rename_process_one(NULL, -EINVAL);
462         _exit(EXIT_SUCCESS);
463 }
464
465 static void test_rename_process(void) {
466         test_rename_process_one(NULL, -EINVAL);
467         test_rename_process_one("", -EINVAL);
468         test_rename_process_one("foo", 1); /* should always fit */
469         test_rename_process_one("this is a really really long process name, followed by some more words", 0); /* unlikely to fit */
470         test_rename_process_one("1234567", 1); /* should always fit */
471         test_rename_process_multi(); /* multiple invocations and dropped privileges */
472 }
473 #endif // 0
474
475 static void test_getpid_cached(void) {
476         siginfo_t si;
477         pid_t a, b, c, d, e, f, child;
478
479         a = raw_getpid();
480         b = getpid_cached();
481         c = getpid();
482
483         assert_se(a == b && a == c);
484
485         child = fork();
486         assert_se(child >= 0);
487
488         if (child == 0) {
489                 /* In child */
490                 a = raw_getpid();
491                 b = getpid_cached();
492                 c = getpid();
493
494                 assert_se(a == b && a == c);
495                 _exit(EXIT_SUCCESS);
496         }
497
498         d = raw_getpid();
499         e = getpid_cached();
500         f = getpid();
501
502         assert_se(a == d && a == e && a == f);
503
504         assert_se(wait_for_terminate(child, &si) >= 0);
505         assert_se(si.si_status == 0);
506         assert_se(si.si_code == CLD_EXITED);
507 }
508
509 #define MEASURE_ITERATIONS (10000000LLU)
510
511 static void test_getpid_measure(void) {
512         unsigned long long i;
513         usec_t t, q;
514
515         t = now(CLOCK_MONOTONIC);
516         for (i = 0; i < MEASURE_ITERATIONS; i++)
517                 (void) getpid();
518         q = now(CLOCK_MONOTONIC) - t;
519
520         log_info(" glibc getpid(): %llu/s\n", (unsigned long long) (MEASURE_ITERATIONS*USEC_PER_SEC/q));
521
522         t = now(CLOCK_MONOTONIC);
523         for (i = 0; i < MEASURE_ITERATIONS; i++)
524                 (void) getpid_cached();
525         q = now(CLOCK_MONOTONIC) - t;
526
527         log_info("getpid_cached(): %llu/s\n", (unsigned long long) (MEASURE_ITERATIONS*USEC_PER_SEC/q));
528 }
529
530 static void test_safe_fork(void) {
531         siginfo_t status;
532         pid_t pid;
533         int r;
534
535         BLOCK_SIGNALS(SIGCHLD);
536
537         r = safe_fork("(test-child)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_NULL_STDIO|FORK_REOPEN_LOG, &pid);
538         assert_se(r >= 0);
539
540         if (r == 0) {
541                 /* child */
542                 usleep(100 * USEC_PER_MSEC);
543
544                 _exit(88);
545         }
546
547         assert_se(wait_for_terminate(pid, &status) >= 0);
548         assert_se(status.si_code == CLD_EXITED);
549         assert_se(status.si_status == 88);
550 }
551
552 static void test_pid_to_ptr(void) {
553
554         assert_se(PTR_TO_PID(NULL) == 0);
555         assert_se(PID_TO_PTR(0) == NULL);
556
557         assert_se(PTR_TO_PID(PID_TO_PTR(1)) == 1);
558         assert_se(PTR_TO_PID(PID_TO_PTR(2)) == 2);
559         assert_se(PTR_TO_PID(PID_TO_PTR(-1)) == -1);
560         assert_se(PTR_TO_PID(PID_TO_PTR(-2)) == -2);
561
562         assert_se(PTR_TO_PID(PID_TO_PTR(INT16_MAX)) == INT16_MAX);
563         assert_se(PTR_TO_PID(PID_TO_PTR(INT16_MIN)) == INT16_MIN);
564
565 #if SIZEOF_PID_T >= 4
566         assert_se(PTR_TO_PID(PID_TO_PTR(INT32_MAX)) == INT32_MAX);
567         assert_se(PTR_TO_PID(PID_TO_PTR(INT32_MIN)) == INT32_MIN);
568 #endif
569 }
570
571 static void test_ioprio_class_from_to_string_one(const char *val, int expected) {
572         assert_se(ioprio_class_from_string(val) == expected);
573         if (expected >= 0) {
574                 _cleanup_free_ char *s = NULL;
575                 unsigned ret;
576
577                 assert_se(ioprio_class_to_string_alloc(expected, &s) == 0);
578                 /* We sometimes get a class number and sometimes a number back */
579                 assert_se(streq(s, val) ||
580                           safe_atou(val, &ret) == 0);
581         }
582 }
583
584 static void test_ioprio_class_from_to_string(void) {
585         test_ioprio_class_from_to_string_one("none", IOPRIO_CLASS_NONE);
586         test_ioprio_class_from_to_string_one("realtime", IOPRIO_CLASS_RT);
587         test_ioprio_class_from_to_string_one("best-effort", IOPRIO_CLASS_BE);
588         test_ioprio_class_from_to_string_one("idle", IOPRIO_CLASS_IDLE);
589         test_ioprio_class_from_to_string_one("0", 0);
590         test_ioprio_class_from_to_string_one("1", 1);
591         test_ioprio_class_from_to_string_one("7", 7);
592         test_ioprio_class_from_to_string_one("8", 8);
593         test_ioprio_class_from_to_string_one("9", -1);
594         test_ioprio_class_from_to_string_one("-1", -1);
595 }
596
597 int main(int argc, char *argv[]) {
598         log_set_max_level(LOG_DEBUG);
599         log_parse_environment();
600         log_open();
601
602         saved_argc = argc;
603         saved_argv = argv;
604
605         if (argc > 1) {
606                 pid_t pid = 0;
607
608                 (void) parse_pid(argv[1], &pid);
609                 test_get_process_comm(pid);
610         } else {
611                 TEST_REQ_RUNNING_SYSTEMD(test_get_process_comm(1));
612                 test_get_process_comm(getpid());
613         }
614
615         test_get_process_comm_escape();
616         test_pid_is_unwaited();
617         test_pid_is_alive();
618 #if 0 /// UNNEEDED by elogind
619         test_personality();
620 #endif // 0
621         test_get_process_cmdline_harder();
622 #if 0 /// UNNEEDED by elogind
623         test_rename_process();
624 #endif // 0
625         test_getpid_cached();
626         test_getpid_measure();
627         test_safe_fork();
628         test_pid_to_ptr();
629         test_ioprio_class_from_to_string();
630
631         return 0;
632 }