MLINKS+=chflags.2 fchflags.2 chflags.2 lchflags.2
MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2 chmod.2 fchmodat.2
MLINKS+=chown.2 fchown.2 chown.2 lchown.2 chown.2 fchownat.2
+MLINKS+=chroot.2 chroot_kernel.2
MLINKS+=clock_gettime.2 clock_getres.2 clock_gettime.2 clock_settime.2
MLINKS+=dup.2 dup2.2
MLINKS+=extattr.2 extattr_delete_file.2 \
.\"
.\" @(#)chroot.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD: src/lib/libc/sys/chroot.2,v 1.7.2.8 2002/12/11 14:06:37 ru Exp $
-.\" $DragonFly: src/lib/libc/sys/chroot.2,v 1.3 2007/07/14 21:48:15 swildner Exp $
.\"
-.Dd June 4, 1993
+.Dd August 1, 2010
.Dt CHROOT 2
.Os
.Sh NAME
.In unistd.h
.Ft int
.Fn chroot "const char *dirname"
+.Ft int
+.Fn chroot_kernel "const char *dirname"
.Sh DESCRIPTION
.Fa Dirname
is the address of the pathname of a directory, terminated by an ASCII NUL.
a value of -1 is returned and
.Va errno
is set to indicate an error.
+.Pp
+The
+.Fn chroot_kernel
+system call adjusts the kernel's internal namecache and root vnode
+references to
+.Fa dirname .
+If used in conjunction with
+.Fn chroot
+during early boot, it allows for changing the root mount to any
+mount point available at that time.
.Sh ERRORS
.Fn Chroot
will fail and the root directory will be unchanged if: