Linux 即使在glibc中有NPTL支持,sem_open在ENOSYS中也会失败

Linux 即使在glibc中有NPTL支持,sem_open在ENOSYS中也会失败,linux,semaphore,Linux,Semaphore,我正在尝试使用命名信号量在我的linux应用程序中的多个进程之间进行同步 #include <fcntl.h> /* For O_* constants */ #include <sys/stat.h> /* For mode constants */ #include <semaphore.h> #include <stdio.h> #include <errno.h

我正在尝试使用命名信号量在我的linux应用程序中的多个进程之间进行同步

    #include <fcntl.h>           /* For O_* constants */
    #include <sys/stat.h>        /* For mode constants */
    #include <semaphore.h>
    #include <stdio.h>
    #include <errno.h>

int main( )
{
        int sval = -2;
        char sem_open_file[128];
        snprintf(sem_open_file, 128, "/MyNamedSem");
        sem_t *sem = sem_open((const char *)sem_open_file, O_CREAT|O_EXCL, S_IRWXU|S_IRWXG|S_IRWXO, 0);
        if(SEM_FAILED == sem)
        {
                printf( "sem_open failed with errno  %d\n",errno);
        }
        else
        {
                printf("sem_open succeded\n");
        }

        return 0;
}
-内核版本的变化会导致任何问题吗

我还将linux内核配置为包含POSIX_MQUE。 使用的NPTL版本是2.9(通过在我的嵌入式主板上运行arm angstrom linux gnueabi/usr/bin/getconf,通过
/getconf GNU_LIBPTHREAD_version
)获得)


欣赏任何能解决问题的想法。谢谢您的帮助。

那么您确定主机已安装shm文件系统了吗?谢谢您的回复。是主机上安装了shm文件系统。“tmpfs on/dev/shm类型tmpfs(rw,relatime)”是“mount”cmd响应的一部分。
$/lib/libc.so.6
GNU C Library stable release version 2.9, by Roland McGrath et al.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.3.3.
Compiled on a Linux >>2.6.24-23-generic<< system on 2010-04-22.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        Support for some architectures added on, not maintained in glibc core.
        BIND-8.2.3-T5B
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.
$uname -r
2.6.30