mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
Import very modest Userland.
This commit is contained in:
parent
4cbf079a17
commit
63764b3a65
23 changed files with 81 additions and 27 deletions
27
Userland/Makefile
Normal file
27
Userland/Makefile
Normal file
|
@ -0,0 +1,27 @@
|
|||
OBJS = \
|
||||
id.o
|
||||
|
||||
ARCH_FLAGS =
|
||||
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib
|
||||
USERLAND_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
|
||||
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
|
||||
FLAVOR_FLAGS = -fomit-frame-pointer -mregparm=3 -march=i386 -m32 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -fmerge-all-constants -fno-unroll-loops -falign-functions=1 -falign-jumps=1 -falign-loops=1 -fno-pie -fno-pic
|
||||
OPTIMIZATION_FLAGS = -Os -fno-asynchronous-unwind-tables
|
||||
INCLUDE_FLAGS = -I.. -I.
|
||||
|
||||
DEFINES = -DSERENITY -DSANITIZE_PTRS
|
||||
|
||||
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
|
||||
CXX = g++
|
||||
LD = ld
|
||||
AR = ar
|
||||
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now
|
||||
|
||||
all: $(OBJS)
|
||||
|
||||
.cpp.o:
|
||||
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
clean:
|
||||
@echo "CLEAN"; rm -f $(LIBRARY) $(OBJS)
|
||||
|
12
Userland/id.cpp
Normal file
12
Userland/id.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <LibC/unistd.h>
|
||||
#include <LibC/stdio.h>
|
||||
|
||||
int main(int c, char** v)
|
||||
{
|
||||
uid_t uid = getuid();
|
||||
gid_t gid = getgid();
|
||||
pid_t pid = getpid();
|
||||
printf("uid=%u, gid=%u, pid=%u\n", uid, gid, pid);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue