summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/Makefile.master1
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/sys/boot/common/tem.c18
-rw-r--r--usr/src/boot/sys/sys/tem_impl.h6
-rw-r--r--usr/src/cmd/acpi/iasl/aslcompiler.l3
-rw-r--r--usr/src/cmd/acpi/iasl/dtparser.l2
-rw-r--r--usr/src/cmd/acpi/iasl/prparser.l2
-rw-r--r--usr/src/cmd/ast/libast/mapfile-vers1
-rw-r--r--usr/src/cmd/backup/dump/dump.h160
-rw-r--r--usr/src/cmd/backup/dump/dumpitime.c81
-rw-r--r--usr/src/cmd/backup/dump/dumpmain.c39
-rw-r--r--usr/src/cmd/backup/dump/dumponline.c62
-rw-r--r--usr/src/cmd/backup/dump/dumpoptr.c48
-rw-r--r--usr/src/cmd/backup/dump/dumptape.c174
-rw-r--r--usr/src/cmd/backup/dump/dumptraverse.c89
-rw-r--r--usr/src/cmd/backup/dump/partial.c48
-rw-r--r--usr/src/cmd/backup/restore/dirs.c2
-rw-r--r--usr/src/cmd/backup/restore/restore.h2
-rw-r--r--usr/src/cmd/backup/restore/tape.c9
-rw-r--r--usr/src/cmd/bnu/conn.c6
-rw-r--r--usr/src/cmd/bnu/ct.c2
-rw-r--r--usr/src/cmd/bnu/cu.c3
-rw-r--r--usr/src/cmd/bnu/pkdefs.c4
-rw-r--r--usr/src/cmd/bnu/uucico.c1
-rw-r--r--usr/src/cmd/cdrw/mmc.c12
-rw-r--r--usr/src/cmd/cdrw/mmc.h6
-rw-r--r--usr/src/cmd/cdrw/transport.h4
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/ftp/ftp.c396
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/ftp/ftp_var.h177
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/ftp/main.c85
-rw-r--r--usr/src/cmd/csh/sh.c18
-rw-r--r--usr/src/cmd/csh/sh.char.c3
-rw-r--r--usr/src/cmd/csh/sh.char.h4
-rw-r--r--usr/src/cmd/csh/sh.dir.c8
-rw-r--r--usr/src/cmd/csh/sh.dir.h6
-rw-r--r--usr/src/cmd/csh/sh.dol.c15
-rw-r--r--usr/src/cmd/csh/sh.err.c46
-rw-r--r--usr/src/cmd/csh/sh.exec.c15
-rw-r--r--usr/src/cmd/csh/sh.exp.c10
-rw-r--r--usr/src/cmd/csh/sh.func.c15
-rw-r--r--usr/src/cmd/csh/sh.glob.c15
-rw-r--r--usr/src/cmd/csh/sh.h156
-rw-r--r--usr/src/cmd/csh/sh.hist.c5
-rw-r--r--usr/src/cmd/csh/sh.lex.c13
-rw-r--r--usr/src/cmd/csh/sh.parse.c8
-rw-r--r--usr/src/cmd/csh/sh.proc.c12
-rw-r--r--usr/src/cmd/csh/sh.proc.h13
-rw-r--r--usr/src/cmd/csh/sh.set.c3
-rw-r--r--usr/src/cmd/csh/sh.tchar.c3
-rw-r--r--usr/src/cmd/csh/sh.time.c5
-rw-r--r--usr/src/cmd/format/ctlr_ata.c25
-rw-r--r--usr/src/cmd/format/ctlr_ata.h29
-rw-r--r--usr/src/cmd/format/global.h94
-rw-r--r--usr/src/cmd/format/main.c30
-rw-r--r--usr/src/cmd/format/menu_command.c1
-rw-r--r--usr/src/cmd/format/menu_fdisk.c2
-rw-r--r--usr/src/cmd/format/startup.c74
-rw-r--r--usr/src/cmd/geniconvtbl/Makefile6
-rw-r--r--usr/src/cmd/geniconvtbl/Makefile.com152
-rw-r--r--usr/src/cmd/geniconvtbl/amd64/Makefile18
-rw-r--r--usr/src/cmd/geniconvtbl/i386/Makefile14
-rw-r--r--usr/src/cmd/geniconvtbl/itmcomp.c137
-rw-r--r--usr/src/cmd/geniconvtbl/samples/Makefile24
-rw-r--r--usr/src/cmd/geniconvtbl/sparc/Makefile11
-rw-r--r--usr/src/cmd/geniconvtbl/sparcv9/Makefile19
-rw-r--r--usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c28
-rw-r--r--usr/src/cmd/mdb/common/kmdb/kmdb_module_load.c4
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_cmds.c7
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_ctf.c2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_fmt.c3
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_kvm.c2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_nm.c2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_print.c2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_proc.c2
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_target.c2
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/genunix.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/kmem.c2
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/lgrp.c8
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/net.c9
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/typegraph.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/ipp/ipp.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/libumem/umem.c2
-rw-r--r--usr/src/cmd/mdb/common/modules/pmcs/pmcs.c16
-rw-r--r--usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c56
-rw-r--r--usr/src/cmd/mdb/tools/common/findscn.c2
-rw-r--r--usr/src/cmd/mdb/tools/common/util.h6
-rw-r--r--usr/src/cmd/sgs/error/common/error.h10
-rw-r--r--usr/src/cmd/sgs/error/common/errorfilter.c2
-rw-r--r--usr/src/cmd/sgs/error/common/errorinput.c3
-rw-r--r--usr/src/cmd/sgs/error/common/errormain.c8
-rw-r--r--usr/src/cmd/sgs/error/common/errortouch.c1
-rw-r--r--usr/src/cmd/sgs/gprof/common/arcs.c31
-rw-r--r--usr/src/cmd/sgs/gprof/common/gprof.c42
-rw-r--r--usr/src/cmd/sgs/gprof/common/gprof.h90
-rw-r--r--usr/src/cmd/sgs/gprof/common/printgprof.c4
-rw-r--r--usr/src/cmd/vi/port/ex.h15
-rw-r--r--usr/src/cmd/vi/port/ex_subr.c13
-rw-r--r--usr/src/contrib/ast/src/cmd/ksh93/sh/parse.c2
-rw-r--r--usr/src/head/protocols/dumprestore.h2
-rw-r--r--usr/src/lib/iconv_modules/utf-8/Makefile1
-rw-r--r--usr/src/lib/libc/i386/sys/door.s10
-rw-r--r--usr/src/lib/libcrypt/common/mapfile-vers1
-rw-r--r--usr/src/lib/libcurses/screen/mapfile-vers1
-rw-r--r--usr/src/lib/libeti/form/common/mapfile-vers1
-rw-r--r--usr/src/lib/libeti/form/common/regcmp.c18
-rw-r--r--usr/src/lib/libeti/form/common/regex.c6
-rw-r--r--usr/src/lib/libeti/menu/common/mapfile-vers1
-rw-r--r--usr/src/lib/libeti/panel/common/mapfile-vers1
-rw-r--r--usr/src/lib/libmp/common/mapfile_1-vers1
-rw-r--r--usr/src/lib/libnisdb/nis_ldap.c12
-rw-r--r--usr/src/lib/libnisdb/nis_parse_ldap_conf.c23
-rw-r--r--usr/src/lib/libnls/common/mapfile-vers1
-rw-r--r--usr/src/lib/pkcs11/pkcs11_tpm/common/loadsave.c4
-rw-r--r--usr/src/pkg/manifests/system-test-ostest.mf4
-rw-r--r--usr/src/test/os-tests/runfiles/default.run4
-rw-r--r--usr/src/test/os-tests/tests/Makefile2
-rw-r--r--usr/src/test/os-tests/tests/stackalign/Makefile78
-rw-r--r--usr/src/test/os-tests/tests/stackalign/stack_amd64.s69
-rw-r--r--usr/src/test/os-tests/tests/stackalign/stack_i386.s75
-rw-r--r--usr/src/test/os-tests/tests/stackalign/stackalign.c170
-rw-r--r--usr/src/tools/Makefile111
-rw-r--r--usr/src/tools/cpcgen/cpcgen.c3
-rw-r--r--usr/src/tools/geniconvtbl/Makefile (renamed from usr/src/cmd/geniconvtbl/native/Makefile)27
-rw-r--r--usr/src/uts/common/fs/doorfs/door_sys.c14
-rw-r--r--usr/src/uts/common/io/tem.c8
-rw-r--r--usr/src/uts/common/io/tem_safe.c10
-rw-r--r--usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h2
-rw-r--r--usr/src/uts/common/sys/tem_impl.h6
-rw-r--r--usr/src/uts/intel/ia32/os/fpu.c48
129 files changed, 1920 insertions, 1636 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 83c75b86be..8e29d75030 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -235,6 +235,7 @@ TIC= $(ONBLD_TOOLS)/bin/$(MACH)/tic
ZIC= $(ONBLD_TOOLS)/bin/$(MACH)/zic
OPENSSL= /usr/bin/openssl
CPCGEN= $(ONBLD_TOOLS)/bin/$(MACH)/cpcgen
+GENICONVTBL= $(ONBLD_TOOLS)/bin/$(MACH)/geniconvtbl
DEFAULT_CONSOLE_COLOR= \
-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_WHITE \
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index fc79093fee..32d625d23a 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -34,4 +34,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2021.02.13.1
+BOOT_VERSION = $(LOADER_VERSION)-2021.03.07.1
diff --git a/usr/src/boot/sys/boot/common/tem.c b/usr/src/boot/sys/boot/common/tem.c
index ebb3ae48f8..0ceb83c72a 100644
--- a/usr/src/boot/sys/boot/common/tem.c
+++ b/usr/src/boot/sys/boot/common/tem.c
@@ -214,6 +214,11 @@ tem_internal_init(struct tem_vt_state *ptem,
if (ptem->tvs_outbuf == NULL)
panic("out of memory in tem_internal_init()\n");
+ ptem->tvs_maxtab = width / 8;
+ ptem->tvs_tabs = calloc(ptem->tvs_maxtab, sizeof (*ptem->tvs_tabs));
+ if (ptem->tvs_tabs == NULL)
+ panic("out of memory in tem_internal_init()\n");
+
tem_reset_display(ptem, clear_screen, init_color);
ptem->tvs_utf8_left = 0;
@@ -294,6 +299,9 @@ tem_free_buf(struct tem_vt_state *tem)
free(tem->tvs_screen_buf);
tem->tvs_screen_buf = NULL;
+
+ free(tem->tvs_tabs);
+ tem->tvs_tabs = NULL;
}
static int
@@ -2399,7 +2407,7 @@ tem_back_tab(struct tem_vt_state *tem)
static void
tem_tab(struct tem_vt_state *tem)
{
- int i;
+ size_t i;
screen_pos_t tabstop;
tabstop = tems.ts_c_dimension.width - 1;
@@ -2417,10 +2425,9 @@ tem_tab(struct tem_vt_state *tem)
static void
tem_set_tab(struct tem_vt_state *tem)
{
- int i;
- int j;
+ size_t i, j;
- if (tem->tvs_ntabs == TEM_MAXTAB)
+ if (tem->tvs_ntabs == tem->tvs_maxtab)
return;
if (tem->tvs_ntabs == 0 ||
tem->tvs_tabs[tem->tvs_ntabs] < tem->tvs_c_cursor.col) {
@@ -2443,8 +2450,7 @@ tem_set_tab(struct tem_vt_state *tem)
static void
tem_clear_tabs(struct tem_vt_state *tem, int action)
{
- int i;
- int j;
+ size_t i, j;
switch (action) {
case 3: /* clear all tabs */
diff --git a/usr/src/boot/sys/sys/tem_impl.h b/usr/src/boot/sys/sys/tem_impl.h
index 6764475695..2afcb5df0a 100644
--- a/usr/src/boot/sys/sys/tem_impl.h
+++ b/usr/src/boot/sys/sys/tem_impl.h
@@ -66,7 +66,6 @@ typedef uint32_t tem_char_t; /* 32bit char to support UTF-8 */
#define TEM_ATTR_ISSET(c, a) ((TEM_CHAR_ATTR(c) & (a)) == (a))
#define TEM_MAXPARAMS 5 /* maximum number of ANSI paramters */
-#define TEM_MAXTAB 40 /* maximum number of tab stops */
#define TEM_MAXFKEY 30 /* max length of function key with <ESC>Q */
#define MAX_TEM 2 /* max number of loadable terminal emulators */
@@ -172,8 +171,9 @@ struct tem_vt_state {
int tvs_curparam; /* current param # of output esc seq */
int tvs_paramval; /* value of current param */
int tvs_params[TEM_MAXPARAMS]; /* parameters of output esc seq */
- screen_pos_t tvs_tabs[TEM_MAXTAB]; /* tab stops */
- int tvs_ntabs; /* number of tabs used */
+ screen_pos_t *tvs_tabs; /* tab stops */
+ size_t tvs_maxtab; /* maximum number of tab stops */
+ size_t tvs_ntabs; /* number of tabs used */
int tvs_nscroll; /* number of lines to scroll */
struct tem_char_pos tvs_s_cursor; /* start cursor position */
diff --git a/usr/src/cmd/acpi/iasl/aslcompiler.l b/usr/src/cmd/acpi/iasl/aslcompiler.l
index 88c0617ba0..942fd815a3 100644
--- a/usr/src/cmd/acpi/iasl/aslcompiler.l
+++ b/usr/src/cmd/acpi/iasl/aslcompiler.l
@@ -156,7 +156,8 @@
#include <stdlib.h>
#include <string.h>
-YYSTYPE AslCompilerlval;
+
+extern YYSTYPE AslCompilerlval;
/*
* Generation: Use the following command line:
diff --git a/usr/src/cmd/acpi/iasl/dtparser.l b/usr/src/cmd/acpi/iasl/dtparser.l
index fae32dba8a..077f47ac38 100644
--- a/usr/src/cmd/acpi/iasl/dtparser.l
+++ b/usr/src/cmd/acpi/iasl/dtparser.l
@@ -208,7 +208,7 @@ NewLine [\n]
/*
* Local support functions
*/
-YY_BUFFER_STATE LexBuffer;
+static YY_BUFFER_STATE LexBuffer;
/******************************************************************************
*
diff --git a/usr/src/cmd/acpi/iasl/prparser.l b/usr/src/cmd/acpi/iasl/prparser.l
index 8940197b7c..d3e46d9f60 100644
--- a/usr/src/cmd/acpi/iasl/prparser.l
+++ b/usr/src/cmd/acpi/iasl/prparser.l
@@ -224,7 +224,7 @@ Identifier [a-zA-Z][0-9a-zA-Z]*
/*
* Local support functions
*/
-YY_BUFFER_STATE LexBuffer;
+static YY_BUFFER_STATE LexBuffer;
/******************************************************************************
diff --git a/usr/src/cmd/ast/libast/mapfile-vers b/usr/src/cmd/ast/libast/mapfile-vers
index 305122da93..d790b19b43 100644
--- a/usr/src/cmd/ast/libast/mapfile-vers
+++ b/usr/src/cmd/ast/libast/mapfile-vers
@@ -353,7 +353,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
_hash_info_;
_iblocks;
_init;
- _lib_version;
_mode_permmap_;
_mode_table_;
_opt_info_;
diff --git a/usr/src/cmd/backup/dump/dump.h b/usr/src/cmd/backup/dump/dump.h
index 3c8703206d..ea56a8e022 100644
--- a/usr/src/cmd/backup/dump/dump.h
+++ b/usr/src/cmd/backup/dump/dump.h
@@ -93,89 +93,89 @@ extern "C" {
#define BIC(i, w) (MWORD(w, i) &= ~MBIT(i))
#define BIT(i, w) (MWORD(w, i) & MBIT(i))
-uint_t msiz;
-uchar_t *clrmap;
-uchar_t *dirmap;
-uchar_t *filmap;
-uchar_t *nodmap;
-uchar_t *shamap;
-uchar_t *activemap;
+extern uint_t msiz;
+extern uchar_t *clrmap;
+extern uchar_t *dirmap;
+extern uchar_t *filmap;
+extern uchar_t *nodmap;
+extern uchar_t *shamap;
+extern uchar_t *activemap;
/*
* All calculations done in 0.1" units!
*/
-char *disk; /* name of the disk file */
-char *dname; /* name to put in /etc/dumpdates */
-int disk_dynamic; /* true if disk refers to dynamic storage */
-char *tape; /* name of the tape file */
-char *host; /* name of the remote tape host (may be "user@host") */
-char *dumpdev; /* hostname:device for current volume */
-char *sdumpdev; /* short form of dumpdev (no user name if remote) */
-char *increm; /* name of file containing incremental information */
-char *filesystem; /* name of the file system */
-char *myname; /* argv[0] without leading path components */
-char lastincno; /* increment number of previous dump */
-char incno; /* increment number */
-char *tlabel; /* what goes in tape header c_label field */
-int uflag; /* update flag */
-int fi; /* disk file descriptor */
-int to; /* tape file descriptor */
-int mapfd; /* block disk device descriptor for mmap */
-int pipeout; /* true => output to standard output */
-int tapeout; /* true => output to a tape drive */
-ino_t ino; /* current inumber; used globally */
-off_t pos; /* starting offset within ino; used globally */
-int leftover; /* number of tape recs left over from prev vol */
-int nsubdir; /* counts subdirs, for deciding to dump a dir */
-int newtape; /* new tape flag */
-int nadded; /* number of added sub directories */
-int dadded; /* directory added flag */
-int density; /* density in 0.1" units */
-ulong_t tsize; /* tape size in 0.1" units */
-u_offset_t esize; /* estimated tape size, blocks */
-u_offset_t o_esize; /* number of header blocks (overhead) */
-u_offset_t f_esize; /* number of TP_BSIZE blocks for files/maps */
-uint_t etapes; /* estimated number of tapes */
-uint_t ntrec; /* 1K records per tape block */
-int tenthsperirg; /* 1/10" per tape inter-record gap */
-dev_t partial_dev; /* id of BLOCK device used in partial mode */
-pid_t dumppid; /* process-ID of top-level process */
-
-int verify; /* verify each volume */
-int doingverify; /* true => doing a verify pass */
-int active; /* recopy active files */
-int doingactive; /* true => redumping active files */
-int archive; /* true => saving a archive in archivefile */
-char *archivefile; /* name of archivefile */
-int archive_opened; /* have opened/created the archivefile */
-int notify; /* notify operator flag */
-int diskette; /* true if dumping to a diskette */
-int cartridge; /* true if dumping to a cartridge tape */
-uint_t tracks; /* number of tracks on a cartridge tape */
-int printsize; /* just print estimated size and exit */
-int offline; /* take tape offline after rewinding */
-int autoload; /* wait for next tape to autoload; implies offline */
-int autoload_tries; /* number of times to check on autoload */
-int autoload_period; /* seconds, tries*period = total wait time */
-int doposition; /* move to specified... */
-daddr32_t filenum; /* position of dump on 1st volume */
-int dumpstate; /* dump output state (see below) */
-int dumptoarchive; /* mark records to be archived */
-
-int blockswritten; /* number of blocks written on current tape */
-uint_t tapeno; /* current tape number */
-
-struct fs *sblock; /* the file system super block */
-int shortmeta; /* current file has small amount of metadata */
-union u_shadow c_shadow_save[1];
-
-time_t *telapsed; /* time spent writing previous tapes */
-time_t *tstart_writing; /* when we started writing the latest tape */
-time_t *tschedule; /* when next to give a remaining-time estimate */
-
-char *debug_chdir; /* non-NULL means to mkdir this/pid, and chdir there, */
- /* once for each separate child */
+extern char *disk; /* name of the disk file */
+extern char *dname; /* name to put in /etc/dumpdates */
+extern int disk_dynamic; /* true if disk refers to dynamic storage */
+extern char *tape; /* name of the tape file */
+extern char *host; /* name of the remote tape host (may be "user@host") */
+extern char *dumpdev; /* hostname:device for current volume */
+extern char *sdumpdev; /* short form of dumpdev (no user name if remote) */
+extern char *increm; /* name of file containing incremental information */
+extern char *filesystem; /* name of the file system */
+extern char *myname; /* argv[0] without leading path components */
+extern char lastincno; /* increment number of previous dump */
+extern char incno; /* increment number */
+extern char *tlabel; /* what goes in tape header c_label field */
+extern int uflag; /* update flag */
+extern int fi; /* disk file descriptor */
+extern int to; /* tape file descriptor */
+extern int mapfd; /* block disk device descriptor for mmap */
+extern int pipeout; /* true => output to standard output */
+extern int tapeout; /* true => output to a tape drive */
+extern ino_t ino; /* current inumber; used globally */
+extern off_t pos; /* starting offset within ino; used globally */
+extern int leftover; /* number of tape recs left over from prev vol */
+extern int nsubdir; /* counts subdirs, for deciding to dump a dir */
+extern int newtape; /* new tape flag */
+extern int nadded; /* number of added sub directories */
+extern int dadded; /* directory added flag */
+extern int density; /* density in 0.1" units */
+extern ulong_t tsize; /* tape size in 0.1" units */
+extern u_offset_t esize; /* estimated tape size, blocks */
+extern u_offset_t o_esize; /* number of header blocks (overhead) */
+extern u_offset_t f_esize; /* number of TP_BSIZE blocks for files/maps */
+extern uint_t etapes; /* estimated number of tapes */
+extern uint_t ntrec; /* 1K records per tape block */
+extern int tenthsperirg; /* 1/10" per tape inter-record gap */
+extern dev_t partial_dev; /* id of BLOCK device used in partial mode */
+extern pid_t dumppid; /* process-ID of top-level process */
+
+extern int verify; /* verify each volume */
+extern int doingverify; /* true => doing a verify pass */
+extern int active; /* recopy active files */
+extern int doingactive; /* true => redumping active files */
+extern int archive; /* true => saving a archive in archivefile */
+extern char *archivefile; /* name of archivefile */
+extern int archive_opened; /* have opened/created the archivefile */
+extern int notify; /* notify operator flag */
+extern int diskette; /* true if dumping to a diskette */
+extern int cartridge; /* true if dumping to a cartridge tape */
+extern uint_t tracks; /* number of tracks on a cartridge tape */
+extern int printsize; /* just print estimated size and exit */
+extern int offline; /* take tape offline after rewinding */
+extern int autoload; /* wait for next tape to autoload; implies offline */
+extern int autoload_tries; /* number of times to check on autoload */
+extern int autoload_period; /* seconds, tries*period = total wait time */
+extern int doposition; /* move to specified... */
+extern daddr32_t filenum; /* position of dump on 1st volume */
+extern int dumpstate; /* dump output state (see below) */
+extern int dumptoarchive; /* mark records to be archived */
+
+extern int blockswritten; /* number of blocks written on current tape */
+extern uint_t tapeno; /* current tape number */
+
+extern struct fs *sblock; /* the file system super block */
+extern int shortmeta; /* current file has small amount of metadata */
+extern union u_shadow c_shadow_save[1];
+
+extern time_t *telapsed; /* time spent writing previous tapes */
+extern time_t *tstart_writing; /* when we started writing the latest tape */
+extern time_t *tschedule; /* when next to give a remaining-time estimate */
+
+extern char *debug_chdir; /* non-NULL means to mkdir this/pid, */
+ /* and chdir there, once for each separate child */
/*
* Defines for the msec part of
@@ -232,8 +232,8 @@ struct idates {
time32_t id_ddate;
};
-size_t nidates; /* number of records (might be zero) */
-struct idates **idatev; /* the arrayfied version */
+extern size_t nidates; /* number of records (might be zero) */
+extern struct idates **idatev; /* the arrayfied version */
#define ITITERATE(i, ip) \
for (i = 0; i < nidates && (ip = idatev[i]) != NULL; i++)
diff --git a/usr/src/cmd/backup/dump/dumpitime.c b/usr/src/cmd/backup/dump/dumpitime.c
index 41ba0e0d16..e5f4b32441 100644
--- a/usr/src/cmd/backup/dump/dumpitime.c
+++ b/usr/src/cmd/backup/dump/dumpitime.c
@@ -12,18 +12,27 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dump.h"
#ifndef LOCK_EX
-static struct flock fl;
+static struct flock fl;
#define flock(fd, flag) (fl.l_type = (flag), fcntl(fd, F_SETLKW, &fl))
#define LOCK_EX F_WRLCK
#define LOCK_SH F_RDLCK
#define LOCK_UN F_UNLCK
#endif
+char *disk;
+char *dname;
+char *increm;
+
+char incno;
+char lastincno;
+int uflag;
+uint_t msiz;
+u_offset_t o_esize;
+u_offset_t f_esize;
+
/*
* Print a date. A date of 0 is the beginning of time (the "epoch").
* If the 2nd argument is non-zero, it is ok to format the date in
@@ -32,8 +41,7 @@ static struct flock fl;
* locale-independent.
*/
char *
-prdate(d)
- time_t d;
+prdate(time_t d)
{
static char buf[256];
struct tm *tm;
@@ -71,11 +79,7 @@ static int makeidate();
#endif
void
-#ifdef __STDC__
inititimes(void)
-#else
-inititimes()
-#endif
{
FILE *df;
int saverr;
@@ -98,10 +102,10 @@ inititimes()
if (errno == ENOENT)
msg(gettext(
"Warning - dump record file `%s' does not exist\n"),
- increm);
+ increm);
else {
msg(gettext("Cannot open dump record file `%s': %s\n"),
- increm, strerror(saverr));
+ increm, strerror(saverr));
dumpabort();
/*NOTREACHED*/
}
@@ -119,8 +123,7 @@ inititimes()
}
static void
-readitimes(df)
- FILE *df;
+readitimes(FILE *df)
{
struct idates *idp;
@@ -141,11 +144,7 @@ readitimes(df)
}
void
-#ifdef __STDC__
getitime(void)
-#else
-getitime()
-#endif
{
struct idates *ip;
int i;
@@ -164,7 +163,7 @@ getitime()
/* XGETTEXT: #ifdef FDEBUG only */
msg(gettext("Looking for name %s in increm = %s for delta = %c\n"),
- fname, increm, (uchar_t)incno);
+ fname, increm, (uchar_t)incno);
#endif
spcl.c_ddate = 0;
lastincno = '0';
@@ -189,11 +188,7 @@ getitime()
}
void
-#ifdef __STDC__
putitime(void)
-#else
-putitime()
-#endif
{
FILE *df;
struct idates *itwalk;
@@ -232,7 +227,7 @@ putitime()
if (fseek(df, 0L, 0) < 0) { /* rewind() was redefined in dumptape.c */
saverr = errno;
msg(gettext("%s: %s error:\n"),
- increm, "fseek", strerror(saverr));
+ increm, "fseek", strerror(saverr));
dumpabort();
/*NOTREACHED*/
}
@@ -240,7 +235,7 @@ putitime()
/* LINTED: won't dereference idatev if it is NULL (see readitimes) */
ITITERATE(i, itwalk) {
if (strncmp(fname, itwalk->id_name,
- sizeof (itwalk->id_name)) != 0)
+ sizeof (itwalk->id_name)) != 0)
continue;
if (itwalk->id_incno != incno)
continue;
@@ -251,7 +246,7 @@ putitime()
*/
nidates++;
idatev = (struct idates **)xrealloc((void *)idatev,
- nidates * (size_t)sizeof (struct idates *));
+ nidates * (size_t)sizeof (struct idates *));
itwalk = idatev[nidates - 1] =
(struct idates *)xcalloc(1, sizeof (*itwalk));
found:
@@ -276,22 +271,16 @@ found:
}
static void
-recout(file, what)
- FILE *file;
- struct idates *what;
+recout(FILE *file, struct idates *what)
{
time_t ddate = what->id_ddate;
/* must use ctime, so we can later use unctime() */
- (void) fprintf(file, DUMPOUTFMT,
- what->id_name,
- (uchar_t)what->id_incno,
- ctime(&ddate));
+ (void) fprintf(file, DUMPOUTFMT, what->id_name,
+ (uchar_t)what->id_incno, ctime(&ddate));
}
static int
-getrecord(df, idatep)
- FILE *df;
- struct idates *idatep;
+getrecord(FILE *df, struct idates *idatep)
{
char buf[BUFSIZ];
@@ -301,7 +290,7 @@ getrecord(df, idatep)
if (makeidate(idatep, buf) < 0) {
msg(gettext(
"Malformed entry in dump record file `%s', line %d\n"),
- increm, recno);
+ increm, recno);
if (strcmp(increm, NINCREM)) {
msg(gettext("`%s' not a dump record file\n"), increm);
dumpabort();
@@ -312,17 +301,15 @@ getrecord(df, idatep)
#ifdef FDEBUG
msg("getrecord: %s %c %s\n",
- idatep->id_name,
- (uchar_t)idatep->id_incno,
- prdate(idatep->id_ddate));
+ idatep->id_name,
+ (uchar_t)idatep->id_incno,
+ prdate(idatep->id_ddate));
#endif
return (0);
}
static int
-makeidate(ip, buf)
- struct idates *ip;
- char *buf;
+makeidate(struct idates *ip, char *buf)
{
char un_buf[128]; /* size must be >= second one in DUMPINFMT */
@@ -354,8 +341,7 @@ makeidate(ip, buf)
* hence the estimate may be high.
*/
void
-est(ip)
- struct dinode *ip;
+est(struct dinode *ip)
{
u_offset_t s, t;
@@ -382,16 +368,15 @@ est(ip)
/* calculate the number of indirect blocks on the dump tape */
/* LINTED: spurious complaint sign-extending 32 to 64 bits */
s += d_howmany(t -
- (unsigned)(NDADDR * sblock->fs_bsize / tp_bsize),
- (unsigned)TP_NINDIR);
+ (unsigned)(NDADDR * sblock->fs_bsize / tp_bsize),
+ (unsigned)TP_NINDIR);
}
f_esize += s;
}
/*ARGSUSED*/
void
-bmapest(map)
- uchar_t *map;
+bmapest(uchar_t *map)
{
o_esize++;
/* LINTED: spurious complaint sign-extending 32 to 64 bits */
diff --git a/usr/src/cmd/backup/dump/dumpmain.c b/usr/src/cmd/backup/dump/dumpmain.c
index b7bb15a963..1d256e298b 100644
--- a/usr/src/cmd/backup/dump/dumpmain.c
+++ b/usr/src/cmd/backup/dump/dumpmain.c
@@ -41,6 +41,45 @@
#include "roll_log.h"
#include <unistd.h>
+char *filesystem;
+char *host;
+char *debug_chdir;
+char *dumpdev;
+char *sdumpdev;
+char *tlabel;
+time_t *telapsed;
+time_t *tstart_writing;
+
+uchar_t *clrmap;
+uchar_t *dirmap;
+uchar_t *filmap;
+uchar_t *nodmap;
+uchar_t *shamap;
+uchar_t *activemap;
+
+int archive;
+int autoload;
+int autoload_period;
+int autoload_tries;
+int archive_opened;
+int doingverify;
+int disk_dynamic;
+int dumpstate;
+int dumptoarchive;
+int fi;
+int leftover;
+int nadded;
+int offline;
+int verify;
+
+uint_t etapes;
+ulong_t tsize;
+ino_t ino;
+off_t pos;
+pid_t dumppid;
+u_offset_t esize;
+union u_shadow c_shadow_save[1];
+
int notify = 0; /* notify operator flag */
int blockswritten = 0; /* number of blocks written on current tape */
uint_t tapeno = 0; /* current tape number */
diff --git a/usr/src/cmd/backup/dump/dumponline.c b/usr/src/cmd/backup/dump/dumponline.c
index 5f5155e721..0928318120 100644
--- a/usr/src/cmd/backup/dump/dumponline.c
+++ b/usr/src/cmd/backup/dump/dumponline.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dump.h"
#include <math.h>
#include <limits.h>
@@ -41,6 +39,19 @@ struct inodesc {
struct inodesc *id_next; /* next on linked list */
};
+char *archivefile;
+char *tape;
+
+int active;
+int doingactive;
+int doposition;
+int pipeout;
+int tapeout;
+int to;
+
+struct fs *sblock;
+union u_spcl u_spcl;
+
static struct inodesc ilist; /* list of used inodesc structs */
static struct inodesc *last; /* last inodesc init'd or matched */
static struct inodesc *freeinodesc; /* free list of inodesc structs */
@@ -56,11 +67,7 @@ static jmp_buf truncate_buf;
static void (*savebus)();
static int incopy;
-#ifdef __STDC__
static void onsigbus(int);
-#else
-static void onsigbus();
-#endif
#endif /* ENABLE_MMAP */
@@ -70,8 +77,7 @@ extern int xflag;
#ifdef ENABLE_MMAP /* XXX part of mmap support */
static void
-onsigbus(sig)
- int sig;
+onsigbus(int sig)
{
if (!incopy) {
dumpabort();
@@ -84,11 +90,7 @@ onsigbus(sig)
#endif /* ENABLE_MMAP */
void
-#ifdef __STDC__
allocino(void)
-#else
-allocino()
-#endif
{
ino_t maxino;
size_t nused;
@@ -116,11 +118,7 @@ allocino()
}
void
-#ifdef __STDC__
freeino(void)
-#else
-freeino()
-#endif
{
int i;
@@ -134,8 +132,7 @@ freeino()
}
void
-resetino(ino)
- ino_t ino;
+resetino(ino_t ino)
{
last = ilist.id_next;
while (last && last->id_inumber < ino)
@@ -143,8 +140,7 @@ resetino(ino)
}
char *
-unrawname(cp)
- char *cp;
+unrawname(char *cp)
{
char *dp;
extern char *getfullblkname();
@@ -168,9 +164,7 @@ unrawname(cp)
* 0 if not mounted, -1 on error.
*/
int
-lf_ismounted(devname, dirname)
- char *devname; /* name of device (raw or block) */
- char *dirname; /* name of f/s mount point */
+lf_ismounted(char *devname, char *dirname)
{
struct stat64 st;
char *blockname; /* name of block device */
@@ -218,11 +212,7 @@ static size_t mapsize; /* amount of mapped data */
* constraints.
*/
caddr_t
-mapfile(fd, offset, bytes, fetch)
- int fd;
- off_t offset; /* offset within file */
- off_t bytes; /* number of bytes to map */
- int fetch; /* start faulting in pages */
+mapfile(int fd, off_t offset, off_t bytes, int fetch)
{
/*LINTED [c used during pre-fetch faulting]*/
volatile char c, *p;
@@ -257,7 +247,7 @@ mapfile(fd, offset, bytes, fetch)
if (mapbase == (caddr_t)-1) {
saverr = errno;
msg(gettext("Cannot map file at inode `%lu' into memory: %s\n"),
- ino, strerror(saverr));
+ ino, strerror(saverr));
/* XXX why not call dumpailing() here? */
if (!query(gettext(
"Do you want to attempt to continue? (\"yes\" or \"no\") "))) {
@@ -293,18 +283,14 @@ mapfile(fd, offset, bytes, fetch)
else
/* XGETTEXT: #ifdef DEBUG only */
msg(gettext(
- "FILE TRUNCATED (fault): Interrupting pre-fetch\n"));
+ "FILE TRUNCATED (fault): Interrupting pre-fetch\n"));
#endif
(void) signal(SIGBUS, savebus);
return (mapstart);
}
void
-#ifdef __STDC__
unmapfile(void)
-#else
-unmapfile()
-#endif
{
if (mapbase) {
/* XXX we're unmapping it, so what does this gain us? */
@@ -316,11 +302,7 @@ unmapfile()
#endif /* ENABLE_MMAP */
void
-#ifdef __STDC__
activepass(void)
-#else
-activepass()
-#endif
{
static int passno = 1; /* active file pass number */
char *ext, *old;
@@ -374,8 +356,8 @@ activepass()
* Be nice and switch volumes.
*/
(void) snprintf(buf, sizeof (buf), gettext(
- "Warning - cannot dump active files to rewind device `%s'\n"),
- tape);
+ "Warning - cannot dump active files to rewind "
+ "device `%s'\n"), tape);
msg(buf);
close_rewind();
changevol();
diff --git a/usr/src/cmd/backup/dump/dumpoptr.c b/usr/src/cmd/backup/dump/dumpoptr.c
index dfab108605..631a494993 100644
--- a/usr/src/cmd/backup/dump/dumpoptr.c
+++ b/usr/src/cmd/backup/dump/dumpoptr.c
@@ -12,21 +12,15 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <errno.h>
#include "dump.h"
+time_t *tschedule;
static unsigned int timeout; /* current timeout */
static char *attnmessage, *saveattn; /* attention message */
-#ifdef __STDC__
static void alarmcatch();
static int idatesort(const void *, const void *);
-#else /* !__STDC__ */
-static void alarmcatch();
-static int idatesort();
-#endif
#ifdef DEBUG
extern int xflag;
@@ -44,8 +38,7 @@ extern int xflag;
* that dump needs attention.
*/
int
-query(question)
- char *question;
+query(char *question)
{
int def = -1;
@@ -59,8 +52,7 @@ static jmp_buf sjalarmbuf;
/* real simple check-sum */
static int
-addem(s)
- char *s;
+addem(char *s)
{
int total = 0;
@@ -72,9 +64,7 @@ addem(s)
}
int
-query_once(question, def)
- char *question;
- int def;
+query_once(char *question, int def)
{
static char *lastmsg;
static int lastmsgsum;
@@ -187,11 +177,7 @@ done:
* longjmp back there and return the default answer.
*/
static void
-#ifdef __STDC__
alarmcatch(void)
-#else
-alarmcatch()
-#endif
{
struct sigvec sv;
@@ -216,8 +202,7 @@ alarmcatch()
*/
/*ARGSUSED*/
void
-interrupt(sig)
- int sig;
+interrupt(int sig)
{
if (!saveattn) {
saveattn = attnmessage;
@@ -243,8 +228,7 @@ interrupt(sig)
* controlling terminals, and the like.
*/
void
-broadcast(message)
- char *message;
+broadcast(char *message)
{
time_t clock;
pid_t pid;
@@ -308,9 +292,7 @@ broadcast(message)
*/
#define EST_SEC 600 /* every 10 minutes */
void
-timeest(force, blkswritten)
- int force;
- int blkswritten;
+timeest(int force, int blkswritten)
{
time_t tnow, deltat;
char *msgp;
@@ -325,10 +307,10 @@ timeest(force, blkswritten)
if (!force && blkswritten < 50 * ntrec)
return;
deltat = (*telapsed + (tnow - *tstart_writing))
- * ((double)esize / blkswritten - 1.0);
+ * ((double)esize / blkswritten - 1.0);
msgp = gettext("%3.2f%% done, finished in %d:%02d\n");
msg(msgp, (blkswritten*100.0)/esize,
- deltat/3600, (deltat%3600)/60);
+ deltat/3600, (deltat%3600)/60);
}
}
@@ -377,8 +359,7 @@ msgtail(const char *fmt, ...)
* we don't actually do it
*/
void
-lastdump(arg) /* w ==> just what to do; W ==> most recent dumps */
- int arg;
+lastdump(int arg) /* w ==> just what to do; W ==> most recent dumps */
{
char *lastname;
char *date;
@@ -445,14 +426,7 @@ lastdump(arg) /* w ==> just what to do; W ==> most recent dumps */
}
static int
-idatesort(v1, v2)
-#ifdef __STDC__
- const void *v1;
- const void *v2;
-#else
- void *v1;
- void *v2;
-#endif
+idatesort(const void *v1, const void *v2)
{
struct idates **p1 = (struct idates **)v1;
struct idates **p2 = (struct idates **)v2;
diff --git a/usr/src/cmd/backup/dump/dumptape.c b/usr/src/cmd/backup/dump/dumptape.c
index 39f09b35a7..d64fe63717 100644
--- a/usr/src/cmd/backup/dump/dumptape.c
+++ b/usr/src/cmd/backup/dump/dumptape.c
@@ -41,6 +41,7 @@
#define SLEEPMS 50
+int newtape;
static uint_t writesize; /* size of malloc()ed buffer for tape */
static ino_t inos[TP_NINOS]; /* starting inodes on each tape */
@@ -153,7 +154,6 @@ int caught; /* caught signal -- imported by mapfile() */
extern int xflag;
#endif
-#ifdef __STDC__
static void cmdwrterr(void);
static void cmdrderr(void);
static void freetape(void);
@@ -176,30 +176,6 @@ static void onxfsz(int);
static void dowrite(int);
static void checkpoint(struct bdesc *, int);
static ssize_t atomic(int (*)(), int, char *, int);
-#else
-static void cmdwrterr();
-static void cmdrderr();
-static void freetape();
-static void bufclear();
-static pid_t setuparchive();
-static pid_t setupwriter();
-static void nextslave();
-static void tperror();
-static void rollforward();
-static void nap();
-static void alrm();
-static void just_rewind();
-static void killall();
-static void proceed();
-static void die();
-static void enslave();
-static void wait_our_turn();
-static void dumpoffline();
-static void onxfsz();
-static void dowrite();
-static void checkpoint();
-static ssize_t atomic();
-#endif
static size_t tapesize;
@@ -208,9 +184,6 @@ static size_t tapesize;
* allocated on page boundaries for tape write() efficiency.
*/
void
-#ifdef __STDC__
-#else
-#endif
alloctape(void)
{
struct slaves *slavep;
@@ -223,7 +196,7 @@ alloctape(void)
writesize = ntrec * tp_bsize;
if (!printsize)
msg(gettext("Writing %d Kilobyte records\n"),
- writesize / TP_BSIZE_MIN);
+ writesize / TP_BSIZE_MIN);
/*
* set up shared memory seg for here and child
@@ -232,7 +205,7 @@ alloctape(void)
if (mapfd == -1) {
saverr = errno;
msg(gettext("Cannot open `%s': %s\n"),
- "/dev/zero", strerror(saverr));
+ "/dev/zero", strerror(saverr));
dumpabort();
/*NOTREACHED*/
}
@@ -312,11 +285,7 @@ alloctape(void)
}
static void
-#ifdef __STDC__
freetape(void)
-#else
-freetape()
-#endif
{
if (shared == NULL)
return;
@@ -330,11 +299,7 @@ freetape()
* before a pass to dump active files.
*/
void
-#ifdef __STDC__
reset(void)
-#else
-reset()
-#endif
{
bufclear();
@@ -355,11 +320,7 @@ reset()
}
static void
-#ifdef __STDC__
bufclear(void)
-#else
-bufclear()
-#endif
{
struct bdesc *bp;
int i;
@@ -377,7 +338,7 @@ bufclear()
(*current < &bufp[0] || *current > &bufp[NBUF*ntrec])) {
/* ANSI string catenation, to shut cstyle up */
msg(gettext("bufclear: current buffer pointer (0x%x) "
- "out of range of buffer\naddresses (0x%x - 0x%x)\n"),
+ "out of range of buffer\naddresses (0x%x - 0x%x)\n"),
*current, &bufp[0], &bufp[NBUF*ntrec]);
dumpabort();
/*NOTREACHED*/
@@ -430,7 +391,7 @@ setuparchive(void)
if (lseek64(archivefd, lf_archoffset, 0) < 0) {
saverr = errno;
msg(gettext(
- "Cannot position archive file `%s' : %s\n"),
+ "Cannot position archive file `%s' : %s\n"),
archivefile, strerror(saverr));
dumpabort();
/*NOTREACHED*/
@@ -438,7 +399,7 @@ setuparchive(void)
if (ftruncate64(archivefd, lf_archoffset) < 0) {
saverr = errno;
msg(gettext(
- "Cannot truncate archive file `%s' : %s\n"),
+ "Cannot truncate archive file `%s' : %s\n"),
archivefile, strerror(saverr));
dumpabort();
/*NOTREACHED*/
@@ -509,7 +470,7 @@ setuparchive(void)
}
if (fstat64(archivefd, &stats) < 0)
- stats.st_size = -1;
+ stats.st_size = -1;
/* cast to keep lint&printf happy */
msg(gettext(
@@ -557,14 +518,14 @@ setupwriter(void)
if (pipe(cmd) < 0) {
saverr = errno;
msg(gettext("%s: %s error: %s\n"),
- "setupwriter", "pipe", strerror(saverr));
+ "setupwriter", "pipe", strerror(saverr));
return (0);
}
sighold(SIGINT);
if ((pid = fork()) < 0) {
saverr = errno;
msg(gettext("%s: %s error: %s\n"),
- "setupwriter", "fork", strerror(saverr));
+ "setupwriter", "fork", strerror(saverr));
return (0);
}
if (pid > 0) {
@@ -608,11 +569,7 @@ setupwriter(void)
}
void
-#ifdef __STDC__
spclrec(void)
-#else
-spclrec()
-#endif
{
int s, i;
int32_t *ip;
@@ -742,9 +699,9 @@ tperror(int sig)
if (tapeout && (isrewind(to) || offline)) {
/* ANSI string catenation, to shut cstyle up */
msg(gettext("This tape will rewind. After "
- "it is rewound,\nreplace the faulty tape "
- "with a new one;\nthis dump volume will "
- "be rewritten.\n"));
+ "it is rewound,\nreplace the faulty tape "
+ "with a new one;\nthis dump volume will "
+ "be rewritten.\n"));
}
} else {
broadcast(gettext("TAPE VERIFICATION ERROR!\n"));
@@ -755,7 +712,7 @@ tperror(int sig)
/*NOTREACHED*/
}
msg(gettext(
- "This tape will be rewritten and then verified\n"));
+ "This tape will be rewritten and then verified\n"));
}
killall();
trewind();
@@ -784,8 +741,9 @@ toslave(void (*fn)(), ino_t inumber)
if (wasactive) {
active++;
msg(gettext(
- "The file at inode `%lu' was active and will be recopied\n"),
- slp->sl_req->ir_inumber);
+ "The file at inode `%lu' was active and will "
+ "be recopied\n"),
+ slp->sl_req->ir_inumber);
/* LINTED: 32-bit to 8-bit assignment ok */
BIS(slp->sl_req->ir_inumber, activemap);
}
@@ -818,11 +776,7 @@ dospcl(ino_t inumber)
}
static void
-#ifdef __STDC__
nextslave(void)
-#else
-nextslave()
-#endif
{
if (++rotor >= SLAVES) {
rotor = 0;
@@ -831,11 +785,7 @@ nextslave()
}
void
-#ifdef __STDC__
flushcmds(void)
-#else
-flushcmds()
-#endif
{
int i;
int wasactive;
@@ -859,7 +809,7 @@ flushcmds()
active++;
msg(gettext(
"inode %d was active and will be recopied\n"),
- slp->sl_req->ir_inumber);
+ slp->sl_req->ir_inumber);
/* LINTED: 32-bit to 8-bit assignment ok */
BIS(slp->sl_req->ir_inumber, activemap);
}
@@ -868,11 +818,7 @@ flushcmds()
}
void
-#ifdef __STDC__
flusht(void)
-#else
-flusht()
-#endif
{
sigset_t block_set, oset; /* hold SIGUSR1 and atomically sleep */
@@ -973,7 +919,7 @@ rollforward(int sig)
if (lf_archoffset < 0) {
int saverr = errno;
msg(gettext("Cannot position archive file `%s': %s\n"),
- archivefile, strerror(saverr));
+ archivefile, strerror(saverr));
dumpabort();
/*NOTREACHED*/
}
@@ -984,7 +930,7 @@ rollforward(int sig)
if (dumpstate == DS_START) {
msg(gettext(
- "Tape too short: changing volumes and restarting\n"));
+ "Tape too short: changing volumes and restarting\n"));
reset();
}
@@ -1024,11 +970,7 @@ alrm(int sig)
}
void
-#ifdef __STDC__
nextdevice(void)
-#else
-nextdevice()
-#endif
{
char *cp;
@@ -1112,7 +1054,7 @@ isrewind(int f)
if (fstat64(f, &sbuf) < 0) {
msg(gettext(
"Cannot obtain status of output device `%s'\n"),
- tape);
+ tape);
dumpabort();
/*NOTREACHED*/
}
@@ -1122,11 +1064,7 @@ isrewind(int f)
}
static void
-#ifdef __STDC__
just_rewind(void)
-#else
-just_rewind()
-#endif
{
struct slaves *slavep;
char *rewinding = gettext("Tape rewinding\n");
@@ -1179,11 +1117,7 @@ just_rewind()
}
void
-#ifdef __STDC__
trewind(void)
-#else
-trewind()
-#endif
{
(void) timeclock((time_t)0);
if (offline && (!verify || doingverify)) {
@@ -1200,11 +1134,7 @@ trewind()
}
void
-#ifdef __STDC__
close_rewind(void)
-#else
-close_rewind()
-#endif
{
char *rewinding = gettext("Tape rewinding\n");
@@ -1238,11 +1168,7 @@ close_rewind()
}
void
-#ifdef __STDC__
changevol(void)
-#else
-changevol()
-#endif
{
char buf1[3000], buf2[3000];
char volname[LBLSIZE+1];
@@ -1408,7 +1334,7 @@ restore_check_point:
if (childpid < 0) {
msg(gettext(
"Context-saving fork failed in parent %ld\n"),
- (long)parentpid);
+ (long)parentpid);
Exit(X_ABORT);
}
if (childpid != 0) {
@@ -1426,7 +1352,7 @@ restore_check_point:
/* XGETTEXT: #ifdef TDEBUG only */
msg(gettext(
"Volume: %d; parent process: %ld child process %ld\n"),
- tapeno+1, (long)parentpid, (long)childpid);
+ tapeno+1, (long)parentpid, (long)childpid);
#endif /* TDEBUG */
for (;;) {
waitproc = waitpid(0, &status, 0);
@@ -1523,7 +1449,7 @@ restore_check_point:
/* XGETTEXT: #ifdef TDEBUG only */
msg(gettext(
"Child on Volume %d has parent %ld, my pid = %ld\n"),
- tapeno+1, (long)parentpid, (long)getpid());
+ tapeno+1, (long)parentpid, (long)getpid());
#endif
(void) snprintf(buf, sizeof (buf), gettext(
"Cannot open `%s'. Do you want to retry the open?: (\"yes\" or \"no\") "),
@@ -1585,10 +1511,11 @@ restore_check_point:
* The tape is rewinding;
* we're screwed.
*/
- msg(gettext(
- "Cannot position tape using rewind device!\n"));
- dumpabort();
- /*NOTREACHED*/
+ msg(gettext(
+ "Cannot position tape using "
+ "rewind device!\n"));
+ dumpabort();
+ /*NOTREACHED*/
} else {
sv.sv_handler = alrm;
(void) sigvec(SIGALRM, &sv, &osv);
@@ -1670,7 +1597,7 @@ restore_check_point:
} else if (tapeno > 1) {
msg(gettext(
"Volume %d begins with blocks from inode %lu\n"),
- tapeno, chkpt.sl_inos);
+ tapeno, chkpt.sl_inos);
}
(void) timeclock((time_t)1);
(void) time(tstart_writing);
@@ -1679,11 +1606,7 @@ restore_check_point:
}
void
-#ifdef __STDC__
dumpabort(void)
-#else
-dumpabort()
-#endif
{
if (master && master != getpid())
@@ -1723,17 +1646,13 @@ Exit(status)
/* XGETTEXT: #ifdef TDEBUG only */
msg(gettext("pid = %ld exits with status %d\n"),
- (long)getpid(), status);
+ (long)getpid(), status);
#endif /* TDEBUG */
exit(status);
}
static void
-#ifdef __STDC__
killall(void)
-#else
-killall()
-#endif
{
struct slaves *slavep;
@@ -1744,7 +1663,7 @@ killall()
/* XGETTEXT: #ifdef TDEBUG only */
msg(gettext("Slave child %ld killed\n"),
- (long)slavep->sl_slavepid);
+ (long)slavep->sl_slavepid);
#endif
}
if (writepid) {
@@ -1780,11 +1699,7 @@ die(int sig)
}
static void
-#ifdef __STDC__
enslave(void)
-#else
-enslave()
-#endif
{
int cmd[2]; /* file descriptors */
int i;
@@ -1871,7 +1786,7 @@ enslave()
saverr = errno;
msg(gettext(
"Cannot open dump device `%s': %s\n"),
- disk, strerror(saverr));
+ disk, strerror(saverr));
dumpabort();
/*NOTREACHED*/
}
@@ -1929,11 +1844,7 @@ enslave()
}
static void
-#ifdef __STDC__
wait_our_turn(void)
-#else
-wait_our_turn()
-#endif
{
(void) sighold(SIGUSR1);
@@ -2108,7 +2019,7 @@ dowrite(int cmd)
gettext(
"Verification error %ld feet into tape %d\n"),
(cartridge ? asize/tracks :
- asize)/120L,
+ asize)/120L,
tapeno);
else
(void) snprintf(buf, sizeof (buf),
@@ -2127,7 +2038,7 @@ dowrite(int cmd)
gettext(
"Write error %ld feet into tape %d\n"),
(cartridge ? asize/tracks :
- asize)/120L, tapeno);
+ asize)/120L, tapeno);
else
(void) snprintf(buf, sizeof (buf),
gettext(
@@ -2174,13 +2085,12 @@ dowrite(int cmd)
if (sp->s_spcl.c_type != TS_ADDR) {
lastnonaddr = sp->s_spcl.c_type;
lastnonaddrm =
- sp->s_spcl.c_dinode.di_mode;
+ sp->s_spcl.c_dinode.di_mode;
if (sp->s_spcl.c_type != TS_TAPE)
chkpt.sl_offset = 0;
}
chkpt.sl_count = sp->s_spcl.c_count;
- bcopy((char *)sp,
- (char *)&spcl, sizeof (spcl));
+ bcopy((char *)sp, (char *)&spcl, sizeof (spcl));
mp = recmap;
endmp = &recmap[spcl.c_count];
count = 0;
@@ -2385,11 +2295,7 @@ atomic(int (*func)(), int fd, char *buf, int count)
}
void
-#ifdef __STDC__
-positiontape(char *msgbuf)
-#else
positiontape(char *msgbuf)
-#endif
{
/* Static as never change, no need to waste stack space */
static struct mtget mt;
@@ -2455,22 +2361,14 @@ positiontape(char *msgbuf)
}
static void
-#ifdef __STDC__
cmdwrterr(void)
-#else
-cmdwrterr()
-#endif
{
int saverr = errno;
msg(gettext("Error writing command pipe: %s\n"), strerror(saverr));
}
static void
-#ifdef __STDC__
cmdrderr(void)
-#else
-cmdrderr()
-#endif
{
int saverr = errno;
msg(gettext("Error reading command pipe: %s\n"), strerror(saverr));
diff --git a/usr/src/cmd/backup/dump/dumptraverse.c b/usr/src/cmd/backup/dump/dumptraverse.c
index 4e28e56347..a021386b16 100644
--- a/usr/src/cmd/backup/dump/dumptraverse.c
+++ b/usr/src/cmd/backup/dump/dumptraverse.c
@@ -12,33 +12,24 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dump.h"
#include <sys/file.h>
#include <sys/mman.h>
-#ifdef __STDC__
static void lf_dmpindir(daddr32_t, int, u_offset_t *);
static void indir(daddr32_t, int, u_offset_t *);
static void lf_blksout(daddr32_t *, u_offset_t);
static void lf_dumpinode(struct dinode *);
static void dsrch(daddr32_t, ulong_t, u_offset_t);
void lf_dump(struct dinode *);
-#else
-static void lf_dmpindir();
-static void indir();
-static void lf_blksout();
-static void dsrch();
-void lf_dump();
-#endif
+int dadded;
+int nsubdir;
+int shortmeta;
static char msgbuf[256];
void
-pass(fn, map)
- void (*fn)(struct dinode *);
- uchar_t *map;
+pass(void (*fn)(struct dinode *), uchar_t *map)
{
int bits;
ino_t maxino;
@@ -84,8 +75,7 @@ restart:
}
void
-mark(ip)
- struct dinode *ip;
+mark(struct dinode *ip)
{
int f;
@@ -118,8 +108,7 @@ mark(ip)
}
void
-active_mark(ip)
- struct dinode *ip;
+active_mark(struct dinode *ip)
{
int f;
@@ -161,8 +150,7 @@ static struct shcount {
static struct shcount *shc = NULL;
void
-markshad(ip)
- struct dinode *ip;
+markshad(struct dinode *ip)
{
ino_t shadow;
@@ -195,8 +183,7 @@ markshad(ip)
}
void
-estshad(ip)
- struct dinode *ip;
+estshad(struct dinode *ip)
{
u_offset_t esizeprime;
u_offset_t tmpesize;
@@ -240,8 +227,7 @@ freeshad()
}
void
-add(ip)
- struct dinode *ip;
+add(struct dinode *ip)
{
int i;
u_offset_t filesize;
@@ -292,10 +278,7 @@ add(ip)
}
static void
-indir(d, n, filesize)
- daddr32_t d;
- int n;
- u_offset_t *filesize;
+indir(daddr32_t d, int n, u_offset_t *filesize)
{
int i;
daddr32_t idblk[MAXNINDIR];
@@ -344,15 +327,13 @@ blocks than valid maximum.\n"));
}
void
-dirdump(ip)
- struct dinode *ip;
+dirdump(struct dinode *ip)
{
/* watchout for dir inodes deleted and maybe reallocated */
if (((ip->di_mode & IFMT) != IFDIR &&
(ip->di_mode & IFMT) != IFATTRDIR) || ip->di_nlink < 2) {
(void) snprintf(msgbuf, sizeof (msgbuf), gettext(
- "Warning - directory at inode `%lu' vanished!\n"),
- ino);
+ "Warning - directory at inode `%lu' vanished!\n"), ino);
msg(msgbuf);
return;
}
@@ -362,18 +343,16 @@ dirdump(ip)
static u_offset_t loffset; /* current offset in file (ufsdump) */
static void
-lf_dumpmeta(ip)
- struct dinode *ip;
+lf_dumpmeta(struct dinode *ip)
{
if ((ip->di_shadow == 0) || shortmeta)
- return;
+ return;
lf_dumpinode(getino((ino_t)(unsigned)(ip->di_shadow)));
}
int
-hasshortmeta(ip)
- struct dinode **ip;
+hasshortmeta(struct dinode **ip)
{
ino_t savino;
int rc;
@@ -388,8 +367,7 @@ hasshortmeta(ip)
}
void
-lf_dumpinode(ip)
- struct dinode *ip;
+lf_dumpinode(struct dinode *ip)
{
int i;
u_offset_t size;
@@ -425,8 +403,7 @@ lf_dumpinode(ip)
}
void
-lf_dump(ip)
- struct dinode *ip;
+lf_dump(struct dinode *ip)
{
if ((!BIT(ino, nodmap)) && (!BIT(ino, shamap)))
@@ -460,10 +437,7 @@ lf_dump(ip)
}
static void
-lf_dmpindir(blk, lvl, size)
- daddr32_t blk;
- int lvl;
- u_offset_t *size;
+lf_dmpindir(daddr32_t blk, int lvl, u_offset_t *size)
{
int i;
u_offset_t cnt;
@@ -507,9 +481,7 @@ blocks than valid maximum.\n"));
}
static void
-lf_blksout(blkp, bytes)
- daddr32_t *blkp;
- u_offset_t bytes;
+lf_blksout(daddr32_t *blkp, u_offset_t bytes)
{
u_offset_t i;
u_offset_t tbperfsb = (unsigned)(sblock->fs_bsize / tp_bsize);
@@ -620,9 +592,7 @@ lf_blksout(blkp, bytes)
}
void
-bitmap(map, typ)
- uchar_t *map;
- int typ;
+bitmap(uchar_t *map, int typ)
{
int i;
u_offset_t count;
@@ -653,10 +623,7 @@ bitmap(map, typ)
}
static void
-dsrch(d, size, filesize)
- daddr32_t d;
- ulong_t size; /* block size */
- u_offset_t filesize;
+dsrch(daddr32_t d, ulong_t size, u_offset_t filesize)
{
struct direct *dp;
struct dinode *ip;
@@ -688,8 +655,8 @@ dsrch(d, size, filesize)
dp = (struct direct *)(dblk + loc);
if (dp->d_reclen == 0) {
(void) snprintf(msgbuf, sizeof (msgbuf), gettext(
- "Warning - directory at inode `%lu' is corrupted\n"),
- ino);
+ "Warning - directory at inode `%lu' is "
+ "corrupted\n"), ino);
msg(msgbuf);
break;
}
@@ -734,8 +701,7 @@ dsrch(d, size, filesize)
#define CACHESIZE 32
struct dinode *
-getino(ino)
- ino_t ino;
+getino(ino_t ino)
{
static ino_t minino, maxino;
static struct dinode itab[MAXINOPB];
@@ -794,10 +760,7 @@ getino(ino)
void
-bread(da, ba, cnt)
-diskaddr_t da;
-uchar_t *ba;
-size_t cnt;
+bread(diskaddr_t da, uchar_t *ba, size_t cnt)
{
caddr_t maddr;
uchar_t *dest;
@@ -848,7 +811,7 @@ size_t cnt;
}
if (read(fi, ba, (size_t)cnt) == (size_t)cnt)
- return;
+ return;
while (cnt != 0) {
diff --git a/usr/src/cmd/backup/dump/partial.c b/usr/src/cmd/backup/dump/partial.c
index 4481a951ad..6194180182 100644
--- a/usr/src/cmd/backup/dump/partial.c
+++ b/usr/src/cmd/backup/dump/partial.c
@@ -24,32 +24,20 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dump.h"
#include <ftw.h>
#include <ulimit.h>
+dev_t partial_dev;
static int partial;
-#ifdef __STDC__
static dev_t devfromopts(struct mntent *);
static int lf_mark_root(dev_t, char *);
static int lf_ftw_mark(const char *, const struct stat64 *, int);
static void markino(ino_t);
-#else
-static dev_t devfromopts();
-static int lf_mark_root();
-static int lf_ftw_mark();
-static void markino();
-#endif
void
-#ifdef __STDC__
partial_check(void)
-#else
-partial_check()
-#endif
{
struct mntent *mnt;
struct stat64 st;
@@ -92,8 +80,7 @@ partial_check()
* extract the device id and avoid having to stat.
*/
static dev_t
-devfromopts(mnt)
- struct mntent *mnt;
+devfromopts(struct mntent *mnt)
{
char *str;
@@ -105,9 +92,7 @@ devfromopts(mnt)
}
int
-partial_mark(argc, argv)
- int argc;
- char **argv;
+partial_mark(int argc, char **argv)
{
char *path;
struct stat64 st;
@@ -119,9 +104,9 @@ partial_mark(argc, argv)
path = *argv++;
if (stat64(path, &st) < 0 ||
- st.st_dev != partial_dev) {
+ st.st_dev != partial_dev) {
msg(gettext("`%s' is not on dump device `%s'\n"),
- path, disk);
+ path, disk);
dumpabort();
/*NOTREACHED*/
}
@@ -139,7 +124,7 @@ partial_mark(argc, argv)
< 0) {
int saverr = errno;
msg(gettext("Error in %s (%s)\n"),
- "ftw", strerror(saverr));
+ "ftw", strerror(saverr));
dumpabort();
/*NOTREACHED*/
}
@@ -150,9 +135,7 @@ partial_mark(argc, argv)
/* mark directories between target and root */
static int
-lf_mark_root(dev, path)
- dev_t dev;
- char *path;
+lf_mark_root(dev_t dev, char *path)
{
struct stat64 st;
char dotdot[MAXPATHLEN + 16];
@@ -182,8 +165,8 @@ lf_mark_root(dev, path)
/* keep marking parent until we hit mount point */
do {
if (stat64(dotdot, &st) < 0 ||
- (st.st_mode & S_IFMT) != S_IFDIR ||
- st.st_dev != dev)
+ (st.st_mode & S_IFMT) != S_IFDIR ||
+ st.st_dev != dev)
return (1);
markino(st.st_ino);
if (strlen(dotdot) > (sizeof (dotdot) - 4))
@@ -196,15 +179,7 @@ lf_mark_root(dev, path)
/*ARGSUSED*/
static int
-lf_ftw_mark(name, st, flag)
-#ifdef __STDC__
- const char *name;
- const struct stat64 *st;
-#else
- char *name;
- struct stat64 *st;
-#endif
- int flag;
+lf_ftw_mark(const char *name, const struct stat64 *st, int flag)
{
if (flag != FTW_NS) {
/* LINTED ufs only uses the lower 32 bits */
@@ -214,8 +189,7 @@ lf_ftw_mark(name, st, flag)
}
static void
-markino(i)
- ino_t i;
+markino(ino_t i)
{
struct dinode *dp;
diff --git a/usr/src/cmd/backup/restore/dirs.c b/usr/src/cmd/backup/restore/dirs.c
index 566f177c2f..2757f53e46 100644
--- a/usr/src/cmd/backup/restore/dirs.c
+++ b/usr/src/cmd/backup/restore/dirs.c
@@ -18,6 +18,8 @@
#include <unistd.h>
#include <utime.h>
+struct context curfile;
+
/*
* Symbol table of directories read from tape.
*/
diff --git a/usr/src/cmd/backup/restore/restore.h b/usr/src/cmd/backup/restore/restore.h
index d1002703b3..807545da9e 100644
--- a/usr/src/cmd/backup/restore/restore.h
+++ b/usr/src/cmd/backup/restore/restore.h
@@ -171,7 +171,7 @@ typedef struct _rstdirdesc {
/*
* The entry describes the next file available on the tape
*/
-struct context {
+extern struct context {
char *name; /* name of file */
ino_t ino; /* inumber of file */
struct dinode *dip; /* pointer to inode */
diff --git a/usr/src/cmd/backup/restore/tape.c b/usr/src/cmd/backup/restore/tape.c
index ac4af20262..cc0ea15b95 100644
--- a/usr/src/cmd/backup/restore/tape.c
+++ b/usr/src/cmd/backup/restore/tape.c
@@ -43,6 +43,7 @@ static int numtrec; /* # of logical blocks in current tape record */
static char *tbf = NULL;
static size_t tbfsize = 0;
static int recsread;
+union u_spcl u_spcl;
static union u_spcl endoftapemark;
static struct s_spcl dumpinfo;
static long blksread; /* # of logical blocks actually read/touched */
@@ -1233,18 +1234,14 @@ metaset(char *name)
}
void
-metaget(data, size)
- char **data;
- size_t *size;
+metaget(char **data, size_t *size)
{
*data = metadata;
*size = metasize;
}
static void
-fsd_acl(name, aclp, size)
- char *name, *aclp;
- unsigned size;
+fsd_acl(char *name, char *aclp, unsigned size)
{
static aclent_t *aclent = NULL;
ufs_acl_t *diskacl;
diff --git a/usr/src/cmd/bnu/conn.c b/usr/src/cmd/bnu/conn.c
index d2b7fcd8a4..4e175ab876 100644
--- a/usr/src/cmd/bnu/conn.c
+++ b/usr/src/cmd/bnu/conn.c
@@ -27,10 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
#include "uucp.h"
GLOBAL char _Protocol[40] = ""; /* working protocol string */
@@ -70,7 +66,7 @@ static int notin(), ifdate(), checkdate(), checktime(), classmatch();
GLOBAL char *Myline = CNULL; /* to force which line will be used */
GLOBAL char *Mytype = CNULL; /* to force selection of specific device type */
-GLOBAL int Dologin; /* to force login chat sequence */
+EXTERN int Dologin; /* to force login chat sequence */
/*
* conn - place a telephone call to system and login, etc.
diff --git a/usr/src/cmd/bnu/ct.c b/usr/src/cmd/bnu/ct.c
index e288464c34..280b3dadb6 100644
--- a/usr/src/cmd/bnu/ct.c
+++ b/usr/src/cmd/bnu/ct.c
@@ -28,7 +28,6 @@
/*
* Copyright (c) 2016 by Delphix. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
@@ -77,6 +76,7 @@ extern int dkminor();
#define TRUE 1
#define FALSE 0
+int Dologin = 0;
static
int _Status; /* exit status of child */
diff --git a/usr/src/cmd/bnu/cu.c b/usr/src/cmd/bnu/cu.c
index e497278979..9cce8f2425 100644
--- a/usr/src/cmd/bnu/cu.c
+++ b/usr/src/cmd/bnu/cu.c
@@ -27,9 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
/*
* cu [-cdevice] [-sspeed] [-lline] [-bbits] [-h] [-t] [-d] [-n]
* [-o|-e] [-L] [-C] telno | systemname [local-cmd]
diff --git a/usr/src/cmd/bnu/pkdefs.c b/usr/src/cmd/bnu/pkdefs.c
index 2bfe8712e4..21386101e2 100644
--- a/usr/src/cmd/bnu/pkdefs.c
+++ b/usr/src/cmd/bnu/pkdefs.c
@@ -27,9 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "uucp.h"
#include "pk.h"
@@ -39,4 +36,3 @@ int pkdebug;
int pksizes[] = {
1, 32, 64, 128, 256, 512, 1024, 2048, 4096, 1
};
-struct pack *Pk;
diff --git a/usr/src/cmd/bnu/uucico.c b/usr/src/cmd/bnu/uucico.c
index f751d0037d..b204d49efd 100644
--- a/usr/src/cmd/bnu/uucico.c
+++ b/usr/src/cmd/bnu/uucico.c
@@ -61,6 +61,7 @@ jmp_buf Sjbuf;
extern unsigned msgtime;
char uuxqtarg[MAXBASENAME] = {'\0'};
int uuxqtflag = 0;
+int Dologin = 0;
extern int (*Setup)(), (*Teardown)(); /* defined in interface.c */
diff --git a/usr/src/cmd/cdrw/mmc.c b/usr/src/cmd/cdrw/mmc.c
index d52e4ba194..4b90cc5f3d 100644
--- a/usr/src/cmd/cdrw/mmc.c
+++ b/usr/src/cmd/cdrw/mmc.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
@@ -35,6 +33,8 @@
#include "util.h"
#include "main.h"
+int uscsi_error;
+
int
test_unit_ready(int fd)
{
@@ -278,7 +278,7 @@ get_configuration(int fd, uint16_t feature, int bufsize, uchar_t *buf)
int
read10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
- uint32_t bufsize)
+ uint32_t bufsize)
{
struct uscsi_cmd *scmd;
@@ -299,7 +299,7 @@ read10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
int
write10(int fd, uint32_t start_blk, uint16_t nblk, uchar_t *buf,
- uint32_t bufsize)
+ uint32_t bufsize)
{
struct uscsi_cmd *scmd;
@@ -396,7 +396,7 @@ blank_disc(int fd, int type, int immediate)
int
read_cd(int fd, uint32_t start_blk, uint16_t nblk, uchar_t sector_type,
- uchar_t *buf, uint32_t bufsize)
+ uchar_t *buf, uint32_t bufsize)
{
struct uscsi_cmd *scmd;
@@ -891,7 +891,7 @@ print_profile_name(uint16_t num, uchar_t current, uchar_t abbr)
*
* Description: Print a list of Profiles supported by the Logical Unit.
*
- * Parameters: fd - file descriptor for device whose list of
+ * Parameters: fd - file descriptor for device whose list of
* profiles we wish to print
*/
void
diff --git a/usr/src/cmd/cdrw/mmc.h b/usr/src/cmd/cdrw/mmc.h
index ec92b48b72..c48062a83c 100644
--- a/usr/src/cmd/cdrw/mmc.h
+++ b/usr/src/cmd/cdrw/mmc.h
@@ -26,8 +26,6 @@
#ifndef _MMC_H
#define _MMC_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -156,9 +154,9 @@ int format_media(int fd);
uint32_t read_format_capacity(int fd, uint_t *bsize);
void reset_dev(int fd);
-int uscsi_error; /* used for debugging failed uscsi */
+extern int uscsi_error; /* used for debugging failed uscsi */
-#define REZERO_UNIT_CMD 0x01
+#define REZERO_UNIT_CMD 0x01
#define FORMAT_UNIT_CMD 0x04
#define INQUIRY_CMD 0x12
#define MODE_SELECT_6_CMD 0x15
diff --git a/usr/src/cmd/cdrw/transport.h b/usr/src/cmd/cdrw/transport.h
index 373b6b916a..b3ba7d38d4 100644
--- a/usr/src/cmd/cdrw/transport.h
+++ b/usr/src/cmd/cdrw/transport.h
@@ -27,8 +27,6 @@
#ifndef _TRANSPORT_H
#define _TRANSPORT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,7 +40,7 @@ extern "C" {
#define RQBUFLEN 32
extern char rqbuf[RQBUFLEN];
-uchar_t uscsi_status, rqstatus, rqresid;
+extern uchar_t uscsi_status, rqstatus, rqresid;
struct uscsi_cmd *get_uscsi_cmd(void);
int uscsi(int fd, struct uscsi_cmd *scmd);
diff --git a/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp.c b/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp.c
index f7007286a8..85674f1aba 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp.c
@@ -25,7 +25,7 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -43,7 +43,7 @@
/*
* WRITE() returns:
- * >0 no error
+ * >0 no error
* -1 error, errorno is set
* -2 security error (secure_write() only)
*/
@@ -55,10 +55,9 @@ static struct sockaddr_in6 data_addr;
int data = -1;
static int abrtflag = 0;
static int ptflag = 0;
-int connected;
static jmp_buf sendabort;
static jmp_buf recvabort;
-static jmp_buf ptabort;
+static jmp_buf ptabort;
static int ptabflg;
static boolean_t pasv_refused;
boolean_t eport_supported = B_TRUE;
@@ -376,7 +375,7 @@ login(char *host)
}
stop_timer();
(void) printf("Name (%s:%s): ", host,
- (myname == NULL) ? "" : myname);
+ (myname == NULL) ? "" : myname);
*tmp = '\0';
if (fgets(tmp, sizeof (tmp) - 1, stdin) != NULL)
tmp[strlen(tmp) - 1] = '\0';
@@ -473,7 +472,7 @@ again: if (secure_command(command_buf) == 0)
if (r == 533 && clevel == PROT_P) {
(void) fprintf(stderr, "ENC command not supported at server; "
- "retrying under MIC...\n");
+ "retrying under MIC...\n");
clevel = PROT_S;
goto again;
}
@@ -498,8 +497,8 @@ getreply(int expecteof)
* 5yz: an error occurred, failure
* 6yz: protected reply (is_base64 == TRUE)
* 631 - base 64 encoded safe message
- * 632 - base 64 encoded private message
- * 633 - base 64 encoded confidential message
+ * 632 - base 64 encoded private message
+ * 633 - base 64 encoded confidential message
* 'c' is a wide char type, for international char sets
*/
wint_t c;
@@ -538,131 +537,137 @@ getreply(int expecteof)
while ((c = ibuf[0] ?
(wint_t)ibuf[i++] : fgetwc(ctrl_in)) != '\n') {
- if (i >= FTPBUFSIZ)
- break;
-
- if (c == IAC) { /* handle telnet commands */
- switch (c = fgetwc(ctrl_in)) {
- case WILL:
- case WONT:
- c = fgetwc(ctrl_in);
- (void) fprintf(ctrl_out, "%c%c%wc", IAC,
- WONT, c);
- (void) fflush(ctrl_out);
- break;
- case DO:
- case DONT:
- c = fgetwc(ctrl_in);
- (void) fprintf(ctrl_out, "%c%c%wc", IAC,
- DONT, c);
- (void) fflush(ctrl_out);
- break;
- default:
+ if (i >= FTPBUFSIZ)
break;
+
+ if (c == IAC) { /* handle telnet commands */
+ switch (c = fgetwc(ctrl_in)) {
+ case WILL:
+ case WONT:
+ c = fgetwc(ctrl_in);
+ (void) fprintf(ctrl_out, "%c%c%wc", IAC,
+ WONT, c);
+ (void) fflush(ctrl_out);
+ break;
+ case DO:
+ case DONT:
+ c = fgetwc(ctrl_in);
+ (void) fprintf(ctrl_out, "%c%c%wc", IAC,
+ DONT, c);
+ (void) fflush(ctrl_out);
+ break;
+ default:
+ break;
+ }
+ continue;
}
- continue;
- }
- dig++;
- if (c == EOF) {
- if (expecteof) {
- (void) signal(SIGINT, oldintr);
- code = 221;
- return (0);
+ dig++;
+ if (c == EOF) {
+ if (expecteof) {
+ (void) signal(SIGINT, oldintr);
+ code = 221;
+ return (0);
+ }
+ lostpeer(0);
+ if (verbose) {
+ (void) printf(
+ "421 Service not available, remote"
+ " server has closed connection\n");
+ } else {
+ (void) printf("Lost connection\n");
+ }
+ (void) fflush(stdout);
+ code = 421;
+ return (4);
}
- lostpeer(0);
- if (verbose) {
- (void) printf(
- "421 Service not available, remote"
- " server has closed connection\n");
- } else
- (void) printf("Lost connection\n");
- (void) fflush(stdout);
- code = 421;
- return (4);
- }
- if (n == 0)
- n = c;
-
- if (n == '6')
- is_base64 = 1;
-
- if ((auth_type != AUTHTYPE_NONE) && !ibuf[0] &&
- (is_base64 || continuation)) {
- /* start storing chars in obuf */
- if (c != '\r' && dig > 4)
- obuf[i++] = (char)c;
- } else {
+ if (n == 0)
+ n = c;
+
+ if (n == '6')
+ is_base64 = 1;
+
if ((auth_type != AUTHTYPE_NONE) && !ibuf[0] &&
- dig == 1 && verbose)
- (void) printf("Unauthenticated reply received "
- "from server:\n");
- if (reply_parse)
- *reply_ptr++ = (char)c;
- if (c != '\r' && (verbose > 0 ||
- (verbose > -1 && n == '5' && dig > 4))) {
- if (proxflag &&
- (dig == 1 || dig == 5 && verbose == 0))
- (void) printf("%s:", hostname);
- (void) putwchar(c);
- }
- } /* endif auth_type && !ibuf[0] ... */
+ (is_base64 || continuation)) {
+ /* start storing chars in obuf */
+ if (c != '\r' && dig > 4)
+ obuf[i++] = (char)c;
+ } else {
+ if ((auth_type != AUTHTYPE_NONE) && !ibuf[0] &&
+ dig == 1 && verbose)
+ (void) printf("Unauthenticated reply "
+ "received from server:\n");
+ if (reply_parse)
+ *reply_ptr++ = (char)c;
+ if (c != '\r' && (verbose > 0 ||
+ (verbose > -1 && n == '5' && dig > 4))) {
+ if (proxflag &&
+ (dig == 1 || dig == 5 &&
+ verbose == 0))
+ (void) printf("%s:", hostname);
+ (void) putwchar(c);
+ }
+ } /* endif auth_type && !ibuf[0] ... */
- if ((auth_type != AUTHTYPE_NONE) && !ibuf[0] && !is_base64)
- continue;
+ if ((auth_type != AUTHTYPE_NONE) && !ibuf[0] &&
+ !is_base64)
+ continue;
+
+ /* we are still extracting the 3 digit code */
+ if (dig < 4 && isascii(c) && isdigit(c))
+ code = code * 10 + (c - '0');
+
+ /* starting passive mode */
+ if (!pflag && code == 227)
+ pflag = 1;
+
+ /* start to store characters, when dig > 4 */
+ if (dig > 4 && pflag == 1 && isascii(c) && isdigit(c))
+ pflag = 2;
+ if (pflag == 2) {
+ if (c != '\r' && c != ')') {
+ /*
+ * the mb array is to deal with
+ * the wchar_t
+ */
+ char mb[MB_LEN_MAX];
+ int avail;
- /* we are still extracting the 3 digit code */
- if (dig < 4 && isascii(c) && isdigit(c))
- code = code * 10 + (c - '0');
-
- /* starting passive mode */
- if (!pflag && code == 227)
- pflag = 1;
-
- /* start to store characters, when dig > 4 */
- if (dig > 4 && pflag == 1 && isascii(c) && isdigit(c))
- pflag = 2;
- if (pflag == 2) {
- if (c != '\r' && c != ')') {
- /* the mb array is to deal with the wchar_t */
- char mb[MB_LEN_MAX];
- int avail;
-
- /*
- * space available in pasv[], accounting
- * for trailing NULL
- */
- avail = &pasv[sizeof (pasv)] - pt - 1;
-
- len = wctomb(mb, c);
- if (len <= 0 && avail > 0) {
- *pt++ = (unsigned char)c;
- } else if (len > 0 && avail >= len) {
- bcopy(mb, pt, (size_t)len);
- pt += len;
- } else {
/*
- * no room in pasv[];
- * close connection
+ * space available in pasv[], accounting
+ * for trailing NULL
*/
- (void) printf("\nReply too long - "
- "closing connection\n");
- lostpeer(0);
- (void) fflush(stdout);
- (void) signal(SIGINT, oldintr);
- return (4);
+ avail = &pasv[sizeof (pasv)] - pt - 1;
+
+ len = wctomb(mb, c);
+ if (len <= 0 && avail > 0) {
+ *pt++ = (unsigned char)c;
+ } else if (len > 0 && avail >= len) {
+ bcopy(mb, pt, (size_t)len);
+ pt += len;
+ } else {
+ /*
+ * no room in pasv[];
+ * close connection
+ */
+ (void) printf("\nReply too long"
+ " - closing connection\n");
+ lostpeer(0);
+ (void) fflush(stdout);
+ (void) signal(SIGINT, oldintr);
+ return (4);
+ }
+ } else {
+ *pt = '\0';
+ pflag = 3;
}
- } else {
- *pt = '\0';
- pflag = 3;
+ } /* endif pflag == 2 */
+ if (dig == 4 && c == '-' && !is_base64) {
+ if (continuation)
+ code = 0;
+ continuation++;
}
- } /* endif pflag == 2 */
- if (dig == 4 && c == '-' && !is_base64) {
- if (continuation)
- code = 0;
- continuation++;
- }
- if (cp < &reply_string[sizeof (reply_string) - 1])
- *cp++ = c;
+ if (cp < &reply_string[sizeof (reply_string) - 1])
+ *cp++ = c;
} /* end while */
@@ -672,15 +677,15 @@ getreply(int expecteof)
ibuf[0] = obuf[i] = '\0';
if (code && is_base64) {
- boolean_t again = 0;
- n = decode_reply(ibuf, sizeof (ibuf), obuf, n, &again);
- if (again)
- continue;
- } else
-
- if (verbose > 0 || verbose > -1 && n == '5') {
- (void) putwchar(c);
- (void) fflush(stdout);
+ boolean_t again = 0;
+ n = decode_reply(ibuf, sizeof (ibuf), obuf, n, &again);
+ if (again)
+ continue;
+ } else {
+ if (verbose > 0 || verbose > -1 && n == '5') {
+ (void) putwchar(c);
+ (void) fflush(stdout);
+ }
}
if (continuation && code != originalcode) {
@@ -699,13 +704,14 @@ getreply(int expecteof)
(*oldintr)();
if (reply_parse) {
- *reply_ptr = '\0';
- if (reply_ptr = strstr(reply_buf, reply_parse)) {
- reply_parse = reply_ptr + strlen(reply_parse);
- if (reply_ptr = strpbrk(reply_parse, " \r"))
- *reply_ptr = '\0';
- } else
- reply_parse = reply_ptr;
+ *reply_ptr = '\0';
+ if (reply_ptr = strstr(reply_buf, reply_parse)) {
+ reply_parse = reply_ptr + strlen(reply_parse);
+ if (reply_ptr = strpbrk(reply_parse, " \r"))
+ *reply_ptr = '\0';
+ } else {
+ reply_parse = reply_ptr;
+ }
}
return (n - '0');
@@ -804,7 +810,7 @@ sendrequest(char *cmd, char *local, char *remote, int allowpipe)
if (fstat(fileno(fin), &st) < 0 ||
(st.st_mode&S_IFMT) != S_IFREG) {
(void) fprintf(stdout,
- "%s: not a plain file.\n", local);
+ "%s: not a plain file.\n", local);
(void) signal(SIGINT, oldintr);
code = -1;
(void) fclose(fin);
@@ -834,7 +840,7 @@ sendrequest(char *cmd, char *local, char *remote, int allowpipe)
return;
}
if (command("REST %lld", (longlong_t)restart_point)
- != CONTINUE) {
+ != CONTINUE) {
if (closefunc != NULL)
(*closefunc)(fin);
restart_point = 0;
@@ -1275,8 +1281,8 @@ writeerr:
perror(local);
else
(void) fprintf(stderr,
- "%s: Unexpected end of file\n",
- local);
+ "%s: Unexpected end of "
+ "file\n", local);
goto abort;
}
if (c == '\n')
@@ -1329,7 +1335,7 @@ endread:
perror("netin");
}
if ((fflush(fout) == EOF) || ferror(fout) ||
- (fsync(fileno(fout)) == -1)) {
+ (fsync(fileno(fout)) == -1)) {
writer_ascii_err:
errflg = 1;
perror(local);
@@ -1484,7 +1490,7 @@ initconn(void)
perror("ftp: setsockopt (TCP_ABORT_THRESHOLD)");
if ((options & SO_DEBUG) &&
setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
- sizeof (on)) < 0)
+ sizeof (on)) < 0)
perror("setsockopt (ignored)");
/*
* Use the system wide default send and receive buffer sizes
@@ -1504,7 +1510,7 @@ initconn(void)
if (ipv6rem == B_TRUE) {
if (command("EPSV") != COMPLETE) {
(void) fprintf(stderr,
- "Passive mode refused. Try EPRT\n");
+ "Passive mode refused. Try EPRT\n");
pasv_refused = B_TRUE;
goto noport;
}
@@ -1541,7 +1547,7 @@ initconn(void)
if (command("PASV") != COMPLETE) {
(void) fprintf(stderr,
- "Passive mode refused. Try PORT\n");
+ "Passive mode refused. Try PORT\n");
pasv_refused = B_TRUE;
goto noport;
}
@@ -1552,9 +1558,9 @@ initconn(void)
* 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2)
*/
if (sscanf(pasv, "%d,%d,%d,%d,%d,%d",
- &a1, &a2, &a3, &a4, &p1, &p2) != 6) {
+ &a1, &a2, &a3, &a4, &p1, &p2) != 6) {
(void) fprintf(stderr,
- "Passive mode parsing failure.\n");
+ "Passive mode parsing failure.\n");
goto bad;
}
/*
@@ -1562,8 +1568,8 @@ initconn(void)
* IPv4-mapped IPv6 address.
*/
a = (unsigned char *)&data_addr.sin6_addr +
- sizeof (struct in6_addr) -
- sizeof (struct in_addr);
+ sizeof (struct in6_addr) -
+ sizeof (struct in_addr);
#define UC(b) ((b)&0xff)
a[0] = UC(a1);
a[1] = UC(a2);
@@ -1661,18 +1667,19 @@ noport:
hname, htons(data_addr.sin6_port));
if (result != COMPLETE)
eport_supported = B_FALSE;
- }
+ }
}
/* Try LPRT */
if (result != COMPLETE) {
result = command(
-"LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
-6, 16,
-UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
-UC(a[4]), UC(a[5]), UC(a[6]), UC(a[7]),
-UC(a[8]), UC(a[9]), UC(a[10]), UC(a[11]),
-UC(a[12]), UC(a[13]), UC(a[14]), UC(a[15]),
-2, UC(p[0]), UC(p[1]));
+ "LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,"
+ "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+ 6, 16,
+ UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
+ UC(a[4]), UC(a[5]), UC(a[6]), UC(a[7]),
+ UC(a[8]), UC(a[9]), UC(a[10]), UC(a[11]),
+ UC(a[12]), UC(a[13]), UC(a[14]), UC(a[15]),
+ 2, UC(p[0]), UC(p[1]));
}
}
@@ -1730,7 +1737,7 @@ ptransfer(char *direction, off_t bytes, hrtime_t t0,
if (remote)
(void) printf("remote: %s\n", remote);
(void) printf("%lld bytes %s in %.2g seconds (%.2f Kbytes/s)\n",
- (longlong_t)bytes, direction, s, bs / 1024.0);
+ (longlong_t)bytes, direction, s, bs / 1024.0);
}
/*ARGSUSED*/
@@ -2216,8 +2223,8 @@ gunique(char *local)
while (!d) {
if (++count == 100) {
(void) printf(
- "runique: can't find unique file name.\n");
- return ((char *)0);
+ "gunique: can't find unique file name.\n");
+ return (NULL);
}
*cp++ = ext;
*cp = '\0';
@@ -2290,34 +2297,34 @@ secure_command(char *cmd)
in_buf.length = strlen(cmd) + 1;
maj_stat = gss_context_time(&min_stat, gcontext,
- &expire_time);
+ &expire_time);
if (GSS_ERROR(maj_stat)) {
user_gss_error(maj_stat, min_stat,
- "gss context has expired");
+ "gss context has expired");
fatal("Your gss credentials have expired. "
- "Good-bye!");
+ "Good-bye!");
}
maj_stat = gss_seal(&min_stat, gcontext,
- (clevel == PROT_P), /* private */
- GSS_C_QOP_DEFAULT,
- &in_buf, &conf_state,
- &out_buf);
+ (clevel == PROT_P), /* private */
+ GSS_C_QOP_DEFAULT,
+ &in_buf, &conf_state,
+ &out_buf);
if (maj_stat != GSS_S_COMPLETE) {
/* generally need to deal */
user_gss_error(maj_stat, min_stat,
- (clevel == PROT_P) ?
- "gss_seal ENC didn't complete":
- "gss_seal MIC didn't complete");
+ (clevel == PROT_P) ?
+ "gss_seal ENC didn't complete":
+ "gss_seal MIC didn't complete");
} else if ((clevel == PROT_P) && !conf_state) {
(void) fprintf(stderr,
- "GSSAPI didn't encrypt message");
+ "GSSAPI didn't encrypt message");
out = out_buf.value;
} else {
if (debug)
- (void) fprintf(stderr,
- "sealed (%s) %d bytes\n",
- clevel == PROT_P ? "ENC" : "MIC",
- out_buf.length);
+ (void) fprintf(stderr,
+ "sealed (%s) %d bytes\n",
+ clevel == PROT_P ? "ENC" : "MIC",
+ out_buf.length);
out = out_buf.value;
}
@@ -2332,15 +2339,15 @@ secure_command(char *cmd)
length = out_buf.length;
if (auth_error = radix_encode(out, in, inlen, &length, 0)) {
(void) fprintf(stderr,
- "Couldn't base 64 encode command (%s)\n",
- radix_error(auth_error));
+ "Couldn't base 64 encode command (%s)\n",
+ radix_error(auth_error));
free(in);
gss_release_buffer(&min_stat, &out_buf);
return (0);
}
(void) fprintf(ctrl_out, "%s %s",
- clevel == PROT_P ? "ENC" : "MIC", in);
+ clevel == PROT_P ? "ENC" : "MIC", in);
free(in);
gss_release_buffer(&min_stat, &out_buf);
@@ -2407,11 +2414,8 @@ setpbsz(unsigned int size)
* 5 if an error occurred
*/
static int
-decode_reply(uchar_t *plain_buf,
- int ilen,
- uchar_t *b64_buf,
- int retval,
- boolean_t *again)
+decode_reply(uchar_t *plain_buf, int ilen, uchar_t *b64_buf, int retval,
+ boolean_t *again)
{
int len;
int safe = 0;
@@ -2419,26 +2423,26 @@ decode_reply(uchar_t *plain_buf,
*again = 0;
if (!b64_buf[0]) /* if there is no string, no problem */
- return (retval);
+ return (retval);
if ((auth_type == AUTHTYPE_NONE)) {
- (void) printf("Cannot decode reply:\n%d %s\n", code, b64_buf);
- return ('5');
+ (void) printf("Cannot decode reply:\n%d %s\n", code, b64_buf);
+ return ('5');
}
switch (code) {
- case 631: /* 'safe' */
+ case 631: /* 'safe' */
safe = 1;
break;
- case 632: /* 'private' */
+ case 632: /* 'private' */
break;
- case 633: /* 'confidential' */
+ case 633: /* 'confidential' */
break;
- default:
+ default:
(void) printf("Unknown reply: %d %s\n", code, b64_buf);
return ('5');
}
@@ -2448,7 +2452,7 @@ decode_reply(uchar_t *plain_buf,
if (auth_error) {
(void) printf("Can't base 64 decode reply %d (%s)\n\"%s\"\n",
- code, radix_error(auth_error), b64_buf);
+ code, radix_error(auth_error), b64_buf);
return ('5');
}
@@ -2461,10 +2465,10 @@ decode_reply(uchar_t *plain_buf,
/* decrypt/verify the message */
maj_stat = gss_unseal(&min_stat, gcontext,
- &xmit_buf, &msg_buf, &conf_state, NULL);
+ &xmit_buf, &msg_buf, &conf_state, NULL);
if (maj_stat != GSS_S_COMPLETE) {
user_gss_error(maj_stat, min_stat,
- "failed unsealing reply");
+ "failed unsealing reply");
return ('5');
}
if (msg_buf.length < ilen - 2 - 1) {
@@ -2474,7 +2478,7 @@ decode_reply(uchar_t *plain_buf,
*again = 1;
} else {
user_gss_error(maj_stat, min_stat,
- "reply was too long");
+ "reply was too long");
return ('5');
}
} /* end if GSSAPI */
diff --git a/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp_var.h b/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp_var.h
index 000166db3d..0533305669 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp_var.h
+++ b/usr/src/cmd/cmd-inet/usr.bin/ftp/ftp_var.h
@@ -24,7 +24,7 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -39,8 +39,6 @@
#ifndef _FTP_VAR_H
#define _FTP_VAR_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -92,90 +90,87 @@ extern "C" {
/*
* FTP global variables.
*/
-#ifndef EXTERN
-#define EXTERN extern
-#endif
#define DEFAULTFTPFILE "/etc/default/ftp"
/*
* Options and other state info.
*/
-EXTERN int trace; /* trace packets exchanged */
-EXTERN int hash; /* print # for each buffer transferred */
-EXTERN int sendport; /* use PORT cmd for each data connection */
-EXTERN int verbose; /* print messages coming back from server */
-EXTERN int connected; /* connected to server */
-EXTERN int fromatty; /* input is from a terminal */
-EXTERN int interactive; /* interactively prompt on m* cmds */
-EXTERN int debug; /* debugging level */
-EXTERN int bell; /* ring bell on cmd completion */
-EXTERN int doglob; /* glob local file names */
-EXTERN int autologin; /* establish user account on connection */
-EXTERN int proxy; /* proxy server connection active */
-EXTERN int proxflag; /* proxy connection exists */
-EXTERN int sunique; /* store files on server with unique name */
-EXTERN int runique; /* store local files with unique name */
-EXTERN int mcase; /* map upper to lower case for mget names */
-EXTERN int ntflag; /* use ntin ntout tables for name translation */
-EXTERN int mapflag; /* use mapin mapout templates on file names */
-EXTERN int code; /* return/reply code for ftp command */
-EXTERN int crflag; /* if 1, strip car. rets. on ascii gets */
-EXTERN char pasv[64]; /* passive port for proxy data connection */
-EXTERN char *altarg; /* argv[1] with no shell-like preprocessing */
-EXTERN char ntin[17]; /* input translation table */
-EXTERN char ntout[17]; /* output translation table */
-EXTERN char mapin[MAXPATHLEN]; /* input map template */
-EXTERN char mapout[MAXPATHLEN]; /* output map template */
-EXTERN char typename[32]; /* name of file transfer type */
-EXTERN int type; /* file transfer type */
-EXTERN char structname[32]; /* name of file transfer structure */
-EXTERN int stru; /* file transfer structure */
-EXTERN char formname[32]; /* name of file transfer format */
-EXTERN int form; /* file transfer format */
-EXTERN char modename[32]; /* name of file transfer mode */
-EXTERN int mode; /* file transfer mode */
-EXTERN char bytename[32]; /* local byte size in ascii */
-EXTERN int bytesize; /* local byte size in binary */
-EXTERN int passivemode; /* passive transfer mode toggle */
-EXTERN off_t restart_point; /* transfer restart offset */
-EXTERN int tcpwindowsize; /* TCP window size for the data connection */
-
-EXTERN boolean_t ls_invokes_NLST; /* behaviour of 'ls' */
-EXTERN char *hostname; /* name of host connected to */
-EXTERN char *home;
-EXTERN char *globerr;
-
-EXTERN struct sockaddr_in6 myctladdr; /* for channel bindings */
-EXTERN struct sockaddr_in6 remctladdr; /* for channel bindings */
-
-EXTERN int clevel; /* command channel protection level */
-EXTERN int dlevel; /* data channel protection level */
-
-EXTERN int autoauth; /* do authentication on connect */
-EXTERN int auth_type; /* authentication type */
-EXTERN int auth_error; /* one error code for all auth types */
-EXTERN int autoencrypt; /* do encryption on connect */
-EXTERN int fflag; /* forward credentials */
-EXTERN boolean_t goteof;
-
-EXTERN int skipsyst; /* enable automatic sending of SYST command */
-
-EXTERN uchar_t *ucbuf; /* clear text buffer */
+extern int trace; /* trace packets exchanged */
+extern int hash; /* print # for each buffer transferred */
+extern int sendport; /* use PORT cmd for each data connection */
+extern int verbose; /* print messages coming back from server */
+extern int connected; /* connected to server */
+extern int fromatty; /* input is from a terminal */
+extern int interactive; /* interactively prompt on m* cmds */
+extern int debug; /* debugging level */
+extern int bell; /* ring bell on cmd completion */
+extern int doglob; /* glob local file names */
+extern int autologin; /* establish user account on connection */
+extern int proxy; /* proxy server connection active */
+extern int proxflag; /* proxy connection exists */
+extern int sunique; /* store files on server with unique name */
+extern int runique; /* store local files with unique name */
+extern int mcase; /* map upper to lower case for mget names */
+extern int ntflag; /* use ntin ntout tables for name translation */
+extern int mapflag; /* use mapin mapout templates on file names */
+extern int code; /* return/reply code for ftp command */
+extern int crflag; /* if 1, strip car. rets. on ascii gets */
+extern char pasv[64]; /* passive port for proxy data connection */
+extern char *altarg; /* argv[1] with no shell-like preprocessing */
+extern char ntin[17]; /* input translation table */
+extern char ntout[17]; /* output translation table */
+extern char mapin[MAXPATHLEN]; /* input map template */
+extern char mapout[MAXPATHLEN]; /* output map template */
+extern char typename[32]; /* name of file transfer type */
+extern int type; /* file transfer type */
+extern char structname[32]; /* name of file transfer structure */
+extern int stru; /* file transfer structure */
+extern char formname[32]; /* name of file transfer format */
+extern int form; /* file transfer format */
+extern char modename[32]; /* name of file transfer mode */
+extern int mode; /* file transfer mode */
+extern char bytename[32]; /* local byte size in ascii */
+extern int bytesize; /* local byte size in binary */
+extern int passivemode; /* passive transfer mode toggle */
+extern off_t restart_point; /* transfer restart offset */
+extern int tcpwindowsize; /* TCP window size for the data connection */
+
+extern boolean_t ls_invokes_NLST; /* behaviour of 'ls' */
+extern char *hostname; /* name of host connected to */
+extern char *home;
+extern char *globerr;
+
+extern struct sockaddr_in6 myctladdr; /* for channel bindings */
+extern struct sockaddr_in6 remctladdr; /* for channel bindings */
+
+extern int clevel; /* command channel protection level */
+extern int dlevel; /* data channel protection level */
+
+extern int autoauth; /* do authentication on connect */
+extern int auth_type; /* authentication type */
+extern int auth_error; /* one error code for all auth types */
+extern int autoencrypt; /* do encryption on connect */
+extern int fflag; /* forward credentials */
+extern boolean_t goteof;
+
+extern int skipsyst; /* enable automatic sending of SYST command */
+
+extern uchar_t *ucbuf; /* clear text buffer */
#define MECH_SZ 40
#define FTP_DEF_MECH "kerberos_v5"
-EXTERN char mechstr[MECH_SZ]; /* mechanism type */
+extern char mechstr[MECH_SZ]; /* mechanism type */
-EXTERN gss_OID mechoid; /* corresponding mechanism oid type */
-EXTERN gss_ctx_id_t gcontext; /* gss security context */
+extern gss_OID mechoid; /* corresponding mechanism oid type */
+extern gss_ctx_id_t gcontext; /* gss security context */
#define FTPBUFSIZ BUFSIZ*16
#define HASHSIZ BUFSIZ*8
-EXTERN char *buf; /* buffer for binary sends and gets */
+extern char *buf; /* buffer for binary sends and gets */
-EXTERN jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
+extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
/*
* BUFSIZE includes
@@ -192,25 +187,25 @@ EXTERN jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
#define MAXCMDLEN 10 /* The length of longest command in cmdtab[] */
#define BUFSIZE ((MAXPATHLEN)*2+MAXCMDLEN+4)
-EXTERN char line[BUFSIZE]; /* input line buffer */
-EXTERN char *stringbase; /* current scan point in line buffer */
-EXTERN char argbuf[BUFSIZE]; /* argument storage buffer */
-EXTERN char *argbase; /* current storage point in arg buffer */
-EXTERN int margc; /* count of arguments on input line */
-EXTERN char **margv; /* args parsed from input line */
-EXTERN int cpend; /* flag: if != 0, then pending server reply */
-EXTERN int mflag; /* flag: if != 0, then active multi command */
-EXTERN FILE *tmp_nlst; /* tmp file; holds NLST results for mget, etc */
+extern char line[BUFSIZE]; /* input line buffer */
+extern char *stringbase; /* current scan point in line buffer */
+extern char argbuf[BUFSIZE]; /* argument storage buffer */
+extern char *argbase; /* current storage point in arg buffer */
+extern int margc; /* count of arguments on input line */
+extern char **margv; /* args parsed from input line */
+extern int cpend; /* flag: if != 0, then pending server reply */
+extern int mflag; /* flag: if != 0, then active multi command */
+extern FILE *tmp_nlst; /* tmp file; holds NLST results for mget, etc */
-EXTERN char *reply_parse; /* for parsing replies to the ADAT command */
-EXTERN char reply_buf[FTPBUFSIZ];
-EXTERN char *reply_ptr;
+extern char *reply_parse; /* for parsing replies to the ADAT command */
+extern char reply_buf[FTPBUFSIZ];
+extern char *reply_ptr;
-EXTERN int options; /* used during socket creation */
+extern int options; /* used during socket creation */
-EXTERN int timeout; /* connection timeout */
-EXTERN int timeoutms; /* connection timeout in msec */
-EXTERN jmp_buf timeralarm; /* to recover from global timeout */
+extern int timeout; /* connection timeout */
+extern int timeoutms; /* connection timeout in msec */
+extern jmp_buf timeralarm; /* to recover from global timeout */
/*
@@ -231,9 +226,9 @@ struct macel {
char *mac_end; /* end of macro in macbuf */
};
-EXTERN int macnum; /* number of defined macros */
-EXTERN struct macel macros[16];
-EXTERN char macbuf[4096];
+extern int macnum; /* number of defined macros */
+extern struct macel macros[16];
+extern char macbuf[4096];
extern void macdef(int argc, char *argv[]);
extern void doproxy(int argc, char *argv[]);
diff --git a/usr/src/cmd/cmd-inet/usr.bin/ftp/main.c b/usr/src/cmd/cmd-inet/usr.bin/ftp/main.c
index e787a45087..09a0782a50 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/ftp/main.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/ftp/main.c
@@ -24,7 +24,7 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -36,15 +36,86 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* FTP User Program -- Command Interface.
*/
-#define EXTERN
#include "ftp_var.h"
#include <deflt.h> /* macros that make using libcmd easier */
+int trace;
+int hash;
+int sendport;
+int verbose;
+int connected;
+int fromatty;
+int interactive;
+int debug;
+int bell;
+int doglob;
+int autologin;
+int proxy;
+int proxflag;
+int sunique;
+int runique;
+int mcase;
+int ntflag;
+int mapflag;
+int code;
+int crflag;
+char pasv[64];
+char *altarg;
+char ntin[17];
+char ntout[17];
+char mapin[MAXPATHLEN];
+char mapout[MAXPATHLEN];
+char typename[32];
+int type;
+char structname[32];
+int stru;
+char formname[32];
+int form;
+char modename[32];
+int mode;
+char bytename[32];
+int bytesize;
+int passivemode;
+off_t restart_point;
+int tcpwindowsize;
+boolean_t ls_invokes_NLST;
+char *hostname;
+char *home;
+char *globerr;
+struct sockaddr_in6 myctladdr;
+struct sockaddr_in6 remctladdr;
+int clevel;
+int dlevel;
+int autoauth;
+int auth_error;
+int autoencrypt;
+int fflag;
+boolean_t goteof;
+int skipsyst;
+char mechstr[MECH_SZ];
+char *buf;
+jmp_buf toplevel;
+char line[BUFSIZE];
+char *stringbase;
+char argbuf[BUFSIZE];
+char *argbase;
+int margc;
+char **margv;
+int cpend;
+int mflag;
+char reply_buf[FTPBUFSIZ];
+char *reply_ptr;
+int options;
+int timeout;
+int timeoutms;
+jmp_buf timeralarm;
+int macnum;
+struct macel macros[16];
+char macbuf[4096];
+
static void usage(void);
static void timeout_sig(int sig);
static void cmdscanner(int top);
@@ -132,7 +203,7 @@ main(int argc, char *argv[])
case 'T':
if (!isdigit(*optarg)) {
(void) fprintf(stderr,
- "ftp: bad timeout: \"%s\"\n", optarg);
+ "ftp: bad timeout: \"%s\"\n", optarg);
break;
}
timeout = atoi(optarg);
@@ -627,7 +698,7 @@ help(int argc, char *argv[])
extern int NCMDS;
(void) printf(
- "Commands may be abbreviated. Commands are:\n\n");
+ "Commands may be abbreviated. Commands are:\n\n");
for (c = cmdtab; c < &cmdtab[NCMDS]; c++) {
int len = strlen(c->c_name);
@@ -673,7 +744,7 @@ help(int argc, char *argv[])
(void) printf("?Invalid help command %s\n", arg);
else
(void) printf("%-*s\t%s\n", HELPINDENT,
- c->c_name, c->c_help);
+ c->c_name, c->c_help);
}
}
diff --git a/usr/src/cmd/csh/sh.c b/usr/src/cmd/csh/sh.c
index 3c7a898409..aacffdefed 100644
--- a/usr/src/cmd/csh/sh.c
+++ b/usr/src/cmd/csh/sh.c
@@ -48,6 +48,8 @@ bool fast;
bool batch;
bool prompt = 1;
bool enterhist = 0;
+static time_t chktim;
+char *err_msg; /* Error message from scanner/parser */
extern gid_t getegid(), getgid();
extern uid_t geteuid(), getuid();
@@ -123,6 +125,7 @@ main(int c, char **av)
tchar s_prompt[MAXHOSTNAMELEN+3];
char *c_max_var_len;
int c_max_var_len_size;
+ bool intact;
/*
* set up the error exit, if there is an error before
@@ -883,7 +886,6 @@ pintr1(bool wantnl)
*/
if (gointr) {
search(ZGOTO, 0, gointr);
- timflg = 0;
if (v = pargv)
pargv = 0, blkfree(v);
if (v = gargv)
@@ -974,7 +976,7 @@ process(bool catch)
if (fseekp == feobp)
printprompt();
}
- err = 0;
+ err_msg = NULL;
/*
* Echo not only on VERBOSE, but also with history expansion.
@@ -1005,8 +1007,8 @@ process(bool catch)
* Print lexical error messages, except when sourcing
* history lists.
*/
- if (!enterhist && err)
- error("%s", gettext(err));
+ if (!enterhist && err_msg)
+ error("%s", gettext(err_msg));
/*
* If had a history command :p modifier then
@@ -1021,8 +1023,8 @@ process(bool catch)
* Parse the words of the input into a parse tree.
*/
t = syntax(paraml.next, &paraml, 0);
- if (err)
- error("%s", gettext(err));
+ if (err_msg)
+ error("%s", gettext(err_msg));
/*
* Execute the parse tree
@@ -1041,8 +1043,8 @@ process(bool catch)
(void) sigsetmask(omask &~ sigmask(SIGCHLD));
}
- if (err)
- error("%s", gettext(err));
+ if (err_msg)
+ error("%s", gettext(err_msg));
/*
* Made it!
*/
diff --git a/usr/src/cmd/csh/sh.char.c b/usr/src/cmd/csh/sh.char.c
index 8c79005dd7..303c9d2270 100644
--- a/usr/src/cmd/csh/sh.char.c
+++ b/usr/src/cmd/csh/sh.char.c
@@ -12,10 +12,9 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.char.h"
+unsigned int Z;
unsigned short _cmap[128] = {
/* nul soh stx etx */
0, 0, 0, 0,
diff --git a/usr/src/cmd/csh/sh.char.h b/usr/src/cmd/csh/sh.char.h
index 3a46db7ba9..a76808b854 100644
--- a/usr/src/cmd/csh/sh.char.h
+++ b/usr/src/cmd/csh/sh.char.h
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Macros to classify characters.
*/
@@ -35,7 +33,7 @@
#define isauxspZ 0
#endif
extern unsigned short _cmap[];/* Defined in sh.char.c */
-unsigned int Z; /* A place to save macro arg to avoid side-effect!*/
+extern unsigned int Z; /* A place to save macro arg to avoid side-effect!*/
#define _Q 0x01 /* '" */
#define _Q1 0x02 /* ` */
diff --git a/usr/src/cmd/csh/sh.dir.c b/usr/src/cmd/csh/sh.dir.c
index 29031692f5..3ba63280a5 100644
--- a/usr/src/cmd/csh/sh.dir.c
+++ b/usr/src/cmd/csh/sh.dir.c
@@ -13,8 +13,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.dir.h"
#include "sh.tconst.h"
@@ -30,9 +28,15 @@ void dtildepr(tchar *, tchar *);
void dfree(struct directory *);
void dnewcwd(struct directory *);
+int didchdir;
+bool loginsh;
+bool havhash2;
+struct varent shvhed;
+struct directory *dcwd;
struct directory dhead; /* "head" of loop */
int printd; /* force name to be printed */
static tchar *fakev[] = { S_dirs, NOSTR };
+char xhash2[HSHSIZ / 8];
/*
* dinit - initialize current working directory
diff --git a/usr/src/cmd/csh/sh.dir.h b/usr/src/cmd/csh/sh.dir.h
index 78ece4a533..47d705534a 100644
--- a/usr/src/cmd/csh/sh.dir.h
+++ b/usr/src/cmd/csh/sh.dir.h
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Structure for entries in directory stack.
*/
@@ -21,6 +19,6 @@ struct directory {
struct directory *di_next; /* next in loop */
struct directory *di_prev; /* prev in loop */
unsigned short *di_count; /* refcount of processes */
- tchar *di_name; /* actual name */
+ tchar *di_name; /* actual name */
};
-struct directory *dcwd; /* the one we are in now */
+extern struct directory *dcwd; /* the one we are in now */
diff --git a/usr/src/cmd/csh/sh.dol.c b/usr/src/cmd/csh/sh.dol.c
index fe0b88f4b0..8d963e7239 100644
--- a/usr/src/cmd/csh/sh.dol.c
+++ b/usr/src/cmd/csh/sh.dol.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h> /* for lseek prototype */
#include "sh.h"
#include "sh.tconst.h"
@@ -22,6 +20,17 @@
* C shell
*/
+bool noexec;
+long gargc;
+short OLDSTD;
+short gflag;
+tchar *bname;
+tchar *file;
+tchar **gargv;
+tchar *doldol;
+tchar *lap;
+tchar **pargv;
+
/*
* These routines perform variable substitution and quoting via ' and ".
* To this point these constructs have been preserved in the divided
@@ -297,7 +306,7 @@ quotspec:
* the input is original, not from a substitution and
* therefore should not be quoted
*/
- if (!err && cmap(c, QUOTES))
+ if (!err_msg && cmap(c, QUOTES))
return (c | QUOTE);
return (c);
}
diff --git a/usr/src/cmd/csh/sh.err.c b/usr/src/cmd/csh/sh.err.c
index 813450b297..99644044b2 100644
--- a/usr/src/cmd/csh/sh.err.c
+++ b/usr/src/cmd/csh/sh.err.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include <locale.h>
#include <dirent.h>
@@ -27,11 +25,18 @@
* C Shell
*/
-
+bool child;
+bool didfds;
+bool exiterr;
bool errspl; /* Argument to error was spliced by seterr2 */
+bool haderr;
+jmp_buf reslab;
tchar one[2] = { '1', 0 };
tchar *onev[2] = { one, NOSTR };
-/*
+short SHDIAG;
+int tpgrp;
+
+/*
* contains DIR * for last opendir_(), its left open if an error
* longjmp (reset) occurs before it gets closed via closedir.
* if its not null in the error handler, then closedir it.
@@ -65,7 +70,6 @@ error(s, a1, a2)
*/
flush();
haderr = 1; /* Now to diagnostic output */
- timflg = 0; /* This isn't otherwise reset */
if (v = pargv)
pargv = 0, blkfree(v);
if (v = gargv)
@@ -76,12 +80,12 @@ error(s, a1, a2)
* an error diagnostic here.
*/
if (s) {
- printf(s, a1, a2), printf("\n");
+ printf(s, a1, a2), printf("\n");
}
-
+
didfds = 0; /* Forget about 0,1,2 */
- if ((ep = err) && errspl) {
+ if ((ep = err_msg) && errspl) {
errspl = 0;
xfree(ep);
}
@@ -155,8 +159,8 @@ void
seterr(char *s)
{
- if (err == 0)
- err = s, errspl = 0;
+ if (err_msg == NULL)
+ err_msg = s, errspl = 0;
}
/* Set err to a splice of cp and dp, to be freed later in error() */
@@ -166,27 +170,27 @@ seterr2(tchar *cp, char *dp)
char chbuf[BUFSIZ];
char *gdp;
- if (err)
+ if (err_msg)
return;
/* Concatinate cp and dp in the allocated space. */
tstostr(chbuf, cp);
gdp = gettext(dp);
- err = (char *)xalloc(strlen(chbuf)+strlen(gdp)+1);
- strcpy(err, chbuf);
- strcat(err, gdp);
+ err_msg = (char *)xalloc(strlen(chbuf)+strlen(gdp)+1);
+ strcpy(err_msg, chbuf);
+ strcat(err_msg, gdp);
- errspl++;/* Remember to xfree(err). */
+ errspl++;/* Remember to xfree(err_msg). */
}
/* Set err to a splice of cp with a string form of character d */
void
seterrc(char *cp, tchar d)
{
- char chbuf[MB_LEN_MAX+1];
+ char chbuf[MB_LEN_MAX+1];
/* don't overwrite an existing error message */
- if (err)
+ if (err_msg)
return;
#ifdef MBCHAR
@@ -203,9 +207,9 @@ seterrc(char *cp, tchar d)
/* Concatinate cp and d in the allocated space. */
- err = (char *)xalloc(strlen(cp)+strlen(chbuf)+1);
- strcpy(err, cp);
- strcat(err, chbuf);
+ err_msg = (char *)xalloc(strlen(cp)+strlen(chbuf)+1);
+ strcpy(err_msg, cp);
+ strcat(err_msg, chbuf);
- errspl++; /* Remember to xfree(err). */
+ errspl++; /* Remember to xfree(err_msg). */
}
diff --git a/usr/src/cmd/csh/sh.exec.c b/usr/src/cmd/csh/sh.exec.c
index eee2d16440..06648c9c35 100644
--- a/usr/src/cmd/csh/sh.exec.c
+++ b/usr/src/cmd/csh/sh.exec.c
@@ -28,6 +28,21 @@
* If there is no search path then we execute only full path names.
*/
+char xhash[HSHSIZ / 8];
+tchar **Vav;
+tchar *Vdp;
+tchar *Vsav;
+
+struct varent aliases;
+bool havhash;
+static int hits;
+static int misses;
+short SHOUT;
+short SHIN;
+
+void (*parintr)();
+void (*parterm)();
+
/*
* As we search for the command we note the first non-trivial error
* message for presentation to the user. This allows us often
diff --git a/usr/src/cmd/csh/sh.exp.c b/usr/src/cmd/csh/sh.exp.c
index 2447692682..ad94bf5b04 100644
--- a/usr/src/cmd/csh/sh.exp.c
+++ b/usr/src/cmd/csh/sh.exp.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.tconst.h"
@@ -38,6 +36,8 @@
#define EQMATCH 7
#define NOTEQMATCH 8
+int uid;
+
int exp0(tchar ***, bool);
int exp1(tchar ***, bool);
int exp2(tchar ***, bool);
@@ -72,7 +72,7 @@ chk_access(tchar *path, mode_t mode)
unsigned char name[MAXPATHLEN*MB_LEN_MAX]; /* General use buffer. */
/* convert tchar * to char * */
- tstostr(name, path);
+ tstostr((char *)name, path);
if (flag == 0) {
euid = geteuid();
@@ -611,8 +611,8 @@ evalav(tchar **v)
hp->prev = wdp;
alias(&paraml);
t = syntax(paraml.next, &paraml, 0);
- if (err)
- error("%s", gettext(err));
+ if (err_msg)
+ error("%s", gettext(err_msg));
execute(t, -1);
freelex(&paraml), freesyn(t);
}
diff --git a/usr/src/cmd/csh/sh.func.c b/usr/src/cmd/csh/sh.func.c
index 79350599df..7d3740cef8 100644
--- a/usr/src/cmd/csh/sh.func.c
+++ b/usr/src/cmd/csh/sh.func.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include <locale.h> /* For LC_ALL */
#include "sh.tconst.h"
@@ -50,6 +48,19 @@ struct limits {
-1, 0,
};
+struct Bin B;
+struct whyle *whyles;
+bool chkstop;
+bool doneinp;
+bool intty;
+bool setintr;
+int shpgrp;
+int opgrp;
+off_t lineloc;
+tchar *evalp;
+tchar **evalvec;
+tchar *gointr;
+
static int getval(struct limits *lp, tchar **v, rlim_t *);
void islogin(void);
diff --git a/usr/src/cmd/csh/sh.glob.c b/usr/src/cmd/csh/sh.glob.c
index db0122c0c6..db878615da 100644
--- a/usr/src/cmd/csh/sh.glob.c
+++ b/usr/src/cmd/csh/sh.glob.c
@@ -25,13 +25,18 @@
* C Shell
*/
+static long pargc;
+static long gnleft;
+static long pnleft;
int globcnt;
-
+tchar *arginp;
+static tchar *pargs;
tchar *gpath, *gpathp, *lastgpathp;
int globbed;
bool noglob;
bool nonomatch;
tchar *entp;
+static tchar *pargcp;
tchar **sortbas;
int sortscmp(tchar **, tchar **);
void ginit(tchar **);
@@ -800,12 +805,12 @@ backeval(tchar *cp, bool literal)
HIST = 0;
(void) lex(&paraml);
HIST = oHIST;
- if (err)
- error("%s", gettext(err));
+ if (err_msg)
+ error("%s", gettext(err_msg));
alias(&paraml);
t = syntax(paraml.next, &paraml, 0);
- if (err)
- error("%s", gettext(err));
+ if (err_msg)
+ error("%s", gettext(err_msg));
if (t)
t->t_dflg |= FPAR;
(void) signal(SIGTSTP, SIG_IGN);
diff --git a/usr/src/cmd/csh/sh.h b/usr/src/cmd/csh/sh.h
index 6aaf4a716f..b394ca2bbc 100644
--- a/usr/src/cmd/csh/sh.h
+++ b/usr/src/cmd/csh/sh.h
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdlib.h> /* MB_xxx, mbxxx(), wcxxx() etc. */
#include <limits.h>
#include <sys/time.h>
@@ -71,7 +69,7 @@
* However, if the user set $cwd, we want the globbing
* done; so, didchdir would be equal to 0 in that case.
*/
-int didchdir;
+extern int didchdir;
#define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR)
@@ -104,51 +102,45 @@ typedef unsigned short int tchar;
/*
* Global flags
*/
-bool chkstop; /* Warned of stopped jobs... allow exit */
-bool didfds; /* Have setup i/o fd's for child */
-bool doneinp; /* EOF indicator after reset from readc */
-bool exiterr; /* Exit if error or non-zero exit status */
-bool child; /* Child shell ... errors cause exit */
-bool haderr; /* Reset was because of an error */
-bool intty; /* Input is a tty */
-bool cflg; /* invoked with -c option */
-bool intact; /* We are interactive... therefore prompt */
-bool justpr; /* Just print because of :p hist mod */
-bool loginsh; /* We are a loginsh -> .login/.logout */
-bool neednote; /* Need to pnotify() */
-bool noexec; /* Don't execute, just syntax check */
-bool pjobs; /* want to print jobs if interrupted */
-bool pfcshflag; /* set to 0 for pfcsh */
-bool setintr; /* Set interrupts on/off -> Wait intr... */
-bool timflg; /* Time the next waited for command */
-bool havhash; /* path hashing is available */
-bool havhash2; /* cdpath hashing is available */
+extern bool chkstop; /* Warned of stopped jobs... allow exit */
+extern bool didfds; /* Have setup i/o fd's for child */
+extern bool doneinp; /* EOF indicator after reset from readc */
+extern bool exiterr; /* Exit if error or non-zero exit status */
+extern bool child; /* Child shell ... errors cause exit */
+extern bool haderr; /* Reset was because of an error */
+extern bool intty; /* Input is a tty */
+extern bool cflg; /* invoked with -c option */
+extern bool justpr; /* Just print because of :p hist mod */
+extern bool loginsh; /* We are a loginsh -> .login/.logout */
+extern bool neednote; /* Need to pnotify() */
+extern bool noexec; /* Don't execute, just syntax check */
+extern bool pjobs; /* want to print jobs if interrupted */
+extern bool setintr; /* Set interrupts on/off -> Wait intr... */
+extern bool havhash; /* path hashing is available */
+extern bool havhash2; /* cdpath hashing is available */
#ifdef FILEC
-bool filec; /* doing filename expansion */
+extern bool filec; /* doing filename expansion */
#endif
/*
* Global i/o info
*/
-tchar *arginp; /* Argument input for sh -c and internal `xx` */
-int onelflg; /* 2 -> need line for -t, 1 -> exit on read */
-tchar *file; /* Name of shell file for $0 */
+extern tchar *arginp; /* Argument input for sh -c and internal `xx` */
+extern int onelflg; /* 2 -> need line for -t, 1 -> exit on read */
+extern tchar *file; /* Name of shell file for $0 */
-char *err; /* Error message from scanner/parser */
-struct timeval time0; /* Time at which the shell started */
-struct rusage ru0;
+extern char *err_msg; /* Error message from scanner/parser */
+extern struct timeval time0; /* Time at which the shell started */
/*
* Miscellany
*/
-tchar *doldol; /* Character pid for $$ */
-int uid; /* Invokers uid */
-time_t chktim; /* Time mail last checked */
-int shpgrp; /* Pgrp of shell */
-int tpgrp; /* Terminal process group */
+extern tchar *doldol; /* Character pid for $$ */
+extern int uid; /* Invokers uid */
+extern int shpgrp; /* Pgrp of shell */
+extern int tpgrp; /* Terminal process group */
/* If tpgrp is -1, leave tty alone! */
-int opgrp; /* Initial pgrp and tty pgrp */
-int oldisc; /* Initial line discipline or -1 */
+extern int opgrp; /* Initial pgrp and tty pgrp */
/*
* These are declared here because they want to be
@@ -176,10 +168,10 @@ extern int nsrchn;
* The desired initial values for these descriptors are defined in
* sh.local.h.
*/
-short SHIN; /* Current shell input (script) */
-short SHOUT; /* Shell output */
-short SHDIAG; /* Diagnostic output... shell errs go here */
-short OLDSTD; /* Old standard input (def for cmds) */
+extern short SHIN; /* Current shell input (script) */
+extern short SHOUT; /* Shell output */
+extern short SHDIAG; /* Diagnostic output... shell errs go here */
+extern short OLDSTD; /* Old standard input (def for cmds) */
/*
* Error control
@@ -189,7 +181,7 @@ short OLDSTD; /* Old standard input (def for cmds) */
* Because of source commands and .cshrc we need nested error catches.
*/
-jmp_buf reslab;
+extern jmp_buf reslab;
#define setexit() ((void) setjmp(reslab))
#define reset() longjmp(reslab, 0)
@@ -197,9 +189,9 @@ jmp_buf reslab;
#define getexit(a) copy((void *)(a), (void *)reslab, sizeof reslab)
#define resexit(a) copy((void *)reslab, ((void *)(a)), sizeof reslab)
-tchar *gointr; /* Label for an onintr transfer */
-void (*parintr)(); /* Parents interrupt catch */
-void (*parterm)(); /* Parents terminate catch */
+extern tchar *gointr; /* Label for an onintr transfer */
+extern void (*parintr)(); /* Parents interrupt catch */
+extern void (*parterm)(); /* Parents terminate catch */
/*
@@ -209,7 +201,7 @@ void (*parterm)(); /* Parents terminate catch */
* In other cases, the shell buffers enough blocks to keep all loops
* in the buffer.
*/
-struct Bin {
+extern struct Bin {
off_t Bfseekp; /* Seek pointer */
off_t Bfbobp; /* Seekp of beginning of buffers */
off_t Bfeobp; /* Seekp of end of buffers */
@@ -226,7 +218,7 @@ struct Bin {
#define btell() fseekp
#ifndef btell
-off_t btell(void);
+extern off_t btell(void);
#endif
/*
@@ -234,10 +226,10 @@ off_t btell(void);
* For whiles, in particular, it reseeks to the beginning of the
* line the while was on; hence the while placement restrictions.
*/
-off_t lineloc;
+extern off_t lineloc;
#ifdef TELL
-bool cantell; /* Is current source tellable ? */
+extern bool cantell; /* Is current source tellable ? */
#endif
/*
@@ -263,16 +255,7 @@ struct wordent {
#define DOEXCL 2
#define DOALL DODOL|DOEXCL
-/*
- * Labuf implements a general buffer for lookahead during lexical operations.
- * Text which is to be placed in the input stream can be stuck here.
- * We stick parsed ahead $ constructs during initial input,
- * process id's from `$$', and modified variable values (from qualifiers
- * during expansion in sh.dol.c) here.
- */
-tchar *labuf;
-
-tchar *lap;
+extern tchar *lap;
/*
* Parser structure
@@ -355,7 +338,7 @@ struct command {
* source level. Loops are implemented by seeking back in the
* input. For foreach (fe), the word list is attached here.
*/
-struct whyle {
+extern struct whyle {
off_t w_start; /* Point to restart loop */
off_t w_end; /* End of loop (0 if unknown) */
tchar **w_fe, **w_fe0; /* Current/initial wordlist for fe */
@@ -368,7 +351,7 @@ struct whyle {
*
* Aliases and variables are stored in AVL balanced binary trees.
*/
-struct varent {
+extern struct varent {
tchar **vec; /* Array of words which is the value */
tchar *v_name; /* Name of variable/alias */
struct varent *v_link[3]; /* The links, see below */
@@ -398,14 +381,14 @@ struct varent *adrof1();
* The following are for interfacing redo substitution in
* aliases to the lexical routines.
*/
-struct wordent *alhistp; /* Argument list (first) */
-struct wordent *alhistt; /* Node after last in arg list */
-tchar **alvec; /* The (remnants of) alias vector */
+extern struct wordent *alhistp; /* Argument list (first) */
+extern struct wordent *alhistt; /* Node after last in arg list */
+extern tchar **alvec; /* The (remnants of) alias vector */
/*
* Filename/command name expansion variables
*/
-short gflag; /* After tglob -> is globbing needed? */
+extern short gflag; /* After tglob -> is globbing needed? */
/*
* A reasonable limit on number of arguments would seem to be
@@ -427,18 +410,13 @@ short gflag; /* After tglob -> is globbing needed? */
/*
* Variables for filename expansion
*/
-tchar **gargv; /* Pointer to the (stack) arglist */
-long gargc; /* Number args in gargv */
-long gnleft;
+extern tchar **gargv; /* Pointer to the (stack) arglist */
+extern long gargc; /* Number args in gargv */
/*
* Variables for command expansion.
*/
-tchar **pargv; /* Pointer to the argv list space */
-tchar *pargs; /* Pointer to start current word */
-long pargc; /* Count of arguments in pargv */
-long pnleft; /* Number of chars left in pargs */
-tchar *pargcp; /* Current index into pargs */
+extern tchar **pargv; /* Pointer to the argv list space */
/*
* History list
@@ -451,19 +429,18 @@ tchar *pargcp; /* Current index into pargs */
* when history substitution includes modifiers, and thrown away
* at the next discarding since their event numbers are very negative.
*/
-struct Hist {
+extern struct Hist {
struct wordent Hlex;
int Hnum;
int Href;
struct Hist *Hnext;
} Histlist;
-struct wordent paraml; /* Current lexical word list */
-int eventno; /* Next events number */
-int lastev; /* Last event reference (default) */
+extern struct wordent paraml; /* Current lexical word list */
+extern int eventno; /* Next events number */
-tchar HIST; /* history invocation character */
-tchar HISTSUB; /* auto-substitute character */
+extern tchar HIST; /* history invocation character */
+extern tchar HISTSUB; /* auto-substitute character */
extern void *xalloc(size_t);
extern void *xcalloc(size_t, size_t);
@@ -511,7 +488,7 @@ extern tchar *value1(tchar *, struct varent *);
* Here we are dynamically reallocating the bname to the new length
* to store the new path
*/
-tchar *bname;
+extern tchar *bname;
#define setname(a) { \
bname = xrealloc(bname, (strlen_(a)+1) * sizeof (tchar)); \
strcpy_(bname, a); \
@@ -519,17 +496,17 @@ tchar *bname;
}
#ifdef VFORK
-tchar *Vsav;
-tchar **Vav;
-tchar *Vdp;
+extern tchar *Vsav;
+extern tchar **Vav;
+extern tchar *Vdp;
#endif
-tchar **evalvec;
-tchar *evalp;
+extern tchar **evalvec;
+extern tchar *evalp;
/* Conversion functions between char and tchar strings. */
-tchar *strtots(/* tchar * , char * */);
-char *tstostr(/* char * , tchar * */);
+tchar *strtots(tchar *, char *);
+char *tstostr(char *, tchar *);
#ifndef NULL
#define NULL 0
@@ -559,11 +536,8 @@ char *tstostr(/* char * , tchar * */);
* variable.
*/
-char xhash[HSHSIZ / 8];
-char xhash2[HSHSIZ / 8];
+extern char xhash[HSHSIZ / 8];
+extern char xhash2[HSHSIZ / 8];
#define hash(a, b) ((a) * HSHMUL + (b) & HSHMASK)
#define bit(h, b) ((h)[(b) >> 3] & 1 << ((b) & 7)) /* bit test */
#define bis(h, b) ((h)[(b) >> 3] |= 1 << ((b) & 7)) /* bit set */
-#ifdef VFORK
-int hits, misses;
-#endif
diff --git a/usr/src/cmd/csh/sh.hist.c b/usr/src/cmd/csh/sh.hist.c
index fb8b5e06ce..c1bc5a2851 100644
--- a/usr/src/cmd/csh/sh.hist.c
+++ b/usr/src/cmd/csh/sh.hist.c
@@ -12,11 +12,12 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.tconst.h"
+struct Hist Histlist;
+int eventno;
+
struct Hist *enthist(int, struct wordent *, bool);
void hfree(struct Hist *);
void dohist1(struct Hist *, int *, int, int);
diff --git a/usr/src/cmd/csh/sh.lex.c b/usr/src/cmd/csh/sh.lex.c
index 4286f8669a..8b1522067e 100644
--- a/usr/src/cmd/csh/sh.lex.c
+++ b/usr/src/cmd/csh/sh.lex.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h> /* for lseek prototype */
#include "sh.h"
#include "sh.tconst.h"
@@ -24,6 +22,14 @@
* C shell
*/
+bool justpr;
+static int lastev;
+int onelflg;
+tchar **alvec;
+struct wordent *alhistp;
+struct wordent *alhistt;
+struct wordent paraml;
+
/*
* These lexical routines read input and form lists of words.
* There is some involved processing here, because of the complications
@@ -330,7 +336,7 @@ top:
* the input is original, not from a substitution and
* therefore should not be quoted
*/
- if (!err && cmap(c, _META|_Q|_Q1)||isauxsp(c))
+ if (!err_msg && cmap(c, _META|_Q|_Q1)||isauxsp(c))
c |= QUOTE;
return (c);
}
@@ -480,6 +486,7 @@ void
addla(tchar *cp)
{
tchar *buf;
+ static tchar *labuf = NULL;
int len = 0;
#ifdef TRACE
diff --git a/usr/src/cmd/csh/sh.parse.c b/usr/src/cmd/csh/sh.parse.c
index b936126c8d..60801ec25e 100644
--- a/usr/src/cmd/csh/sh.parse.c
+++ b/usr/src/cmd/csh/sh.parse.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.tconst.h"
@@ -150,9 +148,9 @@ asyn3(struct wordent *p1, struct wordent *p2)
redid = lex(&alout);
alhistp = alhistt = 0;
alvec = 0;
- if (err) {
+ if (err_msg) {
freelex(&alout);
- error("%s", gettext(err));
+ error("%s", gettext(err_msg));
}
if (p1->word[0] && eq(p1->word, alout.next->word)) {
tchar *cp = alout.next->word;
@@ -623,7 +621,7 @@ savep:
default:
if (l != 0 && !specp)
continue;
- if (err == 0)
+ if (err_msg == NULL)
av[n] = savestr(p->word);
n++;
continue;
diff --git a/usr/src/cmd/csh/sh.proc.c b/usr/src/cmd/csh/sh.proc.c
index 298c2e718a..4dc608c88c 100644
--- a/usr/src/cmd/csh/sh.proc.c
+++ b/usr/src/cmd/csh/sh.proc.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.dir.h"
#include "sh.proc.h"
@@ -24,6 +22,15 @@
* C Shell - functions that manage processes, handling hanging, termination
*/
+bool neednote;
+bool pjobs;
+static struct process *pprevious;
+static short pmaxindex;
+static struct process proclist;
+static struct process *pcurrent;
+struct process *pcurrjob;
+static struct process *pholdjob;
+
#define BIGINDEX 9 /* largest desirable job index */
void pjwait(struct process *);
@@ -71,7 +78,6 @@ loop:
errno = 0;
goto loop;
}
- pnoprocesses = pid == -1;
return;
}
for (pp = proclist.p_next; pp != PNULL; pp = pp->p_next)
diff --git a/usr/src/cmd/csh/sh.proc.h b/usr/src/cmd/csh/sh.proc.h
index 67aa69f763..eb275ba39d 100644
--- a/usr/src/cmd/csh/sh.proc.h
+++ b/usr/src/cmd/csh/sh.proc.h
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* C shell - process structure declarations
*/
@@ -78,13 +76,4 @@ struct process {
#define JOBDIR 0100 /* print job's dir if not the same */
#define AREASON 0200
-struct process proclist; /* list head of all processes */
-bool pnoprocesses; /* pchild found nothing to wait for */
-
-struct process *pholdjob; /* one level stack of current jobs */
-
-struct process *pcurrjob; /* current job */
-struct process *pcurrent; /* current job in table */
-struct process *pprevious; /* previous job in table */
-
-short pmaxindex; /* current maximum job index */
+extern struct process *pcurrjob; /* current job */
diff --git a/usr/src/cmd/csh/sh.set.c b/usr/src/cmd/csh/sh.set.c
index 51f49ae4f4..6ce3eb93c9 100644
--- a/usr/src/cmd/csh/sh.set.c
+++ b/usr/src/cmd/csh/sh.set.c
@@ -12,11 +12,8 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.tconst.h"
-extern int didchdir;
/*
* C Shell
diff --git a/usr/src/cmd/csh/sh.tchar.c b/usr/src/cmd/csh/sh.tchar.c
index acd7856e0e..767294af16 100644
--- a/usr/src/cmd/csh/sh.tchar.c
+++ b/usr/src/cmd/csh/sh.tchar.c
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This module provides with system/library function substitutes for tchar
* datatype. This also includes two conversion functions between tchar and
@@ -51,6 +49,7 @@
#include <fcntl.h>
#include <unistd.h>
+bool cflg;
/*
* strtots(to, from): convert a char string 'from' into a tchar buffer 'to'.
diff --git a/usr/src/cmd/csh/sh.time.c b/usr/src/cmd/csh/sh.time.c
index 1c92bc61ef..e53db7fe80 100644
--- a/usr/src/cmd/csh/sh.time.c
+++ b/usr/src/cmd/csh/sh.time.c
@@ -12,11 +12,12 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "sh.h"
#include "sh.tconst.h"
+struct timeval time0;
+static struct rusage ru0;
+
void ruadd(struct rusage *ru, struct rusage *ru2);
void prusage(struct rusage *r0, struct rusage *r1, struct timeval *e,
struct timeval *b);
diff --git a/usr/src/cmd/format/ctlr_ata.c b/usr/src/cmd/format/ctlr_ata.c
index c8f982d71b..e41c8e5580 100644
--- a/usr/src/cmd/format/ctlr_ata.c
+++ b/usr/src/cmd/format/ctlr_ata.c
@@ -56,25 +56,18 @@
#include "menu_fdisk.h"
+diskaddr_t altsec_offset;
+
int wr_altsctr();
int read_altsctr();
int updatebadsec();
-#ifdef __STDC__
static int ata_ck_format(void);
#ifdef i386
static int ata_ex_cur(struct defect_list *);
static int ata_wr_cur(struct defect_list *);
static int ata_repair(diskaddr_t, int);
#endif /* i386 */
-#else /* __STDC__ */
-static int ata_ck_format();
-#ifdef i386
-static int ata_ex_cur();
-static int ata_wr_cur();
-static int ata_repair();
-#endif /* i386 */
-#endif
struct ctlr_ops ataops = {
#if defined(sparc)
@@ -138,15 +131,9 @@ static char *dadkrawioerrs[] = {
};
/*ARGSUSED6*/
-#if defined(i386)
-int
-ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
- int flags, int *xfercntp)
-#else /* defined(i386) */
-static int
+_STATIC int
ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
- int flags, int *xfercntp)
-#endif /* defined(i386) */
+ int flags, int *xfercntp)
{
int tmpsec;
struct dadkio_rwcmd dadkio_rwcmd;
@@ -159,7 +146,7 @@ ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
/* Doing raw read */
dadkio_rwcmd.cmd = (dir == DIR_READ) ? DADKIO_RWCMD_READ :
- DADKIO_RWCMD_WRITE;
+ DADKIO_RWCMD_WRITE;
dadkio_rwcmd.blkaddr = blkno;
dadkio_rwcmd.buflen = tmpsec;
dadkio_rwcmd.flags = flags;
@@ -204,7 +191,7 @@ ata_rdwr(int dir, int fd, diskaddr_t blk64, int secnt, caddr_t bufaddr,
if (dadkio_rwcmd.status.status) {
if ((flags & F_SILENT) == 0)
err_print(dadkrawioerrs[dadkio_rwcmd.status.status],
- dadkio_rwcmd.status.failed_blk);
+ dadkio_rwcmd.status.failed_blk);
return (1);
}
return (0);
diff --git a/usr/src/cmd/format/ctlr_ata.h b/usr/src/cmd/format/ctlr_ata.h
index 38e3fcdc10..dc1b5d4c87 100644
--- a/usr/src/cmd/format/ctlr_ata.h
+++ b/usr/src/cmd/format/ctlr_ata.h
@@ -46,43 +46,26 @@ extern "C" {
#define TRIPLET(u, m, l) ((int)((((u))&0xff<<16) + \
(((m)&0xff)<<8) + (l&0xff)))
#if defined(i386)
-diskaddr_t altsec_offset; /* Alternate sector offset */
+extern diskaddr_t altsec_offset; /* Alternate sector offset */
#endif /* defined(i386) */
-#ifdef __STDC__
/*
* Local prototypes for ANSI C compilers
*/
#if defined(i386)
-int ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
-#else /* defined(i386) */
-static int ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
+#define _STATIC
+#else
+#define _STATIC static
#endif /* defined(i386) */
+_STATIC int ata_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
+
int ata_ex_man(struct defect_list *);
int ata_ex_grown(struct defect_list *);
int ata_read_defect_data(struct defect_list *, int);
int apply_chg_list(int, int, uchar_t *, uchar_t *, struct chg_list *);
-#else /* ! _STDC_ */
-
-#if defined(i386)
-int ata_rdwr();
-int ata_ex_cur();
-#else /* defined(i386) */
-static int ata_rdwr();
-static int ata_ex_cur();
-#endif /* defined(i386) */
-
-int ata_ck_format();
-int ata_ex_man();
-int ata_ex_grown();
-int ata_read_defect_data();
-int apply_chg_list();
-
-#endif /* __STDC__ */
-
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/cmd/format/global.h b/usr/src/cmd/format/global.h
index 5163ac9e2a..ad8c80699e 100644
--- a/usr/src/cmd/format/global.h
+++ b/usr/src/cmd/format/global.h
@@ -76,67 +76,67 @@ extern "C" {
/*
* These declarations are global state variables.
*/
-struct disk_info *disk_list; /* list of found disks */
-struct ctlr_info *ctlr_list; /* list of found ctlrs */
-char cur_menu; /* current menu level */
-char last_menu; /* last menu level */
-char option_msg; /* extended message options */
-char diag_msg; /* extended diagnostic msgs */
-char option_s; /* silent mode option */
-char *option_f; /* input redirect option */
-char *option_l; /* log file option */
-FILE *log_file; /* log file pointer */
-char *option_d; /* forced disk option */
-char *option_t; /* forced disk type option */
-char *option_p; /* forced partition table option */
-char *option_x; /* data file redirection option */
-FILE *data_file; /* data file pointer */
-char *file_name; /* current data file name */
+extern struct disk_info *disk_list; /* list of found disks */
+extern struct ctlr_info *ctlr_list; /* list of found ctlrs */
+extern char cur_menu; /* current menu level */
+extern char last_menu; /* last menu level */
+extern char option_msg; /* extended message options */
+extern char diag_msg; /* extended diagnostic msgs */
+extern char option_s; /* silent mode option */
+extern char *option_f; /* input redirect option */
+extern char *option_l; /* log file option */
+extern FILE *log_file; /* log file pointer */
+extern char *option_d; /* forced disk option */
+extern char *option_t; /* forced disk type option */
+extern char *option_p; /* forced partition table option */
+extern char *option_x; /* data file redirection option */
+extern FILE *data_file; /* data file pointer */
+extern char *file_name; /* current data file name */
/* for useful error messages */
-int expert_mode; /* enable for expert mode */
+extern int expert_mode; /* enable for expert mode */
/* commands */
-int need_newline; /* for correctly formatted output */
-int dev_expert; /* enable for developer mode */
+extern int need_newline; /* for correctly formatted output */
+extern int dev_expert; /* enable for developer mode */
/* commands */
/*
* These declarations are used for quick access to information about
* the disk being worked on.
*/
-int cur_file; /* file descriptor for current disk */
-int cur_flags; /* flags for current disk */
-int cur_label; /* current label type */
-uint_t cur_blksz; /* currect disk block size */
-struct disk_info *cur_disk; /* current disk */
-struct disk_type *cur_dtype; /* current dtype */
-struct ctlr_info *cur_ctlr; /* current ctlr */
-struct ctlr_type *cur_ctype; /* current ctype */
-struct ctlr_ops *cur_ops; /* current ctlr's ops vector */
-struct partition_info *cur_parts; /* current disk's partitioning */
-struct defect_list cur_list; /* current disk's defect list */
-void *cur_buf; /* current disk's I/O buffer */
-void *pattern_buf; /* current disk's pattern buffer */
-uint_t pcyl; /* # physical cyls */
-uint_t ncyl; /* # data cyls */
-uint_t acyl; /* # alt cyls */
-uint_t nhead; /* # heads */
-uint_t phead; /* # physical heads */
-uint_t nsect; /* # data sects/track */
-uint_t psect; /* # physical sects/track */
-uint_t apc; /* # alternates/cyl */
-uint_t solaris_offset; /* Solaris offset, this value is zero */
+extern int cur_file; /* file descriptor for current disk */
+extern int cur_flags; /* flags for current disk */
+extern int cur_label; /* current label type */
+extern uint_t cur_blksz; /* currect disk block size */
+extern struct disk_info *cur_disk; /* current disk */
+extern struct disk_type *cur_dtype; /* current dtype */
+extern struct ctlr_info *cur_ctlr; /* current ctlr */
+extern struct ctlr_type *cur_ctype; /* current ctype */
+extern struct ctlr_ops *cur_ops; /* current ctlr's ops vector */
+extern struct partition_info *cur_parts; /* current disk's partitioning */
+extern struct defect_list cur_list; /* current disk's defect list */
+extern void *cur_buf; /* current disk's I/O buffer */
+extern void *pattern_buf; /* current disk's pattern buffer */
+extern uint_t pcyl; /* # physical cyls */
+extern uint_t ncyl; /* # data cyls */
+extern uint_t acyl; /* # alt cyls */
+extern uint_t nhead; /* # heads */
+extern uint_t phead; /* # physical heads */
+extern uint_t nsect; /* # data sects/track */
+extern uint_t psect; /* # physical sects/track */
+extern uint_t apc; /* # alternates/cyl */
+extern uint_t solaris_offset; /* Solaris offset, this value is zero */
/* for non-fdisk machines. */
-int prot_type; /* protection type to format disk */
+extern int prot_type; /* protection type to format disk */
#if defined(_SUNOS_VTOC_16)
-uint_t bcyl; /* # other cyls */
+extern uint_t bcyl; /* # other cyls */
#endif /* defined(_SUNOS_VTOC_16) */
-struct mboot boot_sec; /* fdisk partition info */
-uint_t xstart; /* solaris partition start */
-char x86_devname[MAXNAMELEN]; /* saved device name for fdisk */
+extern struct mboot boot_sec; /* fdisk partition info */
+extern uint_t xstart; /* solaris partition start */
+extern char x86_devname[MAXNAMELEN]; /* saved device name for fdisk */
/* information accesses */
-struct mctlr_list *controlp; /* master controller list ptr */
+extern struct mctlr_list *controlp; /* master controller list ptr */
/*
diff --git a/usr/src/cmd/format/main.c b/usr/src/cmd/format/main.c
index 489b1b88e5..bcf45e276b 100644
--- a/usr/src/cmd/format/main.c
+++ b/usr/src/cmd/format/main.c
@@ -56,6 +56,31 @@
#include "label.h"
extern struct menu_item menu_command[];
+uint_t apc;
+uint_t solaris_offset;
+char cur_menu;
+char last_menu;
+void *pattern_buf;
+FILE *log_file;
+void *cur_buf;
+struct disk_info *cur_disk;
+struct ctlr_ops *cur_ops;
+struct ctlr_info *cur_ctlr;
+struct ctlr_type *cur_ctype;
+struct disk_type *cur_dtype;
+struct partition_info *cur_parts;
+struct defect_list cur_list;
+int cur_file;
+int cur_flags;
+int cur_label;
+uint_t pcyl;
+uint_t ncyl;
+uint_t acyl;
+uint_t bcyl;
+uint_t nhead;
+uint_t phead;
+uint_t nsect;
+uint_t psect;
#ifdef __STDC__
@@ -326,8 +351,7 @@ main(int argc, char *argv[])
* disk wasn't labeled at boot time.
*/
void
-init_globals(disk)
- struct disk_info *disk;
+init_globals(struct disk_info *disk)
{
int status;
int found_mount;
@@ -374,7 +398,7 @@ init_globals(disk)
* Open a file for the new disk.
*/
if ((cur_file = open_disk(cur_disk->disk_path,
- O_RDWR | O_NDELAY)) < 0) {
+ O_RDWR | O_NDELAY)) < 0) {
err_print(
"Error: can't open selected disk '%s'.\n", cur_disk->disk_name);
fullabort();
diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c
index 05a359b158..ff8c627b9d 100644
--- a/usr/src/cmd/format/menu_command.c
+++ b/usr/src/cmd/format/menu_command.c
@@ -67,6 +67,7 @@
extern struct menu_item menu_partition[];
extern struct menu_item menu_analyze[];
extern struct menu_item menu_defect[];
+int prot_type;
/*
* Choices for the p_tag vtoc field
diff --git a/usr/src/cmd/format/menu_fdisk.c b/usr/src/cmd/format/menu_fdisk.c
index 317954221f..40e06c4711 100644
--- a/usr/src/cmd/format/menu_fdisk.c
+++ b/usr/src/cmd/format/menu_fdisk.c
@@ -61,6 +61,8 @@
#include "auto_sense.h"
extern struct menu_item menu_fdisk[];
+struct mboot boot_sec;
+uint_t xstart;
/*
* Byte swapping macros for accessing struct ipart
diff --git a/usr/src/cmd/format/startup.c b/usr/src/cmd/format/startup.c
index ba71cd8bbc..07d46a6bab 100644
--- a/usr/src/cmd/format/startup.c
+++ b/usr/src/cmd/format/startup.c
@@ -62,6 +62,26 @@ extern long strtol();
extern int errno;
+char *file_name;
+char *option_d;
+char *option_f;
+char *option_l;
+char *option_p;
+char option_s;
+char *option_t;
+char *option_x;
+char diag_msg;
+char option_msg;
+int need_newline;
+int dev_expert;
+int expert_mode;
+uint_t cur_blksz;
+struct ctlr_info *ctlr_list;
+struct disk_info *disk_list;
+struct mctlr_list *controlp;
+char x86_devname[MAXNAMELEN];
+FILE *data_file;
+
#ifdef __STDC__
/* Function prototypes for ANSI C Compilers */
@@ -2218,13 +2238,11 @@ disk_is_known(struct dk_cinfo *dkinfo)
* in the disk label.
*/
int
-dtype_match(label, dtype)
- register struct dk_label *label;
- register struct disk_type *dtype;
+dtype_match(struct dk_label *label, struct disk_type *dtype)
{
if (dtype->dtype_asciilabel == NULL) {
- return (0);
+ return (0);
}
/*
@@ -2249,9 +2267,7 @@ dtype_match(label, dtype)
* in the disk label.
*/
int
-parts_match(label, pinfo)
- register struct dk_label *label;
- register struct partition_info *pinfo;
+parts_match(struct dk_label *label, struct partition_info *pinfo)
{
int i;
@@ -2286,10 +2302,10 @@ parts_match(label, pinfo)
return (0);
for (i = 0; i < NDKMAP; i++) {
if (label->dkl_vtoc.v_part[i].p_tag !=
- pinfo->vtoc.v_part[i].p_tag)
+ pinfo->vtoc.v_part[i].p_tag)
return (0);
if (label->dkl_vtoc.v_part[i].p_flag !=
- pinfo->vtoc.v_part[i].p_flag)
+ pinfo->vtoc.v_part[i].p_flag)
return (0);
}
/*
@@ -2457,9 +2473,7 @@ search_duplicate_pinfo()
* If so, print an error message and abort.
*/
static void
-check_dtypes_for_inconsistency(dp1, dp2)
- struct disk_type *dp1;
- struct disk_type *dp2;
+check_dtypes_for_inconsistency(struct disk_type *dp1, struct disk_type *dp2)
{
int i;
int result;
@@ -2520,13 +2534,13 @@ check_dtypes_for_inconsistency(dp1, dp2)
if (result) {
err_print("Inconsistent definitions for disk type '%s'\n",
- dp1->dtype_asciilabel);
+ dp1->dtype_asciilabel);
if (dp1->dtype_filename != NULL &&
- dp2->dtype_filename != NULL) {
+ dp2->dtype_filename != NULL) {
err_print("%s (%d) - %s (%d)\n",
- dp1->dtype_filename, dp1->dtype_lineno,
- dp2->dtype_filename, dp2->dtype_lineno);
- }
+ dp1->dtype_filename, dp1->dtype_lineno,
+ dp2->dtype_filename, dp2->dtype_lineno);
+ }
fullabort();
}
}
@@ -2538,9 +2552,8 @@ check_dtypes_for_inconsistency(dp1, dp2)
* If so, print an error message and abort.
*/
static void
-check_pinfo_for_inconsistency(pp1, pp2)
- struct partition_info *pp1;
- struct partition_info *pp2;
+check_pinfo_for_inconsistency(struct partition_info *pp1,
+ struct partition_info *pp2)
{
int i;
int result;
@@ -2588,13 +2601,13 @@ check_pinfo_for_inconsistency(pp1, pp2)
if (result) {
err_print("Inconsistent definitions for partition type '%s'\n",
- pp1->pinfo_name);
+ pp1->pinfo_name);
if (pp1->pinfo_filename != NULL &&
- pp2->pinfo_filename != NULL) {
+ pp2->pinfo_filename != NULL) {
err_print("%s (%d) - %s (%d)\n",
- pp1->pinfo_filename, pp1->pinfo_lineno,
- pp2->pinfo_filename, pp2->pinfo_lineno);
- }
+ pp1->pinfo_filename, pp1->pinfo_lineno,
+ pp2->pinfo_filename, pp2->pinfo_lineno);
+ }
fullabort();
}
}
@@ -2935,7 +2948,7 @@ disk_name_compare(
}
static void
-make_controller_list()
+make_controller_list(void)
{
int x;
struct mctlr_list *ctlrp;
@@ -2952,8 +2965,7 @@ make_controller_list()
}
static void
-check_for_duplicate_disknames(arglist)
-char *arglist[];
+check_for_duplicate_disknames(char *arglist[])
{
char *directory = "/dev/rdsk/";
char **disklist;
@@ -2974,9 +2986,9 @@ char *arglist[];
* disk list.
*/
for (i = 0; i < diskno; i++) {
- canonicalize_name(t, arglist[i]);
- if (strncmp(s, t, strlen(t)) == 0)
- break;
+ canonicalize_name(t, arglist[i]);
+ if (strncmp(s, t, strlen(t)) == 0)
+ break;
}
if (i != diskno)
continue;
diff --git a/usr/src/cmd/geniconvtbl/Makefile b/usr/src/cmd/geniconvtbl/Makefile
index 7ed5411afb..8ad78d87bd 100644
--- a/usr/src/cmd/geniconvtbl/Makefile
+++ b/usr/src/cmd/geniconvtbl/Makefile
@@ -26,7 +26,7 @@
include ../Makefile.cmd
-SUBDIRS= native $(MACH)
+SUBDIRS= $(MACH)
$(BUILD64)SUBDIRS += $(MACH64)
SAMPLES = samples
@@ -35,7 +35,7 @@ all := TARGET = all
install := TARGET = install
clean := TARGET = clean
clobber := TARGET = clobber
-_msg := TARGET = catalog
+_msg := TARGET = _msg
.KEEP_STATE:
@@ -43,7 +43,7 @@ _msg := TARGET = catalog
all clean clobber install: $(SUBDIRS) .WAIT $(SAMPLES)
-_msg: $(SUBDIRS)
+_msg: $(MACH)
$(SUBDIRS) $(SAMPLES): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
diff --git a/usr/src/cmd/geniconvtbl/Makefile.com b/usr/src/cmd/geniconvtbl/Makefile.com
index 66878963a2..5154484248 100644
--- a/usr/src/cmd/geniconvtbl/Makefile.com
+++ b/usr/src/cmd/geniconvtbl/Makefile.com
@@ -24,161 +24,99 @@
# Copyright (c) 2019, Joyent, Inc.
#
-$(NOT_NATIVE)NATIVE_BUILD = $(POUND_SIGN)
-
-ITM = geniconvtbl.so
+LIB = geniconvtbl.so
PROG = geniconvtbl
-SRCSH1 = iconv_tm.h hash.h
-SRCCH1 = itmcomp.h itm_util.h maptype.h
-SRCSC1 = itmcomp.c assemble.c disassemble.c itm_util.c
-SRCY1 = itm_comp.y
-SRCL1 = itm_comp.l
-SRCI1 = geniconvtbl.c
-
-
-YTABC = y.tab.c
-YTABH = y.tab.h
-LEXYY = lex.yy.c
-YOUT = y.output
-MAPFILE = ../mapfile
-
-
-
-SRCSH = $(SRCSH1:%.h=../%.h)
-SRCCH = $(SRCCH1:%.h=../%.h)
-SRCSC = $(SRCSC1:%.c=../%.c)
-SRCI = $(SRCI1:%.c=../%.c)
-SRCY = $(SRCY1:%.y=../%.y)
-SRCL = $(SRCL1:%.l=../%.l)
-
-SRCYC = $(SRCY:%.y=%.c)
-SRCLC = $(SRCL:%.l=%.c)
-
-SRCS = $(SRCSC) $(YTABC) $(LEXYY)
-HDRS = $(SRCCH1) $(ERNOSTRH)
+SRCDIR = $(SRC)/cmd/geniconvtbl
+MAPFILE = $(SRCDIR)/mapfile
+OBJS = itmcomp.o assemble.o disassemble.o itm_util.o y.tab.o lex.yy.o
+MSGFILES = itmcomp.i assemble.i disassemble.i itm_util.i y.tab.i lex.yy.i geniconvtbl.i
-SED = sed
-LEXSED = ../lex.sed
-YACCSED = ../yacc.sed
-
-
-
-# include ../../../lib/Makefile.lib
-include ../../Makefile.cmd
+include $(SRC)/cmd/Makefile.cmd
+POFILE = geniconvtbl_.po
ROOTDIRS32= $(ROOTLIB)/iconv
ROOTDIRS64= $(ROOTLIB)/iconv/$(MACH64)
-ROOTITM32 = $(ROOTDIRS32)/$(ITM)
-ROOTITM64 = $(ROOTDIRS64)/$(ITM)
-
-# defined for some useful targets like clean,
-OBJS = $(SRCSC1:%.c=%.o) $(YTABC:.c=.o) $(LEXYY:.c=.o)
+ROOTLIB32 = $(ROOTDIRS32)/$(LIB)
+ROOTLIB64 = $(ROOTDIRS64)/$(LIB)
-CHECKHDRS = $(HDRS%.h=%.check)
+CLOBBERFILES= $(LIB)
+CLEANFILES = $(OBJS) y.tab.c y.tab.h lex.yy.c \
+ $(POFILE)
-CLOBBERFILES= $(ITM) $(SRCYC)
-CLEANFILES = $(OBJS) $(YTABC) $(YTABH) $(LEXYY) $(YOUT) \
- $(POFILES) $(POFILE)
-
-CPPFLAGS += -I. -I..
+CPPFLAGS += -I. -I$(SRCDIR)
CERRWARN += $(CNOWARN_UNINIT)
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-unused-variable
CERRWARN += -_gcc=-Wno-implicit-function-declaration
-YFLAGS += -d -v
+YFLAGS += -d
CFLAGS += -D_FILE_OFFSET_BITS=64
# dump_expr() is too hairy
SMATCH=off
-$(ITM) := CFLAGS += $(GSHARED) $(C_PICFLAGS) $(ZTEXT) -h$@
-$(ITM) := CPPFLAGS += -D_REENTRANT
-$(ITM) := sparc_CFLAGS += -xregs=no%appl
-$(ITM) := sparcv9_CFLAGS += -xregs=no%appl
-
-LDLIBS += -lgen
-
-MY_NATIVE_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -I. -I..
-MY_NATIVE_LDFLAGS = $(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%) $(ZDIRECT) $(ZLAZYLOAD)
-MY_NATIVE_LDLIBS = -lgen
-
-#
-# Message catalog
-#
-POFILES= $(SRCSC1:%.c=%.po) $(SRCI1:%.c=%.po) \
- $(SRCY1:%.y=%.po) $(SRCL1:%.l=%.po)
-
-POFILE= geniconvtbl_.po
-
-
-
+$(LIB) := LDFLAGS += $(GSHARED) -h$@ $(ZTEXT) $(ZDEFS) $(BDIRECT) \
+ $(C_PICFLAGS) $(MAPFILE:%=-Wl,-M%) \
+ $(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%)
+$(LIB) := CPPFLAGS += -D_REENTRANT
+$(LIB) := sparc_CFLAGS += -xregs=no%appl
+$(LIB) := sparcv9_CFLAGS += -xregs=no%appl
+$(LIB) := LDLIBS += -lc
+$(PROG) := LDLIBS += -lgen
.KEEP_STATE:
-.PARALLEL: $(ITM) $(OBJS)
+.PARALLEL: $(LIB) $(OBJS)
$(PROG): $(OBJS)
$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
$(POST_PROCESS)
-$(ITM): $(SRCI)
- $(CC) $(CFLAGS) $(CPPFLAGS) -Wl,-M$(MAPFILE) -o $@ $(SRCI) $(LDLIBS)
+$(LIB): $(SRCDIR)/geniconvtbl.c
+ $(LINK.c) -o $@ $(SRCDIR)/geniconvtbl.c $(LDLIBS)
$(POST_PROCESS_SO)
-$(YTABC) $(YTABH): $(SRCY)
- $(YACC) $(YFLAGS) $(SRCY)
- @ $(MV) $(YTABC) $(YTABC)~
- @ $(SED) -f $(YACCSED) $(YTABC)~ > $(YTABC)
- @ $(RM) $(YTABC)~
-
-$(LEXYY): $(SRCL) $(YTABH)
- $(LEX) -t $(SRCL) | $(SED) -f $(LEXSED) > $(LEXYY)
-
+y.tab.c + y.tab.h: $(SRCDIR)/itm_comp.y
+ $(YACC) $(YFLAGS) $(SRCDIR)/itm_comp.y
+ @ $(MV) y.tab.c y.tab.c~
+ @ $(SED) -f $(SRCDIR)/yacc.sed y.tab.c~ > y.tab.c
+ @ $(RM) y.tab.c~
-$(POFILE): .WAIT $(POFILES)
- $(RM) $@
- $(CAT) $(POFILES) >$@
-
-$(POFILES): $(SRCSC) $(SRCI) $(SRCY) $(SRCL)
-
-%.po: ../%.c
- $(COMPILE.cpp) $< > $<.i
- $(BUILD.po)
-
-hdrchk: $(HDRCHECKS)
-
-cstyle: $(SRCS)
- $(DOT_C_CHECK)
+lex.yy.c: $(SRCDIR)/itm_comp.l y.tab.h
+ $(LEX) -t $(SRCDIR)/itm_comp.l | $(SED) -f $(SRCDIR)/lex.sed > $(@)
clean:
$(RM) $(CLEANFILES)
+$(POFILE): $(MSGFILES)
+ $(BUILDPO.msgfiles)
+
%.o: %.c
$(COMPILE.c) $<
-%.o: ../%.c
+%.o: $(SRCDIR)/%.c
$(COMPILE.c) $<
+%.i: $(SRCDIR)/%.c
+ $(CPPFORPO) $< > $@
+
# install rule
$(ROOTDIRS32)/%: $(ROOTDIRS32) %
- -$(INS.file)
+ $(INS.file)
$(ROOTDIRS64)/%: $(ROOTDIRS64) %
- -$(INS.file)
+ $(INS.file)
$(ROOTDIRS32): $(ROOTLIB)
- -$(INS.dir)
+ $(INS.dir)
$(ROOTDIRS64): $(ROOTDIRS32)
- -$(INS.dir)
-
-$(ROOTLIB) $(ROOTBIN):
- -$(INS.dir)
+ $(INS.dir)
-include ../../Makefile.targ
+include $(SRC)/cmd/Makefile.targ
+include $(SRC)/Makefile.msg.targ
diff --git a/usr/src/cmd/geniconvtbl/amd64/Makefile b/usr/src/cmd/geniconvtbl/amd64/Makefile
index 6faaf24145..77c9257990 100644
--- a/usr/src/cmd/geniconvtbl/amd64/Makefile
+++ b/usr/src/cmd/geniconvtbl/amd64/Makefile
@@ -23,26 +23,12 @@
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
.KEEP_STATE:
-
-
include ../Makefile.com
include ../../Makefile.cmd.64
-#catalog: $(MSGDOMAIN64) $(POFILE)
-# $(RM) $(MSGDOMAIN64)/$(POFILE)
-# $(CP) $(POFILE) $(MSGDOMAIN64)
-
-lint := SRCS = $(SRCI)
-
-all: $(ITM)
-
-install: all $(ROOTITM64) $(ROOTLINKS64)
-
-both: $(ITM) $(PROG)
+all: $(LIB)
-catalog:
+install: all $(ROOTLIB64) $(ROOTLINKS64)
diff --git a/usr/src/cmd/geniconvtbl/i386/Makefile b/usr/src/cmd/geniconvtbl/i386/Makefile
index 7b2fd74210..b50960a70f 100644
--- a/usr/src/cmd/geniconvtbl/i386/Makefile
+++ b/usr/src/cmd/geniconvtbl/i386/Makefile
@@ -22,19 +22,15 @@
# Copyright 1999, 2003 Sun Microsystems, Inc.
# All rights reserved.
# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/geniconvtbl/i386/Makefile
.KEEP_STATE:
include ../Makefile.com
-catalog: $(MSGDOMAIN) $(POFILE)
- $(RM) $(MSGDOMAIN)/$(POFILE)
- $(CP) $(POFILE) $(MSGDOMAIN)
+_msg: $(MSGDOMAINPOFILE)
+
+all: $(PROG) $(LIB)
+
+install: all $(ROOTBIN) $(ROOTPROG) $(ROOTLIB32) $(ROOTLINKS32)
-all: $(PROG) $(ITM) $(NATIVEPROG)
-install: all $(ROOTBIN) $(ROOTPROG) $(ROOTITM32) $(ROOTLINKS32)
diff --git a/usr/src/cmd/geniconvtbl/itmcomp.c b/usr/src/cmd/geniconvtbl/itmcomp.c
index da0c5b7f70..7572e3a623 100644
--- a/usr/src/cmd/geniconvtbl/itmcomp.c
+++ b/usr/src/cmd/geniconvtbl/itmcomp.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -163,9 +161,8 @@ itm_compile(char *file)
} else {
if (0 != access(file, R_OK)) {
int e = errno;
- itm_error(
- gettext("%1$s: can not access %2$s: "),
- cmd_opt.my_name, file);
+ itm_error(gettext("%1$s: can not access %2$s: "),
+ cmd_opt.my_name, file);
errno = e;
PERROR(NULL);
exit(ITMC_STATUS_CMD2);
@@ -208,9 +205,9 @@ itm_compile(char *file)
(void) memcpy(command, cmd_line, length);
*(command + length) = '\0';
PERROR(command);
- itm_error(
- gettext("%1$s: can not start %2$s on %3$s\n"),
- cmd_opt.my_name, command, itm_input_file);
+ itm_error(gettext("%1$s: can not start "
+ "%2$s on %3$s\n"), cmd_opt.my_name, command,
+ itm_input_file);
exit(ITMC_STATUS_SYS);
} else {
yyin = fp;
@@ -226,9 +223,8 @@ itm_compile(char *file)
} else {
yyin = fopen(file, "r");
if (NULL == yyin) {
- itm_error(
- gettext("%1$s: can not open %2$s\n"),
- cmd_opt.my_name, itm_input_file);
+ itm_error(gettext("%1$s: can not open %2$s\n"),
+ cmd_opt.my_name, itm_input_file);
exit(ITMC_STATUS_CMD2);
}
}
@@ -311,12 +307,12 @@ parse_opts(int argc, char **argv)
error_num += 1;
}
cmd_opt.preprocess_specified =
- prog_path_expand(optarg);
+ prog_path_expand(optarg);
cmd_opt.preprocess = cmd_opt.preprocess_specified;
if (NULL == cmd_opt.preprocess) {
(void) fprintf(stderr,
gettext("cannot find preprocessor \"%s\"\n"),
- optarg);
+ optarg);
error_num += 1;
}
(void) cpp_opt_append(NULL, NULL);
@@ -391,8 +387,7 @@ parse_opts(int argc, char **argv)
if (optind < argc) {
cmd_opt.input_file_num = (argc - optind);
cmd_opt.input_file =
- malloc_vital((sizeof (char *)) *
- (argc - optind + 1));
+ malloc_vital((sizeof (char *)) * (argc - optind + 1));
*(cmd_opt.input_file + (argc - optind)) = NULL;
}
@@ -411,9 +406,8 @@ parse_opts(int argc, char **argv)
(NULL == cmd_opt.output_file) &&
(NULL == cmd_opt.disassemble) &&
(0 == cmd_opt.no_output)) {
- itm_error(gettext(
- "output file is unnamed. "
- "use -o to specify output file\n"));
+ itm_error(gettext("output file is unnamed. "
+ "use -o to specify output file\n"));
error_num++;
}
@@ -427,8 +421,8 @@ parse_opts(int argc, char **argv)
cmd_opt.map_name_type ||
cmd_opt.large_table ||
cmd_opt.output_file)) {
- itm_error(
- gettext("-d may not specified with other options\n"));
+ itm_error(gettext("-d may not be specified with "
+ "other options\n"));
error_num++;
}
@@ -446,7 +440,7 @@ parse_opts(int argc, char **argv)
p = basename(cmd_opt.preprocess_default);
if (NULL == p) {
*(cmd_opt.cpp_opt + 0) =
- strdup_vital(cmd_opt.preprocess_default);
+ strdup_vital(cmd_opt.preprocess_default);
} else {
*(cmd_opt.cpp_opt + 0) = strdup_vital(p);
}
@@ -513,14 +507,14 @@ cpp_opt_append(char *opt, char *arg)
if (0 == cmd_opt.cpp_opt_reserved) {
cmd_opt.cpp_opt_reserved = 32;
cmd_opt.cpp_opt = malloc_vital((sizeof (char *)) * 32);
- *(cmd_opt.cpp_opt + 0) = "cpp";
+ *(cmd_opt.cpp_opt + 0) = strdup_vital("cpp");
cmd_opt.cpp_opt_num = 1;
} else if ((cmd_opt.cpp_opt_reserved - 2) <= cmd_opt.cpp_opt_num) {
cmd_opt.cpp_opt_reserved += 32;
new_opt_list = malloc_vital((sizeof (char *)) *
- cmd_opt.cpp_opt_reserved);
+ cmd_opt.cpp_opt_reserved);
(void) memcpy(new_opt_list, cmd_opt.cpp_opt,
- (sizeof (char *)) * cmd_opt.cpp_opt_num);
+ (sizeof (char *)) * cmd_opt.cpp_opt_num);
(void) memset(new_opt_list + cmd_opt.cpp_opt_num, 0, 32);
free(cmd_opt.cpp_opt);
cmd_opt.cpp_opt = new_opt_list;
@@ -540,7 +534,7 @@ cpp_opt_trunc(int num)
num = cmd_opt.cpp_opt_num;
}
for (; 0 < num; --num) {
- free(cmd_opt.cpp_opt + cmd_opt.cpp_opt_num);
+ free(*(cmd_opt.cpp_opt + cmd_opt.cpp_opt_num - 1));
--(cmd_opt.cpp_opt_num);
}
}
@@ -600,21 +594,20 @@ prog_path_expand(const char *base_name)
static void
usage(int status)
{
-
if (ITMC_STATUS_SUCCESS == status) {
(void) fprintf(stdout,
gettext("Usage: %1$s [-n] [-f] [-q]\n"
- " [-p preprocessor] [-W argument]\n"
- " [-Dname] [-Dname=def] [-Idirectory] [-Uname]\n"
- " [file ...]\n %2$s -h\n"),
- cmd_opt.my_name, cmd_opt.my_name);
+ " [-p preprocessor] [-W argument]\n"
+ " [-Dname] [-Dname=def] [-Idirectory] [-Uname]\n"
+ " [file ...]\n %2$s -h\n"),
+ cmd_opt.my_name, cmd_opt.my_name);
} else {
(void) itm_error(
gettext("Usage: %1$s [-n] [-f] [-q]\n"
- " [-p preprocessor] [-W argument]\n"
- " [-Dname] [-Dname=def] [-Idirectory] [-Uname]\n"
- " [file ...]\n %2$s -h\n"),
- cmd_opt.my_name, cmd_opt.my_name);
+ " [-p preprocessor] [-W argument]\n"
+ " [-Dname] [-Dname=def] [-Idirectory] [-Uname]\n"
+ " [file ...]\n %2$s -h\n"),
+ cmd_opt.my_name, cmd_opt.my_name);
}
exit(status);
}
@@ -666,17 +659,15 @@ map_name_type_append(char *optarg)
*(phf++) = '\0';
hash_factor = atoi(phf);
if (hash_factor < 0) {
- itm_error(
- gettext(
- "invalid hash factor is "
- "specified: %s\n"),
- phf);
+ itm_error(gettext("invalid "
+ "hash factor is "
+ "specified: %s\n"), phf);
hash_factor = 0;
error_deferred += 1;
}
}
- for (i = 0;
- NULL != map_type_name[i].name; i++) {
+ for (i = 0; NULL != map_type_name[i].name;
+ i++) {
if (0 ==
strcmp(p, map_type_name[i].name)) {
type = map_type_name[i].type;
@@ -684,10 +675,8 @@ map_name_type_append(char *optarg)
}
}
if (NULL == map_type_name[i].name) {
- itm_error(
- gettext(
- "unknown map type is specified: %s\n"),
- p);
+ itm_error(gettext("unknown map type "
+ "is specified: %s\n"), p);
error_deferred += 1;
continue;
}
@@ -713,19 +702,17 @@ map_name_type_append(char *optarg)
break;
}
if ('\0' == *name) {
- itm_error(
- gettext(
- "multiple default types are specified:"
- " \"%1$s\" and \"%2$s\"\n"),
- map_type_name_str(type),
- map_type_name_str(m->type));
+ itm_error(gettext("multiple default "
+ "types are specified:"
+ " \"%1$s\" and \"%2$s\"\n"),
+ map_type_name_str(type),
+ map_type_name_str(m->type));
} else {
- itm_error(
- gettext("map \"%1$s\" is specified as "
- "two types \"%2$s\" and \"%3$s\"\n"),
- name,
- map_type_name_str(type),
- map_type_name_str(m->type));
+ itm_error(gettext("map \"%1$s\" is "
+ "specified as two types \"%2$s\" "
+ "and \"%3$s\"\n"), name,
+ map_type_name_str(type),
+ map_type_name_str(m->type));
}
error_deferred += 1;
m = NULL;
@@ -930,9 +917,9 @@ trace_option(void)
}
}
itm_error("output_file = %s\n",
- cmd_opt.output_file ? cmd_opt.output_file : "(stdout)");
+ cmd_opt.output_file ? cmd_opt.output_file : "(stdout)");
itm_error("interpreter = %s\n",
- cmd_opt.interpreter ? cmd_opt.interpreter : "(default)");
+ cmd_opt.interpreter ? cmd_opt.interpreter : "(default)");
if (cmd_opt.cpp_opt) {
itm_error("cpp_opt = %s\n", *(cmd_opt.cpp_opt));
for (i = 1; i < cmd_opt.cpp_opt_num; i++) {
@@ -942,15 +929,15 @@ trace_option(void)
itm_error("cpp_opt = %s\n", "(none)");
}
itm_error("preprocess_default = %s\n",
- cmd_opt.preprocess_default ? cmd_opt.preprocess_default :
- "(no)");
+ cmd_opt.preprocess_default ? cmd_opt.preprocess_default :
+ "(no)");
itm_error("preprocess_specified = %s\n",
- cmd_opt.preprocess_specified ? cmd_opt.preprocess_specified :
- "(no)");
+ cmd_opt.preprocess_specified ? cmd_opt.preprocess_specified :
+ "(no)");
itm_error("preprocess = %s\n",
- cmd_opt.preprocess ? cmd_opt.preprocess : "(no)");
+ cmd_opt.preprocess ? cmd_opt.preprocess : "(no)");
itm_error("disassemble = %s\n",
- cmd_opt.disassemble ? "yes" : "no");
+ cmd_opt.disassemble ? "yes" : "no");
itm_error("map type =");
if (NULL == cmd_opt.map_name_type) {
itm_error("\n");
@@ -959,9 +946,9 @@ trace_option(void)
itm_error(" ");
m = cmd_opt.map_name_type;
itm_error("%s=%s",
- (((NULL == m->name) || ('\0' == *(m->name))) ?
- "default" : m->name),
- map_type_name_str(m->type));
+ (((NULL == m->name) || ('\0' == *(m->name))) ?
+ "default" : m->name),
+ map_type_name_str(m->type));
if (0 != m->hash_factor) {
itm_error(":%ld\n", m->hash_factor);
} else {
@@ -969,9 +956,9 @@ trace_option(void)
}
for (m = m->next; NULL != m; m = m->next) {
itm_error(" %s=%s",
- (((NULL == m->name) || ('\0' == *(m->name))) ?
- "default" : m->name),
- map_type_name_str(m->type));
+ (((NULL == m->name) || ('\0' == *(m->name))) ?
+ "default" : m->name),
+ map_type_name_str(m->type));
if (0 != m->hash_factor) {
itm_error(":%ld\n", m->hash_factor);
} else {
@@ -980,13 +967,13 @@ trace_option(void)
}
}
itm_error("large table = %s\n",
- cmd_opt.large_table ? "true" : "false");
+ cmd_opt.large_table ? "true" : "false");
itm_error("overwrite = %s\n",
- cmd_opt.force_overwrite ? "true" : "false");
+ cmd_opt.force_overwrite ? "true" : "false");
itm_error("strip = %s\n",
- cmd_opt.strip ? "true" : "false");
+ cmd_opt.strip ? "true" : "false");
itm_error("no_output = %s\n",
- cmd_opt.no_output ? "true" : "false");
+ cmd_opt.no_output ? "true" : "false");
itm_error("trace = ");
if (NULL == cmd_opt.trace) {
itm_error("(no)\n");
diff --git a/usr/src/cmd/geniconvtbl/samples/Makefile b/usr/src/cmd/geniconvtbl/samples/Makefile
index 85a33593d3..514fe32281 100644
--- a/usr/src/cmd/geniconvtbl/samples/Makefile
+++ b/usr/src/cmd/geniconvtbl/samples/Makefile
@@ -21,27 +21,19 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/geniconvtbl/samples/Makefile
-
INPUTFILES = ISO8859-1_to_UTF-8.src UTF-8_to_ISO8859-1.src\
eucJP_to_ISO-2022-JP.src ISO-2022-JP_to_eucJP.src \
ISO646_to_ISO8859-1.src ISO8859-1_to_ISO646.src
-
+
OUTPUTFILES = ISO646%ISO8859-1.bt ISO8859-1%ISO646.bt
-# ONLY TWO binarytables are deribalables
+# ONLY TWO binarytables are deliverables
# ISO8859-1%UTF-8.bt UTF-8%ISO8859-1.bt
# eucJP%ISO-2022-JP.bt ISO-2022-JP%eucJP.bt \
-# ISO646%ISO8859-1.bt ISO8859-1%ISO646.bt
+# ISO646%ISO8859-1.bt ISO8859-1%ISO646.bt
# OUTPUTFILES = $(INPUTFILES:%.src=%.bt) NEVER USE ( WATCH OUT FILE NAME )
-
-GENICONVTBL= ../native/geniconvtbl
-
-
# include ../../../lib/Makefile.lib
include ../../Makefile.cmd
@@ -79,8 +71,8 @@ UTF-8%ISO8859_1.bt: UTF-8_to_ISO8859_1.src
eucJP%ISO-2022-JP.bt: eucJP_to_ISO-2022-JP.src
$(GENICONVTBL) -o $@ -f eucJP_to_ISO-2022-JP.src
-ISO-2022-JP%eucJP.bt: ISO-2022-JP_to_eucJP.src
- $(GENICONVTBL) -o $@ -f ISO-2022-JP_to_eucJP.src
+ISO-2022-JP%eucJP.bt: ISO-2022-JP_to_eucJP.src
+ $(GENICONVTBL) -o $@ -f ISO-2022-JP_to_eucJP.src
ISO646%ISO8859-1.bt: ISO646_to_ISO8859-1.src
$(GENICONVTBL) -o $@ -f ISO646_to_ISO8859-1.src
@@ -90,14 +82,14 @@ ISO8859-1%ISO646.bt: ISO8859-1_to_ISO646.src
# install rule
-#
+#
$(SRCSDIRS)/%: % $(SRCSDIRS)
$(INS.file)
$(BTSDIRS)/%: % $(BTSDIRS)
$(INS.file)
-$(SRCSDIRS) $(BTSDIRS): $(ROOTDIRS)
+$(SRCSDIRS) $(BTSDIRS): $(ROOTDIRS)
$(INS.dir)
$(ROOTDIRS): $(ROOTICONVDIRS)
@@ -120,6 +112,6 @@ $(BTSDIRS)/%: $(BTSDIRS) %
#
# %.bt: %.src
-# $(GENICONVTBL) -o $@ -f $<
+# $(GENICONVTBL) -o $@ -f $<
# include ../../Makefile.targ
diff --git a/usr/src/cmd/geniconvtbl/sparc/Makefile b/usr/src/cmd/geniconvtbl/sparc/Makefile
index 8d07afa773..c6120df896 100644
--- a/usr/src/cmd/geniconvtbl/sparc/Makefile
+++ b/usr/src/cmd/geniconvtbl/sparc/Makefile
@@ -23,18 +23,13 @@
# All rights reserved.
# Use is subject to license terms.
#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/geniconvtbl/sparc/Makefile
.KEEP_STATE:
include ../Makefile.com
-catalog: $(MSGDOMAIN) $(POFILE)
- $(RM) $(MSGDOMAIN)/$(POFILE)
- $(CP) $(POFILE) $(MSGDOMAIN)
+_msg: $(MSGDOMAINPOFILE)
-all: $(PROG) $(ITM) $(NATIVEPROG)
+all: $(PROG) $(LIB)
-install: all $(ROOTBIN) $(ROOTPROG) $(ROOTITM32) $(ROOTLINKS32)
+install: all $(ROOTBIN) $(ROOTPROG) $(ROOTLIB32) $(ROOTLINKS32)
diff --git a/usr/src/cmd/geniconvtbl/sparcv9/Makefile b/usr/src/cmd/geniconvtbl/sparcv9/Makefile
index fdfde784dd..be3745875c 100644
--- a/usr/src/cmd/geniconvtbl/sparcv9/Makefile
+++ b/usr/src/cmd/geniconvtbl/sparcv9/Makefile
@@ -22,27 +22,12 @@
# Copyright (c) 1999 by Sun Microsystems, Inc.
# All rights reserved.
#
-#ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/geniconvtbl/sparcv9/Makefile
.KEEP_STATE:
-
-
include ../Makefile.com
include ../../Makefile.cmd.64
-#catalog: $(MSGDOMAIN64) $(POFILE)
-# $(RM) $(MSGDOMAIN64)/$(POFILE)
-# $(CP) $(POFILE) $(MSGDOMAIN64)
-
-lint := SRCS = $(SRCI)
-
-all: $(ITM)
-
-install: all $(ROOTITM64) $(ROOTLINKS64)
-
-both: $(ITM) $(PROG)
+all: $(LIB)
-catalog:
+install: all $(ROOTLIB64) $(ROOTLINKS64)
diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c b/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c
index 628503d179..9d2d74195f 100644
--- a/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c
+++ b/usr/src/cmd/mdb/common/kmdb/kmdb_kvm.c
@@ -1946,6 +1946,10 @@ kmt_wapt_info(mdb_tgt_t *t, mdb_sespec_t *sep, mdb_vespec_t *vep,
else
fmt = "stop on %s of I/O port [%p, %p)";
break;
+
+ default:
+ fmt = "stop on %s of unknown [%p, %p]";
+ break;
}
(void) mdb_iob_snprintf(buf, nbytes, fmt, desc + 1, wp->wp_addr,
@@ -2394,18 +2398,18 @@ kmt_destroy(mdb_tgt_t *t)
static const mdb_tgt_ops_t kmt_ops = {
kmt_setflags, /* t_setflags */
- (int (*)())(uintptr_t) mdb_tgt_notsup, /* t_setcontext */
+ (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_setcontext */
kmt_activate, /* t_activate */
- (void (*)())(uintptr_t) mdb_tgt_nop, /* t_deactivate */
+ (void (*)())(uintptr_t)mdb_tgt_nop, /* t_deactivate */
kmt_periodic, /* t_periodic */
kmt_destroy, /* t_destroy */
kmt_name, /* t_name */
- (const char *(*)()) mdb_conf_isa, /* t_isa */
+ (const char *(*)())mdb_conf_isa, /* t_isa */
kmt_platform, /* t_platform */
kmt_uname, /* t_uname */
kmt_dmodel, /* t_dmodel */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_aread */
- (ssize_t (*)()) mdb_tgt_notsup, /* t_awrite */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_aread */
+ (ssize_t (*)())mdb_tgt_notsup, /* t_awrite */
kmt_read, /* t_vread */
kmt_write, /* t_vwrite */
kmt_pread, /* t_pread */
@@ -2425,25 +2429,25 @@ static const mdb_tgt_ops_t kmt_ops = {
kmt_addr_to_ctf, /* t_addr_to_ctf */
kmt_name_to_ctf, /* t_name_to_ctf */
kmt_status, /* t_status */
- (int (*)())(uintptr_t) mdb_tgt_notsup, /* t_run */
+ (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_run */
kmt_step, /* t_step */
kmt_step_out, /* t_step_out */
kmt_next, /* t_next */
kmt_continue, /* t_cont */
- (int (*)())(uintptr_t) mdb_tgt_notsup, /* t_signal */
+ (int (*)())(uintptr_t)mdb_tgt_notsup, /* t_signal */
kmt_add_vbrkpt, /* t_add_vbrkpt */
kmt_add_sbrkpt, /* t_add_sbrkpt */
kmt_add_pwapt, /* t_add_pwapt */
kmt_add_vwapt, /* t_add_vwapt */
kmt_add_iowapt, /* t_add_iowapt */
- (int (*)())(uintptr_t) mdb_tgt_null, /* t_add_sysenter */
- (int (*)())(uintptr_t) mdb_tgt_null, /* t_add_sysexit */
- (int (*)())(uintptr_t) mdb_tgt_null, /* t_add_signal */
+ (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sysenter */
+ (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_sysexit */
+ (int (*)())(uintptr_t)mdb_tgt_null, /* t_add_signal */
kmt_add_trap, /* t_add_fault */
kmt_getareg, /* t_getareg */
kmt_putareg, /* t_putareg */
- (int (*)())(uintptr_t) mdb_tgt_nop, /* XXX t_stack_iter */
- (int (*)())(uintptr_t) mdb_tgt_notsup /* t_auxv */
+ (int (*)())(uintptr_t)mdb_tgt_nop, /* XXX t_stack_iter */
+ (int (*)())(uintptr_t)mdb_tgt_notsup /* t_auxv */
};
/*
diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_module_load.c b/usr/src/cmd/mdb/common/kmdb/kmdb_module_load.c
index 38ba3ffe48..de65c8e43a 100644
--- a/usr/src/cmd/mdb/common/kmdb/kmdb_module_load.c
+++ b/usr/src/cmd/mdb/common/kmdb/kmdb_module_load.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/param.h>
#include <sys/modctl.h>
#include <sys/kobj.h>
@@ -123,7 +121,7 @@ kmdb_module_loaded(kmdb_wr_load_t *dlr)
struct modctl *modp = dlr->dlr_modctl;
const char *modname = strbasename(dlr->dlr_fname);
struct module *mp;
- kmdb_modctl_t *kmc;
+ kmdb_modctl_t *kmc = NULL;
mdb_var_t *v;
v = mdb_nv_lookup(&mdb.m_dmodctl, modname);
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
index ecdf2957bf..4a71c04dfb 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
@@ -321,6 +321,9 @@ write_arglist(mdb_tgt_as_t as, mdb_tgt_addr_t addr,
case 'Z':
write_value = write_uint64;
break;
+ default:
+ write_value = NULL;
+ break;
}
for (argv++, i = 1; i < argc; i++, argv++) {
@@ -435,6 +438,10 @@ match_arglist(mdb_tgt_as_t as, uint_t flags, mdb_tgt_addr_t addr,
case 'M':
match_value = match_uint64;
break;
+ default:
+ mdb_warn("unknown match value %c\n",
+ argv->a_un.a_char);
+ return (DCMD_ERR);
}
for (argv++, i = 1; i < argc; i++, argv++) {
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
index 9cc7c6f1a0..0368f88ad1 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
@@ -240,7 +240,7 @@ name_to_type(mdb_tgt_t *t, const char *cname, ctf_id_t *idp)
{
const char *object = MDB_TGT_OBJ_EXEC;
ctf_file_t *fp = NULL;
- ctf_id_t id;
+ ctf_id_t id = CTF_ERR;
tnarg_t arg;
char *p, *s;
char buf[MDB_SYM_NAMLEN];
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c
index 6a745b2ac4..e14a4d0bc2 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c
@@ -805,6 +805,9 @@ mdb_fmt_print(mdb_tgt_t *t, mdb_tgt_as_t as,
}
rvalue = u.i8;
break;
+ default:
+ rvalue = 0;
+ break;
}
mdb_nv_set_value(mdb.m_rvalue, rvalue);
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_kvm.c b/usr/src/cmd/mdb/common/mdb/mdb_kvm.c
index 27ca238ca9..dc1c248bac 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_kvm.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_kvm.c
@@ -563,7 +563,7 @@ kt_activate(mdb_tgt_t *t)
kt_data_t *kt = t->t_data;
void *sym;
- int oflag;
+ int oflag = 0;
mdb_prop_postmortem = kt->k_xpv_domu || (kt->k_dumphdr != NULL);
mdb_prop_kernel = TRUE;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_nm.c b/usr/src/cmd/mdb/common/mdb/mdb_nm.c
index 0653075e54..e0c18de0a2 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_nm.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_nm.c
@@ -563,7 +563,7 @@ cmd_nm(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
int hwidth;
size_t nsyms = 0;
- nm_sym_t *syms, *symp;
+ nm_sym_t *syms = NULL, *symp;
nm_iter_info_t nii;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_print.c b/usr/src/cmd/mdb/common/mdb/mdb_print.c
index bd23ef681f..7c213faf24 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_print.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_print.c
@@ -533,7 +533,7 @@ cmd_enum(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_ctf_id_t idr;
int i;
- intmax_t search;
+ intmax_t search = 0;
uint_t isp2;
info.e_flags = (flags & DCMD_PIPE_OUT)? 0 : E_PRETTY;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
index 5169cfb6a5..9ffa80916c 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c
@@ -5305,7 +5305,7 @@ mdb_proc_tgt_create(mdb_tgt_t *t, int argc, const char *argv[])
char execname[MAXPATHLEN];
struct stat64 st;
int perr;
- int state;
+ int state = 0;
struct rlimit rlim;
int i;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_target.c b/usr/src/cmd/mdb/common/mdb/mdb_target.c
index e0ae29bd99..29339f734f 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_target.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_target.c
@@ -506,7 +506,7 @@ ssize_t
mdb_tgt_readstr(mdb_tgt_t *t, mdb_tgt_as_t as, char *buf,
size_t nbytes, mdb_tgt_addr_t addr)
{
- ssize_t n, nread = mdb_tgt_aread(t, as, buf, nbytes, addr);
+ ssize_t n = -1, nread = mdb_tgt_aread(t, as, buf, nbytes, addr);
char *p;
if (nread >= 0) {
diff --git a/usr/src/cmd/mdb/common/modules/genunix/genunix.c b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
index 32370ba7e1..acc239b9a6 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/genunix.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
@@ -2995,7 +2995,7 @@ cpu_walk_init(mdb_walk_state_t *wsp)
int max_ncpus, i = 0;
uintptr_t current, first;
cpu_t cpu, panic_cpu;
- uintptr_t panicstr, addr;
+ uintptr_t panicstr, addr = 0;
GElf_Sym sym;
cw = mdb_zalloc(sizeof (cpu_walk_t), UM_SLEEP | UM_GC);
@@ -3160,7 +3160,7 @@ cpuinfo_walk_cpu(uintptr_t addr, const cpu_t *cpu, cpuinfo_data_t *cid)
kthread_t t;
disp_t disp;
mdb_cpuinfo_proc_t p;
- uintptr_t pinned;
+ uintptr_t pinned = 0;
char **flagbuf;
int nflaglines = 0, flagline = 0, bspl, rval = WALK_NEXT;
diff --git a/usr/src/cmd/mdb/common/modules/genunix/kmem.c b/usr/src/cmd/mdb/common/modules/genunix/kmem.c
index 146317e012..87ae1430f9 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/kmem.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/kmem.c
@@ -1155,7 +1155,7 @@ kmem_walk_init_common(mdb_walk_state_t *wsp, int type)
size_t magmax, magcnt;
void **maglist = NULL;
- uint_t chunksize, slabsize;
+ uint_t chunksize = 1, slabsize = 1;
int status = WALK_ERR;
uintptr_t addr = wsp->walk_addr;
const char *layered;
diff --git a/usr/src/cmd/mdb/common/modules/genunix/lgrp.c b/usr/src/cmd/mdb/common/modules/genunix/lgrp.c
index aa798bdb00..a09978bd04 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/lgrp.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/lgrp.c
@@ -231,9 +231,9 @@ lgrp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
int opt_q = 0; /* display only address. */
int i;
const char *s_index = NULL, *s_handle = NULL, *s_parent = NULL;
- uintptr_t index;
- uintptr_t handle;
- uintptr_t parent;
+ uintptr_t index = 0;
+ uintptr_t handle = 0;
+ uintptr_t parent = 0;
int filters = 0;
if (!(flags & DCMD_ADDRSPEC)) {
@@ -638,7 +638,7 @@ lgrp_set_walk_init(mdb_walk_state_t *wsp, klgrpset_t set)
lwsd->lswd_nlgrps = nlgrps;
if (mdb_readsym(lwsd->lwsd_lgrp_tbl, nlgrps * sizeof (lgrp_t *),
- "lgrp_table") == -1) {
+ "lgrp_table") == -1) {
mdb_warn("unable to read lgrp_table");
return (WALK_ERR);
}
diff --git a/usr/src/cmd/mdb/common/modules/genunix/net.c b/usr/src/cmd/mdb/common/modules/genunix/net.c
index f29407b76a..01ca4e68c4 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/net.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/net.c
@@ -384,7 +384,7 @@ sonode(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
const char *optf = NULL;
const char *optt = NULL;
const char *optp = NULL;
- int family, type, proto;
+ int family = AF_UNSPEC, type = 0, proto = 0;
int filter = 0;
struct sonode so;
@@ -1414,7 +1414,6 @@ do_show_bridge(uintptr_t addr, const void *data, void *ptr)
trill_nickinfo_t tni;
char bname[MAXLINKNAMELEN];
char macaddr[ETHERADDRL * 3];
- char *cp;
uint_t nnicks;
int i;
@@ -1430,9 +1429,9 @@ do_show_bridge(uintptr_t addr, const void *data, void *ptr)
(void) strncpy(bname, bip->bi_name, sizeof (bname) - 1);
bname[MAXLINKNAMELEN - 1] = '\0';
- cp = bname + strlen(bname);
- if (cp > bname && cp[-1] == '0')
- cp[-1] = '\0';
+ i = strlen(bname);
+ if (i > 1 && bname[i - 1] == '0')
+ bname[i - 1] = '\0';
if (args->name != NULL && strcmp(args->name, bname) != 0)
return (WALK_NEXT);
diff --git a/usr/src/cmd/mdb/common/modules/genunix/typegraph.c b/usr/src/cmd/mdb/common/modules/genunix/typegraph.c
index b7f6cf854d..ad68c39279 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/typegraph.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/typegraph.c
@@ -2765,7 +2765,7 @@ int
typeconflict_walk_step(mdb_walk_state_t *wsp)
{
size_t ndx;
- tg_node_t *node;
+ tg_node_t *node = NULL;
for (ndx = (size_t)wsp->walk_data; ndx < tg_nnodes; ndx++) {
node = &tg_node[ndx];
@@ -2793,7 +2793,7 @@ int
typeunknown_walk_step(mdb_walk_state_t *wsp)
{
size_t ndx;
- tg_node_t *node;
+ tg_node_t *node = NULL;
for (ndx = (size_t)wsp->walk_data; ndx < tg_nnodes; ndx++) {
node = &tg_node[ndx];
diff --git a/usr/src/cmd/mdb/common/modules/ipp/ipp.c b/usr/src/cmd/mdb/common/modules/ipp/ipp.c
index 8af4103c20..e744a3140b 100644
--- a/usr/src/cmd/mdb/common/modules/ipp/ipp.c
+++ b/usr/src/cmd/mdb/common/modules/ipp/ipp.c
@@ -568,7 +568,7 @@ dump_classes(
uint_t nelt)
{
ipp_class_t *array;
- ipp_class_t *cp;
+ ipp_class_t *cp = NULL;
uint_t i;
boolean_t first_time = B_TRUE;
char buf[MAXNAMELEN];
@@ -601,7 +601,7 @@ dump_log(
uint_t nelt)
{
ipp_log_t *array;
- ipp_log_t *lp;
+ ipp_log_t *lp = NULL;
uint_t i;
boolean_t first_time = B_TRUE;
char buf[MAXNAMELEN];
diff --git a/usr/src/cmd/mdb/common/modules/libumem/umem.c b/usr/src/cmd/mdb/common/modules/libumem/umem.c
index 018a33dd46..a1b3df481b 100644
--- a/usr/src/cmd/mdb/common/modules/libumem/umem.c
+++ b/usr/src/cmd/mdb/common/modules/libumem/umem.c
@@ -1119,7 +1119,7 @@ umem_walk_init_common(mdb_walk_state_t *wsp, int type)
size_t magmax, magcnt;
void **maglist = NULL;
- uint_t chunksize, slabsize;
+ uint_t chunksize = 1, slabsize = 1;
int status = WALK_ERR;
uintptr_t addr = wsp->walk_addr;
const char *layered;
diff --git a/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c b/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c
index 4ff1bc068f..b010a02a8e 100644
--- a/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c
+++ b/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c
@@ -771,6 +771,9 @@ display_targets(struct pmcs_hw m, int verbose, int totals_only)
dtype = "SMP";
smp_targets++;
break;
+ default:
+ dtype = "Unknown";
+ break;
}
if (totals_only) {
@@ -1951,7 +1954,7 @@ display_phy(struct pmcs_phy phy, struct pmcs_phy *phyp, int verbose,
char *asent = no;
char *dead = no;
char *changed = no;
- char route_attr, route_method;
+ char route_attr, route_method = '\0';
switch (phy.dtype) {
case NOTHING:
@@ -1975,6 +1978,9 @@ display_phy(struct pmcs_phy phy, struct pmcs_phy *phyp, int verbose,
++exp_phys;
}
break;
+ default:
+ dtype = "Unknown";
+ break;
}
if (phy.dtype == NOTHING) {
@@ -2556,7 +2562,7 @@ display_matching_work(struct pmcs_hw ss, uintmax_t index, uintmax_t snum,
uintptr_t _wp;
boolean_t printed_header = B_FALSE;
uint32_t mask, mask_val, match_val;
- char *match_type;
+ char *match_type = NULL;
if (index != UINT_MAX) {
match_type = "index";
@@ -2627,7 +2633,7 @@ pmcs_tag(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
uintmax_t index = UINT_MAX;
int args = 0;
void *pmcs_state;
- char *state_str;
+ char *state_str = NULL;
struct dev_info dip;
if (!(flags & DCMD_ADDRSPEC)) {
@@ -2928,10 +2934,10 @@ pmcs_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
uint_t fwlog = FALSE;
boolean_t devid_filter = FALSE;
uintptr_t pdevid;
- uint32_t devid;
+ uint32_t devid = 0;
int rv = DCMD_OK;
void *pmcs_state;
- char *state_str;
+ char *state_str = NULL;
struct dev_info dip;
per_iport_setting_t pis;
diff --git a/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c b/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c
index 9f7a1feeba..df4517d955 100644
--- a/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c
+++ b/usr/src/cmd/mdb/intel/mdb/mdb_bhyve.c
@@ -1022,7 +1022,7 @@ bhyve_aread(mdb_tgt_t *tgt, mdb_tgt_as_t as, void *buf, size_t nbytes,
mdb_tgt_addr_t addr)
{
bhyve_data_t *bd = tgt->t_data;
- ssize_t cnt;
+ ssize_t cnt = 0;
switch ((uintptr_t)as) {
case (uintptr_t)MDB_TGT_AS_VIRT:
@@ -1061,7 +1061,7 @@ bhyve_awrite(mdb_tgt_t *tgt, mdb_tgt_as_t as, const void *buf, size_t nbytes,
mdb_tgt_addr_t addr)
{
bhyve_data_t *bd = tgt->t_data;
- ssize_t cnt;
+ ssize_t cnt = 0;
switch ((uintptr_t)as) {
case (uintptr_t)MDB_TGT_AS_VIRT:
@@ -1408,15 +1408,15 @@ bhyve_putareg(mdb_tgt_t *tgt, mdb_tgt_tid_t tid, const char *rname,
static const mdb_tgt_ops_t bhyve_ops = {
.t_setflags = bhyve_setflags,
- .t_setcontext = (int (*)()) mdb_tgt_notsup,
+ .t_setcontext = (int (*)())(uintptr_t)mdb_tgt_notsup,
.t_activate = bhyve_activate,
.t_deactivate = bhyve_deactivate,
- .t_periodic = (void (*)()) mdb_tgt_nop,
+ .t_periodic = (void (*)())(uintptr_t)mdb_tgt_nop,
.t_destroy = bhyve_destroy,
.t_name = bhyve_name,
.t_isa = bhyve_isa,
- .t_platform = (const char *(*)()) mdb_conf_platform,
- .t_uname = (int (*)()) mdb_tgt_notsup,
+ .t_platform = (const char *(*)())mdb_conf_platform,
+ .t_uname = (int (*)())(uintptr_t)mdb_tgt_notsup,
.t_dmodel = bhyve_dmodel,
.t_aread = bhyve_aread,
.t_awrite = bhyve_awrite,
@@ -1431,33 +1431,33 @@ static const mdb_tgt_ops_t bhyve_ops = {
.t_vtop = bhyve_vtop,
.t_lookup_by_name = bhyve_lookup_by_name,
.t_lookup_by_addr = bhyve_lookup_by_addr,
- .t_symbol_iter = (int (*)()) mdb_tgt_notsup,
- .t_mapping_iter = (int (*)()) mdb_tgt_notsup,
- .t_object_iter = (int (*)()) mdb_tgt_notsup,
- .t_addr_to_map = (const mdb_map_t *(*)()) mdb_tgt_null,
- .t_name_to_map = (const mdb_map_t *(*)()) mdb_tgt_null,
- .t_addr_to_ctf = (struct ctf_file *(*)()) mdb_tgt_null,
- .t_name_to_ctf = (struct ctf_file *(*)()) mdb_tgt_null,
+ .t_symbol_iter = (int (*)())(uintptr_t)mdb_tgt_notsup,
+ .t_mapping_iter = (int (*)())(uintptr_t)mdb_tgt_notsup,
+ .t_object_iter = (int (*)())(uintptr_t)mdb_tgt_notsup,
+ .t_addr_to_map = (const mdb_map_t *(*)())mdb_tgt_null,
+ .t_name_to_map = (const mdb_map_t *(*)())mdb_tgt_null,
+ .t_addr_to_ctf = (struct ctf_file *(*)())mdb_tgt_null,
+ .t_name_to_ctf = (struct ctf_file *(*)())mdb_tgt_null,
.t_status = bhyve_status,
- .t_run = (int (*)()) mdb_tgt_notsup,
+ .t_run = (int (*)())(uintptr_t)mdb_tgt_notsup,
.t_step = bhyve_step,
- .t_step_out = (int (*)()) mdb_tgt_notsup,
- .t_next = (int (*)()) mdb_tgt_notsup,
+ .t_step_out = (int (*)())(uintptr_t)mdb_tgt_notsup,
+ .t_next = (int (*)())(uintptr_t)mdb_tgt_notsup,
.t_cont = bhyve_cont,
- .t_signal = (int (*)()) mdb_tgt_notsup,
- .t_add_vbrkpt = (int (*)()) mdb_tgt_null,
- .t_add_sbrkpt = (int (*)()) mdb_tgt_null,
- .t_add_pwapt = (int (*)()) mdb_tgt_null,
- .t_add_vwapt = (int (*)()) mdb_tgt_null,
- .t_add_iowapt = (int (*)()) mdb_tgt_null,
- .t_add_sysenter = (int (*)()) mdb_tgt_null,
- .t_add_sysexit = (int (*)()) mdb_tgt_null,
- .t_add_signal = (int (*)()) mdb_tgt_null,
- .t_add_fault = (int (*)()) mdb_tgt_null,
+ .t_signal = (int (*)())(uintptr_t)mdb_tgt_notsup,
+ .t_add_vbrkpt = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_sbrkpt = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_pwapt = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_vwapt = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_iowapt = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_sysenter = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_sysexit = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_signal = (int (*)())(uintptr_t)mdb_tgt_null,
+ .t_add_fault = (int (*)())(uintptr_t)mdb_tgt_null,
.t_getareg = bhyve_getareg,
.t_putareg = bhyve_putareg,
- .t_stack_iter = (int (*)()) mdb_tgt_notsup,
- .t_auxv = (int (*)()) mdb_tgt_notsup
+ .t_stack_iter = (int (*)())(uintptr_t)mdb_tgt_notsup,
+ .t_auxv = (int (*)())(uintptr_t)mdb_tgt_notsup
};
int
diff --git a/usr/src/cmd/mdb/tools/common/findscn.c b/usr/src/cmd/mdb/tools/common/findscn.c
index c5d14cf90a..c407fea3a0 100644
--- a/usr/src/cmd/mdb/tools/common/findscn.c
+++ b/usr/src/cmd/mdb/tools/common/findscn.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <string.h>
#include <libelf.h>
#include <gelf.h>
diff --git a/usr/src/cmd/mdb/tools/common/util.h b/usr/src/cmd/mdb/tools/common/util.h
index 34e191b6a6..d4c67c488a 100644
--- a/usr/src/cmd/mdb/tools/common/util.h
+++ b/usr/src/cmd/mdb/tools/common/util.h
@@ -27,8 +27,6 @@
#ifndef _UTIL_H
#define _UTIL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <libelf.h>
#ifdef __cplusplus
@@ -37,8 +35,8 @@ extern "C" {
extern int findelfsecidx(Elf *, char *);
-extern void die(char *, ...);
-extern void elfdie(char *, ...);
+extern void die(char *, ...) __NORETURN;
+extern void elfdie(char *, ...) __NORETURN;
extern const char *progname;
diff --git a/usr/src/cmd/sgs/error/common/error.h b/usr/src/cmd/sgs/error/common/error.h
index e013635b8f..9a19af13f5 100644
--- a/usr/src/cmd/sgs/error/common/error.h
+++ b/usr/src/cmd/sgs/error/common/error.h
@@ -110,8 +110,8 @@ extern int class_count[];
#define TOTHEFILE 1 /* touch the file */
#define TOSTDOUT 2 /* just print them out (ho-hum) */
-FILE *errorfile; /* where error file comes from */
-FILE *queryfile; /* where the query responses from the user come from */
+extern FILE *errorfile; /* where error file comes from */
+extern FILE *queryfile; /* where the query responses from the user come from */
extern char *currentfilename;
extern char *processname;
@@ -172,8 +172,8 @@ extern struct lang_desc lang_table[];
#define IG_FILE2 "/usr/lib/llib-port"
#define ERRORNAME "/.errorrc"
-int nignored;
-char **names_ignored;
+extern int nignored;
+extern char **names_ignored;
/*
* Structure definition for a full error
*/
@@ -202,7 +202,7 @@ extern Eptr *errors;
*/
extern int nfiles;
extern Eptr **files; /* array of pointers into errors */
-boolean *touchedfiles; /* which files we touched */
+extern boolean *touchedfiles; /* which files we touched */
/*
* The langauge the compilation is in, as intuited from
* the flavor of error messages analyzed.
diff --git a/usr/src/cmd/sgs/error/common/errorfilter.c b/usr/src/cmd/sgs/error/common/errorfilter.c
index cdef60f8ff..52b0ec1da5 100644
--- a/usr/src/cmd/sgs/error/common/errorfilter.c
+++ b/usr/src/cmd/sgs/error/common/errorfilter.c
@@ -38,6 +38,8 @@ char *lint_libs[] = {
IG_FILE2,
0
};
+char **names_ignored;
+int nignored;
extern char *processname;
diff --git a/usr/src/cmd/sgs/error/common/errorinput.c b/usr/src/cmd/sgs/error/common/errorinput.c
index 1f02ab6923..b5a2341ffc 100644
--- a/usr/src/cmd/sgs/error/common/errorinput.c
+++ b/usr/src/cmd/sgs/error/common/errorinput.c
@@ -34,9 +34,6 @@
int wordc; /* how long the current error message is */
char **wordv; /* the actual error message */
-int nerrors;
-int language;
-
Errorclass onelong(void);
Errorclass cpp(void);
Errorclass pccccom(void); /* Portable C Compiler C Compiler */
diff --git a/usr/src/cmd/sgs/error/common/errormain.c b/usr/src/cmd/sgs/error/common/errormain.c
index 026f4b7ce1..5b80c3c537 100644
--- a/usr/src/cmd/sgs/error/common/errormain.c
+++ b/usr/src/cmd/sgs/error/common/errormain.c
@@ -25,8 +25,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
@@ -35,6 +33,8 @@
#include <string.h>
#include "error.h"
+FILE *errorfile;
+FILE *queryfile;
int nerrors = 0;
Eptr er_head;
Eptr *errors;
@@ -181,8 +181,8 @@ main(int argc, char *argv[])
if ((queryfile = fopen(im_on, "r")) == NULL) {
if (query) {
(void) fprintf(stderr,
- "%s: Can't open \"%s\" to query the user.\n",
- processname, im_on);
+ "%s: Can't open \"%s\" to query the user.\n",
+ processname, im_on);
exit(9);
}
}
diff --git a/usr/src/cmd/sgs/error/common/errortouch.c b/usr/src/cmd/sgs/error/common/errortouch.c
index fcc3ce9499..132f703b05 100644
--- a/usr/src/cmd/sgs/error/common/errortouch.c
+++ b/usr/src/cmd/sgs/error/common/errortouch.c
@@ -62,6 +62,7 @@ static void writetouched(int overwrite);
#define FILEITERATE(fi, lb) for (fi = lb; fi <= nfiles; fi++)
int touchstatus = Q_YES;
+boolean *touchedfiles;
void
findfiles(int nerrors, Eptr *errors, int *r_nfiles, Eptr ***r_files)
diff --git a/usr/src/cmd/sgs/gprof/common/arcs.c b/usr/src/cmd/sgs/gprof/common/arcs.c
index 8b5fb24801..cd3ad2a482 100644
--- a/usr/src/cmd/sgs/gprof/common/arcs.c
+++ b/usr/src/cmd/sgs/gprof/common/arcs.c
@@ -25,11 +25,14 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdlib.h>
#include "gprof.h"
+double printtime;
+sztype total_names;
+int ncycle;
+nltype *cyclenl;
+
/*
* add (or just increment) an arc
*/
@@ -334,11 +337,13 @@ cyclelink(void)
continue;
if (arcp->arc_parentp->cycleno ==
- cycle) {
- cyclenlp->selfcalls +=
- arcp->arc_count;
- } else
- cyclenlp->ncall += arcp->arc_count;
+ cycle) {
+ cyclenlp->selfcalls +=
+ arcp->arc_count;
+ } else {
+ cyclenlp->ncall +=
+ arcp->arc_count;
+ }
}
}
}
@@ -607,10 +612,8 @@ doarcs(void)
* the program executable.
*/
if (cflag && (mi == &modules)) {
- findcalls(
- parentp,
- parentp->value,
- parentp->value + parentp->sz);
+ findcalls(parentp, parentp->value,
+ parentp->value + parentp->sz);
}
}
}
@@ -643,7 +646,7 @@ doarcs(void)
index = 0;
for (mi = &modules; mi; mi = mi->next) {
for (i = 0; i < mi->nname; i++)
- topsortnlp[index++] = &(mi->nl[i]);
+ topsortnlp[index++] = &(mi->nl[i]);
}
qsort(topsortnlp, total_names, sizeof (nltype *), topcmp);
@@ -677,7 +680,7 @@ doarcs(void)
* and cycle headers.
*/
timesortnlp = (nltype **) calloc(total_names + ncycle,
- sizeof (nltype *));
+ sizeof (nltype *));
if (timesortnlp == (nltype **) 0) {
(void) fprintf(stderr,
"%s: ran out of memory for sorting\n", whoami);
@@ -686,7 +689,7 @@ doarcs(void)
index = 0;
for (mi = &modules; mi; mi = mi->next) {
for (i = 0; i < mi->nname; i++)
- timesortnlp[index++] = &(mi->nl[i]);
+ timesortnlp[index++] = &(mi->nl[i]);
}
for (index = 1; index <= ncycle; index++)
diff --git a/usr/src/cmd/sgs/gprof/common/gprof.c b/usr/src/cmd/sgs/gprof/common/gprof.c
index 9bdd429183..2cb0720f8b 100644
--- a/usr/src/cmd/sgs/gprof/common/gprof.c
+++ b/usr/src/cmd/sgs/gprof/common/gprof.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sysexits.h>
#include <stdlib.h>
#include <stdio.h>
@@ -32,6 +30,44 @@
#include "gprof.h"
#include "profile.h"
+bool aflag;
+bool bflag;
+bool Bflag;
+bool cflag;
+bool Cflag;
+bool dflag;
+bool Dflag;
+bool eflag;
+bool Eflag;
+bool fflag;
+bool Fflag;
+bool lflag;
+bool sflag;
+bool zflag;
+bool nflag;
+bool rflag;
+bool first_file;
+bool old_style;
+double scale;
+double totime;
+Size n_pcsamples;
+mod_info_t modules;
+pctype s_lowpc;
+pctype s_highpc;
+sztype n_modules;
+sztype sampbytes;
+sztype nsamples;
+unsigned short *samples;
+fl_info_t aout_info;
+fl_info_t gmonout_info;
+long hz;
+struct hdr h;
+unsigned char *textspace;
+int debug;
+int number_funcs_toprint;
+char *a_outname;
+char *prog_name;
+char *gmonname;
char *whoami = "gprof";
static pctype lowpc, highpc; /* range profiled, in UNIT's */
@@ -1896,7 +1932,7 @@ main(int argc, char **argv)
int i;
(void) printf(" Name, pc_entry_pt, svalue, tix_in_routine, "
"#calls, selfcalls, index \n");
- for (i = 0; i < modules.nname; i++) { /* Print each symbol */
+ for (i = 0; i < modules.nname; i++) { /* Print each symbol */
if (timesortnlp[i]->name)
(void) printf(" %s ", timesortnlp[i]->name);
else
diff --git a/usr/src/cmd/sgs/gprof/common/gprof.h b/usr/src/cmd/sgs/gprof/common/gprof.h
index e62ddaf45c..a22f06df34 100644
--- a/usr/src/cmd/sgs/gprof/common/gprof.h
+++ b/usr/src/cmd/sgs/gprof/common/gprof.h
@@ -27,8 +27,6 @@
#ifndef _SGS_GPROF_H
#define _SGS_GPROF_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -87,12 +85,12 @@ typedef Boolean bool;
/*
* ticks per second
*/
-long hz;
+extern long hz;
typedef short UNIT; /* unit of profiling */
typedef unsigned short unsigned_UNIT; /* to remove warnings from gprof.c */
-char *a_outname;
-char *prog_name; /* keep the program name for error messages */
+extern char *a_outname;
+extern char *prog_name; /* keep the program name for error messages */
#define A_OUTNAME "a.out"
typedef unsigned long long pctype;
@@ -105,7 +103,7 @@ typedef size_t sztype;
typedef long long actype;
typedef int32_t actype32;
-char *gmonname;
+extern char *gmonname;
#define GMONNAME "gmon.out"
#define GMONSUM "gmon.sum"
@@ -170,7 +168,7 @@ typedef struct arcstruct arctype;
/*
* Additions for new-style gmon.out
*/
-bool old_style; /* gmon.out versioned/non-versioned ? */
+extern bool old_style; /* gmon.out versioned/non-versioned ? */
/*
* Executable file info.
@@ -189,8 +187,8 @@ typedef struct fl_info fl_info_t;
/*
* Saved file info.
*/
-fl_info_t aout_info; /* saved file info for program exec */
-fl_info_t gmonout_info; /* current gmonout's info */
+extern fl_info_t aout_info; /* saved file info for program exec */
+extern fl_info_t gmonout_info; /* current gmonout's info */
/*
@@ -211,16 +209,14 @@ struct mod_info {
};
typedef struct mod_info mod_info_t;
-sztype total_names; /* from all modules */
+extern sztype total_names; /* from all modules */
/*
* List of shared object modules. Note that this always includes the
* program executable as the first element.
*/
-mod_info_t modules;
-sztype n_modules;
-
-
+extern mod_info_t modules;
+extern sztype n_modules;
/*
* The symbol table;
@@ -265,8 +261,8 @@ typedef struct nl nltype;
* namelist entries for cycle headers.
* the number of discovered cycles.
*/
-nltype *cyclenl; /* cycle header namelist */
-int ncycle; /* number of cycles discovered */
+extern nltype *cyclenl; /* cycle header namelist */
+extern int ncycle; /* number of cycles discovered */
/*
* The header on the gmon.out file.
@@ -288,56 +284,56 @@ struct hdr32 {
pctype32 ncnt;
};
-struct hdr h; /* header of profiled data */
+extern struct hdr h; /* header of profiled data */
-int debug;
-int number_funcs_toprint;
+extern int debug;
+extern int number_funcs_toprint;
/*
* Each discretized pc sample has
* a count of the number of samples in its range
*/
-unsigned short *samples;
+extern unsigned short *samples;
-pctype s_lowpc; /* lowpc from profile file in o-s gmon.out */
-pctype s_highpc; /* highpc from profile file in o-s gmon.out */
-sztype sampbytes; /* number of bytes of samples in o-s gmon.out */
-sztype nsamples; /* number of samples for old-style gmon.out */
+extern pctype s_lowpc; /* lowpc from profile file in o-s gmon.out */
+extern pctype s_highpc; /* highpc from profile file in o-s gmon.out */
+extern sztype sampbytes; /* number of bytes of samples in o-s gmon.out */
+extern sztype nsamples; /* number of samples for old-style gmon.out */
-double actime; /* accumulated time thus far for putprofline */
-double totime; /* total time for all routines */
-double printtime; /* total of time being printed */
-double scale; /* scale factor converting samples to pc */
+extern double actime; /* accumulated time thus far for putprofline */
+extern double totime; /* total time for all routines */
+extern double printtime; /* total of time being printed */
+extern double scale; /* scale factor converting samples to pc */
/* values: each sample covers scale bytes */
/* -- all this is for old-style gmon.out only */
-unsigned char *textspace; /* text space of a.out in core */
-bool first_file; /* for difference option */
+extern unsigned char *textspace; /* text space of a.out in core */
+extern bool first_file; /* for difference option */
/*
* Total number of pcsamples read so far (across gmon.out's)
*/
-Size n_pcsamples;
+extern Size n_pcsamples;
/*
* option flags, from a to z.
*/
-bool aflag; /* suppress static functions */
-bool bflag; /* blurbs, too */
-bool Bflag; /* big pc's (i.e. 64 bits) */
-bool cflag; /* discovered call graph, too */
-bool Cflag; /* gprofing c++ -- need demangling */
-bool dflag; /* debugging options */
-bool Dflag; /* difference option */
-bool eflag; /* specific functions excluded */
-bool Eflag; /* functions excluded with time */
-bool fflag; /* specific functions requested */
-bool Fflag; /* functions requested with time */
-bool lflag; /* exclude LOCAL syms in output */
-bool sflag; /* sum multiple gmon.out files */
-bool zflag; /* zero time/called functions, too */
-bool nflag; /* print only n functions in report */
-bool rflag; /* profiling input generated by */
+extern bool aflag; /* suppress static functions */
+extern bool bflag; /* blurbs, too */
+extern bool Bflag; /* big pc's (i.e. 64 bits) */
+extern bool cflag; /* discovered call graph, too */
+extern bool Cflag; /* gprofing c++ -- need demangling */
+extern bool dflag; /* debugging options */
+extern bool Dflag; /* difference option */
+extern bool eflag; /* specific functions excluded */
+extern bool Eflag; /* functions excluded with time */
+extern bool fflag; /* specific functions requested */
+extern bool Fflag; /* functions requested with time */
+extern bool lflag; /* exclude LOCAL syms in output */
+extern bool sflag; /* sum multiple gmon.out files */
+extern bool zflag; /* zero time/called functions, too */
+extern bool nflag; /* print only n functions in report */
+extern bool rflag; /* profiling input generated by */
/* run-time linker */
diff --git a/usr/src/cmd/sgs/gprof/common/printgprof.c b/usr/src/cmd/sgs/gprof/common/printgprof.c
index acabccaedd..bbd8673ec7 100644
--- a/usr/src/cmd/sgs/gprof/common/printgprof.c
+++ b/usr/src/cmd/sgs/gprof/common/printgprof.c
@@ -34,11 +34,11 @@
#include "conv.h"
#include "gprof.h"
+double actime;
+
void print_demangled_name(int, nltype *);
static void stripped_name(char **, size_t *, nltype **);
-extern long hz;
-
/*
* Symbols that must never be printed, no matter what.
*/
diff --git a/usr/src/cmd/vi/port/ex.h b/usr/src/cmd/vi/port/ex.h
index 65dc0edd01..ea93b2a662 100644
--- a/usr/src/cmd/vi/port/ex.h
+++ b/usr/src/cmd/vi/port/ex.h
@@ -24,7 +24,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/* Copyright (c) 1981 Regents of the University of California */
@@ -372,7 +372,7 @@ var int crflag; /* True if the key has been accepted and the file
var int perm[2]; /* pipe connection to crypt for file being edited */
var int tperm[2]; /* pipe connection to crypt for temporary file */
var int permflag;
-var int tpermflag;
+var int tpermflag;
var unsigned char *key;
var unsigned char crbuf[CRSIZE];
char *getpass();
@@ -399,10 +399,10 @@ int (*setnorm())();
int (*setnorm())();
int (*setnumb())();
#ifndef PRESUNEUC
-int (*wdwc)(wchar_t); /* tells kind of word character */
-int (*wdbdg)(wchar_t, wchar_t, int); /* tells word binding force */
-wchar_t *(*wddlm)(wchar_t, wchar_t, int); /* tells desired delimiter */
-wchar_t (*mcfllr)(void); /* tells multicolumn filler character */
+extern int (*wdwc)(wchar_t); /* tells kind of word character */
+extern int (*wdbdg)(wchar_t, wchar_t, int); /* tells word binding force */
+extern wchar_t *(*wddlm)(wchar_t, wchar_t, int); /* tells desired delimiter */
+extern wchar_t (*mcfllr)(void); /* tells multicolumn filler character */
#endif /* PRESUNEUC */
line *address();
unsigned char *cgoto();
@@ -459,7 +459,7 @@ int vshftop();
int yank(void);
unsigned char *lastchr();
unsigned char *nextchr();
-bool putoctal;
+extern bool putoctal;
void error();
void error0(void);
@@ -603,7 +603,6 @@ void vclear(void);
unsigned char *lastchr();
unsigned char *nextchr();
-bool putoctal;
void setdot1(void);
diff --git a/usr/src/cmd/vi/port/ex_subr.c b/usr/src/cmd/vi/port/ex_subr.c
index 3f0980a825..bc99bbf8fb 100644
--- a/usr/src/cmd/vi/port/ex_subr.c
+++ b/usr/src/cmd/vi/port/ex_subr.c
@@ -24,7 +24,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/* Copyright (c) 1981 Regents of the University of California */
@@ -47,6 +47,13 @@
#include "ex_tty.h"
#include "ex_vis.h"
+#ifndef PRESUNEUC
+int (*wdwc)(wchar_t);
+int (*wdbdg)(wchar_t, wchar_t, int);
+wchar_t *(*wddlm)(wchar_t, wchar_t, int);
+wchar_t (*mcfllr)(void);
+#endif /* PRESUNEUC */
+
/*
* Random routines, in alphabetical order.
*/
@@ -588,7 +595,7 @@ qcolumn(unsigned char *lim, unsigned char *gp)
col = 0;
vcntcol = vcntcol - col + 1;
}
- if (gp)
+ if (gp)
while (*gp) {
length = mbtowc(&wchar, (char *)gp, MULTI_BYTE_MAX);
if(length < 0) {
@@ -628,7 +635,7 @@ nqcolumn(unsigned char *lim, unsigned char *gp)
pline(0);
if (lim != NULL)
lim[length] = x;
- if (gp)
+ if (gp)
while (*gp) {
length = mbtowc(&wchar, (char *)gp, MULTI_BYTE_MAX);
if(length < 0) {
diff --git a/usr/src/contrib/ast/src/cmd/ksh93/sh/parse.c b/usr/src/contrib/ast/src/cmd/ksh93/sh/parse.c
index 1d13e6dd94..49289784ea 100644
--- a/usr/src/contrib/ast/src/cmd/ksh93/sh/parse.c
+++ b/usr/src/contrib/ast/src/cmd/ksh93/sh/parse.c
@@ -743,7 +743,7 @@ static Shnode_t *funct(Lex_t *lexp)
register Shnode_t *t;
register int flag;
struct slnod *volatile slp=0;
- Stak_t *savstak;
+ Stak_t *savstak = NULL;
Sfoff_t first, last;
struct functnod *volatile fp;
Sfio_t *iop;
diff --git a/usr/src/head/protocols/dumprestore.h b/usr/src/head/protocols/dumprestore.h
index 29b3b309b7..aa081a3e76 100644
--- a/usr/src/head/protocols/dumprestore.h
+++ b/usr/src/head/protocols/dumprestore.h
@@ -117,7 +117,7 @@ union u_shadow {
/* if you change anything here, be sure to change normspcl in byteorder.c */
-union u_spcl {
+extern union u_spcl {
char dummy[TP_BUFSIZE];
struct s_spcl {
int32_t c_type; /* record type (see below) */
diff --git a/usr/src/lib/iconv_modules/utf-8/Makefile b/usr/src/lib/iconv_modules/utf-8/Makefile
index 472066bc7e..cc14caf0c0 100644
--- a/usr/src/lib/iconv_modules/utf-8/Makefile
+++ b/usr/src/lib/iconv_modules/utf-8/Makefile
@@ -43,7 +43,6 @@ INPUTFILES1 = $(CODESETS:%=%+UTF-8.src)
INPUTFILES2 = $(CODESETS:%=UTF-8+%.src)
INPUTFILES = $(INPUTFILES1) $(INPUTFILES2)
BINARYTABLES = $(INPUTFILES:%.src=%.bt)
-GENICONVTBL = /usr/bin/geniconvtbl
GENI_SRCS = common/binarytables/srcs
ICONV_DIR = $(ROOT)/usr/lib/iconv
BTS_DIR = $(ICONV_DIR)/geniconvtbl/binarytables
diff --git a/usr/src/lib/libc/i386/sys/door.s b/usr/src/lib/libc/i386/sys/door.s
index 1e5561c387..d0785af1bc 100644
--- a/usr/src/lib/libc/i386/sys/door.s
+++ b/usr/src/lib/libc/i386/sys/door.s
@@ -22,6 +22,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
*/
.file "door.s"
@@ -110,7 +112,7 @@
/*
* int
* __door_return(
- * void *data_ptr,
+ * void *data_ptr,
* size_t data_size, (in bytes)
* door_return_desc_t *door_ptr, (holds returned desc info)
* caddr_t stack_base,
@@ -142,6 +144,8 @@ door_restart:
* data (if any)
* sp-> struct door_results
*
+ * The stack will be aligned to 16 bytes; we must maintain that
+ * alignment prior to any call instruction.
* struct door_results has the arguments in place for the server proc,
* so we just call it directly.
*/
@@ -152,14 +156,16 @@ door_restart:
* this is the last server thread - call creation func for more
*/
movl DOOR_INFO_PTR(%esp), %eax
+ subl $12, %esp
pushl %eax /* door_info_t * */
call door_depletion_cb@PLT
- addl $4, %esp
+ addl $16, %esp
1:
/* Call the door server function now */
movl DOOR_PC(%esp), %eax
call *%eax
/* Exit the thread if we return here */
+ subl $12, %esp
pushl $0
call _thrp_terminate
/* NOTREACHED */
diff --git a/usr/src/lib/libcrypt/common/mapfile-vers b/usr/src/lib/libcrypt/common/mapfile-vers
index b672ef385f..8484e7e84d 100644
--- a/usr/src/lib/libcrypt/common/mapfile-vers
+++ b/usr/src/lib/libcrypt/common/mapfile-vers
@@ -65,7 +65,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
des_setparity;
ecb_crypt;
_encrypt { TYPE = FUNCTION; FILTER = libc.so.1 };
- _lib_version;
makekey;
_makekey;
run_crypt;
diff --git a/usr/src/lib/libcurses/screen/mapfile-vers b/usr/src/lib/libcurses/screen/mapfile-vers
index dab8dc12b4..6e7cf9d1a6 100644
--- a/usr/src/lib/libcurses/screen/mapfile-vers
+++ b/usr/src/lib/libcurses/screen/mapfile-vers
@@ -449,7 +449,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
_init_costs;
_init_HP_pair;
initscr32;
- _lib_version;
LINES;
m_addch;
m_addstr;
diff --git a/usr/src/lib/libeti/form/common/mapfile-vers b/usr/src/lib/libeti/form/common/mapfile-vers
index 9ce7631261..210f8e70ed 100644
--- a/usr/src/lib/libeti/form/common/mapfile-vers
+++ b/usr/src/lib/libeti/form/common/mapfile-vers
@@ -164,7 +164,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
_last_page;
_left_char;
_left_field;
- _lib_version;
__lptr_;
_makearg;
_misc_request;
diff --git a/usr/src/lib/libeti/form/common/regcmp.c b/usr/src/lib/libeti/form/common/regcmp.c
index b41e491b50..147ac0faec 100644
--- a/usr/src/lib/libeti/form/common/regcmp.c
+++ b/usr/src/lib/libeti/form/common/regcmp.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
@@ -32,8 +32,6 @@
* Copyright (c) 2018, Joyent, Inc.
*/
-/*LINTLIBRARY*/
-
#include <sys/types.h>
#include <stdlib.h>
#include "utility.h"
@@ -71,7 +69,7 @@
intptr_t *__sp_;
intptr_t *__stmax;
-int __i_size;
+extern int __i_size;
/*ARGSUSED2*/
char *
@@ -116,7 +114,7 @@ libform_regcmp(char *cs1, char *cs2)
*ep++ = FCEOF;
if (--nbra > NBRA || *__sp_ != -1)
goto cerror;
- __i_size = (int) (ep - sep);
+ __i_size = (int)(ep - sep);
return (sep);
}
if ((c != '*') && (c != '{') && (c != '+'))
@@ -155,12 +153,12 @@ libform_regcmp(char *cs1, char *cs2)
*eptr = GRP;
continue;
}
- i = (int) (ep - eptr - 2);
+ i = (int)(ep - eptr - 2);
for (cclcnt = 0; i >= 256; cclcnt++)
i -= 256;
if (cclcnt > 3) goto cerror;
*eptr |= cclcnt;
- *++eptr = (char) i;
+ *++eptr = (char)i;
continue;
case '\\':
@@ -182,7 +180,7 @@ libform_regcmp(char *cs1, char *cs2)
else goto cerror;
} while (((c = *sp++) != '}') && (c != ','));
if (i > 255) goto cerror;
- *ep++ = (char) i;
+ *ep++ = (char)i;
if (c == ',') {
if (cflg++) goto cerror;
if ((c = *sp++) == '}') {
@@ -194,7 +192,7 @@ libform_regcmp(char *cs1, char *cs2)
}
}
if (!cflg)
- *ep++ = (char) i;
+ *ep++ = (char)i;
else if ((ep[-1]&0377) < (ep[-2]&0377))
goto cerror;
continue;
@@ -243,7 +241,7 @@ libform_regcmp(char *cs1, char *cs2)
*ep++ = c;
cclcnt++;
} while ((c = *sp++) != ']');
- lastep[1] = (char) cclcnt;
+ lastep[1] = (char)cclcnt;
continue;
defchar:
diff --git a/usr/src/lib/libeti/form/common/regex.c b/usr/src/lib/libeti/form/common/regex.c
index 171916d7f4..3993c286a7 100644
--- a/usr/src/lib/libeti/form/common/regex.c
+++ b/usr/src/lib/libeti/form/common/regex.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
@@ -32,8 +32,6 @@
* Copyright (c) 2018, Joyent, Inc.
*/
-/*LINTLIBRARY*/
-
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
@@ -74,7 +72,7 @@
char *__braslist[NBRA];
char *__braelist[NBRA];
-char *__loc1;
+extern char *__loc1;
intptr_t __bravar[NBRA];
intptr_t *__st[SSIZE + 1];
intptr_t *__eptr_, *__lptr_;
diff --git a/usr/src/lib/libeti/menu/common/mapfile-vers b/usr/src/lib/libeti/menu/common/mapfile-vers
index 6268c3daf1..e154c78aba 100644
--- a/usr/src/lib/libeti/menu/common/mapfile-vers
+++ b/usr/src/lib/libeti/menu/common/mapfile-vers
@@ -112,7 +112,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
_Default_Menu;
_disconnect;
_draw;
- _lib_version;
_link_items;
_match;
_movecurrent;
diff --git a/usr/src/lib/libeti/panel/common/mapfile-vers b/usr/src/lib/libeti/panel/common/mapfile-vers
index bee87393b2..5a3eba14ee 100644
--- a/usr/src/lib/libeti/panel/common/mapfile-vers
+++ b/usr/src/lib/libeti/panel/common/mapfile-vers
@@ -63,7 +63,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
_Bottom_panel;
_free_overlap;
_intersect_panel;
- _lib_version;
_Panel_cnt;
_remove_overlap;
_Top_panel;
diff --git a/usr/src/lib/libmp/common/mapfile_1-vers b/usr/src/lib/libmp/common/mapfile_1-vers
index 01276e6510..bd832f627e 100644
--- a/usr/src/lib/libmp/common/mapfile_1-vers
+++ b/usr/src/lib/libmp/common/mapfile_1-vers
@@ -60,7 +60,6 @@ SYMBOL_VERSION SUNW_1.1 {
SYMBOL_VERSION SUNWprivate_1.1 {
global:
- _lib_version;
xalloc;
xfree;
local:
diff --git a/usr/src/lib/libnisdb/nis_ldap.c b/usr/src/lib/libnisdb/nis_ldap.c
index d185fc7a67..2be4df3770 100644
--- a/usr/src/lib/libnisdb/nis_ldap.c
+++ b/usr/src/lib/libnisdb/nis_ldap.c
@@ -24,9 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
#include <poll.h>
#include <sys/time.h>
#include <stdlib.h>
@@ -81,7 +78,8 @@ __nis_config_t ldapConfig = {
* > 0 Decrement 'attempts', sleep as indicated, return 1
*/
int
-__nis_retry_sleep(__nisdb_retry_t *retry, int forceSleep) {
+__nis_retry_sleep(__nisdb_retry_t *retry, int forceSleep)
+{
if (retry == NULL)
return (0);
@@ -111,7 +109,8 @@ static int rootDirTtl = 0;
* Return 1 if the root dir has expired, 0 otherwise.
*/
int
-rootDirExpired(void) {
+rootDirExpired(void)
+{
struct timeval now;
(void) gettimeofday(&now, 0);
@@ -127,7 +126,8 @@ rootDirExpired(void) {
* Also establishes the TTL if not set.
*/
int
-touchRootDir(void) {
+touchRootDir(void)
+{
struct timeval now;
int ttl;
diff --git a/usr/src/lib/libnisdb/nis_parse_ldap_conf.c b/usr/src/lib/libnisdb/nis_parse_ldap_conf.c
index 584932ce6d..ecd0836fbf 100644
--- a/usr/src/lib/libnisdb/nis_parse_ldap_conf.c
+++ b/usr/src/lib/libnisdb/nis_parse_ldap_conf.c
@@ -46,7 +46,6 @@
__nis_ldap_proxy_info proxyInfo =
{NULL, (auth_method_t)NO_VALUE_SET, (tls_method_t)NO_VALUE_SET, NULL,
NULL, NULL, NULL, NULL, (follow_referral_t)NO_VALUE_SET};
-__nis_config_t ldapConfig;
__nisdb_table_mapping_t ldapDBTableMapping;
__nis_table_mapping_t *ldapTableMapping = NULL;
__yp_domain_context_t ypDomains;
@@ -54,7 +53,7 @@ __yp_domain_context_t ypDomains;
parse_error p_error = no_parse_error;
int cur_line_num = 0;
int start_line_num = 0;
-int seq_num = 0;
+int seq_num = 0;
const char *warn_file = NULL;
char _key_val[38];
@@ -88,7 +87,7 @@ static int yp_parse_ldap_default_conf(__nis_ldap_proxy_info *proxy_info,
/* Forward declarations */
int yp_parse_ldap_config_file(const char *, __nis_ldap_proxy_info *,
__nis_config_t *, __nis_table_mapping_t **, __nis_config_info_t *,
- __nisdb_table_mapping_t *, __yp_domain_context_t *);
+ __nisdb_table_mapping_t *, __yp_domain_context_t *);
/* helper functions */
@@ -417,7 +416,7 @@ yp_parse_ldap_default_conf(
char *attr_val;
int defflags;
config_key attrib_num;
- int i, len;
+ int i, len;
void *defp;
if ((defp = defopen_r(YP_ETCCONFFILE)) != NULL) {
@@ -506,10 +505,7 @@ yp_parse_ldap_default_conf(
*/
static config_key
-get_attrib_num_cmdline(
- const char *s,
- const char **begin_s,
- const char **end_s)
+get_attrib_num_cmdline(const char *s, const char **begin_s, const char **end_s)
{
const char *s_end = s + strlen(s);
const char *equal_s;
@@ -564,13 +560,10 @@ get_attrib_num_cmdline(
*/
static int
-parse_ldap_config_file(
- const char *config_file,
- __nis_ldap_proxy_info *proxy_info,
- __nis_config_t *nis_config,
- __nis_table_mapping_t **table_mapping,
- __nis_config_info_t *config_info,
- __nisdb_table_mapping_t *table_info)
+parse_ldap_config_file(const char *config_file,
+ __nis_ldap_proxy_info *proxy_info, __nis_config_t *nis_config,
+ __nis_table_mapping_t **table_mapping, __nis_config_info_t *config_info,
+ __nisdb_table_mapping_t *table_info)
{
int rc = 0;
config_key attrib_num;
diff --git a/usr/src/lib/libnls/common/mapfile-vers b/usr/src/lib/libnls/common/mapfile-vers
index 2b1f174884..29298afb19 100644
--- a/usr/src/lib/libnls/common/mapfile-vers
+++ b/usr/src/lib/libnls/common/mapfile-vers
@@ -47,7 +47,6 @@ SYMBOL_VERSION SUNW_1.1 {
SYMBOL_VERSION SUNWprivate_1.1 {
global:
- _lib_version;
nlsc2addr;
_nlscall;
nlsenv;
diff --git a/usr/src/lib/pkcs11/pkcs11_tpm/common/loadsave.c b/usr/src/lib/pkcs11/pkcs11_tpm/common/loadsave.c
index 249d6c7946..769897a74e 100644
--- a/usr/src/lib/pkcs11/pkcs11_tpm/common/loadsave.c
+++ b/usr/src/lib/pkcs11/pkcs11_tpm/common/loadsave.c
@@ -302,7 +302,7 @@
static char keystore_path[MAXPATHLEN];
static boolean_t keystore_path_initialized = 0;
-TSS_HKEY hPrivateLeafKey;
+extern TSS_HKEY hPrivateLeafKey;
static CK_RV
restore_private_token_object(TSS_HCONTEXT, CK_BYTE *, CK_ULONG, OBJECT *);
@@ -753,7 +753,7 @@ save_private_token_object(TSS_HCONTEXT hContext, OBJECT *obj)
UINT32 obj_data_len_32;
UINT32 total_len;
UINT32 chunksize, blocks;
- char *p = get_tpm_keystore_path();
+ char *p = get_tpm_keystore_path();
if (p == NULL)
return (CKR_FUNCTION_FAILED);
diff --git a/usr/src/pkg/manifests/system-test-ostest.mf b/usr/src/pkg/manifests/system-test-ostest.mf
index 27637d3bb8..daa152b5e3 100644
--- a/usr/src/pkg/manifests/system-test-ostest.mf
+++ b/usr/src/pkg/manifests/system-test-ostest.mf
@@ -14,6 +14,7 @@
# Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2020 Joyent, Inc.
# Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
#
set name=pkg.fmri value=pkg:/system/test/ostest@$(PKGVERS)
@@ -39,6 +40,7 @@ dir path=opt/os-tests/tests/sdevfs
dir path=opt/os-tests/tests/secflags
dir path=opt/os-tests/tests/sigqueue
dir path=opt/os-tests/tests/sockfs
+dir path=opt/os-tests/tests/stackalign
dir path=opt/os-tests/tests/stress
dir path=opt/os-tests/tests/syscall
dir path=opt/os-tests/tests/timer
@@ -114,6 +116,8 @@ file path=opt/os-tests/tests/sockfs/rights.32 mode=0555
file path=opt/os-tests/tests/sockfs/rights.64 mode=0555
file path=opt/os-tests/tests/sockfs/sockpair mode=0555
file path=opt/os-tests/tests/spoof-ras mode=0555
+file path=opt/os-tests/tests/stackalign/stackalign.32 mode=0555
+file path=opt/os-tests/tests/stackalign/stackalign.64 mode=0555
file path=opt/os-tests/tests/stress/dladm-kstat mode=0555
file path=opt/os-tests/tests/syscall/open.32 mode=0555
file path=opt/os-tests/tests/syscall/open.64 mode=0555
diff --git a/usr/src/test/os-tests/runfiles/default.run b/usr/src/test/os-tests/runfiles/default.run
index 15dae9c745..0b120e5d57 100644
--- a/usr/src/test/os-tests/runfiles/default.run
+++ b/usr/src/test/os-tests/runfiles/default.run
@@ -13,6 +13,7 @@
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright 2020 Joyent, Inc.
# Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
#
[DEFAULT]
@@ -138,3 +139,6 @@ pre = ksensor_init
tests = [ 'ksensor_basic.32','ksensor_basic.64', 'ksensor_err.32',
'ksensor_err.64' ]
post = ksensor_fini
+
+[/opt/os-tests/tests/stackalign]
+tests = ['stackalign.32', 'stackalign.64']
diff --git a/usr/src/test/os-tests/tests/Makefile b/usr/src/test/os-tests/tests/Makefile
index 190c61e134..0683d9bc9d 100644
--- a/usr/src/test/os-tests/tests/Makefile
+++ b/usr/src/test/os-tests/tests/Makefile
@@ -12,6 +12,7 @@
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
# Copyright 2020 Joyent, Inc.
+# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
#
SUBDIRS_i386 = i386 imc
@@ -28,6 +29,7 @@ SUBDIRS = \
sigqueue \
sockfs \
spoof-ras \
+ stackalign \
stress \
syscall \
timer \
diff --git a/usr/src/test/os-tests/tests/stackalign/Makefile b/usr/src/test/os-tests/tests/stackalign/Makefile
new file mode 100644
index 0000000000..4af7cb7352
--- /dev/null
+++ b/usr/src/test/os-tests/tests/stackalign/Makefile
@@ -0,0 +1,78 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2020 Oxide Computer Company
+# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
+#
+
+PROGS = stackalign
+
+PROGS32 = $(PROGS:%=%.32)
+PROGS64 = $(PROGS:%=%.64)
+
+OBJS = $(PROGS32:%=%.o) $(PROGS64:%=%.o)
+$(INTEL_BLD)OBJS += stack_i386.o stack_amd64.o
+
+ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
+ROOTOPTSTACK = $(ROOTOPTDIR)/stackalign
+ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTSTACK)/%) $(PROGS64:%=$(ROOTOPTSTACK)/%)
+
+include $(SRC)/cmd/Makefile.cmd
+
+ASFLAGS += -P -D_ASM
+CFLAGS += -D_REENTRANT
+$(INTEL_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
+
+.KEEP_STATE:
+
+all: $(PROGS32) $(PROGS64)
+
+install: $(ROOTOPTPROGS)
+
+clean:
+ -$(RM) $(OBJS)
+
+$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTSTACK)
+
+$(ROOTOPTDIR):
+ $(INS.dir)
+
+$(ROOTOPTSTACK): $(ROOTOPTDIR)
+ $(INS.dir)
+
+$(ROOTOPTSTACK)/%: %
+ $(INS.file)
+
+%.64.o: %.c
+ $(COMPILE64.c) $< -o $@
+
+%.32.o: %.c
+ $(COMPILE.c) $< -o $@
+
+stack_$(MACH).o: stack_$(MACH).s
+ $(COMPILE.s) $< -o $@
+
+stack_$(MACH64).o: stack_$(MACH64).s
+ $(COMPILE64.s) $< -o $@
+
+%.64: %.64.o $(INTEL_BLD)stack_$(MACH64).o
+ $(LINK64.c) -o $@ $^ $(LDLIBS64)
+ $(POST_PROCESS)
+
+%.32: %.32.o $(INTEL_BLD)stack_$(MACH).o
+ $(LINK.c) -o $@ $^ $(LDLIBS)
+ $(POST_PROCESS)
+
+clobber: clean
+ $(RM) $(PROGS32) $(PROGS64)
+
+FRC:
diff --git a/usr/src/test/os-tests/tests/stackalign/stack_amd64.s b/usr/src/test/os-tests/tests/stackalign/stack_amd64.s
new file mode 100644
index 0000000000..7fb4be88e3
--- /dev/null
+++ b/usr/src/test/os-tests/tests/stackalign/stack_amd64.s
@@ -0,0 +1,69 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
+ */
+
+/*
+ * Get the stack at entry and call a function with it as an argument.
+ */
+
+ .file "stack_amd64.s"
+
+#include <sys/asm_linkage.h>
+
+/*
+ * void
+ * get_stack_at_entry(test_ctx_t *ctx)
+ *
+ * ctx+0 is void (*)(uintptr_t stack, char *text),
+ * and ctx+8 is the 'text' argument.
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to the specified function.
+ */
+ ENTRY(get_stack_at_entry)
+ pushq %rbp
+ movq %rsp, %rbp
+ movq %rdi, %rax
+ leaq 16(%rbp), %rdi
+ movq 8(%rax), %rsi
+ call *(%rax)
+ popq %rbp
+ ret
+ SET_SIZE(get_stack_at_entry)
+
+/*
+ * void
+ * get_stack_at_init(void)
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to initarray() (defined elsewhere).
+ * Tests alignment in section .init_array.
+ */
+ ENTRY(get_stack_at_init)
+ pushq %rbp
+ movq %rsp, %rbp
+ leaq 16(%rbp), %rdi
+ call initarray@PLT
+ popq %rbp
+ ret
+ SET_SIZE(get_stack_at_init)
+
+/*
+ * Passes the stack pointer during init to initmain() (defined elsewhere).
+ * Tests alignment in section .init.
+ */
+ .section ".init"
+ movq %rsp, %rdi
+ call initmain@PLT
+
diff --git a/usr/src/test/os-tests/tests/stackalign/stack_i386.s b/usr/src/test/os-tests/tests/stackalign/stack_i386.s
new file mode 100644
index 0000000000..f8fb525cad
--- /dev/null
+++ b/usr/src/test/os-tests/tests/stackalign/stack_i386.s
@@ -0,0 +1,75 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
+ */
+
+/*
+ * Get the stack at entry and call a function with it as an argument.
+ */
+
+ .file "stack_i386.s"
+
+#include <sys/asm_linkage.h>
+
+/*
+ * void
+ * get_stack_at_entry(test_ctx_t *ctx)
+ *
+ * ctx+0 is void (*)(uintptr_t stack, char *text),
+ * and ctx+4 is the 'text' argument.
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to the specified function.
+ */
+ ENTRY(get_stack_at_entry)
+ pushl %ebp
+ movl %esp, %ebp
+ leal 8(%ebp), %eax
+ movl 8(%ebp), %ecx
+ pushl 4(%ecx)
+ pushl %eax
+ call *(%ecx)
+ addl $8, %esp
+ popl %ebp
+ ret
+ SET_SIZE(get_stack_at_entry)
+
+/*
+ * void
+ * get_stack_at_init(void)
+ *
+ * Passes the stack pointer prior to the invoking call instruction
+ * to initarray() (defined elsewhere).
+ * Tests alignment in section .init_array.
+ */
+ ENTRY(get_stack_at_init)
+ pushl %ebp
+ movl %esp, %ebp
+ leal 8(%ebp), %eax
+ subl $8, %esp
+ movl %eax, (%esp)
+ call initarray@PLT
+ addl $8, %esp
+ popl %ebp
+ ret
+ SET_SIZE(get_stack_at_init)
+
+/*
+ * Passes the stack pointer during init to initmain() (defined elsewhere).
+ * Tests alignment in section .init.
+ */
+ .section ".init"
+ movl %esp, %eax
+ pushl %eax
+ call initmain@PLT
+ addl $4, %esp
diff --git a/usr/src/test/os-tests/tests/stackalign/stackalign.c b/usr/src/test/os-tests/tests/stackalign/stackalign.c
new file mode 100644
index 0000000000..2ad77ea39d
--- /dev/null
+++ b/usr/src/test/os-tests/tests/stackalign/stackalign.c
@@ -0,0 +1,170 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
+ */
+
+/*
+ * Test that the stack is aligned to expected values.
+ */
+
+#include <stdio.h>
+#include <pthread.h>
+#include <thread.h>
+#include <door.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ucontext.h>
+
+#include <sys/stack.h>
+
+/*
+ * The introduction of SSE led to the IA32 ABI changing the required stack
+ * alignment from 4 bytes to 16 bytes. Compilers assume this when using SSE.
+ */
+#if defined(__i386)
+#undef STACK_ALIGN
+#define STACK_ALIGN 16
+#endif
+
+#define ALIGN_ERR_IMPL(align, text) \
+ "stack was not aligned to " #align " on " text "\n"
+#define ALIGN_ERR_HELP(align, text) ALIGN_ERR_IMPL(align, text)
+#define ALIGN_ERR(text) ALIGN_ERR_HELP(STACK_ALIGN, text)
+
+#define STACK_SIZE 16*1024
+
+typedef struct test_ctx {
+ void (*func)(uintptr_t, char *);
+ char *text;
+} test_ctx_t;
+
+extern void get_stack_at_entry(test_ctx_t *);
+
+void
+teststack(uintptr_t stack, char *arg)
+{
+ if ((stack & (STACK_ALIGN - 1)) != 0) {
+ fprintf(stderr, ALIGN_ERR("%s"), (char *)arg);
+ exit(1);
+ }
+}
+
+void
+initmain(uintptr_t stack)
+{
+ teststack(stack, "section .init");
+}
+
+void
+initarray(uintptr_t stack)
+{
+ teststack(stack, "section .init_array");
+}
+
+void
+doorstack(uintptr_t stack, char *arg)
+{
+ teststack(stack, arg);
+ (void) door_return(NULL, 0, NULL, 0);
+}
+
+char door_arg[] = "DOOR ARG";
+
+int
+main(int argc, char *argv[])
+{
+ door_arg_t da = {
+ .data_ptr = (void *)door_arg,
+ .data_size = sizeof (door_arg)
+ };
+ test_ctx_t arg = {
+ .func = teststack,
+ .text = "pthread_create()"
+ };
+ ucontext_t back, uc;
+ pthread_t tid;
+ int door_fd, rc;
+
+#if defined(__sparc)
+ /*
+ * This hasn't been implemented for SPARC, so skip.
+ */
+ fprintf(stderr, "No SPARC implementation of get_stack_at_entry\n");
+ return (3);
+#else
+ if (pthread_create(&tid, NULL,
+ (void *(*)(void *))get_stack_at_entry, &arg) != 0) {
+ perror("pthread_create() failed:");
+ exit(-2);
+ }
+ (void) pthread_join(tid, NULL);
+
+ arg.text = "thr_create()";
+
+ if (thr_create(NULL, 0, (void *(*)(void *))get_stack_at_entry,
+ &arg, 0, &tid) != 0) {
+ perror("thr_create() failed:");
+ exit(-3);
+ }
+ (void) thr_join(tid, NULL, NULL);
+
+ if (getcontext(&uc) < 0) {
+ perror("getcontext() failed");
+ exit(-4);
+ }
+
+ uc.uc_link = &back;
+ uc.uc_stack.ss_size = STACK_SIZE;
+ uc.uc_stack.ss_flags = 0;
+ if ((uc.uc_stack.ss_sp = malloc(STACK_SIZE)) == NULL) {
+ perror("failed to allocate stack");
+ exit(-5);
+ }
+
+ arg.text = "swapcontext()";
+ makecontext(&uc, (void (*)(void *))get_stack_at_entry, 1, &arg);
+ if (swapcontext(&back, &uc) < 0) {
+ perror("swapcontext() failed");
+ exit(-6);
+ }
+
+ arg.func = doorstack;
+ arg.text = "door_call()";
+
+ if ((door_fd = door_create(
+ (door_server_procedure_t *)get_stack_at_entry,
+ &arg, 0)) < 0) {
+ perror("failed to create door");
+ exit(-7);
+ }
+
+ rc = door_call(door_fd, &da);
+
+ if (rc < 0) {
+ perror("door call #1 failed");
+ exit(-8);
+ }
+
+ da.data_size += 5;
+ rc = door_call(door_fd, &da);
+
+ if (rc < 0) {
+ perror("door call #2 failed");
+ exit(-9);
+ }
+
+ (void) close(door_fd);
+
+ return (0);
+#endif
+}
diff --git a/usr/src/tools/Makefile b/usr/src/tools/Makefile
index 1e1efb8393..63f9b38709 100644
--- a/usr/src/tools/Makefile
+++ b/usr/src/tools/Makefile
@@ -40,28 +40,28 @@ include ../Makefile.master
# Anything built before 'install.bin' is present must override binary
# installation rules in their makefiles. This includes the Makefile for
# 'install.bin' itself.
-BOOT_SUBDIRS= \
- smatch \
- .WAIT \
- cw \
- .WAIT \
- install.bin \
- .WAIT \
+BOOT_SUBDIRS= \
+ smatch \
+ .WAIT \
+ cw \
+ .WAIT \
+ install.bin \
+ .WAIT \
ctf
-COMMON_SUBDIRS= \
- codesign \
- cscope-fast \
- env \
- findunref \
- lintdump \
- make \
- makesoftcore \
- ndrgen \
- onbld \
- protocmp \
- protolist \
- scripts \
+COMMON_SUBDIRS= \
+ codesign \
+ cscope-fast \
+ env \
+ findunref \
+ lintdump \
+ make \
+ makesoftcore \
+ ndrgen \
+ onbld \
+ protocmp \
+ protolist \
+ scripts \
sgs
#
@@ -74,6 +74,7 @@ UNSHIPPED_SUBDIRS = \
$(SGSLIBLDDBG) \
$(SGSLIBLD) \
$(SGSLD) \
+ geniconvtbl \
localedef \
man \
mandoc \
@@ -82,56 +83,56 @@ UNSHIPPED_SUBDIRS = \
vtfontcvt \
zic
-sparc_SUBDIRS= \
- chk4ubin \
- stabs \
+sparc_SUBDIRS= \
+ chk4ubin \
+ stabs \
tokenize
-i386_SUBDIRS= \
- aw \
- cpcgen \
- elfextract \
- mbh_patch \
+i386_SUBDIRS= \
+ aw \
+ cpcgen \
+ elfextract \
+ mbh_patch \
btxld
$(INTEL_BLD)sgs: aw
-SUBDIRS= \
- $($(MACH)_SUBDIRS) \
- $(COMMON_SUBDIRS) \
+SUBDIRS= \
+ $($(MACH)_SUBDIRS) \
+ $(COMMON_SUBDIRS) \
$(UNSHIPPED_SUBDIRS)
include Makefile.tools
-ROOTDIRS= \
- $(ROOTOPT) \
- $(ROOTONBLD) \
- $(ROOTONBLD)/bin \
- $(ROOTONBLD)/bin/$(MACH) \
- $(ROOTONBLD)/lib \
- $(ROOTONBLD)/lib/$(MACH) \
- $(ROOTONBLD)/lib/$(MACH)/64 \
- $(ROOTONBLD)/lib/perl \
- $(ROOTONBLD)/env \
- $(ROOTONBLD)/etc \
- $(ROOTONBLD)/etc/exception_lists \
- $(ROOTONBLD)/share \
- $(ROOTONBLD)/man \
+ROOTDIRS= \
+ $(ROOTOPT) \
+ $(ROOTONBLD) \
+ $(ROOTONBLD)/bin \
+ $(ROOTONBLD)/bin/$(MACH) \
+ $(ROOTONBLD)/lib \
+ $(ROOTONBLD)/lib/$(MACH) \
+ $(ROOTONBLD)/lib/$(MACH)/64 \
+ $(ROOTONBLD)/lib/perl \
+ $(ROOTONBLD)/env \
+ $(ROOTONBLD)/etc \
+ $(ROOTONBLD)/etc/exception_lists \
+ $(ROOTONBLD)/share \
+ $(ROOTONBLD)/man \
$(ROOTONBLD)/man/man1onbld
$(BUILDPY2TOOLS)ROOTDIRS += \
- $(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
- $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
- $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
+ $(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
+ $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
+ $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
-$(BUILDPY3TOOLS)ROOTDIRS += \
- $(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
- $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
- $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
- $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
- $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
- $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
+$(BUILDPY3TOOLS)ROOTDIRS += \
+ $(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
+ $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
+ $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
+ $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
+ $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
+ $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
all := TARGET= install
diff --git a/usr/src/tools/cpcgen/cpcgen.c b/usr/src/tools/cpcgen/cpcgen.c
index 3f127b4a22..08384a20d2 100644
--- a/usr/src/tools/cpcgen/cpcgen.c
+++ b/usr/src/tools/cpcgen/cpcgen.c
@@ -1442,7 +1442,7 @@ cpcgen_manual_amd_file_before(FILE *f, cpc_map_t *map)
return (B_FALSE);
}
- if ((desc = strdup(map->cmap_name)) == NULL) {
+ if ((desc = strdup(map->cmap_name + 1)) == NULL) {
warn("failed to duplicate manual name for %s", map->cmap_name);
free(upper);
return (B_FALSE);
@@ -1452,7 +1452,6 @@ cpcgen_manual_amd_file_before(FILE *f, cpc_map_t *map)
upper[i] = toupper(upper[i]);
}
- desc++;
c = strchr(desc, '_');
if (c != NULL) {
*c = ' ';
diff --git a/usr/src/cmd/geniconvtbl/native/Makefile b/usr/src/tools/geniconvtbl/Makefile
index bb795a07f3..74cc5628f5 100644
--- a/usr/src/cmd/geniconvtbl/native/Makefile
+++ b/usr/src/tools/geniconvtbl/Makefile
@@ -26,19 +26,22 @@
.KEEP_STATE:
-NOT_NATIVE = $(POUND_SIGN) # tell Makefile.com we're native
+include $(SRC)/cmd/Makefile.cmd
+include $(SRC)/cmd/geniconvtbl/Makefile.com
+include $(SRC)/tools/Makefile.tools
-include ../Makefile.com
+CPPFLAGS = -I. -I$(SRCDIR)
+CERRWARN += $(CNOWARN_UNINIT)
+CERRWARN += -_gcc=-Wno-unused-label
+CERRWARN += -_gcc=-Wno-switch
+CERRWARN += -_gcc=-Wno-unused-variable
+CERRWARN += -_gcc=-Wno-implicit-function-declaration
+YFLAGS += -d
+CFLAGS += -D_FILE_OFFSET_BITS=64
-CC = $(NATIVECC)
-LD = $(NATIVELD)
-CFLAGS = $(NATIVE_CFLAGS)
-CPPFLAGS = $(MY_NATIVE_CPPFLAGS)
-LDFLAGS = $(MY_NATIVE_LDFLAGS)
-LDLIBS = $(MY_NATIVE_LDLIBS)
-NATIVE_LIBS += libgen.so libc.so
-POST_PROCESS =
+LDLIBS += -lgen -lc
+NATIVE_LIBS += libgen.so libc.so
-all install: $(PROG)
+install: $(ROOTONBLDMACHPROG)
-catalog:
+all: $(PROG)
diff --git a/usr/src/uts/common/fs/doorfs/door_sys.c b/usr/src/uts/common/fs/doorfs/door_sys.c
index 68a7a11d82..a2d3812938 100644
--- a/usr/src/uts/common/fs/doorfs/door_sys.c
+++ b/usr/src/uts/common/fs/doorfs/door_sys.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright 2021 Tintri by DDN, Inc. All rights reserved.
*/
/*
@@ -1114,6 +1115,19 @@ door_stack_copyout(const void *kaddr, void *uaddr, size_t count)
}
/*
+ * The IA32 ABI supplement 1.0 changed the required stack alignment to
+ * 16 bytes (from 4 bytes), so that code can make use of SSE instructions.
+ * This is already done for process entry, thread entry, and makecontext();
+ * We need to do this for door_return as well. The stack will be aligned to
+ * whatever the door_results is aligned.
+ * See: usr/src/lib/libc/i386/gen/makectxt.c for more details.
+ */
+#if defined(__amd64)
+#undef STACK_ALIGN32
+#define STACK_ALIGN32 16
+#endif
+
+/*
* Writes the stack layout for door_return() into the door_server_t of the
* server thread.
*/
diff --git a/usr/src/uts/common/io/tem.c b/usr/src/uts/common/io/tem.c
index 525aa5f585..b91952fc32 100644
--- a/usr/src/uts/common/io/tem.c
+++ b/usr/src/uts/common/io/tem.c
@@ -236,6 +236,10 @@ tem_internal_init(struct tem_vt_state *ptem, cred_t *credp,
ptem->tvs_screen_rows = kmem_alloc(ptem->tvs_screen_history_size *
sizeof (term_char_t *), KM_SLEEP);
+ ptem->tvs_maxtab = width / 8;
+ ptem->tvs_tabs = kmem_alloc(ptem->tvs_maxtab * sizeof (*ptem->tvs_tabs),
+ KM_SLEEP);
+
tem_safe_reset_display(ptem, credp, CALLED_FROM_NORMAL,
clear_screen, init_color);
@@ -340,6 +344,10 @@ tem_free_buf(struct tem_vt_state *tem)
kmem_free(tem->tvs_screen_rows, tem->tvs_screen_history_size *
sizeof (term_char_t *));
}
+ if (tem->tvs_tabs != NULL) {
+ kmem_free(tem->tvs_tabs, tem->tvs_maxtab *
+ sizeof (*tem->tvs_tabs));
+ }
}
void
diff --git a/usr/src/uts/common/io/tem_safe.c b/usr/src/uts/common/io/tem_safe.c
index 8764c5764e..73f4604519 100644
--- a/usr/src/uts/common/io/tem_safe.c
+++ b/usr/src/uts/common/io/tem_safe.c
@@ -1961,7 +1961,7 @@ static void
tem_safe_tab(struct tem_vt_state *tem,
cred_t *credp, enum called_from called_from)
{
- int i;
+ size_t i;
screen_pos_t tabstop;
ASSERT((MUTEX_HELD(&tems.ts_lock) && MUTEX_HELD(&tem->tvs_lock)) ||
@@ -1983,10 +1983,9 @@ tem_safe_tab(struct tem_vt_state *tem,
static void
tem_safe_set_tab(struct tem_vt_state *tem)
{
- int i;
- int j;
+ size_t i, j;
- if (tem->tvs_ntabs == TEM_MAXTAB)
+ if (tem->tvs_ntabs == tem->tvs_maxtab)
return;
if (tem->tvs_ntabs == 0 ||
tem->tvs_tabs[tem->tvs_ntabs] < tem->tvs_c_cursor.col) {
@@ -2009,8 +2008,7 @@ tem_safe_set_tab(struct tem_vt_state *tem)
static void
tem_safe_clear_tabs(struct tem_vt_state *tem, int action)
{
- int i;
- int j;
+ size_t i, j;
switch (action) {
case 3: /* clear all tabs */
diff --git a/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h b/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h
index ca6665b83a..03f49b3b3c 100644
--- a/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h
+++ b/usr/src/uts/common/sys/ib/clients/of/sol_uverbs/sol_uverbs_qp.h
@@ -41,7 +41,7 @@ extern "C" {
* Definitions
*/
#define IBT_TO_OFA_QP_STATE(_state) ((_state) < IBT_STATE_SQDRAIN ? \
- (_state) : IBT_STATE_SQD)
+ (enum ib_qp_state)(_state) : IB_QPS_SQD)
/*
* Structures
diff --git a/usr/src/uts/common/sys/tem_impl.h b/usr/src/uts/common/sys/tem_impl.h
index eeb5881a22..d039e4279b 100644
--- a/usr/src/uts/common/sys/tem_impl.h
+++ b/usr/src/uts/common/sys/tem_impl.h
@@ -77,7 +77,6 @@ extern "C" {
#define TEM_ATTR_ISSET(c, a) ((TEM_CHAR_ATTR(c) & (a)) == (a))
#define TEM_MAXPARAMS 5 /* maximum number of ANSI paramters */
-#define TEM_MAXTAB 40 /* maximum number of tab stops */
#define TEM_MAXFKEY 30 /* max length of function key with <ESC>Q */
#define TEM_SCROLL_UP 0
@@ -187,8 +186,9 @@ struct tem_vt_state {
int tvs_curparam; /* current param # of output esc seq */
int tvs_paramval; /* value of current param */
int tvs_params[TEM_MAXPARAMS]; /* parameters of output esc seq */
- screen_pos_t tvs_tabs[TEM_MAXTAB]; /* tab stops */
- int tvs_ntabs; /* number of tabs used */
+ screen_pos_t *tvs_tabs; /* tab stops */
+ size_t tvs_maxtab; /* maximum number of tab stops */
+ size_t tvs_ntabs; /* number of tabs used */
int tvs_nscroll; /* number of lines to scroll */
struct tem_char_pos tvs_s_cursor; /* start cursor position */
diff --git a/usr/src/uts/intel/ia32/os/fpu.c b/usr/src/uts/intel/ia32/os/fpu.c
index 42af52cff2..cab812bcb8 100644
--- a/usr/src/uts/intel/ia32/os/fpu.c
+++ b/usr/src/uts/intel/ia32/os/fpu.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2020 Joyent, Inc.
+ * Copyright 2021 RackTop Systems, Inc.
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
@@ -583,8 +584,8 @@ const struct fnsave_state x87_initial = {
};
/*
- * This vector is patched to xsave_ctxt() if we discover we have an
- * XSAVE-capable chip in fpu_probe.
+ * This vector is patched to xsave_ctxt() or xsaveopt_ctxt() if we discover we
+ * have an XSAVE-capable chip in fpu_probe.
*/
void (*fpsave_ctxt)(void *) = fpxsave_ctxt;
void (*fprestore_ctxt)(void *) = fpxrestore_ctxt;
@@ -1448,8 +1449,9 @@ kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags)
/*
* When we are ending things, we explicitly don't save the current
* state back to the temporary state. The API is not intended to be a
- * permanent save location. We always will clear TS and note that the
- * user state should be restored as part of it returning to userland.
+ * permanent save location. If this is a kernel thread we set TS,
+ * otherwise we restore the user state on the off chance that a
+ * context switch occurs before returning to user-land.
*/
if (curthread->t_lwp != NULL &&
(curthread->t_lwp->lwp_pcb.pcb_fpu.fpu_flags & FPU_EN) != 0) {
@@ -1461,7 +1463,41 @@ kernel_fpu_end(kfpu_state_t *kfpu, uint_t flags)
f = FPU_KERNEL;
}
curthread->t_lwp->lwp_pcb.pcb_fpu.fpu_flags &= ~f;
- PCB_SET_UPDATE_FPU(&curthread->t_lwp->lwp_pcb);
+ /*
+ * Don't need to set PCB_SET_UPDATE_FPU here since we'll
+ * restore our fpu state below if we're a user-level thread.
+ */
+ }
+
+ /*
+ * If a user-level thread ever uses the fpu while in the kernel, then
+ * we cannot call fpdisable since that does STTS. That will set the
+ * ts bit in %cr0 which will cause an exception if anything touches the
+ * fpu. However, the user-level context switch handler (fpsave_ctxt)
+ * needs to access the fpu to save the registers into the pcb.
+ * fpsave_ctxt relies on CLTS having been done to clear the ts bit in
+ * fprestore_ctxt when the thread context switched onto the CPU.
+ */
+ if ((curthread->t_procp->p_flag & SSYS) != 0 ||
+ curthread->t_lwp == NULL ||
+ (curthread->t_lwp->lwp_pcb.pcb_fpu.fpu_flags & FPU_EN) == 0) {
+ fpdisable();
+ } else {
+ /*
+ * This is a user-level thread. If we were to context switch
+ * before returning to user-land, fpsave_ctxt could overwrite
+ * the valid user-level fpu data we previously saved in the
+ * pcb (the fp_save in kernel_fpu_begin). To avoid adding
+ * complexity to the context switch handlers to account for
+ * this case, we restore the user-level fpu registers here,
+ * since user-level thread usage of the kernel fpu tends to be
+ * uncommon. By restoring the fpu registers here, we avoid
+ * setting PCB_SET_UPDATE_FPU and having to handle this in
+ * sys_rtt_common.
+ *
+ * fprestore_ctxt checks FPU_VALID so we don't do that here.
+ */
+ pcb_t *pcb = &curthread->t_lwp->lwp_pcb;
+ fprestore_ctxt(&pcb->pcb_fpu);
}
- fpdisable();
}