mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-16 00:00:06 +01:00
remove dependency of the PCRE library
This commit is contained in:
parent
070d5fac66
commit
b32d266a8c
4 changed files with 10 additions and 19 deletions
|
@ -6,7 +6,7 @@ language: c
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get -qq update
|
- sudo apt-get -qq update
|
||||||
- sudo apt-get install -y curl qemu-system-x86 nasm texinfo libpcre3-dev libmpfr-dev libmpc-dev libgmp-dev libisl-dev flex bison
|
- sudo apt-get install -y curl qemu-system-x86 nasm texinfo libmpfr-dev libmpc-dev libgmp-dev libisl-dev flex bison
|
||||||
- git submodule update --init hermit/lwip hermit/usr/gcc hermit/usr/pte hermit/usr/libomp
|
- git submodule update --init hermit/lwip hermit/usr/gcc hermit/usr/pte hermit/usr/libomp
|
||||||
script:
|
script:
|
||||||
- ./configure
|
- ./configure
|
||||||
|
|
|
@ -23,7 +23,7 @@ The build process works currently only on **x86-based Linux** systems. The follo
|
||||||
|
|
||||||
On Debian-based systems the packets can be installed by executing:
|
On Debian-based systems the packets can be installed by executing:
|
||||||
```
|
```
|
||||||
sudo apt-get install qemu-system-x86 nasm texinfo libpcre3-dev libmpfr-dev libmpc-dev libgmp-dev libisl-dev flex bison
|
sudo apt-get install qemu-system-x86 nasm texinfo libmpfr-dev libmpc-dev libgmp-dev libisl-dev flex bison
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building and testing HermitCore as multi-kernel within a virtual machine
|
## Building and testing HermitCore as multi-kernel within a virtual machine
|
||||||
|
|
|
@ -19,7 +19,7 @@ all: proxy
|
||||||
|
|
||||||
proxy: proxy.o
|
proxy: proxy.o
|
||||||
@echo [LD] $@
|
@echo [LD] $@
|
||||||
$Q$(CC) $(CFLAGS) -o $@ $< -lpcre
|
$Q$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning tools
|
@echo Cleaning tools
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pcre.h>
|
|
||||||
|
|
||||||
#define MAX_PATH 255
|
#define MAX_PATH 255
|
||||||
#define MAX_ARGS 1024
|
#define MAX_ARGS 1024
|
||||||
|
@ -106,36 +105,28 @@ static void exit_handler(int sig)
|
||||||
|
|
||||||
static char* cpufreq(void)
|
static char* cpufreq(void)
|
||||||
{
|
{
|
||||||
const char* pattern = "^cpu MHz\\s*:\\s*(\\d+)";
|
|
||||||
const char* pcreErrorStr = NULL;
|
|
||||||
int creErrorOffset = 0;
|
|
||||||
char line[2048];
|
char line[2048];
|
||||||
const char* match = NULL;
|
const char* match = NULL;
|
||||||
int rc, results[10];
|
|
||||||
|
|
||||||
pcre* reCompiled = pcre_compile(pattern, PCRE_ANCHORED, &pcreErrorStr, &creErrorOffset, NULL);
|
|
||||||
|
|
||||||
if(reCompiled == NULL)
|
|
||||||
return "0";
|
|
||||||
|
|
||||||
FILE* fp = fopen("/proc/cpuinfo", "r");
|
FILE* fp = fopen("/proc/cpuinfo", "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return "0";
|
return "-freq0";
|
||||||
|
|
||||||
while(fgets(line, 2048, fp)) {
|
while(fgets(line, 2048, fp)) {
|
||||||
if ((rc = pcre_exec(reCompiled, 0, line, 2048, 0, 0, results, 10)) < 0)
|
if ((match = strstr(line, "cpu MHz")) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pcre_get_substring(line, results, rc, 1, &(match));
|
// scan strinf for the next number
|
||||||
|
for(; (*match < 0x30) || (*match > 0x39); match++)
|
||||||
|
;
|
||||||
|
|
||||||
snprintf(cmdline, MAX_PATH, "-freq%s", match);
|
snprintf(cmdline, MAX_PATH, "-freq%s", match);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
pcre_free_substring(match);
|
|
||||||
pcre_free(reCompiled);
|
|
||||||
|
|
||||||
return cmdline;
|
return cmdline;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "0";
|
return "-freq0";
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_env(char *path)
|
static int init_env(char *path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue