Skip to main content
Filter by
Sorted by
Tagged with
3 votes
2 answers
1k views

Many functions of the C library are clearly marked as thread-safe or not thread-safe. For example, when I look at the manual of gmtime(3) there is a nice table that shows which of these functions are ...
Alexis Wilke's user avatar
  • 21.2k
2 votes
1 answer
359 views

I'm confused about the getppid syscall in linux. Does it return the pid of the process that spawned it or the current parent (which could be different if the original parent exited)?
rolen's user avatar
  • 57
3 votes
0 answers
844 views

The crate thread-priority is only supported on Windows and Linux operating systems but unfortunately isn't supported for macOS. So the only crate I found that would support macOS was libc but it lacks ...
zandtifing's user avatar
0 votes
1 answer
967 views

First I tried opening a file with fopen function and print content of the file using fprint function but it was just printing a bunch of symbols to the terminal. After a while I realized that it does ...
Suresh466's user avatar
2 votes
1 answer
353 views

I have closed-source shared library originally built for Android which I want to use on Raspberry Pi. The problem is this: /usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `__cxa_atexit@LIBC' /...
Anonymix321's user avatar
3 votes
1 answer
904 views

I'm cross-compiling for Raspberry Pi 4B using ARM's 10.3-2021.07 GCC toolchain (specifically this file uncompressed into ARMGCC). I'm also using the latest Raspberry OS image as sysroot (loop-mounted ...
vesperto's user avatar
  • 873
3 votes
1 answer
83 views

I am currently writing a bit of x86 assembly code and linking it with glibc using as and ld. .section .data str1: .asciz "\n" str3: .asciz "Hello" str4: .asciz &...
lowlevellarry's user avatar
33 votes
2 answers
3k views

This is a follow-up to a different question. The original question had other problems but I had to realize that the main one (according to CLang) was a redefinition of time as a different symbol while ...
Serge Ballesta's user avatar
-1 votes
2 answers
788 views

In C++ I wrote: time_t tmp1, tmp2; time(&tmp1); sleep(1); time(&tmp2); std::cout << tmp2-tmp1; But every-time I run it I see 1 printed, why the result is too perfect? shouldn't it ...
user avatar
2 votes
0 answers
372 views

I wanna create a gcc cross-compiler. I work on a WSL2 ubuntu 20.04 distrib and the target will be x86_64-elf ( for a bare metal project ). For this learning project, I need to build a C libray with ...
ExecAssa's user avatar
  • 317
0 votes
1 answer
674 views

I have built and installed mpich from source (mpich-3.4.1.tar.gz), using the steps given in 'https://www.mpich.org/static/downloads/3.4.1/mpich-3.4.1-README.txt'. I want the resultant executables to ...
bdd's user avatar
  • 63
2 votes
0 answers
72 views

My goal is to wrap malloc() with my own implementation and then inject that implementation into executables using LD_PRELOAD trick for educational purposes. I've made two files, test.c for testing the ...
andrey's user avatar
  • 1,605
1 vote
1 answer
743 views

I have a C++ test program that keeps the CPU busy: #include <cstdint> #include <iostream> // Linear-feedback shift register uint64_t lfsr1(uint64_t max_ix) { uint64_t start_state = ...
nnnmmm's user avatar
  • 8,954
1 vote
1 answer
843 views

I would like to read a GRIB file downloaded from server using ecCodes library in Rust. However, my current solution results in segmentation fault. The extracted example, replicating the problem, is ...
J.Lewandowski's user avatar
0 votes
1 answer
217 views

▶ldd /lib/x86_64-linux-gnu/libc.so.6 linux-vdso.so.1 (0x00007fff2b856000) /lib/$LIB/liblsp.so => /lib/lib/x86_64-linux-gnu/liblsp.so (0x00007f472effc000) /lib64/ld-linux-x86-...
shenzhigang's user avatar
3 votes
1 answer
275 views

I wrote a simple packet capture in Rust on docker hosted by macOS. However, libc::recv doesn't return forever. src/main.rs use std::io; fn main() -> io::Result<()> { let sock = unsafe { ...
thara's user avatar
  • 133
1 vote
1 answer
206 views

I'm learning ctypes module in python. I have the following code: code import sys print(sys.version) import ctypes libc = ctypes.CDLL("/lib/x86_64-linux-gnu/libc.so.6") print(libc) for x in &...
Meng Zhao's user avatar
  • 131
0 votes
1 answer
330 views

I know that these 2 functionalities are not provided by Bionics libc implementation. I do need these for a C++ to Android port. How can I solve this problem? I dont know where to start here. I get ...
tjk's user avatar
  • 13
3 votes
1 answer
327 views

The execvpe function is a GNU extension. If I want my code to e portable to non-gnu libcs, how can I change an execvpe call to be portable? execvp doesn't set the environment of the new program, and ...
Thayne's user avatar
  • 7,079
5 votes
0 answers
289 views

I want to statically compile a program with tcc. tcc complains with error: Unknown relocation type: 23. This is apparently caused by my libc implementation (glibc 2.28-10) using thread-local storage ...
Tom's user avatar
  • 61
1 vote
0 answers
168 views

I override the libc open() function like this and compile it to a shared library called libc_custom.so: struct sys_funcs_t { sys_funcs_t() { libc_hdl = dlopen("/usr/lib64/libc.so....
Alex's user avatar
  • 44
1 vote
1 answer
1k views

The man page for syscall says that the first argument is the system call number. On my system (linux x64), arguments are sent in rdi, rsi, rdx, rcx, r8 and r9. So, rdi receives the call number. The ...
AR7CORE's user avatar
  • 278
-1 votes
1 answer
871 views

To link gcc statically into a shared library, based on the answer in this question, the remaining problem is how to let the linker use the PIC version of libc.a instead of the non-PIC version. The ...
jw_'s user avatar
  • 1,825
2 votes
1 answer
488 views

I'm curious why there is so much about MT and MD on Windows and no-one is talking about linux. In linux, afaik, there is the libc.so as the MD equivalent, and the libc.a as the MT equivalent. Since ...
Jakub D.'s user avatar
2 votes
0 answers
110 views

I write a program,use time() function, When I gdb it : [VM_241_149_tlinux ~/test]$ gdb ./testsys_d -q Reading symbols from /data/home/youngxiao/test/testsys_d...(no debugging symbols found)...done. (...
youngxiao's user avatar
2 votes
1 answer
3k views

I am currently learning about binary exploitation. Now i am working with a binary (Linux) that is vulnerable to a stack buffer overflow (ASLR and NX are enabled, and binary is interacted with through ...
JojoTheCodeDude's user avatar
1 vote
1 answer
706 views

On Windows this can be done (though not recommended since pass c standard library object between different c library instances can have problem), like this: Every executable image (EXE or DLL) can ...
jw_'s user avatar
  • 1,825
3 votes
0 answers
327 views

I found out headers under "bits" directory are internal headers which general headers include. Then what does the name "bits" stand for?
Jangwoong Kim's user avatar
1 vote
1 answer
2k views

I am really confused. Please look at the following picture: I found out that there is a library in linux called glibc, which when we execute our c/c++ programs we use its functions and it calls the ...
capstonene's user avatar
27 votes
2 answers
4k views

Why does libc_nonshared.a exist? What purpose does it serve? I haven't been able to find a good answer for its existence online. As far as I can tell it provides certain symbols (stat, lstat, fstat, ...
peachykeen's user avatar
  • 4,491
0 votes
0 answers
613 views

I'm trying to build Glibc 2.25 on an Ubuntu 20.04 machine and using the build instructions given here : https://sourceware.org/glibc/wiki/Testing/Builds#Building_glibc_with_intent_to_install I'm ...
Parth Pratim Chatterjee's user avatar
0 votes
1 answer
858 views

While creating different benchmarks I often aim for the best latency. As you all know, memory in the heap is much more expensive to access than on the stack. We are now in 2021 and when I try ulimit -...
Antonin GAVREL's user avatar
6 votes
1 answer
275 views

I was looking at the source code of fread in chromium-os / glibc and became increasingly puzzled about it. NB: I am talking about the source code and NOT the use of fread or other related questions ...
Antonin GAVREL's user avatar
2 votes
2 answers
269 views

Does POSIX guarantees the ferror is set on open_memstream's FILE write operations? How do I check for out of memory condition on FILE operation if the FILE is created with open_memstream? I used to ...
Volodymyr Boyko's user avatar
4 votes
1 answer
11k views

I would like to install libc6 2.33 onto a debian docker container for security patch reasons. I can see here that it has been released, and also it is noted here that 2.33 is available. Is there any ...
Max Colledge's user avatar
2 votes
1 answer
1k views

Once the following code is running, it will eat all my memory and cause OOM issue on my ARM 64-bit processor. it seems that some 'delete' operations do not work... it confused me. Could any experts ...
benedict's user avatar
1 vote
1 answer
1k views

I'm working on Rust and using a shared library written in C++. The problem that the C++ library spawns a few threads that constantly print to stdout (1) and that interferes with my own logging. I was ...
user2828781's user avatar
1 vote
1 answer
802 views

So i was just tinkering with C libs in Rust and i found that the following code: extern crate libc; use libc::{c_char, c_int, size_t}; extern "C" { fn printf(fmt: *const c_char, ...) -&...
Mochida's user avatar
  • 72
4 votes
0 answers
4k views

ADD : This link (https://stackoverflow.com/a/48287761/2554472) had the answer for my question (Mark Plotnick's answer). Different title, duplicate answer. I'm using ddd(with gdb) to analyze a program(...
Chan Kim's user avatar
  • 6,159
0 votes
0 answers
151 views

I have this test program: #include "stdio.h" int main() { FILE* read; FILE* write; write = fopen("file.txt", "w"); fwrite("Hallo", 1, 6, write); ...
kuga's user avatar
  • 1,867
3 votes
2 answers
3k views

atom worked smoothly in my Dell Latitude 5410 running Ubuntu 18.04. Suddenly it won't open and looking at tail -F /var/log/syslog I got a libc-2.31.so segfault: Jan 15 03:22:17 enrico-dell-latitude-...
cccnrc's user avatar
  • 1,249
0 votes
1 answer
2k views

I want to get some output on a RISC-V program (assembly) running on top of pk on Spike using newlib. I can call printf with null terminated strings eg (snippet) la a0 msg_ jal printf .data msg_ ....
adrianmcmenamin's user avatar
7 votes
1 answer
450 views

The C spec mandates all C programs have 3 streams open and available to them: stdout, stdin, stderr. The users can use these streams as they see fit, e.g.: fprintf(stdout, "lol"); fputs(&...
Pod's user avatar
  • 4,189
1 vote
1 answer
640 views

I am cross compiling (using x86_64-linux-android-gcc) to build GNU libc, GLIBC version 2.32, for x86_64-linux-android. Getting the error "inconsistent operand constraints in an __asm" from ...
user3063547's user avatar
8 votes
2 answers
3k views

Can a system call happen in a C program? Consider this: int main() { int f = open("/tmp/test.txt", O_CREAT | O_RDWR, 0666); write(f, "hello world", 11); close(f); ...
taranom's user avatar
  • 183
8 votes
1 answer
4k views

I do not understand the llvmlibc-restrict-system-libc-headers check in Clang Tidy (link). I include C libraries in C++ code like this: #include <cstddef> What should I change to fix this Clang ...
Wouter Beek's user avatar
  • 3,407
0 votes
1 answer
283 views

Okay, I give up. I can't read C for my life! What is the structure of time_t below? /usr/include/bits/types/time_t.h #ifndef __time_t_defined #define __time_t_defined 1 #include <bits/types.h>...
Todd's user avatar
  • 976
7 votes
1 answer
9k views

I am trying to use the remote development via ssh feature of VS Code. When connecting to the remote server I encounter: Missing GLIBCXX >= 3.4.18! >Found versions 3.4.1 > 3.4.2 > ... > ...
operator's user avatar
  • 195
2 votes
1 answer
1k views

I'm currently studying dynamic memory allocation and I've got a question on realloc function. I've learned that the contents of the newly allocated block should be same as those of the old block, up ...
이호영's user avatar
1 vote
0 answers
242 views

I'm looking for a way to detect where pthread functions really exist (libc, libpthread or both). My motivation is that GNU libc seems to be moving the pthread functions from libpthread to libc. I need ...
Paul Floyd's user avatar
  • 7,180

1
3 4
5
6 7
23