永发信息网

函数key(lkey1=ftok("/etc/profile",1)里的第二个参数项目ID具体是指什么含义

答案:1  悬赏:60  手机版
解决时间 2021-11-19 15:04
  • 提问者网友:十年饮冰
  • 2021-11-19 07:23
函数key(lkey1=ftok("/etc/profile",1)里的第二个参数项目ID具体是指什么含义
最佳答案
  • 五星知识达人网友:渡鹤影
  • 2021-11-19 08:30
DESCRIPTION
The ftok() function uses the identity of the file named by the given pathname (which must refer to an existing, accessible file) and the least signifi-
cant 8 bits of proj_id (which must be non-zero) to generate a key_t type System V IPC key, suitable for use with msgget(2), semget(2), or shmget(2).

The resulting value is the same for all pathnames that name the same file, when the same value of proj_id is used. The value returned should be differ-
ent when the (simultaneously existing) files or the project IDs differ.

大概意思是根据前面字符串和后面的字节固定那么返回结果就固定,任何一个值不同返回都可能不同,但无论如何不能保证返回的KEY在系统中没有被使用。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯