xref: /qemu/bsd-user/freebsd/os-stat.h (revision c0023204)
1bf14f13dSStacey Son /*
2bf14f13dSStacey Son  *  stat related system call shims and definitions
3bf14f13dSStacey Son  *
4bf14f13dSStacey Son  *  Copyright (c) 2013 Stacey D. Son
5bf14f13dSStacey Son  *
6bf14f13dSStacey Son  *  This program is free software; you can redistribute it and/or modify
7bf14f13dSStacey Son  *  it under the terms of the GNU General Public License as published by
8bf14f13dSStacey Son  *  the Free Software Foundation; either version 2 of the License, or
9bf14f13dSStacey Son  *  (at your option) any later version.
10bf14f13dSStacey Son  *
11bf14f13dSStacey Son  *  This program is distributed in the hope that it will be useful,
12bf14f13dSStacey Son  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13bf14f13dSStacey Son  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14bf14f13dSStacey Son  *  GNU General Public License for more details.
15bf14f13dSStacey Son  *
16bf14f13dSStacey Son  *  You should have received a copy of the GNU General Public License
17bf14f13dSStacey Son  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18bf14f13dSStacey Son  */
19bf14f13dSStacey Son 
20bf14f13dSStacey Son #ifndef BSD_USER_FREEBSD_OS_STAT_H
21bf14f13dSStacey Son #define BSD_USER_FREEBSD_OS_STAT_H
22bf14f13dSStacey Son 
23bf14f13dSStacey Son /* stat(2) */
24bf14f13dSStacey Son static inline abi_long do_freebsd11_stat(abi_long arg1, abi_long arg2)
25bf14f13dSStacey Son {
26bf14f13dSStacey Son     abi_long ret;
27bf14f13dSStacey Son     void *p;
28bf14f13dSStacey Son     struct freebsd11_stat st;
29bf14f13dSStacey Son 
30bf14f13dSStacey Son     LOCK_PATH(p, arg1);
31bf14f13dSStacey Son     ret = get_errno(freebsd11_stat(path(p), &st));
32bf14f13dSStacey Son     UNLOCK_PATH(p, arg1);
33bf14f13dSStacey Son     if (!is_error(ret)) {
34bf14f13dSStacey Son         ret = h2t_freebsd11_stat(arg2, &st);
35bf14f13dSStacey Son     }
36bf14f13dSStacey Son     return ret;
37bf14f13dSStacey Son }
38bf14f13dSStacey Son 
39bf14f13dSStacey Son /* lstat(2) */
40bf14f13dSStacey Son static inline abi_long do_freebsd11_lstat(abi_long arg1, abi_long arg2)
41bf14f13dSStacey Son {
42bf14f13dSStacey Son     abi_long ret;
43bf14f13dSStacey Son     void *p;
44bf14f13dSStacey Son     struct freebsd11_stat st;
45bf14f13dSStacey Son 
46bf14f13dSStacey Son     LOCK_PATH(p, arg1);
47bf14f13dSStacey Son     ret = get_errno(freebsd11_lstat(path(p), &st));
48bf14f13dSStacey Son     UNLOCK_PATH(p, arg1);
49bf14f13dSStacey Son     if (!is_error(ret)) {
50bf14f13dSStacey Son         ret = h2t_freebsd11_stat(arg2, &st);
51bf14f13dSStacey Son     }
52bf14f13dSStacey Son     return ret;
53bf14f13dSStacey Son }
54bf14f13dSStacey Son 
55bf14f13dSStacey Son /* fstat(2) */
56bf14f13dSStacey Son static inline abi_long do_freebsd_fstat(abi_long arg1, abi_long arg2)
57bf14f13dSStacey Son {
58bf14f13dSStacey Son     abi_long ret;
59bf14f13dSStacey Son     struct stat st;
60bf14f13dSStacey Son 
61bf14f13dSStacey Son     ret = get_errno(fstat(arg1, &st));
62bf14f13dSStacey Son     if (!is_error(ret))  {
63bf14f13dSStacey Son         ret = h2t_freebsd_stat(arg2, &st);
64bf14f13dSStacey Son     }
65bf14f13dSStacey Son     return ret;
66bf14f13dSStacey Son }
67bf14f13dSStacey Son 
68bf14f13dSStacey Son /* fstatat(2) */
69bf14f13dSStacey Son static inline abi_long do_freebsd_fstatat(abi_long arg1, abi_long arg2,
70bf14f13dSStacey Son         abi_long arg3, abi_long arg4)
71bf14f13dSStacey Son {
72bf14f13dSStacey Son     abi_long ret;
73bf14f13dSStacey Son     void *p;
74bf14f13dSStacey Son     struct stat st;
75bf14f13dSStacey Son 
76bf14f13dSStacey Son     LOCK_PATH(p, arg2);
77bf14f13dSStacey Son     ret = get_errno(fstatat(arg1, p, &st, arg4));
78bf14f13dSStacey Son     UNLOCK_PATH(p, arg2);
79bf14f13dSStacey Son     if (!is_error(ret) && arg3) {
80bf14f13dSStacey Son         ret = h2t_freebsd_stat(arg3, &st);
81bf14f13dSStacey Son     }
82bf14f13dSStacey Son     return ret;
83bf14f13dSStacey Son }
84bf14f13dSStacey Son 
85bf14f13dSStacey Son /* undocummented nstat(char *path, struct nstat *ub) syscall */
86bf14f13dSStacey Son static abi_long do_freebsd11_nstat(abi_long arg1, abi_long arg2)
87bf14f13dSStacey Son {
88bf14f13dSStacey Son     abi_long ret;
89bf14f13dSStacey Son     void *p;
90bf14f13dSStacey Son     struct freebsd11_stat st;
91bf14f13dSStacey Son 
92bf14f13dSStacey Son     LOCK_PATH(p, arg1);
93bf14f13dSStacey Son     ret = get_errno(freebsd11_nstat(path(p), &st));
94bf14f13dSStacey Son     UNLOCK_PATH(p, arg1);
95bf14f13dSStacey Son     if (!is_error(ret)) {
96bf14f13dSStacey Son         ret = h2t_freebsd11_nstat(arg2, &st);
97bf14f13dSStacey Son     }
98bf14f13dSStacey Son     return ret;
99bf14f13dSStacey Son }
100bf14f13dSStacey Son 
101bf14f13dSStacey Son /* undocummented nfstat(int fd, struct nstat *sb) syscall */
102bf14f13dSStacey Son static abi_long do_freebsd11_nfstat(abi_long arg1, abi_long arg2)
103bf14f13dSStacey Son {
104bf14f13dSStacey Son     abi_long ret;
105bf14f13dSStacey Son     struct freebsd11_stat st;
106bf14f13dSStacey Son 
107bf14f13dSStacey Son     ret = get_errno(freebsd11_nfstat(arg1, &st));
108bf14f13dSStacey Son     if (!is_error(ret))  {
109bf14f13dSStacey Son         ret = h2t_freebsd11_nstat(arg2, &st);
110bf14f13dSStacey Son     }
111bf14f13dSStacey Son     return ret;
112bf14f13dSStacey Son }
113bf14f13dSStacey Son 
114bf14f13dSStacey Son /* undocummented nlstat(char *path, struct nstat *ub) syscall */
115bf14f13dSStacey Son static abi_long do_freebsd11_nlstat(abi_long arg1, abi_long arg2)
116bf14f13dSStacey Son {
117bf14f13dSStacey Son     abi_long ret;
118bf14f13dSStacey Son     void *p;
119bf14f13dSStacey Son     struct freebsd11_stat st;
120bf14f13dSStacey Son 
121bf14f13dSStacey Son     LOCK_PATH(p, arg1);
122bf14f13dSStacey Son     ret = get_errno(freebsd11_nlstat(path(p), &st));
123bf14f13dSStacey Son     UNLOCK_PATH(p, arg1);
124bf14f13dSStacey Son     if (!is_error(ret)) {
125bf14f13dSStacey Son         ret = h2t_freebsd11_nstat(arg2, &st);
126bf14f13dSStacey Son     }
127bf14f13dSStacey Son     return ret;
128bf14f13dSStacey Son }
129bf14f13dSStacey Son 
130db8ee08fSStacey Son /* getfh(2) */
131db8ee08fSStacey Son static abi_long do_freebsd_getfh(abi_long arg1, abi_long arg2)
132db8ee08fSStacey Son {
133db8ee08fSStacey Son     abi_long ret;
134db8ee08fSStacey Son     void *p;
135db8ee08fSStacey Son     fhandle_t host_fh;
136db8ee08fSStacey Son 
137db8ee08fSStacey Son     LOCK_PATH(p, arg1);
138db8ee08fSStacey Son     ret = get_errno(getfh(path(p), &host_fh));
139db8ee08fSStacey Son     UNLOCK_PATH(p, arg1);
140db8ee08fSStacey Son     if (is_error(ret)) {
141db8ee08fSStacey Son         return ret;
142db8ee08fSStacey Son     }
143db8ee08fSStacey Son     return h2t_freebsd_fhandle(arg2, &host_fh);
144db8ee08fSStacey Son }
145db8ee08fSStacey Son 
146db8ee08fSStacey Son /* lgetfh(2) */
147db8ee08fSStacey Son static inline abi_long do_freebsd_lgetfh(abi_long arg1, abi_long arg2)
148db8ee08fSStacey Son {
149db8ee08fSStacey Son     abi_long ret;
150db8ee08fSStacey Son     void *p;
151db8ee08fSStacey Son     fhandle_t host_fh;
152db8ee08fSStacey Son 
153db8ee08fSStacey Son     LOCK_PATH(p, arg1);
154db8ee08fSStacey Son     ret = get_errno(lgetfh(path(p), &host_fh));
155db8ee08fSStacey Son     UNLOCK_PATH(p, arg1);
156db8ee08fSStacey Son     if (is_error(ret)) {
157db8ee08fSStacey Son         return ret;
158db8ee08fSStacey Son     }
159db8ee08fSStacey Son     return h2t_freebsd_fhandle(arg2, &host_fh);
160db8ee08fSStacey Son }
161db8ee08fSStacey Son 
162db8ee08fSStacey Son /* fhopen(2) */
163db8ee08fSStacey Son static inline abi_long do_freebsd_fhopen(abi_long arg1, abi_long arg2)
164db8ee08fSStacey Son {
165db8ee08fSStacey Son     abi_long ret;
166db8ee08fSStacey Son     fhandle_t host_fh;
167db8ee08fSStacey Son 
168db8ee08fSStacey Son     ret = t2h_freebsd_fhandle(&host_fh, arg1);
169db8ee08fSStacey Son     if (is_error(ret)) {
170db8ee08fSStacey Son         return ret;
171db8ee08fSStacey Son     }
172db8ee08fSStacey Son 
173db8ee08fSStacey Son     return get_errno(fhopen(&host_fh, arg2));
174db8ee08fSStacey Son }
175db8ee08fSStacey Son 
176db8ee08fSStacey Son /* fhstat(2) */
177db8ee08fSStacey Son static inline abi_long do_freebsd_fhstat(abi_long arg1, abi_long arg2)
178db8ee08fSStacey Son {
179db8ee08fSStacey Son     abi_long ret;
180db8ee08fSStacey Son     fhandle_t host_fh;
181db8ee08fSStacey Son     struct stat host_sb;
182db8ee08fSStacey Son 
183db8ee08fSStacey Son     ret = t2h_freebsd_fhandle(&host_fh, arg1);
184db8ee08fSStacey Son     if (is_error(ret)) {
185db8ee08fSStacey Son         return ret;
186db8ee08fSStacey Son     }
187db8ee08fSStacey Son     ret = get_errno(fhstat(&host_fh, &host_sb));
188db8ee08fSStacey Son     if (is_error(ret)) {
189db8ee08fSStacey Son         return ret;
190db8ee08fSStacey Son     }
191db8ee08fSStacey Son     return h2t_freebsd_stat(arg2, &host_sb);
192db8ee08fSStacey Son }
193db8ee08fSStacey Son 
194db8ee08fSStacey Son /* fhstatfs(2) */
195db8ee08fSStacey Son static inline abi_long do_freebsd_fhstatfs(abi_ulong target_fhp_addr,
196db8ee08fSStacey Son         abi_ulong target_stfs_addr)
197db8ee08fSStacey Son {
198db8ee08fSStacey Son     abi_long ret;
199db8ee08fSStacey Son     fhandle_t host_fh;
200db8ee08fSStacey Son     struct statfs host_stfs;
201db8ee08fSStacey Son 
202db8ee08fSStacey Son     ret = t2h_freebsd_fhandle(&host_fh, target_fhp_addr);
203db8ee08fSStacey Son     if (is_error(ret)) {
204db8ee08fSStacey Son         return ret;
205db8ee08fSStacey Son     }
206db8ee08fSStacey Son     ret = get_errno(fhstatfs(&host_fh, &host_stfs));
207db8ee08fSStacey Son     if (is_error(ret)) {
208db8ee08fSStacey Son         return ret;
209db8ee08fSStacey Son     }
210db8ee08fSStacey Son     return h2t_freebsd_statfs(target_stfs_addr, &host_stfs);
211db8ee08fSStacey Son }
212db8ee08fSStacey Son 
213191fe50dSStacey Son /* statfs(2) */
214191fe50dSStacey Son static inline abi_long do_freebsd_statfs(abi_long arg1, abi_long arg2)
215191fe50dSStacey Son {
216191fe50dSStacey Son     abi_long ret;
217191fe50dSStacey Son     void *p;
218191fe50dSStacey Son     struct statfs host_stfs;
219191fe50dSStacey Son 
220191fe50dSStacey Son     LOCK_PATH(p, arg1);
221191fe50dSStacey Son     ret = get_errno(statfs(path(p), &host_stfs));
222191fe50dSStacey Son     UNLOCK_PATH(p, arg1);
223191fe50dSStacey Son     if (is_error(ret)) {
224191fe50dSStacey Son         return ret;
225191fe50dSStacey Son     }
226191fe50dSStacey Son 
227191fe50dSStacey Son     return h2t_freebsd_statfs(arg2, &host_stfs);
228191fe50dSStacey Son }
229191fe50dSStacey Son 
230191fe50dSStacey Son /* fstatfs(2) */
231191fe50dSStacey Son static inline abi_long do_freebsd_fstatfs(abi_long fd, abi_ulong target_addr)
232191fe50dSStacey Son {
233191fe50dSStacey Son     abi_long ret;
234191fe50dSStacey Son     struct statfs host_stfs;
235191fe50dSStacey Son 
236191fe50dSStacey Son     ret = get_errno(fstatfs(fd, &host_stfs));
237191fe50dSStacey Son     if (is_error(ret)) {
238191fe50dSStacey Son         return ret;
239191fe50dSStacey Son     }
240191fe50dSStacey Son 
241191fe50dSStacey Son     return h2t_freebsd_statfs(target_addr, &host_stfs);
242191fe50dSStacey Son }
243191fe50dSStacey Son 
244191fe50dSStacey Son /* getfsstat(2) */
245191fe50dSStacey Son static inline abi_long do_freebsd_getfsstat(abi_ulong target_addr,
246191fe50dSStacey Son         abi_long bufsize, abi_long flags)
247191fe50dSStacey Son {
248191fe50dSStacey Son     abi_long ret;
249191fe50dSStacey Son     struct statfs *host_stfs;
250191fe50dSStacey Son     int count;
251191fe50dSStacey Son     long host_bufsize;
252191fe50dSStacey Son 
253191fe50dSStacey Son     count = bufsize / sizeof(struct target_statfs);
254191fe50dSStacey Son 
255191fe50dSStacey Son     /* if user buffer is NULL then return number of mounted FS's */
256191fe50dSStacey Son     if (target_addr == 0 || count == 0) {
257191fe50dSStacey Son         return get_errno(freebsd11_getfsstat(NULL, 0, flags));
258191fe50dSStacey Son     }
259191fe50dSStacey Son 
260191fe50dSStacey Son     /* XXX check count to be reasonable */
261191fe50dSStacey Son     host_bufsize = sizeof(struct statfs) * count;
262191fe50dSStacey Son     host_stfs = alloca(host_bufsize);
263191fe50dSStacey Son     if (!host_stfs) {
264191fe50dSStacey Son         return -TARGET_EINVAL;
265191fe50dSStacey Son     }
266191fe50dSStacey Son 
267191fe50dSStacey Son     ret = count = get_errno(getfsstat(host_stfs, host_bufsize, flags));
268191fe50dSStacey Son     if (is_error(ret)) {
269191fe50dSStacey Son         return ret;
270191fe50dSStacey Son     }
271191fe50dSStacey Son 
272191fe50dSStacey Son     while (count--) {
273191fe50dSStacey Son         if (h2t_freebsd_statfs((target_addr +
274191fe50dSStacey Son                         (count * sizeof(struct target_statfs))),
275191fe50dSStacey Son                     &host_stfs[count])) {
276191fe50dSStacey Son             return -TARGET_EFAULT;
277191fe50dSStacey Son         }
278191fe50dSStacey Son     }
279191fe50dSStacey Son     return ret;
280191fe50dSStacey Son }
281191fe50dSStacey Son 
28221344452SStacey Son /* getdents(2) */
28321344452SStacey Son static inline abi_long do_freebsd11_getdents(abi_long arg1,
28421344452SStacey Son         abi_ulong arg2, abi_long nbytes)
28521344452SStacey Son {
28621344452SStacey Son     abi_long ret;
28721344452SStacey Son     struct freebsd11_dirent *dirp;
28821344452SStacey Son 
28921344452SStacey Son     dirp = lock_user(VERIFY_WRITE, arg2, nbytes, 0);
29021344452SStacey Son     if (dirp == NULL) {
29121344452SStacey Son         return -TARGET_EFAULT;
29221344452SStacey Son     }
29321344452SStacey Son     ret = get_errno(freebsd11_getdents(arg1, (char *)dirp, nbytes));
29421344452SStacey Son     if (!is_error(ret)) {
29521344452SStacey Son         struct freebsd11_dirent *de;
29621344452SStacey Son         int len = ret;
29721344452SStacey Son         int reclen;
29821344452SStacey Son 
29921344452SStacey Son         de = dirp;
30021344452SStacey Son         while (len > 0) {
30121344452SStacey Son             reclen = de->d_reclen;
30221344452SStacey Son             if (reclen > len) {
30321344452SStacey Son                 return -TARGET_EFAULT;
30421344452SStacey Son             }
30521344452SStacey Son             de->d_reclen = tswap16(reclen);
30621344452SStacey Son             de->d_fileno = tswap32(de->d_fileno);
30721344452SStacey Son             len -= reclen;
30821344452SStacey Son         }
30921344452SStacey Son     }
31021344452SStacey Son     return ret;
31121344452SStacey Son }
31221344452SStacey Son 
31321344452SStacey Son /* getdirecentries(2) */
31421344452SStacey Son static inline abi_long do_freebsd_getdirentries(abi_long arg1,
31521344452SStacey Son         abi_ulong arg2, abi_long nbytes, abi_ulong arg4)
31621344452SStacey Son {
31721344452SStacey Son     abi_long ret;
31821344452SStacey Son     struct dirent *dirp;
31921344452SStacey Son     long basep;
32021344452SStacey Son 
32121344452SStacey Son     dirp = lock_user(VERIFY_WRITE, arg2, nbytes, 0);
32221344452SStacey Son     if (dirp == NULL) {
32321344452SStacey Son         return -TARGET_EFAULT;
32421344452SStacey Son     }
32521344452SStacey Son     ret = get_errno(getdirentries(arg1, (char *)dirp, nbytes, &basep));
32621344452SStacey Son     if (!is_error(ret)) {
32721344452SStacey Son         struct dirent *de;
32821344452SStacey Son         int len = ret;
32921344452SStacey Son         int reclen;
33021344452SStacey Son 
33121344452SStacey Son         de = dirp;
33221344452SStacey Son         while (len > 0) {
33321344452SStacey Son             reclen = de->d_reclen;
33421344452SStacey Son             if (reclen > len) {
33521344452SStacey Son                 return -TARGET_EFAULT;
33621344452SStacey Son             }
33721344452SStacey Son             de->d_fileno = tswap64(de->d_fileno);
33821344452SStacey Son             de->d_off = tswap64(de->d_off);
33921344452SStacey Son             de->d_reclen = tswap16(de->d_reclen);
34021344452SStacey Son             de->d_namlen = tswap16(de->d_namlen);
34121344452SStacey Son             len -= reclen;
34221344452SStacey Son             de = (struct dirent *)((void *)de + reclen);
34321344452SStacey Son         }
34421344452SStacey Son     }
34521344452SStacey Son     unlock_user(dirp, arg2, ret);
34621344452SStacey Son     if (arg4) {
34721344452SStacey Son         if (put_user(basep, arg4, abi_ulong)) {
34821344452SStacey Son             return -TARGET_EFAULT;
34921344452SStacey Son         }
35021344452SStacey Son     }
35121344452SStacey Son     return ret;
35221344452SStacey Son }
35321344452SStacey Son 
354*c0023204SStacey Son /* fcntl(2) */
355*c0023204SStacey Son static inline abi_long do_freebsd_fcntl(abi_long arg1, abi_long arg2,
356*c0023204SStacey Son         abi_ulong arg3)
357*c0023204SStacey Son {
358*c0023204SStacey Son     abi_long ret;
359*c0023204SStacey Son     int host_cmd;
360*c0023204SStacey Son     struct flock fl;
361*c0023204SStacey Son     struct target_freebsd_flock *target_fl;
362*c0023204SStacey Son 
363*c0023204SStacey Son     host_cmd = target_to_host_fcntl_cmd(arg2);
364*c0023204SStacey Son     if (host_cmd < 0) {
365*c0023204SStacey Son         return host_cmd;
366*c0023204SStacey Son     }
367*c0023204SStacey Son     switch (arg2) {
368*c0023204SStacey Son     case TARGET_F_GETLK:
369*c0023204SStacey Son         if (!lock_user_struct(VERIFY_READ, target_fl, arg3, 1)) {
370*c0023204SStacey Son             return -TARGET_EFAULT;
371*c0023204SStacey Son         }
372*c0023204SStacey Son         __get_user(fl.l_type, &target_fl->l_type);
373*c0023204SStacey Son         __get_user(fl.l_whence, &target_fl->l_whence);
374*c0023204SStacey Son         __get_user(fl.l_start, &target_fl->l_start);
375*c0023204SStacey Son         __get_user(fl.l_len, &target_fl->l_len);
376*c0023204SStacey Son         __get_user(fl.l_pid, &target_fl->l_pid);
377*c0023204SStacey Son         __get_user(fl.l_sysid, &target_fl->l_sysid);
378*c0023204SStacey Son         unlock_user_struct(target_fl, arg3, 0);
379*c0023204SStacey Son         ret = get_errno(safe_fcntl(arg1, host_cmd, &fl));
380*c0023204SStacey Son         if (!is_error(ret)) {
381*c0023204SStacey Son             if (!lock_user_struct(VERIFY_WRITE, target_fl, arg3, 0)) {
382*c0023204SStacey Son                 return -TARGET_EFAULT;
383*c0023204SStacey Son             }
384*c0023204SStacey Son             __put_user(fl.l_type, &target_fl->l_type);
385*c0023204SStacey Son             __put_user(fl.l_whence, &target_fl->l_whence);
386*c0023204SStacey Son             __put_user(fl.l_start, &target_fl->l_start);
387*c0023204SStacey Son             __put_user(fl.l_len, &target_fl->l_len);
388*c0023204SStacey Son             __put_user(fl.l_pid, &target_fl->l_pid);
389*c0023204SStacey Son             __put_user(fl.l_sysid, &target_fl->l_sysid);
390*c0023204SStacey Son             unlock_user_struct(target_fl, arg3, 1);
391*c0023204SStacey Son         }
392*c0023204SStacey Son         break;
393*c0023204SStacey Son 
394*c0023204SStacey Son     case TARGET_F_SETLK:
395*c0023204SStacey Son     case TARGET_F_SETLKW:
396*c0023204SStacey Son         if (!lock_user_struct(VERIFY_READ, target_fl, arg3, 1)) {
397*c0023204SStacey Son             return -TARGET_EFAULT;
398*c0023204SStacey Son         }
399*c0023204SStacey Son         __get_user(fl.l_type, &target_fl->l_type);
400*c0023204SStacey Son         __get_user(fl.l_whence, &target_fl->l_whence);
401*c0023204SStacey Son         __get_user(fl.l_start, &target_fl->l_start);
402*c0023204SStacey Son         __get_user(fl.l_len, &target_fl->l_len);
403*c0023204SStacey Son         __get_user(fl.l_pid, &target_fl->l_pid);
404*c0023204SStacey Son         __get_user(fl.l_sysid, &target_fl->l_sysid);
405*c0023204SStacey Son         unlock_user_struct(target_fl, arg3, 0);
406*c0023204SStacey Son         ret = get_errno(safe_fcntl(arg1, host_cmd, &fl));
407*c0023204SStacey Son         break;
408*c0023204SStacey Son 
409*c0023204SStacey Son     case TARGET_F_DUPFD:
410*c0023204SStacey Son     case TARGET_F_DUP2FD:
411*c0023204SStacey Son     case TARGET_F_GETOWN:
412*c0023204SStacey Son     case TARGET_F_SETOWN:
413*c0023204SStacey Son     case TARGET_F_GETFD:
414*c0023204SStacey Son     case TARGET_F_SETFD:
415*c0023204SStacey Son     case TARGET_F_GETFL:
416*c0023204SStacey Son     case TARGET_F_SETFL:
417*c0023204SStacey Son     case TARGET_F_READAHEAD:
418*c0023204SStacey Son     case TARGET_F_RDAHEAD:
419*c0023204SStacey Son     case TARGET_F_ADD_SEALS:
420*c0023204SStacey Son     case TARGET_F_GET_SEALS:
421*c0023204SStacey Son     default:
422*c0023204SStacey Son         ret = get_errno(safe_fcntl(arg1, host_cmd, arg3));
423*c0023204SStacey Son         break;
424*c0023204SStacey Son     }
425*c0023204SStacey Son     return ret;
426*c0023204SStacey Son }
427*c0023204SStacey Son 
428bf14f13dSStacey Son #endif /* BSD_USER_FREEBSD_OS_STAT_H */
429