Annotation of researchv9/libc/gen/uname.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     uname(s)
                      3:  *     struct utsname *s;
                      4:  *
                      5:  *     tell something about which system version we're on
                      6:  */
                      7: 
                      8: #include <sys/utsname.h>
                      9: 
                     10: #define WHOFILE "/etc/whoami"
                     11: 
                     12: int
                     13: uname(s)
                     14:        struct utsname *s;
                     15: {
                     16:        static struct utsname clear;
                     17: 
                     18:        register int fd, i;
                     19: 
                     20:        *s = clear;
                     21: 
                     22:        /* read the system identity */
                     23:        fd = open (WHOFILE, 0);
                     24:        if (fd < 0)
                     25:                return -1;
                     26:        read (fd, s->nodename, sizeof (s->nodename) - 1);
                     27:        close(fd);
                     28: 
                     29:        /* find the trailing \n if any and make it \0 */
                     30:        for (i = 0; i < sizeof (s->nodename); i++)
                     31:                if (s->nodename[i] == '\n')
                     32:                        s->nodename[i] = '\0';
                     33:        
                     34:        /* provide additional identifying information */
                     35:        strcpy (s->sysname, s->nodename);
                     36:        strcpy (s->release, "V8");
                     37:        strcpy (s->version, "0");
                     38: 
                     39:        return 0;
                     40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.