previous | start | next

Minix Message Structures

Minix message structures are C struct's with two fixed members for the message type and the message source and a union member.

The union member is a union of 7 different struct types.

Here is a slightly simlified example definition of a message structure containing a union with only 2 members instead of 7. It will be used to illustrate the approach taken in the Minix code for naming and accessing the message components.

typedef struct
{
  int m1i1;
  int m1i2;
  char* m1p1;
} mess_1;

typedef struct
{
  int m2i1;
  int m2i2;
  long m2l1;
} mess_2;

typedef struct
{
  int m_type;
  long m_source;
  union {
    mess_1 m_m1;
    mess_2 m_m2;
  } m_u;
} message;


previous | start | next