diff --git a/userspace/CMakeLists.txt b/userspace/CMakeLists.txt index f4deddbf..0ce1bf16 100644 --- a/userspace/CMakeLists.txt +++ b/userspace/CMakeLists.txt @@ -5,6 +5,7 @@ project(userspace CXX) set(USERSPACE_PROJECTS cat echo + id init ls Shell diff --git a/userspace/id/CMakeLists.txt b/userspace/id/CMakeLists.txt new file mode 100644 index 00000000..1cf2c33d --- /dev/null +++ b/userspace/id/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.26) + +project(id CXX) + +set(SOURCES + main.cpp +) + +add_executable(id ${SOURCES}) +target_compile_options(id PUBLIC -O2 -g) +target_link_libraries(id PUBLIC libc) + +add_custom_target(id-install + COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/id ${BANAN_BIN}/ + DEPENDS id +) diff --git a/userspace/id/main.cpp b/userspace/id/main.cpp new file mode 100644 index 00000000..567be574 --- /dev/null +++ b/userspace/id/main.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() +{ + printf("uid %u, gid %u, euid %u, egid %u\n", getuid(), getgid(), geteuid(), getegid()); +}