If I write a PCSTRACE control message to /proc/pid/ctl, the write will fail.  
However, if I write a PCSET control message using the same format, it will 
succeed.  Any suggestions on where I could be going wrong?



[u]Code that fails on write:[/u] 

        struct iovec piov[2];
        sigset_t *sigset;
        long operation;

        /* Build the Control Message */
        operation = PCSTRACE;
        piov[0].iov_base = (caddr_t)(&operation);
        piov[0].iov_len = sizeof(operation);
        premptyset(&sigset);
        praddset(&sigset, SIGEMT); 
        piov[1].iov_base = (caddr_t)(&argument);
        piov[1].iov_len = sizeof(argument);

        /* Write the control message to the ctl file */
        if ((err = writev(fd, piov, 2)) == -1) {
                sprintf(msg, "ERROR: Cannot write to /proc/%d/ctl\n", p);
                log_message(LOG_FILE, msg);
                exit (1);
        }



[u]Code that succeeds on write:[/u]
        ...
        long argument; 

        /* Build the Control Message */
        operation = PCSET;
        piov[0].iov_base = (caddr_t)(&operation);
        piov[0].iov_len = sizeof(operation);

        argument = PR_MSACCT;
        piov[1].iov_base = (caddr_t)(&argument);
        piov[1].iov_len = sizeof(argument);

        /* Finally write the control message to the ctl file */
        if ((err = writev(fd, piov, 2)) == -1) {
                sprintf(msg, "ERROR: Cannot write to /proc/%d/ctl\n", p);
                log_message(LOG_FILE, msg);
                exit (1);
        }
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to