Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

futimesat, futimesat64 - setting file access and update times

&pagelevel(4)&pagelevel

Syntax

#include <sys/time.h>

int futimesat(int fd, const char *path, const struct timeval times[2]);

CRTE111A30
int futimesat64(int fd, const char *path, const struct timeval64 times[2]); (End)

Description

The futimesat() function sets the access and update times of a file to the values specified in times. The times of the file are changed to which the path parameter points relative to the directory connected with the file descriptor fd. The function permits time specifications which are accurate to the microsecond.

The times parameter is an array consisting of two structures of the type timeval. The access time is set to the value of the first element, and the update time to the value of the second element. The times in the timeval structure are specified in seconds and microseconds since the epoch.

When times is the null pointer, the access and update times are set to the current time. If the file descriptor was opened without O_SEARCH, the function checks whether a search is permitted in the connected file descriptor with the authorizations applicable for the directory.
If the file descriptor was opened with O_SEARCH, the check is not performed.

A process may call futimesat() with the null pointer for times parameter only if it has one of the following properties:

  • owner of the file,

  • write authorization for the file, or

  • special rights.

When the value AT_FDCWD is transferred to the futimesat() function for the fd parameter, the current directory is used. 

The function futimesat64() behaves like the function futimesat(), except that it uses the structure timeval64 instead of the structure timeval and therefore can process timestamps beyond 01/19/2038 03:14:07 UTC.

Return val.

0

-1

in the case of success,

in the case of an error errno is set to display the error.

Errors

futimesat() and futimesat64() fail when the following applies: 

 

EACCES

A component of the path may not be searched, or times is a null pointer and the effective user number is not that of the system administrator and not that of the owner of the file, and write access is rejected or the fd parameter was not opened with O_SEARCH, and the authorizations applicable for the directory do not permit the directory to be searched.

 

EBADF

The path parameter does not specify an absolute pathname, and the fd parameter does not have the value AT_FDCWD, nor does it contain a valid file descriptor opened for reading or searching.


Extension


EFAULT

times is not equal to zero and points beyond the process's assigned address space, or path points beyond the process's assigned address space.


EINTR

A signal was intercepted during the system call futimesat() resp. futimesat64()


EINVAL

An attempt was made to access a BS2000 file or the value of the flag parameter is invalid.


ELOOP

During the compilation of path too many symbolic links occurred to (End).


ENAMETOOLONG



The length of path exceeds {PATH_MAX} or the length of a component of path exceeds {NAME_MAX}.


ENOENT

The specified file does not exist.


ENOTDIR

A component of the path is not a directory, or the path parameter does not specify an absolute pathname, and the file descriptor fd is not connected with a directory.


EPERM

The effective user number if not that of the system administrator and not that of the owner of the file, and times is not equal to zero.


EROFS

The file system containing the file has been mounted write-protected.


futimesat64() fails when the following applies:

 

ENOSYS

POSIX-BC correction status < A47.

 See also

sys/time.h.