[PATCH] Use chvt to switch terminals instead of vtActivate (#854030).

Vratislav Podzimek vpodzime at redhat.com
Tue Sep 4 15:42:45 UTC 2012


I have sent a similar patch on Aug 20, but there were some concerns
about s390x, so I left it not pushed. Please look at that patch.

On Tue, 2012-09-04 at 11:38 -0400, Chris Lumens wrote:
> This means less code we are responsible for, which is better.
> ---
>  anaconda                    |  2 +-
>  pyanaconda/exception.py     | 12 ++----------
>  pyanaconda/isys/__init__.py |  5 -----
>  pyanaconda/isys/isys.c      | 15 ---------------
>  4 files changed, 3 insertions(+), 31 deletions(-)
> 
> diff --git a/anaconda b/anaconda
> index 028a185..b401077 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -44,7 +44,7 @@ def exitHandler(rebootData, storage, exitCode=None):
>          anaconda.intf.shutdown()
>  
>          if "nokill" in flags.cmdline:
> -            isys.vtActivate(1)
> +            os.system("chvt 1")
>              print "anaconda halting due to nokill flag."
>              print "The system will be rebooted when you press Ctrl-Alt-Delete."
>              while True:
> diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
> index 165deed..e465c0d 100644
> --- a/pyanaconda/exception.py
> +++ b/pyanaconda/exception.py
> @@ -102,12 +102,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
>              pass
>  
>      def runDebug(self, (ty, value, tb)):
> -        # vtActivate does not work on certain ppc64 machines, so just skip
> -        # that and continue with the rest of the debugger setup.
> -        try:
> -            isys.vtActivate(1)
> -        except SystemError:
> -            pass
> +        os.system("chvt 1")
>  
>          pidfl = "/tmp/vncshell.pid"
>          if os.path.exists(pidfl) and os.path.isfile(pidfl):
> @@ -136,10 +131,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
>                "the main window")
>          import pdb
>          pdb.post_mortem (tb)
> -        try:
> -            isys.vtActivate(6)
> -        except SystemError:
> -            pass
> +        os.system("chvt 6")
>  
>  def initExceptionHandling(anaconda):
>      fileList = [ "/tmp/anaconda.log",
> diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
> index 63edbf6..8195f0d 100755
> --- a/pyanaconda/isys/__init__.py
> +++ b/pyanaconda/isys/__init__.py
> @@ -265,11 +265,6 @@ def driveUsesModule(device, modules):
>                      pass
>      return rc
>  
> -def vtActivate (num):
> -    if iutil.isS390():
> -        return
> -    _isys.vtActivate (num)
> -
>  def isPseudoTTY (fd):
>      return _isys.isPseudoTTY (fd)
>  
> diff --git a/pyanaconda/isys/isys.c b/pyanaconda/isys/isys.c
> index 9b9046a..82dc404 100644
> --- a/pyanaconda/isys/isys.c
> +++ b/pyanaconda/isys/isys.c
> @@ -125,7 +125,6 @@ static PyMethodDef isysModuleMethods[] = {
>      { "resetresolv", (PyCFunction) doResetResolv, METH_VARARGS, NULL },
>      { "swapon",  (PyCFunction) doSwapon, METH_VARARGS, NULL },
>      { "swapoff",  (PyCFunction) doSwapoff, METH_VARARGS, NULL },
> -    { "vtActivate", (PyCFunction) doVtActivate, METH_VARARGS, NULL},
>      { "isPseudoTTY", (PyCFunction) doisPseudoTTY, METH_VARARGS, NULL},
>      { "isVioConsole", (PyCFunction) doisVioConsole, METH_NOARGS, NULL},
>      { "sync", (PyCFunction) doSync, METH_VARARGS, NULL},
> @@ -444,20 +443,6 @@ static PyObject * doEjectCdrom(PyObject * s, PyObject * args) {
>      return Py_None;
>  }
>  
> -static PyObject * doVtActivate(PyObject * s, PyObject * args) {
> -    int vtnum;
> -
> -    if (!PyArg_ParseTuple(args, "i", &vtnum)) return NULL;
> -
> -    if (ioctl(0, VT_ACTIVATE, vtnum)) {
> -	PyErr_SetFromErrno(PyExc_SystemError);
> -	return NULL;
> -    }
> -
> -    Py_INCREF(Py_None);
> -    return Py_None;
> -}
> -
>  static PyObject * doisPseudoTTY(PyObject * s, PyObject * args) {
>      int fd;
>      struct stat sb;

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list