ipc: Prefer key_t over int for System V IPC keys.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 17 Feb 2017 14:40:58 +0000 (15:40 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 13 Jul 2017 17:02:30 +0000 (19:02 +0200)
commitf6ae5e4753277ea35509c36dc618097b1175d632
treef4c09485f08c7baaa0f84ab091072e089c6fbfba
parentc92370affe722f38a85a41d1b5524e4a102b8f4d
ipc: Prefer key_t over int for System V IPC keys.

get_key() calls ftok(3), which returns a key_t value. key_t is also
the type which semget(2), the only function which receives the key via
mutex_get(), expects. It's stupid to convert the key_t from ftok(3)
into an int, only to convert it back to key_t later.

This patch changes ipc.c to use key_t everywhere. However, in
mutex_get() we print a log message containing the value of the key,
so the format string must be adjusted accordingly. Unfortunately,
on Linux, key_t is the same as int while on FreeBSD and NetBSD it is
defined as long. To avoid a warning from the compiler we use "%lx"
in the format string and cast the value to long.
ipc.c