Re: [PATCH] 2.5.17 /dev/ports

Martin Dalecki (dalecki@evision-ventures.com)
Wed, 22 May 2002 18:17:26 +0200


Uz.ytkownik Alan Cox napisa?:
>>Anybody: if you've ever used /dev/ports, holler _now_.
>
>
> Holler. I posted a list of examples to linux-kernel already. iopl and ioperm
> are not portable in the way /dev/port is. ioperm/iopl also doesnt work
> with most scripting languages, java tools trying to avoid JNI etc

What?

#include <linux/io.h>
#include <stdio.h>
#include <stdlib.h>

int main(char *argv[], int argc)
{
int port = aoit(argv[0]);
int byte = aoit(argv[1]);

if (port > 0)
return inb(port);
else
outb(port, byte);

return 0;
}

and then syscall("/sbin/doportio")

Is certainly *NOT IMPOSSIBLE*. But it's of course too
much of a burden...

BTW> Under java it's rather hard to get around
CAP_RAWIO if you ask me without going down to JNI.

> I've seen it used in tools written in java, python, perl, even tcl
>
> Other examples include libieee1284, the pic 16x84 programmer, hwclock,
> older kbdrate, /sbin/clock on machines that don't have /dev/rtc.

All the examples above are samples of bad coding practice - I have
uncovered already here in C what can be expected inside there!

> Not everything in the world is an x86, and not every app wants to be Linux/x86
> specific or use weird syscalls

Yes and in esp. everything in the world is a __m68000__!

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