Date: Fri, 27 May 2005 20:14:22 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 77586 for review Message-ID: <200505272014.j4RKEM9O020456@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=77586 Change 77586 by jhb@jhb_slimer on 2005/05/27 20:13:22 IFC @77582 to get latest getfsstat(). Affected files ... .. //depot/projects/smpng/sys/boot/common/console.c#3 integrate .. //depot/projects/smpng/sys/boot/common/loader.8#35 integrate .. //depot/projects/smpng/sys/boot/i386/boot2/boot2.c#25 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/bootinfo.c#10 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/devicename.c#4 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/libi386.h#7 integrate .. //depot/projects/smpng/sys/boot/i386/loader/main.c#9 integrate .. //depot/projects/smpng/sys/boot/pc98/boot2/boot.c#7 integrate .. //depot/projects/smpng/sys/boot/pc98/loader/main.c#8 integrate .. //depot/projects/smpng/sys/compat/linux/linux_stats.c#26 integrate .. //depot/projects/smpng/sys/kern/kern_kse.c#19 integrate .. //depot/projects/smpng/sys/kern/subr_sleepqueue.c#16 integrate .. //depot/projects/smpng/sys/kern/uipc_socket2.c#43 integrate .. //depot/projects/smpng/sys/kern/vfs_syscalls.c#89 integrate .. //depot/projects/smpng/sys/sys/proc.h#144 integrate Differences ... ==== //depot/projects/smpng/sys/boot/common/console.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/common/console.c,v 1.6 2003/08/25 23:30:41 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/common/console.c,v 1.7 2005/05/27 19:30:59 jhb Exp $"); #include <stand.h> #include <string.h> @@ -35,14 +35,15 @@ * Core console support */ -static int cons_set(struct env_var *ev, int flags, void *value); -static int cons_find(char *name); +static int cons_set(struct env_var *ev, int flags, const void *value); +static int cons_find(const char *name); +static int cons_check(const char *string); +static void cons_change(const char *string); /* - * Detect possible console(s) to use. The first probed console - * is marked active. Also create the console variable. - * - * XXX Add logic for multiple console support. + * Detect possible console(s) to use. If preferred console(s) have been + * specified, mark them as active. Else, mark the first probed console + * as active. Also create the console variable. */ void cons_probe(void) @@ -64,6 +65,9 @@ if (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT)) active = cons; } + /* Force a console even if all probes failed */ + if (active == -1) + active = 0; /* Check to see if a console preference has already been registered */ prefconsole = getenv("console"); @@ -71,21 +75,24 @@ prefconsole = strdup(prefconsole); if (prefconsole != NULL) { unsetenv("console"); /* we want to replace this */ - for (cons = 0; consoles[cons] != NULL; cons++) - /* look for the nominated console, use it if it's functional */ - if (!strcmp(prefconsole, consoles[cons]->c_name) && - (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT))) - active = cons; + cons_change(prefconsole); + } else { + consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; + consoles[active]->c_init(0); + prefconsole = strdup(consoles[active]->c_name); + } + + printf("Consoles: "); + for (cons = 0; consoles[cons] != NULL; cons++) + if (consoles[cons]->c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) + printf("%s ", consoles[cons]->c_desc); + printf("\n"); + + if (prefconsole != NULL) { + env_setenv("console", EV_VOLATILE, prefconsole, cons_set, + env_nounset); free(prefconsole); } - if (active == -1) - active = 0; - consoles[active]->c_flags |= (C_ACTIVEIN | C_ACTIVEOUT); - consoles[active]->c_init(0); - - printf("Console: %s\n", consoles[active]->c_desc); - env_setenv("console", EV_VOLATILE, consoles[active]->c_name, cons_set, - env_nounset); } int @@ -128,46 +135,93 @@ consoles[cons]->c_out(c); } +/* + * Find the console with the specified name. + */ static int -cons_find(char *name) +cons_find(const char *name) { int cons; - + for (cons = 0; consoles[cons] != NULL; cons++) if (!strcmp(consoles[cons]->c_name, name)) - return(cons); - return(-1); + return (cons); + return (-1); } - /* - * Select a console. - * - * XXX Note that the console system design allows for some extension - * here (eg. multiple consoles, input/output only, etc.) + * Select one or more consoles. */ static int -cons_set(struct env_var *ev, int flags, void *value) +cons_set(struct env_var *ev, int flags, const void *value) { - int cons, active; + int cons; - if ((value == NULL) || ((active = cons_find(value)) == -1)) { + if ((value == NULL) || (cons_check(value) == -1)) { if (value != NULL) - printf("no such console '%s'\n", (char *)value); + printf("no such console!\n"); printf("Available consoles:\n"); for (cons = 0; consoles[cons] != NULL; cons++) printf(" %s\n", consoles[cons]->c_name); return(CMD_ERROR); } - /* disable all current consoles */ - for (cons = 0; consoles[cons] != NULL; cons++) - consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT); - - /* enable selected console */ - consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; - consoles[active]->c_init(0); + cons_change(value); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); return(CMD_OK); } + +/* + * Check that all of the consoles listed in *string are valid consoles + */ +static int +cons_check(const char *string) +{ + int cons; + char *curpos, *dup, *next; + + dup = next = strdup(string); + cons = -1; + while (next != NULL) { + curpos = strsep(&next, " ,"); + if (*curpos != '\0') { + cons = cons_find(curpos); + if (cons == -1) + break; + } + } + + free(dup); + return (cons); +} + +/* + * Activate all of the consoles listed in *string and disable all the others. + */ +static void +cons_change(const char *string) +{ + int cons; + char *curpos, *dup, *next; + + /* Disable all consoles */ + for (cons = 0; consoles[cons] != NULL; cons++) { + consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT); + } + + /* Enable selected consoles */ + dup = next = strdup(string); + while (next != NULL) { + curpos = strsep(&next, " ,"); + if (*curpos == '\0') + continue; + cons = cons_find(curpos); + if (cons > 0) { + consoles[cons]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT; + consoles[cons]->c_init(0); + } + } + + free(dup); +} ==== //depot/projects/smpng/sys/boot/common/loader.8#35 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/sys/boot/common/loader.8,v 1.79 2005/05/19 23:03:02 sobomax Exp $ +.\" $FreeBSD: src/sys/boot/common/loader.8,v 1.80 2005/05/27 19:30:59 jhb Exp $ .\" .Dd October 15, 2004 .Dt LOADER 8 @@ -65,6 +65,7 @@ variable, or set it to serial console .Pq Dq comconsole if the previous boot stage used that. +If multiple consoles are selected, they will be listed separated by spaces. Then, devices are probed, .Va currdev and @@ -391,7 +392,11 @@ The default is .Dq Li kernel . .It Va console -Defines the current console. +Defines the current console or consoles. +Multiple consoles may be specified. +In that case, the first listed console will become the default console for +userland output (e.g. from +.Xr init 8 ). .It Va currdev Selects the default device. Syntax for devices is odd. ==== //depot/projects/smpng/sys/boot/i386/boot2/boot2.c#25 (text+ko) ==== @@ -14,7 +14,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/boot2/boot2.c,v 1.71 2004/09/18 02:07:00 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/boot2/boot2.c,v 1.72 2005/05/27 19:26:11 jhb Exp $"); #include <sys/param.h> #include <sys/disklabel.h> @@ -243,9 +243,9 @@ fsread(ino, cmd, sizeof(cmd)); if (*cmd) { - printf("%s: %s", PATH_CONFIG, cmd); if (parse()) autoboot = 0; + printf("%s: %s", PATH_CONFIG, cmd); /* Do not process this command twice */ *cmd = 0; } ==== //depot/projects/smpng/sys/boot/i386/libi386/bootinfo.c#10 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/bootinfo.c,v 1.36 2004/12/01 04:59:31 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/bootinfo.c,v 1.37 2005/05/27 19:30:59 jhb Exp $"); #include <stand.h> #include <sys/param.h> @@ -59,10 +59,12 @@ bi_getboothowto(char *kargs) { char *cp; + char *curpos, *next, *string; int howto; int active; int i; - + int vidconsole; + /* Parse kargs */ howto = 0; if (kargs != NULL) { @@ -117,10 +119,34 @@ for (i = 0; howto_names[i].ev != NULL; i++) if (getenv(howto_names[i].ev) != NULL) howto |= howto_names[i].mask; - if (!strcmp(getenv("console"), "comconsole")) - howto |= RB_SERIAL; - if (!strcmp(getenv("console"), "nullconsole")) - howto |= RB_MUTE; + + /* Enable selected consoles */ + string = next = strdup(getenv("console")); + vidconsole = 0; + while (next != NULL) { + curpos = strsep(&next, " ,"); + if (*curpos == '\0') + continue; + if (!strcmp(curpos, "vidconsole")) + vidconsole = 1; + else if (!strcmp(curpos, "comconsole")) + howto |= RB_SERIAL; + else if (!strcmp(curpos, "nullconsole")) + howto |= RB_MUTE; + } + + if (vidconsole && (howto & RB_SERIAL)) + howto |= RB_MULTIPLE; + + /* + * XXX: Note that until the kernel is ready to respect multiple consoles + * for the boot messages, the first named console is the primary console + */ + if (!strcmp(string, "vidconsole")) + howto &= ~RB_SERIAL; + + free(string); + return(howto); } ==== //depot/projects/smpng/sys/boot/i386/libi386/devicename.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/devicename.c,v 1.6 2003/08/25 23:28:31 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/devicename.c,v 1.7 2005/05/27 19:28:04 jhb Exp $"); #include <stand.h> #include <string.h> @@ -230,7 +230,7 @@ * Set currdev to suit the value being supplied in (value) */ int -i386_setcurrdev(struct env_var *ev, int flags, void *value) +i386_setcurrdev(struct env_var *ev, int flags, const void *value) { struct i386_devdesc *ncurr; int rv; ==== //depot/projects/smpng/sys/boot/i386/libi386/libi386.h#7 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/boot/i386/libi386/libi386.h,v 1.19 2004/10/22 14:56:23 simokawa Exp $ + * $FreeBSD: src/sys/boot/i386/libi386/libi386.h,v 1.20 2005/05/27 19:28:04 jhb Exp $ */ @@ -59,7 +59,7 @@ int i386_getdev(void **vdev, const char *devspec, const char **path); char *i386_fmtdev(void *vdev); -int i386_setcurrdev(struct env_var *ev, int flags, void *value); +int i386_setcurrdev(struct env_var *ev, int flags, const void *value); extern struct devdesc currdev; /* our current device */ ==== //depot/projects/smpng/sys/boot/i386/loader/main.c#9 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.30 2004/10/22 14:57:28 simokawa Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.31 2005/05/27 19:31:00 jhb Exp $"); /* * MD bootstrap main() and assorted miscellaneous @@ -98,12 +98,16 @@ * We can use printf() etc. once this is done. * If the previous boot stage has requested a serial console, prefer that. */ - if (initial_howto & RB_SERIAL) + if (initial_howto & RB_MULTIPLE) { + setenv("boot_multicons", "YES", 1); + if (initial_howto & RB_SERIAL) + setenv("console", "comconsole vidconsole", 1); + else + setenv("console", "vidconsole comconsole", 1); + } else if (initial_howto & RB_SERIAL) setenv("console", "comconsole", 1); - if (initial_howto & RB_MUTE) + else if (initial_howto & RB_MUTE) setenv("console", "nullconsole", 1); - if (initial_howto & RB_MULTIPLE) - setenv("boot_multicons", "YES", 1); cons_probe(); /* ==== //depot/projects/smpng/sys/boot/pc98/boot2/boot.c#7 (text+ko) ==== @@ -49,7 +49,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/pc98/boot2/boot.c,v 1.13 2005/05/08 14:17:27 nyan Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/pc98/boot2/boot.c,v 1.14 2005/05/27 19:26:11 jhb Exp $"); #include "boot.h" #include <a.out.h> @@ -124,8 +124,8 @@ readfile("boot.config", boot_config, BOOT_CONFIG_SIZE); name = "/boot/loader"; if (boot_config[0] != '\0') { + getbootdev(boot_config, &loadflags); printf("boot.config: %s", boot_config); - getbootdev(boot_config, &loadflags); if (openrd() != 0) name = "kernel"; } ==== //depot/projects/smpng/sys/boot/pc98/loader/main.c#8 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/pc98/loader/main.c,v 1.19 2005/05/08 14:17:28 nyan Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/pc98/loader/main.c,v 1.20 2005/05/27 19:31:00 jhb Exp $"); /* * MD bootstrap main() and assorted miscellaneous @@ -98,12 +98,16 @@ * We can use printf() etc. once this is done. * If the previous boot stage has requested a serial console, prefer that. */ - if (initial_howto & RB_SERIAL) + if (initial_howto & RB_MULTIPLE) { + setenv("boot_multicons", "YES", 1); + if (initial_howto & RB_SERIAL) + setenv("console", "comconsole vidconsole", 1); + else + setenv("console", "vidconsole comconsole", 1); + } else if (initial_howto & RB_SERIAL) setenv("console", "comconsole", 1); - if (initial_howto & RB_MUTE) + else if (initial_howto & RB_MUTE) setenv("console", "nullconsole", 1); - if (initial_howto & RB_MULTIPLE) - setenv("boot_multicons", "YES", 1); cons_probe(); /* ==== //depot/projects/smpng/sys/compat/linux/linux_stats.c#26 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.69 2005/05/22 22:30:31 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.70 2005/05/27 19:25:39 pjd Exp $"); #include "opt_mac.h" @@ -227,8 +227,7 @@ } static void -bsd_to_linux_statfs(struct thread *td, struct statfs *bsd_statfs, - struct l_statfs *linux_statfs) +bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs) { linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename); @@ -261,7 +260,7 @@ LFREEPATH(path); if (error) return (error); - bsd_to_linux_statfs(td, &bsd_statfs, &linux_statfs); + bsd_to_linux_statfs(&bsd_statfs, &linux_statfs); return copyout(&linux_statfs, args->buf, sizeof(linux_statfs)); } @@ -279,7 +278,7 @@ error = kern_fstatfs(td, args->fd, &bsd_statfs); if (error) return error; - bsd_to_linux_statfs(td, &bsd_statfs, &linux_statfs); + bsd_to_linux_statfs(&bsd_statfs, &linux_statfs); return copyout(&linux_statfs, args->buf, sizeof(linux_statfs)); } ==== //depot/projects/smpng/sys/kern/kern_kse.c#19 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.212 2005/04/23 02:32:31 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.213 2005/05/27 15:57:27 davidxu Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1427,16 +1427,6 @@ return (error); /* go sync */ } -int -thread_upcall_check(struct thread *td) -{ - PROC_LOCK_ASSERT(td->td_proc, MA_OWNED); - if (td->td_kflags & TDK_WAKEUP) - return (1); - else - return (0); -} - /* * called after ptrace resumed a process, force all * virtual CPUs to schedule upcall for SA process, ==== //depot/projects/smpng/sys/kern/subr_sleepqueue.c#16 (text+ko) ==== @@ -62,7 +62,7 @@ #include "opt_sleepqueue_profiling.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_sleepqueue.c,v 1.17 2005/04/14 06:30:32 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_sleepqueue.c,v 1.18 2005/05/27 15:57:27 davidxu Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -345,10 +345,8 @@ struct sleepqueue *sq; struct thread *td; struct proc *p; - int do_upcall; int sig; - do_upcall = 0; td = curthread; p = td->td_proc; sc = SC_LOOKUP(wchan); @@ -370,8 +368,6 @@ mtx_unlock(&p->p_sigacts->ps_mtx); if (sig == 0 && thread_suspend_check(1)) sig = SIGSTOP; - else - do_upcall = thread_upcall_check(td); PROC_UNLOCK(p); /* @@ -383,7 +379,7 @@ sleepq_lock(wchan); sq = sleepq_lookup(wchan); mtx_lock_spin(&sched_lock); - if (TD_ON_SLEEPQ(td) && (sig != 0 || do_upcall != 0)) + if (TD_ON_SLEEPQ(td) && sig != 0) sleepq_resume_thread(sq, td, -1); else if (!TD_ON_SLEEPQ(td) && sig == 0) td->td_flags &= ~TDF_SINTR; ==== //depot/projects/smpng/sys/kern/uipc_socket2.c#43 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_socket2.c,v 1.145 2005/03/12 13:39:39 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_socket2.c,v 1.146 2005/05/27 17:16:43 rwatson Exp $"); #include "opt_mac.h" #include "opt_param.h" @@ -159,15 +159,12 @@ { /* - * XXXRW: This code separately acquires SOCK_LOCK(so) and - * SOCKBUF_LOCK(&so->so_rcv) even though they are the same mutex to - * avoid introducing the assumption that they are the same. + * XXXRW: This code assumes that SOCK_LOCK(so) and + * SOCKBUF_LOCK(&so->so_rcv) are the same. */ - SOCK_LOCK(so); + SOCKBUF_LOCK(&so->so_rcv); so->so_state &= ~SS_ISCONNECTING; so->so_state |= SS_ISDISCONNECTING; - SOCK_UNLOCK(so); - SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state |= SBS_CANTRCVMORE; sorwakeup_locked(so); SOCKBUF_LOCK(&so->so_snd); @@ -182,16 +179,12 @@ { /* - * XXXRW: This code separately acquires SOCK_LOCK(so) and - * SOCKBUF_LOCK(&so->so_rcv) even though they are the same mutex to - * avoid introducing the assumption that they are the same. + * XXXRW: This code assumes that SOCK_LOCK(so) and + * SOCKBUF_LOCK(&so->so_rcv) are the same. */ - /* XXXRW: so_state locking? */ - SOCK_LOCK(so); + SOCKBUF_LOCK(&so->so_rcv); so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= SS_ISDISCONNECTED; - SOCK_UNLOCK(so); - SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state |= SBS_CANTRCVMORE; sorwakeup_locked(so); SOCKBUF_LOCK(&so->so_snd); ==== //depot/projects/smpng/sys/kern/vfs_syscalls.c#89 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.380 2005/05/22 23:05:27 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.383 2005/05/27 19:23:48 pjd Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -240,7 +240,8 @@ mtx_lock(&Giant); NDINIT(&nd, LOOKUP, FOLLOW, pathseg, path, td); - if ((error = namei(&nd)) != 0) { + error = namei(&nd); + if (error) { mtx_unlock(&Giant); return (error); } @@ -308,7 +309,8 @@ struct statfs *sp, sb; int error; - if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0) + error = getvnode(td->td_proc->p_fd, fd, &fp); + if (error) return (error); mtx_lock(&Giant); mp = fp->f_vnode->v_mount; @@ -441,7 +443,7 @@ /* * Get old format filesystem statistics. */ -static void cvtstatfs(struct thread *, struct statfs *, struct ostatfs *); +static void cvtstatfs(struct statfs *, struct ostatfs *); #ifndef _SYS_SYSPROTO_H_ struct freebsd4_statfs_args { @@ -464,7 +466,7 @@ error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf); if (error) return (error); - cvtstatfs(td, &sf, &osb); + cvtstatfs(&sf, &osb); return (copyout(&osb, uap->buf, sizeof(osb))); } @@ -492,7 +494,7 @@ error = kern_fstatfs(td, uap->fd, &sf); if (error) return (error); - cvtstatfs(td, &sf, &osb); + cvtstatfs(&sf, &osb); return (copyout(&osb, uap->buf, sizeof(osb))); } @@ -524,6 +526,7 @@ maxcount = uap->bufsize / sizeof(struct ostatfs); sfsp = (caddr_t)uap->buf; count = 0; + mtx_lock(&Giant); mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { if (!prison_check_mount(td->td_ucred, mp)) { @@ -561,10 +564,11 @@ sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - cvtstatfs(td, sp, &osb); + cvtstatfs(sp, &osb); error = copyout(&osb, sfsp, sizeof(osb)); if (error) { vfs_unbusy(mp, td); + mtx_unlock(&Giant); return (error); } sfsp += sizeof(osb); @@ -575,6 +579,7 @@ vfs_unbusy(mp, td); } mtx_unlock(&mountlist_mtx); + mtx_unlock(&Giant); if (sfsp && count > maxcount) td->td_retval[0] = maxcount; else @@ -604,12 +609,13 @@ fhandle_t fh; int error; - if ((error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t))) != 0) + error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); + if (error) return (error); error = kern_fhstatfs(td, fh, &sf); if (error) return (error); - cvtstatfs(td, &sf, &osb); + cvtstatfs(&sf, &osb); return (copyout(&osb, uap->buf, sizeof(osb))); } @@ -617,8 +623,7 @@ * Convert a new format statfs structure to an old format statfs structure. */ static void -cvtstatfs(td, nsp, osp) - struct thread *td; +cvtstatfs(nsp, osp) struct statfs *nsp; struct ostatfs *osp; { @@ -4188,12 +4193,13 @@ fhandle_t fh; int error; - if ((error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t))) != 0) + error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); + if (error) return (error); error = kern_fhstatfs(td, fh, &sf); - if (error == 0) - error = copyout(&sf, uap->buf, sizeof(sf)); - return (error); + if (error) + return (error); + return (copyout(&sf, uap->buf, sizeof(sf))); } int @@ -4209,7 +4215,8 @@ return (error); if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) return (ESTALE); - if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp))) + error = VFS_FHTOVP(mp, &fh.fh_fid, &vp); + if (error) return (error); mp = vp->v_mount; sp = &mp->mnt_stat; @@ -4225,7 +4232,8 @@ sp->f_version = STATFS_VERSION; sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - if ((error = VFS_STATFS(mp, sp, td)) != 0) + error = VFS_STATFS(mp, sp, td); + if (error) return (error); *buf = *sp; return (0); ==== //depot/projects/smpng/sys/sys/proc.h#144 (text+ko) ==== @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.429 2005/05/23 23:01:53 ups Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.430 2005/05/27 15:57:27 davidxu Exp $ */ #ifndef _SYS_PROC_H_ @@ -928,7 +928,6 @@ void thread_unlink(struct thread *td); void thread_unsuspend(struct proc *p); void thread_unsuspend_one(struct thread *td); -int thread_upcall_check(struct thread *td); void thread_unthread(struct thread *td); int thread_userret(struct thread *td, struct trapframe *frame); void thread_user_enter(struct thread *td);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505272014.j4RKEM9O020456>