[webkit-dev] Encoding and decoding ProcessID

Adrien Destugues pulkomandy at pulkomandy.tk
Sun Feb 24 09:54:55 PST 2019

Hi there,

We are finally starting to look into moving the Haiku port to WebKit2.

We have hit one little problem I'm not sure how to solve. Our pid_t on
32bit Haiku is declared as a signed long integer (this is for legacy
reasons and not something we can fix easily). Our uint32_t is a signed
integer (not long). This creates a compilation error when using pid_t
with IPC::Encoder, because none of the encode() functions match when
trying to pass a pid_t in our case.

Our options seems to be:
- Cast pid_t to int32_t when encoding it. I fear this would break other
  platforms if they decide to use a 64bit pid_t, for example
- Add an encode(pid_t) to the IPC::Encoder. I fear on other platforms it
  would complain that this is the same as encode(int32_t) and break the
- Define WTF::ProcessID as int32_t instead of pid_t, which I think could
  work, afte rfixing some compiler warnings (we will need to cast back
  to pid_t when passing it to OS functions, I think)

What do you think about it?

one example where encoding a pid is


More information about the webkit-dev mailing list