Ticket #1250: uname.c.diff

File uname.c.diff, 1010 bytes (added by jonas.kirilla, 12 years ago)
  • src/system/libroot/posix/sys/uname.c

     
    1010#include <errno.h>
    1111#include <stdio.h>
    1212#include <string.h>
     13#include <unistd.h>
    1314
    14 
    1515// Haiku SVN revision. Will be set when copying libroot.so to the image.
    1616// Lives in a separate section so that it can easily be found.
    1717static uint32 sHaikuRevision __attribute__((section("_haiku_revision")));
     
    2323{
    2424    system_info systemInfo;
    2525    const char *platform;
     26    char hostname[_SYS_NAMELEN];
    2627
    2728    if (!info) {
    2829        errno = B_BAD_VALUE;
     
    6162    }
    6263    strlcpy(info->machine, platform, sizeof(info->machine));
    6364
    64     // TODO fill nodename field when we have hostname info
    65     strlcpy(info->nodename, "unknown", sizeof(info->nodename));
    66 
     65    gethostname(hostname, _SYS_NAMELEN);
     66    strlcpy(info->nodename, hostname, sizeof(info->nodename));
     67   
    6768    return 0;
    6869}
    6970