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

📄 0741-0743.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Complete Command Reference:System Calls:EarthWeb Inc.-</TITLE>

</HEAD>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311046 //-->

<!-- TITLE=Linux Complete Command Reference//-->

<!-- AUTHOR=Red Hat//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=02 //-->

<!-- PAGES=0737-0890 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->



<P><CENTER>

<a href="0737-0740.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0744-0746.html">Next</A></CENTER></P>







<A NAME="PAGENUM-741"><P>Page 741</P></A>





<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

bind(2), connect(2), listen(2), select(2), socket(2)

</PRE>

<!-- END CODE SNIP //-->

<PRE>

BSD Man Page, 24 July 1993

</PRE>

<!-- END CODE SNIP //-->



<H3><A NAME="ch02_ 5">

access

</A></H3>



<P>access&#151;Checks user's permissions for a file

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

#include &lt;unistd.h&gt;

int access(const char *pathname,intmode);

</PRE>

<!-- END CODE SNIP //-->



<P><B>

DESCRIPTION

</B></P>



<P>access checks whether the process would be allowed to read, write, or test for existence of the file (or other file system

object) whose name is pathname. If pathname is a symbolic link, permissions of the file referred by this symbolic link are tested.

</P>



<P>mode is a mask consisting of one or more of

R_OK, W_OK, X_OK, and F_OK.

</P>



<P>R_OK, W_OK, and X_OK request checking whether the file exists and has read, write, and execute permissions, respectively.

F_OK just requests checking for the existence of the file.

</P>



<P>The tests depend on the permissions of the directories occurring in the path to the file, as given in

pathname, and on the permissions of directories and files referred by symbolic links encountered on the way.

</P>



<P>The check is done with the process's real UID and GID, rather than with the effective IDs as is done when

actually attempting an operation. This is to allow set-UID programs to easily determine the invoking user's authority.

</P>



<P>Only access bits are checked, not the file type or contents. Therefore, if a directory is found to be &quot;writable,&quot; it

probably means that files can be created in the directory, and not that the directory can be written as a file. Similarly, a DOS file

may be found to be &quot;executable,&quot; but the

execve(2) call will still fail.

</P>



<P><B>

RETURN VALUE

</B></P>



<P>On success (all requested permissions granted),

0 is returned. On error (at least 1 bit in mode asked for a permission that

is denied, or some other error occurred), _1 is returned and

errno is set appropriately.

</P>



<P><B>

ERRORS

</B></P>



<TABLE>



<TR><TD>

EACCES

</TD><TD>

The requested access would be denied, either to the file itself or one of the directories

in pathname.

</TD></TR><TR><TD>

EFAULT

</TD><TD>

pathname points outside your accessible address space.

</TD></TR><TR><TD>

EINVAL

</TD><TD>

mode was incorrectly specified.

</TD></TR><TR><TD>

ENAMETOOLONG

</TD><TD>

pathname is too long.

</TD></TR><TR><TD>

ENOENT

</TD><TD>

A directory component in pathname would have been accessible but does not exist or was

a dangling symbolic link.

</TD></TR><TR><TD>

ENOTDIR

</TD><TD>

A component used as a directory in pathname

is not, in fact, a directory.

</TD></TR><TR><TD>

ENOMEM

</TD><TD>

Insufficient kernel memory was available.

</TD></TR><TR><TD>

ELOOP

</TD><TD>

pathname contains a reference to a circular symbolic link, that is, a symbolic link

containing a reference to itself.

</TD></TR></TABLE>



<P><B>

RESTRICTIONS

</B></P>



<P>access returns an error if any of the access types in the requested call fails, even if other types might be successful.

access may not work correctly on NFS file systems with UID mapping enabled because UID mapping is done on the server and

hidden from the client, which checks permissions.

</P>



<A NAME="PAGENUM-742"><P>Page 742</P></A>





<P><B>

CONFORMS TO

</B></P>



<!-- CODE SNIP //-->

<PRE>

SVID, AT&amp;T, POSIX, X/OPEN, BSD 4.3

</PRE>

<!-- END CODE SNIP //-->



<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

stat(2), open(2), chmod(2), chown(2), setuid(2), setgid(2)

</PRE>

<!-- END CODE SNIP //-->



<P>Linux 1.2.13, 17 March 1996

</P>



<H3><A NAME="ch02_ 6">

acct

</A></H3>



<P>acct&#151;Switches process accounting on or off

</P>





<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

#include &lt;unistd.h&gt;

int acct(const char *filename);

</PRE>

<!-- END CODE SNIP //-->



<P><B>

DESCRIPTION

</B></P>



<P>Warning: Since this function is not implemented as of Linux 0.99.11, it will always return

_1 and set errno to ENOSYS. If acctkit is installed, the function performs as advertised.

</P>



<P>When called with the name of an existing file as argument, accounting is turned on and records for each terminating

process are appended to filename as it terminates. An argument of

NULL causes accounting to be turned off.

</P>



<P><B>

RETURN VALUE

</B></P>



<P>On success, 0 is returned. On error, _1 is returned and

errno is set appropriately.

</P>



<P><B>

NOTES

</B></P>



<P>No accounting is produced for programs running when a crash occurs. In particular, nonterminating processes are

never accounted for.

</P>



<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

acct(5)

</PRE>

<!-- END CODE SNIP //-->



<P>Linux 0.99.11, 10 August 1993

</P>





<H3><A NAME="ch02_ 7">

adjtimex

</A></H3>



<P>adjtimex&#151;Tunes kernel clock

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

#include &lt;sys/timex.h&gt;

int adjtimex(struct timex *buf);

</PRE>

<!-- END CODE SNIP //-->



<P><B>

DESCRIPTION

</B></P>



<P>Linux uses David Mill's clock adjustment algorithm.

adjtimex reads and optionally sets adjustment parameters for

this algorithm.

</P>



<P>adjtimex takes a pointer to a timex structure, updates kernel parameters from field values, and returns the same structure

with current kernel values. This structure is declared as follows:

</P>



<A NAME="PAGENUM-743"><P>Page 743</P></A>





<!-- CODE //-->

<PRE>

struct timex

              {

                  int mode;            /* mode selector */

                  long offset;         /* time offset (usec) */

                  long frequency;      /* frequency offset (scaled ppm) */

                  long maxerror;       /* maximum error (usec) */

                  long esterror;       /* estimated error (usec) */

                  int status;          /* clock command/status */

                  long time_constant;  /* pll time constant */

                  long precision;      /* clock precision (usec) (read only) */

                  long tolerance;      /* clock frequency tolerance (ppm)

                                          (read only) */

                  struct timeval time; /* (read only) */

                  long tick;           /* usecs between clock ticks */

              };

</PRE>

<!-- END CODE //-->



<P>The mode field determines which parameters, if any, to set. It may contain a

bitwise-or combination of zero or more of the following bits:

</P>



<!-- CODE //-->

<PRE>

#define ADJ_OFFSET            0x0001 /* time offset */

              #define ADJ_FREQUENCY         0x0002 /* frequency offset */

              #define ADJ_MAXERROR          0x0004 /* maximum time error */

              #define ADJ_ESTERROR          0x0008 /* estimated time error */

              #define ADJ_STATUS            0x0010 /* clock status */

              #define ADJ_TIMECONST         0x0020 /* pll time constant */

              #define ADJ_TICK              0x4000 /* tick value */

              #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */

</PRE>

<!-- END CODE //-->



<P>Ordinary users are restricted to a 0 value for

mode. Only the superuser may set any parameters.

</P>



<P><B>

RETURN VALUE

</B></P>



<P>On success, adjtimex returns the value of

buf.status:

</P>



<!-- CODE //-->

<PRE>

#define TIME OK 0 /* clock synchronized */

#define TIME INS 1 /* insert leap second */

#define TIME DEL 2 /* delete leap second */

#define TIME OOP 3 /* leap second in progress */

#define TIME BAD 4 /* clock not synchronized */

</PRE>

<!-- END CODE //-->



<P>On failure, adjtimex returns _1 and sets errno.

</P>



<P><B>

ERRORS

</B></P>



<TABLE>



<TR><TD>

EFAULT

</TD><TD>

buf does not point to writable memory.

</TD></TR><TR><TD>

EPERM

</TD><TD>

buf.mode is nonzero and the user is not superuser.

</TD></TR><TR><TD>

EINVAL

</TD><TD>

An attempt is made to set buf.offset to a value outside the range -131071 to +131071,

or to set buf.status to a value other than those listed above, or to set

buf.tick to a value outside the range 900000/HZ to

1100000/HZ,where HZ is the system timer interrupt frequency.

</TD></TR></TABLE>



<P><B>

SEE ALSO

</B></P>



<P>settimeofday(2)

</P>



<!-- CODE SNIP //-->

<PRE>

Linux 1.2.4, 15 April 1995

</PRE>

<!-- END CODE SNIP //-->







<P><CENTER>

<a href="0737-0740.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0744-0746.html">Next</A></CENTER></P>







</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

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