wait3 (waitpid alias) returns -1 with errno set to ECHILD when it should not

TLDR: you are currently relying on unspecified behaviour of signal(2); use sigaction (carefully) instead. Firstly, SIGCHLD is strange. From the manual page for sigaction; POSIX.1-1990 disallowed setting the action for SIGCHLD to SIG_IGN. POSIX.1-2001 allows this possibility, so that ignoring SIGCHLD can be used to prevent the creation of zombies (see wait(2)). Nevertheless, the historical … Read more

What is the difference between alpine docker image and busybox docker image?

The key difference between these is that older versions of the busybox image statically linked busybox against glibc (current versions dynamically link busybox against glibc due to use of libnss even in static configuration), whereas the alpine image dynamically links against musl libc. Going into the weighting factors used to choose between these in detail … Read more

What is file globbing?

Globbing is the * and ? and some other pattern matchers you may be familiar with. Globbing interprets the standard wild card characters * and ?, character lists in square brackets, and certain other special characters (such as ^ for negating the sense of a match). When the shell sees a glob, it will perform … Read more

Linux Kernel – How to obtain a particular version (right upto SUBLEVEL)

kernel.org has a public (read-only) git repository that you can clone. It has also tags for every kernel version, so you can checkout a specific version: # Clone the kernel to your local machine $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git $ cd linux-stable # Find the tag for the version you want $ git tag -l | … Read more

what is the meaning of restrict in the function signature?

It’s something introduced in C99 which lets the compiler know that the pointer passed in there isn’t pointing to the same place as any other pointers in the arguments. If you give this hint to the compiler, it can do some more aggressive optimizations without breaking code. As an example, consider this function: int add(int … Read more

How to run spell check on multiple files and display any incorrect words in shell script?

You can install aspell with Homebrew on OS X. brew info aspell lists supported languages. brew install aspell –lang=en,fi,jp aspell check opens a file in an interactive spell checker: for f in *.txt; do aspell check $f; done aspell list prints all unrecognized words: cat *.txt | aspell list | sort -u Learned words are … Read more