summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-10-04 22:44:26 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-10-04 22:44:26 (GMT)
commit244edc89852ef4c0338438e94c7f3801f289f83e (patch)
tree58c5aa8e22e44fdc8b6d1b3f99facf5bb79d9c8d
parentfcc16330a4f751c0ff0d9c02f0762ce0eaf230bf (diff)
downloadcpython-244edc89852ef4c0338438e94c7f3801f289f83e.zip
cpython-244edc89852ef4c0338438e94c7f3801f289f83e.tar.gz
cpython-244edc89852ef4c0338438e94c7f3801f289f83e.tar.bz2
Add chroot call. Implements feature #459267.
-rw-r--r--Doc/lib/libos.tex6
-rw-r--r--Modules/posixmodule.c15
-rwxr-xr-xconfigure4
-rw-r--r--configure.in2
-rw-r--r--pyconfig.h.in3
5 files changed, 27 insertions, 3 deletions
diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex
index 85355a5..f8804e8 100644
--- a/Doc/lib/libos.tex
+++ b/Doc/lib/libos.tex
@@ -577,6 +577,12 @@ Return a string representing the current working directory.
Availability: Macintosh, \UNIX{}, Windows.
\end{funcdesc}
+\begin{funcdesc}{chroot}{path}
+Change the root directory of the current process to \var{path}.
+Availability: \UNIX{}.
+\versionadded{2.2}
+\end{funcdesc}
+
\begin{funcdesc}{chmod}{path, mode}
Change the mode of \var{path} to the numeric \var{mode}.
Availability: \UNIX{}, Windows.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 0b4b765..c21f7f8 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -724,6 +724,18 @@ posix_chmod(PyObject *self, PyObject *args)
}
+#ifdef HAVE_CHROOT
+static char posix_chroot__doc__[] =
+"chroot(path) -> None\n\
+Change root directory to path.";
+
+static PyObject *
+posix_chroot(PyObject *self, PyObject *args)
+{
+ return posix_1str(args, "et:chroot", chroot);
+}
+#endif
+
#ifdef HAVE_FSYNC
static char posix_fsync__doc__[] =
"fsync(fildes) -> None\n\
@@ -5336,6 +5348,9 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_CHOWN
{"chown", posix_chown, METH_VARARGS, posix_chown__doc__},
#endif /* HAVE_CHOWN */
+#ifdef HAVE_CHROOT
+ {"chroot", posix_chroot, METH_VARARGS, posix_chroot__doc__},
+#endif
#ifdef HAVE_CTERMID
{"ctermid", posix_ctermid, METH_VARARGS, posix_ctermid__doc__},
#endif
diff --git a/configure b/configure
index d4af9b2..51384df 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
-# From configure.in Revision: 1.261
+# From configure.in Revision: 1.262
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
@@ -4683,7 +4683,7 @@ fi
echo "$ac_t""MACHDEP_OBJS" 1>&6
# checks for library functions
-for ac_func in alarm chown clock confstr ctermid ctermid_r execv \
+for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \
flock fork fsync fdatasync fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
hstrerror inet_pton kill link lstat mkfifo mktime mremap \
diff --git a/configure.in b/configure.in
index d8fffc0..c190b70 100644
--- a/configure.in
+++ b/configure.in
@@ -1316,7 +1316,7 @@ fi
AC_MSG_RESULT(MACHDEP_OBJS)
# checks for library functions
-AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
+AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
flock fork fsync fdatasync fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
hstrerror inet_pton kill link lstat mkfifo mktime mremap \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 00dea75..e3ce90c 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -321,6 +321,9 @@
/* Define if you have the chown function. */
#undef HAVE_CHOWN
+/* Define if you have the chroot function. */
+#undef HAVE_CHROOT
+
/* Define if you have the clock function. */
#undef HAVE_CLOCK