Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ utime(2) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

statx, fstatx, stat, fstat, fullstat, ffullstat, lstat



UTIME(2,L)                  AIX Technical Reference                  UTIME(2,L)



-------------------------------------------------------------------------------
utime



PURPOSE

Sets file access and modification times.

LIBRARY

Berkeley Compatability Library (libbsd.a)

SYNTAX

#include <unistd.h>

int utime (path, times)
char *path;
struct utimbuf *times;

DESCRIPTION

The utime system call sets the access and modification times of the file
pointed to by the path parameter to the value of the times parameter.  The
inode changed time is set to the current time.

If the times parameter is NULL, the access and modification times of the file
are set to the current time.  If the file is a remote file, the current time at
the local node- not the remote node-is used.  The effective user ID of the
process must be the same as the owner of the file or must have write permission
or superuser authority in order to use the utime system call in this manner.

If the times parameter is not NULL, it is a pointer to a utimbuf structure and
the access and modification times are set to the values contained in the
designated structure, regardless of whether or not those times correlate with
the current time.  Only the owner of the file or superuser can use the utime
system call this way.

The utimbuf structure pointed to by the times parameter is defined in the
unistd.h file, and it contains the following members.

      time_t actime;    /* Date and time of last access */
      time_t modtime;   /* Date and time of last modification */

The times in this structure are measured in seconds since 00:00:00 GMT, January
1, 1970.

RETURN VALUE

Upon successful completion, a value of 0 is returned.  If the utime system call
fails, a value of -1 is returned and errno is set to indicate the error.



Processed November 7, 1990        UTIME(2,L)                                  1





UTIME(2,L)                  AIX Technical Reference                  UTIME(2,L)




ERROR CONDITIONS

The utime system call fails if one or more of the following are true:

ENOENT  The named file does not exist.

ENOENT  A hidden directory was named, but no component inside it matched the
        process's current site path list.

ENOENT  A symbolic link was named, but the file to which it refers does not
        exist.

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

EACCES  Search permission is denied by a component of the path prefix.

EPERM   The effective user ID is not superuser or the owner of the file and the
        times parameter is not NULL.

EACCES  The effective user ID is not superuser or the owner of the file, the
        times parameter is NULL, and write access is denied.

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

EFAULT  The times or path parameter points to a location outside of the
        process's allocated address space.

ESTALE  The process's root or current directory is located in an NFS virtual
        file system that has been unmounted.

ENAMETOOLONG
        A component of the path parameter exceeded NAME_MAX characters or the
        entire path parameter exceeded PATH_MAX characters.

ELOOP   A loop of symbolic links was detected.

ETXTBSY The times parameter is NULL and the file is a pure procedure (shared
        text) file that is being executed.

If the Transparent Computing Facility is installed on your system, utime can
also fail if one or more of the following are true:

ESITEDN1  path cannot be accessed because a site went down.

ESITEDN2  The operation was terminated because a site failed.

ENOSTORE  path is a name relative to the working directory, but no site which
          stores this directory is currently up.






Processed November 7, 1990        UTIME(2,L)                                  2





UTIME(2,L)                  AIX Technical Reference                  UTIME(2,L)



ENOSTORE  A component of path is replicated but not stored on any site which is
          currently up.

EROFS     The named file resides on a replicated file system in which the
          primary copy is unavailable.

EINTR     A signal was caught during the system call.

RELATED INFORMATION

In this book:  "statx, fstatx, stat, fstat, fullstat, ffullstat, lstat."












































Processed November 7, 1990        UTIME(2,L)                                  3



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