diff --git a/Makefile.am b/Makefile.am index 21e874a..d26f1e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,9 +15,22 @@ AM_CFLAGS = @VLIBC_CFLAGS@ # appended to libvlibc_la_SOURCES WHEN ITS TODO LANDS — the list grows # incrementally and never references a directory that does not exist yet: # -# W1 (wired now): src/internal, src/start, src/errno, -# src/setjmp/x86_64, src/string, crt/ (crt1.o) -# todo 7 src/malloc todo 39-42 src/math todo 50 src/multibyte +# Wired so far (W1-W3 + W5/W6 slices, each wired when its todo landed): +# src/internal, src/start, src/errno, +# src/setjmp/x86_64, src/string, crt/ (crt1.o), +# src/malloc (todo 7), src/ctype (todo 9,51), +# src/stdlib (todo 11-14, incl. the 13 env slice), +# src/unistd (todo 19), src/process (todo 20,23), +# src/fcntl (todo 21), src/stat (todo 22), +# src/dirent (todo 24), src/select (todo 25), +# src/time (todo 26; todo 27 sys/time is a +# follow-up — gettimeofday/settimeofday/ +# getitimer/setitimer/utimes.c + sys/time.h +# landed after this wiring), src/stdio (todo +# 15-18 FILE core + popen; vfprintf.c/ +# vfprintf_float.c still to wire with the +# printf test) +# todo 39-42 src/math todo 50 src/multibyte # todo 11-14 src/stdlib todo 43 src/complex todo 53-54 src/regex # todo 15-18 src/stdio todo 9,51 src/ctype todo 57-58 src/network # todo 19,38 src/unistd todo 55 src/search todo 59 src/mq @@ -41,6 +54,14 @@ AM_CFLAGS = @VLIBC_CFLAGS@ # standalone crt1.o below (the sole crt owner; todo 64 reuses, never rebuilds). # Level-independent L1 core (wired today + the pre-plan string slice). +# W5/W6 additions follow the established split rule: whole-content-L2 TUs +# (lockf, mknod, readdir_r/scandir/alphasort, ppoll, strptime/timer) go to +# VLIBC_LEVEL2_SRCS; L1 bodies with L2 sections self-gated inside the .c +# (fork.c vfork, groups.c setgroups, session.c tail, wait.c wait3/wait4, +# time ctime/mktime/nanosleep/strftime/tzset L2 tails, stdio.c L2 tail, +# unistd lseek64/dup3/pipe2/truncate) stay in CORE. task-19's unistd dir is +# CORE throughout (self-gated L2 sections, no whole-file gate). T27's +# sys/time slice is NOT yet wired (uncommitted at wiring time). VLIBC_CORE_SRCS = \ src/vlibc.c \ src/internal/assert_fail.c \ @@ -85,7 +106,69 @@ VLIBC_CORE_SRCS = \ src/stdlib/inttypes.c \ src/stdlib/env.c \ src/stdlib/multibyte.c \ - src/stdlib/mkstemp.c + src/stdlib/mkstemp.c \ + src/stdio/stdio.c \ + src/stdio/fmemopen.c \ + src/stdio/getline.c \ + src/stdio/locking.c \ + src/stdio/popen.c \ + src/stdio/vfscanf.c \ + src/unistd/access.c \ + src/unistd/close.c \ + src/unistd/dup.c \ + src/unistd/fsync.c \ + src/unistd/lseek.c \ + src/unistd/open.c \ + src/unistd/pipe.c \ + src/unistd/pread.c \ + src/unistd/rw.c \ + src/unistd/sync.c \ + src/unistd/truncate.c \ + src/process/atfork.c \ + src/process/execl.c \ + src/process/execle.c \ + src/process/execlp.c \ + src/process/execv.c \ + src/process/execve.c \ + src/process/execvp.c \ + src/process/fork.c \ + src/process/groups.c \ + src/process/pid.c \ + src/process/session.c \ + src/process/system.c \ + src/process/uid.c \ + src/process/wait.c \ + src/fcntl/creat.c \ + src/fcntl/fcntl.c \ + src/fcntl/posix_fadvise.c \ + src/fcntl/posix_fallocate.c \ + src/stat/chmod.c \ + src/stat/chown.c \ + src/stat/fstatat.c \ + src/stat/mkdir.c \ + src/stat/mkfifo.c \ + src/stat/umask.c \ + src/stat/utimensat.c \ + src/dirent/closedir.c \ + src/dirent/dirfd.c \ + src/dirent/fdopendir.c \ + src/dirent/opendir.c \ + src/dirent/readdir.c \ + src/dirent/rewinddir.c \ + src/dirent/seekdir.c \ + src/dirent/telldir.c \ + src/select/poll.c \ + src/select/pselect.c \ + src/select/select.c \ + src/time/time.c \ + src/time/clock.c \ + src/time/timespec_get.c \ + src/time/sleep.c \ + src/time/nanosleep.c \ + src/time/mktime.c \ + src/time/ctime.c \ + src/time/tzset.c \ + src/time/strftime.c # Profile-gated sources, EXISTING gates preserved (strlcpy/strlcat stay L2 # BSD, strcasestr stays L3 GNU — NOT promoted). Task 8/9 additions: stpcpy.c @@ -100,11 +183,20 @@ VLIBC_CORE_SRCS = \ # and self-gate at level 1. Likewise rand.c (its L2 rand_r/drand48 section) # and the strtox/strtod/inttypes/div/qsort C files (their L2 gates live in # include/stdlib.h / include/inttypes.h declarations) stay in VLIBC_CORE_SRCS. +# W5/W6 whole-file-L2 joins (verified by reading each .c — the #if +# VLIBC_LEVEL_GE(2) wraps the whole body after the includes): lockf.c (XSI), +# mknod.c (XSI), readdir_r.c/scandir.c/alphasort.c (XSI dirent), ppoll.c +# (Linux), strptime.c/timer.c (POSIX timers), plus the earlier strings slice. VLIBC_LEVEL2_SRCS = src/string/strlcpy.c src/string/strlcat.c \ src/string/stpcpy.c src/string/memccpy.c \ src/ctype/isascii.c src/ctype/toascii.c \ src/string/strings_impl.c \ - src/stdlib/pty.c src/stdlib/getsubopt.c + src/stdlib/pty.c src/stdlib/getsubopt.c \ + src/fcntl/lockf.c \ + src/stat/mknod.c \ + src/dirent/readdir_r.c src/dirent/scandir.c src/dirent/alphasort.c \ + src/select/ppoll.c \ + src/time/strptime.c src/time/timer.c VLIBC_LEVEL3_SRCS = src/string/strcasestr.c vlibc_lib_LTLIBRARIES = libvlibc.la @@ -149,7 +241,16 @@ vlibc_include_HEADERS = \ include/tgmath.h \ include/threads.h \ include/uchar.h \ - include/sys/types.h + include/dirent.h \ + include/fcntl.h \ + include/poll.h \ + include/stdio.h \ + include/time.h \ + include/unistd.h \ + include/sys/select.h \ + include/sys/stat.h \ + include/sys/types.h \ + include/sys/wait.h # Install location depends on the install method (see configure.ac). if INSTALL_OVERWRITE @@ -278,7 +379,9 @@ VLIBC_TEST_CFLAGS = -DVLIBC_LEVEL=$(VLIBC_TEST_LEVEL) -fno-stack-protector \ check_PROGRAMS = test_syscall test_strerror test_setjmp test_headers \ test_startup test_malloc test_string test_ctype test_strings \ - test_strtol test_qsort test_inttypes test_env + test_strtol test_qsort test_inttypes test_env \ + test_process test_fcntl test_stat test_wait test_dirent \ + test_poll test_time test_scanf test_getline test_syscall_SOURCES = tests/syscall_test.c test_syscall_CFLAGS = $(VLIBC_TEST_CFLAGS) @@ -358,15 +461,73 @@ test_env_DEPENDENCIES = crt1.o libvlibc-check.a test_env_LINK = $(VLIBC_TEST_LINK) test_env_LDADD = $(VLIBC_TEST_LDADD) +test_process_SOURCES = tests/test_process.c +test_process_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_process_DEPENDENCIES = crt1.o libvlibc-check.a +test_process_LINK = $(VLIBC_TEST_LINK) +test_process_LDADD = $(VLIBC_TEST_LDADD) + +test_fcntl_SOURCES = tests/test_fcntl.c +test_fcntl_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_fcntl_DEPENDENCIES = crt1.o libvlibc-check.a +test_fcntl_LINK = $(VLIBC_TEST_LINK) +test_fcntl_LDADD = $(VLIBC_TEST_LDADD) + +test_stat_SOURCES = tests/test_stat.c +test_stat_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_stat_DEPENDENCIES = crt1.o libvlibc-check.a +test_stat_LINK = $(VLIBC_TEST_LINK) +test_stat_LDADD = $(VLIBC_TEST_LDADD) + +test_wait_SOURCES = tests/test_wait.c +test_wait_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_wait_DEPENDENCIES = crt1.o libvlibc-check.a +test_wait_LINK = $(VLIBC_TEST_LINK) +test_wait_LDADD = $(VLIBC_TEST_LDADD) + +test_dirent_SOURCES = tests/test_dirent.c +test_dirent_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_dirent_DEPENDENCIES = crt1.o libvlibc-check.a +test_dirent_LINK = $(VLIBC_TEST_LINK) +test_dirent_LDADD = $(VLIBC_TEST_LDADD) + +test_poll_SOURCES = tests/test_poll.c +test_poll_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_poll_DEPENDENCIES = crt1.o libvlibc-check.a +test_poll_LINK = $(VLIBC_TEST_LINK) +test_poll_LDADD = $(VLIBC_TEST_LDADD) + +test_time_SOURCES = tests/test_time.c +test_time_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_time_DEPENDENCIES = crt1.o libvlibc-check.a +test_time_LINK = $(VLIBC_TEST_LINK) +test_time_LDADD = $(VLIBC_TEST_LDADD) + +test_scanf_SOURCES = tests/test_scanf.c +test_scanf_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_scanf_DEPENDENCIES = crt1.o libvlibc-check.a +test_scanf_LINK = $(VLIBC_TEST_LINK) +test_scanf_LDADD = $(VLIBC_TEST_LDADD) + +test_getline_SOURCES = tests/test_getline.c +test_getline_CFLAGS = $(VLIBC_TEST_CFLAGS) +test_getline_DEPENDENCIES = crt1.o libvlibc-check.a +test_getline_LINK = $(VLIBC_TEST_LINK) +test_getline_LDADD = $(VLIBC_TEST_LDADD) + # test_startup's default mode exits 42 by design, so it is NOT a bare TESTS # entry; tests/startup_modes.sh runs its full mode matrix and the -f failure # scenarios of the other binaries. test_malloc/test_string/test_ctype/ -# test_strings/test_strtol/test_qsort/test_inttypes/test_env default to the -# happy mode (exit 0 on all-pass) and are bare TESTS entries; their -f/-p -# modes stay runnable by hand. +# test_strings/test_strtol/test_qsort/test_inttypes/test_env and the W5/W6 +# wave tests (test_process/test_fcntl/test_stat/test_wait/test_dirent/ +# test_poll/test_time/test_scanf/test_getline) default to the happy mode +# (exit 0 on all-pass) and are bare TESTS entries; their -f/-p modes stay +# runnable by hand. TESTS = test_syscall test_strerror test_setjmp test_headers \ test_malloc test_string test_ctype test_strings \ test_strtol test_qsort test_inttypes test_env \ + test_process test_fcntl test_stat test_wait test_dirent \ + test_poll test_time test_scanf test_getline \ tests/startup_modes.sh CLEANFILES = crt1.o libvlibc-check.a $(VLIBC_CHECK_OBJECTS) @@ -387,4 +548,10 @@ EXTRA_DIST = \ src/internal/syscall.h \ src/internal/types.h \ src/start/start.h \ - src/start/tcb.h + src/start/tcb.h \ + src/dirent/dirent_impl.h \ + src/process/atfork_impl.h \ + src/stat/stat_impl.h \ + src/stdio/stdio_impl.h \ + src/time/time_impl.h \ + src/unistd/unistd_impl.h