When I built a program with –static option and it calls shm_open() function I get Segmentation fault. Without -static option all works like a charm. Does anybody know why? Below I have cited a debug info and a part of truncated source code from a big project. You can comment/uncomment string from Makefile to reproduce the bug. $ gdb –args
Tag: c++
rpm -q -> query only the descripton
I can query the informations about a rpm-package with Example-Result of a Query: But I only want to query the Description. Is that possible? The reason for that is that I want to process this information (the Description) in a C++ Program (I do this with popen()). Maybe something like this: Answer This is the correct sollution:
How to exit while loop when read() blocks
In a problem given by university we have to pipe from a parent process(P1) to its child P2, and afterwards P2 must pipe to another child of P1, the other child is P3. Both P2 and P3 are to be written in c and made into executable files. They will then by execed by child processes in P1. P1 writes
C Threaded Sockets – tcp with TLS, Can’t get ip/ether packet headers
thanks for reading this question. Have been working for a while on C sockets – specifically c threaded tcp sockets with tls. Using the Openssl API. I have been facing an issue for some time now where I can get the source IP and Port – e.g printf(“Connection: %s:%dn”,inet_ntoa(d->addr.sin_addr), ntohs(d->addr.sin_port));. The problem is that I need all the data –
Ruby, ffi, and a custom C library
I’m trying to create a custom C library I can call from Ruby using FFI. My library will wrap certain libtiff functions with my own code, and the resulting higher-level functions will be called from within Ruby via the FFI interface. I’ve got test code working in C, that compiles successfully to a .so file. I’ve got that same code
Makefile: Cpp Files in Different Directories, Redirect Object Files to ./obj and Executable to ./bin
my directory structure looks like this I would like to write a Makefile that will 1) create three object files, main.o, class1.o and test-wrapper-class.o and place those files in the obj directory 2) use those object files to create an executable that will be placed in the bin folder 3) have a clean that will delete all files in obj
fork: child process doesn’t stay in an infinite loop
In the above code snippet inside if statement if we put while(1), it doesn’t remains blocked and when enter key is pressed program is exited, but in case of parent if we put while(1), parent remains blocked until we give ctrl+c. Please clarify this behaviour of child. Answer In the above code snippet inside if statement if we put while(1),
VS Code will not build c++ programs with multiple .ccp source files
Note that I’m using VS Code on Ubuntu 17.10 and using the GCC Compiler. I’m having trouble building a simple program which makes use of additional .ccp files. I’m probably missing something obvious here as I’m fairly new to programming but I’ll explain what I’ve done so far. This is something that is stopping me from continuing with a tutorial
Client/Server pthreads program not executing under Valgrind. Runs fine normally
I have a C server program that creates & opens the write end of a named pipe (in /var/run), and interrupts on a SIGIO signal for a tty uart, pushing data into the pipe from that interface. This program also spawns a secondary pthread, which opens the read end of a separate pipe (again, in /var/run), reads from it (blocking),
Wait for signal, then continue execution
I am trying to make a program that suspends its execution until a signal arrives. Then, after the signal arrives I just want my code to continue its execution from where it was. I don’t want it to execute a function handler or whatsoever. Is there a simple way of doing this? I have been struggling for a week or