Nsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget(/translations/zh_CN/admin-guide/binderfsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/zh_TW/admin-guide/binderfsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/it_IT/admin-guide/binderfsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/ja_JP/admin-guide/binderfsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/ko_KR/admin-guide/binderfsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/sp_SP/admin-guide/binderfsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhB/var/lib/git/docbuild/linux/Documentation/admin-guide/binderfs.rsthKubhsection)}(hhh](htitle)}(hThe Android binderfs Filesystemh]hThe Android binderfs Filesystem}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hX`Android binderfs is a filesystem for the Android binder IPC mechanism. It allows to dynamically add and remove binder devices at runtime. Binder devices located in a new binderfs instance are independent of binder devices located in other binderfs instances. Mounting a new binderfs instance makes it possible to get a set of private binder devices.h]hX`Android binderfs is a filesystem for the Android binder IPC mechanism. It allows to dynamically add and remove binder devices at runtime. Binder devices located in a new binderfs instance are independent of binder devices located in other binderfs instances. Mounting a new binderfs instance makes it possible to get a set of private binder devices.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hMounting binderfsh]hMounting binderfs}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(h&Android binderfs can be mounted with::h]h%Android binderfs can be mounted with:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh literal_block)}(h8mkdir /dev/binderfs mount -t binder binder /dev/binderfsh]h8mkdir /dev/binderfs mount -t binder binder /dev/binderfs}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhKhhhhubh)}(hXat which point a new instance of binderfs will show up at ``/dev/binderfs``. In a fresh instance of binderfs no binder devices will be present. There will only be a ``binder-control`` device which serves as the request handler for binderfs. Mounting another binderfs instance at a different location will create a new and separate instance from all other binderfs mounts. This is identical to the behavior of e.g. ``devpts`` and ``tmpfs``. The Android binderfs filesystem can be mounted in user namespaces.h](h:at which point a new instance of binderfs will show up at }(hjhhhNhNubhliteral)}(h``/dev/binderfs``h]h /dev/binderfs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh[. In a fresh instance of binderfs no binder devices will be present. There will only be a }(hjhhhNhNubj)}(h``binder-control``h]hbinder-control}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh device which serves as the request handler for binderfs. Mounting another binderfs instance at a different location will create a new and separate instance from all other binderfs mounts. This is identical to the behavior of e.g. }(hjhhhNhNubj)}(h ``devpts``h]hdevpts}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh and }(hjhhhNhNubj)}(h ``tmpfs``h]htmpfs}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhD. The Android binderfs filesystem can be mounted in user namespaces.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]mounting-binderfsah ]h"]mounting binderfsah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hOptionsh]hOptions}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhhKubhdefinition_list)}(hhh](hdefinition_list_item)}(hX max binderfs instances can be mounted with a limit on the number of binder devices that can be allocated. The ``max=`` mount option serves as a per-instance limit. If ``max=`` is set then only ```` number of binder devices can be allocated in this binderfs instance. h](hterm)}(hmaxh]hmax}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhK"hjubh definition)}(hhh]h)}(hXbinderfs instances can be mounted with a limit on the number of binder devices that can be allocated. The ``max=`` mount option serves as a per-instance limit. If ``max=`` is set then only ```` number of binder devices can be allocated in this binderfs instance.h](hjbinderfs instances can be mounted with a limit on the number of binder devices that can be allocated. The }(hjhhhNhNubj)}(h``max=``h]h max=}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh1 mount option serves as a per-instance limit. If }(hjhhhNhNubj)}(h``max=``h]h max=}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is set then only }(hjhhhNhNubj)}(h ````h]h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhE number of binder devices can be allocated in this binderfs instance.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j~hhhK"hj{ubj)}(hXstats Using ``stats=global`` enables global binder statistics. ``stats=global`` is only available for a binderfs instance mounted in the initial user namespace. An attempt to use the option to mount a binderfs instance in another user namespace will return a permission error. h](j)}(hstatsh]hstats}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhK(hjubj)}(hhh]h)}(hXUsing ``stats=global`` enables global binder statistics. ``stats=global`` is only available for a binderfs instance mounted in the initial user namespace. An attempt to use the option to mount a binderfs instance in another user namespace will return a permission error.h](hUsing }(hjhhhNhNubj)}(h``stats=global``h]h stats=global}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh# enables global binder statistics. }(hjhhhNhNubj)}(h``stats=global``h]h stats=global}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is only available for a binderfs instance mounted in the initial user namespace. An attempt to use the option to mount a binderfs instance in another user namespace will return a permission error.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK%hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j~hhhK(hj{hhubeh}(h]h ]h"]h$]h&]uh1jyhjhhhhhhNubeh}(h]optionsah ]h"]optionsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hAllocating binder Devicesh]hAllocating binder Devices}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjJhhhhhK+ubhtarget)}(h<.. _ioctl: http://man7.org/linux/man-pages/man2/ioctl.2.htmlh]h}(h]ioctlah ]h"]ioctlah$]h&]refuri1http://man7.org/linux/man-pages/man2/ioctl.2.htmluh1j[hK-hjJhhhh referencedKubh)}(hTo allocate a new binder device in a binderfs instance a request needs to be sent through the ``binder-control`` device node. A request is sent in the form of an `ioctl() `_.h](h^To allocate a new binder device in a binderfs instance a request needs to be sent through the }(hjlhhhNhNubj)}(h``binder-control``h]hbinder-control}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1jhjlubh3 device node. A request is sent in the form of an }(hjlhhhNhNubh reference)}(h`ioctl() `_h]hioctl()}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameioctl()jijjuh1jhjlresolvedKubj\)}(h h]h}(h]h ]h"]ioctl()ah$]h&]jijjuh1j[indirect_reference_nameioctlhjljKubh.}(hjlhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK/hjJhhubh)}(hX@What a program needs to do is to open the ``binder-control`` device node and send a ``BINDER_CTL_ADD`` request to the kernel. Users of binderfs need to tell the kernel which name the new binder device should get. By default a name can only contain up to ``BINDERFS_MAX_NAME`` chars including the terminating zero byte.h](h*What a program needs to do is to open the }(hjhhhNhNubj)}(h``binder-control``h]hbinder-control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh device node and send a }(hjhhhNhNubj)}(h``BINDER_CTL_ADD``h]hBINDER_CTL_ADD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh request to the kernel. Users of binderfs need to tell the kernel which name the new binder device should get. By default a name can only contain up to }(hjhhhNhNubj)}(h``BINDERFS_MAX_NAME``h]hBINDERFS_MAX_NAME}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh+ chars including the terminating zero byte.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK3hjJhhubh)}(hXOnce the request is made via an `ioctl() `_ passing a ``struct binder_device`` with the name to the kernel it will allocate a new binder device and return the major and minor number of the new device in the struct (This is necessary because binderfs allocates a major device number dynamically.). After the `ioctl() `_ returns there will be a new binder device located under /dev/binderfs with the chosen name.h](h Once the request is made via an }(hjhhhNhNubj)}(h`ioctl() `_h]hioctl()}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameioctl()jijjuh1jhjjKubj\)}(h h]h}(h]h ]h"]ioctl()ah$]h&]jijjuh1j[jioctlhjjKubh passing a }(hjhhhNhNubj)}(h``struct binder_device``h]hstruct binder_device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh with the name to the kernel it will allocate a new binder device and return the major and minor number of the new device in the struct (This is necessary because binderfs allocates a major device number dynamically.). After the }(hjhhhNhNubj)}(h`ioctl() `_h]hioctl()}(hj.hhhNhNubah}(h]h ]h"]h$]h&]nameioctl()jijjuh1jhjjKubj\)}(h h]h}(h]h ]h"]ioctl()ah$]h&]jijjuh1j[jioctlhjjKubh\ returns there will be a new binder device located under /dev/binderfs with the chosen name.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hjJhhubeh}(h]allocating-binder-devicesah ]h"]allocating binder devicesah$]h&]uh1hhhhhhhhK+ubh)}(hhh](h)}(hDeleting binder Devicesh]hDeleting binder Devices}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj\hhhhhKAubj\)}(h>.. _unlink: http://man7.org/linux/man-pages/man2/unlink.2.htmlh]h}(h]unlinkah ]h"]unlinkah$]h&]ji2http://man7.org/linux/man-pages/man2/unlink.2.htmluh1j[hKChj\hhhhjkKubj\)}(h6.. _rm: http://man7.org/linux/man-pages/man1/rm.1.htmlh]h}(h]rmah ]h"]rmah$]h&]ji.http://man7.org/linux/man-pages/man1/rm.1.htmluh1j[hKDhj\hhhhjkKubh)}(hXxBinderfs binder devices can be deleted via `unlink() `_. This means that the `rm() `_ tool can be used to delete them. Note that the ``binder-control`` device cannot be deleted since this would make the binderfs instance unusable. The ``binder-control`` device will be deleted when the binderfs instance is unmounted and all references to it have been dropped.h](h+Binderfs binder devices can be deleted via }(hjhhhNhNubj)}(h`unlink() `_h]hunlink()}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameunlink()jijyuh1jhjjKubj\)}(h h]h}(h]h ]h"]unlink()ah$]h&]jijyuh1j[junlinkhjjKubh. This means that the }(hjhhhNhNubj)}(h `rm() `_h]hrm()}(hjhhhNhNubah}(h]h ]h"]h$]h&]namerm()jijuh1jhjjKubj\)}(h h]h}(h]h ]h"]rm()ah$]h&]jijuh1j[jrmhjjKubh0 tool can be used to delete them. Note that the }(hjhhhNhNubj)}(h``binder-control``h]hbinder-control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhU device cannot be deleted since this would make the binderfs instance unusable. The }(hjhhhNhNubj)}(h``binder-control``h]hbinder-control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhk device will be deleted when the binderfs instance is unmounted and all references to it have been dropped.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKFhj\hhubeh}(h]deleting-binder-devicesah ]h"]deleting binder devicesah$]h&]uh1hhhhhhhhKAubh)}(hhh](h)}(hBinder featuresh]hBinder features}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKMubh)}(hXAssuming an instance of binderfs has been mounted at ``/dev/binderfs``, the features supported by the binder driver can be located under ``/dev/binderfs/features/``. The presence of individual files can be tested to determine whether a particular feature is supported by the driver.h](h5Assuming an instance of binderfs has been mounted at }(hjhhhNhNubj)}(h``/dev/binderfs``h]h /dev/binderfs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhC, the features supported by the binder driver can be located under }(hjhhhNhNubj)}(h``/dev/binderfs/features/``h]h/dev/binderfs/features/}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhv. The presence of individual files can be tested to determine whether a particular feature is supported by the driver.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKOhjhhubh)}(h Example::h]hExample:}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThjhhubh)}(h2cat /dev/binderfs/features/oneway_spam_detection 1h]h2cat /dev/binderfs/features/oneway_spam_detection 1}hjRsbah}(h]h ]h"]h$]h&]hhuh1hhhhKVhjhhubeh}(h]binder-featuresah ]h"]binder featuresah$]h&]uh1hhhhhhhhKMubeh}(h]the-android-binderfs-filesystemah ]h"]the android binderfs filesystemah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets](jj j>jjesubstitution_defs}substitution_names}refnames}(ioctl](jjj jj>j.eunlink](jjerm](jjeurefids}nameids}(jmjjjejbjGjDjYjVjfjcjjjvjsjjjejbu nametypes}(jmjejGjYjfjjvjjeuh}(jjhjbhjDjhjVjJjcj]jj\jsjmjjzjbju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages](hsystem_message)}(hhh]h)}(hhh]h-Hyperlink target "ioctl()" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineK/uh1jubj)}(hhh]h)}(hhh]h-Hyperlink target "ioctl()" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineK9uh1jubj)}(hhh]h)}(hhh]h-Hyperlink target "ioctl()" is not referenced.}hj7sbah}(h]h ]h"]h$]h&]uh1hhj4ubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineK9uh1jubj)}(hhh]h)}(hhh]h.Hyperlink target "unlink()" is not referenced.}hjQsbah}(h]h ]h"]h$]h&]uh1hhjNubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKFuh1jubj)}(hhh]h)}(hhh]h*Hyperlink target "rm()" is not referenced.}hjksbah}(h]h ]h"]h$]h&]uh1hhjhubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKFuh1jube transformerN include_log] decorationNhhub.