BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionLibC / blob / d0db5bd73909d1f94cac363ea1dfd12674bbd3a4 / include / sys / ipc.h

// Related

OrionLibC

Barry Importing existing Orion LibC 03048a9 (2 years, 2 months ago)
#ifndef _SYS_IPC_H
#define _SYS_IPC_H

#include <stdint.h>
#include <sys/types.h>

/* Processes */
enum Process {
        NO_PROCESS,
        SYSTEM,

        ANY = 0xFFFFFFFF
};

/* Message encodings */
typedef union MessageContent MessageContent;
union MessageContent {
	/* Generics */
	char raw[16];
	void *ptr;
	uint32_t num;
} __attribute__((__transparent_union__));

/* Structure for a message */
typedef struct Message Message;
struct Message {
	pid_t from;
	uint16_t type;
	MessageContent msg;
	Message *next;
} __attribute__((packed));

Message *nb_send_msg(pid_t to, uint16_t type, MessageContent *msg);
Message *send_msg(pid_t to, uint16_t type, MessageContent *msg);
pid_t nb_recv_msg(Message *buf, pid_t from);
pid_t recv_msg(Message *buf, pid_t from);

#endif