diff options
Diffstat (limited to 'usr/src/uts/common/syscall/pgrpsys.c')
-rw-r--r-- | usr/src/uts/common/syscall/pgrpsys.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/usr/src/uts/common/syscall/pgrpsys.c b/usr/src/uts/common/syscall/pgrpsys.c index e8be876537..8f60747663 100644 --- a/usr/src/uts/common/syscall/pgrpsys.c +++ b/usr/src/uts/common/syscall/pgrpsys.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * 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. @@ -19,11 +18,16 @@ * * CDDL HEADER END */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#ident "%Z%%M% %I% %E% SMI" /* from SVr4.0 1.78 */ +#pragma ident "%Z%%M% %I% %E% SMI" /* from SVr4.0 1.78 */ #include <sys/param.h> #include <sys/types.h> @@ -39,8 +43,9 @@ int setpgrp(int flag, int pid, int pgid) { - register proc_t *p = ttoproc(curthread); - register int retval = 0; + proc_t *p = curproc; + int retval = 0; + int sid; switch (flag) { @@ -51,7 +56,10 @@ setpgrp(int flag, int pid, int pgid) sess_create(); } else mutex_exit(&pidlock); - return (p->p_sessp->s_sid); + mutex_enter(&p->p_splock); + sid = p->p_sessp->s_sid; + mutex_exit(&p->p_splock); + return (sid); case 3: /* setsid() */ mutex_enter(&pidlock); @@ -61,7 +69,10 @@ setpgrp(int flag, int pid, int pgid) } mutex_exit(&pidlock); sess_create(); - return (p->p_sessp->s_sid); + mutex_enter(&p->p_splock); + sid = p->p_sessp->s_sid; + mutex_exit(&p->p_splock); + return (sid); case 5: /* setpgid() */ { |