[libc-commits] [libc] [libc] Add `shm_open/shm_unlink` (PR #84974)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Fri Mar 15 09:41:36 PDT 2024
================
@@ -0,0 +1,50 @@
+//===---------- 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/memory_utils/inline_memcpy.h"
+
+// TODO: Get PATH_MAX via https://github.com/llvm/llvm-project/issues/85121
+#include <linux/limits.h>
+
+namespace LIBC_NAMESPACE {
+
+LIBC_INLINE_VAR constexpr cpp::string_view SHM_PREFIX = "/dev/shm/";
+using SHMPath = cpp::array<char, NAME_MAX + SHM_PREFIX.size() + 1>;
----------------
nickdesaulniers wrote:
Consider moving this `using` statement (and definition of SHM_PREFIX) inside of the `get_shm_name` function. Otherwise it's polluting the `LIBC_NAMESPACE` namespace in a header.
https://github.com/llvm/llvm-project/pull/84974
More information about the libc-commits
mailing list