|
From: Daniel G. <dan...@ta...> - 2014-04-11 18:10:49
|
On Thu, Apr 10, 2014 at 7:22 PM, John Reiser <jr...@bi...> wrote:
>> What if I re-write my code using uname syscall?
>
> The result is what some previous user-mode code said that nodename should be.
> Quoting from the manual page "man 2 uname":
> On the other hand, the field node‐
> name is meaningless: it gives the name of the present machine in some unde‐
> fined network, but typically machines are in more than one network and have
> several names. Moreover, the kernel has no way of knowing about such things,
> so it has to be told what to answer here.
> Note that this is _logically_ equivalent to setting HOSTNAME. No one knows
> what the answer should be until some user-mode code decides and propagates its decision.
>
> In the case of uname syscall, there are THREE different ones:
> Over time, increases in the size of the utsname structure have led to three
> successive versions of uname()
> So you need to pick which one, and write that. The libc uname() is unavailable
> because valgrind does not link with libc.
About which syscall version, I will write a new patch according to:
"The glibc uname() wrapper func‐
tion hides these details from applications, invoking the most
recent version of the system call provided by the kernel."
Let's see how things end up.
At very least, if there is no approval for the patch using the
syscall, please consider to use a different character
(other than '?') which has a special behavior, something like
"_unknown_" or "XXX" or alike.
Please note in the patch that, unlike the subject of this post, I'm
not "replacing" the use of getenv("HOST"), but ADDING a third try if
"HOST" and "HOSTNAME" are not defined.
Whatever the syscall returns, I think it will be better than "???".
New patch in its way.
Daniel.
>
>>> Overcome this by setting and exporting HOST or HOSTNAME yourself.
>>
>> We are already doing that, but this could be easily fixed with uname.
>
> Sometimes uname gives the wrong answer, and using uname is not "easy", either.
> That is a significant part of the reason why HOSTNAME is used instead.
>
>> Otherwise, people like me may end up creating their own wrappers
>> rather than using an off-the-shelf valgrind.
>
> You: "Dr, it hurts when I use a shell that I picked up off the street."
> Dr: "Get yourself a better shell. There are several to choose from,
> and most are both free and libre."
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
|