[libc-commits] [libc] [libc][sys] add header and functions for sys ipc (PR #182700)
Pengxiang Huang via libc-commits
libc-commits at lists.llvm.org
Sun Feb 22 13:37:16 PST 2026
================
@@ -0,0 +1,33 @@
+//===-- Definition of struct ipc_perm -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TYPES_STRUCT_IPC_PERM_H
+#define LLVM_LIBC_TYPES_STRUCT_IPC_PERM_H
+
+#include "gid_t.h"
+#include "key_t.h"
+#include "uid_t.h"
+
+#ifdef __linux__
+struct ipc_perm {
+ key_t __key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ unsigned short mode;
----------------
Pengxiang-Huang wrote:
1. Yes, this should be mode_t, i think i referred the wrong source defined this, which confused me that point.
2. The specify the rest of padding and unused is a practical concern. I once defined without those fields and i encountered several segfault when I tested this data structure in my local linux device. Then I found the implementation in linux for this is:
https://elixir.bootlin.com/linux/v6.19.3/source/include/uapi/asm-generic/ipcbuf.h#L22
also the glibc defined this the same way:
https://elixir.bootlin.com/glibc/glibc-2.42.9000/source/sysdeps/unix/sysv/linux/bits/ipc-perm.h#L28
the old definition for this:
https://elixir.bootlin.com/linux/v6.19/source/include/uapi/linux/ipc.h#L10
are marked as obsolete
https://github.com/llvm/llvm-project/pull/182700
More information about the libc-commits
mailing list