Skip to content
Advertisement

Tag: c++

socket recv function not returning updated value

Trying to create socket application using c (Linux) to constantly fetch data from a server For this I have created a loop and inside it the routine connects , send a command, receive some data and close the socket. It works fine for the first interaction but looks like the recv function failing to update the buffer variable from second

Signal Handling C programming on ubuntu

While I sending kill -9 command to a program on ubuntu , I want to close other running processes before the program closes.I am trying this with c programming . Could it be something like this? How can I say program if you get KILL command you should do something? Answer Per the POSIX standard <signal.h> documentation: … The following

Know who is the inheritor while debugging core dumps with GDB

My process has crashed, and I have a core dump. I see that the process crashed while running a code similar to that : I have a full call stack in the core dump, but I don’t know who is the inheritor that runs the “func”. Is there a way to figure it out (maybe by some pointer calculation tricks

C – get list of opened handlers – duplicate entries

I have this code to retrieve list of opened handlers (mostly FILE) However, when i call single fopen and run this, it prints the same file multiple times (from n to FD_SETSIZE, where n is some offset id… first 0 .. n are some system handlers like dev/nul etc.). Answer Your error check after fcntl(fd, F_GETFD, 0) is a bit

Can I use 1G superpages to back shared mmaps?

So far when I’ve tried using a file in /mnt/hugepages1G/ as the backing I get segfaults. It works fine if I use 2M superpages in /mnt/hugepages/ I think I read somewhere that I now can’t find that Linux only supports 2M pages for Shared memory? But I can’t swear to it. Can’t find it in documentation. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/vm/hugetlbpage.txt?id=HEAD $ hugeadm –pool-list

libopencv_core.so.2.4: error adding symbols: DSO missing from command line

I have installed OpenCV 3.3.0 to Ubuntu 16.04. Just want to compile this code. g++ -o main gpu_thresh.cpp ‘pkg-config opencv –cflags –libs’ -lopencv_gpu -lopencv_core g++ -L/usr/local/lib -o main gpu_thresh.cpp ‘pkg-config opencv –cflags –libs’ -lopencv_gpu -lopencv_core I tried to compile it with these ways but still giving same warning and error. /usr/bin/ld: warning: libopencv_core.so.2.4, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libopencv_gpu.so, may conflict with libopencv_core.so.3.3

C code about pointers

I’ve got this simple code that plays with pointers taken from Jon Eriksen’s book that I’m trying to compile but gcc gives me warnings in compilation and segmentation fault (core dumped) when I run it. Output: Answer This program is wrong, and the advice given in the book is obviously wrong, too. A pointer can be converted to an integer

Advertisement