XenevaOS
Loading...
Searching...
No Matches
Classes | Macros
auipc.h File Reference
#include <stdint.h>
Include dependency graph for auipc.h:

Go to the source code of this file.

Classes

struct  IpcCreate
 
struct  IpcConnect
 
struct  IpcHandle
 
struct  IpcCall
 
struct  IpcFetch
 
struct  IpcWait
 
struct  IpcRecv
 
struct  IpcReply
 

Macros

#define IPC_MAX_MSG   8192
 
#define IPC_NAME_MAX   24
 
#define IPC_IOC_CREATE   0x5601 /* IpcCreate -> handle */
 
#define IPC_IOC_DESTROY   0x5602 /* IpcHandle */
 
#define IPC_IOC_CONNECT   0x5603 /* IpcConnect -> handle */
 
#define IPC_IOC_CALL   0x5604 /* IpcCall (sleeps) */
 
#define IPC_IOC_FETCH   0x5605 /* IpcFetch */
 
#define IPC_IOC_WAIT   0x5606 /* IpcWait (sleeps) */
 
#define IPC_IOC_RECV   0x5607 /* IpcRecv */
 
#define IPC_IOC_REPLY   0x5608 /* IpcReply */
 
#define IPC_ACL_ANY   0 /* any process may call */
 
#define IPC_ACL_DAEMONS   1 /* only MISC_DAEMONS processes may call */
 
#define IPC_OK   0
 
#define IPC_E_PERM   -1
 
#define IPC_E_INVAL   -2
 
#define IPC_E_NOENT   -3
 
#define IPC_E_BUSY   -4 /* endpoint queue full / name taken */
 
#define IPC_E_TIMEOUT   -5
 
#define IPC_E_DEAD   -6 /* the server went away */
 
#define IPC_E_EMPTY   -7
 
#define IPC_E_TOOBIG   -8
 

Macro Definition Documentation

◆ IPC_ACL_ANY

#define IPC_ACL_ANY   0 /* any process may call */

◆ IPC_ACL_DAEMONS

#define IPC_ACL_DAEMONS   1 /* only MISC_DAEMONS processes may call */

◆ IPC_E_BUSY

#define IPC_E_BUSY   -4 /* endpoint queue full / name taken */

◆ IPC_E_DEAD

#define IPC_E_DEAD   -6 /* the server went away */

◆ IPC_E_EMPTY

#define IPC_E_EMPTY   -7

◆ IPC_E_INVAL

#define IPC_E_INVAL   -2

◆ IPC_E_NOENT

#define IPC_E_NOENT   -3

◆ IPC_E_PERM

#define IPC_E_PERM   -1

◆ IPC_E_TIMEOUT

#define IPC_E_TIMEOUT   -5

◆ IPC_E_TOOBIG

#define IPC_E_TOOBIG   -8

◆ IPC_IOC_CALL

#define IPC_IOC_CALL   0x5604 /* IpcCall (sleeps) */

◆ IPC_IOC_CONNECT

#define IPC_IOC_CONNECT   0x5603 /* IpcConnect -> handle */

◆ IPC_IOC_CREATE

#define IPC_IOC_CREATE   0x5601 /* IpcCreate -> handle */

◆ IPC_IOC_DESTROY

#define IPC_IOC_DESTROY   0x5602 /* IpcHandle */

◆ IPC_IOC_FETCH

#define IPC_IOC_FETCH   0x5605 /* IpcFetch */

◆ IPC_IOC_RECV

#define IPC_IOC_RECV   0x5607 /* IpcRecv */

◆ IPC_IOC_REPLY

#define IPC_IOC_REPLY   0x5608 /* IpcReply */

◆ IPC_IOC_WAIT

#define IPC_IOC_WAIT   0x5606 /* IpcWait (sleeps) */

◆ IPC_MAX_MSG

#define IPC_MAX_MSG   8192

auipc.h – generic kernel IPC: named endpoints with synchronous call/reply.

A server (MISC_DAEMONS group) creates a named endpoint on /dev/ipc. Any process the endpoint's ACL admits can connect by name and CALL it: the kernel copies the request into a queue, wakes the server, and the caller sleeps until the server REPLYs, the timeout expires, or the server dies. The server learns the caller's pid/uid/gid from the kernel, never from the message.

Blocking calls cannot return a value after they sleep (the syscall frame is resumed, not the C stack), so the sleeping operations are paired with a non-blocking one that delivers the data:

client: IPC_IOC_CALL (sleeps) then IPC_IOC_FETCH (reply or error) server: IPC_IOC_WAIT (sleeps) then IPC_IOC_RECV (request or empty) IPC_IOC_REPLY

Fields named status are the result of the sleeping call; read them after it.

◆ IPC_NAME_MAX

#define IPC_NAME_MAX   24

◆ IPC_OK

#define IPC_OK   0