-->

Previous | Table of Contents | Next

Page 747


#include <asm/cachectl.h>

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

DESCRIPTION

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:

ICACHE Flush the instruction cache.
DCACHE Write back to memory and invalidate the affected valid cache lines.
BCACHE Same as (ICACHE|DCACHE).

RETURN VALUE

cacheflush returns 0 on success or -1 on error. If errors are detected, errno will indicate the error.

ERRORS

EINVAL The cache parameter is not one of ICACHE, DCACHE, or BCACHE.
EFAULT Some or all of the address range addr to (addr+nbytes-1) is not accessible.

BUGS

The current implementation ignores the addr and nbytes parameters. Therefore, the whole cache is always flushed.

NOTE

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

SEE ALSO


cachectl(2)

Linux, 27 June 95

chdir, fchdir

chdir, fchdir—Changes the working directory

SYNOPSIS


#include <unistd.h>

int chdir(const char *path);

int fchdir(int fd);

DESCRIPTION

chdir changes the current directory to that specified in path.

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

RETURN VALUE

On success, 0 is returned. On error, _1 is returned, and errno is set appropriately.

ERRORS

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

EPERM The process does not have execute permission on the directory.
EFAULT path points outside your accessible address space.
ENAMETOOLONG path is too long.

Page 748

EBADF fd is not a valid file descriptor.
ENOENT The file does not exist.
ENOMEM Insufficient kernel memory was available.
ENOTDIR A component of the path prefix is not a directory.
EACCES Search permission is denied on a component of the path prefix.
ELOOP path contains a circular reference (that is, via a symbolic link)

SEE ALSO


getcwd(3), chroot(2)

Linux 1.2.4, 15 April 1995

chmod, fchmod

chmod, fchmod—Changes permissions of a file

SYNOPSIS


#include <sys/types.h>

#include <sys/stat.h>

int chmod(const char *path,modetmode);

int fchmod(int fildes,modetmode);

DESCRIPTION

The mode of the file given by path or referenced by filedes is changed.

Modes are specified by oring the following:

S_ISUID 04000 Set user ID on execution
S_ISGID 02000 Set group ID on execution
S_ISVTX 01000 Sticky bit
S_IRUSR (S_IREAD) 00400 Read by owner
S_IWUSR (S_IWRITE) 00200 Write by owner
S_IXUSR (S_IEXEC) 00100 Execute/search by owner
S_IRGRP 00040 Read by group
S_IWGRP 00020 Write by group
S_IXGRP 00010 Execute/search by group
S_IROTH 00004 Read by others
S_IWOTH 00002 Write by others
S_IXOTH 00001 Execute/search by others
The effective UID of the process must be 0 or must match the owner of the file.
The effective UID or GID must be appropriate for setting execution bits.
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).

RETURN VALUE

On success, 0 is returned. On error, _1 is returned and errno is set appropriately.

Page 749

ERRORS

Depending on the file system, other errors can be returned. The more general errors for chmod are listed here:

EPERM The effective UID does not match the owner of the file and is not 0.
EROFS The named file resides on a read-only file system.
EFAULT path points outside your accessible address space.
ENAMETOOLONG path is too long.
ENOENT The file does not exist.
ENOMEM Insufficient kernel memory was available.
ENOTDIR A component of the path prefix is not a directory.
EACCES Search permission is denied on a component of the path prefix.
ELOOP path contains a circular reference (that is, via a symbolic link)

The general errors for fchmod are listed here:

EBADF The descriptor is not value.
ENOENT See above.
EPERM See above.
EROFS See above.

SEE ALSO


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

Linux 0.99.11, 21 July 1993

chown, fchown

chown, fchown—Changes ownership of a file

SYNOPSIS


#include <sys/types.h>

#include <unistd.h>

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

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

DESCRIPTION

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.

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

RETURN VALUE

On success, 0 is returned. On error, _1 is returned and errno is set appropriately.

ERRORS

Depending on the file system, other errors can be returned. The more general errors for chown are listed here:

EPERM The effective UID does not match the owner of the file, and is not 0; or the owner or group were specified incorrectly.
EROFS The named file resides on a read-only file system.
EFAULT path points outside your accessible address space.

Page 750

ENAMETOOLONG path is too long.
ENOENT The file does not exist.
ENOMEM Insufficient kernel memory was available.
ENOTDIR A component of the path prefix is not a directory.
EACCES Search permission is denied on a component of the path prefix.
ELOOP path contains a circular reference (that is, via a symbolic link).

The general errors for fchown are listed here:

EBADF The descriptor is not value.
ENOENT See above.
EPERM See above.
EROFS See above.

NOTES

chown does not follow symbolic links. The prototype for fchown is only available if USE BSD is defined.

SEE ALSO


chmod(2), flock(2)

Linux 0.99.11, 21 July 1993

chroot

chroot—Changes root directory

SYNOPSIS


#include <unistd.h>

int chroot(const char *path);

DESCRIPTION

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.

Only the superuser may change the root directory.

Note that this call does not change the current working directory, so that . can be outside the tree rooted at /.

RETURN VALUE

On success, 0 is returned. On error, _1 is returned and errno is set appropriately.

ERRORS

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

EPERM The effective UID does not match the owner of the file, and is not 0; or the owner or group were specified incorrectly.
EROFS The named file resides on a read-only file system.
EFAULT path points outside your accessible address space.
ENAMETOOLONG path is too long.
ENOENT The file does not exist.
ENOMEM Insufficient kernel memory was available.

Previous | Table of Contents | Next