I want to print the contents of a .txt file to the command line like this: The file testfile.txt looks like this: The function prints only the first 4 letters line. When using sizeof instead of strlen the whole file is printed. Why is strlen not working? Answer When using sizeof instead of strlen the whole fi…
Tag: linux
Managing Log File Sizes
I am implementing a simple log file handler for an embedded device. I cannot use syslog because it is already reserved for other uses. The device’s SSD size is limited, so there is a real risk of the log file using all of the disk space, which will crash the device. What is the cheapest way I can guaran…
Linux top output unrealistic?
I’m having a weird issue with a java process which is consuming a lot of resources on a linux VM. The output of top for the process is the below : So this shows that the process is actually consuming 21G of physical memory ? When checking the process in more detail I can see it was started with -Xmx4G
FIPS Capable OpenSSL cross-compiled: incore fingerprint issue
I’m having an issue trying to use the OpenSSL shared library (libcrypto) compiled to be FIPS capable on a MIPS device. I cross-compiled the FIPS Object Module and then the OpenSSL library in the following way (summarizing): I did all the needed steps, so I’m able to compile and install the library…
Starting a process using systemd on Linux: different behaviour using “su root -c”
We have a SignalR push server using Mono/Owin on a Linux Debian server. We perform a load test and we get a different behaviour according to how the push is started on systemd Working: ExecStart=/bin/su root -c ‘/usr/bin/mono –server mydaemon.exe -l:/var/run/mydaemon.pid’ Hanging after aroun…
Why does trying to kill a process in Docker container take me out of it?
I have a v6.10.0 Node server on my macOS that is automatically started from the CMD in the Dockerfile. Normally in my local development un-containerized environment I will use CTRL+C to kill the server. Not being able to (or not knowing how to) do this in the container, I resort to ps aux | grep node to try t…
What is the type of elements of thread_group list in sched.h?
In sched.h, task_struct has following 2 fields: thread_group & thread_node. They keep the first element of their list but I could not find which type of variables they contain. Answer thread_group and thread_node are both intrusive linked-lists of all the threads in a thread group – they are use to …
No network interfaces on Debian 8 Lenovo install [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
Integrate ffmpeg to unity via plugin OS X and Linux
I need to use a ffmpeg wrapper (so we can use it in unity) for a lecture. Unfortunately the teachers only provide a solution to do this for Windows. They are referring to https://github.com/Ruslan-B/FFmpeg.AutoGen which we should use to generate a wrapper for our OS. That’s where my problems begin: I ha…
Linux: Append variable to end of line using line number as variable
I am new to shell scripting. I am using ksh. I have this particular line in my script which I use to append text in a variable q to the end of a particular line given by the variable a containing the line number . Now the variable q can contain a large amount of text, with all sorts of