[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSProcessInfo kernel dependency
From: |
Richard Frith-Macdonald |
Subject: |
Re: NSProcessInfo kernel dependency |
Date: |
Thu, 16 Jan 2003 08:01:30 +0000 |
On Tuesday, January 14, 2003, at 11:36 pm, James Knight wrote:
NSProcessInfo seems to have a gratuitous dependance on the particular
kernel version in use. In particular, in +load, it attempts to count
the number of arguments from the file in /proc. However, some versions
of the kernel null terminate the last argument, and some don't.
Currently, gnustep handles this by using a configure check to
determine which kind of kernel you're on. That is less than ideal
situation, because 1) it is easy to do the check at runtime,
Unfortunately, this is not the case ...
Your code looks very much like the initial version I did to try to deal
with this problem, and it suffers from the fact that it is in fact
impossible to know whether you have a nul terminated list of arguments,
or a non-terminated list whose final argument is an empty string. This
leads to very tricky to find problems when people pass an empty
argument to a program.
I guess Ideally what we should be doing is checking the kernel version
at runtime rather than at configure time ... but I didn't/don't know
how to do that and chose a reasonably quick solution at the time.
and 2) people can and do use the same binaries on different kernels.
Good point. Definitely we should be checking kernel version at runtime
.. unless there is some better method.