I am using remote (k)gdb to debug a problem in a module that causes a panic when loaded e.g. when init() is called. The stack trace just shows that do_one_initcall(mod->init) causes the crash. In order to get the symbol file loaded in the gdb, I need to get the address of the module text section, and to get that I
How does fork() return for child process
I know that fork() returns differently for the child and parent processes, but I’m unable to find information on how this happens. How does the child process receive the return value 0 from fork? And what is the difference in regards to the call stack? As I understand it, for the parent it goes something like this: parent process–invokes fork–>system_call–calls
C++ wrapper for posix and linux specific functions [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 5 years ago. Improve this question Do you know about any good library wrapping posix and linux
Compiling linux sources in Windows environment
I got a source for console program written in c++ for linux Is there a (automated) way to compile this source to run in windows? and what about linux functions and libraries called in this file? Answer It depends on the source, but if it’s using linux functions and libraries, installing Linux might end up being easier that getting it
How to run infinitely script in background on Linux?
I have a PHP script with infinite loop. I need this script running forever. So, I run And it works in background in my current user’s security context. But when I close terminal window (log off), of course, CentOS Linux kills my program. I see two guesses: run from a different user in background or make a daemon. I need
Change the target of a symlink with PHP
How can I change the target of a symlink with PHP? Thanks. Answer You can delete the existing link using unlink function and recreate the link to the new target using the symlink function. You need to do error checking for each of these.
Get directory path by fd
I’ve run into the need to be able refer to a directory by path given its file descriptor in Linux. The path doesn’t have to be canonical, it just has to be functional so that I can pass it to other functions. So, taking the same parameters as passed to a function like fstatat(), I need to be able to
Prevent * to be expanded in the bash script
Linux bash script: Execution results: * is expanded to the list of files, which is actually script itself. How can I prevent this and see actual variable value? In general case, var can be more complicated than *, for example: home/alex/mydir/*. Answer you need to escape your variables, too: And in your function:
linux batch rename directories and strip # character from name
i have a directory with a lot of subdirectories with a # infront of them: I want to rename them all and remove the # caracter I tried to do: but didn’t seem to work. Any ideas on this. Thanks Answer Just use use -n just to check that what you think it would happen really happens. In you example
Limiting the time a program runs in Linux
In Linux I would like to run a program but only for a limited time, like 1 second. If the program exceeds this running time I would like to kill the process and show an error message. Answer StackOverflow won’t allow me to delete my answer since it’s the accepted one. It’s garnering down-votes since it’s at the top of