I’m working on a project that involves writing a new system call for Linux 3.18.20. This system call is supposed to store various information about the currently running process in a newly defined struct. One of the fields of the struct is the PID of the process’s youngest child, and I’ve been searching for information about this in the struct
Tag: c++
strange output from g_print
I get the following error when I compile my code: file.h: In function ‘add_new_set’: file.h:7:53: warning: format not a string literal and no format arguments [-Wformat-security] g_print (gtk_entry_get_text ((GtkEntry *)((struct data *) callback_params)->entry)); here’s my code: now when I press the button to run the g_print part, If I type in ‘%s test’ I get: (null) test now this seems
perf enable demangling of callgraph
How do I enable C++ demangling for the perf callgraph? It seems to demangle symbols when I go into annotate mode, but not in the main callgraph. Sample code (using Google Benchmark): build command: perf commands: I’ve also tried enabling the –demangle option, but that doesn’t seem to affect the output. callgraph missing demangled symbols: annotated disassembly showing demangled calls:
Mem alloced via mmap without munmap will cause leak after process exits or terminals
there is the code about alloc mem via mmap void *ret = mmap(NULL, 4 * 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); when process exits normally, the memory will be return to os ? Answer According to the man and under unmap: The region is also automatically unmapped when the process is terminated. Which sounds very reasonable as
Covariance matrix with opencl and opencv
I recently start to learn opencl and how to create kernel for OpenCV as well. I am still working with the basics. I need to implement an opencl kernel for calculate the covariance matrix. This function don’t have any opencl kernel already implemented by opencv’s fundation. Technically what I want to process is that : I found OpenCV’s fundation have
Extracting type info from printf format string
I’d like to extract c++ type information from a printf format string. For example, I’ve attempted this using parse_printf_format() from printf.h, but the returned argtypes don’t appear to include information about signed/unsigned. Is there some way to get signed/unsigned info as well? Answer As I said in my answer, the parse_printf_format is not made for what you need. You can
Working with semaphores and shared memory under Linux
I need to write a program that is creating a N amount of sub processes and every single one of them adds one to a shared memory variable. My idea is to use semaphores and shared memory, but the processes are not waiting for each other and the shared memory variable is also not working as I want it. mydefs.h
PHP popen Application cannot open shared object
I’ve created a simple C++ Application with the boost framework. The Application is running correct from the command line. After this I’ve created a PHP file with a popen to this binary. After visiting the website I’ve got the following error message from apache2/error_log System is openSuse Linux. Steps done: Insert lib path to /etc/ld.so.conf and running ldconfig Answer You
How to control global OpenMP settings from C/C++?
OpenMP doesn’t provide API to adjust some crucial settings in runtime, e.g. OMP_WAIT_POLICY or GOMP_SPINCOUNT (at least in gcc 4.8.3). Such settings are designed to be changed through environment variables for some reason. Not very convenient. Is there any way I can change such settings in run-time from C/C++ using gcc on Linux? For example, would it be enough to
How do I find what libraries need to be installed on a client linux machine if I compile a binary with a newer version of gcc?
Say I have a C++ binary that was compiled with a version of gcc say 4.4.x, which is used on a client linux box. If I want to upgrade my compiler to use a newer one, say 4.9.3 (because I want to use C++11): What kind of things would need to be upgraded on the client box to run this