--- xinu/sys/psend.c 2018/04/24 17:39:04 1.1.1.1 +++ xinu/sys/psend.c 2018/04/24 17:40:12 1.1.1.2 @@ -11,21 +11,23 @@ */ SYSCALL psend(portid, msg) int portid; -int msg; +WORD msg; { - PStype ps; struct pt *ptptr; int seq; struct ptnode *freenode; - disable(ps); +#ifdef DEBUG + dotrace("psend", &portid, 2); +#endif + disable(); if ( isbadport(portid) || #ifdef MEMMARK unmarked(ptmark) || #endif (ptptr= &ports[portid])->ptstate != PTALLOC ) { - restore(ps); + restore(); return(SYSERR); } @@ -35,22 +37,24 @@ int msg; if (wait(ptptr->ptssem) == SYSERR || ptptr->ptstate != PTALLOC || ptptr->ptseq != seq) { - restore(ps); + restore(); + return(SYSERR); + } + if (ptfree == NULL) { + kprintf("Ports - out of nodes"); return(SYSERR); } - if (ptfree == (struct ptnode *)NULL) - panic("psend: out of nodes"); freenode = ptfree; ptfree = freenode->ptnext; - freenode->ptnext = (struct ptnode *)NULL; + freenode->ptnext = (struct ptnode *) NULL; freenode->ptmsg = msg; - if (ptptr->pttail == (struct ptnode *)NULL) /* empty queue */ + if (ptptr->pttail == (struct ptnode *) NULL) /* empty queue */ ptptr->pttail = ptptr->pthead = freenode; else { (ptptr->pttail)->ptnext = freenode; ptptr->pttail = freenode; } signal(ptptr->ptrsem); - restore(ps); + restore(); return(OK); }