Creates a file. This system call is identical to sys_open call with 'O_CREAT or O_WRONLY or O_TRUNC' mode flags.
Arguments
eax |
8 |
ebx |
Pointer to a null-terminated string specifying the pathname of a file. |
ecx |
File permissions to set for a newly created file. Following is the list of flags that can be used:
S_IRWXU - owner has read, write and execute permission
S_IRUSR - owner has read permission
S_IWUSR - owner has write permission
S_IXUSR - owner has execute permission
S_IRWXG - group has read, write and execute permission
S_IRGRP - group has read permission
S_IWGRP - group has write permission
S_IXGRP - group has execute permission
S_IRWXO - others have read, write and execute permission
S_IROTH - others have read permission
S_IWOTH - others have write permission
S_IXOTH - others have execute permission |
|
Return values
If the system call succeeds the return value is the new file descriptor.
If the system call fails the return value is one of the following errno values:
-EEXIST |
Pathname already exists. |
-EFAULT |
ebx points outside your accessible address space. |
-EISDIR |
Pathname refers to a directory and the access requested involved writing. |
-ELOOP |
Too many symbolic links were encountered in resolving the pathname. |
-EMFILE |
The process already has the maximum number of files open. |
-ENAMETOOLONG |
Pathname is too long. |
-ENFILE |
The system limit on the total number of open files has been reached. |
-ENOMEM |
Insufficient kernel memory was available. |
-ENOSPC |
Pathname was to be created but the device containing pathname has no room for the new file. |
-ENOTDIR |
A component used as a directory in pathname is not, in fact, a directory. |
-ENXIO |
No corresponding device exists. |
-EROFS |
Pathname refers to a file on a read-only filesystem and write access was requested. |
|
Remarks
If the file is newly created, its st_atime, st_ctime, st_mtime fields (respectively, time of last access, time of last status change, and time of last modification; see sys_stat) are set to the current time, and so are the st_ctime and st_mtime fields of the parent directory. Otherwise, if the file is modified because of the O_TRUNC flag, its st_ctime and st_mtime fields are set to the current time.
Compatibility
n/a |