2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
5 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
6 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH UTIME 2 "Sep 1, 2009"
9 utime \- set file access and modification times
13 #include <sys/types.h>
16 \fBint\fR \fButime\fR(\fBconst char *\fR\fIpath\fR, \fBconst struct utimbuf *\fR\fItimes\fR);
22 The \fButime()\fR function sets the access and modification times of the file
23 pointed to by \fIpath\fR, and causes the time of the last file status change
24 (\fBst_ctime\fR) to be updated.
27 If \fItimes\fR is \fINULL\fR, the access and modification times of the file are
28 set to the current time. A process must be the owner of the file or have write
29 permission to use \fButime()\fR in this manner.
32 If \fItimes\fR is not \fINULL\fR, \fItimes\fR is interpreted as a pointer to a
33 \fButimbuf\fR structure (defined in <\fButime.h\fR>) and the access and
34 modification times are set to the values contained in the designated structure.
35 Only the owner of the file or a process that has the {\fBPRIV_FILE_OWNER\fR}
36 privilege asserted in its effective set can use \fButime()\fR in this manner.
39 The \fButimbuf\fR structure contains the following members:
43 time_t actime; /* access time */
44 time_t modtime; /* modification time */
50 The times contained in the members of the \fButimbuf\fR structure are measured
51 in seconds since 00:00:00 UTC, January 1, 1970.
55 Upon successful completion, 0 is returned. Otherwise, \(mi1 is returned and
56 \fBerrno\fR is set to indicate the error.
60 The \fButime()\fR function will fail if:
67 Search permission is denied by a component of the \fIpath\fR prefix.
76 The process does not have appropriate privileges and is not the owner of the
77 file, write permission is denied for the file, and \fItimes\fR is \fINULL\fR.
86 The \fIpath\fR argument points to an illegal address.
95 A signal was caught during the execution of the \fButime()\fR function.
104 An I/O error occurred while reading from or writing to the file system.
113 Too many symbolic links were encountered in translating \fIpath\fR.
119 \fB\fBENAMETOOLONG\fR\fR
122 The length of the \fIpath\fR argument exceeds \fIPATH_MAX\fR, or the length of
123 a \fIpath\fR component exceeds \fINAME_MAX\fR while \fB_POSIX_NO_TRUNC\fR is in
133 The named file does not exist or is a null pathname.
142 The \fIpath\fR argument points to a remote machine and the link to that machine
152 A component of the \fIpath\fR prefix is not a directory.
161 The effective user of the calling process is not the owner of the file,
162 {\fBPRIV_FILE_OWNER\fR} is not asserted in the effective set of the calling
163 process, and \fItimes\fR is not \fINULL\fR.
172 The file system containing the file is mounted read-only.
178 See \fBattributes\fR(5) for descriptions of the following attributes:
186 ATTRIBUTE TYPE ATTRIBUTE VALUE
188 Interface Stability Committed
190 MT-Level Async-Signal-Safe
192 Standard See \fBstandards\fR(5).
198 \fBfutimens\fR(2), \fBstat\fR(2), \fButimes\fR(2), \fBattributes\fR(5),
199 \fBprivileges\fR(5), \fBstandards\fR(5)