I’m sending data from one process to another pipe and I want to clear the pipe after reading. Is there a function in C that can do this ? Answer Yes. It’s just the read function offered by the stdio library. You have to invoke it as many times as you need in order to be sure the pipe will
C++ + linux handle SIGPIPE signal
Yes, I understand this issue has been discussed many times. And yes, I’ve seen and read these and other discussions: 1 2 3 and I still can’t fix my code myself. I am writing my own web server. In the next cycle, it listens on a socket, connects each new client and writes it to a vector. Into my class
Snap and certbot, unknown command ‘unset’
I’m trying to set up Let’s Encrypt certificates on an ec2 instance for the first time and have run into an error which I cannot find a resolution for online. I’m using the official certbox nginx guide, and am at the step where I need to install the route53 dns plugin. However, when I run sudo snap install certbot-dns-route53, I
Usage of getc with a file
To print the contents of a file one can use getc: How efficient is the getc function? That is, how frequently does it actually do operating system calls or something that would take a non-trivial amount of time? For example, let’s say I had a 10TB file — would calling this function trillions of times be a poor way to
Command not found in Linux machine
I installed Fortify software in Linux using the user “Kiran”. When I typed sourceanalyzer –v using the user “Kiran” I got: But, when I searched using the user “root”, I am getting command not found. Can someone please help me on how to find the version using the root user or any other user? Answer Switch to user “Kiran”, fire
How to get any command / task (ex: Ansible – Yum Install ) / stdout output i.e. Pretty print or Beautify / Lint aligned output
Ansible version: 2.8.3 or Any I’m using -m <module> Ansible’s ad-hoc command to ensure the following package is installed –OR– let’s say if I have a task to install few yum packages, like (i.e. How can I do the same within a task (possibly when I’m not using ansible’s shell / command modules): It works, but how can I get
issues using waitpid() with large number of child process
I have a c program to create a TCP socket and keep waiting for a connection in an infinite loop. Each time a client connected to the program, I would spawn a new child process to handle the client request. My program could only exit with signal interrupt (e.g. ctrl+c). I don’t want the parent process hanging there and wait
Text-cursor position handling in C (under Linux)
I’m trying to reposition the text-cursor to top left corner of the console each frame, so the resulted square rendered at the same position I found that this is possible in windows by including <windows.h>: How can I do that in Ubuntu? Answer [update] Oops, sorry, I didn’t notice the “[C]” tag and my answer was only referring to shell
How can I iterate over some file names returned from ls command?
Hello I am trying to write a simple bash script, the problem I am having is that I want to iterate through the 4th,5th,6th and the 7th files returned from the ls command and then to check if these files have write or read permissions and if they do so, to do a simple copy of these files to another
What instruction does Linux use to direct Intel CPU to setup a DMA transfer?
I know there are kernel apis that device drivers can use to set the transfer direction, count etc., but I would like to understand what CPU instruction does the api use to inform cpu to initiate this DMA transfer? Answer For most cases each device has its own DMA/bus mastering abilities built into the device; and the device driver uses