Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ utime(3C) — SunOS 4.0.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stat(2)

utimes(2)

UTIME(3C)  —  COMPATIBILITY FUNCTIONS

NAME

utime − set file times

SYNOPSIS

#include <sys/types.h>

int utime(file, timep)
char ∗file;
time_t ∗timep;

DESCRIPTION

utime() sets the access and modification times of the file named by file.

If the timep argument is NULL, the access and modification times are set to the current time.  A process must be the owner of the file or have write permission for the file to use utime() in this manner. 

If the timep argument is not NULL, it is assumed to point to an array of two time_t values.  The access time is set to the value of the first member, and the modification time is set to the value of the second member.  The times contained in that array are measured in seconds since 00:00:00 GMT Jan 1, 1970.  Only the owner of the file or the super-user may use utime() in this manner. 

In either case, the “inode-changed” time of the file is set to the current time. 

RETURN VALUE

Upon successful completion a value of 0 is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

ERRORS

utime() will fail if one or more of the following are true:

ENOTDIR A component of the path prefix of file is not a directory. 

ENAMETOOLONG The length of a component of file exceeds 255 characters, or the length of file exceeds 1023 characters. 

ENOENT The file referred to by file does not exist. 

EACCESS Search permission is denied for a component of the path prefix of file.

ELOOP Too many symbolic links were encountered in translating file.

EPERM The effective user ID of the process is not super-user and not the owner of the file, and timep is not NULL. 

EACCESS The effective user ID is not super-user and not the owner of the file, write permission is denied for the file, and timep is NULL. 

EIO An I/O error occurred while reading from or writing to the file system. 

EROFS The file system containing the file is mounted read-only. 

EFAULT file or timep points outside the process’s allocated address space. 

SEE ALSO

stat(2), utimes(2)

Sun Release 4.0  —  Last change: 22 November 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026