meta: replace systemd and ldd with herdd and nsd
This commit is contained in:
43
services/herdd/main.c
Normal file
43
services/herdd/main.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <errno.h>
|
||||
#include <mango/log.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void *thread_func(void *arg)
|
||||
{
|
||||
kern_logf("started thread with arg %p", arg);
|
||||
errno = 100;
|
||||
return (void *)0xdeadbeef;
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[], const char *envp[])
|
||||
{
|
||||
kern_logf("herdd");
|
||||
kern_logf("args:");
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
kern_logf("[%d]: %s", i, argv[i]);
|
||||
}
|
||||
|
||||
kern_logf("env:");
|
||||
|
||||
for (int i = 0; envp[i]; i++) {
|
||||
kern_logf("[%d]: %s", i, envp[i]);
|
||||
}
|
||||
|
||||
kern_logf("self = %p", pthread_self());
|
||||
errno = 200;
|
||||
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, NULL, thread_func, (void *)0xdeafcafe);
|
||||
kern_logf("started thread %p", thread);
|
||||
void *ret = NULL;
|
||||
pthread_join(thread, &ret);
|
||||
kern_logf("thread returned %p", ret);
|
||||
|
||||
kern_logf("errno...");
|
||||
kern_logf("%u", errno);
|
||||
kern_logf("...errno");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user