1 /*
2  * Copyright (c) 2024, Tenstorrent AI ULC
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/posix/unistd.h>
8 
getpid(void)9 pid_t getpid(void)
10 {
11 	/*
12 	 * To maintain compatibility with some other POSIX operating systems,
13 	 * a PID of zero is used to indicate that the process exists in another namespace.
14 	 * PID zero is also used by the scheduler in some cases.
15 	 * PID one is usually reserved for the init process.
16 	 * Also note, that negative PIDs may be used by kill()
17 	 * to send signals to process groups in some implementations.
18 	 *
19 	 * At the moment, getpid just returns an arbitrary number >= 2
20 	 */
21 
22 	return 42;
23 }
24 #ifdef CONFIG_POSIX_MULTI_PROCESS_ALIAS_GETPID
25 FUNC_ALIAS(getpid, _getpid, pid_t);
26 #endif /* CONFIG_POSIX_MULTI_PROCESS_ALIAS_GETPID */
27