Re: [PATCH] 2.5.17 /dev/ports

Martin Dalecki (dalecki@evision-ventures.com)
Wed, 22 May 2002 14:30:44 +0200


Uz.ytkownik Padraig Brady napisa?:
> Martin Dalecki wrote:
>
>> Remove support for /dev/port altogether.
>
>
> FYI:
>
> [root@pixelbeat padraig]# find /bin /usr/bin /lib /sbin /usr/sbin
> /usr/lib -maxdepth 1 -type f -perm +111 | xargs grep -l "/dev/port"
> /sbin/hwclock: util-linux
> /sbin/kbdrate: util-linux
> /bin/watchdog: ;-)

Let's have a closer look.

[root@kozaczek sbin]# rpm -qf /sbin/kbdrate
util-linux-2.11n-12
[root@kozaczek sbin]# rpm -qf /sbin/hwclock
util-linux-2.11n-12
[root@kozaczek sbin]#

/dev/null {} \;util-linux-2.11r]# find ./ -name "*.[ch]" -exec grep \/dev\/port
./po/cat-id-tbl.c: {"Cannot open /dev/port: %s", 971},
./hwclock/cmos.c: if ((dev_port_fd = open("/dev/port", O_RDWR)) < 0) {
./hwclock/cmos.c: fprintf(stderr, _("Cannot open /dev/port: %s"),
strerror(errsv));
./hwclock/clock-ppc.c: * code and not via /dev/port (still possible via #undef
...)."

static int
get_permissions_cmos(void) {
int rc;

if (use_dev_port) {
if ((dev_port_fd = open("/dev/port", O_RDWR)) < 0) {
int errsv = errno;
fprintf(stderr, _("Cannot open /dev/port: %s"), strerror(errsv));
rc = 1;
} else
rc = 0;
} else {
rc = i386_iopl(3);
if (rc == -2) {

./hwclock/cmos.c:int use_dev_port = 0; /* 1 for Jensen */
./hwclock/cmos.c: use_dev_port = 1;
./hwclock/cmos.c: if (use_dev_port) {
./hwclock/cmos.c: if (use_dev_port) {
./hwclock/cmos.c: if (use_dev_port) {
[root@kozaczek util-linux-2.11r]#

void
set_cmos_access(int Jensen, int funky_toy) {

/* See whether we're dealing with a Jensen---it has a weird I/O
system. DEC was just learning how to build Alpha PCs. */
if (Jensen || is_in_cpuinfo("system type", "Jensen")) {
use_dev_port = 1;
clock_ctl_addr = 0x170;
clock_data_addr = 0x171;
if (debug) printf (_("clockport adjusted to 0x%x\n"), clock_ctl_addr);
}

You can see from the above that the code in question
is accessing /dev/port only for the Jensen architecture...
which is:

1. Obsolete by a bright margin.

2. Very rare.

3. Should be fixed anyway.

4. Most possibly not correct anylonger.

So both of the above aplications in fact don't access /dev/port
at all at 99.9% of the systems.
Since they belong in to the util-linux category - well
we require even new versions of mount for new kernels.

Still no problem at all.

-
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/