glibc

namespace issues in c++11?

被刻印的时光 ゝ 提交于 2019-12-01 15:01:12
问题 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

Can malloc_trim() release memory from the middle of the heap?

自古美人都是妖i 提交于 2019-12-01 13:31:52
I am confused about the behaviour of malloc_trim as implemented in the glibc. man malloc_trim [...] malloc_trim - release free memory from the top of the heap [...] This function cannot release free memory located at places other than the top of the heap. When I now look up the source of malloc_trim() (in malloc/malloc.c) I see that it calls mtrim() which is utilizing madvise(x, MADV_DONTNEED) to release memory back to the operating system. So I wonder if the man-page is wrong or if I misinterpret the source in malloc/malloc.c. Can malloc_trim() release memory from the middle of the heap? ...

centos7(Linux)配置MySQL

霸气de小男生 提交于 2019-12-01 12:42:43
一、安装MySQL 1、下载安装包mysql-5.6.34-linux-glibc2.5-x86_64.tar(可前往官网自行下载: http://dev.mysql.com/downloads/mysql/) 2、卸载系统自带的Mariadb 打开Terminal终端: [root@localhost ~]# rpm -qa|grep mariadb // 查询出来已安装的mariadb [root@localhost ~]# rpm -e --nodeps 文件名 // 卸载mariadb,文件名为上述命令查询出来的文件 3、删除etc目录下的my.cnf [root@localhost ~]# rm /etc/my.cnf 4、执行以下命令来创建mysql用户组 [root@localhost ~]# groupadd mysql 5、执行以下命令来创建一个用户名为mysql的用户并加入mysql用户组 [root@localhost ~]# useradd -g mysql mysql 6、将下载的压缩包放到 /usr/local/ 目录下(通过mv 要移动的文件 /usr/local/) 7、解压安装包 [root@localhost ~]# tar -xvf mysql-5.6.34-linux-glibc2.5-x86_64.tar 注:如果压缩包为:mysql-5

gets() function and '\\0' zero byte in input

可紊 提交于 2019-12-01 12:41:24
Will the gets() function from C language (e.g. from glibc) stop, if it reads a zero byte ( '\0' ) from the file ? Quick test: echo -ne 'AB\0CDE' Thanks. PS this question arises from comments in this question: return to libc - problem PPS the gets function is dangerous, but it is a question about this function itself, not about should anybody use it or not. The behavior of gets() is that it stops when a newline character is encountered or if EOF is encountered. It does not care if it reads \0 bytes. C99 Standard, 7.19.7.7 Synopsis #include <stdio.h> char *gets(char *s); Description The gets

“C or gcc” is like “Chicken or the egg” ? :( [duplicate]

牧云@^-^@ 提交于 2019-12-01 11:19:02
Possible Duplicate: How are gcc/g++ bootstrapped? I would like to know how gcc is compiled as we all know it is written in C. Did they used some other compiler to come up with gcc? If so, can I use the same compile to compile my C program? There is no chicken and egg here. glibc is compiled with the compiler you are using. That compiler was first compiled with a previous version of the same compiler. Then it can compile itself as well. The real chicken-and-egg problem was solved in the 1950's when someone had to write the world's first compiler. After that, you can use one compiler to compile

(二)、MariaDB、Apache软件安装

半世苍凉 提交于 2019-12-01 10:49:14
概述 上一篇文章我们了解了一些关于LAMP的知识,其中还学到了关于MySQL的安装,本文将要讲的是与MySQL类似的 MariaDB 软件的安装。在构建lamp的时候选择其中一个安装就行了 数据库已经安装好了就该安装httpd了,这里我们用的是 Apache 软件的2.4版本,这个版本需要我们手动编译安装 apr 以及 apr-util 包。 MariaDB安装 准备 先把下载的二进制安装包,放到到指定目录 因为源网站下载速度太慢,我们这里是windos上下载好 在传到linux中去的 先从windos上把包传到linux下 # 一般下载的包 都在这里,所以传文件也指定到这里方便我们查找 [root@centos001 src]# cd /usr/local/src/ 1.Linux和windows互传文件 安装yum包 ###用yum安装一个包 lrzsz 2.从windows传文件到linux 命令rz # 选项:rz -r适用于异常状态时,如传送出错 3.解压压缩包 tar zxvf 包名 安装步骤 初始化 #进入目录 [root@centos001 ~]# cd /usr/local/src/ [root@centos001 src]# ls httpd-2.2.34 mysql-5.1.73-linux-x86_64-glibc23.tar.gz httpd-2.2.34

centos 7-64bit 安装 oracle11g

假如想象 提交于 2019-12-01 10:10:07
// 注释 # root用户 $oracle用户 1. 关闭安全措施 # chkconfig iptables off // 永久关闭防火墙 # service iptables stop // 暂时关闭防火墙,重启系统后会自动打开 # sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config // 关闭Selinux 2. 验证硬件 2.1 内存: 要求:内存最小1G,推荐2G或者更高。 查看命令:# grep MemTotal /proc/meminfo 2.2 Swap: 要求: RAW Swap 1G至2G 1.5倍 2G至16G 同RAW相等 16G以上 16G 查看命令:# grep SwapTotal /proc/meminfo # free 3. 验证软件 3.1 操作系统 Asianux Server 3 SP2 Oracle Linux 4 Update 7 Oracle Linux 5 Update 2 (with Red Hat Compatible Kernel) Oracle Linux 5 Update 5 Oracle Linux 6 Oracle Linux 6 (with Red Hat Compatible Kernel) Red Hat Enterprise

GDB step into Dynamic linker(ld.so) code

别来无恙 提交于 2019-12-01 09:39:54
I wanted to step into the code of ld.so whenever it will be used in my normal c code. I am trying to code flow through GDB in the TUI mode where you can see both source code and assembly as you step over the code. For this I also installed libc-dbg binutils-source package from ubuntu package manager. GDB can find the debug symbols for the ld.so itself and I can step at the instruction level that is using si but I cant step at the source level as GDB is not able to find the source for ld.so and shows NO Source Available . How can I make GDB find the source for ld.so so that I can also see which

“glibc free(): invalid next size(fast)” on vector.push_back?

删除回忆录丶 提交于 2019-12-01 09:39:26
When I run my program it will occasionally crash and give me this error: " glibc detected /pathtoexecutable: free(): invalid next size (fast)" The backtrace leads to a member function that just calls a vector's push_back function - void Path::add(Position p) {path.push_back(p);} I have tried googling the error and the very large majority of the problems are people allocating too little memory. But how could that be happening on an std::vector<>.push_back? What can I check for? Any help is appreciated. You're probably doing an invalid write somewhere and trashing the control information kept by