I am using a Linux periodic timer, in particular, timerfd, which I set to expire periodically, for instance, every 200 ms. I noticed, however, that the timer seems to expire, sometimes, a little before with respect to the timeout I set. In particular, I’m using the following C code to perform a simple test: After compiling it with gcc: I’m
Tag: c++
What is the size in bits of a file descriptor in an x64 system running Ubuntu 19.10?
What is the size in bits of a file descriptor such as standard input and standard output, is it a 32-bit integer? Answer If you are talking about the actual file descriptors returned by (and used for) Linux syscalls, then take a look at the manpage for open etc. as @JonathanLeffler suggests. For instance: The return value of open() is
error while loading shared libraries: libgmock.so: cannot open shared object file: No such file or directory
I am currently facing an issue with a project of mine foudn while configuring CI. Resume The problem faced is the following: error while loading shared libraries: libgmock.so: cannot open shared object file: No such file or directory. For the problem above I am not installing the google test/google mock framework but I am compiling it. Although it says it
BUILD_BUG_ON_ZERO not working in a simple user space application
I tried to use BUILD_BUG_ON_ZERO in a simple user space application and it is failed to compile Can anyone please provide me hints on the error. Answer The macro BUILD_BUG_ON_ZERO is intended to be used with a constant expression as defined in 6.6 constant expression. i isn’t a constant expression – it’s just a local variable. Even const qualified objects
x86_64-conda_cos6-linux-gnu-cc: Command not found with postgres function makefile
I am trying to do this tutorial: https://linuxgazette.net/139/peterson.html so I can learn to write postgres functions. It says to use this makefile, which fails: Errors: I have tried several things, including updating conda and anaconda, as per the answers to similar questions. Nothing has worked yet. How do I compile postgres function given this situation? Answer This error has occurred
Is it possible to make a hardcoding with the help of the command objcopy
I’m working on Linux and I’ve just heard that there was a command objcopy, I’ve found the relative command on my x86_64 PC: x86_64-linux-gnu-objcopy. With its help, I can convert a file into an obj file: x86_64-linux-gnu-objcopy -I binary -O elf64-x86-64 custom.config custom.config.o The file custom.config is a human-readable file. It contains two lines: Now I can execute objdump -x
Execute binary file inside C code (No system())
I am trying to execute a binary executable file inside C code without using system since it has security and resource management issues. The system used here is Debian Buster with kernel 5.4.0-2-amd64 and gcc 9.2.1. I used the method in this question: execute binary machine code from C which is to convert executable into hexadecimal code with xxd -i,
Why is there a “gap” beween the variables that I initiated in the stack?
I’m trying to play around with a buffer overflow. When the program counter gets to if(modified != 0), the base pointer is 0x00007fffffffdfe0. Right below the base pointer, I see 4 bytes that contains integer 0 which makes sense. However, the buffer is not right below the int modified. It looks like 4 bytes of 0s then 0x00007fff are in
strstr() and exit(0) trouble in C
so I’m working on a simulated linux shell using C (homework), and I have it exiting the program if the user just simply types in “quit”. However, if they throw “exit” somewhere inside a command… “cat file ; exit” I need it to execute the command like normal, then quit. I know that I still have to filter the string
Blazor : Change image src with @Onclick without js
i’m begin to learn c# after years of Delphi. I decide to learn about blazor. i’m trying to program about basic card mind game. There must be random images on page and on init page all images with black picture (0.jpg) I am creating randomized image’s id property with for loop at top of the xxx.razor For example When the