From 740dbbbee7b598060a9d3b51afbb9634e735b56e 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 | 7 +++++++ src/pacman/pacman.c | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 0f0c2cfb..23744328 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -18,6 +18,7 @@ * along with this program. If not, see . */ +#include #include #include #include /* setlocale */ @@ -401,6 +402,12 @@ int config_add_architecture(char *arch) char *newarch; uname(&un); newarch = strdup(un.machine); + if(strcmp(newarch, "i686") == 0) { + unsigned int eax, ebx, ecx, edx; + __get_cpuid(1, &eax, &ebx, &ecx, &edx); + if (edx & bit_SSE2) + newarch = strdup("pentium4"); + } free(arch); arch = newarch; } diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 7e810127..cf30325b 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -26,6 +26,7 @@ #include /* atoi */ #include +#include #include /* isspace */ #include #include @@ -274,8 +275,18 @@ static void setuseragent(void) int len; uname(&un); + char machine[8]; + strncpy(machine, un.machine, 8); + if(strcmp(machine, "i686") == 0) { + int eax, ebx, ecx, edx; + __get_cpuid(1, &eax, &ebx, &ecx, &edx); + if (edx & bit_SSE2) { + strncpy(machine, "pentium4", sizeof machine); + machine[sizeof machine-1] = '\0'; + } + } 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-54-g00ecf