]> granicus.if.org Git - python/commitdiff
Add chroot call. Implements feature #459267.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 4 Oct 2001 22:44:26 +0000 (22:44 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 4 Oct 2001 22:44:26 +0000 (22:44 +0000)
Doc/lib/libos.tex
Modules/posixmodule.c
configure
configure.in
pyconfig.h.in

index 85355a5ee9c6e1a31b676d547300922dc0381533..f8804e812a764521a094cfc4aea3b493c6133017 100644 (file)
@@ -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.
index 0b4b76562c5eb228c6f495d93aa418d88338ce2e..c21f7f85296c45749e5fe071da22b2fcdee22179 100644 (file)
@@ -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
index d4af9b2b6c50cf71566d276bb8736572ba51de0d..51384dff02dd257eec78cea5cff42a5eba62af65 100755 (executable)
--- 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 \
index d8fffc0a553864effc9cf104737ff57e8af1a758..c190b70600e1185d250165c0953d73fb1cd29519 100644 (file)
@@ -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 \
index 00dea7503dfad44d8ad773ac5214db521ffd13f3..e3ce90cd9a674957918efa93acaf766787408cfa 100644 (file)
 /* 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