IPC trap not allowed - Minix

This is a discussion on IPC trap not allowed - Minix ; Hello! I've attached some code that must be compiled on Minix using g++ (GCC 4.1.1). It's sort of hard for you to run the code since it requires a kernel hack that installs my own server into the boot image ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: IPC trap not allowed

  1. IPC trap not allowed

    Hello!

    I've attached some code that must be compiled on Minix using g++ (GCC
    4.1.1). It's sort of hard for you to run the code since it requires a
    kernel hack that installs my own server into the boot image and allows
    "init" children to communicate with ti.

    The thing with the below code is that both receive() and send() return
    error code -110, which means "IPC trap not allowed". However,
    sendrec() works fine for some reason. Anyone ever have this problem?
    I can't figure it out... On the server side, my code does receive(ANY,
    msg) and then send()'s back to msg.m_source just fine. So I'm pretty
    much at a loss and was hoping someone here knew the answer... the
    answer is probably somewhere in the Minix code too.

    Thanks in advance for all your help.

    +++++++++ BEGIN CODE PASTE +++++++++

    #include
    #include
    #include
    #include
    #include

    using namespace std;

    class Test
    {
    private:
    int _exitStatus;

    public:
    inline Test() : _exitStatus(0) {}

    inline void run()
    {
    message msg1, msg2;
    memcpy(msg1.m3_ca1, "testing.", M3_STRING);
    int ret = send(7, &msg1);
    if (ret < 0) {
    cerr << __func__ << ": error: " << ret << endl;
    _exitStatus = ret;
    }

    memset(msg1.m3_ca1, 0, M3_STRING);

    ret = receive(6, &msg1);
    if (ret < 0) {
    cerr << __func__ << ": error: " << ret << endl;
    _exitStatus = ret;
    }

    memcpy(msg1.m3_ca1, "testing.", M3_STRING);
    ret = sendrec(7, &msg1);
    if (ret < 0) {
    fprintf(stderr, "%s: error: %d\n", __func__, ret);
    _exitStatus = ret;
    }
    printf("%s\n", msg1.m3_ca1);
    }

    inline int exitStatus()
    {
    return _exitStatus;
    }
    };

    int main()
    {
    Test t;
    t.run();
    return t.exitStatus();
    }


  2. Re: IPC trap not allowed

    I continuously seem to reply to my own posts, but whatever At the
    very least I hope these posts can help someone.

    I found the answer by taking another look at the boot image defined in
    kernel/table.c. The "init" process is allowed to trap for sendrec and
    some other call; changing it to SRV_T from USR_T did the trick.
    Granted, I know this is dangerous, but I just wanted to make sure my
    server is doing something correctly, and I need to separate the
    send/receive calls for that this one time.

    Thanks again, and have a very Merry Christmas!


+ Reply to Thread