libmagic.man (267897) | libmagic.man (275698) |
---|---|
1.\" $File: libmagic.man,v 1.28 2014/03/02 14:47:16 christos Exp $ | 1.\" $File: libmagic.man,v 1.33 2014/11/28 02:46:39 christos Exp $ |
2.\" 3.\" Copyright (c) Christos Zoulas 2003. 4.\" All Rights Reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 20.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" | 2.\" 3.\" Copyright (c) Christos Zoulas 2003. 4.\" All Rights Reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 20.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" |
28.Dd January 6, 2012 | 28.Dd November 27, 2014 |
29.Dt LIBMAGIC 3 30.Os 31.Sh NAME 32.Nm magic_open , 33.Nm magic_close , 34.Nm magic_error , 35.Nm magic_errno , 36.Nm magic_descriptor , 37.Nm magic_buffer , 38.Nm magic_setflags , 39.Nm magic_check , 40.Nm magic_compile , 41.Nm magic_list , 42.Nm magic_load , | 29.Dt LIBMAGIC 3 30.Os 31.Sh NAME 32.Nm magic_open , 33.Nm magic_close , 34.Nm magic_error , 35.Nm magic_errno , 36.Nm magic_descriptor , 37.Nm magic_buffer , 38.Nm magic_setflags , 39.Nm magic_check , 40.Nm magic_compile , 41.Nm magic_list , 42.Nm magic_load , |
43.Nm magic_load_buffers , 44.Nm magic_setparam , 45.Nm magic_getparam , |
|
43.Nm magic_version 44.Nd Magic number recognition library 45.Sh LIBRARY 46.Lb libmagic 47.Sh SYNOPSIS 48.In magic.h 49.Ft magic_t 50.Fn magic_open "int flags" --- 15 unchanged lines hidden (view full) --- 66.Fn magic_check "magic_t cookie" "const char *filename" 67.Ft int 68.Fn magic_compile "magic_t cookie" "const char *filename" 69.Ft int 70.Fn magic_list "magic_t cookie" "const char *filename" 71.Ft int 72.Fn magic_load "magic_t cookie" "const char *filename" 73.Ft int | 46.Nm magic_version 47.Nd Magic number recognition library 48.Sh LIBRARY 49.Lb libmagic 50.Sh SYNOPSIS 51.In magic.h 52.Ft magic_t 53.Fn magic_open "int flags" --- 15 unchanged lines hidden (view full) --- 69.Fn magic_check "magic_t cookie" "const char *filename" 70.Ft int 71.Fn magic_compile "magic_t cookie" "const char *filename" 72.Ft int 73.Fn magic_list "magic_t cookie" "const char *filename" 74.Ft int 75.Fn magic_load "magic_t cookie" "const char *filename" 76.Ft int |
77.Fn magic_load_buffers "magic_t cookie" "void **buffers" "size_t *sizes" "size_t nbuffers" 78.Ft int 79.Fn magic_getparam "magic_t cookie" "int param" "void *value" 80.Ft int 81.Fn magic_setparam "magic_t cookie" "int param" "const void *value" 82.Ft int |
|
74.Fn magic_version "void" 75.Sh DESCRIPTION 76These functions 77operate on the magic database file 78which is described 79in 80.Xr magic __FSECTION__ . 81.Pp --- 166 unchanged lines hidden (view full) --- 248The default database file is named by the MAGIC environment variable. 249If that variable is not set, the default database file name is __MAGIC__. 250.Fn magic_load 251adds 252.Dq .mgc 253to the database filename as appropriate. 254.Pp 255The | 83.Fn magic_version "void" 84.Sh DESCRIPTION 85These functions 86operate on the magic database file 87which is described 88in 89.Xr magic __FSECTION__ . 90.Pp --- 166 unchanged lines hidden (view full) --- 257The default database file is named by the MAGIC environment variable. 258If that variable is not set, the default database file name is __MAGIC__. 259.Fn magic_load 260adds 261.Dq .mgc 262to the database filename as appropriate. 263.Pp 264The |
265.Fn magic_load_buffers 266function takes an array of size 267.Fa nbuffers 268of 269.Fa buffers 270with a respective size for each in the array of 271.Fa sizes 272loaded with the contents of the magic databases from the filesystem. 273This function can be used in environment where the magic library does 274not have direct access to the filesystem, but can access the magic 275database via shared memory or other IPC means. 276.Pp 277The 278.Fn magic_getparam 279and 280.Fn magic_setparam 281allow getting and setting various limits related to the the magic 282library. 283.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent 284.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default" 285.It Li MAGIC_PARAM_INDIR_MAX Ta size_t Ta 15 286.It Li MAGIC_PARAM_NAME_MAX Ta size_t Ta 30 287.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 288.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 289.El 290.Pp 291The 292.Dv MAGIC_PARAM_INDIR_RECURSION 293parameter controls how many levels of recursion will be followed for 294indirect magic entries. 295.Pp 296The 297.Dv MAGIC_PARAM_NAME_RECURSION 298parameter controls how many levels of recursion will be followed for 299for name/use calls. 300.Pp 301The 302.Dv MAGIC_PARAM_NAME_MAX 303parameter controls the maximum number of calls for name/use. 304.Pp 305The 306.Dv MAGIC_PARAM_PHNUM_MAX 307parameter controls how many elf program sections will be processed. 308.Pp 309The 310.Dv MAGIC_PARAM_SHNUM_MAX 311parameter controls how many elf sections will be processed. 312.Pp 313The |
|
256.Fn magic_version 257command returns the version number of this library which is compiled into 258the shared library using the constant 259.Dv MAGIC_VERSION 260from 261.In magic.h . 262This can be used by client programs to verify that the version they compile 263against is the same as the version that they run against. --- 57 unchanged lines hidden --- | 314.Fn magic_version 315command returns the version number of this library which is compiled into 316the shared library using the constant 317.Dv MAGIC_VERSION 318from 319.In magic.h . 320This can be used by client programs to verify that the version they compile 321against is the same as the version that they run against. --- 57 unchanged lines hidden --- |