---
name: "pcap_open_dead"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/pcap_open_dead"
---

# pcap\_open\_dead(3)

open a fake pcap\_t for compiling filters or opening a capture for output

## NAME

pcap\_open\_dead, pcap\_open\_dead\_with\_tstamp\_precision - open a fake pcap\_t for compiling filters or opening a capture for output

## SYNOPSIS

```
#include <pcap/pcap.h>
```

**pcap\_t \*pcap\_open\_dead(int linktype, int snaplen);** **pcap\_t \*pcap\_open\_dead\_with\_tstamp\_precision(int linktype, int snaplen,**\
     **u\_int precision);**

## DESCRIPTION

**pcap\_open\_dead**() and **pcap\_open\_dead\_with\_tstamp\_precision**() are used for creating a **pcap\_t** structure to use when calling the other functions in libpcap.  It is typically used when just using libpcap for compiling BPF code; it can also be used if using [**pcap\_dump\_open**(3)](/pcap_dump_open/3.md), [**pcap\_dump**(3)](/pcap_dump/3.md), and [**pcap\_dump\_close**(3)](/pcap_dump_close/3.md) to write a savefile if there is no **pcap\_t** that supplies the packets to be written.

*linktype* specifies the link-layer type for the **pcap\_t**.

*snaplen* specifies the snapshot length for the **pcap\_t**.

When **pcap\_open\_dead\_with\_tstamp\_precision**(), is used to create a **pcap\_t** for use with **pcap\_dump\_open**(), *precision* specifies the time stamp precision for packets; **PCAP\_TSTAMP\_PRECISION\_MICRO** should be specified if the packets to be written have time stamps in seconds and microseconds, and **PCAP\_TSTAMP\_PRECISION\_NANO** should be specified if the packets to be written have time stamps in seconds and nanoseconds.  Its value does not affect [**pcap\_compile**(3)](/pcap_compile/3.md).

## BACKWARD COMPATIBILITY

The **pcap\_open\_dead\_with\_tstamp\_precision**() function became available in libpcap release 1.5.1.  In previous releases, there was no mechanism to open a savefile for writing with time stamps given in seconds and nanoseconds.

## SEE ALSO

[**pcap**(3)](/pcap/3.md), [**pcap-linktype**(7)](/pcap-linktype/7.md)
