* @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
| 10245 | * @note The file descriptor `fd` must be opened with write permissions for this operation to succeed. |
| 10246 | */ |
| 10247 | sysret_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. |
nothing calls this directly
no test coverage detected