看看这个semaphore出了什么问题?
mysem_put = sem_open( "mysem_put0" , O_RDWR|O_CREAT , S_IRUSR|S_IWUSR , 1);
运行上面的代码时返回错误:EINVAL
在solaris 8 上
问题点数:20、回复次数:5Top
1 楼fierygnu(va_list)回复于 2003-09-02 15:04:56 得分 20
mysem_put = sem_open( "/mysem_put0" , O_RDWR|O_CREAT , S_IRUSR|S_IWUSR , 1);
名字必须以"/"开头。Top
2 楼wabc(wabc)回复于 2003-09-02 17:22:26 得分 0
"/mysem_put0"是不是要在根目录下建立一个这样的文件?Top
3 楼fierygnu(va_list)回复于 2003-09-02 17:48:24 得分 0
sem_open不会建立文件,与根目录也没有什么关系。
下面是POSIX标准对sem_open的name参数的解释:
If name begins with the slash character, then processes calling sem_open() with the same value of name shall refer to the same semaphore object, as long as that name has not been removed. If name does not begin with the slash character, the effect is implementation-defined. The interpretation of slash characters other than the leading slash character in name is implementation-defined.
Top
4 楼wabc(wabc)回复于 2003-09-03 12:53:05 得分 0
thanks.
by the way,where can I find(or download) the POSIX specification?Top
5 楼fierygnu(va_list)回复于 2003-09-03 13:08:32 得分 0
http://www.opengroup.org/onlinepubs/007904975/Top




