[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printing pid_t values
From: |
Bernhard Voelker |
Subject: |
Re: printing pid_t values |
Date: |
Wed, 6 Jan 2021 19:30:28 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
On 1/6/21 7:00 PM, Bruno Haible wrote:
> I don't think there is an issue, because
> * The pid_t values occurring on Solaris are in the 5-digit range
> (> 0 and likely < 32768).
> * On 32-bit platforms, 'int' and 'long' are of the same size, and on
> x86_64 and sparc64 the parameter passing conventions in varargs
> say that such a value is passed zero-extended or sign-extended,
> and which of the two is irrelevant here.
great, thanks!
> But if you want to get rid of the warnings, you are welcome to submit
> a patch that adds PRIdPID or PRIuPID to <inttypes.h> and uses it where
> it makes sense.
I'm afraid this is beyond my current capacity.
A quick search finds PRIdPID already in some Apple-related code:
https://opensource.apple.com/source/Security/Security-55471/libsecurity_codesigning/lib/SecTask.c
// Define PRIdPID (proper printf format string for pid_t)
#define PRIdPID PRId32
FWIW: on Solaris 11, PID_MAX is defined like this:
$ find /usr/include -type f -exec grep -w PID_MAX '{}' +
/usr/include/limits.h:#define PID_MAX 999999 /* max value
for a process ID */
Thanks again.
Have a nice day,
Berny