BSD is a family of Unix-like operating systems, including FreeBSD, NetBSD and OpenBSD.
Questions tagged [bsd]
510 questions
5
votes
4 answers
dTrace scripts and tools
I've recently began using dTrace and have noticed just how awesome it is. Its the perfect tool for profiling without placing the burden on programmers to set up hundreds of probes in their applications.
I've found some nice one liner and sample…

Robert Gould
- 68,773
- 61
- 187
- 272
5
votes
1 answer
How do I find the cpu the current thread is running on, for Mac and BSD?
I'm looking for a function on Mac OS and BSD that's equivalent to Linux's sched_getcpu(), and Windows' GetCurrentProcessorNumberEx() in order to implement a library for cpu-local storage. It's clearly possible to emulate this with the cpuid or…

Jeffrey Yasskin
- 5,171
- 2
- 27
- 39
5
votes
1 answer
Using `splice` for Linux... what else for other systems?
On recent Linux kernels, afaict, the fastest way of copying a file or a subset of a file to another file is through the use of the very nice splice system call. This system gets the kernel to manage the transfer (almost) directly, without ever…

Yoric
- 3,348
- 3
- 19
- 26
5
votes
1 answer
segfault on write() with ~8MB buffer (OSX, Linux)
I was curious what kind of buffer sizes write() and read() could handle on Linux/OSX/FreeBSD, so I started playing around with dumb programs like the following:
#include
#include
#include
#include
#include…

staticfloat
- 6,752
- 4
- 37
- 51
4
votes
3 answers
Adding Blue Screen of Death to Non-Windows OS
I am looking to get into operating system kernel development and figured and have been reading books on operating systems (Tannenbaum) as well as studying how BSD and Linux have tackled this challenge but still am stuck on several concepts.
If I…

McGovernTheory
- 6,556
- 4
- 41
- 75
4
votes
2 answers
C network programming?
What libraries are the best (in terms of performance) for network programming in C on windows and UNIX?
I'm quite interested with respect to high frequency trading.
I have heard about BSD and POSIX but I wasnt sure if there were faster…

user997112
- 29,025
- 43
- 182
- 361
4
votes
1 answer
Raw Sockets on BSD Operating Systems
I've been writing some sockets code in C. I need modify packet headers and control how they're sent out, so I took the raw sockets approach. However, the code I wrote will not compile on BSD systems (Mac OS X/Darwin, FreeBSD, etc.)
I've done a…

GhostCode
- 578
- 1
- 8
- 18
4
votes
4 answers
Hooking into the TCP Stack in C
It's not just a capture I'm looking to do here. I want to first capture the packet, then in real time, check the payload for specific data, remove it, inject a signature and reinject the packet into the stack to be sent on as before.
I had a read of…

abnev
- 469
- 1
- 8
- 20
4
votes
1 answer
BSD Grep patternfile (-f) skipping patterns that contain substrings of previous patterns. Ordering sensitive?
I have a file with a list of keywords I would like to locate (pattern.txt):
foo
foo_bar
asdf
asdf_fdsa
Some of these keywords are substrings of others, so I am using the -w option for grep to match full words.
For this example, I am just using a…

Robyn Murdock
- 41
- 3
4
votes
1 answer
SED fails on MacOS in two cases : invalid repetition count(s) and bad flag in substitute command
I am trying to create a series of cross platform SED substitutions (Linux and MacOS) . I am getting two errors on MacOS for the two SED commands below which work fine under bash in Linux. What do I need to change to get them accepted under BSD…

EmceeBC
- 71
- 4
4
votes
1 answer
Resize Partitions in OpenBSD
I'm currently trying to install OpenBSD with gnome. I'm having the issue that my /dev/wd0h (/usr/local) disk partition is full, while some of the other have 1 or 2 GB free.
I'm trying to resize the partitions, to move some of the available space…

Victor
- 41
- 1
- 5
4
votes
4 answers
Is there a good reason to write my own daemonize function instead of using daemon(3)?
There are a lot of example implementations of daemons on the net. Most that I saw do not use the daemon(3) function to run the program in the background. Is that just a matter of taste, ignorance, or is there a good reason to write my own daemonize…

Jan Deinhard
- 19,645
- 24
- 81
- 137
4
votes
4 answers
Where can I find the source code of the "halt" tool?
Can anyone link up the source of the halt tool? It is a binary usually located in /sbin which shuts down the system. I did some search and I couldn't find it anywhere.

Kristina
- 15,859
- 29
- 111
- 181
4
votes
1 answer
How do I convert from using `grep -P` to `grep -E`?
I have a script that we use on Ubuntu (Linux) and I'd like to convert it to be used on both Ubuntu (Linux) and MacOS X. grep on Linux is different than grep on FreeBSD (i.e. MacOS X); grep on MacOS X doesn't support the -P option. Unfortunately,…

Son of the Wai-Pan
- 12,371
- 16
- 46
- 55
4
votes
1 answer
Copying files using memory map
I want to implement an effective file copying technique in C for my process which runs on BSD OS. As of now the functionality is implemented using read-write technique. I am trying to make it optimized by using memory map file copying technique.…

Bose
- 381
- 3
- 16