Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 505368
Collapse All | Expand All

(-)src/ck-vt-monitor.c.ori (-2 / +61 lines)
Lines 27-32 Link Here
27
#include <string.h>
27
#include <string.h>
28
#include <errno.h>
28
#include <errno.h>
29
29
30
#include <sys/types.h>
31
#include <sys/stat.h>
32
#include <sys/socket.h>
33
#include <sys/ioctl.h>
34
35
#ifdef __linux__
36
#include <linux/kd.h>
37
#endif
38
39
#ifdef HAVE_SYS_VT_H
40
#include <sys/vt.h>
41
#endif
42
43
#if HAVE_SYS_CONSIO_H
44
#include <sys/consio.h>
45
#endif
46
47
30
#include <glib.h>
48
#include <glib.h>
31
#include <glib/gi18n.h>
49
#include <glib/gi18n.h>
32
#include <glib/gstdio.h>
50
#include <glib/gstdio.h>
Lines 319-326 Link Here
319
337
320
        res = ck_wait_for_active_console_num (vt_monitor->priv->vfd, num);
338
        res = ck_wait_for_active_console_num (vt_monitor->priv->vfd, num);
321
        if (! res) {
339
        if (! res) {
322
                /* FIXME: what do we do if it fails? */
340
                int fd;
323
        } else {
341
                const char *errmsg;
342
                struct vt_stat vts;
343
                guint  active;
344
345
                g_warning ("Reopen a console and check again");
346
347
                fd = vt_monitor->priv->vfd;
348
                if (fd != ERROR) {
349
                        g_debug ("close descriptor %d", fd);
350
                        close (fd);
351
                }
352
353
                fd = ck_get_a_console_fd();
354
                vt_monitor->priv->vfd = fd;
355
356
                if (fd == ERROR) {
357
                        errmsg = g_strerror (errno);
358
                        g_warning("Unable to open a console: %s", errmsg);
359
                } else {
360
                        g_debug ("VT_GETSTATE for vt %d", num);
361
                        if ((res = ioctl(fd, VT_GETSTATE, &vts)) != -1) {
362
                            if (vts.v_active != num) {
363
                                res = ck_get_active_console_num(fd, &active);
364
                                if (! res) {
365
                                    g_warning("Could not determine active console");
366
                                    active = 0;
367
                                }
368
                                vt_monitor->priv->active_num = active;
369
                                res = ck_wait_for_active_console_num(vt_monitor->priv->vfd, num);
370
                                if (!res) {
371
                                  errmsg = g_strerror (errno);
372
                                  g_warning("Unable to wait for vt %d activation: %s", num, errmsg);
373
                                }
374
                            }
375
                        } else {
376
                            errmsg = g_strerror (errno);
377
                            g_warning("Unable to get console state: %s", errmsg);
378
                        }
379
                }
380
                g_debug ("new descriptor is %d", fd);
381
        }
382
        if (res) {
324
                EventData *event;
383
                EventData *event;
325
384
326
                /* add event to queue */
385
                /* add event to queue */

Return to bug 505368