glibc

Inconsistency in definitions of fputwc(), putwc() and putwchar() in glibc

拜拜、爱过 提交于 2019-12-02 00:36:41
Why fputwc() , putwc() and putwchar() take argument of type wchar_t instead of wint_t ? This contradicts corresponding non-wide character functions fputc() , putc() and putchar() , which take int , not char . tversteeg That is because wchar_t is required to hold an WEOF value and char is not required to hold an EOF value. For char , the fputc() , putc() and putchar() functions need to accept values which can hold both values in the unsigned char and EOF range, where EOF can be a negative number so a int is required to hold them both. 1 Whereas wchar_t itself is required to hold a WEOF

How to load library defined symbols to a specified location?

纵然是瞬间 提交于 2019-12-02 00:25:36
The test is on Ubuntu 12.04, 32-bit, with gcc 4.6.3. Basically I am doing some binary manipulation work on ELF binaries, and what I have to do now is to assemble a assembly program and guarantee the libc symbols are loaded to a predefined address by me. Let me elaborate it in an simple example. Suppose in the original code, libc symbols stdout@GLIBC_2.0 is used. #include <stdio.h> int main() { FILE* fout = stdout; fprintf( fout, "hello\n" ); } When I compile it and check the symbol address using these commands: gcc main.c readelf -s a.out | grep stdout I got this: 0804a020 4 OBJECT GLOBAL

学习嵌入式开发——简介及搭建开发环境

旧城冷巷雨未停 提交于 2019-12-01 23:56:52
嵌入式技术的发展经历了单片机(SCM)、微控制器(MCU)、系统级芯片(SoC)3个阶段。 SCM——随着大规模集成电路的出现及其发展,计算机的CPU、RAM、ROM、定时数器和多种I/O接口集成在一片芯片上,形成芯片级的计算机。 MCU——MCU的特征是满足各类嵌入式应用,根据对象系统要求扩展各种外围电路与接口电路,突显其对象的智能化控制能力。实际上,MCU、SCM之间的概念在日常工作中并不严格区分,一概以单片机称呼。随着能够运行更复杂软件(比如操作系统)的SoC的出现,“单片机”通常是指不运行操作系统、功能相对单一的嵌入式系统,但这不是绝对的。 SoC——SoC的特征是实现复杂系统功能的VLSI;采用超深亚微米工艺技术;使用一个以上嵌入式CPU/数字信号处理器(DSP);外部可以对芯片进行编程;主要采用第三方IP进行设计。 嵌入式处理器种类繁多,有ARM、MIPS、PPC等多种架构。但由于ARM处理器的文档丰富,各类嵌入式软件大多支持ARM处理器,使用ARM开发板来学习嵌入式开发是一个好选择。 基于ARM的处理器以其高速度、低功耗、价格低等优点得到非常广泛的应用,它可以应用于以下领域:为无线通信、消费电子、成像设备等产品提供可运行复杂操作系统的开放应用平台;在海量存储、汽车电子、工业控制和网络应用等领域提供实时嵌入式应用;安全系统,比如信用卡、SIM卡等。

Linux信号使用及自定义信号

点点圈 提交于 2019-12-01 22:21:34
linux自定义信号: https://www.cnblogs.com/bigben0123/p/3186661.html linux信号、值及解释: https://blog.csdn.net/luotuo44/article/details/16799607 信号处理: https://wiki.jikexueyuan.com/project/cplusplus/signal-handling.html 没什么kill -l没有32 33 http://www.kbase101.com/question/30858.html __SIGRTMIN 和 SIGRTMIN: 两个是不同的,SIGRTMIN在 __SIGRTMIN 基础上+2 执行 kill -l 会列出了下信号 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23)

Is there a portable/standard-compliant way to get filenames and linenumbers in a stack trace?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 21:13:01
I've just read How to generate a stacktrace when my gcc C++ app crashes which is pretty old by now (5 years). Some answers suggest solutions allowing you to get, for every stack frame, the name of the function and an offset (within the stack I guess). But what I (and may others) really need is the source filename and line number where the call was made (assuming the code was compiled with debug information). One of the answers linked to a part of glibc which does this (libSegfault; see files in this directory - segfault.c , backtracesyms.c , backtracesymsfd.c ) - so it is possible . My

Looking for C source code for snprintf()

天大地大妈咪最大 提交于 2019-12-01 20:08:43
问题 I need to port snprintf() to another platform that does not fully support GLibC. I am looking for the underlying declaration in the Glibc 2.14 source code. I follow many function calls, but get stuck on vfprintf(). It then seems to call _IO_vfprintf(), but I cannot find the definition. Probably a macro is obfuscating things. I need to see the real C code that scans the format string and calculates the number of bytes it would write if input buffer was large enough. I also tried looking in

安装升级libpcap至1.9.0

百般思念 提交于 2019-12-01 19:50:13
不看别人的是不会装的,装过就忘了,所以记在这里 1、首先安装或者升级glibc 2.17 CentOS 6.x 如何升级 glibc 2.17 2、然后安装flex yum -y install flex 3、然后安装bison yum -y install bison 4、安装完成后验证 你可以看其他人的方法,直接编写c,还有一个简单方法,再安装tcpdump yum -y install tcpdump 安装完成后,使用如下命令查看安装或者升级了的libpcap版本 tcpdump --version 来源: https://www.cnblogs.com/lizhaoxian/p/11715373.html

What is the version number field in the output of the linux file command

99封情书 提交于 2019-12-01 17:51:23
问题 If I do the following command on my executable called "version", compiled on Fedora Core 11, I get this output file version version: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18 , not stripped What's the significance of the 2.6.18 number towards the end, and is it any use in distinguishing to customers which version of some software they should download ? From what I've looked at so far, this number is definitely not The

namespace issues in c++11?

点点圈 提交于 2019-12-01 16:25:13
Can somebody please explain the following: $ cat test.cpp #include <string> std::string div; $ g++ -c test.cpp $ g++ -std=c++11 -c test.cpp test.cpp:2:13: error: 'std::string div' redeclared as different kind of symbol In file included from /usr/include/c++/4.7.1/cstdlib:66:0, from /usr/include/c++/4.7.1/ext/string_conversions.h:37, from /usr/include/c++/4.7.1/bits/basic_string.h:2814, from /usr/include/c++/4.7.1/string:54, from test.cpp:1: /usr/include/stdlib.h:787:14: error: previous declaration of 'div_t div(int, int)' $ Shouldn't the div symbol be in std namespace also for C++11 mode? Or

C linkage for function pointer passed to C library

谁说胖子不能爱 提交于 2019-12-01 15:13:39
问题 My case is pretty simple: I want my C++ program to deal with Unix signals. To do so, glibc provides a function in signal.h called sigaction , which expects to receive a function pointer as its second argument. extern "C" { void uponSignal(int); } void uponSignal(int) { // set some flag to quit the program } static void installSignalHandler() { // initialize the signal handler static struct sigaction sighandler; memset( &sighandler, 0, sizeof(struct sigaction) ); sighandler.sa_handler =