Skip to content

pcbsd/NextBSD

Repository files navigation

This is the darwin-support branch. It adds support for a subset of the mach APIs
to enable FreeBSD to run some of the OSX daemons.

It is currently only supported as a module to workaround the limited typeid space (15 bits) of
dtrace.

To enable booting launchd, add the following lines /boot/loader.conf:
##############################################################
###  Darwin Kernel settings  ########################################
##############################################################

init_path="/sbin/launchd"
mach_load="YES"



If there are problems in mach that prevent the system from booting completely you
can disable launchd by dropping to the loader prompt (3) and typing:
set init_path=/sbin/init

If you disable launchd you will need to start devd by hand

Immediate issues:
migcom is building during bootstrap but includes target headers - it needs to be
refactored to not include any special headers and only use self-contained defines


Unsupported OSX / Mach functionality:
 - updating the audit token when setuid/setgid/ etc are called
 - memory object creation (used in parts of libdispatch)
 - voucher ports (used only by most recent parts of libdispatch)
 - BSM audit functionality for mach sessions


Missing mach features ordered by version of launchd by which they'll be supported:

v1:
Support:
- MACH_SEND_NOTIFY

kevent flags needed by (at least) libdispatch:
- EVFILT_VM
	- NOTE_VM_PRESSURE
	- NOTE_VM_ERROR

per-user & per-session launchds (xpc domain system in domain.defs)
 - The audit session system calls: audit_session_self, audit_session_join,
   and audit_session_port


extended posix_spawnattr calls in support/posix_spawn.c are not expected
to actually work yet, among others:
- posix_spawnattr_setbinpref_np
- posix_spawnattr_getbinpref_np

proc_setpcontrol
proc_get_dirty
proc_set_dirty
proc_track_dirty


v2 or later:

- AF_SYSTEM domain sockets and the event protocols

- XPC_JETSAM_BANDs (handle memory pressure)

I/O priority setting functionality - system call:
__iopolicysys supports:
	- getiopolicy_np
	- setiopolicy_np


- except NOTE_EXIT_MEMORY of questionable relevance
#define	NOTE_EXIT_DETAIL	0x02000000	/* provide details on reasons for exit */
/*
 * If NOTE_EXIT_DETAIL is present, these bits indicate specific reasons for exiting.
 */
#define NOTE_EXIT_DETAIL_MASK		0x00070000
#define	NOTE_EXIT_DECRYPTFAIL		0x00010000 
#define	NOTE_EXIT_MEMORY		0x00020000
#define NOTE_EXIT_CSERROR		0x00040000





This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree.  See build(7)
and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The `buildkernel` and `installkernel` targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process.  See build(7), config(8),
and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
for more information.

Note: If you want to build and install the kernel with the
`buildkernel` and `installkernel` targets, you might need to build
world before.  More information is available in the handbook.

The kernel configuration files reside in the sys/<arch>/conf
sub-directory.  GENERIC is the default configuration used in release builds.
NOTES contains entries and documentation for all possible
devices, not just those commonly used.


Source Roadmap:
---------------

bin		System/user commands.

cddl		Various commands and libraries under the Common Development
		and Distribution License.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tests		Regression tests which can be run by Kyua.  See tests/README
		for additional information.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html