linux file命令输出中的版本号字段是什么 [英] What is the version number field in the output of the linux file command

查看:195
本文介绍了linux file命令输出中的版本号字段是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在Fedora Core 11上编译的可执行文件版本"上执行以下命令,则会得到此输出

If I do the following command on my executable called "version", compiled on Fedora Core 11, I get this output

文件版本

版本:ELF 32位LSB可执行文件,英特尔80386版本1(SYSV),动态链接(使用共享库),用于GNU/Linux 2.6.18 ,未剥离

version: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped

最后的 2.6.18 的意义是什么?在区别客户应下载哪个版本的软件方面有什么用?

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

  1. 内核版本
  2. libc版本
  3. 与lsb_release无关

我想获得一些简单的标识符,以使客户知道应该下载哪个二进制发行版,理想情况下,他们应该能够通过键入命令来识别哪个二进制发行版(例如uname -a,尽管显然不是那个)在这种情况下).

I'd like to get some easy identifier to allow customers to know which binary release they should download, which they should ideally be able to identify by typing a command (like uname -a, although that obviously isn't the one in this case).

谢谢

推荐答案

这是二进制文件编译所在的计算机的内核版本.如果您使用发行版中的预编译二进制文件,则它是发行版供应商计算机的内核版本,可能在其编译场中.

It's the kernel version of the machine the binary was compiled on. If you use precompiled binaries from your distribution, it's the kernel version of a machine of the distribution vendor, probably in its compile farm.

这很重要,例如在考虑系统调用时.假设您的二进制文件使用syscall号. X,并且您使用的内核不支持X,或者更糟的是分配了syscall号. X转到另一个系统调用.

It's relevant e.g. when considering syscalls. Say your binary uses the syscall no. X and you use a kernel which does not support X yet or worse has assigned syscall no. X to a different syscall.

香草Linux内核用户API稳定.这意味着,如果A <=B,则Linux版本A中可用的每个syscall在Linux版本B中均可用.但是有可能某些开发人员发布了自己的Linux开发版本(例如linux-2.6.18-xy),并实现了一个新的syscall.如果他/她现在使用该内核版本编译二进制文件,则该二进制文件将使用该版本进行标记.因此,您以后便可以知道它可能行不通.

The vanilla Linux Kernel User API is stable. That means every syscall available in Linux version A is available in Linux version B if A <=B. But it may happen that some developer releases his/her own development version of Linux (something like linux-2.6.18-xy) and s/he implements a new syscall. If s/he now compiles a binary using that kernel version, the binary gets tagged with that version. So, you are later on able to know that it may or may not work.

顺便说一句,/usr/include/asm/unistd_32.h包含系统调用号,摘录:

Btw, /usr/include/asm/unistd_32.h contains syscall numbers, excerpt:

[...]
#define __NR_restart_syscall      0
#define __NR_exit         1
#define __NR_fork         2
#define __NR_read         3
#define __NR_write        4
#define __NR_open         5
[...]

这篇关于linux file命令输出中的版本号字段是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆