Userspace: Add basic id that prints {,e}{uid,gid} of the current proc
This commit is contained in:
parent
b254ade69b
commit
bb4d81a4fa
|
@ -5,6 +5,7 @@ project(userspace CXX)
|
|||
set(USERSPACE_PROJECTS
|
||||
cat
|
||||
echo
|
||||
id
|
||||
init
|
||||
ls
|
||||
Shell
|
||||
|
|
|
@ -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
|
||||
)
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("uid %u, gid %u, euid %u, egid %u\n", getuid(), getgid(), geteuid(), getegid());
|
||||
}
|
Loading…
Reference in New Issue