4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-22 00:38:06 +08:00

Cygwin: uname: add host machine tag to sysname.

If the Cygwin dll's architecture is different from the host system's
architecture, append an additional tag that indicates the host system
architecture (the Cygwin dll's architecture is already indicated in
machine).

Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
This commit is contained in:
Jeremy Drake 2024-11-27 11:26:50 -08:00 committed by Corinna Vinschen
parent 46f7bcc1e5
commit 7923059bff

View File

@ -33,11 +33,25 @@ uname_x (struct utsname *name)
__try
{
char buf[NI_MAXHOST + 1] ATTRIBUTE_NONSTRING;
int n;
memset (name, 0, sizeof (*name));
/* sysname */
__small_sprintf (name->sysname, "CYGWIN_%s-%u",
wincap.osname (), wincap.build_number ());
n = __small_sprintf (name->sysname, "CYGWIN_%s-%u",
wincap.osname (), wincap.build_number ());
if (wincap.host_machine () != wincap.cygwin_machine ())
{
switch (wincap.host_machine ())
{
case IMAGE_FILE_MACHINE_ARM64:
n = stpcpy (name->sysname + n, "-ARM64") - name->sysname;
break;
default:
n += __small_sprintf (name->sysname + n, "-%04y",
(int) wincap.host_machine ());
break;
}
}
/* nodename */
memset (buf, 0, sizeof buf);
cygwin_gethostname (buf, sizeof buf - 1);