9fans archive / 1997 / 05 / 45 /    prev next

From: G. David Butler gdb@dbS...
Subject: calling sleep() while holding lock()
Date: Fri, 9 May 1997 08:41:22 -0500

I wrote:

>The boddles follow relative to /sys/src/9 with the original files
>called file_name.cdrom (e.g. port/fault.c.cdrom)
>
>To make sure you get the whole thing, the last line says ThEeNd.
>Remove it before you send it to rc -X.

Well some mailer along the way doesn't like lines with a lone period :-)

Take the following and do a 1,$s/^.// on it from ed and it will
be usable

David Butler
gdb@dbS...

##!/bin/rc
##
## command: /bin/boddle pc/clock.c.cdrom pc/clock.c
## srcdir: pc
## version: 863162201
## date: Fri May 9 02:16:41 CDT 1997
##
#myname=$0
#doextract=no
#
#fn usage{
#	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
#	exit usage
#}
#
#fn sigint{
#	rm -rf 863162201
#	exit interrupt
#}
#
#while(~ $1 -*){
#	switch($1){
#	case -X
#		doextract=yes
#	case -*
#		usage
#	}
#	shift
#}
#
#switch($#*){
#case 0
#	srcdir=pc
#case 1
#	srcdir=$1
#case *
#	usage
#}
#
#if(! ~ $doextract yes){
#	echo This shell file contains a bundle of diffs representing changes
#	echo to original source files in the Plan 9 distribution. It will run
#	echo against the files in
#	echo ' ' $srcdir
#	echo '(unless overridden by the optional source directory argument)'
#	echo and create a directory 863162201 containing the updated files.
#	echo It will NOT automatically update the original files.
#	echo
#	echo Invoke with argument -X to perform the actual extraction.
#	exit 0
#}
#
#rm -rf 863162201
#mkdir 863162201
#
#target=863162201/clock.c.cdrom
#echo -n '863162201/clock.c.cdrom: '
#if(! test -f $srcdir/clock.c.cdrom || ! test -r $srcdir/clock.c.cdrom){
#	echo $srcdir/clock.c.cdrom unreadable
#	exit unreadable
#}
#sum=`{sum < $srcdir/clock.c.cdrom}
#if(! ~ a11baa684391  $sum(1)^$sum(2)){
#	echo $srcdir/clock.c.cdrom is not the original distribution file
#	exit original
#}
#cp $srcdir/clock.c.cdrom 863162201/clock.c.cdrom
#ed 863162201/clock.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM clock.c.cdrom'
#66,70c
#		if(p->hasspin == 0 && anyready()){
#			sched();
#.
#62c
#	if(u && p && p->state == Running){
#.
#wq
#//GO.SYSIN DD VADIM clock.c.cdrom
#sum=`{sum < 863162201/clock.c.cdrom}
#if(~ b4c370264365  $sum(1)^$sum(2))
#	echo
#if not{
#	echo 863162201/clock.c.cdrom checksum error creating updated file
#	exit checksum
#}
##!/bin/rc
##
## command: /bin/boddle port/devbit.c.cdrom port/devbit.c
## srcdir: port
## version: 863162229
## date: Fri May 9 02:17:09 CDT 1997
##
#myname=$0
#doextract=no
#
#fn usage{
#	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
#	exit usage
#}
#
#fn sigint{
#	rm -rf 863162229
#	exit interrupt
#}
#
#while(~ $1 -*){
#	switch($1){
#	case -X
#		doextract=yes
#	case -*
#		usage
#	}
#	shift
#}
#
#switch($#*){
#case 0
#	srcdir=port
#case 1
#	srcdir=$1
#case *
#	usage
#}
#
#if(! ~ $doextract yes){
#	echo This shell file contains a bundle of diffs representing changes
#	echo to original source files in the Plan 9 distribution. It will run
#	echo against the files in
#	echo ' ' $srcdir
#	echo '(unless overridden by the optional source directory argument)'
#	echo and create a directory 863162229 containing the updated files.
#	echo It will NOT automatically update the original files.
#	echo
#	echo Invoke with argument -X to perform the actual extraction.
#	exit 0
#}
#
#rm -rf 863162229
#mkdir 863162229
#
#target=863162229/devbit.c.cdrom
#echo -n '863162229/devbit.c.cdrom: '
#if(! test -f $srcdir/devbit.c.cdrom || ! test -r $srcdir/devbit.c.cdrom){
#	echo $srcdir/devbit.c.cdrom unreadable
#	exit unreadable
#}
#sum=`{sum < $srcdir/devbit.c.cdrom}
#if(! ~ d3657f7546179  $sum(1)^$sum(2)){
#	echo $srcdir/devbit.c.cdrom is not the original distribution file
#	exit original
#}
#cp $srcdir/devbit.c.cdrom 863162229/devbit.c.cdrom
#ed 863162229/devbit.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM devbit.c.cdrom'
#432d
#429a
#			free(b);
#.
#426a
#		b = smalloc(sizeof(GBitmap));
#.
#wq
#//GO.SYSIN DD VADIM devbit.c.cdrom
#sum=`{sum < 863162229/devbit.c.cdrom}
#if(~ 45a5486b46191  $sum(1)^$sum(2))
#	echo
#if not{
#	echo 863162229/devbit.c.cdrom checksum error creating updated file
#	exit checksum
#}
##!/bin/rc
##
## command: /bin/boddle port/fault.c.cdrom port/fault.c
## srcdir: port
## version: 863162247
## date: Fri May 9 02:17:27 CDT 1997
##
#myname=$0
#doextract=no
#
#fn usage{
#	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
#	exit usage
#}
#
#fn sigint{
#	rm -rf 863162247
#	exit interrupt
#}
#
#while(~ $1 -*){
#	switch($1){
#	case -X
#		doextract=yes
#	case -*
#		usage
#	}
#	shift
#}
#
#switch($#*){
#case 0
#	srcdir=port
#case 1
#	srcdir=$1
#case *
#	usage
#}
#
#if(! ~ $doextract yes){
#	echo This shell file contains a bundle of diffs representing changes
#	echo to original source files in the Plan 9 distribution. It will run
#	echo against the files in
#	echo ' ' $srcdir
#	echo '(unless overridden by the optional source directory argument)'
#	echo and create a directory 863162247 containing the updated files.
#	echo It will NOT automatically update the original files.
#	echo
#	echo Invoke with argument -X to perform the actual extraction.
#	exit 0
#}
#
#rm -rf 863162247
#mkdir 863162247
#
#target=863162247/fault.c.cdrom
#echo -n '863162247/fault.c.cdrom: '
#if(! test -f $srcdir/fault.c.cdrom || ! test -r $srcdir/fault.c.cdrom){
#	echo $srcdir/fault.c.cdrom unreadable
#	exit unreadable
#}
#sum=`{sum < $srcdir/fault.c.cdrom}
#if(! ~ 2a5f95575928  $sum(1)^$sum(2)){
#	echo $srcdir/fault.c.cdrom is not the original distribution file
#	exit original
#}
#cp $srcdir/fault.c.cdrom 863162247/fault.c.cdrom
#ed 863162247/fault.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM fault.c.cdrom'
#144c
#				if ((new = malloc(sizeof(Page))) == 0)
#					panic("malloc in fixfault");
#.
#wq
#//GO.SYSIN DD VADIM fault.c.cdrom
#sum=`{sum < 863162247/fault.c.cdrom}
#if(~ 9c3feeeb5972  $sum(1)^$sum(2))
#	echo
#if not{
#	echo 863162247/fault.c.cdrom checksum error creating updated file
#	exit checksum
#}
##!/bin/rc
##
## command: /bin/boddle port/proc.c.cdrom port/proc.c
## srcdir: port
## version: 863162273
## date: Fri May 9 02:17:53 CDT 1997
##
#myname=$0
#doextract=no
#
#fn usage{
#	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
#	exit usage
#}
#
#fn sigint{
#	rm -rf 863162273
#	exit interrupt
#}
#
#while(~ $1 -*){
#	switch($1){
#	case -X
#		doextract=yes
#	case -*
#		usage
#	}
#	shift
#}
#
#switch($#*){
#case 0
#	srcdir=port
#case 1
#	srcdir=$1
#case *
#	usage
#}
#
#if(! ~ $doextract yes){
#	echo This shell file contains a bundle of diffs representing changes
#	echo to original source files in the Plan 9 distribution. It will run
#	echo against the files in
#	echo ' ' $srcdir
#	echo '(unless overridden by the optional source directory argument)'
#	echo and create a directory 863162273 containing the updated files.
#	echo It will NOT automatically update the original files.
#	echo
#	echo Invoke with argument -X to perform the actual extraction.
#	exit 0
#}
#
#rm -rf 863162273
#mkdir 863162273
#
#target=863162273/proc.c.cdrom
#echo -n '863162273/proc.c.cdrom: '
#if(! test -f $srcdir/proc.c.cdrom || ! test -r $srcdir/proc.c.cdrom){
#	echo $srcdir/proc.c.cdrom unreadable
#	exit unreadable
#}
#sum=`{sum < $srcdir/proc.c.cdrom}
#if(! ~ d4143c7915168  $sum(1)^$sum(2)){
#	echo $srcdir/proc.c.cdrom is not the original distribution file
#	exit original
#}
#cp $srcdir/proc.c.cdrom 863162273/proc.c.cdrom
#ed 863162273/proc.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM proc.c.cdrom'
#693a
#			unlock(&p->exl);
#.
#691d
#542a
#	unlock(&p->rlock);
#	splx(s);
#.
#527,541c
#	s = splhi();
#	lock(&p->rlock);
#	r = p->r;
#	if(r){
#		if(r->p != p || p->r != r || p->state != Wakeme)
#			panic("postnote: state");
#		r->p = 0;
#		p->r = 0;
#		ready(p);
#.
#479c
#
#	unlock(&p->rlock);
#.
#472c
#	if(p == 0)
#		return;
#
#	s = splhi();
#	lock(&p->rlock);
#
#	if(r->p == p && p->r == r){
#.
#469,470d
#406c
#		unlock(&p->rlock);
#.
#403c
#		lock(&p->rlock);
#.
#396a
#	if (p->hasspin)
#		panic("hasspin %d %d\n", p->pid, p->hasspin);
#.
#386,387c
#	p->r = r;
#	unlock(&p->rlock);
#.
#381,384d
#371,372c
#		r->p = 0;
#		unlock(&p->rlock);
#.
#364,365c
#	s = splhi();
#	lock(&p->rlock);
#	if(r->p){
#		print("double sleep %d %d\n", r->p->pid, p->pid);
#		dumpstack();
#	}
#	r->p = p;
#.
#362d
#352c
#static void
#.
#322c
#			p->mp = m;
#.
#308a
#			p->hasspin = 0;
#.
#94a
#		p = u->p;
#		if (p->pid && p->hasspin)
#			panic("hasspin %d %d\n", p->pid, p->hasspin);
#.
#wq
#//GO.SYSIN DD VADIM proc.c.cdrom
#sum=`{sum < 863162273/proc.c.cdrom}
#if(~ d8988e3715301  $sum(1)^$sum(2))
#	echo
#if not{
#	echo 863162273/proc.c.cdrom checksum error creating updated file
#	exit checksum
#}
##!/bin/rc
##
## command: /bin/boddle port/segment.c.cdrom port/segment.c
## srcdir: port
## version: 863162294
## date: Fri May 9 02:18:14 CDT 1997
##
#myname=$0
#doextract=no
#
#fn usage{
#	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
#	exit usage
#}
#
#fn sigint{
#	rm -rf 863162294
#	exit interrupt
#}
#
#while(~ $1 -*){
#	switch($1){
#	case -X
#		doextract=yes
#	case -*
#		usage
#	}
#	shift
#}
#
#switch($#*){
#case 0
#	srcdir=port
#case 1
#	srcdir=$1
#case *
#	usage
#}
#
#if(! ~ $doextract yes){
#	echo This shell file contains a bundle of diffs representing changes
#	echo to original source files in the Plan 9 distribution. It will run
#	echo against the files in
#	echo ' ' $srcdir
#	echo '(unless overridden by the optional source directory argument)'
#	echo and create a directory 863162294 containing the updated files.
#	echo It will NOT automatically update the original files.
#	echo
#	echo Invoke with argument -X to perform the actual extraction.
#	exit 0
#}
#
#rm -rf 863162294
#mkdir 863162294
#
#target=863162294/segment.c.cdrom
#echo -n '863162294/segment.c.cdrom: '
#if(! test -f $srcdir/segment.c.cdrom || ! test -r $srcdir/segment.c.cdrom){
#	echo $srcdir/segment.c.cdrom unreadable
#	exit unreadable
#}
#sum=`{sum < $srcdir/segment.c.cdrom}
#if(! ~ 7c34b5a48705  $sum(1)^$sum(2)){
#	echo $srcdir/segment.c.cdrom is not the original distribution file
#	exit original
#}
#cp $srcdir/segment.c.cdrom 863162294/segment.c.cdrom
#ed 863162294/segment.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM segment.c.cdrom'
#228c
#		sched();
#.
#90a
#	unlock(s);
#.
#72,73d
#67d
#63c
#	lock(s);
#.
#wq
#//GO.SYSIN DD VADIM segment.c.cdrom
#sum=`{sum < 863162294/segment.c.cdrom}
#if(~ 3203b05a8693  $sum(1)^$sum(2))
#	echo
#if not{
#	echo 863162294/segment.c.cdrom checksum error creating updated file
#	exit checksum
#}
##!/bin/rc
##
## command: /bin/boddle port/taslock.c.cdrom port/taslock.c
## srcdir: port
## version: 863162313
## date: Fri May 9 02:18:33 CDT 1997
##
#myname=$0
#doextract=no
#
#fn usage{
#	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
#	exit usage
#}
#
#fn sigint{
#	rm -rf 863162313
#	exit interrupt
#}
#
#while(~ $1 -*){
#	switch($1){
#	case -X
#		doextract=yes
#	case -*
#		usage
#	}
#	shift
#}
#
#switch($#*){
#case 0
#	srcdir=port
#case 1
#	srcdir=$1
#case *
#	usage
#}
#
#if(! ~ $doextract yes){
#	echo This shell file contains a bundle of diffs representing changes
#	echo to original source files in the Plan 9 distribution. It will run
#	echo against the files in
#	echo ' ' $srcdir
#	echo '(unless overridden by the optional source directory argument)'
#	echo and create a directory 863162313 containing the updated files.
#	echo It will NOT automatically update the original files.
#	echo
#	echo Invoke with argument -X to perform the actual extraction.
#	exit 0
#}
#
#rm -rf 863162313
#mkdir 863162313
#
#target=863162313/taslock.c.cdrom
#echo -n '863162313/taslock.c.cdrom: '
#if(! test -f $srcdir/taslock.c.cdrom || ! test -r $srcdir/taslock.c.cdrom){
#	echo $srcdir/taslock.c.cdrom unreadable
#	exit unreadable
#}
#sum=`{sum < $srcdir/taslock.c.cdrom}
#if(! ~ 744969121109  $sum(1)^$sum(2)){
#	echo $srcdir/taslock.c.cdrom is not the original distribution file
#	exit original
#}
#cp $srcdir/taslock.c.cdrom 863162313/taslock.c.cdrom
#ed 863162313/taslock.c.cdrom >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM taslock.c.cdrom'
#76a
#	if(u && u->p)
#		(u->p->hasspin)--;
#.
#68,69d
#65a
#	if(u && u->p)
#		(u->p->hasspin)--;
#.
#59c
#		(u->p->hasspin)++;
#.
#48,49c
#	panic("lock loop 0x%lux pc 0x%lux held by pc 0x%lux\n",
#			l, pc, l->pc);
#.
#42a
#			if(u && u->p)
#				(u->p->hasspin)++;
#.
#25,26c
#	panic("lock loop 0x%lux pc 0x%lux held by pc 0x%lux\n",
#			l, pc, l->pc);
#.
#20a
#			if(u && u->p)
#				(u->p->hasspin)++;
#.
#18,19d
#wq
#//GO.SYSIN DD VADIM taslock.c.cdrom
#sum=`{sum < 863162313/taslock.c.cdrom}
#if(~ f7c98ba41155  $sum(1)^$sum(2))
#	echo
#if not{
#	echo 863162313/taslock.c.cdrom checksum error creating updated file
#	exit checksum
#}

ThEeNd