| CTFDIFF(1) | User Commands | CTFDIFF(1) | 
ctfdiff — compare
    two CTF containers
ctfdiff | 
    [-afIloqt] [-F
      function] [-O
      object] [-p
      parent1] [-p
      parent2] [-T
      type] file1 file2 | 
  
The ctfdiff utility identifies differences
    between the contents of the CTF containers found in
    file1 and file2.
ctfdiff can find differences
    between two CTF container's labels,
    functions, objects, and
    types. When no options are specified,
    ctfdiff will only consider
    functions,
    objects, and
    types.
Two labels are the same if they have the same name. Two objects are the same if they have the same name and the type of the object is the same. Two functions are considered the same if they have the same name, the same return type, the same number of arguments, and the types of their arguments are the same.
Two types are considered the same if they have
    the same name, they represent the same kind of thing, and the contents of
    the type are the same. This varies for each specific kind, for example, two
    structs are the same if they have the same members whose types, offsets, and
    names are all the same. For more information on the specifics for what we
    look at for each kind of type, and the kinds themselves, see the information
    we use to encode them in ctf(5). If the
    option -I is specified, then the names of basic
    integer types are ignored. For an example of where this makes sense, see
    Example 4.
If the CTF container found inside of either file1 or file2 has been uniquified (see ctf(5) for more on uniquification), then the parent CTF container is also required for the diff to complete.
The following options are supported:
-a-f-F
    function-f be specified and can be repeated multiple
      times.-I-l-o-O
    object-o to be specified and can be
      repeated multiple times.-p
    parent1-P
    parent2-q-t-T
    type-T
      specified, other types will be diffed as necessary for the evaluation of
      the named types; however, the results of those intermediate differences
      will not impact the results of ctfdiff, only named
      types are considered when evaluating the exit status of
      ctfdiff.Example 1 Diffing Two CTF Containers
The following example compares two CTF containers using the default set of comparisons: objects, functions, and types.
$ ctfdiff /usr/lib/libc.so.1 /usr/lib/libdtrace.so.1 ctf container /usr/lib/libc.so.1 type 37 is different ctf container /usr/lib/libc.so.1 type 38 is different ctf container /usr/lib/libc.so.1 type 39 is different ctf container /usr/lib/libc.so.1 type 40 is different ctf container /usr/lib/libc.so.1 type 41 is different ctf container /usr/lib/libc.so.1 type 42 is different ctf container /usr/lib/libc.so.1 type 43 is different ctf container /usr/lib/libc.so.1 type 47 is different ctf container /usr/lib/libc.so.1 type 48 is different ctf container /usr/lib/libc.so.1 type 49 is different ...
The following example compares two CTF containers /ws/rm/zlan/proto/kernel/drv/amd64/vnd and /ws/rm/zlan/proto/kernel/drv/amd64/overlay that have been uniquified against the same container /ws/rm/zlan/proto/kernel/amd64/genunix.
$ ctfdiff -t -p /ws/rm/zlan/proto/kernel/amd64/genunix \
    -P /ws/rm/zlan/proto/kernel/amd64/genunix \
    /ws/rm/zlan/proto/kernel/drv/amd64/vnd  \
    /ws/rm/zlan/proto/kernel/drv/amd64/overlay
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32769 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32770 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32771 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32772 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32774 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32775 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32776 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32777 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32778 is different
ctf container /ws/rm/zlan/proto/kernel/drv/amd64/vnd type 32779 is different
...
Example 3 Diffing a Specific Function in Two CTF Containers
This example shows us looking for differences in the function libzfs_core_init in two different version of the library libzfs_core.so.1.
$ ctfdiff -f -F libzfs_core_init /usr/lib/libzfs_core.so.1 \
    /ws/rm/ctf/proto/usr/lib/libzfs_core.so.1
$ echo $?
Example 4 Diffing Types to Find Differences Between Different Data Models.
This example looks for differences between structures used in an ioctl that the kernel wants to be bitness neutral by comparing a 32-bit and 64-bit library that consumes it. In this example, we'll use the library libvnd.so.1 and the types vnd_ioc_attach_t, vnd_ioc_link_t, vnd_ioc_unlink_t, vnd_ioc_buf_t, and vnd_ioc_info_t.
$ ctfdiff -t -I -T vnd_ioc_attach_t  -T vnd_ioc_link_t  \
    -T vnd_ioc_unlink_t -T vnd_ioc_buf_t  -T vnd_ioc_info_t \
    i386/libvnd.so.1 amd64/libvnd.so.1
$ echo $?
0
The command syntax is Committed. The output format is Uncommitted.
| December 2, 2023 | OmniOS |