Commit 76c3e4b7 authored by Robert Schmidt's avatar Robert Schmidt

Remove x86-specific instructions from telnet server

telnetsrv uses the Intel/AMD-specific "cpuid" instruction, which is not
available on ARM machines. Remove the call.

The previous code was checking for the number of cores, which is
retained by a call to get_nprocs(). I did not find an equivalent for the
number of threads in C. In C++, there would be
https://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency, in
case it's relevant for anybody.
parent 220d851d
......@@ -32,6 +32,7 @@
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysinfo.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
......@@ -222,11 +223,8 @@ char aname[256];
tdata->numlines = 0;
}
unsigned int eax = 11, ebx = 0, ecx = 1, edx = 0;
asm volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "0"(eax), "2"(ecx) :);
prnt("System has %d cores %d threads %d Actual threads", eax, ebx, edx);
int nprocs = get_nprocs();
prnt("System has %d cores", nprocs);
prnt("\n id name state USRmod KRNmod prio nice vsize proc pol \n\n");
snprintf(aname, sizeof(aname), "/proc/%d/stat", getpid());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment