1 | .\" Copyright (c) 1980 Regents of the University of California.
|
---|
2 | .\" All rights reserved. The Berkeley software License Agreement
|
---|
3 | .\" specifies the terms and conditions for redistribution.
|
---|
4 | .\"
|
---|
5 | .\" @(#)utimes.2 6.4 (Berkeley) 8/26/85
|
---|
6 | .\"
|
---|
7 | .TH UTIME 2 "August 26, 1985"
|
---|
8 | .UC 4
|
---|
9 | .SH NAME
|
---|
10 | utime \- set file times
|
---|
11 | .SH SYNOPSIS
|
---|
12 | .nf
|
---|
13 | .ft B
|
---|
14 | #include <sys/types.h>
|
---|
15 | #include <utime.h>
|
---|
16 |
|
---|
17 | int utime(const char *\fIfile\fP, struct utimbuf *\fItimes\fP)
|
---|
18 | .fi
|
---|
19 | .SH DESCRIPTION
|
---|
20 | The
|
---|
21 | .B utime
|
---|
22 | call
|
---|
23 | uses the
|
---|
24 | \*(lqaccessed\*(rq and \*(lqupdated\*(rq times
|
---|
25 | from the utimbuf structure pointed to by
|
---|
26 | .I times
|
---|
27 | to set the corresponding recorded times for
|
---|
28 | .I file.
|
---|
29 | .PP
|
---|
30 | Struct utimbuf is defined in <utime.h> as follows:
|
---|
31 | .PP
|
---|
32 | .RS
|
---|
33 | .nf
|
---|
34 | .ta +0.4i +0.8i +1.0i
|
---|
35 | struct utimbuf {
|
---|
36 | time_t actime; /* access time */
|
---|
37 | time_t modtime; /* modification time */
|
---|
38 | };
|
---|
39 | .fi
|
---|
40 | .RE
|
---|
41 | .PP
|
---|
42 | The caller must be the owner of the file or the super-user.
|
---|
43 | The \*(lqinode-changed\*(rq time of the file is set to the current time.
|
---|
44 | .SH "RETURN VALUE
|
---|
45 | Upon successful completion, a value of 0 is returned.
|
---|
46 | Otherwise, a value of \-1 is returned and
|
---|
47 | .B errno
|
---|
48 | is set to indicate the error.
|
---|
49 | .SH "ERRORS
|
---|
50 | .B Utime
|
---|
51 | will fail if one or more of the following are true:
|
---|
52 | .TP 15
|
---|
53 | [ENOTDIR]
|
---|
54 | A component of the path prefix is not a directory.
|
---|
55 | .TP 15
|
---|
56 | [EINVAL]
|
---|
57 | The pathname contains a character with the high-order bit set.
|
---|
58 | .TP 15
|
---|
59 | [ENAMETOOLONG]
|
---|
60 | The path name exceeds PATH_MAX characters.
|
---|
61 | .TP 15
|
---|
62 | [ENOENT]
|
---|
63 | The named file does not exist.
|
---|
64 | .TP 15
|
---|
65 | [ELOOP]
|
---|
66 | Too many symbolic links were encountered in translating the pathname.
|
---|
67 | (Minix-vmd)
|
---|
68 | .TP 15
|
---|
69 | [EPERM]
|
---|
70 | The process is not super-user and not the owner of the file.
|
---|
71 | .TP 15
|
---|
72 | [EACCES]
|
---|
73 | Search permission is denied for a component of the path prefix.
|
---|
74 | .TP 15
|
---|
75 | [EROFS]
|
---|
76 | The file system containing the file is mounted read-only.
|
---|
77 | .TP 15
|
---|
78 | [EFAULT]
|
---|
79 | .I File
|
---|
80 | or \fItimes\fP points outside the process's allocated address space.
|
---|
81 | .TP 15
|
---|
82 | [EIO]
|
---|
83 | An I/O error occurred while reading or writing the affected inode.
|
---|
84 | .SH SEE ALSO
|
---|
85 | .BR stat (2).
|
---|