⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utime.html

📁 posix标准英文,html格式
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>utime</title></head><body bgcolor="white"><basefont size="3"> <a name="utime"></a> <a name="tag_03_806"></a><!-- utime --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_806_01"></a>NAME</h4><blockquote>utime - set file access and modification times</blockquote><h4><a name="tag_03_806_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>#include &lt;<a href="../basedefs/utime.h.html">utime.h</a>&gt;<br><br> int utime(const char *</tt><i>path</i><tt>, const struct utimbuf *</tt><i>times</i><tt>);<br></tt></code></p></blockquote><h4><a name="tag_03_806_03"></a>DESCRIPTION</h4><blockquote><p>The <i>utime</i>() function shall set the access and modification times of the file named by the <i>path</i> argument.</p><p>If <i>times</i> is a null pointer, the access and modification times of the file shall be set to the current time. The effectiveuser ID of the process shall match the owner of the file, or the process has write permission to the file or has appropriateprivileges, to use <i>utime</i>() in this manner.</p><p>If <i>times</i> is not a null pointer, <i>times</i> shall be interpreted as a pointer to a <b>utimbuf</b> structure and theaccess and modification times shall be set to the values contained in the designated structure. Only a process with the effectiveuser ID equal to the user ID of the file or a process with appropriate privileges may use <i>utime</i>() this way.</p><p>The <b>utimbuf</b> structure is defined in the <a href="../basedefs/utime.h.html"><i>&lt;utime.h&gt;</i></a> header. The timesin the structure <b>utimbuf</b> are measured in seconds since the Epoch.</p><p>Upon successful completion, <i>utime</i>() shall mark the time of the last file status change, <i>st_ctime</i>, to be updated;see <a href="../basedefs/sys/stat.h.html"><i>&lt;sys/stat.h&gt;</i></a>.</p></blockquote><h4><a name="tag_03_806_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and <i>errno</i> shall be set to indicate theerror, and the file times shall not be affected.</p></blockquote><h4><a name="tag_03_806_05"></a>ERRORS</h4><blockquote><p>The <i>utime</i>() function shall fail if:</p><dl compact><dt>[EACCES]</dt><dd>Search permission is denied by a component of the path prefix; or the <i>times</i> argument is a null pointer and the effectiveuser ID of the process does not match the owner of the file, the process does not have write permission for the file, and theprocess does not have appropriate privileges.</dd><dt>[ELOOP]</dt><dd>A loop exists in symbolic links encountered during resolution of the <i>path</i> argument.</dd><dt>[ENAMETOOLONG]</dt><dd>The length of the <i>path</i> argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.</dd><dt>[ENOENT]</dt><dd>A component of <i>path</i> does not name an existing file or <i>path</i> is an empty string.</dd><dt>[ENOTDIR]</dt><dd>A component of the path prefix is not a directory.</dd><dt>[EPERM]</dt><dd>The <i>times</i> argument is not a null pointer and the calling process' effective user ID does not match the owner of the fileand the calling process does not have the appropriate privileges.</dd><dt>[EROFS]</dt><dd>The file system containing the file is read-only.</dd></dl><p>The <i>utime</i>() function may fail if:</p><dl compact><dt>[ELOOP]</dt><dd>More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the <i>path</i> argument.</dd><dt>[ENAMETOOLONG]</dt><dd>As a result of encountering a symbolic link in resolution of the <i>path</i> argument, the length of the substituted pathnamestring exceeded {PATH_MAX}.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_806_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_806_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_806_08"></a>RATIONALE</h4><blockquote><p>The <i>actime</i> structure member must be present so that an application may set it, even though an implementation may ignoreit and not change the access time on the file. If an application intends to leave one of the times of a file unchanged whilechanging the other, it should use <a href="../functions/stat.html"><i>stat</i>()</a> to retrieve the file's <i>st_atime</i> and<i>st_mtime</i> parameters, set <i>actime</i> and <i>modtime</i> in the buffer, and change one of them before making the<i>utime</i>() call.</p></blockquote><h4><a name="tag_03_806_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_806_10"></a>SEE ALSO</h4><blockquote><p>The Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/stat.h.html"><i>&lt;sys/stat.h&gt;</i></a>, <a href="../basedefs/utime.h.html"><i>&lt;utime.h&gt;</i></a></p></blockquote><h4><a name="tag_03_806_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 1. Derived from Issue 1 of the SVID.</p></blockquote><h4><a name="tag_03_806_12"></a>Issue 6</h4><blockquote><p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p><ul><li><p>The requirement to include <a href="../basedefs/sys/types.h.html"><i>&lt;sys/types.h&gt;</i></a> has been removed. Although <ahref="../basedefs/sys/types.h.html"><i>&lt;sys/types.h&gt;</i></a> was required for conforming implementations of previous POSIXspecifications, it was not required for UNIX applications.</p></li><li><p>The [ELOOP] mandatory error condition is added.</p></li><li><p>A second [ENAMETOOLONG] is added as an optional error condition.</p></li></ul><p>The following changes were made to align with the IEEE&nbsp;P1003.1a draft standard:</p><ul><li><p>The [ELOOP] optional error condition is added.</p></li></ul><p>The DESCRIPTION is updated to avoid use of the term &quot;must&quot; for application requirements.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -