Unix-Files form an empty analysis

Source: Internet
Author: User

The Lseek function displays the offset for an open file, and the file offset can be greater than the current length of the file, in which case the next write to the file will be extended and a hole in the file is allowed. Bytes that are in the file but not written are read as 0.

eg


The HOLEFILE.C function creates a file with empty, running observations:


As you can see, the 30 non-written bytes in the file are set to read as 0. A 7-digit number at the beginning of each line is the byte offset represented in eight binary form.

Compare the file you just created with the same length but the dance hole file




Although the length of the two files is the same, the empty file occupies 20 disk blocks, while the empty file occupies only 8 disk blocks.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Unix-Files form an empty analysis

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.