Skip to contentSkip to conversation

Improve portability: Cast pid_t's to intmax_t

PATCH George Spelvin 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

This seems rather pointless. Whatever Solaris thinks, I really doubt that process IDs will ever overflow an int, which is 32 bits on all machines that will ever support more than 32k processes.

You can be paranoid if you like and cast to long, but I don't think even a massive 64-bit cluster is likely to have more than 2G processes in the forseeable future.

I'd support a cast to int or unsigned, or a cast to long as a second choice.

Using uintmax_t is formally correct, but practically pointless clutter.

#1 lore raw
Quoted 3 lines · George Spelvin

You can be paranoid if you like and cast to long, but I don't think even a massive 64-bit cluster is likely to have more than 2G processes in the forseeable future.

But it isn't it possible for some OS to use a sparse PID namespace?

-Miles

Signature · 1 line
Brain, n. An apparatus with which we think we think.