I am trying to set up a signal and signal handler to rebuffer CAN frames as they arrive. Below is my code. I can send a frame from the computer running this code, but when I send a frame back the other way, nothing happens. I am holding the programme with scanf(). Can you see why this signal handler is
Tag: c++
why memcpy is slower than copying data in bytes granularity?
I write three different codes to copy data from a 4GB buffer to another 4GB buffer. I measure their bandwidth and the cache miss with perf stat. The code is shown below: Compiling it with gcc memcpy-test.c -o memcpy-test. The first one uses memcpy to copy memcpy_sz bytes data for each time. I test this with 8B, 64B, 4KB, 512KB,
Linux signals program doesn’t return the same value on each execution
I have this code: this program to my understanding should always print cpt = 5 but when i run it on my machine it returns different values (3,4,5) why is that? Answer The SIGCHLD signal is a little funny and doesn’t work like you’d expect: we think we should get one signal per child death, but that’s not it. Instead,
Where/how does the kernel loads statically linked modules?
Looking at init/main.c#start_kernel it’s not clear where the statically linked kernel modules are loaded, neither how the kernel gets a list of them. So, where are the statically linked kernel modules loaded? Answer For compiling a module “as a module”, the corresponding Kconfig is set to m. If set to y, all the module code is compiled just like all
How to connect BLE devices using Linux bluetooth C library
Description of the problem I am trying to connect my Bluetooth devices with BLE to a Linux system using the Bluetooth C libraries (I am programming using C++), so here is the code I am currently using: NOTE: You need to set a specific MAC in connect function parameter. I am also compiling with g++ using the following command: Here
gdb: how to learn which shared library loaded a shared library in question
I need to get the list of shared libraries used by an app in runtime. Most of them can be listed by ldd, but some can be seen only with gdb -p <pid> and by running the gdb command info sharedlib. It would really help, if I could learn in some way: for a chosen library (in the list, output
How to set app icon for linux revisited and how does xfreerdp do it
I discovered that my appimag-ed application does not show any app icon in the window manager when launched, even though it has the icon inside itself. By the way, e.g., Obsidian app does suffer from this problem. In general, from searching on the Web, it looks like appimage fails with icons. Here e.g., a person also answers that appimage fails
Valgrind message: Conditional jump or move depends on uninitialised value(s) unresolved
I’m trying a new assignment I’ve got: I need to copy the Environment variables from the shell into an array, then lowercase them and print them back. (I’m using Ubuntu 20.04.4 LTS, gcc for compiling, and writing my code in C language). I was advised to use malloc to create the array but decided not to. everything goes good up
Why string shown up in Shared Library file like .so file in Linux?
May I know why the .so file in linux will show up the string value from my cpp code? Even with fvisibility=hidden set in gcc make. for example, i set “Hello World” and it will show up. I tried google but found nothing related.. Thanks. Answer -fvisibility=hidden only affects the linker visibility, i.e. whether symbols are visible when a linker
Can an already opened FILE handle reflect changes to the underlying file without re-opening it?
Assuming a plain text file, foo.txt, and two processes: Process A, a shell script, overwrites the file in regular intervals $ echo “example” > foo.txt Process B, a C program, reads from the file in regular intervals fopen(“foo.txt”, “r”); getline(buf, len, fp); fclose(fp); In the C program, keeping the FILE* fp open after the initial fopen(), doing a rewind() and