Skip to content

os.is64bit() support on POSIX platform#2609

Closed
noresources wants to merge 1 commit intopremake:masterfrom
noresources:patch5-os-is64bit-uname
Closed

os.is64bit() support on POSIX platform#2609
noresources wants to merge 1 commit intopremake:masterfrom
noresources:patch5-os-is64bit-uname

Conversation

@noresources
Copy link
Contributor

Use iname() to get host architecture name and compare it against a known 64-bit architecture name list.

What does this PR do?
os.is64bit() implementation for POSIX platforms.

How does this PR change Premake's behavior?

os.is64bit() returns true on most common 64-bit platforms running POSIX systems.

Anything else we should know?

Architecture white list is not exhaustive but covers most common platforms.

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to requests like these!

Use iname() to get host architecture name and compare it against a known 64-bit architecture name list.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this change from the commit.

*/

#include "premake.h"
#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) || defined(PLATFORM_LINUX) || defined(PLATFORM_SOLARIS) || defined(PLATFORM_HURD) || defined(PLATFORM_HAIKU) || defined(PLATFORM_COSMO)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Update the date on the copyright

#endif
#if HAVE_UNAME
struct utsname data;
if (uname(&data) >= 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not == 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was my first move. Before reading this comment in src/host/os_getversion.c

// uname returns -1 on error, and returns 0 on success for most platforms
// except Solaris, which returns non-negative.

@noresources noresources force-pushed the patch5-os-is64bit-uname branch from 80217d4 to d4622b8 Compare January 24, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants