Change sendfile() to use the new m_ext callback scheme for cleaning up after
[dragonfly.git] / sys / sys / sysmsg.h
CommitLineData
c7114eea
MD
1/*
2 * SYS/SYSMSG.H
3 *
1fa2b4b4 4 * $DragonFly: src/sys/sys/sysmsg.h,v 1.5 2004/06/04 20:35:39 dillon Exp $
c7114eea
MD
5 */
6
7#ifndef _SYS_SYSMSG_H_
8#define _SYS_SYSMSG_H_
9
245e4f17
MD
10#ifdef _KERNEL
11
c7114eea 12#ifndef _SYS_CALLOUT_H_
a75a2a96
MD
13#include <sys/callout.h> /* for struct callout */
14#endif
15#ifndef _SYS_TIME_H_
16#include <sys/time.h> /* for struct timespec */
c7114eea
MD
17#endif
18
19/*
245e4f17
MD
20 * The sysmsg holds the kernelland version of a system call.
21 * It typically preceeds the usrmsg and syscall arguments in sysunion
1fa2b4b4
MD
22 * (see sys/sysunion.h). Note that msgq field is used by the governing
23 * process to record a system call that returns EASYNC in order to be able
24 * to properly abort and/or wait on it in exit1(). This is different from
25 * any localized queueing of the LWKT message that the syscall itself might
26 * do.
c7114eea 27 */
df2244e3
MD
28union sysunion;
29
30struct sysmsg {
245e4f17 31 struct lwkt_msg lmsg;
df2244e3 32 void (*copyout)(union sysunion *sysun);
1fa2b4b4 33 TAILQ_ENTRY(sysmsg) msgq;
df2244e3
MD
34 union {
35 struct sysmsg_sleep {
36 struct lwkt_msg lmsg;
37 struct timespec rmt;
38 struct timespec rqt;
39 struct callout timer;
40 } sleep;
41 } sm;
c7114eea
MD
42};
43
1fa2b4b4
MD
44struct proc;
45
46struct sysmsg *sysmsg_wait(struct proc *p, struct sysmsg *sysmsg, int nonblock);
47void sysmsg_rundown(struct proc *p, int doabort);
48
245e4f17
MD
49#endif
50
51/*
52 * The usrmsg holds the userland version of the system call message which
53 * typically preceeds the original user arguments. This message structure
54 * is typically loaded by the copyin() and adjusted prior to copyout(), but
55 * not used in the nominal running of the system call.
56 */
57union usrmsg {
58 struct lwkt_msg umsg;
59};
c7114eea 60
245e4f17 61#ifdef _KERNEL
df2244e3
MD
62typedef struct sysmsg *sysmsg_t;
63#define sysmsg_copyout sysmsg.copyout
64#define sysmsg_lmsg sysmsg.lmsg
245e4f17
MD
65#define sysmsg_result sysmsg.lmsg.u.ms_result
66#define sysmsg_lresult sysmsg.lmsg.u.ms_lresult
67#define sysmsg_resultp sysmsg.lmsg.u.ms_resultp
68#define sysmsg_fds sysmsg.lmsg.u.ms_fds
69#define sysmsg_offset sysmsg.lmsg.u.ms_offset
70#define sysmsg_result32 sysmsg.lmsg.u.ms_result32
71#define sysmsg_result64 sysmsg.lmsg.u.ms_result64
72#endif
73
74typedef union usrmsg *usrmsg_t;
75#define usrmsg_result usrmsg.umsg.u.ms_result
76#define usrmsg_lresult usrmsg.umsg.u.ms_lresult
77#define usrmsg_resultp usrmsg.umsg.u.ms_resultp
78#define usrmsg_fds usrmsg.umsg.u.ms_fds
79#define usrmsg_offset usrmsg.umsg.u.ms_offset
80#define usrmsg_result32 usrmsg.umsg.u.ms_result32
81#define usrmsg_result64 usrmsg.umsg.u.ms_result64
c7114eea
MD
82
83#endif
84