1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-09 23:18:31 -04:00

freebsd: add initial support for running on FreeBSD, excluding Bluez,

ppd, and some things. Add a simple wpa_supplicant backend
This commit is contained in:
bbedward
2026-07-19 10:31:48 -04:00
parent 069df80b22
commit 90291bd627
46 changed files with 3168 additions and 209 deletions
+2 -2
View File
@@ -43,9 +43,9 @@ type Buffer struct {
func CreateBuffer(width, height, stride int) (*Buffer, error) {
size := stride * height
fd, err := unix.MemfdCreate("dms-shm", 0)
fd, err := CreateAnonFd("dms-shm")
if err != nil {
return nil, fmt.Errorf("memfd_create: %w", err)
return nil, fmt.Errorf("create shm fd: %w", err)
}
if err := unix.Ftruncate(fd, int64(size)); err != nil {
+28
View File
@@ -0,0 +1,28 @@
package shm
import (
"unsafe"
"golang.org/x/sys/unix"
)
// Mirrors FreeBSD libc memfd_create (lib/libc/gen/memfd_create.c):
// shm_open2(SHM_ANON, O_RDWR, 0, SHM_GROW_ON_WRITE, name).
// x/sys/unix has no wrapper for SYS_shm_open2 (571, sys/sys/syscall.h).
const (
sysShmOpen2 = 571
shmAnon = 1 // SHM_ANON ((char *)1), sys/sys/mman.h
shmGrowOnWrite = 0x2 // SHM_GROW_ON_WRITE, sys/sys/mman.h
)
func CreateAnonFd(name string) (int, error) {
p, err := unix.BytePtrFromString(name)
if err != nil {
return -1, err
}
fd, _, errno := unix.Syscall6(sysShmOpen2, shmAnon, unix.O_RDWR, 0, shmGrowOnWrite, uintptr(unsafe.Pointer(p)), 0)
if errno != 0 {
return -1, errno
}
return int(fd), nil
}
+7
View File
@@ -0,0 +1,7 @@
package shm
import "golang.org/x/sys/unix"
func CreateAnonFd(name string) (int, error) {
return unix.MemfdCreate(name, 0)
}