Skip to content

Commit

Permalink
Cygwin: uname: add host machine tag to sysname.
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Jeremy Drake authored and lazka committed Jan 30, 2025
1 parent b160d31 commit 02238d2
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions winsup/cygwin/uname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,27 @@ uname_x (struct utsname *name)
__try
{
char buf[NI_MAXHOST + 1] ATTRIBUTE_NONSTRING;
int n;

memset (name, 0, sizeof (*name));
/* sysname */
const char* sysname = get_sysname();
__small_sprintf (name->sysname, "%s_%s-%u",
sysname,
wincap.osname (), wincap.build_number ());
n = __small_sprintf (name->sysname, "%s_%s-%u",
sysname,
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);
Expand Down

0 comments on commit 02238d2

Please sign in to comment.