In article <[EMAIL PROTECTED]>, Martin v. Löwis <[EMAIL PROTECTED]> wrote: >Jorgen Grahn wrote: >> There might still be a problem for people doing things like this: netstat >> might use unstable or non-public APIs to find the things it lists. This is >> fine because it's typically your OS vendor who have to handle that (ship >> another netstat when the /proc or /sys file system layout changes, etc). > >Right. However, on Unix, there aren't really that much "non-public" >APIs. If you can figure out what the system call number is, and you >have /usr/include/sys, you can typically come up with a way to call >this API. > >It becomes tricky if netstat turns out to read /dev/kmem or some such. > >> If it works like that, you can access the APIs fine from Python -- but you >> cannot write a portable 'pynetstat' without a lot of effort and maintenance. > >Well, to make that accessible from Python, you need to have Python >wrappers for all system calls involved (or for library routines that >use the system calls the right way). In case of /proc, this is easy; >if it is a ioctl(2), it might still be doable. If it is something >else, you may have to write a Python wrapper for that other system >call first. . . . ALSO, as you know, but billie might not, Python certainly makes it easy enough to wrap netstat itself as an external executable. In many situations, *that*'s the right solution.
-- http://mail.python.org/mailman/listinfo/python-list