This source file includes following definitions.
- freebsd_sys_rtprio
- freebsd_sys_poll2
- freebsd_sys_madvise
- freebsd_readdir_callback
- freebsd_sys_getdents
- freebsd_sys_mmap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/proc.h>
42 #include <sys/mount.h>
43 #include <sys/file.h>
44 #include <sys/dirent.h>
45 #include <sys/filedesc.h>
46 #include <sys/mman.h>
47 #include <sys/vnode.h>
48
49 #include <sys/syscallargs.h>
50
51 #include <compat/freebsd/freebsd_signal.h>
52 #include <compat/freebsd/freebsd_syscallargs.h>
53 #include <compat/freebsd/freebsd_util.h>
54 #include <compat/freebsd/freebsd_rtprio.h>
55
56 #include <compat/common/compat_dir.h>
57
58
59
60 int
61 freebsd_sys_rtprio(p, v, retval)
62 struct proc *p;
63 void *v;
64 register_t *retval;
65 {
66 #ifdef notyet
67 struct freebsd_sys_rtprio_args
68
69
70
71 *uap = v;
72 #endif
73
74 return ENOSYS;
75 }
76
77
78
79
80
81
82 int
83 freebsd_sys_poll2(p, v, retval)
84 struct proc *p;
85 void *v;
86 register_t *retval;
87 {
88 return (sys_poll(p, v, retval));
89 }
90
91
92
93
94 int
95 freebsd_sys_madvise(p, v, retval)
96 struct proc *p;
97 void *v;
98 register_t *retval;
99 {
100 return (0);
101 }
102
103
104 int freebsd_readdir_callback(void *, struct dirent *, off_t);
105
106 struct freebsd_readdir_callback_args {
107 caddr_t outp;
108 int resid;
109 };
110
111 int
112 freebsd_readdir_callback(void *arg, struct dirent *bdp, off_t cookie)
113 {
114 struct freebsd_readdir_callback_args *cb = arg;
115 struct dirent idb;
116 int error;
117
118 if (cb->resid < bdp->d_reclen)
119 return (ENOMEM);
120 idb.d_fileno = bdp->d_fileno;
121 idb.d_reclen = bdp->d_reclen;
122 idb.d_type = bdp->d_type;
123 idb.d_namlen = bdp->d_namlen;
124 strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
125
126 if ((error = copyout((caddr_t)&idb, cb->outp, bdp->d_reclen)))
127 return (error);
128 cb->outp += bdp->d_reclen;
129 cb->resid -= bdp->d_reclen;
130
131 return (0);
132 }
133
134 int
135 freebsd_sys_getdents(struct proc *p, void *v, register_t *retval)
136 {
137 struct freebsd_sys_getdents_args
138
139
140
141 *uap = v;
142 struct vnode *vp;
143 struct file *fp;
144 int error;
145 struct freebsd_readdir_callback_args args;
146
147 if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
148 return (error);
149
150 vp = (struct vnode *)fp->f_data;
151
152 args.resid = SCARG(uap, count);
153 args.outp = (caddr_t)SCARG(uap, dirent);
154
155 error = readdir_with_callback(fp, &fp->f_offset, args.resid,
156 freebsd_readdir_callback, &args);
157
158 FRELE(fp);
159 if (error)
160 return (error);
161
162 *retval = SCARG(uap, count) - args.resid;
163 return (0);
164 }
165
166 #define FBSD_MAP_NOCORE 0x20000
167 int
168 freebsd_sys_mmap(struct proc *p, void *v, register_t *retval)
169 {
170 struct freebsd_sys_mmap_args
171
172
173
174
175
176
177
178 *uap = v;
179 SCARG(uap, flags) &= ~FBSD_MAP_NOCORE;
180 return (sys_mmap(p, uap, retval));
181 }