From b05869385871ba7048af2aebb421a3519fcae312 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 13 May 2019 10:39:33 +0200 Subject: change "i686" to "pentium4" if sse2 is available --- src/pacman/conf.c | 5 +++++ src/pacman/pacman.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 3b79fbc7..2325f688 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -308,6 +308,11 @@ int config_set_arch(const char *arch) struct utsname un; uname(&un); config->arch = strdup(un.machine); + if(strcmp(config->arch, "i686") == 0) { + __builtin_cpu_init(); + if (__builtin_cpu_supports("sse2")) + config->arch = strdup("pentium4"); + } } else { config->arch = strdup(arch); } diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 3bb622e6..abb6f933 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -274,8 +274,15 @@ static void setuseragent(void) int len; uname(&un); + char machine[8]; + strncpy(machine, un.machine, 8); + if(strcmp(machine, "i686") == 0) { + __builtin_cpu_init(); + if (__builtin_cpu_supports("sse2")) + strncpy(machine, "pentium4", 8); + } len = snprintf(agent, 100, "pacman/%s (%s %s) libalpm/%s", - PACKAGE_VERSION, un.sysname, un.machine, alpm_version()); + PACKAGE_VERSION, un.sysname, machine, alpm_version()); if(len >= 100) { pm_printf(ALPM_LOG_WARNING, _("HTTP_USER_AGENT truncated\n")); } -- cgit v1.2.3-70-g09d2