Re: To get net ioctl number
On 28.02.2019 08:24, Iain Hibbert wrote: > On Thu, 28 Feb 2019, Masanobu SAITOH wrote: > >> I'd like to get new number for new ioctl. How should I find unused number >> for it? I'm going to add new SIOCXXX. It may not enough to grep sys/net/*.h, >> so I made usr.bin/kdump-ioctl.c and did >> >> grep \'i kdump-ioctl.c | sort -n -k 5,5 | uniq | column -t >> >> I think it might not enough because kdump-ioctl.c has no compat-related >> code. >> >> What should I do? > > In most cases, an ioctl value is only valid when performed on a handle > leading to a specific subsystem, meaning that it does not really need to > be globally distinct. There is a list of the letters used in ioctl(9) > We need globally distinct numbers for ioctl(2) operations in sanitizers and other programs tracing ioctl(2) operations like ktruss(1). There is a small number of duplicates and we are sacrificing handling of less important ones with more important ones. If we can get support for F_GETPATH we could mitigate duplicates. > iain > signature.asc Description: OpenPGP digital signature
Re: To get net ioctl number
On 2019/02/28 16:54, matthew green wrote: Iain Hibbert writes: On Thu, 28 Feb 2019, Masanobu SAITOH wrote: I'd like to get new number for new ioctl. How should I find unused number for it? I'm going to add new SIOCXXX. It may not enough to grep sys/net/*.h, so I made usr.bin/kdump-ioctl.c and did grep \'i kdump-ioctl.c | sort -n -k 5,5 | uniq | column -t I think it might not enough because kdump-ioctl.c has no compat-related code. What should I do? In most cases, an ioctl value is only valid when performed on a handle leading to a specific subsystem, meaning that it does not really need to be globally distinct. Yes, you're correct. There is a list of the letters used in ioctl(9) true that that don't _need_ to be globally unique, but it sure is nice for kdump(1). Yes, it's also correct. It's better to unique than overlap. .mrg. Currently, kdump-ioctl.c doesn't include compat ioctl. If I mistakenly choose new value which is used in the compat code, it would cause trouble. If we can include compat stuff into kdump, it would be good for user to know about the old syscall's behavior and it also good to check system-wide ioctl number usage... -- --- SAITOH Masanobu (msai...@execsw.org msai...@netbsd.org)
re: To get net ioctl number
Iain Hibbert writes: > On Thu, 28 Feb 2019, Masanobu SAITOH wrote: > > > I'd like to get new number for new ioctl. How should I find unused number > > for it? I'm going to add new SIOCXXX. It may not enough to grep sys/net/*.h, > > so I made usr.bin/kdump-ioctl.c and did > > > > grep \'i kdump-ioctl.c | sort -n -k 5,5 | uniq | column -t > > > > I think it might not enough because kdump-ioctl.c has no compat-related > > code. > > > > What should I do? > > In most cases, an ioctl value is only valid when performed on a handle > leading to a specific subsystem, meaning that it does not really need to > be globally distinct. There is a list of the letters used in ioctl(9) true that that don't _need_ to be globally unique, but it sure is nice for kdump(1). .mrg.
Re: To get net ioctl number
On Thu, 28 Feb 2019, Masanobu SAITOH wrote: > I'd like to get new number for new ioctl. How should I find unused number > for it? I'm going to add new SIOCXXX. It may not enough to grep sys/net/*.h, > so I made usr.bin/kdump-ioctl.c and did > > grep \'i kdump-ioctl.c | sort -n -k 5,5 | uniq | column -t > > I think it might not enough because kdump-ioctl.c has no compat-related > code. > > What should I do? In most cases, an ioctl value is only valid when performed on a handle leading to a specific subsystem, meaning that it does not really need to be globally distinct. There is a list of the letters used in ioctl(9) iain
re: To get net ioctl number
> This might be FAQ... > > I'd like to get new number for new ioctl. How should I find unused number > for it? I'm going to add new SIOCXXX. It may not enough to grep sys/net/*.h, > so I made usr.bin/kdump-ioctl.c and did > > grep \'i kdump-ioctl.c | sort -n -k 5,5 | uniq | column -t > > I think it might not enough because kdump-ioctl.c has no compat-related > code. > > What should I do? i don't have a script, but looking in the tree for _IO*() calls should find all the relevant ioctls we have defined. .mrg.