From owner-svn-src-projects@FreeBSD.ORG Sat May 3 09:19:04 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC8F14BE; Sat, 3 May 2014 09:19:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6EF217DF; Sat, 3 May 2014 09:19:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s439J4TB063133; Sat, 3 May 2014 09:19:04 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s439IxfS063089; Sat, 3 May 2014 09:18:59 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <201405030918.s439IxfS063089@svn.freebsd.org> From: Mark Murray Date: Sat, 3 May 2014 09:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265259 - in projects/random_number_generator: bin/ps contrib/gcc/config/i386 contrib/top lib/libc/rpc lib/libproc release/doc/en_US.ISO8859-1/hardware rescue/rescue sbin/gvinum share/m... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 09:19:04 -0000 Author: markm Date: Sat May 3 09:18:59 2014 New Revision: 265259 URL: http://svnweb.freebsd.org/changeset/base/265259 Log: MFC - tracking commit. Merging r265226 through r265255. Added: projects/random_number_generator/share/man/man4/mpr.4 - copied unchanged from r265255, head/share/man/man4/mpr.4 projects/random_number_generator/sys/dev/mpr/ - copied from r265255, head/sys/dev/mpr/ projects/random_number_generator/sys/modules/mpr/ - copied from r265255, head/sys/modules/mpr/ Modified: projects/random_number_generator/bin/ps/Makefile projects/random_number_generator/bin/ps/ps.1 projects/random_number_generator/bin/ps/ps.c projects/random_number_generator/contrib/gcc/config/i386/i386.c projects/random_number_generator/contrib/top/commands.c projects/random_number_generator/contrib/top/machine.h projects/random_number_generator/contrib/top/top.X projects/random_number_generator/contrib/top/top.c projects/random_number_generator/lib/libc/rpc/clnt_vc.c projects/random_number_generator/lib/libproc/_libproc.h projects/random_number_generator/lib/libproc/proc_create.c projects/random_number_generator/lib/libproc/proc_rtld.c projects/random_number_generator/lib/libproc/proc_sym.c projects/random_number_generator/release/doc/en_US.ISO8859-1/hardware/article.xml projects/random_number_generator/rescue/rescue/Makefile projects/random_number_generator/sbin/gvinum/gvinum.c projects/random_number_generator/sbin/gvinum/gvinum.h projects/random_number_generator/share/man/man4/Makefile projects/random_number_generator/share/man/man5/make.conf.5 projects/random_number_generator/sys/amd64/conf/GENERIC projects/random_number_generator/sys/arm/conf/VYBRID projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/random_number_generator/sys/conf/NOTES projects/random_number_generator/sys/conf/files projects/random_number_generator/sys/conf/options projects/random_number_generator/sys/fs/nfs/nfs_commonsubs.c projects/random_number_generator/sys/fs/nfsserver/nfs_nfsdport.c projects/random_number_generator/sys/i386/conf/GENERIC projects/random_number_generator/sys/i386/conf/XEN projects/random_number_generator/sys/ia64/conf/GENERIC projects/random_number_generator/sys/kern/kern_cpu.c projects/random_number_generator/sys/kern/kern_descrip.c projects/random_number_generator/sys/mips/conf/OCTEON1 projects/random_number_generator/sys/modules/Makefile projects/random_number_generator/sys/net/ieee8023ad_lacp.c projects/random_number_generator/sys/rpc/clnt_vc.c projects/random_number_generator/sys/sparc64/conf/GENERIC projects/random_number_generator/sys/sys/user.h projects/random_number_generator/usr.bin/top/Makefile projects/random_number_generator/usr.bin/top/machine.c Directory Properties: projects/random_number_generator/ (props changed) projects/random_number_generator/contrib/gcc/ (props changed) projects/random_number_generator/contrib/top/ (props changed) projects/random_number_generator/lib/libc/ (props changed) projects/random_number_generator/sbin/ (props changed) projects/random_number_generator/share/man/man4/ (props changed) projects/random_number_generator/sys/ (props changed) projects/random_number_generator/sys/cddl/contrib/opensolaris/ (props changed) projects/random_number_generator/sys/conf/ (props changed) Modified: projects/random_number_generator/bin/ps/Makefile ============================================================================== --- projects/random_number_generator/bin/ps/Makefile Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/bin/ps/Makefile Sat May 3 09:18:59 2014 (r265259) @@ -11,7 +11,7 @@ SRCS= fmt.c keyword.c nlist.c print.c ps # on large systems. # CFLAGS+=-DLAZY_PS -DPADD= ${LIBM} ${LIBKVM} -LDADD= -lm -lkvm +DPADD= ${LIBM} ${LIBKVM} ${LIBJAIL} +LDADD= -lm -lkvm -ljail .include Modified: projects/random_number_generator/bin/ps/ps.1 ============================================================================== --- projects/random_number_generator/bin/ps/ps.1 Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/bin/ps/ps.1 Sat May 3 09:18:59 2014 (r265259) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd December 27, 2013 +.Dd May 2, 2014 .Dt PS 1 .Os .Sh NAME @@ -40,6 +40,7 @@ .Op Fl aCcdefHhjlmrSTuvwXxZ .Op Fl O Ar fmt | Fl o Ar fmt .Op Fl G Ar gid Ns Op , Ns Ar gid Ns Ar ... +.Op Fl J Ar jid Ns Op , Ns Ar jid Ns Ar ... .Op Fl M Ar core .Op Fl N Ar system .Op Fl p Ar pid Ns Op , Ns Ar pid Ns Ar ... @@ -62,7 +63,7 @@ will also display processes that do not .Pp A different set of processes can be selected for display by using any combination of the -.Fl a , G , p , T , t , +.Fl a , G , J , p , T , t , and .Fl U options. @@ -152,6 +153,20 @@ Print information associated with the fo .Cm user , pid , ppid , pgid , sid , jobc , state , tt , time , and .Cm command . +.It Fl J +Display information about processes which match the specified jail IDs. +This may be either the +.Cm jid +or +.Cm name +of the jail. +Use +.Fl J +.Sy 0 +to display only host processes. +This flag implies +.Fl x +by default. .It Fl L List the set of keywords available for the .Fl O Modified: projects/random_number_generator/bin/ps/ps.c ============================================================================== --- projects/random_number_generator/bin/ps/ps.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/bin/ps/ps.c Sat May 3 09:18:59 2014 (r265259) @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)ps.c 8.4 (Be __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -124,6 +126,7 @@ struct listinfo { const char *lname; union { gid_t *gids; + int *jids; pid_t *pids; dev_t *ttys; uid_t *uids; @@ -132,6 +135,7 @@ struct listinfo { }; static int addelem_gid(struct listinfo *, const char *); +static int addelem_jid(struct listinfo *, const char *); static int addelem_pid(struct listinfo *, const char *); static int addelem_tty(struct listinfo *, const char *); static int addelem_uid(struct listinfo *, const char *); @@ -163,12 +167,12 @@ static char vfmt[] = "pid,state,time,sl, "%cpu,%mem,command"; static char Zfmt[] = "label"; -#define PS_ARGS "AaCcde" OPT_LAZY_f "G:gHhjLlM:mN:O:o:p:rSTt:U:uvwXxZ" +#define PS_ARGS "AaCcde" OPT_LAZY_f "G:gHhjJ:LlM:mN:O:o:p:rSTt:U:uvwXxZ" int main(int argc, char *argv[]) { - struct listinfo gidlist, pgrplist, pidlist; + struct listinfo gidlist, jidlist, pgrplist, pidlist; struct listinfo ruidlist, sesslist, ttylist, uidlist; struct kinfo_proc *kp; KINFO *kinfo = NULL, *next_KINFO; @@ -208,6 +212,7 @@ main(int argc, char *argv[]) prtheader = showthreads = wflag = xkeep_implied = 0; xkeep = -1; /* Neither -x nor -X. */ init_list(&gidlist, addelem_gid, sizeof(gid_t), "group"); + init_list(&jidlist, addelem_jid, sizeof(int), "jail id"); init_list(&pgrplist, addelem_pid, sizeof(pid_t), "process group"); init_list(&pidlist, addelem_pid, sizeof(pid_t), "process id"); init_list(&ruidlist, addelem_uid, sizeof(uid_t), "ruser"); @@ -275,6 +280,11 @@ main(int argc, char *argv[]) case 'h': prtheader = ws.ws_row > 5 ? ws.ws_row : 22; break; + case 'J': + add_list(&jidlist, optarg); + xkeep_implied = 1; + nselectors++; + break; case 'j': parsefmt(jfmt, 0); _fmt = 1; @@ -538,6 +548,11 @@ main(int argc, char *argv[]) if (kp->ki_rgid == gidlist.l.gids[elem]) goto keepit; } + if (jidlist.count > 0) { + for (elem = 0; elem < jidlist.count; elem++) + if (kp->ki_jid == jidlist.l.jids[elem]) + goto keepit; + } if (pgrplist.count > 0) { for (elem = 0; elem < pgrplist.count; elem++) if (kp->ki_pgid == @@ -666,6 +681,7 @@ main(int argc, char *argv[]) } } free_list(&gidlist); + free_list(&jidlist); free_list(&pidlist); free_list(&pgrplist); free_list(&ruidlist); @@ -727,6 +743,30 @@ addelem_gid(struct listinfo *inf, const } static int +addelem_jid(struct listinfo *inf, const char *elem) +{ + int tempid; + + if (*elem == '\0') { + warnx("Invalid (zero-length) jail id"); + optfatal = 1; + return (0); /* Do not add this value. */ + } + + tempid = jail_getid(elem); + if (tempid < 0) { + warnx("Invalid %s: %s", inf->lname, elem); + optfatal = 1; + return (0); + } + + if (inf->count >= inf->maxcount) + expand_list(inf); + inf->l.jids[(inf->count)++] = tempid; + return (1); +} + +static int addelem_pid(struct listinfo *inf, const char *elem) { char *endp; @@ -1373,7 +1413,7 @@ usage(void) (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: ps " SINGLE_OPTS " [-O fmt | -o fmt] [-G gid[,gid...]]", - " [-M core] [-N system]", + " [-J jid[,jid...]] [-M core] [-N system]", " [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]", " ps [-L]"); exit(1); Modified: projects/random_number_generator/contrib/gcc/config/i386/i386.c ============================================================================== --- projects/random_number_generator/contrib/gcc/config/i386/i386.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/contrib/gcc/config/i386/i386.c Sat May 3 09:18:59 2014 (r265259) @@ -14408,7 +14408,7 @@ ix86_local_alignment (tree type, int ali if (AGGREGATE_TYPE_P (type) && TYPE_SIZE (type) && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST - && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 16 + && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 128 || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 128) return 128; } Modified: projects/random_number_generator/contrib/top/commands.c ============================================================================== --- projects/random_number_generator/contrib/top/commands.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/contrib/top/commands.c Sat May 3 09:18:59 2014 (r265259) @@ -74,6 +74,7 @@ e - list errors generated by last H - toggle the displaying of threads\n\ i or I - toggle the displaying of idle processes\n\ j - toggle the displaying of jail ID\n\ +J - display processes for only one jail (+ selects all jails)\n\ k - kill processes; send a signal to a list of processes\n\ m - toggle the display between 'cpu' and 'io' modes\n\ n or # - change number of processes to display\n", stdout); Modified: projects/random_number_generator/contrib/top/machine.h ============================================================================== --- projects/random_number_generator/contrib/top/machine.h Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/contrib/top/machine.h Sat May 3 09:18:59 2014 (r265259) @@ -66,6 +66,7 @@ struct process_select int thread; /* show threads */ int uid; /* only this uid (unless uid == -1) */ int wcpu; /* show weighted cpu */ + int jid; /* only this jid (unless jid == -1) */ int jail; /* show jail ID */ int kidle; /* show per-CPU idle threads */ char *command; /* only this command (unless == NULL) */ Modified: projects/random_number_generator/contrib/top/top.X ============================================================================== --- projects/random_number_generator/contrib/top/top.X Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/contrib/top/top.X Sat May 3 09:18:59 2014 (r265259) @@ -20,6 +20,8 @@ top \- display and update information ab ] [ .BI \-s time ] [ +.BI \-J jail +] [ .BI \-U username ] [ .I number @@ -171,6 +173,21 @@ values are \*(lqcpu\*(rq, \*(lqsize\*(rq but may vary on different operating systems. Note that not all operating systems support this option. .TP +.BI \-J jail +Show only those processes owned by +.IR jail . +This may be either the +.B jid +or +.B name +of the jail. +Use +.B 0 +to limit to host processes. +Using this option implies the +.B \-j +flag. +.PP .BI \-U username Show only those processes owned by .IR username . @@ -315,6 +332,12 @@ Toggle the display of .IR jail (8) ID. .TP +.B J +Display only processes owned by a specific jail (prompt for jail). +If the jail specified is simply \*(lq+\*(rq, then processes belonging +to all jails and the host will be displayed. +This will also enable the display of JID. +.TP .B P Toggle the display of per-CPU statistics. .TP Modified: projects/random_number_generator/contrib/top/top.c ============================================================================== --- projects/random_number_generator/contrib/top/top.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/contrib/top/top.c Sat May 3 09:18:59 2014 (r265259) @@ -38,7 +38,9 @@ char *copyright = #include #include #include +#include #include +#include /* includes specific to top */ #include "display.h" /* interface to display package */ @@ -198,9 +200,9 @@ char *argv[]; fd_set readfds; #ifdef ORDER - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPo"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJo"; #else - static char command_chars[] = "\f qh?en#sdkriIutHmSCajzP"; + static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJ"; #endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 @@ -228,8 +230,9 @@ char *argv[]; #define CMD_jidtog 21 #define CMD_kidletog 22 #define CMD_pcputog 23 +#define CMD_jail 24 #ifdef ORDER -#define CMD_order 24 +#define CMD_order 25 #endif /* set the buffer for stdout */ @@ -261,6 +264,7 @@ char *argv[]; ps.uid = -1; ps.thread = No; ps.wcpu = 1; + ps.jid = -1; ps.jail = No; ps.kidle = Yes; ps.command = NULL; @@ -288,7 +292,7 @@ char *argv[]; optind = 1; } - while ((i = getopt(ac, av, "CSIHPabijnquvzs:d:U:m:o:t")) != EOF) + while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:t")) != EOF) { switch(i) { @@ -413,6 +417,15 @@ char *argv[]; ps.jail = !ps.jail; break; + case 'J': /* display only jail's processes */ + if ((ps.jid = jail_getid(optarg)) == -1) + { + fprintf(stderr, "%s: unknown jail\n", optarg); + exit(1); + } + ps.jail = 1; + break; + case 'P': pcpu_stats = !pcpu_stats; break; @@ -425,7 +438,7 @@ char *argv[]; fprintf(stderr, "Top version %s\n" "Usage: %s [-abCHIijnPqStuvz] [-d count] [-m io | cpu] [-o field] [-s time]\n" -" [-U username] [number]\n", +" [-J jail] [-U username] [number]\n", version_string(), myname); exit(1); } @@ -994,7 +1007,7 @@ restart: case CMD_user: new_message(MT_standout, - "Username to show: "); + "Username to show (+ for all): "); if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) { if (tempbuf2[0] == '+' && @@ -1085,6 +1098,44 @@ restart: reset_display(); putchar('\r'); break; + + case CMD_jail: + new_message(MT_standout, + "Jail to show (+ for all): "); + if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) + { + if (tempbuf2[0] == '+' && + tempbuf2[1] == '\0') + { + ps.jid = -1; + } + else if ((i = jail_getid(tempbuf2)) == -1) + { + new_message(MT_standout, + " %s: unknown jail", tempbuf2); + no_command = Yes; + } + else + { + ps.jid = i; + } + if (ps.jail == 0) { + ps.jail = 1; + new_message(MT_standout | + MT_delayed, " Displaying jail " + "ID."); + header_text = + format_header(uname_field); + reset_display(); + } + putchar('\r'); + } + else + { + clear_message(); + } + break; + case CMD_kidletog: ps.kidle = !ps.kidle; new_message(MT_standout | MT_delayed, Modified: projects/random_number_generator/lib/libc/rpc/clnt_vc.c ============================================================================== --- projects/random_number_generator/lib/libc/rpc/clnt_vc.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/lib/libc/rpc/clnt_vc.c Sat May 3 09:18:59 2014 (r265259) @@ -301,15 +301,13 @@ clnt_vc_create(fd, raddr, prog, vers, se return (cl); err: - if (cl) { - if (ct) { - if (ct->ct_addr.len) - mem_free(ct->ct_addr.buf, ct->ct_addr.len); - mem_free(ct, sizeof (struct ct_data)); - } - if (cl) - mem_free(cl, sizeof (CLIENT)); + if (ct) { + if (ct->ct_addr.len) + mem_free(ct->ct_addr.buf, ct->ct_addr.len); + mem_free(ct, sizeof (struct ct_data)); } + if (cl) + mem_free(cl, sizeof (CLIENT)); return ((CLIENT *)NULL); } Modified: projects/random_number_generator/lib/libproc/_libproc.h ============================================================================== --- projects/random_number_generator/lib/libproc/_libproc.h Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/lib/libproc/_libproc.h Sat May 3 09:18:59 2014 (r265259) @@ -46,6 +46,8 @@ struct proc_handle { size_t rdobjsz; size_t nobjs; struct lwpstatus lwps; + rd_loadobj_t *rdexec; /* rdobj index of program executable. */ + char execname[MAXPATHLEN]; /* Path to program executable. */ }; #ifdef DEBUG Modified: projects/random_number_generator/lib/libproc/proc_create.c ============================================================================== --- projects/random_number_generator/lib/libproc/proc_create.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/lib/libproc/proc_create.c Sat May 3 09:18:59 2014 (r265259) @@ -26,8 +26,10 @@ * $FreeBSD$ */ -#include "_libproc.h" -#include +#include +#include +#include + #include #include #include @@ -35,7 +37,37 @@ #include #include #include -#include + +#include "_libproc.h" + +static int proc_init(pid_t, int, int, struct proc_handle *); + +static int +proc_init(pid_t pid, int flags, int status, struct proc_handle *phdl) +{ + int mib[4], error; + size_t len; + + memset(phdl, 0, sizeof(*phdl)); + phdl->pid = pid; + phdl->flags = flags; + phdl->status = status; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = pid; + len = sizeof(phdl->execname); + if (sysctl(mib, 4, phdl->execname, &len, NULL, 0) != 0) { + error = errno; + DPRINTF("ERROR: cannot get pathname for child process %d", pid); + return (error); + } + if (len == 0) + phdl->execname[0] = '\0'; + + return (0); +} int proc_attach(pid_t pid, int flags, struct proc_handle **pphdl) @@ -54,12 +86,12 @@ proc_attach(pid_t pid, int flags, struct if ((phdl = malloc(sizeof(struct proc_handle))) == NULL) return (ENOMEM); - memset(phdl, 0, sizeof(struct proc_handle)); - phdl->pid = pid; - phdl->flags = flags; - phdl->status = PS_RUN; elf_version(EV_CURRENT); + error = proc_init(pid, flags, PS_RUN, phdl); + if (error != 0) + goto out; + if (ptrace(PT_ATTACH, phdl->pid, 0, 0) != 0) { error = errno; DPRINTF("ERROR: cannot ptrace child process %d", pid); @@ -123,9 +155,9 @@ proc_create(const char *file, char * con _exit(2); } else { /* The parent owns the process handle. */ - memset(phdl, 0, sizeof(struct proc_handle)); - phdl->pid = pid; - phdl->status = PS_IDLE; + error = proc_init(pid, 0, PS_IDLE, phdl); + if (error != 0) + goto bad; /* Wait for the child process to stop. */ if (waitpid(pid, &status, WUNTRACED) == -1) { Modified: projects/random_number_generator/lib/libproc/proc_rtld.c ============================================================================== --- projects/random_number_generator/lib/libproc/proc_rtld.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/lib/libproc/proc_rtld.c Sat May 3 09:18:59 2014 (r265259) @@ -49,6 +49,9 @@ map_iter(const rd_loadobj_t *lop, void * if (phdl->rdobjs == NULL) return (-1); } + if (strcmp(lop->rdl_path, phdl->execname) == 0 && + (lop->rdl_prot & RD_RDL_X) != 0) + phdl->rdexec = &phdl->rdobjs[phdl->nobjs]; memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*lop)); return (0); Modified: projects/random_number_generator/lib/libproc/proc_sym.c ============================================================================== --- projects/random_number_generator/lib/libproc/proc_sym.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/lib/libproc/proc_sym.c Sat May 3 09:18:59 2014 (r265259) @@ -112,17 +112,23 @@ proc_obj2map(struct proc_handle *p, cons rd_loadobj_t *rdl; char path[MAXPATHLEN]; + rdl = NULL; for (i = 0; i < p->nobjs; i++) { - rdl = &p->rdobjs[i]; - basename_r(rdl->rdl_path, path); + basename_r(p->rdobjs[i].rdl_path, path); if (strcmp(path, objname) == 0) { - if ((map = malloc(sizeof(*map))) == NULL) - return (NULL); - proc_rdl2prmap(rdl, map); - return (map); + rdl = &p->rdobjs[i]; + break; } } - return (NULL); + if (rdl == NULL && strcmp(objname, "a.out") == 0 && p->rdexec != NULL) + rdl = p->rdexec; + else + return (NULL); + + if ((map = malloc(sizeof(*map))) == NULL) + return (NULL); + proc_rdl2prmap(rdl, map); + return (map); } int @@ -386,8 +392,9 @@ proc_name2map(struct proc_handle *p, con free(kves); return (NULL); } - if (name == NULL || strcmp(name, "a.out") == 0) { - map = proc_addr2map(p, p->rdobjs[0].rdl_saddr); + if ((name == NULL || strcmp(name, "a.out") == 0) && + p->rdexec != NULL) { + map = proc_addr2map(p, p->rdexec->rdl_saddr); return (map); } for (i = 0; i < p->nobjs; i++) { Modified: projects/random_number_generator/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- projects/random_number_generator/release/doc/en_US.ISO8859-1/hardware/article.xml Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/release/doc/en_US.ISO8859-1/hardware/article.xml Sat May 3 09:18:59 2014 (r265259) @@ -29,6 +29,7 @@ 2011 2012 2013 + 2014 The &os; Documentation Project @@ -732,6 +733,8 @@ &hwlist.mly; + &hwlist.mpr; + &hwlist.mps; &hwlist.mpt; Modified: projects/random_number_generator/rescue/rescue/Makefile ============================================================================== --- projects/random_number_generator/rescue/rescue/Makefile Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/rescue/rescue/Makefile Sat May 3 09:18:59 2014 (r265259) @@ -52,7 +52,7 @@ CRUNCH_SRCDIRS+= bin CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ ed expr getfacl hostname kenv kill ln ls mkdir mv \ pkill ps pwd realpath rm rmdir setfacl sh stty sync test -CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil +CRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -ll -ltermcap -lutil CRUNCH_BUILDTOOLS+= bin/sh # Additional options for specific programs @@ -120,7 +120,7 @@ CRUNCH_PROGS_sbin+= zpool CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec .if ${MK_ZFS} != "no" -CRUNCH_LIBS+= -lavl -ljail -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem +CRUNCH_LIBS+= -lavl -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem .endif CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv -lmd -lsbuf -lufs -lz Modified: projects/random_number_generator/sbin/gvinum/gvinum.c ============================================================================== --- projects/random_number_generator/sbin/gvinum/gvinum.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sbin/gvinum/gvinum.c Sat May 3 09:18:59 2014 (r265259) @@ -95,8 +95,10 @@ main(int argc, char **argv) char buffer[BUFSIZ], *inputline, *token[GV_MAXARGS]; /* Load the module if necessary. */ - if (kldfind(GVINUMMOD) < 0 && kldload(GVINUMMOD) < 0) - err(1, GVINUMMOD ": Kernel module not available"); + if (modfind(GVINUMMOD) < 0) { + if (kldload(GVINUMKLD) < 0 && modfind(GVINUMMOD) < 0) + err(1, GVINUMKLD ": Kernel module not available"); + } /* Arguments given on the command line. */ if (argc > 1) { @@ -1207,9 +1209,10 @@ gvinum_stop(int argc, char **argv) { int err, fileid; - fileid = kldfind(GVINUMMOD); + fileid = kldfind(GVINUMKLD); if (fileid == -1) { - warn("cannot find " GVINUMMOD); + if (modfind(GVINUMMOD) < 0) + warn("cannot find " GVINUMKLD); return; } @@ -1219,7 +1222,7 @@ gvinum_stop(int argc, char **argv) * event thread will be free for the g_wither_geom() call from * gv_unload(). It's silly, but it works. */ - printf("unloading " GVINUMMOD " kernel module... "); + printf("unloading " GVINUMKLD " kernel module... "); fflush(stdout); if ((err = kldunload(fileid)) != 0 && (errno == EAGAIN)) { sleep(1); @@ -1227,7 +1230,7 @@ gvinum_stop(int argc, char **argv) } if (err != 0) { printf(" failed!\n"); - warn("cannot unload " GVINUMMOD); + warn("cannot unload " GVINUMKLD); return; } Modified: projects/random_number_generator/sbin/gvinum/gvinum.h ============================================================================== --- projects/random_number_generator/sbin/gvinum/gvinum.h Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sbin/gvinum/gvinum.h Sat May 3 09:18:59 2014 (r265259) @@ -36,4 +36,5 @@ /* $FreeBSD$ */ -#define GVINUMMOD "geom_vinum" +#define GVINUMMOD "g_vinum" +#define GVINUMKLD "geom_vinum" Modified: projects/random_number_generator/share/man/man4/Makefile ============================================================================== --- projects/random_number_generator/share/man/man4/Makefile Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/share/man/man4/Makefile Sat May 3 09:18:59 2014 (r265259) @@ -262,6 +262,7 @@ MAN= aac.4 \ mod_cc.4 \ mos.4 \ mouse.4 \ + mpr.4 \ mps.4 \ mpt.4 \ msk.4 \ Copied: projects/random_number_generator/share/man/man4/mpr.4 (from r265255, head/share/man/man4/mpr.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/share/man/man4/mpr.4 Sat May 3 09:18:59 2014 (r265259, copy of r265255, head/share/man/man4/mpr.4) @@ -0,0 +1,229 @@ +.\" +.\" Copyright (c) 2010 Spectra Logic Corporation +.\" Copyright (c) 2014 LSI Corp +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions, and the following disclaimer, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" substantially similar to the "NO WARRANTY" disclaimer below +.\" ("Disclaimer") and any redistribution must be conditioned upon +.\" including a substantially similar Disclaimer requirement for further +.\" binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGES. +.\" +.\" mpr driver man page. +.\" +.\" Author: Ken Merry +.\" Author: Stephen McConnell +.\" +.\" $Id$ +.\" $FreeBSD$ +.\" +.Dd May 2, 2014 +.Dt MPR 4 +.Os +.Sh NAME +.Nm mpr +.Nd "LSI Fusion-MPT 3 IT/IR 12Gb/s Serial Attached SCSI/SATA driver" +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pci" +.Cd "device scbus" +.Cd "device mpr" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +mpr_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for LSI Fusion-MPT 3 IT/IR +.Tn SAS +controllers. +.Sh HARDWARE +The following controllers are supported by the +.Nm +driver +.Pp +.Bl -bullet -compact +.It +LSI SAS 3004 (4 Port SAS) +.It +LSI SAS 3008 (8 Port SAS) +.It +LSI SAS 3108 (8 Port SAS) +.El +.Sh CONFIGURATION +To disable MSI interrupts for all +.Nm +driver instances, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mpr.disable_msi=1 +.Ed +.Pp +To disable MSI interrupts for a specific +.Nm +driver instance, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mpr.X.disable_msi=1 +.Ed +.Pp +where X is the adapter number. +.Pp +To disable MSI-X interrupts for all +.Nm +driver instances, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mpr.disable_msix=1 +.Ed +.Pp +To disable MSI-X interrupts for a specific +.Nm +driver instance, set the following tunable value in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mpr.X.disable_msix=1 +.Ed +.Pp +To set the maximum number of DMA chains allocated for all adapters, set +the following variable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mpr.max_chains=NNNN +.Ed +.Pp +To set the maximum number of DMA chains allocated for a specific adapter, +set the following variable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mpr.X.max_chains=NNNN +.Ed +.Pp +This variable may also be viewed via +.Xr sysctl 8 +to see the maximum set for a given adapter. +.Pp +The current number of free chain frames may be seen via the +dev.mpr.X.chain_free +.Xr sysctl 8 +variable. +.Pp +The lowest number of free chain frames may be seen via the +dev.mpr.X.chain_free_lowwater +.Xr sysctl 8 +variable. +.Pp +The current number of active I/O commands is shown in the +dev.mpr.X.io_cmds_active +.Xr sysctl 8 +variable. +.Pp +The maximum number of active I/O commands seen since boot is shown in the +dev.mpr.X.io_cmds_highwater +.Xr sysctl 8 +variable. +.Pp +Devices can be excluded from +.Nm +control for all adapters by setting the following variable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.mpr.exclude_ids=Y +.Ed +.Pp +where Y is the target ID of the device. +If more than one device is to be +excluded, target ID's are separated by commas. +.Pp +Devices can be excluded from +.Nm +control for a specific adapter by setting the following variable in +.Xr loader.conf 5 : +.Bd -literal -offset indent +dev.mpr.X.exclude_ids=Y +.Ed +.Pp +where X is the adapter number and Y is the target ID of the device. +If more +than one device is to be excluded, target ID's are separated by commas. +.Sh DEBUGGING +To enable debugging prints from the +.Nm +driver, set the +.Bd -literal -offset indent +hw.mpr.X.debug_level +.Ed +.Pp +variable, where X is the adapter number, either in +.Xr loader.conf 5 +or via +.Xr sysctl 8 . +The following bits have the described effects: +.Bd -literal -offset indent +0x0001 Enable informational prints. +0x0002 Enable prints for driver faults. +0x0004 Enable prints for controller events. +0x0008 Enable prints for controller logging. +0x0010 Enable prints for tracing recovery operations. +0x0020 Enable prints for parameter errors and programming bugs. +0x0040 Enable prints for system initialization operations. +0x0080 Enable prints for more detailed information. +0x0100 Enable prints for user-generated commands. +0x0200 Enable prints for device mapping. +0x0400 Enable prints for tracing through driver functions. +.Ed +.Sh SEE ALSO +.Xr cam 4 , +.Xr cd 4 , +.Xr ch 4 , +.Xr da 4 , +.Xr mps 4 , +.Xr mpt 4 , +.Xr pci 4 , +.Xr sa 4 , +.Xr scsi 4 , +.Xr targ 4 , +.Xr loader.conf 5 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in FreeBSD 9.3. +.Sh AUTHORS +The +.Nm +driver was originally written by +.An -nosplit +.An Scott Long Aq scottl@FreeBSD.org . +It has been improved and tested by LSI Corporation. +.Pp +This man page was written by +.An Ken Merry Aq ken@FreeBSD.org +with additional input from +.An Stephen McConnell Aq stephen.mcconnell@lsi.com . Modified: projects/random_number_generator/share/man/man5/make.conf.5 ============================================================================== --- projects/random_number_generator/share/man/man5/make.conf.5 Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/share/man/man5/make.conf.5 Sat May 3 09:18:59 2014 (r265259) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 28, 2013 +.Dd May 2, 2014 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -692,6 +692,8 @@ and .Ev MAKEOBJDIR are environment variables and should not be set in .Nm +or as command line arguments to +.Xr make 1 , but in make's environment. .Sh BUGS This manual page may occasionally be out of date with respect to Modified: projects/random_number_generator/sys/amd64/conf/GENERIC ============================================================================== --- projects/random_number_generator/sys/amd64/conf/GENERIC Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sys/amd64/conf/GENERIC Sat May 3 09:18:59 2014 (r265259) @@ -119,6 +119,7 @@ device isp # Qlogic family #device ispfw # Firmware for QLogic HBAs- normally a module device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 +device mpr # LSI-Logic MPT-Fusion 3 #device ncr # NCR/Symbios Logic device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') device trm # Tekram DC395U/UW/F DC315U adapters Modified: projects/random_number_generator/sys/arm/conf/VYBRID ============================================================================== --- projects/random_number_generator/sys/arm/conf/VYBRID Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sys/arm/conf/VYBRID Sat May 3 09:18:59 2014 (r265259) @@ -147,3 +147,5 @@ device kbdmux options SC_DFLT_FONT # compile font in makeoptions SC_DFLT_FONT=cp437 device ukbd + +options FDT Modified: projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat May 3 09:18:59 2014 (r265259) @@ -2674,7 +2674,10 @@ zio_vdev_io_done(zio_t **ziop) zio->io_error = zio_handle_label_injection(zio, EIO); if (zio->io_error) { - if (!vdev_accessible(vd, zio)) { + if (zio->io_error == ENOTSUP && + zio->io_type == ZIO_TYPE_FREE) { + /* Not all devices support TRIM. */ + } else if (!vdev_accessible(vd, zio)) { zio->io_error = SET_ERROR(ENXIO); } else { unexpected_error = B_TRUE; Modified: projects/random_number_generator/sys/conf/NOTES ============================================================================== --- projects/random_number_generator/sys/conf/NOTES Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sys/conf/NOTES Sat May 3 09:18:59 2014 (r265259) @@ -176,6 +176,7 @@ options GEOM_SHSEC # Shared secret. options GEOM_STRIPE # Disk striping. options GEOM_SUNLABEL # Sun/Solaris partitioning options GEOM_UZIP # Read-only compressed disks +options GEOM_VINUM # Vinum logical volume manager options GEOM_VIRSTOR # Virtual storage. options GEOM_VOL # Volume names from UFS superblock options GEOM_ZERO # Performance testing helper. Modified: projects/random_number_generator/sys/conf/files ============================================================================== --- projects/random_number_generator/sys/conf/files Sat May 3 09:07:02 2014 (r265258) +++ projects/random_number_generator/sys/conf/files Sat May 3 09:18:59 2014 (r265259) @@ -1804,6 +1804,17 @@ dev/mmc/mmcbr_if.m standard dev/mmc/mmcbus_if.m standard dev/mmc/mmcsd.c optional mmcsd dev/mn/if_mn.c optional mn pci +dev/mpr/mpr.c optional mpr +dev/mpr/mpr_config.c optional mpr +# XXX Work around clang warning, until maintainer approves fix. +dev/mpr/mpr_mapping.c optional mpr \ + compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}" +dev/mpr/mpr_pci.c optional mpr pci +dev/mpr/mpr_sas.c optional mpr \ + compile-with "${NORMAL_C} ${NO_WUNNEEDED_INTERNAL_DECL}" +dev/mpr/mpr_sas_lsi.c optional mpr +dev/mpr/mpr_table.c optional mpr +dev/mpr/mpr_user.c optional mpr dev/mps/mps.c optional mps dev/mps/mps_config.c optional mps # XXX Work around clang warning, until maintainer approves fix. @@ -2758,6 +2769,21 @@ contrib/xz-embedded/linux/lib/xz/xz_dec_ optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" geom/uzip/g_uzip.c optional geom_uzip +geom/vinum/geom_vinum.c optional geom_vinum +geom/vinum/geom_vinum_create.c optional geom_vinum +geom/vinum/geom_vinum_drive.c optional geom_vinum +geom/vinum/geom_vinum_plex.c optional geom_vinum *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***