UTIMES

Section: System Calls (2)
Index Return to Main Contents

BSD mandoc
BSD 4  

NAME

utimes - set file access and modification times  

SYNOPSIS

Fd #include <sys/time.h> Ft int Fn utimes const char *file const struct timeval *times  

DESCRIPTION

The Fn utimes function sets the access and modification times of the named file.

If Fa times is NULL the access and modification times are set to the current time. The caller must be the owner of the file, have permission to write the file, or be the super-user.

If Fa times is non- NULL , it is assumed to point to an array of two timeval structures. The access time is set to the value of the first element, and the modification time is set to the value of the second element. The caller must be the owner of the file or be the super-user.

In either case, the inode-change-time of the file is set to the current time.  

RETURN VALUES

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.  

ERRORS

Fn Utimes will fail if:

Bq Er EACCES
Search permission is denied for a component of the path prefix; or the Fa times argument is NULL and the effective user ID of the process does not match the owner of the file, and is not the super-user, and write access is denied.
Bq Er EFAULT
File or Fa times points outside the process's allocated address space.
Bq Er EIO
An I/O error occurred while reading or writing the affected inode.
Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
Bq Er ENAMETOOLONG
A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters.
Bq Er ENOENT
The named file does not exist.
Bq Er ENOTDIR
A component of the path prefix is not a directory.
Bq Er EPERM
The Fa times argument is not NULL and the calling process's effective user ID does not match the owner of the file and is not the super-user.
Bq Er EROFS
The file system containing the file is mounted read-only.

 

SEE ALSO

stat(2), utime(3)  

HISTORY

The Fn utimes function call appeared in BSD 4.2


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
ERRORS
SEE ALSO
HISTORY

This document was created by man2html, using the manual pages.
Time: 21:44:10 GMT, August 05, 2022