linux系统编程:获取glibc的版本号
2023-09-11 14:19:51 时间
我的环境是ubuntu16.04
glibc官网:http://www.gnu.org/software/libc/libc.html
方法一、一般来说,涉及到库调用的程序,在链接时候都会链接到glibc,所以,可以用ldd命令来查看
ghostwu@ubuntu:~/c_program/linux_unix/chapter4$ ldd ./pwd | grep libc libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7c45491000) ghostwu@ubuntu:~/c_program/linux_unix/chapter4$ /lib/x86_64-linux-gnu/libc.so.6 GNU C Library (Ubuntu GLIBC 2.23-0ubuntu9) stable release version 2.23, by Roland McGrath et al. Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 5.4.0 20160609. Available extensions: crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B libc ABIs: UNIQUE IFUNC For bug reporting instructions, please see: <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
这个就是我的电脑上glibc的路径:/lib/x86_64-linux-gnu/libc.so.6
方法二:man -k glibc,可以找到一个系统函数gnu_get_libc_version,他可以用来获取版本
ghostwu@ubuntu:~$ man -k libc cracklib-check (8) - Check passwords using libcrack2 create-cracklib-dict (8) - Check passwords using libcrack2 curl-config (1) - Get information about a libcurl installation error (3) - glibc error reporting functions error_at_line (3) - glibc error reporting functions error_message_count (3) - glibc error reporting functions error_one_per_line (3) - glibc error reporting functions error_print_progname (3) - glibc error reporting functions glibc (7) - overview of standard C libraries on Linux gnu_get_libc_release (3) - get glibc version and release gnu_get_libc_version (3) - get glibc version and release libc (7) - overview of standard C libraries on Linux ghostwu@ubuntu:~$ man 3 gnu_get_libc_version
/*================================================================ * Copyright (C) 2018 . All rights reserved. * * 文件名称:check_glibc_version.c * 创 建 者:ghostwu(吴华) * 创建日期:2018年01月10日 * 描 述:获取GNU C库(glibc)的版本号 * ================================================================*/ #include <stdio.h> #include <gnu/libc-version.h> int main(int argc, char *argv[]) { printf( "glibc's version: %s\n", gnu_get_libc_version() ); return 0; }
方法三、getconf GNU_LIBC_VERSION
相关文章
- 《Linux系统编程(第2版)》
- linux系统中删除文件夹
- Linux下查看日志用到的常用命令
- Linux系统 SSHD服务安全优化方案
- linux系统的开机流程
- STM32MP157 Linux系统移植开发篇5:Trusted Firmware-A移植
- 浅析 Linux 初始化 init 系统: UpStart
- Linux基础:如何找出你的系统所支持的最大内存
- linux系统调用过程
- Linux系统nginx安装说明(在线/离线安装)
- [Linux]File “/bin/yum-config-manager“, line 135 except yum.Errors.RepoError, e:
- Linux— file命令 用于辨识文件类型
- Linux系统小技巧(1):/dev/random设备可能导致java程序启动慢或者操作耗时不正常
- linux系统编程:IO读写过程的原子性操作实验
- linux系统编程:read,write与lseek的综合应用
- linux系统编程:cp的另外一种实现方式
- linux系统编程:open常用参数详解
- linux系统编程:自己动手写一个who命令
- linux系统编程快速定位头文件的技巧之强大的grep命令
- 文件传输 ------ SSH SCP ----- window 系统和 linux 系统的文件传输
- C++ | 探究函数重载的原理:函数名修饰【基于Windows + Linux双系统】
- 嵌入式Linux的一点学习心得
- Linux系统的启动原理
- Linux系统如何解压rar文件
- Linux系统编程——多线程实现多任务
- Linux系统编程_8_进程控制之fork_wait_waitpid函数
- Linux学习笔记(2)linux系统信息与进程相关命令
- Linux系统编程——信号
- Windows和Linux网络安全应急响应基础技能——如何进行系统排查以及检测恶意用户登录和网络流量日志分析
- Linux Sudo命令曝出漏洞 快快打补丁吧