- Various style fixes.

- Fix a silly bug so that we return the actual error code if a procfs
  attach fails rather than always returning 0.

Reported by:	bde
This commit is contained in:
John Baldwin 2001-03-29 18:10:46 +00:00
parent 69f7c9a31c
commit 0316f71d56
2 changed files with 6 additions and 14 deletions

View File

@ -35,8 +35,6 @@
* SUCH DAMAGE.
*
* @(#)procfs_ctl.c 8.4 (Berkeley) 6/15/94
*
* From:
* $FreeBSD$
*/
@ -128,13 +126,12 @@ procfs_control(curp, p, op)
if (op == PROCFS_CTL_ATTACH) {
sx_xlock(&proctree_lock);
PROC_LOCK(p);
/* check whether already being traced */
if (p->p_flag & P_TRACED) {
error = EBUSY;
goto out;
}
/* can't trace yourself! */
/* Can't trace yourself! */
if (p->p_pid == curp->p_pid) {
error = EINVAL;
goto out;
@ -156,10 +153,10 @@ procfs_control(curp, p, op)
proc_reparent(p, curp);
}
psignal(p, SIGSTOP);
out:
out:
PROC_UNLOCK(p);
sx_xunlock(&proctree_lock);
return (0);
return (error);
}
/*
@ -266,7 +263,6 @@ procfs_control(curp, p, op)
* to enter
*/
case PROCFS_CTL_WAIT:
error = 0;
if (p->p_flag & P_TRACED) {
mtx_lock_spin(&sched_lock);
while (error == 0 &&

View File

@ -35,8 +35,6 @@
* SUCH DAMAGE.
*
* @(#)procfs_ctl.c 8.4 (Berkeley) 6/15/94
*
* From:
* $FreeBSD$
*/
@ -128,13 +126,12 @@ procfs_control(curp, p, op)
if (op == PROCFS_CTL_ATTACH) {
sx_xlock(&proctree_lock);
PROC_LOCK(p);
/* check whether already being traced */
if (p->p_flag & P_TRACED) {
error = EBUSY;
goto out;
}
/* can't trace yourself! */
/* Can't trace yourself! */
if (p->p_pid == curp->p_pid) {
error = EINVAL;
goto out;
@ -156,10 +153,10 @@ procfs_control(curp, p, op)
proc_reparent(p, curp);
}
psignal(p, SIGSTOP);
out:
out:
PROC_UNLOCK(p);
sx_xunlock(&proctree_lock);
return (0);
return (error);
}
/*
@ -266,7 +263,6 @@ procfs_control(curp, p, op)
* to enter
*/
case PROCFS_CTL_WAIT:
error = 0;
if (p->p_flag & P_TRACED) {
mtx_lock_spin(&sched_lock);
while (error == 0 &&