Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/sys Document fchroot(2).
details: https://anonhg.NetBSD.org/src/rev/55e1864f47df
branches: trunk
changeset: 508712:55e1864f47df
user: kleink <kleink%NetBSD.org@localhost>
date: Wed Apr 18 08:28:10 2001 +0000
description:
Document fchroot(2).
diffstat:
lib/libc/sys/Makefile.inc | 3 ++-
lib/libc/sys/chroot.2 | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 3 deletions(-)
diffs (90 lines):
diff -r 58282fe336e3 -r 55e1864f47df lib/libc/sys/Makefile.inc
--- a/lib/libc/sys/Makefile.inc Wed Apr 18 05:59:40 2001 +0000
+++ b/lib/libc/sys/Makefile.inc Wed Apr 18 08:28:10 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.111 2001/01/05 21:49:47 jdolecek Exp $
+# $NetBSD: Makefile.inc,v 1.112 2001/04/18 08:28:10 kleink Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@@ -216,6 +216,7 @@
MLINKS+=chflags.2 fchflags.2 chflags.2 lchflags.2
MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2
MLINKS+=chown.2 fchown.2 chown.2 lchown.2
+MLINKS+=chroot.2 fchroot.2
MLINKS+=clock_settime.2 clock_gettime.2
MLINKS+=clock_settime.2 clock_getres.2
MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
diff -r 58282fe336e3 -r 55e1864f47df lib/libc/sys/chroot.2
--- a/lib/libc/sys/chroot.2 Wed Apr 18 05:59:40 2001 +0000
+++ b/lib/libc/sys/chroot.2 Wed Apr 18 08:28:10 2001 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: chroot.2,v 1.12 1999/12/02 21:42:36 kleink Exp $
+.\" $NetBSD: chroot.2,v 1.13 2001/04/18 08:28:11 kleink Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)chroot.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd June 4, 1993
+.Dd April 18, 2001
.Dt CHROOT 2
.Os
.Sh NAME
@@ -45,6 +45,8 @@
.Fd #include <unistd.h>
.Ft int
.Fn chroot "const char *dirname"
+.Ft int
+.Fn fchroot "int fd"
.Sh DESCRIPTION
.Fa dirname
is the address of the pathname of a directory, terminated by an ASCII NUL.
@@ -66,6 +68,12 @@
has no effect on the process's current directory.
.Pp
This call is restricted to the super-user.
+.Pp
+The
+.Fn fchroot
+function performs the same operation on an open directory file
+known by the file descriptor
+.Fa fd .
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise,
a value of -1 is returned and
@@ -95,6 +103,24 @@
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.El
+.Pp
+.Fn fchroot
+will fail and the root directory will be unchanged if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Search permission is denied for the directory referenced
+by the file descriptor.
+.It Bq Er EBADF
+The argument
+.Fa fd
+is not a valid file descriptor.
+.It Bq Er EIO
+An I/O error occurred while reading from or writing to the file system.
+.It Bq Er ENOTDIR
+The argument
+.Fa fd
+does not reference a directory.
+.El
.Sh SEE ALSO
.Xr chdir 2
.Sh HISTORY
@@ -107,3 +133,7 @@
to prevent one way a process could use a second
.Fn chroot
call to a different directory to "escape" from the restricted subtree.
+The
+.Fn fchroot
+function appeared in
+.Nx 1.4 .
Home |
Main Index |
Thread Index |
Old Index