HPlogo MPE/iX Developer's Kit Reference Manual Volume 2: HP 3000 MPE/iX Computer Systems > Chapter 2 SVID IPC Library Function Descriptions

ftok

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Returns a key used in calls to msgget(), semget(), and shmget() function calls.

Syntax

     #include <sys/types.h>

     #include <sys/ipc.h>



     key_t ftok (char *pathname, char id);

Parameters

pathname

Passes a pointer to a string containing the pathname of a file accessible to the calling process.

id

Passes a character used to further qualify the returned key.

Return Values

≠-1

Key value returned.

-1

Error. The specified pathname does not exist or is not accessible to the calling process.

Description

The ftok() function can be used to return a key based on both pathname and id. This key can be used in subsequent calls to the SVID IPC msgget(), semget(), and shmget() functions.

A different key is returned when called with the same pathname but a different character is passed in id.

Implementation Considerations

None.

Errors

If an error occurs, errno is set to the following value.

EINVALCAUSEThe pathname parameter points to an invalid address, or pathname specifies a nonexistent file, or the caller does not have the correct access to the pathname.
 ACTIONMake sure that pathname points to a valid and existing pathname to which the caller has access.

See Also

msgget(), semget(), shmget()

Feedback to webmaster