struct timeval lores_uptime;
#endif
struct timeval now;
+#ifdef HAVE_SYSINFO
struct sysinfo info;
+#endif
if (gettimeofday(&now, NULL) != 0) {
warn(_("gettimeofday failed"));
return 0;
}
#endif
+#ifdef HAVE_SYSINFO
/* fallback */
if (sysinfo(&info) != 0)
warn(_("sysinfo failed"));
boot_time->tv_sec = now.tv_sec - info.uptime;
boot_time->tv_usec = 0;
return 0;
+#else
+ return -ENOSYS;
+#endif
}
# define IUCLC 0
#endif
+#ifdef TIOCGLCKTRMIOS
/*
* For the case plymouth is found on this system
*/
}
return 1;
}
+#endif
/*
* Fix the tty modes and set reasonable defaults.
int mode = 0, flags = 0;
struct termios *tio = &con->tio;
struct termios lock;
- int fd = con->fd, i = (plymouth_command("--ping")) ? 20 : 0;
+ int fd = con->fd;
+#ifdef TIOCGLCKTRMIOS
+ int i = (plymouth_command("--ping")) ? 20 : 0;
while (i-- > 0) {
/*
}
memset(&lock, 0, sizeof(struct termios));
ioctl(fd, TIOCSLCKTRMIOS, &lock);
+#endif
errno = 0;
{
const pid_t pid = getpid();
int closed = 0;
+#ifndef KDGKBMODE
+ int serial;
+#endif
/* Set up new standard input, unless we are given an already opened port. */
* In case of a virtual console the ioctl KDGKBMODE succeeds
* whereas on other lines it will fails.
*/
- if (ioctl(STDIN_FILENO, KDGKBMODE, &op->kbmode) == 0) {
+#ifdef KDGKBMODE
+ if (ioctl(STDIN_FILENO, KDGKBMODE, &op->kbmode) == 0)
+#else
+ if (ioctl(STDIN_FILENO, TIOCMGET, &serial) < 0 && (errno == EINVAL))
+#endif
+ {
op->flags |= F_VCONSOLE;
if (!op->term)
op->term = DEFAULT_VCTERM;
} else {
+#ifdef K_RAW
op->kbmode = K_RAW;
+#endif
if (!op->term)
op->term = DEFAULT_STERM;
}
speed_t ispeed, ospeed;
struct winsize ws;
struct termios lock;
+#ifdef TIOCGLCKTRMIOS
int i = (plymouth_command("--ping") == 0) ? 30 : 0;
while (i-- > 0) {
}
memset(&lock, 0, sizeof(struct termios));
ioctl(STDIN_FILENO, TIOCSLCKTRMIOS, &lock);
+#endif
if (op->flags & F_VCONSOLE) {
#if defined(IUTF8) && defined(KDGKBMODE)