I have a working Nitrogen6x board that runs on Yocto Krogoth-next build with core-image-sato. I have installed Qt Creator 3.5.1 (based on Qt 5.5.1) and I have added my kit for nitrogen6x board as per [Build & Install Qt5 toolchain] document. I have added a sample Qt Quick Application with component set ch…
Can someone please explain how this works?fork(),sleep()
What is happening here? How is sleep() getting executed in the for loop? When is it getting called? Here is the output: Please explain this output. I am not able to understand how it’s working. Step by step analysis would be great. Answer In the first loop, the original (parent) process forks 10 copies …
Different file owner inside Docker container and in host machine
I am facing a issue related to Docker users. I run my container as gitlab-runner using the following command: The files created inside the docker container show owner gitlab-runner, however, the same files show in my host machine as owner roggerfernandes. gitlab-runner must be the owner of files created insid…
linux c++ libev official example show redundant console behavior
I just tried the official example of libev, like below. After compiling and running, I see once I input anything from stdin, the event is triggered, no problem. But what I inputed is still treated as solid input and then appear on my console. My question is: is there a way to avoid this console input from bei…
Using linux epoll: epoll_ctl seems to have redundant parameter?
Usually on linux when we wish to use epoll, we first create a epfd, and then register fd and events to it. Above is a common example I found from internet. It works, but problem is: ev.data.fd=fd here I already have my “fd” assigned to ev structure. epoll_ctl still requires the 3rd parameter of th…
The Linux timeout command and exit codes
In a Linux shell script I would like to use the timeout command to end another command if some time limit is reached. In general: But I also want that my shell script exits when the command is failing for some reason. If the command is failing early enough, the time limit will not be reached, and timeout will…
a program to alert when /var files system usage reaches threshold
I am working on a program which will send an snmp alert when /var reaches maximum threshold. I am having trouble with calculating % of /var disk usage for this. I have this command “du -hs /var” which give me usage of /var in MB and /var is in the /root directory. So to calculate total disk on whi…
Exit whole script from code block { }
I have the following script: But the problem is that the {} block is exiting and not the whole script. How can I make the whole script exit? Answer Add the following line after your tee command: test ${PIPESTATUS[0]} -eq 0 || exit ${PIPESTATUS[0]} Reference Link: https://stackoverflow.com/a/34386000/2357256
cpp multipleThread: detach non-class type error
I’m writing a program with mutiplethread using cpp , but I have a compiler-error like this: my code could be presented as follow: So anybody have a clue about where I did wrong and what can I do? Answer You’ve hit C++’s Most Vexing Parse. The above declaration doesn’t declare a turnCam…
Father-child process use pipe to talk, hangs after “execlp”, why?
I’ve got a simple text file called “tmp” under current directory, I wish to “cat” this file and then “sort” it, I want to use a c program to act like pipe “|” so I tried to use a father/child talk to do this. Unexpectedly, the program hangs after “ca…