minix3.1.4のmessage構造体の定義

自分が持ってるオペレーティングシステムの第2版のP127によると、minixがメッセージの送受信に使うメッセージの構造体はtype.hとなってるけど、3.1.4だとminix/ipc.hにあった。

typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1; 
        short m2s1;} mess_2;
typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
typedef struct {long m4l1, m4l2, m4l3, m4l4, m4l5;} mess_4;
typedef struct {short m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;
typedef struct {long m6l1, m6l2, m6l3; short m6s1, m6s2, m6s3; char m6c1, m6c2;
        char *m6p1, *m6p2;} mess_6;
typedef struct {int m7i1, m7i2, m7i3, m7i4; char *m7p1, *m7p2;} mess_7;
typedef struct {int m8i1, m8i2; char *m8p1, *m8p2, *m8p3, *m8p4;} mess_8;
typedef struct {long m9l1, m9l2, m9l3, m9l4, m9l5; short m9s1, m9s2, m9s3;
        char m9c1, m9c2; } mess_9;

typedef struct {
  endpoint_t m_source;          /* who sent the message */
  int m_type;                   /* what kind of message is it */
  union {
        mess_1 m_m1;
        mess_2 m_m2;
        mess_3 m_m3;
        mess_4 m_m4;
        mess_5 m_m5;
        mess_7 m_m7;
        mess_8 m_m8;
        mess_6 m_m6;
        mess_9 m_m9;
  } m_u;
} message;

message構造体の1番目のメンバ変数の型(endpoint_t)はminix/type.hで定義

typedef int endpoint_t;                 /* process identifier */

2番目の引数に使うm_typeの値は、minix/com.hで定義しているやつらを使っている様子。



ぱっと見、各メッセージの持つメンバ変数は第2版のころと変わっていない模様。
例えば、servers/vm/main.cのmain()だと、

       if(msg.m_type & NOTIFY_MESSAGE) {
                switch(msg.m_source) {
                        case SYSTEM:
                                /* Kernel wants to have memory ranges
                                 * verified.
                                 */
                                handle_memory();
                                break;
                        case PM_PROC_NR:
                                /* PM sends a notify() on shutdown, which
                                 * is OK and we ignore.
                                 */
                                break;
                        case HARDWARE:
                                /* This indicates a page fault has happened,
                                 * which we have to handle.
                                 */
                                handle_pagefaults();
                                break;
                        default:
                                /* No-one else should send us notifies. */
                                printf("VM: ignoring notify() from %d\n",
                                        msg.m_source);
                                break;
                }
                continue;
        }

ここのcase文で使ってる定数もminix/com.hで定義ずみ。