⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zlibc.3

📁 zlib压缩原码
💻 3
📖 第 1 页 / 共 2 页
字号:
.PP .nf.ft 3.in +0.3i> gzip tstfil> ls -ltotal 1pr--r--r--   1 alknaff  sirac          15 Feb 25 19:40 tstfillrwxrwxrwx   1 alknaff  sirac           8 Feb 25 19:40 x -> tstfil.fi.in -0.3i.ft R.lp \&\fR.PP\&\fR\&\f(CW\(ifTstfil\(is\fR is now shown as a pipe by zlibc in order to warn programsthat they cannot seek in it.  Zlibc still shows it with its old name,and you can directly look at its contents: .nf.ft 3.in +0.3i> cat tstfilthis is a test.fi.in -0.3i.ft R.lp \&\fR.PPHowever, \fR\&\f(CW\(iftstfil\(is\fR is not yet accessible using the symbolic link: .nf.ft 3.in +0.3i> cat xcat: x: No such file or directory.fi.in -0.3i.ft R.lp \&\fR.PPIn order to make \fR\&\f(CW\(iftstfil\(is\fR accessible using the link, you have todestroy the link, and remake it: .nf.ft 3.in +0.3i> rm x/bin/rm: remove `x'? y> ln -s tstfil x> ls -ltotal 1pr--r--r--   1 alknaff  sirac          15 Feb 25 19:40 tstfillrwxrwxrwx   1 alknaff  sirac           8 Feb 25 19:44 x -> tstfil> cat xthis is a test.fi.in -0.3i.ft R.lp \&\fR.PP.SS \ \ Hard\ links.PPIf you compress datafiles with hard links pointing to them, gzip refusesto compress them. .PP .nf.ft 3.in +0.3i> echo 'this is a test' >tstfil> ln tstfil x> ls -litotal 2    166 -rw-r--r--   2 alknaff  sirac          15 Feb 25 19:46 tstfil    166 -rw-r--r--   2 alknaff  sirac          15 Feb 25 19:46 x> gzip tstfilgzip: tstfil has 1 other link  -- unchanged.fi.in -0.3i.ft R.lp \&\fR.PPThus you need to remove these hard links first, and remake them aftercompressing the file..PP .nf.ft 3.in +0.3i> rm x/bin/rm: remove `x'? y> gzip tstfil> ln tstfil x> ls -litotal 2    167 pr--r--r--   2 alknaff  sirac          15 Feb 25 19:46 tstfil    167 pr--r--r--   2 alknaff  sirac          15 Feb 25 19:46 x> cat xthis is a test.fi.in -0.3i.ft R.lp \&\fR.PP.SH How\ it\ works.PPUsually, programs don't make system calls directly, but instead call alibrary function which performs the actual system calls. For instance,to open a file, the program first calls the \fR\&\f(CWopen\fR libraryfunction, and then this function makes the actual syscall.  Zlibcoverrides the \fR\&\f(CWopen\fR function and other related functions in orderto do the uncompression on the fly..PPIf the \fR\&\f(CWopen\fR system call fails because the file doesn't exist,zlibc constructs the filename of a compressed file by appending\&\fR\&\f(CW.gz\fR to the filename supplied by the user program. If thiscompressed file exists, it is opened and piped trough \fR\&\f(CWgunzip\fR, andthe descriptor of the read end of this pipe is returned to the caller..PPIn some cases, the compressed file is first uncompressed into atemporary file, and a read descriptor for this file is passed to thecaller.  This is necessary if the caller wants to call \fR\&\f(CWlseek\fR onthe file or \fR\&\f(CWmmap\fR it. A description of data files for which usingtemporary is necessary can be given in the configuration files\&\fR\&\f(CW\(if/usr/local/etc/zlibc.conf\(is\fR (\fR\&\f(CW\(if/etc/zlibc.conf\(is\fR onLinux)\fR\fR\fR and\&\fR\&\f(CW\(if~/.zlibrc\(is\fR. See section Configuration files, for a detailed descriptionof their syntax..PPMany user programs try to check the existence of a given file by othersystem calls before actually opening it. That's why zlibc alsooverrides these system calls. If for example the user program tries tostat a file, this call is also intercepted..PPThe compressed file, which exists physically on the disk, is also called\&'the real file', and the uncompressed file, whose existence is onlysimulated by zlibc is called 'the virtual file'..PP.SH Customization.iX "c Customization".PPThe behavior of zlibc can be tailored using configuration files orenvironment variables. This customization should normally not be needed,as the compiled-in defaults are already pretty complete..PP.SS Environmental\ variables.PPEnvironmental variables come in two kinds: \fIswitch\fR variables havea boolean value and can only be turned on or off, whereas \fIstring\fRvariables can have arbitrary strings as values..PP.SS \ \ Switch\ variables.iX "v LD_ZLIB_VERBOSE".iX "c debugging zlibc".iX "v LD_ZLIB_UNLINK".iX "c removing files".iX "c preventing accidental removal of compressed files (env.var.)".iX "v LD_ZLIB_DISABLE".iX "v LD_ZLIB_READDIR_COMPR".iX "c showing compressed files in a directory listing (env.var.)".PPThese variables represent a flag which can be turned on or off.  Iftheir value is \fR\&\f(CWon\fR or \fR\&\f(CW1\fR they are turned on, if their valueis \fR\&\f(CWoff\fR or \fR\&\f(CW0\fR they are turned off. All other values areignored. If the same flag can be turned on or off using config files,the environmental variable always has the priority..TP\&\fR\&\f(CWLD_ZLIB_VERBOSE\ \fR\ If this variable is turned on, informational messages are printed onmany operations of zlibc.  Moreover, error messages are printed in orderto point out errors in the configuration files, if any. If this variableis turned off, errors are silently ignored..TP\&\fR\&\f(CWLD_ZLIB_UNLINK\fR\ If this variable is turned on, and if the user program tries to unlink avirtual (uncompressed) file, zlibc translates this call into unlinkingthe real file. If this variable is turned off, unlink calls on virtualfiles are ignored..TP\&\fR\&\f(CWLD_ZLIB_DISABLE\fR\ If this variable is turned on, zlibc is switched off..TP\&\fR\&\f(CWLD_ZLIB_READDIR_COMPR\fR\ If this variable is turned on, the readdir function shows the real(compressed) files instead of the virtual (uncompressed) files..PP.SS \ \ String\ variables.iX "v LD_ZLIB_TMP".iX "c directory for temporary files (env.var.)".iX "v LD_ZLIB_EXT".iX "c filename extension for compressed files (env.var.)".iX "v LD_ZLIB_UNCOMPRESSOR".iX "c command line for the uncompressing program (env.var.)".iX "v LD_ZLIB_CONFFILE".iX "c location of the configuration file (env.var.)".PPThese variables have a string value, which represent a file, a directoryor a command..TP\&\fR\&\f(CWLD_ZLIB_TMP\fR\ This is the name of the directory where the temporary uncompressed files are put. The default is /tmp..TP\&\fR\&\f(CWLD_ZLIB_EXT\fR\ This is the extension which is appended to a virtual file name in orderto obtain the real (compressed) file name. The default is \fR\&\f(CW.gz\fR..TP\&\fR\&\f(CWLD_ZLIB_UNCOMPRESSOR\fR\ This is the name of the program to be invoked to uncompress the data. Defaultis \fR\&\f(CWgzip -dc\fR..TP\&\fR\&\f(CWLD_ZLIB_CONFFILE\ \fR\ This is the name of an additional configuration file. If this variableis defined and if the corresponding file exists, the configurationdescribed in this file overrides the configurations in \fR\&\f(CW\(if~/.zlibrc\(is\fRand in \fR\&\f(CW\(if/usr/local/etc/zlibc.conf\(is\fR (\fR\&\f(CW\(if/etc/zlibc.conf\(is\fR onLinux)..PP.SS Compiled-in\ defaults.PPIt is possible to operate zlibc entirely without configuration files.In this case, it uses the \fIcompiled-in defaults\fR.  These aregenerated at compile-time from the \fR\&\f(CW\(ifzlibrc.sample\(is\fR file.  This filehas the same syntax as the configuration files described above(see section  Configuration files).  If you want to change the compiled-indefaults of zlibc, edit that file, and remake..PP.SS Compile-time\ configuration\ via\ GNU\ autoconf.iX "c configure options".iX "c temporary file directory".iX "c directory for temporary files".iX "c compile-time configuration".PPBefore it can be compiled, zlibc must be configured using the GNUautoconf script \fR\&\f(CW./configure\fR.  In most circumstances, running\&\fR\&\f(CW./configure\fR without any parameters is enough. However, you maycustomize zlibc using various options to \fR\&\f(CW./configure\fR. Thefollowing options are supported:.TP\&\fR\&\f(CW--prefix\ \fIdirectory\fR\&\f(CW\fR\ Prefix used for any directories used by zlibc.  By default, this is\&\fR\&\f(CW\(if/usr/local\(is\fR.  Zlibc is installed in \fR\&\f(CW\(if$prefix/lib\(is\fR, looks forits system wide configuration file in \fR\&\f(CW\(if$prefix/etc\(is\fR.  Man pages areinstalled in \fR\&\f(CW\(if$prefix/man\(is\fR, info pages in \fR\&\f(CW\(if$prefix/info\(is\fR etc.On Linux, if you use zlibc via \fR\&\f(CW\(if/etc/ld.so.preload\(is\fR, you should use\&\fR\&\f(CW\(if/\(is\fR as the prefix instead of the default \fR\&\f(CW\(if$prefix/lib\(is\fR..TP\&\fR\&\f(CW--sysconfdir\ \fIdirectory\fR\&\f(CW\fR\ Directory containing the system-wide configuration file\&\fR\&\f(CW\(ifzlibc.conf\(is\fR.  By default, this is derived from \fR\&\f(CWprefix\fR (seeabove)..TP\&\fR\&\f(CW--disable-runtime-conf\fR\ Disables run time configuration via environmental variables and via theconfiguration files.  This may be needed in hyper secure environments..TP\&\fR\&\f(CW--disable-env-conf\fR\ Disables run time configuration via environmental variables.TP\&\fR\&\f(CW--disable-have-proc\fR\ Tells zlibc not to use the /proc filesystem to find out the commandlineof the programs for which it runs, even if a working /proc is detected..TP\&\fR\&\f(CW--disable-have-proc\fR\ Tells zlibc to use the /proc filesystem to find out the commandline ofthe programs for which it runs, even if no working /proc is detected..TP\&\fR\&\f(CW--with-compr-ext=\fIextension\fR\&\f(CW\fR\ Uses \fIextension\fR as the filename extension of compressed files.  Bydefault, is \fR\&\f(CW.gz\fR.TP\&\fR\&\f(CW--with-extlen=\fIlength\fR\&\f(CW\fR\ Allows to configure compressed filename extensions with at most\&\fIlength\fR character via runtime configuration.  By default is 5..TP\&\fR\&\f(CW--with-tmpdir=\fIdirectory\fR\&\f(CW\fR\ Uses \fIdirectory\fR to store the uncompressed files.  By default is\&\fR\&\f(CW/tmp\fR.  .TP\&\fR\&\f(CW--with-uncompressor=\fIuncompressor-command-line\fR\&\f(CW\fR\ Defines how the program for uncompressing files should be invoked.  Thiscommand should read the compressed file from stdin, and output theuncompressed data to stdout By default is \fR\&\f(CWgzip -dc\fR..PPIn addition to the above-listed options, the standard GNU autoconfoptions apply.  Type \fR\&\f(CW./configure --help\fR to get a complete list ofthese..PP.SS \ \ See\ alsozlibc.conf(5).PP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -