1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

stand: Make ioctl declaration consistent

It typically had two args with an optional third from the userland
declaration in sys/ioccom.h. However, the funciton definition used a
non-optional char * argument. This mismatch is UB behavior (but worked
due to the calling convetions of all our machines).

Instead, add a declaration for ioctl to stand.h, make the third arg
'void *' which is a better match to the ... declaration before. This
prevents the convert int * -> char * errors as well. Make the ioctl
user-space declaration truly user-space specific (omit it in the
stand-alone build).

No functional change intended.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D37680
This commit is contained in:
Warner Losh 2022-12-12 21:46:05 -07:00
parent 0b75997f4c
commit 2e1e68cbae
3 changed files with 3 additions and 2 deletions

View File

@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
#include "stand.h"
int
ioctl(int fd, u_long cmd, char *arg)
ioctl(int fd, u_long cmd, void *arg)
{
struct open_file *f;

View File

@ -315,6 +315,7 @@ extern int close(int);
extern void closeall(void);
extern ssize_t read(int, void *, size_t);
extern ssize_t write(int, const void *, size_t);
extern int ioctl(int, u_long, void *);
extern struct dirent *readdirfd(int);
extern void preload(int);

View File

@ -82,7 +82,7 @@
#define _IOC_INVALID (_IOC_VOID|_IOC_INOUT) /* Never valid cmd value,
use as filler */
#else
#elif !defined(_STANDALONE)
#include <sys/cdefs.h>