summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/P90+AMD1/DEPS.mk2
-rw-r--r--src/_POSIX_SOURCE.c5
-rw-r--r--src/cpio/C_IRGRP.c5
-rw-r--r--src/cpio/C_IROTH.c5
-rw-r--r--src/cpio/C_IRUSR.c5
-rw-r--r--src/cpio/C_ISBLK.c5
-rw-r--r--src/cpio/C_ISCHR.c5
-rw-r--r--src/cpio/C_ISCTG.c5
-rw-r--r--src/cpio/C_ISDIR.c5
-rw-r--r--src/cpio/C_ISFIFO.c5
-rw-r--r--src/cpio/C_ISGID.c5
-rw-r--r--src/cpio/C_ISLNK.c5
-rw-r--r--src/cpio/C_ISREG.c5
-rw-r--r--src/cpio/C_ISSOCK.c5
-rw-r--r--src/cpio/C_ISUID.c5
-rw-r--r--src/cpio/C_ISVTX.c5
-rw-r--r--src/cpio/C_IWGRP.c5
-rw-r--r--src/cpio/C_IWOTH.c5
-rw-r--r--src/cpio/C_IWUSR.c5
-rw-r--r--src/cpio/C_IXGRP.c5
-rw-r--r--src/cpio/C_IXOTH.c5
-rw-r--r--src/cpio/C_IXUSR.c5
-rw-r--r--src/cpio/MAGIC.c5
-rw-r--r--src/dirent/DIR.c5
-rw-r--r--src/dirent/closedir.c20
-rw-r--r--src/dirent/opendir.c12
-rw-r--r--src/dirent/readdir.c12
-rw-r--r--src/dirent/rewinddir.c10
-rw-r--r--src/dirent/struct_dirent.c14
-rw-r--r--src/environ.c4
-rw-r--r--src/errno/E2BIG.c8
-rw-r--r--src/errno/EACCES.c8
-rw-r--r--src/errno/EAGAIN.c8
-rw-r--r--src/errno/EBADF.c8
-rw-r--r--src/errno/EBUSY.c8
-rw-r--r--src/errno/ECHILD.c8
-rw-r--r--src/errno/EDEADLK.c8
-rw-r--r--src/errno/EEXIST.c8
-rw-r--r--src/errno/EFAULT.c8
-rw-r--r--src/errno/EFBIG.c8
-rw-r--r--src/errno/EINTR.c8
-rw-r--r--src/errno/EINVAL.c8
-rw-r--r--src/errno/EIO.c8
-rw-r--r--src/errno/EISDIR.c8
-rw-r--r--src/errno/EMFILE.c8
-rw-r--r--src/errno/EMLINK.c8
-rw-r--r--src/errno/ENAMETOOLONG.c8
-rw-r--r--src/errno/ENFILE.c8
-rw-r--r--src/errno/ENODEV.c8
-rw-r--r--src/errno/ENOENT.c8
-rw-r--r--src/errno/ENOEXEC.c8
-rw-r--r--src/errno/ENOLCK.c8
-rw-r--r--src/errno/ENOMEM.c8
-rw-r--r--src/errno/ENOSPC.c8
-rw-r--r--src/errno/ENOSYS.c8
-rw-r--r--src/errno/ENOTDIR.c8
-rw-r--r--src/errno/ENOTEMPTY.c8
-rw-r--r--src/errno/ENOTTY.c8
-rw-r--r--src/errno/ENXIO.c8
-rw-r--r--src/errno/EPERM.c8
-rw-r--r--src/errno/EPIPE.c8
-rw-r--r--src/errno/EROFS.c8
-rw-r--r--src/errno/ESPIPE.c8
-rw-r--r--src/errno/ESRCH.c8
-rw-r--r--src/errno/EXDEV.c8
-rw-r--r--src/fcntl/FD_CLOEXEC.c7
-rw-r--r--src/fcntl/F_DUPFD.c7
-rw-r--r--src/fcntl/F_GETFD.c7
-rw-r--r--src/fcntl/F_GETFL.c7
-rw-r--r--src/fcntl/F_GETLK.c7
-rw-r--r--src/fcntl/F_RDLCK.c7
-rw-r--r--src/fcntl/F_SETFD.c7
-rw-r--r--src/fcntl/F_SETFL.c7
-rw-r--r--src/fcntl/F_SETLK.c7
-rw-r--r--src/fcntl/F_SETLKW.c7
-rw-r--r--src/fcntl/F_UNLCK.c7
-rw-r--r--src/fcntl/F_WRLCK.c7
-rw-r--r--src/fcntl/O_ACCMODE.c7
-rw-r--r--src/fcntl/O_APPEND.c7
-rw-r--r--src/fcntl/O_CREAT.c7
-rw-r--r--src/fcntl/O_EXCL.c7
-rw-r--r--src/fcntl/O_NOCTTY.c7
-rw-r--r--src/fcntl/O_NONBLOCK.c7
-rw-r--r--src/fcntl/O_RDONLY.c7
-rw-r--r--src/fcntl/O_RDWR.c7
-rw-r--r--src/fcntl/O_TRUNC.c7
-rw-r--r--src/fcntl/O_WRONLY.c7
-rw-r--r--src/fcntl/creat.c11
-rw-r--r--src/fcntl/fcntl.c61
-rw-r--r--src/fcntl/open.c30
-rw-r--r--src/fcntl/struct_flock.c13
-rw-r--r--src/grp/getgrgid.c13
-rw-r--r--src/grp/getgrnam.c13
-rw-r--r--src/grp/struct_group.c11
-rw-r--r--src/limits/ARG_MAX.c8
-rw-r--r--src/limits/CHILD_MAX.c8
-rw-r--r--src/limits/LINK_MAX.c8
-rw-r--r--src/limits/MAX_CANON.c8
-rw-r--r--src/limits/MAX_INPUT.c8
-rw-r--r--src/limits/NAME_MAX.c9
-rw-r--r--src/limits/NGROUPS_MAX.c8
-rw-r--r--src/limits/OPEN_MAX.c8
-rw-r--r--src/limits/PATH_MAX.c9
-rw-r--r--src/limits/PIPE_BUF.c8
-rw-r--r--src/limits/SSIZE_MAX.c8
-rw-r--r--src/limits/STREAM_MAX.c9
-rw-r--r--src/limits/TZNAME_MAX.c9
-rw-r--r--src/limits/_POSIX_ARG_MAX.c6
-rw-r--r--src/limits/_POSIX_CHILD_MAX.c7
-rw-r--r--src/limits/_POSIX_LINK_MAX.c6
-rw-r--r--src/limits/_POSIX_MAX_CANON.c6
-rw-r--r--src/limits/_POSIX_MAX_INPUT.c6
-rw-r--r--src/limits/_POSIX_NAME_MAX.c6
-rw-r--r--src/limits/_POSIX_NGROUPS_MAX.c7
-rw-r--r--src/limits/_POSIX_OPEN_MAX.c7
-rw-r--r--src/limits/_POSIX_PATH_MAX.c7
-rw-r--r--src/limits/_POSIX_PIPE_BUF.c6
-rw-r--r--src/limits/_POSIX_SSIZE_MAX.c8
-rw-r--r--src/limits/_POSIX_STREAM_MAX.c7
-rw-r--r--src/limits/_POSIX_TZNAME_MAX.c9
-rw-r--r--src/nonstd/intmax_t.ref2
-rw-r--r--src/pwd/getpwnam.c13
-rw-r--r--src/pwd/getpwuid.c13
-rw-r--r--src/pwd/struct_passwd.c13
-rw-r--r--src/setjmp/sigjmp_buf.c7
-rw-r--r--src/setjmp/siglongjmp.c10
-rw-r--r--src/setjmp/sigsetjmp.c10
-rw-r--r--src/signal/SA_NOCLDSTOP.c6
-rw-r--r--src/signal/SIGALRM.c6
-rw-r--r--src/signal/SIGCHLD.c5
-rw-r--r--src/signal/SIGCONT.c5
-rw-r--r--src/signal/SIGHUP.c6
-rw-r--r--src/signal/SIGKILL.c6
-rw-r--r--src/signal/SIGPIPE.c5
-rw-r--r--src/signal/SIGQUIT.c6
-rw-r--r--src/signal/SIGSTOP.c5
-rw-r--r--src/signal/SIGTSTP.c5
-rw-r--r--src/signal/SIGTTIN.c5
-rw-r--r--src/signal/SIGTTOU.c5
-rw-r--r--src/signal/SIGUSR1.c5
-rw-r--r--src/signal/SIGUSR2.c5
-rw-r--r--src/signal/SIG_BLOCK.c5
-rw-r--r--src/signal/SIG_SETMASK.c5
-rw-r--r--src/signal/SIG_UNBLOCK.c5
-rw-r--r--src/signal/kill.c11
-rw-r--r--src/signal/sigaction.c12
-rw-r--r--src/signal/sigaddset.c11
-rw-r--r--src/signal/sigdelset.c11
-rw-r--r--src/signal/sigemptyset.c11
-rw-r--r--src/signal/sigfillset.c11
-rw-r--r--src/signal/sigismember.c11
-rw-r--r--src/signal/sigpending.c11
-rw-r--r--src/signal/sigprocmask.c11
-rw-r--r--src/signal/sigset_t.c6
-rw-r--r--src/signal/sigsuspend.c11
-rw-r--r--src/signal/struct_sigaction.c16
-rw-r--r--src/stdio/L_ctermid.c5
-rw-r--r--src/stdio/L_cuserid.c5
-rw-r--r--src/stdio/_stdio.c2
-rw-r--r--src/stdio/fdopen.c10
-rw-r--r--src/stdio/fileno.c12
-rw-r--r--src/sys/stat/S_IRGRP.c6
-rw-r--r--src/sys/stat/S_IROTH.c6
-rw-r--r--src/sys/stat/S_IRUSR.c6
-rw-r--r--src/sys/stat/S_IRWXG.c6
-rw-r--r--src/sys/stat/S_IRWXO.c6
-rw-r--r--src/sys/stat/S_IRWXU.c6
-rw-r--r--src/sys/stat/S_ISBLK.C5
-rw-r--r--src/sys/stat/S_ISCHR.c5
-rw-r--r--src/sys/stat/S_ISDIR.c5
-rw-r--r--src/sys/stat/S_ISFIFO.c5
-rw-r--r--src/sys/stat/S_ISGID.c5
-rw-r--r--src/sys/stat/S_ISREG.c5
-rw-r--r--src/sys/stat/S_ISUID.c5
-rw-r--r--src/sys/stat/S_IWGRP.c5
-rw-r--r--src/sys/stat/S_IWOTH.c5
-rw-r--r--src/sys/stat/S_IWUSR.c5
-rw-r--r--src/sys/stat/S_IXGRP.c5
-rw-r--r--src/sys/stat/S_IXOTH.c5
-rw-r--r--src/sys/stat/S_IXUSR.c5
-rw-r--r--src/sys/stat/chmod.c17
-rw-r--r--src/sys/stat/fstat.c11
-rw-r--r--src/sys/stat/mkdir.c13
-rw-r--r--src/sys/stat/mkfifo.c11
-rw-r--r--src/sys/stat/stat.c32
-rw-r--r--src/sys/stat/struct_stat.c23
-rw-r--r--src/sys/stat/umask.c11
-rw-r--r--src/sys/times/struct_tms.c12
-rw-r--r--src/sys/times/times.c11
-rw-r--r--src/sys/types/dev_t.c6
-rw-r--r--src/sys/types/gid_t.c6
-rw-r--r--src/sys/types/ino_t.c6
-rw-r--r--src/sys/types/mode_t.c6
-rw-r--r--src/sys/types/nlink_t.c6
-rw-r--r--src/sys/types/off_t.c6
-rw-r--r--src/sys/types/pid_t.c6
-rw-r--r--src/sys/types/ssize_t.c7
-rw-r--r--src/sys/types/uid_t.c6
-rw-r--r--src/sys/utsname/struct_utsname.c13
-rw-r--r--src/sys/utsname/uname.c25
-rw-r--r--src/sys/wait/WEXITSTATUS.c6
-rw-r--r--src/sys/wait/WIFEXITED.c6
-rw-r--r--src/sys/wait/WIFSIGNALED.c6
-rw-r--r--src/sys/wait/WIFSTOPPED.c6
-rw-r--r--src/sys/wait/WNOHANG.c6
-rw-r--r--src/sys/wait/WSTOPSIG.c6
-rw-r--r--src/sys/wait/WTERMSIG.c6
-rw-r--r--src/sys/wait/WUNTRACED.c6
-rw-r--r--src/sys/wait/wait.c10
-rw-r--r--src/sys/wait/waitpid.c11
-rw-r--r--src/tar/AREGTYPE.c7
-rw-r--r--src/tar/BLKTYPE.c7
-rw-r--r--src/tar/CHRTYPE.c7
-rw-r--r--src/tar/CONTTYPE.c7
-rw-r--r--src/tar/DIRTYPE.c7
-rw-r--r--src/tar/FIFOTYPE.c7
-rw-r--r--src/tar/LNKTYPE.c7
-rw-r--r--src/tar/REGTYPE.c7
-rw-r--r--src/tar/SYMTYPE.c7
-rw-r--r--src/tar/TGEXEC.c7
-rw-r--r--src/tar/TGREAD.c7
-rw-r--r--src/tar/TGWRITE.c7
-rw-r--r--src/tar/TMAGIC.c7
-rw-r--r--src/tar/TMAGLEN.c7
-rw-r--r--src/tar/TOEXEC.c7
-rw-r--r--src/tar/TOREAD.c7
-rw-r--r--src/tar/TOWRITE.c7
-rw-r--r--src/tar/TSGID.c7
-rw-r--r--src/tar/TSUID.c7
-rw-r--r--src/tar/TSVTX.c7
-rw-r--r--src/tar/TUEXEC.c7
-rw-r--r--src/tar/TUREAD.c7
-rw-r--r--src/tar/TUWRITE.c7
-rw-r--r--src/tar/TVERSION.c7
-rw-r--r--src/tar/TVERSLEN.c7
-rw-r--r--src/termios/B0.c5
-rw-r--r--src/termios/B110.c5
-rw-r--r--src/termios/B1200.c5
-rw-r--r--src/termios/B134.c5
-rw-r--r--src/termios/B150.c5
-rw-r--r--src/termios/B1800.c5
-rw-r--r--src/termios/B19200.c5
-rw-r--r--src/termios/B200.c5
-rw-r--r--src/termios/B2400.c5
-rw-r--r--src/termios/B300.c5
-rw-r--r--src/termios/B38400.c5
-rw-r--r--src/termios/B4800.c5
-rw-r--r--src/termios/B50.c5
-rw-r--r--src/termios/B600.c5
-rw-r--r--src/termios/B75.c5
-rw-r--r--src/termios/B9600.c5
-rw-r--r--src/termios/BRKINT.c5
-rw-r--r--src/termios/CLOCAL.c5
-rw-r--r--src/termios/CREAD.c5
-rw-r--r--src/termios/CS5.c5
-rw-r--r--src/termios/CS6.c5
-rw-r--r--src/termios/CS7.c5
-rw-r--r--src/termios/CS8.c5
-rw-r--r--src/termios/CSIZE.c5
-rw-r--r--src/termios/CSTOPB.c5
-rw-r--r--src/termios/ECHO.c5
-rw-r--r--src/termios/ECHOE.c5
-rw-r--r--src/termios/ECHOK.c5
-rw-r--r--src/termios/ECHONL.c5
-rw-r--r--src/termios/HUPCL.c5
-rw-r--r--src/termios/ICANON.c5
-rw-r--r--src/termios/ICRNL.c5
-rw-r--r--src/termios/IEXTEN.c5
-rw-r--r--src/termios/IGNBRK.c5
-rw-r--r--src/termios/IGNCR.c5
-rw-r--r--src/termios/IGNPAR.c5
-rw-r--r--src/termios/INLCR.c5
-rw-r--r--src/termios/INPCK.c5
-rw-r--r--src/termios/ISIG.c5
-rw-r--r--src/termios/ISTRIP.c5
-rw-r--r--src/termios/IXOFF.c5
-rw-r--r--src/termios/IXON.c5
-rw-r--r--src/termios/NCCS.c5
-rw-r--r--src/termios/NOFLSH.c5
-rw-r--r--src/termios/OPOST.c5
-rw-r--r--src/termios/PARENB.c5
-rw-r--r--src/termios/PARMRK.c5
-rw-r--r--src/termios/PARODD.c5
-rw-r--r--src/termios/TCIFLUSH.c5
-rw-r--r--src/termios/TCIOFF.c5
-rw-r--r--src/termios/TCIOFLUSH.c5
-rw-r--r--src/termios/TCION.c5
-rw-r--r--src/termios/TCOFLUSH.c5
-rw-r--r--src/termios/TCOOFF.c5
-rw-r--r--src/termios/TCOON.c5
-rw-r--r--src/termios/TCSADRAIN.c5
-rw-r--r--src/termios/TCSAFLUSH.c5
-rw-r--r--src/termios/TCSANOW.c5
-rw-r--r--src/termios/TOSTOP.c5
-rw-r--r--src/termios/VEOF.c5
-rw-r--r--src/termios/VEOL.c5
-rw-r--r--src/termios/VERASE.c5
-rw-r--r--src/termios/VINTR.c5
-rw-r--r--src/termios/VKILL.c5
-rw-r--r--src/termios/VMIN.c5
-rw-r--r--src/termios/VQUIT.c5
-rw-r--r--src/termios/VSTART.c5
-rw-r--r--src/termios/VSTOP.c5
-rw-r--r--src/termios/VSUSP.c5
-rw-r--r--src/termios/VTIME.c5
-rw-r--r--src/termios/cc_t.c5
-rw-r--r--src/termios/cfgetispeed.c11
-rw-r--r--src/termios/cfgetospeed.c11
-rw-r--r--src/termios/cfsetispeed.c37
-rw-r--r--src/termios/cfsetospeed.c36
-rw-r--r--src/termios/speed_t.c5
-rw-r--r--src/termios/struct_termios.c13
-rw-r--r--src/termios/tcdrain.c9
-rw-r--r--src/termios/tcflag_t.c5
-rw-r--r--src/termios/tcflow.c11
-rw-r--r--src/termios/tcflush.c10
-rw-r--r--src/termios/tcgetattr.c10
-rw-r--r--src/termios/tcsendbreak.c10
-rw-r--r--src/termios/tcsetattr.c10
-rw-r--r--src/time/CLK_TCK.c5
-rw-r--r--src/time/tzname.c5
-rw-r--r--src/time/tzset.c7
-rw-r--r--src/unistd/F_OK.c5
-rw-r--r--src/unistd/R_OK.c5
-rw-r--r--src/unistd/STDERR_FILENO.c5
-rw-r--r--src/unistd/STDIN_FILENO.c5
-rw-r--r--src/unistd/STDOUT_FILENO.c5
-rw-r--r--src/unistd/W_OK.c5
-rw-r--r--src/unistd/X_OK.c5
-rw-r--r--src/unistd/_PC_CHOWN_RESTRICTED.c5
-rw-r--r--src/unistd/_PC_LINK_MAX.c5
-rw-r--r--src/unistd/_PC_MAX_CANON.c5
-rw-r--r--src/unistd/_PC_MAX_INPUT.c5
-rw-r--r--src/unistd/_PC_NAME_MAX.c5
-rw-r--r--src/unistd/_PC_NO_TRUNC.c5
-rw-r--r--src/unistd/_PC_PATH_MAX.c5
-rw-r--r--src/unistd/_PC_PIPE_BUF.c5
-rw-r--r--src/unistd/_PC_VDISABLE.c5
-rw-r--r--src/unistd/_POSIX_CHOWN_RESTRICTED.c6
-rw-r--r--src/unistd/_POSIX_JOB_CONTROL.c5
-rw-r--r--src/unistd/_POSIX_NO_TRUNC.c6
-rw-r--r--src/unistd/_POSIX_SAVED_IDS.c5
-rw-r--r--src/unistd/_POSIX_VDISABLE.c6
-rw-r--r--src/unistd/_POSIX_VERSION.c17
-rw-r--r--src/unistd/_SC_ARG_MAX.c5
-rw-r--r--src/unistd/_SC_CHILD_MAX.c5
-rw-r--r--src/unistd/_SC_CLK_TCK.c5
-rw-r--r--src/unistd/_SC_JOB_CONTROL.c5
-rw-r--r--src/unistd/_SC_NGROUPS_MAX.c5
-rw-r--r--src/unistd/_SC_OPEN_MAX.c5
-rw-r--r--src/unistd/_SC_SAVED_IDS.c5
-rw-r--r--src/unistd/_SC_STREAM_MAX.c7
-rw-r--r--src/unistd/_SC_TZNAME_MAX.c7
-rw-r--r--src/unistd/_SC_VERSION.c5
-rw-r--r--src/unistd/_exit.c13
-rw-r--r--src/unistd/access.c43
-rw-r--r--src/unistd/alarm.c16
-rw-r--r--src/unistd/chdir.c12
-rw-r--r--src/unistd/chown.c12
-rw-r--r--src/unistd/close.c12
-rw-r--r--src/unistd/ctermid.c21
-rw-r--r--src/unistd/dup.c12
-rw-r--r--src/unistd/dup2.c29
-rw-r--r--src/unistd/execl.c24
-rw-r--r--src/unistd/execle.c26
-rw-r--r--src/unistd/execlp.c24
-rw-r--r--src/unistd/execv.c12
-rw-r--r--src/unistd/execve.c14
-rw-r--r--src/unistd/execvp.c20
-rw-r--r--src/unistd/fork.c13
-rw-r--r--src/unistd/fpathconf.c12
-rw-r--r--src/unistd/getcwd.c21
-rw-r--r--src/unistd/getegid.c12
-rw-r--r--src/unistd/geteuid.c12
-rw-r--r--src/unistd/getgid.c12
-rw-r--r--src/unistd/getgroups.c17
-rw-r--r--src/unistd/getlogin.c11
-rw-r--r--src/unistd/getpgrp.c12
-rw-r--r--src/unistd/getpid.c12
-rw-r--r--src/unistd/getppid.c12
-rw-r--r--src/unistd/getuid.c12
-rw-r--r--src/unistd/isatty.c19
-rw-r--r--src/unistd/link.c12
-rw-r--r--src/unistd/lseek.c12
-rw-r--r--src/unistd/pathconf.c12
-rw-r--r--src/unistd/pause.c13
-rw-r--r--src/unistd/pipe.c14
-rw-r--r--src/unistd/read.c13
-rw-r--r--src/unistd/rmdir.c13
-rw-r--r--src/unistd/setgid.c13
-rw-r--r--src/unistd/setpgid.c13
-rw-r--r--src/unistd/setsid.c12
-rw-r--r--src/unistd/setuid.c12
-rw-r--r--src/unistd/sleep.c16
-rw-r--r--src/unistd/sysconf.c11
-rw-r--r--src/unistd/tcgetpgrp.c13
-rw-r--r--src/unistd/tcsetpgrp.c13
-rw-r--r--src/unistd/ttyname.c12
-rw-r--r--src/unistd/unlink.c14
-rw-r--r--src/unistd/write.c16
-rw-r--r--src/utime/struct_utimbuf.c10
-rw-r--r--src/utime/utime.c11
402 files changed, 3320 insertions, 6 deletions
diff --git a/src/P90+AMD1/DEPS.mk b/src/P90+AMD1/DEPS.mk
deleted file mode 100644
index 9eff3368..00000000
--- a/src/P90+AMD1/DEPS.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-DEPS=POSIX.1-1990 9899-1990-AMD1
-CFLAGS=-D_POSIX_SOURCE
diff --git a/src/_POSIX_SOURCE.c b/src/_POSIX_SOURCE.c
new file mode 100644
index 00000000..b594f3d9
--- /dev/null
+++ b/src/_POSIX_SOURCE.c
@@ -0,0 +1,5 @@
+#define _POSIX_SOURCE /** feature test macro **/
+/*
+FTM(POSIX.1-1988)
+POSIX(1)
+*/
diff --git a/src/cpio/C_IRGRP.c b/src/cpio/C_IRGRP.c
new file mode 100644
index 00000000..bbf5f072
--- /dev/null
+++ b/src/cpio/C_IRGRP.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IRGRP 0000040
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IROTH.c b/src/cpio/C_IROTH.c
new file mode 100644
index 00000000..2dc30333
--- /dev/null
+++ b/src/cpio/C_IROTH.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IROTH 0000004
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IRUSR.c b/src/cpio/C_IRUSR.c
new file mode 100644
index 00000000..cefdb740
--- /dev/null
+++ b/src/cpio/C_IRUSR.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IRUSR 0000400
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISBLK.c b/src/cpio/C_ISBLK.c
new file mode 100644
index 00000000..124d13e0
--- /dev/null
+++ b/src/cpio/C_ISBLK.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISBLK 0060000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISCHR.c b/src/cpio/C_ISCHR.c
new file mode 100644
index 00000000..36d6b333
--- /dev/null
+++ b/src/cpio/C_ISCHR.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISCHR 0020000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISCTG.c b/src/cpio/C_ISCTG.c
new file mode 100644
index 00000000..6a78baab
--- /dev/null
+++ b/src/cpio/C_ISCTG.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISCTG 0110000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISDIR.c b/src/cpio/C_ISDIR.c
new file mode 100644
index 00000000..104971d5
--- /dev/null
+++ b/src/cpio/C_ISDIR.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISDIR 0040000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISFIFO.c b/src/cpio/C_ISFIFO.c
new file mode 100644
index 00000000..d8d56047
--- /dev/null
+++ b/src/cpio/C_ISFIFO.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISFIFO 0010000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISGID.c b/src/cpio/C_ISGID.c
new file mode 100644
index 00000000..a2397b98
--- /dev/null
+++ b/src/cpio/C_ISGID.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISGID 0002000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISLNK.c b/src/cpio/C_ISLNK.c
new file mode 100644
index 00000000..290e650e
--- /dev/null
+++ b/src/cpio/C_ISLNK.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISLNK 0120000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISREG.c b/src/cpio/C_ISREG.c
new file mode 100644
index 00000000..5d96f26c
--- /dev/null
+++ b/src/cpio/C_ISREG.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISREG 0100000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISSOCK.c b/src/cpio/C_ISSOCK.c
new file mode 100644
index 00000000..0cd93ab7
--- /dev/null
+++ b/src/cpio/C_ISSOCK.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISSOCK 0140000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISUID.c b/src/cpio/C_ISUID.c
new file mode 100644
index 00000000..702391d4
--- /dev/null
+++ b/src/cpio/C_ISUID.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISUID 0004000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_ISVTX.c b/src/cpio/C_ISVTX.c
new file mode 100644
index 00000000..6cb552bb
--- /dev/null
+++ b/src/cpio/C_ISVTX.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_ISVTX 0001000
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IWGRP.c b/src/cpio/C_IWGRP.c
new file mode 100644
index 00000000..1d46f706
--- /dev/null
+++ b/src/cpio/C_IWGRP.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IWGRP 0000020
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IWOTH.c b/src/cpio/C_IWOTH.c
new file mode 100644
index 00000000..d08377d5
--- /dev/null
+++ b/src/cpio/C_IWOTH.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IWOTH 0000002
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IWUSR.c b/src/cpio/C_IWUSR.c
new file mode 100644
index 00000000..8069cdf5
--- /dev/null
+++ b/src/cpio/C_IWUSR.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IWUSR 0000200
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IXGRP.c b/src/cpio/C_IXGRP.c
new file mode 100644
index 00000000..54105462
--- /dev/null
+++ b/src/cpio/C_IXGRP.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IXGRP 0000010
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IXOTH.c b/src/cpio/C_IXOTH.c
new file mode 100644
index 00000000..8f995201
--- /dev/null
+++ b/src/cpio/C_IXOTH.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IXOTH 0000001
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/C_IXUSR.c b/src/cpio/C_IXUSR.c
new file mode 100644
index 00000000..89af5151
--- /dev/null
+++ b/src/cpio/C_IXUSR.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define C_IXUSR 0000100
+/*
+POSIX(1)
+*/
diff --git a/src/cpio/MAGIC.c b/src/cpio/MAGIC.c
new file mode 100644
index 00000000..40ed0897
--- /dev/null
+++ b/src/cpio/MAGIC.c
@@ -0,0 +1,5 @@
+#include <cpio.h>
+#define MAGIC "070707"
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/DIR.c b/src/dirent/DIR.c
new file mode 100644
index 00000000..cc43a5d8
--- /dev/null
+++ b/src/dirent/DIR.c
@@ -0,0 +1,5 @@
+#include <dirent.h>
+typedef struct __DIR DIR;
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
new file mode 100644
index 00000000..daa72d50
--- /dev/null
+++ b/src/dirent/closedir.c
@@ -0,0 +1,20 @@
+#include <dirent.h>
+#include "nonstd/assert.h"
+#include "nonstd/types.h"
+#include "nonstd/syscall.h"
+
+int closedir(DIR *dirp)
+{
+ ASSERT_NONNULL(dirp);
+ SCNO(scno, "closedir", -1);
+
+ int r = __libc.syscall(scno, dirp);
+ if (r < 0) {
+ errno = -r;
+ return -1;
+ }
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c
new file mode 100644
index 00000000..3e1d1c87
--- /dev/null
+++ b/src/dirent/opendir.c
@@ -0,0 +1,12 @@
+#include <dirent.h>
+#include "stddef.h"
+
+DIR * opendir(const char * dirname)
+{
+ (void)dirname;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/readdir.c b/src/dirent/readdir.c
new file mode 100644
index 00000000..0e079f82
--- /dev/null
+++ b/src/dirent/readdir.c
@@ -0,0 +1,12 @@
+#include <dirent.h>
+#include "stddef.h"
+
+struct dirent * readdir(DIR * dirp)
+{
+ (void)dirp;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/rewinddir.c b/src/dirent/rewinddir.c
new file mode 100644
index 00000000..0b53d783
--- /dev/null
+++ b/src/dirent/rewinddir.c
@@ -0,0 +1,10 @@
+#include <dirent.h>
+
+void rewinddir(DIR * dirp)
+{
+ (void)dirp;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/dirent/struct_dirent.c b/src/dirent/struct_dirent.c
new file mode 100644
index 00000000..a6d4bb6c
--- /dev/null
+++ b/src/dirent/struct_dirent.c
@@ -0,0 +1,14 @@
+#include <dirent.h>
+
+struct dirent {
+ #if (defined _XOPEN_SOURCE)
+ ino_t d_ino;
+ #else
+ unsigned long long int __padding;
+ #endif
+ char d_name[];
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/environ.c b/src/environ.c
new file mode 100644
index 00000000..62ce6652
--- /dev/null
+++ b/src/environ.c
@@ -0,0 +1,4 @@
+char **environ;
+/*
+POSIX(1)
+*/
diff --git a/src/errno/E2BIG.c b/src/errno/E2BIG.c
new file mode 100644
index 00000000..0d66967f
--- /dev/null
+++ b/src/errno/E2BIG.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define E2BIG (10)
+
+/** Argument list too long **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EACCES.c b/src/errno/EACCES.c
new file mode 100644
index 00000000..f1030e9f
--- /dev/null
+++ b/src/errno/EACCES.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EACCES (11)
+
+/** Permission denied **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EAGAIN.c b/src/errno/EAGAIN.c
new file mode 100644
index 00000000..9aea1930
--- /dev/null
+++ b/src/errno/EAGAIN.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EAGAIN (12)
+
+/** Resource unavailable, try again **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EBADF.c b/src/errno/EBADF.c
new file mode 100644
index 00000000..a41c8bea
--- /dev/null
+++ b/src/errno/EBADF.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EBADF (13)
+
+/** Bad file descriptor **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EBUSY.c b/src/errno/EBUSY.c
new file mode 100644
index 00000000..5b8cfaa8
--- /dev/null
+++ b/src/errno/EBUSY.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EBUSY (14)
+
+/** Device or resource busy **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ECHILD.c b/src/errno/ECHILD.c
new file mode 100644
index 00000000..1394ae3b
--- /dev/null
+++ b/src/errno/ECHILD.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ECHILD (15)
+
+/** No child processes **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EDEADLK.c b/src/errno/EDEADLK.c
new file mode 100644
index 00000000..3cf4f59d
--- /dev/null
+++ b/src/errno/EDEADLK.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EDEADLK (16)
+
+/** Resource deadlock would occur **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EEXIST.c b/src/errno/EEXIST.c
new file mode 100644
index 00000000..a7322bf3
--- /dev/null
+++ b/src/errno/EEXIST.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EEXIST (17)
+
+/** File exists **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EFAULT.c b/src/errno/EFAULT.c
new file mode 100644
index 00000000..55268766
--- /dev/null
+++ b/src/errno/EFAULT.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EFAULT (18)
+
+/** Bad address **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EFBIG.c b/src/errno/EFBIG.c
new file mode 100644
index 00000000..5d852bfe
--- /dev/null
+++ b/src/errno/EFBIG.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EFBIG (19)
+
+/** File too large **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EINTR.c b/src/errno/EINTR.c
new file mode 100644
index 00000000..bfd966e1
--- /dev/null
+++ b/src/errno/EINTR.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EINTR (20)
+
+/** Interrupted function **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EINVAL.c b/src/errno/EINVAL.c
new file mode 100644
index 00000000..af518243
--- /dev/null
+++ b/src/errno/EINVAL.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EINVAL (21)
+
+/** Invalid argument **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EIO.c b/src/errno/EIO.c
new file mode 100644
index 00000000..b6fb981d
--- /dev/null
+++ b/src/errno/EIO.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EIO (22)
+
+/** I/O error **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EISDIR.c b/src/errno/EISDIR.c
new file mode 100644
index 00000000..fd1d9228
--- /dev/null
+++ b/src/errno/EISDIR.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EISDIR (23)
+
+/** Is a directory **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EMFILE.c b/src/errno/EMFILE.c
new file mode 100644
index 00000000..c9fb1b18
--- /dev/null
+++ b/src/errno/EMFILE.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EMFILE (24)
+
+/** File descriptor value too large **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EMLINK.c b/src/errno/EMLINK.c
new file mode 100644
index 00000000..eadac9f0
--- /dev/null
+++ b/src/errno/EMLINK.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EMLINK (25)
+
+/** Too many links **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENAMETOOLONG.c b/src/errno/ENAMETOOLONG.c
new file mode 100644
index 00000000..8632e0a0
--- /dev/null
+++ b/src/errno/ENAMETOOLONG.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENAMETOOLONG (26)
+
+/** Filename too long **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENFILE.c b/src/errno/ENFILE.c
new file mode 100644
index 00000000..58e8aeb8
--- /dev/null
+++ b/src/errno/ENFILE.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENFILE (27)
+
+/** Too many files open in system **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENODEV.c b/src/errno/ENODEV.c
new file mode 100644
index 00000000..73a61194
--- /dev/null
+++ b/src/errno/ENODEV.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENODEV (28)
+
+/** No such device **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOENT.c b/src/errno/ENOENT.c
new file mode 100644
index 00000000..13ca00b5
--- /dev/null
+++ b/src/errno/ENOENT.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOENT (29)
+
+/** No such file or directory **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOEXEC.c b/src/errno/ENOEXEC.c
new file mode 100644
index 00000000..38bab541
--- /dev/null
+++ b/src/errno/ENOEXEC.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOEXEC (30)
+
+/** Executable file format error **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOLCK.c b/src/errno/ENOLCK.c
new file mode 100644
index 00000000..8a1f34fe
--- /dev/null
+++ b/src/errno/ENOLCK.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOLCK (31)
+
+/** No locks available **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOMEM.c b/src/errno/ENOMEM.c
new file mode 100644
index 00000000..af1d283b
--- /dev/null
+++ b/src/errno/ENOMEM.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOMEM (32)
+
+/** Not enough space **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOSPC.c b/src/errno/ENOSPC.c
new file mode 100644
index 00000000..6e548bf8
--- /dev/null
+++ b/src/errno/ENOSPC.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOSPC (33)
+
+/** No space left on device **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOSYS.c b/src/errno/ENOSYS.c
new file mode 100644
index 00000000..af179b52
--- /dev/null
+++ b/src/errno/ENOSYS.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOSYS (34)
+
+/** Function not supported **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOTDIR.c b/src/errno/ENOTDIR.c
new file mode 100644
index 00000000..6efd7d28
--- /dev/null
+++ b/src/errno/ENOTDIR.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOTDIR (35)
+
+/** Not a directory or a symbolic link to a directory **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOTEMPTY.c b/src/errno/ENOTEMPTY.c
new file mode 100644
index 00000000..70fb1788
--- /dev/null
+++ b/src/errno/ENOTEMPTY.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOTEMPTY (36)
+
+/** Directory not empty **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENOTTY.c b/src/errno/ENOTTY.c
new file mode 100644
index 00000000..82742bef
--- /dev/null
+++ b/src/errno/ENOTTY.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENOTTY (37)
+
+/** Inappropriate I/O control operation **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ENXIO.c b/src/errno/ENXIO.c
new file mode 100644
index 00000000..fdc015aa
--- /dev/null
+++ b/src/errno/ENXIO.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ENXIO (38)
+
+/** No such device or address **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EPERM.c b/src/errno/EPERM.c
new file mode 100644
index 00000000..eee5363b
--- /dev/null
+++ b/src/errno/EPERM.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EPERM (39)
+
+/** Operation not permitted **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EPIPE.c b/src/errno/EPIPE.c
new file mode 100644
index 00000000..d2aa9534
--- /dev/null
+++ b/src/errno/EPIPE.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EPIPE (40)
+
+/** Broken pipe **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EROFS.c b/src/errno/EROFS.c
new file mode 100644
index 00000000..e232bfed
--- /dev/null
+++ b/src/errno/EROFS.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EROFS (41)
+
+/** Read-only file system **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ESPIPE.c b/src/errno/ESPIPE.c
new file mode 100644
index 00000000..b401cc66
--- /dev/null
+++ b/src/errno/ESPIPE.c
@@ -0,0 +1,8 @@
+#inlcude <errno.h>
+
+#define ESPIPE (42)
+
+/** Invalid seek **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/ESRCH.c b/src/errno/ESRCH.c
new file mode 100644
index 00000000..b70fe70c
--- /dev/null
+++ b/src/errno/ESRCH.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define ESRCH (43)
+
+/** No such process **/
+/*
+POSIX(1)
+*/
diff --git a/src/errno/EXDEV.c b/src/errno/EXDEV.c
new file mode 100644
index 00000000..afec7785
--- /dev/null
+++ b/src/errno/EXDEV.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+#define EXDEV (44)
+
+/** Cross-device link **/
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/FD_CLOEXEC.c b/src/fcntl/FD_CLOEXEC.c
new file mode 100644
index 00000000..f406ed34
--- /dev/null
+++ b/src/fcntl/FD_CLOEXEC.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define FD_CLOEXEC (1)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_DUPFD.c b/src/fcntl/F_DUPFD.c
new file mode 100644
index 00000000..e0428596
--- /dev/null
+++ b/src/fcntl/F_DUPFD.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_DUPFD (1)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_GETFD.c b/src/fcntl/F_GETFD.c
new file mode 100644
index 00000000..6d99ea3c
--- /dev/null
+++ b/src/fcntl/F_GETFD.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_GETFD (3)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_GETFL.c b/src/fcntl/F_GETFL.c
new file mode 100644
index 00000000..f9432301
--- /dev/null
+++ b/src/fcntl/F_GETFL.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_GETFL (5)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_GETLK.c b/src/fcntl/F_GETLK.c
new file mode 100644
index 00000000..8236e213
--- /dev/null
+++ b/src/fcntl/F_GETLK.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_GETLK (7)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_RDLCK.c b/src/fcntl/F_RDLCK.c
new file mode 100644
index 00000000..53fce2a3
--- /dev/null
+++ b/src/fcntl/F_RDLCK.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_RDLCK (1)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_SETFD.c b/src/fcntl/F_SETFD.c
new file mode 100644
index 00000000..aa0f6070
--- /dev/null
+++ b/src/fcntl/F_SETFD.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_SETFD (4)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_SETFL.c b/src/fcntl/F_SETFL.c
new file mode 100644
index 00000000..0a40145c
--- /dev/null
+++ b/src/fcntl/F_SETFL.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_SETFL (6)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_SETLK.c b/src/fcntl/F_SETLK.c
new file mode 100644
index 00000000..ccc09f4e
--- /dev/null
+++ b/src/fcntl/F_SETLK.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_SETLK (8)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_SETLKW.c b/src/fcntl/F_SETLKW.c
new file mode 100644
index 00000000..045e5991
--- /dev/null
+++ b/src/fcntl/F_SETLKW.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_SETLKW (9)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_UNLCK.c b/src/fcntl/F_UNLCK.c
new file mode 100644
index 00000000..42c4c416
--- /dev/null
+++ b/src/fcntl/F_UNLCK.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_UNLCK (2)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/F_WRLCK.c b/src/fcntl/F_WRLCK.c
new file mode 100644
index 00000000..8eaa8711
--- /dev/null
+++ b/src/fcntl/F_WRLCK.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define F_WRLCK (3)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_ACCMODE.c b/src/fcntl/O_ACCMODE.c
new file mode 100644
index 00000000..82045649
--- /dev/null
+++ b/src/fcntl/O_ACCMODE.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_ACCMODE (O_EXEC|O_RDONLY|O_RDWR|O_SEARCH|O_WRONLY)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_APPEND.c b/src/fcntl/O_APPEND.c
new file mode 100644
index 00000000..d6526545
--- /dev/null
+++ b/src/fcntl/O_APPEND.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_APPEND (1<<8)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_CREAT.c b/src/fcntl/O_CREAT.c
new file mode 100644
index 00000000..03d04b91
--- /dev/null
+++ b/src/fcntl/O_CREAT.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_CREAT (1<<1)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_EXCL.c b/src/fcntl/O_EXCL.c
new file mode 100644
index 00000000..144eebbb
--- /dev/null
+++ b/src/fcntl/O_EXCL.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_EXCL (1<<3)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_NOCTTY.c b/src/fcntl/O_NOCTTY.c
new file mode 100644
index 00000000..c7805910
--- /dev/null
+++ b/src/fcntl/O_NOCTTY.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_NOCTTY (1<<4)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_NONBLOCK.c b/src/fcntl/O_NONBLOCK.c
new file mode 100644
index 00000000..7ccda6ad
--- /dev/null
+++ b/src/fcntl/O_NONBLOCK.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_NONBLOCK (1<<10)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_RDONLY.c b/src/fcntl/O_RDONLY.c
new file mode 100644
index 00000000..00425d4e
--- /dev/null
+++ b/src/fcntl/O_RDONLY.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_RDONLY (1<<14)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_RDWR.c b/src/fcntl/O_RDWR.c
new file mode 100644
index 00000000..f1ce88b2
--- /dev/null
+++ b/src/fcntl/O_RDWR.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_RDWR (1<<15)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_TRUNC.c b/src/fcntl/O_TRUNC.c
new file mode 100644
index 00000000..d835021a
--- /dev/null
+++ b/src/fcntl/O_TRUNC.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_TRUNC (1<<6)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/O_WRONLY.c b/src/fcntl/O_WRONLY.c
new file mode 100644
index 00000000..e6c00841
--- /dev/null
+++ b/src/fcntl/O_WRONLY.c
@@ -0,0 +1,7 @@
+#include <fcntl.h>
+
+#define O_WRONLY (1<<17)
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/creat.c b/src/fcntl/creat.c
new file mode 100644
index 00000000..eab98ca8
--- /dev/null
+++ b/src/fcntl/creat.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <fcntl.h>
+
+int creat(const char *path, mode_t mode)
+{
+ return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/fcntl.c b/src/fcntl/fcntl.c
new file mode 100644
index 00000000..18288776
--- /dev/null
+++ b/src/fcntl/fcntl.c
@@ -0,0 +1,61 @@
+#include "sys/types.h"
+#include <fcntl.h>
+#include "errno.h"
+#include "stdarg.h"
+#include "nonstd/types.h"
+#include "nonstd/syscall.h"
+
+int fcntl(int fildes, int cmd, ...)
+{
+ SCNO(scno, "fcntl", -1);
+
+ int r = -ENOSYS;
+ enum { NONE, INT, FLOCK } arg = NONE;
+
+ switch (cmd) {
+ case F_GETFD:
+ case F_GETFL:
+ break;
+
+ case F_DUPFD:
+ case F_SETFD:
+ case F_SETFL:
+ arg = INT;
+ break;
+
+ case F_GETLK:
+ case F_SETLK:
+ case F_SETLKW:
+ arg = FLOCK;
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (arg == NONE) {
+ r = __libc.syscall(scno, fildes);
+ } else {
+ va_list ap;
+ va_start(ap, cmd);
+ if (arg == INT) {
+ int n = va_arg(ap, int);
+ r = __libc.syscall(scno, fildes, n);
+ } else if (arg == FLOCK) {
+ struct flock *fl = va_arg(ap, struct flock *);
+ r = __libc.syscall(scno, fildes, fl);
+ }
+ va_end(ap);
+ }
+
+ if (r < 0) {
+ errno = -r;
+ return -1;
+ }
+
+ return r;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/open.c b/src/fcntl/open.c
new file mode 100644
index 00000000..f0968556
--- /dev/null
+++ b/src/fcntl/open.c
@@ -0,0 +1,30 @@
+#include "sys/types.h"
+#include <fcntl.h>
+#include "sys/stat.h" /* OH */
+#include "errno.h"
+#include "stdarg.h"
+#include "nonstd/syscall.h"
+
+int open(const char *path, int oflag, ...)
+{
+ SCNO(scno, "open", -1);
+
+ mode_t mode = 0;
+ if (oflag & O_CREAT) {
+ va_list ap;
+ va_start(ap, oflag);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ }
+
+ int r = __libc.syscall(scno, path, oflag, mode);
+ if (r < 0) {
+ errno = -r;
+ return -1;
+ }
+
+ return r;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/fcntl/struct_flock.c b/src/fcntl/struct_flock.c
new file mode 100644
index 00000000..c910e0ff
--- /dev/null
+++ b/src/fcntl/struct_flock.c
@@ -0,0 +1,13 @@
+#include <fcntl.h>
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/grp/getgrgid.c b/src/grp/getgrgid.c
new file mode 100644
index 00000000..0d39ffc2
--- /dev/null
+++ b/src/grp/getgrgid.c
@@ -0,0 +1,13 @@
+#include "sys/types.h"
+#include <grp.h>
+#include "stddef.h"
+
+struct group * getgrgid(gid_t gid)
+{
+ (void)gid;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/grp/getgrnam.c b/src/grp/getgrnam.c
new file mode 100644
index 00000000..c3598866
--- /dev/null
+++ b/src/grp/getgrnam.c
@@ -0,0 +1,13 @@
+#include "sys/types.h"
+#include <grp.h>
+#include "stddef.h"
+
+struct group * getgrnam(const char * name)
+{
+ (void)name;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/grp/struct_group.c b/src/grp/struct_group.c
new file mode 100644
index 00000000..16097b22
--- /dev/null
+++ b/src/grp/struct_group.c
@@ -0,0 +1,11 @@
+#include <grp.h>
+
+struct group {
+ char * gr_name;
+ gid_t gr_gid;
+ char ** gr_mem;
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/limits/ARG_MAX.c b/src/limits/ARG_MAX.c
new file mode 100644
index 00000000..57f793a5
--- /dev/null
+++ b/src/limits/ARG_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef ARG_MAX */
+/* MIN: _POSIX_ARG_MAX */
+/* MAY-BE-UNDEFINED */
+/** maximum length of arguments to the exec family of functions **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/CHILD_MAX.c b/src/limits/CHILD_MAX.c
new file mode 100644
index 00000000..f3d4d3a2
--- /dev/null
+++ b/src/limits/CHILD_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef CHILD_MAX */
+/* MIN: _POSIX_CHILD_MAX */
+/* MAY-BE-UNEFINED */
+/** maximum number of processes per real user ID **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/LINK_MAX.c b/src/limits/LINK_MAX.c
new file mode 100644
index 00000000..08567888
--- /dev/null
+++ b/src/limits/LINK_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef LINK_MAX */
+/* MIN: _POSIX_LINK_MAX */
+/* CHECK: pathconf */
+/** maximum number of links to a single file **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/MAX_CANON.c b/src/limits/MAX_CANON.c
new file mode 100644
index 00000000..16563e98
--- /dev/null
+++ b/src/limits/MAX_CANON.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef MAX_CANON */
+/* MIN: _POSIX_MAX_CANON */
+/* CHECK: pathconf */
+/** maximum number of bytes in a terminal canonical input queue **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/MAX_INPUT.c b/src/limits/MAX_INPUT.c
new file mode 100644
index 00000000..90cd985f
--- /dev/null
+++ b/src/limits/MAX_INPUT.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef MAX_INPUT */
+/* MIN: _POSIX_MAX_INPUT */
+/* CHECK: pathconf */
+/** maximum number of bytes in a terminal input queue **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/NAME_MAX.c b/src/limits/NAME_MAX.c
new file mode 100644
index 00000000..7ef5721f
--- /dev/null
+++ b/src/limits/NAME_MAX.c
@@ -0,0 +1,9 @@
+#include <limits.h>
+/* #undef NAME_MAX */
+/* MIN: _POSIX_NAME_MAX */
+/* POSIX + XOPEN: MIN: _XOPEN_NAME_MAX */
+/* CHECK: pathconf */
+/** the maximum number of bytes (not counting chr(0)) in a filename **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/NGROUPS_MAX.c b/src/limits/NGROUPS_MAX.c
new file mode 100644
index 00000000..aac46c03
--- /dev/null
+++ b/src/limits/NGROUPS_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+#define NGROUPS_MAX _POSIX_NGROUPS_MAX
+/* MIN: _POSIX_NGROUPS_MAX */
+/* CHECK: sysconf */
+/** the maximum number of group IDs per process **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/OPEN_MAX.c b/src/limits/OPEN_MAX.c
new file mode 100644
index 00000000..03acebbb
--- /dev/null
+++ b/src/limits/OPEN_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef OPEN_MAX */
+/* MIN: _POSIX_OPEN_MAX */
+/* MAY-BE-UNEFINED */
+/** the maximum number of open file descriptors **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/PATH_MAX.c b/src/limits/PATH_MAX.c
new file mode 100644
index 00000000..9a7b05ca
--- /dev/null
+++ b/src/limits/PATH_MAX.c
@@ -0,0 +1,9 @@
+#include <limits.h>
+/* #undef PATH_MAX */
+/* MIN: _POSIX_PATH_MAX */
+/* POSIX + XOPEN: MIN: _XOPEN_PATH_MAX */
+/* CHECK: pathconf */
+/** the maximum number of bytes in a full path name **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/PIPE_BUF.c b/src/limits/PIPE_BUF.c
new file mode 100644
index 00000000..0924a70f
--- /dev/null
+++ b/src/limits/PIPE_BUF.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+/* #undef PIPE_BUF */
+/* MIN: _POSIX_PIPE_BUF */
+/* CHECK: pathconf */
+/** maximum number of bytes guranteed to be atomic writing to a pipe **/
+/*
+POSIX(1)
+*/
diff --git a/src/limits/SSIZE_MAX.c b/src/limits/SSIZE_MAX.c
new file mode 100644
index 00000000..b9f1d798
--- /dev/null
+++ b/src/limits/SSIZE_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+
+#define SSIZE_MAX (2147483647)
+
+/* MIN: _POSIX_SSIZE_MAX */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/STREAM_MAX.c b/src/limits/STREAM_MAX.c
new file mode 100644
index 00000000..bcd85c91
--- /dev/null
+++ b/src/limits/STREAM_MAX.c
@@ -0,0 +1,9 @@
+#include <limits.h>
+
+/* #undef STREAM_MAX */
+
+/* MIN: _POSIX_STREAM_MAX */
+/* MAY-BE-UNEFINED */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/TZNAME_MAX.c b/src/limits/TZNAME_MAX.c
new file mode 100644
index 00000000..20d33691
--- /dev/null
+++ b/src/limits/TZNAME_MAX.c
@@ -0,0 +1,9 @@
+#include <limits.h>
+
+/* #undef TZNAME_MAX */
+
+/* MIN: _POSIX_TZNAME_MAX */
+/* MAY-BE-UNEFINED */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_ARG_MAX.c b/src/limits/_POSIX_ARG_MAX.c
new file mode 100644
index 00000000..a5047ebc
--- /dev/null
+++ b/src/limits/_POSIX_ARG_MAX.c
@@ -0,0 +1,6 @@
+#include <limits.h>
+#define _POSIX_ARG_MAX (4096)
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_CHILD_MAX.c b/src/limits/_POSIX_CHILD_MAX.c
new file mode 100644
index 00000000..849079dd
--- /dev/null
+++ b/src/limits/_POSIX_CHILD_MAX.c
@@ -0,0 +1,7 @@
+#include <limits.h>
+#define _POSIX_CHILD_MAX (6)
+/* goes to 26 in later versions */
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_LINK_MAX.c b/src/limits/_POSIX_LINK_MAX.c
new file mode 100644
index 00000000..50a63d13
--- /dev/null
+++ b/src/limits/_POSIX_LINK_MAX.c
@@ -0,0 +1,6 @@
+#include <limits.h>
+#define _POSIX_LINK_MAX (8)
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_MAX_CANON.c b/src/limits/_POSIX_MAX_CANON.c
new file mode 100644
index 00000000..9068a160
--- /dev/null
+++ b/src/limits/_POSIX_MAX_CANON.c
@@ -0,0 +1,6 @@
+#include <limits.h>
+#define _POSIX_MAX_CANON (255)
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_MAX_INPUT.c b/src/limits/_POSIX_MAX_INPUT.c
new file mode 100644
index 00000000..346e225c
--- /dev/null
+++ b/src/limits/_POSIX_MAX_INPUT.c
@@ -0,0 +1,6 @@
+#include <limits.h>
+#define _POSIX_MAX_INPUT (255)
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_NAME_MAX.c b/src/limits/_POSIX_NAME_MAX.c
new file mode 100644
index 00000000..b6438730
--- /dev/null
+++ b/src/limits/_POSIX_NAME_MAX.c
@@ -0,0 +1,6 @@
+#include <limits.h>
+#define _POSIX_NAME_MAX (14)
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_NGROUPS_MAX.c b/src/limits/_POSIX_NGROUPS_MAX.c
new file mode 100644
index 00000000..24a8c8fa
--- /dev/null
+++ b/src/limits/_POSIX_NGROUPS_MAX.c
@@ -0,0 +1,7 @@
+#include <limits.h>
+#define _POSIX_NGROUPS_MAX (0)
+/* goes to 8 in later version */
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_OPEN_MAX.c b/src/limits/_POSIX_OPEN_MAX.c
new file mode 100644
index 00000000..3ee24630
--- /dev/null
+++ b/src/limits/_POSIX_OPEN_MAX.c
@@ -0,0 +1,7 @@
+#include <limits.h>
+#define _POSIX_OPEN_MAX (16)
+/* goes to 20 in later version */
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_PATH_MAX.c b/src/limits/_POSIX_PATH_MAX.c
new file mode 100644
index 00000000..b8b6f0f6
--- /dev/null
+++ b/src/limits/_POSIX_PATH_MAX.c
@@ -0,0 +1,7 @@
+#include <limits.h>
+#define _POSIX_PATH_MAX (256)
+/* goes to 256 later */
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_PIPE_BUF.c b/src/limits/_POSIX_PIPE_BUF.c
new file mode 100644
index 00000000..8926fa60
--- /dev/null
+++ b/src/limits/_POSIX_PIPE_BUF.c
@@ -0,0 +1,6 @@
+#include <limits.h>
+#define _POSIX_PIPE_BUF (512)
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_SSIZE_MAX.c b/src/limits/_POSIX_SSIZE_MAX.c
new file mode 100644
index 00000000..d2306563
--- /dev/null
+++ b/src/limits/_POSIX_SSIZE_MAX.c
@@ -0,0 +1,8 @@
+#include <limits.h>
+
+#define _POSIX_SSIZE_MAX (32767)
+
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_STREAM_MAX.c b/src/limits/_POSIX_STREAM_MAX.c
new file mode 100644
index 00000000..c04afda1
--- /dev/null
+++ b/src/limits/_POSIX_STREAM_MAX.c
@@ -0,0 +1,7 @@
+#include <limits.h>
+#define _POSIX_STREAM_MAX (8)
+
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/limits/_POSIX_TZNAME_MAX.c b/src/limits/_POSIX_TZNAME_MAX.c
new file mode 100644
index 00000000..5db16d53
--- /dev/null
+++ b/src/limits/_POSIX_TZNAME_MAX.c
@@ -0,0 +1,9 @@
+#include <limits.h>
+
+#define _POSIX_TZNAME_MAX (3)
+
+/* goes to 6 later */
+/* DEF */
+/*
+POSIX(1)
+*/
diff --git a/src/nonstd/intmax_t.ref b/src/nonstd/intmax_t.ref
deleted file mode 100644
index b96b2d3b..00000000
--- a/src/nonstd/intmax_t.ref
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <nonstd/types.h>
-REFERENCE(stdint/intmax_t.c)
diff --git a/src/pwd/getpwnam.c b/src/pwd/getpwnam.c
new file mode 100644
index 00000000..5a255caf
--- /dev/null
+++ b/src/pwd/getpwnam.c
@@ -0,0 +1,13 @@
+#include "sys/types.h"
+#include <pwd.h>
+#include "stddef.h"
+
+struct passwd * getpwnam(const char * name)
+{
+ (void)name;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/pwd/getpwuid.c b/src/pwd/getpwuid.c
new file mode 100644
index 00000000..dd1236ff
--- /dev/null
+++ b/src/pwd/getpwuid.c
@@ -0,0 +1,13 @@
+#include "sys/types.h"
+#include <pwd.h>
+#include "stddef.h"
+
+struct passwd * getpwuid(uid_t uid)
+{
+ (void)uid;
+ return NULL;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/pwd/struct_passwd.c b/src/pwd/struct_passwd.c
new file mode 100644
index 00000000..d77dd7b7
--- /dev/null
+++ b/src/pwd/struct_passwd.c
@@ -0,0 +1,13 @@
+#include <pwd.h>
+
+struct passwd {
+ char * pw_name;
+ uid_t pw_uid;
+ gid_t pw_gid;
+ char * pw_dir;
+ char * pw_shell;
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/setjmp/sigjmp_buf.c b/src/setjmp/sigjmp_buf.c
new file mode 100644
index 00000000..09829e88
--- /dev/null
+++ b/src/setjmp/sigjmp_buf.c
@@ -0,0 +1,7 @@
+#include <setjmp.h>
+
+typedef jmp_buf sigjmp_buf;
+
+/*
+POSIX(1)
+*/
diff --git a/src/setjmp/siglongjmp.c b/src/setjmp/siglongjmp.c
new file mode 100644
index 00000000..44b6d6ed
--- /dev/null
+++ b/src/setjmp/siglongjmp.c
@@ -0,0 +1,10 @@
+#include <setjmp.h>
+
+void siglongjmp(sigjmp_buf env, int val)
+{
+ (void)env; (void)val;
+ /* TODO */
+}
+/*
+POSIX(1)
+*/
diff --git a/src/setjmp/sigsetjmp.c b/src/setjmp/sigsetjmp.c
new file mode 100644
index 00000000..37c9727f
--- /dev/null
+++ b/src/setjmp/sigsetjmp.c
@@ -0,0 +1,10 @@
+#include <setjmp.h>
+
+int sigsetjmp(sigjmp_buf env, int savemask)
+{
+ (void)env; (void)savemask;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SA_NOCLDSTOP.c b/src/signal/SA_NOCLDSTOP.c
new file mode 100644
index 00000000..37ec8281
--- /dev/null
+++ b/src/signal/SA_NOCLDSTOP.c
@@ -0,0 +1,6 @@
+#include <signal.h>
+
+#define SA_NOCLDSTOP (1<<0)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGALRM.c b/src/signal/SIGALRM.c
new file mode 100644
index 00000000..10f61118
--- /dev/null
+++ b/src/signal/SIGALRM.c
@@ -0,0 +1,6 @@
+#include <signal.h>
+#define SIGALRM (11)
+/*s Alarm s*/
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGCHLD.c b/src/signal/SIGCHLD.c
new file mode 100644
index 00000000..b1322485
--- /dev/null
+++ b/src/signal/SIGCHLD.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGCHLD (13)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGCONT.c b/src/signal/SIGCONT.c
new file mode 100644
index 00000000..3b2ea99e
--- /dev/null
+++ b/src/signal/SIGCONT.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGCONT (14)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGHUP.c b/src/signal/SIGHUP.c
new file mode 100644
index 00000000..8433a252
--- /dev/null
+++ b/src/signal/SIGHUP.c
@@ -0,0 +1,6 @@
+#include <signal.h>
+#define SIGHUP (15)
+/*s Hang-up s*/
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGKILL.c b/src/signal/SIGKILL.c
new file mode 100644
index 00000000..65f58cce
--- /dev/null
+++ b/src/signal/SIGKILL.c
@@ -0,0 +1,6 @@
+#include <signal.h>
+#define SIGKILL (9)
+/*s Kill s*/
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGPIPE.c b/src/signal/SIGPIPE.c
new file mode 100644
index 00000000..a8388af5
--- /dev/null
+++ b/src/signal/SIGPIPE.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGPIPE (16)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGQUIT.c b/src/signal/SIGQUIT.c
new file mode 100644
index 00000000..829cf4c6
--- /dev/null
+++ b/src/signal/SIGQUIT.c
@@ -0,0 +1,6 @@
+#include <signal.h>
+#define SIGQUIT (17)
+/*s Quit s*/
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGSTOP.c b/src/signal/SIGSTOP.c
new file mode 100644
index 00000000..2f16eb25
--- /dev/null
+++ b/src/signal/SIGSTOP.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGSTOP (31)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGTSTP.c b/src/signal/SIGTSTP.c
new file mode 100644
index 00000000..9ede35ea
--- /dev/null
+++ b/src/signal/SIGTSTP.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGTSTP (18)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGTTIN.c b/src/signal/SIGTTIN.c
new file mode 100644
index 00000000..8ca0db4a
--- /dev/null
+++ b/src/signal/SIGTTIN.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGTTIN (19)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGTTOU.c b/src/signal/SIGTTOU.c
new file mode 100644
index 00000000..6eeb8570
--- /dev/null
+++ b/src/signal/SIGTTOU.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGTTOU (20)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGUSR1.c b/src/signal/SIGUSR1.c
new file mode 100644
index 00000000..c4a29756
--- /dev/null
+++ b/src/signal/SIGUSR1.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGUSR1 (21)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIGUSR2.c b/src/signal/SIGUSR2.c
new file mode 100644
index 00000000..8c580dc8
--- /dev/null
+++ b/src/signal/SIGUSR2.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIGUSR2 (22)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIG_BLOCK.c b/src/signal/SIG_BLOCK.c
new file mode 100644
index 00000000..5eddc698
--- /dev/null
+++ b/src/signal/SIG_BLOCK.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIG_BLOCK (1)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIG_SETMASK.c b/src/signal/SIG_SETMASK.c
new file mode 100644
index 00000000..3c070d6b
--- /dev/null
+++ b/src/signal/SIG_SETMASK.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIG_SETMASK (3)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/SIG_UNBLOCK.c b/src/signal/SIG_UNBLOCK.c
new file mode 100644
index 00000000..fc65ed57
--- /dev/null
+++ b/src/signal/SIG_UNBLOCK.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+#define SIG_UNBLOCK (2)
+/*
+POSIX(1)
+*/
diff --git a/src/signal/kill.c b/src/signal/kill.c
new file mode 100644
index 00000000..78c3d3ef
--- /dev/null
+++ b/src/signal/kill.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+#include "nonstd/syscall.h"
+
+int kill(pid_t pid, int sig)
+{
+ SC(int, pid, sig);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c
new file mode 100644
index 00000000..addde011
--- /dev/null
+++ b/src/signal/sigaction.c
@@ -0,0 +1,12 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigaction(int sig, const struct sigaction * restrict act, struct sigaction * restrict oact)
+{
+ (void)sig; (void)act; (void)oact;
+ return 0;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigaddset.c b/src/signal/sigaddset.c
new file mode 100644
index 00000000..81b408f3
--- /dev/null
+++ b/src/signal/sigaddset.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigaddset(sigset_t * set, int signo)
+{
+ (void)set; (void)signo;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigdelset.c b/src/signal/sigdelset.c
new file mode 100644
index 00000000..ca20cc43
--- /dev/null
+++ b/src/signal/sigdelset.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigdelset(sigset_t * set, int signo)
+{
+ (void)set; (void)signo;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigemptyset.c b/src/signal/sigemptyset.c
new file mode 100644
index 00000000..2f579579
--- /dev/null
+++ b/src/signal/sigemptyset.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigemptyset(sigset_t * set)
+{
+ (void)set;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigfillset.c b/src/signal/sigfillset.c
new file mode 100644
index 00000000..4530e42a
--- /dev/null
+++ b/src/signal/sigfillset.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigfillset(sigset_t * set)
+{
+ (void)set;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigismember.c b/src/signal/sigismember.c
new file mode 100644
index 00000000..5e21cb5c
--- /dev/null
+++ b/src/signal/sigismember.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigismember(const sigset_t * set, int signo)
+{
+ (void)set; (void)signo;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigpending.c b/src/signal/sigpending.c
new file mode 100644
index 00000000..b459a114
--- /dev/null
+++ b/src/signal/sigpending.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigpending(sigset_t * set)
+{
+ (void)set;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigprocmask.c b/src/signal/sigprocmask.c
new file mode 100644
index 00000000..73017da5
--- /dev/null
+++ b/src/signal/sigprocmask.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigprocmask(int how, const sigset_t * restrict set, sigset_t * restrict oset)
+{
+ (void)how; (void)set; (void)oset;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigset_t.c b/src/signal/sigset_t.c
new file mode 100644
index 00000000..864f3365
--- /dev/null
+++ b/src/signal/sigset_t.c
@@ -0,0 +1,6 @@
+#include <signal.h>
+
+typedef unsigned int sigset_t;
+/*
+POSIX(1)
+*/
diff --git a/src/signal/sigsuspend.c b/src/signal/sigsuspend.c
new file mode 100644
index 00000000..0325cc6a
--- /dev/null
+++ b/src/signal/sigsuspend.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <signal.h>
+
+int sigsuspend(const sigset_t * sigmask)
+{
+ (void)sigmask;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/signal/struct_sigaction.c b/src/signal/struct_sigaction.c
new file mode 100644
index 00000000..f9b9656b
--- /dev/null
+++ b/src/signal/struct_sigaction.c
@@ -0,0 +1,16 @@
+#include <signal.h>
+
+struct sigaction {
+ void (*sa_handler)(int);
+ sigset_t sa_mask;
+ int sa_flags;
+ #if (_POSIX_C_SOURCE >= 199506L) || (defined _XOPEN_SOURCE && defined _XOPEN_SOURCE_EXTENDED && _XOPEN_SOURCE_EXTENDED == 1)
+ void (*sa_sigaction)(int, siginfo_t *, void *);
+ #else
+ void (*__padding)(int, void *, void *);
+ #endif
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/stdio/L_ctermid.c b/src/stdio/L_ctermid.c
new file mode 100644
index 00000000..f280b586
--- /dev/null
+++ b/src/stdio/L_ctermid.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+#define L_ctermid (255)
+/*
+POSIX(1)
+*/
diff --git a/src/stdio/L_cuserid.c b/src/stdio/L_cuserid.c
new file mode 100644
index 00000000..1bcaec9a
--- /dev/null
+++ b/src/stdio/L_cuserid.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+#define L_cuserid (255)
+/*
+POSIX(1)
+*/
diff --git a/src/stdio/_stdio.c b/src/stdio/_stdio.c
deleted file mode 100644
index 05851eeb..00000000
--- a/src/stdio/_stdio.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "stdio.h"
-FILE *stdin, *stdout, *stderr;
diff --git a/src/stdio/fdopen.c b/src/stdio/fdopen.c
new file mode 100644
index 00000000..9f6f8d72
--- /dev/null
+++ b/src/stdio/fdopen.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+FILE * fdopen(int fildes, const char * mode)
+{
+ (void)fildes; (void)mode;
+ return NULL;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/stdio/fileno.c b/src/stdio/fileno.c
new file mode 100644
index 00000000..a3af0ec2
--- /dev/null
+++ b/src/stdio/fileno.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include "nonstd/FILE.h"
+#include "nonstd/assert.h"
+
+int fileno(FILE * stream)
+{
+ ASSERT_NONNULL(stream);
+ return stream->fd;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IRGRP.c b/src/sys/stat/S_IRGRP.c
new file mode 100644
index 00000000..98cf739e
--- /dev/null
+++ b/src/sys/stat/S_IRGRP.c
@@ -0,0 +1,6 @@
+#include <sys/stat.h>
+
+#define S_IRGRP (040)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IROTH.c b/src/sys/stat/S_IROTH.c
new file mode 100644
index 00000000..006421ed
--- /dev/null
+++ b/src/sys/stat/S_IROTH.c
@@ -0,0 +1,6 @@
+#include <sys/stat.h>
+
+#define S_IROTH (04)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IRUSR.c b/src/sys/stat/S_IRUSR.c
new file mode 100644
index 00000000..2b62f4f1
--- /dev/null
+++ b/src/sys/stat/S_IRUSR.c
@@ -0,0 +1,6 @@
+#include <sys/stat.h>
+
+#define S_IRUSR (0400)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IRWXG.c b/src/sys/stat/S_IRWXG.c
new file mode 100644
index 00000000..e051625e
--- /dev/null
+++ b/src/sys/stat/S_IRWXG.c
@@ -0,0 +1,6 @@
+#include <sys/stat.h>
+
+#define S_IRWXG (070)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IRWXO.c b/src/sys/stat/S_IRWXO.c
new file mode 100644
index 00000000..82bbadb3
--- /dev/null
+++ b/src/sys/stat/S_IRWXO.c
@@ -0,0 +1,6 @@
+#include <sys/stat.h>
+
+#define S_IRWXO (07)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IRWXU.c b/src/sys/stat/S_IRWXU.c
new file mode 100644
index 00000000..a518680e
--- /dev/null
+++ b/src/sys/stat/S_IRWXU.c
@@ -0,0 +1,6 @@
+#include <sys/stat.h>
+
+#define S_IRWXU (0700)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISBLK.C b/src/sys/stat/S_ISBLK.C
new file mode 100644
index 00000000..1a1498ef
--- /dev/null
+++ b/src/sys/stat/S_ISBLK.C
@@ -0,0 +1,5 @@
+#includ
+#define S_ISBLK(s) /* FIXME */
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISCHR.c b/src/sys/stat/S_ISCHR.c
new file mode 100644
index 00000000..a393b84e
--- /dev/null
+++ b/src/sys/stat/S_ISCHR.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_ISCHR(s) /* fixme */
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISDIR.c b/src/sys/stat/S_ISDIR.c
new file mode 100644
index 00000000..5b5720c7
--- /dev/null
+++ b/src/sys/stat/S_ISDIR.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_ISDIR(s) (s)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISFIFO.c b/src/sys/stat/S_ISFIFO.c
new file mode 100644
index 00000000..a28a90e9
--- /dev/null
+++ b/src/sys/stat/S_ISFIFO.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_ISFIFO(s) /* fixme */
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISGID.c b/src/sys/stat/S_ISGID.c
new file mode 100644
index 00000000..55ceb105
--- /dev/null
+++ b/src/sys/stat/S_ISGID.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_ISGID (02000)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISREG.c b/src/sys/stat/S_ISREG.c
new file mode 100644
index 00000000..7a09ffe5
--- /dev/null
+++ b/src/sys/stat/S_ISREG.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_ISREG(s) /* fixme */
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_ISUID.c b/src/sys/stat/S_ISUID.c
new file mode 100644
index 00000000..85295ad3
--- /dev/null
+++ b/src/sys/stat/S_ISUID.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_ISUID (04000)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IWGRP.c b/src/sys/stat/S_IWGRP.c
new file mode 100644
index 00000000..c7a716e7
--- /dev/null
+++ b/src/sys/stat/S_IWGRP.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_IWGRP (020)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IWOTH.c b/src/sys/stat/S_IWOTH.c
new file mode 100644
index 00000000..26e75066
--- /dev/null
+++ b/src/sys/stat/S_IWOTH.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_IWOTH (02)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IWUSR.c b/src/sys/stat/S_IWUSR.c
new file mode 100644
index 00000000..e9af1829
--- /dev/null
+++ b/src/sys/stat/S_IWUSR.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_IWUSR (0200)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IXGRP.c b/src/sys/stat/S_IXGRP.c
new file mode 100644
index 00000000..34f44729
--- /dev/null
+++ b/src/sys/stat/S_IXGRP.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_IXGRP (010)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IXOTH.c b/src/sys/stat/S_IXOTH.c
new file mode 100644
index 00000000..10d51686
--- /dev/null
+++ b/src/sys/stat/S_IXOTH.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_IXOTH (01)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/S_IXUSR.c b/src/sys/stat/S_IXUSR.c
new file mode 100644
index 00000000..b4b8e494
--- /dev/null
+++ b/src/sys/stat/S_IXUSR.c
@@ -0,0 +1,5 @@
+#include <sys/stat.h>
+#define S_IXUSR (0100)
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/chmod.c b/src/sys/stat/chmod.c
new file mode 100644
index 00000000..f061e1a8
--- /dev/null
+++ b/src/sys/stat/chmod.c
@@ -0,0 +1,17 @@
+#include "sys/types.h"
+#include <sys/stat.h>
+#include "nonstd/syscall.h"
+
+int chmod(const char *path, mode_t mode)
+{
+ SCNO(scno, "chmod", -1);
+ int r = __libc.syscall(scno, path, mode);
+ if (r < 0) {
+ errno = -r;
+ return -1;
+ }
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/fstat.c b/src/sys/stat/fstat.c
new file mode 100644
index 00000000..bdd9f574
--- /dev/null
+++ b/src/sys/stat/fstat.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <sys/stat.h>
+
+int fstat(int fildes, struct stat *buf)
+{
+ (void)fildes; (void)buf;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/mkdir.c b/src/sys/stat/mkdir.c
new file mode 100644
index 00000000..7b3f510d
--- /dev/null
+++ b/src/sys/stat/mkdir.c
@@ -0,0 +1,13 @@
+#include "sys/types.h"
+#include <sys/stat.h>
+#include "nonstd/syscall.h"
+
+int mkdir(const char *path, mode_t mode)
+{
+ (void)path; (void)mode;
+ return -1;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/mkfifo.c b/src/sys/stat/mkfifo.c
new file mode 100644
index 00000000..2d475258
--- /dev/null
+++ b/src/sys/stat/mkfifo.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <sys/stat.h>
+
+int mkfifo(const char *path, mode_t mode)
+{
+ (void)path; (void)mode;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/stat.c b/src/sys/stat/stat.c
new file mode 100644
index 00000000..c5079295
--- /dev/null
+++ b/src/sys/stat/stat.c
@@ -0,0 +1,32 @@
+#include "sys/types.h"
+#include <sys/stat.h>
+#include "stdlib.h"
+#include "nonstd/assert.h"
+
+int stat(const char * restrict path, struct stat * restrict buf)
+{
+ ASSERT_NONNULL(path);
+ ASSERT_NONNULL(buf);
+
+ int ret = 0;
+ #if 0
+ char *linkbuf = NULL;
+
+ do {
+ ret = lstat(path, buf);
+ if (S_ISLNK(buf->st_mode)) {
+ linkbuf = realloc(linkbuf, buf->st_size + 1);
+ readlink(path, linkbuf, buf->st_size);
+ path = linkbuf;
+ } else {
+ path = NULL;
+ }
+ } while (path);
+ realloc(linkbuf, 0);
+ #endif
+
+ return ret;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/struct_stat.c b/src/sys/stat/struct_stat.c
new file mode 100644
index 00000000..c825e561
--- /dev/null
+++ b/src/sys/stat/struct_stat.c
@@ -0,0 +1,23 @@
+#include <sys/stat.h>
+
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ #if 0
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ #endif
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/stat/umask.c b/src/sys/stat/umask.c
new file mode 100644
index 00000000..ca038bad
--- /dev/null
+++ b/src/sys/stat/umask.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <sys/stat.h>
+
+mode_t umask(mode_t cmask)
+{
+ return cmask;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/times/struct_tms.c b/src/sys/times/struct_tms.c
new file mode 100644
index 00000000..8e70958b
--- /dev/null
+++ b/src/sys/times/struct_tms.c
@@ -0,0 +1,12 @@
+#include <sys/times.h>
+
+struct tms {
+ clock_t tms_utime;
+ clock_t tms_stime;
+ clock_t tms_cutime;
+ clock_t tms_cstime;
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/times/times.c b/src/sys/times/times.c
new file mode 100644
index 00000000..753d66ae
--- /dev/null
+++ b/src/sys/times/times.c
@@ -0,0 +1,11 @@
+#include "time.h"
+#include <sys/times.h>
+
+clock_t times(struct tms *buffer)
+{
+ (void)buffer;
+ return (clock_t)-1;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/dev_t.c b/src/sys/types/dev_t.c
new file mode 100644
index 00000000..5a98787f
--- /dev/null
+++ b/src/sys/types/dev_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef unsigned long long int dev_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/gid_t.c b/src/sys/types/gid_t.c
new file mode 100644
index 00000000..b62344a9
--- /dev/null
+++ b/src/sys/types/gid_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef unsigned long long int gid_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/ino_t.c b/src/sys/types/ino_t.c
new file mode 100644
index 00000000..a563dd7b
--- /dev/null
+++ b/src/sys/types/ino_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef unsigned long long int ino_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/mode_t.c b/src/sys/types/mode_t.c
new file mode 100644
index 00000000..9b68ed05
--- /dev/null
+++ b/src/sys/types/mode_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef unsigned long int mode_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/nlink_t.c b/src/sys/types/nlink_t.c
new file mode 100644
index 00000000..68eb4f84
--- /dev/null
+++ b/src/sys/types/nlink_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef unsigned long long int nlink_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/off_t.c b/src/sys/types/off_t.c
new file mode 100644
index 00000000..f9056020
--- /dev/null
+++ b/src/sys/types/off_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef long long int off_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/pid_t.c b/src/sys/types/pid_t.c
new file mode 100644
index 00000000..91307c09
--- /dev/null
+++ b/src/sys/types/pid_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef long int pid_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/ssize_t.c b/src/sys/types/ssize_t.c
new file mode 100644
index 00000000..2bfdef89
--- /dev/null
+++ b/src/sys/types/ssize_t.c
@@ -0,0 +1,7 @@
+#include <sys/types.h>
+
+typedef long int ssize_t;
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/types/uid_t.c b/src/sys/types/uid_t.c
new file mode 100644
index 00000000..ab37f521
--- /dev/null
+++ b/src/sys/types/uid_t.c
@@ -0,0 +1,6 @@
+#include <sys/types.h>
+
+typedef unsigned long long int uid_t;
+/*
+POSIX(1)
+*/
diff --git a/src/sys/utsname/struct_utsname.c b/src/sys/utsname/struct_utsname.c
new file mode 100644
index 00000000..4b100a7a
--- /dev/null
+++ b/src/sys/utsname/struct_utsname.c
@@ -0,0 +1,13 @@
+#include <sys/utsname.h>
+
+struct utsname {
+ char sysname[100];
+ char nodename[100];
+ char release[100];
+ char version[100];
+ char machine[100];
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/utsname/uname.c b/src/sys/utsname/uname.c
new file mode 100644
index 00000000..50b53e11
--- /dev/null
+++ b/src/sys/utsname/uname.c
@@ -0,0 +1,25 @@
+#include <sys/utsname.h>
+#include "string.h"
+#include "nonstd/assert.h"
+
+# define __PLATFORM__ "x86"
+
+int uname(struct utsname *name)
+{
+ ASSERT_NONNULL(name);
+
+ strcpy(name->sysname, "UNG");
+ #if 0
+ gethostname(name->nodename, sizeof(name->nodename));
+ #else
+ strcpy(name->sysname, "localhost");
+ #endif
+ strcpy(name->release, "YYYY-MM-DD");
+ strcpy(name->version, "MM.mm.pp");
+ strcpy(name->machine, __PLATFORM__);
+ return 1;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WEXITSTATUS.c b/src/sys/wait/WEXITSTATUS.c
new file mode 100644
index 00000000..f0fcafc6
--- /dev/null
+++ b/src/sys/wait/WEXITSTATUS.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WEXITSTATUS 1
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WIFEXITED.c b/src/sys/wait/WIFEXITED.c
new file mode 100644
index 00000000..e0e32bcb
--- /dev/null
+++ b/src/sys/wait/WIFEXITED.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WIFEXITED 2
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WIFSIGNALED.c b/src/sys/wait/WIFSIGNALED.c
new file mode 100644
index 00000000..cc99a98a
--- /dev/null
+++ b/src/sys/wait/WIFSIGNALED.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WIFSIGNALED 3
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WIFSTOPPED.c b/src/sys/wait/WIFSTOPPED.c
new file mode 100644
index 00000000..3fb06d8c
--- /dev/null
+++ b/src/sys/wait/WIFSTOPPED.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WIFSTOPPED 4
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WNOHANG.c b/src/sys/wait/WNOHANG.c
new file mode 100644
index 00000000..1c28008b
--- /dev/null
+++ b/src/sys/wait/WNOHANG.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WNOHANG 5
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WSTOPSIG.c b/src/sys/wait/WSTOPSIG.c
new file mode 100644
index 00000000..721179c8
--- /dev/null
+++ b/src/sys/wait/WSTOPSIG.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WSTOPSIG 6
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WTERMSIG.c b/src/sys/wait/WTERMSIG.c
new file mode 100644
index 00000000..6d47fea2
--- /dev/null
+++ b/src/sys/wait/WTERMSIG.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WTERMSIG 7
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/WUNTRACED.c b/src/sys/wait/WUNTRACED.c
new file mode 100644
index 00000000..d082bef5
--- /dev/null
+++ b/src/sys/wait/WUNTRACED.c
@@ -0,0 +1,6 @@
+#include <sys/wait.h>
+
+#define WUNTRACED 8
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/wait.c b/src/sys/wait/wait.c
new file mode 100644
index 00000000..be1799fe
--- /dev/null
+++ b/src/sys/wait/wait.c
@@ -0,0 +1,10 @@
+#include "sys/types.h"
+#include <sys/wait.h>
+
+pid_t wait(int *stat_loc)
+{
+ return waitpid((pid_t)-1, stat_loc, 0);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/sys/wait/waitpid.c b/src/sys/wait/waitpid.c
new file mode 100644
index 00000000..ef196cc1
--- /dev/null
+++ b/src/sys/wait/waitpid.c
@@ -0,0 +1,11 @@
+#include "sys/types.h"
+#include <sys/wait.h>
+
+pid_t waitpid(pid_t pid, int *stat_loc, int options)
+{
+ (void)pid; (void)stat_loc; (void)options;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/tar/AREGTYPE.c b/src/tar/AREGTYPE.c
new file mode 100644
index 00000000..9543eeea
--- /dev/null
+++ b/src/tar/AREGTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define AREGTYPE '\0'
+/*d Regular file. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/BLKTYPE.c b/src/tar/BLKTYPE.c
new file mode 100644
index 00000000..fd2fa542
--- /dev/null
+++ b/src/tar/BLKTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define BLKTYPE '4'
+/*d Block special. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/CHRTYPE.c b/src/tar/CHRTYPE.c
new file mode 100644
index 00000000..34468291
--- /dev/null
+++ b/src/tar/CHRTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define CHRTYPE '3'
+/*d Character special. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/CONTTYPE.c b/src/tar/CONTTYPE.c
new file mode 100644
index 00000000..281dbd01
--- /dev/null
+++ b/src/tar/CONTTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define CONTTYPE '7'
+/*d Reserved. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/DIRTYPE.c b/src/tar/DIRTYPE.c
new file mode 100644
index 00000000..2d472b67
--- /dev/null
+++ b/src/tar/DIRTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define DIRTYPE '5'
+/*d Directory. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/FIFOTYPE.c b/src/tar/FIFOTYPE.c
new file mode 100644
index 00000000..d9531aab
--- /dev/null
+++ b/src/tar/FIFOTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define FIFOTYPE '6'
+/*d FIFO special. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/LNKTYPE.c b/src/tar/LNKTYPE.c
new file mode 100644
index 00000000..35c8a14c
--- /dev/null
+++ b/src/tar/LNKTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define LNKTYPE '1'
+/*d Link. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/REGTYPE.c b/src/tar/REGTYPE.c
new file mode 100644
index 00000000..d1935b93
--- /dev/null
+++ b/src/tar/REGTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define REGTYPE '0'
+/*d Regular file. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/SYMTYPE.c b/src/tar/SYMTYPE.c
new file mode 100644
index 00000000..566ca67b
--- /dev/null
+++ b/src/tar/SYMTYPE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define SYMTYPE '2'
+/*d Symoblic link. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TGEXEC.c b/src/tar/TGEXEC.c
new file mode 100644
index 00000000..5557c981
--- /dev/null
+++ b/src/tar/TGEXEC.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TGEXEC 00010
+/*d Execute/search by group. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TGREAD.c b/src/tar/TGREAD.c
new file mode 100644
index 00000000..23656009
--- /dev/null
+++ b/src/tar/TGREAD.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TGREAD 00040
+/*d Read by group. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TGWRITE.c b/src/tar/TGWRITE.c
new file mode 100644
index 00000000..47e142db
--- /dev/null
+++ b/src/tar/TGWRITE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TGWRITE 00020
+/*d Write by group. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TMAGIC.c b/src/tar/TMAGIC.c
new file mode 100644
index 00000000..c162877f
--- /dev/null
+++ b/src/tar/TMAGIC.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TMAGIC "ustar"
+/*d POSIX tar archive magic number. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TMAGLEN.c b/src/tar/TMAGLEN.c
new file mode 100644
index 00000000..48e7b52e
--- /dev/null
+++ b/src/tar/TMAGLEN.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TMAGLEN 6
+/*d The length of the POSIX tar archive magic number. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TOEXEC.c b/src/tar/TOEXEC.c
new file mode 100644
index 00000000..8e1d9576
--- /dev/null
+++ b/src/tar/TOEXEC.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TOEXEC 00001
+/*d Execute/search by other. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TOREAD.c b/src/tar/TOREAD.c
new file mode 100644
index 00000000..253fb8c5
--- /dev/null
+++ b/src/tar/TOREAD.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TOREAD 00004
+/*d Read by other. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TOWRITE.c b/src/tar/TOWRITE.c
new file mode 100644
index 00000000..fc05a49e
--- /dev/null
+++ b/src/tar/TOWRITE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TOWRITE 00002
+/*d Write by other. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TSGID.c b/src/tar/TSGID.c
new file mode 100644
index 00000000..d62b177b
--- /dev/null
+++ b/src/tar/TSGID.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TSGID 02000
+/*d Set GID on execution. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TSUID.c b/src/tar/TSUID.c
new file mode 100644
index 00000000..c4c49437
--- /dev/null
+++ b/src/tar/TSUID.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TSUID 04000
+/*d Set UID on execution. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TSVTX.c b/src/tar/TSVTX.c
new file mode 100644
index 00000000..e1577fa1
--- /dev/null
+++ b/src/tar/TSVTX.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TSVTX 01000
+/*d Reserved d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TUEXEC.c b/src/tar/TUEXEC.c
new file mode 100644
index 00000000..6ff9d156
--- /dev/null
+++ b/src/tar/TUEXEC.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TUEXEC 00100
+/*d Execute/search by owner. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TUREAD.c b/src/tar/TUREAD.c
new file mode 100644
index 00000000..e60c0f19
--- /dev/null
+++ b/src/tar/TUREAD.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TUREAD 00400
+/*d Read by owner. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TUWRITE.c b/src/tar/TUWRITE.c
new file mode 100644
index 00000000..c0730304
--- /dev/null
+++ b/src/tar/TUWRITE.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TUWRITE 00200
+/*d Write by owner. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TVERSION.c b/src/tar/TVERSION.c
new file mode 100644
index 00000000..f4b51d58
--- /dev/null
+++ b/src/tar/TVERSION.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TVERSION "00"
+/*d The version of a POSIX tar archive, not including the NULL byte. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/tar/TVERSLEN.c b/src/tar/TVERSLEN.c
new file mode 100644
index 00000000..4560e140
--- /dev/null
+++ b/src/tar/TVERSLEN.c
@@ -0,0 +1,7 @@
+#include <tar.h>
+
+#define TVERSLEN 2
+/*d The length of the version string in a POSIX tar archive. d*/
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B0.c b/src/termios/B0.c
new file mode 100644
index 00000000..5409219e
--- /dev/null
+++ b/src/termios/B0.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B0 (0)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B110.c b/src/termios/B110.c
new file mode 100644
index 00000000..e0ef2d00
--- /dev/null
+++ b/src/termios/B110.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B110 (110)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B1200.c b/src/termios/B1200.c
new file mode 100644
index 00000000..74fee7ae
--- /dev/null
+++ b/src/termios/B1200.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B1200 (1200)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B134.c b/src/termios/B134.c
new file mode 100644
index 00000000..903b26ba
--- /dev/null
+++ b/src/termios/B134.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B134 (134)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B150.c b/src/termios/B150.c
new file mode 100644
index 00000000..6e1f8d53
--- /dev/null
+++ b/src/termios/B150.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B150 (150)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B1800.c b/src/termios/B1800.c
new file mode 100644
index 00000000..667ab049
--- /dev/null
+++ b/src/termios/B1800.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B1800 (1800)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B19200.c b/src/termios/B19200.c
new file mode 100644
index 00000000..7398414c
--- /dev/null
+++ b/src/termios/B19200.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B19200 (19200)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B200.c b/src/termios/B200.c
new file mode 100644
index 00000000..466be6ae
--- /dev/null
+++ b/src/termios/B200.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B200 (200)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B2400.c b/src/termios/B2400.c
new file mode 100644
index 00000000..894db7aa
--- /dev/null
+++ b/src/termios/B2400.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B2400 (2400)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B300.c b/src/termios/B300.c
new file mode 100644
index 00000000..43fea2ad
--- /dev/null
+++ b/src/termios/B300.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B300 (300)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B38400.c b/src/termios/B38400.c
new file mode 100644
index 00000000..9d785894
--- /dev/null
+++ b/src/termios/B38400.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B38400 (38400)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B4800.c b/src/termios/B4800.c
new file mode 100644
index 00000000..d4059f6d
--- /dev/null
+++ b/src/termios/B4800.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B4800 (4800)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B50.c b/src/termios/B50.c
new file mode 100644
index 00000000..44109e91
--- /dev/null
+++ b/src/termios/B50.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B50 (50)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B600.c b/src/termios/B600.c
new file mode 100644
index 00000000..46a077d9
--- /dev/null
+++ b/src/termios/B600.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B600 (600)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B75.c b/src/termios/B75.c
new file mode 100644
index 00000000..001c7e84
--- /dev/null
+++ b/src/termios/B75.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B75 (75)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/B9600.c b/src/termios/B9600.c
new file mode 100644
index 00000000..518a3748
--- /dev/null
+++ b/src/termios/B9600.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define B9600 (9600)
+/*
+POSIX(1)
+*/
diff --git a/src/termios/BRKINT.c b/src/termios/BRKINT.c
new file mode 100644
index 00000000..383dbac5
--- /dev/null
+++ b/src/termios/BRKINT.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define BRKINT /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CLOCAL.c b/src/termios/CLOCAL.c
new file mode 100644
index 00000000..a2e64633
--- /dev/null
+++ b/src/termios/CLOCAL.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CLOCAL /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CREAD.c b/src/termios/CREAD.c
new file mode 100644
index 00000000..7afdf721
--- /dev/null
+++ b/src/termios/CREAD.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CREAD /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CS5.c b/src/termios/CS5.c
new file mode 100644
index 00000000..ca402a98
--- /dev/null
+++ b/src/termios/CS5.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CS5 /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CS6.c b/src/termios/CS6.c
new file mode 100644
index 00000000..04a7ae68
--- /dev/null
+++ b/src/termios/CS6.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CS6 /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CS7.c b/src/termios/CS7.c
new file mode 100644
index 00000000..34f8c7bf
--- /dev/null
+++ b/src/termios/CS7.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CS7 /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CS8.c b/src/termios/CS8.c
new file mode 100644
index 00000000..ef7837ab
--- /dev/null
+++ b/src/termios/CS8.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CS8 /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CSIZE.c b/src/termios/CSIZE.c
new file mode 100644
index 00000000..b6c42b22
--- /dev/null
+++ b/src/termios/CSIZE.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CSIZE /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/CSTOPB.c b/src/termios/CSTOPB.c
new file mode 100644
index 00000000..05cefcad
--- /dev/null
+++ b/src/termios/CSTOPB.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define CSTOPB /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ECHO.c b/src/termios/ECHO.c
new file mode 100644
index 00000000..aeec4619
--- /dev/null
+++ b/src/termios/ECHO.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ECHO /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ECHOE.c b/src/termios/ECHOE.c
new file mode 100644
index 00000000..078cd979
--- /dev/null
+++ b/src/termios/ECHOE.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ECHOE /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ECHOK.c b/src/termios/ECHOK.c
new file mode 100644
index 00000000..04464d14
--- /dev/null
+++ b/src/termios/ECHOK.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ECHOK /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ECHONL.c b/src/termios/ECHONL.c
new file mode 100644
index 00000000..5ff6838b
--- /dev/null
+++ b/src/termios/ECHONL.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ECHONL /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/HUPCL.c b/src/termios/HUPCL.c
new file mode 100644
index 00000000..1be7ff10
--- /dev/null
+++ b/src/termios/HUPCL.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define HUPCL /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ICANON.c b/src/termios/ICANON.c
new file mode 100644
index 00000000..f3227ca8
--- /dev/null
+++ b/src/termios/ICANON.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ICANON /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ICRNL.c b/src/termios/ICRNL.c
new file mode 100644
index 00000000..e203abbb
--- /dev/null
+++ b/src/termios/ICRNL.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ICRNL /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/IEXTEN.c b/src/termios/IEXTEN.c
new file mode 100644
index 00000000..3358e27d
--- /dev/null
+++ b/src/termios/IEXTEN.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define IEXTEN /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/IGNBRK.c b/src/termios/IGNBRK.c
new file mode 100644
index 00000000..00003681
--- /dev/null
+++ b/src/termios/IGNBRK.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define IGNBRK /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/IGNCR.c b/src/termios/IGNCR.c
new file mode 100644
index 00000000..c8848d8d
--- /dev/null
+++ b/src/termios/IGNCR.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define IGNCR /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/IGNPAR.c b/src/termios/IGNPAR.c
new file mode 100644
index 00000000..caf85715
--- /dev/null
+++ b/src/termios/IGNPAR.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define IGNPAR /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/INLCR.c b/src/termios/INLCR.c
new file mode 100644
index 00000000..b49d50fb
--- /dev/null
+++ b/src/termios/INLCR.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define INLCR /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/INPCK.c b/src/termios/INPCK.c
new file mode 100644
index 00000000..8604e0ff
--- /dev/null
+++ b/src/termios/INPCK.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define INPCK /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ISIG.c b/src/termios/ISIG.c
new file mode 100644
index 00000000..4e3e0234
--- /dev/null
+++ b/src/termios/ISIG.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ISIG /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/ISTRIP.c b/src/termios/ISTRIP.c
new file mode 100644
index 00000000..f794d859
--- /dev/null
+++ b/src/termios/ISTRIP.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define ISTRIP /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/IXOFF.c b/src/termios/IXOFF.c
new file mode 100644
index 00000000..8b8f9bfd
--- /dev/null
+++ b/src/termios/IXOFF.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define IXOFF /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/IXON.c b/src/termios/IXON.c
new file mode 100644
index 00000000..862a5ef5
--- /dev/null
+++ b/src/termios/IXON.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define IXON /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/NCCS.c b/src/termios/NCCS.c
new file mode 100644
index 00000000..f16fb67b
--- /dev/null
+++ b/src/termios/NCCS.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define NCCS /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/NOFLSH.c b/src/termios/NOFLSH.c
new file mode 100644
index 00000000..a5700711
--- /dev/null
+++ b/src/termios/NOFLSH.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define NOFLSH /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/OPOST.c b/src/termios/OPOST.c
new file mode 100644
index 00000000..416b0b44
--- /dev/null
+++ b/src/termios/OPOST.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define OPOST /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/PARENB.c b/src/termios/PARENB.c
new file mode 100644
index 00000000..a51711c5
--- /dev/null
+++ b/src/termios/PARENB.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define PARENB /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/PARMRK.c b/src/termios/PARMRK.c
new file mode 100644
index 00000000..380163fa
--- /dev/null
+++ b/src/termios/PARMRK.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define PARMRK /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/PARODD.c b/src/termios/PARODD.c
new file mode 100644
index 00000000..57f12684
--- /dev/null
+++ b/src/termios/PARODD.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define PARODD /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCIFLUSH.c b/src/termios/TCIFLUSH.c
new file mode 100644
index 00000000..bdcad63a
--- /dev/null
+++ b/src/termios/TCIFLUSH.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCIFLUSH /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCIOFF.c b/src/termios/TCIOFF.c
new file mode 100644
index 00000000..2c2abf8d
--- /dev/null
+++ b/src/termios/TCIOFF.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCIOFF /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCIOFLUSH.c b/src/termios/TCIOFLUSH.c
new file mode 100644
index 00000000..be6f0a4f
--- /dev/null
+++ b/src/termios/TCIOFLUSH.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCIOFLUSH /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCION.c b/src/termios/TCION.c
new file mode 100644
index 00000000..bddc0468
--- /dev/null
+++ b/src/termios/TCION.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCION /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCOFLUSH.c b/src/termios/TCOFLUSH.c
new file mode 100644
index 00000000..5e137330
--- /dev/null
+++ b/src/termios/TCOFLUSH.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCOFLUSH /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCOOFF.c b/src/termios/TCOOFF.c
new file mode 100644
index 00000000..73b915fb
--- /dev/null
+++ b/src/termios/TCOOFF.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCOOFF /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCOON.c b/src/termios/TCOON.c
new file mode 100644
index 00000000..9ac4dce2
--- /dev/null
+++ b/src/termios/TCOON.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCOON /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCSADRAIN.c b/src/termios/TCSADRAIN.c
new file mode 100644
index 00000000..07a646cf
--- /dev/null
+++ b/src/termios/TCSADRAIN.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCSADRAIN /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCSAFLUSH.c b/src/termios/TCSAFLUSH.c
new file mode 100644
index 00000000..56f103a7
--- /dev/null
+++ b/src/termios/TCSAFLUSH.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCSAFLUSH /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TCSANOW.c b/src/termios/TCSANOW.c
new file mode 100644
index 00000000..642c9bd4
--- /dev/null
+++ b/src/termios/TCSANOW.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TCSANOW /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/TOSTOP.c b/src/termios/TOSTOP.c
new file mode 100644
index 00000000..e187a4ff
--- /dev/null
+++ b/src/termios/TOSTOP.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define TOSTOP /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VEOF.c b/src/termios/VEOF.c
new file mode 100644
index 00000000..f280cb44
--- /dev/null
+++ b/src/termios/VEOF.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VEOF /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VEOL.c b/src/termios/VEOL.c
new file mode 100644
index 00000000..c97e237b
--- /dev/null
+++ b/src/termios/VEOL.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VEOL /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VERASE.c b/src/termios/VERASE.c
new file mode 100644
index 00000000..a8afca17
--- /dev/null
+++ b/src/termios/VERASE.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VERASE /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VINTR.c b/src/termios/VINTR.c
new file mode 100644
index 00000000..7aab15de
--- /dev/null
+++ b/src/termios/VINTR.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VINTR /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VKILL.c b/src/termios/VKILL.c
new file mode 100644
index 00000000..c6d3c90e
--- /dev/null
+++ b/src/termios/VKILL.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VKILL /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VMIN.c b/src/termios/VMIN.c
new file mode 100644
index 00000000..5a2bab96
--- /dev/null
+++ b/src/termios/VMIN.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VMIN /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VQUIT.c b/src/termios/VQUIT.c
new file mode 100644
index 00000000..ad01350b
--- /dev/null
+++ b/src/termios/VQUIT.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VQUIT /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VSTART.c b/src/termios/VSTART.c
new file mode 100644
index 00000000..bdd1c30c
--- /dev/null
+++ b/src/termios/VSTART.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VSTART /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VSTOP.c b/src/termios/VSTOP.c
new file mode 100644
index 00000000..00047eec
--- /dev/null
+++ b/src/termios/VSTOP.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VSTOP /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VSUSP.c b/src/termios/VSUSP.c
new file mode 100644
index 00000000..fc3c6586
--- /dev/null
+++ b/src/termios/VSUSP.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VSUSP /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/VTIME.c b/src/termios/VTIME.c
new file mode 100644
index 00000000..015bf2fd
--- /dev/null
+++ b/src/termios/VTIME.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+#define VTIME /* TBD */
+/*
+POSIX(1)
+*/
diff --git a/src/termios/cc_t.c b/src/termios/cc_t.c
new file mode 100644
index 00000000..eff66f77
--- /dev/null
+++ b/src/termios/cc_t.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+typedef int cc_t;
+/*
+POSIX(1)
+*/
diff --git a/src/termios/cfgetispeed.c b/src/termios/cfgetispeed.c
new file mode 100644
index 00000000..8b7e91fb
--- /dev/null
+++ b/src/termios/cfgetispeed.c
@@ -0,0 +1,11 @@
+#include <termios.h>
+#include "nonstd/assert.h"
+
+speed_t cfgetispeed(const struct termios *termios_p)
+{
+ ASSERT_NONNULL(termios_p);
+ return termios_p->c_iflag; /* FIXME */
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/cfgetospeed.c b/src/termios/cfgetospeed.c
new file mode 100644
index 00000000..88f13c9e
--- /dev/null
+++ b/src/termios/cfgetospeed.c
@@ -0,0 +1,11 @@
+#include <termios.h>
+#include "nonstd/assert.h"
+
+speed_t cfgetospeed(const struct termios *termios_p)
+{
+ ASSERT_NONNULL(termios_p);
+ return termios_p->c_oflag; /* FIXME */
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/cfsetispeed.c b/src/termios/cfsetispeed.c
new file mode 100644
index 00000000..a500ba49
--- /dev/null
+++ b/src/termios/cfsetispeed.c
@@ -0,0 +1,37 @@
+#include <termios.h>
+#include "nonstd/assert.h"
+
+int cfsetispeed(struct termios *termios_p, speed_t speed)
+{
+ ASSERT_NONNULL(termios_p);
+
+ switch (speed) {
+ case B0:
+ case B50:
+ case B75:
+ case B110:
+ case B134:
+ case B150:
+ case B200:
+ case B300:
+ case B600:
+ case B1200:
+ case B1800:
+ case B2400:
+ case B4800:
+ case B9600:
+ case B19200:
+ case B38400:
+ termios_p->c_iflag = speed; /* FIXME */
+ return 0;
+
+ default:
+ break;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/cfsetospeed.c b/src/termios/cfsetospeed.c
new file mode 100644
index 00000000..9c11b4d8
--- /dev/null
+++ b/src/termios/cfsetospeed.c
@@ -0,0 +1,36 @@
+#include <termios.h>
+#include "nonstd/assert.h"
+
+int cfsetospeed(struct termios *termios_p, speed_t speed)
+{
+ ASSERT_NONNULL(termios_p);
+ switch (speed) {
+ case B0:
+ case B50:
+ case B75:
+ case B110:
+ case B134:
+ case B150:
+ case B200:
+ case B300:
+ case B600:
+ case B1200:
+ case B1800:
+ case B2400:
+ case B4800:
+ case B9600:
+ case B19200:
+ case B38400:
+ termios_p->c_oflag = speed; /* FIXME */
+ return 0;
+
+ default:
+ break;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/speed_t.c b/src/termios/speed_t.c
new file mode 100644
index 00000000..142fe5c8
--- /dev/null
+++ b/src/termios/speed_t.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+typedef int speed_t;
+/*
+POSIX(1)
+*/
diff --git a/src/termios/struct_termios.c b/src/termios/struct_termios.c
new file mode 100644
index 00000000..5f9a6909
--- /dev/null
+++ b/src/termios/struct_termios.c
@@ -0,0 +1,13 @@
+#include <termios.h>
+
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_cc[NCCS];
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcdrain.c b/src/termios/tcdrain.c
new file mode 100644
index 00000000..a0963b83
--- /dev/null
+++ b/src/termios/tcdrain.c
@@ -0,0 +1,9 @@
+#include <termios.h>
+
+int tcdrain(int fildes)
+{
+ return fildes;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcflag_t.c b/src/termios/tcflag_t.c
new file mode 100644
index 00000000..b955f566
--- /dev/null
+++ b/src/termios/tcflag_t.c
@@ -0,0 +1,5 @@
+#include <termios.h>
+typedef unsigned int tcflag_t;
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcflow.c b/src/termios/tcflow.c
new file mode 100644
index 00000000..05898373
--- /dev/null
+++ b/src/termios/tcflow.c
@@ -0,0 +1,11 @@
+#include <termios.h>
+
+int tcflow(int fildes, int action)
+{
+ (void)fildes;
+ return action;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcflush.c b/src/termios/tcflush.c
new file mode 100644
index 00000000..28933528
--- /dev/null
+++ b/src/termios/tcflush.c
@@ -0,0 +1,10 @@
+#include <termios.h>
+
+int tcflush(int fildes, int queue_selector)
+{
+ (void)queue_selector;
+ return fildes;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcgetattr.c b/src/termios/tcgetattr.c
new file mode 100644
index 00000000..f9ebe024
--- /dev/null
+++ b/src/termios/tcgetattr.c
@@ -0,0 +1,10 @@
+#include <termios.h>
+
+int tcgetattr(int fildes, struct termios *termios_p)
+{
+ (void)termios_p;
+ return fildes;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcsendbreak.c b/src/termios/tcsendbreak.c
new file mode 100644
index 00000000..7c728aa3
--- /dev/null
+++ b/src/termios/tcsendbreak.c
@@ -0,0 +1,10 @@
+#include <termios.h>
+
+int tcsendbreak(int fildes, int duration)
+{
+ (void)duration;
+ return fildes;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/termios/tcsetattr.c b/src/termios/tcsetattr.c
new file mode 100644
index 00000000..b68652ad
--- /dev/null
+++ b/src/termios/tcsetattr.c
@@ -0,0 +1,10 @@
+#include <termios.h>
+
+int tcsetattr(int fildes, int optional_actions, struct termios *termios_p)
+{
+ (void)optional_actions; (void)termios_p;
+ return fildes;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/time/CLK_TCK.c b/src/time/CLK_TCK.c
new file mode 100644
index 00000000..7ce665f5
--- /dev/null
+++ b/src/time/CLK_TCK.c
@@ -0,0 +1,5 @@
+#include <time.h>
+#define CLK_TCK /* TODO */
+/*
+POSIX(1)
+*/
diff --git a/src/time/tzname.c b/src/time/tzname.c
new file mode 100644
index 00000000..f65d1c1c
--- /dev/null
+++ b/src/time/tzname.c
@@ -0,0 +1,5 @@
+#include <time.h>
+char * tzname[2];
+/*
+POSIX(1)
+*/
diff --git a/src/time/tzset.c b/src/time/tzset.c
new file mode 100644
index 00000000..51afb285
--- /dev/null
+++ b/src/time/tzset.c
@@ -0,0 +1,7 @@
+#include <time.h>
+void tzset(void)
+{
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/F_OK.c b/src/unistd/F_OK.c
new file mode 100644
index 00000000..1c97b651
--- /dev/null
+++ b/src/unistd/F_OK.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define F_OK 8
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/R_OK.c b/src/unistd/R_OK.c
new file mode 100644
index 00000000..367b3d8a
--- /dev/null
+++ b/src/unistd/R_OK.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define R_OK 4
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/STDERR_FILENO.c b/src/unistd/STDERR_FILENO.c
new file mode 100644
index 00000000..f2c75dde
--- /dev/null
+++ b/src/unistd/STDERR_FILENO.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define STDERR_FILENO 2
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/STDIN_FILENO.c b/src/unistd/STDIN_FILENO.c
new file mode 100644
index 00000000..550b080e
--- /dev/null
+++ b/src/unistd/STDIN_FILENO.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define STDIN_FILENO 0
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/STDOUT_FILENO.c b/src/unistd/STDOUT_FILENO.c
new file mode 100644
index 00000000..d1aca0c9
--- /dev/null
+++ b/src/unistd/STDOUT_FILENO.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define STDOUT_FILENO 1
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/W_OK.c b/src/unistd/W_OK.c
new file mode 100644
index 00000000..387adb7a
--- /dev/null
+++ b/src/unistd/W_OK.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define W_OK 2
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/X_OK.c b/src/unistd/X_OK.c
new file mode 100644
index 00000000..f097b19e
--- /dev/null
+++ b/src/unistd/X_OK.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define X_OK 1
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_CHOWN_RESTRICTED.c b/src/unistd/_PC_CHOWN_RESTRICTED.c
new file mode 100644
index 00000000..6f5589db
--- /dev/null
+++ b/src/unistd/_PC_CHOWN_RESTRICTED.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_CHOWN_RESTRICTED 3
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_LINK_MAX.c b/src/unistd/_PC_LINK_MAX.c
new file mode 100644
index 00000000..bab6528f
--- /dev/null
+++ b/src/unistd/_PC_LINK_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_LINK_MAX 5
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_MAX_CANON.c b/src/unistd/_PC_MAX_CANON.c
new file mode 100644
index 00000000..1e23c04c
--- /dev/null
+++ b/src/unistd/_PC_MAX_CANON.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_MAX_CANON 6
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_MAX_INPUT.c b/src/unistd/_PC_MAX_INPUT.c
new file mode 100644
index 00000000..bc7bb3bc
--- /dev/null
+++ b/src/unistd/_PC_MAX_INPUT.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_MAX_INPUT 7
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_NAME_MAX.c b/src/unistd/_PC_NAME_MAX.c
new file mode 100644
index 00000000..bb9698e3
--- /dev/null
+++ b/src/unistd/_PC_NAME_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_NAME_MAX 8
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_NO_TRUNC.c b/src/unistd/_PC_NO_TRUNC.c
new file mode 100644
index 00000000..9a83e5cb
--- /dev/null
+++ b/src/unistd/_PC_NO_TRUNC.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_NO_TRUNC 9
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_PATH_MAX.c b/src/unistd/_PC_PATH_MAX.c
new file mode 100644
index 00000000..1c5dcf8a
--- /dev/null
+++ b/src/unistd/_PC_PATH_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_PATH_MAX 10
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_PIPE_BUF.c b/src/unistd/_PC_PIPE_BUF.c
new file mode 100644
index 00000000..038827a2
--- /dev/null
+++ b/src/unistd/_PC_PIPE_BUF.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_PIPE_BUF 11
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_PC_VDISABLE.c b/src/unistd/_PC_VDISABLE.c
new file mode 100644
index 00000000..5056367b
--- /dev/null
+++ b/src/unistd/_PC_VDISABLE.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _PC_VDISABLE 20
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_POSIX_CHOWN_RESTRICTED.c b/src/unistd/_POSIX_CHOWN_RESTRICTED.c
new file mode 100644
index 00000000..c3404e5e
--- /dev/null
+++ b/src/unistd/_POSIX_CHOWN_RESTRICTED.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#define _POSIX_CHOWN_RESTRICTED (1)
+/* USE: pathconf() */
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_POSIX_JOB_CONTROL.c b/src/unistd/_POSIX_JOB_CONTROL.c
new file mode 100644
index 00000000..37a1c9c8
--- /dev/null
+++ b/src/unistd/_POSIX_JOB_CONTROL.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _POSIX_JOB_CONTROL (_POSIX_C_SOURCE)
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_POSIX_NO_TRUNC.c b/src/unistd/_POSIX_NO_TRUNC.c
new file mode 100644
index 00000000..5ed641a8
--- /dev/null
+++ b/src/unistd/_POSIX_NO_TRUNC.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#define _POSIX_NO_TRUNC (2)
+/* USE: pathconf */
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_POSIX_SAVED_IDS.c b/src/unistd/_POSIX_SAVED_IDS.c
new file mode 100644
index 00000000..16058a22
--- /dev/null
+++ b/src/unistd/_POSIX_SAVED_IDS.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _POSIX_SAVED_IDS (_POSIX_C_SOURCE)
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_POSIX_VDISABLE.c b/src/unistd/_POSIX_VDISABLE.c
new file mode 100644
index 00000000..41aef6fe
--- /dev/null
+++ b/src/unistd/_POSIX_VDISABLE.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#define _POSIX_VDISABLE (3)
+/* USE: pathconf() */
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_POSIX_VERSION.c b/src/unistd/_POSIX_VERSION.c
new file mode 100644
index 00000000..d9552154
--- /dev/null
+++ b/src/unistd/_POSIX_VERSION.c
@@ -0,0 +1,17 @@
+#include <unistd.h>
+#if _POSIX_C_SOURCE >= 200809L
+#define _POSIX_VERISON (200809L)
+#elif _POSIX_C_SOURCE >= 200112L
+#define _POSIX_VERSION (200112L)
+#elif _POSIX_C_SOURCE >= 199506L
+#define _POSIX_VERSION (199506L)
+#elif _POSIX_C_SOURCE >= 199309L
+#define _POSIX_VERSION (199309L)
+#elif defined _POSIX_C_SOURCE
+#define _POSIX_VERSION (199009L)
+#else
+#define _POSIX_VERSION (198808L)
+#endif
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_ARG_MAX.c b/src/unistd/_SC_ARG_MAX.c
new file mode 100644
index 00000000..11d04582
--- /dev/null
+++ b/src/unistd/_SC_ARG_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_ARG_MAX 19
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_CHILD_MAX.c b/src/unistd/_SC_CHILD_MAX.c
new file mode 100644
index 00000000..c4c7fdfa
--- /dev/null
+++ b/src/unistd/_SC_CHILD_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_CHILD_MAX 27
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_CLK_TCK.c b/src/unistd/_SC_CLK_TCK.c
new file mode 100644
index 00000000..11924761
--- /dev/null
+++ b/src/unistd/_SC_CLK_TCK.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_CLK_TCK 28
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_JOB_CONTROL.c b/src/unistd/_SC_JOB_CONTROL.c
new file mode 100644
index 00000000..95fe71e4
--- /dev/null
+++ b/src/unistd/_SC_JOB_CONTROL.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_JOB_CONTROL 40
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_NGROUPS_MAX.c b/src/unistd/_SC_NGROUPS_MAX.c
new file mode 100644
index 00000000..b8245ff1
--- /dev/null
+++ b/src/unistd/_SC_NGROUPS_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_NGROUPS_MAX 51
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_OPEN_MAX.c b/src/unistd/_SC_OPEN_MAX.c
new file mode 100644
index 00000000..901c8257
--- /dev/null
+++ b/src/unistd/_SC_OPEN_MAX.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_OPEN_MAX 52
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_SAVED_IDS.c b/src/unistd/_SC_SAVED_IDS.c
new file mode 100644
index 00000000..fec11730
--- /dev/null
+++ b/src/unistd/_SC_SAVED_IDS.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_SAVED_IDS 63
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_STREAM_MAX.c b/src/unistd/_SC_STREAM_MAX.c
new file mode 100644
index 00000000..206af307
--- /dev/null
+++ b/src/unistd/_SC_STREAM_MAX.c
@@ -0,0 +1,7 @@
+#include <unistd.h>
+
+#define _SC_STREAM_MAX 74
+
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_TZNAME_MAX.c b/src/unistd/_SC_TZNAME_MAX.c
new file mode 100644
index 00000000..86eea892
--- /dev/null
+++ b/src/unistd/_SC_TZNAME_MAX.c
@@ -0,0 +1,7 @@
+#include <unistd.h>
+
+#define _SC_TZNAME_MAX 106
+
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_SC_VERSION.c b/src/unistd/_SC_VERSION.c
new file mode 100644
index 00000000..e3310b91
--- /dev/null
+++ b/src/unistd/_SC_VERSION.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+#define _SC_VERSION 115
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_exit.c b/src/unistd/_exit.c
new file mode 100644
index 00000000..fde6d675
--- /dev/null
+++ b/src/unistd/_exit.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+void _exit(int status)
+{
+ __libc.syscall(__libc.syscall_lookup("exit"), status);
+ for (;;);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/access.c b/src/unistd/access.c
new file mode 100644
index 00000000..25554edf
--- /dev/null
+++ b/src/unistd/access.c
@@ -0,0 +1,43 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "sys/stat.h"
+
+int access(const char *path, int amode)
+{
+ struct stat st;
+ mode_t check = (amode & R_OK ? 4 : 0)
+ | (amode & W_OK ? 2 : 0)
+ | (amode & X_OK ? 1 : 0);
+
+ if (amode != F_OK && ((amode & ~(R_OK | W_OK | X_OK)) != 0)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (stat(path, &st) == -1) {
+ /* errno set by stat() */
+ return -1;
+ }
+
+ if (amode == F_OK) {
+ return 0;
+ }
+
+ if (st.st_uid == getuid()) {
+ check <<= 6;
+ } else if (st.st_gid == getgid()) {
+ check <<= 3;
+ }
+
+ if ((st.st_mode & check) == check) {
+ return 0;
+ }
+
+ errno = EACCES;
+ return -1;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/alarm.c b/src/unistd/alarm.c
new file mode 100644
index 00000000..ff96dbaa
--- /dev/null
+++ b/src/unistd/alarm.c
@@ -0,0 +1,16 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+unsigned alarm(unsigned seconds)
+{
+ #if 0
+ SC(unsigned, seconds);
+ #else
+ return seconds;
+ #endif
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/chdir.c b/src/unistd/chdir.c
new file mode 100644
index 00000000..82dc997a
--- /dev/null
+++ b/src/unistd/chdir.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+int chdir(const char *path)
+{
+ SC(int, path);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/chown.c b/src/unistd/chown.c
new file mode 100644
index 00000000..55b32b07
--- /dev/null
+++ b/src/unistd/chown.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+int chown(const char *path, uid_t owner, gid_t group)
+{
+ SC(int, path, owner, group);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/close.c b/src/unistd/close.c
new file mode 100644
index 00000000..b4f402eb
--- /dev/null
+++ b/src/unistd/close.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+int close(int fildes)
+{
+ SC(int, fildes);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/ctermid.c b/src/unistd/ctermid.c
new file mode 100644
index 00000000..32a47b64
--- /dev/null
+++ b/src/unistd/ctermid.c
@@ -0,0 +1,21 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "stdio.h"
+#include "string.h"
+
+char * ctermid(char * s)
+{
+ static char termid[L_ctermid] = "/dev/tty";
+
+ if (s == NULL) {
+ s = termid;
+ } else {
+ strcpy(s, termid);
+ }
+
+ return s;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/dup.c b/src/unistd/dup.c
new file mode 100644
index 00000000..badc0f86
--- /dev/null
+++ b/src/unistd/dup.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "fcntl.h"
+
+int dup(int fildes)
+{
+ return fcntl(fildes, F_DUPFD, 0);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/dup2.c b/src/unistd/dup2.c
new file mode 100644
index 00000000..2755fbc7
--- /dev/null
+++ b/src/unistd/dup2.c
@@ -0,0 +1,29 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "fcntl.h"
+#include "limits.h"
+#include "errno.h"
+
+int dup2(int fildes, int fildes2)
+{
+ if (fildes2 < 0 || fildes2 >= _POSIX_OPEN_MAX) {
+ errno = EBADF;
+ return -1;
+ }
+
+ if (fildes == fildes2) {
+ return fildes2;
+ }
+
+ if (fcntl(fildes, F_GETFD) == -1) {
+ errno = EBADF;
+ return -1;
+ }
+
+ close(fildes2);
+ return fcntl(fildes, F_DUPFD, fildes2);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/execl.c b/src/unistd/execl.c
new file mode 100644
index 00000000..4bfcdd9b
--- /dev/null
+++ b/src/unistd/execl.c
@@ -0,0 +1,24 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "limits.h"
+#include "stdarg.h"
+
+int execl(const char *path, const char *arg0, ... /*, (char *)0 */)
+{
+ char *argv[_POSIX_ARG_MAX], *arg = (char*)arg0;
+ int argc = 0;
+
+ va_list ap;
+ va_start(ap, arg0);
+ do {
+ argv[argc++] = arg;
+ } while ((arg = va_arg(ap, char *)) != NULL);
+ va_end(ap);
+
+ argv[argc] = NULL;
+ return execv(path, argv);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/execle.c b/src/unistd/execle.c
new file mode 100644
index 00000000..d1f42a36
--- /dev/null
+++ b/src/unistd/execle.c
@@ -0,0 +1,26 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "limits.h"
+#include "stdarg.h"
+
+int execle(const char *path, const char *arg0, ... /*, (char *)0, char *const envp[] */)
+{
+ char *argv[_POSIX_ARG_MAX], *arg = (char*)arg0;
+ char **envp = NULL;
+ int argc = 0;
+
+ va_list ap;
+ va_start(ap, arg0);
+ do {
+ argv[argc++] = arg;
+ } while ((arg = va_arg(ap, char *)) != NULL);
+ envp = va_arg(ap, char **);
+ va_end(ap);
+
+ argv[argc] = NULL;
+ return execve(path, argv, envp);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/execlp.c b/src/unistd/execlp.c
new file mode 100644
index 00000000..55d779eb
--- /dev/null
+++ b/src/unistd/execlp.c
@@ -0,0 +1,24 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "stdarg.h"
+#include "limits.h"
+
+int execlp(const char *file, const char *arg0, ... /*, (char *0) */)
+{
+ char *argv[_POSIX_ARG_MAX], *arg = (char*)arg0;
+ int argc = 0;
+
+ va_list ap;
+ va_start(ap, arg0);
+ do {
+ argv[argc++] = arg;
+ } while ((arg = va_arg(ap, char *)) != NULL);
+ va_end(ap);
+
+ argv[argc] = NULL;
+ return execvp(file, argv);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/execv.c b/src/unistd/execv.c
new file mode 100644
index 00000000..3b3e29fb
--- /dev/null
+++ b/src/unistd/execv.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+int execv(const char *path, char *const argv[])
+{
+ extern char **environ;
+ return execve(path, argv, environ);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/execve.c b/src/unistd/execve.c
new file mode 100644
index 00000000..7d54ec91
--- /dev/null
+++ b/src/unistd/execve.c
@@ -0,0 +1,14 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+int execve(const char *path, char *const argv[], char *const envp[])
+{
+ SCNO(scno, "execve", -1);
+ errno = -__libc.syscall(scno, path, argv, envp);
+ return -1;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/execvp.c b/src/unistd/execvp.c
new file mode 100644
index 00000000..5ad54781
--- /dev/null
+++ b/src/unistd/execvp.c
@@ -0,0 +1,20 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+
+int execvp(const char *file, char *const argv[])
+{
+ extern char **environ;
+ /* search $PATH for file */
+ execve(file, argv, environ);
+ if (errno == ENOEXEC) {
+ /* stuff /bin/sh in front */
+ char sh[] = "/bin/sh";
+ return execve(sh, argv, environ);
+ }
+ return -1;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/fork.c b/src/unistd/fork.c
new file mode 100644
index 00000000..3da5c822
--- /dev/null
+++ b/src/unistd/fork.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+pid_t fork(void)
+{
+ SC0(pid_t);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/fpathconf.c b/src/unistd/fpathconf.c
new file mode 100644
index 00000000..37fcf41a
--- /dev/null
+++ b/src/unistd/fpathconf.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+long fpathconf(int fildes, int name)
+{
+ (void)fildes; (void)name;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getcwd.c b/src/unistd/getcwd.c
new file mode 100644
index 00000000..e8e46a60
--- /dev/null
+++ b/src/unistd/getcwd.c
@@ -0,0 +1,21 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/assert.h"
+#include "nonstd/syscall.h"
+
+char * getcwd(char *buf, size_t size)
+{
+ ASSERT_NONNULL(buf);
+ SCNO(scno, "getcwd", NULL);
+ int r = __libc.syscall(scno, buf, size);
+ if (r < 0) {
+ errno = -r;
+ return NULL;
+ }
+ return buf;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getegid.c b/src/unistd/getegid.c
new file mode 100644
index 00000000..617e3b70
--- /dev/null
+++ b/src/unistd/getegid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+gid_t getegid(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/geteuid.c b/src/unistd/geteuid.c
new file mode 100644
index 00000000..6ff0d186
--- /dev/null
+++ b/src/unistd/geteuid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+uid_t geteuid(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getgid.c b/src/unistd/getgid.c
new file mode 100644
index 00000000..03c5f62b
--- /dev/null
+++ b/src/unistd/getgid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+gid_t getgid(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getgroups.c b/src/unistd/getgroups.c
new file mode 100644
index 00000000..1e1dd584
--- /dev/null
+++ b/src/unistd/getgroups.c
@@ -0,0 +1,17 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+#include "nonstd/assert.h"
+
+int getgroups(int gidsetsize, gid_t grouplist[])
+{
+ if (gidsetsize != 0) {
+ ASSERT_NONNULL(grouplist);
+ }
+ SC(int, gidsetsize, grouplist);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getlogin.c b/src/unistd/getlogin.c
new file mode 100644
index 00000000..462b5a6d
--- /dev/null
+++ b/src/unistd/getlogin.c
@@ -0,0 +1,11 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+char * getlogin(void)
+{
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getpgrp.c b/src/unistd/getpgrp.c
new file mode 100644
index 00000000..fd079ff1
--- /dev/null
+++ b/src/unistd/getpgrp.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+pid_t getpgrp(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getpid.c b/src/unistd/getpid.c
new file mode 100644
index 00000000..333735b2
--- /dev/null
+++ b/src/unistd/getpid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+pid_t getpid(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getppid.c b/src/unistd/getppid.c
new file mode 100644
index 00000000..d0518c3e
--- /dev/null
+++ b/src/unistd/getppid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+pid_t getppid(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/getuid.c b/src/unistd/getuid.c
new file mode 100644
index 00000000..8a06b900
--- /dev/null
+++ b/src/unistd/getuid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+uid_t getuid(void)
+{
+ SCNOFAIL();
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/isatty.c b/src/unistd/isatty.c
new file mode 100644
index 00000000..baafa508
--- /dev/null
+++ b/src/unistd/isatty.c
@@ -0,0 +1,19 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+int isatty(int fildes)
+{
+ SCNO(scno, "isatty", 0);
+ int r = __libc.syscall(scno, fildes);
+ if (r < 0) {
+ errno = -r;
+ return 0;
+ }
+ return r;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/link.c b/src/unistd/link.c
new file mode 100644
index 00000000..8960d1f1
--- /dev/null
+++ b/src/unistd/link.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+int link(const char *path1, const char *path2)
+{
+ SC(int, path1, path2);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/lseek.c b/src/unistd/lseek.c
new file mode 100644
index 00000000..86436a9e
--- /dev/null
+++ b/src/unistd/lseek.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+off_t lseek(int fildes, off_t offset, int whence)
+{
+ SC(off_t, fildes, offset, whence);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/pathconf.c b/src/unistd/pathconf.c
new file mode 100644
index 00000000..c871970e
--- /dev/null
+++ b/src/unistd/pathconf.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+long pathconf(const char *path, int name)
+{
+ (void)path; (void)name;
+ return 0;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/pause.c b/src/unistd/pause.c
new file mode 100644
index 00000000..4ce5771c
--- /dev/null
+++ b/src/unistd/pause.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+int pause(void)
+{
+ SC0(int);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/pipe.c b/src/unistd/pipe.c
new file mode 100644
index 00000000..0ceb1181
--- /dev/null
+++ b/src/unistd/pipe.c
@@ -0,0 +1,14 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/assert.h"
+#include "nonstd/syscall.h"
+
+int pipe(int fildes[2])
+{
+ ASSERT_NONNULL(fildes);
+ SC(int, fildes);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/read.c b/src/unistd/read.c
new file mode 100644
index 00000000..dd82ce9c
--- /dev/null
+++ b/src/unistd/read.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+ssize_t read(int fildes, void *buf, size_t nbyte)
+{
+ SC(ssize_t, fildes, buf, nbyte);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/rmdir.c b/src/unistd/rmdir.c
new file mode 100644
index 00000000..2991dcbb
--- /dev/null
+++ b/src/unistd/rmdir.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+int rmdir(const char *path)
+{
+ SC(int, path);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/setgid.c b/src/unistd/setgid.c
new file mode 100644
index 00000000..947df23e
--- /dev/null
+++ b/src/unistd/setgid.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+int setgid(gid_t gid)
+{
+ SC(int, gid);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/setpgid.c b/src/unistd/setpgid.c
new file mode 100644
index 00000000..561dadf0
--- /dev/null
+++ b/src/unistd/setpgid.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "errno.h"
+#include "nonstd/syscall.h"
+
+int setpgid(pid_t pid, pid_t pgid)
+{
+ SC(int, pid, pgid);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/setsid.c b/src/unistd/setsid.c
new file mode 100644
index 00000000..5c39fe0a
--- /dev/null
+++ b/src/unistd/setsid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+pid_t setsid(void)
+{
+ SC0(pid_t);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/setuid.c b/src/unistd/setuid.c
new file mode 100644
index 00000000..ce08fcef
--- /dev/null
+++ b/src/unistd/setuid.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+int setuid(uid_t uid)
+{
+ SC(int, uid);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/sleep.c b/src/unistd/sleep.c
new file mode 100644
index 00000000..1e884f8e
--- /dev/null
+++ b/src/unistd/sleep.c
@@ -0,0 +1,16 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/syscall.h"
+
+unsigned sleep(unsigned seconds)
+{
+ #if 0
+ SC(unsigned, seconds);
+ #else
+ return seconds;
+ #endif
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/sysconf.c b/src/unistd/sysconf.c
new file mode 100644
index 00000000..100dab5b
--- /dev/null
+++ b/src/unistd/sysconf.c
@@ -0,0 +1,11 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+long sysconf(int name)
+{
+ return name;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/tcgetpgrp.c b/src/unistd/tcgetpgrp.c
new file mode 100644
index 00000000..13610d63
--- /dev/null
+++ b/src/unistd/tcgetpgrp.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+pid_t tcgetpgrp(int fildes)
+{
+ (void)fildes;
+ return 0;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/tcsetpgrp.c b/src/unistd/tcsetpgrp.c
new file mode 100644
index 00000000..e3cfe023
--- /dev/null
+++ b/src/unistd/tcsetpgrp.c
@@ -0,0 +1,13 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+int tcsetpgrp(int fildes, pid_t pgid_id)
+{
+ (void)fildes; (void)pgid_id;
+ return 0;
+}
+
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/ttyname.c b/src/unistd/ttyname.c
new file mode 100644
index 00000000..2d4e3cab
--- /dev/null
+++ b/src/unistd/ttyname.c
@@ -0,0 +1,12 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+
+char *ttyname(int fildes)
+{
+ (void)fildes;
+ return NULL;
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/unlink.c b/src/unistd/unlink.c
new file mode 100644
index 00000000..38279888
--- /dev/null
+++ b/src/unistd/unlink.c
@@ -0,0 +1,14 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/assert.h"
+#include "nonstd/syscall.h"
+
+int unlink(const char *path)
+{
+ ASSERT_NONNULL(path);
+ SC(int, path);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/write.c b/src/unistd/write.c
new file mode 100644
index 00000000..c591c279
--- /dev/null
+++ b/src/unistd/write.c
@@ -0,0 +1,16 @@
+#include "stddef.h"
+#include "sys/types.h"
+#include <unistd.h>
+#include "nonstd/assert.h"
+#include "nonstd/syscall.h"
+
+ssize_t write(int fildes, const void *buf, size_t nbyte)
+{
+ if (nbyte != 0) {
+ ASSERT_NONNULL(buf);
+ }
+ SC(ssize_t, fildes, buf, nbyte);
+}
+/*
+POSIX(1)
+*/
diff --git a/src/utime/struct_utimbuf.c b/src/utime/struct_utimbuf.c
new file mode 100644
index 00000000..6fd37261
--- /dev/null
+++ b/src/utime/struct_utimbuf.c
@@ -0,0 +1,10 @@
+#include <utime.h>
+
+struct utimbuf {
+ time_t actime;
+ time_t modtime;
+};
+
+/*
+POSIX(1)
+*/
diff --git a/src/utime/utime.c b/src/utime/utime.c
new file mode 100644
index 00000000..75ce6c1d
--- /dev/null
+++ b/src/utime/utime.c
@@ -0,0 +1,11 @@
+#include "time.h"
+#include <utime.h>
+
+int utime(const char *path, const struct utimbuf *times)
+{
+ (void)path; (void)times;
+ return -1;
+}
+/*
+POSIX(1)
+*/