]> git.cameronkatri.com Git - apple_cmds.git/commitdiff
Merge branch 'apple'
authorCameron Katri <me@cameronkatri.com>
Fri, 2 Jul 2021 15:36:44 +0000 (11:36 -0400)
committerCameron Katri <me@cameronkatri.com>
Fri, 2 Jul 2021 15:36:44 +0000 (11:36 -0400)
394 files changed:
.gitignore
Makefile [new file with mode: 0644]
Makefile.inc [new file with mode: 0644]
README.md [new file with mode: 0644]
adv_cmds/Makefile [new file with mode: 0644]
adv_cmds/Makefile.inc [new file with mode: 0644]
adv_cmds/cap_mkdb/Makefile [new file with mode: 0644]
adv_cmds/colldef/Makefile [new file with mode: 0644]
adv_cmds/colldef/scan.l
adv_cmds/finger/Makefile [new file with mode: 0644]
adv_cmds/gencat/Makefile [new file with mode: 0644]
adv_cmds/last/Makefile [new file with mode: 0644]
adv_cmds/locale/Makefile [new file with mode: 0644]
adv_cmds/lsvfs/Makefile [new file with mode: 0644]
adv_cmds/mklocale/Makefile [new file with mode: 0644]
adv_cmds/mklocale/lex.l
adv_cmds/ps/Makefile [new file with mode: 0644]
adv_cmds/stty/Makefile [new file with mode: 0644]
adv_cmds/tabs/Makefile [new file with mode: 0644]
adv_cmds/tty/Makefile [new file with mode: 0644]
adv_cmds/whois/Makefile [new file with mode: 0644]
basic_cmds/Makefile [new file with mode: 0644]
basic_cmds/Makefile.inc [new file with mode: 0644]
basic_cmds/mesg/Makefile [new file with mode: 0644]
basic_cmds/uudecode/Makefile [new file with mode: 0644]
basic_cmds/uuencode/Makefile [new file with mode: 0644]
basic_cmds/write/Makefile [new file with mode: 0644]
bootstrap_cmds/Makefile [new file with mode: 0644]
bootstrap_cmds/Makefile.inc [new file with mode: 0644]
bootstrap_cmds/migcom.tproj/Makefile [new file with mode: 0644]
bootstrap_cmds/migcom.tproj/lexxer.l
create_tarballs.sh [new file with mode: 0755]
developer_cmds/Makefile [new file with mode: 0644]
developer_cmds/Makefile.inc [new file with mode: 0644]
developer_cmds/asa/Makefile [new file with mode: 0644]
developer_cmds/ctags/Makefile [new file with mode: 0644]
developer_cmds/lorder/Makefile [new file with mode: 0644]
developer_cmds/rpcgen/Makefile [new file with mode: 0644]
developer_cmds/rpcgen/rpc_main.c
developer_cmds/unifdef/Makefile [new file with mode: 0644]
diskdev_cmds/Makefile [new file with mode: 0644]
diskdev_cmds/Makefile.inc [new file with mode: 0644]
diskdev_cmds/dev_mkdb.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/disklib/preen.c
diskdev_cmds/edquota.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/edquota.tproj/edquota.c
diskdev_cmds/edt_fstab/edt_fstab.h
diskdev_cmds/fdisk.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/fsck.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/fsck.tproj/fsck.c
diskdev_cmds/fstyp.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/fstyp.tproj/progs.mk [new file with mode: 0644]
diskdev_cmds/fuser.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/mount.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/mount_devfs.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/mount_fdesc.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/mount_flags_dir/mount_flags.c
diskdev_cmds/quota.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/quotacheck.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/quotaon.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/repquota.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/setclass.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/vndevice.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/vsdbutil.tproj/Makefile [new file with mode: 0644]
diskdev_cmds/vsdbutil.tproj/vsdbutil_main.c
doc_cmds/Makefile [new file with mode: 0644]
doc_cmds/Makefile.inc [new file with mode: 0644]
doc_cmds/checknr/Makefile [new file with mode: 0644]
doc_cmds/colcrt/Makefile [new file with mode: 0644]
doc_cmds/makewhatis/Makefile [new file with mode: 0644]
file_cmds/Makefile [new file with mode: 0644]
file_cmds/Makefile.inc [new file with mode: 0644]
file_cmds/chflags/Makefile [new file with mode: 0644]
file_cmds/chmod/Makefile [new file with mode: 0644]
file_cmds/chown/Makefile [new file with mode: 0644]
file_cmds/cksum/Makefile [new file with mode: 0644]
file_cmds/common/rpmatch.c [new file with mode: 0644]
file_cmds/compress/Makefile [new file with mode: 0644]
file_cmds/compress/compress.c
file_cmds/cp/Makefile [new file with mode: 0644]
file_cmds/cp/cp.c
file_cmds/cp/utils.c
file_cmds/dd/Makefile [new file with mode: 0644]
file_cmds/df/Makefile [new file with mode: 0644]
file_cmds/du/Makefile [new file with mode: 0644]
file_cmds/gzip/Makefile [new file with mode: 0644]
file_cmds/install/Makefile [new file with mode: 0644]
file_cmds/install/xinstall.c
file_cmds/ipcrm/Makefile [new file with mode: 0644]
file_cmds/ipcs/Makefile [new file with mode: 0644]
file_cmds/ipcs/ipcs.c
file_cmds/ln/Makefile [new file with mode: 0644]
file_cmds/ls/Makefile [new file with mode: 0644]
file_cmds/ls/ls.c
file_cmds/mkdir/Makefile [new file with mode: 0644]
file_cmds/mkfifo/Makefile [new file with mode: 0644]
file_cmds/mknod/Makefile [new file with mode: 0644]
file_cmds/mtree/Makefile [new file with mode: 0644]
file_cmds/mtree/commoncrypto.c
file_cmds/mv/Makefile [new file with mode: 0644]
file_cmds/mv/mv.c
file_cmds/pathchk/Makefile [new file with mode: 0644]
file_cmds/pax/Makefile [new file with mode: 0644]
file_cmds/pax/ar_io.c
file_cmds/pax/extern.h
file_cmds/pax/options.c
file_cmds/rm/Makefile [new file with mode: 0644]
file_cmds/rm/rm.c
file_cmds/rmdir/Makefile [new file with mode: 0644]
file_cmds/rmt/Makefile [new file with mode: 0644]
file_cmds/shar/Makefile [new file with mode: 0644]
file_cmds/stat/Makefile [new file with mode: 0644]
file_cmds/touch/Makefile [new file with mode: 0644]
file_cmds/xinstall [new symlink]
mail_cmds/Makefile
mail_cmds/Makefile.inc [new file with mode: 0644]
mail_cmds/biff/Makefile
mail_cmds/comsat/Makefile
mail_cmds/from/Makefile
mail_cmds/mail/Makefile
mail_cmds/mail/popen.c
mail_cmds/mail/send.c
mail_cmds/msgs/Makefile
misc_cmds/Makefile [new file with mode: 0644]
misc_cmds/Makefile.inc [new file with mode: 0644]
misc_cmds/calendar/Makefile [new file with mode: 0644]
misc_cmds/calendar/io.c
misc_cmds/leave/Makefile [new file with mode: 0644]
misc_cmds/leave/leave.c
misc_cmds/ncal/Makefile [new file with mode: 0644]
misc_cmds/ncal/ncal.c
misc_cmds/tsort/Makefile [new file with mode: 0644]
misc_cmds/units/Makefile [new file with mode: 0644]
network_cmds/Makefile [new file with mode: 0644]
network_cmds/Makefile.inc [new file with mode: 0644]
network_cmds/arp.tproj/Makefile [new file with mode: 0644]
network_cmds/cfilutil/Makefile [new file with mode: 0644]
network_cmds/dnctl/Makefile [new file with mode: 0644]
network_cmds/dnctl/dnctl.c
network_cmds/ecnprobe/Makefile [new file with mode: 0644]
network_cmds/frame_delay/Makefile [new file with mode: 0644]
network_cmds/ifconfig.tproj/Makefile [new file with mode: 0644]
network_cmds/ifconfig.tproj/if6lowpan.c
network_cmds/ifconfig.tproj/ifbridge.c
network_cmds/ifconfig.tproj/ifconfig.c
network_cmds/ifconfig.tproj/ifmedia.c
network_cmds/ifconfig.tproj/nexus.c
network_cmds/ip6addrctl.tproj/Makefile [new file with mode: 0644]
network_cmds/kdumpd.tproj/Makefile [new file with mode: 0644]
network_cmds/mnc.tproj/Makefile [new file with mode: 0644]
network_cmds/mptcp_client/Makefile [new file with mode: 0644]
network_cmds/mtest.tproj/Makefile [new file with mode: 0644]
network_cmds/ndp.tproj/Makefile [new file with mode: 0644]
network_cmds/ndp.tproj/ndp.c
network_cmds/netstat.tproj/Makefile [new file with mode: 0644]
network_cmds/ping.tproj/Makefile [new file with mode: 0644]
network_cmds/ping6.tproj/Makefile [new file with mode: 0644]
network_cmds/pktapctl/Makefile [new file with mode: 0644]
network_cmds/pktmnglr/Makefile [new file with mode: 0644]
network_cmds/rarpd.tproj/Makefile [new file with mode: 0644]
network_cmds/route.tproj/Makefile [new file with mode: 0644]
network_cmds/rtadvd.tproj/Makefile [new file with mode: 0644]
network_cmds/rtadvd.tproj/rtadvd_logging.c
network_cmds/rtsol.tproj/Makefile [new file with mode: 0644]
network_cmds/spray.tproj/Makefile [new file with mode: 0644]
network_cmds/traceroute.tproj/Makefile [new file with mode: 0644]
network_cmds/traceroute6.tproj/Makefile [new file with mode: 0644]
patch_cmds/Makefile [new file with mode: 0644]
patch_cmds/Makefile.inc [new file with mode: 0644]
patch_cmds/diffstat/Makefile [new file with mode: 0644]
patch_cmds/diffstat/diffstat.c
patch_cmds/patch/Makefile
remote_cmds/Makefile
remote_cmds/Makefile.inc [new file with mode: 0644]
remote_cmds/logger.tproj/Makefile
remote_cmds/talk.tproj/Makefile
remote_cmds/talkd.tproj/Makefile
remote_cmds/telnet.tproj/Makefile
remote_cmds/telnet.tproj/commands.c
remote_cmds/telnet.tproj/telnet.c
remote_cmds/telnetd.tproj/Makefile
remote_cmds/telnetd.tproj/sys_term.c
remote_cmds/tftp.tproj/Makefile
remote_cmds/tftpd.tproj/Makefile
remote_cmds/wall.tproj/Makefile
setup.sh [new file with mode: 0755]
shell_cmds/Makefile [new file with mode: 0644]
shell_cmds/Makefile.inc [new file with mode: 0644]
shell_cmds/alias/Makefile [new file with mode: 0644]
shell_cmds/apply/Makefile [new file with mode: 0644]
shell_cmds/apply/apply.c
shell_cmds/basename/Makefile [new file with mode: 0644]
shell_cmds/chroot/Makefile [new file with mode: 0644]
shell_cmds/chroot/chroot.c
shell_cmds/date/Makefile [new file with mode: 0644]
shell_cmds/dirname/Makefile [new file with mode: 0644]
shell_cmds/echo/Makefile [new file with mode: 0644]
shell_cmds/env/Makefile [new file with mode: 0644]
shell_cmds/env/env.c
shell_cmds/expr/Makefile [new file with mode: 0644]
shell_cmds/false/Makefile [new file with mode: 0644]
shell_cmds/find/Makefile [new file with mode: 0644]
shell_cmds/find/function.c
shell_cmds/find/misc.c
shell_cmds/find/rpmatch.c [new file with mode: 0644]
shell_cmds/getopt/Makefile [new file with mode: 0644]
shell_cmds/hexdump/Makefile [new file with mode: 0644]
shell_cmds/hostname/Makefile [new file with mode: 0644]
shell_cmds/id/Makefile [new file with mode: 0644]
shell_cmds/jot/Makefile [new file with mode: 0644]
shell_cmds/kill/Makefile [new file with mode: 0644]
shell_cmds/killall/Makefile [new file with mode: 0644]
shell_cmds/lastcomm/Makefile [new file with mode: 0644]
shell_cmds/locate/Makefile [new file with mode: 0644]
shell_cmds/locate/Makefile.inc [new file with mode: 0644]
shell_cmds/locate/bigram/Makefile [new file with mode: 0644]
shell_cmds/locate/code/Makefile [new file with mode: 0644]
shell_cmds/locate/locate/Makefile [new file with mode: 0644]
shell_cmds/logname/Makefile [new file with mode: 0644]
shell_cmds/mktemp/Makefile [new file with mode: 0644]
shell_cmds/nice/Makefile [new file with mode: 0644]
shell_cmds/nice/nice.c
shell_cmds/nohup/Makefile [new file with mode: 0644]
shell_cmds/nohup/nohup.c
shell_cmds/path_helper/Makefile [new file with mode: 0644]
shell_cmds/printenv/Makefile [new file with mode: 0644]
shell_cmds/printf/Makefile [new file with mode: 0644]
shell_cmds/pwd/Makefile [new file with mode: 0644]
shell_cmds/renice/Makefile [new file with mode: 0644]
shell_cmds/script/Makefile [new file with mode: 0644]
shell_cmds/script/script.c
shell_cmds/seq/Makefile [new file with mode: 0644]
shell_cmds/sh/Makefile
shell_cmds/sh/exec.c
shell_cmds/shlock/Makefile [new file with mode: 0644]
shell_cmds/sleep/Makefile [new file with mode: 0644]
shell_cmds/su/Makefile [new file with mode: 0644]
shell_cmds/su/su.c
shell_cmds/systime/Makefile [new file with mode: 0644]
shell_cmds/systime/systime.c
shell_cmds/tee/Makefile [new file with mode: 0644]
shell_cmds/test/Makefile [new file with mode: 0644]
shell_cmds/time/Makefile [new file with mode: 0644]
shell_cmds/time/time.c
shell_cmds/true/Makefile [new file with mode: 0644]
shell_cmds/uname/Makefile [new file with mode: 0644]
shell_cmds/users/Makefile [new file with mode: 0644]
shell_cmds/w/Makefile [new file with mode: 0644]
shell_cmds/what/Makefile [new file with mode: 0644]
shell_cmds/whereis/Makefile [new file with mode: 0644]
shell_cmds/which/Makefile [new file with mode: 0644]
shell_cmds/who/Makefile [new file with mode: 0644]
shell_cmds/who/utmpentry.c
shell_cmds/xargs/Makefile [new file with mode: 0644]
shell_cmds/xargs/strtonum.c [new file with mode: 0644]
shell_cmds/xargs/xargs.c
shell_cmds/yes/Makefile [new file with mode: 0644]
system_cmds/Makefile [new file with mode: 0644]
system_cmds/Makefile.inc [new file with mode: 0644]
system_cmds/ac.tproj/Makefile [new file with mode: 0644]
system_cmds/accton.tproj/Makefile [new file with mode: 0644]
system_cmds/arch.tproj/Makefile [new file with mode: 0644]
system_cmds/arch.tproj/arch.c
system_cmds/at.tproj/Makefile [new file with mode: 0644]
system_cmds/atrun.tproj/Makefile [new file with mode: 0644]
system_cmds/atrun.tproj/atrun.c
system_cmds/chkpasswd.tproj/Makefile [new file with mode: 0644]
system_cmds/chkpasswd.tproj/passwd.c
system_cmds/cpuctl.tproj/Makefile [new file with mode: 0644]
system_cmds/cpuctl.tproj/cpuctl.c
system_cmds/dmesg.tproj/Makefile [new file with mode: 0644]
system_cmds/dynamic_pager.tproj/Makefile [new file with mode: 0644]
system_cmds/fs_usage.tproj/Makefile [new file with mode: 0644]
system_cmds/gcore.tproj/Makefile [new file with mode: 0644]
system_cmds/gcore.tproj/convert.c
system_cmds/gcore.tproj/corefile.c
system_cmds/gcore.tproj/dyld.c
system_cmds/gcore.tproj/main.c
system_cmds/gcore.tproj/sparse.c
system_cmds/gcore.tproj/threads.c
system_cmds/gcore.tproj/utils.c
system_cmds/gcore.tproj/vanilla.c
system_cmds/gcore.tproj/vm.c
system_cmds/getconf.tproj/Makefile [new file with mode: 0644]
system_cmds/getconf.tproj/getconf.c
system_cmds/getty.tproj/Makefile [new file with mode: 0644]
system_cmds/getty.tproj/main.c
system_cmds/hostinfo.tproj/Makefile [new file with mode: 0644]
system_cmds/hostinfo.tproj/hostinfo.c
system_cmds/iosim.tproj/Makefile [new file with mode: 0644]
system_cmds/iostat.tproj/Makefile [new file with mode: 0644]
system_cmds/kpgo.tproj/Makefile [new file with mode: 0644]
system_cmds/latency.tproj/Makefile [new file with mode: 0644]
system_cmds/latency.tproj/latency.c
system_cmds/login.tproj/Makefile [new file with mode: 0644]
system_cmds/login.tproj/login.c
system_cmds/lskq.tproj/Makefile [new file with mode: 0644]
system_cmds/lskq.tproj/common.h
system_cmds/lskq.tproj/lskq.c
system_cmds/lsmp.patch [new file with mode: 0644]
system_cmds/lsmp.tproj/Makefile [new file with mode: 0644]
system_cmds/lsmp.tproj/common.h
system_cmds/lsmp.tproj/entitlements.plist
system_cmds/lsmp.tproj/lsmp.c
system_cmds/lsmp.tproj/port_details.c
system_cmds/lsmp.tproj/task_details.c
system_cmds/ltop.tproj/Makefile [new file with mode: 0644]
system_cmds/mean.tproj/Makefile [new file with mode: 0644]
system_cmds/mean.tproj/mean.c
system_cmds/memory_pressure.tproj/Makefile [new file with mode: 0644]
system_cmds/memory_pressure.tproj/memory_pressure.c
system_cmds/mkfile.tproj/Makefile [new file with mode: 0644]
system_cmds/mslutil/Makefile [new file with mode: 0644]
system_cmds/newgrp.tproj/Makefile [new file with mode: 0644]
system_cmds/newgrp.tproj/newgrp.c
system_cmds/nologin.tproj/Makefile [new file with mode: 0644]
system_cmds/nvram.tproj/Makefile [new file with mode: 0644]
system_cmds/pagesize.tproj/Makefile [new file with mode: 0644]
system_cmds/passwd.tproj/Makefile [new file with mode: 0644]
system_cmds/passwd.tproj/passwd.c
system_cmds/proc_uuid_policy.tproj/Makefile [new file with mode: 0644]
system_cmds/purge.tproj/Makefile [new file with mode: 0644]
system_cmds/pwd_mkdb.tproj/Makefile [new file with mode: 0644]
system_cmds/reboot.tproj/Makefile [new file with mode: 0644]
system_cmds/reboot.tproj/reboot.c
system_cmds/sa.tproj/Makefile [new file with mode: 0644]
system_cmds/sc_usage.tproj/Makefile [new file with mode: 0644]
system_cmds/sc_usage.tproj/sc_usage.c
system_cmds/shutdown.tproj/Makefile [new file with mode: 0644]
system_cmds/shutdown.tproj/shutdown.c
system_cmds/stackshot.tproj/Makefile [new file with mode: 0644]
system_cmds/stackshot.tproj/stackshot.c
system_cmds/sync.tproj/Makefile [new file with mode: 0644]
system_cmds/sysctl.tproj/Makefile [new file with mode: 0644]
system_cmds/taskpolicy.tproj/Makefile [new file with mode: 0644]
system_cmds/taskpolicy.tproj/taskpolicy.c
system_cmds/trace.tproj/Makefile [new file with mode: 0644]
system_cmds/trace.tproj/trace.c
system_cmds/vifs.tproj/Makefile [new file with mode: 0644]
system_cmds/vifs.tproj/vifs.c
system_cmds/vipw.tproj/Makefile [new file with mode: 0644]
system_cmds/vipw.tproj/pw_util.c
system_cmds/vm_purgeable_stat.tproj/Makefile [new file with mode: 0644]
system_cmds/vm_purgeable_stat.tproj/entitlements.plist
system_cmds/vm_purgeable_stat.tproj/vm_purgeable_stat.c
system_cmds/vm_stat.tproj/Makefile [new file with mode: 0644]
system_cmds/wait4path/Makefile [new file with mode: 0644]
system_cmds/wordexp-helper.tproj/Makefile [new file with mode: 0644]
system_cmds/zdump.tproj/Makefile [new file with mode: 0644]
system_cmds/zic.tproj/Makefile [new file with mode: 0644]
text_cmds/Makefile [new file with mode: 0644]
text_cmds/Makefile.inc [new file with mode: 0644]
text_cmds/banner/Makefile [new file with mode: 0644]
text_cmds/cat/Makefile [new file with mode: 0644]
text_cmds/col/Makefile [new file with mode: 0644]
text_cmds/colrm/Makefile [new file with mode: 0644]
text_cmds/column/Makefile [new file with mode: 0644]
text_cmds/comm/Makefile [new file with mode: 0644]
text_cmds/csplit/Makefile [new file with mode: 0644]
text_cmds/cut/Makefile [new file with mode: 0644]
text_cmds/ed/Makefile [new file with mode: 0644]
text_cmds/ee/Makefile
text_cmds/ee/ee.c
text_cmds/expand/Makefile [new file with mode: 0644]
text_cmds/fmt/Makefile [new file with mode: 0644]
text_cmds/fold/Makefile [new file with mode: 0644]
text_cmds/grep/Makefile [new file with mode: 0644]
text_cmds/head/Makefile [new file with mode: 0644]
text_cmds/join/Makefile [new file with mode: 0644]
text_cmds/lam/Makefile [new file with mode: 0644]
text_cmds/look/Makefile [new file with mode: 0644]
text_cmds/md5/Makefile [new file with mode: 0644]
text_cmds/nl/Makefile [new file with mode: 0644]
text_cmds/paste/Makefile [new file with mode: 0644]
text_cmds/pr/Makefile [new file with mode: 0644]
text_cmds/rev/Makefile [new file with mode: 0644]
text_cmds/rs/Makefile [new file with mode: 0644]
text_cmds/sed/Makefile [new file with mode: 0644]
text_cmds/sort/Makefile [new file with mode: 0644]
text_cmds/sort/coll.h
text_cmds/split/Makefile [new file with mode: 0644]
text_cmds/tail/Makefile [new file with mode: 0644]
text_cmds/tr/Makefile [new file with mode: 0644]
text_cmds/tr/collate-fbsd.c [new file with mode: 0644]
text_cmds/tr/collate.h [new file with mode: 0644]
text_cmds/tr/setlocale.h [new file with mode: 0644]
text_cmds/tr/str.c
text_cmds/tr/xlocale_private.h [new file with mode: 0644]
text_cmds/ul/Makefile [new file with mode: 0644]
text_cmds/unexpand/Makefile [new file with mode: 0644]
text_cmds/uniq/Makefile [new file with mode: 0644]
text_cmds/unvis/Makefile [new file with mode: 0644]
text_cmds/vis/Makefile [new file with mode: 0644]
text_cmds/wc/Makefile [new file with mode: 0644]

index df967b96a579e45a18b8251732d16804b2e56a55..126f41ddf1378954378ae9b5521b9e56edbefee1 100644 (file)
@@ -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 (file)
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 (file)
index 0000000..39af5e2
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..722516e
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/adv_cmds/cap_mkdb/Makefile b/adv_cmds/cap_mkdb/Makefile
new file mode 100644 (file)
index 0000000..4beb70d
--- /dev/null
@@ -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 (file)
index 0000000..fc11e68
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  colldef
+SRCS=  parse.y \
+       scan.l
+
+LDADD+=-lfl
+
+CFLAGS+=-Ilocale
+
+.include <bsd.prog.mk>
index ce14492646cc9d7624623a3fb0b25a54568e77c5..ee464f0539e3302b367db9a4ff8699024c5b8c18 100644 (file)
@@ -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 (file)
index 0000000..86b9d00
--- /dev/null
@@ -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 (file)
index 0000000..c5df80c
--- /dev/null
@@ -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 (file)
index 0000000..96e9737
--- /dev/null
@@ -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 (file)
index 0000000..535355b
--- /dev/null
@@ -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 (file)
index 0000000..70c8f64
--- /dev/null
@@ -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 (file)
index 0000000..132ce00
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  mklocale
+SRCS=  lex.l \
+       yacc.y
+
+.include <bsd.prog.mk>
index 9ffbacaa647fd28815e49a80ba3cb510de73d55e..0576f3b85f96f34862c83d94c9f9b05b0c733d11 100644 (file)
@@ -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 (file)
index 0000000..145ef7a
--- /dev/null
@@ -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 (file)
index 0000000..c8ec706
--- /dev/null
@@ -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 (file)
index 0000000..2d7391e
--- /dev/null
@@ -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 (file)
index 0000000..e0e4713
--- /dev/null
@@ -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 (file)
index 0000000..cd1ebf7
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  whois
+
+.include <bsd.prog.mk>
diff --git a/basic_cmds/Makefile b/basic_cmds/Makefile
new file mode 100644 (file)
index 0000000..2ab0c2d
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/basic_cmds/mesg/Makefile b/basic_cmds/mesg/Makefile
new file mode 100644 (file)
index 0000000..02a02d8
--- /dev/null
@@ -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 (file)
index 0000000..e46ca33
--- /dev/null
@@ -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 (file)
index 0000000..142478a
--- /dev/null
@@ -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 (file)
index 0000000..7dceec0
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  write
+
+.include <bsd.prog.mk>
diff --git a/bootstrap_cmds/Makefile b/bootstrap_cmds/Makefile
new file mode 100644 (file)
index 0000000..0b2a259
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/bootstrap_cmds/migcom.tproj/Makefile b/bootstrap_cmds/migcom.tproj/Makefile
new file mode 100644 (file)
index 0000000..150a059
--- /dev/null
@@ -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>
index 82b32e5289a467a3cd9c062d4fa8cb38e72706ca..4a784c0947090c8cce32ed8809b5a4769a8b6378 100644 (file)
@@ -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 (executable)
index 0000000..b14d267
--- /dev/null
@@ -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 (file)
index 0000000..b5f3128
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/developer_cmds/asa/Makefile b/developer_cmds/asa/Makefile
new file mode 100644 (file)
index 0000000..9ad92ce
--- /dev/null
@@ -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 (file)
index 0000000..eca51cd
--- /dev/null
@@ -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 (file)
index 0000000..f07a7fc
--- /dev/null
@@ -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 (file)
index 0000000..0d26ec2
--- /dev/null
@@ -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>
index a7a15a8e69f760b83455e7e8eb5af6159f01d107..0a5198478a2005aeb1c6e9276c7d8cb1a4ab877b 100644 (file)
@@ -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 (file)
index 0000000..2a5448b
--- /dev/null
@@ -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 (file)
index 0000000..0ea0640
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -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 (file)
index 0000000..141726f
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  dev_mkdb
+MAN=   dev_mkdb.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index f7128e0be92b61a2a5dbebf73acd5757be7d6cf4..34a10a4b27c9bffcdcd17b6ac3116fab36102e5e 100644 (file)
@@ -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 (file)
index 0000000..87c954b
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  edquota
+MAN=   edquota.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 6dad1cbe611d95a24b6e3706f55c0582954a1d7a..0071e766598d830115e1c0a9829d6c911efe236c 100644 (file)
@@ -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;
index 1fd492647cd028d0e1cc2aa10555ac3ddbc1cf66..ef694801fa34c9baa82703bfe81fa33548177245 100644 (file)
@@ -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 (file)
index 0000000..a623892
--- /dev/null
@@ -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 (file)
index 0000000..3603f3a
--- /dev/null
@@ -0,0 +1,3 @@
+MAN=   fsck.8
+
+.include <bsd.prog.mk>
index dc44e776053436ebbfb14b7b73450cc42a78572e..1b3dfeedb7db02bfbf14029ac0b9de1450823dcb 100644 (file)
 #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 (file)
index 0000000..66f4830
--- /dev/null
@@ -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 (file)
index 0000000..1fe9f5f
--- /dev/null
@@ -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 (file)
index 0000000..19b1df9
--- /dev/null
@@ -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 (file)
index 0000000..172c51d
--- /dev/null
@@ -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 (file)
index 0000000..3f4c03c
--- /dev/null
@@ -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 (file)
index 0000000..7ed9671
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  mount_fdesc
+MAN=   mount_fdesc.8
+
+LDADD=-lutil
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
index 370729053efcd9d3e0f628c680d4ee246920c889..911095eef3394c9ded240d37e4a0d2a6f01d1788 100644 (file)
@@ -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 (file)
index 0000000..ba137fe
--- /dev/null
@@ -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 (file)
index 0000000..b90f20e
--- /dev/null
@@ -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 (file)
index 0000000..8cda80c
--- /dev/null
@@ -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 (file)
index 0000000..0cc629b
--- /dev/null
@@ -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 (file)
index 0000000..e9b7c86
--- /dev/null
@@ -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 (file)
index 0000000..740631d
--- /dev/null
@@ -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 (file)
index 0000000..621ce78
--- /dev/null
@@ -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>
index c9647fe369d6e40e4ade70679f3fabcfb977ce78..6dc2450daf046648ddf7709429214bd2661b05c7 100644 (file)
@@ -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 (file)
index 0000000..ea362db
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/doc_cmds/checknr/Makefile b/doc_cmds/checknr/Makefile
new file mode 100644 (file)
index 0000000..b5cf5d3
--- /dev/null
@@ -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 (file)
index 0000000..923684c
--- /dev/null
@@ -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 (file)
index 0000000..af5e87e
--- /dev/null
@@ -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 (file)
index 0000000..44e87bb
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/file_cmds/chflags/Makefile b/file_cmds/chflags/Makefile
new file mode 100644 (file)
index 0000000..a734b6e
--- /dev/null
@@ -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 (file)
index 0000000..0815c98
--- /dev/null
@@ -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 (file)
index 0000000..be9d786
--- /dev/null
@@ -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 (file)
index 0000000..be8950d
--- /dev/null
@@ -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 (file)
index 0000000..e4c366a
--- /dev/null
@@ -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 (file)
index 0000000..9f151da
--- /dev/null
@@ -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>
index 97c70f291e278016d2e8e84133f16c35ee81569f..ba05189d990c0a4d9af4331cfd964b4d5d8cccf3 100644 (file)
@@ -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 (file)
index 0000000..29e1063
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  cp
+SRCS=  cp.c utils.c
+
+BINDIR=/bin
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
index c856fd995d74d95802cee2ce10b0c054d19baaa1..4db6c81084f47214c4844298ce8a214f020a4f99 100644 (file)
@@ -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;                                      \
index feecc0c85528a475ec18da490a513ddd2258e741..6332956c7aa08976244c42ce8495379a9707037d 100644 (file)
@@ -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 (file)
index 0000000..72f3c3a
--- /dev/null
@@ -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 (file)
index 0000000..99a7194
--- /dev/null
@@ -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 (file)
index 0000000..ab61aa3
--- /dev/null
@@ -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 (file)
index 0000000..8250e3e
--- /dev/null
@@ -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 (file)
index 0000000..3116d07
--- /dev/null
@@ -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>
index 5e6bcecc09a8337fdc9ee5c0df4b81af3d9709db..49934aab74f987474f8116286c6090e801c64ce2 100644 (file)
@@ -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 (file)
index 0000000..c3dc182
--- /dev/null
@@ -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 (file)
index 0000000..1d79542
--- /dev/null
@@ -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>
index 986b229efc035159435f6f882b79565bc4dbcff0..8ee4e0e84d94cf5b9022ffade27770e0d5521a74 100644 (file)
 #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 (file)
index 0000000..db89bfa
--- /dev/null
@@ -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 (file)
index 0000000..2872cbe
--- /dev/null
@@ -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>
index e07933392be74e12087450f8e03962c86e69a3f3..0a6b1a0e48a92b4022c1f5a46d692825f264a50c 100644 (file)
@@ -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 (file)
index 0000000..ea70b14
--- /dev/null
@@ -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 (file)
index 0000000..aa19b2a
--- /dev/null
@@ -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 (file)
index 0000000..04efea7
--- /dev/null
@@ -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 (file)
index 0000000..177c7e8
--- /dev/null
@@ -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>
index 0ac621c8081f7e412726a8319c602e164a0310c9..fd4258ef69c16659b9689643420aa638e6271563 100644 (file)
@@ -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 (file)
index 0000000..dbf5b3d
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  mv
+
+LDADD+=-liosexec
+
+BINDIR=/bin
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
index 52a2938a53d4173aa1988a89dba5ded725dcee51..17ef1e04135284895ae0a14bdc0a1f06b9ab79ec 100644 (file)
@@ -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 (file)
index 0000000..a3ea46c
--- /dev/null
@@ -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 (file)
index 0000000..1ea323c
--- /dev/null
@@ -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>
index 1c4b943e0fa2afc7de8121c320ee9c46d5addc97..6ed3e8364f02f8ca4cf62619a7cec073baae2f4d 100644 (file)
@@ -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.
  */
index 16d31958b261bda04572da0e22199bed63e4b282..d2823de3bff3c7679a5cbf640685cc9daeab7a8c 100644 (file)
@@ -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
index 0544e5efa9ebf93ab8602e818ac10a2ab0d2398b..2d968bddee2034d57e5eb6f13f237705a50aa85f 100644 (file)
@@ -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 (file)
index 0000000..7a721c1
--- /dev/null
@@ -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>
index ef457c5a19c0d978acc2a25ab1d5f3960150dbe3..389df6edc08707eba216b6fd5e5f035086d1d2fe 100644 (file)
@@ -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 (file)
index 0000000..e54393e
--- /dev/null
@@ -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 (file)
index 0000000..1e515ee
--- /dev/null
@@ -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 (file)
index 0000000..261ee43
--- /dev/null
@@ -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 (file)
index 0000000..28b769e
--- /dev/null
@@ -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 (file)
index 0000000..fcb8859
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  touch
+
+.include <bsd.prog.mk>
diff --git a/file_cmds/xinstall b/file_cmds/xinstall
new file mode 120000 (symlink)
index 0000000..f7ffc47
--- /dev/null
@@ -0,0 +1 @@
+install
\ No newline at end of file
index 127d0a79dd9b5d66a0db5242191807fd80978df5..d7ac9504563b4874d3f0ab0c7fdc4fbcaa7c6be8 100644 (file)
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
index 2672505ce3455704f569f37affa73d7b6144ef0f..6ba161554ccc57383109d4f4f0bbd4596163bf65 100644 (file)
@@ -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>
index fd52e66abee5cde351430cd5fbe4ed5d6e04bb76..3f349abbde223e54f0df14c9ff7fa86b7315f3fb 100644 (file)
@@ -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>
index b0c5bd7597e613b03e65182e950814230b25a60f..c27be3f50a251947ab9a8b1502e31dbd6030421f 100644 (file)
@@ -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>
index bd82ec4651a95bc47bd8b5fcb017e97d0697c90d..c516dff6c91924b7cae4f743082f2730bb206dd4 100644 (file)
@@ -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>
index 979a76f7019f5785f8145747b06dbfdb6996f31c..f3b3a048a89a80d234f0b144ff4758be31a8155c 100644 (file)
@@ -46,6 +46,8 @@ static const char rcsid[] =
 #include <fcntl.h>
 #include "extern.h"
 
+#include <libiosexec.h>
+
 #define READ 0
 #define WRITE 1
 
index 466bd6553afb53785ea15f26a102df2e94262c73..99c4ddfdec29793f9188d5f68fcc6d008065ed74 100644 (file)
@@ -44,6 +44,8 @@ static const char rcsid[] =
 #include "rcv.h"
 #include "extern.h"
 
+#include <libiosexec.h>
+
 /*
  * Mail -- a mail program
  *
index 3319b01d5b54f290b10f3ccf74fbc91534c47c2b..a0d558d59ee6fe32647c3d1cdac66f944b25c408 100644 (file)
@@ -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 (file)
index 0000000..4110807
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/misc_cmds/calendar/Makefile b/misc_cmds/calendar/Makefile
new file mode 100644 (file)
index 0000000..1b47615
--- /dev/null
@@ -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>
index 6c8f4d21fd7f0c71df162a81806da5a43002c434..5af44e020648a79ad2f520999950a36e64e9ad07 100644 (file)
@@ -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 (file)
index 0000000..1a08221
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  leave
+
+.include <bsd.prog.mk>
index c1db13606cb09f273e9f90a040c09ba5b47ed3b2..69cd3fb297195685772de184d57cd47d42babd60 100644 (file)
@@ -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 (file)
index 0000000..96408c6
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  ncal
+SRCS=  calendar.c easter.c ncal.c
+
+LDADD=-lncursesw
+
+.include <bsd.prog.mk>
index 5a5cbc3553abfe022fe8c6030ac2d8cf12665999..105fa952a27e044998df7095a71ccd41248f3873 100644 (file)
@@ -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 (file)
index 0000000..44c9898
--- /dev/null
@@ -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 (file)
index 0000000..e9f84b8
--- /dev/null
@@ -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 (file)
index 0000000..296ddb4
--- /dev/null
@@ -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 (file)
index 0000000..14e30a9
--- /dev/null
@@ -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 (file)
index 0000000..13711ef
--- /dev/null
@@ -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 (file)
index 0000000..64ed77c
--- /dev/null
@@ -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 (file)
index 0000000..7965631
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  dnctl
+MAN=   dnctl.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 38cffe8b8471f9a84b9a51a2dd3b7b3891c7592e..e8443f479f724b4a264f06ce1402626553e14a69 100644 (file)
@@ -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 (file)
index 0000000..fe02a7f
--- /dev/null
@@ -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 (file)
index 0000000..b9b9744
--- /dev/null
@@ -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 (file)
index 0000000..61a64da
--- /dev/null
@@ -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>
index f0f4b2e5723dbcbdaea7458da7c15ce0ba67347e..ee638965326b352ae63e4ebab7190859177475bc 100644 (file)
@@ -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
index 951c56bd4661c3a448bb0cef385aa56a1be8981a..19ce8fffd6203ab7472660d0deb5f6053573b577 100644 (file)
@@ -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",
index 3449301dab642809d9ea0784244e72dbe47cd812..3acc59cf3980a3f206bc52bf4629a9138db0a2ff 100644 (file)
@@ -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;
index 713c13693610bcd7969db67b7b9bc904758d2116..4f9ade189291ad3db2dd929acec150919a83afa3 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
+#ifndef SIOCGIFXMEDIA
+#define SIOCGIFXMEDIA SIOCGIFMEDIA
+#endif
+
 #include "ifconfig.h"
 
 static void    domediaopt(const char *, int, int);
index 3df98428399a6d4a067c135bb394e215c9d4acb1..3717c157f84d58039c193c022febdd39c0946386 100644 (file)
 
 #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 (file)
index 0000000..bceb792
--- /dev/null
@@ -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 (file)
index 0000000..ad84ab0
--- /dev/null
@@ -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 (file)
index 0000000..146b027
--- /dev/null
@@ -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 (file)
index 0000000..a5f71ed
--- /dev/null
@@ -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 (file)
index 0000000..7390411
--- /dev/null
@@ -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 (file)
index 0000000..5eb750d
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  ndp
+MAN=   ndp.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index b485fa14612e3302a79edb783d6082d014dcdead..e3e51b8e89ebecc7b7942e672f9cd04555d9f94a 100644 (file)
@@ -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 (file)
index 0000000..454465d
--- /dev/null
@@ -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 (file)
index 0000000..e708457
--- /dev/null
@@ -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 (file)
index 0000000..9a85e6f
--- /dev/null
@@ -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 (file)
index 0000000..35b551c
--- /dev/null
@@ -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 (file)
index 0000000..fbb190c
--- /dev/null
@@ -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 (file)
index 0000000..b63f630
--- /dev/null
@@ -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 (file)
index 0000000..678ccf3
--- /dev/null
@@ -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 (file)
index 0000000..61fb788
--- /dev/null
@@ -0,0 +1,3 @@
+MAN=   rtadvd.8 rtadvd.conf.5
+
+.include <bsd.prog.mk>
index 90dec083d5fd96eb5b2625b05dda429b19c6c229..aafb03a2a389a8976f481beeaa2244a772ee5b31 100644 (file)
@@ -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 (file)
index 0000000..0fd1e09
--- /dev/null
@@ -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 (file)
index 0000000..904e17b
--- /dev/null
@@ -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 (file)
index 0000000..706c13c
--- /dev/null
@@ -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 (file)
index 0000000..5d60f43
--- /dev/null
@@ -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 (file)
index 0000000..db429c5
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/patch_cmds/diffstat/Makefile b/patch_cmds/diffstat/Makefile
new file mode 100644 (file)
index 0000000..ae9c6ca
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  diffstat
+
+CFLAGS+=-DHAVE_CONFIG_H
+
+.include <bsd.prog.mk>
index 7027ba3818e65513e765ac58ac7fd51ab9144f7f..c09f585d4695e1202bccd9e7d74861305f3bb500 100644 (file)
@@ -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)
index d7071a4a0688314a880f22a7a44f38ce984a7771..ec33186e73cbf733c8e2f3b43cdc67e6de639479 100644 (file)
@@ -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>
index 7347ea8027c608ceced18b6c4f944f0ea9499bba..1ffac6ff63bc9ce7dd804611b9f3a11c218f770a 100644 (file)
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
index 002cb56fa7b91665509c4e70992cb6b78fad806a..b91335469b0fafa462ea0c1fde4a67f06887cda0 100644 (file)
@@ -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>
index 47e36318695f8dca0aa3204ea8245cdb764f344a..ea9860ee06cd4430289cf4f7e5800452b4fc3e0a 100644 (file)
@@ -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>
index f67b40b448e6fc770055cefc1e7ec7c2d56c5b0b..83f8c4af39c1ade0aea70dee77488555f23ec23c 100644 (file)
@@ -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>
index dc8569be1e539ebba11135327a9579eb80333169..af7c6b1fde37ae65f4fab3e515592d8942b89442 100644 (file)
@@ -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>
index 56a07948635e18be9029a04eb8780c98acb44f31..1f4ca5328e4f049e3c9ec938f63a7d4c3a6a553d 100644 (file)
@@ -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
index 541cf9bff935fef56049e673ad0f22ba0227e2ea..2e63f8d75ec61e711e7e805ab2f4a17ce9653c9e 100644 (file)
@@ -667,7 +667,7 @@ is_unique(char *name, char **as, char **ae)
        return (1);
 }
 
-#ifdef TERMCAP
+#ifndef        TERMCAP
 char termbuf[1024];
 
 /*ARGSUSED*/
index c3f7feb62cd3230523784717125e14396fea130b..8060160769b09fdec0413afc016b89fec523f84f 100644 (file)
@@ -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>
index 23da55b9561818cd43cecd15c4da6d3f2225de7f..84b94ca922df32122193a95efaed278dbc83a470 100644 (file)
@@ -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)
index 6ed62a0ab3de51de066cfa7f82c183c50d65bb76..b6ea09089ec00cb820628ad3a17e3ba89e43e80e 100644 (file)
@@ -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>
index e48f4849ee922ce3794ea420313a20fa2cd49f17..080009df98966c82b629f2e81f2c0e73ee0c8a1f 100644 (file)
@@ -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>
index 08da621dea58a3f057bb821cc9720c5a661f43df..06e0547dc0600364f41844251d8fedf8a41d9faf 100644 (file)
@@ -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 (executable)
index 0000000..11f5a84
--- /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 -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/nls/FreeBSD/msgcat.h
+wget -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/private/stack_logging.h
+wget -q --show-progress -nc -Pbase/include/os https://opensource.apple.com/source/Libc/Libc-1439.40.11/os/assumes.h
+wget -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/include/libc.h
+wget -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/_simple.h
+wget -q --show-progress -nc -Pbase/include/os https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/os/base_private.h
+wget -q --show-progress -nc -Pbase/include/System/uuid/ https://opensource.apple.com/source/Libc/Libc-1439.40.11/uuid/namespace.h
+wget -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/mntopts.h
+wget -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/libutil.h
+wget -q --show-progress -nc -Pbase/include https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/membership.subproj/membershipPriv.h
+wget -q --show-progress -nc -Pbase/include/rpc https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/rpc.subproj/pmap_clnt.h
+wget -q --show-progress -nc -Pbase/include/CommonCrypto https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60118.30.2/include/CommonDigestSPI.h
+wget -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -nc -Pbase/include/Kernel/libkern \
+       https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLibPrivate.h
+wget -q --show-progress -nc -Pbase/include/System/libkern \
+       https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libkern/libkern/OSKextLibPrivate.h
+wget -q --show-progress -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 -q --show-progress -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 -q --show-progress -nc -Pbase/include/machine https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/machine/cpu_capabilities.h
+wget -q --show-progress -nc -Pbase/include/Kernel/kern https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/kern/ledger.h
+wget -q --show-progress -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 -q --show-progress -nc -Pbase/include/System/machine https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/machine/cpu_capabilities.h
+wget -q --show-progress -nc -Pbase/include/System/arm https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/arm/cpu_capabilities.h
+wget -q --show-progress -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach/coalition.h
+wget -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -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 -q --show-progress -nc -Pbase/include/IOKit \
+       https://opensource.apple.com/source/xnu/xnu-${XNUVER}/iokit/IOKit/IOKitKeysPrivate.h
+wget -q --show-progress -nc -Pbase/include/Kernel/IOKit \
+       https://opensource.apple.com/source/xnu/xnu-${XNUVER}/iokit/IOKit/IOKitDebug.h
+wget -q --show-progress -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 -q --show-progress -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 -q --show-progress -nc -Pbase/include/mach \
+       https://opensource.apple.com/source/xnu/xnu-${XNUVER}/libsyscall/mach/mach/mach_init.h
+wget -q --show-progress -nc -Pbase/include/mach_debug \
+       https://opensource.apple.com/source/xnu/xnu-${XNUVER}/osfmk/mach_debug/ipc_info.h
+wget -q --show-progress -nc -Pbase/include/mach-o \
+       https://opensource.apple.com/source/dyld/dyld-832.7.3/include/mach-o/dyld_process_info.h
+wget -q --show-progress -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 (file)
index 0000000..e630c10
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/shell_cmds/alias/Makefile b/shell_cmds/alias/Makefile
new file mode 100644 (file)
index 0000000..818ff1a
--- /dev/null
@@ -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 (file)
index 0000000..2eb2434
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  apply
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index cf4e9c10f97bfd4ffe044812413b11233071e3b5..314af6633fabe30f5a5971164fada5e28e0cb08d 100644 (file)
@@ -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 (file)
index 0000000..e507dfd
--- /dev/null
@@ -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 (file)
index 0000000..cc7de4d
--- /dev/null
@@ -0,0 +1,8 @@
+BINDIR=/usr/sbin
+
+PROG=  chroot
+MAN=   chroot.8
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index c9c38f58983d241bd94004515ea689f310ce0d4c..e9ef7c8e45d9fe54d8e1cea59c3c4132803b4926 100644 (file)
@@ -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 (file)
index 0000000..ad0dd44
--- /dev/null
@@ -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 (file)
index 0000000..939bfaf
--- /dev/null
@@ -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 (file)
index 0000000..f896dfc
--- /dev/null
@@ -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 (file)
index 0000000..b21ba8e
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  env
+SRCS=  env.c envopts.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index 3dc152ad37a7b26f7f373e328736fbb4123508a9..db5f1f684863885776bab4deb5c2c99051a42e36 100644 (file)
@@ -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 (file)
index 0000000..96c0a4e
--- /dev/null
@@ -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 (file)
index 0000000..7922186
--- /dev/null
@@ -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 (file)
index 0000000..d632d5d
--- /dev/null
@@ -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>
index a673a025f1691d2518503c67ebfab6efd6e42d3b..3ea53a28360fa0f8af19419ad649ec958bdee03e 100644 (file)
@@ -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 *);
index a165c5ec9cdd86b855907385e898f484e4c0c933..e45b8648c6d3d02bae4e5e69037a17213c381e0d 100644 (file)
@@ -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 (file)
index 0000000..e4c366a
--- /dev/null
@@ -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 (file)
index 0000000..b015a8a
--- /dev/null
@@ -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 (file)
index 0000000..1ae98e4
--- /dev/null
@@ -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 (file)
index 0000000..a594745
--- /dev/null
@@ -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 (file)
index 0000000..b01f798
--- /dev/null
@@ -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 (file)
index 0000000..e662623
--- /dev/null
@@ -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 (file)
index 0000000..d6bfee9
--- /dev/null
@@ -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 (file)
index 0000000..e8ff6ee
--- /dev/null
@@ -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 (file)
index 0000000..23fafaf
--- /dev/null
@@ -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 (file)
index 0000000..a4c8e8f
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/shell_cmds/locate/bigram/Makefile b/shell_cmds/locate/bigram/Makefile
new file mode 100644 (file)
index 0000000..2c5fc1b
--- /dev/null
@@ -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 (file)
index 0000000..1d3e5ea
--- /dev/null
@@ -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 (file)
index 0000000..c1a6737
--- /dev/null
@@ -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 (file)
index 0000000..b7422cb
--- /dev/null
@@ -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 (file)
index 0000000..b78ac92
--- /dev/null
@@ -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 (file)
index 0000000..24e9617
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  nice
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index 62a197e457dae53eed294a62ce0a3c18d365fbe9..7f8d1fc1016600353d5821587b2011224b8ccddb 100644 (file)
@@ -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 (file)
index 0000000..2246f0d
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  nohup
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index 021361c5cf251c00c3c5c146e369c727bad17982..d2b9f8132d38674f0f8a50d444c8b2be8af904f2 100644 (file)
@@ -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 (file)
index 0000000..e5f316a
--- /dev/null
@@ -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 (file)
index 0000000..e3b7071
--- /dev/null
@@ -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 (file)
index 0000000..9133366
--- /dev/null
@@ -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 (file)
index 0000000..cf20a3e
--- /dev/null
@@ -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 (file)
index 0000000..00fdb5c
--- /dev/null
@@ -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 (file)
index 0000000..0d600f8
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  script
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index 90e895ef0129f311c1f95a66dc8e071a9dbbe003..495cc124ff2f02bec095c67b397ab810168fcf22 100644 (file)
@@ -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 (file)
index 0000000..96f8a35
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  seq
+
+.include <bsd.prog.mk>
index 8d0866256fe1dee009f28242ddb44b51cf01057f..7926feffd5749ca9acbc89848a7f00339d380972 100644 (file)
@@ -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
index ae3cf6ed31118cc934143a5700b906b46ff2112f..eb279f2358b790e721b2a4dd262974719d32cd27 100644 (file)
@@ -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 (file)
index 0000000..004ad04
--- /dev/null
@@ -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 (file)
index 0000000..7fe93c5
--- /dev/null
@@ -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 (file)
index 0000000..7bc56fb
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  su
+
+LDADD=-lpam -liosexec
+
+.include <bsd.prog.mk>
index 8ad7434611653a8e44ba895a447c085821907d65..a03ad3b572017334c3379d28fb576d7ce012a4c5 100644 (file)
@@ -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 (file)
index 0000000..c6065f3
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  systime
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index 37cee8be8ccd944d17c26b8277a874496ca82e08..38159b8c7dd922553e6dbb67168fe6d4b7acb393 100644 (file)
@@ -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 (file)
index 0000000..ab7b935
--- /dev/null
@@ -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 (file)
index 0000000..562c968
--- /dev/null
@@ -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 (file)
index 0000000..f2c8284
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  time
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index afaaed0e86b9fda95de530b39a794228090c8cce..78bf4ca28c4ec176ddf883b86a7ccd5f250466b1 100644 (file)
@@ -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 (file)
index 0000000..1285b81
--- /dev/null
@@ -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 (file)
index 0000000..a002a44
--- /dev/null
@@ -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 (file)
index 0000000..8b987ca
--- /dev/null
@@ -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 (file)
index 0000000..c1d1c21
--- /dev/null
@@ -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 (file)
index 0000000..f50df5d
--- /dev/null
@@ -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 (file)
index 0000000..5803279
--- /dev/null
@@ -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 (file)
index 0000000..097d238
--- /dev/null
@@ -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 (file)
index 0000000..74826ba
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  who
+SRCS=  who.c utmpentry.c
+
+CFLAGS+=-DSUPPORT_UTMPX
+
+.include <bsd.prog.mk>
index b0e09146f3faf6db18f047bf096946fa6b4691b5..7938d371692fe5c132b4c79c61ad1d72f248bf9e 100644 (file)
@@ -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 (file)
index 0000000..d7f3518
--- /dev/null
@@ -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 (file)
index 0000000..aa433d8
--- /dev/null
@@ -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);
+}
index a1ee4805bd8e53a5e906eda7e948652797b6958c..7865be388b49daa56e43053e8da742c3ee0dd176 100644 (file)
@@ -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 (file)
index 0000000..b1d4075
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  yes
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/Makefile b/system_cmds/Makefile
new file mode 100644 (file)
index 0000000..89852eb
--- /dev/null
@@ -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 (file)
index 0000000..b098e97
--- /dev/null
@@ -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 (file)
index 0000000..999d22b
--- /dev/null
@@ -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 (file)
index 0000000..3690047
--- /dev/null
@@ -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 (file)
index 0000000..224450b
--- /dev/null
@@ -0,0 +1,7 @@
+PROG=  arch
+MAN=   arch.1 machine.1
+LINKS= ${BINDIR}/arch ${BINDIR}/machine
+
+LDADD+=-framework CoreFoundation
+
+.include <bsd.prog.mk>
index b522ce8ffcc20c2059e9342e0a65bf44272454de..a0b5e2023d2efc8b8682001a2d066619c5e9f2c8 100644 (file)
 #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 (file)
index 0000000..f67fb15
--- /dev/null
@@ -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 (file)
index 0000000..0b38fee
--- /dev/null
@@ -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>
index 0981614d822cc3cc05617308747de8773b49ae01..dc7b2e6157e58eb4d058956372ca15e55110ef95 100644 (file)
@@ -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 (file)
index 0000000..9f13009
--- /dev/null
@@ -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>
index bff82809172ed282d614a8eee491efeeb2a42fd3..452de74de95f7fb0f3c3e2f183d0b930e4277945 100644 (file)
@@ -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 (file)
index 0000000..4a51f7b
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  cpuctl
+MAN=   cpuctl.8
+
+.include <bsd.prog.mk>
index 482187858c29389b6df24a11bd98498c803d0330..22e2f3370797921584972b37dd52f34827178b22 100644 (file)
@@ -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 (file)
index 0000000..01e7165
--- /dev/null
@@ -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 (file)
index 0000000..6227af5
--- /dev/null
@@ -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 (file)
index 0000000..e920168
--- /dev/null
@@ -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 (file)
index 0000000..78b3db6
--- /dev/null
@@ -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>
index b9457336dcbd57cdc806b1901f081a44e6676245..5e38244108a38c654d13eda054396cccb9cb15fb 100644 (file)
@@ -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>
 
index b1e4421cdd1c6e770d23a0d1264cbc13f17622a0..8e61ca6cc8c1c5f820f757c5a54ae13b99ab2298 100644 (file)
@@ -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"
index 92aeac1fe758dcb2b22f78c760c37f271b7abc8d..5ef98999ecd31bea39f7781237d143051360fa3e 100644 (file)
@@ -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"
index abefa14fbff986162805926b3222a5107fd1aab4..b20e721e63fa5d0e946bff5b91329535eb92c003 100644 (file)
@@ -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"
index c62b9f3f4dfc7deae8f7d569b637eced543b4c37..616eedf17e80620275109dccc54bbfa9fa1fa576 100644 (file)
@@ -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"
index b1b3d6f814ede08150516b99d1365364d922af2b..f47cbfd0c9a723f98944d9f450a9852dbe2b4446 100644 (file)
@@ -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"
index f0edcf842f0d4e0510dcb00104fc01152eb557c4..8706b6e0b184b65cc79bedb5427983f426fcbb5b 100644 (file)
@@ -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"
index 2253bffd9f3c1ef9cd8e5e586198adc3bbf80acc..46b91b5af5f49ca1dd4672a8080358d3e30c1b5a 100644 (file)
@@ -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"
index 22b0efe2b7413ac2b3851e2bb54e5c26a7fda98e..0504f51e8380c8b6c59788a42a5fed866f2006d7 100644 (file)
@@ -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 (file)
index 0000000..3ba6329
--- /dev/null
@@ -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>
index b2a275298cf3dd7d8db9a618ea84fe6f0239e5b8..6af99f7006ee4d4b23b4bcd44ee1e11c250e06a6 100644 (file)
@@ -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 (file)
index 0000000..cabee33
--- /dev/null
@@ -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>
index ba501fb6d85e7cacaa71ab3aeb4b49cd41f8c795..38fc5955092a1a5d62b4f32c4bca641bab8a2b3b 100644 (file)
@@ -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 (file)
index 0000000..78473a2
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  hostinfo
+MAN=   hostinfo.8
+
+.include <bsd.prog.mk>
index 1828583bc25b732a40746d6f78fab761d50f8c4b..7739975bf95514317ccaf3ba868d4cff410152d1 100644 (file)
@@ -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 (file)
index 0000000..f573337
--- /dev/null
@@ -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 (file)
index 0000000..b86524b
--- /dev/null
@@ -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 (file)
index 0000000..25abe7f
--- /dev/null
@@ -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 (file)
index 0000000..8e69a31
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  latency
+
+LDADD+=-lncursesw -lutil
+
+.include <bsd.prog.mk>
index afd67cc5951c3397fb76b7c932237a6ce255c715..3183eb010ce940593ced2bbe08f8806d6f1d005f 100644 (file)
@@ -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 (file)
index 0000000..a936913
--- /dev/null
@@ -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>
index d32a06d25cf27dba917bea3a36909053e814c6ce..0bba90869ca144fc59dfc0697becd7e3bde7b93d 100644 (file)
@@ -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 (file)
index 0000000..b034a0b
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  lskq
+
+.include <bsd.prog.mk>
index 959ac66e2dbbf2bd3ecf518197bd0c95a3f72746..c01cff47804ceddd0391dcecf2736bd96192c83a 100644 (file)
 
 #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
  */
index a48bb26100c6649137dc8194d2b1353ec38e663c..91f53c0f2c8d1ee441190beff6610fa6b732b93e 100644 (file)
@@ -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 (file)
index 0000000..6b1e129
--- /dev/null
@@ -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 (file)
index 0000000..5c3c5bd
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  lsmp
+SRCS=  lsmp.c \
+port_details.c \
+task_details.c
+
+.include <bsd.prog.mk>
index a059eb555cfd8b7a5fc3c8f8cf81ef3320eb479f..9a47012d07212998517aa0fa1125bc4a724397dd 100644 (file)
@@ -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);
index cdf0e9eaa532973fa2dd28ccd1061aacb9fe8c30..b7b4e6c614e0ae0e9e32b513409cb53b2da1ebd5 100644 (file)
@@ -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>
index 114c5b6e17b2de2edf8086e6f914941ca31d276a..e1a89d92cded5ddf545ae0cb0fb26183d3c67cc2 100644 (file)
@@ -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);
index 69fc9beaf20b972759150fdf96a10b7b51f6f4a8..f6222cd1cc8c81ff83f141a5a484ceabee8743a7 100644 (file)
@@ -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;
index 123f8aac9694c6b596024f86cb41ba2111674d5a..3111e77467e1ed1600771d046800ae9fd8beb83c 100644 (file)
@@ -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 (file)
index 0000000..4ce4899
--- /dev/null
@@ -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 (file)
index 0000000..cb287f6
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  mean
+MAN=   
+
+.include <bsd.prog.mk>
index 87ecdc25f238edcd2ca531ed795b5baf75ed6e27..0c7268d389f843808d082567f15f601171bb39d7 100644 (file)
@@ -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 (file)
index 0000000..8d4a1ed
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  memory_pressure
+
+.include <bsd.prog.mk>
index 1713fcb5d1738f206bc6224ee2efc51ec55bec3e..eb417c24aee28dff3ae1cd6412f32872cbb7ec8a 100644 (file)
@@ -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 (file)
index 0000000..666e804
--- /dev/null
@@ -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 (file)
index 0000000..5ac99a6
--- /dev/null
@@ -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 (file)
index 0000000..25fecc5
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  newgrp
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index 3a4f412d1930239fb0f162c0650a7016eeca3b13..3ffe7a7ef0bf6f20c474337db1c972d558707280 100644 (file)
@@ -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 (file)
index 0000000..2e009b3
--- /dev/null
@@ -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 (file)
index 0000000..21abc19
--- /dev/null
@@ -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 (file)
index 0000000..7efe016
--- /dev/null
@@ -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 (file)
index 0000000..7dcc91f
--- /dev/null
@@ -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>
index 877036e26466e5889d966d110f7f960c238636bb..663a40dcab81bce91874483bf215717afe834488 100644 (file)
@@ -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 (file)
index 0000000..2902836
--- /dev/null
@@ -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 (file)
index 0000000..bef9cc2
--- /dev/null
@@ -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 (file)
index 0000000..0869be5
--- /dev/null
@@ -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 (file)
index 0000000..d36639a
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  reboot
+MAN=   reboot.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
index 5478704a8161c4f6c249326d9f70e0fc5f83f366..8156d658e96a10608dbc06465cb9463a9a0ec23d 100644 (file)
@@ -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 (file)
index 0000000..c5efb2a
--- /dev/null
@@ -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 (file)
index 0000000..3cf5de4
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  sc_usage
+
+LDADD+=-lncursesw -liosexec
+
+.include <bsd.prog.mk>
index d7044796f21b4e0074e17e6989345f45ed4f12b3..0d74b4a4a6d43509c1b678686a8b532da12c71b9 100644 (file)
@@ -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 (file)
index 0000000..3d12099
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  shutdown
+MAN=   shutdown.8
+
+LDADD+=-lbsm -framework IOKit -liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 597f9f229626c957093abbc595290cf2c882a7e6..0dcc41b8d17c6a725e8d1d743f10287bc3145a02 100644 (file)
@@ -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 (file)
index 0000000..7471846
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  stackshot
+MAN=   
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
index ecb36875d990c23833028d89367a856cac4bf191..254d0db4b7bf104442c237e493a6d7c3c8470dff 100644 (file)
@@ -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 (file)
index 0000000..bfcb191
--- /dev/null
@@ -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 (file)
index 0000000..dcfb282
--- /dev/null
@@ -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 (file)
index 0000000..726ca66
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  taskpolicy
+MAN=   taskpolicy.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 5bc96844ba2ef55e41b0c666b55bbb69e678b4bf..2c87e7c3f74f6b719a6779a29e755cb9364ab40e 100644 (file)
@@ -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 (file)
index 0000000..84ed106
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  trace
+
+LDADD+=-lutil
+
+.include <bsd.prog.mk>
index f85b336ebf8b473390d584917c81ed5f8e860ef7..6ccf0fcd41c0f6a29cf510823aa6f6540188b84c 100644 (file)
@@ -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 (file)
index 0000000..f79e2e8
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  vifs
+MAN=   vifs.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 967cc1df8d53e851774612f23e3411c6647ffbe9..19cf2f925a3b31821dddf28bc94d7dd999e42bc0 100644 (file)
@@ -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 (file)
index 0000000..5f51e35
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  vipw
+MAN=   vipw.8
+SRCS=  pw_util.c vipw.c
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 83644968a09ced593f071ff20d5d87642e3079c0..46ff3047eec7c04e678b6dbcd15dd76790f730a4 100644 (file)
@@ -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 (file)
index 0000000..6fb7784
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  vm_purgeable_stat
+
+.include <bsd.prog.mk>
index 2ee8d1e91cd55b80a7859f6d4380e0c36cae306e..b21dbd852d3f6b01c31c04c546591b0f018198f5 100644 (file)
@@ -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>
index 330704d0898551985c3ddfe8ffe5a74fd1f90c93..e0a0011d37b1d7dbe34e8397064c5be197d7c18d 100644 (file)
  * @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 (file)
index 0000000..ffa95b6
--- /dev/null
@@ -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 (file)
index 0000000..ea154c6
--- /dev/null
@@ -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 (file)
index 0000000..864f5b0
--- /dev/null
@@ -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 (file)
index 0000000..40111f3
--- /dev/null
@@ -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 (file)
index 0000000..87b92fa
--- /dev/null
@@ -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 (file)
index 0000000..0303d46
--- /dev/null
@@ -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 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/text_cmds/banner/Makefile b/text_cmds/banner/Makefile
new file mode 100644 (file)
index 0000000..f3af9a6
--- /dev/null
@@ -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 (file)
index 0000000..934ccfa
--- /dev/null
@@ -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 (file)
index 0000000..33498e2
--- /dev/null
@@ -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 (file)
index 0000000..0da3b5a
--- /dev/null
@@ -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 (file)
index 0000000..b0b88c0
--- /dev/null
@@ -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 (file)
index 0000000..8bfa67f
--- /dev/null
@@ -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 (file)
index 0000000..b4c7ed9
--- /dev/null
@@ -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 (file)
index 0000000..3f243c6
--- /dev/null
@@ -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 (file)
index 0000000..c374a39
--- /dev/null
@@ -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>
index a6525ea5717016ce70be024104395ca71a2b6ee3..4c7cfd7baf359f4c7de4fba2df2a46f98f66c35d 100644 (file)
@@ -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>
index 70a44076f88209d0819ab4c3f216336f03371862..211f4d656f20d3ff49e72bddb6bfbd9c7f7e42d9 100644 (file)
@@ -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 (file)
index 0000000..bba5bd3
--- /dev/null
@@ -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 (file)
index 0000000..48f96db
--- /dev/null
@@ -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 (file)
index 0000000..278a34e
--- /dev/null
@@ -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 (file)
index 0000000..a54da9f
--- /dev/null
@@ -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 (file)
index 0000000..5ea0c9a
--- /dev/null
@@ -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 (file)
index 0000000..42b5f58
--- /dev/null
@@ -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 (file)
index 0000000..e47ea0a
--- /dev/null
@@ -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 (file)
index 0000000..e1331bf
--- /dev/null
@@ -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 (file)
index 0000000..c152154
--- /dev/null
@@ -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 (file)
index 0000000..66a1483
--- /dev/null
@@ -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 (file)
index 0000000..e4f9e6d
--- /dev/null
@@ -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 (file)
index 0000000..5213e2d
--- /dev/null
@@ -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 (file)
index 0000000..92540c1
--- /dev/null
@@ -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 (file)
index 0000000..db1ea14
--- /dev/null
@@ -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 (file)
index 0000000..e818030
--- /dev/null
@@ -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 (file)
index 0000000..e0e1dac
--- /dev/null
@@ -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>
index 6e3f9b45b79a1a1d6cc2143a98d8bbaa15c068d8..d74460e81f570180e7ec7a14a10a1f7cccf00f23 100644 (file)
@@ -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 (file)
index 0000000..27270a0
--- /dev/null
@@ -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 (file)
index 0000000..bd285e9
--- /dev/null
@@ -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 (file)
index 0000000..86980fa
--- /dev/null
@@ -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 (file)
index 0000000..c4d8997
--- /dev/null
@@ -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 (file)
index 0000000..494e231
--- /dev/null
@@ -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 (file)
index 0000000..b21f6f7
--- /dev/null
@@ -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_ */
index e7e6757e9f16a78b0df13014714a1d62cb0b6c20..6971e68ab6d2e7a3a02f6ec6241d4ae901668a2b 100644 (file)
@@ -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 (file)
index 0000000..8cb81f9
--- /dev/null
@@ -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 (file)
index 0000000..cf193c3
--- /dev/null
@@ -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 (file)
index 0000000..0d06c9f
--- /dev/null
@@ -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 (file)
index 0000000..a62780c
--- /dev/null
@@ -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 (file)
index 0000000..cf3c0cb
--- /dev/null
@@ -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 (file)
index 0000000..424b508
--- /dev/null
@@ -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 (file)
index 0000000..4506a3f
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  wc
+
+.include <bsd.prog.mk>