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]>
  • Loading branch information
Jeremy Drake authored and github-cygwin committed Nov 28, 2024
1 parent 46f7bcc commit 7923059
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions winsup/cygwin/uname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7923059

Please sign in to comment.