summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2014-01-22 19:13:13 +0000
committerKeith M Wesolowski <wesolows@foobazco.org>2014-01-22 19:16:58 +0000
commit8e90799debe0cc1d192dc0fa7a1c6de15d68fe67 (patch)
treea38ad7a042fbc5bd672537be10173c4a06562d52
parent9abf63b76435a73b55cd086630c38a0e9cf693fb (diff)
parent9ee94b97c8654689d6a034daec08757fda75d21a (diff)
downloadillumos-joyent-8e90799debe0cc1d192dc0fa7a1c6de15d68fe67.tar.gz
[illumos-gate merge]
commit 9ee94b97c8654689d6a034daec08757fda75d21a 4496 ndmpd handles wrongly EOM and EOF conditions commit f7dbdfc7b241e42b135dc9118e41b127cb935483 4512 kclient(1m) should not depend on /usr/xpg4/bin/grep commit 19d32b9ab53d17ac6605971e14c45a5281f8d9bb 4493 want siginfo 4494 Make dd show progress when you send INFO/USR1 signals 4495 dd could support O_SYNC and O_DSYNC commit 4f364e7c95ee7fd9d5bbeddc1940e92405bb0e72 4489 need ptcumem Conflicts: usr/src/lib/libumem/sparc/umem_genasm.c usr/src/lib/libumem/i386/umem_genasm.c usr/src/lib/libumem/common/umem_base.h usr/src/lib/libumem/common/umem.c usr/src/lib/libumem/common/stub_stand.c usr/src/lib/libumem/amd64/umem_genasm.c usr/src/lib/libc/inc/thr_uberdata.h usr/src/cmd/mdb/common/modules/libumem/umem.c usr/src/lib/libumem/Makefile.com (trampoline) usr/src/lib/Makefile (trampoline) usr/src/lib/libumem_trampoline (deleted) manifest (trampoline) usr/src/lib/libumem/common/envvar.c (fix automerge) usr/src/lib/libumem/common/mapfile-vers (trampoline)
-rw-r--r--exception_lists/check_rtime2
-rw-r--r--manifest8
-rw-r--r--usr/src/cmd/dd/dd.c105
-rw-r--r--usr/src/cmd/krb5/kadmin/kclient/kclient.sh9
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/alerts.c4
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp2.c10
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp4.c6
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/fncs.c12
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/init.c4
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/lpsched.h12
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/nodes.h4
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/requeue.c3
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/status.c6
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/validate.c3
-rw-r--r--usr/src/cmd/mdb/common/kmdb/kmdb_umemglue.c10
-rw-r--r--usr/src/cmd/mdb/common/modules/libumem/umem.c2
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd.h8
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd_handler.c5
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd_mover.c313
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd_tape.c357
-rw-r--r--usr/src/cmd/syseventd/daemons/syseventd/syseventd.c1
-rw-r--r--usr/src/cmd/ttymon/stty.c107
-rw-r--r--usr/src/cmd/ttymon/sttyparse.c25
-rw-r--r--usr/src/lib/Makefile3
-rw-r--r--usr/src/lib/libc/amd64/Makefile1
-rw-r--r--usr/src/lib/libc/amd64/gen/siginfolst.c1
-rw-r--r--usr/src/lib/libc/i386/Makefile.com2
-rw-r--r--usr/src/lib/libc/i386/gen/siginfolst.c1
-rw-r--r--usr/src/lib/libc/inc/thr_uberdata.h5
-rw-r--r--usr/src/lib/libc/port/gen/siglist.c1
-rw-r--r--usr/src/lib/libc/port/gen/str2sig.c2
-rw-r--r--usr/src/lib/libc/port/mapfile-vers1
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com1
-rw-r--r--usr/src/lib/libc/sparc/gen/siginfolst.c1
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com1
-rw-r--r--usr/src/lib/libc/sparcv9/gen/siginfolst.c1
-rw-r--r--usr/src/lib/libshell/common/data/signals.c3
-rw-r--r--usr/src/lib/libumem/Makefile.com3
-rw-r--r--usr/src/lib/libumem/amd64/umem_genasm.c41
-rw-r--r--usr/src/lib/libumem/common/envvar.c1
-rw-r--r--usr/src/lib/libumem/common/linktest_stand.c3
-rw-r--r--usr/src/lib/libumem/common/malloc.c15
-rw-r--r--usr/src/lib/libumem/common/mapfile-vers15
-rw-r--r--usr/src/lib/libumem/common/stub_stand.c8
-rw-r--r--usr/src/lib/libumem/common/umem.c57
-rw-r--r--usr/src/lib/libumem/common/umem_base.h10
-rw-r--r--usr/src/lib/libumem/common/vmem_base.c2
-rw-r--r--usr/src/lib/libumem/i386/asm_subr.s47
-rw-r--r--usr/src/lib/libumem/i386/umem_genasm.c44
-rw-r--r--usr/src/lib/libumem/sparc/umem_genasm.c2
-rw-r--r--usr/src/lib/libumem_trampoline/Makefile50
-rw-r--r--usr/src/lib/libumem_trampoline/Makefile.com49
-rw-r--r--usr/src/lib/libumem_trampoline/amd64/Makefile29
-rw-r--r--usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline28
-rw-r--r--usr/src/lib/libumem_trampoline/common/mapfile-vers62
-rw-r--r--usr/src/lib/libumem_trampoline/common/trampoline.c166
-rw-r--r--usr/src/lib/libumem_trampoline/i386/Makefile29
-rw-r--r--usr/src/lib/libumem_trampoline/sparc/Makefile29
-rw-r--r--usr/src/lib/libumem_trampoline/sparcv9/Makefile29
-rw-r--r--usr/src/man/man1/stty.19
-rw-r--r--usr/src/man/man1m/dd.1m60
-rw-r--r--usr/src/man/man3head/signal.h.3head3
-rw-r--r--usr/src/man/man3head/termios.h.3head3
-rw-r--r--usr/src/man/man7i/termio.7i37
-rw-r--r--usr/src/uts/common/io/ldterm.c14
-rw-r--r--usr/src/uts/common/io/options.conf4
-rw-r--r--usr/src/uts/common/io/ttcompat.c1
-rw-r--r--usr/src/uts/common/io/tty_common.c6
-rw-r--r--usr/src/uts/common/os/sig.c3
-rw-r--r--usr/src/uts/common/sys/iso/signal_iso.h5
-rw-r--r--usr/src/uts/common/sys/signal.h4
-rw-r--r--usr/src/uts/common/sys/termios.h4
-rw-r--r--usr/src/uts/common/sys/ttychars.h3
73 files changed, 731 insertions, 1184 deletions
diff --git a/exception_lists/check_rtime b/exception_lists/check_rtime
index ce606dc0ea..fce897b09b 100644
--- a/exception_lists/check_rtime
+++ b/exception_lists/check_rtime
@@ -63,6 +63,8 @@ SKIP ^usr/lib/sysevent/modules/picl_slm.so$
# Objects that are allowed to have executable data segments
EXEC_DATA ^MACH(lib)/ld\.so\.1$
EXEC_DATA ^lib/libc\.so\.1$ # 6524709, 32-bit, needed for x86 only
+EXEC_DATA ^lib/amd64/libumem\.so\.1$ # ptcumem
+EXEC_DATA ^lib/libumem\.so\.1$ # ptcumem
EXEC_DATA ^opt/SUNWdtrt/tst/.*/ustack/tst\.helper\.exe$
EXEC_DATA ^platform/.*/MACH(kernel)/unix$
EXEC_DATA ^platform/.*/multiboot$
diff --git a/manifest b/manifest
index 98b088670f..9a5b868272 100644
--- a/manifest
+++ b/manifest
@@ -1225,8 +1225,6 @@ f lib/amd64/libtsol.so.2 0755 root bin
s lib/amd64/libtsol.so=libtsol.so.2
f lib/amd64/libumem.so.1 0755 root bin
s lib/amd64/libumem.so=libumem.so.1
-f lib/amd64/libumem_trampoline.so.1 0755 root bin
-s lib/amd64/libumem_trampoline.so=libumem_trampoline.so.1
f lib/amd64/libuuid.so.1 0755 root bin
s lib/amd64/libuuid.so=libuuid.so.1
f lib/amd64/libuutil.so.1 0755 root bin
@@ -1421,8 +1419,6 @@ f lib/libtsol.so.2 0755 root bin
s lib/libtsol.so=libtsol.so.2
f lib/libumem.so.1 0755 root bin
s lib/libumem.so=libumem.so.1
-f lib/libumem_trampoline.so.1 0755 root bin
-s lib/libumem_trampoline.so=libumem_trampoline.so.1
f lib/libuuid.so.1 0755 root bin
s lib/libuuid.so=libuuid.so.1
f lib/libuutil.so.1 0755 root bin
@@ -4941,8 +4937,6 @@ s usr/lib/amd64/libtsol.so.2=../../../lib/amd64/libtsol.so.2
s usr/lib/amd64/libtsol.so=../../../lib/amd64/libtsol.so.2
s usr/lib/amd64/libumem.so.1=../../../lib/amd64/libumem.so.1
s usr/lib/amd64/libumem.so=../../../lib/amd64/libumem.so.1
-s usr/lib/amd64/libumem_trampoline.so.1=../../../lib/amd64/libumem_trampoline.so.1
-s usr/lib/amd64/libumem_trampoline.so=../../../lib/amd64/libumem_trampoline.so.1
s usr/lib/amd64/libuuid.so.1=../../../lib/amd64/libuuid.so.1
s usr/lib/amd64/libuuid.so=../../../lib/amd64/libuuid.so.1
s usr/lib/amd64/libuutil.so.1=../../../lib/amd64/libuutil.so.1
@@ -6376,8 +6370,6 @@ s usr/lib/libtsol.so.2=../../lib/libtsol.so.2
s usr/lib/libtsol.so=../../lib/libtsol.so.2
s usr/lib/libumem.so.1=../../lib/libumem.so.1
s usr/lib/libumem.so=../../lib/libumem.so.1
-s usr/lib/libumem_trampoline.so.1=../../lib/libumem_trampoline.so.1
-s usr/lib/libumem_trampoline.so=../../lib/libumem_trampoline.so.1
f usr/lib/libunistat.so.1 0755 root bin
s usr/lib/libunistat.so=libunistat.so.1
s usr/lib/libuuid.so.1=../../lib/libuuid.so.1
diff --git a/usr/src/cmd/dd/dd.c b/usr/src/cmd/dd/dd.c
index 75caccbeac..623850f83e 100644
--- a/usr/src/cmd/dd/dd.c
+++ b/usr/src/cmd/dd/dd.c
@@ -24,6 +24,7 @@
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -44,6 +45,9 @@
#include <stdlib.h>
#include <locale.h>
#include <string.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <strings.h>
/* The BIG parameter is machine dependent. It should be a long integer */
/* constant that can be used by the number parser to check the validity */
@@ -102,7 +106,8 @@
" [iseek=n] [oseek=n] [seek=n] [count=n] [conv=[ascii]\n"\
" [,ebcdic][,ibm][,asciib][,ebcdicb][,ibmb]\n"\
" [,block|unblock][,lcase|ucase][,swab]\n"\
- " [,noerror][,notrunc][,sync]]\n"
+ " [,noerror][,notrunc][,sync]]\n"\
+ " [oflag=[dsync][sync]]\n"
/* Global references */
@@ -127,6 +132,7 @@ static unsigned cbc; /* number of bytes in the conversion buffer */
static int ibf; /* input file descriptor */
static int obf; /* output file descriptor */
static int cflag; /* conversion option flags */
+static int oflag; /* output flag options */
static int skipf; /* if skipf == 1, skip rest of input line */
static unsigned long long nifr; /* count of full input records */
static unsigned long long nipr; /* count of partial input records */
@@ -149,6 +155,10 @@ static char *ofile; /* output file name pointer */
static unsigned char *ibuf; /* input buffer pointer */
static unsigned char *obuf; /* output buffer pointer */
+static hrtime_t startt; /* hrtime copy started */
+static unsigned long long obytes; /* output bytes */
+static sig_atomic_t nstats; /* do we need to output stats */
+
/* This is an EBCDIC to ASCII conversion table */
/* from a proposed BTL standard April 16, 1979 */
@@ -461,6 +471,12 @@ static unsigned char *atoe = svr4_atoe;
static unsigned char *etoa = svr4_etoa;
static unsigned char *atoibm = svr4_atoibm;
+/*ARGSUSED*/
+static void
+siginfo_handler(int sig, siginfo_t *sip, void *ucp)
+{
+ nstats = 1;
+}
int
main(int argc, char **argv)
@@ -471,6 +487,7 @@ main(int argc, char **argv)
int conv; /* conversion option code */
int trunc; /* whether output file is truncated */
struct stat file_stat;
+ struct sigaction sact;
/* Set option defaults */
@@ -657,6 +674,32 @@ main(int argc, char **argv)
}
continue;
}
+ if (match("oflag="))
+ {
+ for (;;)
+ {
+ if (match(","))
+ {
+ continue;
+ }
+ if (*string == '\0')
+ {
+ break;
+ }
+ if (match("dsync"))
+ {
+ oflag |= O_DSYNC;
+ continue;
+ }
+ if (match("sync"))
+ {
+ oflag |= O_SYNC;
+ continue;
+ }
+ goto badarg;
+ }
+ continue;
+ }
badarg:
(void) fprintf(stderr, "dd: %s \"%s\"\n",
gettext("bad argument:"), string);
@@ -787,13 +830,12 @@ main(int argc, char **argv)
{
ibf = open(ifile, 0);
}
-#ifndef STANDALONE
else
{
ifile = "";
ibf = dup(0);
}
-#endif
+
if (ibf == -1)
{
(void) fprintf(stderr, "dd: %s: ", ifile);
@@ -807,11 +849,11 @@ main(int argc, char **argv)
if (ofile)
{
if (trunc == 0) /* do not truncate output file */
- obf = open(ofile, (O_WRONLY|O_CREAT),
+ obf = open(ofile, (O_WRONLY|O_CREAT|oflag),
(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH));
else if (oseekn && (trunc == 1))
{
- obf = open(ofile, O_WRONLY|O_CREAT,
+ obf = open(ofile, O_WRONLY|O_CREAT|oflag,
(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH));
if (obf == -1)
{
@@ -829,16 +871,15 @@ main(int argc, char **argv)
}
}
else
- obf = creat(ofile,
+ obf = open(ofile, O_WRONLY|O_CREAT|O_TRUNC|oflag,
(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH));
}
-#ifndef STANDALONE
else
{
ofile = "";
obf = dup(1);
}
-#endif
+
if (obf == -1)
{
(void) fprintf(stderr, "dd: %s: ", ofile);
@@ -871,14 +912,33 @@ main(int argc, char **argv)
exit(2);
}
- /* Enable a statistics message on SIGINT */
+ /*
+ * Enable a statistics message when we terminate on SIGINT
+ * Also enable it to be queried via SIGINFO and SIGUSR1
+ */
-#ifndef STANDALONE
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
{
(void) signal(SIGINT, term);
}
-#endif
+
+ bzero(&sact, sizeof (struct sigaction));
+ sact.sa_flags = SA_SIGINFO;
+ sact.sa_sigaction = siginfo_handler;
+ (void) sigemptyset(&sact.sa_mask);
+ if (sigaction(SIGINFO, &sact, NULL) != 0) {
+ (void) fprintf(stderr, "dd: %s: %s\n",
+ gettext("failed to enable siginfo handler"),
+ gettext(strerror(errno)));
+ exit(2);
+ }
+ if (sigaction(SIGUSR1, &sact, NULL) != 0) {
+ (void) fprintf(stderr, "dd: %s: %s\n",
+ gettext("failed to enable sigusr1 handler"),
+ gettext(strerror(errno)));
+ exit(2);
+ }
+
/* Skip input blocks */
while (skip)
@@ -939,8 +999,16 @@ main(int argc, char **argv)
/* Read and convert input blocks until end of file(s) */
+ /* Grab our start time for siginfo purposes */
+ startt = gethrtime();
+
for (;;)
{
+ if (nstats != 0) {
+ stats();
+ nstats = 0;
+ }
+
if ((count == 0) || (nifr+nipr < count))
{
/* If proceed on error is enabled, zero the input buffer */
@@ -1772,6 +1840,7 @@ static unsigned char
}
obc -= oc;
op = obuf;
+ obytes += bc;
/* If any data in the conversion buffer, move it into */
/* the output buffer */
@@ -1820,10 +1889,24 @@ int c;
static void
stats()
{
+ hrtime_t delta = gethrtime() - startt;
+ double secs = delta * 1e-9;
+
(void) fprintf(stderr, gettext("%llu+%llu records in\n"), nifr, nipr);
(void) fprintf(stderr, gettext("%llu+%llu records out\n"), nofr, nopr);
if (ntrunc) {
(void) fprintf(stderr,
gettext("%llu truncated record(s)\n"), ntrunc);
}
+
+ /*
+ * If we got here before we started copying somehow, don't bother
+ * printing the rest.
+ */
+ if (startt == 0)
+ return;
+
+ (void) fprintf(stderr,
+ gettext("%llu bytes transferred in %.6f secs (%.0f bytes/sec)\n"),
+ obytes, secs, obytes / secs);
}
diff --git a/usr/src/cmd/krb5/kadmin/kclient/kclient.sh b/usr/src/cmd/krb5/kadmin/kclient/kclient.sh
index 258d5e42a2..7967b20e17 100644
--- a/usr/src/cmd/krb5/kadmin/kclient/kclient.sh
+++ b/usr/src/cmd/krb5/kadmin/kclient/kclient.sh
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2014 Nexenta Systems, Inc. All rights reserved.
#
# This script is used to setup the Kerberos client by
# supplying information about the Kerberos realm and kdc.
@@ -1190,8 +1191,6 @@ function join_domain {
fqdn=$hostname.$domain
upn=host/${fqdn}@${realm}
- grep=/usr/xpg4/bin/grep
-
object=$(mktemp -q -t kclient-computer-object.XXXXXX)
if [[ -z $object ]]; then
printf "\n$(gettext "Can not create temporary file, exiting").\n
@@ -1199,8 +1198,6 @@ function join_domain {
error_message
fi
- grep=/usr/xpg4/bin/grep
-
modify_existing=false
recreate=false
@@ -1427,7 +1424,7 @@ EOF
fi
# RC4 comes next (whether it's better than 1DES or not -- AD prefers it)
- if encrypt -l|$grep -q ^arcfour
+ if encrypt -l|grep -q ^arcfour
then
((val=val+4))
enctypes[${#enctypes[@]}]=arcfour-hmac-md5
@@ -1435,7 +1432,7 @@ EOF
# Use 1DES ONLY if we don't have arcfour
userAccountControl=$((userAccountControl + 2097152))
fi
- if encrypt -l | $grep -q ^des
+ if encrypt -l | grep -q ^des
then
((val=val+2))
enctypes[${#enctypes[@]}]=des-cbc-md5
diff --git a/usr/src/cmd/lp/cmd/lpsched/alerts.c b/usr/src/cmd/lp/cmd/lpsched/alerts.c
index 7e9b5c5824..462c14851c 100644
--- a/usr/src/cmd/lp/cmd/lpsched/alerts.c
+++ b/usr/src/cmd/lp/cmd/lpsched/alerts.c
@@ -27,8 +27,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lpsched.h"
#include "stdarg.h"
@@ -294,7 +292,7 @@ cancel_alert(int type, ...)
static int
dest_equivalent_printer(char *dest, char *printer)
{
- CSTATUS * pc;
+ CLSTATUS * pc;
return (
STREQU(dest, printer)
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp2.c b/usr/src/cmd/lp/cmd/lpsched/disp2.c
index 459367f2dc..eddcdb1031 100644
--- a/usr/src/cmd/lp/cmd/lpsched/disp2.c
+++ b/usr/src/cmd/lp/cmd/lpsched/disp2.c
@@ -28,8 +28,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dispatch.h"
#include <syslog.h>
#include <time.h>
@@ -371,7 +369,7 @@ s_load_class(char *m, MESG *md)
char *class;
ushort status;
register CLASS *pc;
- register CSTATUS *pcs;
+ register CLSTATUS *pcs;
(void) getmessage(m, S_LOAD_CLASS, &class);
syslog(LOG_DEBUG, "s_load_class(%s)", (class ? class : "NULL"));
@@ -449,7 +447,7 @@ s_load_class(char *m, MESG *md)
*/
static void
-_unload_class(CSTATUS *pcs)
+_unload_class(CLSTATUS *pcs)
{
freeclass (pcs->class);
if (pcs->rej_reason != NULL)
@@ -465,7 +463,7 @@ s_unload_class(char *m, MESG *md)
char *class;
ushort status;
RSTATUS *prs;
- register CSTATUS *pcs;
+ register CLSTATUS *pcs;
(void) getmessage(m, S_UNLOAD_CLASS, &class);
syslog(LOG_DEBUG, "s_unload_class(%s)", (class ? class : "NULL"));
@@ -535,7 +533,7 @@ void
s_inquire_class(char *m, MESG *md)
{
char *class;
- register CSTATUS *pcs;
+ register CLSTATUS *pcs;
(void) getmessage(m, S_INQUIRE_CLASS, &class);
syslog(LOG_DEBUG, "s_inquire_class(%s)", (class ? class : "NULL"));
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp4.c b/usr/src/cmd/lp/cmd/lpsched/disp4.c
index bb61d0cddc..8ce3a1f8a8 100644
--- a/usr/src/cmd/lp/cmd/lpsched/disp4.c
+++ b/usr/src/cmd/lp/cmd/lpsched/disp4.c
@@ -27,8 +27,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "time.h"
#include "dispatch.h"
#include <syslog.h>
@@ -44,7 +42,7 @@ s_accept_dest(char *m, MESG *md)
char *destination;
ushort status;
register PSTATUS *pps;
- register CSTATUS *pcs;
+ register CLSTATUS *pcs;
getmessage (m, S_ACCEPT_DEST, &destination);
syslog(LOG_DEBUG, "s_accept_dest(%s)",
@@ -94,7 +92,7 @@ s_reject_dest(char *m, MESG *md)
*reason;
ushort status;
register PSTATUS *pps;
- register CSTATUS *pcs;
+ register CLSTATUS *pcs;
getmessage (m, S_REJECT_DEST, &destination, &reason);
diff --git a/usr/src/cmd/lp/cmd/lpsched/fncs.c b/usr/src/cmd/lp/cmd/lpsched/fncs.c
index b99815b0f1..66f8311fa7 100644
--- a/usr/src/cmd/lp/cmd/lpsched/fncs.c
+++ b/usr/src/cmd/lp/cmd/lpsched/fncs.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "unistd.h"
@@ -271,7 +269,7 @@ new_pstatus(PRINTER *p)
}
void
-free_cstatus(CSTATUS *csp)
+free_cstatus(CLSTATUS *csp)
{
if (csp != NULL) {
if (csp->rej_reason != NULL)
@@ -282,10 +280,10 @@ free_cstatus(CSTATUS *csp)
}
}
-CSTATUS *
+CLSTATUS *
new_cstatus(CLASS *c)
{
- CSTATUS *result = calloc(1, sizeof (*result));
+ CLSTATUS *result = calloc(1, sizeof (*result));
if (result != NULL) {
if (c != NULL)
@@ -502,10 +500,10 @@ search_fptable(register char *paper)
return (ps);
}
-CSTATUS *
+CLSTATUS *
search_cstatus(register char *name)
{
- CSTATUS *ps = NULL;
+ CLSTATUS *ps = NULL;
if (name != NULL) {
if (CStatus != NULL) {
diff --git a/usr/src/cmd/lp/cmd/lpsched/init.c b/usr/src/cmd/lp/cmd/lpsched/init.c
index fe318e1e81..8793d0906f 100644
--- a/usr/src/cmd/lp/cmd/lpsched/init.c
+++ b/usr/src/cmd/lp/cmd/lpsched/init.c
@@ -28,12 +28,10 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lpsched.h"
#include <syslog.h>
-CSTATUS **CStatus = NULL; /* Status of same */
+CLSTATUS **CStatus = NULL; /* Status of same */
PSTATUS **PStatus = NULL; /* Status of same */
FSTATUS **FStatus = NULL; /* status of same */
PWSTATUS **PWStatus = NULL; /* Status of same */
diff --git a/usr/src/cmd/lp/cmd/lpsched/lpsched.h b/usr/src/cmd/lp/cmd/lpsched/lpsched.h
index c9a4d95b99..8c833b987f 100644
--- a/usr/src/cmd/lp/cmd/lpsched/lpsched.h
+++ b/usr/src/cmd/lp/cmd/lpsched/lpsched.h
@@ -28,8 +28,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "stdio.h"
#include "sys/types.h"
#include "memory.h"
@@ -59,7 +57,7 @@
**/
/*
- * These are the fields in the PSTATUS and CSTATUS files,
+ * These are the fields in the PSTATUS and CLSTATUS files,
* found in the SYSTEM directory.
*/
@@ -336,7 +334,7 @@ extern void list_remove(void ***, void *);
extern RSTATUS *new_rstatus(REQUEST *, SECURE *);
extern PSTATUS *new_pstatus(PRINTER *);
-extern CSTATUS *new_cstatus(CLASS *);
+extern CLSTATUS *new_cstatus(CLASS *);
extern FSTATUS *new_fstatus(_FORM *f);
extern PWSTATUS *new_pwstatus(PWHEEL *p);
extern ALERT *new_alert(char *fmt, int i);
@@ -348,11 +346,11 @@ extern void free_exec(EXEC *);
extern void free_alert(ALERT *);
extern void free_pwstatus(PWSTATUS *);
extern void free_fstatus(FSTATUS *);
-extern void free_cstatus(CSTATUS *);
+extern void free_cstatus(CLSTATUS *);
extern void free_pstatus(PSTATUS *);
extern void free_rstatus(RSTATUS *);
-extern CSTATUS *search_cstatus ( char * );
+extern CLSTATUS *search_cstatus ( char * );
extern FSTATUS *search_fptable(register char *);
extern FSTATUS *search_fstatus ( char * );
extern PSTATUS *search_pstatus ( char * );
@@ -370,7 +368,7 @@ extern char *pwheel_in_question;
** External tables, lists:
**/
-extern CSTATUS **CStatus; /* Status of classes */
+extern CLSTATUS **CStatus; /* Status of classes */
extern PSTATUS **PStatus; /* Status of printers */
extern FSTATUS **FStatus; /* Status of forms */
extern PWSTATUS **PWStatus; /* Status of print wheels */
diff --git a/usr/src/cmd/lp/cmd/lpsched/nodes.h b/usr/src/cmd/lp/cmd/lpsched/nodes.h
index 3ace135c23..4fa0a1b15e 100644
--- a/usr/src/cmd/lp/cmd/lpsched/nodes.h
+++ b/usr/src/cmd/lp/cmd/lpsched/nodes.h
@@ -27,10 +27,8 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
typedef struct alert_node ALERT;
-typedef struct cstat_node CSTATUS;
+typedef struct cstat_node CLSTATUS;
typedef struct exec_node EXEC;
typedef struct form_node _FORM;
typedef struct fstat_node FSTATUS;
diff --git a/usr/src/cmd/lp/cmd/lpsched/requeue.c b/usr/src/cmd/lp/cmd/lpsched/requeue.c
index 47798de6b3..52715d6b1f 100644
--- a/usr/src/cmd/lp/cmd/lpsched/requeue.c
+++ b/usr/src/cmd/lp/cmd/lpsched/requeue.c
@@ -28,7 +28,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "lpsched.h"
@@ -68,7 +67,7 @@ void
queue_attract(PSTATUS *pps, int (*qchk_p)(RSTATUS *), int attract_just_one)
{
register RSTATUS *prs;
- register CSTATUS *pcs;
+ register CLSTATUS *pcs;
int called_schedule = 0;
diff --git a/usr/src/cmd/lp/cmd/lpsched/status.c b/usr/src/cmd/lp/cmd/lpsched/status.c
index 893ffa3c05..342881f47d 100644
--- a/usr/src/cmd/lp/cmd/lpsched/status.c
+++ b/usr/src/cmd/lp/cmd/lpsched/status.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "stdlib.h"
#include "string.h"
#include "unistd.h"
@@ -337,7 +335,7 @@ load_fault_status(void)
static void
load_cstatus(void)
{
- CSTATUS *pcs;
+ CLSTATUS *pcs;
char *rej_reason,
buf[BUFSIZ],
*name,
@@ -666,7 +664,7 @@ dump_cstatus(void)
}
for (i = 0; CStatus != NULL && CStatus[i] != NULL; i++) {
- CSTATUS *pcs = CStatus[i];
+ CLSTATUS *pcs = CStatus[i];
if (pcs->class->name)
for (f = 0; f < CST_MAX; f++) switch (f) {
diff --git a/usr/src/cmd/lp/cmd/lpsched/validate.c b/usr/src/cmd/lp/cmd/lpsched/validate.c
index bec1434f9b..635220180f 100644
--- a/usr/src/cmd/lp/cmd/lpsched/validate.c
+++ b/usr/src/cmd/lp/cmd/lpsched/validate.c
@@ -27,7 +27,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
/* SVr4.0 1.11.1.10 */
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
@@ -76,7 +75,7 @@ _validate(RSTATUS *prs, PSTATUS *pps, PSTATUS *stop_pps, char **prefixp,
register FSTATUS *pfs = 0;
- register CSTATUS *pcs = 0;
+ register CLSTATUS *pcs = 0;
CANDIDATE *arena = 0,
single;
diff --git a/usr/src/cmd/mdb/common/kmdb/kmdb_umemglue.c b/usr/src/cmd/mdb/common/kmdb/kmdb_umemglue.c
index 4193b0dcd5..c2289ec7f7 100644
--- a/usr/src/cmd/mdb/common/kmdb/kmdb_umemglue.c
+++ b/usr/src/cmd/mdb/common/kmdb/kmdb_umemglue.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <mdb/mdb_debug.h>
#include <mdb/mdb_err.h>
#include <mdb/mdb_io.h>
@@ -101,6 +99,14 @@ umem_atomic_add_64(uint64_t *target, int64_t delta)
*target = *target + delta;
}
+uint64_t
+umem_atomic_swap_64(volatile uint64_t *t, uint64_t v)
+{
+ uint64_t old = *t;
+ *t = v;
+ return (old);
+}
+
/*
* Standalone umem must be manually initialized
*/
diff --git a/usr/src/cmd/mdb/common/modules/libumem/umem.c b/usr/src/cmd/mdb/common/modules/libumem/umem.c
index 69b003cc5c..73dd4d6e89 100644
--- a/usr/src/cmd/mdb/common/modules/libumem/umem.c
+++ b/usr/src/cmd/mdb/common/modules/libumem/umem.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright 2012 Joyent, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd.h b/usr/src/cmd/ndmpd/ndmp/ndmpd.h
index b24c1a58a2..efee818c14 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd.h
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd.h
@@ -37,6 +37,7 @@
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
+/* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
#ifndef _NDMPD_H
#define _NDMPD_H
@@ -310,9 +311,6 @@ typedef struct ndmpd_session_tape_desc {
int td_sid;
int td_lun;
char td_adapter_name[SCSI_MAX_NAME];
- ulong_t td_eom_seen:1,
- td_io_err:1,
- td_write:1;
} ndmpd_session_tape_desc_t;
typedef struct ndmpd_session_mover_desc {
@@ -798,7 +796,6 @@ extern int ndmpd_remote_read_v3(ndmpd_session_t *,
char *,
ulong_t);
extern int ndmpd_mover_wait_v3(ndmpd_session_t *);
-extern void ndmpd_write_eom(int);
/*
@@ -1022,6 +1019,9 @@ extern int ndmp_restore_extract_params(ndmpd_session_t *,
extern int ndmp_tar_reader(ndmp_tar_reader_arg_t *);
extern int tape_open(char *, int);
+extern int tape_is_at_bot(ndmpd_session_t *);
+extern int tape_is_at_bof(ndmpd_session_t *);
+extern void fm_dance(ndmpd_session_t *);
extern void ndmp_session_ref(ndmpd_session_t *);
extern void ndmp_session_unref(ndmpd_session_t *);
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_handler.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_handler.c
index 30bafa0f73..2658bb2cef 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_handler.c
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_handler.c
@@ -37,6 +37,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
#include <sys/note.h>
#include "ndmpd.h"
@@ -348,7 +351,7 @@ ndmp_handler_t ndmp_msghdl_tab[] = {
NDMP_TAPE_WRITE,
AUTH_REQUIRED,
{
- HANDL(tape_write, 2, 2),
+ HANDL(tape_write, 3, 2),
HANDL(tape_write, 3, 3),
HANDL(tape_write, 3, 4),
}
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_mover.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_mover.c
index 6bf0a8808b..8772edc199 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_mover.c
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_mover.c
@@ -37,6 +37,7 @@
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
+/* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
#include <sys/ioctl.h>
#include <sys/types.h>
@@ -62,7 +63,6 @@
static int create_listen_socket_v2(ndmpd_session_t *session, ulong_t *addr,
ushort_t *port);
-static int tape_write(ndmpd_session_t *session, char *data, ssize_t length);
static int tape_read(ndmpd_session_t *session, char *data);
static int change_tape(ndmpd_session_t *session);
static int discard_data(ndmpd_session_t *session, ulong_t length);
@@ -1354,30 +1354,6 @@ ndmpd_mover_connect_v4(ndmp_connection_t *connection, void *body)
*/
/*
- * ndmpd_write_eom
- *
- * Write end-of-media magic string. This is called after hitting the LEOT.
- */
-void
-ndmpd_write_eom(int fd)
-{
- int n;
-
- (void) ndmp_mtioctl(fd, MTWEOF, 1);
- n = write(fd, NDMP_EOM_MAGIC, strlen(NDMP_EOM_MAGIC));
-
- NDMP_LOG(LOG_DEBUG, "%d EOM bytes wrote", n);
- (void) ndmp_mtioctl(fd, MTWEOF, 1);
-
- /*
- * Rewind to the previous file since the last two files are used
- * as the indicator for logical EOM.
- */
- (void) ndmp_mtioctl(fd, MTBSF, 2);
-}
-
-
-/*
* ndmpd_local_write
*
* Writes data to the mover.
@@ -1413,7 +1389,7 @@ ndmpd_local_write(ndmpd_session_t *session, char *data, ulong_t length)
0, session->ns_mover.md_record_size -
session->ns_mover.md_w_index);
- n = tape_write(session, session->ns_mover.md_buf,
+ n = mover_tape_write_v3(session, session->ns_mover.md_buf,
session->ns_mover.md_record_size);
if (n <= 0) {
ndmpd_mover_error(session,
@@ -1439,7 +1415,7 @@ ndmpd_local_write(ndmpd_session_t *session, char *data, ulong_t length)
*/
if (session->ns_mover.md_w_index == 0 &&
length - count >= session->ns_mover.md_record_size) {
- n = tape_write(session, &data[count],
+ n = mover_tape_write_v3(session, &data[count],
session->ns_mover.md_record_size);
if (n <= 0) {
ndmpd_mover_error(session,
@@ -1469,9 +1445,10 @@ ndmpd_local_write(ndmpd_session_t *session, char *data, ulong_t length)
/* Write the buffer if its full */
if (session->ns_mover.md_w_index ==
session->ns_mover.md_record_size) {
- n = tape_write(session, session->ns_mover.md_buf,
+ n = mover_tape_write_v3(session,
+ session->ns_mover.md_buf,
session->ns_mover.md_record_size);
- if (n < 0) {
+ if (n <= 0) {
ndmpd_mover_error(session,
(n == 0 ? NDMP_MOVER_HALT_ABORTED :
NDMP_MOVER_HALT_INTERNAL_ERROR));
@@ -2279,99 +2256,6 @@ accept_connection(void *cookie, int fd, ulong_t mode)
}
/*
- * tape_write
- *
- * Writes a data record to tape. Detects and handles EOT conditions.
- *
- * Parameters:
- * session (input) - session pointer.
- * data (input) - data to be written.
- * length (input) - length of data to be written.
- *
- * Returns:
- * 0 - operation aborted by client.
- * -1 - error.
- * otherwise - number of bytes written.
- */
-static int
-tape_write(ndmpd_session_t *session, char *data, ssize_t length)
-{
- ssize_t n;
- int err;
-
- for (; ; ) {
- /*
- * Refer to the comment at the top of ndmpd_tape.c file for
- * Mammoth2 tape drives.
- */
- if (session->ns_tape.td_eom_seen) {
- NDMP_LOG(LOG_DEBUG, "eom_seen");
- session->ns_tape.td_eom_seen = FALSE;
- /*
- * End of media reached.
- * Notify client and wait for the client to
- * either abort the operation or continue the
- * operation after changing the tape.
- */
- NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
- ++ndmp_log_msg_id,
- "End of tape reached. Load next tape.\n");
-
- err = change_tape(session);
-
- /* Operation aborted or connection terminated? */
- if (err < 0)
- return (-1);
-
- continue;
- }
-
- n = write(session->ns_tape.td_fd, data, length);
- if (n < 0) {
- NDMP_LOG(LOG_ERR, "Tape write error: %m.");
- return (-1);
- }
- NS_ADD(wtape, n);
-
- if (n == 0 || n != length) {
- if (n != 0) {
- NDMP_LOG(LOG_DEBUG, "LEOT n: %d", n);
-
- NDMP_LOG(LOG_DEBUG, "Backup one record");
- (void) ndmp_mtioctl(session->ns_tape.td_fd,
- MTBSR, 1);
-
- /* setting logical EOM */
- ndmpd_write_eom(session->ns_tape.td_fd);
- }
-
- /*
- * End of media reached.
- * Notify client and wait for the client to
- * either abort the operation or continue the
- * operation after changing the tape.
- */
- NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
- ++ndmp_log_msg_id,
- "End of tape reached. Load next tape.\n");
-
- err = change_tape(session);
-
- /* Operation aborted or connection terminated? */
- if (err < 0)
- return (-1);
-
- /* Retry the write to the new tape. */
- continue;
- }
-
- session->ns_tape.td_record_count++;
- return (n);
- }
-}
-
-
-/*
* tape_read
*
* Reads a data record from tape. Detects and handles EOT conditions.
@@ -3143,7 +3027,8 @@ mover_tape_write_one_buf(ndmpd_session_t *session, tlm_buffer_t *buf)
buf->tb_full, buf->tb_eot, buf->tb_eof, buf->tb_errno,
buf->tb_buffer_size, buf->tb_buffer_data);
- n = tape_write(session, buf->tb_buffer_data, buf->tb_buffer_size);
+ n = mover_tape_write_v3(session, buf->tb_buffer_data,
+ buf->tb_buffer_size);
NDMP_LOG(LOG_DEBUG, "n: %d", n);
@@ -3668,37 +3553,9 @@ static int
mover_tape_write_v3(ndmpd_session_t *session, char *data, ssize_t length)
{
ssize_t n;
- int err;
-
- for (; ; ) {
- /*
- * Refer to the comment at the top of ndmpd_tape.c file for
- * Mammoth2 tape drives.
- */
- if (session->ns_tape.td_eom_seen) {
- NDMP_LOG(LOG_DEBUG, "eom_seen");
-
- session->ns_tape.td_eom_seen = FALSE;
- /*
- * End of media reached.
- * Notify client and wait for the client to
- * either abort the operation or continue the
- * operation after changing the tape.
- */
- NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
- ++ndmp_log_msg_id,
- "End of tape reached. Load next tape");
-
- err = mover_pause_v3(session, NDMP_MOVER_PAUSE_EOM);
-
- /* Operation aborted or connection terminated? */
- if (err < 0)
- return (-1);
-
- /* Retry the write to the new tape. */
- continue;
- }
+ ssize_t count = length;
+ while (count > 0) {
/*
* Enforce mover window on write.
*/
@@ -3707,57 +3564,49 @@ mover_tape_write_v3(ndmpd_session_t *session, char *data, ssize_t length)
session->ns_mover.md_window_length) {
NDMP_LOG(LOG_DEBUG, "MOVER_PAUSE_EOW");
- err = mover_pause_v3(session, NDMP_MOVER_PAUSE_EOW);
- /* Operation aborted or connection terminated? */
- if (err < 0)
+ if (mover_pause_v3(session, NDMP_MOVER_PAUSE_EOW) < 0)
+ /* Operation aborted or connection terminated */
return (-1);
}
- n = write(session->ns_tape.td_fd, data, length);
+ n = write(session->ns_tape.td_fd, data, count);
if (n < 0) {
NDMP_LOG(LOG_ERR, "Tape write error: %m.");
return (-1);
+ } else if (n > 0) {
+ NS_ADD(wtape, n);
+ count -= n;
+ data += n;
+ session->ns_tape.td_record_count++;
}
- NS_ADD(wtape, n);
- if (n == 0 || n != length) {
- if (n != 0) {
- /*
- * Backup one record since the record
- * hits the EOM.
- */
- NDMP_LOG(LOG_DEBUG, "Back up one record");
- (void) ndmp_mtioctl(session->ns_tape.td_fd,
- MTBSR, 1);
+ /* EOM handling */
+ if (count > 0) {
+ struct mtget mtstatus;
- /* setting logical EOM */
- ndmpd_write_eom(session->ns_tape.td_fd);
- }
+ (void) ioctl(session->ns_tape.td_fd, MTIOCGET,
+ &mtstatus);
+ NDMP_LOG(LOG_DEBUG, "EOM detected (%d written bytes, "
+ "mover record %d, file #%d, block #%d)", n,
+ session->ns_tape.td_record_count,
+ mtstatus.mt_fileno, mtstatus.mt_blkno);
/*
- * End of media reached.
- * Notify client and wait for the client to
- * either abort the operation or continue the
- * operation after changing the tape.
+ * Notify the client to either abort the operation
+ * or change the tape.
*/
NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
++ndmp_log_msg_id,
"End of tape reached. Load next tape");
- err = mover_pause_v3(session, NDMP_MOVER_PAUSE_EOM);
-
- /* Operation aborted or connection terminated? */
- if (err < 0)
+ if (mover_pause_v3(session, NDMP_MOVER_PAUSE_EOM) < 0)
+ /* Operation aborted or connection terminated */
return (-1);
-
- /* Retry the write to the new tape. */
- continue;
}
-
- session->ns_tape.td_record_count++;
- return (n);
}
+
+ return (length);
}
@@ -3904,7 +3753,7 @@ ndmpd_local_write_v3(ndmpd_session_t *session, char *data, ulong_t length)
n = mover_tape_write_v3(session,
session->ns_mover.md_buf,
session->ns_mover.md_record_size);
- if (n < 0) {
+ if (n <= 0) {
ndmpd_mover_error(session,
(n == 0 ? NDMP_MOVER_HALT_ABORTED :
NDMP_MOVER_HALT_MEDIA_ERROR));
@@ -4017,59 +3866,84 @@ mover_data_read_v3(void *cookie, int fd, ulong_t mode)
static int
mover_tape_read_v3(ndmpd_session_t *session, char *data)
{
+ int pause_reason;
ssize_t n;
int err;
int count;
count = session->ns_mover.md_record_size;
- for (; ; ) {
+ while (count > 0) {
+ pause_reason = NDMP_MOVER_PAUSE_NA;
+
n = read(session->ns_tape.td_fd, data, count);
if (n < 0) {
- NDMP_LOG(LOG_ERR, "Tape read error: %m.");
- return (TAPE_READ_ERR);
- }
- NS_ADD(rtape, n);
-
- if (n == 0) {
+ /*
+ * If at beginning of file and read fails with EIO,
+ * then it's repeated attempt to read at EOT.
+ */
+ if (errno == EIO && tape_is_at_bof(session)) {
+ NDMP_LOG(LOG_DEBUG, "Repeated read at EOT");
+ pause_reason = NDMP_MOVER_PAUSE_EOM;
+ NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
+ ++ndmp_log_msg_id,
+ "End of tape reached. Load next tape");
+ }
+ /*
+ * According to NDMPv4 spec preferred error code when
+ * trying to read from blank tape is NDMP_EOM_ERR.
+ */
+ else if (errno == EIO && tape_is_at_bot(session)) {
+ NDMP_LOG(LOG_ERR,
+ "Blank tape detected, returning EOM");
+ NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
+ ++ndmp_log_msg_id,
+ "Blank tape. Load another tape");
+ pause_reason = NDMP_MOVER_PAUSE_EOM;
+ } else {
+ NDMP_LOG(LOG_ERR, "Tape read error: %m.");
+ return (TAPE_READ_ERR);
+ }
+ } else if (n > 0) {
+ NS_ADD(rtape, n);
+ data += n;
+ count -= n;
+ session->ns_tape.td_record_count++;
+ } else {
if (!is_writer_running_v3(session))
return (TAPE_NO_WRITER_ERR);
/*
- * End of media reached.
- * Notify client and wait for the client to
- * either abort the data operation or continue the
- * operation after changing the tape.
+ * End of file or media reached. Notify client and
+ * wait for the client to either abort the data
+ * operation or continue the operation after changing
+ * the tape.
*/
- NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
- ++ndmp_log_msg_id,
- "End of tape reached. Load next tape");
+ if (tape_is_at_bof(session)) {
+ NDMP_LOG(LOG_DEBUG, "EOT detected");
+ pause_reason = NDMP_MOVER_PAUSE_EOM;
+ NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
+ ++ndmp_log_msg_id, "End of medium reached");
+ } else {
+ NDMP_LOG(LOG_DEBUG, "EOF detected");
+ /* reposition the tape to BOT side of FM */
+ fm_dance(session);
+ pause_reason = NDMP_MOVER_PAUSE_EOF;
+ NDMP_APILOG((void*)session, NDMP_LOG_NORMAL,
+ ++ndmp_log_msg_id, "End of file reached.");
+ }
+ }
- err = mover_pause_v3(session, NDMP_MOVER_PAUSE_EOF);
+ if (pause_reason != NDMP_MOVER_PAUSE_NA) {
+ err = mover_pause_v3(session, pause_reason);
/* Operation aborted or connection terminated? */
if (err < 0) {
- /*
- * Back up one record if it's read but not
- * used.
- */
- if (count != session->ns_mover.md_record_size)
- (void) ndmp_mtioctl(
- session->ns_tape.td_fd, MTBSR, 1);
return (0);
}
-
- /* Retry the read from the new tape. */
- continue;
- }
-
- data += n;
- count -= n;
- if (count <= 0) {
- session->ns_mover.md_record_num++;
- session->ns_tape.td_record_count++;
- return (n);
+ /* Retry the read from new location */
}
}
+ return (session->ns_mover.md_record_size);
}
@@ -4168,6 +4042,7 @@ mover_data_write_v3(void *cookie, int fd, ulong_t mode)
}
session->ns_mover.md_w_index = n;
+ session->ns_mover.md_record_num++;
}
/*
@@ -4540,6 +4415,7 @@ ndmpd_local_read_v3(ndmpd_session_t *session, char *data, ulong_t length)
count += n;
session->ns_mover.md_bytes_left_to_read -= n;
session->ns_mover.md_position += n;
+ session->ns_mover.md_record_num++;
continue;
}
@@ -4557,6 +4433,7 @@ ndmpd_local_read_v3(ndmpd_session_t *session, char *data, ulong_t length)
session->ns_mover.md_w_index = n;
session->ns_mover.md_r_index = 0;
+ session->ns_mover.md_record_num++;
NDMP_LOG(LOG_DEBUG, "n: %d", n);
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_tape.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_tape.c
index 8dd46411f9..0d5194c27e 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_tape.c
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_tape.c
@@ -2,7 +2,6 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
/*
* BSD 3 Clause License
*
@@ -38,6 +37,7 @@
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
+/* Copyright 2014 Nexenta Systems, Inc. All rights reserved. */
#include <sys/param.h>
#include <fcntl.h>
@@ -65,6 +65,29 @@ int ndmp_tape_open_retries = 5;
int ndmp_tape_open_delay = 1000;
/*
+ * A few words about EOT (end-of-tape) and EOM handling on tapes with SVR4
+ * semantic:
+ *
+ * We adhere to terminology as used in st driver. EOT means end of recorded
+ * data on a tape. This is different from EOM (somewhere referred to as LEOT)
+ * which is the end of tape medium. EOT is meaningful only for reads while EOM
+ * is meaningful only for writes. It's not possible to read after EOT (fails
+ * with EIO), but it's possible to write data after EOM. EOM returned by st
+ * driver on modern tape drives is just indication that the physical end of
+ * tape medium is nearing and that writer should write just the necessary
+ * minimum and stop writing. When physical end of tape is reached all writes
+ * return EIO. If EOM is crossed during read operation then st driver doesn't
+ * bother to report it to client and that's alright because reads don't care
+ * where medium physically ends but they care about meaningful data recorded on
+ * the tape and as long as there are such data reads should continue to work.
+ *
+ * When reading EOT is signalled by st driver by two empty consecutive reads
+ * (with FSF done between them). When writing EOM is signalled by empty write
+ * (a write which writes zero bytes). Following writes succeed until physical
+ * end of tape is reached in which case EIO is returned.
+ */
+
+/*
* ************************************************************************
* NDMP V2 HANDLERS
* ************************************************************************
@@ -196,7 +219,6 @@ ndmpd_tape_open_v2(ndmp_connection_t *connection, void *body)
session->ns_tape.td_lun = lun;
(void) strlcpy(session->ns_tape.td_adapter_name, adptnm, SCSI_MAX_NAME);
session->ns_tape.td_record_count = 0;
- session->ns_tape.td_eom_seen = FALSE;
NDMP_LOG(LOG_DEBUG, "Tape is opened fd: %d", session->ns_tape.td_fd);
@@ -389,6 +411,7 @@ ndmpd_tape_mtio_v2(ndmp_connection_t *connection, void *body)
do {
NS_UPD(twait, trun);
+ errno = 0;
rc = ioctl(session->ns_tape.td_fd, MTIOCTOP, &tapeop);
NS_UPD(trun, twait);
NDMP_LOG(LOG_DEBUG,
@@ -445,104 +468,6 @@ ndmpd_tape_mtio_v2(ndmp_connection_t *connection, void *body)
/*
- * ndmpd_tape_write_v2
- *
- * This handler handles tape_write requests.
- * This interface is a non-buffered interface. Each write request
- * maps directly to a write to the tape device. It is the responsibility
- * of the NDMP client to pad the data to the desired record size.
- * It is the responsibility of the NDMP client to ensure that the
- * length is a multiple of the tape block size if the tape device
- * is in fixed block mode.
- *
- * Parameters:
- * connection (input) - connection handle.
- * body (input) - request message body.
- *
- * Returns:
- * void
- */
-void
-ndmpd_tape_write_v2(ndmp_connection_t *connection, void *body)
-{
- ndmp_tape_write_request *request = (ndmp_tape_write_request *) body;
- ndmp_tape_write_reply reply;
- ndmpd_session_t *session = ndmp_get_client_data(connection);
- ssize_t n;
-
- reply.count = 0;
-
- if (session->ns_tape.td_fd == -1) {
- NDMP_LOG(LOG_ERR, "Tape device is not open.");
- reply.error = NDMP_DEV_NOT_OPEN_ERR;
- ndmp_send_reply(connection, (void *) &reply,
- "sending tape_write reply");
- return;
- }
- if (session->ns_tape.td_mode == NDMP_TAPE_READ_MODE) {
- NDMP_LOG(LOG_INFO, "Tape device opened in read-only mode");
- reply.error = NDMP_PERMISSION_ERR;
- ndmp_send_reply(connection, (void *) &reply,
- "sending tape_write reply");
- return;
- }
- if (request->data_out.data_out_len == 0) {
- reply.error = NDMP_NO_ERR;
- ndmp_send_reply(connection, (void *) &reply,
- "sending tape_write reply");
- return;
- }
-
- if (session->ns_tape.td_eom_seen) {
- /*
- * Refer to the comment at the top of this file for
- * Mammoth2 tape drives.
- */
- NDMP_LOG(LOG_DEBUG, "eom_seen");
- ndmpd_write_eom(session->ns_tape.td_fd);
-
- session->ns_tape.td_eom_seen = FALSE;
- reply.error = NDMP_EOM_ERR;
- ndmp_send_reply(connection, (void *) &reply,
- "sending tape_write reply");
- return;
- }
-
- n = write(session->ns_tape.td_fd, request->data_out.data_out_val,
- request->data_out.data_out_len);
- if (n >= 0) {
- session->ns_tape.td_write = 1;
- NS_ADD(wtape, n);
- }
- if (n == 0) {
- NDMP_LOG(LOG_DEBUG, "n == 0");
- reply.error = NDMP_EOM_ERR;
- session->ns_tape.td_eom_seen = FALSE;
- } else if (n < 0) {
- NDMP_LOG(LOG_ERR, "Tape write error: %m.");
- reply.error = NDMP_IO_ERR;
- } else {
- reply.count = n;
- reply.error = NDMP_NO_ERR;
-
- /*
- * a logical end of tape will return number of bytes written
- * less than rquested, and one more request to write will
- * give 0, and then no-space
- */
- if (n < request->data_out.data_out_len) {
- NDMP_LOG(LOG_DEBUG, "LEOT: n: %d", n);
- session->ns_tape.td_eom_seen = TRUE;
- } else {
- session->ns_tape.td_eom_seen = FALSE;
- }
- }
- ndmp_send_reply(connection, &reply,
- "sending tape_write reply");
-}
-
-
-/*
* ndmpd_tape_read_v2
*
* This handler handles tape_read requests.
@@ -593,8 +518,6 @@ ndmpd_tape_read_v2(ndmp_connection_t *connection, void *body)
return;
}
- session->ns_tape.td_eom_seen = FALSE;
-
unbuffered_read(session, buf, request->count, &reply);
ndmp_send_reply(connection, (void *) &reply, "sending tape_read reply");
@@ -631,7 +554,6 @@ ndmpd_tape_execute_cdb_v2(ndmp_connection_t *connection, void *body)
ndmp_send_reply(connection, (void *) &reply,
"sending tape_execute_cdb reply");
} else {
- session->ns_tape.td_eom_seen = FALSE;
ndmp_execute_cdb(session, session->ns_tape.td_adapter_name,
session->ns_tape.td_sid, session->ns_tape.td_lun,
(ndmp_execute_cdb_request *)request);
@@ -752,32 +674,92 @@ ndmpd_tape_get_state_v3(ndmp_connection_t *connection, void *body)
"sending tape_get_state reply");
}
+/*
+ * tape_is_at_bot
+ *
+ * Returns 1 if tape is at BOT, 0 on error or not at BOT.
+ *
+ */
+int
+tape_is_at_bot(ndmpd_session_t *session)
+{
+ struct mtget mtstatus;
+
+ if (ioctl(session->ns_tape.td_fd, MTIOCGET, &mtstatus) == 0 &&
+ mtstatus.mt_fileno == 0 && mtstatus.mt_blkno == 0)
+ return (1);
+
+ return (0);
+}
+
+/*
+ * If we are at the beginning of a file (block # is zero) and read returns
+ * zero bytes then this has to be end of recorded data on the tape. Repeated
+ * reads at EOT return EIO. In both cases (zero read and EIO read) this
+ * function should be used to test if we are at EOT.
+ *
+ * Returns 1 if tape is at BOF, 0 on error or not at BOF.
+ */
+int
+tape_is_at_bof(ndmpd_session_t *session)
+{
+ struct mtget mtstatus;
+
+ if ((ioctl(session->ns_tape.td_fd, MTIOCGET, &mtstatus) == 0) &&
+ (mtstatus.mt_fileno > 0) && (mtstatus.mt_blkno == 0))
+ return (1);
+
+ return (0);
+}
+
+/*
+ * Skips forward over a file mark and then back before the file mark. Why is
+ * this needed? There are two reasons for it:
+ *
+ * 1) Because NDMPv4 spec requires that when EOF is encountered, the tape
+ * position should remain on BOT side of the file mark. When st driver reaches
+ * end of file get-position mtioctl reports position before file mark, however
+ * the file mark has already been read and the real position is thus after the
+ * file mark (real position as reported for example by uscsi commands). Thus we
+ * need to do FSF, which does nothing but only updates file & block counter in
+ * st driver and then BSF, which sets the position before the file mark. Thus
+ * current position as reported by scsi and mtioctl will be in sync.
+ *
+ * 2) st driver returns EIO for repeated reads at EOF while according to NDMP
+ * spec we should continue to return zero bytes until FSF is done. By skipping
+ * forward and backward, st driver will return zero bytes for the next read
+ * again and we don't need to specifically handle this case.
+ */
+void
+fm_dance(ndmpd_session_t *session)
+{
+ (void) ndmp_mtioctl(session->ns_tape.td_fd, MTFSF, 1);
+ (void) ndmp_mtioctl(session->ns_tape.td_fd, MTBSF, 1);
+}
/*
* ndmpd_tape_write_v3
*
- * This handler handles tape_write requests.
- * This interface is a non-buffered interface. Each write request
- * maps directly to a write to the tape device. It is the responsibility
- * of the NDMP client to pad the data to the desired record size.
- * It is the responsibility of the NDMP client to ensure that the
- * length is a multiple of the tape block size if the tape device
- * is in fixed block mode.
+ * This handler handles tape_write requests. This interface is a non-buffered
+ * interface. Each write request maps directly to a write to the tape device.
+ * It is the responsibility of the NDMP client to pad the data to the desired
+ * record size. It is the responsibility of the NDMP client to ensure that the
+ * length is a multiple of the tape block size if the tape device is in fixed
+ * block mode.
+ *
+ * A logical end of tape will return number of bytes written less than
+ * requested, and one more request to write will give 0 and NDMP_EOM_ERR,
+ * followed by NDMP_NO_ERR until NDMP_IO_ERR when physical end of tape is
+ * reached.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
- *
- * Returns:
- * void
*/
-void
-ndmpd_tape_write_v3(ndmp_connection_t *connection, void *body)
-{
- ndmp_tape_write_request *request = (ndmp_tape_write_request *) body;
- ndmp_tape_write_reply reply;
- ndmpd_session_t *session = ndmp_get_client_data(connection);
- ssize_t n;
+void ndmpd_tape_write_v3(ndmp_connection_t *connection, void *body) {
+ ndmp_tape_write_request *request = (ndmp_tape_write_request *)body;
+ ndmp_tape_write_reply reply; ndmpd_session_t *session =
+ ndmp_get_client_data(connection); ssize_t n;
reply.count = 0;
@@ -816,65 +798,48 @@ ndmpd_tape_write_v3(ndmp_connection_t *connection, void *body)
return;
}
- /*
- * Refer to the comment at the top of this file for
- * Mammoth2 tape drives.
- */
- if (session->ns_tape.td_eom_seen) {
- NDMP_LOG(LOG_DEBUG, "eom_seen");
- ndmpd_write_eom(session->ns_tape.td_fd);
- session->ns_tape.td_eom_seen = FALSE;
- reply.error = NDMP_EOM_ERR;
- ndmp_send_reply(connection, (void *) &reply,
- "sending tape_write reply");
- return;
- }
-
n = write(session->ns_tape.td_fd, request->data_out.data_out_val,
request->data_out.data_out_len);
- session->ns_tape.td_eom_seen = FALSE;
- if (n >= 0) {
- session->ns_tape.td_write = 1;
- NS_ADD(wtape, n);
- }
- if (n == 0) {
- NDMP_LOG(LOG_INFO, "EOM detected");
- reply.error = NDMP_EOM_ERR;
- session->ns_tape.td_eom_seen = TRUE;
- } else if (n < 0) {
+ if (n < 0) {
NDMP_LOG(LOG_ERR, "Tape write error: %m.");
reply.error = NDMP_IO_ERR;
+ } else if (n == 0) {
+ NDMP_LOG(LOG_INFO, "EOM detected");
+ reply.error = NDMP_EOM_ERR;
} else {
+ NS_ADD(wtape, n);
reply.count = n;
reply.error = NDMP_NO_ERR;
+
+ if (n < request->data_out.data_out_len)
+ NDMP_LOG(LOG_DEBUG,
+ "EOM is coming (partial write of %d bytes)", n);
}
ndmp_send_reply(connection, (void *) &reply,
"sending tape_write reply");
}
-
/*
* ndmpd_tape_read_v3
*
- * This handler handles tape_read requests.
- * This interface is a non-buffered interface. Each read request
- * maps directly to a read to the tape device. It is the responsibility
- * of the NDMP client to issue read requests with a length that is at
- * least as large as the record size used write the tape. The tape driver
- * always reads a full record. Data is discarded if the read request is
- * smaller than the record size.
- * It is the responsibility of the NDMP client to ensure that the
- * length is a multiple of the tape block size if the tape device
- * is in fixed block mode.
+ * This handler handles tape_read requests. This interface is a non-buffered
+ * interface. Each read request maps directly to a read to the tape device. It
+ * is the responsibility of the NDMP client to issue read requests with a
+ * length that is at least as large as the record size used write the tape. The
+ * tape driver always reads a full record. Data is discarded if the read
+ * request is smaller than the record size. It is the responsibility of the
+ * NDMP client to ensure that the length is a multiple of the tape block size
+ * if the tape device is in fixed block mode.
+ *
+ * A logical end of tape will return less bytes than requested, and one more
+ * request to read will give 0 and NDMP_EOM_ERR. All subsequent reads will
+ * return NDMP_EOM_ERR until the tape is repositioned.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
- *
- * Returns:
- * void
*/
void
ndmpd_tape_read_v3(ndmp_connection_t *connection, void *body)
@@ -883,7 +848,7 @@ ndmpd_tape_read_v3(ndmp_connection_t *connection, void *body)
ndmp_tape_read_reply reply;
ndmpd_session_t *session = ndmp_get_client_data(connection);
char *buf;
- int n, len;
+ int n;
reply.data_in.data_in_len = 0;
@@ -921,7 +886,6 @@ ndmpd_tape_read_v3(ndmp_connection_t *connection, void *body)
"sending tape_read reply");
return;
}
- session->ns_tape.td_eom_seen = FALSE;
n = read(session->ns_tape.td_fd, buf, request->count);
if (n < 0) {
@@ -931,51 +895,41 @@ ndmpd_tape_read_v3(ndmp_connection_t *connection, void *body)
*/
if (errno == ENOSPC) {
reply.error = NDMP_EOF_ERR;
+ }
+ /*
+ * If at beginning of file and read fails with EIO, then it's
+ * repeated attempt to read at EOT.
+ */
+ else if (errno == EIO && tape_is_at_bof(session)) {
+ NDMP_LOG(LOG_DEBUG, "Repeated read at EOT");
+ reply.error = NDMP_EOM_ERR;
+ }
+ /*
+ * According to NDMPv4 spec preferred error code when
+ * trying to read from blank tape is NDMP_EOM_ERR.
+ */
+ else if (errno == EIO && tape_is_at_bot(session)) {
+ NDMP_LOG(LOG_ERR, "Blank tape detected, returning EOM");
+ reply.error = NDMP_EOM_ERR;
} else {
NDMP_LOG(LOG_ERR, "Tape read error: %m.");
reply.error = NDMP_IO_ERR;
}
} else if (n == 0) {
- (void) ndmp_mtioctl(session->ns_tape.td_fd, MTFSF, 1);
-
- len = strlen(NDMP_EOM_MAGIC);
- (void) memset(buf, 0, len);
- n = read(session->ns_tape.td_fd, buf, len);
- buf[len] = '\0';
-
- NDMP_LOG(LOG_DEBUG, "Checking EOM: nread %d [%s]", n, buf);
-
- if (strncmp(buf, NDMP_EOM_MAGIC, len) == 0) {
+ if (tape_is_at_bof(session)) {
+ NDMP_LOG(LOG_DEBUG, "EOT detected");
reply.error = NDMP_EOM_ERR;
- NDMP_LOG(LOG_DEBUG, "NDMP_EOM_ERR");
} else {
+ /* reposition the tape to BOT side of FM */
+ fm_dance(session);
+ NDMP_LOG(LOG_DEBUG, "EOF detected");
reply.error = NDMP_EOF_ERR;
- NDMP_LOG(LOG_DEBUG, "NDMP_EOF_ERR");
}
- if (n > 0)
- (void) ndmp_mtioctl(session->ns_tape.td_fd, MTBSR, 1);
} else {
- /*
- * Symantec fix for import phase
- *
- * As import process from symantec skips filemarks
- * they can come across to NDMP_EOM_MAGIC and treat
- * it as data. This fix prevents the magic to be
- * sent to the client and the read will return zero bytes
- * and set the NDMP_EOM_ERR error. The tape should
- * be positioned at the EOT side of the file mark.
- */
- len = strlen(NDMP_EOM_MAGIC);
- if (n == len && strncmp(buf, NDMP_EOM_MAGIC, len) == 0) {
- reply.error = NDMP_EOM_ERR;
- (void) ndmp_mtioctl(session->ns_tape.td_fd, MTFSF, 1);
- NDMP_LOG(LOG_DEBUG, "NDMP_EOM_ERR");
- } else {
- session->ns_tape.td_pos += n;
- reply.data_in.data_in_len = n;
- reply.data_in.data_in_val = buf;
- reply.error = NDMP_NO_ERR;
- }
+ session->ns_tape.td_pos += n;
+ reply.data_in.data_in_len = n;
+ reply.data_in.data_in_val = buf;
+ reply.error = NDMP_NO_ERR;
NS_ADD(rtape, n);
}
@@ -1058,21 +1012,17 @@ ndmpd_tape_get_state_v4(ndmp_connection_t *connection, void *body)
if (dtp.bsize == 0)
reply.blockno = mtstatus.mt_blkno;
else
- reply.blockno = mtstatus.mt_blkno *
+ reply.blockno = mtstatus.mt_blkno /
(session->ns_mover.md_record_size / dtp.bsize);
- reply.total_space = long_long_to_quad(0); /* not supported */
- reply.space_remain = long_long_to_quad(0); /* not supported */
-
+ reply.total_space = long_long_to_quad(0LL); /* not supported */
+ reply.space_remain = long_long_to_quad(0LL); /* not supported */
reply.soft_errors = 0;
- reply.total_space = long_long_to_quad(0LL);
- reply.space_remain = long_long_to_quad(0LL);
reply.unsupported = NDMP_TAPE_STATE_SOFT_ERRORS_INVALID |
NDMP_TAPE_STATE_TOTAL_SPACE_INVALID |
NDMP_TAPE_STATE_SPACE_REMAIN_INVALID |
NDMP_TAPE_STATE_PARTITION_INVALID;
-
NDMP_LOG(LOG_DEBUG, "f 0x%x, fnum %d, bsize %d, bno: %d",
reply.flags, reply.file_num, reply.block_size, reply.blockno);
@@ -1366,7 +1316,6 @@ common_tape_open(ndmp_connection_t *connection, char *devname, int ndmpmode)
session->ns_tape.td_lun = lun;
(void) strlcpy(session->ns_tape.td_adapter_name, adptnm, SCSI_MAX_NAME);
session->ns_tape.td_record_count = 0;
- session->ns_tape.td_eom_seen = FALSE;
NDMP_LOG(LOG_DEBUG, "Tape is opened fd: %d", session->ns_tape.td_fd);
@@ -1397,11 +1346,9 @@ common_tape_close(ndmp_connection_t *connection)
session->ns_tape.td_fd = -1;
session->ns_tape.td_sid = 0;
session->ns_tape.td_lun = 0;
- session->ns_tape.td_write = 0;
(void) memset(session->ns_tape.td_adapter_name, 0,
sizeof (session->ns_tape.td_adapter_name));
session->ns_tape.td_record_count = 0;
- session->ns_tape.td_eom_seen = FALSE;
reply.error = NDMP_NO_ERR;
ndmp_send_reply(connection, (void *) &reply,
diff --git a/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c b/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c
index f7dc1023d6..eac85c38b2 100644
--- a/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c
+++ b/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c
@@ -238,6 +238,7 @@ flt_handler(int sig)
case SIGXRES:
case SIGJVM1:
case SIGJVM2:
+ case SIGINFO:
/* No need to abort */
break;
default:
diff --git a/usr/src/cmd/ttymon/stty.c b/usr/src/cmd/ttymon/stty.c
index fd4013d313..bfccdd3cc0 100644
--- a/usr/src/cmd/ttymon/stty.c
+++ b/usr/src/cmd/ttymon/stty.c
@@ -22,6 +22,7 @@
/*
* Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
/*
@@ -30,8 +31,6 @@
*
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
@@ -115,7 +114,7 @@ main(int argc, char *argv[])
if (read(fd, (void *)&cswp, sizeof (cswp)) <
sizeof (cswp)) {
(void) fprintf(stderr, gettext(
- "cannot read entier %s file\n"), tmps);
+ "cannot read entire %s file\n"), tmps);
exit(2);
}
@@ -173,14 +172,14 @@ main(int argc, char *argv[])
return (0);
default:
(void) fprintf(stderr, gettext(
- "usage: stty [-a| -g]\n"));
+ "usage: stty [-a| -g]\n"));
(void) fprintf(stderr, gettext(
- " stty [modes]\n"));
+ " stty [modes]\n"));
return (2);
}
if ((argc == 3) && (argv[1][0] == '-') && (argv[1][2] == '\0') &&
- (argv[2][0] == '-') && (argv[2][1] == '-') && (argv[2][2] == '\0'))
+ (argv[2][0] == '-') && (argv[2][1] == '-') && (argv[2][2] == '\0'))
switch (argv[1][1]) {
case 'a':
pramodes();
@@ -190,13 +189,13 @@ main(int argc, char *argv[])
return (0);
default:
(void) fprintf(stderr, gettext(
- "usage: stty [-a| -g]\n"));
+ "usage: stty [-a| -g]\n"));
(void) fprintf(stderr, gettext(
- " stty [modes]\n"));
+ " stty [modes]\n"));
return (2);
}
if ((argc >= 3) && (argv[1][0] == '-') && (argv[1][1] == '-') &&
- (argv[1][2] == '\0')) {
+ (argv[1][2] == '\0')) {
/* ignore -- */
--argc;
++argv;
@@ -211,8 +210,9 @@ main(int argc, char *argv[])
for (i = 0; not_supported[i]; i++) {
if (strcmp(not_supported[i], s) == 0) {
(void) fprintf(stderr,
- gettext(
- "mode not supported on this device: %s\n"), s_arg);
+ gettext(
+ "mode not supported on this device: %s\n"),
+ s_arg);
exit(2);
}
}
@@ -306,11 +306,11 @@ prmodes(void) /* print modes, no options, argc is 1 */
if (ocb.c_line != 0)
(void) printf(gettext("line = %d; "), ocb.c_line);
if (term & WINDOW) {
+ (void) printf(gettext("rows = %d; columns = %d;"),
+ winsize.ws_row, winsize.ws_col);
(void) printf(gettext(
- "rows = %d; columns = %d;"), winsize.ws_row, winsize.ws_col);
- (void) printf(gettext(
- " ypixels = %d; xpixels = %d;\n"),
- winsize.ws_ypixel, winsize.ws_xpixel);
+ " ypixels = %d; xpixels = %d;\n"),
+ winsize.ws_ypixel, winsize.ws_xpixel);
}
if ((cb.c_lflag&ICANON) == 0)
(void) printf(gettext("min = %d; time = %d;\n"),
@@ -348,6 +348,8 @@ prmodes(void) /* print modes, no options, argc is 1 */
pit(cb.c_cc[VWERASE], "werase", "; ");
if (cb.c_cc[VLNEXT] != CLNEXT)
pit(cb.c_cc[VLNEXT], "lnext", "; ");
+ if (cb.c_cc[VSTATUS] != CSTATUS)
+ pit(cb.c_cc[VSTATUS], "status", "; ");
}
if (pitt) (void) printf("\n");
m = cb.c_iflag;
@@ -453,41 +455,41 @@ prmodes(void) /* print modes, no options, argc is 1 */
m = termiox.x_cflag;
switch (m & XMTCLK) {
case XCIBRG: (void)printf("xcibrg ");
- break;
+ break;
case XCTSET: (void)printf("xctset ");
- break;
+ break;
case XCRSET: (void)printf("xcrset ");
}
switch (m & RCVCLK) {
case RCIBRG: (void)printf("rcibrg ");
- break;
+ break;
case RCTSET: (void)printf("rctset ");
- break;
+ break;
case RCRSET: (void)printf("rcrset ");
}
switch (m & TSETCLK) {
case TSETCOFF: (void)printf("tsetcoff ");
- break;
+ break;
case TSETCRBRG: (void)printf("tsetcrbrg ");
- break;
+ break;
case TSETCTBRG: (void)printf("tsetctbrg ");
- break;
+ break;
case TSETCTSET: (void)printf("tsetctset ");
- break;
+ break;
case TSETCRSET: (void)printf("tsetcrset ");
}
switch (m & RSETCLK) {
case RSETCOFF: (void)printf("rsetcoff ");
- break;
+ break;
case RSETCRBRG: (void)printf("rsetcrbrg ");
- break;
+ break;
case RSETCTBRG: (void)printf("rsetctbrg ");
- break;
+ break;
case RSETCTSET: (void)printf("rsetctset ");
- break;
+ break;
case RSETCRSET: (void)printf("rsetcrset ");
}
(void) printf("\n");
@@ -512,10 +514,10 @@ pramodes(void) /* print all modes, -a option */
(void) printf("\n");
if (term & WINDOW) {
(void) printf(gettext("rows = %d; columns = %d;"),
- winsize.ws_row, winsize.ws_col);
+ winsize.ws_row, winsize.ws_col);
(void) printf(gettext(
- " ypixels = %d; xpixels = %d;\n"),
- winsize.ws_ypixel, winsize.ws_xpixel);
+ " ypixels = %d; xpixels = %d;\n"),
+ winsize.ws_ypixel, winsize.ws_xpixel);
}
#ifdef EUC
if ((term & CSIW) && kcswp.locale_name[0]) {
@@ -529,15 +531,15 @@ pramodes(void) /* print all modes, -a option */
*/
if ((term & EUCW) && kwp.eucw[0]) {
(void) printf("eucw %d:%d:%d:%d, ", kwp.eucw[0],
- kwp.eucw[1], kwp.eucw[2], kwp.eucw[3]);
+ kwp.eucw[1], kwp.eucw[2], kwp.eucw[3]);
(void) printf("scrw %d:%d:%d:%d\n", kwp.scrw[0],
- kwp.scrw[1], kwp.scrw[2], kwp.scrw[3]);
+ kwp.scrw[1], kwp.scrw[2], kwp.scrw[3]);
} else
(void) printf("eucw ?, scrw ?\n");
#endif /* EUC */
if ((cb.c_lflag&ICANON) == 0)
(void) printf(gettext("min = %d; time = %d;\n"),
- cb.c_cc[VMIN], cb.c_cc[VTIME]);
+ cb.c_cc[VMIN], cb.c_cc[VTIME]);
pit(cb.c_cc[VINTR], "intr", "; ");
pit(cb.c_cc[VQUIT], "quit", "; ");
pit(cb.c_cc[VERASE], "erase", "; ");
@@ -555,6 +557,7 @@ pramodes(void) /* print all modes, -a option */
pit(cb.c_cc[VDISCARD], "flush", "; ");
pit(cb.c_cc[VWERASE], "werase", "; ");
pit(cb.c_cc[VLNEXT], "lnext", ";\n");
+ pit(cb.c_cc[VSTATUS], "status", ";\n");
}
} else
pit((unsigned)stio.tab, "ctab", "\n");
@@ -644,41 +647,41 @@ pramodes(void) /* print all modes, -a option */
m = termiox.x_cflag;
switch (m & XMTCLK) {
case XCIBRG: (void)printf("xcibrg ");
- break;
+ break;
case XCTSET: (void)printf("xctset ");
- break;
+ break;
case XCRSET: (void)printf("xcrset ");
}
switch (m & RCVCLK) {
case RCIBRG: (void)printf("rcibrg ");
- break;
+ break;
case RCTSET: (void)printf("rctset ");
- break;
+ break;
case RCRSET: (void)printf("rcrset ");
}
switch (m & TSETCLK) {
case TSETCOFF: (void)printf("tsetcoff ");
- break;
+ break;
case TSETCRBRG: (void)printf("tsetcrbrg ");
- break;
+ break;
case TSETCTBRG: (void)printf("tsetctbrg ");
- break;
+ break;
case TSETCTSET: (void)printf("tsetctset ");
- break;
+ break;
case TSETCRSET: (void)printf("tsetcrset ");
}
switch (m & RSETCLK) {
case RSETCOFF: (void)printf("rsetcoff ");
- break;
+ break;
case RSETCRBRG: (void)printf("rsetcrbrg ");
- break;
+ break;
case RSETCTBRG: (void)printf("rsetctbrg ");
- break;
+ break;
case RSETCTSET: (void)printf("rsetctset ");
- break;
+ break;
case RSETCRSET: (void)printf("rsetcrset ");
}
(void) printf("\n");
@@ -693,7 +696,7 @@ pit(unsigned char what, char *itsname, char *sep)
pitt++;
(void) printf("%s", itsname);
if ((term & TERMIOS) && what == _POSIX_VDISABLE ||
- !(term & TERMIOS) && what == 0200) {
+ !(term & TERMIOS) && what == 0200) {
(void) printf(" = <undef>%s", sep);
return;
}
@@ -753,7 +756,7 @@ prencode(void) /* another stty cmd, used for -g option */
* output, control, and line discipline modes.
*/
(void) printf("%x:%x:%x:%x", cb.c_iflag, cb.c_oflag, cb.c_cflag,
- cb.c_lflag);
+ cb.c_lflag);
/* Print the control character fields. */
if (term & TERMIOS)
@@ -771,7 +774,7 @@ prencode(void) /* another stty cmd, used for -g option */
* structure.
*/
(void) printf(":%x:%x:%x:", kcswp.version, kcswp.codeset_type,
- kcswp.csinfo_num);
+ kcswp.csinfo_num);
if (*kcswp.locale_name == '\0') {
(void) printf("00");
} else {
@@ -780,10 +783,10 @@ prencode(void) /* another stty cmd, used for -g option */
}
for (i = 0; i < LDTERM_CS_MAX_CODESETS; i++)
(void) printf(":%x:%x:%x:%x",
- kcswp.eucpc_data[i].byte_length,
- kcswp.eucpc_data[i].screen_width,
- kcswp.eucpc_data[i].msb_start,
- kcswp.eucpc_data[i].msb_end);
+ kcswp.eucpc_data[i].byte_length,
+ kcswp.eucpc_data[i].screen_width,
+ kcswp.eucpc_data[i].msb_start,
+ kcswp.eucpc_data[i].msb_end);
} else {
#endif /* EUC */
for (i = 0; i < last; i++)
diff --git a/usr/src/cmd/ttymon/sttyparse.c b/usr/src/cmd/ttymon/sttyparse.c
index 515fc86164..03eccb8011 100644
--- a/usr/src/cmd/ttymon/sttyparse.c
+++ b/usr/src/cmd/ttymon/sttyparse.c
@@ -22,6 +22,7 @@
/*
* Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
/*
@@ -30,8 +31,6 @@
*
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -130,6 +129,8 @@ sttyparse(int argc, char *argv[], int term, struct termio *ocb,
cb->c_cc[VWERASE] = gct(*++argv, term);
else if (eq("lnext") && --argc)
cb->c_cc[VLNEXT] = gct(*++argv, term);
+ else if (eq("status") && --argc)
+ cb->c_cc[VSTATUS] = gct(*++argv, term);
}
if (match)
continue;
@@ -137,7 +138,7 @@ sttyparse(int argc, char *argv[], int term, struct termio *ocb,
cb->c_cc[VERASE] = CERASE;
cb->c_cc[VKILL] = CKILL;
} else if (eq("line") &&
- !(term & TERMIOS) && --argc) {
+ !(term & TERMIOS) && --argc) {
ocb->c_line = atoi(*++argv);
continue;
} else if (eq("raw")) {
@@ -153,6 +154,7 @@ sttyparse(int argc, char *argv[], int term, struct termio *ocb,
cb->c_cc[VINTR] = CINTR;
cb->c_cc[VEOF] = CEOF;
cb->c_cc[VEOL] = CNUL;
+ cb->c_cc[VSTATUS] = CSTATUS;
/* SWTCH purposely not set */
#ifdef EUC
} else if (eq("defeucw")) {
@@ -173,7 +175,7 @@ sttyparse(int argc, char *argv[], int term, struct termio *ocb,
(unsigned char)(wp->_scrw3 & 0177);
(void) memcpy((void *)kcswp, (const void *)cswp,
- sizeof (ldterm_cs_data_user_t));
+ sizeof (ldterm_cs_data_user_t));
#endif /* EUC */
} else if ((term & TERMIOS) && eq("ospeed") && --argc) {
s_arg = *++argv;
@@ -224,7 +226,7 @@ sttyparse(int argc, char *argv[], int term, struct termio *ocb,
cb->c_iflag |= imodes[i].set;
#ifdef EUC
if (wp->_multibyte &&
- (eq("-raw") || eq("cooked") || eq("sane")))
+ (eq("-raw") || eq("cooked") || eq("sane")))
cb->c_iflag &= ~ISTRIP;
#endif /* EUC */
}
@@ -251,7 +253,8 @@ sttyparse(int argc, char *argv[], int term, struct termio *ocb,
cb->c_cflag |= cmodes[i].set;
#ifdef EUC
if (wp->_multibyte &&
- (eq("-raw") || eq("cooked") || eq("sane"))) {
+ (eq("-raw") || eq("cooked") ||
+ eq("sane"))) {
cb->c_cflag &= ~(CS7|PARENB);
cb->c_cflag |= CS8;
}
@@ -477,7 +480,7 @@ set_ttymode(int fd, int term, struct termio *termio, struct termios *termios,
cmd.ic_dp = (char *)kcswp;
if (ioctl(fd, I_STR, &cmd) != 0) {
(void) fprintf(stderr, gettext(
- "stty: can't set codeset width.\n"));
+ "stty: can't set codeset width.\n"));
return (-1);
}
} else if (term & EUCW) {
@@ -487,7 +490,7 @@ set_ttymode(int fd, int term, struct termio *termio, struct termios *termios,
cmd.ic_dp = (char *)kwp;
if (ioctl(fd, I_STR, &cmd) != 0) {
(void) fprintf(stderr, gettext(
- "stty: can't set EUC codeset width.\n"));
+ "stty: can't set EUC codeset width.\n"));
return (-1);
}
}
@@ -545,7 +548,7 @@ parse_encoded(struct termios *cb
r = strdup(s_arg);
if (r == (char *)NULL) {
(void) fprintf(stderr, gettext(
- "no more memory - try again later\n"));
+ "no more memory - try again later\n"));
return (0);
}
t = strtok(r, ":");
@@ -601,7 +604,7 @@ parse_encoded(struct termios *cb
s[0] = *t++;
s[1] = *t++;
ecswp.locale_name[i] = (char)strtol(s, (char **)NULL,
- 16);
+ 16);
}
if (i >= MAXNAMELEN) {
free((void *)r);
@@ -625,7 +628,7 @@ parse_encoded(struct termios *cb
/* We got the 'ecswp' all filled up now; let's copy. */
(void) memcpy((void *)kcswp, (const void *)&ecswp,
- sizeof (ldterm_cs_data_user_t));
+ sizeof (ldterm_cs_data_user_t));
}
#endif /* EUC */
diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile
index c4a931a0a8..265d45030c 100644
--- a/usr/src/lib/Makefile
+++ b/usr/src/lib/Makefile
@@ -157,8 +157,7 @@ SUBDIRS += \
librdc \
libinstzones \
libpkg \
- libpcidb \
- libumem_trampoline
+ libpcidb
SUBDIRS += \
passwdutil \
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 396c536387..873c2ded87 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -1121,6 +1121,7 @@ TIL= \
thread_pool.o \
thrp_unwind.o \
tls.o \
+ tmem.o \
tsd.o
$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
diff --git a/usr/src/lib/libc/amd64/gen/siginfolst.c b/usr/src/lib/libc/amd64/gen/siginfolst.c
index 17cad14cf6..8451dfbb4f 100644
--- a/usr/src/lib/libc/amd64/gen/siginfolst.c
+++ b/usr/src/lib/libc/amd64/gen/siginfolst.c
@@ -171,6 +171,7 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = {
0, 0, /* SIGXRES */
0, 0, /* SIGJVM1 */
0, 0, /* SIGJVM2 */
+ 0, 0, /* SIGINFO */
0, 0, /* SIGRTMIN */
0, 0, /* SIGRTMIN+1 */
0, 0, /* SIGRTMIN+2 */
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index d5826d8e45..d91540d0ae 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
@@ -1179,6 +1180,7 @@ TIL= \
thread_pool.o \
tls.o \
tsd.o \
+ tmem.o \
unwind.o
THREADS_INLINES = $(LIBCBASE)/threads/i386.il
diff --git a/usr/src/lib/libc/i386/gen/siginfolst.c b/usr/src/lib/libc/i386/gen/siginfolst.c
index 17cad14cf6..8451dfbb4f 100644
--- a/usr/src/lib/libc/i386/gen/siginfolst.c
+++ b/usr/src/lib/libc/i386/gen/siginfolst.c
@@ -171,6 +171,7 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = {
0, 0, /* SIGXRES */
0, 0, /* SIGJVM1 */
0, 0, /* SIGJVM2 */
+ 0, 0, /* SIGINFO */
0, 0, /* SIGRTMIN */
0, 0, /* SIGRTMIN+1 */
0, 0, /* SIGRTMIN+2 */
diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h
index 5f67e760e2..de0d4a6b05 100644
--- a/usr/src/lib/libc/inc/thr_uberdata.h
+++ b/usr/src/lib/libc/inc/thr_uberdata.h
@@ -23,7 +23,7 @@
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#ifndef _THR_UBERDATA_H
@@ -494,7 +494,8 @@ typedef struct {
* As part of per-thread caching libumem (ptcumem), we add a small amount to the
* thread's uberdata to facilitate it. The tm_roots are the roots of linked
* lists which is used by libumem to chain together allocations. tm_size is used
- * to track the total amount of data stored across those linked lists.
+ * to track the total amount of data stored across those linked lists. For more
+ * information, see libumem's big theory statement.
*/
#define NTMEMBASE 16
diff --git a/usr/src/lib/libc/port/gen/siglist.c b/usr/src/lib/libc/port/gen/siglist.c
index 1795632f44..441cc4c2c5 100644
--- a/usr/src/lib/libc/port/gen/siglist.c
+++ b/usr/src/lib/libc/port/gen/siglist.c
@@ -111,6 +111,7 @@ static const char *_sys_siglist_data[NSIG] = {
"Resource Control Exceeded", /* SIGXRES */
"Reserved for JVM 1", /* SIGJVM1 */
"Reserved for JVM 2", /* SIGJVM2 */
+ "Information Request", /* SIGINFO */
"First Realtime Signal", /* SIGRTMIN */
"Second Realtime Signal", /* SIGRTMIN+1 */
"Third Realtime Signal", /* SIGRTMIN+2 */
diff --git a/usr/src/lib/libc/port/gen/str2sig.c b/usr/src/lib/libc/port/gen/str2sig.c
index ac4bde9762..e0c4e89d68 100644
--- a/usr/src/lib/libc/port/gen/str2sig.c
+++ b/usr/src/lib/libc/port/gen/str2sig.c
@@ -22,6 +22,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1988 AT&T */
@@ -84,6 +85,7 @@ static signame_t signames[] = {
{ "XRES", SIGXRES },
{ "JVM1", SIGJVM1 },
{ "JVM2", SIGJVM2 },
+ { "INFO", SIGINFO },
{ "RTMIN", _SIGRTMIN },
{ "RTMIN+1", _SIGRTMIN+1 },
{ "RTMIN+2", _SIGRTMIN+2 },
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index 585c47328d..86adb85d94 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -26,6 +26,7 @@
#
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2013 Gary Mills
#
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index 4840990414..c8779479d3 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
diff --git a/usr/src/lib/libc/sparc/gen/siginfolst.c b/usr/src/lib/libc/sparc/gen/siginfolst.c
index 17cad14cf6..8451dfbb4f 100644
--- a/usr/src/lib/libc/sparc/gen/siginfolst.c
+++ b/usr/src/lib/libc/sparc/gen/siginfolst.c
@@ -171,6 +171,7 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = {
0, 0, /* SIGXRES */
0, 0, /* SIGJVM1 */
0, 0, /* SIGJVM2 */
+ 0, 0, /* SIGINFO */
0, 0, /* SIGRTMIN */
0, 0, /* SIGRTMIN+1 */
0, 0, /* SIGRTMIN+2 */
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 669e06395c..7f4a6e4e38 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
diff --git a/usr/src/lib/libc/sparcv9/gen/siginfolst.c b/usr/src/lib/libc/sparcv9/gen/siginfolst.c
index 17cad14cf6..8451dfbb4f 100644
--- a/usr/src/lib/libc/sparcv9/gen/siginfolst.c
+++ b/usr/src/lib/libc/sparcv9/gen/siginfolst.c
@@ -171,6 +171,7 @@ static const struct siginfolist _sys_siginfolist_data[NSIG-1] = {
0, 0, /* SIGXRES */
0, 0, /* SIGJVM1 */
0, 0, /* SIGJVM2 */
+ 0, 0, /* SIGINFO */
0, 0, /* SIGRTMIN */
0, 0, /* SIGRTMIN+1 */
0, 0, /* SIGRTMIN+2 */
diff --git a/usr/src/lib/libshell/common/data/signals.c b/usr/src/lib/libshell/common/data/signals.c
index bac1031045..2eb4eda145 100644
--- a/usr/src/lib/libshell/common/data/signals.c
+++ b/usr/src/lib/libshell/common/data/signals.c
@@ -104,6 +104,9 @@ const struct shtable2 shtab_signals[] =
#endif /* SIGGRANT */
"HUP", VAL(SIGHUP,SH_SIGDONE), S("Hangup"),
"ILL", VAL(SIGILL,SH_SIGDONE), S("Illegal instruction"),
+#ifdef SIGINFO
+ "INFO", VAL(SIGINFO,SH_SIGIGNORE), S("Information request"),
+#endif /*SIGINFO */
#ifdef JOBS
"INT", VAL(SIGINT,SH_SIGINTERACTIVE), S("Interrupt"),
#else
diff --git a/usr/src/lib/libumem/Makefile.com b/usr/src/lib/libumem/Makefile.com
index 9c10ded585..61f7e9503d 100644
--- a/usr/src/lib/libumem/Makefile.com
+++ b/usr/src/lib/libumem/Makefile.com
@@ -119,8 +119,6 @@ MAPFILE_SUPPLEMENTAL = $(MAPFILE_SUPPLEMENTAL_$(CURTYPE))
LDLIBS += -lc
-DYNFLAGS += -Wl,-Plibumem_trampoline.so.1
-
LDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -M../common/mapfile-vers \
-M$(MAPFILE_SUPPLEMENTAL) -dy -r
LDFLAGS = $(LDFLAGS_$(CURTYPE))
@@ -146,6 +144,7 @@ DTS_ERRNO=
STAND_RENAMED_FUNCS= \
atomic_add_64 \
atomic_add_32_nv \
+ atomic_swap_64 \
snprintf \
vsnprintf
diff --git a/usr/src/lib/libumem/amd64/umem_genasm.c b/usr/src/lib/libumem/amd64/umem_genasm.c
index 7dad57505b..ba68cb2d37 100644
--- a/usr/src/lib/libumem/amd64/umem_genasm.c
+++ b/usr/src/lib/libumem/amd64/umem_genasm.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
/*
@@ -69,18 +69,18 @@
#include <umem_impl.h>
#include "umem_base.h"
-int umem_genasm_supported = 1;
-uintptr_t umem_genasm_mptr;
-uintptr_t umem_genasm_msize;
-uintptr_t umem_genasm_fptr;
-uintptr_t umem_genasm_fsize;
-static uintptr_t umem_genasm_omptr;
-static uintptr_t umem_genasm_ofptr;
+const int umem_genasm_supported = 1;
+static uintptr_t umem_genasm_mptr = (uintptr_t)&_malloc;
+static size_t umem_genasm_msize = 576;
+static uintptr_t umem_genasm_fptr = (uintptr_t)&_free;
+static size_t umem_genasm_fsize = 576;
+static uintptr_t umem_genasm_omptr = (uintptr_t)umem_malloc;
+static uintptr_t umem_genasm_ofptr = (uintptr_t)umem_malloc_free;
#define UMEM_GENASM_MAX64 (UINT32_MAX / sizeof (uintptr_t))
#define PTC_JMPADDR(dest, src) (dest - (src + 4))
#define PTC_ROOT_SIZE sizeof (uintptr_t)
-#define MULTINOP 0x0000441f0f
+#define MULTINOP 0x0000441f0f
/*
* void *ptcmalloc(size_t orig_size);
@@ -550,11 +550,10 @@ umem_genasm(int *cp, umem_cache_t **caches, int nc)
int nents, i;
uint8_t *mptr;
uint8_t *fptr;
- uint32_t *ptr;
uint64_t v, *vptr;
- mptr = (void *)((uintptr_t)&umem_genasm_mptr + 5);
- fptr = (void *)((uintptr_t)&umem_genasm_fptr + 5);
+ mptr = (void *)((uintptr_t)umem_genasm_mptr + 5);
+ fptr = (void *)((uintptr_t)umem_genasm_fptr + 5);
if (umem_genasm_mptr == 0 || umem_genasm_msize == 0 ||
umem_genasm_fptr == 0 || umem_genasm_fsize == 0)
return (1);
@@ -563,7 +562,7 @@ umem_genasm(int *cp, umem_cache_t **caches, int nc)
* The total number of caches that we can service is the minimum of:
* o the amount supported by libc
* o the total number of umem caches
- * o we use a single byte addl, so its MAX_UINT32 / sizeof (uintptr_t).
+ * o we use a single byte addl, so it's MAX_UINT32 / sizeof (uintptr_t)
* For 64-bit, this is MAX_UINT32 >> 3, a lot.
*/
nents = _tmem_get_nentries();
@@ -578,30 +577,24 @@ umem_genasm(int *cp, umem_cache_t **caches, int nc)
if (nents == 0 || umem_ptc_size == 0)
return (0);
- /* Grab the original malloc and free locations */
- ptr = (void *)(mptr - 4);
- umem_genasm_omptr = *ptr + (uintptr_t)mptr;
- ptr = (void *)(fptr - 4);
- umem_genasm_ofptr = *ptr + (uintptr_t)fptr;
-
/* Take into account the jump */
- if (genasm_malloc(mptr, umem_genasm_fsize - 5, nents, cp) != 0)
+ if (genasm_malloc(mptr, umem_genasm_msize, nents, cp) != 0)
return (1);
- if (genasm_free(fptr, umem_genasm_fsize - 5, nents, cp) != 0)
+ if (genasm_free(fptr, umem_genasm_fsize, nents, cp) != 0)
return (1);
+
/* nop out the jump with a multibyte jump */
- vptr = (void *)&umem_genasm_mptr;
+ vptr = (void *)umem_genasm_mptr;
v = MULTINOP;
v |= *vptr & (0xffffffULL << 40);
(void) atomic_swap_64(vptr, v);
- vptr = (void *)&umem_genasm_fptr;
+ vptr = (void *)umem_genasm_fptr;
v = MULTINOP;
v |= *vptr & (0xffffffULL << 40);
(void) atomic_swap_64(vptr, v);
-
for (i = 0; i < nents; i++)
caches[i]->cache_flags |= UMF_PTC;
diff --git a/usr/src/lib/libumem/common/envvar.c b/usr/src/lib/libumem/common/envvar.c
index 2fdf7824c3..0c4d872814 100644
--- a/usr/src/lib/libumem/common/envvar.c
+++ b/usr/src/lib/libumem/common/envvar.c
@@ -22,7 +22,6 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2012 Joyent, Inc. All rights reserved.
*/
/*
diff --git a/usr/src/lib/libumem/common/linktest_stand.c b/usr/src/lib/libumem/common/linktest_stand.c
index 8ae9fdbec8..dd8333828b 100644
--- a/usr/src/lib/libumem/common/linktest_stand.c
+++ b/usr/src/lib/libumem/common/linktest_stand.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file is used to verify that the standalone's external dependencies
* haven't changed in a way that'll break things that use it.
@@ -34,6 +32,7 @@
void __umem_assert_failed(void) {}
void atomic_add_64(void) {}
void atomic_add_32_nv(void) {}
+void atomic_swap_64(void) {}
void dladdr1(void) {}
void bcopy(void) {}
void bzero(void) {}
diff --git a/usr/src/lib/libumem/common/malloc.c b/usr/src/lib/libumem/common/malloc.c
index 906f369d29..3d19e5b320 100644
--- a/usr/src/lib/libumem/common/malloc.c
+++ b/usr/src/lib/libumem/common/malloc.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h>
#include <errno.h>
#include <string.h>
@@ -50,8 +48,17 @@ typedef struct malloc_data {
uint32_t malloc_stat; /* = UMEM_MALLOC_ENCODE(state, malloc_size) */
} malloc_data_t;
+/*
+ * Because we do not support ptcumem on non-x86 today, we have to create these
+ * weak aliases.
+ */
+#ifndef _x86
+#pragma weak malloc = umem_malloc
+#pragma weak free = umem_malloc_free
+#endif /* !_x86 */
+
void *
-malloc(size_t size_arg)
+umem_malloc(size_t size_arg)
{
#ifdef _LP64
uint32_t high_size = 0;
@@ -369,7 +376,7 @@ process_memalign:
}
void
-free(void *buf)
+umem_malloc_free(void *buf)
{
if (buf == NULL)
return;
diff --git a/usr/src/lib/libumem/common/mapfile-vers b/usr/src/lib/libumem/common/mapfile-vers
index 6a05f0cfaa..888a1570f2 100644
--- a/usr/src/lib/libumem/common/mapfile-vers
+++ b/usr/src/lib/libumem/common/mapfile-vers
@@ -39,6 +39,17 @@
$mapfile_version 2
+$if _x86
+LOAD_SEGMENT umem {
+ FLAGS = READ WRITE EXECUTE;
+ ASSIGN_SECTION {
+ IS_NAME = .text;
+ FILE_BASENAME = asm_subr.o
+ };
+};
+$endif
+
+
SYMBOL_VERSION SUNW_1.1 {
global:
calloc { FLAGS = NODIRECT };
@@ -73,10 +84,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
vmem_walk;
vmem_xalloc;
vmem_xfree;
- umem_genasm_mptr;
- umem_genasm_fptr;
- umem_genasm_fsize;
- umem_genasm_msize;
local:
*;
};
diff --git a/usr/src/lib/libumem/common/stub_stand.c b/usr/src/lib/libumem/common/stub_stand.c
index 1a90c6be75..2c82364ef1 100644
--- a/usr/src/lib/libumem/common/stub_stand.c
+++ b/usr/src/lib/libumem/common/stub_stand.c
@@ -146,11 +146,3 @@ void
_tmem_set_cleanup(void (*f)(int, void *))
{
}
-
-uint64_t
-atomic_swap_64(volatile uint64_t *t, uint64_t v)
-{
- uint64_t old = *t;
- *t = v;
- return (old);
-}
diff --git a/usr/src/lib/libumem/common/umem.c b/usr/src/lib/libumem/common/umem.c
index e22106e979..00028e5f80 100644
--- a/usr/src/lib/libumem/common/umem.c
+++ b/usr/src/lib/libumem/common/umem.c
@@ -25,7 +25,7 @@
*/
/*
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014 Joyent, Inc. All rights reserved.
*/
/*
@@ -411,6 +411,13 @@
* entry in a given root's list will be able to satisfy the same requests as the
* corresponding cache.
*
+ * The choice of sixteen roots is based on where we believe we get the biggest
+ * bang for our buck. The per-thread caches will cache up to 256 byte and 448
+ * byte allocations on ILP32 and LP64 respectively. Generally applications plan
+ * more carefully how they do larger allocations than smaller ones. Therefore
+ * sixteen roots is a reasonable compromise between the amount of additional
+ * overhead per thread, and the likelihood of a program to benefit from it.
+ *
* The maximum amount of memory that can be cached in each thread is determined
* by the perthread_cache UMEM_OPTION. It corresponds to the umem_ptc_size
* value. The default value for this is currently 1 MB. Once umem_init() has
@@ -476,29 +483,18 @@
* -----------------------------------------------
*
* The last piece of this puzzle is how we actually jam ptcmalloc() into the
- * PLT. The dyanmic linker has support for global and local audit libraries.
- * For the full explanation of audit libraries consult the Linkers and Libraries
- * guide or the linker source. A local auditer can attach to a single library
- * and interpose on all of the relocations that come in from and leave to that
- * same library. To facilitate our work, we have created a local audit library
- * for libumem that is called libumem_trampoline and is located in
- * lib/libumem_trampoline/.
- *
- * When any resolution is done to malloc(), the audit library allows us to
- * replace the address with an address that it specifies. There are two 4k
- * sections in the libumem_trampoline's bss which we use as the stomping grounds
- * for ptcmalloc and ptcfree. When the audit library audits the malloc and free
- * functions from libumem, it encodes their address and sets its buffers to
- * contain a simple trampoline which consists of a jmp instruction and a four
- * byte offset to the original malloc and free. libumem_trampoline's mapfile
- * explicitly makes its bss rwx instead of rw to support this.
- *
- * When umem_genasm() is called, it uses a similar mechanism to get the address
- * and size of the trampoline libraries malloc (mbuf) and free (fbuf) buffers.
- * After validating that the size will be able to contain all of the
- * instructions, it starts laying out ptcmalloc and ptcfree at mbuf[4] and
- * fbuf[4]. Once both have been successfully generated, umem_genasm() stores a
- * single five byte nop over the original jump.
+ * PLT. To handle this, we have defined two functions, _malloc and _free and
+ * used a special mapfile directive to place them into the a readable,
+ * writeable, and executable segment. Next we use a standard #pragma weak for
+ * malloc and free and direct them to those symbols. By default, those symbols
+ * have text defined as nops for our generated functions and when they're
+ * invoked, they jump to the default malloc and free functions.
+ *
+ * When umem_genasm() is called, it goes through and generates new malloc() and
+ * free() functions in the text provided for by _malloc and _free just after the
+ * jump. Once both have been successfully generated, umem_genasm() nops over the
+ * original jump so that we now call into the genasm versions of these
+ * functions.
*
* 8.3 umem_genasm()
* -----------------
@@ -547,12 +543,11 @@
* o. umem_genasm_fsize: The size in bytes of the above buffer
*
* Finally, to enable the generated assembly we need to remove the previous jump
- * to the actual malloc that exists at the start of these buffers. This is a
- * five byte region. We could zero out the jump offset to be a jmp +0, but
- * using nops can be faster. We specifically use a single five byte nop which is
- * faster. The opcode for the five byte nop is 0x 0f 1f 44 00 00. On x86,
- * remember integers are little endian, so it will be written the other way
- * around.
+ * to the actual malloc that exists at the start of these buffers. On x86, this
+ * is a five byte region. We could zero out the jump offset to be a jmp +0, but
+ * using nops can be faster. We specifically use a single five byte nop on x86
+ * as it is faster. When porting ptcumem to other architectures, the various
+ * opcode changes and options should be analyzed.
*
* 8.4 Interface with libc.so
* --------------------------
@@ -560,7 +555,7 @@
* The tmem_t structure as described in the beginning of section 8, is part of a
* private interface with libc. There are three functions that exist to cover
* this. They are not documented in man pages or header files. They are in the
- * SUNWprivate part of libc's makefile.
+ * SUNWprivate part of libc's mapfile.
*
* o. _tmem_get_base(void)
*
diff --git a/usr/src/lib/libumem/common/umem_base.h b/usr/src/lib/libumem/common/umem_base.h
index 26e00bc282..c845331fbc 100644
--- a/usr/src/lib/libumem/common/umem_base.h
+++ b/usr/src/lib/libumem/common/umem_base.h
@@ -146,9 +146,17 @@ void umem_process_envvars(void);
/*
* umem_genasm.c: private interfaces
*/
-extern int umem_genasm_supported;
+extern const int umem_genasm_supported;
extern int umem_genasm(int *, umem_cache_t **, int);
+/*
+ * malloc.c: traditional malloc/free interface for genasm
+ */
+extern void *umem_malloc(size_t);
+extern void umem_malloc_free(void *);
+extern void *_malloc(size_t);
+extern void _free(void *);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libumem/common/vmem_base.c b/usr/src/lib/libumem/common/vmem_base.c
index d64f6362d6..dcd83ddf31 100644
--- a/usr/src/lib/libumem/common/vmem_base.c
+++ b/usr/src/lib/libumem/common/vmem_base.c
@@ -29,7 +29,7 @@
#include "umem_base.h"
uint_t vmem_backend = 0;
-uint_t vmem_allocator = 0;
+uint_t vmem_allocator = VM_BESTFIT;
vmem_t *
vmem_heap_arena(vmem_alloc_t **allocp, vmem_free_t **freep)
diff --git a/usr/src/lib/libumem/i386/asm_subr.s b/usr/src/lib/libumem/i386/asm_subr.s
index 2edb2b49b5..5ad5345c6d 100644
--- a/usr/src/lib/libumem/i386/asm_subr.s
+++ b/usr/src/lib/libumem/i386/asm_subr.s
@@ -24,10 +24,32 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/asm_linkage.h>
+#define NOP4 \
+ nop; \
+ nop; \
+ nop; \
+ nop;
+
+#define NOP16 \
+ NOP4 \
+ NOP4 \
+ NOP4 \
+ NOP4
+
+#define NOP64 \
+ NOP16 \
+ NOP16 \
+ NOP16 \
+ NOP16
+
+#define NOP256 \
+ NOP64 \
+ NOP64 \
+ NOP64 \
+ NOP64
+
#if defined(lint)
void *
@@ -69,4 +91,25 @@ _breakpoint(void)
SET_SIZE(_breakpoint)
#endif
+ ENTRY(_malloc)
+ jmp umem_malloc;
+ NOP256
+ NOP256
+#if defined(__amd64)
+ NOP64
+#endif
+ SET_SIZE(_malloc)
+
+ ENTRY(_free)
+ jmp umem_malloc_free;
+ NOP256
+ NOP256
+#if defined(__amd64)
+ NOP64
+#endif
+ SET_SIZE(_free)
+
+ ANSI_PRAGMA_WEAK2(malloc,_malloc,function)
+ ANSI_PRAGMA_WEAK2(free,_free,function)
+
#endif /* lint */
diff --git a/usr/src/lib/libumem/i386/umem_genasm.c b/usr/src/lib/libumem/i386/umem_genasm.c
index 0bfa338e2b..530a83e486 100644
--- a/usr/src/lib/libumem/i386/umem_genasm.c
+++ b/usr/src/lib/libumem/i386/umem_genasm.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014 Joyent, Inc. All rights reserved.
*/
/*
@@ -29,7 +29,7 @@
* implementations in libumem's malloc.c.
*
* What follows is the i386 implementation of the thread caching automatic
- * assembly generation. With i386 a function only has three registers its
+ * assembly generation. With i386 a function only has three registers it's
* allowed to change without restoring them: eax, ecx, and edx. All others have
* to be preserved. Since the set of registers we have available is so small, we
* have to make use of esi, ebx, and edi and save their original values to the
@@ -67,14 +67,13 @@
#include <atomic.h>
-int umem_genasm_supported = 1;
-uintptr_t umem_genasm_mptr;
-size_t umem_genasm_msize;
-uintptr_t umem_genasm_fptr;
-size_t umem_genasm_fsize;
-static uintptr_t umem_genasm_omptr;
-static uintptr_t umem_genasm_ofptr;
-
+const int umem_genasm_supported = 1;
+static uintptr_t umem_genasm_mptr = (uintptr_t)&_malloc;
+static size_t umem_genasm_msize = 512;
+static uintptr_t umem_genasm_fptr = (uintptr_t)&_free;
+static size_t umem_genasm_fsize = 512;
+static uintptr_t umem_genasm_omptr = (uintptr_t)umem_malloc;
+static uintptr_t umem_genasm_ofptr = (uintptr_t)umem_malloc_free;
/*
* The maximum number of caches we can support. We use a single byte addl so
* this is 255 (UINT8_MAX) / sizeof (uintptr_t). In this case 63
@@ -83,7 +82,7 @@ static uintptr_t umem_genasm_ofptr;
#define PTC_JMPADDR(dest, src) (dest - (src + 4))
#define PTC_ROOT_SIZE sizeof (uintptr_t)
-#define MULTINOP 0x0000441f0f
+#define MULTINOP 0x0000441f0f
/*
* void *ptcmalloc(size_t orig_size);
@@ -114,7 +113,7 @@ static const uint8_t malinit[] = {
0x0f, 0x82, 0x00, 0x00, 0x00, 0x00, /* jc +$JMP (errout) */
0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, /* cmpl sizeof ($C0), %esi */
0x0f, 0x87, 0x00, 0x00, 0x00, 0x00, /* ja +$JMP (errout) */
- 0x65, 0x8b, 0x0d, 0x00, 0x0, 0x00, 0x00, /* movl %gs:0x0,%ecx */
+ 0x65, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0,%ecx */
0x81, 0xc1, 0x00, 0x00, 0x00, 0x00, /* addl $OFF, %ecx */
0x8d, 0x51, 0x04 /* leal 0x4(%ecx), %edx */
};
@@ -543,11 +542,10 @@ umem_genasm(int *alloc_sizes, umem_cache_t **caches, int ncaches)
int nents, i;
uint8_t *mptr;
uint8_t *fptr;
- uint32_t *ptr;
uint64_t v, *vptr;
- mptr = (void *)((uintptr_t)&umem_genasm_mptr + 5);
- fptr = (void *)((uintptr_t)&umem_genasm_fptr + 5);
+ mptr = (void *)((uintptr_t)umem_genasm_mptr + 5);
+ fptr = (void *)((uintptr_t)umem_genasm_fptr + 5);
if (umem_genasm_mptr == 0 || umem_genasm_msize == 0 ||
umem_genasm_fptr == 0 || umem_genasm_fsize == 0)
return (1);
@@ -556,7 +554,7 @@ umem_genasm(int *alloc_sizes, umem_cache_t **caches, int ncaches)
* The total number of caches that we can service is the minimum of:
* o the amount supported by libc
* o the total number of umem caches
- * o we use a single byte addl, so its 255 / sizeof (uintptr_t). For
+ * o we use a single byte addl, so it's 255 / sizeof (uintptr_t). For
* 32-bit, this is 63.
*/
nents = _tmem_get_nentries();
@@ -571,27 +569,21 @@ umem_genasm(int *alloc_sizes, umem_cache_t **caches, int ncaches)
if (nents == 0 || umem_ptc_size == 0)
return (0);
- /* Grab the original malloc and free locations */
- ptr = (void *)(mptr - 4);
- umem_genasm_omptr = *ptr + (uintptr_t)mptr;
- ptr = (void *)(fptr - 4);
- umem_genasm_ofptr = *ptr + (uintptr_t)fptr;
-
/* Take into account the jump */
- if (genasm_malloc(mptr, umem_genasm_fsize - 5, nents,
+ if (genasm_malloc(mptr, umem_genasm_msize, nents,
alloc_sizes) != 0)
return (1);
- if (genasm_free(fptr, umem_genasm_fsize - 5, nents,
+ if (genasm_free(fptr, umem_genasm_fsize, nents,
alloc_sizes) != 0)
return (1);
/* nop out the jump with a multibyte jump */
- vptr = (void *)&umem_genasm_mptr;
+ vptr = (void *)umem_genasm_mptr;
v = MULTINOP;
v |= *vptr & (0xffffffULL << 40);
(void) atomic_swap_64(vptr, v);
- vptr = (void *)&umem_genasm_fptr;
+ vptr = (void *)umem_genasm_fptr;
v = MULTINOP;
v |= *vptr & (0xffffffULL << 40);
(void) atomic_swap_64(vptr, v);
diff --git a/usr/src/lib/libumem/sparc/umem_genasm.c b/usr/src/lib/libumem/sparc/umem_genasm.c
index 77dcc4a6a5..4bdea8122d 100644
--- a/usr/src/lib/libumem/sparc/umem_genasm.c
+++ b/usr/src/lib/libumem/sparc/umem_genasm.c
@@ -28,7 +28,7 @@
* statement in lib/libumem/common/umem.c, particularly section eight.
*/
-int umem_genasm_supported = 0;
+const int umem_genasm_supported = 0;
/*ARGSUSED*/
int
diff --git a/usr/src/lib/libumem_trampoline/Makefile b/usr/src/lib/libumem_trampoline/Makefile
deleted file mode 100644
index e1140efa8c..0000000000
--- a/usr/src/lib/libumem_trampoline/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright (c) 2012 Joyent, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.lib
-
-SUBDIRS= $(MACH)
-$(BUILD64)SUBDIRS += $(MACH64)
-
-all := TARGET= all
-clean := TARGET= clean
-clobber := TARGET= clobber
-install := TARGET= install
-lint := TARGET= lint
-
-.KEEP_STATE:
-
-all clean clobber install lint: $(SUBDIRS)
-
-install_h: $(ROOTHDRS)
-
-check: $(CHECKHDRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
-include ../Makefile.targ
diff --git a/usr/src/lib/libumem_trampoline/Makefile.com b/usr/src/lib/libumem_trampoline/Makefile.com
deleted file mode 100644
index a43fad0fd5..0000000000
--- a/usr/src/lib/libumem_trampoline/Makefile.com
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright (c) 2012 Joyent, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-LIBRARY = libumem_trampoline.a
-VERS = .1
-OBJECTS = trampoline.o
-
-include ../../Makefile.lib
-
-# install this library in the root filesystem
-include ../../Makefile.rootfs
-
-LIBS = $(DYNLIB) $(LINTLIB)
-
-SRCDIR = ../common
-
-$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
-
-CFLAGS += $(CCVERBOSE)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-lint: lintcheck
-
-include ../../Makefile.targ
diff --git a/usr/src/lib/libumem_trampoline/amd64/Makefile b/usr/src/lib/libumem_trampoline/amd64/Makefile
deleted file mode 100644
index 132720332b..0000000000
--- a/usr/src/lib/libumem_trampoline/amd64/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2012 (c) Joyent, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.com
-include ../../Makefile.lib.64
-
-install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline b/usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline
deleted file mode 100644
index 8fda64fc80..0000000000
--- a/usr/src/lib/libumem_trampoline/common/llib-lumem_trampoline
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* LINTLIBRARY */
-/* PROTOLIB1 */
diff --git a/usr/src/lib/libumem_trampoline/common/mapfile-vers b/usr/src/lib/libumem_trampoline/common/mapfile-vers
deleted file mode 100644
index c52eeda977..0000000000
--- a/usr/src/lib/libumem_trampoline/common/mapfile-vers
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright (c) 2012, Joyent, Inc. All rights reserved.
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-#
-# The BSS must me executable for ptcumem to work properly. If it is not,
-# programs will get a SEGV. For more information read section of 8 libumem's big
-# theory statement in lib/libumem/common/umem.c.
-#
-LOAD_SEGMENT bss {
- FLAGS = READ WRITE EXECUTE;
-};
-
-SYMBOL_VERSION SUNWprivate_1.1 {
- global:
- la_version;
- la_objopen;
-$if _ELF32
- la_symbind32;
-$endif
-$if _ELF64
- la_symbind64;
-$endif
- local:
- *;
-};
diff --git a/usr/src/lib/libumem_trampoline/common/trampoline.c b/usr/src/lib/libumem_trampoline/common/trampoline.c
deleted file mode 100644
index 200f32aabc..0000000000
--- a/usr/src/lib/libumem_trampoline/common/trampoline.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 2012 Joyent, Inc. All rights reserved.
- */
-
-/*
- * This is a local link auditing library for libumem(3LIB). It provides a means
- * for us to implement the per-thread caching component of libumem. When any
- * binary or library attempts to bind to libumem's malloc and free symbols we
- * instead point them to a private buffer in our own BSS. Our mapfile ensures
- * that this BSS is readable, writeable, and executable. By default these
- * private buffers contain a jmp instruction to the original libumem malloc and
- * free.
- *
- * When libumem tries to generate its assembly, we key off of private symbol
- * names and replace their values with pointers to our values. For more
- * information on this process, see section 8 of the big theory statement for
- * libumem in lib/libumem/common/umem.c.
- *
- * Note that this is very x86 specific currently. This includes x86 instructions
- * and making assumptions about alignment of variables, see the lint warnings.
- * By the current construction, SPARC is basically a no-op.
- */
-#include <dlfcn.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <libelf.h>
-#include <link.h>
-
-#if defined(__i386) || defined(__amd64)
-#define LIBUMEM_TRAMPOLINE_JMP32 0xe9
-#endif /* defined(__i386) || defined(__amd64) */
-
-/*
- * This is our malloc trampoline. We give it the name "malloc" to make it
- * appear somewhat like malloc.
- */
-static uint8_t malloc[4096];
-static uint8_t free[4096];
-static size_t msize = sizeof (malloc);
-static size_t fsize = sizeof (free);
-
-/*
- * We don't want to link against libc, so we define our own versions of the
- * string functions as necessary.
- */
-static int
-la_strcmp(const char *s1, const char *s2)
-{
- if (s1 == s2)
- return (0);
- while (*s1 == *s2++)
- if (*s1++ == '\0')
- return (0);
-
- return (*(unsigned char *)s1 - *(unsigned char *)--s2);
-}
-
-static char *
-la_strrchr(char *str, char c)
-{
- char *r;
-
- r = NULL;
- do {
- if (*str == c)
- r = str;
- } while (*str++);
- return (r);
-}
-
-/*ARGSUSED*/
-uint_t
-la_version(uint_t version)
-{
- return (LAV_CURRENT);
-}
-
-/*ARGSUSED*/
-uint_t
-la_objopen(Link_map *lmp, Lmid_t lmid, uintptr_t *cookie)
-{
-#if defined(__i386) || defined(__amd64)
- char *objname;
-
- if ((objname = la_strrchr(lmp->l_name, '/')) == NULL ||
- *(++objname) == '\0')
- objname = lmp->l_name;
-
- if (la_strcmp(objname, "libumem.so.1") == 0 ||
- la_strcmp(objname, "libumem.so") == 0)
- return (LA_FLG_BINDFROM | LA_FLG_BINDTO);
-#endif /* defined(__i386) || defined(__amd64) */
-
- return (0);
-}
-
-#if defined(_LP64)
-/*ARGSUSED*/
-uintptr_t
-la_symbind64(Elf64_Sym *symp, uint_t symndx, uintptr_t *refcook,
- uintptr_t *defcook, uint_t *sb_flags, char const *sym_name)
-#else
-/*ARGSUSED*/
-uintptr_t
-la_symbind32(Elf32_Sym *symp, uint_t symndx, uintptr_t *refcook,
- uintptr_t *defcook, uint_t *sb_flags)
-#endif
-{
-#if defined(__i386) || defined(__amd64)
- int i = 0;
-
-#if !defined(_LP64)
- char const *sym_name = (char const *) symp->st_name;
-#endif
-
- if (la_strcmp(sym_name, "malloc") == 0) {
- if (malloc[i] == '\0') {
- malloc[i++] = LIBUMEM_TRAMPOLINE_JMP32;
- /*LINTED E_BAD_PTR_CAST_ALIGN*/
- *(uint32_t *)&malloc[i] = (uint32_t)(symp->st_value -
- (uintptr_t)&malloc[i + sizeof (uint32_t)]);
- }
-
- return ((uintptr_t)malloc);
- } else if (la_strcmp(sym_name, "free") == 0) {
- if (free[i] == '\0') {
- free[i++] = LIBUMEM_TRAMPOLINE_JMP32;
- /*LINTED E_BAD_PTR_CAST_ALIGN*/
- *(uint32_t *)&free[i] = (uint32_t)(symp->st_value -
- (uintptr_t)&free[i + sizeof (uint32_t)]);
- }
-
- return ((uintptr_t)free);
- } else if (la_strcmp(sym_name, "umem_genasm_mptr") == 0) {
- return ((uintptr_t)malloc);
- } else if (la_strcmp(sym_name, "umem_genasm_msize") == 0) {
- return ((uintptr_t)&msize);
- } else if (la_strcmp(sym_name, "umem_genasm_fptr") == 0) {
- return ((uintptr_t)free);
- } else if (la_strcmp(sym_name, "umem_genasm_fsize") == 0) {
- return ((uintptr_t)&fsize);
- } else {
- return (symp->st_value);
- }
-#endif /* defined(__i386) || defined(__amd64) */
-}
diff --git a/usr/src/lib/libumem_trampoline/i386/Makefile b/usr/src/lib/libumem_trampoline/i386/Makefile
deleted file mode 100644
index 76c3ccc672..0000000000
--- a/usr/src/lib/libumem_trampoline/i386/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2012 (c) Joyent, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libumem_trampoline/sparc/Makefile b/usr/src/lib/libumem_trampoline/sparc/Makefile
deleted file mode 100644
index 76c3ccc672..0000000000
--- a/usr/src/lib/libumem_trampoline/sparc/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2012 (c) Joyent, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libumem_trampoline/sparcv9/Makefile b/usr/src/lib/libumem_trampoline/sparcv9/Makefile
deleted file mode 100644
index 132720332b..0000000000
--- a/usr/src/lib/libumem_trampoline/sparcv9/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2012 (c) Joyent, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-include ../Makefile.com
-include ../../Makefile.lib.64
-
-install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/man/man1/stty.1 b/usr/src/man/man1/stty.1
index e3cb5c7d70..21e44cae64 100644
--- a/usr/src/man/man1/stty.1
+++ b/usr/src/man/man1/stty.1
@@ -1,6 +1,7 @@
'\" te
.\" Copyright 1989 AT&T
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright (c) 2014, Joyent, Inc. All Rights Reserved
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text
@@ -10,7 +11,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH STTY 1 "May 20, 2009"
+.TH STTY 1 "Jan 04, 2014"
.SH NAME
stty \- set the options for a terminal
.SH SYNOPSIS
@@ -956,9 +957,9 @@ Set \fIcontrol-character\fR to \fIc\fR, where:
.RS 21n
is \fBctab\fR, \fBdiscard\fR, \fBdsusp\fR, \fBeof\fR, \fBeol\fR, \fBeol2\fR,
\fBerase\fR, \fBintr\fR, \fBkill\fR, \fBlnext\fR, \fBquit\fR, \fBreprint\fR,
-\fBstart\fR, \fBstop\fR, \fBsusp\fR, \fBswtch\fR, or \fBwerase\fR (\fBctab\fR
-is used with \fB-stappl\fR, see \fBtermio\fR(7I)). For information on
-\fBswtch\fR, see NOTES.
+\fBstart\fR, \fBstop\fR, \fBsusp\fR, \fBstatus\fR, \fBswtch\fR, or \fBwerase\fR
+(\fBctab\fR is used with \fB-stappl\fR, see \fBtermio\fR(7I)). For information
+on \fBswtch\fR, see NOTES.
.RE
.sp
diff --git a/usr/src/man/man1m/dd.1m b/usr/src/man/man1m/dd.1m
index ffdedba12f..99dae520ff 100644
--- a/usr/src/man/man1m/dd.1m
+++ b/usr/src/man/man1m/dd.1m
@@ -1,4 +1,5 @@
'\" te
+.\" Copyright (c) 2014, Joyent, Inc. All rights Reserved.
.\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved
@@ -9,7 +10,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH DD 1M "Sep 16, 1996"
+.TH DD 1M "Jan 04, 2014"
.SH NAME
dd \- convert and copy a file
.SH SYNOPSIS
@@ -381,9 +382,40 @@ bytes. (If either \fBblock\fR or \fBunblock\fR is also specified, appends
.RE
.sp
+.ne 2
+.na
+\fB\fBoflag=\fR\fIvalue\fR[\fB,\fR\fIvalue\fR.\|.\|.\|]\fR
+.ad
+.sp .6
+Where \fIvalue\fRs are comma-separated symbols from the following list which
+affect the behavior of writing the output file:
+.sp
+.ne 2
+.na
+\fB\fBdsync\fR\fR
+.ad
+.RS 11n
+The output file is opened with the \fBO_DSYNC\fR flag set. All data writes will
+be synchronous. For more information on \fBO_DSYNC\fR see \fBfcntl.h\fR(3HEAD).
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fBsync\fR\fR
+.ad
+.RS 11n
+The output file is opened with the \fBO_SYNC\fR flag set. All data and metadata
+writes will be synchronous. For more information on \fBO_SYNC\fR see
+\fBfcntl.h\fR(3HEAD).
+.RE
+
+.RE
+
+.sp
.LP
-If operands other than \fBconv=\fR are specified more than once, the last
-specified \fBoperand=\fR\fIvalue\fR is used.
+If operands other than \fBconv=\fR and \fBoflag=\fR are specified more than once,
+the last specified \fBoperand=\fR\fIvalue\fR is used.
.sp
.LP
For the \fBbs=\fR, \fBcbs=\fR, \fBibs=\fR, and \fBobs=\fR operands, the
@@ -451,6 +483,20 @@ separated by \fBx\fR, specifying the product of the indicated values.
.sp
.LP
All of the operands will be processed before any input is read.
+.SH SIGNALS
+.sp
+.LP
+When \fBdd\fR receives either SIGINFO or SIGUSR1, \fBdd\fR will emit the current
+input and output block counts, total bytes written, total time elapsed, and the
+number of bytes per second to standard error. This is the same information
+format that \fBdd\fR emits when it successfully completes. Users may send
+SIGINFO via their terminal. The default character is ^T, see \fBstty\fR(1) for
+more information.
+.sp
+.LP
+For \fBSIGINT\fR, \fBdd\fR writes status information to standard error before
+exiting. \fBdd\fR takes the standard action for all other signals.
+
.SH USAGE
.sp
.LP
@@ -569,8 +615,8 @@ Interface Stability Standard
.SH SEE ALSO
.sp
.LP
-\fBcp\fR(1), \fBsed\fR(1), \fBtr\fR(1), \fBattributes\fR(5), \fBenviron\fR(5),
-\fBlargefile\fR(5), \fBstandards\fR(5)
+\fBcp\fR(1), \fBsed\fR(1), \fBtr\fR(1), \fBfcntl.h\fR(3HEAD),
+\fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
.SH DIAGNOSTICS
.sp
.ne 2
@@ -601,7 +647,3 @@ from the pipe at the time.
When using \fBdd\fR to copy files to a tape device, the file size must be a
multiple of the device sector size (for example, 512 Kbyte). To copy files of
arbitrary size to a tape device, use \fBtar\fR(1) or \fBcpio\fR(1).
-.sp
-.LP
-For \fBSIGINT\fR, \fBdd\fR writes status information to standard error before
-exiting. It takes the standard action for all other signals.
diff --git a/usr/src/man/man3head/signal.h.3head b/usr/src/man/man3head/signal.h.3head
index e1974ce1eb..0d213e8fd7 100644
--- a/usr/src/man/man3head/signal.h.3head
+++ b/usr/src/man/man3head/signal.h.3head
@@ -8,7 +8,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH SIGNAL.H 3HEAD "Feb 5, 2008"
+.TH SIGNAL.H 3HEAD "Jan 4, 2014"
.SH NAME
signal.h, signal \- base signals
.SH SYNOPSIS
@@ -174,6 +174,7 @@ Resource control exceeded (see \fBsetrctl\fR(2))
T}
\fBSIGJVM1\fR 39 Ignore Reserved for Java Virtual Machine 1
\fBSIGJVM2\fR 40 Ignore Reserved for Java Virtual Machine 2
+\fBSIGINFO\fR 41 Ignore Status request
\fBSIGRTMIN\fR \fB*\fR Exit First real time signal
(\fBSIGRTMIN\fR+1) * Exit Second real time signal
\fB\|.\|.\|.\fR
diff --git a/usr/src/man/man3head/termios.h.3head b/usr/src/man/man3head/termios.h.3head
index 7b2f4f058e..cb29f860ac 100644
--- a/usr/src/man/man3head/termios.h.3head
+++ b/usr/src/man/man3head/termios.h.3head
@@ -7,7 +7,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH TERMIOS.H 3HEAD "Sep 10, 2004"
+.TH TERMIOS.H 3HEAD "Jan 04, 2014"
.SH NAME
termios.h, termios \- define values for termios
.SH SYNOPSIS
@@ -110,6 +110,7 @@ _
\fBVSTOP\fR \fBVSTOP\fR STOP character
\fBVSUSP\fR \fBVSUSP\fR SUSP character
\fBVTIME\fR TIME value
+\fBVSTATUS\fR STATUS character
.TE
.sp
diff --git a/usr/src/man/man7i/termio.7i b/usr/src/man/man7i/termio.7i
index 8921aa67c0..71c78d0e96 100644
--- a/usr/src/man/man7i/termio.7i
+++ b/usr/src/man/man7i/termio.7i
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright (c) 2014, Joyent, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
@@ -456,6 +457,18 @@ arrives, or the condition is cleared by a program.
.sp
.ne 2
.na
+\fB\fBSTATUS\fR\fR
+.ad
+.RS 11n
+(Control-t or \fBASCII DC4\fR) generates a \fBSIGINFO\fR signal. Processes with
+a handler will output status information when they receive \fBSIGINFO\fR, for
+example, \fBdd(1)\fR. If a process does not have a \fBSIGINFO\fR handler, the
+signal will be ignored.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBLNEXT\fR\fR
.ad
.RS 11n
@@ -465,13 +478,13 @@ allows characters to be input that would otherwise be interpreted by the system
(for example \fBKILL, QUIT\fR). The character values for \fBINTR\fR,
\fBQUIT\fR, \fBERASE\fR, \fBWERASE\fR, \fBKILL\fR, \fBREPRINT\fR, \fBEOF\fR,
\fBEOL\fR, \fBEOL2\fR, \fBSWTCH\fR, \fBSUSP\fR, \fBDSUSP\fR, \fBSTOP\fR,
-\fBSTART\fR, \fBDISCARD\fR, and \fBLNEXT\fR may be changed to suit individual
-tastes. If the value of a special control character is _POSIX_VDISABLE (0), the
-function of that special control character is disabled. The \fBERASE\fR,
-\fBKILL\fR, and \fBEOF\fR characters may be escaped by a preceding backslash
-(\e) character, in which case no special function is done. Any of the special
-characters may be preceded by the \fBLNEXT\fR character, in which case no
-special function is done.
+\fBSTART\fR, \fBDISCARD\fR, \fBSTATUS\fR, and \fBLNEXT\fR may be changed to suit
+individual tastes. If the value of a special control character is
+_POSIX_VDISABLE (0), the function of that special control character is disabled.
+The \fBERASE\fR, \fBKILL\fR, and \fBEOF\fR characters may be escaped by a
+preceding backslash (\e) character, in which case no special function is done.
+Any of the special characters may be preceded by the \fBLNEXT\fR character, in
+which case no special function is done.
.RE
.SS "Modem Disconnect"
@@ -565,7 +578,9 @@ _
_
15 VLNEXT SYN
_
-16-19 Reserved
+16 VSTATUS DC4
+_
+17-19 Reserved
.TE
.SS "Input Modes"
@@ -1856,9 +1871,9 @@ with code 177 octal, is echoed as ^ \fB?\fR.
.sp
.LP
If \fBNOFLSH\fR is set, the normal flush of the input and output queues
-associated with the \fBINTR\fR, \fBQUIT\fR, and \fBSUSP\fR characters is not
-done. This bit should be set when restarting system calls that read from or
-write to a terminal (see \fBsigaction\fR(2)\|).
+associated with the \fBINTR\fR, \fBQUIT\fR, \fBSTATUS\fR, and \fBSUSP\fR
+characters is not done. This bit should be set when restarting system calls
+that read from or write to a terminal (see \fBsigaction\fR(2)\|).
.sp
.LP
If \fBTOSTOP\fR and \fBIEXTEN\fR are set, the signal \fBSIGTTOU\fR is sent to
diff --git a/usr/src/uts/common/io/ldterm.c b/usr/src/uts/common/io/ldterm.c
index 69af0acf27..9d4baf4790 100644
--- a/usr/src/uts/common/io/ldterm.c
+++ b/usr/src/uts/common/io/ldterm.c
@@ -21,6 +21,7 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -36,8 +37,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Standard Streams Terminal Line Discipline module.
*/
@@ -1357,6 +1356,17 @@ ldtermrput(queue_t *q, mblk_t *mp)
M_SIG, 0);
continue;
}
+
+ /*
+ * Consumers do not expect the ^T to be
+ * echoed out when we generate a
+ * VSTATUS.
+ */
+ if (c == tp->t_modes.c_cc[VSTATUS]) {
+ ldterm_dosig(q, SIGINFO, '\0',
+ M_PCSIG, FLUSHRW);
+ continue;
+ }
}
/*
* Throw away CR if IGNCR set, or
diff --git a/usr/src/uts/common/io/options.conf b/usr/src/uts/common/io/options.conf
index aa1a288850..d88ae22788 100644
--- a/usr/src/uts/common/io/options.conf
+++ b/usr/src/uts/common/io/options.conf
@@ -21,8 +21,8 @@
#
#
# Copyright (c) 1992, by Sun Microsystems, Inc.
+# Copyright (c) 2014, Joyent, Inc.
#
-#ident "%Z%%M% %I% %E% SMI"
#
# The property "ttymodes" defines the default termios modes
# (upon driver open) for ttys.
@@ -45,4 +45,4 @@
#
name="options" class="root"
-ttymodes="2502:1805:bd:8a3b:3:1c:7f:15:4:0:0:0:11:13:1a:19:12:f:17:16";
+ttymodes="2502:1805:bd:8a3b:3:1c:7f:15:4:0:0:0:11:13:1a:19:12:f:17:16:14";
diff --git a/usr/src/uts/common/io/ttcompat.c b/usr/src/uts/common/io/ttcompat.c
index de5c5b690c..ab420c82e7 100644
--- a/usr/src/uts/common/io/ttcompat.c
+++ b/usr/src/uts/common/io/ttcompat.c
@@ -1177,6 +1177,7 @@ from_compat(compat_state_t *csp, struct termios *termiosp)
FROM_COMPAT_CHAR(termiosp->c_cc[VDISCARD], csp->t_flushc);
FROM_COMPAT_CHAR(termiosp->c_cc[VWERASE], csp->t_werasc);
FROM_COMPAT_CHAR(termiosp->c_cc[VLNEXT], csp->t_lnextc);
+ termiosp->c_cc[VSTATUS] = 0;
if (csp->t_flags & O_TANDEM)
termiosp->c_iflag |= IXOFF;
if (csp->t_flags & O_LCASE) {
diff --git a/usr/src/uts/common/io/tty_common.c b/usr/src/uts/common/io/tty_common.c
index fc01d2b1c8..0ad4a3b25a 100644
--- a/usr/src/uts/common/io/tty_common.c
+++ b/usr/src/uts/common/io/tty_common.c
@@ -9,8 +9,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/signal.h>
@@ -54,7 +52,7 @@ static struct termios default_termios = {
CFLUSH,
CWERASE,
CLNEXT,
- 0 /* nonexistent STATUS */
+ CSTATUS
}
};
@@ -423,7 +421,7 @@ allocfailure:
return (ioctlrespsize);
}
-#define NFIELDS 20 /* 16 control characters + 4 sets of modes */
+#define NFIELDS 21 /* 16 control characters + 4 sets of modes */
/*
* Init routine run from main at boot time.
diff --git a/usr/src/uts/common/os/sig.c b/usr/src/uts/common/os/sig.c
index 288a6d57e8..0b79c3765a 100644
--- a/usr/src/uts/common/os/sig.c
+++ b/usr/src/uts/common/os/sig.c
@@ -22,6 +22,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -76,7 +77,7 @@ const k_sigset_t ignoredefault =
|sigmask(SIGWINCH)|sigmask(SIGURG)|sigmask(SIGWAITING)),
(sigmask(SIGLWP)|sigmask(SIGCANCEL)|sigmask(SIGFREEZE)
|sigmask(SIGTHAW)|sigmask(SIGXRES)|sigmask(SIGJVM1)
- |sigmask(SIGJVM2)), 0};
+ |sigmask(SIGJVM2)|sigmask(SIGINFO)), 0};
const k_sigset_t stopdefault =
{(sigmask(SIGSTOP)|sigmask(SIGTSTP)|sigmask(SIGTTOU)|sigmask(SIGTTIN)),
diff --git a/usr/src/uts/common/sys/iso/signal_iso.h b/usr/src/uts/common/sys/iso/signal_iso.h
index 0d23dceec3..b1990121b8 100644
--- a/usr/src/uts/common/sys/iso/signal_iso.h
+++ b/usr/src/uts/common/sys/iso/signal_iso.h
@@ -91,10 +91,11 @@ extern "C" {
#define SIGXRES 38 /* resource control exceeded */
#define SIGJVM1 39 /* reserved signal for Java Virtual Machine */
#define SIGJVM2 40 /* reserved signal for Java Virtual Machine */
+#define SIGINFO 41 /* information request */
/* insert new signals here, and move _SIGRTM* appropriately */
-#define _SIGRTMIN 41 /* first (highest-priority) realtime signal */
-#define _SIGRTMAX 72 /* last (lowest-priority) realtime signal */
+#define _SIGRTMIN 42 /* first (highest-priority) realtime signal */
+#define _SIGRTMAX 73 /* last (lowest-priority) realtime signal */
extern long _sysconf(int); /* System Private interface to sysconf() */
#define SIGRTMIN ((int)_sysconf(_SC_SIGRT_MIN)) /* first realtime signal */
#define SIGRTMAX ((int)_sysconf(_SC_SIGRT_MAX)) /* last realtime signal */
diff --git a/usr/src/uts/common/sys/signal.h b/usr/src/uts/common/sys/signal.h
index 1442231536..8f0e1794f4 100644
--- a/usr/src/uts/common/sys/signal.h
+++ b/usr/src/uts/common/sys/signal.h
@@ -158,8 +158,8 @@ struct sigaction32 {
* use of these symbols by applications is injurious
* to binary compatibility
*/
-#define NSIG 73 /* valid signals range from 1 to NSIG-1 */
-#define MAXSIG 72 /* size of u_signal[], NSIG-1 <= MAXSIG */
+#define NSIG 74 /* valid signals range from 1 to NSIG-1 */
+#define MAXSIG 73 /* size of u_signal[], NSIG-1 <= MAXSIG */
#endif /* defined(__EXTENSIONS__) || !defined(_XPG4_2) */
#define MINSIGSTKSZ 2048
diff --git a/usr/src/uts/common/sys/termios.h b/usr/src/uts/common/sys/termios.h
index ddc5dc5207..e66ba0bc6b 100644
--- a/usr/src/uts/common/sys/termios.h
+++ b/usr/src/uts/common/sys/termios.h
@@ -162,7 +162,8 @@ extern pid_t tcgetsid();
#define VDISCARD 13
#define VWERASE 14
#define VLNEXT 15
-/* 16 thru 19 reserved for future use */
+#define VSTATUS 16
+/* 17 through 19 reserved for future use */
/*
* control characters form Xenix termio.h
@@ -194,6 +195,7 @@ extern pid_t tcgetsid();
#define CFLUSH CTRL('o')
#define CWERASE CTRL('w')
#define CLNEXT CTRL('v')
+#define CSTATUS CTRL('t')
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
diff --git a/usr/src/uts/common/sys/ttychars.h b/usr/src/uts/common/sys/ttychars.h
index f6751577b5..88ee3a6978 100644
--- a/usr/src/uts/common/sys/ttychars.h
+++ b/usr/src/uts/common/sys/ttychars.h
@@ -35,8 +35,6 @@
#ifndef _SYS_TTYCHARS_H
#define _SYS_TTYCHARS_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -83,6 +81,7 @@ struct ttychars {
#define CFLUSH CTRL('o')
#define CWERASE CTRL('w')
#define CLNEXT CTRL('v')
+#define CSTATUS CTRL('t')
#endif /* _SYS_TERMIOS_H */