English 中文(简体)
What is the version number field in the output of the linux file command
原标题:

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

  1. The kernel version
  2. The libc version
  3. Anything to do with the lsb_release

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).

Thanks

问题回答

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.

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.

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.

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
[...]




相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签