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

📄 syscalls_4.html

📁 Linux系统调用
💻 HTML
字号:
<!-- This HTML file has been created by texi2html 1.29
     from syscalls.texi on 4 June 1994 -->

<TITLE>Syscall specifications of Linux - access</TITLE>
<P>Go to the <A HREF="syscalls_3.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_3.html">previous</A>, <A HREF="syscalls_5.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_5.html">next</A> section.<P>
<H2><A NAME="SEC4" HREF="syscalls_toc.html#SEC4" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_toc.html#SEC4">access</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int access(const char *<VAR>pathname</VAR>, int <VAR>mode</VAR>);</CODE>
<P>
<H3>PARAMETERS</H3>
<P>
<VAR>pathname</VAR>: [in] the path of the file to test.
<P>
<VAR>mode</VAR>: [in] indicates what the task wants to test.
<P>
<H3>DESCRIPTION</H3>
<P>
Checks whether the calling task has the necessary access rights to
perform operations specified by <VAR>mode</VAR> on the file <VAR>pathname</VAR>.
<VAR>mode</VAR> is a mask consisting of one or more of the values
<CODE>R_OK</CODE>, <CODE>W_OK</CODE>, <CODE>X_OK</CODE> and <CODE>F_OK</CODE> which respectively
test if the taks can read, write, execute or test if the file exists.
The test is performed using the <STRONG>real uid and gid</STRONG> of the calling
task. Only the access bits of the file are tested.  
<P>
<STRONG>Note</STRONG>: only the final component of the path is checked using the
real uid and gid. All the other components of the path are checked using
the <STRONG>effective</STRONG> uid and gid.
<P>
<H3>RETURN VALUE</H3>
<P>
On success, zero is returned. On error, -1 is returned and <CODE>errno</CODE> is set
to one of the following values:
<P>
<UL>
<LI><CODE>EINVAL</CODE>: <VAR>mode</VAR> is not a valid value.
<LI><CODE>EACCESS</CODE>, <CODE>EFAULT</CODE>, <CODE>ENOENT</CODE>, <CODE>ENOTDIR</CODE>,
<CODE>ENOMEM</CODE>, <CODE>ENAMETOOLONG</CODE> or <CODE>ELOOP</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_3.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_3.html">previous</A>, <A HREF="syscalls_5.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_5.html">next</A> section.<P>

⌨️ 快捷键说明

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