Library Version 18.1.40

db_env_set_func_ftruncate
Prev | Appendix C. Berkeley DB Application Space Static Functions | Next

## db_env_set_func_ftruncate

    #include <db.h>

    int
    db_env_set_func_ftruncate(int (*func_ftruncate)(int fd, off_t offset));

The Berkeley DB library requires the ability to truncate a file.

The `db_env_set_func_ftruncate` function configures all operations performed by a process and all of its threads of control, not operations confined to a single database environment.

Although the `db_env_set_func_ftruncate` function may be called at any time during the life of the application, it should normally be called before making calls to the db_env_create or db_create methods.

The `db_env_set_func_ftruncate()` function returns a non-zero error value on failure and 0 on success.

### Parameters

#### func_ftruncate

The func_ftruncate parameter is the function which truncates a file.

The fd parameter is an open file descriptor on the file.

The ftruncate function must truncate the file to the byte length specified by the offset parameter.

The func_ftruncate function must return the value of errno on failure and 0 on success.

### See Also

Run-time configuration

Prev | Up | Next
db_env_set_func_fsync | Home | db_env_set_func_ioinfo