diff options
author | Robert Mustacchi <rm@joyent.com> | 2013-12-05 01:26:55 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2014-01-21 18:24:13 -0800 |
commit | 19d32b9ab53d17ac6605971e14c45a5281f8d9bb (patch) | |
tree | e0d013df65909af86605dcdb177f0394680922b3 | |
parent | 4f364e7c95ee7fd9d5bbeddc1940e92405bb0e72 (diff) | |
download | illumos-gate-19d32b9ab53d17ac6605971e14c45a5281f8d9bb.tar.gz |
4493 want siginfo
4494 Make dd show progress when you send INFO/USR1 signals
4495 dd could support O_SYNC and O_DSYNC
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
35 files changed, 311 insertions, 157 deletions
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/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/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/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/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/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/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/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/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 */ |