compat/ -- what MontaukOS does not have, and what git gets instead.
Two kinds of file live here.
HEADER OVERLAYS use #include_next to pull in the Montauk libc's own header
and then add what git needs on top. They are found first because -I compat
precedes the libc include path.
unistd.h identity (getuid/geteuid/...), symlink/readlink/link,
chown, fsync, process groups, execl/execlp, getpass, alarm
signal.h the sigaction() family and NSIG
time.h localtime_r/gmtime_r/ctime_r/asctime_r
sys/stat.h S_ISUID/S_ISGID/S_ISVTX and the S_IF* type constants
sys/time.h ITIMER_* selectors
sys/types.h the BSD aliases (u_char, u_int, ...) the ISC-derived
inet_ntop/inet_pton want
STANDALONE HEADERS are for things the libc has no header for at all:
poll.h struct pollfd; the implementation reports everything ready
pwd.h struct passwd, answered from the session user
grp.h struct group; every lookup fails (no group database)
termios.h accepted and ignored; there is no line discipline
netdb.h resolver types; every lookup fails
syslog.h discards (only `git daemon` logs, and it is not built)
sys/socket.h BSD socket API; every call fails with ENOSYS
sys/un.h struct sockaddr_un, for the type only
sys/ioctl.h TIOCGWINSZ, which IS implemented (SYS_TERMSIZE)
sys/utsname.h uname(), static MontaukOS strings
sys/resource.h getrlimit says "unlimited"; getrusage fails
sys/statvfs.h fails; no filesystem statistics syscall
netinet/in.h, netinet/tcp.h, arpa/inet.h address types and byte order
THESE FILES ARE NOT SHIMS. They are the port's own code:
montauk-paths.h force-included into every translation unit, ahead of
git-compat-util.h, so git recognises "0:/path" as an
absolute path. Without it git treats every MontaukOS
absolute path as relative and prepends the cwd to it.
montauk-ownership.h also force-included: answers git's safe.directory
"is this repository mine?" check with yes. MontaukOS
stores no per-file owner, so the default lstat-vs-geteuid
comparison is false for every directory on the system.
Read the header before changing it -- it says what this
gives up once the OS grows real ownership.
montauk-init.h declares montauk_startup(), called from main() by the
patch series.
montauk-compat.c the implementations, each commented with what it
really does. Built into libgitcompat.a, which sits on
the link line ahead of liblibc.a.
THE RULE followed throughout: a shim either does the real thing, or fails
with an errno git already knows how to report. Nothing silently pretends to
have done work it did not do -- with one deliberate exception, fsync(),
which reports success because git treats a failed fsync as fatal and would
abort every commit. That one is called out at its definition.