diff options
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/eeprom/i386/benv.c | 6 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/Makefile | 5 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/Makefile.com | 6 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/amd64/Makefile | 13 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/common/dump.c | 5 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/i386/Makefile | 33 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/sparc/Makefile | 33 | ||||
-rw-r--r-- | usr/src/cmd/sgs/dump/sparcv9/Makefile | 13 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/Makefile | 4 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/Makefile.com | 9 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/amd64/Makefile | 13 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/common/main.c | 8 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/i386/Makefile | 35 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/sparc/Makefile | 33 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/sparcv9/Makefile | 12 | ||||
-rw-r--r-- | usr/src/cmd/ttymon/tmchild.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/ttymon/tmexpress.c | 46 | ||||
-rw-r--r-- | usr/src/cmd/ttymon/tmextern.h | 2 | ||||
-rw-r--r-- | usr/src/cmd/ttymon/tmstruct.h | 1 | ||||
-rw-r--r-- | usr/src/cmd/ttymon/tmterm.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/ttymon/ttymon.c | 88 |
21 files changed, 168 insertions, 201 deletions
diff --git a/usr/src/cmd/eeprom/i386/benv.c b/usr/src/cmd/eeprom/i386/benv.c index 2119bdc3af..2e559f83d3 100644 --- a/usr/src/cmd/eeprom/i386/benv.c +++ b/usr/src/cmd/eeprom/i386/benv.c @@ -934,12 +934,13 @@ main(int argc, char **argv) argc -= optind; argv += optind; + optind = 0; if (bootenv) { int rv = 0; if (argc == 1) - value = argv[0]; + value = argv[optind]; if (bootenv_print) return (lzbe_bootenv_print(name, nvlist, stdout)); @@ -978,7 +979,7 @@ main(int argc, char **argv) if (optind >= argc) { print_vars(elist); return (0); - } else + } else { while (optind < argc) { /* * If "-" specified, read variables from stdin; @@ -996,6 +997,7 @@ main(int argc, char **argv) optind++; } + } /* * don't write benv if we are processing delayed writes since diff --git a/usr/src/cmd/sgs/dump/Makefile b/usr/src/cmd/sgs/dump/Makefile index 745dc3e005..a83ee1a5d7 100644 --- a/usr/src/cmd/sgs/dump/Makefile +++ b/usr/src/cmd/sgs/dump/Makefile @@ -20,10 +20,9 @@ # CDDL HEADER END # # -#ident "%Z%%M% %I% %E% SMI" -# # Copyright (c) 1994 by Sun Microsystems, Inc. # -# cmd/sgs/dump/Makefile + +BUILD32 = $(POUND_SIGN) include ../Makefile.sub diff --git a/usr/src/cmd/sgs/dump/Makefile.com b/usr/src/cmd/sgs/dump/Makefile.com index 6fee454721..96a6b4aa58 100644 --- a/usr/src/cmd/sgs/dump/Makefile.com +++ b/usr/src/cmd/sgs/dump/Makefile.com @@ -40,12 +40,10 @@ OBJS = $(COMOBJS) .PARALLEL: $(OBJS) CPPFLAGS += -D__EXTENSIONS__ -LLDFLAGS = '$(LDPASS)-R$$ORIGIN/../../lib' -LLDFLAGS64 = '$(LDPASS)-R$$ORIGIN/../../../lib/$(MACH64)' -LDFLAGS += $(LLDFLAGS) +LDFLAGS += '-R$$ORIGIN/../../lib/$(MACH64)' CERRWARN += $(CNOWARN_UNINIT) SMOFF += indenting -LDLIBS += $(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf +LDLIBS += $(CONVLIBDIR64) -lconv $(ELFLIBDIR64) -lelf diff --git a/usr/src/cmd/sgs/dump/amd64/Makefile b/usr/src/cmd/sgs/dump/amd64/Makefile index 10cef7c92d..20455f057c 100644 --- a/usr/src/cmd/sgs/dump/amd64/Makefile +++ b/usr/src/cmd/sgs/dump/amd64/Makefile @@ -30,14 +30,11 @@ include ../Makefile.com .KEEP_STATE: -LLDFLAGS = $(LLDFLAGS64) -ELFLIBDIR = $(ELFLIBDIR64) -CONVLIBDIR = $(CONVLIBDIR64) - -ROOTPROG= $(ROOTPROG64) -ROOTCCSBINLINK= $(ROOTCCSBINLINK64) - include ../Makefile.targ include $(SRC)/Makefile.master.64 -install: $(ROOTPROG64) +install: $(ROOTPROG) $(ROOTPROG64) \ + $(ROOTCCSBINLINK) $(ROOTCCSBINLINK64) + +$(ROOTBIN64)/dump: + $(RM) $@; $(SYMLINK) ../../bin/dump $@ diff --git a/usr/src/cmd/sgs/dump/common/dump.c b/usr/src/cmd/sgs/dump/common/dump.c index 204c0d52f1..20acf25d3d 100644 --- a/usr/src/cmd/sgs/dump/common/dump.c +++ b/usr/src/cmd/sgs/dump/common/dump.c @@ -2010,11 +2010,6 @@ main(int argc, char *argv[], char *envp[]) char *optstr = OPTSTR; /* option string used by getopt() */ int optchar; - /* - * Check for a binary that better fits this architecture. - */ - (void) conv_check_native(argv, envp); - prog_name = argv[0]; (void) setlocale(LC_ALL, ""); diff --git a/usr/src/cmd/sgs/dump/i386/Makefile b/usr/src/cmd/sgs/dump/i386/Makefile deleted file mode 100644 index ba0a4032e6..0000000000 --- a/usr/src/cmd/sgs/dump/i386/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. -# - -include ../Makefile.com - -.KEEP_STATE: - -include ../Makefile.targ diff --git a/usr/src/cmd/sgs/dump/sparc/Makefile b/usr/src/cmd/sgs/dump/sparc/Makefile deleted file mode 100644 index ba0a4032e6..0000000000 --- a/usr/src/cmd/sgs/dump/sparc/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. -# - -include ../Makefile.com - -.KEEP_STATE: - -include ../Makefile.targ diff --git a/usr/src/cmd/sgs/dump/sparcv9/Makefile b/usr/src/cmd/sgs/dump/sparcv9/Makefile index 5632b0ecf0..20455f057c 100644 --- a/usr/src/cmd/sgs/dump/sparcv9/Makefile +++ b/usr/src/cmd/sgs/dump/sparcv9/Makefile @@ -30,14 +30,11 @@ include ../Makefile.com .KEEP_STATE: -LLDFLAGS = $(LLDFLAGS64) -ELFLIBDIR = $(ELFLIBDIR64) -CONVLIBDIR = $(CONVLIBDIR64) - -ROOTPROG = $(ROOTPROG64) -ROOTCCSBINLINK = $(ROOTCCSBINLINK64) - include ../Makefile.targ include $(SRC)/Makefile.master.64 -install: $(ROOTPROG64) +install: $(ROOTPROG) $(ROOTPROG64) \ + $(ROOTCCSBINLINK) $(ROOTCCSBINLINK64) + +$(ROOTBIN64)/dump: + $(RM) $@; $(SYMLINK) ../../bin/dump $@ diff --git a/usr/src/cmd/sgs/elfdump/Makefile b/usr/src/cmd/sgs/elfdump/Makefile index 2f70df00c7..35c78efe07 100644 --- a/usr/src/cmd/sgs/elfdump/Makefile +++ b/usr/src/cmd/sgs/elfdump/Makefile @@ -23,7 +23,7 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# + +BUILD32 = $(POUND_SIGN) include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/elfdump/Makefile.com b/usr/src/cmd/sgs/elfdump/Makefile.com index c5190adcd4..1caec6d1bf 100644 --- a/usr/src/cmd/sgs/elfdump/Makefile.com +++ b/usr/src/cmd/sgs/elfdump/Makefile.com @@ -51,11 +51,10 @@ MAPOPT= $(MAPFILE:%=-Wl,-M%) CPPFLAGS= -I. -I../common -I../../include -I../../include/$(MACH) \ -I$(SRC)/lib/libc/inc -I$(SRC)/uts/$(ARCH)/sys \ $(CPPFLAGS.master) -I$(ELFCAP) -LLDFLAGS = '-R$$ORIGIN/../../lib' -LLDFLAGS64 = '-R$$ORIGIN/../../../lib/$(MACH64)' -LDFLAGS += $(VERSREF) $(MAPOPT) $(LLDFLAGS) -LDLIBS += $(ELFLIBDIR) -lelf $(LDDBGLIBDIR) -llddbg \ - $(CONVLIBDIR) -lconv + +LDFLAGS += $(VERSREF) $(MAPOPT) '-R$$ORIGIN/../../lib/$(MACH64)' +LDLIBS += $(ELFLIBDIR64) -lelf $(LDDBGLIBDIR64) -llddbg \ + $(CONVLIBDIR64) -lconv NATIVE_LDFLAGS = $(LDASSERTS) $(BDIRECT) diff --git a/usr/src/cmd/sgs/elfdump/amd64/Makefile b/usr/src/cmd/sgs/elfdump/amd64/Makefile index b04872649b..0294565bb4 100644 --- a/usr/src/cmd/sgs/elfdump/amd64/Makefile +++ b/usr/src/cmd/sgs/elfdump/amd64/Makefile @@ -31,17 +31,14 @@ include ../Makefile.com .KEEP_STATE: ARCH = amd64 -LLDFLAGS = $(LLDFLAGS64) -ELFLIBDIR = $(ELFLIBDIR64) -LDDBGLIBDIR = $(LDDBGLIBDIR64) -CONVLIBDIR = $(CONVLIBDIR64) - -ROOTPROG = $(ROOTPROG64) -ROOTCCSBINLINK = $(ROOTCCSBINLINK64) install: all $(ROOTPROG64) include ../Makefile.targ include $(SRC)/Makefile.master.64 -install: $(ROOTPROG64) +install: $(ROOTPROG) $(ROOTPROG64) \ + $(ROOTCCSBINLINK) $(ROOTCCSBINLINK64) + +$(ROOTBIN64)/elfdump: + $(RM) $@; $(SYMLINK) ../../bin/elfdump $@ diff --git a/usr/src/cmd/sgs/elfdump/common/main.c b/usr/src/cmd/sgs/elfdump/common/main.c index ed95ad5892..7acecdaf96 100644 --- a/usr/src/cmd/sgs/elfdump/common/main.c +++ b/usr/src/cmd/sgs/elfdump/common/main.c @@ -174,7 +174,7 @@ detail_usage() */ void dump_hex_bytes(const void *data, size_t n, int indent, - int bytes_per_col, int col_per_row) + int bytes_per_col, int col_per_row) { const uchar_t *ldata = data; int bytes_per_row = bytes_per_col * col_per_row; @@ -735,12 +735,6 @@ main(int argc, char **argv, char **envp) uchar_t osabi = ELFOSABI_NONE; /* - * If we're on a 64-bit kernel, try to exec a full 64-bit version of - * the binary. If successful, conv_check_native() won't return. - */ - (void) conv_check_native(argv, envp); - - /* * Establish locale. */ (void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY)); diff --git a/usr/src/cmd/sgs/elfdump/i386/Makefile b/usr/src/cmd/sgs/elfdump/i386/Makefile deleted file mode 100644 index 95390a2899..0000000000 --- a/usr/src/cmd/sgs/elfdump/i386/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include ../Makefile.com - -.KEEP_STATE: - -ARCH = i386 - -install: all $(ROOTPROG32) - -include ../Makefile.targ diff --git a/usr/src/cmd/sgs/elfdump/sparc/Makefile b/usr/src/cmd/sgs/elfdump/sparc/Makefile deleted file mode 100644 index a2c6327b0b..0000000000 --- a/usr/src/cmd/sgs/elfdump/sparc/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include ../Makefile.com - -.KEEP_STATE: - -ARCH = sparc - -include ../Makefile.targ diff --git a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile index f24ce47957..2db168be93 100644 --- a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile +++ b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile @@ -31,16 +31,12 @@ include ../Makefile.com .KEEP_STATE: ARCH = sparcv9 -LLDFLAGS = $(LLDFLAGS64) -ELFLIBDIR = $(ELFLIBDIR64) -LDDBGLIBDIR = $(LDDBGLIBDIR64) -CONVLIBDIR = $(CONVLIBDIR64) - -ROOTPROG = $(ROOTPROG64) -ROOTCCSBINLINK = $(ROOTCCSBINLINK64) include ../Makefile.targ include $(SRC)/Makefile.master.64 -install: $(ROOTPROG64) +install: $(ROOTPROG) $(ROOTPROG64) \ + $(ROOTCCSBINLINK) $(ROOTCCSBINLINK64) +$(ROOTBIN64)/elfdump: + $(RM) $@; $(SYMLINK) ../../bin/elfdump $@ diff --git a/usr/src/cmd/ttymon/tmchild.c b/usr/src/cmd/ttymon/tmchild.c index a58099974b..960a9a816c 100644 --- a/usr/src/cmd/ttymon/tmchild.c +++ b/usr/src/cmd/ttymon/tmchild.c @@ -99,7 +99,7 @@ tmchild(struct pmtab *pmtab) */ (void) setsid(); } - speedef = get_speed(pmtab->p_ttylabel); + speedef = get_speed(pmtab); openline(pmtab, speedef); if (pmtab->p_ttyflags & (C_FLAG|B_FLAG)) { if (pmtab->p_fd >= 0) { diff --git a/usr/src/cmd/ttymon/tmexpress.c b/usr/src/cmd/ttymon/tmexpress.c index 345fdd1529..2a3f91d147 100644 --- a/usr/src/cmd/ttymon/tmexpress.c +++ b/usr/src/cmd/ttymon/tmexpress.c @@ -34,7 +34,6 @@ #include <ctype.h> #include <string.h> #include <signal.h> -#include <sys/stat.h> #include <utmpx.h> #include <pwd.h> #include <dirent.h> @@ -42,6 +41,7 @@ #include <sys/acl.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/mkdev.h> #include <sys/console.h> #include <libdevinfo.h> #include "ttymon.h" @@ -143,6 +143,44 @@ ttymon_express(int argc, char **argv) } /* + * For serial device, return ttyX-mode property value. + */ +static char * +get_ttymode_prop(dev_t rconsdev) +{ + char *rootpath = "/"; + char path[MAXPATHLEN]; + di_node_t root; + char *propname, *v; + struct stat st; + + (void) snprintf(path, sizeof (path), "/dev/tty%c", + 'a' + minor(rconsdev)); + if (stat(path, &st) < 0) + return (NULL); + + if (st.st_rdev != rconsdev) + return (NULL); + + if (asprintf(&propname, "%s-mode", path + 5) <= 0) + return (NULL); + + root = di_init(rootpath, DINFOPROP); + if (root == DI_NODE_NIL) { + free(propname); + return (NULL); + } + + v = NULL; + if (di_prop_lookup_strings(DDI_DEV_T_ANY, root, propname, &v) > 0) + v = strdup(v); + + di_fini(root); + free(propname); + return (v); +} + +/* * parse_arg - parse cmd line arguments */ static int @@ -172,11 +210,13 @@ parse_args(int argc, char **argv, struct pmtab *pmtab) pmtab->p_termtype = ""; pmtab->p_device = ""; pmtab->p_status = GETTY; + pmtab->p_ttymode = NULL; if (strcmp(lastname(argv[0]), "getty") == 0) { pmtab->p_ttylabel = "300"; getty_options(argc, argv, pmtab); } else { int cn_fd; + struct cons_getdev cnd; pmtab->p_ttylabel = "9600"; ttymon_options(argc, argv, pmtab); @@ -200,6 +240,10 @@ parse_args(int argc, char **argv, struct pmtab *pmtab) if (ioctl(cn_fd, CONS_GETTERM, &cnterm) != -1) pmtab->p_termtype = cnterm.cn_term_type; + + if (ioctl(cn_fd, CONS_GETDEV, &cnd) != -1) + pmtab->p_ttymode = + get_ttymode_prop(cnd.cnd_rconsdev); (void) close(cn_fd); } } diff --git a/usr/src/cmd/ttymon/tmextern.h b/usr/src/cmd/ttymon/tmextern.h index b08c59f04d..955e5773ff 100644 --- a/usr/src/cmd/ttymon/tmextern.h +++ b/usr/src/cmd/ttymon/tmextern.h @@ -222,7 +222,7 @@ extern "C" { extern int Splflag; /* ttymon.c */ - extern struct Gdef *get_speed(char *); + extern struct Gdef *get_speed(struct pmtab *); extern void open_device(struct pmtab *); extern void set_softcar(struct pmtab *); extern void setup_PCpipe(void); diff --git a/usr/src/cmd/ttymon/tmstruct.h b/usr/src/cmd/ttymon/tmstruct.h index 288c1ec122..8c4582896a 100644 --- a/usr/src/cmd/ttymon/tmstruct.h +++ b/usr/src/cmd/ttymon/tmstruct.h @@ -74,6 +74,7 @@ struct pmtab { uid_t p_uid; /* uid of p_identity */ gid_t p_gid; /* gid of p_identity */ char *p_dir; /* home dir of p_identity */ + char *p_ttymode; /* mode line for serial device */ struct pmtab *p_next; }; diff --git a/usr/src/cmd/ttymon/tmterm.c b/usr/src/cmd/ttymon/tmterm.c index 96e63af2d3..613cf2597d 100644 --- a/usr/src/cmd/ttymon/tmterm.c +++ b/usr/src/cmd/ttymon/tmterm.c @@ -244,7 +244,7 @@ initial_termio(int fd, struct pmtab *pmptr) int ret; struct Gdef *speedef; - speedef = get_speed(pmptr->p_ttylabel); + speedef = get_speed(pmptr); if (speedef->g_autobaud & A_FLAG) { pmptr->p_ttyflags |= A_FLAG; if (auto_termio(fd) == -1) { diff --git a/usr/src/cmd/ttymon/ttymon.c b/usr/src/cmd/ttymon/ttymon.c index 03ff520059..0c061a9c8c 100644 --- a/usr/src/cmd/ttymon/ttymon.c +++ b/usr/src/cmd/ttymon/ttymon.c @@ -26,6 +26,7 @@ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ +#include <ctype.h> #include <stdio_ext.h> #include <stdlib.h> #include <fcntl.h> @@ -597,25 +598,106 @@ free_defs(void) } /* + * rebuild flags entry using speed from ttymode. + */ +static char * +merge_flags(char *src, char *ttymode) +{ + char *data, *ptr, *flags; + + /* copy speed entry */ + data = strsave(src); + flags = strsave(ttymode); + ptr = strchr(flags, ','); + if (ptr == NULL) { /* ttymode is corrupted */ + free(flags); + return (data); + } + *ptr = '\0'; + ptr = flags; + flags = strsave(flags); + free(ptr); + + /* + * The flags line is supposed to have stty keywords separated by space. + * We need to split up the keywords, replace the speed and + * reconstruct the flags line. + */ + + ptr = strtok(data, " \t"); + if (ptr == NULL) { + free(data); + return (flags); + } + + do { + char *tmp; + + /* skip speed */ + if (isdigit(*ptr)) + continue; + + if (asprintf(&tmp, "%s %s", flags, ptr) <= 0) { + /* should we complain? */ + break; + } + free(flags); + flags = tmp; + } while ((ptr = strtok(NULL, " \t")) != NULL); + + free(data); + return (flags); +} + +/* * struct Gdef *get_speed(ttylabel) * - search "/etc/ttydefs" for speed and term. specification * using "ttylabel". If "ttylabel" is NULL, default * to DEFAULT + * - for /dev/console, if we are in fact using serial console, + * use ttyX-mode value to get speed. This allows us to use + * the value set for serial console either from firmware (or BMC sol), + * or boot loader default. * arg: ttylabel - label/id of speed settings. */ struct Gdef * -get_speed(char *ttylabel) +get_speed(struct pmtab *pmptr) { + static struct Gdef serial = { 0 }; struct Gdef *sp; + char *ttylabel = pmptr->p_ttylabel; if ((ttylabel != NULL) && (*ttylabel != '\0')) { if ((sp = find_def(ttylabel)) == NULL) { log("unable to find <%s> in \"%s\"", ttylabel, TTYDEFS); sp = &DEFAULT; /* use default */ } - } else sp = &DEFAULT; /* use default */ - return (sp); + } else { + sp = &DEFAULT; /* use default */ + } + + /* + * if this is not /dev/console or /dev/console is not using serial, + * we are done. + */ + if (pmptr->p_ttymode == NULL || + strcmp(pmptr->p_device, "/dev/console") != 0) + return (sp); + + /* is entry for serial set up? */ + if (serial.g_id == NULL) { + /* + * Copy data from sp, except we need to update inital and + * final flags. + */ + serial.g_id = strsave(sp->g_id); + serial.g_iflags = merge_flags(sp->g_iflags, pmptr->p_ttymode); + serial.g_fflags = merge_flags(sp->g_fflags, pmptr->p_ttymode); + serial.g_autobaud = sp->g_autobaud; + serial.g_nextid = strsave(sp->g_nextid); + } + return (&serial); } /* |