Mkdir function in Linux

Source: Internet
Author: User

 

Prototype: int mkdir (const char * filename, mode_t Mode)

If the return value is 0, the operation is successful. If the return value is-1, an error occurs. To use this function, you must include the header file SYS/STAT. h.
Mode indicates the permission of the new directory. You can use the following values:

S_irusr
S_iread
Read Permission bit for the owner of the file. on Alibaba systems this bit is 0400. s_iread is an obsolete synonym provided for BSD compatibility.

S_iwusr
S_iwrite
Write Permission bit for the owner of the file. Usually 0200. s_iwrite is an obsolete synonym provided for BSD compatibility.

S_ixusr
S_iexec
Execute (for ordinary files) or search (for directories) Permission bit for the owner of the file. Usually 0100. s_iexec is an obsolete synonym provided for BSD compatibility.

S_irwxu
This is equivalent to (s_irusr | s_iwusr | s_ixusr ).

S_irgrp
Read Permission bit for the group owner of the file. Usually 040.

S_iwgrp
Write Permission bit for the group owner of the file. Usually 020.

S_ixgrp
Execute or search permission bit for the group owner of the file. Usually 010.

S_irwxg
This is equivalent to (s_irgrp | s_iwgrp | s_ixgrp ).

S_iroth
Read Permission bit for other users. Usually 04.

S_iwoth
Write Permission bit for other users. Usually 02.

S_ixoth
Execute or search permission bit for other users. Usually 01.

S_irwxo
This is equivalent to (s_iroth | s_iwoth | s_ixoth ).

S_isuid
This is the set-user-id on execute bit, usually 04000. See how change persona.

S_isgid
This is the set-group-ID on execute bit, usually 02000. See how change persona.

S_isvtx
This is the sticky bit, usually 01000. Note:

If there is a directory "test", you can create a new directory "/test/subdirectory" according to "mkdir", but you can't create a new

Directory "/test/subdirectory", it will return-1.

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.