€•…]Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ'/translations/zh_CN/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/zh_TW/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/it_IT/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ja_JP/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ko_KR/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/pt_BR/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/sp_SP/bpf/map_queue_stack”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ%SPDX-License-Identifier: GPL-2.0-only”h]”hŒ%SPDX-License-Identifier: GPL-2.0-only”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒA/var/lib/git/docbuild/linux/Documentation/bpf/map_queue_stack.rst”h´Kubh¶)�”}”(hŒ Copyright (C) 2022 Red Hat, Inc.”h]”hŒ Copyright (C) 2022 Red Hat, Inc.”…”�”}”hhÈsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhhh²hh³hÇh´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒ)BPF_MAP_TYPE_QUEUE and BPF_MAP_TYPE_STACK”h]”hŒ)BPF_MAP_TYPE_QUEUE and BPF_MAP_TYPE_STACK”…”�”}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´KubhŒnote”“”)�”}”(hŒ\- ``BPF_MAP_TYPE_QUEUE`` and ``BPF_MAP_TYPE_STACK`` were introduced in kernel version 4.20”h]”hŒ bullet_list”“”)�”}”(hhh]”hŒ list_item”“”)�”}”(hŒX``BPF_MAP_TYPE_QUEUE`` and ``BPF_MAP_TYPE_STACK`` were introduced in kernel version 4.20”h]”hŒ paragraph”“”)�”}”(hŒX``BPF_MAP_TYPE_QUEUE`` and ``BPF_MAP_TYPE_STACK`` were introduced in kernel version 4.20”h]”(hŒliteral”“”)�”}”(hŒ``BPF_MAP_TYPE_QUEUE``”h]”hŒBPF_MAP_TYPE_QUEUE”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhþubhŒ and ”…”�”}”(hhþh²hh³Nh´Nubj)�”}”(hŒ``BPF_MAP_TYPE_STACK``”h]”hŒBPF_MAP_TYPE_STACK”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhþubhŒ' were introduced in kernel version 4.20”…”�”}”(hhþh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K hhøubah}”(h]”h ]”h"]”h$]”h&]”uh1höhhóubah}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1hñh³hÇh´K hhíubah}”(h]”h ]”h"]”h$]”h&]”uh1hëhhØh²hh³Nh´Nubhý)�”}”(hXQ``BPF_MAP_TYPE_QUEUE`` provides FIFO storage and ``BPF_MAP_TYPE_STACK`` provides LIFO storage for BPF programs. These maps support peek, pop and push operations that are exposed to BPF programs through the respective helpers. These operations are exposed to userspace applications using the existing ``bpf`` syscall in the following way:”h]”(j)�”}”(hŒ``BPF_MAP_TYPE_QUEUE``”h]”hŒBPF_MAP_TYPE_QUEUE”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjBubhŒ provides FIFO storage and ”…”�”}”(hjBh²hh³Nh´Nubj)�”}”(hŒ``BPF_MAP_TYPE_STACK``”h]”hŒBPF_MAP_TYPE_STACK”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjBubhŒå provides LIFO storage for BPF programs. These maps support peek, pop and push operations that are exposed to BPF programs through the respective helpers. These operations are exposed to userspace applications using the existing ”…”�”}”(hjBh²hh³Nh´Nubj)�”}”(hŒ``bpf``”h]”hŒbpf”…”�”}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjBubhŒ syscall in the following way:”…”�”}”(hjBh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K hhØh²hubhò)�”}”(hhh]”(h÷)�”}”(hŒ``BPF_MAP_LOOKUP_ELEM`` -> peek”h]”hý)�”}”(hj‡h]”(j)�”}”(hŒ``BPF_MAP_LOOKUP_ELEM``”h]”hŒBPF_MAP_LOOKUP_ELEM”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‰ubhŒ -> peek”…”�”}”(hj‰h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khj…ubah}”(h]”h ]”h"]”h$]”h&]”uh1höhj‚h²hh³hÇh´Nubh÷)�”}”(hŒ)``BPF_MAP_LOOKUP_AND_DELETE_ELEM`` -> pop”h]”hý)�”}”(hj¬h]”(j)�”}”(hŒ"``BPF_MAP_LOOKUP_AND_DELETE_ELEM``”h]”hŒBPF_MAP_LOOKUP_AND_DELETE_ELEM”…”�”}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj®ubhŒ -> pop”…”�”}”(hj®h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khjªubah}”(h]”h ]”h"]”h$]”h&]”uh1höhj‚h²hh³hÇh´Nubh÷)�”}”(hŒ ``BPF_MAP_UPDATE_ELEM`` -> push ”h]”hý)�”}”(hŒ``BPF_MAP_UPDATE_ELEM`` -> push”h]”(j)�”}”(hŒ``BPF_MAP_UPDATE_ELEM``”h]”hŒBPF_MAP_UPDATE_ELEM”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÓubhŒ -> push”…”�”}”(hjÓh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KhjÏubah}”(h]”h ]”h"]”h$]”h&]”uh1höhj‚h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j:j;uh1hñh³hÇh´KhhØh²hubhý)�”}”(hŒW``BPF_MAP_TYPE_QUEUE`` and ``BPF_MAP_TYPE_STACK`` do not support ``BPF_F_NO_PREALLOC``.”h]”(j)�”}”(hŒ``BPF_MAP_TYPE_QUEUE``”h]”hŒBPF_MAP_TYPE_QUEUE”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjûubhŒ and ”…”�”}”(hjûh²hh³Nh´Nubj)�”}”(hŒ``BPF_MAP_TYPE_STACK``”h]”hŒBPF_MAP_TYPE_STACK”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjûubhŒ do not support ”…”�”}”(hjûh²hh³Nh´Nubj)�”}”(hŒ``BPF_F_NO_PREALLOC``”h]”hŒBPF_F_NO_PREALLOC”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjûubhŒ.”…”�”}”(hjûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KhhØh²hubh×)�”}”(hhh]”(hÜ)�”}”(hŒUsage”h]”hŒUsage”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj;h²hh³hÇh´Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒ Kernel BPF”h]”hŒ Kernel BPF”…”�”}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjLh²hh³hÇh´Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒbpf_map_push_elem()”h]”hŒbpf_map_push_elem()”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj]h²hh³hÇh´K ubhŒ literal_block”“”)�”}”(hŒIlong bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags)”h]”hŒIlong bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags)”…”�”}”hjpsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œc”Œhighlight_args”}”uh1jnh³hÇh´K"hj]h²hubhý)�”}”(hXyAn element ``value`` can be added to a queue or stack using the ``bpf_map_push_elem`` helper. The ``flags`` parameter must be set to ``BPF_ANY`` or ``BPF_EXIST``. If ``flags`` is set to ``BPF_EXIST`` then, when the queue or stack is full, the oldest element will be removed to make room for ``value`` to be added. Returns ``0`` on success, or negative error in case of failure.”h]”(hŒ An element ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ, can be added to a queue or stack using the ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ``bpf_map_push_elem``”h]”hŒbpf_map_push_elem”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ helper. The ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``flags``”h]”hŒflags”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ parameter must be set to ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``BPF_ANY``”h]”hŒBPF_ANY”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ or ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``BPF_EXIST``”h]”hŒ BPF_EXIST”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ. If ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``flags``”h]”hŒflags”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ is set to ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``BPF_EXIST``”h]”hŒ BPF_EXIST”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ\ then, when the queue or stack is full, the oldest element will be removed to make room for ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ to be added. Returns ”…”�”}”(hjƒh²hh³Nh´Nubj)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjƒubhŒ2 on success, or negative error in case of failure.”…”�”}”(hjƒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K&hj]h²hubeh}”(h]”Œbpf-map-push-elem”ah ]”h"]”Œbpf_map_push_elem()”ah$]”h&]”uh1hÖhjLh²hh³hÇh´K ubh×)�”}”(hhh]”(hÜ)�”}”(hŒbpf_map_peek_elem()”h]”hŒbpf_map_peek_elem()”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj;h²hh³hÇh´K.ubjo)�”}”(hŒ8long bpf_map_peek_elem(struct bpf_map *map, void *value)”h]”hŒ8long bpf_map_peek_elem(struct bpf_map *map, void *value)”…”�”}”hjLsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´K0hj;h²hubhý)�”}”(hŒ“This helper fetches an element ``value`` from a queue or stack without removing it. Returns ``0`` on success, or negative error in case of failure.”h]”(hŒThis helper fetches an element ”…”�”}”(hj[h²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj[ubhŒ4 from a queue or stack without removing it. Returns ”…”�”}”(hj[h²hh³Nh´Nubj)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj[ubhŒ2 on success, or negative error in case of failure.”…”�”}”(hj[h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K4hj;h²hubeh}”(h]”Œbpf-map-peek-elem”ah ]”h"]”Œbpf_map_peek_elem()”ah$]”h&]”uh1hÖhjLh²hh³hÇh´K.ubh×)�”}”(hhh]”(hÜ)�”}”(hŒbpf_map_pop_elem()”h]”hŒbpf_map_pop_elem()”…”�”}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj•h²hh³hÇh´K9ubjo)�”}”(hŒ7long bpf_map_pop_elem(struct bpf_map *map, void *value)”h]”hŒ7long bpf_map_pop_elem(struct bpf_map *map, void *value)”…”�”}”hj¦sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´K;hj•h²hubhý)�”}”(hŒ„This helper removes an element into ``value`` from a queue or stack. Returns ``0`` on success, or negative error in case of failure.”h]”(hŒ$This helper removes an element into ”…”�”}”(hjµh²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjµubhŒ from a queue or stack. Returns ”…”�”}”(hjµh²hh³Nh´Nubj)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjµubhŒ2 on success, or negative error in case of failure.”…”�”}”(hjµh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K?hj•h²hubeh}”(h]”Œbpf-map-pop-elem”ah ]”h"]”Œbpf_map_pop_elem()”ah$]”h&]”uh1hÖhjLh²hh³hÇh´K9ubeh}”(h]”Œ kernel-bpf”ah ]”h"]”h$]”Œ kernel bpf”ah&]”uh1hÖhj;h²hh³hÇh´KŒ referenced”Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒ Userspace”h]”hŒ Userspace”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjøh²hh³hÇh´KDubh×)�”}”(hhh]”(hÜ)�”}”(hŒbpf_map_update_elem()”h]”hŒbpf_map_update_elem()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj h²hh³hÇh´KGubjo)�”}”(hŒQint bpf_map_update_elem (int fd, const void *key, const void *value, __u64 flags)”h]”hŒQint bpf_map_update_elem (int fd, const void *key, const void *value, __u64 flags)”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´KIhj h²hubhý)�”}”(hXZA userspace program can push ``value`` onto a queue or stack using libbpf's ``bpf_map_update_elem`` function. The ``key`` parameter must be set to ``NULL`` and ``flags`` must be set to ``BPF_ANY`` or ``BPF_EXIST``, with the same semantics as the ``bpf_map_push_elem`` kernel helper. Returns ``0`` on success, or negative error in case of failure.”h]”(hŒA userspace program can push ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ( onto a queue or stack using libbpf’s ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ``bpf_map_update_elem``”h]”hŒbpf_map_update_elem”…”�”}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ function. The ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ``key``”h]”hŒkey”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ parameter must be set to ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ``NULL``”h]”hŒNULL”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ and ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ ``flags``”h]”hŒflags”…”�”}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ must be set to ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ ``BPF_ANY``”h]”hŒBPF_ANY”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ or ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ ``BPF_EXIST``”h]”hŒ BPF_EXIST”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ!, with the same semantics as the ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ``bpf_map_push_elem``”h]”hŒbpf_map_push_elem”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ kernel helper. Returns ”…”�”}”(hj)h²hh³Nh´Nubj)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj)ubhŒ2 on success, or negative error in case of failure.”…”�”}”(hj)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KMhj h²hubeh}”(h]”Œbpf-map-update-elem”ah ]”h"]”Œbpf_map_update_elem()”ah$]”h&]”uh1hÖhjøh²hh³hÇh´KGubh×)�”}”(hhh]”(hÜ)�”}”(hŒbpf_map_lookup_elem()”h]”hŒbpf_map_lookup_elem()”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjáh²hh³hÇh´KTubjo)�”}”(hŒ>int bpf_map_lookup_elem (int fd, const void *key, void *value)”h]”hŒ>int bpf_map_lookup_elem (int fd, const void *key, void *value)”…”�”}”hjòsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´KVhjáh²hubhý)�”}”(hŒðA userspace program can peek at the ``value`` at the head of a queue or stack using the libbpf ``bpf_map_lookup_elem`` function. The ``key`` parameter must be set to ``NULL``. Returns ``0`` on success, or negative error in case of failure.”h]”(hŒ$A userspace program can peek at the ”…”�”}”(hjh²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ2 at the head of a queue or stack using the libbpf ”…”�”}”(hjh²hh³Nh´Nubj)�”}”(hŒ``bpf_map_lookup_elem``”h]”hŒbpf_map_lookup_elem”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ function. The ”…”�”}”(hjh²hh³Nh´Nubj)�”}”(hŒ``key``”h]”hŒkey”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ parameter must be set to ”…”�”}”(hjh²hh³Nh´Nubj)�”}”(hŒ``NULL``”h]”hŒNULL”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ . Returns ”…”�”}”(hjh²hh³Nh´Nubj)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒ2 on success, or negative error in case of failure.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KZhjáh²hubeh}”(h]”Œbpf-map-lookup-elem”ah ]”h"]”Œbpf_map_lookup_elem()”ah$]”h&]”uh1hÖhjøh²hh³hÇh´KTubh×)�”}”(hhh]”(hÜ)�”}”(hŒ bpf_map_lookup_and_delete_elem()”h]”hŒ bpf_map_lookup_and_delete_elem()”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjqh²hh³hÇh´K`ubjo)�”}”(hŒIint bpf_map_lookup_and_delete_elem (int fd, const void *key, void *value)”h]”hŒIint bpf_map_lookup_and_delete_elem (int fd, const void *key, void *value)”…”�”}”hj‚sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´Kbhjqh²hubhý)�”}”(hŒöA userspace program can pop a ``value`` from the head of a queue or stack using the libbpf ``bpf_map_lookup_and_delete_elem`` function. The ``key`` parameter must be set to ``NULL``. Returns ``0`` on success, or negative error in case of failure.”h]”(hŒA userspace program can pop a ”…”�”}”(hj‘h²hh³Nh´Nubj)�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubhŒ4 from the head of a queue or stack using the libbpf ”…”�”}”(hj‘h²hh³Nh´Nubj)�”}”(hŒ"``bpf_map_lookup_and_delete_elem``”h]”hŒbpf_map_lookup_and_delete_elem”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubhŒ function. The ”…”�”}”(hj‘h²hh³Nh´Nubj)�”}”(hŒ``key``”h]”hŒkey”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubhŒ parameter must be set to ”…”�”}”(hj‘h²hh³Nh´Nubj)�”}”(hŒ``NULL``”h]”hŒNULL”…”�”}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubhŒ . Returns ”…”�”}”(hj‘h²hh³Nh´Nubj)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubhŒ2 on success, or negative error in case of failure.”…”�”}”(hj‘h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kfhjqh²hubeh}”(h]”Œbpf-map-lookup-and-delete-elem”ah ]”h"]”Œ bpf_map_lookup_and_delete_elem()”ah$]”h&]”uh1hÖhjøh²hh³hÇh´K`ubeh}”(h]”Œ userspace”ah ]”h"]”h$]”Œ userspace”ah&]”uh1hÖhj;h²hh³hÇh´KDj÷Kubeh}”(h]”Œusage”ah ]”h"]”Œusage”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒExamples”h]”hŒExamples”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´Klubh×)�”}”(hhh]”(hÜ)�”}”(hŒ Kernel BPF”h]”hŒ Kernel BPF”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj"h²hh³hÇh´Koubhý)�”}”(hŒ;This snippet shows how to declare a queue in a BPF program:”h]”hŒ;This snippet shows how to declare a queue in a BPF program:”…”�”}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kqhj"h²hubjo)�”}”(hŒ‡struct { __uint(type, BPF_MAP_TYPE_QUEUE); __type(value, __u32); __uint(max_entries, 10); } queue SEC(".maps");”h]”hŒ‡struct { __uint(type, BPF_MAP_TYPE_QUEUE); __type(value, __u32); __uint(max_entries, 10); } queue SEC(".maps");”…”�”}”hjAsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´Kshj"h²hubeh}”(h]”Œid1”ah ]”h"]”h$]”jõah&]”uh1hÖhjh²hh³hÇh´Koj÷Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒ Userspace”h]”hŒ Userspace”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjWh²hh³hÇh´K}ubhý)�”}”(hŒVThis snippet shows how to use libbpf's low-level API to create a queue from userspace:”h]”hŒXThis snippet shows how to use libbpf’s low-level API to create a queue from userspace:”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KhjWh²hubjo)�”}”(hXŽint create_queue() { return bpf_map_create(BPF_MAP_TYPE_QUEUE, "sample_queue", /* name */ 0, /* key size, must be zero */ sizeof(__u32), /* value size */ 10, /* max entries */ NULL); /* create options */ }”h]”hXŽint create_queue() { return bpf_map_create(BPF_MAP_TYPE_QUEUE, "sample_queue", /* name */ 0, /* key size, must be zero */ sizeof(__u32), /* value size */ 10, /* max entries */ NULL); /* create options */ }”…”�”}”hjvsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj~‰jj€j�}”uh1jnh³hÇh´K‚hjWh²hubeh}”(h]”Œid2”ah ]”h"]”h$]”jah&]”uh1hÖhjh²hh³hÇh´K}j÷Kubeh}”(h]”Œexamples”ah ]”h"]”Œexamples”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Klubh×)�”}”(hhh]”(hÜ)�”}”(hŒ References”h]”hŒ References”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj”h²hh³hÇh´K�ubhý)�”}”(hŒNhttps://lwn.net/ml/netdev/153986858555.9127.14517764371945179514.stgit@kernel/”h]”hŒ reference”“”)�”}”(hj§h]”hŒNhttps://lwn.net/ml/netdev/153986858555.9127.14517764371945179514.stgit@kernel/”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j§uh1j©hj¥ubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K’hj”h²hubeh}”(h]”Œ references”ah ]”h"]”Œ references”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K�ubeh}”(h]”Œ)bpf-map-type-queue-and-bpf-map-type-stack”ah ]”h"]”Œ)bpf_map_type_queue and bpf_map_type_stack”ah$]”h&]”uh1hÖhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jòŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jÌjÉjj Œ kernel bpf”Nj8j5j’j�jìjéŒ userspace”NjÞjÛjnjkjþjûj‘jŽjÄjÁuŒ nametypes”}”(j̉j‰j6‰j8‰j’‰jì‰j7‰jÞ‰jn‰jþ‰j‘‰jĉuh}”(jÉhØj j;jñjLj5j]j�j;jéj•jjøjÛj jkjájûjqjŽjjRj"j‡jWjÁj”uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jKs…”R”Œparse_messages”]”(hŒsystem_message”“”)�”}”(hhh]”hý)�”}”(hŒ-Duplicate implicit target name: "kernel bpf".”h]”hŒ1Duplicate implicit target name: “kernel bpfâ€�.”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hühjXubah}”(h]”h ]”h"]”h$]”h&]”jRaŒlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kouh1jVhj"h²hh³hÇh´KoubjW)�”}”(hhh]”hý)�”}”(hŒ,Duplicate implicit target name: "userspace".”h]”hŒ0Duplicate implicit target name: “userspaceâ€�.”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hühjtubah}”(h]”h ]”h"]”h$]”h&]”j‡aŒlevel”KŒtype”jqŒsource”hÇŒline”K}uh1jVhjWh²hh³hÇh´K}ubeŒtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.