1*61186Sbostic.\" Copyright (c) 1990, 1993 2*61186Sbostic.\" The Regents of the University of California. All rights reserved. 320147Smckusick.\" 447208Scael.\" %sccs.include.redist.man% 520147Smckusick.\" 6*61186Sbostic.\" @(#)utimes.2 8.1 (Berkeley) 06/04/93 747208Scael.\" 847208Scael.Dd 947208Scael.Dt UTIMES 2 1047208Scael.Os BSD 4 1147208Scael.Sh NAME 1247208Scael.Nm utimes 1347208Scael.Nd set file access and modification times 1447208Scael.Sh SYNOPSIS 1547208Scael.Fd #include <sys/time.h> 1647208Scael.Ft int 1747208Scael.Fn utimes "const char *file" "const struct timeval *times" 1847208Scael.Sh DESCRIPTION 1920147SmckusickThe 2047208Scael.Fn utimes 2147208Scaelfunction sets the access and modification times of the named file from 2247208Scaelthe structures in the argument array 2347208Scael.Fa times . 2447208Scael.Pp 2547208ScaelThe first structure is the access time, and the second is the modification 2647208Scaeltime. 2747208Scael.Pp 2847208ScaelIf the times are specified (the 2947208Scael.Fa times 3047208Scaelargument is 3148344Scael.Pf non- Dv NULL ) 3248344Scaelthe caller must be the owner of the file or be the super-user. 3347208Scael.Pp 3447208ScaelIf the times are not specified (the 3547208Scael.Fa times 3647208Scaelargument is 3747208Scael.Dv NULL ) 3847208Scaelthe caller must be the owner of the file, have permission to 3947208Scaelwrite the file, or be the super-user. 4047208Scael.Sh RETURN VALUES 4120148SmckusickUpon successful completion, a value of 0 is returned. 4247208ScaelOtherwise, a value of -1 is returned and 4347208Scael.Va errno 4420148Smckusickis set to indicate the error. 4547208Scael.Sh ERRORS 4647208Scael.Fn Utimes 4747208Scaelwill fail if: 4847208Scael.Bl -tag -width Er 4947208Scael.It Bq Er EACCES 5047208ScaelSearch permission is denied for a component of the path prefix; 5147208Scaelor the 5247208Scael.Fa times 5347208Scaelargument is 5447208Scael.Dv NULL 5547208Scaeland the effective user ID of the process does not 5647208Scaelmatch the owner of the file, and is not the super-user, and write 5747208Scaelaccess is denied. 5847208Scael.It Bq Er EFAULT 5947208Scael.Xr File 6047208Scaelor 6147208Scael.Fa times 6247208Scaelpoints outside the process's allocated address space. 6347208Scael.It Bq Er EINVAL 6421004SmckusickThe pathname contains a character with the high-order bit set. 6547208Scael.It Bq Er EIO 6647208ScaelAn I/O error occurred while reading or writing the affected inode. 6747208Scael.It Bq Er ELOOP 6847208ScaelToo many symbolic links were encountered in translating the pathname. 6947208Scael.It Bq Er ENAMETOOLONG 7021004SmckusickA component of a pathname exceeded 255 characters, 7121004Smckusickor an entire path name exceeded 1023 characters. 7247208Scael.It Bq Er ENOENT 7320148SmckusickThe named file does not exist. 7447208Scael.It Bq Er ENOTDIR 7547208ScaelA component of the path prefix is not a directory. 7647208Scael.It Bq Er EPERM 7747208ScaelThe 7847208Scael.Fa times 7947208Scaelargument is not 8047208Scael.Dv NULL 8147208Scaeland the calling process's effective user ID 8247208Scaeldoes not match the owner of the file and is not the super-user. 8347208Scael.It Bq Er EROFS 8420148SmckusickThe file system containing the file is mounted read-only. 8547208Scael.El 8647208Scael.Sh SEE ALSO 8747208Scael.Xr stat 2 8847208Scael.Sh HISTORY 8947208ScaelThe 9059636Sbostic.Nm utimes 9147208Scaelfunction call appeared in 9247208Scael.Bx 4.2 . 93