[LWN Logo]
[LWN.net]
From:	 Alexander Viro <viro@math.psu.edu>
To:	 Andries.Brouwer@cwi.nl
Subject: Re: no ioctls for serial ports? [was Re: LANANA: To Pending
	 DeviceNumberRegistrants]
Date:	 Sun, 20 May 2001 08:45:47 -0400 (EDT)
Cc:	 abramo@alsa-project.org, alan@lxorguk.ukuu.org.uk,
	 hpa@transmeta.com, jgarzik@mandrakesoft.com,
	 jsimmons@transvirtual.com, linux-kernel@vger.kernel.org,
	 neilb@cse.unsw.edu.au, pavel@suse.cz, torvalds@transmeta.com



On Sun, 20 May 2001 Andries.Brouwer@cwi.nl wrote:

> > Getting a list of all ioctls in the tree, along with types of their arguments
> > would be a great start. Anyone willing to help with that?
> 
> % man 2 ioctl_list
> 
> gives a very outdated list. Collecting the present list is trivial
> but time-consuming. If anyone does I would be happy if he also
> sent me an updated ioctl_list.2

Andries, I wouldn't call it trivial. Consider the following:
                default:
                        if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) {
                                int len;
                                if (!dev->name) return 0;
                                len = strlen(dev->name) + 1;
                                if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
                                if (copy_to_user((char *) arg, dev->name, len)) return -EFAULT;
                                return len;
                        }

Real-world example. From drivers/input/joydev.c::joydev_ioctl(). And it's far
from the worst ones - just one I'm currently looking at.

We have ~180 first-order ioctl() methods. Several (my guess would be 8--15)
subsystems of the second order and hell knows how many instances in each
of them. And I'm afraid that we have some third-order families. Each instance
of each family got some ioctls in it. I think that we have several thousands
of these beasts.  And that's several thousands of undocumented system calls
hidden in bowels of sys_ioctl(). Undocumented == for most of them we have
no information of argument types, which arguments are in-, out- or in-out,
which contain pointers to other userland structures, etc.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/