summaryrefslogtreecommitdiffstats
path: root/include/consoles.h
diff options
context:
space:
mode:
authorWerner Fink2012-11-08 15:55:48 +0100
committerKarel Zak2012-11-08 15:55:48 +0100
commit3a08f74f1d9b85be4e7454daa15bf3c8413a69b5 (patch)
tree89dc5c47d0f5f575ca4460312877dc8245b8c154 /include/consoles.h
parentscript: do not try to close stderr twice (diff)
downloadkernel-qcow2-util-linux-3a08f74f1d9b85be4e7454daa15bf3c8413a69b5.tar.gz
kernel-qcow2-util-linux-3a08f74f1d9b85be4e7454daa15bf3c8413a69b5.tar.xz
kernel-qcow2-util-linux-3a08f74f1d9b85be4e7454daa15bf3c8413a69b5.zip
lib/consoles: add code to detect all system consoles
Signed-off-by: Werner Fink <werner@suse.de>
Diffstat (limited to 'include/consoles.h')
-rw-r--r--include/consoles.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/consoles.h b/include/consoles.h
new file mode 100644
index 000000000..c669eb2a7
--- /dev/null
+++ b/include/consoles.h
@@ -0,0 +1,48 @@
+/*
+ * consoles.h Header file for routines to detect the system consoles
+ *
+ * Copyright (c) 2011 SuSE LINUX Products GmbH, All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING); if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Author: Werner Fink <werner@suse.de>
+ */
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <termios.h>
+
+struct chardata {
+ uint8_t erase;
+ uint8_t kill;
+ uint8_t eol;
+ uint8_t parity;
+};
+struct console {
+ char *tty;
+ FILE *file;
+ uint32_t flags;
+ int fd, id;
+#define CON_SERIAL 0x0001
+#define CON_NOTTY 0x0002
+ pid_t pid;
+ struct chardata cp;
+ struct termios tio;
+ struct console *next;
+};
+extern struct console *consoles;
+extern int detect_consoles(const char *, int);