meta: replace systemd and ldd with herdd and nsd
This commit is contained in:
@@ -1,10 +0,0 @@
|
|||||||
file(GLOB sources *.c)
|
|
||||||
add_executable(systemd ${sources})
|
|
||||||
target_link_libraries(systemd libc libc-runtime libpthread liblaunch libmango)
|
|
||||||
|
|
||||||
sysroot_add_program(
|
|
||||||
NAME systemd
|
|
||||||
BIN_DIR /usr/bin)
|
|
||||||
bsp_add_program(
|
|
||||||
NAME systemd
|
|
||||||
BIN_DIR /usr/bin)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#include <mango/log.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
|
||||||
{
|
|
||||||
kern_logf("systemd");
|
|
||||||
kern_logf("args:");
|
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) {
|
|
||||||
kern_logf("[%d]: %s", i, argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
10
services/herdd/CMakeLists.txt
Normal file
10
services/herdd/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
file(GLOB sources *.c)
|
||||||
|
add_executable(herdd ${sources})
|
||||||
|
target_link_libraries(herdd libc libc-runtime libmango libpthread)
|
||||||
|
|
||||||
|
sysroot_add_program(
|
||||||
|
NAME herdd
|
||||||
|
BIN_DIR /usr/bin)
|
||||||
|
bsp_add_program(
|
||||||
|
NAME herdd
|
||||||
|
BIN_DIR /usr/bin)
|
||||||
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;
|
||||||
|
}
|
||||||
0
services/herdd/runlevel.c
Normal file
0
services/herdd/runlevel.c
Normal file
14
services/herdd/runlevel.h
Normal file
14
services/herdd/runlevel.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef RUNLEVEL_H_
|
||||||
|
#define RUNLEVEL_H_
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define RUNLEVEL_DESCRIPTION_MAX 64
|
||||||
|
|
||||||
|
struct runlevel {
|
||||||
|
char rl_description[RUNLEVEL_DESCRIPTION_MAX];
|
||||||
|
char **rl_requires;
|
||||||
|
size_t rl_requires_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
0
services/herdd/service.c
Normal file
0
services/herdd/service.c
Normal file
17
services/herdd/service.h
Normal file
17
services/herdd/service.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef SERVICE_H_
|
||||||
|
#define SERVICE_H_
|
||||||
|
|
||||||
|
#define SVC_DESCRIPTION_MAX 64
|
||||||
|
|
||||||
|
enum service_role {
|
||||||
|
SVC_ROLE_NONE = 0x00u,
|
||||||
|
SVC_ROLE_NAMESPACE_PROVIDER = 0x01u,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct service {
|
||||||
|
char s_description[SVC_DESCRIPTION_MAX];
|
||||||
|
enum service_role s_roles;
|
||||||
|
char *s_exec;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
file(GLOB sources *.c)
|
|
||||||
add_executable(ldd ${sources})
|
|
||||||
target_link_libraries(ldd libc-core libc-runtime libmango)
|
|
||||||
|
|
||||||
sysroot_add_program(
|
|
||||||
NAME ldd
|
|
||||||
BIN_DIR /usr/bin)
|
|
||||||
bsp_add_program(
|
|
||||||
NAME ldd
|
|
||||||
BIN_DIR /usr/bin)
|
|
||||||
15
services/nsd/CMakeLists.txt
Normal file
15
services/nsd/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
file(GLOB sources *.c)
|
||||||
|
rosetta_add_service(
|
||||||
|
NAME nsd
|
||||||
|
SOURCES ${sources}
|
||||||
|
CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/nsd.service)
|
||||||
|
target_link_libraries(nsd libc libc-runtime)
|
||||||
|
|
||||||
|
sysroot_add_service(
|
||||||
|
NAME nsd
|
||||||
|
BIN_DIR /usr/bin
|
||||||
|
SVC_DIR /etc/herdd/services)
|
||||||
|
bsp_add_service(
|
||||||
|
NAME nsd
|
||||||
|
BIN_DIR /usr/bin
|
||||||
|
SVC_DIR /etc/herdd/services)
|
||||||
6
services/nsd/nsd.service
Normal file
6
services/nsd/nsd.service
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Namespace Service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Exec=/usr/bin/nsd
|
||||||
|
Role=NamespaceProvider
|
||||||
Reference in New Issue
Block a user