@samitouri / QOSamiQemu / commits / 55a952a4c4

bsd-user: Add FreeBSD file I/O ioctl definitions

Add os-ioctl-filio.h with file I/O control ioctl definitions including FIONREAD, FIONBIO, FIOASYNC, and FIOSETOWN for file descriptor control. Signed-off-by: Stacey Son <sson@FreeBSD.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Warner Losh <imp@bsdimp.com>

Stacey Son committed Mar 13, 2026 at 22:11 UTC 55a952a4c4f8108ee073cc59a319aebc4555c199
1 file changed +34
bsd-user/freebsd/os-ioctl-filio.h new
+34
@@ -0,0 +1,34 @@
1 +/*
2 + * FreeBSD filio definitions for ioctl(2) emulation
3 + *
4 + * Copyright (c) 2013 Stacey D. Son
5 + *
6 + * SPDX-License-Identifier: GPL-2.0-or-later
7 + */
8 +#ifndef BSD_USER_FREEBSD_OS_IOCTL_FILIO_H
9 +#define BSD_USER_FREEBSD_OS_IOCTL_FILIO_H
10 +
11 +/* see sys/filio.h */
12 +#define TARGET_FIOCLEX TARGET_IO('f', 1)
13 +#define TARGET_FIONCLEX TARGET_IO('f', 2)
14 +#define TARGET_FIONREAD TARGET_IOR('f', 127, int)
15 +#define TARGET_FIONBIO TARGET_IOW('f', 126, int)
16 +#define TARGET_FIOASYNC TARGET_IOW('f', 125, int)
17 +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int)
18 +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int)
19 +#define TARGET_FIODTYPE TARGET_IOR('f', 122, int)
20 +#define TARGET_FIOGETLBA TARGET_IOR('f', 121, int)
21 +
22 +struct target_fiodgname_arg {
23 + int32_t len;
24 + abi_ulong buf;
25 +};
26 +
27 +#define TARGET_FIODGNAME TARGET_IOW('f', 120, \
28 + struct target_fiodgname_arg)
29 +#define TARGET_FIONWRITE TARGET_IOR('f', 119, int)
30 +#define TARGET_FIONSPACE TARGET_IOR('f', 118, int)
31 +#define TARGET_FIOSEEKDATA TARGET_IOWR('f', 97, off_t)
32 +#define TARGET_FIOSEEKHOLE TARGET_IOWR('f', 98, off_t)
33 +
34 +#endif /* BSD_USER_FREEBSD_OS_IOCTL_FILIO_H */