Ejemplo n.º 1
0
void
_threadnote(void *v, char *s)
{
	Proc *p;
	Note *n;

	_threaddebug(DBGNOTE, "Got note %s", s);
//	if(strncmp(s, "sys:", 4) == 0)
//		noted(NDFLT);

//	if(_threadexitsallstatus){
//		_threaddebug(DBGNOTE, "Threadexitsallstatus = '%s'\n", _threadexitsallstatus);
//		_exits(_threadexitsallstatus);
//	}

	if(strcmp(s, "threadint")==0)
		noted(NCONT);

	p = _threadgetproc();
	if(p == nil)
		noted(NDFLT);

	for(n=notes; n<enotes; n++)
		if(canlock(&n->inuse))
			break;
	if(n==enotes)
		sysfatal("libthread: too many delayed notes");
	utfecpy(n->s, n->s+ERRMAX, s);
	n->proc = p;
	p->pending = 1;
	if(!p->splhi)
		delayednotes(p, v);
	noted(NCONT);
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: rennis250/sam
void
notifyf(void *a, char *msg)
{
	if(strcmp(msg, "interrupt") == 0)
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 3
0
void
ding(void *, char *msg)
{
	if(strstr(msg, "alarm") != nil)
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 4
0
/* this is registered in _envsetup */
int
_notehandler(void *u, char *msg)
{
	int i;
	void(*f)(int, char*, Ureg*);
	extern void _doatexits(void);	/* in stdio/exit.c */

	if(_finishing)
		_finish(0, 0);
	for(i = 0; i<NSIGTAB; i++){
		if(strncmp(msg, sigtab[i].msg, strlen(sigtab[i].msg)) == 0){
			f = _sighdlr[sigtab[i].num];
			if(f == SIG_DFL || f == SIG_ERR)
				break;
			if(f != SIG_IGN) {
				_notetramp(sigtab[i].num, f, u);
				/* notetramp is machine-dependent; doesn't return to here */
			}
			noted(0); /* NCONT */
			return 0;
		}
	}
	//_doatexits();
	noted(1); /* NDFLT */
	return 0;
}
Ejemplo n.º 5
0
Archivo: aux.c Proyecto: 99years/plan9
void
catchint(void *a, char *note)
{
	USED(a);
	if(strcmp(note, "alarm") == 0)
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 6
0
void
ding(void*, char *s)
{
	if(strstr(s, "alarm"))
		noted(NCONT);
	else
		noted(NDFLT);
}
Ejemplo n.º 7
0
void
catcher(void*, char *msg)
{
	timedout = 1;
	if(strcmp(msg, "alarm") == 0)
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 8
0
Archivo: vacfs.c Proyecto: npe9/harvey
void
notifyf(void *a, char *s)
{
	USED(a);
	if(strncmp(s, "interrupt", 9) == 0)
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 9
0
Archivo: dn.c Proyecto: aahud/harvey
static void
ding(void *v, char *msg)
{
	if(strstr(msg, "alarm") != nil) {
		stats.alarms++;
		noted(NCONT);		/* resume with system call error */
	} else
		noted(NDFLT);		/* die */
}
Ejemplo n.º 10
0
Archivo: rip.c Proyecto: aahud/harvey
void
ding(void *u, char *msg)
{
	USED(u);

	if(strstr(msg, "alarm"))
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 11
0
Archivo: ssh1.c Proyecto: aahud/harvey
static void
cookedcatchint(void*, char *msg)
{
	if(strstr(msg, "interrupt"))
		noted(NCONT);
	else if(strstr(msg, "kill"))
		noted(NDFLT);
	else
		noted(NCONT);
}
Ejemplo n.º 12
0
void
catcher(void *a, char *msg)
{
	USED(a);
	if(strcmp(msg, "interrupt") != 0)
		noted(NDFLT);

	count = 1;
	print("ki\n");
	noted(NCONT);
}
Ejemplo n.º 13
0
void
catchalarm(void *regs, char *msg)
{
	USED(regs);
	USED(msg);
	if(strcmp(msg, "alarm") == 0){
		alarmed = 1;
		noted(NCONT);
	} else
		noted(NDFLT);
}
Ejemplo n.º 14
0
void
catcher(void *junk, char *s)
{
	USED(junk);

	if(strstr(s, "interrupt")) {
		gotint = 1;
		noted(NCONT);
	}
	noted(NDFLT);
}
Ejemplo n.º 15
0
/*
 * An interrupt occurred;
 * seek to the end of the current file
 * and remember that there was a fault.
 */
void
fault(void *a, char *s)
{
	USED(a);
	if(strncmp(s, "interrupt", 9) == 0){
		seek(infile, 0L, 2);
		mkfault++;
		noted(NCONT);
	}
	noted(NDFLT);
}
Ejemplo n.º 16
0
/*
 *  ignore interrupts
 */
void
notifyf(void *a, char *msg)
{
	USED(a);
	if(strcmp(msg, "interrupt") == 0){
		interrupted = 1;
		noted(NCONT);
	}
	if(strcmp(msg, "hangup") == 0)
		noted(NCONT);
	noted(NDFLT);
}
Ejemplo n.º 17
0
void
notifyf(void *a, char *s)
{
	USED(a);
	if(bpipeok && strcmp(s, "sys: write on closed pipe") == 0)
		noted(NCONT);
	if(strcmp(s, "interrupt") == 0)
		noted(NCONT);
	panicking = 1;
	rescue();
	noted(NDFLT);
}
Ejemplo n.º 18
0
Archivo: srv.c Proyecto: npe9/harvey
void
ignore(void *a, char *c)
{
	USED(a);
	if(strcmp(c, "alarm") == 0){
		fprint(2, "srv: timeout establishing connection to %s\n", dest);
		exits("timeout");
	}
	if(strstr(c, "write on closed pipe") == 0){
		fprint(2, "write on closed pipe\n");
		noted(NCONT);
	}
	noted(NDFLT);
}
Ejemplo n.º 19
0
Archivo: stats.c Proyecto: aahud/harvey
void
alarmed(void *a, char *s)
{
	if(strcmp(s, "alarm") == 0)
		notejmp(a, catchalarm, 1);
	noted(NDFLT);
}
Ejemplo n.º 20
0
void
_notetramp(int sig, void (*hdlr)(int, char*, Ureg*), Ureg *u)
{
	Pcstack *p;

	if(nstack >= MAXSIGSTACK)
		noted(NDFLT);	/* nesting too deep; just do system default */
	p = &pcstack[nstack];
	p->restorepc = u->ip;
	p->sig = sig;
	p->hdlr = hdlr;
	p->u = u;
	nstack++;
	u->ip = (uint64_t) notecont;
	noted(NSAVE);	/* clear note but hold state */
}
Ejemplo n.º 21
0
void
failure(void*, char *note)
{
	if(strcmp(note, "failure") == 0)
		_exits(nil);
	noted(NDFLT);
}
Ejemplo n.º 22
0
static void
delayednotes(Proc *p, void *v)
{
	int i;
	Note *n;
	int (*fn)(void*, char*);

	if(!p->pending)
		return;

	p->pending = 0;
	for(n=notes; n<enotes; n++){
		if(n->proc == p){
			for(i=0; i<NFN; i++){
				if(onnotepid[i]!=p->pid || (fn = onnote[i])==nil)
					continue;
				if((*fn)(v, n->s))
					break;
			}
			if(i==NFN){
				_threaddebug(DBGNOTE, "Unhandled note %s, proc %p\n", n->s, p);
				if(v != nil)
					noted(NDFLT);
				else if(strncmp(n->s, "sys:", 4)==0)
					abort();
				threadexitsall(n->s);
			}
			n->proc = nil;
			unlock(&n->inuse);
		}
	}
}
Ejemplo n.º 23
0
void
bell(void *v, char *msg)
{
	if(strcmp(msg, "alarm") == 0)
		drawsleep = drawsleep ? 0 : 1000;
	noted(NCONT);
}
Ejemplo n.º 24
0
void
handler(void *v, char *s)
{
	fprint(2, "%d: %d iterations\n", id, i);
	if (intr++ < 16)
		noted(NCONT);
	fprint(2, "FAIL: too many interrupts\n");
	exits("FAIL");
}
Ejemplo n.º 25
0
void
catcher(void *u, char *s)
{
	err = 0;
	if(strncmp(s, "sys: fp:", 8) == 0){
		err = s;
		notejmp(u, errj, 0);
	}
	noted(NDFLT);
}
Ejemplo n.º 26
0
Archivo: ed.c Proyecto: Earnestly/plan9
void
notifyf(void *a, char *s)
{
	if(strcmp(s, "interrupt") == 0){
		if(rescuing || waiting)
			noted(NCONT);
		putchr(L'\n');
		lastc = '\n';
		error1(Q);
		notejmp(a, savej, 0);
	}
	if(strcmp(s, "hangup") == 0){
		if(rescuing)
			noted(NDFLT);
		rescue();
	}
	fprint(2, "ed: note: %s\n", s);
	abort();
}
Ejemplo n.º 27
0
Archivo: cpu.c Proyecto: 99years/plan9
void
catcher(void*, char *text)
{
	int n;

	n = strlen(text);
	if(n >= sizeof(notebuf))
		n = sizeof(notebuf)-1;
	memmove(notebuf, text, n);
	notebuf[n] = '\0';
	noted(NCONT);
}
Ejemplo n.º 28
0
void
notejmp(void *vr, jmp_buf j, int ret)
{
	struct Ureg *r = vr;

	r->r0 = ret;
	if(ret == 0)
		r->r0 = 1;
	r->pc = j[JMPBUFPC];
	r->sp = j[JMPBUFSP];
	noted(NCONT);
}
Ejemplo n.º 29
0
static void
notecont(Ureg *u, char *s)
{
	Pcstack *p;
	void(*f)(int, char*, Ureg*);

	p = &pcstack[nstack-1];
	f = p->hdlr;
	u->ip = p->restorepc;
	nstack--;
	(*f)(p->sig, s, u);
	noted(NRSTR);
}
Ejemplo n.º 30
0
Archivo: plan9.c Proyecto: aahud/harvey
void
notifyf(void* v, char *s)
{
	int i;
	for(i = 0;syssigname[i];i++) if(strncmp(s, syssigname[i], strlen(syssigname[i]))==0){
		if(strncmp(s, "sys: ", 5)!=0) interrupted = 1;
		goto Out;
	}
	pfmt(err, "rc: note: %s\n", s);
	noted(NDFLT);
	return;
Out:
	if(strcmp(s, "interrupt")!=0 || trap[i]==0){
		trap[i]++;
		ntrap++;
	}
	if(ntrap>=32){	/* rc is probably in a trap loop */
		pfmt(err, "rc: Too many traps (trap %s), aborting\n", s);
		abort();
	}
	noted(NCONT);
}