glibc

Writing to a closed, local TCP socket not failing

让人想犯罪 __ 提交于 2019-12-17 07:13:20
问题 I seem to be having a problem with my sockets. Below, you will see some code which forks a server and a client. The server opens a TCP socket, and the client connects to it and then closes it. Sleeps are used to coordinate the timing. After the client-side close(), the server tries to write() to its own end of the TCP connection. According to the write(2) man page, this should give me a SIGPIPE and an EPIPE errno. However, I don't see this. From the server's point of view, the write to a

difference between %ms and %s scanf

六月ゝ 毕业季﹏ 提交于 2019-12-17 06:49:11
问题 Reading the scanf manual I encounter this line: An optional 'm' character. This is used with string conversions (%s, %c, %[), Can someone explain it with simple example stating the difference and the need of such option in some cases ? 回答1: The C Standard does not define such an optional character in the scanf() formats. The GNU lib C, does define an optional a indicator this way (from the man page for scanf ): An optional a character. This is used with string conversions, and relieves the

What is a glibc free/malloc/realloc invalid next size/invalid pointer error and how to fix it?

我的梦境 提交于 2019-12-17 04:31:06
问题 You are most likely seeing this question because your question has been closed as a duplicate of this. For a moderately complete list of related questions, please see A long list of possible duplicates — C memory allocation and overrunning bounds on Meta Stack Overflow. Example Question From free char*: invalid next size (fast) asked by noobie on 2014-04-11. I am freeing a char* after a concatenation process, but I receive this error: free(): invalid next size (fast): 0x0000000001b86170 This

Hyperledger Fabric make: *** No rule to make target问题

寵の児 提交于 2019-12-17 04:27:56
Hyperledger Fabric make: *** No rule to make target问题 最近一段时间,改Fabric代码,发现没法编译了!make总是报找不到target! ➜ fabric git: ( master ) ✗ make configtxgen make: *** No rule to make target ` .build/bin/configtxgen', needed by ` configtxgen' . Stop. make 输出debug信息,没有error,只是告诉必须重新make ➜ fabric git: ( master ) ✗ make configtxgen -d .. . Must remake target ` .build/bin/configtxgen'. make: *** No rule to make target ` .build/bin/configtxgen ', needed by `configtxgen' . Stop. ➜ fabric git: ( master ) ✗ 后来,在其他机器上发现,存在.build文件的可以通过编译。 从对应版本的项目中复制fabric/.build过来,就可以编译了。 ➜ fabric git: ( master ) ✗ cp .. /fabric-dev/

Using C++ library in C code

不想你离开。 提交于 2019-12-17 02:04:49
问题 I have a C++ library that provides various classes for managing data. I have the source code for the library. I want to extend the C++ API to support C function calls so that the library can be used with C code and C++ code at the same time. I'm using GNU tool chain (gcc, glibc, etc), so language and architecture support are not an issue. Are there any reasons why this is technically not possible? Are there any gotcha's that I need to watch out for? Are there resources, example code and/or

CentOS6.5 环境下调用lightgbm库报错: OSError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/python3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so)

拈花ヽ惹草 提交于 2019-12-17 00:33:40
1、为何报错?   因工作需要在linux环境下运行一些python代码,用到了lightgbm库,而因为CentOS6.5的glibc版本内置是比较低的,而python代码编译时用了较高的版本。 2、网上的解决方案   百度以后发现是比较常见的错误,网上给出的方式一般是分两种   1、使用类似 libstdc++.so.6.0.26 的一个文件替换原有的 动态链接库     本人尝试该方法没有成功,不过找到了对应文件(libstdc.so_.6.0.26),似乎多数地方都需要C币,在此免费分享给大家。     具体使用方法推荐下述链接,希望使用该方法就可以解决问题。 博客链接:https://blog.csdn.net/u012811841/article/details/77854581/文件链接:http://www.vuln.cn/wp-content/uploads/2019/08/libstdc.so_.6.0.26.zip   2、第二种是尝试编译整个库,也没有成功,而且比较费时间,对编译了解的比较多的人可以尝试一下,这里就不贴链接了。   3、第三种是修改依赖程度的,这个没有做过尝试。贴一下链接,可能会提供一些思路,但方法并未尝试过。 博客链接:https://www.cnblogs.com/jhc888007/p/9400450.html 3、最终选用的方法(推荐

01.初识MySQL

ⅰ亾dé卋堺 提交于 2019-12-16 23:44:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> MySQL理论 1. 数据库 数据: 数据就是一种符号,记录人类认为有价值的东西,例如图片、视频、文字、表格等 从计算机角度来看,就是二进制、16进制的文件 数据库的分类: RDBMS:关系型数据库管理系统 二维表结构,有清楚的行列结构,提供丰富的查询功能,高一致性,性能较差 适用数据安全要求较高的场景 NOSQL:无结构化存储 key volume键值存储或jeon格式,性能较高 适用于性能要求较高,安全性要求不是太高的场景,可配合RDBMS使用 NewSQL:新式的关系型数据库管理系统,就是RDBMS+NOSQL的组合 2. 数据库产品 RDBMS NOSQL NEWSQL MySQL(Oracle) Redis PinCAP产品: TiDB Oracle MongoDB Ali使用:PolarDB + OB MSSQL Memcached Tencent使用:TDSQL PG ES 3. MySQL版本选用 mysql社区版本类型 MR|RC:测试开发版 GA:稳定发布版 MySQL:尽量使用双数版 5.6.34 - 5.6.42 5.6.36:2017-3.18 GA 5.7.20 - 5.7.26 5.7.20:2017-9-13 GA 产品线 MySQL: E:企业版 C:社区版 5.0 5.1 5

记一次诡异的memcpy问题

泄露秘密 提交于 2019-12-14 23:23:25
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 当你看到这个标题,心里一定在想肯定是因为内存重叠导致的bug,我承认你是对的,但也不全对,如果你对此感兴趣可以继续往下看,你一定会有所收获。 首先我简单介绍一下背景,最近公司的项目遇到个诡异的问题,当客户端同时发送多个包时,服务端有一定概率解析不了,我们的协议格式是4字节头+消息体,每解析一条完整的包,就使用memcpy将剩余的数据copy到buffer头,类似这样的代码:memcpy(buffer, buffer+offset, len)。就是这样一行简单的代码,却有一定机率出现数据copy错误。【细心的读者可能注意到,其实不需要memcpy,每次都memcpy太浪费了,直接使用指针偏移就可以,没错,正确的姿势确实应该是这样,但是我很庆幸出现了这样的代码,不然可能要错过这么有意思的事,并且如果后续的数据不足一个完整的包,那么还是需要memcpy,所以这个问题最终还是会遇到】。 在详细说明之前,我先简单介绍一下memcpy,搞c/c++的对他肯定很熟悉,其主要用途就是用来copy内存,但需要注意的是在出现内存重叠时,可能会出现bug。在copy内存时源地址和目标地址可能有三种情况:1、源地址与目标地址完全不重叠;2、源地址与目标地址重叠且目标地址小于源地址;3、源地址与目标地址重叠且目标地址大于源地址

RHEL 6 - how to install 'GLIBC_2.14' or 'GLIBC_2.15'?

╄→гoц情女王★ 提交于 2019-12-14 04:16:19
问题 I need these 2 packages installed on RHEL 6 linux system. They are required by several other programs. When I do: sudo yum install glibc-devel this is output: Loaded plugins: product-id, security Setting up Install Process Package glibc-devel-2.12-1.166.el6_7.1.x86_64 already installed and latest version Nothing to do Is there some EPEL with GLIBC_2.15 for RHEL? If not - what is a workaround here? 回答1: This often occurs when you build software in RHEL 7 and try to run on RHEL 6. To update

Accessing .eh_frame data during execution

浪子不回头ぞ 提交于 2019-12-14 00:24:30
问题 This question was migrated from Unix & Linux Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . I'm trying to access the contents of .eh_frame section of a running program from within it (specifically, the program is Linux kernel 2.6.34.8). The .eh_frame contains useful data used for exception handling and I'd like to use it internally from within kernel code. The section is already being written by gcc ( readelf -a vmlinux.o contains .eh_frame ), the problem