I found an alternate way to write a control message which works for PCSTRACE.
I suspect in my original post, the control message did not contain the correct
number of bytes. For instance, the difference between the code that failed
and the code that worked was the former used a sigset_t * as an argument; the
latter used a long.
Anyways, here is what works (code borrowed from ptrace.c on OpenSolaris):
struct {
long cmd;
union {
long flags;
sigset_t signals;
fltset_t faults;
} arg;
} ctl;
size_t size;
ctl.cmd = PCSTRACE;
premptyset(&ctl.arg.signals);
praddset(&ctl.arg.signals, SIGEMT);
size = sizeof (long) + sizeof (sigset_t);
if((err = write(fd, &ctl, size)) != size){
sprintf(msg, "ERROR: Cannot write to /proc/%d/ctl -- wrote only %d bytes\n", p,
err );
log_message(LOG_FILE, msg);
exit (1);
} else {
sprintf(msg, "SUCCESSFULLY wrote %d bytes to /proc/%d/ctl\n", err, p);
log_message(LOG_FILE, msg);
}
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code