Lines Matching +full:a +full:- +full:bit
18 the ioctl system call. While this can be any 32-bit number that uniquely
19 identifies an action for a particular driver, there are a number of
22 ``include/uapi/asm-generic/ioctl.h`` provides four macros for defining
28 The macro name specifies how the argument will be used. It may be a
31 argument or those passing an integer value instead of a pointer.
36 An 8-bit number, often a character literal, specific to a subsystem
37 or driver, and listed in Documentation/userspace-api/ioctl/ioctl-number.rst
40 An 8-bit number identifying the specific command, unique for a give
45 encodes the ``sizeof(data_type)`` value in a 13-bit or 14-bit integer,
46 leading to a limit of 8191 bytes for the maximum size of the argument.
49 _IO does not have a data_type parameter.
58 This is generally a bad idea, since changes to existing commands tend
61 A better approach is to add a new ioctl command with a new number. The
63 but this can be a wrapper around the new implementation.
71 a positive 'long' value.
74 handler returns either -ENOTTY or -ENOIOCTLCMD, which also results in
75 -ENOTTY being returned from the system call. Some subsystems return
76 -ENOSYS or -EINVAL here for historic reasons, but this is wrong.
79 -ENOIOCTLCMD in order to use the fallback conversion into native
90 move to 64-bit time_t.
101 requires an expensive 64-bit division, a simple __u64 nanosecond value
110 need to be persistent across a reboot or between multiple machines.
112 32-bit compat mode
115 In order to support 32-bit user space running on a 64-bit machine, each
120 easy as setting the .compat_ioctl pointer to a helper function such as
124 ------------
126 On the s390 architecture, 31-bit user space has ambiguous representations
127 for data pointers, with the upper bit being ignored. When running such
128 a process in compat mode, the compat_ptr() helper must be used to
129 clear the upper bit of a compat_uptr_t and turn it into a valid 64-bit
130 pointer. On other architectures, this macro only performs a cast to a
134 which can be interpreted as either a pointer or a scalar depending on
135 the command. If it is a scalar, then compat_ptr() must not be used, to
136 ensure that the 64-bit kernel behaves the same way as a 32-bit kernel
137 for arguments with the upper bit set.
139 The compat_ptr_ioctl() helper can be used in place of a custom
144 ----------------
149 * ``long`` and ``unsigned long`` are the size of a register, so
150 they can be either 32-bit or 64-bit wide and cannot be used in portable
151 data structures. Fixed-length replacements are ``__s32``, ``__u32``,
156 in place of pointers, which requires a cast to ``uintptr_t`` in user
158 it back into a user pointer.
160 * On the x86-32 (i386) architecture, the alignment of 64-bit variables
161 is only 32-bit, but they are naturally aligned on most other
162 architectures including x86-64. This means a structure like::
165 __u32 a;
170 has four bytes of padding between a and b on x86-64, plus another four
171 bytes of padding at the end, but no padding on i386, and it needs a
179 * On ARM OABI user space, structures are padded to multiples of 32-bit,
181 do not end on a 32-bit boundary.
184 alignment greater than 16-bit, which is a problem when relying on
188 but some properties of them are implementation-defined, so it is better
192 the architecture, so the __u8 and __s8 types should be used for 8-bit
193 integer values, though char arrays are clearer for fixed-length strings.
229 between multiple drivers than when it is only used in a single driver.
234 There are many cases in which ioctl is not the best solution for a
237 * System calls are a better choice for a system-wide feature that
238 is not tied to a physical device or constrained by the file system
239 permissions of a character device node
244 * debugfs is used for ad-hoc interfaces for debugging functionality
245 that does not need to be exposed as a stable interface to applications.
247 * sysfs is a good way to expose the state of an in-kernel object
248 that is not tied to a file descriptor.
252 * A custom file system can provide extra flexibility with a simple
253 user interface but adds a lot of complexity to the implementation.