mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 13:02:25 +08:00
fix(cdev): keep ioctl arg as unsigned long across all callers
The Windows-shim PR widened cdev::CDev::ioctl()'s `arg` parameter from `unsigned long` to `uintptr_t` (and propagated the change to uORB::DeviceNode and px4_ioctl). On 32-bit ARM NuttX targets uintptr_t is `unsigned int`, which is a different type than `unsigned long` and breaks every external override of this method: src/drivers/px4io/px4io.cpp:133:25: error: 'int PX4IO::ioctl(file*, int, long unsigned int)' marked 'override', but does not override This regressed Linux ubuntu:22.04 / 24.04, all NuttX seed targets, the px4_fmu-v5x/v6xrt CodeQL analyses, and the Checking jobs for nxp_mr-tropic, nxp_tropic-community, px4_fmu-v5x, px4_fmu-v6xrt. The NuttX kernel ioctl callback signature is `unsigned long arg` and all in-tree callers (px4io, IridiumSBD, lib/drivers/device/CDev) match that. Revert the four signatures back to `unsigned long`. The Windows shim's ioctl(2) implementation in platforms/posix/src/px4/windows/posix/sys/ioctl.cpp already uses `unsigned long`, so no Windows-side change is needed. Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
@@ -117,7 +117,7 @@ __EXPORT int px4_open(const char *path, int flags, ...);
|
|||||||
__EXPORT int px4_close(int fd);
|
__EXPORT int px4_close(int fd);
|
||||||
__EXPORT ssize_t px4_read(int fd, void *buffer, size_t buflen);
|
__EXPORT ssize_t px4_read(int fd, void *buffer, size_t buflen);
|
||||||
__EXPORT ssize_t px4_write(int fd, const void *buffer, size_t buflen);
|
__EXPORT ssize_t px4_write(int fd, const void *buffer, size_t buflen);
|
||||||
__EXPORT int px4_ioctl(int fd, int cmd, uintptr_t arg);
|
__EXPORT int px4_ioctl(int fd, int cmd, unsigned long arg);
|
||||||
__EXPORT int px4_poll(px4_pollfd_struct_t *fds, unsigned int nfds, int timeout);
|
__EXPORT int px4_poll(px4_pollfd_struct_t *fds, unsigned int nfds, int timeout);
|
||||||
__EXPORT int px4_access(const char *pathname, int mode);
|
__EXPORT int px4_access(const char *pathname, int mode);
|
||||||
__EXPORT px4_task_t px4_getpid(void);
|
__EXPORT px4_task_t px4_getpid(void);
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ uORB::DeviceNode::write(cdev::file_t *filp, const char *buffer, size_t buflen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
uORB::DeviceNode::ioctl(cdev::file_t *filp, int cmd, uintptr_t arg)
|
uORB::DeviceNode::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case ORBIOCUPDATED: {
|
case ORBIOCUPDATED: {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* IOCTL control for the subscriber.
|
* IOCTL control for the subscriber.
|
||||||
*/
|
*/
|
||||||
int ioctl(cdev::file_t *filp, int cmd, uintptr_t arg) override;
|
int ioctl(cdev::file_t *filp, int cmd, unsigned long arg) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to publish a data to this node.
|
* Method to publish a data to this node.
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public:
|
|||||||
* @param arg The ioctl argument value.
|
* @param arg The ioctl argument value.
|
||||||
* @return OK on success, or -errno otherwise.
|
* @return OK on success, or -errno otherwise.
|
||||||
*/
|
*/
|
||||||
virtual int ioctl(file_t *filep, int cmd, uintptr_t arg) { return -ENOTTY; };
|
virtual int ioctl(file_t *filep, int cmd, unsigned long arg) { return -ENOTTY; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a poll setup/teardown operation.
|
* Perform a poll setup/teardown operation.
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ extern "C" {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int px4_ioctl(int fd, int cmd, uintptr_t arg)
|
int px4_ioctl(int fd, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
PX4_DEBUG("px4_ioctl fd = %d", fd);
|
PX4_DEBUG("px4_ioctl fd = %d", fd);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user