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

📄 0747-0750.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="0744-0746.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0751-0753.html">Next</A></CENTER></P>







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





<!-- CODE SNIP //-->

<PRE>

#include &lt;asm/cachectl.h&gt;

int cacheflush(char *addr,intnbytes,intcache);

</PRE>

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



<P><B>

DESCRIPTION

</B></P>



<P>cacheflush flushes contents of indicated cache(s) for user addresses in the range

addr to (addr+nbytes-1). The cache may be one of the following:

</P>



<TABLE>



<TR><TD>

ICACHE

</TD><TD>

Flush the instruction cache.

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

DCACHE

</TD><TD>

Write back to memory and invalidate the affected valid cache lines.

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

BCACHE

</TD><TD>

Same as (ICACHE|DCACHE).

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



<P><B>

RETURN VALUE

</B></P>



<P>cacheflush returns 0 on success or -1 on error. If errors are detected,

errno will indicate the error.

</P>



<P><B>

ERRORS

</B></P>



<TABLE>



<TR><TD>

EINVAL

</TD><TD>

The cache parameter is not one of

ICACHE, DCACHE, or BCACHE.

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

EFAULT

</TD><TD>

Some or all of the address range addr to

(addr+nbytes-1) is not accessible.

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



<P><B>

BUGS

</B></P>



<P>The current implementation ignores the addr and

nbytes parameters. Therefore, the whole cache is always flushed.

</P>



<P><B>

NOTE

</B></P>



<P>This system call is only available on MIPS-based systems.

</P>



<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

cachectl(2)

</PRE>

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



<P>

Linux, 27 June 95

</P>





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

chdir, fchdir

</A></H3>



<P>chdir, fchdir&#151;Changes the working directory

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

#include &lt;unistd.h&gt;

int chdir(const char *path);

int fchdir(int fd);

</PRE>

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



<P><B>

DESCRIPTION

</B></P>



<P>chdir changes the current directory to that specified in

path.

</P>



<P>fchdir is identical to chdir, only the directory is given as an open file descriptor.

</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>

ERRORS

</B></P>



<P>Depending on the file system, other errors can be returned. The more general errors are listed here:

</P>



<TABLE>



<TR><TD>

EPERM

</TD><TD>

The process does not have execute permission on the directory.

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

EFAULT

</TD><TD>

path points outside your accessible address space.

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

ENAMETOOLONG

</TD><TD>

path is too long.

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





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



<TABLE>



<TR><TD>

EBADF

</TD><TD>

fd is not a valid file descriptor.

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

ENOENT

</TD><TD>

The file does not exist.

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

ENOMEM

</TD><TD>

Insufficient kernel memory was available.

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

ENOTDIR

</TD><TD>

A component of the path prefix is not a directory.

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

EACCES

</TD><TD>

Search permission is denied on a component of the path prefix.

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

ELOOP

</TD><TD>

path contains a circular reference (that is, via a symbolic link)

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



<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

getcwd(3), chroot(2)

</PRE>

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



<P>Linux 1.2.4, 15 April 1995

</P>



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

chmod, fchmod

</A></H3>



<P>chmod, fchmod&#151;Changes permissions of a file

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

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

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

int chmod(const char *path,modetmode);

int fchmod(int fildes,modetmode);

</PRE>

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





<P><B>

DESCRIPTION

</B></P>



<P>The mode of the file given by path or referenced by

filedes is changed.

</P>



<P>Modes are specified by oring the following:

</P>



<TABLE>



<TR><TD>

S_ISUID

</TD><TD>

04000     Set user ID on execution

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

S_ISGID

</TD><TD>

02000     Set group ID on execution

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

S_ISVTX

</TD><TD>

01000     Sticky bit

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

S_IRUSR (S_IREAD)

</TD><TD>

00400     Read by owner

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

S_IWUSR (S_IWRITE)

</TD><TD>

00200     Write by owner

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

S_IXUSR (S_IEXEC)

</TD><TD>

00100     Execute/search by  owner

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

S_IRGRP

</TD><TD>

00040     Read by group

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

S_IWGRP

</TD><TD>

00020     Write by group

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

S_IXGRP

</TD><TD>

00010     Execute/search by  group

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

S_IROTH

</TD><TD>

00004     Read by others

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

S_IWOTH

</TD><TD>

00002     Write by others

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

S_IXOTH

</TD><TD>

00001     Execute/search by others

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

</TD><TD>

The effective UID of the process must be 0 or must match the owner of the file.

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

</TD><TD>

The effective UID or GID must be appropriate for setting execution bits.

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

</TD><TD>

Depending on the file system, set user ID and set group ID execution bits may be

turned off if a file is written. On some file systems, only the superuser can set the sticky bit,

which may have a special meaning (that is, for directories, a file can only be deleted by the

owner or the superuser).

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





<P><B>

RETURN VALUE

</B></P>



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

errno is set appropriately.

</P>



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





<P><B>

ERRORS

</B></P>



<P>Depending on the file system, other errors can be returned. The more general errors for

chmod are listed here:

</P>



<TABLE>



<TR><TD>

EPERM

</TD><TD>

The effective UID does not match the owner of the file and is not 0.

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

EROFS

</TD><TD>

The named file resides on a read-only file system.

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

EFAULT

</TD><TD>

path points outside your accessible address space.

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

ENAMETOOLONG

</TD><TD>

path is too long.

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

ENOENT

</TD><TD>

The file does not exist.

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

ENOMEM

</TD><TD>

Insufficient kernel memory was available.

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

ENOTDIR

</TD><TD>

A component of the path prefix is not a directory.

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

EACCES

</TD><TD>

Search permission is denied on a component of the path prefix.

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

ELOOP

</TD><TD>

path contains a circular reference (that is, via a symbolic link)

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



<P>The general errors for fchmod are listed here:

</P>



<TABLE>



<TR><TD>

EBADF

</TD><TD>

The descriptor is not value.

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

ENOENT

</TD><TD>

See above.

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

EPERM

</TD><TD>

See above.

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

EROFS

</TD><TD>

See above.

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





<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

open(2), chown(2), stat(2)

</PRE>

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



<P>Linux 0.99.11, 21 July 1993

</P>



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

chown, fchown

</A></H3>



<P>chown, fchown&#151;Changes ownership of a file

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

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

#include &lt;unistd.h&gt;

int chown(const char *path, uid t owner, gid_t group);

int fchown(int fd, uid t owner, gid_t group);

</PRE>

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



<P><B>

DESCRIPTION

</B></P>



<P>The owner of the file specified by path or by

fd is changed. Only the superuser may change the owner of a file. The owner

of a file may change the group of the file to any group of which that owner is a member. The superuser may change the

group arbitrarily.

</P>



<P>If the owner or group is specified as _1, that ID is not changed.

</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>

ERRORS

</B></P>



<P>Depending on the file system, other errors can be returned. The more general errors for

chown are listed here:

</P>



<TABLE>



<TR><TD>

EPERM

</TD><TD>

The effective UID does not match the owner of the file, and is not 0; or the

owner or group were specified incorrectly.

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

EROFS

</TD><TD>

The named file resides on a read-only file system.

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

EFAULT

</TD><TD>

path points outside your accessible address space.

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





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



<TABLE>



<TR><TD>

ENAMETOOLONG

</TD><TD>

path is too long.

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

ENOENT

</TD><TD>

The file does not exist.

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

ENOMEM

</TD><TD>

Insufficient kernel memory was available.

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

ENOTDIR

</TD><TD>

A component of the path prefix is not a directory.

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

EACCES

</TD><TD>

Search permission is denied on a component of the path prefix.

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

ELOOP

</TD><TD>

path contains a circular reference (that is, via a symbolic link).

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



<P>The general errors for fchown are listed here:

</P>



<TABLE>



<TR><TD>

EBADF

</TD><TD>

The descriptor is not value.

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

ENOENT

</TD><TD>

See above.

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

EPERM

</TD><TD>

See above.

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

EROFS

</TD><TD>

See above.

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



<P><B>

NOTES

</B></P>



<P>chown does not follow symbolic links. The prototype for

fchown is only available if USE BSD is defined.

</P>



<P><B>

SEE ALSO

</B></P>



<!-- CODE SNIP //-->

<PRE>

chmod(2), flock(2)

</PRE>

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



<P>Linux 0.99.11, 21 July 1993

</P>



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

chroot

</A></H3>



<P>chroot&#151;Changes root directory

</P>



<P><B>

SYNOPSIS

</B></P>



<!-- CODE SNIP //-->

<PRE>

#include &lt;unistd.h&gt;

int chroot(const char *path);

</PRE>

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



<P><B>

DESCRIPTION

</B></P>



<P>chroot changes the root directory to that specified in

path. This directory will be used for pathnames beginning with

/. The root directory is inherited by all children of the current process.

</P>



<P>Only the superuser may change the root directory.

</P>



<P>Note that this call does not change the current working directory, so that

. can be outside the tree rooted at /.

</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>

ERRORS

</B></P>



<P>Depending on the file system, other errors can be returned. The more general errors are listed here:

</P>



<TABLE>



<TR><TD>

EPERM

</TD><TD>

The effective UID does not match the owner of the file, and is not 0; or the

owner or group were specified incorrectly.

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

EROFS

</TD><TD>

The named file resides on a read-only file system.

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

EFAULT

</TD><TD>

path points outside your accessible address space.

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

ENAMETOOLONG

</TD><TD>

path is too long.

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

ENOENT

</TD><TD>

The file does not exist.

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

ENOMEM

</TD><TD>

Insufficient kernel memory was available.

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







<P><CENTER>

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







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

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

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