journald-console.c revision 4871690d9e32608bbd9b18505b5326c2079c9690
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers This file is part of systemd.
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers Copyright 2011 Lennart Poettering
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers systemd is free software; you can redistribute it and/or modify it
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers under the terms of the GNU Lesser General Public License as published by
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers the Free Software Foundation; either version 2.1 of the License, or
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers (at your option) any later version.
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers systemd is distributed in the hope that it will be useful, but
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers WITHOUT ANY WARRANTY; without even the implied warranty of
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers Lesser General Public License for more details.
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers You should have received a copy of the GNU Lesser General Public License
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers along with systemd; If not, see <http://www.gnu.org/licenses/>.
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers const char *tty;
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers /* First: identifier and PID */
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) ucred->pid);
8f0e73f250f4a397ea07d29a339bd7e64d077612Dave Reisner /* Third: message */
8f0e73f250f4a397ea07d29a339bd7e64d077612Dave Reisner tty = s->tty_path ? s->tty_path : "/dev/console";
8f0e73f250f4a397ea07d29a339bd7e64d077612Dave Reisner fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
5ba2dc259f3cdd8fddef68cfd28380a32534e49aKay Sievers log_debug("Failed to open %s for logging: %s", tty, strerror(errno));
goto finish;