BSD is a family of Unix-like operating systems, including FreeBSD, NetBSD and OpenBSD.
Questions tagged [bsd]
510 questions
0
votes
1 answer
restriction on using #define'd functions/inline functions inside Assembly files
Is there any restriction on using #define'd functions/inline functions inside Assembly files.
I referred bsd kernel in which two different implementations are defined.
One is macro and other is a normal function ( both are for same function)
In the…

kumar
- 2,530
- 6
- 33
- 57
0
votes
0 answers
Why does backgrounding `script` from a makefile drastically increase cpu usage?
First a little bit of context: I'm calling this is inside a shell script that's called from make that's executed concurrently with make -j4. I have not found any reliable way to atomically write to stdout so I backgrounded the process and found it…

vmrob
- 2,966
- 29
- 40
0
votes
2 answers
why the return value from recvfrom method is 4294967295 which should be 0 or -1?
I am using sendto/recvfrom methods to send/receive UDP packets in my app. Now my receive method is as following:
- (void)listenForPackets
{
int listeningSocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (listeningSocket <= 0) {
…

chancyWu
- 14,073
- 11
- 62
- 81
0
votes
2 answers
Sockets behavior differently between BSD (Mac OS X and OpenBSD) and Linux (Ubuntu)
I wrote a man-in-the-middle/proxy server initially on my mac. Essentially the proxy creates a socket and waits for a connection, then connects to another application. This works flawlessly on in OS X and in OpenBSD; however, when porting the proxy…

jbh
- 1,153
- 2
- 11
- 24
0
votes
2 answers
How do I use sed to replace all lines between two matching patterns (on OSX BSD)
I would like to know how to:
Replace all lines between two matching patterns (not include the patterns - exclusive). Please note that these will be on separate lines.
Replace all lines between and including two matching patterns (inclusive). Please…

vsiege
- 305
- 1
- 6
- 16
0
votes
1 answer
BSD hard disk designation
I have a hard disk array which runs on an OS based on BSD. I want to acces some hard disk information on it directly but I cant seem to figure out what the hard drives are. In linux it would /dev/sda,/dev/sdb etc.
here is an output from a ls in…

user3021085
- 407
- 2
- 5
- 16
0
votes
2 answers
Mac unix script: given a list of file paths, find the one with latest modified date?
If I have a list of file names (absolute path), how do I determine which one is last modified in command line?
Thanks!

hzxu
- 5,753
- 11
- 60
- 95
0
votes
1 answer
Bash shell / Command: strip out arbitrary components in a given path?
Say if I have:
MYPATH=../Library/NetworkUtil/Classes/Headers/network.h
then I want to construct another path AllHeaders/NetworkUtil/network.h
I actually need to get different components out fro the original path, is there a way to do it?
I found…

hzxu
- 5,753
- 11
- 60
- 95
0
votes
2 answers
unix command to copy all .h file with modified directory-structure
Suppose I have a folder structure like:
Libraries\
UIToolkit\
files\
toolkit.h
toolkit.c
toolkit.resource
NetworkLayer\
files\
network.h
network-info.txt
...
I need a command so that I can input the Libraries folder and specify a Output…

hzxu
- 5,753
- 11
- 60
- 95
0
votes
2 answers
Script to find all .h file and put in specified folder with same structure?
I need a bash script like
headers ~/headers-folder ~/output-folder
so it recursively finds all .h files in ~/headers-folder and put them all in ~/output-folder with the folder hierarchy maintained?
Thanks!

hzxu
- 5,753
- 11
- 60
- 95
0
votes
1 answer
Reading from a socket at an offset with MSG_PEEK flag?
I want to get away from the sequential and slow way of reading from a socket, in which we use:
struct PACKET_STRUCT{
int PacketType;
char buffer[50];
};
char buffer[sizeof(PACKET_STRUCT)];
struct sockaddr_storage addr;
socklen_t fromlen =…

Lucky
- 579
- 6
- 24
0
votes
1 answer
Is the comm command broken on Mac?
Suppose there are file1:
1
2
3
5
And file2:
2
3
4
When comparing them with comm file1 file2 on FreeBSD or Linux, I got the following result:
1
2
3
4
5
But when I tried the same command on Mac OSX 10.9, the…

Domon
- 6,753
- 1
- 25
- 29
0
votes
2 answers
syslog: process specific priority
I have two user processes A and B. Both use syslog using facility LOG_USER.
I want to have different threshold levels for them:
For A, only messages of priority ERR-and-above must be logged
For B, only messages of priority CRIT-and-above must be…

Arun
- 19,750
- 10
- 51
- 60
0
votes
1 answer
Unusual signal numbers from WTERMSIG macro after waitpid()
I am seeing unusual signal numbers (for example 50, 80 or 117) from the following code when waiting for a child process to terminate. I am only seeing this from one particular child process, and I have no access to the process source code and it…

trojanfoe
- 120,358
- 21
- 212
- 242
0
votes
1 answer
Using globs in GNU grep's path argument
BSD (Mac) grep allows for this command:
grep -n "FIXME" **/*.rb
But GNU grep forces me to specify at least a folder to start from:
grep -n "FIXME" {lib,spec}/**/*.rb
Is there a way to get this to behave like it does in BSD grep?

yurisich
- 6,991
- 7
- 42
- 63