Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MapRef

Object holdling a file descriptor (plus parameters) for an eBPF map. The object must own the file descriptor, meaning that it won't get closed while this object is alive.

If you got a file descriptor from someplace else, you can use createMapRef to obtain a MapRef pointing to the same map.

Implementing a custom MapRef

You can also choose to implement your own MapRefs, but you must make sure to report the parameters correctly (otherwise, it can lead to buffer overflow) and make sure the object holds a reference to whatever is keeping the file descriptor from being closed. You may optionally implement close if you completely own the FD.

Hierarchy

Index

Properties

fd: number

Readonly property holding the FD owned by this object. Don't store this value elsewhere, query it from here every time to make sure it's valid.

Throws if close() was successfully called.

flags: number

Flags specified on map creation, see MapFlags

id?: number

Map ID (since Linux 4.13)

ifindex?: number

For offloading, ifindex of network device the map was created on (reported since Linux 4.16)

keySize: number

Size of every key, in bytes

maxEntries: number

Maximum amount of entries: the meaning of this is type-dependent

name?: string

Map name (might get truncated if longer than OBJ_NAME_LEN) (since Linux 4.15)

netnsDev?: bigint
netnsIno?: bigint
type: MapType

Map type. This decides the available operations and their semantics.

valueSize: number

Size of every value, in bytes

Methods

  • close(): void
  • Closes the FD early. Instances don't necessarily support this operation (and will throw in that case), but all instances returned by this module do.

    If supported, calling it a second time does nothing.

    Returns void

Generated using TypeDoc