c - Converting string to key_t -
c - Converting string to key_t -
how possible convert string key_t, in order  utilize creating shared memory segment using shmget?
this because key mapping shared memory beingness transmitted on tcp/ip.
thanks in advance!
the key created  phone call ftok(). latter uses file path , 8bit value so.
for same file path , same 8bit value ftok() (re-)creates same key.
so transfer file path , 8bit value (typically char) ,  allow receiver  phone call ftok() on values received. create same key sender uses.
from ftok()'s documentation:
the ftok() function uses identity of file named given pathname (which must refer existing, accessible file) , to the lowest degree important 8 bits of proj_id (which must nonzero) generate key_t type scheme v ipc key, suitable utilize msgget(2), semget(2), or shmget(2).
the resulting value same pathnames name same file, when same value of proj_id used. value returned should different when (simultaneously existing) files or project ids differ.
 c linux shared-memory sysv-ipc 
 
Comments
Post a Comment