[libc-commits] [libc] [libc] Add `shm_open/shm_unlink` (PR #84974)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Mar 13 09:26:01 PDT 2024


================
@@ -0,0 +1,51 @@
+//===---------- Shared implementations for shm_open/shm_unlink ------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/CPP/array.h"
+#include "src/__support/CPP/optional.h"
+#include "src/__support/CPP/string_view.h"
+#include "src/errno/libc_errno.h"
+#include "src/string/memchr.h"
+#include "src/string/memcpy.h"
+#include <asm/errno.h>
+#include <linux/limits.h>
----------------
nickdesaulniers wrote:

I'm not sure that we should be using NAME_MAX at all, which seems very Linux specific for a POSIX API.  Instead, I think we should be using the constants mandated by POSIX.

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/

talks about `_POSIX_PATH_MAX`, `_XOPEN_PATH_MAX`, `_POSIX_NAME_MAX`, and `_XOPEN_NAME_MAX`.

Bionic for example provides a header of these values (though bionic doesn't implement shm_open or shm_unlink).
https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/bits/posix_limits.h



https://github.com/llvm/llvm-project/pull/84974


More information about the libc-commits mailing list