Skip to content

Tag: c++

Re-opening stdout and stdin file descriptors after closing them

I’m writing a function, which, given an argument, will either redirect the stdout to a file or read the stdin from a file. To do this I close the file descriptor associated with the stdout or stdin, so that when I open the file it opens under the descriptor that I just closed. This works, but the proble…

C wait3() int* status or int* stat_loc

I indeed to use wait3(). I have been looking what exactly is status/stat_loc but I couldn’t find it anywhere. Any explanation is greatly appreciated! Answer man wait explains the semantics of status:

gdb how to get thread name displayed

There are many threads created in my application. some of the threads name are visible in the gdb while i execute the command ‘info threads’, others are not displayed. How to get all the thread name itself instead of the hex value like 0xb7fe1424 Answer If you upgrade to gdb 7.3 or later, “i…

“SO” file conversion to readable format

Is there any way to convert “.so” file into source code or some in readable format. Answer Source code is probably hard, since the .so doesn’t “know” which language it was written in. But you can browse around in the assembly code by doing something like this:

How can I do congestion control for a UDP protocol?

I have a custom UDP protocol with multiple senders/receivers designed to send large files around as fast as possible. It is client/server based. How can I detect congestion on the LAN to slow the rate of UDP packets being sent? EDIT: please, no comments on the use of UDP whether it’s suitable or not. Th…

High performance reading – linux/pthreads

I have moderately large binary file consisting of independent blocks like this: header1 data1 header2 data2 header3 data3 … The number of blocks, the size of each block and the total size of the file vary quite a lot, but typical numbers are ~1000 blocks and average blocksize 100kb. The files are genera…