From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <2cc2c048f7b1591c9a05bf3ec1528a17.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199705282124.XAA06124@orion.ens.fr> Date: Wed, 28 May 1997 23:24:53 +0200 (CEST) From: Thomas Pornin Subject: 2.0.30 + shmctl Hello, I have some problem using shared memory functions with a 2.0.30 kernel on my UDB. This breaks X programs using shared memory extensions, namely Quake (but not only). I have searched the mailinglist archive, but I have not found many information; anyway, I came upon something I find rather disturbing: a call to shmctl() with IPC_STAT as argument should fill a struct shmid_ds, which contains a struct ipc_perm, declared this way in /usr/include/linux/ipc.h : struct ipc_perm { key_t key; ushort uid; /* owner euid and egid */ ushort gid; ushort cuid; /* creator euid and egid */ ushort cgid; ushort mode; /* access modes see mode flags below */ ushort seq; /* sequence number */ }; But, in user land, it is declared this way (/usr/include/sys/ipc_buf.h): struct ipc_perm { key_t __key; /* key */ __uid_t uid; /* owner's user ID */ __gid_t gid; /* owner's group ID */ __uid_t cuid; /* creator's user ID */ __gid_t cgid; /* creator's group ID */ __mode_t mode; /* read/write permission */ unsigned short int __seq; /* sequence number */ }; The main problem is that a ushort is two bytes long, and a __uid_t is four bytes long. This is much disturbing; the kernel uses its definition in the values it returns, but userland programs use the other one. This breaks gdb (from RedHat 4.1), xquake (the 1.06 elf binary), and any program using shmctl(), including all the X programs using XShmPutImage() and similar functions. My kernel is a clean 2.0.30 from ftp.kernel.org, no patch (and no axp-diff patch). What is the cure ? Recompiling a kernel with a patched definition of ipc_perm ? Or does it exist a cleaner solution ? Thanks in advance for any answer. (please Cc: a copy to me directly, because I seem to be only randomly subscribed to the mailinglist) --Thomas Pornin -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com