Functions
func open(String, Int32) (deprecated)
public func open(path: String, oflag: Int32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
When the oflag parameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters.
O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func open(String, Int32, UInt32) (deprecated)
public func open(path: String, oflag: Int32, flag: UInt32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails. path indicates the file path, and oflag indicates the file opening mode. O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for oflag, but can be used together with other operation identifiers, such as O_APPEND.
When the oflag parameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters.
O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
- oflag: Int32: file opening mode
- flag: UInt32: If
oflagis set to O_CREAT and a new file needs to be created, theflagparameter indicates the permission on the new file. Otherwise,flagdoes not change the file permission.
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func access(String, Int32) (deprecated)
public func access(path: String, mode: Int32): Int32
Description: Checks whether a certain permission is granted on a file. If so, 0 is returned. Otherwise, -1 is returned.
mode indicates the specified permission. The input type is R_OK, W_OK, X_OK, or F_OK.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the permission is granted on the file,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func chdir(String) (deprecated)
public func chdir(path: String): Int32
Description: Changes the current working directory of the called process by specifying a path.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: changed path
Returns:
- Int32: If the setting is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func chmod(String, UInt32) (deprecated)
public func chmod(path: String, mode: UInt32): Int32
Description: Modifies the file access permission.
In the Windows environment:
- All files and directories are readable. chmod() cannot change the read permission on files.
- In the
Windowsenvironment, the execute permission on a file is set through the file name extension. All directories are executable, and chmod() cannot change the execute permission on files and directories.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned. Ifmodeis set to an invalid parameter, chmod ignores the parameter and0is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func chown(String, UInt32, UInt32) (deprecated)
public func chown(path: String, owner: UInt32, group: UInt32): Int32
Description: Modifies the file owner and the group to which the file owner belongs.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func close(Int32) (deprecated)
public func close(fd: Int32): Int32
Description: Close a file, which triggers data writeback to the disk and releases resources occupied by the file.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
func creat(String, UInt32) (deprecated)
public func creat(path: String, flag: UInt32): Int32
Description: Creates a file and returns a file descriptor, or returns -1 when the operation fails.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: A file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func dup(Int32) (deprecated)
public func dup(fd: Int32): Int32
Description: Copies and returns the file descriptor specified by the original fd parameter. The new file descriptor and the original fd parameter reference the same file, share the file states, and share all locks, read or write location, and permissions or flags.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
Returns:
- Int32: The smallest unused file descriptor is returned. If the execution fails,
-1is returned.
func dup2(Int32, Int32) (deprecated)
public func dup2(fd: Int32, fd2: Int32): Int32
Description: Copies the file descriptor specified by oldfd and returns it to the newfd parameter. If the newfd parameter is an open file descriptor, the file specified by newfd is closed first.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor specified by the
oldfdparameter - fd2: Int32: file descriptor specified by the
newfdparameter
Returns:
- Int32:
fd2file descriptor
func faccessat(Int32, String, Int32, Int32) (deprecated)
public func faccessat(fd: Int32, path: String, mode: Int32, flag: Int32): Int32
Description: Checks whether a certain permission is granted on the file specified by fd. If so, 0 is returned. Otherwise, -1 is returned.
mode indicates the specified permission. The input type is R_OK, W_OK, X_OK, or F_OK.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
- path: String: file path
- mode: Int32: permission to be checked
- flag: Int32: Obtains one or more of the following values by bitwise OR operation. The value
(512)indicates that access check is performed using a valid user and groupID. By default, a validIDis used. If the path name is a symbolic link (value(256)), the reference is not canceled but information about the link is returned.
Returns:
- Int32: If the permission is granted on the file,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func fchdir(Int32) (deprecated)
public func fchdir(fd: Int32): Int32
Description: Changes the current working directory of the called process by specifying the descriptor of a file path.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: descriptor of the changed file path
Returns:
- Int32: If the setting is successful,
0is returned. Otherwise,-1is returned.
func fchmod(Int32, UInt32) (deprecated)
public func fchmod(fd: Int32, mode: UInt32): Int32
Description: Modifies the file access permission corresponding to the file descriptor.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func fchmodat(Int32, String, UInt32, Int32) (deprecated)
public func fchmodat(fd: Int32, path: String, mode: UInt32, flag: Int32): Int32
Description: Modifies the file access permission corresponding to the file descriptor.
- If
pathis a relative path andfdis set to a special valueAT_FDCWD, the path is relative to the current working directory of the called process. - If
pathis a relative path andfdis notAT_FDCWD, the path is relative to the directory to which the file referenced byfdbelongs. - If
pathis an absolute path, thefdparameter is ignored.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
- path: String: file path
- mode: UInt32: permission to be modified
- flag: Int32: The value can be
0or(256)(the path name is a symbolic link, and the reference to it is not canceled, but information about the link is returned).
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func fchown(Int32, UInt32, UInt32) (deprecated)
public func fchown(fd: Int32, owner: UInt32, group: UInt32): Int32
Description: Modifies the file owner corresponding to fd and the group to which the file owner belongs.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
func fchownat(Int32, String, UInt32, UInt32, Int32) (deprecated)
public func fchownat(fd: Int32, path: String, owner: UInt32, group: UInt32, flag: Int32): Int32
Description: Modifies the file owner corresponding to the file descriptor and the group to which the file owner belongs.
- If
pathis a relative path andfdis set to a special valueAT_FDCWD, the path is relative to the current working directory of the called process. - If
pathis a relative path andfdis notAT_FDCWD, the path is relative to the directory to which the file referenced byfdbelongs. - If
pathis an absolute path, thefdparameter is ignored.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
- path: String: file path
- owner: UInt32: owner
uid - group: UInt32: parameter specifying the
gid - flag: Int32: The value can be
0or(256)(the path name is a symbolic link, and the reference to it is not canceled, but information about the link is returned).
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func getcwd() (deprecated)
public func getcwd(): String
Description: Obtains the absolute path of the working directory of the current process.
NOTE
This function will be deprecated in future releases.
Returns:
- String: If the operation is successful, a string containing the path information is returned. Otherwise, an empty string is returned.
func getgid() (deprecated)
public func getgid(): UInt32
Description: Obtains the user group ID.
NOTE
This function will be deprecated in future releases.
Returns:
- UInt32: current user group
ID
func getgroups(Int32, CPointer<UInt32>) (deprecated)
public unsafe func getgroups(size: Int32, gidArray: CPointer<UInt32>): Int32
Description: Obtains codes of groups to which the current user belongs.
If the size parameter of gidArray is 0, the function returns only the number of groups to which the user belongs, and does not add gid into gidArray.
NOTE
This function will be deprecated in future releases.
Parameters:
- size: Int32:
gidquantity allowed ingidArray - gidArray: CPointer<UInt32>: array storing
gidinformation
Returns:
- Int32: If the execution is successful, the group code is returned. Otherwise,
-1is returned.
func gethostname() (deprecated)
public func gethostname(): String
Description: Obtains a host name, which is usually the name of a host on the TCP/IP network.
NOTE
This function will be deprecated in future releases.
Returns:
- String: obtained host name string. If the host name fails to be obtained, an empty string is returned.
func getlogin() (deprecated)
public func getlogin(): String
Description: Obtains the current login name.
NOTE
This function will be deprecated in future releases.
Returns:
- String: If the operation is successful, the login name is returned. Otherwise, an empty string is returned.
func getos() (deprecated)
public func getos(): String
Description: Obtains the Linux system information from the /proc/version file. Example: Linux version 4.15.0-142-generic (buildd@lgw01-amd64-036) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021.
NOTE
This function will be deprecated in future releases.
Returns:
- String: obtained Linux system information string
func getpgid(Int32) (deprecated)
public func getpgid(pid: Int32): Int32
Description: Obtains PGID of the process specified by pid. If pid is 0, ID of the called process is returned.
NOTE
This function will be deprecated in future releases.
Parameters:
- pid: Int32: target process
ID
Returns:
- Int32: If the execution is successful, the process group
IDis returned. Otherwise,-1is returned.
func getpgrp() (deprecated)
public func getpgrp(): Int32
Description: Obtains the parent process ID of the called process.
NOTE
This function will be deprecated in future releases.
Returns:
- Int32: The parent process
IDof the called process is returned.
func getpid() (deprecated)
public func getpid(): Int32
Description: Obtains ID(PID) of the called process.
NOTE
This function will be deprecated in future releases.
Returns:
- Int32: The
ID(PID)of the called process is returned.
func getppid() (deprecated)
public func getppid(): Int32
Description: Obtains the parent process ID of the called process.
NOTE
This function will be deprecated in future releases.
Returns:
- Int32: The parent process
IDof the called process is returned.
func getuid() (deprecated)
public func getuid(): UInt32
Description: Obtains the real user ID of the called process.
NOTE
This function will be deprecated in future releases.
Returns:
- UInt32: current real user
ID
func isBlk(String) (deprecated)
public func isBlk(path: String): Bool
Description: Checks whether the input object is a block device and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isChr(String) (deprecated)
public func isChr(path: String): Bool
Description: Checks whether the input object is a character device and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isDir(String) (deprecated)
public func isDir(path: String): Bool
Description: Checks whether the input object is a folder and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isFIFO(String) (deprecated)
public func isFIFO(path: String): Bool
Description: Checks whether the input object is an FIFO file and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isLnk(String) (deprecated)
public func isLnk(path: String): Bool
Description: Checks whether the input object is a soft link and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isReg(String) (deprecated)
public func isReg(path: String): Bool
Description: Checks whether the input object is a regular file and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isSock(String) (deprecated)
public func isSock(path: String): Bool
Description: Checks whether the input object is a socket file and returns a Boolean value.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Bool: If so,
trueis returned. Otherwise,falseis returned.
func isType(String, UInt32) (deprecated)
public func isType(path: String, mode: UInt32): Bool
Description: Checks whether a file is in the specified mode. If so, true is returned. Otherwise, false is returned. Different types are determined based on different modes.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Bool: If the file is in a specified mode,
trueis returned. Otherwise,falseis returned.
func isatty(Int32) (deprecated)
public func isatty(fd: Int32): Bool
Description: Tests whether a file descriptor references a terminal. If so, true is returned. Otherwise, false is returned.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
Returns:
- Bool: If the operation is successful,
trueis returned. Otherwise,falseis returned.
func kill(Int32, Int32) (deprecated)
public func kill(pid: Int32, sig: Int32): Int32
Description: Sends any signal to any process group or process.
- If
pidis greater than0,sigis sent to the process corresponding topid. - If
pidis equal to0,sigis sent to each process in the process group to which the called process belongs. - If
pidis equal to-1,sigis sent to each process to which the called process has permission to send signals. - If
pidis less than-1,sigis sent to each process in the process group whoseIDis-pid.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
func killpg(Int32, Int32) (deprecated)
public func killpg(pgid: Int32, sig: Int32): Int32
Description: Sends the signal sig to the process group pgrp. If pgrp is 0, killpg() sends the signal to the process group to which the called process belongs.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
func lchown(String, UInt32, UInt32) (deprecated)
public func lchown(path: String, owner: UInt32, group: UInt32): Int32
Description: Modifies the file link owner and the group to which the owner belongs.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path in string format
- owner: UInt32: owner
uid - group: UInt32: parameter specifying the
gid
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func link(String, String) (deprecated)
public func link(path: String, newpath: String): Int32
Description: Creates a link for an existing file. A file can have multiple directory entries pointing to its i-node.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathornewPathcontains null characters, this exception is thrown.
func linkat(Int32, String, Int32, String, Int32) (deprecated)
public func linkat(fd: Int32, path: String, nfd: Int32, newPath: String, lflag: Int32): Int32
Description: Creates a file link relative to the directory file descriptor.
- If
pathis a relative path andfdis set to a special valueAT_FDCWD, the path is relative to the current working directory of the called process. - If
pathis a relative path andfdis notAT_FDCWD, the path is relative to the directory to which the file referenced byfdbelongs. - If
pathis an absolute path, thefdparameter is ignored. newPathis similar topath. The only difference is that whennewPathis a relative path, the path is the directory to which the file referenced bynfdbelongs.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
- path: String: file path
- nfd: Int32: another file descriptor
- newPath: String: another file path. If
newpathalready exists, the existing file will not be overwritten. - lflag: Int32: AT_EMPTY_PATH,
AT_SYMLINK_FOLLOW, or0
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathornewPathcontains null characters, this exception is thrown.
func lseek(Int32, Int64, Int32) (deprecated)
public func lseek(fd: Int32, offset: Int64, whence: Int32): Int64
Description: Moves the read or write location in file reading or writing. This function is used to control the read or write location of a file. If the call is successful, the current read or write location, that is, the number of bytes from the start of the file, is returned. Otherwise, -1 is returned.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int64: If the call is successful, the current read or write location, that is, the number of bytes from the start of the file, is returned.
func nice(Int32) (deprecated)
public func nice(inc: Int32): Int32
Description: Changes the priority of the current thread.
If the operation is successful, a new value is returned. Otherwise, -1 is returned. If the value of inc is greater than 19, 19 is returned.
Only the superuser can use a negative inc value, which indicates a higher priority and faster process execution. inc indicates the priority of the current process, ranging from +19 (low priority) to -20.
NOTE
This function will be deprecated in future releases.
Parameters:
- inc: Int32: priority of the current process, ranging from
+19(low priority) to-20
Returns:
- Int32: A new priority value is returned.
func open64(String, Int32) (deprecated)
public func open64(path: String, oflag: Int32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
- When the
oflagparameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters. - O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for
oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func open64(String, Int32, UInt32) (deprecated)
public func open64(path: String, oflag: Int32, flag: UInt32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
- When the
oflagparameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters. - O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for
oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
- oflag: Int32: file opening mode
- flag: UInt32: If
oflagis set to O_CREAT and a new file needs to be created, theflagparameter indicates the permission on the new file. Otherwise,flagdoes not change the file permission.
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func openat(Int32, String, Int32) (deprecated)
public func openat(fd: Int32, path: String, oflag: Int32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
- When the
oflagparameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters. - O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for
oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func openat(Int32, String, Int32, UInt32) (deprecated)
public func openat(fd: Int32, path: String, oflag: Int32, flag: UInt32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
- When the
oflagparameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters. - O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for
oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor of a path
- path: String: file path
- oflag: Int32: file opening mode
- flag: UInt32: If
oflagis set to O_CREAT and a new file needs to be created, theflagparameter indicates the permission on the new file. Otherwise,flagdoes not change the file permission.
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func openat64(Int32, String, Int32) (deprecated)
public func openat64(fd: Int32, path: String, oflag: Int32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
- When the
oflagparameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters. - O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for
oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func openat64(Int32, String, Int32, UInt32) (deprecated)
public func openat64(fd: Int32, path: String, oflag: Int32, flag: UInt32): Int32
Description: Opens a file and returns a new file descriptor, or returns -1 when the operation fails.
- When the
oflagparameter of the file opening mode is set to O_CREAT, file permissions can be set through parameters. - O_RDONLY, O_RDWR, and O_WRONLY are mutually exclusive for
oflag, but can be used together with other operation identifiers, such as O_APPEND.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor of a path
- path: String: file path
- oflag: Int32: file opening mode
- flag: UInt32: If
oflagis set to O_CREAT and a new file needs to be created, theflagparameter indicates the permission on the new file. Otherwise,flagdoes not change the file permission.
Returns:
- Int32: A new file descriptor is returned. If the execution fails,
-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func pread(Int32, CPointer<UInt8>, UIntNative, Int32) (deprecated)
public unsafe func pread(fd: Int32, buffer: CPointer<UInt8>, nbyte: UIntNative, offset: Int32): IntNative
Description: Transfers nbyte of the file specified by fd to the memory specified by buffer. If nbyte is 0, the function does not work and 0 is returned. The returned value is the number of bytes that are actually read. If the returned value is 0, the end of the file is reached or data cannot be read. In addition, the read or write location of the file varies with the bytes read.
It is recommended that the size of nbyte be the same as that of buffer, and the size of buffer be less than or equal to 150,000 bytes.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor of the file to be read
- buffer: CPointer<UInt8>: buffer container
- nbyte: UIntNative: number of bytes to be read.
buffer.sizeis recommended. - offset: Int32: offset of the read location
Returns:
- IntNative: The number of actually read bytes is returned. If the read operation is invalid,
-1is returned.
func pwrite(Int32, CPointer<UInt8>, UIntNative, Int32) (deprecated)
public unsafe func pwrite(fd: Int32, buffer: CPointer<UInt8>, nbyte: UIntNative, offset: Int32): IntNative
Description: Writes nbyte in the memory specified by buffer to the file specified by fd, starting from the specified offset location. The read or write location of the specified file change accordingly.
It is recommended that the size of nbyte be the same as that of buffer, and the size of buffer be less than or equal to 150,000 bytes.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor of the file to be read
- buffer: CPointer<UInt8>: buffer container
- nbyte: UIntNative: number of bytes to be read.
buffer.sizeis recommended. - offset: Int32: offset of the read location
Returns:
- IntNative: The number of actually written bytes is returned. If the write operation fails,
-1is returned.
func read(Int32, CPointer<UInt8>, UIntNative) (deprecated)
public unsafe func read(fd: Int32, buffer: CPointer<UInt8>, nbyte: UIntNative): IntNative
Description: Transfers nbyte of the file specified by fd to the memory specified by buffer. If nbyte is 0, the function does not work and 0 is returned. The returned value is the number of bytes that are actually read. If the returned value is 0, the end of the file is reached or data cannot be read. In addition, the read or write location of the file varies with the bytes read.
It is recommended that the size of nbyte be the same as that of buffer, and the size of buffer be less than or equal to 150,000 bytes.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor of the file to be read
- buffer: CPointer<UInt8>: buffer container
- nbyte: UIntNative: number of bytes to be read.
buffer.sizeis recommended.
Returns:
- IntNative: The number of actually read bytes is returned. If the read operation is invalid,
-1is returned.
func remove(String) (deprecated)
public func remove(path: String): Int32
Description: Deletes a file or directory.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func rename(String, String) (deprecated)
public func rename(oldName: String, newName: String): Int32
Description: Renames a file, and moves the file to another directory when required. Any other hard links of the file are not affected. The file descriptors opened in the old path are not affected.
Constraints determine whether the rename operation is successful. The specific scenarios are as follows:
- If
newNamealready exists, it is replaced atomically so that another process trying to accessnewNamedoes not find it lost, but there may be a window where both the old and new paths reference the file to be renamed. - If the old and new paths are existing hard links that reference the same file, the rename operation is not performed and success is returned.
- If
newNameexists but the operation fails for some reason, thenewNameinstance is retained. oldNamecan specify a directory. In this case,newNamemust be unique or specify an empty directory.- If the old path references a symbolic link, the link is renamed. If the new path references a symbolic link, the link is overwritten.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
oldNameornewNamecontains null characters, this exception is thrown.
func renameat(Int32, String, Int32, String) (deprecated)
public func renameat(oldfd: Int32, oldName: String, newfd: Int32, newName: String): Int32
Description: Renames a file, and moves the file to another directory when required.
renameat() and rename() are processed in the same way. The following describes only the differences between them:
- If
oldNameis a relative path andoldfdis set to a special valueAT_FDCWD, the path is relative to the current working directory of the called process. - If
oldNameis a relative path andoldfdis notAT_FDCWD, the path is relative to the directory to which the file referenced byoldfdbelongs. - If
oldNameis an absolute path, theoldfdparameter is ignored. newNameis similar tooldName. The only difference is that whennewNameis a relative path, the path is the directory to which the file referenced bynewfdbelongs.
NOTE
This function will be deprecated in future releases.
Parameters:
- oldfd: Int32: file descriptor
- oldName: String: file name
- newfd: Int32: file descriptor
- newName: String: file name
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
oldNameornewNamecontains null characters, this exception is thrown.
func setgid(UInt32) (deprecated)
public func setgid(id: UInt32): Int32
Description: Sets the valid group ID of the called process, which requires appropriate permissions.
NOTE
This function will be deprecated in future releases.
Parameters:
- id: UInt32: valid group
IDof the called process
Returns:
- Int32: If the setting is successful,
0is returned. Otherwise,-1is returned.
func sethostname(String) (deprecated)
public func sethostname(buf: String): Int32
Description: Sets a host name. Only the superuser can call this function.
NOTE
This function will be deprecated in future releases.
Parameters:
- buf: String: host name to be set
Returns:
- Int32: If the setting is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the
bufparameter contains null characters, this exception is thrown.
func setpgid(Int32, Int32) (deprecated)
public func setpgid(pid: Int32, pgrp: Int32): Int32
Description: Sets the group ID specified by pid to the group pid specified by pgrp. If pid is set to 0, the group ID of the current process is used.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the execution is successful, the group
IDis returned. Otherwise,-1is returned.
func setpgrp() (deprecated)
public func setpgrp(): Int32
Description: Sets the group ID to which the current process belongs to the process ID of the current process. This function is equivalent to setpgid(0, 0).
NOTE
This function will be deprecated in future releases.
Returns:
- Int32: If the execution is successful, the current process group
IDis returned. Otherwise,-1is returned.
func setuid(UInt32) (deprecated)
public func setuid(id: UInt32): Int32
Description: Sets the valid user ID of the called process, which requires appropriate permissions.
NOTE
This function will be deprecated in future releases.
Parameters:
- id: UInt32: valid group
IDof the called process
Returns:
- Int32: If the setting is successful,
0is returned. Otherwise,-1is returned.
func symlink(String, String) (deprecated)
public func symlink(path: String, symPath: String): Int32
Description: Creates a link named symPath to the file specified by path.
- A symbolic link is replaced by the actual file or directory when executed.
- Symbolic links may contain .. path components. Such components (if used at the beginning of a link) reference the parent directory.
- A symbolic link (also called a soft link) can point to an existing file or a file that does not exist. The latter is called a dangling link.
- The permissions of symbolic links are unrelated. When a link is traced, the ownership is ignored. However, when a request for deleting or renaming the link is initiated and the link is in a directory with the sticky bit set, the ownership is checked.
- If symPath already exists, the existing file is not overwritten.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathorsymPathcontains null characters, this exception is thrown.
func symlinkat(String, Int32, String) (deprecated)
public func symlinkat(path: String, fd: Int32, symPath: String): Int32
Description: Creates a link named symPath to the file specified by path and fd.
- If
symPathis a relative path andfdis set to a special valueAT_FDCWD, the path is relative to the current working directory of the called process. - If
symPathis a relative path andfdis notAT_FDCWD, the path is relative to the directory to which the file referenced byfdbelongs. - If
symPathis an absolute path, thefdparameter is ignored.
NOTE
This function will be deprecated in future releases.
Parameters:
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathorsymPathcontains null characters, this exception is thrown.
func ttyname(Int32) (deprecated)
public func ttyname(fd: Int32): String
Description: Returns the terminal name.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
Returns:
- String: If the operation is successful, the path name is returned. Otherwise,
NULLis returned.
func umask(UInt32) (deprecated)
public func umask(cmask: UInt32): UInt32
Description: Sets a permission mask.
NOTE
This function will be deprecated in future releases.
Parameters:
- cmask: UInt32: file permission parameter.
Returns:
- UInt32: The previous mask of the file is returned.
func unlink(String) (deprecated)
public func unlink(path: String): Int32
Description: Deletes a file from the file system.
- If
pathis the last link to a file and no process is using the file, the file is deleted and the space used by the file can be reused. - If
pathis the last link to a file but the file is still used by a process, the file exists until the last file descriptor that references it is closed. - If
pathreferences a symbolic link, the link is deleted. - If
pathreferences a socket, FIFO, or device, the file is deleted, but it may still be used by the process that opens the object.
NOTE
This function will be deprecated in future releases.
Parameters:
- path: String: file path
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func unlinkat(Int32, String, Int32) (deprecated)
public func unlinkat(fd: Int32, path: String, ulflag: Int32): Int32
Description: Deletes a file from the file system.
The system call method of this function is the same as that of unlink, except for the differences described below.
- If
pathis a relative path andfdis set to a special valueAT_FDCWD, the path is relative to the current working directory of the called process. - If
pathis a relative path andfdis notAT_FDCWD, the path is relative to the directory to which the file referenced byfdbelongs. - If
pathis an absolute path, thefdparameter is ignored.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor
- path: String: file path
- ulflag: Int32: specified as
0or set to a bitwise OR operation of the flag value that controls the unlinkat() operation Currently, the flag value can only be AT_REMOVEDIR.
Returns:
- Int32: If the operation is successful,
0is returned. Otherwise,-1is returned.
Throws:
- IllegalArgumentException: If the function parameter
pathcontains null characters, this exception is thrown.
func write(Int32, CPointer<UInt8>, UIntNative) (deprecated)
public unsafe func write(fd: Int32, buffer: CPointer<UInt8>, nbyte: UIntNative): IntNative
Description: Writes nbyte in the memory specified by buffer to the file specified by fd. The read or write location of the specified file change accordingly.
It is recommended that the size of nbyte be the same as that of buffer, and the size of buffer be less than or equal to 150,000 bytes.
NOTE
This function will be deprecated in future releases.
Parameters:
- fd: Int32: file descriptor of the file to be written to
- buffer: CPointer<UInt8>: buffer container
- nbyte: UIntNative: number of bytes to be read.
buffer.sizeis recommended.
Returns:
- IntNative: The number of actually read bytes is returned. If the read operation is invalid,
-1is returned.