1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

remove dependency of the PCRE library

This commit is contained in:
Stefan Lankes 2016-10-09 08:55:10 +02:00
parent 070d5fac66
commit b32d266a8c
4 changed files with 10 additions and 19 deletions

View file

@ -6,7 +6,7 @@ language: c
compiler: gcc
before_install:
- 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
script:
- ./configure

View file

@ -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:
```
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

View file

@ -19,7 +19,7 @@ all: proxy
proxy: proxy.o
@echo [LD] $@
$Q$(CC) $(CFLAGS) -o $@ $< -lpcre
$Q$(CC) $(CFLAGS) -o $@ $<
clean:
@echo Cleaning tools

View file

@ -45,7 +45,6 @@
#include <sys/wait.h>
#include <unistd.h>
#include <stdint.h>
#include <pcre.h>
#define MAX_PATH 255
#define MAX_ARGS 1024
@ -106,36 +105,28 @@ static void exit_handler(int sig)
static char* cpufreq(void)
{
const char* pattern = "^cpu MHz\\s*:\\s*(\\d+)";
const char* pcreErrorStr = NULL;
int creErrorOffset = 0;
char line[2048];
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");
if (!fp)
return "0";
return "-freq0";
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;
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);
fclose(fp);
pcre_free_substring(match);
pcre_free(reCompiled);
return cmdline;
}
return "0";
return "-freq0";
}
static int init_env(char *path)