mirror of
https://github.com/drasko/codezero.git
synced 2026-01-17 13:23:16 +01:00
Fixed a few minor issues.
This commit is contained in:
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
pagerid = ascii_to_int(getenv("pagerid"));
|
||||
|
||||
wait_pager(0);
|
||||
wait_pager(pagerid);
|
||||
|
||||
printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
|
||||
|
||||
@@ -66,6 +66,6 @@ int main(int argc, char *argv[])
|
||||
exectest(parent_of_all);
|
||||
|
||||
while (1)
|
||||
wait_pager(0);
|
||||
wait_pager(pagerid);
|
||||
}
|
||||
|
||||
|
||||
26
conts/posix/test0/src/test_exec/atoi.h
Normal file
26
conts/posix/test0/src/test_exec/atoi.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __ATOI_H__
|
||||
#define __ATOI_H__
|
||||
|
||||
static inline int power(int exp, int mul)
|
||||
{
|
||||
int total = 1;
|
||||
|
||||
while (exp > 0) {
|
||||
total *= mul;
|
||||
exp--;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
static inline int ascii_to_int(char *str)
|
||||
{
|
||||
int size = strlen(str);
|
||||
int iter = size - 1;
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
num += ((int)str[iter - i] - 48) * power(i, 10);
|
||||
return num;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include "atoi.h"
|
||||
|
||||
void wait_pager(l4id_t partner)
|
||||
{
|
||||
@@ -23,6 +24,8 @@ void wait_pager(l4id_t partner)
|
||||
// printf("Pager synced with us.\n");
|
||||
}
|
||||
|
||||
pid_t pagerid;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
wait_pager(0);
|
||||
@@ -43,13 +46,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Get parent of all pid as a string from environment */
|
||||
parent_of_all = getenv("parent_of_all");
|
||||
pagerid = ascii_to_int(getenv("pagerid"));
|
||||
|
||||
/* Compare two pid strings. We use strings because we dont have atoi() */
|
||||
if (!strcmp(pidbuf, parent_of_all)) {
|
||||
printf("EXECVE TEST -- PASSED --\n");
|
||||
printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid());
|
||||
while (1)
|
||||
wait_pager(0);
|
||||
wait_pager(pagerid);
|
||||
}
|
||||
out:
|
||||
_exit(0);
|
||||
|
||||
Reference in New Issue
Block a user