summaryrefslogtreecommitdiffstats
path: root/term-utils/agetty.c
Commit message (Collapse)AuthorAgeFilesLines
...
* misc: simplify if clauses [oclint]Sami Kerola2016-07-211-15/+10Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: call uname() only when necessaryKarel Zak2016-07-201-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix \S usageKarel Zak2016-07-201-10/+15
| | | | | | | | If \S without argument used then uninitialized 'varname' compared with ANSI_COLOR. Addresses: https://github.com/karelzak/util-linux/issues/329 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: don't modify argv[] when parse speedsKarel Zak2016-06-301-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-4/+4
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* build-sys: add --disable-plymouth-supportKarel Zak2016-05-261-2/+5
| | | | | | | | The plymouth support depends on Linux specific SOCK_* flags and all the feature is probably unnecessary in some cases (non-plymouth distros, etc.) Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: agetty: use the plymouth local protocol instead the plymouth binaryWerner Fink2016-05-201-42/+6Star
| | | | | | | | | | | | | for stopping plymouthd. That do not depend on the existence of the plymouth binary if it e.g. becomes uninstalled or an other service is providing plymouthd facilities. [kzak@redhat.com: - fix compiler warnings [-Wpointer-sign] - use sizeof() for write_all() - cast to char* for read_all] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: remove atoi() from argv[] parsing [clang analyze]Karel Zak2016-03-291-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: never cast void* from malloc(3) and friendsRuediger Meier2016-03-071-1/+1
| | | | | | | | | | Such cast could hide serious compiler warnings in case we are missing includes (e.g. <stdlib.h> or "xalloc.h"). See http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: safer (and uniform) handling of return valueYuriy M. Kaminskiy2016-03-071-2/+2
| | | | | | When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow. Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: support \e{name} for issue fileKarel Zak2016-02-171-1/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: add support for \e in issue file to print \033Karel Zak2016-02-111-0/+3
| | | | | Suggested-by: Victor Ananjevsky <ananasik@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: don't ignore netlink on select()Karel Zak2015-11-241-3/+9
| | | | | | | | | | agetty uses NETLINK_ROUTE to be notified about network interface changes. Unfortunately, the code that monitor the netlink FD does not increment number of the monitored file descriptors when call select(2), so the netlink notifications are invisible for agetty. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1278906 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix chown(3), chmod(3) and open(3) raceSami Kerola2015-11-091-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: cleanup plymouth usage [coverity scan]Karel Zak2015-08-051-3/+9
| | | | | | | * use macros for paths * check open() return value Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: Reprompt once the network addresses change if address displayedStef Walter2015-07-201-18/+107
| | | | | | | | | | | | | | | Several of the /etc/issue escape codes such as \4 and \6 depend on the current addresses of the system that can change after the agetty prompt is displayed. This can cause stale data to be displayed when a user looks at a VT, especially in cases of DHCP racing with system start up. Similar to the --reload mechanism, if we're displaying an address in the issue output, and the user hasn't typed anything yet: then redisplay the prompt with the new address. We use netlink to watch for address changes. We only open the netlink socket if we display an address in the issue file.
* agetty: reload issue on --autologin --login-pause tooKarel Zak2015-03-091-79/+92
| | | | | | | | The current "agetty --reload" implementation does not refresh issue file output on autologin. Let's support this use-case too. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: make sure that reload file existsKarel Zak2015-03-091-5/+16
| | | | | | | | | | agetty monitors /run/agetty.reload file, unfortunately if the file does not exist when agetty starts up then "agetty" --reload does not work. This patch forces agetty to create the file before inotify is enabled. Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: support /usr/lib/os-release tooKarel Zak2015-03-051-3/+6
| | | | | | | | | | | | http://www.freedesktop.org/software/systemd/man/os-release.html The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Reported-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix spellos and inconsistencies in several program messagesBenno Schulenberg2015-01-261-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* build-sys: fix make checkincludes warningsSami Kerola2015-01-071-3/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* agetty: use futimens, check for all in configure.acKarel Zak2014-11-211-7/+1Star
| | | | | | | | | | | It seems better to warn about --reload in ./configure if futimens or inotify_init1 are missing. The patch also replaces futimes() with futimens() to make the code compatible with Uclibc. Addresses: https://github.com/karelzak/util-linux/issues/133 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix typoKarel Zak2014-11-211-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: keep the current baud before try 9600 on serial linesKarel Zak2014-11-211-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: don't ignore TERMKarel Zak2014-11-211-2/+4
| | | | | | | | | Fix command line parsing to not ignore term setting if no baud specified, for example: /sbin/agetty ttyS0 vt100 Signed-off-by: Karel Zak <kzak@redhat.com>
* aggety: always set default serial line speedKarel Zak2014-11-201-4/+11
| | | | | | | | | * makes speeds table usage more robust * don't call next_speed() for empty speeds table to avoid division by zero * default to 9600 when port baud unspecified Addresses: https://github.com/karelzak/util-linux/pull/131 Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: use version printing macro everywhereSami Kerola2014-10-011-2/+1Star
| | | | | | | Only mount, umount, and blkid remains not using the macro because they are print also library references. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)Christoph Egger2014-09-171-0/+16
| | | | | | | Handle vc flags missing on FreeBSD Fix tty creation on kFreeBSD taking patch from 2.19 Addresses-Debian-Bug: #650185
* textual: remove some inconsistent periods from error messagesBenno Schulenberg2014-08-111-1/+1
| | | | | | While doing so, also improve translatability and some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* agetty: Reprompt and reprint /etc/issue when askedStef Walter2014-07-281-12/+129
| | | | | | | | | | | | | | | | | | | | | Add an 'agetty --reload' command which asks all running agetty commands to display their prompts again. Several of the /etc/issue escape codes such as \4 and \S depend on variable data which can change after the agetty prompt is displayed. This can cause stale data to be displayed when a user looks at a VT, especially in cases of DHCP racing with system start up. We never want this to occur once the user has started typing a user name. So we detect when the user starts typing, after which no further reprompting occurs after that point. [kzak@redhat.com: - add #ifdefs to make it usable on non-inotify systems, - use futimens() with NULL timespec - add --reaload to usage()] Signed-off-by: Stef Walter <stefw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fixes for non-Linux systemsSamuel Thibault2014-06-191-1/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: Update help usage functionBenjamin Robin2014-05-181-2/+5
| | | | Signed-off-by: Benjamin Robin <dev@benjarobin.fr>
* agetty: Fix implementation of option --nonewline. The flag F_NONL was never set.Benjamin Robin2014-05-181-0/+3
| | | | Signed-off-by: Benjamin Robin <dev@benjarobin.fr>
* agetty: use the "best" interface for \4 and \6Karel Zak2014-05-131-38/+62
| | | | | | | | | | | | The issue file escape sequences \4 and \6 prints the host IP when no interface is specified. That's useless on some virtual machines where gethostname()+getaddrinfo() returns 127.0.0.1. The seems better to print IP of the "best" interface (UP, RUNNING, non-LOOPBACK) and use gethostname() as painful fallback only. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1090935 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix odd check for chardev/ttyKarel Zak2014-05-131-2/+2
| | | | | References: https://bugzilla.redhat.com/show_bug.cgi?id=1069902 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: beside virtual consoles support xvc and hvc device lines as wellWerner Fink2014-05-131-12/+11Star
| | | | | | | | For this approach do not use the ioctl TIOCMGET anymore as this is for real serial lines only. But switch over to use the ioctl KDGKBMODE as this is unique to the virtual console lines only. Signed-off-by: Werner Fink <werner@suse.de>
* agetty: better support of the special system consoles on S390Werner Fink2014-05-131-5/+10
| | | | | | | | | | | | | | | | | That is that there are several consoles, the /dev/ttyS0 which is type of ibm3215 and a dumb terminal, then there is the device /dev/3270/tty1 which can handle ANSI color escape sequences and is a ibm327x terminal, and the /dev/ttyS1 which is a vt220 terminal. The macro is_speed() in agetty.c allows to distinguish between the terminal line (/dev)3270/tty1 and the speed options on the command line used in /run/systemd/generator/getty.target.wants/serial-getty@3270-tty1.service which is a symbolic link to /usr/lib/systemd/system/serial-getty@.service Signed-off-by: Werner Fink <werner@suse.de>
* agetty: avoid that agetty nor sulogin are fooled by a running plymouthWerner Fink2014-05-131-7/+68
| | | | | | | | The nowadays used plymouth locks the devices used for the system console which causes that agetty as well as sulogin can not modify the termios settings of e.g. the serial devices of the systenm console. Signed-off-by: Werner Fink <werner@suse.de>
* include/c.h: prefer nanosleep() over usleep()Karel Zak2014-01-241-1/+1
| | | | | | | | | | | | | | Let's use nanosleep() although if usleep() exists. The nanosleep function does no interact with signals and other timers. The patch introduces xusleep() as replacement to libc (or our fallback) usleep(). Yes, we don't want to use struct timespec + nanosleep() everywhere in code as nano-time resolution is useless for us. The patch also enlarges delays in some busy wait loops. It seems enough to try read/write 4x per second. Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: support the special terminal on first serial line on a S/390Werner Fink2013-12-021-0/+18
| | | | | | | | which is due legacy reasons a block terminal of type 3270 or higher. Whereas the second serial line on a S/390(x) is a real character terminal which is compatible with VT220. Signed-off-by: Werner Fink <werner@suse.de>
* losetup, agetty: remove unnecessary if's before free()Sami Kerola2013-12-021-4/+2Star
| | | | | Reference: http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: make two messages somewhat easier to understandBenno Schulenberg2013-10-081-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* agetty: use standard angular brackets in usage messageBenno Schulenberg2013-10-041-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* Fix various typosYuri Chornoivan2013-09-281-2/+2
|
* agetty: add \S to output /etc/os-release dataKarel Zak2013-09-121-1/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows to use a new \S or \S{VARNAME} sequence in the /etc/issue file. The sequence prints data from /etc/os-release. The reason is to keep /etc/issue file distribution and release independent. The \S{ANSI_COLOR} is converted to the real terminal escape seq. For example: \S Kernel \r on an \m (\l) or more complex example: Welcome to \S{ANSI_COLOR}\S{NAME}0m \S{VERSION} Report bugs at \S{BUG_REPORT_URL}. See http://www.freedesktop.org/software/systemd/man/os-release.html fr more details about /etc/issue. Based on patch from Bill Nottingham <notting@redhat.com>. Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: add baud rates available from glibc that are not already supportedJames Buren2013-09-121-0/+36
| | | | | This adds userspace support for baud rates reater than 230400, provided the tty also supports it.
* agetty: only use EXTA/EXTB macros if B19200/B38400 macros are not presentJames Buren2013-09-121-7/+5Star
|
* agetty: cleanup debug ifdefsKarel Zak2013-09-091-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last, utmpdump, agetty, wall, write: avoid compatibility hacksSami Kerola2013-08-291-0/+4
| | | | | | | | In include/bits/utmp.h the ut_user and ut_time macros are marked with comment they are backwards compatibility hacks. It is probably best to avoid use of these macros where ever possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>