Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question This …
Difference between lsof -c name and lsof | grep ^name?
I’m trying to figure out whether I have a leak in file descriptors using lsof. The -c option to lsof is defined as: Selects the listing of files for processes executing the command that begins with the characters of c. If that’s true then why do these two commands report different numbers? Answer …
insmod fails with “Unknown symbol in module”
I am working on Linuxmint Cinnamon 19 Ubuntu 18.04, kernel version 4.15.0-20-generic The following I see during compilation: Then I try to install the module with sudo insmod elevator.ko Seeing in the logs: dmesg | tail Makefile elevator.c issue_request.c start_elevator.c stop_elevator.c Functions are static …
Meaning of dup2() POSIX function with second argument equals Zero
Sometimes I see strange usage of dup2() function. For example: It doesn’t even check the return value. What exactly does it do with such arguments? The man dup2 says that if newfd (second argument of dup2) was previously open, it is silently closed before being reused. But the 0 is stdin and why do we e…
assembly, how to use mprotect?
I am trying to make self modifying code in Linux. I thought it would works but didn’t. I used nasm on ubuntu 18.04. INT 0x80 return value is -22 0xffffffea I don’t know what is wrong. Answer Run your program under strace, like strace ./a.out to decode system call args and return values. Probably y…
Linux Command Line – list all directories containing .js files, and copy the directories and their contents to a new folder
Here is the code I already have that finds and lists all directories containing .js files (excluding the node_modules directory). As you can see, listing those directories is no problem. However, rather than list the directories, I would like to copy them (and their contents) to a new folder, preferably all i…
sharing read-write lock between interprocess
I have two processes rwlock1(parent) and rwlock2(child) . i want to use read-writer lock between processes , i need to transfer pthread_rwlock_t mem_lock to child process, i have a simple code , how can i trasfer the handle . i dont want to use a mutex. rwlock1(parent)’s code Answer I haven’t trie…
Piping to File Utility
I am being sent the bytes of thousands files over an interface, and my app must maintain statistics regarding the counts of various files types which it observes (text, HTML, binary, compressed, etc.). I have been using the subprocess module to run the file utility. However, as the scale has increased, I am h…
How to run a file in variable
I want to run this command: ././pscan `cat ips` 22 but the script don’t run corectly and i want to run command e.g: ././pscan 1.1 22 ././pscan 2.2 22 ././pscan 3.3 22 ././pscan 4.4 22 ././pscan 5.5 22 the script pscan works perfectly when i type on single command ././pscan 1.1 22 and i want to run more …
If statements accepting yes or no in bash script?
I am trying to accept user input of yes or no to a question and depending on the answer read back the value of my variable. I can never get commands attached to variables to work or my if statements to accept yes or no. It just keeps going to “not a valid answer”. Please let me know how to