How can I trim white space from a variable in awk?
You’re printing the result of the gsub, but gsub does an in-place modify of $2 instead of returning a modified copy. Call gsub, then print: awk -F\, ‘{gsub(/[ \t]+$/, “”, $2); print $2 “:”}’
You’re printing the result of the gsub, but gsub does an in-place modify of $2 instead of returning a modified copy. Call gsub, then print: awk -F\, ‘{gsub(/[ \t]+$/, “”, $2); print $2 “:”}’
Use the -O binary output format: objcopy -O binary –only-section=.text foobar.elf foobar.text Just verified with avr-objcopy and an AVR ELF image’s .text section. Note that if, as Tim points out below, your section doesn’t have the ALLOC flag, you may have to add –set-section-flags .text=alloc to be able to extract it.
The parent shell, the one invoking bash show_files.sh *, expands the * for you. In your script, you need to use: for dir in “$@” do echo “$dir” done The double quotes ensure that multiple spaces etc in file names are handled correctly. See also How to iterate over arguments in a bash shell script. … Read more
Another very handy way to do this is with gnu parallel, which is well worth installing if you don’t already have it; this is invaluable if the tasks don’t necessarily take the same amount of time. seq 1000 | parallel -j 8 –workdir $PWD ./myrun {} will launch ./myrun 1, ./myrun 2, etc, making sure … Read more
I think you can find a lot of documentation about the kmalloc + mmap part. However, I am not sure that you can kmalloc so much memory in a contiguous way, and have it always at the same place. Sure, if everything is always the same, then you might get a constant address. However, each … Read more
When you source the file, the assignments will be set but the variables are not exported unless the allexport option has been set. If you want all the variables to be exported, it is much simpler to use allexport and source the file than it is to read the file and use export explicitly. In … Read more
What is the difference between “zero-copy networking” and “kernel bypass”? Are they two phrases meaning the same thing, or different? Is kernel bypass a technique used within “zero copy networking” and this is the relationship? TL;DR – They are different concepts, but it is quite likely that zero copy is supported within kernel bypass API/framework. … Read more
mmap a special file, like /dev/zero (or use MAP_ANONYMOUS) as PROT_NONE, later use mprotect to commit.
It is both complicated and differs from Unix to Unix variant. In Linux, for example, a system called Futex (Short for Fast Userspace Mutex) is used. In this system an atomic increment and test operation is performed on the mutex variable in user space. If the result of the operation indicates that there was no … Read more
Documentation ( from Monitor file system activity with inotify ) The inotify C API inotify provides three system calls to build file system monitors of all kinds: inotify_init() creates an instance of the inotify subsystem in the kernel and returns a file descriptor on success and -1 on failure. Like other system calls, if inotify_init() … Read more