Skip to content

Commit 8d847f4

Browse files
committed
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 <[email protected]> (cherry picked from commit 7923059)
1 parent fe383b0 commit 8d847f4

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

‎winsup/cygwin/uname.cc‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,27 @@ uname_x (struct utsname *name)
5151
__try
5252
{
5353
char buf[NI_MAXHOST + 1] ATTRIBUTE_NONSTRING;
54+
int n;
5455

5556
memset (name, 0, sizeof (*name));
5657
/* sysname */
5758
const char* sysname = get_sysname();
58-
__small_sprintf (name->sysname, "%s_%s-%u",
59-
sysname,
60-
wincap.osname (), wincap.build_number ());
59+
n = __small_sprintf (name->sysname, "%s_%s-%u",
60+
sysname,
61+
wincap.osname (), wincap.build_number ());
62+
if (wincap.host_machine () != wincap.cygwin_machine ())
63+
{
64+
switch (wincap.host_machine ())
65+
{
66+
case IMAGE_FILE_MACHINE_ARM64:
67+
n = stpcpy (name->sysname + n, "-ARM64") - name->sysname;
68+
break;
69+
default:
70+
n += __small_sprintf (name->sysname + n, "-%04y",
71+
(int) wincap.host_machine ());
72+
break;
73+
}
74+
}
6175
/* nodename */
6276
memset (buf, 0, sizeof buf);
6377
cygwin_gethostname (buf, sizeof buf - 1);

0 commit comments

Comments
 (0)