[libc-commits] [libc] [libc][sys] add header and functions for sys ipc (PR #182700)
Alexey Samsonov via libc-commits
libc-commits at lists.llvm.org
Sun Feb 22 10:43:54 PST 2026
================
@@ -0,0 +1,28 @@
+//===-- Linux implementation of ftok -------------------------------------===//
+//
+// 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/sys/ipc/ftok.h"
+
+#include "src/__support/common.h"
+#include "src/sys/stat/stat.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(key_t, ftok, (const char *path, int id)) {
+
+ // ftok implements based on stat
+ struct stat st;
+ if (LIBC_NAMESPACE::stat(path, &st) < 0)
----------------
vonosmas wrote:
We should not be calling one public function from the implementation of a different public function. E.g. here you'll probably need to call `stat` syscall, instead of stat function.
@michaelrj-google has a pending refactor (https://discourse.llvm.org/t/rfc-linux-syscall-cleanup/87248) that would make it simpler.
https://github.com/llvm/llvm-project/pull/182700
More information about the libc-commits
mailing list