1UTIME(3P)                  POSIX Programmer's Manual                 UTIME(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       utime - set file access and modification times
13

SYNOPSIS

15       #include <utime.h>
16
17       int utime(const char *path, const struct utimbuf *times);
18
19

DESCRIPTION

21       The utime() function shall set the access and modification times of the
22       file named by the path argument.
23
24       If  times  is  a null pointer, the access and modification times of the
25       file shall be set to the current time. The effective  user  ID  of  the
26       process  shall  match  the  owner of the file, or the process has write
27       permission to the file or has appropriate privileges, to use utime() in
28       this manner.
29
30       If times is not a null pointer, times shall be interpreted as a pointer
31       to a utimbuf structure and the access and modification times  shall  be
32       set to the values contained in the designated structure. Only a process
33       with the effective user ID equal to the  user  ID  of  the  file  or  a
34       process with appropriate privileges may use utime() this way.
35
36       The utimbuf structure is defined in the <utime.h> header.  The times in
37       the structure utimbuf are measured in seconds since the Epoch.
38
39       Upon successful completion, utime() shall mark the  time  of  the  last
40       file status change, st_ctime, to be updated; see <sys/stat.h>.
41

RETURN VALUE

43       Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
44       returned and errno shall be set to indicate the  error,  and  the  file
45       times shall not be affected.
46

ERRORS

48       The utime() function shall fail if:
49
50       EACCES Search  permission  is denied by a component of the path prefix;
51              or the times argument is a null pointer and the  effective  user
52              ID  of  the  process  does  not match the owner of the file, the
53              process does not have write permission for  the  file,  and  the
54              process does not have appropriate privileges.
55
56       ELOOP  A loop exists in symbolic links encountered during resolution of
57              the path argument.
58
59       ENAMETOOLONG
60              The length of the path argument exceeds {PATH_MAX} or a pathname
61              component is longer than {NAME_MAX}.
62
63       ENOENT A component of path does not name an existing file or path is an
64              empty string.
65
66       ENOTDIR
67              A component of the path prefix is not a directory.
68
69       EPERM  The times argument  is  not  a  null  pointer  and  the  calling
70              process'  effective user ID does not match the owner of the file
71              and the calling process does not  have  the  appropriate  priviā€
72              leges.
73
74       EROFS  The file system containing the file is read-only.
75
76
77       The utime() function may fail if:
78
79       ELOOP  More  than  {SYMLOOP_MAX} symbolic links were encountered during
80              resolution of the path argument.
81
82       ENAMETOOLONG
83              As a result of encountering a symbolic link in resolution of the
84              path  argument,  the  length  of the substituted pathname string
85              exceeded {PATH_MAX}.
86
87
88       The following sections are informative.
89

EXAMPLES

91       None.
92

APPLICATION USAGE

94       None.
95

RATIONALE

97       The actime structure member must be present so that an application  may
98       set  it, even though an implementation may ignore it and not change the
99       access time on the file. If an application intends to leave one of  the
100       times  of  a  file  unchanged  while  changing the other, it should use
101       stat() to retrieve the file's st_atime  and  st_mtime  parameters,  set
102       actime  and modtime in the buffer, and change one of them before making
103       the utime() call.
104

FUTURE DIRECTIONS

106       None.
107

SEE ALSO

109       The Base  Definitions  volume  of  IEEE Std 1003.1-2001,  <sys/stat.h>,
110       <utime.h>
111
113       Portions  of  this text are reprinted and reproduced in electronic form
114       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
115       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
116       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
117       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
118       event of any discrepancy between this version and the original IEEE and
119       The  Open Group Standard, the original IEEE and The Open Group Standard
120       is the referee document. The original Standard can be  obtained  online
121       at http://www.opengroup.org/unix/online.html .
122
123
124
125IEEE/The Open Group                  2003                            UTIME(3P)
Impressum