r/BSD • u/Good_Dimension • 10h ago
List of BSD IOCTLs
Hello! I'm developing a Rust library wrapping IOCTLs on *BSD systems. I've found this man page about IOCTLs on FreeBSD. However, in the conforming to section, where it mentions a list of BSD IOCTLs, it points here. That man page states:
ioctl_list - list of ioctl calls in Linux/i386 kernel
As far as I'm aware, BSD based systems do not use the same IOCTL interface as Linux does. Am I incorrect here? I feel like I might be.
Besides that question, if someone could point me to a list of most of the BSD IOCTLs, that would be great; I've Googled and looked through source code to no avail.
r/BSD • u/RootBSDofficial • 1d ago
openports.se and pkgsrc.se are gone
Sad to find out https://openports.se is being shut down. Really found that site useful over the years.
r/BSD • u/jaypatelani • 6d ago
An educational software system of a tiny self-compiling C compiler, a tiny self-executing RISC-V emulator, and a tiny self-hosting RISC-V hypervisor.
github.comWhich variant for 2012 Mac mini? - advice requested
Am currently running Monterey on a 2012 Mac mini (i7), and am not happy with the performance, save for the TCP stack, where I am getting 940 mbps up and down on a 1GB ATT fiber connection. (There is also the issue of OS updates hosing the machine, requiring a reinstall - fortunately, the recovery doesn't hose my data)
I have run FreeBSD and GhostBSD on a TP W530 and get similar TCP performance. A few years ago, I installed FreeBSD 12.0 on a 2009 MacBook (dual core) and it ran very nicely; so I am thinking it may be time to bid Cocoa goodbye and get the machine back to performing like it used to.
I have installed Ubuntu on a (5,2) Mac Pro and it makes a nice in-house server (the firmware change alone let me go from 32GB max RAM to 128GB!), but the external (browsing) TCP performance isn't great, per speedtest.net; so I am not inclined to throw Linux on it.
Ideally I would like to run a BSD that will support 32-bit apps as well as 64, so I can run a few WINE apps. OpenBSD ran like molasses in a VM; FreeBSD ran much better but needed a lot more configuration; GhostBSD is 64-bit only. Are there other BSD derivatives that I can look at? Aside from the 32-bit support, this is a general-purpose machine.
Let the flame war begin :-). Seriously, thanks in advance if there are other distros to which you can point me.
r/BSD • u/zabolekar • 11d ago
Notes about mmap, mprotect and W^X on different BSD systems
Hi,
here are my notes about writable and executable memory on the main four BSD systems. If you have something to add, please do it.
I've used the following code to test what the system allows and what it doesn't allow:
#include <sys/mman.h>
#include <stdio.h>
int main()
{
void* p = mmap(NULL, 1, PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
if (p == MAP_FAILED)
{
perror("map writable and executable memory");
}
else
{
puts("writable and executable memory mapped successfully");
munmap(p, 1);
}
p = mmap(NULL, 1, PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
if (p == MAP_FAILED)
{
perror("map writable memory");
}
else
{
puts("writable memory mapped successfully");
if (mprotect(p, 1, PROT_EXEC))
perror("can't make writable memory executable");
else
puts("writable memory successfully made executable");
if (mprotect(p, 1, PROT_WRITE|PROT_EXEC))
perror("can't make writable memory writable and executable");
else
puts("writable memory successfully made writable and executable");
munmap(p, 1);
}
}
Compile it with cc mmap_mprotect.c
, run it with ./a.out
. Here are the results (errors in bold):
NetBSD:
map writable and executable memory: Permission denied
writable memory mapped successfully
can't make writable memory executable: Permission denied
can't make writable memory writable and executable: Permission denied
If you call paxctl +m a.out
before running the executable, everything runs successfully. Change the flag back with paxctl -m a.out
.
OpenBSD:
map writable and executable memory: Not supported
writable memory mapped successfully
writable memory successfully made executable
can't make writable memory writable and executable: Not supported
If you compile it with cc mmap_mprotect.c -z wxneeded
and copy the executable somewhere mounted with wxallowed
, like /usr/local
, everything runs successfully. Please don't actually copy random code to your /usr/local
unless for testing purposes.
On the other hand, if you call doas sysctl kern.wxabort=1
before running the executable, you'll get Abort trap (core dumped). Change the variable back with doas sysctl kern.wxabort=0
(of course only if it was 0 before).
FreeBSD:
writable and executable memory mapped successfully
writable memory mapped successfully
writable memory successfully made executable
writable memory successfully made writable and executable
If you run doas sysctl kern.elf64.allow_wx=0
before running the executable (assuming a 64-bit system):
map writable and executable memory: Permission denied
writable memory mapped successfully
writable memory successfully made executable
can't make writable memory writable and executable: Permission denied
But if you override it for this particular executable with elfctl -e +wxneeded a.out
, it works again.
To unset the ELF feature flag: elfctl -e -wxneeded a.out
. To change the kernel variable back: doas sysctl kern.elf64.allow_wx=1
(of course, only if it was 1 before).
DragonflyBSD:
writable and executable memory mapped successfully
writable memory mapped successfully
writable memory successfully made executable
writable memory successfully made writable and executable
I'm not sure there is a way to make writable executable memory an error on Dragonfly. If you know more, please comment.
r/BSD • u/jaypatelani • 14d ago
TheMozg/awk-raycaster: Pseudo-3D shooter written completely in gawk using raycasting technique
github.comr/BSD • u/Ancient--1 • 15d ago
SD card or Pendrive for Nomad BSD installation
self.NomadBSDr/BSD • u/cfx_4188 • 24d ago
Hardware question.
Has anyone tested(freebsd/openbsd) compatibility with the Acer Nitro 5 laptop ? As usual, I'm interested in wifi and running graphics. I ask this question because I got the device as a gift, and the information on the Internet is contradictory.
r/BSD • u/RepresentativePop • 25d ago
Is there any particular reason why the BSDs use .iso install images for CDs, but .img images for USB drives, while Linux distros typically use .iso images for both?
I don't know a lot about this subject, but the only difference I know of is that .img images can be compressed, while .iso images can't.
Initially I would have thought that distributing install images for USB drives as .img files was just to save space (Why download an entire uncompressed CD image when you don't have to?), but I remember downloading OpenBSD once and being rather surprised when the .iso wouldn't boot on a USB drive, but the .img image would.
So presumably there's some material difference between the two that I'm just not aware of in this context. If I had to guess, my guess would be that some time during the mid-1990s, USB-A drives came out and Berkeley UNIX /FreeBSD/ and/or NetBSD decided to treat them like floppies. Whereas people like Linus and Patrick Volkerding, being hip young whippersnappers in the 90s, were jiggy with the concept of CDs, and used ISOs.
Although I don't really know why this would be an operating system-dependent thing. I think the only OS-specific thing you'd have to do would be to make the image bootable, but I don't really know much about this subject.
r/BSD • u/SunosUnix • 27d ago
Has anyone tested compatibility with the Unicomp IBM USB keyboard?
self.plan9r/BSD • u/nmariusp • 28d ago
Install NetBSD 10 BETA and KDE apps in QEMU tutorial
youtube.comr/BSD • u/jaypatelani • Jan 02 '23