diff options
author | Werner Fink | 2012-11-08 15:55:48 +0100 |
---|---|---|
committer | Karel Zak | 2012-11-08 15:55:48 +0100 |
commit | 3a08f74f1d9b85be4e7454daa15bf3c8413a69b5 (patch) | |
tree | 89dc5c47d0f5f575ca4460312877dc8245b8c154 /include | |
parent | script: do not try to close stderr twice (diff) | |
download | kernel-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')
-rw-r--r-- | include/Makemodule.am | 1 | ||||
-rw-r--r-- | include/consoles.h | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/include/Makemodule.am b/include/Makemodule.am index bef118f44..40918965b 100644 --- a/include/Makemodule.am +++ b/include/Makemodule.am @@ -8,6 +8,7 @@ dist_noinst_HEADERS += \ include/canonicalize.h \ include/carefulputc.h \ include/closestream.h \ + include/consoles.h \ include/cpuset.h \ include/crc32.h \ include/env.h \ 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); |