Ftok () Linux functions

Source: Internet
Author: User

# Include <sys/types. h>

# Include <sys/IPC. h>

As follows:

Key_t ftok (char * fname, int ID)

Fname is the specified file name (an existing file name). The current directory is generally used, for example:

Key_t key;

Key = ftok (".", 1); in this way, the fname is set to the current directory.

ID is a subserial number.

In general UNIX implementationS index NodeThe return value of key_t is obtained by adding the subnumber.

For example, if the index node number of a specified file is 65538, it is converted into a hexadecimal value of 0x010002, And the id value you specified is 38, it is converted into a hexadecimal value of 0x26, then the final key_t return value is 0x26010002.

To query the node number of a file index, use LS-I.

After deleting the rebuilt file, the index node number isOperating SystemIt is allocated according to the usage of the file system at that time. Therefore, the index node number obtained is different from the original one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.