1.\" Copyright (c) 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)utimes.2 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt UTIMES 2 10.Os BSD 4 11.Sh NAME 12.Nm utimes 13.Nd set file access and modification times 14.Sh SYNOPSIS 15.Fd #include <sys/time.h> 16.Ft int 17.Fn utimes "const char *file" "const struct timeval *times" 18.Sh DESCRIPTION 19The 20.Fn utimes 21function sets the access and modification times of the named file from 22the structures in the argument array 23.Fa times . 24.Pp 25The first structure is the access time, and the second is the modification 26time. 27.Pp 28If the times are specified (the 29.Fa times 30argument is 31.Pf non- Dv NULL ) 32the caller must be the owner of the file or be the super-user. 33.Pp 34If the times are not specified (the 35.Fa times 36argument is 37.Dv NULL ) 38the caller must be the owner of the file, have permission to 39write the file, or be the super-user. 40.Sh RETURN VALUES 41Upon successful completion, a value of 0 is returned. 42Otherwise, a value of -1 is returned and 43.Va errno 44is set to indicate the error. 45.Sh ERRORS 46.Fn Utimes 47will fail if: 48.Bl -tag -width Er 49.It Bq Er EACCES 50Search permission is denied for a component of the path prefix; 51or the 52.Fa times 53argument is 54.Dv NULL 55and the effective user ID of the process does not 56match the owner of the file, and is not the super-user, and write 57access is denied. 58.It Bq Er EFAULT 59.Xr File 60or 61.Fa times 62points outside the process's allocated address space. 63.It Bq Er EINVAL 64The pathname contains a character with the high-order bit set. 65.It Bq Er EIO 66An I/O error occurred while reading or writing the affected inode. 67.It Bq Er ELOOP 68Too many symbolic links were encountered in translating the pathname. 69.It Bq Er ENAMETOOLONG 70A component of a pathname exceeded 255 characters, 71or an entire path name exceeded 1023 characters. 72.It Bq Er ENOENT 73The named file does not exist. 74.It Bq Er ENOTDIR 75A component of the path prefix is not a directory. 76.It Bq Er EPERM 77The 78.Fa times 79argument is not 80.Dv NULL 81and the calling process's effective user ID 82does not match the owner of the file and is not the super-user. 83.It Bq Er EROFS 84The file system containing the file is mounted read-only. 85.El 86.Sh SEE ALSO 87.Xr stat 2 88.Sh HISTORY 89The 90.Nm utimes 91function call appeared in 92.Bx 4.2 . 93