1utime(2)                         System Calls                         utime(2)
2
3
4

NAME

6       utime - set file access and modification times
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <utime.h>
11
12       int utime(const char *path, const struct utimbuf *times);
13
14

DESCRIPTION

16       The utime() function sets the access and modification times of the file
17       pointed to by path,  and causes the time of the last file status change
18       (st_ctime) to be updated.
19
20
21       If times is NULL, the access and modification times of the file are set
22       to the current time. A process must be the owner of the  file  or  have
23       write permission to use utime() in this manner.
24
25
26       If  times  is  not NULL, times is interpreted as a pointer to a utimbuf
27       structure (defined in <utime.h>) and the access and modification  times
28       are  set  to the values contained in the designated structure. Only the
29       owner of the file or a process that has the {PRIV_FILE_OWNER} privilege
30       asserted in its effective set can use utime() in this manner.
31
32
33       The utimbuf structure contains the following members:
34
35         time_t   actime;    /* access time */
36         time_t   modtime;   /* modification time */
37
38
39
40       The  times  contained  in the members of the utimbuf structure are mea‐
41       sured in seconds since 00:00:00 UTC, January 1, 1970.
42

RETURN VALUES

44       Upon successful completion, 0 is returned. Otherwise,  −1  is  returned
45       and errno is set to indicate the error.
46

ERRORS

48       The utime() function will fail if:
49
50       EACCES          Search  permission is denied by a component of the path
51                       prefix.
52
53
54       EACCES          The process does not have appropriate privileges and is
55                       not  the  owner of the file, write permission is denied
56                       for the file, and times is NULL.
57
58
59       EFAULT          The path argument points to an illegal address.
60
61
62       EINTR           A signal was caught during the execution of the utime()
63                       function.
64
65
66       EIO             An  I/O error occurred while reading from or writing to
67                       the file system.
68
69
70       ELOOP           Too many symbolic links were encountered in translating
71                       path.
72
73
74       ENAMETOOLONG    The  length  of  the path argument exceeds PATH_MAX, or
75                       the length of a path component exceeds  NAME_MAX  while
76                       _POSIX_NO_TRUNC is in effect.
77
78
79       ENOENT          The named file does not exist or is a null pathname.
80
81
82       ENOLINK         The  path  argument  points to a remote machine and the
83                       link to that machine is no longer active.
84
85
86       ENOTDIR         A component of the path prefix is not a directory.
87
88
89       EPERM           The effective user of the calling process  is  not  the
90                       owner of the file, {PRIV_FILE_OWNER} is not asserted in
91                       the effective set of the calling process, and times  is
92                       not NULL.
93
94
95       EROFS           The  file  system  containing the file is mounted read-
96                       only.
97
98

ATTRIBUTES

100       See attributes(5) for descriptions of the following attributes:
101
102
103
104
105       ┌─────────────────────────────┬─────────────────────────────┐
106       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
107       ├─────────────────────────────┼─────────────────────────────┤
108       │Interface Stability          │Committed                    │
109       ├─────────────────────────────┼─────────────────────────────┤
110       │MT-Level                     │Async-Signal-Safe            │
111       ├─────────────────────────────┼─────────────────────────────┤
112       │Standard                     │See standards(5).            │
113       └─────────────────────────────┴─────────────────────────────┘
114

SEE ALSO

116       futimens(2), stat(2), utimes(2),  attributes(5),  privileges(5),  stan‐
117       dards(5)
118
119
120
121SunOS 5.11                        1 Sep 2009                          utime(2)
Impressum