I have a trouble in separating few exact ‘fields’ with strings and then putting them into .txt file. I need to extract ‘nologin’ users from /etc/passwd file and that is an easy step. I’m using this command: cat command gives me for example: and it is saved to file1.txt Now I have…
Buggy simple function for binary search (C++)
I wrote a simple function for binary search, but it’s not working as expected. I have a vector with 4000000 32-bit ints. Usually, when I search for a number, if it’s there, it’s found and the index is returned, if it’s not, -1 is returned (the index always corresponds to the value, but…
How to properly print file content to the command line in C?
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…
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 …