Actually, I am using libev; but under the hood this is using epoll (I’m only on linux). When I add a watcher to read a file and all data has been read then I do get a call back that there is data to read, but read(2) returns 0 (EOF). At that point I have to stop the watcher or
Tag: linux
How to emulate ARM unaligned memory access exceptions?
I’m writing a cross-platform application which works on x86 machines, but crashes with “Bus error” on the actual ARM hardware (Raspberypi 2) … … but runs without any problems in Qemu. I run this command to enable SIGBUS signal and notification in the kernel running under Qemu, bu…
Where to find the source code of timespec_get?
The C11 standard provides the function timespec_get. If I run the example code on cppreference, or on my computer, it works: However, if I look at the sources of glibc here, the code is the following: Which… should not work… Which leads to the question: where is the source code of timespec_get tha…
Provide windows avilable cores
I use the following in my script to find how many available cores I can use. This is for Linux: This is for Mac (darwin): How should it be in Windows? Answer You can use one of those commands: (here you have two physical processors) Or as suggested in comments: In Makefile the record should be something like:…
Relocations in generic ELF (EM: 183)
This used to work before. I don’t know what changed, the thing is I can’t run anymore. I’m cross-compiling for an aarch64 architecture with ARM cpu’s, using Ubuntu 16.04 x86-64. This is what I’m running to configure: ./configure –host=aarch64-linux-gnu –prefix=/data/d…
How can I use the cat command to read from a character device with my own character device driver?
I am trying to write a simple read/write character driver for a beaglebone. One of the tasks is to be able to use the cat command to read from the device, but I am unable to do so. Here is the code for my read function for my character device driver located inside char_drvr.c: Read executes successfully (the …
Using sed (or any other tool) to remove the quotes in a json file
I have a json file I want to change it to i.e. convert the requestId from String to Integer. I have tried some ways, but none seem to work : Could someone help me out please? Answer Try or The main differences with your attempts are: Your regular expressions were looking for [0-9] between double quotes, and t…
What is efficient way to ensure bash script variable is valid permission bits?
I’m inexperienced with bash scripts, mostly cobbling things together from google searches. The following simple script creates file foo and changes its permission bits to whatever the script’s $1 is. Can an experienced bash scripter please advise what would be a proper and/or efficient way to ensu…
Where to extract the source code (.cpp files) of wxWidgets under Linux Mint 19 for step inside debugging?
I have successfully installed the wxWidgets v3.1.1 banaries from CodeLite’s website Here The problem is the installation has no .cpp files for step inside debugging. So I had to download the source code to get the .cpp files. My question is where to extract them in the system? Thank you. Answer You can …
Git clone with authentication over HTTP protocol
I have a centos 7 server with a git repo shared over smart http, when I make “git push” the authentication works but when I make “git clone” not works. I want than Git and Apache ask me user and password to clone the repos. /var/www/git -> Is my repo dir /var/www/html -> Is the w…