aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore289
-rw-r--r--Makefile17
-rw-r--r--Makefile.inc11
-rw-r--r--README.md5
-rw-r--r--adv_cmds/Makefile15
-rw-r--r--adv_cmds/Makefile.inc1
-rw-r--r--adv_cmds/cap_mkdb/Makefile3
-rw-r--r--adv_cmds/colldef/Makefile9
-rw-r--r--adv_cmds/colldef/scan.l2
-rw-r--r--adv_cmds/finger/Makefile8
-rw-r--r--adv_cmds/gencat/Makefile5
-rw-r--r--adv_cmds/last/Makefile3
-rw-r--r--adv_cmds/locale/Makefile3
-rw-r--r--adv_cmds/lsvfs/Makefile3
-rw-r--r--adv_cmds/mklocale/Makefile5
-rw-r--r--adv_cmds/mklocale/lex.l2
-rw-r--r--adv_cmds/ps/Makefile3
-rw-r--r--adv_cmds/stty/Makefile7
-rw-r--r--adv_cmds/tabs/Makefile5
-rw-r--r--adv_cmds/tty/Makefile3
-rw-r--r--adv_cmds/whois/Makefile3
-rw-r--r--basic_cmds/Makefile6
-rw-r--r--basic_cmds/Makefile.inc1
-rw-r--r--basic_cmds/mesg/Makefile3
-rw-r--r--basic_cmds/uudecode/Makefile5
-rw-r--r--basic_cmds/uuencode/Makefile6
-rw-r--r--basic_cmds/write/Makefile3
-rw-r--r--bootstrap_cmds/Makefile3
-rw-r--r--bootstrap_cmds/Makefile.inc1
-rw-r--r--bootstrap_cmds/migcom.tproj/Makefile24
-rw-r--r--bootstrap_cmds/migcom.tproj/lexxer.l2
-rwxr-xr-xcreate_tarballs.sh33
-rw-r--r--developer_cmds/Makefile7
-rw-r--r--developer_cmds/Makefile.inc1
-rw-r--r--developer_cmds/asa/Makefile3
-rw-r--r--developer_cmds/ctags/Makefile10
-rw-r--r--developer_cmds/lorder/Makefile3
-rw-r--r--developer_cmds/rpcgen/Makefile15
-rw-r--r--developer_cmds/rpcgen/rpc_main.c3
-rw-r--r--developer_cmds/unifdef/Makefile4
-rw-r--r--diskdev_cmds/Makefile18
-rw-r--r--diskdev_cmds/Makefile.inc1
-rw-r--r--diskdev_cmds/dev_mkdb.tproj/Makefile6
-rw-r--r--diskdev_cmds/disklib/preen.c4
-rw-r--r--diskdev_cmds/edquota.tproj/Makefile8
-rw-r--r--diskdev_cmds/edquota.tproj/edquota.c2
-rw-r--r--diskdev_cmds/edt_fstab/edt_fstab.h2
-rw-r--r--diskdev_cmds/fdisk.tproj/Makefile16
-rw-r--r--diskdev_cmds/fsck.tproj/Makefile3
-rw-r--r--diskdev_cmds/fsck.tproj/fsck.c6
-rw-r--r--diskdev_cmds/fstyp.tproj/Makefile19
-rw-r--r--diskdev_cmds/fstyp.tproj/progs.mk1
-rw-r--r--diskdev_cmds/fuser.tproj/Makefile5
-rw-r--r--diskdev_cmds/mount.tproj/Makefile5
-rw-r--r--diskdev_cmds/mount_devfs.tproj/Makefile8
-rw-r--r--diskdev_cmds/mount_fdesc.tproj/Makefile8
-rw-r--r--diskdev_cmds/mount_flags_dir/mount_flags.c2
-rw-r--r--diskdev_cmds/quota.tproj/Makefile6
-rw-r--r--diskdev_cmds/quotacheck.tproj/Makefile9
-rw-r--r--diskdev_cmds/quotaon.tproj/Makefile8
-rw-r--r--diskdev_cmds/repquota.tproj/Makefile6
-rw-r--r--diskdev_cmds/setclass.tproj/Makefile6
-rw-r--r--diskdev_cmds/vndevice.tproj/Makefile6
-rw-r--r--diskdev_cmds/vsdbutil.tproj/Makefile12
-rw-r--r--diskdev_cmds/vsdbutil.tproj/vsdbutil_main.c4
-rw-r--r--doc_cmds/Makefile5
-rw-r--r--doc_cmds/Makefile.inc1
-rw-r--r--doc_cmds/checknr/Makefile3
-rw-r--r--doc_cmds/colcrt/Makefile3
-rw-r--r--doc_cmds/makewhatis/Makefile8
-rw-r--r--file_cmds/Makefile30
-rw-r--r--file_cmds/Makefile.inc1
-rw-r--r--file_cmds/chflags/Makefile5
-rw-r--r--file_cmds/chmod/Makefile7
-rw-r--r--file_cmds/chown/Makefile8
-rw-r--r--file_cmds/cksum/Makefile12
-rw-r--r--file_cmds/common/rpmatch.c57
-rw-r--r--file_cmds/compress/Makefile12
-rw-r--r--file_cmds/compress/compress.c4
-rw-r--r--file_cmds/cp/Makefile8
-rw-r--r--file_cmds/cp/cp.c4
-rw-r--r--file_cmds/cp/utils.c4
-rw-r--r--file_cmds/dd/Makefile6
-rw-r--r--file_cmds/df/Makefile3
-rw-r--r--file_cmds/du/Makefile3
-rw-r--r--file_cmds/gzip/Makefile17
-rw-r--r--file_cmds/install/Makefile9
-rw-r--r--file_cmds/install/xinstall.c16
-rw-r--r--file_cmds/ipcrm/Makefile3
-rw-r--r--file_cmds/ipcs/Makefile5
-rw-r--r--file_cmds/ipcs/ipcs.c12
-rw-r--r--file_cmds/ln/Makefile6
-rw-r--r--file_cmds/ls/Makefile10
-rw-r--r--file_cmds/ls/ls.c5
-rw-r--r--file_cmds/mkdir/Makefile5
-rw-r--r--file_cmds/mkfifo/Makefile3
-rw-r--r--file_cmds/mknod/Makefile6
-rw-r--r--file_cmds/mtree/Makefile22
-rw-r--r--file_cmds/mtree/commoncrypto.c4
-rw-r--r--file_cmds/mv/Makefile9
-rw-r--r--file_cmds/mv/mv.c6
-rw-r--r--file_cmds/pathchk/Makefile3
-rw-r--r--file_cmds/pax/Makefile25
-rw-r--r--file_cmds/pax/ar_io.c2
-rw-r--r--file_cmds/pax/extern.h2
-rw-r--r--file_cmds/pax/options.c2
-rw-r--r--file_cmds/rm/Makefile10
-rw-r--r--file_cmds/rm/rm.c4
-rw-r--r--file_cmds/rmdir/Makefile5
-rw-r--r--file_cmds/rmt/Makefile4
-rw-r--r--file_cmds/shar/Makefile4
-rw-r--r--file_cmds/stat/Makefile6
-rw-r--r--file_cmds/touch/Makefile3
l---------file_cmds/xinstall1
-rw-r--r--mail_cmds/Makefile10
-rw-r--r--mail_cmds/Makefile.inc1
-rw-r--r--mail_cmds/biff/Makefile11
-rw-r--r--mail_cmds/comsat/Makefile13
-rw-r--r--mail_cmds/from/Makefile11
-rw-r--r--mail_cmds/mail/Makefile39
-rw-r--r--mail_cmds/mail/popen.c2
-rw-r--r--mail_cmds/mail/send.c2
-rw-r--r--mail_cmds/msgs/Makefile12
-rw-r--r--misc_cmds/Makefile7
-rw-r--r--misc_cmds/Makefile.inc1
-rw-r--r--misc_cmds/calendar/Makefile12
-rw-r--r--misc_cmds/calendar/io.c2
-rw-r--r--misc_cmds/leave/Makefile3
-rw-r--r--misc_cmds/leave/leave.c1
-rw-r--r--misc_cmds/ncal/Makefile6
-rw-r--r--misc_cmds/ncal/ncal.c2
-rw-r--r--misc_cmds/tsort/Makefile3
-rw-r--r--misc_cmds/units/Makefile5
-rw-r--r--network_cmds/Makefile34
-rw-r--r--network_cmds/Makefile.inc3
-rw-r--r--network_cmds/arp.tproj/Makefile6
-rw-r--r--network_cmds/cfilutil/Makefile6
-rw-r--r--network_cmds/dnctl/Makefile8
-rw-r--r--network_cmds/dnctl/dnctl.c2
-rw-r--r--network_cmds/ecnprobe/Makefile26
-rw-r--r--network_cmds/frame_delay/Makefile6
-rw-r--r--network_cmds/ifconfig.tproj/Makefile18
-rw-r--r--network_cmds/ifconfig.tproj/if6lowpan.c2
-rw-r--r--network_cmds/ifconfig.tproj/ifbridge.c8
-rw-r--r--network_cmds/ifconfig.tproj/ifconfig.c30
-rw-r--r--network_cmds/ifconfig.tproj/ifmedia.c4
-rw-r--r--network_cmds/ifconfig.tproj/nexus.c5
-rw-r--r--network_cmds/ip6addrctl.tproj/Makefile6
-rw-r--r--network_cmds/kdumpd.tproj/Makefile7
-rw-r--r--network_cmds/mnc.tproj/Makefile7
-rw-r--r--network_cmds/mptcp_client/Makefile6
-rw-r--r--network_cmds/mtest.tproj/Makefile6
-rw-r--r--network_cmds/ndp.tproj/Makefile6
-rw-r--r--network_cmds/ndp.tproj/ndp.c2
-rw-r--r--network_cmds/netstat.tproj/Makefile8
-rw-r--r--network_cmds/ping.tproj/Makefile9
-rw-r--r--network_cmds/ping6.tproj/Makefile9
-rw-r--r--network_cmds/pktapctl/Makefile6
-rw-r--r--network_cmds/pktmnglr/Makefile7
-rw-r--r--network_cmds/rarpd.tproj/Makefile6
-rw-r--r--network_cmds/route.tproj/Makefile6
-rw-r--r--network_cmds/rtadvd.tproj/Makefile3
-rw-r--r--network_cmds/rtadvd.tproj/rtadvd_logging.c1
-rw-r--r--network_cmds/rtsol.tproj/Makefile8
-rw-r--r--network_cmds/spray.tproj/Makefile15
-rw-r--r--network_cmds/traceroute.tproj/Makefile8
-rw-r--r--network_cmds/traceroute6.tproj/Makefile6
-rw-r--r--patch_cmds/Makefile4
-rw-r--r--patch_cmds/Makefile.inc1
-rw-r--r--patch_cmds/diffstat/Makefile5
-rw-r--r--patch_cmds/diffstat/diffstat.c2
-rw-r--r--patch_cmds/patch/Makefile4
-rw-r--r--remote_cmds/Makefile16
-rw-r--r--remote_cmds/Makefile.inc1
-rw-r--r--remote_cmds/logger.tproj/Makefile12
-rw-r--r--remote_cmds/talk.tproj/Makefile18
-rw-r--r--remote_cmds/talkd.tproj/Makefile18
-rw-r--r--remote_cmds/telnet.tproj/Makefile26
-rw-r--r--remote_cmds/telnet.tproj/commands.c2
-rw-r--r--remote_cmds/telnet.tproj/telnet.c2
-rw-r--r--remote_cmds/telnetd.tproj/Makefile56
-rw-r--r--remote_cmds/telnetd.tproj/sys_term.c4
-rw-r--r--remote_cmds/tftp.tproj/Makefile14
-rw-r--r--remote_cmds/tftpd.tproj/Makefile19
-rw-r--r--remote_cmds/wall.tproj/Makefile18
-rwxr-xr-xsetup.sh223
-rw-r--r--shell_cmds/Makefile51
-rw-r--r--shell_cmds/Makefile.inc1
-rw-r--r--shell_cmds/alias/Makefile37
-rw-r--r--shell_cmds/apply/Makefile5
-rw-r--r--shell_cmds/apply/apply.c2
-rw-r--r--shell_cmds/basename/Makefile4
-rw-r--r--shell_cmds/chroot/Makefile8
-rw-r--r--shell_cmds/chroot/chroot.c2
-rw-r--r--shell_cmds/date/Makefile6
-rw-r--r--shell_cmds/dirname/Makefile4
-rw-r--r--shell_cmds/echo/Makefile5
-rw-r--r--shell_cmds/env/Makefile6
-rw-r--r--shell_cmds/env/env.c2
-rw-r--r--shell_cmds/expr/Makefile6
-rw-r--r--shell_cmds/false/Makefile3
-rw-r--r--shell_cmds/find/Makefile6
-rw-r--r--shell_cmds/find/function.c2
-rw-r--r--shell_cmds/find/misc.c4
-rw-r--r--shell_cmds/find/rpmatch.c57
-rw-r--r--shell_cmds/getopt/Makefile3
-rw-r--r--shell_cmds/hexdump/Makefile10
-rw-r--r--shell_cmds/hostname/Makefile5
-rw-r--r--shell_cmds/id/Makefile8
-rw-r--r--shell_cmds/jot/Makefile3
-rw-r--r--shell_cmds/kill/Makefile5
-rw-r--r--shell_cmds/killall/Makefile3
-rw-r--r--shell_cmds/lastcomm/Makefile3
-rw-r--r--shell_cmds/locate/Makefile3
-rw-r--r--shell_cmds/locate/Makefile.inc1
-rw-r--r--shell_cmds/locate/bigram/Makefile8
-rw-r--r--shell_cmds/locate/code/Makefile8
-rw-r--r--shell_cmds/locate/locate/Makefile17
-rw-r--r--shell_cmds/logname/Makefile3
-rw-r--r--shell_cmds/mktemp/Makefile3
-rw-r--r--shell_cmds/nice/Makefile5
-rw-r--r--shell_cmds/nice/nice.c2
-rw-r--r--shell_cmds/nohup/Makefile5
-rw-r--r--shell_cmds/nohup/nohup.c3
-rw-r--r--shell_cmds/path_helper/Makefile4
-rw-r--r--shell_cmds/printenv/Makefile3
-rw-r--r--shell_cmds/printf/Makefile3
-rw-r--r--shell_cmds/pwd/Makefile5
-rw-r--r--shell_cmds/renice/Makefile4
-rw-r--r--shell_cmds/script/Makefile5
-rw-r--r--shell_cmds/script/script.c2
-rw-r--r--shell_cmds/seq/Makefile3
-rw-r--r--shell_cmds/sh/Makefile24
-rw-r--r--shell_cmds/sh/exec.c2
-rw-r--r--shell_cmds/shlock/Makefile3
-rw-r--r--shell_cmds/sleep/Makefile5
-rw-r--r--shell_cmds/su/Makefile5
-rw-r--r--shell_cmds/su/su.c2
-rw-r--r--shell_cmds/systime/Makefile5
-rw-r--r--shell_cmds/systime/systime.c3
-rw-r--r--shell_cmds/tee/Makefile3
-rw-r--r--shell_cmds/test/Makefile8
-rw-r--r--shell_cmds/time/Makefile5
-rw-r--r--shell_cmds/time/time.c2
-rw-r--r--shell_cmds/true/Makefile3
-rw-r--r--shell_cmds/uname/Makefile3
-rw-r--r--shell_cmds/users/Makefile3
-rw-r--r--shell_cmds/w/Makefile6
-rw-r--r--shell_cmds/what/Makefile3
-rw-r--r--shell_cmds/whereis/Makefile3
-rw-r--r--shell_cmds/which/Makefile3
-rw-r--r--shell_cmds/who/Makefile6
-rw-r--r--shell_cmds/who/utmpentry.c4
-rw-r--r--shell_cmds/xargs/Makefile6
-rw-r--r--shell_cmds/xargs/strtonum.c68
-rw-r--r--shell_cmds/xargs/xargs.c4
-rw-r--r--shell_cmds/yes/Makefile3
-rw-r--r--system_cmds/Makefile52
-rw-r--r--system_cmds/Makefile.inc3
-rw-r--r--system_cmds/ac.tproj/Makefile6
-rw-r--r--system_cmds/accton.tproj/Makefile6
-rw-r--r--system_cmds/arch.tproj/Makefile7
-rw-r--r--system_cmds/arch.tproj/arch.c11
-rw-r--r--system_cmds/at.tproj/Makefile5
-rw-r--r--system_cmds/atrun.tproj/Makefile11
-rw-r--r--system_cmds/atrun.tproj/atrun.c2
-rw-r--r--system_cmds/chkpasswd.tproj/Makefile10
-rw-r--r--system_cmds/chkpasswd.tproj/passwd.c4
-rw-r--r--system_cmds/cpuctl.tproj/Makefile4
-rw-r--r--system_cmds/cpuctl.tproj/cpuctl.c1
-rw-r--r--system_cmds/dmesg.tproj/Makefile6
-rw-r--r--system_cmds/dynamic_pager.tproj/Makefile6
-rw-r--r--system_cmds/fs_usage.tproj/Makefile4
-rw-r--r--system_cmds/gcore.tproj/Makefile9
-rw-r--r--system_cmds/gcore.tproj/convert.c4
-rw-r--r--system_cmds/gcore.tproj/corefile.c1
-rw-r--r--system_cmds/gcore.tproj/dyld.c1
-rw-r--r--system_cmds/gcore.tproj/main.c1
-rw-r--r--system_cmds/gcore.tproj/sparse.c1
-rw-r--r--system_cmds/gcore.tproj/threads.c1
-rw-r--r--system_cmds/gcore.tproj/utils.c1
-rw-r--r--system_cmds/gcore.tproj/vanilla.c1
-rw-r--r--system_cmds/gcore.tproj/vm.c2
-rw-r--r--system_cmds/getconf.tproj/Makefile40
-rw-r--r--system_cmds/getconf.tproj/getconf.c2
-rw-r--r--system_cmds/getty.tproj/Makefile9
-rw-r--r--system_cmds/getty.tproj/main.c2
-rw-r--r--system_cmds/hostinfo.tproj/Makefile4
-rw-r--r--system_cmds/hostinfo.tproj/hostinfo.c1
-rw-r--r--system_cmds/iosim.tproj/Makefile8
-rw-r--r--system_cmds/iostat.tproj/Makefile8
-rw-r--r--system_cmds/kpgo.tproj/Makefile4
-rw-r--r--system_cmds/latency.tproj/Makefile5
-rw-r--r--system_cmds/latency.tproj/latency.c1
-rw-r--r--system_cmds/login.tproj/Makefile11
-rw-r--r--system_cmds/login.tproj/login.c2
-rw-r--r--system_cmds/lskq.tproj/Makefile3
-rw-r--r--system_cmds/lskq.tproj/common.h25
-rw-r--r--system_cmds/lskq.tproj/lskq.c9
-rw-r--r--system_cmds/lsmp.patch406
-rw-r--r--system_cmds/lsmp.tproj/Makefile6
-rw-r--r--system_cmds/lsmp.tproj/common.h15
-rw-r--r--system_cmds/lsmp.tproj/entitlements.plist4
-rw-r--r--system_cmds/lsmp.tproj/lsmp.c19
-rw-r--r--system_cmds/lsmp.tproj/port_details.c37
-rw-r--r--system_cmds/lsmp.tproj/task_details.c112
-rw-r--r--system_cmds/ltop.tproj/Makefile3
-rw-r--r--system_cmds/mean.tproj/Makefile4
-rw-r--r--system_cmds/mean.tproj/mean.c1
-rw-r--r--system_cmds/memory_pressure.tproj/Makefile3
-rw-r--r--system_cmds/memory_pressure.tproj/memory_pressure.c1
-rw-r--r--system_cmds/mkfile.tproj/Makefile6
-rw-r--r--system_cmds/mslutil/Makefile3
-rw-r--r--system_cmds/newgrp.tproj/Makefile5
-rw-r--r--system_cmds/newgrp.tproj/newgrp.c3
-rw-r--r--system_cmds/nologin.tproj/Makefile6
-rw-r--r--system_cmds/nvram.tproj/Makefile3
-rw-r--r--system_cmds/pagesize.tproj/Makefile4
-rw-r--r--system_cmds/passwd.tproj/Makefile8
-rw-r--r--system_cmds/passwd.tproj/passwd.c11
-rw-r--r--system_cmds/proc_uuid_policy.tproj/Makefile3
-rw-r--r--system_cmds/purge.tproj/Makefile6
-rw-r--r--system_cmds/pwd_mkdb.tproj/Makefile9
-rw-r--r--system_cmds/reboot.tproj/Makefile6
-rw-r--r--system_cmds/reboot.tproj/reboot.c3
-rw-r--r--system_cmds/sa.tproj/Makefile9
-rw-r--r--system_cmds/sc_usage.tproj/Makefile5
-rw-r--r--system_cmds/sc_usage.tproj/sc_usage.c2
-rw-r--r--system_cmds/shutdown.tproj/Makefile8
-rw-r--r--system_cmds/shutdown.tproj/shutdown.c17
-rw-r--r--system_cmds/stackshot.tproj/Makefile6
-rw-r--r--system_cmds/stackshot.tproj/stackshot.c2
-rw-r--r--system_cmds/sync.tproj/Makefile6
-rw-r--r--system_cmds/sysctl.tproj/Makefile6
-rw-r--r--system_cmds/taskpolicy.tproj/Makefile6
-rw-r--r--system_cmds/taskpolicy.tproj/taskpolicy.c1
-rw-r--r--system_cmds/trace.tproj/Makefile5
-rw-r--r--system_cmds/trace.tproj/trace.c1
-rw-r--r--system_cmds/vifs.tproj/Makefile8
-rw-r--r--system_cmds/vifs.tproj/vifs.c2
-rw-r--r--system_cmds/vipw.tproj/Makefile9
-rw-r--r--system_cmds/vipw.tproj/pw_util.c2
-rw-r--r--system_cmds/vm_purgeable_stat.tproj/Makefile3
-rw-r--r--system_cmds/vm_purgeable_stat.tproj/entitlements.plist2
-rw-r--r--system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c8
-rw-r--r--system_cmds/vm_stat.tproj/Makefile3
-rw-r--r--system_cmds/wait4path/Makefile5
-rw-r--r--system_cmds/wordexp-helper.tproj/Makefile4
-rw-r--r--system_cmds/zdump.tproj/Makefile6
-rw-r--r--system_cmds/zic.tproj/Makefile14
-rw-r--r--text_cmds/Makefile37
-rw-r--r--text_cmds/Makefile.inc1
-rw-r--r--text_cmds/banner/Makefile4
-rw-r--r--text_cmds/cat/Makefile5
-rw-r--r--text_cmds/col/Makefile3
-rw-r--r--text_cmds/colrm/Makefile3
-rw-r--r--text_cmds/column/Makefile3
-rw-r--r--text_cmds/comm/Makefile3
-rw-r--r--text_cmds/csplit/Makefile3
-rw-r--r--text_cmds/cut/Makefile3
-rw-r--r--text_cmds/ed/Makefile7
-rw-r--r--text_cmds/ee/Makefile34
-rw-r--r--text_cmds/ee/ee.c2
-rw-r--r--text_cmds/expand/Makefile4
-rw-r--r--text_cmds/fmt/Makefile3
-rw-r--r--text_cmds/fold/Makefile3
-rw-r--r--text_cmds/grep/Makefile21
-rw-r--r--text_cmds/head/Makefile3
-rw-r--r--text_cmds/join/Makefile3
-rw-r--r--text_cmds/lam/Makefile3
-rw-r--r--text_cmds/look/Makefile3
-rw-r--r--text_cmds/md5/Makefile28
-rw-r--r--text_cmds/nl/Makefile3
-rw-r--r--text_cmds/paste/Makefile3
-rw-r--r--text_cmds/pr/Makefile4
-rw-r--r--text_cmds/rev/Makefile3
-rw-r--r--text_cmds/rs/Makefile3
-rw-r--r--text_cmds/sed/Makefile7
-rw-r--r--text_cmds/sort/Makefile23
-rw-r--r--text_cmds/sort/coll.h2
-rw-r--r--text_cmds/split/Makefile3
-rw-r--r--text_cmds/tail/Makefile4
-rw-r--r--text_cmds/tr/Makefile4
-rw-r--r--text_cmds/tr/collate-fbsd.c158
-rw-r--r--text_cmds/tr/collate.h121
-rw-r--r--text_cmds/tr/setlocale.h42
-rw-r--r--text_cmds/tr/str.c4
-rw-r--r--text_cmds/tr/xlocale_private.h97
-rw-r--r--text_cmds/ul/Makefile5
-rw-r--r--text_cmds/unexpand/Makefile4
-rw-r--r--text_cmds/uniq/Makefile3
-rw-r--r--text_cmds/unvis/Makefile3
-rw-r--r--text_cmds/vis/Makefile4
-rw-r--r--text_cmds/wc/Makefile3
394 files changed, 3905 insertions, 395 deletions
diff --git a/.gitignore b/.gitignore
index df967b9..126f41d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,290 @@
base
+*.o
+*.[1-9].zst
+
+adv_cmds/cap_mkdb/cap_mkdb
+adv_cmds/colldef/colldef
+adv_cmds/colldef/parse.c
+adv_cmds/colldef/parse.h
+adv_cmds/colldef/scan.c
+adv_cmds/finger/finger
+adv_cmds/gencat/gencat
+adv_cmds/last/last
+adv_cmds/locale/locale
+adv_cmds/lsvfs/lsvfs
+adv_cmds/mklocale/lex.c
+adv_cmds/mklocale/mklocale
+adv_cmds/mklocale/yacc.c
+adv_cmds/mklocale/yacc.h
+adv_cmds/ps/ps
+adv_cmds/stty/stty
+adv_cmds/tabs/tabs
+adv_cmds/tty/tty
+adv_cmds/whois/whois
+basic_cmds/mesg/mesg
+basic_cmds/uudecode/uudecode
+basic_cmds/uuencode/uuencode
+basic_cmds/write/write
+bootstrap_cmds/migcom.tproj/lexxer.c
+bootstrap_cmds/migcom.tproj/migcom
+bootstrap_cmds/migcom.tproj/parser.c
+bootstrap_cmds/migcom.tproj/parser.h
+developer_cmds/asa/asa
+developer_cmds/ctags/ctags
+developer_cmds/rpcgen/rpcgen
+developer_cmds/unifdef/unifdef
+diskdev_cmds/dev_mkdb.tproj/dev_mkdb
+diskdev_cmds/edquota.tproj/edquota
+diskdev_cmds/fdisk.tproj/fdisk
+diskdev_cmds/fsck.tproj/fsck
+diskdev_cmds/fstyp.tproj/fstyp
+diskdev_cmds/fstyp.tproj/fstyp_msdos
+diskdev_cmds/fstyp.tproj/fstyp_ntfs
+diskdev_cmds/fstyp.tproj/fstyp_udf
+diskdev_cmds/mount_devfs.tproj/mount_devfs
+diskdev_cmds/mount_fdesc.tproj/mount_fdesc
+diskdev_cmds/quota.tproj/quota
+diskdev_cmds/quotacheck.tproj/quotacheck
+diskdev_cmds/quotaon.tproj/quotaon
+diskdev_cmds/repquota.tproj/repquota
+diskdev_cmds/setclass.tproj/setclass
+diskdev_cmds/vndevice.tproj/vndevice
+diskdev_cmds/vsdbutil.tproj/vsdbutil
+doc_cmds/checknr/checknr
+doc_cmds/colcrt/colcrt
+doc_cmds/makewhatis/makewhatis
+file_cmds/chflags/chflags
+file_cmds/chmod/chmod
+file_cmds/chown/chown
+file_cmds/cksum/cksum
+file_cmds/compress/compress
+file_cmds/cp/cp
+file_cmds/dd/dd
+file_cmds/df/df
+file_cmds/du/du
+file_cmds/gzip/gzip
+file_cmds/install/xinstall
+file_cmds/ipcrm/ipcrm
+file_cmds/ipcs/ipcs
+file_cmds/ln/ln
+file_cmds/ls/ls
+file_cmds/mkdir/mkdir
+file_cmds/mkfifo/mkfifo
+file_cmds/mknod/mknod
+file_cmds/mtree/mtree
+file_cmds/mv/mv
+file_cmds/pathchk/pathchk
+file_cmds/pax/pax
+file_cmds/rm/rm
+file_cmds/rmdir/rmdir
+file_cmds/rmt/rmt
+file_cmds/stat/stat
+file_cmds/touch/touch
+mail_cmds/biff/biff
+mail_cmds/comsat/comsat
+mail_cmds/from/from
+mail_cmds/mail/mail
+mail_cmds/msgs/msgs
+misc_cmds/calendar/calendar
+misc_cmds/leave/leave
+misc_cmds/ncal/ncal
+misc_cmds/tsort/tsort
+misc_cmds/units/units
+network_cmds/arp.tproj/arp
+network_cmds/cfilutil/cfilutil
+network_cmds/dnctl/dnctl
+network_cmds/ecnprobe/ecnprobe
+network_cmds/ecnprobe/grammar.c
+network_cmds/ecnprobe/grammar.h
+network_cmds/ecnprobe/scanner.c
+network_cmds/ecnprobe/scanner.h
+network_cmds/frame_delay/frame_delay
+network_cmds/ifconfig.tproj/ifconfig
+network_cmds/ip6addrctl.tproj/ip6addrctl
+network_cmds/kdumpd.tproj/kdumpd
+network_cmds/mnc.tproj/mnc
+network_cmds/mptcp_client/mptcp_client
+network_cmds/mtest.tproj/mtest
+network_cmds/ndp.tproj/ndp
+network_cmds/netstat.tproj/netstat
+network_cmds/ping.tproj/ping
+network_cmds/ping6.tproj/ping6
+network_cmds/pktapctl/pktapctl
+network_cmds/pktmnglr/pktmnglr
+network_cmds/rarpd.tproj/rarpd
+network_cmds/route.tproj/route
+network_cmds/rtadvd.tproj/rtadvd
+network_cmds/rtsol.tproj/rtsol
+network_cmds/spray.tproj/spray
+network_cmds/spray.tproj/spray.h
+network_cmds/spray.tproj/spray_xdr.c
+network_cmds/traceroute.tproj/traceroute
+network_cmds/traceroute6.tproj/traceroute6
+patch_cmds/diffstat/diffstat
+patch_cmds/patch/patch
+remote_cmds/logger.tproj/logger
+remote_cmds/talk.tproj/talk
+remote_cmds/talkd.tproj/talkd
+remote_cmds/telnet.tproj/telnet
+remote_cmds/telnetd.tproj/telnetd
+remote_cmds/tftp.tproj/tftp
+remote_cmds/tftpd.tproj/tftpd
+remote_cmds/wall.tproj/wall
+shell_cmds/apply/apply
+shell_cmds/basename/basename
+shell_cmds/chroot/chroot
+shell_cmds/date/date
+shell_cmds/dirname/dirname
+shell_cmds/echo/echo
+shell_cmds/env/env
+shell_cmds/expr/expr
+shell_cmds/expr/expr.c
+shell_cmds/expr/expr.h
+shell_cmds/false/false
+shell_cmds/find/find
+shell_cmds/find/getdate.c
+shell_cmds/find/getdate.h
+shell_cmds/getopt/getopt
+shell_cmds/hexdump/hexdump
+shell_cmds/hostname/hostname
+shell_cmds/id/id
+shell_cmds/jot/jot
+shell_cmds/kill/kill
+shell_cmds/killall/killall
+shell_cmds/lastcomm/lastcomm
+shell_cmds/locate/bigram/locate.bigram
+shell_cmds/locate/code/locate.code
+shell_cmds/locate/locate/locate
+shell_cmds/logname/logname
+shell_cmds/mktemp/mktemp
+shell_cmds/nice/nice
+shell_cmds/nohup/nohup
+shell_cmds/path_helper/path_helper
+shell_cmds/printenv/printenv
+shell_cmds/printf/printf
+shell_cmds/pwd/pwd
+shell_cmds/renice/renice
+shell_cmds/script/script
+shell_cmds/seq/seq
+shell_cmds/sh/builtins.c
+shell_cmds/sh/builtins.h
+shell_cmds/sh/mknodes
+shell_cmds/sh/mksyntax
+shell_cmds/sh/nodes.c
+shell_cmds/sh/nodes.h
+shell_cmds/sh/sh
+shell_cmds/sh/syntax.c
+shell_cmds/sh/syntax.h
+shell_cmds/sh/token.h
+shell_cmds/shlock/shlock
+shell_cmds/sleep/sleep
+shell_cmds/su/su
+shell_cmds/systime/systime
+shell_cmds/tee/tee
+shell_cmds/test/test
+shell_cmds/time/time
+shell_cmds/true/true
+shell_cmds/uname/uname
+shell_cmds/users/users
+shell_cmds/w/w
+shell_cmds/what/what
+shell_cmds/whereis/whereis
+shell_cmds/which/which
+shell_cmds/who/who
+shell_cmds/xargs/xargs
+shell_cmds/yes/yes
+system_cmds/ac.tproj/ac
+system_cmds/accton.tproj/accton
+system_cmds/arch.tproj/arch
+system_cmds/at.tproj/at
+system_cmds/atrun.tproj/atrun
+system_cmds/chkpasswd.tproj/chkpasswd
+system_cmds/cpuctl.tproj/cpuctl
+system_cmds/dmesg.tproj/dmesg
+system_cmds/dynamic_pager.tproj/dynamic_pager
+system_cmds/gcore.tproj/gcore
+system_cmds/getconf.tproj/conflicting.names
+system_cmds/getconf.tproj/confstr.c
+system_cmds/getconf.tproj/confstr.names
+system_cmds/getconf.tproj/getconf
+system_cmds/getconf.tproj/limits.c
+system_cmds/getconf.tproj/limits.names
+system_cmds/getconf.tproj/pathconf.c
+system_cmds/getconf.tproj/progenv.c
+system_cmds/getconf.tproj/sysconf.c
+system_cmds/getconf.tproj/sysconf.names
+system_cmds/getconf.tproj/unique.names
+system_cmds/getty.tproj/getty
+system_cmds/hostinfo.tproj/hostinfo
+system_cmds/iosim.tproj/iosim
+system_cmds/iostat.tproj/iostat
+system_cmds/kpgo.tproj/kpgo
+system_cmds/latency.tproj/latency
+system_cmds/login.tproj/login
+system_cmds/lskq.tproj/lskq
+system_cmds/lsmp.tproj/lsmp
+system_cmds/ltop.tproj/ltop
+system_cmds/mean.tproj/mean
+system_cmds/memory_pressure.tproj/memory_pressure
+system_cmds/mkfile.tproj/mkfile
+system_cmds/mslutil/mslutil
+system_cmds/newgrp.tproj/newgrp
+system_cmds/nologin.tproj/nologin
+system_cmds/nvram.tproj/nvram
+system_cmds/passwd.tproj/passwd
+system_cmds/proc_uuid_policy.tproj/proc_uuid_policy
+system_cmds/purge.tproj/purge
+system_cmds/pwd_mkdb.tproj/pwd_mkdb
+system_cmds/reboot.tproj/reboot
+system_cmds/sa.tproj/sa
+system_cmds/sc_usage.tproj/sc_usage
+system_cmds/shutdown.tproj/shutdown
+system_cmds/stackshot.tproj/stackshot
+system_cmds/sync.tproj/sync
+system_cmds/sysctl.tproj/sysctl
+system_cmds/taskpolicy.tproj/taskpolicy
+system_cmds/trace.tproj/trace
+system_cmds/vifs.tproj/vifs
+system_cmds/vipw.tproj/vipw
+system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat
+system_cmds/vm_stat.tproj/vm_stat
+system_cmds/wait4path/wait4path
+system_cmds/wordexp-helper.tproj/wordexp-helper
+system_cmds/zdump.tproj/zdump
+system_cmds/zic.tproj/zic
+text_cmds/banner/banner
+text_cmds/cat/cat
+text_cmds/col/col
+text_cmds/colrm/colrm
+text_cmds/column/column
+text_cmds/comm/comm
+text_cmds/csplit/csplit
+text_cmds/cut/cut
+text_cmds/ed/ed
+text_cmds/ee/ee
+text_cmds/expand/expand
+text_cmds/fmt/fmt
+text_cmds/fold/fold
+text_cmds/grep/grep
+text_cmds/head/head
+text_cmds/join/join
+text_cmds/lam/lam
+text_cmds/look/look
+text_cmds/md5/md5
+text_cmds/nl/nl
+text_cmds/paste/paste
+text_cmds/pr/pr
+text_cmds/rev/rev
+text_cmds/rs/rs
+text_cmds/sed/sed
+text_cmds/sort/sort
+text_cmds/sort/sort.1
+text_cmds/split/split
+text_cmds/tail/tail
+text_cmds/tr/tr
+text_cmds/ul/ul
+text_cmds/unexpand/unexpand
+text_cmds/uniq/uniq
+text_cmds/unvis/unvis
+text_cmds/vis/vis
+text_cmds/wc/wc
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6e27c7b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+SUBDIR= adv_cmds \
+ basic_cmds \
+ bootstrap_cmds \
+ developer_cmds \
+ diskdev_cmds \
+ doc_cmds \
+ file_cmds \
+ mail_cmds \
+ misc_cmds \
+ network_cmds \
+ patch_cmds \
+ remote_cmds \
+ shell_cmds \
+ system_cmds \
+ text_cmds
+
+.include <bsd.subdir.mk>
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 0000000..39af5e2
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,11 @@
+RPCGEN?=rpcgen
+STRIP=
+
+SHAREDIR=/usr/share/
+
+.if !defined(BINDIR)
+BINDIR=/usr/bin
+.endif
+
+COMPRESS_CMD?= zstd -c
+COMPRESS_EXT?= .zst
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4ec29e4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+# apple_cmds
+A WIP port of the macOS/FreeBSD userland for iOS using BSD make
+
+The latest version of each tool (except `netstat`) as been backported to compile for iOS 12.
+`lsmp` has been downgraded to a lower version due to incompatible changes.
diff --git a/adv_cmds/Makefile b/adv_cmds/Makefile
new file mode 100644
index 0000000..722516e
--- /dev/null
+++ b/adv_cmds/Makefile
@@ -0,0 +1,15 @@
+SUBDIR= gencat \
+ lsvfs \
+ ps \
+ whois \
+ cap_mkdb \
+ last \
+ stty \
+ colldef \
+ locale \
+ mklocale \
+ tabs \
+ finger \
+ tty
+
+.include <bsd.subdir.mk>
diff --git a/adv_cmds/Makefile.inc b/adv_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/adv_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/adv_cmds/cap_mkdb/Makefile b/adv_cmds/cap_mkdb/Makefile
new file mode 100644
index 0000000..4beb70d
--- /dev/null
+++ b/adv_cmds/cap_mkdb/Makefile
@@ -0,0 +1,3 @@
+PROG= cap_mkdb
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/colldef/Makefile b/adv_cmds/colldef/Makefile
new file mode 100644
index 0000000..fc11e68
--- /dev/null
+++ b/adv_cmds/colldef/Makefile
@@ -0,0 +1,9 @@
+PROG= colldef
+SRCS= parse.y \
+ scan.l
+
+LDADD+=-lfl
+
+CFLAGS+=-Ilocale
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/colldef/scan.l b/adv_cmds/colldef/scan.l
index ce14492..ee464f0 100644
--- a/adv_cmds/colldef/scan.l
+++ b/adv_cmds/colldef/scan.l
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD: src/usr.bin/colldef/scan.l,v 1.19 2002/08/23 04:18:26 ache E
#include <sys/types.h>
#include "collate.h"
#include "common.h"
-#include "y.tab.h"
+#include "parse.h"
int line_no = 1, save_no, fromsubs;
wchar_t buf0[BUFSIZE], *ptr;
diff --git a/adv_cmds/finger/Makefile b/adv_cmds/finger/Makefile
new file mode 100644
index 0000000..86b9d00
--- /dev/null
+++ b/adv_cmds/finger/Makefile
@@ -0,0 +1,8 @@
+PROG= finger
+SRCS= finger.c \
+ lprint.c \
+ net.c \
+ sprint.c \
+ util.c
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/gencat/Makefile b/adv_cmds/gencat/Makefile
new file mode 100644
index 0000000..c5df80c
--- /dev/null
+++ b/adv_cmds/gencat/Makefile
@@ -0,0 +1,5 @@
+PROG= gencat
+SRCS= gencat.c \
+ genlib.c
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/last/Makefile b/adv_cmds/last/Makefile
new file mode 100644
index 0000000..96e9737
--- /dev/null
+++ b/adv_cmds/last/Makefile
@@ -0,0 +1,3 @@
+PROG= last
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/locale/Makefile b/adv_cmds/locale/Makefile
new file mode 100644
index 0000000..535355b
--- /dev/null
+++ b/adv_cmds/locale/Makefile
@@ -0,0 +1,3 @@
+PROG_CXX= locale
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/lsvfs/Makefile b/adv_cmds/lsvfs/Makefile
new file mode 100644
index 0000000..70c8f64
--- /dev/null
+++ b/adv_cmds/lsvfs/Makefile
@@ -0,0 +1,3 @@
+PROG= lsvfs
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/mklocale/Makefile b/adv_cmds/mklocale/Makefile
new file mode 100644
index 0000000..132ce00
--- /dev/null
+++ b/adv_cmds/mklocale/Makefile
@@ -0,0 +1,5 @@
+PROG= mklocale
+SRCS= lex.l \
+ yacc.y
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/mklocale/lex.l b/adv_cmds/mklocale/lex.l
index 9ffbaca..0576f3b 100644
--- a/adv_cmds/mklocale/lex.l
+++ b/adv_cmds/mklocale/lex.l
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD: src/usr.bin/mklocale/lex.l,v 1.9 2005/02/26 21:47:54 ru Exp
#include <stdlib.h>
#include "ldef.h"
-#include "y.tab.h"
+#include "yacc.h"
#include "extern.h"
%}
diff --git a/adv_cmds/ps/Makefile b/adv_cmds/ps/Makefile
new file mode 100644
index 0000000..145ef7a
--- /dev/null
+++ b/adv_cmds/ps/Makefile
@@ -0,0 +1,3 @@
+MAN= ps.1
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/stty/Makefile b/adv_cmds/stty/Makefile
new file mode 100644
index 0000000..c8ec706
--- /dev/null
+++ b/adv_cmds/stty/Makefile
@@ -0,0 +1,7 @@
+PROG= stty
+SRCS= cchar.c gfmt.c key.c \
+ modes.c print.c stty.c util.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/tabs/Makefile b/adv_cmds/tabs/Makefile
new file mode 100644
index 0000000..2d7391e
--- /dev/null
+++ b/adv_cmds/tabs/Makefile
@@ -0,0 +1,5 @@
+PROG= tabs
+
+LDADD=-lncursesw
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/tty/Makefile b/adv_cmds/tty/Makefile
new file mode 100644
index 0000000..e0e4713
--- /dev/null
+++ b/adv_cmds/tty/Makefile
@@ -0,0 +1,3 @@
+PROG= tty
+
+.include <bsd.prog.mk>
diff --git a/adv_cmds/whois/Makefile b/adv_cmds/whois/Makefile
new file mode 100644
index 0000000..cd1ebf7
--- /dev/null
+++ b/adv_cmds/whois/Makefile
@@ -0,0 +1,3 @@
+PROG= whois
+
+.include <bsd.prog.mk>
diff --git a/basic_cmds/Makefile b/basic_cmds/Makefile
new file mode 100644
index 0000000..2ab0c2d
--- /dev/null
+++ b/basic_cmds/Makefile
@@ -0,0 +1,6 @@
+SUBDIR= mesg \
+ uudecode \
+ uuencode \
+ write
+
+.include <bsd.subdir.mk>
diff --git a/basic_cmds/Makefile.inc b/basic_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/basic_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/basic_cmds/mesg/Makefile b/basic_cmds/mesg/Makefile
new file mode 100644
index 0000000..02a02d8
--- /dev/null
+++ b/basic_cmds/mesg/Makefile
@@ -0,0 +1,3 @@
+PROG= mesg
+
+.include <bsd.prog.mk>
diff --git a/basic_cmds/uudecode/Makefile b/basic_cmds/uudecode/Makefile
new file mode 100644
index 0000000..e46ca33
--- /dev/null
+++ b/basic_cmds/uudecode/Makefile
@@ -0,0 +1,5 @@
+PROG= uudecode
+SRCS= uudecode.c \
+ base64.c
+
+.include <bsd.prog.mk>
diff --git a/basic_cmds/uuencode/Makefile b/basic_cmds/uuencode/Makefile
new file mode 100644
index 0000000..142478a
--- /dev/null
+++ b/basic_cmds/uuencode/Makefile
@@ -0,0 +1,6 @@
+PROG= uuencode
+MAN= uuencode.1 uuencode.5
+SRCS= uuencode.c \
+ base64.c
+
+.include <bsd.prog.mk>
diff --git a/basic_cmds/write/Makefile b/basic_cmds/write/Makefile
new file mode 100644
index 0000000..7dceec0
--- /dev/null
+++ b/basic_cmds/write/Makefile
@@ -0,0 +1,3 @@
+PROG= write
+
+.include <bsd.prog.mk>
diff --git a/bootstrap_cmds/Makefile b/bootstrap_cmds/Makefile
new file mode 100644
index 0000000..0b2a259
--- /dev/null
+++ b/bootstrap_cmds/Makefile
@@ -0,0 +1,3 @@
+SUBDIR= migcom.tproj
+
+.include <bsd.subdir.mk>
diff --git a/bootstrap_cmds/Makefile.inc b/bootstrap_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/bootstrap_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/bootstrap_cmds/migcom.tproj/Makefile b/bootstrap_cmds/migcom.tproj/Makefile
new file mode 100644
index 0000000..150a059
--- /dev/null
+++ b/bootstrap_cmds/migcom.tproj/Makefile
@@ -0,0 +1,24 @@
+PROG= migcom
+SRCS= error.c \
+ global.c \
+ header.c \
+ mig.c \
+ routine.c \
+ server.c \
+ statement.c \
+ string.c \
+ type.c \
+ user.c \
+ utils.c \
+ lexxer.l \
+ parser.y
+SCRIPTS= mig.sh
+
+VERSION!= cat ${.CURDIR}/../.apple_version
+
+CFLAGS+=-DMIG_VERSION=\"mig-${VERSION}\"
+
+BINDIR=/usr/libexec/
+SCRIPTSDIR=/usr/bin/
+
+.include <bsd.prog.mk>
diff --git a/bootstrap_cmds/migcom.tproj/lexxer.l b/bootstrap_cmds/migcom.tproj/lexxer.l
index 82b32e5..4a784c0 100644
--- a/bootstrap_cmds/migcom.tproj/lexxer.l
+++ b/bootstrap_cmds/migcom.tproj/lexxer.l
@@ -71,7 +71,7 @@ FileName ({QString}|{AString})
#include <mach/std_types.h>
#include "statement.h"
#include "global.h"
-#include "y.tab.h" // was parser.h
+#include "parser.h"
#include "lexxer.h"
#include "mig_machine.h"
diff --git a/create_tarballs.sh b/create_tarballs.sh
new file mode 100755
index 0000000..b14d267
--- /dev/null
+++ b/create_tarballs.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+if command -v bsdtar >/dev/null 2>&1; then
+ TAR="bsdtar"
+elif ! tar --version | grep "GNU" >/dev/null 2>&1; then
+ TAR="tar"
+else
+ echo "Install BSD tar"
+ exit 1
+fi
+
+num=0
+for i in adv_cmds basic_cmds bootstrap_cmds \
+ developer_cmds diskdev_cmds doc_cmds \
+ file_cmds mail_cmds misc_cmds network_cmds \
+ patch_cmds remote_cmds shell_cmds \
+ system_cmds text_cmds; do
+ EXTRA_PATHS=""
+ VERSION="$(cat ${i}/.apple_version)"
+ REGEX="|^${i}|${i}-${VERSION}|"
+ case "$i" in
+ network_cmds) REGEX="|^|network_cmds-${VERSION}/|" EXTRA_PATHS="lib/libpcap";;
+ remote_cmds) REGEX="|^|remote_cmds-${VERSION}/|" EXTRA_PATHS="lib/libtelnet";;
+ esac
+ num=$((num+1))
+ printf "(%i) %s\n" "$num" "$i"
+ cp setup.sh $i/setup.sh
+ cp $i/Makefile.inc $i.Makefile.inc
+ sed -i '' -e /\.\.\\/Makefile\.inc/d $i/Makefile.inc
+ cat Makefile.inc >> $i/Makefile.inc
+ ${TAR} -s ${REGEX} -caf ${i}-${VERSION}.tar.zst $i ${EXTRA_PATHS}
+ mv $i.Makefile.inc $i/Makefile.inc
+ rm $i/setup.sh
+done
diff --git a/developer_cmds/Makefile b/developer_cmds/Makefile
new file mode 100644
index 0000000..b5f3128
--- /dev/null
+++ b/developer_cmds/Makefile
@@ -0,0 +1,7 @@
+SUBDIR= asa \
+ ctags \
+ lorder \
+ rpcgen \
+ unifdef
+
+.include <bsd.subdir.mk>
diff --git a/developer_cmds/Makefile.inc b/developer_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/developer_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/developer_cmds/asa/Makefile b/developer_cmds/asa/Makefile
new file mode 100644
index 0000000..9ad92ce
--- /dev/null
+++ b/developer_cmds/asa/Makefile
@@ -0,0 +1,3 @@
+PROG= asa
+
+.include <bsd.prog.mk>
diff --git a/developer_cmds/ctags/Makefile b/developer_cmds/ctags/Makefile
new file mode 100644
index 0000000..eca51cd
--- /dev/null
+++ b/developer_cmds/ctags/Makefile
@@ -0,0 +1,10 @@
+PROG= ctags
+SRCS= C.c \
+ ctags.c \
+ fortran.c \
+ lisp.c \
+ print.c \
+ tree.c \
+ yacc.c
+
+.include <bsd.prog.mk>
diff --git a/developer_cmds/lorder/Makefile b/developer_cmds/lorder/Makefile
new file mode 100644
index 0000000..f07a7fc
--- /dev/null
+++ b/developer_cmds/lorder/Makefile
@@ -0,0 +1,3 @@
+SCRIPTS= lorder.sh
+
+.include <bsd.prog.mk>
diff --git a/developer_cmds/rpcgen/Makefile b/developer_cmds/rpcgen/Makefile
new file mode 100644
index 0000000..0d26ec2
--- /dev/null
+++ b/developer_cmds/rpcgen/Makefile
@@ -0,0 +1,15 @@
+PROG= rpcgen
+SRCS= rpc_clntout.c \
+ rpc_cout.c \
+ rpc_hout.c \
+ rpc_main.c \
+ rpc_parse.c \
+ rpc_sample.c \
+ rpc_scan.c \
+ rpc_svcout.c \
+ rpc_tblout.c \
+ rpc_util.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/developer_cmds/rpcgen/rpc_main.c b/developer_cmds/rpcgen/rpc_main.c
index a7a15a8..0a51984 100644
--- a/developer_cmds/rpcgen/rpc_main.c
+++ b/developer_cmds/rpcgen/rpc_main.c
@@ -61,6 +61,9 @@ __RCSID("$NetBSD: rpc_main.c,v 1.14 1997/10/18 10:53:53 lukem Exp $");
#include <sys/file.h>
#endif
#include <sys/stat.h>
+
+#include <libiosexec.h>
+
#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
diff --git a/developer_cmds/unifdef/Makefile b/developer_cmds/unifdef/Makefile
new file mode 100644
index 0000000..2a5448b
--- /dev/null
+++ b/developer_cmds/unifdef/Makefile
@@ -0,0 +1,4 @@
+PROG= unifdef
+SCRTIPS= unifdefall.sh
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/Makefile b/diskdev_cmds/Makefile
new file mode 100644
index 0000000..0ea0640
--- /dev/null
+++ b/diskdev_cmds/Makefile
@@ -0,0 +1,18 @@
+SUBDIR= dev_mkdb.tproj \
+ edquota.tproj \
+ fdisk.tproj \
+ fsck.tproj \
+ fstyp.tproj \
+ fuser.tproj \
+ mount_devfs.tproj \
+ mount_fdesc.tproj \
+ mount.tproj \
+ quota.tproj \
+ quotacheck.tproj \
+ quotaon.tproj \
+ repquota.tproj \
+ setclass.tproj \
+ vndevice.tproj \
+ vsdbutil.tproj
+
+.include <bsd.subdir.mk>
diff --git a/diskdev_cmds/Makefile.inc b/diskdev_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/diskdev_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/diskdev_cmds/dev_mkdb.tproj/Makefile b/diskdev_cmds/dev_mkdb.tproj/Makefile
new file mode 100644
index 0000000..141726f
--- /dev/null
+++ b/diskdev_cmds/dev_mkdb.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= dev_mkdb
+MAN= dev_mkdb.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/disklib/preen.c b/diskdev_cmds/disklib/preen.c
index f7128e0..34a10a4 100644
--- a/diskdev_cmds/disklib/preen.c
+++ b/diskdev_cmds/disklib/preen.c
@@ -66,7 +66,6 @@
#include <string.h>
#include <TargetConditionals.h>
-#if TARGET_OS_OSX
struct part {
struct part *next; /* forward link of partitions on disk */
char *name; /* device name */
@@ -387,6 +386,3 @@ rawname(name)
(void)strlcat(rawbuf, &dp[1], sizeof(rawbuf));
return (rawbuf);
}
-
-#endif /* TARGET_OS_OSX */
-
diff --git a/diskdev_cmds/edquota.tproj/Makefile b/diskdev_cmds/edquota.tproj/Makefile
new file mode 100644
index 0000000..87c954b
--- /dev/null
+++ b/diskdev_cmds/edquota.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= edquota
+MAN= edquota.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/edquota.tproj/edquota.c b/diskdev_cmds/edquota.tproj/edquota.c
index 6dad1cb..0071e76 100644
--- a/diskdev_cmds/edquota.tproj/edquota.c
+++ b/diskdev_cmds/edquota.tproj/edquota.c
@@ -96,6 +96,8 @@ __unused static char sccsid[] = "@(#)edquota.c 8.3 (Berkeley) 4/27/95";
#include <libkern/OSByteOrder.h>
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
char *qfname = QUOTAFILENAME;
char *qfextension[] = INITQFNAMES;
char *quotagroup = QUOTAGROUP;
diff --git a/diskdev_cmds/edt_fstab/edt_fstab.h b/diskdev_cmds/edt_fstab/edt_fstab.h
index 1fd4926..ef69480 100644
--- a/diskdev_cmds/edt_fstab/edt_fstab.h
+++ b/diskdev_cmds/edt_fstab/edt_fstab.h
@@ -29,8 +29,6 @@
#ifndef edt_fstab_h
#define edt_fstab_h
-#include <TargetConditionals.h>
-
#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
#define RAMDISK_FS_SPEC "ramdisk"
diff --git a/diskdev_cmds/fdisk.tproj/Makefile b/diskdev_cmds/fdisk.tproj/Makefile
new file mode 100644
index 0000000..a623892
--- /dev/null
+++ b/diskdev_cmds/fdisk.tproj/Makefile
@@ -0,0 +1,16 @@
+PROG= fdisk
+MAN= fdisk.8
+SRCS= auto.c \
+ cmd.c \
+ disk.c \
+ fdisk.c \
+ getrawpartition.c \
+ mbr.c \
+ misc.c \
+ opendev.c \
+ part.c \
+ user.c
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/fsck.tproj/Makefile b/diskdev_cmds/fsck.tproj/Makefile
new file mode 100644
index 0000000..3603f3a
--- /dev/null
+++ b/diskdev_cmds/fsck.tproj/Makefile
@@ -0,0 +1,3 @@
+MAN= fsck.8
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/fsck.tproj/fsck.c b/diskdev_cmds/fsck.tproj/fsck.c
index dc44e77..1b3dfee 100644
--- a/diskdev_cmds/fsck.tproj/fsck.c
+++ b/diskdev_cmds/fsck.tproj/fsck.c
@@ -72,7 +72,11 @@
#include <sys/time.h>
#include <signal.h>
-#include <TargetConditionals.h>
+/* libiosexec.h will include TargetConditionals.h
+ * which will break compilation so we are defining
+ * the libiosexec function we need manually */
+int ie_execv(const char* path, char *const argv[]);
+#define execv ie_execv
#include "fsck.h"
#include "../edt_fstab/edt_fstab.h"
diff --git a/diskdev_cmds/fstyp.tproj/Makefile b/diskdev_cmds/fstyp.tproj/Makefile
new file mode 100644
index 0000000..66f4830
--- /dev/null
+++ b/diskdev_cmds/fstyp.tproj/Makefile
@@ -0,0 +1,19 @@
+all:
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_msdos MAN=fstyp_msdos.8 all)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_ntfs MAN=fstyp_ntfs.8 all)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_udf MAN=fstyp_udf.8 all)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp MAN=fstyp.8 all)
+
+clean:
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_msdos MAN=fstyp_msdos.8 clean)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_ntfs MAN=fstyp_ntfs.8 clean)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_udf MAN=fstyp_udf.8 clean)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp MAN=fstyp.8 clean)
+
+install:
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_msdos MAN=fstyp_msdos.8 install)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_ntfs MAN=fstyp_ntfs.8 install)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp_udf MAN=fstyp_udf.8 install)
+ (${MAKE} ${.MAKEFLAGS} -f progs.mk PROG=fstyp MAN=fstyp.8 install)
+
+.PHONY: all clean install
diff --git a/diskdev_cmds/fstyp.tproj/progs.mk b/diskdev_cmds/fstyp.tproj/progs.mk
new file mode 100644
index 0000000..1fe9f5f
--- /dev/null
+++ b/diskdev_cmds/fstyp.tproj/progs.mk
@@ -0,0 +1 @@
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/fuser.tproj/Makefile b/diskdev_cmds/fuser.tproj/Makefile
new file mode 100644
index 0000000..19b1df9
--- /dev/null
+++ b/diskdev_cmds/fuser.tproj/Makefile
@@ -0,0 +1,5 @@
+SCRIPTS= fuser.pl
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/mount.tproj/Makefile b/diskdev_cmds/mount.tproj/Makefile
new file mode 100644
index 0000000..172c51d
--- /dev/null
+++ b/diskdev_cmds/mount.tproj/Makefile
@@ -0,0 +1,5 @@
+MAN= fstab.5
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/mount_devfs.tproj/Makefile b/diskdev_cmds/mount_devfs.tproj/Makefile
new file mode 100644
index 0000000..3f4c03c
--- /dev/null
+++ b/diskdev_cmds/mount_devfs.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= mount_devfs
+MAN=
+
+LDADD=-lutil
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/mount_fdesc.tproj/Makefile b/diskdev_cmds/mount_fdesc.tproj/Makefile
new file mode 100644
index 0000000..7ed9671
--- /dev/null
+++ b/diskdev_cmds/mount_fdesc.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= mount_fdesc
+MAN= mount_fdesc.8
+
+LDADD=-lutil
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/mount_flags_dir/mount_flags.c b/diskdev_cmds/mount_flags_dir/mount_flags.c
index 3707290..911095e 100644
--- a/diskdev_cmds/mount_flags_dir/mount_flags.c
+++ b/diskdev_cmds/mount_flags_dir/mount_flags.c
@@ -79,7 +79,9 @@ const mountopt_t optnames[] = {
{ MNT_DEFWRITE, "defwrite", NULL, },
{ MNT_IGNORE_OWNERSHIP, "noowners", "noowners", },
{ MNT_NOATIME, "noatime", "noatime", },
+#if defined(MNT_STRICTATIME)
{ MNT_STRICTATIME, "strictatime", "strictatime", },
+#endif
{ MNT_QUARANTINE, "quarantine", "quarantine", },
{ MNT_DONTBROWSE, "nobrowse", "nobrowse", },
{ MNT_CPROTECT, "protect", "protect", },
diff --git a/diskdev_cmds/quota.tproj/Makefile b/diskdev_cmds/quota.tproj/Makefile
new file mode 100644
index 0000000..ba137fe
--- /dev/null
+++ b/diskdev_cmds/quota.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= quota
+MAN= quota.1
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/quotacheck.tproj/Makefile b/diskdev_cmds/quotacheck.tproj/Makefile
new file mode 100644
index 0000000..b90f20e
--- /dev/null
+++ b/diskdev_cmds/quotacheck.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= quotacheck
+MAN= quotacheck.8
+SRCS= quotacheck.c hfs_quotacheck.c preen.c
+
+.PATH: ${.CURDIR}/../disklib
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/quotaon.tproj/Makefile b/diskdev_cmds/quotaon.tproj/Makefile
new file mode 100644
index 0000000..8cda80c
--- /dev/null
+++ b/diskdev_cmds/quotaon.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= quotaon
+LINKS= ${BINDIR}/quotaon ${BINDIR}/quotaoff
+MAN= quotaon.8
+MLINKS= quotaon.8 quotaoff.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/repquota.tproj/Makefile b/diskdev_cmds/repquota.tproj/Makefile
new file mode 100644
index 0000000..0cc629b
--- /dev/null
+++ b/diskdev_cmds/repquota.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= repquota
+MAN= repquota.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/setclass.tproj/Makefile b/diskdev_cmds/setclass.tproj/Makefile
new file mode 100644
index 0000000..e9b7c86
--- /dev/null
+++ b/diskdev_cmds/setclass.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= setclass
+MAN= setclass.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/vndevice.tproj/Makefile b/diskdev_cmds/vndevice.tproj/Makefile
new file mode 100644
index 0000000..740631d
--- /dev/null
+++ b/diskdev_cmds/vndevice.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= vndevice
+MAN=
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/vsdbutil.tproj/Makefile b/diskdev_cmds/vsdbutil.tproj/Makefile
new file mode 100644
index 0000000..621ce78
--- /dev/null
+++ b/diskdev_cmds/vsdbutil.tproj/Makefile
@@ -0,0 +1,12 @@
+PROG= vsdbutil
+MAN= vsdbutil.8
+SRCS= vsdbutil_main.c \
+ mount_flags.c
+
+.PATH: ${.CURDIR}/../mount_flags_dir
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/diskdev_cmds/vsdbutil.tproj/vsdbutil_main.c b/diskdev_cmds/vsdbutil.tproj/vsdbutil_main.c
index c9647fe..6dc2450 100644
--- a/diskdev_cmds/vsdbutil.tproj/vsdbutil_main.c
+++ b/diskdev_cmds/vsdbutil.tproj/vsdbutil_main.c
@@ -41,7 +41,7 @@
#include <sys/time.h>
#include <sys/ucred.h>
#include <sys/resource.h>
-#include <sys/vmmeter.h>
+// #include <sys/vmmeter.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
@@ -56,6 +56,8 @@
#include <uuid/uuid.h>
#include <System/uuid/namespace.h>
+#include <libiosexec.h>
+
// This flags array is shared with the mount(8) tool.
#include "../mount_flags_dir/mount_flags.h"
diff --git a/doc_cmds/Makefile b/doc_cmds/Makefile
new file mode 100644
index 0000000..ea362db
--- /dev/null
+++ b/doc_cmds/Makefile
@@ -0,0 +1,5 @@
+SUBDIR= checknr \
+ colcrt \
+ makewhatis
+
+.include <bsd.subdir.mk>
diff --git a/doc_cmds/Makefile.inc b/doc_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/doc_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/doc_cmds/checknr/Makefile b/doc_cmds/checknr/Makefile
new file mode 100644
index 0000000..b5cf5d3
--- /dev/null
+++ b/doc_cmds/checknr/Makefile
@@ -0,0 +1,3 @@
+PROG= checknr
+
+.include <bsd.prog.mk>
diff --git a/doc_cmds/colcrt/Makefile b/doc_cmds/colcrt/Makefile
new file mode 100644
index 0000000..923684c
--- /dev/null
+++ b/doc_cmds/colcrt/Makefile
@@ -0,0 +1,3 @@
+PROG= colcrt
+
+.include <bsd.prog.mk>
diff --git a/doc_cmds/makewhatis/Makefile b/doc_cmds/makewhatis/Makefile
new file mode 100644
index 0000000..af5e87e
--- /dev/null
+++ b/doc_cmds/makewhatis/Makefile
@@ -0,0 +1,8 @@
+PROG= makewhatis
+MAN= makewhatis.8 makewhatis.local.8
+SCRIPTS= makewhatis.local.sh
+SCRIPTSDIR=/usr/libexec/
+
+LDADD=-lz
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/Makefile b/file_cmds/Makefile
new file mode 100644
index 0000000..44e87bb
--- /dev/null
+++ b/file_cmds/Makefile
@@ -0,0 +1,30 @@
+SUBDIR= chflags \
+ chmod \
+ chown \
+ cksum \
+ compress \
+ cp \
+ dd \
+ df \
+ du \
+ gzip \
+ ipcrm \
+ ipcs \
+ ln \
+ ls \
+ mkdir \
+ mkfifo \
+ mknod \
+ mtree \
+ mv \
+ pathchk \
+ pax \
+ rm \
+ rmdir \
+ rmt \
+ shar \
+ stat \
+ touch \
+ xinstall
+
+.include <bsd.subdir.mk>
diff --git a/file_cmds/Makefile.inc b/file_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/file_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/file_cmds/chflags/Makefile b/file_cmds/chflags/Makefile
new file mode 100644
index 0000000..a734b6e
--- /dev/null
+++ b/file_cmds/chflags/Makefile
@@ -0,0 +1,5 @@
+PROG= chflags
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/chmod/Makefile b/file_cmds/chmod/Makefile
new file mode 100644
index 0000000..0815c98
--- /dev/null
+++ b/file_cmds/chmod/Makefile
@@ -0,0 +1,7 @@
+PROG= chmod
+SRCS= chmod.c \
+ chmod_acl.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/chown/Makefile b/file_cmds/chown/Makefile
new file mode 100644
index 0000000..be9d786
--- /dev/null
+++ b/file_cmds/chown/Makefile
@@ -0,0 +1,8 @@
+PROG= chown
+MAN= chown.8 chgrp.1
+
+BINDIR=/usr/sbin
+
+LINKS= ${BINDIR}/chown /usr/bin/chgrp
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/cksum/Makefile b/file_cmds/cksum/Makefile
new file mode 100644
index 0000000..be8950d
--- /dev/null
+++ b/file_cmds/cksum/Makefile
@@ -0,0 +1,12 @@
+PROG= cksum
+MAN= cksum.1 sum.1
+SRCS= cksum.c \
+ crc.c \
+ crc32.c \
+ print.c \
+ sum1.c \
+ sum2.c
+
+LINKS+= ${BINDIR}/cksum ${BINDIR}/sum
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/common/rpmatch.c b/file_cmds/common/rpmatch.c
new file mode 100644
index 0000000..e4c366a
--- /dev/null
+++ b/file_cmds/common/rpmatch.c
@@ -0,0 +1,57 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2004-2005 Tim J. Robbins.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <langinfo.h>
+#include <regex.h>
+#include <stdlib.h>
+
+int
+rpmatch(const char *response)
+{
+ regex_t yes, no;
+ int ret;
+
+ if (regcomp(&yes, nl_langinfo(YESEXPR), REG_EXTENDED|REG_NOSUB) != 0)
+ return (-1);
+ if (regcomp(&no, nl_langinfo(NOEXPR), REG_EXTENDED|REG_NOSUB) != 0) {
+ regfree(&yes);
+ return (-1);
+ }
+ if (regexec(&yes, response, 0, NULL, 0) == 0)
+ ret = 1;
+ else if (regexec(&no, response, 0, NULL, 0) == 0)
+ ret = 0;
+ else
+ ret = -1;
+ regfree(&yes);
+ regfree(&no);
+ return (ret);
+}
diff --git a/file_cmds/compress/Makefile b/file_cmds/compress/Makefile
new file mode 100644
index 0000000..9f151da
--- /dev/null
+++ b/file_cmds/compress/Makefile
@@ -0,0 +1,12 @@
+PROG= compress
+MAN= compress.1 uncompress.1 zopen.3
+SRCS= compress.c zopen.c
+SCRIPTS= zcat.sh
+
+BINDIR=/usr/bin
+
+LINKS+= ${BINDIR}/compress ${BINDIR}/uncompress
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/compress/compress.c b/file_cmds/compress/compress.c
index 97c70f2..ba05189 100644
--- a/file_cmds/compress/compress.c
+++ b/file_cmds/compress/compress.c
@@ -59,6 +59,10 @@ __FBSDID("$FreeBSD: src/usr.bin/compress/compress.c,v 1.23 2010/12/11 08:32:16 j
#include "zopen.h"
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "rpmatch.c"
+#endif
+
void compress(const char *, const char *, int);
void cwarn(const char *, ...) __printflike(1, 2);
void cwarnx(const char *, ...) __printflike(1, 2);
diff --git a/file_cmds/cp/Makefile b/file_cmds/cp/Makefile
new file mode 100644
index 0000000..29e1063
--- /dev/null
+++ b/file_cmds/cp/Makefile
@@ -0,0 +1,8 @@
+PROG= cp
+SRCS= cp.c utils.c
+
+BINDIR=/bin
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/cp/cp.c b/file_cmds/cp/cp.c
index c856fd9..4db6c81 100644
--- a/file_cmds/cp/cp.c
+++ b/file_cmds/cp/cp.c
@@ -81,6 +81,10 @@ __FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.52 2005/09/05 04:36:08 csjp Exp $");
#include "extern.h"
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "rpmatch.c"
+#endif
+
#define STRIP_TRAILING_SLASH(p) { \
while ((p).p_end > (p).p_path + 1 && (p).p_end[-1] == '/') \
*--(p).p_end = 0; \
diff --git a/file_cmds/cp/utils.c b/file_cmds/cp/utils.c
index feecc0c..6332956 100644
--- a/file_cmds/cp/utils.c
+++ b/file_cmds/cp/utils.c
@@ -66,6 +66,10 @@ __FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.46 2005/09/05 04:36:08 csjp Exp $");
#define COMPAT_MODE(a,b) (1)
#endif /* __APPLE__ */
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+int rpmatch(const char *);
+#endif
+
#include "extern.h"
#define cp_pct(x,y) (int)(100.0 * (double)(x) / (double)(y))
diff --git a/file_cmds/dd/Makefile b/file_cmds/dd/Makefile
new file mode 100644
index 0000000..72f3c3a
--- /dev/null
+++ b/file_cmds/dd/Makefile
@@ -0,0 +1,6 @@
+PROG= dd
+SRCS= args.c conv_tab.c conv.c dd.c misc.c position.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/df/Makefile b/file_cmds/df/Makefile
new file mode 100644
index 0000000..99a7194
--- /dev/null
+++ b/file_cmds/df/Makefile
@@ -0,0 +1,3 @@
+MAN= df.1
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/du/Makefile b/file_cmds/du/Makefile
new file mode 100644
index 0000000..ab61aa3
--- /dev/null
+++ b/file_cmds/du/Makefile
@@ -0,0 +1,3 @@
+PROG= du
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/gzip/Makefile b/file_cmds/gzip/Makefile
new file mode 100644
index 0000000..8250e3e
--- /dev/null
+++ b/file_cmds/gzip/Makefile
@@ -0,0 +1,17 @@
+PROG= gzip
+SRCS= futimens.c \
+ gzip.c
+MAN= gzexe.1 gzip.1 zdiff.1 zforce.1 zmore.1 znew.1
+SCRIPTS= gzexe \
+ gzip \
+ zdiff \
+ zforce \
+ zmore \
+ znew
+
+CFLAGS+=-DGZIP_APPLE_VERSION=\"321.40.3\"
+LDADD=-llzma -lz -lbz2
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/install/Makefile b/file_cmds/install/Makefile
new file mode 100644
index 0000000..3116d07
--- /dev/null
+++ b/file_cmds/install/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= xinstall
+PROGNAME= install
+SRCS= xinstall.c
+MAN= install.1
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/install/xinstall.c b/file_cmds/install/xinstall.c
index 5e6bcec..49934aa 100644
--- a/file_cmds/install/xinstall.c
+++ b/file_cmds/install/xinstall.c
@@ -721,21 +721,29 @@ void
strip(to_name)
char *to_name;
{
+ const char *stripbin;
+ const char *args[3];
pid_t pid;
int error;
extern char** environ;
- char *const argv[] = { "xcrun", "strip", "-", to_name, NULL };
+
+ stripbin = getenv("STRIPBIN");
+ if (stripbin == NULL)
+ stripbin = "strip";
+ args[0] = stripbin;
+ args[1] = to_name;
+ args[2] = NULL;
- if (0 == (error = posix_spawnp(&pid, "xcrun", NULL, NULL, argv, environ))) {
+ if (0 == (error = posix_spawnp(&pid, stripbin, NULL, NULL, (char**)args, environ))) {
int status = 0;
pid_t child = waitpid(pid, &status, 0);
if ((child == -1) || status) {
unlink(to_name);
- errx(EX_SOFTWARE, "child process failed: xcrun strip - %s", to_name);
+ errx(EX_SOFTWARE, "child process failed: %p", args);
}
} else {
errno = error;
- err(EX_OSERR, "xcrun strip - %s", to_name);
+ err(EX_OSERR, "%p", args);
}
}
diff --git a/file_cmds/ipcrm/Makefile b/file_cmds/ipcrm/Makefile
new file mode 100644
index 0000000..c3dc182
--- /dev/null
+++ b/file_cmds/ipcrm/Makefile
@@ -0,0 +1,3 @@
+PROG= ipcrm
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/ipcs/Makefile b/file_cmds/ipcs/Makefile
new file mode 100644
index 0000000..1d79542
--- /dev/null
+++ b/file_cmds/ipcs/Makefile
@@ -0,0 +1,5 @@
+PROG= ipcs
+
+CFLAGS+=-Duser32_time_t=user_time_t -Duser32_addr_t=user_addr_t -Duser64_time_t=user_time_t
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/ipcs/ipcs.c b/file_cmds/ipcs/ipcs.c
index 986b229..8ee4e0e 100644
--- a/file_cmds/ipcs/ipcs.c
+++ b/file_cmds/ipcs/ipcs.c
@@ -42,19 +42,19 @@
#include <unistd.h>
#include <sysexits.h>
-#include "sys/types.h"
+#include <sys/types.h>
#include <sys/ucred.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <errno.h>
-#include "sys/ipcs.h"
+#include <sys/ipcs.h>
#define KERNEL 1 /* To get new ipc_perm and __(sem|shm|msg)ds_new */
-#include "sys/ipc.h"
-#include "sys/sem_internal.h"
-#include "sys/shm_internal.h"
-#include "sys/msg.h"
+#include <sys/ipc.h>
+#include <sys/sem_internal.h>
+#include <sys/shm_internal.h>
+#include <sys/msg.h>
/* The following is a kludge, until the problem of multiple inclusions
diff --git a/file_cmds/ln/Makefile b/file_cmds/ln/Makefile
new file mode 100644
index 0000000..db89bfa
--- /dev/null
+++ b/file_cmds/ln/Makefile
@@ -0,0 +1,6 @@
+PROG= ln
+MAN= link.1 ln.1 symlink.7
+BINDIR=/bin
+LINKS= ${BINDIR}/ln ${BINDIR}/link
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/ls/Makefile b/file_cmds/ls/Makefile
new file mode 100644
index 0000000..2872cbe
--- /dev/null
+++ b/file_cmds/ls/Makefile
@@ -0,0 +1,10 @@
+PROG= ls
+SRCS= cmp.c ls.c print.c util.c
+
+CFLAGS+=-DCOLORLS
+
+LDADD=-lutil -lncursesw
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/ls/ls.c b/file_cmds/ls/ls.c
index e079333..0a6b1a0 100644
--- a/file_cmds/ls/ls.c
+++ b/file_cmds/ls/ls.c
@@ -75,7 +75,6 @@ __RCSID("$FreeBSD: src/bin/ls/ls.c,v 1.66 2002/09/21 01:28:36 wollman Exp $");
#include <sys/param.h>
#include <get_compat.h>
#include <sys/sysctl.h>
-#include <System/sys/fsctl.h>
#else
#define COMPAT_MODE(a,b) (1)
#endif /* __APPLE__ */
@@ -562,10 +561,12 @@ traverse(int argc, char *argv[], int options)
break;
}
+#ifdef SF_DATALESS
if (IS_DATALESS(p->fts_statp)) {
fts_set(ftsp, p, FTS_SKIP);
break;
}
+#endif
/*
* If already output something, put out a newline as
@@ -858,9 +859,11 @@ display(FTSENT *p, FTSENT *list)
} else {
np->mode_suffix = ' ';
}
+#ifdef SF_DATALESS
if (IS_DATALESS(sp)) {
np->mode_suffix = '%';
}
+#endif
if (!f_acl) {
acl_free(np->acl);
np->acl = NULL;
diff --git a/file_cmds/mkdir/Makefile b/file_cmds/mkdir/Makefile
new file mode 100644
index 0000000..ea70b14
--- /dev/null
+++ b/file_cmds/mkdir/Makefile
@@ -0,0 +1,5 @@
+PROG= mkdir
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/mkfifo/Makefile b/file_cmds/mkfifo/Makefile
new file mode 100644
index 0000000..aa19b2a
--- /dev/null
+++ b/file_cmds/mkfifo/Makefile
@@ -0,0 +1,3 @@
+PROG= mkfifo
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/mknod/Makefile b/file_cmds/mknod/Makefile
new file mode 100644
index 0000000..04efea7
--- /dev/null
+++ b/file_cmds/mknod/Makefile
@@ -0,0 +1,6 @@
+PROG= mknod
+MAN= mknod.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/mtree/Makefile b/file_cmds/mtree/Makefile
new file mode 100644
index 0000000..177c7e8
--- /dev/null
+++ b/file_cmds/mtree/Makefile
@@ -0,0 +1,22 @@
+PROG= mtree
+MAN= mtree.8
+SRCS= commoncrypto.c \
+ compare.c \
+ create.c \
+ excludes.c \
+ metrics.c \
+ misc.c \
+ mtree.c \
+ spec.c \
+ specspec.c \
+ verify.c \
+ crc.c
+
+.PATH: ${.CURDIR}/../cksum
+
+CFLAGS+=-DENABLE_MD5 -DENABLE_RMD160 -DENABLE_SHA1 -DENABLE_SHA256
+LDADD=-framework CoreFoundation
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/mtree/commoncrypto.c b/file_cmds/mtree/commoncrypto.c
index 0ac621c..fd4258e 100644
--- a/file_cmds/mtree/commoncrypto.c
+++ b/file_cmds/mtree/commoncrypto.c
@@ -12,7 +12,7 @@
#include <unistd.h>
#include <sys/xattr.h>
#include <sys/mount.h>
-#include <apfs/apfs_fsctl.h>
+//#include <apfs/apfs_fsctl.h>
#include "commoncrypto.h"
#include "extern.h"
@@ -256,6 +256,7 @@ get_xdstream_privateid(char *path, char *buf) {
nextName += strlen(name) + 1;
}
+#ifdef APFSIOC_XDSTREAM_OBJ_ID
for (int i = 0; i < xattrIndex; i++) {
char *name = xattrs[i];
// System volume has stream based xattrs only in form of resource forks
@@ -277,6 +278,7 @@ get_xdstream_privateid(char *path, char *buf) {
}
}
}
+#endif
ai->xdstream_priv_id = xd_obj_id;
// insert a dummy value as digest is not used in presence of mflag
diff --git a/file_cmds/mv/Makefile b/file_cmds/mv/Makefile
new file mode 100644
index 0000000..dbf5b3d
--- /dev/null
+++ b/file_cmds/mv/Makefile
@@ -0,0 +1,9 @@
+PROG= mv
+
+LDADD+=-liosexec
+
+BINDIR=/bin
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/mv/mv.c b/file_cmds/mv/mv.c
index 52a2938..17ef1e0 100644
--- a/file_cmds/mv/mv.c
+++ b/file_cmds/mv/mv.c
@@ -80,8 +80,14 @@ __RCSID("$FreeBSD: src/bin/mv/mv.c,v 1.39 2002/07/09 17:45:13 johan Exp $");
#define COMPAT_MODE(a,b) (1)
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
#include "pathnames.h"
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "rpmatch.c"
+#endif
+
int fflg, iflg, nflg, vflg;
int copy(char *, char *);
diff --git a/file_cmds/pathchk/Makefile b/file_cmds/pathchk/Makefile
new file mode 100644
index 0000000..a3ea46c
--- /dev/null
+++ b/file_cmds/pathchk/Makefile
@@ -0,0 +1,3 @@
+PROG= pathchk
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/pax/Makefile b/file_cmds/pax/Makefile
new file mode 100644
index 0000000..1ea323c
--- /dev/null
+++ b/file_cmds/pax/Makefile
@@ -0,0 +1,25 @@
+PROG= pax
+MAN= cpio.1 pax.1
+SRCS= ar_io.c \
+ ar_subs.c \
+ buf_subs.c \
+ cache.c \
+ cpio.c \
+ file_subs.c \
+ ftree.c \
+ gen_subs.c \
+ getoldopt.c \
+ options.c \
+ pat_rep.c \
+ pax_format.c \
+ pax.c \
+ sel_subs.c \
+ tables.c \
+ tar.c \
+ tty_subs.c
+
+LDADD+=-liosexec
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/pax/ar_io.c b/file_cmds/pax/ar_io.c
index 1c4b943..6ed3e83 100644
--- a/file_cmds/pax/ar_io.c
+++ b/file_cmds/pax/ar_io.c
@@ -65,6 +65,8 @@ __used static const char rcsid[] = "$OpenBSD: ar_io.c,v 1.38 2008/06/11 00:49:08
#include "options.h"
#include "extern.h"
+#include <libiosexec.h>
+
/*
* Routines which deal directly with the archive I/O device/file.
*/
diff --git a/file_cmds/pax/extern.h b/file_cmds/pax/extern.h
index 16d3195..d2823de 100644
--- a/file_cmds/pax/extern.h
+++ b/file_cmds/pax/extern.h
@@ -203,7 +203,7 @@ int opt_add(const char *);
int bad_opt(void);
int pax_format_opt_add(char *);
int pax_opt(void);
-char *chdname;
+extern char *chdname;
/*
* pat_rep.c
diff --git a/file_cmds/pax/options.c b/file_cmds/pax/options.c
index 0544e5e..2d968bd 100644
--- a/file_cmds/pax/options.c
+++ b/file_cmds/pax/options.c
@@ -65,6 +65,8 @@ __used static const char rcsid[] = "$OpenBSD: options.c,v 1.70 2008/06/11 00:49:
#include "tar.h"
#include "extern.h"
+char *chdname;
+
/*
* Routines which handle command line options
*/
diff --git a/file_cmds/rm/Makefile b/file_cmds/rm/Makefile
new file mode 100644
index 0000000..7a721c1
--- /dev/null
+++ b/file_cmds/rm/Makefile
@@ -0,0 +1,10 @@
+PROG= rm
+MAN= rm.1 unlink.1
+
+BINDIR=/bin
+
+LINKS+= ${BINDIR}/rm ${BINDIR}/unlink
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/rm/rm.c b/file_cmds/rm/rm.c
index ef457c5..389df6e 100644
--- a/file_cmds/rm/rm.c
+++ b/file_cmds/rm/rm.c
@@ -75,6 +75,10 @@ __used static const char rcsid[] =
#define COMPAT_MODE(func, mode) 1
#endif
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "rpmatch.c"
+#endif
+
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
uid_t uid;
diff --git a/file_cmds/rmdir/Makefile b/file_cmds/rmdir/Makefile
new file mode 100644
index 0000000..e54393e
--- /dev/null
+++ b/file_cmds/rmdir/Makefile
@@ -0,0 +1,5 @@
+PROG= rmdir
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/rmt/Makefile b/file_cmds/rmt/Makefile
new file mode 100644
index 0000000..1e515ee
--- /dev/null
+++ b/file_cmds/rmt/Makefile
@@ -0,0 +1,4 @@
+PROG= rmt
+MAN= rmt.8
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/shar/Makefile b/file_cmds/shar/Makefile
new file mode 100644
index 0000000..261ee43
--- /dev/null
+++ b/file_cmds/shar/Makefile
@@ -0,0 +1,4 @@
+SCRIPTS= shar.sh
+MAN= shar.1
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/stat/Makefile b/file_cmds/stat/Makefile
new file mode 100644
index 0000000..28b769e
--- /dev/null
+++ b/file_cmds/stat/Makefile
@@ -0,0 +1,6 @@
+PROG= stat
+MAN= readlink.1 stat.1
+
+LINKS+= ${BINDIR}/stat ${BINDIR}/readlink
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/touch/Makefile b/file_cmds/touch/Makefile
new file mode 100644
index 0000000..fcb8859
--- /dev/null
+++ b/file_cmds/touch/Makefile
@@ -0,0 +1,3 @@
+PROG= touch
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/xinstall b/file_cmds/xinstall
new file mode 120000
index 0000000..f7ffc47
--- /dev/null
+++ b/file_cmds/xinstall
@@ -0,0 +1 @@
+install \ No newline at end of file
diff --git a/mail_cmds/Makefile b/mail_cmds/Makefile
index 127d0a7..d7ac950 100644
--- a/mail_cmds/Makefile
+++ b/mail_cmds/Makefile
@@ -1,5 +1,7 @@
-Project = mail_cmds
+SUBDIR= biff \
+ comsat \
+ from \
+ mail \
+ msgs
-SubProjects = biff comsat from mail msgs
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.subdir.mk>
diff --git a/mail_cmds/Makefile.inc b/mail_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/mail_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/mail_cmds/biff/Makefile b/mail_cmds/biff/Makefile
index 2672505..6ba1615 100644
--- a/mail_cmds/biff/Makefile
+++ b/mail_cmds/biff/Makefile
@@ -1,10 +1,3 @@
-Project = biff
-Install_Dir = /usr/bin
+PROG= biff
-CFILES = biff.c
-MANPAGES = biff.1
-
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_LD_Flags = -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/mail_cmds/comsat/Makefile b/mail_cmds/comsat/Makefile
index fd52e66..3f349ab 100644
--- a/mail_cmds/comsat/Makefile
+++ b/mail_cmds/comsat/Makefile
@@ -1,11 +1,4 @@
-Project = comsat
-Install_Dir = /usr/libexec
+PROG= comsat
+MAN= comsat.8
-CFILES = comsat.c
-MANPAGES = comsat.8
-LAUNCHD_PLISTS = comsat.plist
-
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_LD_Flags = -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/mail_cmds/from/Makefile b/mail_cmds/from/Makefile
index b0c5bd7..c27be3f 100644
--- a/mail_cmds/from/Makefile
+++ b/mail_cmds/from/Makefile
@@ -1,10 +1,3 @@
-Project = from
-Install_Dir = /usr/bin
+PROG= from
-CFILES = from.c
-MANPAGES = from.1
-
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_LD_Flags = -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/mail_cmds/mail/Makefile b/mail_cmds/mail/Makefile
index bd82ec4..c516dff 100644
--- a/mail_cmds/mail/Makefile
+++ b/mail_cmds/mail/Makefile
@@ -1,24 +1,25 @@
-Project = mail
-Install_Dir = /usr/bin
+# @(#)Makefile 8.2 (Berkeley) 1/25/94
+# $FreeBSD$
-CFILES = aux.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c \
- edit.c fio.c getname.c head.c lex.c list.c main.c names.c\
- popen.c quit.c send.c strings.c temp.c tty.c v7.local.c\
- vars.c version.c
-MANPAGES = mail.1 mailx.1
+CONFS= misc/mail.rc
+PROG= mail
+SRCS= aux.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c \
+ edit.c fio.c getname.c head.c lex.c list.c main.c names.c\
+ popen.c quit.c send.c strings.c temp.c tty.c v7.local.c\
+ vars.c version.c
+FILES= mail.help mail.tildehelp
+FILESDIR= ${SHAREDIR}/misc
+EFILES= mail.rc
+LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx
+MAN= mail.1 mailx.1
+MLINKS= mail.1 Mail.1
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_LD_Flags = -dead_strip
+LDADD+=-liosexec
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.PATH: ${.CURDIR}/misc
-ETCDIR=$(DSTROOT)/private/etc
-MISCDIR=$(DSTROOT)/usr/share/misc
+etc-mailrc:
+ cd ${.CURDIR}/misc; ${INSTALL} -o root -g wheel \
+ -m 644 ${EFILES} ${DESTDIR}/private/etc
-after_install:
- $(INSTALL_DIRECTORY) $(MISCDIR)
- $(INSTALL_FILE) -c misc/mail.help misc/mail.tildehelp $(MISCDIR)
- $(INSTALL_DIRECTORY) $(ETCDIR)
- $(INSTALL_FILE) -c -m 644 misc/mail.rc $(ETCDIR)/mail.rc
- $(LN) -f $(DSTROOT)$(Install_Dir)/mail \
- $(DSTROOT)$(Install_Dir)/mailx
+.include <bsd.prog.mk>
diff --git a/mail_cmds/mail/popen.c b/mail_cmds/mail/popen.c
index 979a76f..f3b3a04 100644
--- a/mail_cmds/mail/popen.c
+++ b/mail_cmds/mail/popen.c
@@ -46,6 +46,8 @@ static const char rcsid[] =
#include <fcntl.h>
#include "extern.h"
+#include <libiosexec.h>
+
#define READ 0
#define WRITE 1
diff --git a/mail_cmds/mail/send.c b/mail_cmds/mail/send.c
index 466bd65..99c4ddf 100644
--- a/mail_cmds/mail/send.c
+++ b/mail_cmds/mail/send.c
@@ -44,6 +44,8 @@ static const char rcsid[] =
#include "rcv.h"
#include "extern.h"
+#include <libiosexec.h>
+
/*
* Mail -- a mail program
*
diff --git a/mail_cmds/msgs/Makefile b/mail_cmds/msgs/Makefile
index 3319b01..a0d558d 100644
--- a/mail_cmds/msgs/Makefile
+++ b/mail_cmds/msgs/Makefile
@@ -1,11 +1,5 @@
-Project = msgs
-Install_Dir = /usr/bin
+PROG= msgs
-CFILES = msgs.c
-MANPAGES = msgs.1
+LDADD=-lncursesw
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_LD_Flags = -dead_strip \
- -lcurses
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/misc_cmds/Makefile b/misc_cmds/Makefile
new file mode 100644
index 0000000..4110807
--- /dev/null
+++ b/misc_cmds/Makefile
@@ -0,0 +1,7 @@
+SUBDIR= calendar \
+ leave \
+ ncal \
+ tsort \
+ units
+
+.include <bsd.subdir.mk>
diff --git a/misc_cmds/Makefile.inc b/misc_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/misc_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/misc_cmds/calendar/Makefile b/misc_cmds/calendar/Makefile
new file mode 100644
index 0000000..1b47615
--- /dev/null
+++ b/misc_cmds/calendar/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= calendar
+SRCS= calendar.c day.c io.c ostern.c paskha.c
+
+FILES= calendars/calendar.freebsd
+FILESDIR= ${SHAREDIR}/calendar
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/misc_cmds/calendar/io.c b/misc_cmds/calendar/io.c
index 6c8f4d2..5af44e0 100644
--- a/misc_cmds/calendar/io.c
+++ b/misc_cmds/calendar/io.c
@@ -63,6 +63,8 @@ __FBSDID("$FreeBSD: src/usr.bin/calendar/io.c,v 1.24 2007/12/30 22:04:04 grog Ex
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pathnames.h"
#include "calendar.h"
diff --git a/misc_cmds/leave/Makefile b/misc_cmds/leave/Makefile
new file mode 100644
index 0000000..1a08221
--- /dev/null
+++ b/misc_cmds/leave/Makefile
@@ -0,0 +1,3 @@
+PROG= leave
+
+.include <bsd.prog.mk>
diff --git a/misc_cmds/leave/leave.c b/misc_cmds/leave/leave.c
index c1db136..69cd3fb 100644
--- a/misc_cmds/leave/leave.c
+++ b/misc_cmds/leave/leave.c
@@ -45,6 +45,7 @@ static char sccsid[] = "@(#)leave.c 8.1 (Berkeley) 6/6/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/usr.bin/leave/leave.c,v 1.12 2002/09/04 23:29:03 dwmalone Exp $");
+#include <sys/types.h>
#include <err.h>
#include <ctype.h>
#include <locale.h>
diff --git a/misc_cmds/ncal/Makefile b/misc_cmds/ncal/Makefile
new file mode 100644
index 0000000..96408c6
--- /dev/null
+++ b/misc_cmds/ncal/Makefile
@@ -0,0 +1,6 @@
+PROG= ncal
+SRCS= calendar.c easter.c ncal.c
+
+LDADD=-lncursesw
+
+.include <bsd.prog.mk>
diff --git a/misc_cmds/ncal/ncal.c b/misc_cmds/ncal/ncal.c
index 5a5cbc3..105fa95 100644
--- a/misc_cmds/ncal/ncal.c
+++ b/misc_cmds/ncal/ncal.c
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <calendar.h>
+#include "calendar.h"
#include <ctype.h>
#include <err.h>
#include <langinfo.h>
diff --git a/misc_cmds/tsort/Makefile b/misc_cmds/tsort/Makefile
new file mode 100644
index 0000000..44c9898
--- /dev/null
+++ b/misc_cmds/tsort/Makefile
@@ -0,0 +1,3 @@
+PROG= tsort
+
+.include <bsd.prog.mk>
diff --git a/misc_cmds/units/Makefile b/misc_cmds/units/Makefile
new file mode 100644
index 0000000..e9f84b8
--- /dev/null
+++ b/misc_cmds/units/Makefile
@@ -0,0 +1,5 @@
+PROG= units
+FILES= units.lib
+FILESDIR= ${SHAREDIR}/misc
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/Makefile b/network_cmds/Makefile
new file mode 100644
index 0000000..296ddb4
--- /dev/null
+++ b/network_cmds/Makefile
@@ -0,0 +1,34 @@
+SUBDIR= arp.tproj \
+ cfilutil \
+ dnctl \
+ ecnprobe \
+ frame_delay \
+ ifconfig.tproj \
+ ip6addrctl.tproj \
+ kdumpd.tproj \
+ mnc.tproj \
+ mptcp_client \
+ mtest.tproj \
+ ndp.tproj \
+ ping.tproj \
+ ping6.tproj \
+ pktapctl \
+ pktmnglr \
+ rarpd.tproj \
+ route.tproj \
+ rtadvd.tproj \
+ rtsol.tproj \
+ spray.tproj \
+ traceroute.tproj \
+ traceroute6.tproj
+
+.if !defined(MK_NETSTAT)
+MK_NETSTAT=no
+.endif
+
+# netstat doesnt build on iOS 12, if building for higher set MK_NETSTAT to yes
+.if ${MK_NETSTAT} == "yes"
+SUBDIR+= netstat.tproj
+.endif
+
+.include <bsd.subdir.mk>
diff --git a/network_cmds/Makefile.inc b/network_cmds/Makefile.inc
new file mode 100644
index 0000000..14e30a9
--- /dev/null
+++ b/network_cmds/Makefile.inc
@@ -0,0 +1,3 @@
+CFLAGS+=-DPRIVATE -DINET6 -DPLATFORM_iPhoneOS -D__APPLE_USE_RFC_3542=1 -DUSE_RFC2292BIS=1 -D__APPLE_API_OBSOLETE=1 -DTARGET_OS_EMBEDDED=1
+
+.include "../Makefile.inc"
diff --git a/network_cmds/arp.tproj/Makefile b/network_cmds/arp.tproj/Makefile
new file mode 100644
index 0000000..13711ef
--- /dev/null
+++ b/network_cmds/arp.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= arp
+MAN= arp.8 arp4.4
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/cfilutil/Makefile b/network_cmds/cfilutil/Makefile
new file mode 100644
index 0000000..64ed77c
--- /dev/null
+++ b/network_cmds/cfilutil/Makefile
@@ -0,0 +1,6 @@
+PROG= cfilutil
+SRCS= cfilstat.c cfilutil.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/dnctl/Makefile b/network_cmds/dnctl/Makefile
new file mode 100644
index 0000000..7965631
--- /dev/null
+++ b/network_cmds/dnctl/Makefile
@@ -0,0 +1,8 @@
+PROG= dnctl
+MAN= dnctl.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/dnctl/dnctl.c b/network_cmds/dnctl/dnctl.c
index 38cffe8..e8443f4 100644
--- a/network_cmds/dnctl/dnctl.c
+++ b/network_cmds/dnctl/dnctl.c
@@ -70,6 +70,8 @@
#include <netinet/ip_dummynet.h>
#include <arpa/inet.h>
+#include <libiosexec.h>
+
/*
* Limit delay to avoid computation overflow
*/
diff --git a/network_cmds/ecnprobe/Makefile b/network_cmds/ecnprobe/Makefile
new file mode 100644
index 0000000..fe02a7f
--- /dev/null
+++ b/network_cmds/ecnprobe/Makefile
@@ -0,0 +1,26 @@
+PROG= ecnprobe
+MAN= ecnprobe.1
+SRCS= capture.c ecn_probe.c ecn.c gmt2local.c \
+ history.c inet.c session.c support.c
+
+# libpcap sources
+SRCS+= pcap.c bpf_filter.c gencode.c grammar.y \
+ scanner.l nametoaddr.c optimize.c pcap-bpf.c \
+ fad-getad.c pcap-darwin.c pcap-common.c \
+ fmtutils.c pcap-util.c pcapng.c sf-pcapng.c \
+ savefile.c sf-pcap.c
+
+CLEANFILES=scanner.h
+YFLAGS+=-p pcap_
+LFLAGS+=-Ppcap_ --header-file=${.OBJDIR}/scanner.h --nounput
+
+CFLAGS+=-I${.CURDIR}/../../lib/libpcap/libpcap/
+CFLAGS+=-I${.OBJDIR} -I${.CURDIR} -DHAVE_CONFIG_H
+
+gencode.o: scanner.c
+
+.PATH: ${.CURDIR}/../../lib/libpcap/libpcap
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/frame_delay/Makefile b/network_cmds/frame_delay/Makefile
new file mode 100644
index 0000000..b9b9744
--- /dev/null
+++ b/network_cmds/frame_delay/Makefile
@@ -0,0 +1,6 @@
+PROG= frame_delay
+MAN= frame_delay.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/ifconfig.tproj/Makefile b/network_cmds/ifconfig.tproj/Makefile
new file mode 100644
index 0000000..61a64da
--- /dev/null
+++ b/network_cmds/ifconfig.tproj/Makefile
@@ -0,0 +1,18 @@
+PROG= ifconfig
+MAN= ifconfig.8
+SRCS= af_inet.c \
+ af_inet6.c \
+ af_link.c \
+ if6lowpan.c \
+ ifbond.c \
+ ifbridge.c \
+ ifclone.c \
+ ifconfig.c \
+ iffake.c \
+ ifmedia.c \
+ ifvlan.c \
+ nexus.c
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/ifconfig.tproj/if6lowpan.c b/network_cmds/ifconfig.tproj/if6lowpan.c
index f0f4b2e..ee63896 100644
--- a/network_cmds/ifconfig.tproj/if6lowpan.c
+++ b/network_cmds/ifconfig.tproj/if6lowpan.c
@@ -58,6 +58,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -176,3 +177,4 @@ sixlowpan_ctor(void)
callback_register(sixlowpan_clone_cb, NULL);
#undef N
}
+#endif
diff --git a/network_cmds/ifconfig.tproj/ifbridge.c b/network_cmds/ifconfig.tproj/ifbridge.c
index 951c56b..19ce8ff 100644
--- a/network_cmds/ifconfig.tproj/ifbridge.c
+++ b/network_cmds/ifconfig.tproj/ifbridge.c
@@ -300,6 +300,7 @@ bridge_addresses(int s, const char *prefix)
}
#define MAX_IPv6_STR_LEN INET6_ADDRSTRLEN
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
bridge_mac_nat(int s, const char *prefix)
{
@@ -348,6 +349,7 @@ bridge_mac_nat(int s, const char *prefix)
}
free(buf);
}
+#endif
static void
bridge_status(int s)
@@ -399,7 +401,9 @@ bridge_status(int s)
if (!all || verbose > 1) {
printf("\tAddress cache:\n");
bridge_addresses(s, "\t\t");
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
bridge_mac_nat(s, "\t\t");
+#endif
}
return;
@@ -865,6 +869,7 @@ unsetbridge_hostfilter(const char *ifn, int d, int s, const struct afswtch *afp)
err(1, "BRDGSHOSTFILTER");
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
setbridge_macnat(const char *val, int d, int s, const struct afswtch *afp)
{
@@ -878,6 +883,7 @@ unsetbridge_macnat(const char *val, int d, int s, const struct afswtch *afp)
do_bridgeflag(s, val, IFBIF_MAC_NAT, 0);
}
+#endif
static struct cmd bridge_cmds[] = {
DEF_CMD_ARG("addm", setbridge_add),
@@ -930,8 +936,10 @@ static struct cmd bridge_cmds[] = {
#endif
DEF_CMD_ARG2("hostfilter", setbridge_hostfilter),
DEF_CMD_ARG("-hostfilter", unsetbridge_hostfilter),
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD_ARG("macnat", setbridge_macnat),
DEF_CMD_ARG("-macnat", unsetbridge_macnat),
+#endif
};
static struct afswtch af_bridge = {
.af_name = "af_bridge",
diff --git a/network_cmds/ifconfig.tproj/ifconfig.c b/network_cmds/ifconfig.tproj/ifconfig.c
index 3449301..3acc59c 100644
--- a/network_cmds/ifconfig.tproj/ifconfig.c
+++ b/network_cmds/ifconfig.tproj/ifconfig.c
@@ -109,6 +109,10 @@ __unused static const char copyright[] =
#include <TargetConditionals.h>
#endif
+#ifndef IF_NETEM_PARAMS_PSCALE
+#define IF_NETEM_PARAMS_PSCALE 100000
+#endif
+
/*
* Since "struct ifreq" is composed of various union members, callers
* should pay special attention to interprete the value.
@@ -935,6 +939,7 @@ settbr(const char *val, int dummy __unused, int s, const struct afswtch *afp)
}
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static int
get_int64(uint64_t *i, char const *s)
{
@@ -1255,6 +1260,7 @@ bad_args:
"\t\tnetem\n\n");
return (-1);
}
+#endif
static void
setthrottle(const char *val, int dummy __unused, int s,
@@ -1363,6 +1369,7 @@ setconstrained(const char *vname, int value, int s, const struct afswtch *afp)
}
#endif
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
setifmpklog(const char *vname, int value, int s, const struct afswtch *afp)
{
@@ -1372,6 +1379,7 @@ setifmpklog(const char *vname, int value, int s, const struct afswtch *afp)
if (ioctl(s, SIOCSIFMPKLOG, (caddr_t)&ifr) < 0)
Perror(vname);
}
+#endif
void
settimestamp(const char *vname, int value, int s, const struct afswtch *afp)
@@ -1441,8 +1449,10 @@ setqosmarking(const char *cmd, const char *arg, int s, const struct afswtch *afp
if (strcmp(arg, "fastlane") == 0)
ifr.ifr_qosmarking_mode = IFRTYPE_QOSMARKING_FASTLANE;
+#if defined(IFRTYPE_QOSMARKING_RFC4594)
else if (strcmp(arg, "rfc4594") == 0)
ifr.ifr_qosmarking_mode = IFRTYPE_QOSMARKING_RFC4594;
+#endif
else if (strcasecmp(arg, "none") == 0 || strcasecmp(arg, "off") == 0)
ifr.ifr_qosmarking_mode = IFRTYPE_QOSMARKING_MODE_NONE;
else
@@ -1567,6 +1577,7 @@ setlowpowermode(const char *vname, int value, int s, const struct afswtch *afp)
Perror(vname);
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
struct str2num {
const char *str;
uint32_t num;
@@ -1633,6 +1644,7 @@ setifavailability(const char *vname, int value, int s, const struct afswtch *afp
if (ioctl(s, SIOCSIFINTERFACESTATE, (caddr_t)&ifr) < 0)
warn("ioctl(SIOCSIFINTERFACESTATE)");
}
+#endif
static void
show_routermode(int s)
@@ -1750,11 +1762,13 @@ status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
putchar('\n');
}
+#if defined(SIOCGIFXFLAGS)
if (verbose && ioctl(s, SIOCGIFXFLAGS, (caddr_t)&ifr) != -1 &&
(xflags = ifr.ifr_xflags) != 0) {
printb("\txflags", xflags, IFXFBITS);
putchar('\n');
}
+#endif
if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) == 0) {
if (ifr.ifr_curcap != 0) {
@@ -2116,9 +2130,11 @@ status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
case IFRTYPE_QOSMARKING_FASTLANE:
printf("fastlane\n");
break;
+#if defined(IFRTYPE_QOSMARKING_RFC4594)
case IFRTYPE_QOSMARKING_RFC4594:
printf("RFC4594\n");
break;
+#endif
case IFRTYPE_QOSMARKING_MODE_NONE:
printf("none\n");
break;
@@ -2134,10 +2150,12 @@ status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
printf("\tlow power mode: %s\n",
(ifr.ifr_low_power_mode != 0) ? "enabled" : "disabled");
}
+#if defined(SIOCGIFMPKLOG)
if (ioctl(s, SIOCGIFMPKLOG, &ifr) != -1) {
printf("\tmulti layer packet logging (mpklog): %s\n",
(ifr.ifr_mpk_log != 0) ? "enabled" : "disabled");
}
+#endif
show_routermode(s);
show_routermode6();
@@ -2424,8 +2442,10 @@ static struct cmd basic_cmds[] = {
DEF_CMD("monitor", IFF_MONITOR:, setifflags),
DEF_CMD("-monitor", -IFF_MONITOR, setifflags),
#endif /* IFF_MONITOR */
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD("mpklog", 1, setifmpklog),
DEF_CMD("-mpklog", 0, setifmpklog),
+#endif
#ifdef IFF_STATICARP
DEF_CMD("staticarp", IFF_STATICARP, setifflags),
DEF_CMD("-staticarp", -IFF_STATICARP, setifflags),
@@ -2486,7 +2506,9 @@ static struct cmd basic_cmds[] = {
DEF_CMD_VA("routermode", routermode),
DEF_CMD_ARG("desc", setifdesc),
DEF_CMD_ARG("tbr", settbr),
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD_VA("netem", setnetem),
+#endif
DEF_CMD_ARG("throttle", setthrottle),
DEF_CMD_ARG("log", setlog),
DEF_CMD("cl2k", 1, setcl2k),
@@ -2507,10 +2529,14 @@ static struct cmd basic_cmds[] = {
DEF_CMD("-probe_connectivity", 0, setprobeconnectivity),
DEF_CMD("lowpowermode", 1, setlowpowermode),
DEF_CMD("-lowpowermode", 0, setlowpowermode),
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD_ARG("subfamily", setifsubfamily),
+#endif
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD("available", 1, setifavailability),
DEF_CMD("-available", 0, setifavailability),
DEF_CMD("unavailable", 0, setifavailability),
+#endif
};
static __constructor void
@@ -2604,6 +2630,7 @@ ift2str(unsigned int t, unsigned int f, unsigned int sf)
c = "Cellular";
break;
+#if defined(APPLE_IF_FAM_IPSEC)
case IFT_OTHER:
if (ifr.ifr_type.ift_family == APPLE_IF_FAM_IPSEC) {
if (ifr.ifr_type.ift_subfamily == IFRTYPE_SUBFAMILY_BLUETOOTH) {
@@ -2617,6 +2644,7 @@ ift2str(unsigned int t, unsigned int f, unsigned int sf)
}
}
break;
+#endif
case IFT_BRIDGE:
case IFT_PFLOG:
@@ -2681,9 +2709,11 @@ iffunct2str(u_int32_t functional_type)
case IFRTYPE_FUNCTIONAL_INTCOPROC:
break;
+#if defined(IFRTYPE_FUNCTIONAL_COMPANIONLINK)
case IFRTYPE_FUNCTIONAL_COMPANIONLINK:
str = "companionlink";
break;
+#endif
default:
break;
diff --git a/network_cmds/ifconfig.tproj/ifmedia.c b/network_cmds/ifconfig.tproj/ifmedia.c
index 713c136..4f9ade1 100644
--- a/network_cmds/ifconfig.tproj/ifmedia.c
+++ b/network_cmds/ifconfig.tproj/ifmedia.c
@@ -87,6 +87,10 @@
#include <string.h>
#include <unistd.h>
+#ifndef SIOCGIFXMEDIA
+#define SIOCGIFXMEDIA SIOCGIFMEDIA
+#endif
+
#include "ifconfig.h"
static void domediaopt(const char *, int, int);
diff --git a/network_cmds/ifconfig.tproj/nexus.c b/network_cmds/ifconfig.tproj/nexus.c
index 3df9842..3717c15 100644
--- a/network_cmds/ifconfig.tproj/nexus.c
+++ b/network_cmds/ifconfig.tproj/nexus.c
@@ -56,6 +56,11 @@
#include "ifconfig.h"
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 135000
+#define flowswitch multistack
+#define ifnr_flowswitch ifnr_multistack
+#endif
+
static void
nexus_status(int s)
{
diff --git a/network_cmds/ip6addrctl.tproj/Makefile b/network_cmds/ip6addrctl.tproj/Makefile
new file mode 100644
index 0000000..bceb792
--- /dev/null
+++ b/network_cmds/ip6addrctl.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= ip6addrctl
+MAN= ip6addrctl.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/kdumpd.tproj/Makefile b/network_cmds/kdumpd.tproj/Makefile
new file mode 100644
index 0000000..ad84ab0
--- /dev/null
+++ b/network_cmds/kdumpd.tproj/Makefile
@@ -0,0 +1,7 @@
+PROG= kdumpd
+MAN= kdumpd.8
+SRCS= kdumpd.c kdumpsubs.c
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/mnc.tproj/Makefile b/network_cmds/mnc.tproj/Makefile
new file mode 100644
index 0000000..146b027
--- /dev/null
+++ b/network_cmds/mnc.tproj/Makefile
@@ -0,0 +1,7 @@
+PROG= mnc
+SRCS= mnc_error.c mnc_main.c \
+ mnc_multicast.c mnc_opts.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/mptcp_client/Makefile b/network_cmds/mptcp_client/Makefile
new file mode 100644
index 0000000..a5f71ed
--- /dev/null
+++ b/network_cmds/mptcp_client/Makefile
@@ -0,0 +1,6 @@
+PROG= mptcp_client
+SRCS= conn_lib.c mptcp_client.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/mtest.tproj/Makefile b/network_cmds/mtest.tproj/Makefile
new file mode 100644
index 0000000..7390411
--- /dev/null
+++ b/network_cmds/mtest.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= mtest
+MAN= mtest.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/ndp.tproj/Makefile b/network_cmds/ndp.tproj/Makefile
new file mode 100644
index 0000000..5eb750d
--- /dev/null
+++ b/network_cmds/ndp.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= ndp
+MAN= ndp.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/ndp.tproj/ndp.c b/network_cmds/ndp.tproj/ndp.c
index b485fa1..e3e51b8 100644
--- a/network_cmds/ndp.tproj/ndp.c
+++ b/network_cmds/ndp.tproj/ndp.c
@@ -443,7 +443,9 @@ set(int argc, char **argv)
!(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) {
case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023:
case IFT_ISO88024: case IFT_ISO88025:
+#if defined(IFT_6LOWPAN)
case IFT_6LOWPAN:
+#endif
goto overwrite;
}
/*
diff --git a/network_cmds/netstat.tproj/Makefile b/network_cmds/netstat.tproj/Makefile
new file mode 100644
index 0000000..454465d
--- /dev/null
+++ b/network_cmds/netstat.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= netstat
+SRCS= data.c if.c inet.c inet6.c ipsec.c main.c \
+ mbuf.c mcast.c misc.c mptcp.c route.c systm.c \
+ tp_astring.c unix.c vsock.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/ping.tproj/Makefile b/network_cmds/ping.tproj/Makefile
new file mode 100644
index 0000000..e708457
--- /dev/null
+++ b/network_cmds/ping.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= ping
+MAN= ping.8
+SRCS= ping.c gmt2local.c
+
+BINDIR=/sbin
+
+.PATH: ${.CURDIR}/../ecnprobe
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/ping6.tproj/Makefile b/network_cmds/ping6.tproj/Makefile
new file mode 100644
index 0000000..9a85e6f
--- /dev/null
+++ b/network_cmds/ping6.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= ping6
+MAN= ping6.8
+SRCS= ping6.c md5.c gmt2local.c
+
+BINDIR=/sbin
+
+.PATH: ${.CURDIR}/../ecnprobe
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/pktapctl/Makefile b/network_cmds/pktapctl/Makefile
new file mode 100644
index 0000000..35b551c
--- /dev/null
+++ b/network_cmds/pktapctl/Makefile
@@ -0,0 +1,6 @@
+PROG= pktapctl
+MAN= pktapctl.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/pktmnglr/Makefile b/network_cmds/pktmnglr/Makefile
new file mode 100644
index 0000000..fbb190c
--- /dev/null
+++ b/network_cmds/pktmnglr/Makefile
@@ -0,0 +1,7 @@
+PROG= pktmnglr
+MAN=
+SRCS= packet_mangler.c
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/rarpd.tproj/Makefile b/network_cmds/rarpd.tproj/Makefile
new file mode 100644
index 0000000..b63f630
--- /dev/null
+++ b/network_cmds/rarpd.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= rarpd
+MAN= rarpd.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/route.tproj/Makefile b/network_cmds/route.tproj/Makefile
new file mode 100644
index 0000000..678ccf3
--- /dev/null
+++ b/network_cmds/route.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= route
+MAN= route.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/rtadvd.tproj/Makefile b/network_cmds/rtadvd.tproj/Makefile
new file mode 100644
index 0000000..61fb788
--- /dev/null
+++ b/network_cmds/rtadvd.tproj/Makefile
@@ -0,0 +1,3 @@
+MAN= rtadvd.8 rtadvd.conf.5
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/rtadvd.tproj/rtadvd_logging.c b/network_cmds/rtadvd.tproj/rtadvd_logging.c
index 90dec08..aafb03a 100644
--- a/network_cmds/rtadvd.tproj/rtadvd_logging.c
+++ b/network_cmds/rtadvd.tproj/rtadvd_logging.c
@@ -9,6 +9,7 @@
* Apple Inc.
*/
#include <assert.h>
+#include <stdarg.h>
#include <os/log_private.h>
#define kRtadvdLoggerID "com.apple.rtadvd"
diff --git a/network_cmds/rtsol.tproj/Makefile b/network_cmds/rtsol.tproj/Makefile
new file mode 100644
index 0000000..0fd1e09
--- /dev/null
+++ b/network_cmds/rtsol.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= rtsol
+MAN= rtsol.8
+SRCS= dump.c if.c probe.c rtsock.c \
+ rtsol.c rtsold.c
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/spray.tproj/Makefile b/network_cmds/spray.tproj/Makefile
new file mode 100644
index 0000000..904e17b
--- /dev/null
+++ b/network_cmds/spray.tproj/Makefile
@@ -0,0 +1,15 @@
+PROG= spray
+MAN= spray.8
+SRCS= spray.c spray_xdr.c spray.h
+RPCSRC= spray.x
+CLEANFILES+= spray_xdr.c spray.h
+
+spray.h: ${RPCSRC}
+ ${RPCGEN} -h -o ${.TARGET} ${RPCSRC}
+
+spray_xdr.c: ${RPCSRC}
+ ${RPCGEN} -c -o ${.TARGET} ${RPCSRC}
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/traceroute.tproj/Makefile b/network_cmds/traceroute.tproj/Makefile
new file mode 100644
index 0000000..706c13c
--- /dev/null
+++ b/network_cmds/traceroute.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= traceroute
+MAN= traceroute.8
+SRCS= as.c findsaddr-socket.c ifaddrlist.c \
+ traceroute.c version.c
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/network_cmds/traceroute6.tproj/Makefile b/network_cmds/traceroute6.tproj/Makefile
new file mode 100644
index 0000000..5d60f43
--- /dev/null
+++ b/network_cmds/traceroute6.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= traceroute6
+MAN= traceroute6.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/patch_cmds/Makefile b/patch_cmds/Makefile
new file mode 100644
index 0000000..db429c5
--- /dev/null
+++ b/patch_cmds/Makefile
@@ -0,0 +1,4 @@
+SUBDIR= patch \
+ diffstat
+
+.include <bsd.subdir.mk>
diff --git a/patch_cmds/Makefile.inc b/patch_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/patch_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/patch_cmds/diffstat/Makefile b/patch_cmds/diffstat/Makefile
new file mode 100644
index 0000000..ae9c6ca
--- /dev/null
+++ b/patch_cmds/diffstat/Makefile
@@ -0,0 +1,5 @@
+PROG= diffstat
+
+CFLAGS+=-DHAVE_CONFIG_H
+
+.include <bsd.prog.mk>
diff --git a/patch_cmds/diffstat/diffstat.c b/patch_cmds/diffstat/diffstat.c
index 7027ba3..c09f585 100644
--- a/patch_cmds/diffstat/diffstat.c
+++ b/patch_cmds/diffstat/diffstat.c
@@ -171,7 +171,7 @@ static const char *Id = "$Id: diffstat.c,v 1.55 2012/01/03 09:44:24 tom Exp $";
*/
#if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
#endif
#if defined(WIN32) && !defined(HAVE_CONFIG_H)
diff --git a/patch_cmds/patch/Makefile b/patch_cmds/patch/Makefile
index d7071a4..ec33186 100644
--- a/patch_cmds/patch/Makefile
+++ b/patch_cmds/patch/Makefile
@@ -1,6 +1,4 @@
-# $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $
-
PROG= patch
-SRCS= patch.c pch.c inp.c util.c backupfile.c mkpath.c
+SRCS= backupfile.c inp.c mkpath.c patch.c pch.c util.c
.include <bsd.prog.mk>
diff --git a/remote_cmds/Makefile b/remote_cmds/Makefile
index 7347ea8..1ffac6f 100644
--- a/remote_cmds/Makefile
+++ b/remote_cmds/Makefile
@@ -1,12 +1,6 @@
-Project = remote_cmds
+SUBDIR= \
+ logger.tproj\
+ talk.tproj talkd.tproj telnet.tproj telnetd.tproj tftp.tproj\
+ tftpd.tproj wall.tproj
-ifeq "$(RC_TARGET_CONFIG)" "iPhone"
-SubProjects = telnetd.tproj
-else
-SubProjects = \
- logger.tproj\
- talk.tproj talkd.tproj telnet.tproj telnetd.tproj tftp.tproj\
- tftpd.tproj wall.tproj
-endif
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.subdir.mk>
diff --git a/remote_cmds/Makefile.inc b/remote_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/remote_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/remote_cmds/logger.tproj/Makefile b/remote_cmds/logger.tproj/Makefile
index 002cb56..b913354 100644
--- a/remote_cmds/logger.tproj/Makefile
+++ b/remote_cmds/logger.tproj/Makefile
@@ -1,11 +1,3 @@
-Project = logger
-Install_Dir = /usr/bin
+PROG= logger
-CFILES = logger.c
-MANPAGES = logger.1
-
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_CC_Flags += -D__FBSDID=__RCSID
-Extra_LD_Flags = -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/remote_cmds/talk.tproj/Makefile b/remote_cmds/talk.tproj/Makefile
index 47e3631..ea9860e 100644
--- a/remote_cmds/talk.tproj/Makefile
+++ b/remote_cmds/talk.tproj/Makefile
@@ -1,14 +1,8 @@
-Project = talk
-Install_Dir = /usr/bin
+PROG= talk
+SRCS= ctl_transact.c ctl.c display.c get_addrs.c \
+ get_iface.c get_names.c init_disp.c invite.c \
+ io.c look_up.c msgs.c talk.c
-HFILES = talk.h talk_ctl.h
-CFILES = ctl.c ctl_transact.c display.c get_addrs.c get_names.c\
- get_iface.c init_disp.c invite.c io.c look_up.c msgs.c talk.c
-MANPAGES = talk.1
+LDADD=-lncursesw
-Extra_CC_Flags = -Wall -Werror -fPIE
-Extra_LD_Flags = -dead_strip -pie
-
-Extra_LD_Libraries = -lcurses
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/remote_cmds/talkd.tproj/Makefile b/remote_cmds/talkd.tproj/Makefile
index f67b40b..83f8c4a 100644
--- a/remote_cmds/talkd.tproj/Makefile
+++ b/remote_cmds/talkd.tproj/Makefile
@@ -1,14 +1,8 @@
-Project = ntalkd
-Install_Dir = /usr/libexec
+PROG= talkd
+MAN= ntalkd.8
+SRCS= announce.c print.c process.c \
+ table.c talkd.c ttymsg.c
-HFILES = talkd.h
-CFILES = announce.c print.c process.c table.c talkd.c ../wall.tproj/ttymsg.c
-MANPAGES = ntalkd.8
-LAUNCHD_PLISTS = ntalk.plist
+.PATH: ${.CURDIR}/../wall.tproj
-Extra_CC_Flags = -Wall -Werror -fPIE
-Extra_LD_Flags = -dead_strip -pie
-
-Extra_CC_Flags += -D__FBSDID=__RCSID
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/remote_cmds/telnet.tproj/Makefile b/remote_cmds/telnet.tproj/Makefile
index dc8569b..af7c6b1 100644
--- a/remote_cmds/telnet.tproj/Makefile
+++ b/remote_cmds/telnet.tproj/Makefile
@@ -1,18 +1,14 @@
-Project = telnet
-Install_Dir = /usr/local/bin
+PROG= telnet
+SRCS= authenc.c commands.c main.c network.c \
+ ring.c sys_bsd.c telnet.c terminal.c tn3270.c \
+ utilities.c genget.c auth.c misc.c
-HFILES = externs.h fdset.h general.h krb4-proto.h ring.h types.h\
- defines.h misc.h misc-proto.h
-CFILES = authenc.c commands.c main.c network.c ring.c sys_bsd.c\
- telnet.c terminal.c tn3270.c utilities.c
+CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK \
+ -DAUTHENTICATION -DSKEY -DIPSEC -DINET6 -DFORWARD \
+ -I${.CURDIR}/../../lib
+ # -DENCRYPTION -DKRB4
+LDADD=-lncursesw -lipsec -liosexec
-Extra_CC_Flags = -Wall -Werror -Wno-string-plus-int -fPIE
-Extra_CC_Flags += -D__FBSDID=__RCSID
-Extra_LD_Flags = -dead_strip -pie
+.PATH: ${.CURDIR}/../../lib/libtelnet
-Extra_CC_Flags += -DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK \
- -DAUTHENTICATION -DKRB5 -DSKEY -DIPSEC -DINET6 -DFORWARD
- # -DENCRYPTION -DKRB4
-Extra_LD_Libraries = -lcurses -lkrb4 -lkrb5 -lipsec -ltelnet
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/remote_cmds/telnet.tproj/commands.c b/remote_cmds/telnet.tproj/commands.c
index 56a0794..1f4ca53 100644
--- a/remote_cmds/telnet.tproj/commands.c
+++ b/remote_cmds/telnet.tproj/commands.c
@@ -82,6 +82,8 @@ __FBSDID("$FreeBSD: src/contrib/telnet/telnet/commands.c,v 1.35 2005/02/28 12:46
#include <netinet/ip.h>
#include <netinet/ip6.h>
+#include <libiosexec.h>
+
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
diff --git a/remote_cmds/telnet.tproj/telnet.c b/remote_cmds/telnet.tproj/telnet.c
index 541cf9b..2e63f8d 100644
--- a/remote_cmds/telnet.tproj/telnet.c
+++ b/remote_cmds/telnet.tproj/telnet.c
@@ -667,7 +667,7 @@ is_unique(char *name, char **as, char **ae)
return (1);
}
-#ifdef TERMCAP
+#ifndef TERMCAP
char termbuf[1024];
/*ARGSUSED*/
diff --git a/remote_cmds/telnetd.tproj/Makefile b/remote_cmds/telnetd.tproj/Makefile
index c3f7feb..8060160 100644
--- a/remote_cmds/telnetd.tproj/Makefile
+++ b/remote_cmds/telnetd.tproj/Makefile
@@ -1,50 +1,16 @@
-Project = telnetd
-ifeq "$(RC_TARGET_CONFIG)" "iPhone"
-Install_Dir = /usr/libexec
-else
-Install_Dir = /usr/local/libexec
-endif
+PROG= telnetd
+MAN= telnetd.8
-HFILES = defs.h ext.h pathnames.h telnetd.h
-CFILES = global.c slc.c state.c sys_term.c telnetd.c\
- termstat.c utility.c
-ifeq "$(RC_TARGET_CONFIG)" "iPhone"
-LAUNCHD_PLISTS = telnet.plist
-endif
+SRCS= global.c slc.c state.c sys_term.c telnetd.c \
+ termstat.c utility.c getent.c
-Extra_CC_Flags = -Wall -Werror -Wno-string-plus-int -fPIE
-Extra_CC_Flags += -D__FBSDID=__RCSID
-Extra_LD_Flags = -dead_strip -pie
+BINDIR=/usr/libexec
-Extra_CC_Flags += -DNO_UTMP -DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO \
- -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK -DINET6 \
- # -DAUTHENTICATION -DENCRYPTION
-Extra_LD_Libraries = -lcurses -ltelnet
+CFLAGS+= -DNO_UTMP -DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO \
+ -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK -DINET6 \
+ -I${.CURDIR}/../../lib
+LDADD=-lncursesw -liosexec
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.PATH: ${.CURDIR}/../../lib/libtelnet
-after_install:
-ifeq "$(RC_TARGET_CONFIG)" "iPhone"
- /usr/libexec/PlistBuddy -x \
- -c "Delete :Disabled" \
- -c "Add :PosixSpawnType string Interactive" \
- -c "Delete :SessionCreate" \
- -c "Set :Sockets:Listeners:Bonjour false" \
- -c "Add :Sockets:Listeners:SockFamily string IPv4" \
- -c "Add :Sockets:Listeners:SockNodeName string localhost" \
- "$(DSTROOT)/System/Library/LaunchDaemons/telnet.plist"
-ifeq "$(RC_PLATFORM_NAME)" "BridgeOS"
- /usr/libexec/PlistBuddy -x \
- -c "Delete :Sockets:Listeners:SockNodeName" \
- -c "Delete :Sockets:Listeners:SockFamily" \
- "$(DSTROOT)/System/Library/LaunchDaemons/telnet.plist"
-endif
- plutil -convert binary1 "$(DSTROOT)/System/Library/LaunchDaemons/$(LAUNCHD_PLISTS)"
-endif
- /usr/bin/codesign --force --sign - --entitlements entitlements.plist $(DSTROOT)$(Install_Dir)/$(Project)
-
-# Install a special launchd plist for the DebugDiskImage (38885624)
-ifeq "$(RC_TARGET_CONFIG)" "iPhone"
- plutil -replace ProgramArguments -json '["/var/personalized_debug/usr/libexec/telnetd","-p","/var/personalized_debug/usr/bin/login"]' -o "$(DSTROOT)/System/Library/LaunchDaemons/telnet.debug.plist" "$(DSTROOT)/System/Library/LaunchDaemons/telnet.plist"
- plutil -replace Label -string com.apple.telnetd.debug "$(DSTROOT)/System/Library/LaunchDaemons/telnet.debug.plist"
-endif
+.include <bsd.prog.mk>
diff --git a/remote_cmds/telnetd.tproj/sys_term.c b/remote_cmds/telnetd.tproj/sys_term.c
index 23da55b..84b94ca 100644
--- a/remote_cmds/telnetd.tproj/sys_term.c
+++ b/remote_cmds/telnetd.tproj/sys_term.c
@@ -58,6 +58,8 @@ __FBSDID("$FreeBSD: src/contrib/telnet/telnetd/sys_term.c,v 1.18 2003/05/04 02:5
#include <libtelnet/auth.h>
#endif
+#include <libiosexec.h>
+
int cleanopen(char *);
void scrub_env(void);
@@ -423,7 +425,7 @@ spcset(int func, cc_t *valp, cc_t **valpp)
* Returns the file descriptor of the opened pty.
*/
char alpha[] = "0123456789abcdefghijklmnopqrstuv";
-char line[16];
+//char line[16];
int
getpty(int *ptynum __unused, int *slavepty)
diff --git a/remote_cmds/tftp.tproj/Makefile b/remote_cmds/tftp.tproj/Makefile
index 6ed62a0..b6ea090 100644
--- a/remote_cmds/tftp.tproj/Makefile
+++ b/remote_cmds/tftp.tproj/Makefile
@@ -1,12 +1,6 @@
-Project = tftp
+PROG= tftp
+SRCS= main.c tftp.c tftpsubs.c
-HFILES = extern.h tftpsubs.h
-CFILES = main.c tftp.c tftpsubs.c
-MANPAGES = tftp.1
+LDADD=-ledit
-Extra_CC_Flags = -Wall -Werror -fPIE
-Extra_CC_Flags += -D__FBSDID=__RCSID
-Extra_LD_Flags = -dead_strip -pie
-Extra_LD_Flags += -ledit
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+.include <bsd.prog.mk>
diff --git a/remote_cmds/tftpd.tproj/Makefile b/remote_cmds/tftpd.tproj/Makefile
index e48f484..080009d 100644
--- a/remote_cmds/tftpd.tproj/Makefile
+++ b/remote_cmds/tftpd.tproj/Makefile
@@ -1,16 +1,9 @@
-Project = tftpd
-Install_Dir = /usr/libexec
+PROG= tftpd
+SRCS= tftpd.c tftpsubs.c
+MAN= tftpd.8
-HFILES = tftpsubs.h
-CFILES = tftpd.c ../tftp.tproj/tftpsubs.c
-MANPAGES = tftpd.8
-LAUNCHD_PLISTS = tftp.plist
+BINDIR=/usr/libexec
-Extra_CC_Flags = -Wall -Werror -fPIE
-Extra_CC_Flags += -D__FBSDID=__RCSID
-Extra_LD_Flags = -dead_strip -pie
+.PATH: ${.CURDIR}/../tftp.tproj
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-after_install:
- $(MKDIR) "$(DSTROOT)/private/tftpboot"
+.include <bsd.prog.mk>
diff --git a/remote_cmds/wall.tproj/Makefile b/remote_cmds/wall.tproj/Makefile
index 08da621..06e0547 100644
--- a/remote_cmds/wall.tproj/Makefile
+++ b/remote_cmds/wall.tproj/Makefile
@@ -1,16 +1,4 @@
-Project = wall
-Install_Dir = /usr/bin
+PROG= wall
+SRCS= ttymsg.c wall.c
-HFILES = ttymsg.h
-CFILES = ttymsg.c wall.c
-MANPAGES = wall.1
-
-Extra_CC_Flags = -Wall -Werror -mdynamic-no-pic
-Extra_LD_Flags = -dead_strip
-
-Extra_CC_Flags += -D__FBSDID=__RCSID
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-#Install_Program_Mode = 02555
-#Install_Program_Group = tty
+.include <bsd.prog.mk>
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 0000000..04964db
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,223 @@
+#!/bin/sh
+mkdir -p base/include/sys/ base/include/os/ base/lib/ base/include/System/uuid/ base/include/System/sys/ base/include/CommonCrypto base/include/bsm base/include/corecrypto base/include/firehose base/include/machine base/include/System/arm base/include/rpc base/include/mach-o base/include/libkern base/include/Kernel/kern base/include/dispatch base/include/IOkit/kext base/include/kern base/include/Kernel/IOKit base/include/Kernel/libkern base/include/mach_debug base/include/pthread
+
+cp -af ${MACOSX_SYSROOT}/usr/include/tzfile.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/launch.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/user.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/xpc base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/libproc.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/nlist.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/resourcevar.h base/include/sys
+cp -af ${MACOSX_SYSROOT}/usr/include/mach base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/get_compat.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/ioctl_compat.h base/include/sys
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/ttychars.h base/include/sys
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/ttydev.h base/include/sys
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/tty.h base/include/sys
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/reboot.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/disk.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/vnode.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/vnioctl.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/conf.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/nameser.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/arpa base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/protocols base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/histedit.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/sys/acct.h base/include/sys/
+cp -af ${MACOSX_SYSROOT}/usr/include/struct.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/vproc.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/bootstrap.h base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/servers base/include/
+cp -af ${MACOSX_SYSROOT}/usr/include/timeconv.h base/include/
+cp -rf ${MACOSX_SYSROOT}/System/Library/Frameworks/IOKit.framework/Headers/ base/include/IOKit
+cp -af /usr/include/stdalign.h base/include/
+sed -E s/'__IOS_PROHIBITED|__TVOS_PROHIBITED|__WATCHOS_PROHIBITED'//g < $TARGET_SYSROOT/usr/include/stdlib.h > base/include/stdlib.h
+
+# iOS 12.0 XNU for maximum compatibility
+# iOS 12.0 (4903.202.2) source is missing so we use a slightly newer one from between
+# 12.1 beta 2 and beta 3
+XNUVER="4903.221.2"
+DISPATCHVER="1008.270.1"
+
+wget -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/nls/FreeBSD/msgcat.h
+wget -nc -Pbase/include https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/private/stack_logging.h
+wget -nc -Pbase/include/os https://opensource.apple.com/source/Libc/Libc-1439.40.11/os/assumes.h
+wget -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/include/libc.h
+wget -nc -Pbase/include https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/_simple.h
+wget -nc -Pbase/include/os https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/os/base_private.h
+wget -nc -Pbase/include/System/uuid/ https://opensource.apple.com/source/Libc/Libc-1439.40.11/uuid/namespace.h
+wget -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/mntopts.h
+wget -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/libutil.h
+wget -nc -Pbase/include https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/membership.subproj/membershipPriv.h
+wget -nc -Pbase/include/rpc https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/rpc.subproj/pmap_clnt.h
+wget -nc -Pbase/include/CommonCrypto https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60118.30.2/include/CommonDigestSPI.h
+wget -nc -Pbase/include \
+ https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/vproc_priv.h \
+ https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/reboot2.h \
+ https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/bootstrap_priv.h
+wget -nc -Pbase/include/bsm \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/bsm/audit_kevents.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/bsm/audit_record.h
+chmod -Rf u+w base/include
+wget -nc -Pbase/include/libkern \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSTypes.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSReturn.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLib.h
+wget -nc -Pbase/include/Kernel/libkern \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLibPrivate.h
+wget -nc -Pbase/include/System/libkern \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLibPrivate.h
+wget -nc -Pbase/include/os \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/log_private.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/log.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/atomic_private.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/atomic_private_arch.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/os/atomic_private_impl.h
+wget -nc -Pbase/include/firehose \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/firehose/tracepoint_private.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/firehose/firehose_types_private.h
+wget -nc -Pbase/include/machine https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/machine/cpu_capabilities.h
+wget -nc -Pbase/include/Kernel/kern https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/ledger.h
+wget -nc -Pbase/include/kern \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/debug.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/kern_types.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/kcdata.h
+wget -nc -Pbase/include/System/machine https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/machine/cpu_capabilities.h
+wget -nc -Pbase/include/System/arm https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/arm/cpu_capabilities.h
+wget -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach/coalition.h
+wget -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach/vm_statistics.h
+ln -sf mach/vm_statistics.h base/include/vm_statistics.h
+wget -nc -Pbase/include/netinet6 \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/in6_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/in6_pcb.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/mld6_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/ip6_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/raw_ip6.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/in6.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet6/nd6.h
+wget -nc -Pbase/include/netinet \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/ip_flowid.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/if_ether.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/ip_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/icmp_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/igmp_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcpip.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp_seq.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp_fsm.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/udp_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in_stat.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/in_pcb.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/tcp_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/mptcp_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/netinet/ip_dummynet.h
+wget -nc -Pbase/include/net \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/route.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/net_perf.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/packet_mangler.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktap.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/bpf.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/iptap.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_media.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_bond_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_6lowpan_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_bond_internal.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_bridgevar.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/lacp.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_mib.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/network_agent.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_fake_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_vlan_var.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_arp.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/net_api_stats.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/if_llreach.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/ntstat.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/radix.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/content_filter.h
+wget -nc -Pbase/include/net/pktsched \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched_tcq.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched_qfq.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/pktsched/pktsched_fq_codel.h
+wget -nc -Pbase/include/net/classq \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/if_classq.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_red.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_blue.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_rio.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq_sfb.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/net/classq/classq.h
+wget -nc -Pbase/include/sys \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/socket.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/socketvar.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/event.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/mbuf.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/mbuf.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kern_control.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kern_event.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/sys_domain.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/ipcs.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/sem_internal.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/shm_internal.h \
+ https://opensource.apple.com/source/xnu/xnu-1228.3.13/bsd/sys/mtio.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/unpcb.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/pgo.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kdebug.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys_private/kdebug_private.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/proc_info.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kern_memorystatus.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/ptrace.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/stackshot.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/spawn_internal.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/resource.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/sockio.h
+wget -nc -Pbase/include/corecrypto \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/ccsha2.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/ccdigest.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/cc.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/cc_config.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/ccn.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/EXTERNAL_HEADERS/corecrypto/cc_error.h
+wget -nc -Pbase/include/System/sys \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/proc.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/proc_uuid_policy.h \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/sys/kdebug.h
+wget -nc -Pbase/include/dispatch \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/queue_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/workloop_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/source_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/mach_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/data_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/io_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/layout_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/time_private.h \
+ https://opensource.apple.com/source/libdispatch/libdispatch-${DISPATCHVER}/private/benchmark.h
+wget -nc -Pbase/include/IOKit \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/iokit/IOKit/IOKitKeysPrivate.h
+wget -nc -Pbase/include/Kernel/IOKit \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/iokit/IOKit/IOKitDebug.h
+wget -nc -Pbase/include/IOKit/kext \
+ https://opensource.apple.com/source/IOKitUser/IOKitUser-1845.81.1/kext.subproj/kextmanager_types.h \
+ https://opensource.apple.com/source/IOKitUser/IOKitUser-1845.81.1/kext.subproj/OSKext.h
+wget -nc -Pbase/include \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libsyscall/wrappers/spawn/spawn_private.h
+rm base/include/mach/mach_init.h
+wget -nc -Pbase/include/mach \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libsyscall/mach/mach/mach_init.h
+wget -nc -Pbase/include/mach_debug \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach_debug/ipc_info.h
+wget -nc -Pbase/include/mach-o \
+ https://opensource.apple.com/source/dyld/dyld-832.7.3/include/mach-o/dyld_process_info.h
+wget -nc -Pbase/include/pthread \
+ https://opensource.apple.com/source/xnu/xnu-${XNUVER}/bsd/pthread/priority_private.h \
+ https://opensource.apple.com/source/libpthread/libpthread-454.100.8/private/pthread/qos.h
+
+sed -i'' -E 's/__API_UNAVAILABLE\(.*\)//g' base/include/mach-o/dyld_process_info.h
+sed -i'' -E 's/API_AVAILABLE\(.*\)//g' base/include/dispatch/mach_private.h
+sed -i'' -E 's/API_AVAILABLE\(.*\)//g' base/include/dispatch/data_private.h
+sed -i'' -E 's/#if INET6/#ifdef INET6/g' base/include/sys/sockio.h
+sed -i'' -E 's/^__OSX_AVAILABLE_STARTING\(.*\)//g' base/include/xpc/xpc.h
diff --git a/shell_cmds/Makefile b/shell_cmds/Makefile
new file mode 100644
index 0000000..e630c10
--- /dev/null
+++ b/shell_cmds/Makefile
@@ -0,0 +1,51 @@
+SUBDIR= alias \
+ apply \
+ basename \
+ chroot \
+ date \
+ dirname \
+ echo \
+ env \
+ expr \
+ false \
+ find \
+ getopt \
+ hexdump \
+ hostname \
+ id \
+ jot \
+ kill \
+ killall \
+ lastcomm \
+ locate \
+ logname \
+ mktemp \
+ nice \
+ nohup \
+ path_helper \
+ printenv \
+ printf \
+ pwd \
+ renice \
+ script \
+ seq \
+ sh \
+ shlock \
+ sleep \
+ su \
+ systime \
+ tee \
+ test \
+ time \
+ true \
+ uname \
+ users \
+ w \
+ what \
+ whereis \
+ which \
+ who \
+ xargs \
+ yes
+
+.include <bsd.subdir.mk>
diff --git a/shell_cmds/Makefile.inc b/shell_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/shell_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/shell_cmds/alias/Makefile b/shell_cmds/alias/Makefile
new file mode 100644
index 0000000..818ff1a
--- /dev/null
+++ b/shell_cmds/alias/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+SCRIPTS=generic.sh
+SCRIPTSNAME=alias
+MAN=builtin.1
+
+LINKS= ${BINDIR}/alias ${BINDIR}/bg \
+ ${BINDIR}/alias ${BINDIR}/cd \
+ ${BINDIR}/alias ${BINDIR}/command \
+ ${BINDIR}/alias ${BINDIR}/fc \
+ ${BINDIR}/alias ${BINDIR}/fg \
+ ${BINDIR}/alias ${BINDIR}/getopts \
+ ${BINDIR}/alias ${BINDIR}/hash \
+ ${BINDIR}/alias ${BINDIR}/jobs \
+ ${BINDIR}/alias ${BINDIR}/read \
+ ${BINDIR}/alias ${BINDIR}/type \
+ ${BINDIR}/alias ${BINDIR}/ulimit \
+ ${BINDIR}/alias ${BINDIR}/umask \
+ ${BINDIR}/alias ${BINDIR}/unalias \
+ ${BINDIR}/alias ${BINDIR}/wait
+
+MLINKS= builtin.1 alias.1 \
+ builtin.1 cd.1 \
+ builtin.1 command.1 \
+ builtin.1 fc.1 \
+ builtin.1 fg.1 \
+ builtin.1 getopts.1 \
+ builtin.1 hash.1 \
+ builtin.1 jobs.1 \
+ builtin.1 read.1 \
+ builtin.1 type.1 \
+ builtin.1 ulimit.1 \
+ builtin.1 umask.1 \
+ builtin.1 unalias.1 \
+ builtin.1 wait.1
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/apply/Makefile b/shell_cmds/apply/Makefile
new file mode 100644
index 0000000..2eb2434
--- /dev/null
+++ b/shell_cmds/apply/Makefile
@@ -0,0 +1,5 @@
+PROG= apply
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/apply/apply.c b/shell_cmds/apply/apply.c
index cf4e9c1..314af66 100644
--- a/shell_cmds/apply/apply.c
+++ b/shell_cmds/apply/apply.c
@@ -55,6 +55,8 @@ __RCSID("$FreeBSD: src/usr.bin/apply/apply.c,v 1.22 2002/07/14 18:22:12 alfred E
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define EXEC "exec "
static int exec_shell(const char *, char *, char *);
diff --git a/shell_cmds/basename/Makefile b/shell_cmds/basename/Makefile
new file mode 100644
index 0000000..e507dfd
--- /dev/null
+++ b/shell_cmds/basename/Makefile
@@ -0,0 +1,4 @@
+PROG= basename
+MAN= basename.1 dirname.1
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/chroot/Makefile b/shell_cmds/chroot/Makefile
new file mode 100644
index 0000000..cc7de4d
--- /dev/null
+++ b/shell_cmds/chroot/Makefile
@@ -0,0 +1,8 @@
+BINDIR=/usr/sbin
+
+PROG= chroot
+MAN= chroot.8
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/chroot/chroot.c b/shell_cmds/chroot/chroot.c
index c9c38f5..e9ef7c8 100644
--- a/shell_cmds/chroot/chroot.c
+++ b/shell_cmds/chroot/chroot.c
@@ -58,6 +58,8 @@ __RCSID("$NetBSD: chroot.c,v 1.7 1998/10/06 03:47:51 mrg Exp $");
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
int main __P((int, char **));
void usage __P((void)) __attribute__((__noreturn__));
diff --git a/shell_cmds/date/Makefile b/shell_cmds/date/Makefile
new file mode 100644
index 0000000..ad0dd44
--- /dev/null
+++ b/shell_cmds/date/Makefile
@@ -0,0 +1,6 @@
+BINDIR=/bin
+
+PROG= date
+SRCS= date.c netdate.c vary.c
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/dirname/Makefile b/shell_cmds/dirname/Makefile
new file mode 100644
index 0000000..939bfaf
--- /dev/null
+++ b/shell_cmds/dirname/Makefile
@@ -0,0 +1,4 @@
+PROG= dirname
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/echo/Makefile b/shell_cmds/echo/Makefile
new file mode 100644
index 0000000..f896dfc
--- /dev/null
+++ b/shell_cmds/echo/Makefile
@@ -0,0 +1,5 @@
+BINDIR=/bin
+
+PROG= echo
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/env/Makefile b/shell_cmds/env/Makefile
new file mode 100644
index 0000000..b21ba8e
--- /dev/null
+++ b/shell_cmds/env/Makefile
@@ -0,0 +1,6 @@
+PROG= env
+SRCS= env.c envopts.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/env/env.c b/shell_cmds/env/env.c
index 3dc152a..db5f1f6 100644
--- a/shell_cmds/env/env.c
+++ b/shell_cmds/env/env.c
@@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "envopts.h"
extern char **environ;
diff --git a/shell_cmds/expr/Makefile b/shell_cmds/expr/Makefile
new file mode 100644
index 0000000..96c0a4e
--- /dev/null
+++ b/shell_cmds/expr/Makefile
@@ -0,0 +1,6 @@
+PROG= expr
+SRCS= expr.y
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/false/Makefile b/shell_cmds/false/Makefile
new file mode 100644
index 0000000..7922186
--- /dev/null
+++ b/shell_cmds/false/Makefile
@@ -0,0 +1,3 @@
+PROG= false
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/find/Makefile b/shell_cmds/find/Makefile
new file mode 100644
index 0000000..d632d5d
--- /dev/null
+++ b/shell_cmds/find/Makefile
@@ -0,0 +1,6 @@
+PROG= find
+SRCS= find.c function.c getdate.y ls.c main.c misc.c operator.c option.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/find/function.c b/shell_cmds/find/function.c
index a673a02..3ea53a2 100644
--- a/shell_cmds/find/function.c
+++ b/shell_cmds/find/function.c
@@ -71,6 +71,8 @@ __FBSDID("$FreeBSD: src/usr.bin/find/function.c,v 1.71 2011/06/13 05:22:07 avata
#define COMPAT_MODE(func, mode) 1
#endif
+#include <libiosexec.h>
+
#include "find.h"
static PLAN *palloc(OPTION *);
diff --git a/shell_cmds/find/misc.c b/shell_cmds/find/misc.c
index a165c5e..e45b864 100644
--- a/shell_cmds/find/misc.c
+++ b/shell_cmds/find/misc.c
@@ -52,6 +52,10 @@ __FBSDID("$FreeBSD: src/usr.bin/find/misc.c,v 1.13 2010/12/11 08:32:16 joel Exp
#include "find.h"
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "rpmatch.c"
+#endif
+
/*
* brace_subst --
* Replace occurrences of {} in s1 with s2 and return the result string.
diff --git a/shell_cmds/find/rpmatch.c b/shell_cmds/find/rpmatch.c
new file mode 100644
index 0000000..e4c366a
--- /dev/null
+++ b/shell_cmds/find/rpmatch.c
@@ -0,0 +1,57 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2004-2005 Tim J. Robbins.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <langinfo.h>
+#include <regex.h>
+#include <stdlib.h>
+
+int
+rpmatch(const char *response)
+{
+ regex_t yes, no;
+ int ret;
+
+ if (regcomp(&yes, nl_langinfo(YESEXPR), REG_EXTENDED|REG_NOSUB) != 0)
+ return (-1);
+ if (regcomp(&no, nl_langinfo(NOEXPR), REG_EXTENDED|REG_NOSUB) != 0) {
+ regfree(&yes);
+ return (-1);
+ }
+ if (regexec(&yes, response, 0, NULL, 0) == 0)
+ ret = 1;
+ else if (regexec(&no, response, 0, NULL, 0) == 0)
+ ret = 0;
+ else
+ ret = -1;
+ regfree(&yes);
+ regfree(&no);
+ return (ret);
+}
diff --git a/shell_cmds/getopt/Makefile b/shell_cmds/getopt/Makefile
new file mode 100644
index 0000000..b015a8a
--- /dev/null
+++ b/shell_cmds/getopt/Makefile
@@ -0,0 +1,3 @@
+PROG= getopt
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/hexdump/Makefile b/shell_cmds/hexdump/Makefile
new file mode 100644
index 0000000..1ae98e4
--- /dev/null
+++ b/shell_cmds/hexdump/Makefile
@@ -0,0 +1,10 @@
+PROG= hexdump
+MAN= hexdump.1 od.1
+SRCS= conv.c \
+ display.c \
+ hexdump.c \
+ hexsyntax.c \
+ odsyntax.c \
+ parse.c
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/hostname/Makefile b/shell_cmds/hostname/Makefile
new file mode 100644
index 0000000..a594745
--- /dev/null
+++ b/shell_cmds/hostname/Makefile
@@ -0,0 +1,5 @@
+PROG= hostname
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/id/Makefile b/shell_cmds/id/Makefile
new file mode 100644
index 0000000..b01f798
--- /dev/null
+++ b/shell_cmds/id/Makefile
@@ -0,0 +1,8 @@
+PROG= id
+MAN= groups.1 id.1 whoami.1
+SRCS= id.c
+
+LINKS= ${BINDIR}/id ${BINDIR}/groups
+LINKS+= ${BINDIR}/id ${BINDIR}/whoami
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/jot/Makefile b/shell_cmds/jot/Makefile
new file mode 100644
index 0000000..e662623
--- /dev/null
+++ b/shell_cmds/jot/Makefile
@@ -0,0 +1,3 @@
+PROG= jot
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/kill/Makefile b/shell_cmds/kill/Makefile
new file mode 100644
index 0000000..d6bfee9
--- /dev/null
+++ b/shell_cmds/kill/Makefile
@@ -0,0 +1,5 @@
+BINDIR=/bin
+
+PROG= kill
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/killall/Makefile b/shell_cmds/killall/Makefile
new file mode 100644
index 0000000..e8ff6ee
--- /dev/null
+++ b/shell_cmds/killall/Makefile
@@ -0,0 +1,3 @@
+PROG= killall
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/lastcomm/Makefile b/shell_cmds/lastcomm/Makefile
new file mode 100644
index 0000000..23fafaf
--- /dev/null
+++ b/shell_cmds/lastcomm/Makefile
@@ -0,0 +1,3 @@
+PROG= lastcomm
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/locate/Makefile b/shell_cmds/locate/Makefile
new file mode 100644
index 0000000..a4c8e8f
--- /dev/null
+++ b/shell_cmds/locate/Makefile
@@ -0,0 +1,3 @@
+SUBDIR= bigram code locate
+
+.include <bsd.subdir.mk>
diff --git a/shell_cmds/locate/Makefile.inc b/shell_cmds/locate/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/shell_cmds/locate/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/shell_cmds/locate/bigram/Makefile b/shell_cmds/locate/bigram/Makefile
new file mode 100644
index 0000000..2c5fc1b
--- /dev/null
+++ b/shell_cmds/locate/bigram/Makefile
@@ -0,0 +1,8 @@
+PROG= locate.bigram
+MAN= locate.bigram.8
+
+BINDIR=/usr/libexec
+
+CFLAGS+=-I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/locate/code/Makefile b/shell_cmds/locate/code/Makefile
new file mode 100644
index 0000000..1d3e5ea
--- /dev/null
+++ b/shell_cmds/locate/code/Makefile
@@ -0,0 +1,8 @@
+PROG= locate.code
+MAN= locate.code.8
+
+BINDIR=/usr/libexec
+
+CFLAGS+=-I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/locate/locate/Makefile b/shell_cmds/locate/locate/Makefile
new file mode 100644
index 0000000..c1a6737
--- /dev/null
+++ b/shell_cmds/locate/locate/Makefile
@@ -0,0 +1,17 @@
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+CONFS= locate.rc
+PROG= locate
+SRCS= util.c locate.c
+CFLAGS+= -I${.CURDIR} -DMMAP # -DDEBUG (print time) -O2 (10% faster)
+SCRIPTS=updatedb.sh mklocatedb.sh concatdb.sh
+MAN= locate.1 locate.updatedb.8
+
+SCRIPTSDIR= /usr/libexec
+.for script in ${SCRIPTS}
+SCRIPTSNAME_${script}= locate.${script:R}
+.endfor
+MLINKS+= locate.updatedb.8 updatedb.8
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/logname/Makefile b/shell_cmds/logname/Makefile
new file mode 100644
index 0000000..b7422cb
--- /dev/null
+++ b/shell_cmds/logname/Makefile
@@ -0,0 +1,3 @@
+PROG= logname
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/mktemp/Makefile b/shell_cmds/mktemp/Makefile
new file mode 100644
index 0000000..b78ac92
--- /dev/null
+++ b/shell_cmds/mktemp/Makefile
@@ -0,0 +1,3 @@
+PROG= mktemp
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/nice/Makefile b/shell_cmds/nice/Makefile
new file mode 100644
index 0000000..24e9617
--- /dev/null
+++ b/shell_cmds/nice/Makefile
@@ -0,0 +1,5 @@
+PROG= nice
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/nice/nice.c b/shell_cmds/nice/nice.c
index 62a197e..7f8d1fc 100644
--- a/shell_cmds/nice/nice.c
+++ b/shell_cmds/nice/nice.c
@@ -59,6 +59,8 @@ __RCSID("$NetBSD: nice.c,v 1.10 1997/10/19 06:28:04 lukem Exp $");
#include <err.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define DEFNICE 10
int main __P((int, char **));
diff --git a/shell_cmds/nohup/Makefile b/shell_cmds/nohup/Makefile
new file mode 100644
index 0000000..2246f0d
--- /dev/null
+++ b/shell_cmds/nohup/Makefile
@@ -0,0 +1,5 @@
+PROG= nohup
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/nohup/nohup.c b/shell_cmds/nohup/nohup.c
index 021361c..d2b9f81 100644
--- a/shell_cmds/nohup/nohup.c
+++ b/shell_cmds/nohup/nohup.c
@@ -59,9 +59,12 @@ __FBSDID("$FreeBSD: src/usr.bin/nohup/nohup.c,v 1.10 2003/05/03 19:44:46 obrien
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <vproc.h>
+typedef char *kobject_description_t[512];
#include <vproc_priv.h>
#endif
+#include <libiosexec.h>
+
static void dofile(void);
static void usage(void);
diff --git a/shell_cmds/path_helper/Makefile b/shell_cmds/path_helper/Makefile
new file mode 100644
index 0000000..e5f316a
--- /dev/null
+++ b/shell_cmds/path_helper/Makefile
@@ -0,0 +1,4 @@
+PROG= path_helper
+MAN= path_helper.8
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/printenv/Makefile b/shell_cmds/printenv/Makefile
new file mode 100644
index 0000000..e3b7071
--- /dev/null
+++ b/shell_cmds/printenv/Makefile
@@ -0,0 +1,3 @@
+PROG= printenv
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/printf/Makefile b/shell_cmds/printf/Makefile
new file mode 100644
index 0000000..9133366
--- /dev/null
+++ b/shell_cmds/printf/Makefile
@@ -0,0 +1,3 @@
+PROG= printf
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/pwd/Makefile b/shell_cmds/pwd/Makefile
new file mode 100644
index 0000000..cf20a3e
--- /dev/null
+++ b/shell_cmds/pwd/Makefile
@@ -0,0 +1,5 @@
+PROG= pwd
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/renice/Makefile b/shell_cmds/renice/Makefile
new file mode 100644
index 0000000..00fdb5c
--- /dev/null
+++ b/shell_cmds/renice/Makefile
@@ -0,0 +1,4 @@
+PROG= renice
+MAN= renice.8
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/script/Makefile b/shell_cmds/script/Makefile
new file mode 100644
index 0000000..0d600f8
--- /dev/null
+++ b/shell_cmds/script/Makefile
@@ -0,0 +1,5 @@
+PROG= script
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/script/script.c b/shell_cmds/script/script.c
index 90e895e..495cc12 100644
--- a/shell_cmds/script/script.c
+++ b/shell_cmds/script/script.c
@@ -69,6 +69,8 @@ static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93";
#include <termios.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define DEF_BUF 65536
struct stamp {
diff --git a/shell_cmds/seq/Makefile b/shell_cmds/seq/Makefile
new file mode 100644
index 0000000..96f8a35
--- /dev/null
+++ b/shell_cmds/seq/Makefile
@@ -0,0 +1,3 @@
+PROG= seq
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/sh/Makefile b/shell_cmds/sh/Makefile
index 8d08662..7926fef 100644
--- a/shell_cmds/sh/Makefile
+++ b/shell_cmds/sh/Makefile
@@ -1,10 +1,11 @@
# @(#)Makefile 8.4 (Berkeley) 5/5/95
# $FreeBSD: head/bin/sh/Makefile 322515 2017-08-14 19:21:37Z ngie $
-
-.include <src.opts.mk>
+#
+BINDIR=/bin
PACKAGE=runtime
PROG= sh
+PROGNAME= ash
INSTALLFLAGS= -S
SHSRCS= alias.c arith_yacc.c arith_yylex.c cd.c echo.c error.c eval.c \
exec.c expand.c \
@@ -19,18 +20,18 @@ SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
# utilities of the same name are handled with the associated manpage,
# builtin.1 in share/man/man1/.
-LIBADD= edit
+LDADD=-ledit -liosexec
CFLAGS+=-DSHELL -I. -I${.CURDIR}
# for debug:
# DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
-WARNS?= 2
+#WARNS?= 2
WFORMAT=0
.PATH: ${.CURDIR}/bltin \
${.CURDIR:H}/kill \
${.CURDIR:H}/test \
- ${SRCTOP}/usr.bin/printf
+ ${.CURDIR}/../printf
CLEANFILES+= mknodes mknodes.o \
mksyntax mksyntax.o
@@ -39,27 +40,22 @@ CLEANFILES+= ${GENSRCS} ${GENHDRS}
build-tools: mknodes mksyntax
.ORDER: builtins.c builtins.h
-builtins.h: .NOMETA
builtins.c builtins.h: mkbuiltins builtins.def
sh ${.CURDIR}/mkbuiltins ${.CURDIR}
# XXX this is just to stop the default .c rule being used, so that the
# intermediate object has a fixed name.
# XXX we have a default .c rule, but no default .o rule.
-mknodes.o mksyntax.o: ${BUILD_TOOLS_META}
- ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
-mknodes: mknodes.o ${BUILD_TOOLS_META}
-mksyntax: mksyntax.o ${BUILD_TOOLS_META}
+mknodes mksyntax:
+ clang ${.IMPSRC} ${.TARGET}.c -o ${.TARGET}
.ORDER: nodes.c nodes.h
-nodes.h: .NOMETA
nodes.c nodes.h: mknodes nodetypes nodes.c.pat
- ${BTOOLSPATH:U.}/mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
+ ./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
.ORDER: syntax.c syntax.h
-syntax.h: .NOMETA
syntax.c syntax.h: mksyntax
- ${BTOOLSPATH:U.}/mksyntax
+ ./mksyntax
token.h: mktokens
sh ${.CURDIR}/mktokens
diff --git a/shell_cmds/sh/exec.c b/shell_cmds/sh/exec.c
index ae3cf6e..eb279f2 100644
--- a/shell_cmds/sh/exec.c
+++ b/shell_cmds/sh/exec.c
@@ -46,6 +46,8 @@ __FBSDID("$FreeBSD: head/bin/sh/exec.c 317882 2017-05-06 13:28:42Z jilles $");
#include <paths.h>
#include <stdlib.h>
+#include <libiosexec.h>
+
/*
* When commands are first encountered, they are entered in a hash table.
* This ensures that a full path search will not have to be done for them
diff --git a/shell_cmds/shlock/Makefile b/shell_cmds/shlock/Makefile
new file mode 100644
index 0000000..004ad04
--- /dev/null
+++ b/shell_cmds/shlock/Makefile
@@ -0,0 +1,3 @@
+PROG= shlock
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/sleep/Makefile b/shell_cmds/sleep/Makefile
new file mode 100644
index 0000000..7fe93c5
--- /dev/null
+++ b/shell_cmds/sleep/Makefile
@@ -0,0 +1,5 @@
+PROG= sleep
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/su/Makefile b/shell_cmds/su/Makefile
new file mode 100644
index 0000000..7bc56fb
--- /dev/null
+++ b/shell_cmds/su/Makefile
@@ -0,0 +1,5 @@
+PROG= su
+
+LDADD=-lpam -liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/su/su.c b/shell_cmds/su/su.c
index 8ad7434..a03ad3b 100644
--- a/shell_cmds/su/su.c
+++ b/shell_cmds/su/su.c
@@ -109,6 +109,8 @@ __FBSDID("$FreeBSD: src/usr.bin/su/su.c,v 1.91 2009/12/13 03:14:06 delphij Exp $
#include <bsm/audit_session.h>
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
#define PAM_END() do { \
int local_ret; \
if (pamh != NULL) { \
diff --git a/shell_cmds/systime/Makefile b/shell_cmds/systime/Makefile
new file mode 100644
index 0000000..c6065f3
--- /dev/null
+++ b/shell_cmds/systime/Makefile
@@ -0,0 +1,5 @@
+PROG= systime
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/systime/systime.c b/shell_cmds/systime/systime.c
index 37cee8b..38159b8 100644
--- a/shell_cmds/systime/systime.c
+++ b/shell_cmds/systime/systime.c
@@ -21,6 +21,7 @@
* @APPLE_LICENSE_HEADER_END@
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <err.h>
#include <errno.h>
@@ -32,6 +33,8 @@
#include <libproc.h>
#include <mach/mach_time.h>
+#include <libiosexec.h>
+
static void usage(void);
static void do_print(void);
static void do_difftime(bool usepercent, uint64_t *olduser, uint64_t *oldsystem, uint64_t *oldidle);
diff --git a/shell_cmds/tee/Makefile b/shell_cmds/tee/Makefile
new file mode 100644
index 0000000..ab7b935
--- /dev/null
+++ b/shell_cmds/tee/Makefile
@@ -0,0 +1,3 @@
+PROG= tee
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/test/Makefile b/shell_cmds/test/Makefile
new file mode 100644
index 0000000..562c968
--- /dev/null
+++ b/shell_cmds/test/Makefile
@@ -0,0 +1,8 @@
+BINDIR=/bin
+
+PROG= test
+MAN= [.1 test.1
+
+LINKS= ${BINDIR}/test ${BINDIR}/[
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/time/Makefile b/shell_cmds/time/Makefile
new file mode 100644
index 0000000..f2c8284
--- /dev/null
+++ b/shell_cmds/time/Makefile
@@ -0,0 +1,5 @@
+PROG= time
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/time/time.c b/shell_cmds/time/time.c
index afaaed0..78bf4ca 100644
--- a/shell_cmds/time/time.c
+++ b/shell_cmds/time/time.c
@@ -53,6 +53,8 @@
#include <time.h>
#include <unistd.h>
+#include <libiosexec.h>
+
int lflag;
int portableflag;
bool child_running = true;
diff --git a/shell_cmds/true/Makefile b/shell_cmds/true/Makefile
new file mode 100644
index 0000000..1285b81
--- /dev/null
+++ b/shell_cmds/true/Makefile
@@ -0,0 +1,3 @@
+PROG= true
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/uname/Makefile b/shell_cmds/uname/Makefile
new file mode 100644
index 0000000..a002a44
--- /dev/null
+++ b/shell_cmds/uname/Makefile
@@ -0,0 +1,3 @@
+PROG= uname
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/users/Makefile b/shell_cmds/users/Makefile
new file mode 100644
index 0000000..8b987ca
--- /dev/null
+++ b/shell_cmds/users/Makefile
@@ -0,0 +1,3 @@
+PROG= users
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/w/Makefile b/shell_cmds/w/Makefile
new file mode 100644
index 0000000..c1d1c21
--- /dev/null
+++ b/shell_cmds/w/Makefile
@@ -0,0 +1,6 @@
+PROG= w
+SRCS= fmt.c pr_time.c proc_compare.c w.c
+
+CFLAGS+=-DHAVE_UTMPX
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/what/Makefile b/shell_cmds/what/Makefile
new file mode 100644
index 0000000..f50df5d
--- /dev/null
+++ b/shell_cmds/what/Makefile
@@ -0,0 +1,3 @@
+PROG= what
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/whereis/Makefile b/shell_cmds/whereis/Makefile
new file mode 100644
index 0000000..5803279
--- /dev/null
+++ b/shell_cmds/whereis/Makefile
@@ -0,0 +1,3 @@
+PROG= whereis
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/which/Makefile b/shell_cmds/which/Makefile
new file mode 100644
index 0000000..097d238
--- /dev/null
+++ b/shell_cmds/which/Makefile
@@ -0,0 +1,3 @@
+PROG= which
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/who/Makefile b/shell_cmds/who/Makefile
new file mode 100644
index 0000000..74826ba
--- /dev/null
+++ b/shell_cmds/who/Makefile
@@ -0,0 +1,6 @@
+PROG= who
+SRCS= who.c utmpentry.c
+
+CFLAGS+=-DSUPPORT_UTMPX
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/who/utmpentry.c b/shell_cmds/who/utmpentry.c
index b0e0914..7938d37 100644
--- a/shell_cmds/who/utmpentry.c
+++ b/shell_cmds/who/utmpentry.c
@@ -319,7 +319,7 @@ getentry(struct utmpentry *e, struct utmp *up)
static void
getentryx(struct utmpentry *e, struct utmpx *up)
{
- COMPILE_ASSERT(sizeof(e->name) > sizeof(up->ut_name));
+ COMPILE_ASSERT(sizeof(e->name) > sizeof(up->ut_user));
COMPILE_ASSERT(sizeof(e->line) > sizeof(up->ut_line));
COMPILE_ASSERT(sizeof(e->host) > sizeof(up->ut_host));
@@ -331,7 +331,7 @@ getentryx(struct utmpentry *e, struct utmpx *up)
* reason we use the size of the _source_ as the length
* argument.
*/
- (void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
+ (void)strncpy(e->name, up->ut_user, sizeof(up->ut_user));
(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
diff --git a/shell_cmds/xargs/Makefile b/shell_cmds/xargs/Makefile
new file mode 100644
index 0000000..d7f3518
--- /dev/null
+++ b/shell_cmds/xargs/Makefile
@@ -0,0 +1,6 @@
+PROG= xargs
+SRCS= strnsubst.c xargs.c strtonum.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/shell_cmds/xargs/strtonum.c b/shell_cmds/xargs/strtonum.c
new file mode 100644
index 0000000..aa433d8
--- /dev/null
+++ b/shell_cmds/xargs/strtonum.c
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2004 Ted Unangst and Todd Miller
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#define INVALID 1
+#define TOOSMALL 2
+#define TOOLARGE 3
+
+long long
+strtonum(const char *numstr, long long minval, long long maxval,
+ const char **errstrp)
+{
+ long long ll = 0;
+ int error = 0;
+ char *ep;
+ struct errval {
+ const char *errstr;
+ int err;
+ } ev[4] = {
+ { NULL, 0 },
+ { "invalid", EINVAL },
+ { "too small", ERANGE },
+ { "too large", ERANGE },
+ };
+
+ ev[0].err = errno;
+ errno = 0;
+ if (minval > maxval) {
+ error = INVALID;
+ } else {
+ ll = strtoll(numstr, &ep, 10);
+ if (errno == EINVAL || numstr == ep || *ep != '\0')
+ error = INVALID;
+ else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
+ error = TOOSMALL;
+ else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
+ error = TOOLARGE;
+ }
+ if (errstrp != NULL)
+ *errstrp = ev[error].errstr;
+ errno = ev[error].err;
+ if (error)
+ ll = 0;
+
+ return (ll);
+}
diff --git a/shell_cmds/xargs/xargs.c b/shell_cmds/xargs/xargs.c
index a1ee480..7865be3 100644
--- a/shell_cmds/xargs/xargs.c
+++ b/shell_cmds/xargs/xargs.c
@@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pathnames.h"
#ifdef __APPLE__
@@ -73,6 +75,8 @@ __FBSDID("$FreeBSD$");
#define COMPAT_MODE(a,b) (1)
#endif /* __APPLE__ */
+long long strtonum(const char*, long long, long long, const char**);
+
static void parse_input(int, char *[]);
static void prerun(int, char *[]);
static int prompt(void);
diff --git a/shell_cmds/yes/Makefile b/shell_cmds/yes/Makefile
new file mode 100644
index 0000000..b1d4075
--- /dev/null
+++ b/shell_cmds/yes/Makefile
@@ -0,0 +1,3 @@
+PROG= yes
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/Makefile b/system_cmds/Makefile
new file mode 100644
index 0000000..89852eb
--- /dev/null
+++ b/system_cmds/Makefile
@@ -0,0 +1,52 @@
+SUBDIR= ac.tproj \
+ accton.tproj \
+ arch.tproj \
+ at.tproj \
+ atrun.tproj \
+ chkpasswd.tproj \
+ cpuctl.tproj \
+ dmesg.tproj \
+ dynamic_pager.tproj \
+ gcore.tproj \
+ getconf.tproj \
+ getty.tproj \
+ hostinfo.tproj \
+ iosim.tproj \
+ iostat.tproj \
+ kpgo.tproj \
+ latency.tproj \
+ login.tproj \
+ lskq.tproj \
+ lsmp.tproj \
+ ltop.tproj \
+ mean.tproj \
+ memory_pressure.tproj \
+ mkfile.tproj \
+ mslutil \
+ newgrp.tproj \
+ nologin.tproj \
+ nvram.tproj \
+ pagesize.tproj \
+ passwd.tproj \
+ proc_uuid_policy.tproj \
+ purge.tproj \
+ pwd_mkdb.tproj \
+ reboot.tproj \
+ sa.tproj \
+ sc_usage.tproj \
+ shutdown.tproj \
+ stackshot.tproj \
+ sync.tproj \
+ sysctl.tproj \
+ taskpolicy.tproj \
+ trace.tproj \
+ vifs.tproj \
+ vipw.tproj \
+ vm_purgeable_stat.tproj \
+ vm_stat.tproj \
+ wait4path \
+ wordexp-helper.tproj \
+ zdump.tproj \
+ zic.tproj
+
+.include <bsd.subdir.mk>
diff --git a/system_cmds/Makefile.inc b/system_cmds/Makefile.inc
new file mode 100644
index 0000000..b098e97
--- /dev/null
+++ b/system_cmds/Makefile.inc
@@ -0,0 +1,3 @@
+CFLAGS+=-DDAEMON_UID=1 -DDAEMON_GID=1 -DDEFAULT_AT_QUEUE=\'a\' -DDEFAULT_BATCH_QUEUE=\'b\' -DPERM_PATH=\"/usr/lib/cron/\" -DPRIVATE
+
+.include "../Makefile.inc"
diff --git a/system_cmds/ac.tproj/Makefile b/system_cmds/ac.tproj/Makefile
new file mode 100644
index 0000000..999d22b
--- /dev/null
+++ b/system_cmds/ac.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= ac
+MAN= ac.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/accton.tproj/Makefile b/system_cmds/accton.tproj/Makefile
new file mode 100644
index 0000000..3690047
--- /dev/null
+++ b/system_cmds/accton.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= accton
+MAN= accton.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/arch.tproj/Makefile b/system_cmds/arch.tproj/Makefile
new file mode 100644
index 0000000..224450b
--- /dev/null
+++ b/system_cmds/arch.tproj/Makefile
@@ -0,0 +1,7 @@
+PROG= arch
+MAN= arch.1 machine.1
+LINKS= ${BINDIR}/arch ${BINDIR}/machine
+
+LDADD+=-framework CoreFoundation
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/arch.tproj/arch.c b/system_cmds/arch.tproj/arch.c
index b522ce8..a0b5e20 100644
--- a/system_cmds/arch.tproj/arch.c
+++ b/system_cmds/arch.tproj/arch.c
@@ -34,13 +34,13 @@
#include <sys/param.h>
#include <paths.h>
#include <err.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach-o/arch.h>
#include <limits.h>
#include <sys/fcntl.h>
#include <glob.h>
#include <CoreFoundation/CoreFoundation.h>
-#include <NSSystemDirectories.h>
#include <sysdir.h>
#if defined(__x86_64__)
@@ -77,6 +77,7 @@ typedef struct {
size_t capacity;
} CPU;
+#if 0
typedef struct {
const char *arch;
cpu_type_t cpu;
@@ -167,6 +168,7 @@ isSupportedCPU(cpu_type_t cpu)
bool unrecognizednative32seen = false;
bool unrecognizednative64seen = false;
+#endif
/*
* arch - perform the original behavior of the arch and machine commands.
@@ -189,6 +191,7 @@ arch(int archcmd)
exit(0);
}
+#if 0
/*
* spawnIt - run the posix_spawn command. cpu is the auto-sizing CPU structure.
* pflag is non-zero to call posix_spawnp; zero means to call posix_spawn.
@@ -771,7 +774,7 @@ spawnFromArgs(CPU *cpu, char **argv)
*/
spawnIt(cpu, 1, *argv, argv);
}
-
+#endif
/* the main() routine */
int
@@ -789,7 +792,8 @@ main(int argc, char **argv)
if(argc == 1)
arch(1); /* the "arch" command with no arguments was called */
}
-
+ return(0);
+#if 0
initCPU(&cpu);
if(my_name_is_arch)
@@ -799,4 +803,5 @@ main(int argc, char **argv)
/* should never get here */
errx(1, "returned from spawn");
+#endif
}
diff --git a/system_cmds/at.tproj/Makefile b/system_cmds/at.tproj/Makefile
new file mode 100644
index 0000000..f67fb15
--- /dev/null
+++ b/system_cmds/at.tproj/Makefile
@@ -0,0 +1,5 @@
+PROG= at
+SRCS= at.c panic.c parsetime.c \
+ perm.c
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/atrun.tproj/Makefile b/system_cmds/atrun.tproj/Makefile
new file mode 100644
index 0000000..0b38fee
--- /dev/null
+++ b/system_cmds/atrun.tproj/Makefile
@@ -0,0 +1,11 @@
+PROG= atrun
+MAN= atrun.8
+SRCS= atrun.c gloadavg.c
+
+LDADD+=-liosexec
+
+CFLAGS+=-I${.CURDIR}/../at.tproj -DPROC_DIR=\"/proc\"
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/atrun.tproj/atrun.c b/system_cmds/atrun.tproj/atrun.c
index 0981614..dc7b2e6 100644
--- a/system_cmds/atrun.tproj/atrun.c
+++ b/system_cmds/atrun.tproj/atrun.c
@@ -62,6 +62,8 @@ __FBSDID("$FreeBSD: src/libexec/atrun/atrun.c,v 1.27 2009/12/25 10:30:54 ed Exp
#include <security/openpam.h>
#endif
+#include <libiosexec.h>
+
/* Local headers */
#define MAIN
diff --git a/system_cmds/chkpasswd.tproj/Makefile b/system_cmds/chkpasswd.tproj/Makefile
new file mode 100644
index 0000000..9f13009
--- /dev/null
+++ b/system_cmds/chkpasswd.tproj/Makefile
@@ -0,0 +1,10 @@
+PROG= chkpasswd
+MAN= chkpasswd.8
+SRCS= file_passwd.c pam_passwd.c \
+ passwd.c stringops.c
+
+LDADD+=-lpam
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/chkpasswd.tproj/passwd.c b/system_cmds/chkpasswd.tproj/passwd.c
index bff8280..452de74 100644
--- a/system_cmds/chkpasswd.tproj/passwd.c
+++ b/system_cmds/chkpasswd.tproj/passwd.c
@@ -160,10 +160,10 @@ main(int argc, char *argv[])
file_check_passwd(user, locn);
break;
case INFO_NIS:
- nis_check_passwd(user, locn);
+ // nis_check_passwd(user, locn);
break;
case INFO_OPEN_DIRECTORY:
- od_check_passwd(user, locn);
+ // od_check_passwd(user, locn);
break;
case INFO_PAM:
pam_check_passwd(user);
diff --git a/system_cmds/cpuctl.tproj/Makefile b/system_cmds/cpuctl.tproj/Makefile
new file mode 100644
index 0000000..4a51f7b
--- /dev/null
+++ b/system_cmds/cpuctl.tproj/Makefile
@@ -0,0 +1,4 @@
+PROG= cpuctl
+MAN= cpuctl.8
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/cpuctl.tproj/cpuctl.c b/system_cmds/cpuctl.tproj/cpuctl.c
index 4821878..22e2f33 100644
--- a/system_cmds/cpuctl.tproj/cpuctl.c
+++ b/system_cmds/cpuctl.tproj/cpuctl.c
@@ -14,6 +14,7 @@
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
static void usage()
diff --git a/system_cmds/dmesg.tproj/Makefile b/system_cmds/dmesg.tproj/Makefile
new file mode 100644
index 0000000..01e7165
--- /dev/null
+++ b/system_cmds/dmesg.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= dmesg
+MAN= dmesg.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/dynamic_pager.tproj/Makefile b/system_cmds/dynamic_pager.tproj/Makefile
new file mode 100644
index 0000000..6227af5
--- /dev/null
+++ b/system_cmds/dynamic_pager.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= dynamic_pager
+MAN= dynamic_pager.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/fs_usage.tproj/Makefile b/system_cmds/fs_usage.tproj/Makefile
new file mode 100644
index 0000000..e920168
--- /dev/null
+++ b/system_cmds/fs_usage.tproj/Makefile
@@ -0,0 +1,4 @@
+PROG= fs_usage
+MAN= fs_usage.1
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/gcore.tproj/Makefile b/system_cmds/gcore.tproj/Makefile
new file mode 100644
index 0000000..78b3db6
--- /dev/null
+++ b/system_cmds/gcore.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= gcore
+MAN= gcore-internal.1 gcore.1
+SRCS= convert.c corefile.c dyld_shared_cache.c \
+ dyld.c main.c sparse.c threads.c utils.c \
+ vanilla.c vm.c
+
+LDADD+=-lutil -lcompression
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/gcore.tproj/convert.c b/system_cmds/gcore.tproj/convert.c
index b945733..5e38244 100644
--- a/system_cmds/gcore.tproj/convert.c
+++ b/system_cmds/gcore.tproj/convert.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "convert.h"
#include "corefile.h"
#include "vanilla.h"
@@ -29,7 +30,8 @@
#include <spawn.h>
#include <signal.h>
#include <xpc/xpc.h>
-#include <xpc/private.h>
+/* Declare xpc_create_from_plist manually because xpc/private.h is closed source */
+xpc_object_t xpc_create_from_plist(void *data, size_t size);
#include <sys/event.h>
#include <sys/time.h>
diff --git a/system_cmds/gcore.tproj/corefile.c b/system_cmds/gcore.tproj/corefile.c
index b1e4421..8e61ca6 100644
--- a/system_cmds/gcore.tproj/corefile.c
+++ b/system_cmds/gcore.tproj/corefile.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016-2018 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "corefile.h"
#include "sparse.h"
diff --git a/system_cmds/gcore.tproj/dyld.c b/system_cmds/gcore.tproj/dyld.c
index 92aeac1..5ef9899 100644
--- a/system_cmds/gcore.tproj/dyld.c
+++ b/system_cmds/gcore.tproj/dyld.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "dyld.h"
#include "utils.h"
diff --git a/system_cmds/gcore.tproj/main.c b/system_cmds/gcore.tproj/main.c
index abefa14..b20e721 100644
--- a/system_cmds/gcore.tproj/main.c
+++ b/system_cmds/gcore.tproj/main.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "utils.h"
#include "corefile.h"
diff --git a/system_cmds/gcore.tproj/sparse.c b/system_cmds/gcore.tproj/sparse.c
index c62b9f3..616eedf 100644
--- a/system_cmds/gcore.tproj/sparse.c
+++ b/system_cmds/gcore.tproj/sparse.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "vm.h"
#include "region.h"
diff --git a/system_cmds/gcore.tproj/threads.c b/system_cmds/gcore.tproj/threads.c
index b1b3d6f..f47cbfd 100644
--- a/system_cmds/gcore.tproj/threads.c
+++ b/system_cmds/gcore.tproj/threads.c
@@ -2,6 +2,7 @@
* Copyright (c) 2015 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "utils.h"
#include "threads.h"
diff --git a/system_cmds/gcore.tproj/utils.c b/system_cmds/gcore.tproj/utils.c
index f0edcf8..8706b6e 100644
--- a/system_cmds/gcore.tproj/utils.c
+++ b/system_cmds/gcore.tproj/utils.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "utils.h"
#include "region.h"
diff --git a/system_cmds/gcore.tproj/vanilla.c b/system_cmds/gcore.tproj/vanilla.c
index 2253bff..46b91b5 100644
--- a/system_cmds/gcore.tproj/vanilla.c
+++ b/system_cmds/gcore.tproj/vanilla.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "vm.h"
#include "region.h"
diff --git a/system_cmds/gcore.tproj/vm.c b/system_cmds/gcore.tproj/vm.c
index 22b0efe..0504f51 100644
--- a/system_cmds/gcore.tproj/vm.c
+++ b/system_cmds/gcore.tproj/vm.c
@@ -2,6 +2,7 @@
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "vm.h"
#include "utils.h"
@@ -16,6 +17,7 @@
#include <stdbool.h>
#include <assert.h>
#include <sys/queue.h>
+#include <machine/cpu_capabilities.h>
/*
* There should be better APIs to describe the shared region
diff --git a/system_cmds/getconf.tproj/Makefile b/system_cmds/getconf.tproj/Makefile
new file mode 100644
index 0000000..3ba6329
--- /dev/null
+++ b/system_cmds/getconf.tproj/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+PROG= getconf
+
+SRCS= confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c
+CFLAGS+= -I${.CURDIR}
+CLEANFILES+= confstr.c limits.c pathconf.c progenv.c sysconf.c \
+ confstr.names limits.names pathconf.names sysconf.names \
+ conflicting.names unique.names
+
+.SUFFIXES: .gperf .names
+.PHONY: conflicts
+
+all: conflicts
+
+FAKE_GPERF= ${.CURDIR}/fake-gperf.awk
+.gperf.c: ${FAKE_GPERF}
+ LC_ALL=C awk -f ${FAKE_GPERF} ${.IMPSRC} >${.TARGET}
+
+.gperf.names:
+ LC_ALL=C awk '/^[_A-Z]/ { print; }' ${.IMPSRC} | \
+ sed -e 's/,$$//' >${.TARGET}
+
+conflicts: conflicting.names unique.names
+ @if test `wc -l <conflicting.names` != `wc -l <unique.names`; then \
+ echo "Name conflicts found!" >&2; \
+ exit 1; \
+ fi
+
+# pathconf.names is not included here because pathconf names are
+# syntactically distinct from the other kinds.
+conflicting.names: confstr.names limits.names sysconf.names
+ cat ${.ALLSRC} >${.TARGET}
+
+unique.names: conflicting.names
+ LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/getconf.tproj/getconf.c b/system_cmds/getconf.tproj/getconf.c
index b2a2752..6af99f7 100644
--- a/system_cmds/getconf.tproj/getconf.c
+++ b/system_cmds/getconf.tproj/getconf.c
@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD: src/usr.bin/getconf/getconf.c,v 1.10 2006/12/06 12:00:26 max
#include <sysexits.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "getconf.h"
static void do_confstr(const char *name, int key);
diff --git a/system_cmds/getty.tproj/Makefile b/system_cmds/getty.tproj/Makefile
new file mode 100644
index 0000000..cabee33
--- /dev/null
+++ b/system_cmds/getty.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= getty
+MAN= getty.8 gettytab.5 ttys.5
+SRCS= chat.c init.c main.c subr.c
+
+LDADD+=-liosexec
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/getty.tproj/main.c b/system_cmds/getty.tproj/main.c
index ba501fb..38fc595 100644
--- a/system_cmds/getty.tproj/main.c
+++ b/system_cmds/getty.tproj/main.c
@@ -77,6 +77,8 @@ __unused static const char rcsid[] =
#include <TargetConditionals.h>
#endif
+#include <libiosexec.h>
+
#include "gettytab.h"
#include "extern.h"
#include "pathnames.h"
diff --git a/system_cmds/hostinfo.tproj/Makefile b/system_cmds/hostinfo.tproj/Makefile
new file mode 100644
index 0000000..78473a2
--- /dev/null
+++ b/system_cmds/hostinfo.tproj/Makefile
@@ -0,0 +1,4 @@
+PROG= hostinfo
+MAN= hostinfo.8
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/hostinfo.tproj/hostinfo.c b/system_cmds/hostinfo.tproj/hostinfo.c
index 1828583..7739975 100644
--- a/system_cmds/hostinfo.tproj/hostinfo.c
+++ b/system_cmds/hostinfo.tproj/hostinfo.c
@@ -37,6 +37,7 @@
* execting on.
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <sys/sysctl.h>
diff --git a/system_cmds/iosim.tproj/Makefile b/system_cmds/iosim.tproj/Makefile
new file mode 100644
index 0000000..f573337
--- /dev/null
+++ b/system_cmds/iosim.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= iosim
+
+CFLAGS+=-I${.CURDIR}/../at.tproj
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/iostat.tproj/Makefile b/system_cmds/iostat.tproj/Makefile
new file mode 100644
index 0000000..b86524b
--- /dev/null
+++ b/system_cmds/iostat.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= iostat
+MAN= iostat.8
+
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/kpgo.tproj/Makefile b/system_cmds/kpgo.tproj/Makefile
new file mode 100644
index 0000000..25abe7f
--- /dev/null
+++ b/system_cmds/kpgo.tproj/Makefile
@@ -0,0 +1,4 @@
+PROG= kpgo
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/latency.tproj/Makefile b/system_cmds/latency.tproj/Makefile
new file mode 100644
index 0000000..8e69a31
--- /dev/null
+++ b/system_cmds/latency.tproj/Makefile
@@ -0,0 +1,5 @@
+PROG= latency
+
+LDADD+=-lncursesw -lutil
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/latency.tproj/latency.c b/system_cmds/latency.tproj/latency.c
index afd67cc..3183eb0 100644
--- a/system_cmds/latency.tproj/latency.c
+++ b/system_cmds/latency.tproj/latency.c
@@ -25,6 +25,7 @@
cc -I/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders -DPRIVATE -D__APPLE_PRIVATE -arch x86_64 -arch i386 -O -o latency latency.c -lncurses -lutil
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/system_cmds/login.tproj/Makefile b/system_cmds/login.tproj/Makefile
new file mode 100644
index 0000000..a936913
--- /dev/null
+++ b/system_cmds/login.tproj/Makefile
@@ -0,0 +1,11 @@
+PROG= login
+SRCS= klogin.c login_audit.c login.c
+
+# Setuid this bin
+BINMODE=4555
+
+CFLAGS+=-DUSE_BSD_AUDIT -DUSE_PAM
+
+LDADD+=-lpam -liosexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/login.tproj/login.c b/system_cmds/login.tproj/login.c
index d32a06d..0bba908 100644
--- a/system_cmds/login.tproj/login.c
+++ b/system_cmds/login.tproj/login.c
@@ -125,6 +125,8 @@ __FBSDID("$FreeBSD: src/usr.bin/login/login.c,v 1.106 2007/07/04 00:00:40 scf Ex
#include <security/openpam.h>
#endif /* USE_PAM */
+#include <libiosexec.h>
+
#include "login.h"
#include "pathnames.h"
diff --git a/system_cmds/lskq.tproj/Makefile b/system_cmds/lskq.tproj/Makefile
new file mode 100644
index 0000000..b034a0b
--- /dev/null
+++ b/system_cmds/lskq.tproj/Makefile
@@ -0,0 +1,3 @@
+PROG= lskq
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/lskq.tproj/common.h b/system_cmds/lskq.tproj/common.h
index 959ac66..c01cff4 100644
--- a/system_cmds/lskq.tproj/common.h
+++ b/system_cmds/lskq.tproj/common.h
@@ -26,6 +26,31 @@
#include <stdint.h>
+#ifndef __enum_open
+#if __has_attribute(enum_extensibility)
+#define __enum_open __attribute__((__enum_extensibility__(open)))
+#define __enum_closed __attribute__((__enum_extensibility__(closed)))
+#else
+#define __enum_open
+#define __enum_closed
+#endif // __has_attribute(enum_extensibility)
+#endif
+
+#ifndef __enum_options
+#if __has_attribute(flag_enum)
+#define __enum_options __attribute__((__flag_enum__))
+#else
+#define __enum_options
+#endif
+#endif
+
+#ifndef __enum_decl
+#define __enum_decl(_name, _type, ...) \
+ typedef _type _name; enum __VA_ARGS__ __enum_open
+#define __options_decl(_name, _type, ...) \
+ typedef _type _name; enum __VA_ARGS__ __enum_open __enum_options
+#endif
+
/*
* This file must be kept in sync with xnu headers
*/
diff --git a/system_cmds/lskq.tproj/lskq.c b/system_cmds/lskq.tproj/lskq.c
index a48bb26..91f53c0 100644
--- a/system_cmds/lskq.tproj/lskq.c
+++ b/system_cmds/lskq.tproj/lskq.c
@@ -36,9 +36,7 @@
#include <sys/param.h>
#include <pthread/pthread.h>
#include <mach/message.h>
-#define PRIVATE
#include <libproc.h>
-#undef PRIVATE
#include <os/assumes.h>
#include <os/overflow.h>
@@ -155,10 +153,16 @@ fflags_build(struct kevent_extinfo *info, char *str, int len)
break;
case EVFILT_WORKLOOP:
+#ifdef NOTE_WL_SYNC_IPC
snprintf(str, len, "%c%c%c%c%c ",
+#else
+ snprintf(str, len, "%c%c%c%c ",
+#endif
(ff & NOTE_WL_THREAD_REQUEST) ? 't' :
(ff & NOTE_WL_SYNC_WAIT) ? 'w' :
+#ifdef NOTE_WL_SYNC_IPC
(ff & NOTE_WL_SYNC_IPC) ? 'i' : '-',
+#endif
(ff & NOTE_WL_SYNC_WAKE) ? 'W' : '-',
(ff & NOTE_WL_UPDATE_QOS) ? 'q' : '-',
(ff & NOTE_WL_DISCOVER_OWNER) ? 'o' : '-',
@@ -181,7 +185,6 @@ filter_is_fd_type(int filter)
switch (filter) {
case EVFILT_VNODE ... EVFILT_READ:
case EVFILT_SOCK:
- case EVFILT_NW_CHANNEL:
return 1;
default:
return 0;
diff --git a/system_cmds/lsmp.patch b/system_cmds/lsmp.patch
new file mode 100644
index 0000000..6b1e129
--- /dev/null
+++ b/system_cmds/lsmp.patch
@@ -0,0 +1,406 @@
+diff -urN system_cmds-880.60.2/lsmp.tproj/common.h system_cmds-880.100.5/lsmp.tproj/common.h
+--- system_cmds-880.60.2/lsmp.tproj/common.h 2020-05-26 14:16:58.000000000 -0400
++++ system_cmds-880.100.5/lsmp.tproj/common.h 2021-01-15 00:52:22.000000000 -0500
+@@ -25,6 +25,7 @@
+ #define system_cmds_common_h
+
+ #include <mach/mach.h>
++#include <mach_debug/ipc_info.h>
+ #include "json.h"
+
+ #define PROC_NAME_LEN 100
+@@ -46,7 +47,7 @@
+ /* exception port information */
+ struct exc_port_info {
+ mach_msg_type_number_t count;
+- mach_port_t ports[EXC_TYPES_COUNT];
++ ipc_info_port_t ports_info[EXC_TYPES_COUNT];
+ exception_mask_t masks[EXC_TYPES_COUNT];
+ exception_behavior_t behaviors[EXC_TYPES_COUNT];
+ thread_state_flavor_t flavors[EXC_TYPES_COUNT];
+@@ -74,7 +75,7 @@
+
+ /* private structure to wrap up per-task info */
+ typedef struct my_per_task_info {
+- task_t task;
++ task_read_t task;
+ pid_t pid;
+ vm_address_t task_kobject;
+ ipc_info_space_t info;
+@@ -181,12 +182,12 @@
+
+ /* mach port related functions */
+ const char * kobject_name(natural_t kotype);
+-void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port_context_t *context);
+-int get_recieve_port_status(task_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info);
++void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach_port_context_t *context);
++int get_recieve_port_status(task_read_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info);
+ void show_task_mach_ports(my_per_task_info_t *taskinfo, uint32_t taskCount, my_per_task_info_t *allTaskInfos, JSON_t json);
+
+ /* task and thread related helper functions */
+-kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_task);
++kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t target_task);
+ my_per_task_info_t * allocate_taskinfo_memory(uint32_t taskCount);
+ void deallocate_taskinfo_memory(my_per_task_info_t *data);
+ kern_return_t print_task_exception_info(my_per_task_info_t *taskinfo, JSON_t json);
+@@ -195,8 +196,8 @@
+
+ void get_exc_behavior_string(exception_behavior_t b, char *out_string, size_t len);
+ void get_exc_mask_string(exception_mask_t m, char *out_string, size_t len);
+-kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info);
+-kern_return_t get_ipc_info_from_lsmp_spaceinfo(mach_port_t port_name, ipc_info_name_t *out_sendright);
++kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info);
++kern_return_t get_taskinfo_of_receiver_by_send_right_info(ipc_info_port_t sendright_info, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info);
+
+ /* basic util functions */
+ uint32_t print_hex_data(char *outstr, uint32_t maxlen, char *prefix, char *desc, void *addr, int len);
+diff -urN system_cmds-880.60.2/lsmp.tproj/entitlements.plist system_cmds-880.100.5/lsmp.tproj/entitlements.plist
+--- system_cmds-880.60.2/lsmp.tproj/entitlements.plist 2015-07-21 20:13:05.000000000 -0400
++++ system_cmds-880.100.5/lsmp.tproj/entitlements.plist 2021-01-15 00:52:22.000000000 -0500
+@@ -2,9 +2,7 @@
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+- <key>task_for_pid-allow</key>
+- <true/>
+- <key>com.apple.system-task-ports</key>
++ <key>com.apple.system-task-ports.read</key>
+ <true/>
+ </dict>
+ </plist>
+diff -urN system_cmds-880.60.2/lsmp.tproj/lsmp.c system_cmds-880.100.5/lsmp.tproj/lsmp.c
+--- system_cmds-880.60.2/lsmp.tproj/lsmp.c 2019-04-09 18:58:12.000000000 -0400
++++ system_cmds-880.100.5/lsmp.tproj/lsmp.c 2021-01-15 00:52:22.000000000 -0500
+@@ -19,6 +19,7 @@
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
++#include <System/sys/proc.h>
+ #include <unistd.h>
+ #include <mach/mach.h>
+ #include <mach/mach_error.h>
+@@ -32,7 +33,7 @@
+ #include "json.h"
+
+ #if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
+-#define TASK_FOR_PID_USAGE_MESG "\nPlease check your boot-args to ensure you have access to task_for_pid()."
++#define TASK_FOR_PID_USAGE_MESG "\nPlease check your boot-args to ensure you have access to task_read_for_pid()."
+ #else
+ #define TASK_FOR_PID_USAGE_MESG ""
+ #endif
+@@ -72,7 +73,7 @@
+
+ int main(int argc, char *argv[]) {
+ kern_return_t ret;
+- task_t aTask;
++ task_read_t aTask;
+ my_per_task_info_t *taskinfo = NULL;
+ task_array_t tasks;
+ char *progname = "lsmp";
+@@ -153,10 +154,10 @@
+ mach_port_deallocate(mach_task_self(), psets[0]);
+ vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)psetCount * sizeof(mach_port_t));
+
+- /* convert the processor-set-priv to a list of tasks for the processor set */
+- ret = processor_set_tasks(pset_priv, &tasks, &taskCount);
++ /* convert the processor-set-priv to a list of task read ports for the processor set */
++ ret = processor_set_tasks_with_flavor(pset_priv, TASK_FLAVOR_READ, &tasks, &taskCount);
+ if (ret != KERN_SUCCESS) {
+- fprintf(stderr, "processor_set_tasks() failed: %s\n", mach_error_string(ret));
++ fprintf(stderr, "processor_set_tasks_with_flavor() failed: %s\n", mach_error_string(ret));
+ exit(1);
+ }
+ mach_port_deallocate(mach_task_self(), pset_priv);
+@@ -164,7 +165,7 @@
+ /* swap my current instances port to be last to collect all threads and exception port info */
+ int myTaskPosition = -1;
+ for (int i = 0; i < taskCount; i++) {
+- if (tasks[i] == mach_task_self()){
++ if (mach_task_is_self(tasks[i])){
+ myTaskPosition = i;
+ break;
+ }
+@@ -181,7 +182,7 @@
+ {
+ fprintf(stderr, "warning: should run as root for best output (cross-ref to other tasks' ports).\n");
+ /* just the one process */
+- ret = task_for_pid(mach_task_self(), lsmp_config.pid, &aTask);
++ ret = task_read_for_pid(mach_task_self(), lsmp_config.pid, &aTask);
+ if (ret != KERN_SUCCESS) {
+ fprintf(stderr, "task_for_pid() failed: %s %s\n", mach_error_string(ret), TASK_FOR_PID_USAGE_MESG);
+ exit(1);
+@@ -200,8 +201,9 @@
+ continue;
+ }
+
+- if (psettaskinfo[i].pid == lsmp_config.pid)
++ if (psettaskinfo[i].pid == lsmp_config.pid) {
+ taskinfo = &psettaskinfo[i];
++ }
+ }
+
+ JSON_OBJECT_BEGIN(lsmp_config.json_output);
+diff -urN system_cmds-880.60.2/lsmp.tproj/port_details.c system_cmds-880.100.5/lsmp.tproj/port_details.c
+--- system_cmds-880.60.2/lsmp.tproj/port_details.c 2020-05-26 14:16:58.000000000 -0400
++++ system_cmds-880.100.5/lsmp.tproj/port_details.c 2021-01-15 00:52:22.000000000 -0500
+@@ -232,7 +232,7 @@
+ return voucher_outstr;
+ }
+
+-void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port_context_t *context) {
++void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach_port_context_t *context) {
+ if (context == NULL) {
+ return;
+ }
+@@ -248,7 +248,7 @@
+ return;
+ }
+
+-int get_recieve_port_status(task_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info){
++int get_recieve_port_status(task_read_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info){
+ if (info == NULL) {
+ return -1;
+ }
+@@ -625,13 +625,19 @@
+ if (ret == KERN_SUCCESS && kotype != 0) {
+ JSON_OBJECT_SET(json, identifier, "0x%08x", (natural_t)kobject);
+ JSON_OBJECT_SET(json, type, "%s", kobject_name(kotype));
+- if (desc[0]) {
+- JSON_OBJECT_SET(json, description, "%s", desc);
+- printf(" 0x%08x %s %s", (natural_t)kobject, kobject_name(kotype), desc);
+- } else {
+- printf(" 0x%08x %s", (natural_t)kobject, kobject_name(kotype));
+- }
+- if ((kotype == IKOT_TASK_RESUME) || (kotype == IKOT_TASK_CONTROL) || (kotype == IKOT_TASK_NAME)) {
++
++ if (desc[0]) {
++ JSON_OBJECT_SET(json, description, "%s", desc);
++ printf(" 0x%08x %s %s", (natural_t)kobject, kobject_name(kotype), desc);
++ } else {
++ printf(" 0x%08x %s", (natural_t)kobject, kobject_name(kotype));
++ }
++
++ if ((kotype == IKOT_TASK_RESUME) ||
++ (kotype == IKOT_TASK_CONTROL) ||
++ (kotype == IKOT_TASK_READ) ||
++ (kotype == IKOT_TASK_INSPECT) ||
++ (kotype == IKOT_TASK_NAME)) {
+ if (taskinfo->task_kobject == kobject) {
+ /* neat little optimization since in most cases tasks have themselves in their ipc space */
+ JSON_OBJECT_SET(json, pid, %d, taskinfo->pid);
+@@ -645,7 +651,9 @@
+ }
+ }
+
+- if (kotype == IKOT_THREAD_CONTROL) {
++ if ((kotype == IKOT_THREAD_CONTROL) ||
++ (kotype == IKOT_THREAD_READ) ||
++ (kotype == IKOT_THREAD_INSPECT)) {
+ for (int i = 0; i < taskinfo->threadCount; i++) {
+ if (taskinfo->threadInfos[i].th_kobject == kobject) {
+ printf(" (%#llx)", taskinfo->threadInfos[i].th_id);
+@@ -673,7 +681,7 @@
+ /* not kobject - find the receive right holder */
+ my_per_task_info_t *recv_holder_taskinfo;
+ mach_port_name_t recv_name = MACH_PORT_NULL;
+- if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(entry, &recv_holder_taskinfo, &recv_name)) {
++ if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(*entry, &recv_holder_taskinfo, &recv_name)) {
+ mach_port_status_t port_status;
+ mach_port_info_ext_t info;
+ mach_port_context_t port_context = (mach_port_context_t)0;
+diff -urN system_cmds-880.60.2/lsmp.tproj/task_details.c system_cmds-880.100.5/lsmp.tproj/task_details.c
+--- system_cmds-880.60.2/lsmp.tproj/task_details.c 2020-05-26 14:16:58.000000000 -0400
++++ system_cmds-880.100.5/lsmp.tproj/task_details.c 2021-01-15 00:52:22.000000000 -0500
+@@ -139,7 +139,7 @@
+ }
+ }
+
+-kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_task)
++kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t target_task)
+ {
+ int i;
+ kern_return_t ret = KERN_SUCCESS;
+@@ -149,10 +149,10 @@
+ taskinfo->task = target_task;
+ pid_for_task(target_task, &taskinfo->pid);
+
+- ret = task_get_exception_ports(taskinfo->task, EXC_MASK_ALL, taskinfo->exceptionInfo.masks, &taskinfo->exceptionInfo.count, taskinfo->exceptionInfo.ports, taskinfo->exceptionInfo.behaviors, taskinfo->exceptionInfo.flavors);
++ ret = task_get_exception_ports_info(taskinfo->task, EXC_MASK_ALL, taskinfo->exceptionInfo.masks, &taskinfo->exceptionInfo.count, taskinfo->exceptionInfo.ports_info, taskinfo->exceptionInfo.behaviors, taskinfo->exceptionInfo.flavors);
+
+ if (ret != KERN_SUCCESS) {
+- fprintf(stderr, "task_get_exception_ports() failed: pid:%d error: %s\n",taskinfo->pid, mach_error_string(ret));
++ fprintf(stderr, "task_get_exception_ports_info() failed: pid:%d error: %s\n",taskinfo->pid, mach_error_string(ret));
+ taskinfo->pid = 0;
+ }
+
+@@ -180,9 +180,9 @@
+ mach_msg_type_number_t th_info_count = THREAD_IDENTIFIER_INFO_COUNT;
+ struct exc_port_info *excinfo = &(taskinfo->threadExceptionInfos[i]);
+
+- ret = thread_get_exception_ports(threadPorts[i], EXC_MASK_ALL, excinfo->masks, &excinfo->count, excinfo->ports, excinfo->behaviors, excinfo->flavors);
++ ret = thread_get_exception_ports_info(threadPorts[i], EXC_MASK_ALL, excinfo->masks, &excinfo->count, excinfo->ports_info, excinfo->behaviors, excinfo->flavors);
+ if (ret != KERN_SUCCESS){
+- fprintf(stderr, "thread_get_exception_ports() failed: pid: %d thread: %d error %s\n", taskinfo->pid, threadPorts[i], mach_error_string(ret));
++ fprintf(stderr, "thread_get_exception_ports_info() failed: pid: %d thread: %d error %s\n", taskinfo->pid, threadPorts[i], mach_error_string(ret));
+ }
+
+ if (excinfo->count != 0) {
+@@ -236,8 +236,9 @@
+ proc_pid_to_name(taskinfo->pid, taskinfo->processName);
+
+ ret = mach_port_kernel_object(mach_task_self(), taskinfo->task, &kotype, (unsigned *)&kobject);
+-
+- if (ret == KERN_SUCCESS && kotype == IKOT_TASK_CONTROL) {
++
++ /* Now that we are using read ports, kotype should be checked against IKOT_TASK_READ */
++ if (ret == KERN_SUCCESS && kotype == IKOT_TASK_READ) {
+ taskinfo->task_kobject = kobject;
+ taskinfo->valid = TRUE;
+ }
+@@ -307,23 +308,32 @@
+
+ boolean_t header_required = TRUE;
+ for (int i = 0; i < taskinfo->exceptionInfo.count; i++) {
+- if (taskinfo->exceptionInfo.ports[i] != MACH_PORT_NULL) {
++ if (taskinfo->exceptionInfo.ports_info[i].iip_port_object != 0) {
++ my_per_task_info_t * _found_task;
++
+ if (header_required) {
+
+- printf(" exc_port flavor <behaviors> mask \n");
++ printf(" exc_port_object receiver_task flavor <behaviors> mask \n");
+ header_required = FALSE;
+ }
+ get_exc_behavior_string(taskinfo->exceptionInfo.behaviors[i], behavior_string, sizeof(behavior_string));
+ get_exc_mask_string(taskinfo->exceptionInfo.masks[i], mask_string, sizeof(mask_string));
+
+ JSON_OBJECT_BEGIN(json);
+- JSON_OBJECT_SET(json, port, "0x%08x", taskinfo->exceptionInfo.ports[i]);
++ JSON_OBJECT_SET(json, port_object, "0x%08x", taskinfo->exceptionInfo.ports_info[i].iip_port_object);
++ JSON_OBJECT_SET(json, receiver_object, "0x%08x", taskinfo->exceptionInfo.ports_info[i].iip_receiver_object);
+ JSON_OBJECT_SET(json, flavor, "0x%03x", taskinfo->exceptionInfo.flavors[i]);
+ JSON_OBJECT_SET(json, behavior, "%s", behavior_string);
+ JSON_OBJECT_SET(json, mask, "%s", mask_string);
+ JSON_OBJECT_END(json); // exception port
+-
+- printf(" 0x%08x 0x%03x <%s> %s \n" , taskinfo->exceptionInfo.ports[i], taskinfo->exceptionInfo.flavors[i], behavior_string, mask_string);
++
++ _found_task = get_taskinfo_by_kobject((natural_t)taskinfo->exceptionInfo.ports_info[i].iip_receiver_object);
++
++ printf(" 0x%08x (%d) %s 0x%03x <%s> %s \n",
++ taskinfo->exceptionInfo.ports_info[i].iip_port_object,
++ _found_task->pid,
++ _found_task->processName,
++ taskinfo->exceptionInfo.flavors[i], behavior_string, mask_string);
+ }
+
+ }
+@@ -389,39 +399,35 @@
+ for (int i = 0; i < excinfo->count; i++) {
+ JSON_OBJECT_BEGIN(json);
+
+- if (excinfo->ports[i] != MACH_PORT_NULL) {
++ if (excinfo->ports_info[i].iip_port_object != 0) {
+ if (header_required) {
+- printf("\n exc_port flavor <behaviors> mask -> name owner\n");
++ printf("\n exc_port_object exc_port_receiver flavor <behaviors> mask -> name owner\n");
+ header_required = FALSE;
+ }
+ get_exc_behavior_string(excinfo->behaviors[i], behavior_string, sizeof(behavior_string));
+ get_exc_mask_string(excinfo->masks[i], mask_string, sizeof(mask_string));
+
+- JSON_OBJECT_SET(json, port, "0x%08x", excinfo->ports[i]);
++ JSON_OBJECT_SET(json, port_object, "0x%08x", excinfo->ports_info[i].iip_port_object);
++ JSON_OBJECT_SET(json, receiver_object, "0x%08x", excinfo->ports_info[i].iip_receiver_object);
+ JSON_OBJECT_SET(json, flavor, "0x%03x", excinfo->flavors[i]);
+ JSON_OBJECT_SET(json, behavior, "%s", behavior_string);
+ JSON_OBJECT_SET(json, mask, "%s", mask_string);
+
+- printf(" 0x%08x 0x%03x <%s> %s " , excinfo->ports[i], excinfo->flavors[i], behavior_string, mask_string);
++ printf(" 0x%08x 0x%08x 0x%03x <%s> %s " , excinfo->ports_info[i].iip_port_object, excinfo->ports_info[i].iip_receiver_object, excinfo->flavors[i], behavior_string, mask_string);
+
+- ipc_info_name_t actual_sendinfo;
+- if (KERN_SUCCESS == get_ipc_info_from_lsmp_spaceinfo(excinfo->ports[i], &actual_sendinfo)) {
+- my_per_task_info_t *recv_holder_taskinfo;
+- mach_port_name_t recv_name = MACH_PORT_NULL;
+- if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(&actual_sendinfo, &recv_holder_taskinfo, &recv_name)) {
++ my_per_task_info_t *recv_holder_taskinfo;
++ mach_port_name_t recv_name = MACH_PORT_NULL;
++ if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right_info(excinfo->ports_info[i], &recv_holder_taskinfo, &recv_name)) {
++ JSON_OBJECT_SET(json, name, "0x%08x", recv_name);
++ JSON_OBJECT_SET(json, ipc-object, "0x%08x", excinfo->ports_info[i].iip_port_object);
++ JSON_OBJECT_SET(json, pid, %d, recv_holder_taskinfo->pid);
++ JSON_OBJECT_SET(json, process, "%s", recv_holder_taskinfo->processName);
+
+- JSON_OBJECT_SET(json, name, "0x%08x", recv_name);
+- JSON_OBJECT_SET(json, ipc-object, "0x%08x", actual_sendinfo.iin_object);
+- JSON_OBJECT_SET(json, pid, %d, recv_holder_taskinfo->pid);
+- JSON_OBJECT_SET(json, process, "%s", recv_holder_taskinfo->processName);
+-
+- printf(" -> 0x%08x 0x%08x (%d) %s\n",
+- recv_name,
+- actual_sendinfo.iin_object,
+- recv_holder_taskinfo->pid,
+- recv_holder_taskinfo->processName);
+- }
+-
++ printf(" -> 0x%08x 0x%08x (%d) %s\n",
++ recv_name,
++ excinfo->ports_info[i].iip_port_object,
++ recv_holder_taskinfo->pid,
++ recv_holder_taskinfo->processName);
+ } else {
+ fprintf(stderr, "failed to find");
+ }
+@@ -463,14 +469,14 @@
+ return retval;
+ }
+
+-kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
++static kern_return_t _get_taskinfo_of_receiver_by_send_right(natural_t kobject, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
+ {
+ *out_taskinfo = &NOT_FOUND_TASK_INFO;
+ struct k2n_table_node *k2nnode;
+
+- for (int j = 0; j < global_taskcount; j++) {
+- if ((k2nnode = k2n_table_lookup(global_taskinfo[j].k2ntable, sendright->iin_object))) {
+- assert(k2nnode->info_name->iin_object == sendright->iin_object);
++ for (unsigned int j = 0; j < global_taskcount; j++) {
++ if ((k2nnode = k2n_table_lookup(global_taskinfo[j].k2ntable, kobject))) {
++ assert(k2nnode->info_name->iin_object == kobject);
+
+ if (k2nnode->info_name->iin_type & MACH_PORT_TYPE_RECEIVE) {
+ *out_taskinfo = &global_taskinfo[j];
+@@ -483,25 +489,12 @@
+ return KERN_FAILURE;
+ }
+
+-kern_return_t get_ipc_info_from_lsmp_spaceinfo(mach_port_t port_name, ipc_info_name_t *out_sendright){
+- kern_return_t retval = KERN_FAILURE;
+- bzero(out_sendright, sizeof(ipc_info_name_t));
+- my_per_task_info_t *mytaskinfo = NULL;
+- for (int i = global_taskcount - 1; i >= 0; i--){
+- if (global_taskinfo[i].task == mach_task_self()){
+- mytaskinfo = &global_taskinfo[i];
+- break;
+- }
+- }
+- if (mytaskinfo) {
+- for (int k = 0; k < mytaskinfo->tableCount; k++) {
+- if (port_name == mytaskinfo->table[k].iin_name){
+- bcopy(&mytaskinfo->table[k], out_sendright, sizeof(ipc_info_name_t));
+- retval = KERN_SUCCESS;
+- break;
+- }
+- }
+- }
+- return retval;
++kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
++{
++ return _get_taskinfo_of_receiver_by_send_right(sendright.iin_object, out_taskinfo, out_recv_info);
++}
+
++kern_return_t get_taskinfo_of_receiver_by_send_right_info(ipc_info_port_t sendright_info, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
++{
++ return _get_taskinfo_of_receiver_by_send_right(sendright_info.iip_port_object, out_taskinfo, out_recv_info);
+ }
diff --git a/system_cmds/lsmp.tproj/Makefile b/system_cmds/lsmp.tproj/Makefile
new file mode 100644
index 0000000..5c3c5bd
--- /dev/null
+++ b/system_cmds/lsmp.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= lsmp
+SRCS= lsmp.c \
+port_details.c \
+task_details.c
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/lsmp.tproj/common.h b/system_cmds/lsmp.tproj/common.h
index a059eb5..9a47012 100644
--- a/system_cmds/lsmp.tproj/common.h
+++ b/system_cmds/lsmp.tproj/common.h
@@ -25,7 +25,6 @@
#define system_cmds_common_h
#include <mach/mach.h>
-#include <mach_debug/ipc_info.h>
#include "json.h"
#define PROC_NAME_LEN 100
@@ -47,7 +46,7 @@ extern struct prog_configs lsmp_config;
/* exception port information */
struct exc_port_info {
mach_msg_type_number_t count;
- ipc_info_port_t ports_info[EXC_TYPES_COUNT];
+ mach_port_t ports[EXC_TYPES_COUNT];
exception_mask_t masks[EXC_TYPES_COUNT];
exception_behavior_t behaviors[EXC_TYPES_COUNT];
thread_state_flavor_t flavors[EXC_TYPES_COUNT];
@@ -75,7 +74,7 @@ struct k2n_table_node *k2n_table_lookup(struct k2n_table_node **table, natural_t
/* private structure to wrap up per-task info */
typedef struct my_per_task_info {
- task_read_t task;
+ task_t task;
pid_t pid;
vm_address_t task_kobject;
ipc_info_space_t info;
@@ -182,12 +181,12 @@ char *copy_voucher_detail(mach_port_t task, mach_port_name_t voucher, JSON_t jso
/* mach port related functions */
const char * kobject_name(natural_t kotype);
-void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach_port_context_t *context);
-int get_recieve_port_status(task_read_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info);
+void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port_context_t *context);
+int get_recieve_port_status(task_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info);
void show_task_mach_ports(my_per_task_info_t *taskinfo, uint32_t taskCount, my_per_task_info_t *allTaskInfos, JSON_t json);
/* task and thread related helper functions */
-kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t target_task);
+kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_task);
my_per_task_info_t * allocate_taskinfo_memory(uint32_t taskCount);
void deallocate_taskinfo_memory(my_per_task_info_t *data);
kern_return_t print_task_exception_info(my_per_task_info_t *taskinfo, JSON_t json);
@@ -196,8 +195,8 @@ my_per_task_info_t * get_taskinfo_by_kobject(natural_t kobj);
void get_exc_behavior_string(exception_behavior_t b, char *out_string, size_t len);
void get_exc_mask_string(exception_mask_t m, char *out_string, size_t len);
-kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info);
-kern_return_t get_taskinfo_of_receiver_by_send_right_info(ipc_info_port_t sendright_info, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info);
+kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info);
+kern_return_t get_ipc_info_from_lsmp_spaceinfo(mach_port_t port_name, ipc_info_name_t *out_sendright);
/* basic util functions */
uint32_t print_hex_data(char *outstr, uint32_t maxlen, char *prefix, char *desc, void *addr, int len);
diff --git a/system_cmds/lsmp.tproj/entitlements.plist b/system_cmds/lsmp.tproj/entitlements.plist
index cdf0e9e..b7b4e6c 100644
--- a/system_cmds/lsmp.tproj/entitlements.plist
+++ b/system_cmds/lsmp.tproj/entitlements.plist
@@ -2,7 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>com.apple.system-task-ports.read</key>
+ <key>task_for_pid-allow</key>
+ <true/>
+ <key>com.apple.system-task-ports</key>
<true/>
</dict>
</plist>
diff --git a/system_cmds/lsmp.tproj/lsmp.c b/system_cmds/lsmp.tproj/lsmp.c
index 114c5b6..e1a89d9 100644
--- a/system_cmds/lsmp.tproj/lsmp.c
+++ b/system_cmds/lsmp.tproj/lsmp.c
@@ -19,7 +19,7 @@
*
* @APPLE_LICENSE_HEADER_END@
*/
-#include <System/sys/proc.h>
+typedef char *kobject_description_t[512];
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_error.h>
@@ -33,7 +33,7 @@
#include "json.h"
#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
-#define TASK_FOR_PID_USAGE_MESG "\nPlease check your boot-args to ensure you have access to task_read_for_pid()."
+#define TASK_FOR_PID_USAGE_MESG "\nPlease check your boot-args to ensure you have access to task_for_pid()."
#else
#define TASK_FOR_PID_USAGE_MESG ""
#endif
@@ -73,7 +73,7 @@ static void print_task_info(my_per_task_info_t *taskinfo, mach_msg_type_number_t
int main(int argc, char *argv[]) {
kern_return_t ret;
- task_read_t aTask;
+ task_t aTask;
my_per_task_info_t *taskinfo = NULL;
task_array_t tasks;
char *progname = "lsmp";
@@ -154,10 +154,10 @@ int main(int argc, char *argv[]) {
mach_port_deallocate(mach_task_self(), psets[0]);
vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)psetCount * sizeof(mach_port_t));
- /* convert the processor-set-priv to a list of task read ports for the processor set */
- ret = processor_set_tasks_with_flavor(pset_priv, TASK_FLAVOR_READ, &tasks, &taskCount);
+ /* convert the processor-set-priv to a list of tasks for the processor set */
+ ret = processor_set_tasks(pset_priv, &tasks, &taskCount);
if (ret != KERN_SUCCESS) {
- fprintf(stderr, "processor_set_tasks_with_flavor() failed: %s\n", mach_error_string(ret));
+ fprintf(stderr, "processor_set_tasks() failed: %s\n", mach_error_string(ret));
exit(1);
}
mach_port_deallocate(mach_task_self(), pset_priv);
@@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
/* swap my current instances port to be last to collect all threads and exception port info */
int myTaskPosition = -1;
for (int i = 0; i < taskCount; i++) {
- if (mach_task_is_self(tasks[i])){
+ if (tasks[i] == mach_task_self()){
myTaskPosition = i;
break;
}
@@ -182,7 +182,7 @@ int main(int argc, char *argv[]) {
{
fprintf(stderr, "warning: should run as root for best output (cross-ref to other tasks' ports).\n");
/* just the one process */
- ret = task_read_for_pid(mach_task_self(), lsmp_config.pid, &aTask);
+ ret = task_for_pid(mach_task_self(), lsmp_config.pid, &aTask);
if (ret != KERN_SUCCESS) {
fprintf(stderr, "task_for_pid() failed: %s %s\n", mach_error_string(ret), TASK_FOR_PID_USAGE_MESG);
exit(1);
@@ -201,9 +201,8 @@ int main(int argc, char *argv[]) {
continue;
}
- if (psettaskinfo[i].pid == lsmp_config.pid) {
+ if (psettaskinfo[i].pid == lsmp_config.pid)
taskinfo = &psettaskinfo[i];
- }
}
JSON_OBJECT_BEGIN(lsmp_config.json_output);
diff --git a/system_cmds/lsmp.tproj/port_details.c b/system_cmds/lsmp.tproj/port_details.c
index 69fc9be..f6222cd 100644
--- a/system_cmds/lsmp.tproj/port_details.c
+++ b/system_cmds/lsmp.tproj/port_details.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <libproc.h>
#include <assert.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
//#include <mach/mach_port.h.h>
#include <mach/mach_voucher.h>
@@ -232,7 +233,7 @@ char * copy_voucher_detail(mach_port_t task, mach_port_name_t voucher, JSON_t js
return voucher_outstr;
}
-void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach_port_context_t *context) {
+void get_receive_port_context(task_t taskp, mach_port_name_t portname, mach_port_context_t *context) {
if (context == NULL) {
return;
}
@@ -248,7 +249,7 @@ void get_receive_port_context(task_read_t taskp, mach_port_name_t portname, mach
return;
}
-int get_recieve_port_status(task_read_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info){
+int get_recieve_port_status(task_t taskp, mach_port_name_t portname, mach_port_info_ext_t *info){
if (info == NULL) {
return -1;
}
@@ -609,6 +610,7 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta
/* converting to kobjects is not always supported */
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130500
desc[0] = '\0';
ret = mach_port_kobject_description(taskinfo->task,
entry->iin_name,
@@ -621,23 +623,22 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta
entry->iin_name,
&kotype, (unsigned *)&kobject);
}
+#else
+ ret = mach_port_kernel_object(taskinfo->task,
+ entry->iin_name,
+ &kotype, (unsigned *)&kobject);
+#endif
if (ret == KERN_SUCCESS && kotype != 0) {
JSON_OBJECT_SET(json, identifier, "0x%08x", (natural_t)kobject);
JSON_OBJECT_SET(json, type, "%s", kobject_name(kotype));
-
- if (desc[0]) {
- JSON_OBJECT_SET(json, description, "%s", desc);
- printf(" 0x%08x %s %s", (natural_t)kobject, kobject_name(kotype), desc);
- } else {
- printf(" 0x%08x %s", (natural_t)kobject, kobject_name(kotype));
- }
-
- if ((kotype == IKOT_TASK_RESUME) ||
- (kotype == IKOT_TASK_CONTROL) ||
- (kotype == IKOT_TASK_READ) ||
- (kotype == IKOT_TASK_INSPECT) ||
- (kotype == IKOT_TASK_NAME)) {
+ if (desc[0]) {
+ JSON_OBJECT_SET(json, description, "%s", desc);
+ printf(" 0x%08x %s %s", (natural_t)kobject, kobject_name(kotype), desc);
+ } else {
+ printf(" 0x%08x %s", (natural_t)kobject, kobject_name(kotype));
+ }
+ if ((kotype == IKOT_TASK_RESUME) || (kotype == IKOT_TASK_CONTROL) || (kotype == IKOT_TASK_NAME)) {
if (taskinfo->task_kobject == kobject) {
/* neat little optimization since in most cases tasks have themselves in their ipc space */
JSON_OBJECT_SET(json, pid, %d, taskinfo->pid);
@@ -651,9 +652,7 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta
}
}
- if ((kotype == IKOT_THREAD_CONTROL) ||
- (kotype == IKOT_THREAD_READ) ||
- (kotype == IKOT_THREAD_INSPECT)) {
+ if (kotype == IKOT_THREAD_CONTROL) {
for (int i = 0; i < taskinfo->threadCount; i++) {
if (taskinfo->threadInfos[i].th_kobject == kobject) {
printf(" (%#llx)", taskinfo->threadInfos[i].th_id);
@@ -681,7 +680,7 @@ static void show_task_table_entry(ipc_info_name_t *entry, my_per_task_info_t *ta
/* not kobject - find the receive right holder */
my_per_task_info_t *recv_holder_taskinfo;
mach_port_name_t recv_name = MACH_PORT_NULL;
- if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(*entry, &recv_holder_taskinfo, &recv_name)) {
+ if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(entry, &recv_holder_taskinfo, &recv_name)) {
mach_port_status_t port_status;
mach_port_info_ext_t info;
mach_port_context_t port_context = (mach_port_context_t)0;
diff --git a/system_cmds/lsmp.tproj/task_details.c b/system_cmds/lsmp.tproj/task_details.c
index 123f8aa..3111e77 100644
--- a/system_cmds/lsmp.tproj/task_details.c
+++ b/system_cmds/lsmp.tproj/task_details.c
@@ -21,6 +21,7 @@
*/
#include <unistd.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <mach_debug/ipc_info.h>
@@ -139,7 +140,7 @@ void deallocate_taskinfo_memory(my_per_task_info_t *data){
}
}
-kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t target_task)
+kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_t target_task)
{
int i;
kern_return_t ret = KERN_SUCCESS;
@@ -149,10 +150,10 @@ kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t ta
taskinfo->task = target_task;
pid_for_task(target_task, &taskinfo->pid);
- ret = task_get_exception_ports_info(taskinfo->task, EXC_MASK_ALL, taskinfo->exceptionInfo.masks, &taskinfo->exceptionInfo.count, taskinfo->exceptionInfo.ports_info, taskinfo->exceptionInfo.behaviors, taskinfo->exceptionInfo.flavors);
+ ret = task_get_exception_ports(taskinfo->task, EXC_MASK_ALL, taskinfo->exceptionInfo.masks, &taskinfo->exceptionInfo.count, taskinfo->exceptionInfo.ports, taskinfo->exceptionInfo.behaviors, taskinfo->exceptionInfo.flavors);
if (ret != KERN_SUCCESS) {
- fprintf(stderr, "task_get_exception_ports_info() failed: pid:%d error: %s\n",taskinfo->pid, mach_error_string(ret));
+ fprintf(stderr, "task_get_exception_ports() failed: pid:%d error: %s\n",taskinfo->pid, mach_error_string(ret));
taskinfo->pid = 0;
}
@@ -180,9 +181,9 @@ kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t ta
mach_msg_type_number_t th_info_count = THREAD_IDENTIFIER_INFO_COUNT;
struct exc_port_info *excinfo = &(taskinfo->threadExceptionInfos[i]);
- ret = thread_get_exception_ports_info(threadPorts[i], EXC_MASK_ALL, excinfo->masks, &excinfo->count, excinfo->ports_info, excinfo->behaviors, excinfo->flavors);
+ ret = thread_get_exception_ports(threadPorts[i], EXC_MASK_ALL, excinfo->masks, &excinfo->count, excinfo->ports, excinfo->behaviors, excinfo->flavors);
if (ret != KERN_SUCCESS){
- fprintf(stderr, "thread_get_exception_ports_info() failed: pid: %d thread: %d error %s\n", taskinfo->pid, threadPorts[i], mach_error_string(ret));
+ fprintf(stderr, "thread_get_exception_ports() failed: pid: %d thread: %d error %s\n", taskinfo->pid, threadPorts[i], mach_error_string(ret));
}
if (excinfo->count != 0) {
@@ -236,9 +237,8 @@ kern_return_t collect_per_task_info(my_per_task_info_t *taskinfo, task_read_t ta
proc_pid_to_name(taskinfo->pid, taskinfo->processName);
ret = mach_port_kernel_object(mach_task_self(), taskinfo->task, &kotype, (unsigned *)&kobject);
-
- /* Now that we are using read ports, kotype should be checked against IKOT_TASK_READ */
- if (ret == KERN_SUCCESS && kotype == IKOT_TASK_READ) {
+
+ if (ret == KERN_SUCCESS && kotype == IKOT_TASK_CONTROL) {
taskinfo->task_kobject = kobject;
taskinfo->valid = TRUE;
}
@@ -308,32 +308,23 @@ kern_return_t print_task_exception_info(my_per_task_info_t *taskinfo, JSON_t jso
boolean_t header_required = TRUE;
for (int i = 0; i < taskinfo->exceptionInfo.count; i++) {
- if (taskinfo->exceptionInfo.ports_info[i].iip_port_object != 0) {
- my_per_task_info_t * _found_task;
-
+ if (taskinfo->exceptionInfo.ports[i] != MACH_PORT_NULL) {
if (header_required) {
- printf(" exc_port_object receiver_task flavor <behaviors> mask \n");
+ printf(" exc_port flavor <behaviors> mask \n");
header_required = FALSE;
}
get_exc_behavior_string(taskinfo->exceptionInfo.behaviors[i], behavior_string, sizeof(behavior_string));
get_exc_mask_string(taskinfo->exceptionInfo.masks[i], mask_string, sizeof(mask_string));
JSON_OBJECT_BEGIN(json);
- JSON_OBJECT_SET(json, port_object, "0x%08x", taskinfo->exceptionInfo.ports_info[i].iip_port_object);
- JSON_OBJECT_SET(json, receiver_object, "0x%08x", taskinfo->exceptionInfo.ports_info[i].iip_receiver_object);
+ JSON_OBJECT_SET(json, port, "0x%08x", taskinfo->exceptionInfo.ports[i]);
JSON_OBJECT_SET(json, flavor, "0x%03x", taskinfo->exceptionInfo.flavors[i]);
JSON_OBJECT_SET(json, behavior, "%s", behavior_string);
JSON_OBJECT_SET(json, mask, "%s", mask_string);
JSON_OBJECT_END(json); // exception port
-
- _found_task = get_taskinfo_by_kobject((natural_t)taskinfo->exceptionInfo.ports_info[i].iip_receiver_object);
-
- printf(" 0x%08x (%d) %s 0x%03x <%s> %s \n",
- taskinfo->exceptionInfo.ports_info[i].iip_port_object,
- _found_task->pid,
- _found_task->processName,
- taskinfo->exceptionInfo.flavors[i], behavior_string, mask_string);
+
+ printf(" 0x%08x 0x%03x <%s> %s \n" , taskinfo->exceptionInfo.ports[i], taskinfo->exceptionInfo.flavors[i], behavior_string, mask_string);
}
}
@@ -399,35 +390,39 @@ kern_return_t print_task_threads_special_ports(my_per_task_info_t *taskinfo, JSO
for (int i = 0; i < excinfo->count; i++) {
JSON_OBJECT_BEGIN(json);
- if (excinfo->ports_info[i].iip_port_object != 0) {
+ if (excinfo->ports[i] != MACH_PORT_NULL) {
if (header_required) {
- printf("\n exc_port_object exc_port_receiver flavor <behaviors> mask -> name owner\n");
+ printf("\n exc_port flavor <behaviors> mask -> name owner\n");
header_required = FALSE;
}
get_exc_behavior_string(excinfo->behaviors[i], behavior_string, sizeof(behavior_string));
get_exc_mask_string(excinfo->masks[i], mask_string, sizeof(mask_string));
- JSON_OBJECT_SET(json, port_object, "0x%08x", excinfo->ports_info[i].iip_port_object);
- JSON_OBJECT_SET(json, receiver_object, "0x%08x", excinfo->ports_info[i].iip_receiver_object);
+ JSON_OBJECT_SET(json, port, "0x%08x", excinfo->ports[i]);
JSON_OBJECT_SET(json, flavor, "0x%03x", excinfo->flavors[i]);
JSON_OBJECT_SET(json, behavior, "%s", behavior_string);
JSON_OBJECT_SET(json, mask, "%s", mask_string);
- printf(" 0x%08x 0x%08x 0x%03x <%s> %s " , excinfo->ports_info[i].iip_port_object, excinfo->ports_info[i].iip_receiver_object, excinfo->flavors[i], behavior_string, mask_string);
-
- my_per_task_info_t *recv_holder_taskinfo;
- mach_port_name_t recv_name = MACH_PORT_NULL;
- if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right_info(excinfo->ports_info[i], &recv_holder_taskinfo, &recv_name)) {
- JSON_OBJECT_SET(json, name, "0x%08x", recv_name);
- JSON_OBJECT_SET(json, ipc-object, "0x%08x", excinfo->ports_info[i].iip_port_object);
- JSON_OBJECT_SET(json, pid, %d, recv_holder_taskinfo->pid);
- JSON_OBJECT_SET(json, process, "%s", recv_holder_taskinfo->processName);
-
- printf(" -> 0x%08x 0x%08x (%d) %s\n",
- recv_name,
- excinfo->ports_info[i].iip_port_object,
- recv_holder_taskinfo->pid,
- recv_holder_taskinfo->processName);
+ printf(" 0x%08x 0x%03x <%s> %s " , excinfo->ports[i], excinfo->flavors[i], behavior_string, mask_string);
+
+ ipc_info_name_t actual_sendinfo;
+ if (KERN_SUCCESS == get_ipc_info_from_lsmp_spaceinfo(excinfo->ports[i], &actual_sendinfo)) {
+ my_per_task_info_t *recv_holder_taskinfo;
+ mach_port_name_t recv_name = MACH_PORT_NULL;
+ if (KERN_SUCCESS == get_taskinfo_of_receiver_by_send_right(&actual_sendinfo, &recv_holder_taskinfo, &recv_name)) {
+
+ JSON_OBJECT_SET(json, name, "0x%08x", recv_name);
+ JSON_OBJECT_SET(json, ipc-object, "0x%08x", actual_sendinfo.iin_object);
+ JSON_OBJECT_SET(json, pid, %d, recv_holder_taskinfo->pid);
+ JSON_OBJECT_SET(json, process, "%s", recv_holder_taskinfo->processName);
+
+ printf(" -> 0x%08x 0x%08x (%d) %s\n",
+ recv_name,
+ actual_sendinfo.iin_object,
+ recv_holder_taskinfo->pid,
+ recv_holder_taskinfo->processName);
+ }
+
} else {
fprintf(stderr, "failed to find");
}
@@ -469,14 +464,14 @@ my_per_task_info_t * get_taskinfo_by_kobject(natural_t kobj) {
return retval;
}
-static kern_return_t _get_taskinfo_of_receiver_by_send_right(natural_t kobject, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
+kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t *sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
{
*out_taskinfo = &NOT_FOUND_TASK_INFO;
struct k2n_table_node *k2nnode;
- for (unsigned int j = 0; j < global_taskcount; j++) {
- if ((k2nnode = k2n_table_lookup(global_taskinfo[j].k2ntable, kobject))) {
- assert(k2nnode->info_name->iin_object == kobject);
+ for (int j = 0; j < global_taskcount; j++) {
+ if ((k2nnode = k2n_table_lookup(global_taskinfo[j].k2ntable, sendright->iin_object))) {
+ assert(k2nnode->info_name->iin_object == sendright->iin_object);
if (k2nnode->info_name->iin_type & MACH_PORT_TYPE_RECEIVE) {
*out_taskinfo = &global_taskinfo[j];
@@ -489,12 +484,25 @@ static kern_return_t _get_taskinfo_of_receiver_by_send_right(natural_t kobject,
return KERN_FAILURE;
}
-kern_return_t get_taskinfo_of_receiver_by_send_right(ipc_info_name_t sendright, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
-{
- return _get_taskinfo_of_receiver_by_send_right(sendright.iin_object, out_taskinfo, out_recv_info);
-}
+kern_return_t get_ipc_info_from_lsmp_spaceinfo(mach_port_t port_name, ipc_info_name_t *out_sendright){
+ kern_return_t retval = KERN_FAILURE;
+ bzero(out_sendright, sizeof(ipc_info_name_t));
+ my_per_task_info_t *mytaskinfo = NULL;
+ for (int i = global_taskcount - 1; i >= 0; i--){
+ if (global_taskinfo[i].task == mach_task_self()){
+ mytaskinfo = &global_taskinfo[i];
+ break;
+ }
+ }
+ if (mytaskinfo) {
+ for (int k = 0; k < mytaskinfo->tableCount; k++) {
+ if (port_name == mytaskinfo->table[k].iin_name){
+ bcopy(&mytaskinfo->table[k], out_sendright, sizeof(ipc_info_name_t));
+ retval = KERN_SUCCESS;
+ break;
+ }
+ }
+ }
+ return retval;
-kern_return_t get_taskinfo_of_receiver_by_send_right_info(ipc_info_port_t sendright_info, my_per_task_info_t **out_taskinfo, mach_port_name_t *out_recv_info)
-{
- return _get_taskinfo_of_receiver_by_send_right(sendright_info.iip_port_object, out_taskinfo, out_recv_info);
}
diff --git a/system_cmds/ltop.tproj/Makefile b/system_cmds/ltop.tproj/Makefile
new file mode 100644
index 0000000..4ce4899
--- /dev/null
+++ b/system_cmds/ltop.tproj/Makefile
@@ -0,0 +1,3 @@
+PROG= ltop
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/mean.tproj/Makefile b/system_cmds/mean.tproj/Makefile
new file mode 100644
index 0000000..cb287f6
--- /dev/null
+++ b/system_cmds/mean.tproj/Makefile
@@ -0,0 +1,4 @@
+PROG= mean
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/mean.tproj/mean.c b/system_cmds/mean.tproj/mean.c
index 87ecdc2..0c7268d 100644
--- a/system_cmds/mean.tproj/mean.c
+++ b/system_cmds/mean.tproj/mean.c
@@ -7,6 +7,7 @@
*
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/task.h>
#include <mach/thread_act.h>
diff --git a/system_cmds/memory_pressure.tproj/Makefile b/system_cmds/memory_pressure.tproj/Makefile
new file mode 100644
index 0000000..8d4a1ed
--- /dev/null
+++ b/system_cmds/memory_pressure.tproj/Makefile
@@ -0,0 +1,3 @@
+PROG= memory_pressure
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/memory_pressure.tproj/memory_pressure.c b/system_cmds/memory_pressure.tproj/memory_pressure.c
index 1713fcb..eb417c2 100644
--- a/system_cmds/memory_pressure.tproj/memory_pressure.c
+++ b/system_cmds/memory_pressure.tproj/memory_pressure.c
@@ -21,6 +21,7 @@
* @APPLE_LICENSE_HEADER_END@
*/
+typedef char *kobject_description_t[512];
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
diff --git a/system_cmds/mkfile.tproj/Makefile b/system_cmds/mkfile.tproj/Makefile
new file mode 100644
index 0000000..666e804
--- /dev/null
+++ b/system_cmds/mkfile.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= mkfile
+MAN= mkfile.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/mslutil/Makefile b/system_cmds/mslutil/Makefile
new file mode 100644
index 0000000..5ac99a6
--- /dev/null
+++ b/system_cmds/mslutil/Makefile
@@ -0,0 +1,3 @@
+PROG= mslutil
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/newgrp.tproj/Makefile b/system_cmds/newgrp.tproj/Makefile
new file mode 100644
index 0000000..25fecc5
--- /dev/null
+++ b/system_cmds/newgrp.tproj/Makefile
@@ -0,0 +1,5 @@
+PROG= newgrp
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/newgrp.tproj/newgrp.c b/system_cmds/newgrp.tproj/newgrp.c
index 3a4f412..3ffe7a7 100644
--- a/system_cmds/newgrp.tproj/newgrp.c
+++ b/system_cmds/newgrp.tproj/newgrp.c
@@ -52,6 +52,9 @@ __FBSDID("$FreeBSD: src/usr.bin/newgrp/newgrp.c,v 1.5 2009/12/13 03:14:06 delphi
#ifdef __APPLE__
#include <paths.h>
#endif /* __APPLE__ */
+
+#include <libiosexec.h>
+
static void addgroup(const char *grpname);
static void doshell(void);
static int inarray(gid_t, const gid_t[], int);
diff --git a/system_cmds/nologin.tproj/Makefile b/system_cmds/nologin.tproj/Makefile
new file mode 100644
index 0000000..2e009b3
--- /dev/null
+++ b/system_cmds/nologin.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= nologin
+MAN= nologin.5 nologin.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/nvram.tproj/Makefile b/system_cmds/nvram.tproj/Makefile
new file mode 100644
index 0000000..21abc19
--- /dev/null
+++ b/system_cmds/nvram.tproj/Makefile
@@ -0,0 +1,3 @@
+MAN= nvram.8
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/pagesize.tproj/Makefile b/system_cmds/pagesize.tproj/Makefile
new file mode 100644
index 0000000..7efe016
--- /dev/null
+++ b/system_cmds/pagesize.tproj/Makefile
@@ -0,0 +1,4 @@
+SCRIPTS= pagesize.sh
+MAN= pagesize.1
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/passwd.tproj/Makefile b/system_cmds/passwd.tproj/Makefile
new file mode 100644
index 0000000..7dcc91f
--- /dev/null
+++ b/system_cmds/passwd.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= passwd
+MAN= passwd.1
+SRCS= file_passwd.c nis_passwd.c od_passwd.c \
+ pam_passwd.c passwd.c
+
+LDADD+=-lcrypt
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/passwd.tproj/passwd.c b/system_cmds/passwd.tproj/passwd.c
index 877036e..663a40d 100644
--- a/system_cmds/passwd.tproj/passwd.c
+++ b/system_cmds/passwd.tproj/passwd.c
@@ -30,6 +30,7 @@
#include <libc.h>
#include <ctype.h>
#include <string.h>
+#include <crypt.h>
#include "passwd.h"
#ifdef __SLICK__
@@ -50,7 +51,6 @@ getpasswd(char *name, int isroot, int minlen, int mixcase, int nonalpha,
char *p;
static char obuf[_PASSWORD_LEN+1];
static char nbuf[_PASSWORD_LEN+1];
- char salt[9];
printf("Changing password for %s.\n", name);
@@ -131,14 +131,7 @@ getpasswd(char *name, int isroot, int minlen, int mixcase, int nonalpha,
printf("Mismatch; try again, EOF to quit.\n");
}
- /*
- * Create a random salt
- */
- srandom((int)time((time_t *)NULL));
- salt[0] = saltchars[random() % strlen(saltchars)];
- salt[1] = saltchars[random() % strlen(saltchars)];
- salt[2] = '\0';
- *new_pw = crypt(nbuf, salt);
+ *new_pw = crypt(nbuf, crypt_gensalt("$6$", 0, saltchars, strlen(saltchars)));
*old_clear = obuf;
*new_clear = nbuf;
diff --git a/system_cmds/proc_uuid_policy.tproj/Makefile b/system_cmds/proc_uuid_policy.tproj/Makefile
new file mode 100644
index 0000000..2902836
--- /dev/null
+++ b/system_cmds/proc_uuid_policy.tproj/Makefile
@@ -0,0 +1,3 @@
+PROG= proc_uuid_policy
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/purge.tproj/Makefile b/system_cmds/purge.tproj/Makefile
new file mode 100644
index 0000000..bef9cc2
--- /dev/null
+++ b/system_cmds/purge.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= purge
+MAN= purge.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/pwd_mkdb.tproj/Makefile b/system_cmds/pwd_mkdb.tproj/Makefile
new file mode 100644
index 0000000..0869be5
--- /dev/null
+++ b/system_cmds/pwd_mkdb.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= pwd_mkdb
+MAN= pwd_mkdb.8
+SRCS= pw_scan.c pwd_mkdb.c
+
+CFLAGS+=-D_PW_NAME_LEN=MAXLOGNAME -D_PW_YPTOKEN=\"__YP!\"
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/reboot.tproj/Makefile b/system_cmds/reboot.tproj/Makefile
new file mode 100644
index 0000000..d36639a
--- /dev/null
+++ b/system_cmds/reboot.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= reboot
+MAN= reboot.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/reboot.tproj/reboot.c b/system_cmds/reboot.tproj/reboot.c
index 5478704..8156d65 100644
--- a/system_cmds/reboot.tproj/reboot.c
+++ b/system_cmds/reboot.tproj/reboot.c
@@ -65,6 +65,7 @@ __unused static const char rcsid[] =
#include "kextmanager.h"
#include <IOKit/kext/kextmanager_types.h>
#endif
+typedef char *kobject_description_t[512];
#include <mach/mach_port.h> // allocate
#include <mach/mach.h> // task_self, etc
#include <servers/bootstrap.h> // bootstrap
@@ -74,6 +75,8 @@ __unused static const char rcsid[] =
#include <sys/time.h>
#endif
+int reboot3(int);
+
void usage(void);
u_int get_pageins(void);
#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
diff --git a/system_cmds/sa.tproj/Makefile b/system_cmds/sa.tproj/Makefile
new file mode 100644
index 0000000..c5efb2a
--- /dev/null
+++ b/system_cmds/sa.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= sa
+MAN= sa.8
+SRCS= db.c main.c pdb.c usrdb.c
+
+CFLAGS+=-DAHZV1=AHZ
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/sc_usage.tproj/Makefile b/system_cmds/sc_usage.tproj/Makefile
new file mode 100644
index 0000000..3cf5de4
--- /dev/null
+++ b/system_cmds/sc_usage.tproj/Makefile
@@ -0,0 +1,5 @@
+PROG= sc_usage
+
+LDADD+=-lncursesw -liosexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/sc_usage.tproj/sc_usage.c b/system_cmds/sc_usage.tproj/sc_usage.c
index d704479..0d74b4a 100644
--- a/system_cmds/sc_usage.tproj/sc_usage.c
+++ b/system_cmds/sc_usage.tproj/sc_usage.c
@@ -61,6 +61,8 @@ cc -I. -DPRIVATE -D__APPLE_PRIVATE -O -o sc_usage sc_usage.c -lncurses
#include <err.h>
#include <libutil.h>
+#include <libiosexec.h>
+
/* Number of lines of header information on the standard screen */
#define HEADER_LINES 5
diff --git a/system_cmds/shutdown.tproj/Makefile b/system_cmds/shutdown.tproj/Makefile
new file mode 100644
index 0000000..3d12099
--- /dev/null
+++ b/system_cmds/shutdown.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= shutdown
+MAN= shutdown.8
+
+LDADD+=-lbsm -framework IOKit -liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/shutdown.tproj/shutdown.c b/system_cmds/shutdown.tproj/shutdown.c
index 597f9f2..0dcc41b 100644
--- a/system_cmds/shutdown.tproj/shutdown.c
+++ b/system_cmds/shutdown.tproj/shutdown.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
#ifdef __APPLE__
#include <errno.h>
#include <util.h>
+typedef char *kobject_description_t[512];
#include <bsm/libbsm.h>
#include <bsm/audit_uevents.h>
#include <sys/types.h>
@@ -71,8 +72,10 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
#include <vproc.h>
#include <vproc_priv.h>
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
#include "kextmanager.h"
#include <IOKit/kext/kextmanager_types.h>
+#endif
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <mach/mach_port.h> // allocate
#include <mach/mach.h> // task_self, etc
@@ -84,6 +87,10 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
#include "pathnames.h"
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
+int reboot3(int);
+
#ifdef DEBUG
#undef _PATH_NOLOGIN
#define _PATH_NOLOGIN "./nologin"
@@ -139,8 +146,8 @@ void nolog(void);
void timeout(int);
void timewarn(time_t);
void usage(const char *);
-#ifdef __APPLE__
int audit_shutdown(int);
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
int reserve_reboot(void);
#endif
@@ -419,13 +426,13 @@ log_and_exec_reboot_or_halt()
die_you_gravy_sucking_pig_dog()
#endif
{
-#ifndef __APPLE__
- char *empty_environ[] = { NULL };
-#else
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
if ((errno = reserve_reboot())) {
warn("couldn't lock for reboot");
finish(0);
}
+#else
+ char *empty_environ[] = { NULL };
#endif
syslog(LOG_NOTICE, "%s%s by %s: %s",
@@ -670,7 +677,6 @@ usage(const char *cp)
exit(1);
}
-#ifdef __APPLE__
/*
* The following tokens are included in the audit record for shutdown
* header
@@ -718,6 +724,7 @@ audit_shutdown(int exitstatus)
return 1;
}
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
static bool
kextdDisabled(void)
diff --git a/system_cmds/stackshot.tproj/Makefile b/system_cmds/stackshot.tproj/Makefile
new file mode 100644
index 0000000..7471846
--- /dev/null
+++ b/system_cmds/stackshot.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= stackshot
+MAN=
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/stackshot.tproj/stackshot.c b/system_cmds/stackshot.tproj/stackshot.c
index ecb3687..254d0db 100644
--- a/system_cmds/stackshot.tproj/stackshot.c
+++ b/system_cmds/stackshot.tproj/stackshot.c
@@ -17,6 +17,8 @@
#include <kern/kcdata.h>
+#include <libiosexec.h>
+
static uint64_t
stackshot_get_mach_absolute_time(void *buffer, uint32_t size)
{
diff --git a/system_cmds/sync.tproj/Makefile b/system_cmds/sync.tproj/Makefile
new file mode 100644
index 0000000..bfcb191
--- /dev/null
+++ b/system_cmds/sync.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= sync
+MAN= sync.8
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/sysctl.tproj/Makefile b/system_cmds/sysctl.tproj/Makefile
new file mode 100644
index 0000000..dcfb282
--- /dev/null
+++ b/system_cmds/sysctl.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= sysctl
+MAN= sysctl.8 sysctl.conf.5
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/taskpolicy.tproj/Makefile b/system_cmds/taskpolicy.tproj/Makefile
new file mode 100644
index 0000000..726ca66
--- /dev/null
+++ b/system_cmds/taskpolicy.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= taskpolicy
+MAN= taskpolicy.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/taskpolicy.tproj/taskpolicy.c b/system_cmds/taskpolicy.tproj/taskpolicy.c
index 5bc9684..2c87e7c 100644
--- a/system_cmds/taskpolicy.tproj/taskpolicy.c
+++ b/system_cmds/taskpolicy.tproj/taskpolicy.c
@@ -32,6 +32,7 @@
#include <sys/errno.h>
#include <stdbool.h>
#include <sysexits.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/task_policy.h>
diff --git a/system_cmds/trace.tproj/Makefile b/system_cmds/trace.tproj/Makefile
new file mode 100644
index 0000000..84ed106
--- /dev/null
+++ b/system_cmds/trace.tproj/Makefile
@@ -0,0 +1,5 @@
+PROG= trace
+
+LDADD+=-lutil
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/trace.tproj/trace.c b/system_cmds/trace.tproj/trace.c
index f85b336..6ccf0fc 100644
--- a/system_cmds/trace.tproj/trace.c
+++ b/system_cmds/trace.tproj/trace.c
@@ -7,6 +7,7 @@
* made here may also need to be made there.
*/
+typedef char *kobject_description_t[512];
#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
diff --git a/system_cmds/vifs.tproj/Makefile b/system_cmds/vifs.tproj/Makefile
new file mode 100644
index 0000000..f79e2e8
--- /dev/null
+++ b/system_cmds/vifs.tproj/Makefile
@@ -0,0 +1,8 @@
+PROG= vifs
+MAN= vifs.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vifs.tproj/vifs.c b/system_cmds/vifs.tproj/vifs.c
index 967cc1d..19cf2f9 100644
--- a/system_cmds/vifs.tproj/vifs.c
+++ b/system_cmds/vifs.tproj/vifs.c
@@ -35,6 +35,8 @@
#include <unistd.h>
#include <signal.h>
+#include <libiosexec.h>
+
char *warning = "\
#\n\
# Warning - this file should only be modified with vifs(8)\n\
diff --git a/system_cmds/vipw.tproj/Makefile b/system_cmds/vipw.tproj/Makefile
new file mode 100644
index 0000000..5f51e35
--- /dev/null
+++ b/system_cmds/vipw.tproj/Makefile
@@ -0,0 +1,9 @@
+PROG= vipw
+MAN= vipw.8
+SRCS= pw_util.c vipw.c
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vipw.tproj/pw_util.c b/system_cmds/vipw.tproj/pw_util.c
index 8364496..46ff304 100644
--- a/system_cmds/vipw.tproj/pw_util.c
+++ b/system_cmds/vipw.tproj/pw_util.c
@@ -81,6 +81,8 @@ __unused static char sccsid[] = "@(#)pw_util.c 8.4 (Berkeley) 4/28/95";
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pw_util.h"
extern char *tempname;
diff --git a/system_cmds/vm_purgeable_stat.tproj/Makefile b/system_cmds/vm_purgeable_stat.tproj/Makefile
new file mode 100644
index 0000000..6fb7784
--- /dev/null
+++ b/system_cmds/vm_purgeable_stat.tproj/Makefile
@@ -0,0 +1,3 @@
+PROG= vm_purgeable_stat
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vm_purgeable_stat.tproj/entitlements.plist b/system_cmds/vm_purgeable_stat.tproj/entitlements.plist
index 2ee8d1e..b21dbd8 100644
--- a/system_cmds/vm_purgeable_stat.tproj/entitlements.plist
+++ b/system_cmds/vm_purgeable_stat.tproj/entitlements.plist
@@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>com.apple.system-task-ports.inspect</key>
+ <key>task_for_pid-allow</key>
<true/>
</dict>
</plist>
diff --git a/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c b/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c
index 330704d..e0a0011 100644
--- a/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c
+++ b/system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c
@@ -22,11 +22,11 @@
* @APPLE_LICENSE_HEADER_END@
*/
-#include <System/sys/proc.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/mach_types.h>
#include <mach/task.h>
@@ -88,7 +88,7 @@ int get_task_from_pid(int pid, task_t *task)
fprintf(stderr, "%s\n", PRIV_ERR_MSG);
return -1;
}
- kr = task_inspect_for_pid(mach_task_self(), pid, task);
+ kr = task_for_pid(mach_task_self(), pid, task);
if (kr != KERN_SUCCESS) {
fprintf(stderr, "Failed to get task port for pid: %d\n", pid);
return -1;
@@ -128,9 +128,9 @@ int get_system_tasks(task_array_t *tasks, mach_msg_type_number_t *count)
vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)psetCount * sizeof(mach_port_t));
/* convert the processor-set-priv to a list of tasks for the processor set */
- ret = processor_set_tasks_with_flavor(pset_priv, TASK_FLAVOR_INSPECT, tasks, count);
+ ret = processor_set_tasks(pset_priv, tasks, count);
if (ret != KERN_SUCCESS) {
- fprintf(stderr, "processor_set_tasks_with_flavor() failed: %s\n", mach_error_string(ret));
+ fprintf(stderr, "processor_set_tasks() failed: %s\n", mach_error_string(ret));
return -1;
}
mach_port_deallocate(mach_task_self(), pset_priv);
diff --git a/system_cmds/vm_stat.tproj/Makefile b/system_cmds/vm_stat.tproj/Makefile
new file mode 100644
index 0000000..ffa95b6
--- /dev/null
+++ b/system_cmds/vm_stat.tproj/Makefile
@@ -0,0 +1,3 @@
+MAN= vm_stat.1
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/wait4path/Makefile b/system_cmds/wait4path/Makefile
new file mode 100644
index 0000000..ea154c6
--- /dev/null
+++ b/system_cmds/wait4path/Makefile
@@ -0,0 +1,5 @@
+PROG= wait4path
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/wordexp-helper.tproj/Makefile b/system_cmds/wordexp-helper.tproj/Makefile
new file mode 100644
index 0000000..864f5b0
--- /dev/null
+++ b/system_cmds/wordexp-helper.tproj/Makefile
@@ -0,0 +1,4 @@
+PROG= wordexp-helper
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/zdump.tproj/Makefile b/system_cmds/zdump.tproj/Makefile
new file mode 100644
index 0000000..40111f3
--- /dev/null
+++ b/system_cmds/zdump.tproj/Makefile
@@ -0,0 +1,6 @@
+PROG= zdump
+MAN= zdump.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/zic.tproj/Makefile b/system_cmds/zic.tproj/Makefile
new file mode 100644
index 0000000..87b92fa
--- /dev/null
+++ b/system_cmds/zic.tproj/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PROG= zic
+MAN= zic.8
+SRCS= zic.c ialloc.c scheck.c
+
+CFLAGS+= -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DSTD_INSPIRED -DPCTS
+CFLAGS+= -DHAVE_LONG_DOUBLE -DTZDIR=\"${SHAREDIR}/zoneinfo\" -Demkdir=mkdir
+CFLAGS+= -DHAVE_STRERROR -DHAVE_UNISTD_H
+CFLAGS+= -I${.CURDIR:H} -I${SRCTOP}/contrib/tzcode/stdtime
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/Makefile b/text_cmds/Makefile
new file mode 100644
index 0000000..0303d46
--- /dev/null
+++ b/text_cmds/Makefile
@@ -0,0 +1,37 @@
+SUBDIR= banner \
+ cat \
+ col \
+ colrm \
+ column \
+ comm \
+ csplit \
+ cut \
+ ed \
+ ee \
+ expand \
+ fmt \
+ fold \
+ grep \
+ head \
+ join \
+ lam \
+ look \
+ md5 \
+ nl \
+ paste \
+ pr \
+ rev \
+ rs \
+ sed \
+ sort \
+ split \
+ tail \
+ tr \
+ ul \
+ unexpand \
+ uniq \
+ unvis \
+ vis \
+ wc
+
+.include <bsd.subdir.mk>
diff --git a/text_cmds/Makefile.inc b/text_cmds/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/text_cmds/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/text_cmds/banner/Makefile b/text_cmds/banner/Makefile
new file mode 100644
index 0000000..f3af9a6
--- /dev/null
+++ b/text_cmds/banner/Makefile
@@ -0,0 +1,4 @@
+PROG= banner
+MAN= banner.6
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/cat/Makefile b/text_cmds/cat/Makefile
new file mode 100644
index 0000000..934ccfa
--- /dev/null
+++ b/text_cmds/cat/Makefile
@@ -0,0 +1,5 @@
+PROG= cat
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/col/Makefile b/text_cmds/col/Makefile
new file mode 100644
index 0000000..33498e2
--- /dev/null
+++ b/text_cmds/col/Makefile
@@ -0,0 +1,3 @@
+PROG= col
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/colrm/Makefile b/text_cmds/colrm/Makefile
new file mode 100644
index 0000000..0da3b5a
--- /dev/null
+++ b/text_cmds/colrm/Makefile
@@ -0,0 +1,3 @@
+PROG= colrm
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/column/Makefile b/text_cmds/column/Makefile
new file mode 100644
index 0000000..b0b88c0
--- /dev/null
+++ b/text_cmds/column/Makefile
@@ -0,0 +1,3 @@
+PROG= column
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/comm/Makefile b/text_cmds/comm/Makefile
new file mode 100644
index 0000000..8bfa67f
--- /dev/null
+++ b/text_cmds/comm/Makefile
@@ -0,0 +1,3 @@
+PROG= comm
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/csplit/Makefile b/text_cmds/csplit/Makefile
new file mode 100644
index 0000000..b4c7ed9
--- /dev/null
+++ b/text_cmds/csplit/Makefile
@@ -0,0 +1,3 @@
+PROG= csplit
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/cut/Makefile b/text_cmds/cut/Makefile
new file mode 100644
index 0000000..3f243c6
--- /dev/null
+++ b/text_cmds/cut/Makefile
@@ -0,0 +1,3 @@
+PROG= cut
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/ed/Makefile b/text_cmds/ed/Makefile
new file mode 100644
index 0000000..c374a39
--- /dev/null
+++ b/text_cmds/ed/Makefile
@@ -0,0 +1,7 @@
+PROG= ed
+SRCS= buf.c cbc.c glbl.c io.c \
+ main.c re.c sub.c undo.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/ee/Makefile b/text_cmds/ee/Makefile
index a6525ea..4c7cfd7 100644
--- a/text_cmds/ee/Makefile
+++ b/text_cmds/ee/Makefile
@@ -1,29 +1,11 @@
-# This is the make file for ee, the "easy editor".
-#
-# A file called 'make.local' will be generated which will contain information
-# specific to the local system, such as if it is a BSD or System V based
-# version of UNIX, whether or not it has catgets, or select.
-#
-# The "install" target ("make install") will copy the ee binary to
-# the /usr/local/bin directory on the local system. The man page (ee.1)
-# will be copied into the /usr/local/man/man1 directory.
-#
-# The "clean" target ("make clean") will remove the ee and new_curse.o
-# object files, and the ee binary.
-#
+# $FreeBSD$
-all : localmake buildee
+CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \
+ -DHAS_SYS_WAIT
-buildee :
- make -f make.local
-
-localmake:
- @./create.make
-
-install :
- cp ee /usr/local/bin/ee
- cp ee.1 /usr/local/man/man1/ee.1
-
-clean :
- rm -f ee.o new_curse.o ee
+PROG= ee
+LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit
+MLINKS= ee.1 ree.1 ee.1 edit.1
+LDADD+=-lncursesw -liosexec
+.include <bsd.prog.mk>
diff --git a/text_cmds/ee/ee.c b/text_cmds/ee/ee.c
index 70a4407..211f4d6 100644
--- a/text_cmds/ee/ee.c
+++ b/text_cmds/ee/ee.c
@@ -82,6 +82,8 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.104 $";
#include <pwd.h>
#include <locale.h>
+#include <libiosexec.h>
+
#ifdef HAS_SYS_WAIT
#include <sys/wait.h>
#endif
diff --git a/text_cmds/expand/Makefile b/text_cmds/expand/Makefile
new file mode 100644
index 0000000..bba5bd3
--- /dev/null
+++ b/text_cmds/expand/Makefile
@@ -0,0 +1,4 @@
+PROG= expand
+MLINKS= expand.1 unexpand.1
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/fmt/Makefile b/text_cmds/fmt/Makefile
new file mode 100644
index 0000000..48f96db
--- /dev/null
+++ b/text_cmds/fmt/Makefile
@@ -0,0 +1,3 @@
+PROG= fmt
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/fold/Makefile b/text_cmds/fold/Makefile
new file mode 100644
index 0000000..278a34e
--- /dev/null
+++ b/text_cmds/fold/Makefile
@@ -0,0 +1,3 @@
+PROG= fold
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/grep/Makefile b/text_cmds/grep/Makefile
new file mode 100644
index 0000000..a54da9f
--- /dev/null
+++ b/text_cmds/grep/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $
+# $FreeBSD$
+# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
+
+PROG= grep
+
+SRCS= file.c grep.c queue.c util.c
+
+LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \
+ ${BINDIR}/grep ${BINDIR}/fgrep \
+ ${BINDIR}/grep ${BINDIR}/rgrep \
+
+MLINKS+= grep.1 egrep.1 \
+ grep.1 fgrep.1 \
+ grep.1 rgrep.1
+
+CFLAGS+=-DWITHOUT_FASTMATCH
+
+LDADD+=-llzma -lbz2 -lz
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/head/Makefile b/text_cmds/head/Makefile
new file mode 100644
index 0000000..5ea0c9a
--- /dev/null
+++ b/text_cmds/head/Makefile
@@ -0,0 +1,3 @@
+PROG= head
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/join/Makefile b/text_cmds/join/Makefile
new file mode 100644
index 0000000..42b5f58
--- /dev/null
+++ b/text_cmds/join/Makefile
@@ -0,0 +1,3 @@
+PROG= join
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/lam/Makefile b/text_cmds/lam/Makefile
new file mode 100644
index 0000000..e47ea0a
--- /dev/null
+++ b/text_cmds/lam/Makefile
@@ -0,0 +1,3 @@
+PROG= lam
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/look/Makefile b/text_cmds/look/Makefile
new file mode 100644
index 0000000..e1331bf
--- /dev/null
+++ b/text_cmds/look/Makefile
@@ -0,0 +1,3 @@
+PROG= look
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/md5/Makefile b/text_cmds/md5/Makefile
new file mode 100644
index 0000000..c152154
--- /dev/null
+++ b/text_cmds/md5/Makefile
@@ -0,0 +1,28 @@
+PROG= md5
+SRCS= md5.c commoncrypto.c
+
+LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \
+ ${BINDIR}/md5 ${BINDIR}/sha1 \
+ ${BINDIR}/md5 ${BINDIR}/sha224 \
+ ${BINDIR}/md5 ${BINDIR}/sha256 \
+ ${BINDIR}/md5 ${BINDIR}/sha384 \
+ ${BINDIR}/md5 ${BINDIR}/sha512 \
+ ${BINDIR}/md5 ${BINDIR}/sha512t256 \
+ ${BINDIR}/md5 ${BINDIR}/skein256 \
+ ${BINDIR}/md5 ${BINDIR}/skein512 \
+ ${BINDIR}/md5 ${BINDIR}/skein1024
+
+MLINKS= md5.1 rmd160.1 \
+ md5.1 sha1.1 \
+ md5.1 sha224.1 \
+ md5.1 sha256.1 \
+ md5.1 sha384.1 \
+ md5.1 sha512.1 \
+ md5.1 sha512t256.1 \
+ md5.1 skein256.1 \
+ md5.1 skein512.1 \
+ md5.1 skein1024.1
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/nl/Makefile b/text_cmds/nl/Makefile
new file mode 100644
index 0000000..66a1483
--- /dev/null
+++ b/text_cmds/nl/Makefile
@@ -0,0 +1,3 @@
+PROG= nl
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/paste/Makefile b/text_cmds/paste/Makefile
new file mode 100644
index 0000000..e4f9e6d
--- /dev/null
+++ b/text_cmds/paste/Makefile
@@ -0,0 +1,3 @@
+PROG= paste
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/pr/Makefile b/text_cmds/pr/Makefile
new file mode 100644
index 0000000..5213e2d
--- /dev/null
+++ b/text_cmds/pr/Makefile
@@ -0,0 +1,4 @@
+PROG= pr
+SRCS= egetopt.c pr.c
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/rev/Makefile b/text_cmds/rev/Makefile
new file mode 100644
index 0000000..92540c1
--- /dev/null
+++ b/text_cmds/rev/Makefile
@@ -0,0 +1,3 @@
+PROG= rev
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/rs/Makefile b/text_cmds/rs/Makefile
new file mode 100644
index 0000000..db1ea14
--- /dev/null
+++ b/text_cmds/rs/Makefile
@@ -0,0 +1,3 @@
+PROG= rs
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/sed/Makefile b/text_cmds/sed/Makefile
new file mode 100644
index 0000000..e818030
--- /dev/null
+++ b/text_cmds/sed/Makefile
@@ -0,0 +1,7 @@
+PROG= sed
+SRCS= compile.c \
+main.c \
+misc.c \
+process.c
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/sort/Makefile b/text_cmds/sort/Makefile
new file mode 100644
index 0000000..e0e1dac
--- /dev/null
+++ b/text_cmds/sort/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+PROG= sort
+
+SRCS= bwstring.c coll.c commoncrypto.c file.c \
+ mem.c radixsort.c sort.c vsort.c
+
+sort.1: sort.1.in
+ sed ${MAN_SUB} ${.ALLSRC} >${.TARGET}
+
+CLEANFILES+= sort.1
+
+# Enabled here cause not enabling it is a bad default
+CFLAGS+= -DSORT_THREADS
+MAN_SUB+= -e 's|%%THREADS%%||g'
+
+CFLAGS+= -DWITHOUT_NLS
+MAN_SUB+= -e 's|%%NLS%%|\.\\"|g'
+
+# Current text_cmds version
+CFLAGS+=-DSORT_VERSION=\"106\"
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/sort/coll.h b/text_cmds/sort/coll.h
index 6e3f9b4..d74460e 100644
--- a/text_cmds/sort/coll.h
+++ b/text_cmds/sort/coll.h
@@ -91,7 +91,7 @@ struct key_value
{
struct bwstring *k; /* key string */
struct key_hint hint[0]; /* key sort hint */
-} __packed;
+};
/*
* Set of keys container object.
diff --git a/text_cmds/split/Makefile b/text_cmds/split/Makefile
new file mode 100644
index 0000000..27270a0
--- /dev/null
+++ b/text_cmds/split/Makefile
@@ -0,0 +1,3 @@
+PROG= split
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/tail/Makefile b/text_cmds/tail/Makefile
new file mode 100644
index 0000000..bd285e9
--- /dev/null
+++ b/text_cmds/tail/Makefile
@@ -0,0 +1,4 @@
+PROG= tail
+SRCS= forward.c misc.c read.c reverse.c tail.c
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/tr/Makefile b/text_cmds/tr/Makefile
new file mode 100644
index 0000000..86980fa
--- /dev/null
+++ b/text_cmds/tr/Makefile
@@ -0,0 +1,4 @@
+PROG= tr
+SRCS= cmap.c cset.c str.c tr.c
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/tr/collate-fbsd.c b/text_cmds/tr/collate-fbsd.c
new file mode 100644
index 0000000..c4d8997
--- /dev/null
+++ b/text_cmds/tr/collate-fbsd.c
@@ -0,0 +1,158 @@
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.33 2004/09/22 16:56:48 stefanf Exp $");
+
+#include "xlocale_private.h"
+#define __collate_chain_equiv_table (loc->__lc_collate->__chain_equiv_table)
+#define __collate_chain_pri_table (loc->__lc_collate->__chain_pri_table)
+#define __collate_char_pri_table (loc->__lc_collate->__char_pri_table)
+#define __collate_info (&loc->__lc_collate->__info)
+#define __collate_large_char_pri_table (loc->__lc_collate->__large_char_pri_table)
+#define __collate_substitute_table (loc->__lc_collate->__substitute_table)
+
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <wchar.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include <ctype.h>
+
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+static void wntohl(wchar_t *, int);
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
+void __collate_err(int ex, const char *f) __dead2;
+
+/*
+ * Normally, the __collate_* routines should all be __private_extern__,
+ * but grep is using them (3715846). Until we can provide an alternative,
+ * we leave them public, and provide a read-only __collate_load_error variable
+ */
+#undef __collate_load_error
+int __collate_load_error = 1;
+
+static int
+__collate_wcsnlen(const wchar_t *s, int len)
+{
+ int n = 0;
+ while (*s && n < len) {
+ s++;
+ n++;
+ }
+ return n;
+}
+
+static struct __collate_st_chain_pri *
+chainsearch(const wchar_t *key, int *len, locale_t loc)
+{
+ int low = 0;
+ int high = __collate_info->chain_count - 1;
+ int next, compar, l;
+ struct __collate_st_chain_pri *p;
+ struct __collate_st_chain_pri *tab = __collate_chain_pri_table;
+
+ while (low <= high) {
+ next = (low + high) / 2;
+ p = tab + next;
+ compar = *key - *p->str;
+ if (compar == 0) {
+ l = __collate_wcsnlen(p->str, STR_LEN);
+ compar = wcsncmp(key, p->str, l);
+ if (compar == 0) {
+ *len = l;
+ return p;
+ }
+ }
+ if (compar > 0)
+ low = next + 1;
+ else
+ high = next - 1;
+ }
+ return NULL;
+}
+
+static struct __collate_st_large_char_pri *
+largesearch(const wchar_t key, locale_t loc)
+{
+ int low = 0;
+ int high = __collate_info->large_pri_count - 1;
+ int next, compar;
+ struct __collate_st_large_char_pri *p;
+ struct __collate_st_large_char_pri *tab = __collate_large_char_pri_table;
+
+ while (low <= high) {
+ next = (low + high) / 2;
+ p = tab + next;
+ compar = key - p->val;
+ if (compar == 0)
+ return p;
+ if (compar > 0)
+ low = next + 1;
+ else
+ high = next - 1;
+ }
+ return NULL;
+}
+
+void
+__collate_lookup_l(const wchar_t *t, int *len, int *prim, int *sec, locale_t loc)
+{
+ struct __collate_st_chain_pri *p2;
+ int l;
+
+ *len = 1;
+ *prim = *sec = 0;
+ p2 = chainsearch(t, &l, loc);
+ /* use the chain if prim >= 0 */
+ if (p2 && p2->pri[0] >= 0) {
+ *len = l;
+ *prim = p2->pri[0];
+ *sec = p2->pri[1];
+ return;
+ }
+ if (*t <= UCHAR_MAX) {
+ *prim = __collate_char_pri_table[*t].pri[0];
+ *sec = __collate_char_pri_table[*t].pri[1];
+ return;
+ }
+ if (__collate_info->large_pri_count > 0) {
+ struct __collate_st_large_char_pri *match;
+ match = largesearch(*t, loc);
+ if (match) {
+ *prim = match->pri.pri[0];
+ *sec = match->pri.pri[1];
+ return;
+ }
+ }
+ *prim = (l = __collate_info->undef_pri[0]) >= 0 ? l : *t - l;
+ *sec = (l = __collate_info->undef_pri[1]) >= 0 ? l : *t - l;
+}
diff --git a/text_cmds/tr/collate.h b/text_cmds/tr/collate.h
new file mode 100644
index 0000000..494e231
--- /dev/null
+++ b/text_cmds/tr/collate.h
@@ -0,0 +1,121 @@
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/libc/locale/collate.h,v 1.14 2002/08/30 20:26:02 ache Exp $
+ */
+
+#ifndef _COLLATE_H_
+#define _COLLATE_H_
+
+#include <sys/cdefs.h>
+#ifndef __LIBC__
+#include <sys/types.h>
+#endif /* !__LIBC__ */
+#include <limits.h>
+
+#define STR_LEN 10
+#define TABLE_SIZE 100
+#define COLLATE_VERSION "1.0\n"
+#define COLLATE_VERSION1_1 "1.1\n"
+#define COLLATE_VERSION1_1A "1.1A\n"
+/* see discussion in string/FreeBSD/strxfrm for this value */
+#define COLLATE_MAX_PRIORITY ((1 << 24) - 1)
+
+#define DIRECTIVE_UNDEF 0x00
+#define DIRECTIVE_FORWARD 0x01
+#define DIRECTIVE_BACKWARD 0x02
+#define DIRECTIVE_POSITION 0x04
+
+#define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
+
+#define COLLATE_SUBST_DUP 0x0001
+
+#define IGNORE_EQUIV_CLASS 1
+
+struct __collate_st_info {
+ __uint8_t directive[COLL_WEIGHTS_MAX];
+ __uint8_t flags;
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+ __uint8_t directive_count:4;
+ __uint8_t chain_max_len:4;
+#else
+ __uint8_t chain_max_len:4;
+ __uint8_t directive_count:4;
+#endif
+ __int32_t undef_pri[COLL_WEIGHTS_MAX];
+ __int32_t subst_count[COLL_WEIGHTS_MAX];
+ __int32_t chain_count;
+ __int32_t large_pri_count;
+};
+
+struct __collate_st_char_pri {
+ __int32_t pri[COLL_WEIGHTS_MAX];
+};
+struct __collate_st_chain_pri {
+ __darwin_wchar_t str[STR_LEN];
+ __int32_t pri[COLL_WEIGHTS_MAX];
+};
+struct __collate_st_large_char_pri {
+ __int32_t val;
+ struct __collate_st_char_pri pri;
+};
+struct __collate_st_subst {
+ __int32_t val;
+ __darwin_wchar_t str[STR_LEN];
+};
+
+#ifndef __LIBC__
+extern int __collate_load_error;
+extern int __collate_substitute_nontrivial;
+#define __collate_char_pri_table (*__collate_char_pri_table_ptr)
+extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
+extern struct __collate_st_chain_pri *__collate_chain_pri_table;
+extern __int32_t *__collate_chain_equiv_table;
+extern struct __collate_st_info __collate_info;
+#endif /* !__LIBC__ */
+
+__BEGIN_DECLS
+#ifdef __LIBC__
+__darwin_wchar_t *__collate_mbstowcs(const char *, locale_t);
+__darwin_wchar_t *__collate_wcsdup(const __darwin_wchar_t *);
+__darwin_wchar_t *__collate_substitute(const __darwin_wchar_t *, int, locale_t);
+int __collate_load_tables(const char *, locale_t);
+void __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t);
+void __collate_lookup_which(const __darwin_wchar_t *, int *, int *, int, locale_t);
+void __collate_xfrm(const __darwin_wchar_t *, __darwin_wchar_t **, locale_t);
+int __collate_range_cmp(__darwin_wchar_t, __darwin_wchar_t, locale_t);
+size_t __collate_collating_symbol(__darwin_wchar_t *, size_t, const char *, size_t, __darwin_mbstate_t *, locale_t);
+int __collate_equiv_class(const char *, size_t, __darwin_mbstate_t *, locale_t);
+size_t __collate_equiv_match(int, __darwin_wchar_t *, size_t, __darwin_wchar_t, const char *, size_t, __darwin_mbstate_t *, size_t *, locale_t);
+#else /* !__LIBC__ */
+void __collate_lookup(const unsigned char *, int *, int *, int *);
+#endif /* __LIBC__ */
+#ifdef COLLATE_DEBUG
+void __collate_print_tables(void);
+#endif
+__END_DECLS
+
+#endif /* !_COLLATE_H_ */
diff --git a/text_cmds/tr/setlocale.h b/text_cmds/tr/setlocale.h
new file mode 100644
index 0000000..b21f6f7
--- /dev/null
+++ b/text_cmds/tr/setlocale.h
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/libc/locale/setlocale.h,v 1.6 2003/07/06 02:03:37 ache Exp $
+ */
+
+#ifndef _SETLOCALE_H_
+#define _SETLOCALE_H_
+
+#include <xlocale.h>
+
+#define ENCODING_LEN 31
+#define CATEGORY_LEN 11
+
+extern char *_PathLocale;
+
+int __detect_path_locale(void);
+int __wrap_setrunelocale(const char *, locale_t);
+
+#endif /* !_SETLOCALE_H_ */
diff --git a/text_cmds/tr/str.c b/text_cmds/tr/str.c
index e7e6757..6971e68 100644
--- a/text_cmds/tr/str.c
+++ b/text_cmds/tr/str.c
@@ -66,8 +66,12 @@ static void genseq(STR *);
* Using libc internal function __collate_lookup_l for character
* equivalence
*/
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000
+#include "collate-fbsd.c"
+#else
void __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *,
locale_t);
+#endif
/*
* Cache for primary collation weight of each single byte character
* used in static void genequiv(s)
diff --git a/text_cmds/tr/xlocale_private.h b/text_cmds/tr/xlocale_private.h
new file mode 100644
index 0000000..8cb81f9
--- /dev/null
+++ b/text_cmds/tr/xlocale_private.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE_PRIVATE_H_
+#define _XLOCALE_PRIVATE_H_
+
+#include <sys/cdefs.h>
+#define __DARWIN_XLOCALE_PRIVATE
+#include <xlocale.h>
+#undef __DARWIN_XLOCALE_PRIVATE
+#include <stdlib.h>
+#include <locale.h>
+#include <libkern/OSAtomic.h>
+#include <pthread.h>
+#include <limits.h>
+#include "setlocale.h"
+#include "collate.h"
+
+typedef void (*__free_extra_t)(void *);
+
+#define __STRUCT_COMMON \
+ int32_t __refcount; \
+ __free_extra_t __free_extra;
+
+struct __xlocale_st_collate {
+ __STRUCT_COMMON
+ char __encoding[ENCODING_LEN + 1];
+ struct __collate_st_info __info;
+ struct __collate_st_subst *__substitute_table[COLL_WEIGHTS_MAX];
+ struct __collate_st_chain_pri *__chain_pri_table;
+ struct __collate_st_large_char_pri *__large_char_pri_table;
+ struct __collate_st_char_pri __char_pri_table[UCHAR_MAX + 1];
+};
+struct _xlocale {
+/* The item(s) before __magic are not copied when duplicating locale_t's */
+ __STRUCT_COMMON /* only used for locale_t's in __lc_numeric_loc */
+ /* 10 independent mbstate_t buffers! */
+ __darwin_mbstate_t __mbs_mblen;
+ __darwin_mbstate_t __mbs_mbrlen;
+ __darwin_mbstate_t __mbs_mbrtowc;
+ __darwin_mbstate_t __mbs_mbsnrtowcs;
+ __darwin_mbstate_t __mbs_mbsrtowcs;
+ __darwin_mbstate_t __mbs_mbtowc;
+ __darwin_mbstate_t __mbs_wcrtomb;
+ __darwin_mbstate_t __mbs_wcsnrtombs;
+ __darwin_mbstate_t __mbs_wcsrtombs;
+ __darwin_mbstate_t __mbs_wctomb;
+/* magic (Here up to the end is copied when duplicating locale_t's) */
+ int64_t __magic;
+/* flags */
+ unsigned char __collate_load_error;
+ unsigned char __collate_substitute_nontrivial;
+ unsigned char _messages_using_locale;
+ unsigned char _monetary_using_locale;
+ unsigned char _numeric_using_locale;
+ unsigned char _time_using_locale;
+ unsigned char __mlocale_changed;
+ unsigned char __nlocale_changed;
+ unsigned char __numeric_fp_cvt;
+/* collate */
+ struct __xlocale_st_collate *__lc_collate;
+/* ctype */
+ struct __xlocale_st_runelocale *__lc_ctype;
+/* messages */
+ struct __xlocale_st_messages *__lc_messages;
+/* monetary */
+ struct __xlocale_st_monetary *__lc_monetary;
+/* numeric */
+ struct __xlocale_st_numeric *__lc_numeric;
+ struct _xlocale *__lc_numeric_loc;
+/* time */
+ struct __xlocale_st_time *__lc_time;
+/* localeconv */
+ struct __xlocale_st_localeconv *__lc_localeconv;
+};
+
+#endif /* _XLOCALE_PRIVATE_H_ */
diff --git a/text_cmds/ul/Makefile b/text_cmds/ul/Makefile
new file mode 100644
index 0000000..cf193c3
--- /dev/null
+++ b/text_cmds/ul/Makefile
@@ -0,0 +1,5 @@
+PROG= ul
+
+LDADD+=-lncursesw
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/unexpand/Makefile b/text_cmds/unexpand/Makefile
new file mode 100644
index 0000000..0d06c9f
--- /dev/null
+++ b/text_cmds/unexpand/Makefile
@@ -0,0 +1,4 @@
+PROG= unexpand
+MAN=
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/uniq/Makefile b/text_cmds/uniq/Makefile
new file mode 100644
index 0000000..a62780c
--- /dev/null
+++ b/text_cmds/uniq/Makefile
@@ -0,0 +1,3 @@
+PROG= uniq
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/unvis/Makefile b/text_cmds/unvis/Makefile
new file mode 100644
index 0000000..cf3c0cb
--- /dev/null
+++ b/text_cmds/unvis/Makefile
@@ -0,0 +1,3 @@
+PROG= unvis
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/vis/Makefile b/text_cmds/vis/Makefile
new file mode 100644
index 0000000..424b508
--- /dev/null
+++ b/text_cmds/vis/Makefile
@@ -0,0 +1,4 @@
+PROG= vis
+SRCS= foldit.c vis.c
+
+.include <bsd.prog.mk>
diff --git a/text_cmds/wc/Makefile b/text_cmds/wc/Makefile
new file mode 100644
index 0000000..4506a3f
--- /dev/null
+++ b/text_cmds/wc/Makefile
@@ -0,0 +1,3 @@
+PROG= wc
+
+.include <bsd.prog.mk>