I have a requirement to find whether a given address is in heap or in stack. Is there a reliable way to do this in Linux? I have thought about the following approach assuming that the stack will grow downward and heap will grow up towards stack. How reliable is this solution? We don’t use gcc split-stack. [edit – I
Tag: c++
mpirun: Unrecognized argument mca
I have a c++ solver which I need to run in parallel using the following command: This command will run my_exec independently on the 16 processors available on my node. This used to work perfectly. Last week, the HPC department performed an OS upgrade and now, when launching the same command, I get two warning messages (for each processor). The
Socket buffer size not increasing
Output is – Current socket buff len = 41600 setsock opt success After setting socket buff len = 41600. Looks like receive buffer size is not increasing, any idea why this happens? Thanks in advance! Answer If the kernel is of newer version (2.6.17 or higher), checkout whether autotuning is enabled by verifying the file /proc/sys/net/ipv4/tcp_moderate_rcvbuf . If the value
Redirecting stdout and stderr to a file in c++
I am trying to redirect stdout and stderr to a log file. This is what i am doing. But still i am missing out some of the logs. I came to know that when i executed my application commenting out these lines of code. I am dubious about this code snippet. Please provide your feedback on this. Answer first close
sys_ functions in syscalls.h are undefined
I’m just making a kernel module. And I meet this warnings: How can I fix this problem? This is my codes: And my workspace is Ubuntu 3.13.0-66-generic. I need to use file descriptor. So, I can’t use filp_ functions(like filp_open). Edit1: My Makefile: obj-m += NAME.o Answer Calling system calls(sys_* functions) from the kernel code is not a good idea.
Attempting to pass Linux command output into a variable
I have the following code: With the following output: As you can see, gpio pin 123 is set to ‘in’ and 124 is set to ‘out’. However, both gp123 and gp124 are being assigned ‘in’. I am rusty with functions and C. Could you fellas help me out a little please? More specifically, why is it failing to assign the
Segmentation fault (core dumped) C linux
So i have to make a program that execution results are similar to those after using command who and who am i in linux. the problem is that both functions inside if(strcmp… and in else… are working when separated. The main issue is that i have to have them both in one file, and it just not work. When put
valgrind on raspberry Pi 2 invalid read by libtasn1
I’m currently trying to find a memory leak with valgrind on my Raspberry pi 2 Model b. My project is using the following compiler flags For debugging purposes i have removed all the code in my main function so it looks like: System uname -a: Linux debuggingpi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux valgrind
global hotkeys using xlib
I’m trying to get my C application to execute certain tasks when the ctrl+k button is pressed(OR CTRL SHIFT K not sure yet), documentation is a bit sccarce but I was able to find a cpp example and tried to mimic that code: I understand the keypresses are captured by the XGrabKey function, the xnext event reads the event and
What exactly do these arguments mean in linux?
I have a program written in C and the command I am supposed to run it with on linux looks like this: What exactly does that mean? I think X Y will be the arguments so argc[2] will be X and argc[3] will be Y? But what about –something? Thanks a lot! Answer The C runtime does not discriminate any