MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_ftruncate

Function sys_ftruncate

components/lwp/lwp_syscall.c:10247–10254  ·  view source on GitHub ↗

* @brief Truncate a file to a specified length. * * This function resizes the file associated with the given file descriptor `fd` to the specified length. * If the current size of the file is greater than the specified length, the file is truncated. If the file is smaller, * it is extended, and the new space is initialized to zero. * * @param[in] fd The file descriptor referring to the

Source from the content-addressed store, hash-verified

10245 * @note The file descriptor `fd` must be opened with write permissions for this operation to succeed.
10246 */
10247sysret_t sys_ftruncate(int fd, size_t length)
10248{
10249 int ret;
10250
10251 ret = ftruncate(fd, length);
10252
10253 return (ret < 0 ? GET_ERRNO() : ret);
10254}
10255
10256/**
10257 * @brief Set file access and modification times.

Callers

nothing calls this directly

Calls 1

ftruncateFunction · 0.50

Tested by

no test coverage detected