#include <9pm/sys/types.h>
#include <9pm/signal.h>

#define NODEFINE
#include <9pm/u.h>
#include <9pm/libc.h>
#include "../9syscall/sig.h"

int
pm_postnote(int group, int pid, char *note)
{
	int i, sig;

	sig = 9;
	for(i=0; i<pm_nsigtab; i++)
		if(pm_strcmp(note, pm_sigtab[i].desc) == 0){
			sig = i;
			break;
		}

	switch(group) {
	case PM_PNPROC:
		if(kill(pid, sig) < 0){
			pm_oserror();
			return -1;
		}
		return 0;
		
	case PM_PNGROUP:
		pm_werrstr("PNGROUP not supported");
		return -1;
	default:
		pm_werrstr("unknown postnote group");
		return -1;
	}
}
