freebsd | FreeBSD 's source with custom patches
kandi X-RAY | freebsd Summary
kandi X-RAY | freebsd Summary
this is the top level of the freebsd source directory. this file was last revised on: $freebsd$. for copyright information, please see the file copyright in this directory (additional copyright information also exists for some sources in this tree - please see the specific source directories for more information). the makefile in this directory supports a number of targets for building components (or all) of the freebsd source tree, the most commonly used one being world'', which rebuilds and installs everything in the freebsd system from the source tree except the kernel, the kernel-modules and the contents of /etc. the world'' target should only be used in cases where the source tree has not changed from the currently running version. see: for more information, including setting make(1) variables. the buildkernel'' and installkernel'' targets build and install the kernel and the modules (see below). please see the
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of freebsd
freebsd Key Features
freebsd Examples and Code Snippets
Community Discussions
Trending Discussions on freebsd
QUESTION
When I was using Linux I used to use Linux namespaces:
https://man7.org/linux/man-pages/man7/namespaces.7.html
Also on FreeBSD, there are jails:
https://www.freebsd.org/cgi/man.cgi?jail
I was wondering what the alternative was on macOS 12? I'm new to Macs so I'm just trying to learn the system and any features it might have.
...ANSWER
Answered 2022-Apr-03 at 12:01The equivalent feature to FreeBSD's jails and linux namespaces for macOS is the App Sandbox.
You can find relevant details in the App Sandbox Design Guide.
QUESTION
From pthread_key_create
FreeBSD man page:
/comment
... The
pthread_key_create()
function creates a thread-specific data key visible to all threads in the process. Key values provided bypthread_key_create()
are opaque objects used to locate thread-specific data. Although the same key value may be used by different threads, the values bound to the key bypthread_setspecific()
are maintained on a per-thread basis and persist for the life of the calling thread.
I am assuming that produced pthread_key_t
instances are bound to a process (hence the opaque word in the man page), and that these become invalid after a fork()
. I couldn't find any reference in existing man pages or documentation however.
Can anyone confirm/comment?
...ANSWER
Answered 2022-Apr-01 at 12:37I am assuming that produced pthread_key_t instances are bound to a process
There is every reason to think that instances are process-specific, in that if you, say, record the representation of a key in shared memory then it is not meaningful to unrelated processes that happen to map the same shared memory segment.
(hence the opaque word in the man page),
But "opaque" has nothing in particular to do with that. It just means that there are no user-serviceable parts inside. You're meant to use it only as a whole.
and that these become invalid after a fork().
That seems a bit of a jump. I would not expect that at all. fork()
creates a nearly exact duplicate of the calling process, subject to a few explicitly enumerated exceptions, which are listed in the manual. Probably the biggest relevant one is that the new process contains only one thread (the one that called fork()
). Invalidation of thread-specific data keys is not on the list, nor is the loss of thread-specific data of the one initial thread of the child.
I couldn't find any reference in existing man pages or documentation however.
Exactly so.
HOWEVER, multi-threaded programs generally should not fork, as there is a high risk that the child process is left in an invalid state, such as with mutexes that are locked by threads that do not exist in the child. There are a few special cases, such as forking a child that immediately exec
s, but for the most part, you should not attempt to mix multithreading with multiprocessing.
QUESTION
For some tests, I've set up a plain new TrueNAS 12.3 FreeBSD Jail and started it, then installed python3
, firefox
, geckodriver
and pip
using the following commands:
ANSWER
Answered 2022-Jan-23 at 16:48This error message...
QUESTION
With support for macOS, Windows (MSVC), and Linux, how do I do the following?
...ANSWER
Answered 2022-Mar-23 at 07:30As pointed out in the comments, (v)snprintf
always returns the number of bytes that would have been written (excluding the null terminating byte), even if truncated. This has the effect that providing the function with a size
argument of 0
returns the length of the to-be-formatted string.
Using this value, plus the string length of our existing string (if applicable), plus one, we (re)allocate the appropriate amount of memory.
To concatenate, simply print the formatted string at the correct offset.
An example, sans error checking.
QUESTION
I am sending messages from an ATMEGA644 to a Linux machine, and the CRC32 routine gives a different result on the two machines. The CRC algorithm is from MIT.
The ATMEGA version is compiled with avr-gcc and the Linux version with cc. The Linux compilation produces two warnings about the size of the printf parameters in the test harness, but even if you eliminate these warnings, the result is the same.
Here is the crc32 routine, together with a main() test harness that shows the problem:
...ANSWER
Answered 2022-Mar-22 at 15:29The two different systems you are comparing have int
types of different sizes, and although your code does not use int
explicitly, it is used implicitly by the rules of the C language.
On the AVR, ~0U
has the type unsigned int
(i.e. uint16_t
) and a value of 0xFFFF.
On a normal PC, ~0U
has the type unsigned int
(i.e. uint32_t
) and a value of 0xFFFFFFFF.
Like Tom Karzes said, you should just use ~crc
if you want to invert all the bits in the crc
variable in a simple, cross-platform way.
QUESTION
I'm working on a procfs kernel extension for macOS and trying to implement a feature that emulates Linux’s /proc/cpuinfo similar to what FreeBSD does with its linprocfs. Since I'm trying to learn, and since not every bit of FreeBSD code can simply be copied over to XNU and be expected to work right out of the jar, I'm writing this feature from scratch, with FreeBSD and NetBSD's linux-based procfs features as a reference. Anyways...
Under Linux, $cat /proc/cpuinfo showes me something like this:
...ANSWER
Answered 2022-Mar-18 at 07:54There is no need to allocate memory for this task: pass a pointer to a local array along with its size and use strlcat
properly:
QUESTION
Consider these awk
commands:
ANSWER
Answered 2022-Feb-08 at 20:52POSIX awk does not allow physical newlines in string values.
When you use C/BASH string notation like $'a\nb'
then any POSIX compliant awk implementation will fail.
Even with gnu-awk, when you enable posix
option following error will be returned:
QUESTION
On a FreeBSD v13 box, I call sysctl()
to obtain dev.cpu.0.freq_levels
which then returns:
ANSWER
Answered 2022-Jan-29 at 18:33A frequency 1 MHz higher than the maximum frequency of the CPU indicates the Intel(R) Turbo Boost(TM) feature.
QUESTION
I run FreeBSD-based kernel as QEMU/KVM guest.
I'm working on a FreeBSD-based OS kernel SCSI driver and have an issue with read
system call produces corrupted data.
To troubleshoot the problem I use the Kernel running in QEMU and would like to trace memory access performed by the DMA controller which is responsible for delivering data into the user-supplied buffer. In case of QEMU The controller is QEMU SCSI/ATA Disk
device. So I tried to set a watchpoint on a user supplied buffer
Example:
Setting the breakpoint on int sys_read(struct thread *td, struct read_args *uap)
I got some buffer arrived from the user:
ANSWER
Answered 2022-Jan-28 at 11:41The watchpoint handling provided for QEMU's gdbstub is really only intended to work with accesses done by the guest CPU, not for those done by DMA from emulated devices. I'm surprised it hits at all, and not surprised that the behaviour is a bit weird.
If you can repro this on a QEMU setup using purely emulation (ie not KVM, hvf or whpx), then my suggestion for debugging this would be to run QEMU itself in a host gdb, and use the host gdb to set a watchpoint on the host memory that corresponds to the relevant bit of guest memory. Unfortunately that requires some knowledge of QEMU internals to find the host memory, and generally to understand what's going on and relate what QEMU is doing to what the guest execution is.
Supplementary debugging tip: if you can take a 'snapshot' just before the bug is triggered, that gives you a shorter reproduce case which is "load from snapshot and trigger bug" rather than "boot entire guest OS and userspace then trigger bug". More detail in this blog post.
Supplementary debugging tip 2: if you take the "debug QEMU with host gdb" approach, you can use the reverse-debugger rr, which is very handy for memory-corruption bugs, because you can say "now execute backwards to whatever last touched this memory". More info in this post.
QUESTION
The following example compiles with both gcc 11 on Linux (GNU STL) and clang 12 on FreeBSD (Clang STL). On Linux, it runs and prints values 1 and 2. On FreeBSD, it prints value 1 and then crashes with a SEGV. I don't quite understand the object lifetimes -- so the whole thing may be UB and the runtime behavior might not be relevant. I do know that the implementation of std::unique_ptr
between those two STLs differs in an important way: Clang STL resets the internal pointer of a std::unique_ptr
to nullptr
at the start of the destructor, while GNU STL leaves the pointer alone.
ANSWER
Answered 2022-Jan-24 at 10:41Yes, the lifetime of the object that m_owner
refers to has already ended and it's destructor call completed when m_owner->cleanup();
is called. The call is therefore UB.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install freebsd
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page