src: Use program_getpid() instead of getpid() on CloudABI.
CloudABI does not provide getpid(). The problem with getpid() is that it, being an integer type, cannot be implemented in a way that it is unique enough.
On traditional UNIX-like systems, it can be recycled fairly quickly. As CloudABI is focussing on getting distributed applications (clusters) right, it makes little sense to have five-digit process numbers. Instead, we have a program_getpid() function that returns a UUIDv4.
This code patches up process.pid to return the UUIDv4 on CloudABI. It also fixes up a log message containing the PID to use program_getpid() instead. For the latter, we also need to adjust the printf() format. Add a GETPID_FORMAT define that can be used for this purpose. Even POSIX doesn't guarantee that pid_t is a plain 'int'.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added <-- Do we want to change the documentation of process.pid
that it can return both ints and strings, depending on the OS? -
commit message follows commit guidelines
Affected core subsystem(s)
src