Skip to content
Advertisement

Tag: c++

Checking for specific system call support in inline assembly

My application builds on environments that are older, and do not support newer (specific) system calls. I can’t go upgrading them for reasons I can’t disclose, but instead of making it compile time (which would lose out on any ‘benefits’) I was wondering if there’s a way to do in inline assembly. For example: Is there a way to check

1506-221 (S) Initializer must be a valid constant expression

In AIX during compilation of header file i am facing this issue. Header file (header1.h) has the structure like this: now in .c file including header1.h when i’m compiling the above .c file using xlc compiler it is throwing the error: header1.h”, line xxxx: 1506-221 (S) Initializer must be a valid constant expression. make: 1254-004 The error code from the

ARM GDB cannot access memory only on Linux

Trying to switch development to Linux, but running into a (probably simple newbie) problem. On my Mac, I can use ARM GDB (arm-eabi-none-gdb from the GNU ARM Embedded Toolchain) to load my elf to my STM32L432, then at my breakpoints a simple i lo (or examine, or whatever) gives me the local vars. On Linux, however, the exact same code

Global variables in header only library

I’m writing a header-only logger library and I need global variables to store current logger settings (output flags, log file descriptor etc.). My thoughts: I can’t declare variables as extern, as i don’t have access to the translation units to define them I can’t just define global variables in header as it will lead to multiple definitions static variables in

How to get list of files in directory smb libcurl?

I’m trying to get a list of files in the directory with libcurl from the SMB server. But I have a error: If I try to get the file then everything will be okay: Answer It is not currently supported by libcurl. It is however mentioned in the TODO as something that we’d like to see added one day.

Is there any way to “try umount” before actually preform umount?

There can be several mount points under management in linux. I want to umount them all or don’t umount any. Since there are cases when linux cannot umount a device (like someone is on the mount point), I want to add a function to check all mount points and see if the devices can be umounted before I actually perform

Where to find the source code of timespec_get?

The C11 standard provides the function timespec_get. If I run the example code on cppreference, or on my computer, it works: However, if I look at the sources of glibc here, the code is the following: Which… should not work… Which leads to the question: where is the source code of timespec_get that is actually called? Answer The timespec_get function’s

C code to access environment variables

I created an environment variable SHELLCODE which contains a 200-byte long NOP sled and a shellcode. It is stored at 0x7fffffffe285, but I’ll try to access 0x7fffffffe2e5, which is around the middle of the NOP sled. Then I wrote the following code to try to access the variable. I used gdb to see the memory The pointer was clearly pointing

Advertisement