mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-03 12:21:37 +00:00
This feature doesn't seem to make much sense. Also, it was already broken: Pal/regression/Process3.c assumed uri==NULL means spawning the process without an executable, but PAL code interpreted this as "spawn caller's executable again". The documentation doesn't mention this special case, so it's hard to say which semantics was originally intended.
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
#include "api.h"
|
|
#include "pal.h"
|
|
#include "pal_debug.h"
|
|
|
|
int main(int argc, char** argv) {
|
|
int count = 0;
|
|
|
|
pal_printf("In process: %s", argv[0]);
|
|
for (int i = 1; i < argc; i++) {
|
|
pal_printf(" %s", argv[i]);
|
|
}
|
|
pal_printf("\n");
|
|
|
|
if (argc == 1) {
|
|
uint64_t time = DkSystemTimeQuery();
|
|
char time_arg[24];
|
|
snprintf(time_arg, 24, "%ld", time);
|
|
|
|
const char* newargs[4] = {"Process4", "0", time_arg, NULL};
|
|
|
|
PAL_HANDLE proc = DkProcessCreate("file:Process4", newargs);
|
|
|
|
if (!proc)
|
|
pal_printf("Can't create process\n");
|
|
|
|
DkObjectClose(proc);
|
|
DkThreadDelayExecution(3000000);
|
|
} else {
|
|
count = atoi(argv[1]);
|
|
|
|
if (count < 100) {
|
|
count++;
|
|
|
|
char count_arg[8];
|
|
snprintf(count_arg, 8, "%d", count);
|
|
const char* newargs[4] = {"Process4", count_arg, argv[2], NULL};
|
|
|
|
PAL_HANDLE proc = DkProcessCreate("file:Process4", newargs);
|
|
|
|
if (!proc)
|
|
pal_printf("Can't create process\n");
|
|
|
|
DkObjectClose(proc);
|
|
} else {
|
|
uint64_t end = DkSystemTimeQuery();
|
|
uint64_t start = atol(argv[2]);
|
|
pal_printf("wall time = %ld\n", end - start);
|
|
}
|
|
}
|
|
|
|
DkProcessExit(0);
|
|
}
|