shm_open 函数的正确 Java 映射是什么?

What is the correct Java mapping of the shm_open function?

我正在尝试编写一些访问 glibc 的 JNA 代码,特别是 mmap.h.

中定义的函数

我已尝试完全按照 man shm_open 中所示定义它。 getuid() 函数在工作之前调用,但 shm_open 没有 return.

我只能使用 JNA 4.4.0 和 JNA Platform 3.4.0。

interface LibC extends Library {
    LibC INSTANCE = Native.loadLibrary("c", LibC.class);

    int shm_open(String name, int oFlag, int mode);
}
// ...
int fileDescriptor = LibC.INSTANCE.shm_open("/some_memory.123", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
// ...

我希望文件描述符被 returned,但我得到了这些异常:

嗯,写题的时候想通了问题

虽然 getuid() 和朋友在 libc 中定义,但 shm_open 和朋友在 librt 中定义。我真的应该意识到,因为 shm_open 的联机帮助页明确指出 "Link with -lrt",表明它驻留在 "rt" 库中。

简而言之:我需要一个新的 LibRT 接口和 LibC,加载名称 rt