ftok(3) Library Functions Manual ftok(3) NOMBRE ftok - convierte un nombre de camino y un identificador de proyecto en una clave IPC de System V BIBLIOTECA Biblioteca Estandar C (libc, -lc) SINOPSIS #include key_t ftok(const char *path, int proj_id); DESCRIPCION The ftok() function uses the identity of the file named by the given path (which must refer to an existing, accessible file) and the least significant 8 bits of proj_id (which must be nonzero) to generate a key_t type System V IPC key, suitable for use with msgget(2), semget(2), or shmget(2). El valor resultante es el mismo para todos los nombres de ruta que hacen referencia al mismo fichero, cuando se utiliza el mismo valor de proy. El valor devuelto deberia ser diferente cuando los ficheros (que existen simultaneamente) o los identificadores de proyecto son distintos. VALOR DEVUELTO En caso de exito se devuelve la clave key_t generada. En caso de fallo se devuelve -1, y la variable errno indica el error al igual que con la llamada al sistema stat(2). ATRIBUTOS Para obtener una explicacion de los terminos usados en esta seccion, vease attributes(7). +-----------------------------+--------------------+-------------------+ |Interfaz | Atributo | Valor | +-----------------------------+--------------------+-------------------+ |ftok() | Seguridad del hilo | Multi-hilo seguro | +-----------------------------+--------------------+-------------------+ ESTANDARES POSIX.1-2008. HISTORIAL POSIX.1-2001. NOTAS On some ancient systems, the prototype was: key_t ftok(char *path, char proj_id); Today, proj_id is an int, but still only 8 bits are used. Typical usage has an ASCII character proj_id, that is why the behavior is said to be undefined when proj_id is zero. Of course, no guarantee can be given that the resulting key_t is unique. Typically, a best-effort attempt combines the given proj_id byte, the lower 16 bits of the inode number, and the lower 8 bits of the device number into a 32-bit result. Collisions may easily happen, for example between files on /dev/hda1 and files on /dev/sda1. EJEMPLOS See semget(2). VEASE TAMBIEN msgget(2), semget(2), shmget(2), stat(2), sysvipc(7) TRADUCCION La traduccion al espanol de esta pagina del manual fue creada por Gerardo Aburruzaga Garcia y Miguel Perez Ibars Esta traduccion es documentacion libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algun error en la traduccion de esta pagina del manual, envie un correo electronico a . Paginas de Manual de Linux 6.15 17 Mayo 2025 ftok(3)