BSD is a family of Unix-like operating systems, including FreeBSD, NetBSD and OpenBSD.
Questions tagged [bsd]
510 questions
5
votes
2 answers
OpenBSD fails to execute a.out
I wrote this program that should just exit with exitcode 44:
// prog.S
#include
.text
.globl _start
_start:
subl $8, %esp
pushl $44
pushl $0
movl $SYS_exit, %eax
int $0x80
I…

dVNE
- 161
- 9
5
votes
5 answers
How to test for GNU or BSD version of rm?
The GNU version of rm has a cool -I flag. From the manpage:
-I prompt once before removing more than three files, or when removing recursively. Less
intrusive than -i, while still giving protection against most mistakes
Macs…

Kevin Burke
- 61,194
- 76
- 188
- 305
5
votes
1 answer
PF header net/pfvar.h on OSX missing
PF (packet filter) is a kernel-level firewall, included in BSD-like kernels (Darwin kernel is basically BSD), and BSD man pages provide detailed documentation about these headers, letting control PF programmatically. PF is included in OSX kernel,…
user707779
5
votes
0 answers
Make symlinked file non-writable
I have this situation, a real folder called "git" is symlinked to .githooks:
Is there a way to make the symlinked files non-writable, without affecting the original files?
I don't want users to accidentally modify the source in the git folder…

Alexander Mills
- 90,741
- 139
- 482
- 817
5
votes
1 answer
How to use xargs with BSD find?
With GNU find, it is easy to pipe to xargs. A typical (useless) example:
find /var/log -name "*.log" | xargs dirname
This returns all the directory names containing some log file.
The same command with BSD find does not work, ending with:
usage:…

Eric Platon
- 9,819
- 6
- 41
- 48
5
votes
0 answers
rationale for posix tracing obsolescent?
I began reading the POSIX standard, and I really appreciate the rationale sections, as they help me understand (and remember) the design. When I came to the "Tracing" system interface section, I saw that it's marked as obsolescent, but I can't find…

bukzor
- 37,539
- 11
- 77
- 111
5
votes
2 answers
What type of threads does OS X have?
Kernel-level threads (like Linux and some *BSD systems) or something else? If there is any difference, I'm using pthreads.

Pyetras
- 1,492
- 16
- 21
5
votes
1 answer
Why is rand() much faster than arc4random()?
I'm writing a game AI which requires fast integer random number generation. This game is for Mac OS, so there are two choices rand() (the plain C) and arc4random() (BSD). I didn't find any comparison in speed for these two functions, so I wrote a…

Zhigang An
- 296
- 2
- 13
5
votes
1 answer
How do I get information on linux whether my program is swapping or not?
More specifically: I want to find this information from inside the program, preferably just before it starts swapping so I can react. So far I found:
Information inside /proc, which is not very useful
mincore syscall which seems to be available on…

fijal
- 3,190
- 18
- 21
5
votes
2 answers
What Jail/Chroot/Sandbox-like mechanisms are available on OpenBSD?
I have recently started using OpenBSD. And I want to create easy fire-and-forget containers/VM or something es (it should be used as a Sandbox).
The user can upload his source code (C++/Java/Perl), it will be compiled on the Server (OpenBSD), if…

kpalatzky
- 1,213
- 1
- 11
- 26
5
votes
2 answers
Is it possible to run the BSD userland as a replacement to GNU coreutils with the linux kernel?
I have been looking for a linux distribution that is not for embedded systems and does not use many of the GNU utilities found in many popular distributions. I want to develop a (pet project) linux distribution that uses musl-libc, bsd userland, and…

wohlleben
- 59
- 1
- 3
5
votes
2 answers
System Calls: UNIX, Linux, BSD and Solaris variations
Are there differences between the amount of syscalls in the major *NIX variants ?
Which syscalls would be supported universally ?

Ande Turner
- 7,096
- 19
- 80
- 107
5
votes
2 answers
What's the meaning of typedef int function(void*)?
I saw some BSD code using the following construct:
typedef int driver_filter_t(void*);
What does that mean, exactly? I don't think it's a function pointer because otherwise it would be something like typedef int (*driver_filter_t)(void*), right?

Martin
- 940
- 6
- 26
5
votes
4 answers
C random() & setstate function not behaving as expected
I am unsure why these two blocks of code give different outputs:
unsigned int seed1 = 0;
char state1[256];
initstate(seed1, state1, 256);
printf("%10ld\n", random());
printf("%10ld\n", random());
// Gives:
// 1216130483
// 1950449197
vs.
unsigned…

David Lawson
- 7,802
- 4
- 31
- 37
5
votes
3 answers
BSD atos available on Linux?
Is the atos binary for converting numberic addresses to symbols of binary images available on Linux, specifically Ubuntu? It seems to only be available on OS X.

moinudin
- 134,091
- 45
- 190
- 216