9.39 truncate

int truncate(int fd, uint64_t new_size);

The syscall truncates the size of fd on disk to exactly new_size bytes.

If the file was larger, the cropped contents are lost, if it was smaller, the new data is zero’d out. No other file data is changed.

The syscall returns 0 or -1 on failure, with the following errno: