futimens man page on Solaris

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
Solaris logo
[printable version]

futimens(2)			 System Calls			   futimens(2)

NAME
       futimens, utimensat - set file access and modification times

SYNOPSIS
       #include <sys/stat.h>

       int futimens(int fd, const struct timespec times[2]);

       int utimensat(int fd, const char *path,
	    const struct timespec times[2], int flag);

DESCRIPTION
       The  futimens()	and utimensat() functions set the access and modifica‐
       tion times of a file to the values of the  times	 argument.  The	 futi‐
       mens()  function changes the times of the file associated with the file
       descriptor fd. The utimensat() function changes the times of  the  file
       pointed	to  by the path argument, relative to the directory associated
       with the file descriptor fd. Both functions allow  time	specifications
       accurate to the nanosecond.

       The  times  argument  is an array of two timespec structures. The first
       array member represents the date and time of last access, and the  sec‐
       ond member represents the date and time of last modification. The times
       in the timespec structure are measured in seconds and nanoseconds since
       the  Epoch.  The file's relevant timestamp is set to the greatest value
       supported by the file system that is not	 greater  than	the  specified
       time.

       If  the	tv_nsec	 field	of  a timespec structure has the special value
       UTIME_NOW, the file's relevant timestamp is set to the  greatest	 value
       supported by the file system that is not greater than the current time.
       If the tv_nsec field has the special value UTIME_OMIT, the file's rele‐
       vant  timestamp	is  not	 changed.  In either case, the tv_sec field is
       ignored.

       If the times argument is a null pointer, both the access and  modifica‐
       tion  timestamps	 are  set  to the greatest value supported by the file
       system that is not greater than the current  time.  If  utimensat()  is
       passed  a  relative  path  in the path argument, the file to be used is
       relative to the	directory  associated  with  the  file	descriptor  fd
       instead of the current working directory.

       If  utimensat()	is passed the special value AT_FDCWD in the fd parame‐
       ter, the current working directory is used.

       Only a process with the effective user ID equal to the user ID  of  the
       file,  or with write access to the file, or with appropriate privileges
       may use futimens() or utimensat() with a	 null  pointer	as  the	 times
       argument	 or  with  both	 tv_nsec  fields  set  to  the	special	 value
       UTIME_NOW. Only a process with the effective user ID equal to the  user
       ID  of  the  file  or with appropriate privileges may use futimens() or
       utimensat() with a non-null times argument  that	 does  not  have  both
       tv_nsec	fields	set to UTIME_NOW and does not have both tv_nsec fields
       set to UTIME_OMIT. If both tv_nsec fields are  set  to  UTIME_OMIT,  no
       ownership  or  permissions  check  is performed for the file, but other
       error conditions are still detected (including EACCES errors related to
       the path prefix).

       Values  for  the flag argument of utimensat() are constructed by a bit‐
       wise-inclusive  OR  of  flags  from  the	 following  list,  defined  in
       <fcntl.h>:

       AT_SYMLINK_NOFOLLOW

	   If  path  names  a  symbolic link, then the access and modification
	   times of the symbolic link are changed.

       Upon completion, futimens() and utimensat() mark the last  file	status
       change timestamp for update.

RETURN VALUES
       Upon  successful completion, these functions return 0. Otherwise, these
       functions return -1 and set errno to  indicate  the  error.  If	-1  is
       returned, the file times are not affected.

ERRORS
       The futimens() and utimensat() functions will fail if:

       EACCES	 The  times argument is a null pointer, or both tv_nsec values
		 are UTIME_NOW, and the effective user ID of the process  does
		 not match the owner of the file and write access is denied.

       EINVAL	 Either	 of  the times argument structures specified a tv_nsec
		 value that was neither UTIME_NOW nor UTIME_OMIT,  and	was  a
		 value	less  than  zero or greater than or equal to 1000 mil‐
		 lion.

		 A new file timestamp would be a value whose tv_sec  component
		 is not a value supported by the file system.

       EPERM	 The  times argument is not a null pointer, does not have both
		 tv_nsec fields set to UTIME_NOW, does not have	 both  tv_nsec
		 fields set to UTIME_OMIT, the calling process' effective user
		 ID has write access to the file but does not match the	 owner
		 of  the file, and the calling process does not have appropri‐
		 ate privileges.

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

       The futimens() function will fail if:

       EBADF	The fd argument is not a valid file descriptor.

       The utimensat() function will fail if:

       EACCES	       The permissions of the directory underlying fd  do  not
		       permit directory searches.

       EBADF	       The path argument does not specify an absolute path and
		       the fd argument is neither AT_FDCWD nor	a  valid  file
		       descriptor open for reading.

       ENOTDIR	       The  path  argument  is	not an absolute path and fd is
		       neither AT_FDCWD nor a file descriptor associated  with
		       a directory.

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

       ELOOP	       Too many symbolic links were encountered during resolu‐
		       tion of the path argument.

       ENAMETOOLONG    The length of the path argument exceeds {PATH_MAX} or a
		       pathname component is longer than {NAME_MAX}.

       ENOENT	       A component of path does not name an existing  file  or
		       path is an empty string.

       ENOTDIR	       A  component  of the path prefix is not a directory, or
		       the path argument contains at least one character  that
		       is  not	a slash (/) and ends with one or more trailing
		       slash characters and the last pathname component	 names
		       an existing file that is neither a directory nor a sym‐
		       bolic link to a directory.

       The utimensat() function will fail if:

       ENAMETOOLONG    Path name resolution of a  symbolic  link  produced  an
		       intermediate   result   with   a	 length	 that  exceeds
		       {PATH_MAX}.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌─────────────────────────────┬─────────────────────────────┐
       │      ATTRIBUTE TYPE	     │	    ATTRIBUTE VALUE	   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Interface Stability	     │Committed			   │
       ├─────────────────────────────┼─────────────────────────────┤
       │MT-Level		     │Async-Signal-Safe		   │
       └─────────────────────────────┴─────────────────────────────┘

SEE ALSO
       stat(2), utime(2), utimes(2), attributes(5), fsattr(5)

SunOS 5.10			  1 Sep 2009			   futimens(2)
[top]

List of man pages available for Solaris

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net