]> git.cameronkatri.com Git - apple_cmds.git/commitdiff
system_cmds: shutdown may not work
authorCameron Katri <me@cameronkatri.com>
Wed, 12 May 2021 20:08:47 +0000 (16:08 -0400)
committerCameron Katri <me@cameronkatri.com>
Wed, 12 May 2021 20:08:47 +0000 (16:08 -0400)
63 files changed:
Makefile.inc
setup.sh
system_cmds/Makefile [new file with mode: 0644]
system_cmds/Makefile.inc
system_cmds/ac.tproj/Makefile [new file with mode: 0644]
system_cmds/accton.tproj/Makefile [new file with mode: 0644]
system_cmds/arch.tproj/Makefile [new file with mode: 0644]
system_cmds/arch.tproj/arch.c
system_cmds/at.tproj/Makefile [new file with mode: 0644]
system_cmds/atrun.tproj/Makefile [new file with mode: 0644]
system_cmds/chkpasswd.tproj/Makefile [new file with mode: 0644]
system_cmds/chkpasswd.tproj/passwd.c
system_cmds/cpuctl.tproj/Makefile [new file with mode: 0644]
system_cmds/dmesg.tproj/Makefile [new file with mode: 0644]
system_cmds/dynamic_pager.tproj/Makefile [new file with mode: 0644]
system_cmds/fs_usage.tproj/Makefile [new file with mode: 0644]
system_cmds/gcore.tproj/Makefile [new file with mode: 0644]
system_cmds/gcore.tproj/convert.c
system_cmds/gcore.tproj/vm.c
system_cmds/getconf.tproj/Makefile [new file with mode: 0644]
system_cmds/getty.tproj/Makefile [new file with mode: 0644]
system_cmds/hostinfo.tproj/Makefile [new file with mode: 0644]
system_cmds/iosim.tproj/Makefile [new file with mode: 0644]
system_cmds/iostat.tproj/Makefile [new file with mode: 0644]
system_cmds/kpgo.tproj/Makefile [new file with mode: 0644]
system_cmds/latency.tproj/Makefile [new file with mode: 0644]
system_cmds/login.tproj/Makefile [new file with mode: 0644]
system_cmds/lskq.tproj/Makefile [new file with mode: 0644]
system_cmds/lskq.tproj/lskq.c
system_cmds/lsmp.tproj/Makefile [new file with mode: 0644]
system_cmds/ltop.tproj/Makefile [new file with mode: 0644]
system_cmds/mean.tproj/Makefile [new file with mode: 0644]
system_cmds/memory_pressure.tproj/Makefile [new file with mode: 0644]
system_cmds/mkfile.tproj/Makefile [new file with mode: 0644]
system_cmds/mslutil/Makefile [new file with mode: 0644]
system_cmds/newgrp.tproj/Makefile [new file with mode: 0644]
system_cmds/nologin.tproj/Makefile [new file with mode: 0644]
system_cmds/nvram.tproj/Makefile [new file with mode: 0644]
system_cmds/pagesize.tproj/Makefile [new file with mode: 0644]
system_cmds/passwd.tproj/Makefile [new file with mode: 0644]
system_cmds/passwd.tproj/passwd.c
system_cmds/proc_uuid_policy.tproj/Makefile [new file with mode: 0644]
system_cmds/purge.tproj/Makefile [new file with mode: 0644]
system_cmds/pwd_mkdb.tproj/Makefile [new file with mode: 0644]
system_cmds/reboot.tproj/Makefile [new file with mode: 0644]
system_cmds/reboot.tproj/reboot.c
system_cmds/sa.tproj/Makefile [new file with mode: 0644]
system_cmds/sc_usage.tproj/Makefile [new file with mode: 0644]
system_cmds/shutdown.tproj/Makefile [new file with mode: 0644]
system_cmds/shutdown.tproj/shutdown.c
system_cmds/stackshot.tproj/Makefile [new file with mode: 0644]
system_cmds/sync.tproj/Makefile [new file with mode: 0644]
system_cmds/sysctl.tproj/Makefile [new file with mode: 0644]
system_cmds/taskpolicy.tproj/Makefile [new file with mode: 0644]
system_cmds/trace.tproj/Makefile [new file with mode: 0644]
system_cmds/vifs.tproj/Makefile [new file with mode: 0644]
system_cmds/vipw.tproj/Makefile [new file with mode: 0644]
system_cmds/vm_purgeable_stat.tproj/Makefile [new file with mode: 0644]
system_cmds/vm_stat.tproj/Makefile [new file with mode: 0644]
system_cmds/wait4path/Makefile [new file with mode: 0644]
system_cmds/wordexp-helper.tproj/Makefile [new file with mode: 0644]
system_cmds/zdump.tproj/Makefile [new file with mode: 0644]
system_cmds/zic.tproj/Makefile [new file with mode: 0644]

index 7fd683e76670ee6b6ce4afe759ce5863e7eec876..6979e4930c482e9a76039013836d53abc71e1c6c 100644 (file)
@@ -1,2 +1,6 @@
 RPCGEN?=rpcgen
 STRIP=
+SHAREDIR=/usr/share/
+.if !defined(BINDIR)
+BINDIR=/usr/bin
+.endif
index 563cba79512cd8e5e5bf4acf57429105d6057bc8..c2026adfcf24fe3f4f2fd3de1b19a4e4ff41aa4c 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -1,15 +1,14 @@
 #!/bin/sh
-mkdir -p base/include/sys/ base/include/os/ base/include/mach/ 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
+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
 
 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/sys/proc*.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/shared_memory_server.h base/include/mach
+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
@@ -30,21 +29,38 @@ 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
 
 wget -q -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/nls/FreeBSD/msgcat.h
+wget -q -nc -Pbase/include https://opensource.apple.com/source/libmalloc/libmalloc-317.40.8/private/stack_logging.h
 wget -q -nc -Pbase/include/os https://opensource.apple.com/source/Libc/Libc-1439.40.11/os/assumes.h
+wget -q -nc -Pbase/include https://opensource.apple.com/source/Libc/Libc-1439.40.11/include/libc.h
 wget -q -nc -Pbase/include https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/_simple.h
 wget -q -nc -Pbase/include/os https://opensource.apple.com/source/libplatform/libplatform-126.1.2/include/os/base_private.h
 wget -q -nc -Pbase/include/System/uuid/ https://opensource.apple.com/source/Libc/Libc-1439.40.11/uuid/namespace.h
 wget -q -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/mntopts.h
 wget -q -nc -Pbase/include https://opensource.apple.com/source/libutil/libutil-58.40.2/libutil.h
 wget -q -nc -Pbase/include https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/membership.subproj/membershipPriv.h
+wget -q -nc -Pbase/include/rpc https://opensource.apple.com/source/Libinfo/Libinfo-542.40.3/rpc.subproj/pmap_clnt.h
 wget -q -nc -Pbase/include/CommonCrypto https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60118.30.2/include/CommonDigestSPI.h
-wget -q -nc -Pbase/include https://opensource.apple.com/source/launchd/launchd-842.92.1/liblaunch/vproc_priv.h
-wget -q -nc -Pbase/include/bsm https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/bsm/audit_kevents.h
+wget -q -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 -nc -Pbase/include/bsm \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/bsm/audit_kevents.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/bsm/audit_record.h
 chmod -Rf u+w base/include
+wget -q -nc -Pbase/include/libkern \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSTypes.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSReturn.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSKextLib.h
+wget -q -nc -Pbase/include/Kernel/libkern \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSKextLibPrivate.h
+wget -q -nc -Pbase/include/System/libkern \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/libkern/OSKextLibPrivate.h
 wget -q -nc -Pbase/include/os \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/log_private.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/os/log.h \
@@ -55,7 +71,15 @@ wget -q -nc -Pbase/include/firehose \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/firehose/tracepoint_private.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/libkern/firehose/firehose_types_private.h
 wget -q -nc -Pbase/include/machine https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/machine/cpu_capabilities.h
+wget -q -nc -Pbase/include/Kernel/kern https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/kern/ledger.h
+wget -q -nc -Pbase/include/kern \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/kern/debug.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/kern/kcdata.h
+wget -q -nc -Pbase/include/System/machine https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/machine/cpu_capabilities.h
 wget -q -nc -Pbase/include/System/arm https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/arm/cpu_capabilities.h
+wget -q -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/mach/coalition.h
+wget -q -nc -Pbase/include/mach https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/mach/vm_statistics.h
+ln -sf mach/vm_statistics.h base/include/vm_statistics.h
 wget -q -nc -Pbase/include/netinet6 \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/in6_var.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/netinet6/in6_pcb.h \
@@ -127,6 +151,15 @@ wget -q -nc -Pbase/include/sys \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/shm_internal.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/mtio.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/unpcb.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/pgo.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kdebug.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys_private/kdebug_private.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/proc_info.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kern_memorystatus.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/ptrace.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/stackshot.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/spawn_internal.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/resource.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/sockio.h
 wget -q -nc -Pbase/include/corecrypto \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/ccsha2.h \
@@ -135,6 +168,36 @@ wget -q -nc -Pbase/include/corecrypto \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/cc_config.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/ccn.h \
        https://opensource.apple.com/source/xnu/xnu-7195.81.3/EXTERNAL_HEADERS/corecrypto/cc_error.h
+wget -q -nc -Pbase/include/System/sys \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/proc_uuid_policy.h \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/sys/kdebug.h
+wget -q -nc -Pbase/include/dispatch \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/queue_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/workloop_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/source_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/mach_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/data_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/io_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/layout_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/time_private.h \
+       https://opensource.apple.com/source/libdispatch/libdispatch-1271.40.12/private/benchmark.h
+wget -q -nc -Pbase/include/IOKit \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/iokit/IOKit/IOKitKeysPrivate.h
+wget -q -nc -Pbase/include/Kernel/IOKit \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/iokit/IOKit/IOKitDebug.h
+wget -q -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 -nc -Pbase/include \
+       https://opensource.apple.com/source/xnu/xnu-7195.81.3/libsyscall/wrappers/spawn/spawn_private.h
+wget -q -nc -Pbase/include/mach-o \
+       https://opensource.apple.com/source/dyld/dyld-832.7.3/include/mach-o/dyld_process_info.h
+
+sed -i '' -E 's/__API_UNAVAILABLE\(.*\)//g' base/include/mach-o/dyld_process_info.h
+sed -i '' -E 's/DISPATCH_ENUM_API_AVAILABLE\(.*\)//g' base/include/dispatch/source_private.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
 
 CC=aarch64-apple-darwin-clang
 CXX=aarch64-apple-darwin-clang++
diff --git a/system_cmds/Makefile b/system_cmds/Makefile
new file mode 100644 (file)
index 0000000..89852eb
--- /dev/null
@@ -0,0 +1,52 @@
+SUBDIR=        ac.tproj \
+       accton.tproj \
+       arch.tproj \
+       at.tproj \
+       atrun.tproj \
+       chkpasswd.tproj \
+       cpuctl.tproj \
+       dmesg.tproj \
+       dynamic_pager.tproj \
+       gcore.tproj \
+       getconf.tproj \
+       getty.tproj \
+       hostinfo.tproj \
+       iosim.tproj \
+       iostat.tproj \
+       kpgo.tproj \
+       latency.tproj \
+       login.tproj \
+       lskq.tproj \
+       lsmp.tproj \
+       ltop.tproj \
+       mean.tproj \
+       memory_pressure.tproj \
+       mkfile.tproj \
+       mslutil \
+       newgrp.tproj \
+       nologin.tproj \
+       nvram.tproj \
+       pagesize.tproj \
+       passwd.tproj \
+       proc_uuid_policy.tproj \
+       purge.tproj \
+       pwd_mkdb.tproj \
+       reboot.tproj \
+       sa.tproj \
+       sc_usage.tproj \
+       shutdown.tproj \
+       stackshot.tproj \
+       sync.tproj \
+       sysctl.tproj \
+       taskpolicy.tproj \
+       trace.tproj \
+       vifs.tproj \
+       vipw.tproj \
+       vm_purgeable_stat.tproj \
+       vm_stat.tproj \
+       wait4path \
+       wordexp-helper.tproj \
+       zdump.tproj \
+       zic.tproj
+
+.include <bsd.subdir.mk>
index 01b5f23410c841bf51e05b95e22841fb657be42a..b098e9713c77a85052ff169fd7f72e3fd1986caa 100644 (file)
@@ -1 +1,3 @@
+CFLAGS+=-DDAEMON_UID=1 -DDAEMON_GID=1 -DDEFAULT_AT_QUEUE=\'a\' -DDEFAULT_BATCH_QUEUE=\'b\' -DPERM_PATH=\"/usr/lib/cron/\" -DPRIVATE
+
 .include "../Makefile.inc"
diff --git a/system_cmds/ac.tproj/Makefile b/system_cmds/ac.tproj/Makefile
new file mode 100644 (file)
index 0000000..999d22b
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  ac
+MAN=   ac.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/accton.tproj/Makefile b/system_cmds/accton.tproj/Makefile
new file mode 100644 (file)
index 0000000..3690047
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  accton
+MAN=   accton.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/arch.tproj/Makefile b/system_cmds/arch.tproj/Makefile
new file mode 100644 (file)
index 0000000..224450b
--- /dev/null
@@ -0,0 +1,7 @@
+PROG=  arch
+MAN=   arch.1 machine.1
+LINKS= ${BINDIR}/arch ${BINDIR}/machine
+
+LDADD+=-framework CoreFoundation
+
+.include <bsd.prog.mk>
index b522ce8ffcc20c2059e9342e0a65bf44272454de..326b541b1951a4b9f6e59a245ee3007269a7e63c 100644 (file)
@@ -40,7 +40,6 @@
 #include <sys/fcntl.h>
 #include <glob.h>
 #include <CoreFoundation/CoreFoundation.h>
-#include <NSSystemDirectories.h>
 #include <sysdir.h>
 
 #if defined(__x86_64__)
diff --git a/system_cmds/at.tproj/Makefile b/system_cmds/at.tproj/Makefile
new file mode 100644 (file)
index 0000000..f67fb15
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  at
+SRCS=  at.c panic.c parsetime.c \
+       perm.c
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/atrun.tproj/Makefile b/system_cmds/atrun.tproj/Makefile
new file mode 100644 (file)
index 0000000..39f4411
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  atrun
+MAN=   atrun.8
+SRCS=  atrun.c gloadavg.c
+
+CFLAGS+=-I${.CURDIR}/../at.tproj -DPROC_DIR=\"/proc\"
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/chkpasswd.tproj/Makefile b/system_cmds/chkpasswd.tproj/Makefile
new file mode 100644 (file)
index 0000000..9f13009
--- /dev/null
@@ -0,0 +1,10 @@
+PROG=  chkpasswd
+MAN=   chkpasswd.8
+SRCS=  file_passwd.c pam_passwd.c \
+       passwd.c stringops.c
+
+LDADD+=-lpam
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
index bff82809172ed282d614a8eee491efeeb2a42fd3..452de74de95f7fb0f3c3e2f183d0b930e4277945 100644 (file)
@@ -160,10 +160,10 @@ main(int argc, char *argv[])
                        file_check_passwd(user, locn);
                        break;
                case INFO_NIS:
-                       nis_check_passwd(user, locn);
+               //      nis_check_passwd(user, locn);
                        break;
                case INFO_OPEN_DIRECTORY:
-                       od_check_passwd(user, locn);
+               //      od_check_passwd(user, locn);
                        break;
                case INFO_PAM:
                        pam_check_passwd(user);
diff --git a/system_cmds/cpuctl.tproj/Makefile b/system_cmds/cpuctl.tproj/Makefile
new file mode 100644 (file)
index 0000000..4a51f7b
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  cpuctl
+MAN=   cpuctl.8
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/dmesg.tproj/Makefile b/system_cmds/dmesg.tproj/Makefile
new file mode 100644 (file)
index 0000000..01e7165
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  dmesg
+MAN=   dmesg.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/dynamic_pager.tproj/Makefile b/system_cmds/dynamic_pager.tproj/Makefile
new file mode 100644 (file)
index 0000000..6227af5
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  dynamic_pager
+MAN=   dynamic_pager.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/fs_usage.tproj/Makefile b/system_cmds/fs_usage.tproj/Makefile
new file mode 100644 (file)
index 0000000..e920168
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  fs_usage
+MAN=   fs_usage.1
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/gcore.tproj/Makefile b/system_cmds/gcore.tproj/Makefile
new file mode 100644 (file)
index 0000000..78b3db6
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  gcore
+MAN=   gcore-internal.1 gcore.1
+SRCS=  convert.c corefile.c dyld_shared_cache.c \
+       dyld.c main.c sparse.c threads.c utils.c \
+       vanilla.c vm.c
+
+LDADD+=-lutil -lcompression
+
+.include <bsd.prog.mk>
index b9457336dcbd57cdc806b1901f081a44e6676245..a3b41f3b0194a81078f9cd700e4ec665adcf588c 100644 (file)
@@ -29,7 +29,8 @@
 #include <spawn.h>
 #include <signal.h>
 #include <xpc/xpc.h>
-#include <xpc/private.h>
+/* Declare xpc_create_from_plist manually because xpc/private.h is closed source */
+xpc_object_t xpc_create_from_plist(void *data, size_t size);
 #include <sys/event.h>
 #include <sys/time.h>
 
index 22b0efe2b7413ac2b3851e2bb54e5c26a7fda98e..3c4e7e6291081b3800f99a9ed5d2494dc4a7cccc 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 #include <assert.h>
 #include <sys/queue.h>
+#include <machine/cpu_capabilities.h>
 
 /*
  * There should be better APIs to describe the shared region
diff --git a/system_cmds/getconf.tproj/Makefile b/system_cmds/getconf.tproj/Makefile
new file mode 100644 (file)
index 0000000..a5b230d
--- /dev/null
@@ -0,0 +1,41 @@
+# $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}
+
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/getty.tproj/Makefile b/system_cmds/getty.tproj/Makefile
new file mode 100644 (file)
index 0000000..8f3fe06
--- /dev/null
@@ -0,0 +1,7 @@
+PROG=  getty
+MAN=   getty.8 gettytab.5 ttys.5
+SRCS=  chat.c init.c main.c subr.c
+
+BINDIR=/usr/libexec
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/hostinfo.tproj/Makefile b/system_cmds/hostinfo.tproj/Makefile
new file mode 100644 (file)
index 0000000..78473a2
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  hostinfo
+MAN=   hostinfo.8
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/iosim.tproj/Makefile b/system_cmds/iosim.tproj/Makefile
new file mode 100644 (file)
index 0000000..f573337
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  iosim
+
+CFLAGS+=-I${.CURDIR}/../at.tproj
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/bin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/iostat.tproj/Makefile b/system_cmds/iostat.tproj/Makefile
new file mode 100644 (file)
index 0000000..b86524b
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  iostat
+MAN=   iostat.8
+
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/kpgo.tproj/Makefile b/system_cmds/kpgo.tproj/Makefile
new file mode 100644 (file)
index 0000000..25abe7f
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  kpgo
+MAN=   
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/latency.tproj/Makefile b/system_cmds/latency.tproj/Makefile
new file mode 100644 (file)
index 0000000..8e69a31
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  latency
+
+LDADD+=-lncursesw -lutil
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/login.tproj/Makefile b/system_cmds/login.tproj/Makefile
new file mode 100644 (file)
index 0000000..8a5ee71
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  login
+SRCS=  klogin.c login_audit.c login.c
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/lskq.tproj/Makefile b/system_cmds/lskq.tproj/Makefile
new file mode 100644 (file)
index 0000000..b034a0b
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  lskq
+
+.include <bsd.prog.mk>
index a48bb26100c6649137dc8194d2b1353ec38e663c..d19f72271e22a30e4e40f0a32da8dc28315c1b73 100644 (file)
@@ -36,9 +36,7 @@
 #include <sys/param.h>
 #include <pthread/pthread.h>
 #include <mach/message.h>
-#define PRIVATE
 #include <libproc.h>
-#undef PRIVATE
 #include <os/assumes.h>
 #include <os/overflow.h>
 
@@ -181,7 +179,6 @@ filter_is_fd_type(int filter)
        switch (filter) {
        case EVFILT_VNODE ... EVFILT_READ:
        case EVFILT_SOCK:
-       case EVFILT_NW_CHANNEL:
                return 1;
        default:
                return 0;
diff --git a/system_cmds/lsmp.tproj/Makefile b/system_cmds/lsmp.tproj/Makefile
new file mode 100644 (file)
index 0000000..5c3c5bd
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  lsmp
+SRCS=  lsmp.c \
+port_details.c \
+task_details.c
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/ltop.tproj/Makefile b/system_cmds/ltop.tproj/Makefile
new file mode 100644 (file)
index 0000000..4ce4899
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  ltop
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/mean.tproj/Makefile b/system_cmds/mean.tproj/Makefile
new file mode 100644 (file)
index 0000000..cb287f6
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  mean
+MAN=   
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/memory_pressure.tproj/Makefile b/system_cmds/memory_pressure.tproj/Makefile
new file mode 100644 (file)
index 0000000..8d4a1ed
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  memory_pressure
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/mkfile.tproj/Makefile b/system_cmds/mkfile.tproj/Makefile
new file mode 100644 (file)
index 0000000..666e804
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  mkfile
+MAN=   mkfile.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/mslutil/Makefile b/system_cmds/mslutil/Makefile
new file mode 100644 (file)
index 0000000..5ac99a6
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  mslutil
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/newgrp.tproj/Makefile b/system_cmds/newgrp.tproj/Makefile
new file mode 100644 (file)
index 0000000..80e97c1
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  newgrp
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/nologin.tproj/Makefile b/system_cmds/nologin.tproj/Makefile
new file mode 100644 (file)
index 0000000..2e009b3
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  nologin
+MAN=   nologin.5 nologin.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/nvram.tproj/Makefile b/system_cmds/nvram.tproj/Makefile
new file mode 100644 (file)
index 0000000..f53da40
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  nvram
+MAN=   nvram.8
+
+CFLAGS+=-DTARGET_OS_BRIDGE=0
+LDADD+=-framework CoreFoundation -framework IOKit
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/pagesize.tproj/Makefile b/system_cmds/pagesize.tproj/Makefile
new file mode 100644 (file)
index 0000000..7efe016
--- /dev/null
@@ -0,0 +1,4 @@
+SCRIPTS=       pagesize.sh
+MAN=   pagesize.1
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/passwd.tproj/Makefile b/system_cmds/passwd.tproj/Makefile
new file mode 100644 (file)
index 0000000..7dcc91f
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  passwd
+MAN=   passwd.1
+SRCS=  file_passwd.c nis_passwd.c od_passwd.c \
+       pam_passwd.c passwd.c
+
+LDADD+=-lcrypt
+
+.include <bsd.prog.mk>
index 877036e26466e5889d966d110f7f960c238636bb..663a40dcab81bce91874483bf215717afe834488 100644 (file)
@@ -30,6 +30,7 @@
 #include <libc.h>
 #include <ctype.h>
 #include <string.h>
+#include <crypt.h>
 #include "passwd.h"
 
 #ifdef __SLICK__
@@ -50,7 +51,6 @@ getpasswd(char *name, int isroot, int minlen, int mixcase, int nonalpha,
        char *p;
        static char obuf[_PASSWORD_LEN+1];
        static char nbuf[_PASSWORD_LEN+1];
-       char salt[9];
 
        printf("Changing password for %s.\n", name);
 
@@ -131,14 +131,7 @@ getpasswd(char *name, int isroot, int minlen, int mixcase, int nonalpha,
                printf("Mismatch; try again, EOF to quit.\n");
        }
 
-       /*
-        * Create a random salt
-        */
-       srandom((int)time((time_t *)NULL));
-       salt[0] = saltchars[random() % strlen(saltchars)];
-       salt[1] = saltchars[random() % strlen(saltchars)];
-       salt[2] = '\0';
-       *new_pw = crypt(nbuf, salt);
+       *new_pw = crypt(nbuf, crypt_gensalt("$6$", 0, saltchars, strlen(saltchars)));
 
        *old_clear = obuf;
        *new_clear = nbuf;
diff --git a/system_cmds/proc_uuid_policy.tproj/Makefile b/system_cmds/proc_uuid_policy.tproj/Makefile
new file mode 100644 (file)
index 0000000..2902836
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  proc_uuid_policy
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/purge.tproj/Makefile b/system_cmds/purge.tproj/Makefile
new file mode 100644 (file)
index 0000000..bef9cc2
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  purge
+MAN=   purge.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/pwd_mkdb.tproj/Makefile b/system_cmds/pwd_mkdb.tproj/Makefile
new file mode 100644 (file)
index 0000000..0869be5
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  pwd_mkdb
+MAN=   pwd_mkdb.8
+SRCS=  pw_scan.c pwd_mkdb.c
+
+CFLAGS+=-D_PW_NAME_LEN=MAXLOGNAME -D_PW_YPTOKEN=\"__YP!\"
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/reboot.tproj/Makefile b/system_cmds/reboot.tproj/Makefile
new file mode 100644 (file)
index 0000000..d36639a
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  reboot
+MAN=   reboot.8
+
+BINDIR=/sbin
+
+.include <bsd.prog.mk>
index 5478704a8161c4f6c249326d9f70e0fc5f83f366..ce9a019078227c01c8214e4b15346b3a12a6275d 100644 (file)
@@ -74,6 +74,8 @@ __unused static const char rcsid[] =
 #include <sys/time.h>
 #endif
 
+int    reboot3(int);
+
 void usage(void);
 u_int get_pageins(void);
 #if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
diff --git a/system_cmds/sa.tproj/Makefile b/system_cmds/sa.tproj/Makefile
new file mode 100644 (file)
index 0000000..c5efb2a
--- /dev/null
@@ -0,0 +1,9 @@
+PROG=  sa
+MAN=   sa.8
+SRCS=  db.c main.c pdb.c usrdb.c
+
+CFLAGS+=-DAHZV1=AHZ
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/sc_usage.tproj/Makefile b/system_cmds/sc_usage.tproj/Makefile
new file mode 100644 (file)
index 0000000..7253f3b
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  sc_usage
+
+LDADD+=-lncursesw
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/shutdown.tproj/Makefile b/system_cmds/shutdown.tproj/Makefile
new file mode 100644 (file)
index 0000000..4f24191
--- /dev/null
@@ -0,0 +1,8 @@
+PROG=  shutdown
+MAN=   shutdown.8
+
+LDADD+=-lbsm -framework IOKit
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
index 597f9f229626c957093abbc595290cf2c882a7e6..f5d8dd49687c69184ccfee8938ea7f1992e0d222 100644 (file)
@@ -71,8 +71,10 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
 #include <vproc.h>
 #include <vproc_priv.h>
 
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
 #include "kextmanager.h"
 #include <IOKit/kext/kextmanager_types.h>
+#endif
 #include <IOKit/pwr_mgt/IOPMLib.h>
 #include <mach/mach_port.h>            // allocate
 #include <mach/mach.h>                 // task_self, etc
@@ -84,6 +86,8 @@ __FBSDID("$FreeBSD: src/sbin/shutdown/shutdown.c,v 1.28 2005/01/25 08:40:51 delp
 #include "pathnames.h"
 #endif /* __APPLE__ */
 
+int    reboot3(int);
+
 #ifdef DEBUG
 #undef _PATH_NOLOGIN
 #define        _PATH_NOLOGIN   "./nologin"
@@ -139,8 +143,8 @@ void nolog(void);
 void timeout(int);
 void timewarn(time_t);
 void usage(const char *);
-#ifdef __APPLE__
 int audit_shutdown(int);
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
 int reserve_reboot(void);
 #endif
 
@@ -419,13 +423,13 @@ log_and_exec_reboot_or_halt()
 die_you_gravy_sucking_pig_dog()
 #endif
 {
-#ifndef __APPLE__
-       char *empty_environ[] = { NULL };
-#else
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
        if ((errno = reserve_reboot())) {
                warn("couldn't lock for reboot");
                finish(0);
        }
+#else
+       char *empty_environ[] = { NULL };
 #endif
 
        syslog(LOG_NOTICE, "%s%s by %s: %s",
@@ -670,7 +674,6 @@ usage(const char *cp)
        exit(1);
 }
 
-#ifdef __APPLE__
 /*
  * The following tokens are included in the audit record for shutdown
  * header
@@ -718,6 +721,7 @@ audit_shutdown(int exitstatus)
        return 1;
 }
 
+#if defined(__APPLE__) && !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
 
 static bool
 kextdDisabled(void)
diff --git a/system_cmds/stackshot.tproj/Makefile b/system_cmds/stackshot.tproj/Makefile
new file mode 100644 (file)
index 0000000..97acc8e
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  stackshot
+MAN=   
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/sync.tproj/Makefile b/system_cmds/sync.tproj/Makefile
new file mode 100644 (file)
index 0000000..bfcb191
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  sync
+MAN=   sync.8
+
+BINDIR=/bin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/sysctl.tproj/Makefile b/system_cmds/sysctl.tproj/Makefile
new file mode 100644 (file)
index 0000000..dcfb282
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  sysctl
+MAN=   sysctl.8 sysctl.conf.5
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/taskpolicy.tproj/Makefile b/system_cmds/taskpolicy.tproj/Makefile
new file mode 100644 (file)
index 0000000..726ca66
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  taskpolicy
+MAN=   taskpolicy.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/trace.tproj/Makefile b/system_cmds/trace.tproj/Makefile
new file mode 100644 (file)
index 0000000..84ed106
--- /dev/null
@@ -0,0 +1,5 @@
+PROG=  trace
+
+LDADD+=-lutil
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vifs.tproj/Makefile b/system_cmds/vifs.tproj/Makefile
new file mode 100644 (file)
index 0000000..e1f6a5e
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  vifs
+MAN=   vifs.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vipw.tproj/Makefile b/system_cmds/vipw.tproj/Makefile
new file mode 100644 (file)
index 0000000..ae48e7e
--- /dev/null
@@ -0,0 +1,7 @@
+PROG=  vipw
+MAN=   vipw.8
+SRCS=  pw_util.c vipw.c
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vm_purgeable_stat.tproj/Makefile b/system_cmds/vm_purgeable_stat.tproj/Makefile
new file mode 100644 (file)
index 0000000..6fb7784
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  vm_purgeable_stat
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/vm_stat.tproj/Makefile b/system_cmds/vm_stat.tproj/Makefile
new file mode 100644 (file)
index 0000000..6910739
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  vm_stat
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/wait4path/Makefile b/system_cmds/wait4path/Makefile
new file mode 100644 (file)
index 0000000..9781cb6
--- /dev/null
@@ -0,0 +1,3 @@
+PROG=  wait4path
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/wordexp-helper.tproj/Makefile b/system_cmds/wordexp-helper.tproj/Makefile
new file mode 100644 (file)
index 0000000..864f5b0
--- /dev/null
@@ -0,0 +1,4 @@
+PROG=  wordexp-helper
+MAN=   
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/zdump.tproj/Makefile b/system_cmds/zdump.tproj/Makefile
new file mode 100644 (file)
index 0000000..40111f3
--- /dev/null
@@ -0,0 +1,6 @@
+PROG=  zdump
+MAN=   zdump.8
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>
diff --git a/system_cmds/zic.tproj/Makefile b/system_cmds/zic.tproj/Makefile
new file mode 100644 (file)
index 0000000..87b92fa
--- /dev/null
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PROG=  zic
+MAN=   zic.8
+SRCS=  zic.c ialloc.c scheck.c
+
+CFLAGS+= -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DSTD_INSPIRED -DPCTS
+CFLAGS+= -DHAVE_LONG_DOUBLE -DTZDIR=\"${SHAREDIR}/zoneinfo\" -Demkdir=mkdir
+CFLAGS+= -DHAVE_STRERROR -DHAVE_UNISTD_H
+CFLAGS+= -I${.CURDIR:H} -I${SRCTOP}/contrib/tzcode/stdtime
+
+BINDIR=/usr/sbin
+
+.include <bsd.prog.mk>