···126126chmod a+rw /dev/mach
127127````
128128129129+### Prefixes
130130+131131+Darling has support for DPREFIXes, which are very similar to WINEPREFIXes. They are virtual “chroot” environments with an macOS-like filesystem structure, where you can install software safely. The default DPREFIX location is `~/.darling`, but this can be changed by exporting an identically named environment variable. A prefix is automatically created and initialized on first use.
132132+133133+Please note that we use `overlayfs` for creating prefixes, and so we cannot support putting prefix on a filesystem like NFS or eCryptfs. In particular, the default prefix location won't work if you have an encrypted home directory.
134134+129135### Hello world
130136131137Let's start with a Hello world:
+2
etc/udev/rules.d/00-darling-mach.rules
···11+# Make /dev/mach accessible by all users
22+KERNEL=="mach", NAME="mach", MODE="0666"
+5-5
kernel-include/i386/_types.h
···22 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
33 *
44 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55- *
55+ *
66 * This file contains Original Code and/or Modifications of Original Code
77 * as defined in and that are subject to the Apple Public Source License
88 * Version 2.0 (the 'License'). You may not use this file except in
···1111 * unlawful or unlicensed copies of an Apple operating system, or to
1212 * circumvent, violate, or enable the circumvention or violation of, any
1313 * terms of an Apple operating system software license agreement.
1414- *
1414+ *
1515 * Please obtain a copy of the License at
1616 * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717- *
1717+ *
1818 * The Original Code and all software distributed under the License are
1919 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
···2222 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323 * Please see the License for the specific language governing rights and
2424 * limitations under the License.
2525- *
2525+ *
2626 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727 */
2828#ifndef _BSD_I386__TYPES_H_
···106106107107typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
108108109109-#if defined(__GNUC__) && defined(__WINT_TYPE__)
109109+#if defined(__GNUC__) && defined(__WINT_TYPE__) && !defined(DARLING)
110110typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
111111#else
112112typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
+5-5
platform-include/i386/_types.h
···22 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
33 *
44 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
55- *
55+ *
66 * This file contains Original Code and/or Modifications of Original Code
77 * as defined in and that are subject to the Apple Public Source License
88 * Version 2.0 (the 'License'). You may not use this file except in
···1111 * unlawful or unlicensed copies of an Apple operating system, or to
1212 * circumvent, violate, or enable the circumvention or violation of, any
1313 * terms of an Apple operating system software license agreement.
1414- *
1414+ *
1515 * Please obtain a copy of the License at
1616 * http://www.opensource.apple.com/apsl/ and read it before using this file.
1717- *
1717+ *
1818 * The Original Code and all software distributed under the License are
1919 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2020 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
···2222 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2323 * Please see the License for the specific language governing rights and
2424 * limitations under the License.
2525- *
2525+ *
2626 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
2727 */
2828#ifndef _BSD_I386__TYPES_H_
···108108109109typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
110110111111-#if defined(__WINT_TYPE__)
111111+#if defined(__WINT_TYPE__) && !defined(DARLING)
112112typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
113113#else
114114typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
···2323#define _DARLING_H_
24242525void showHelp(const char* argv0);
2626+void showVersion(const char* argv0);
26272728// Reports that this executable is not setuid root
2829void missingSetuidRoot(void);
+12-1
src/kernel/emulation/linux/signal/sigaction.c
···26262727 linux_signum = signum_bsd_to_linux(signum);
2828 if (linux_signum == 0)
2929- return -EINVAL;
2929+ {
3030+ // Some software (e.g. Node.js) tries to set up handlers for all signals by
3131+ // walking through all signal numbers incrementally. They end up hitting
3232+ // signals that don't exist on Linux and then bail out if they receive
3333+ // an error.
3434+ // Fake that everyting is all right.
3535+3636+ if (osa != NULL)
3737+ memset(osa, 0, sizeof(*osa));
3838+3939+ return 0;
4040+ }
30413142 if (nsa != NULL)
3243 {
+1-1
src/kernel/emulation/linux/stat/fstatfs.c
···3636 int max_len = 0;
37373838#ifdef __NR_fstatfs64
3939- ret = LINUX_SYSCALL2(__NR_fstatfs64, fd, &lbuf);
3939+ ret = LINUX_SYSCALL3(__NR_fstatfs64, fd, sizeof(lbuf), &lbuf);
4040#else
4141 ret = LINUX_SYSCALL2(__NR_fstatfs, fd, &lbuf);
4242#endif