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
--- /dev/null
+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>
--- /dev/null
+RPCGEN?=rpcgen
+STRIP=
+
+SHAREDIR=/usr/share/
+
+.if !defined(BINDIR)
+BINDIR=/usr/bin
+.endif
+
+COMPRESS_CMD?= zstd -c
+COMPRESS_EXT?= .zst
--- /dev/null
+# 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.
--- /dev/null
+SUBDIR= gencat \
+ lsvfs \
+ ps \
+ whois \
+ cap_mkdb \
+ last \
+ stty \
+ colldef \
+ locale \
+ mklocale \
+ tabs \
+ finger \
+ tty
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= cap_mkdb
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= colldef
+SRCS= parse.y \
+ scan.l
+
+LDADD+=-lfl
+
+CFLAGS+=-Ilocale
+
+.include <bsd.prog.mk>
#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;
--- /dev/null
+PROG= finger
+SRCS= finger.c \
+ lprint.c \
+ net.c \
+ sprint.c \
+ util.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= gencat
+SRCS= gencat.c \
+ genlib.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= last
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG_CXX= locale
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= lsvfs
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mklocale
+SRCS= lex.l \
+ yacc.y
+
+.include <bsd.prog.mk>
#include <stdlib.h>
#include "ldef.h"
-#include "y.tab.h"
+#include "yacc.h"
#include "extern.h"
%}
--- /dev/null
+MAN= ps.1
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= stty
+SRCS= cchar.c gfmt.c key.c \
+ modes.c print.c stty.c util.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= tabs
+
+LDADD=-lncursesw
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= tty
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= whois
+
+.include <bsd.prog.mk>
--- /dev/null
+SUBDIR= mesg \
+ uudecode \
+ uuencode \
+ write
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= mesg
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= uudecode
+SRCS= uudecode.c \
+ base64.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= uuencode
+MAN= uuencode.1 uuencode.5
+SRCS= uuencode.c \
+ base64.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= write
+
+.include <bsd.prog.mk>
--- /dev/null
+SUBDIR= migcom.tproj
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+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>
#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"
--- /dev/null
+#!/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
--- /dev/null
+SUBDIR= asa \
+ ctags \
+ lorder \
+ rpcgen \
+ unifdef
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= asa
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= ctags
+SRCS= C.c \
+ ctags.c \
+ fortran.c \
+ lisp.c \
+ print.c \
+ tree.c \
+ yacc.c
+
+.include <bsd.prog.mk>
--- /dev/null
+SCRIPTS= lorder.sh
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#include <sys/file.h>
#endif
#include <sys/stat.h>
+
+#include <libiosexec.h>
+
#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
--- /dev/null
+PROG= unifdef
+SCRTIPS= unifdefall.sh
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= dev_mkdb
+MAN= dev_mkdb.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#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 */
(void)strlcat(rawbuf, &dp[1], sizeof(rawbuf));
return (rawbuf);
}
-
-#endif /* TARGET_OS_OSX */
-
--- /dev/null
+PROG= edquota
+MAN= edquota.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#include <libkern/OSByteOrder.h>
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
char *qfname = QUOTAFILENAME;
char *qfextension[] = INITQFNAMES;
char *quotagroup = QUOTAGROUP;
#ifndef edt_fstab_h
#define edt_fstab_h
-#include <TargetConditionals.h>
-
#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
#define RAMDISK_FS_SPEC "ramdisk"
--- /dev/null
+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>
--- /dev/null
+MAN= fsck.8
+
+.include <bsd.prog.mk>
#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"
--- /dev/null
+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
--- /dev/null
+.include <bsd.prog.mk>
--- /dev/null
+SCRIPTS= fuser.pl
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+MAN= fstab.5
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mount_devfs
+MAN=
+
+LDADD=-lutil
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mount_fdesc
+MAN= mount_fdesc.8
+
+LDADD=-lutil
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
{ 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", },
--- /dev/null
+PROG= quota
+MAN= quota.1
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= quotacheck
+MAN= quotacheck.8
+SRCS= quotacheck.c hfs_quotacheck.c preen.c
+
+.PATH: ${.CURDIR}/../disklib
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= quotaon
+LINKS= ${BINDIR}/quotaon ${BINDIR}/quotaoff
+MAN= quotaon.8
+MLINKS= quotaon.8 quotaoff.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= repquota
+MAN= repquota.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= setclass
+MAN= setclass.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= vndevice
+MAN=
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#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>
#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"
--- /dev/null
+SUBDIR= checknr \
+ colcrt \
+ makewhatis
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= checknr
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= colcrt
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= makewhatis
+MAN= makewhatis.8 makewhatis.local.8
+SCRIPTS= makewhatis.local.sh
+SCRIPTSDIR=/usr/libexec/
+
+LDADD=-lz
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= chflags
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= chmod
+SRCS= chmod.c \
+ chmod_acl.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= chown
+MAN= chown.8 chgrp.1
+
+BINDIR=/usr/sbin
+
+LINKS= ${BINDIR}/chown /usr/bin/chgrp
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+/*-
+ * 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);
+}
--- /dev/null
+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>
#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);
--- /dev/null
+PROG= cp
+SRCS= cp.c utils.c
+
+BINDIR=/bin
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
#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; \
#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))
--- /dev/null
+PROG= dd
+SRCS= args.c conv_tab.c conv.c dd.c misc.c position.c
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+MAN= df.1
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= du
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+# @(#)Makefile 8.1 (Berkeley) 6/6/93
+# $FreeBSD$
+
+PROG= xinstall
+PROGNAME= install
+SRCS= xinstall.c
+MAN= install.1
+
+.include <bsd.prog.mk>
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);
}
}
--- /dev/null
+PROG= ipcrm
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#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
--- /dev/null
+PROG= ln
+MAN= link.1 ln.1 symlink.7
+BINDIR=/bin
+LINKS= ${BINDIR}/ln ${BINDIR}/link
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= ls
+SRCS= cmp.c ls.c print.c util.c
+
+CFLAGS+=-DCOLORLS
+
+LDADD=-lutil -lncursesw
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
#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__ */
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
} 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;
--- /dev/null
+PROG= mkdir
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mkfifo
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mknod
+MAN= mknod.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#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"
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
}
}
}
+#endif
ai->xdstream_priv_id = xd_obj_id;
// insert a dummy value as digest is not used in presence of mflag
--- /dev/null
+PROG= mv
+
+LDADD+=-liosexec
+
+BINDIR=/bin
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
#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 *);
--- /dev/null
+PROG= pathchk
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#include "options.h"
#include "extern.h"
+#include <libiosexec.h>
+
/*
* Routines which deal directly with the archive I/O device/file.
*/
int bad_opt(void);
int pax_format_opt_add(char *);
int pax_opt(void);
-char *chdname;
+extern char *chdname;
/*
* pat_rep.c
#include "tar.h"
#include "extern.h"
+char *chdname;
+
/*
* Routines which handle command line options
*/
--- /dev/null
+PROG= rm
+MAN= rm.1 unlink.1
+
+BINDIR=/bin
+
+LINKS+= ${BINDIR}/rm ${BINDIR}/unlink
+
+CFLAGS+=-I${.CURDIR}/../common
+
+.include <bsd.prog.mk>
#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;
--- /dev/null
+PROG= rmdir
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= rmt
+MAN= rmt.8
+
+.include <bsd.prog.mk>
--- /dev/null
+SCRIPTS= shar.sh
+MAN= shar.1
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= stat
+MAN= readlink.1 stat.1
+
+LINKS+= ${BINDIR}/stat ${BINDIR}/readlink
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= touch
+
+.include <bsd.prog.mk>
--- /dev/null
+install
\ No newline at end of file
-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>
--- /dev/null
+.include "../Makefile.inc"
-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>
-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>
-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>
-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>
#include <fcntl.h>
#include "extern.h"
+#include <libiosexec.h>
+
#define READ 0
#define WRITE 1
#include "rcv.h"
#include "extern.h"
+#include <libiosexec.h>
+
/*
* Mail -- a mail program
*
-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>
--- /dev/null
+SUBDIR= calendar \
+ leave \
+ ncal \
+ tsort \
+ units
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+# @(#)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>
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pathnames.h"
#include "calendar.h"
--- /dev/null
+PROG= leave
+
+.include <bsd.prog.mk>
#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>
--- /dev/null
+PROG= ncal
+SRCS= calendar.c easter.c ncal.c
+
+LDADD=-lncursesw
+
+.include <bsd.prog.mk>
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <calendar.h>
+#include "calendar.h"
#include <ctype.h>
#include <err.h>
#include <langinfo.h>
--- /dev/null
+PROG= tsort
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= units
+FILES= units.lib
+FILESDIR= ${SHAREDIR}/misc
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+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"
--- /dev/null
+PROG= arp
+MAN= arp.8 arp4.4
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= cfilutil
+SRCS= cfilstat.c cfilutil.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= dnctl
+MAN= dnctl.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#include <netinet/ip_dummynet.h>
#include <arpa/inet.h>
+#include <libiosexec.h>
+
/*
* Limit delay to avoid computation overflow
*/
--- /dev/null
+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>
--- /dev/null
+PROG= frame_delay
+MAN= frame_delay.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
* 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>
callback_register(sixlowpan_clone_cb, NULL);
#undef N
}
+#endif
}
#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)
{
}
free(buf);
}
+#endif
static void
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;
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)
{
do_bridgeflag(s, val, IFBIF_MAC_NAT, 0);
}
+#endif
static struct cmd bridge_cmds[] = {
DEF_CMD_ARG("addm", setbridge_add),
#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",
#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.
}
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static int
get_int64(uint64_t *i, char const *s)
{
"\t\tnetem\n\n");
return (-1);
}
+#endif
static void
setthrottle(const char *val, int dummy __unused, int s,
}
#endif
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
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)
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
Perror(vname);
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
struct str2num {
const char *str;
uint32_t num;
if (ioctl(s, SIOCSIFINTERFACESTATE, (caddr_t)&ifr) < 0)
warn("ioctl(SIOCSIFINTERFACESTATE)");
}
+#endif
static void
show_routermode(int s)
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) {
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;
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();
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),
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),
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
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) {
}
}
break;
+#endif
case IFT_BRIDGE:
case IFT_PFLOG:
case IFRTYPE_FUNCTIONAL_INTCOPROC:
break;
+#if defined(IFRTYPE_FUNCTIONAL_COMPANIONLINK)
case IFRTYPE_FUNCTIONAL_COMPANIONLINK:
str = "companionlink";
break;
+#endif
default:
break;
#include <string.h>
#include <unistd.h>
+#ifndef SIOCGIFXMEDIA
+#define SIOCGIFXMEDIA SIOCGIFMEDIA
+#endif
+
#include "ifconfig.h"
static void domediaopt(const char *, int, int);
#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)
{
--- /dev/null
+PROG= ip6addrctl
+MAN= ip6addrctl.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= kdumpd
+MAN= kdumpd.8
+SRCS= kdumpd.c kdumpsubs.c
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mnc
+SRCS= mnc_error.c mnc_main.c \
+ mnc_multicast.c mnc_opts.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mptcp_client
+SRCS= conn_lib.c mptcp_client.c
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mtest
+MAN= mtest.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= ndp
+MAN= ndp.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
!(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;
}
/*
--- /dev/null
+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>
--- /dev/null
+PROG= ping
+MAN= ping.8
+SRCS= ping.c gmt2local.c
+
+BINDIR=/sbin
+
+.PATH: ${.CURDIR}/../ecnprobe
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= ping6
+MAN= ping6.8
+SRCS= ping6.c md5.c gmt2local.c
+
+BINDIR=/sbin
+
+.PATH: ${.CURDIR}/../ecnprobe
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= pktapctl
+MAN= pktapctl.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= pktmnglr
+MAN=
+SRCS= packet_mangler.c
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= rarpd
+MAN= rarpd.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= route
+MAN= route.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+MAN= rtadvd.8 rtadvd.conf.5
+
+.include <bsd.prog.mk>
* Apple Inc.
*/
#include <assert.h>
+#include <stdarg.h>
#include <os/log_private.h>
#define kRtadvdLoggerID "com.apple.rtadvd"
--- /dev/null
+PROG= rtsol
+MAN= rtsol.8
+SRCS= dump.c if.c probe.c rtsock.c \
+ rtsol.c rtsold.c
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+PROG= traceroute
+MAN= traceroute.8
+SRCS= as.c findsaddr-socket.c ifaddrlist.c \
+ traceroute.c version.c
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= traceroute6
+MAN= traceroute6.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+SUBDIR= patch \
+ diffstat
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= diffstat
+
+CFLAGS+=-DHAVE_CONFIG_H
+
+.include <bsd.prog.mk>
*/
#if defined(HAVE_CONFIG_H)
-#include <config.h>
+#include "config.h"
#endif
#if defined(WIN32) && !defined(HAVE_CONFIG_H)
-# $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>
-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>
--- /dev/null
+.include "../Makefile.inc"
-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>
-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>
-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>
-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>
#include <netinet/ip.h>
#include <netinet/ip6.h>
+#include <libiosexec.h>
+
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
return (1);
}
-#ifdef TERMCAP
+#ifndef TERMCAP
char termbuf[1024];
/*ARGSUSED*/
-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>
#include <libtelnet/auth.h>
#endif
+#include <libiosexec.h>
+
int cleanopen(char *);
void scrub_env(void);
* Returns the file descriptor of the opened pty.
*/
char alpha[] = "0123456789abcdefghijklmnopqrstuv";
-char line[16];
+//char line[16];
int
getpty(int *ptynum __unused, int *slavepty)
-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>
-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>
-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>
--- /dev/null
+#!/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
--- /dev/null
+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>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+# $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>
--- /dev/null
+PROG= apply
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define EXEC "exec "
static int exec_shell(const char *, char *, char *);
--- /dev/null
+PROG= basename
+MAN= basename.1 dirname.1
+
+.include <bsd.prog.mk>
--- /dev/null
+BINDIR=/usr/sbin
+
+PROG= chroot
+MAN= chroot.8
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
int main __P((int, char **));
void usage __P((void)) __attribute__((__noreturn__));
--- /dev/null
+BINDIR=/bin
+
+PROG= date
+SRCS= date.c netdate.c vary.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= dirname
+MAN=
+
+.include <bsd.prog.mk>
--- /dev/null
+BINDIR=/bin
+
+PROG= echo
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= env
+SRCS= env.c envopts.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <stdlib.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "envopts.h"
extern char **environ;
--- /dev/null
+PROG= expr
+SRCS= expr.y
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= false
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#define COMPAT_MODE(func, mode) 1
#endif
+#include <libiosexec.h>
+
#include "find.h"
static PLAN *palloc(OPTION *);
#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.
--- /dev/null
+/*-
+ * 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);
+}
--- /dev/null
+PROG= getopt
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= hexdump
+MAN= hexdump.1 od.1
+SRCS= conv.c \
+ display.c \
+ hexdump.c \
+ hexsyntax.c \
+ odsyntax.c \
+ parse.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= hostname
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+PROG= jot
+
+.include <bsd.prog.mk>
--- /dev/null
+BINDIR=/bin
+
+PROG= kill
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= killall
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= lastcomm
+
+.include <bsd.prog.mk>
--- /dev/null
+SUBDIR= bigram code locate
+
+.include <bsd.subdir.mk>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= locate.bigram
+MAN= locate.bigram.8
+
+BINDIR=/usr/libexec
+
+CFLAGS+=-I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= locate.code
+MAN= locate.code.8
+
+BINDIR=/usr/libexec
+
+CFLAGS+=-I${.CURDIR}/../locate
+
+.include <bsd.prog.mk>
--- /dev/null
+# @(#)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>
--- /dev/null
+PROG= logname
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mktemp
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= nice
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <err.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define DEFNICE 10
int main __P((int, char **));
--- /dev/null
+PROG= nohup
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#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);
--- /dev/null
+PROG= path_helper
+MAN= path_helper.8
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= printenv
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= printf
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= pwd
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= renice
+MAN= renice.8
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= script
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <termios.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#define DEF_BUF 65536
struct stamp {
--- /dev/null
+PROG= seq
+
+.include <bsd.prog.mk>
# @(#)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 \
# 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
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
#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
--- /dev/null
+PROG= shlock
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= sleep
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= su
+
+LDADD=-lpam -liosexec
+
+.include <bsd.prog.mk>
#include <bsm/audit_session.h>
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
#define PAM_END() do { \
int local_ret; \
if (pamh != NULL) { \
--- /dev/null
+PROG= systime
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
* @APPLE_LICENSE_HEADER_END@
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <err.h>
#include <errno.h>
#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);
--- /dev/null
+PROG= tee
+
+.include <bsd.prog.mk>
--- /dev/null
+BINDIR=/bin
+
+PROG= test
+MAN= [.1 test.1
+
+LINKS= ${BINDIR}/test ${BINDIR}/[
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= time
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <time.h>
#include <unistd.h>
+#include <libiosexec.h>
+
int lflag;
int portableflag;
bool child_running = true;
--- /dev/null
+PROG= true
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= uname
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= users
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= w
+SRCS= fmt.c pr_time.c proc_compare.c w.c
+
+CFLAGS+=-DHAVE_UTMPX
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= what
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= whereis
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= which
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= who
+SRCS= who.c utmpentry.c
+
+CFLAGS+=-DSUPPORT_UTMPX
+
+.include <bsd.prog.mk>
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));
* 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));
--- /dev/null
+PROG= xargs
+SRCS= strnsubst.c xargs.c strtonum.c
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
--- /dev/null
+/*-
+ * 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);
+}
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pathnames.h"
#ifdef __APPLE__
#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);
--- /dev/null
+PROG= yes
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+CFLAGS+=-DDAEMON_UID=1 -DDAEMON_GID=1 -DDEFAULT_AT_QUEUE=\'a\' -DDEFAULT_BATCH_QUEUE=\'b\' -DPERM_PATH=\"/usr/lib/cron/\" -DPRIVATE
+
+.include "../Makefile.inc"
--- /dev/null
+PROG= ac
+MAN= ac.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= accton
+MAN= accton.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= arch
+MAN= arch.1 machine.1
+LINKS= ${BINDIR}/arch ${BINDIR}/machine
+
+LDADD+=-framework CoreFoundation
+
+.include <bsd.prog.mk>
#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__)
size_t capacity;
} CPU;
+#if 0
typedef struct {
const char *arch;
cpu_type_t cpu;
bool unrecognizednative32seen = false;
bool unrecognizednative64seen = false;
+#endif
/*
* arch - perform the original behavior of the arch and machine commands.
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.
*/
spawnIt(cpu, 1, *argv, argv);
}
-
+#endif
/* the main() routine */
int
if(argc == 1)
arch(1); /* the "arch" command with no arguments was called */
}
-
+ return(0);
+#if 0
initCPU(&cpu);
if(my_name_is_arch)
/* should never get here */
errx(1, "returned from spawn");
+#endif
}
--- /dev/null
+PROG= at
+SRCS= at.c panic.c parsetime.c \
+ perm.c
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#include <security/openpam.h>
#endif
+#include <libiosexec.h>
+
/* Local headers */
#define MAIN
--- /dev/null
+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>
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);
--- /dev/null
+PROG= cpuctl
+MAN= cpuctl.8
+
+.include <bsd.prog.mk>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
static void usage()
--- /dev/null
+PROG= dmesg
+MAN= dmesg.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= dynamic_pager
+MAN= dynamic_pager.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= fs_usage
+MAN= fs_usage.1
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "convert.h"
#include "corefile.h"
#include "vanilla.h"
#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>
* Copyright (c) 2016-2018 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "corefile.h"
#include "sparse.h"
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "dyld.h"
#include "utils.h"
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "utils.h"
#include "corefile.h"
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "vm.h"
#include "region.h"
* Copyright (c) 2015 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "utils.h"
#include "threads.h"
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "utils.h"
#include "region.h"
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "vm.h"
#include "region.h"
* Copyright (c) 2016 Apple Inc. All rights reserved.
*/
+typedef char *kobject_description_t[512];
#include "options.h"
#include "vm.h"
#include "utils.h"
#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
--- /dev/null
+# $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>
#include <sysexits.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "getconf.h"
static void do_confstr(const char *name, int key);
--- /dev/null
+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>
#include <TargetConditionals.h>
#endif
+#include <libiosexec.h>
+
#include "gettytab.h"
#include "extern.h"
#include "pathnames.h"
--- /dev/null
+PROG= hostinfo
+MAN= hostinfo.8
+
+.include <bsd.prog.mk>
* execting on.
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <sys/sysctl.h>
--- /dev/null
+PROG= iosim
+
+CFLAGS+=-I${.CURDIR}/../at.tproj
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= iostat
+MAN= iostat.8
+
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= kpgo
+MAN=
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= latency
+
+LDADD+=-lncursesw -lutil
+
+.include <bsd.prog.mk>
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>
--- /dev/null
+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>
#include <security/openpam.h>
#endif /* USE_PAM */
+#include <libiosexec.h>
+
#include "login.h"
#include "pathnames.h"
--- /dev/null
+PROG= lskq
+
+.include <bsd.prog.mk>
#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
*/
#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>
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' : '-',
switch (filter) {
case EVFILT_VNODE ... EVFILT_READ:
case EVFILT_SOCK:
- case EVFILT_NW_CHANNEL:
return 1;
default:
return 0;
--- /dev/null
+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);
+ }
--- /dev/null
+PROG= lsmp
+SRCS= lsmp.c \
+port_details.c \
+task_details.c
+
+.include <bsd.prog.mk>
#define system_cmds_common_h
#include <mach/mach.h>
-#include <mach_debug/ipc_info.h>
#include "json.h"
#define PROC_NAME_LEN 100
/* 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];
/* 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;
/* 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);
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);
<!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>
*
* @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>
#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
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";
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);
/* 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;
}
{
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);
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);
#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>
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;
}
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;
}
/* 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,
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);
}
}
- 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);
/* 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;
*/
#include <unistd.h>
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <mach_debug/ipc_info.h>
}
}
-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;
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;
}
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) {
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;
}
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);
}
}
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");
}
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];
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);
}
--- /dev/null
+PROG= ltop
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mean
+MAN=
+
+.include <bsd.prog.mk>
*
*/
+typedef char *kobject_description_t[512];
#include <mach/mach.h>
#include <mach/task.h>
#include <mach/thread_act.h>
--- /dev/null
+PROG= memory_pressure
+
+.include <bsd.prog.mk>
* @APPLE_LICENSE_HEADER_END@
*/
+typedef char *kobject_description_t[512];
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
--- /dev/null
+PROG= mkfile
+MAN= mkfile.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= mslutil
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= newgrp
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#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);
--- /dev/null
+PROG= nologin
+MAN= nologin.5 nologin.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+MAN= nvram.8
+
+.include <bsd.prog.mk>
--- /dev/null
+SCRIPTS= pagesize.sh
+MAN= pagesize.1
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
#include <libc.h>
#include <ctype.h>
#include <string.h>
+#include <crypt.h>
#include "passwd.h"
#ifdef __SLICK__
char *p;
static char obuf[_PASSWORD_LEN+1];
static char nbuf[_PASSWORD_LEN+1];
- char salt[9];
printf("Changing password for %s.\n", name);
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;
--- /dev/null
+PROG= proc_uuid_policy
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= purge
+MAN= purge.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+PROG= reboot
+MAN= reboot.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
#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
#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)
--- /dev/null
+PROG= sa
+MAN= sa.8
+SRCS= db.c main.c pdb.c usrdb.c
+
+CFLAGS+=-DAHZV1=AHZ
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= sc_usage
+
+LDADD+=-lncursesw -liosexec
+
+.include <bsd.prog.mk>
#include <err.h>
#include <libutil.h>
+#include <libiosexec.h>
+
/* Number of lines of header information on the standard screen */
#define HEADER_LINES 5
--- /dev/null
+PROG= shutdown
+MAN= shutdown.8
+
+LDADD+=-lbsm -framework IOKit -liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#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>
#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
#include "pathnames.h"
#endif /* __APPLE__ */
+#include <libiosexec.h>
+
+int reboot3(int);
+
#ifdef DEBUG
#undef _PATH_NOLOGIN
#define _PATH_NOLOGIN "./nologin"
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
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",
exit(1);
}
-#ifdef __APPLE__
/*
* The following tokens are included in the audit record for shutdown
* header
return 1;
}
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
static bool
kextdDisabled(void)
--- /dev/null
+PROG= stackshot
+MAN=
+
+LDADD+=-liosexec
+
+.include <bsd.prog.mk>
#include <kern/kcdata.h>
+#include <libiosexec.h>
+
static uint64_t
stackshot_get_mach_absolute_time(void *buffer, uint32_t size)
{
--- /dev/null
+PROG= sync
+MAN= sync.8
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= sysctl
+MAN= sysctl.8 sysctl.conf.5
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= taskpolicy
+MAN= taskpolicy.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#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>
--- /dev/null
+PROG= trace
+
+LDADD+=-lutil
+
+.include <bsd.prog.mk>
* 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>
--- /dev/null
+PROG= vifs
+MAN= vifs.8
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#include <unistd.h>
#include <signal.h>
+#include <libiosexec.h>
+
char *warning = "\
#\n\
# Warning - this file should only be modified with vifs(8)\n\
--- /dev/null
+PROG= vipw
+MAN= vipw.8
+SRCS= pw_util.c vipw.c
+
+LDADD+=-liosexec
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
#include <string.h>
#include <unistd.h>
+#include <libiosexec.h>
+
#include "pw_util.h"
extern char *tempname;
--- /dev/null
+PROG= vm_purgeable_stat
+
+.include <bsd.prog.mk>
<!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>
* @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>
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;
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);
--- /dev/null
+MAN= vm_stat.1
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= wait4path
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= wordexp-helper
+MAN=
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= zdump
+MAN= zdump.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
--- /dev/null
+# $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>
--- /dev/null
+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>
--- /dev/null
+.include "../Makefile.inc"
--- /dev/null
+PROG= banner
+MAN= banner.6
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= cat
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= col
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= colrm
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= column
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= comm
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= csplit
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= cut
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
-# 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>
#include <pwd.h>
#include <locale.h>
+#include <libiosexec.h>
+
#ifdef HAS_SYS_WAIT
#include <sys/wait.h>
#endif
--- /dev/null
+PROG= expand
+MLINKS= expand.1 unexpand.1
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= fmt
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= fold
+
+.include <bsd.prog.mk>
--- /dev/null
+# $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>
--- /dev/null
+PROG= head
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= join
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= lam
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= look
+
+.include <bsd.prog.mk>
--- /dev/null
+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>
--- /dev/null
+PROG= nl
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= paste
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= pr
+SRCS= egetopt.c pr.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= rev
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= rs
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= sed
+SRCS= compile.c \
+main.c \
+misc.c \
+process.c
+
+.include <bsd.prog.mk>
--- /dev/null
+# $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>
{
struct bwstring *k; /* key string */
struct key_hint hint[0]; /* key sort hint */
-} __packed;
+};
/*
* Set of keys container object.
--- /dev/null
+PROG= split
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= tail
+SRCS= forward.c misc.c read.c reverse.c tail.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= tr
+SRCS= cmap.c cset.c str.c tr.c
+
+.include <bsd.prog.mk>
--- /dev/null
+/*-
+ * 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;
+}
--- /dev/null
+/*-
+ * 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_ */
--- /dev/null
+/*-
+ * 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_ */
* 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)
--- /dev/null
+/*
+ * 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_ */
--- /dev/null
+PROG= ul
+
+LDADD+=-lncursesw
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= unexpand
+MAN=
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= uniq
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= unvis
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= vis
+SRCS= foldit.c vis.c
+
+.include <bsd.prog.mk>
--- /dev/null
+PROG= wc
+
+.include <bsd.prog.mk>