- 論壇徽章:
- 0
|
本帖最后由 vupiggy 于 2011-06-14 15:16 編輯
哇咔咔,咋這多不看手冊(cè)的囁,RTFM!
22 是 EINVAL,man semget
- ...
- EINVAL nsems is less than 0 or greater than the limit on the number of semaphores per semaphore set (SEMMSL),
- or a semaphore set corresponding to key already exists, and nsems is larger than the number of sema‐
- phores in that set.
- ...
復(fù)制代碼 返回 EINVAL 只有 3 種可能。
檢查你調(diào)用 semget 的場(chǎng)景,你的 nsems 是 10,大于0,沒(méi)問(wèn)題,SEMMSL 打出來(lái)看一下,是250,10 < 250 也沒(méi)問(wèn)題,剩下唯一的可能就是,以 123 為 key 的信號(hào)量已經(jīng)存在,并且它創(chuàng)建時(shí)指定的容量小于你指定的 10,要在程序中知道它的容量用 semctl 看一下,不知道怎么用 semctl,man semctl,在 shell 下用 ipcs -s 命令查看。要不然就像樓上說(shuō)的先刪除再創(chuàng)建新的。 |
|