Add all_sysent target to /usr/src/sys/Makefile to rebuild syscalls.
[dragonfly.git] / sys / sys / msgport.h
CommitLineData
ece04fd0
MD
1/*
2 * SYS/MSGPORT.H
3 *
4 * Implements LWKT messages and ports.
5 *
335dda38 6 * $DragonFly: src/sys/sys/msgport.h,v 1.2 2003/07/22 17:03:34 dillon Exp $
ece04fd0
MD
7 */
8
9#ifndef _SYS_MSGPORT_H_
10#define _SYS_MSGPORT_H_
11
12#ifndef _SYS_QUEUE_H_
13#include <sys/queue.h> /* TAILQ_* macros */
14#endif
15
16struct lwkt_msg;
17struct lwkt_port;
335dda38 18struct thread;
ece04fd0
MD
19
20typedef struct lwkt_msg *lwkt_msg_t;
21typedef struct lwkt_port *lwkt_port_t;
22
335dda38
MD
23typedef TAILQ_HEAD(lwkt_msg_queue, lwkt_msg) lwkt_msg_queue;
24
ece04fd0
MD
25/*
26 * The standard message and port structure for communications between
27 * threads. See kern/lwkt_msgport.c for documentation on how messages and
28 * ports work.
29 */
30typedef struct lwkt_msg {
31 TAILQ_ENTRY(lwkt_msg) ms_node; /* link node (not always used) */
32 lwkt_port_t ms_target_port; /* only used in certain situations */
33 lwkt_port_t ms_reply_port; /* asynch replies returned here */
34 int ms_abortreq; /* set asynchronously */
35 int ms_cmd;
36 int ms_flags;
37 int ms_error;
38} lwkt_msg;
39
40#define MSGF_DONE 0x0001 /* asynch message is complete */
41#define MSGF_REPLY 0x0002 /* asynch message has been returned */
42#define MSGF_QUEUED 0x0004 /* message has been queued sanitychk */
43#define MSGF_ASYNC 0x0008 /* sync/async hint */
44
335dda38
MD
45#define MSG_CMD_CDEV 0x00010000
46#define MSG_CMD_VFS 0x00020000
47#define MSG_CMD_SYSCALL 0x00030000
48#define MSG_SUBCMD_MASK 0x0000FFFF
49
ece04fd0
MD
50typedef struct lwkt_port {
51 lwkt_msg_queue mp_msgq;
52 int mp_flags;
335dda38 53 struct thread *mp_td;
ece04fd0
MD
54 int (*mp_beginmsg)(lwkt_port_t port, lwkt_msg_t msg);
55 void (*mp_abortmsg)(lwkt_port_t port, lwkt_msg_t msg);
56 void (*mp_returnmsg)(lwkt_port_t port, lwkt_msg_t msg);
57} lwkt_port;
58
59#define MSGPORTF_WAITING 0x0001
60
61#ifdef _KERNEL
62
335dda38 63extern void lwkt_init_port(lwkt_port_t port, struct thread *td);
ece04fd0
MD
64extern void lwkt_sendmsg(lwkt_port_t port, lwkt_msg_t msg);
65extern int lwkt_domsg(lwkt_port_t port, lwkt_msg_t msg);
66extern int lwkt_waitmsg(lwkt_msg_t msg);
67extern void lwkt_replyport(lwkt_port_t port, lwkt_msg_t msg);
68extern void lwkt_abortport(lwkt_port_t port, lwkt_msg_t msg);
69extern int lwkt_putport(lwkt_port_t port, lwkt_msg_t msg);
70extern void *lwkt_getport(lwkt_port_t port);
71extern void *lwkt_waitport(lwkt_port_t port);
72
73#endif
74
75#endif