:: Re: [DNG] new freedesktop "standard…
Inizio della pagina
Delete this message
Reply to this message
Autore: marc
Data:  
To: dng
Oggetto: Re: [DNG] new freedesktop "standard": /etc/machine-id
> > So you are correct that gethostid has been around for a while,
> > but this call returns a 32bit number, typically the IP.
>
> ?? No, it returns a value that's unique to the local machine even if it
> was not configured on any network.?? Plus, the IP can change, but the
> hostid is supposed to be static.?? The Unix hostid was developed in order
> to uniquely identify a machine regardless of where in the Internet it
> is.?? What you described is the gethostbyname syscall.


Maybe your system is different to mine, but try compiling the below
and find out for yourself:

#include <stdio.h>
#include <unistd.h>

int main()
{
int id;

id = gethostid();

printf("my id is 0x%08x\n", id);

return 0;
}

regards

marc