2 Copyright © 2008, The AROS Development Team. All rights reserved.
10 #include <exec/types.h>
11 #include <aros/debug.h>
12 #include <utility/tagitem.h>
13 #include <aros/inquire.h>
14 #include <proto/aros.h>
15 #include <proto/dos.h>
17 /*****************************************************************************
20 #include <sys/utsname.h>
28 Store information about the operating system in the structure pointed
32 name - Pointer to utsname structure defined in <sys/utsname.h>.
35 If the information was stored successfully, zero is returned. Otherwise
36 function returns -1 and sets errno appropriately.
47 This function is using ArosInquire() function to get information about
50 ******************************************************************************/
59 memset(name
, 0, sizeof(struct utsname
));
61 ArosInquire(AI_ArosBuildDate
, &str_builddate
,
62 AI_ArosVersion
, &version
,
63 AI_ArosReleaseMajor
, &release_minor
,
64 AI_ArosReleaseMinor
, &release_major
,
65 AI_ArosArchitecture
, &architecture
,
68 strncpy(name
->sysname
, "AROS", sizeof(name
->sysname
) - 1);
69 snprintf(name
->release
, sizeof(name
->release
) - 1, "%d.%d", (int) release_major
, (int) release_minor
);
70 snprintf(name
->version
, sizeof(name
->version
) - 1, "%d %s", (int) version
, str_builddate
);
71 cpu
= rindex(architecture
, '-') + 1;
72 strncpy(name
->machine
, (cpu
?cpu
:architecture
), sizeof(name
->machine
) - 1);
74 /* If TCP is running it will set the ENV:HOSTNAME var with our hostname */
75 if (GetVar("HOSTNAME", name
->nodename
, sizeof(name
->nodename
) - 1, GVF_GLOBAL_ONLY
) == -1)
77 strncpy(name
->nodename
, "localhost.localdomain", sizeof(name
->nodename
) - 1);