~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/binderfs.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. SPDX-License-Identifier: GPL-2.0
  2 
  3 The Android binderfs Filesystem
  4 ===============================
  5 
  6 Android binderfs is a filesystem for the Android binder IPC mechanism.  It
  7 allows to dynamically add and remove binder devices at runtime.  Binder devices
  8 located in a new binderfs instance are independent of binder devices located in
  9 other binderfs instances.  Mounting a new binderfs instance makes it possible
 10 to get a set of private binder devices.
 11 
 12 Mounting binderfs
 13 -----------------
 14 
 15 Android binderfs can be mounted with::
 16 
 17   mkdir /dev/binderfs
 18   mount -t binder binder /dev/binderfs
 19 
 20 at which point a new instance of binderfs will show up at ``/dev/binderfs``.
 21 In a fresh instance of binderfs no binder devices will be present.  There will
 22 only be a ``binder-control`` device which serves as the request handler for
 23 binderfs. Mounting another binderfs instance at a different location will
 24 create a new and separate instance from all other binderfs mounts.  This is
 25 identical to the behavior of e.g. ``devpts`` and ``tmpfs``. The Android
 26 binderfs filesystem can be mounted in user namespaces.
 27 
 28 Options
 29 -------
 30 max
 31   binderfs instances can be mounted with a limit on the number of binder
 32   devices that can be allocated. The ``max=<count>`` mount option serves as
 33   a per-instance limit. If ``max=<count>`` is set then only ``<count>`` number
 34   of binder devices can be allocated in this binderfs instance.
 35 
 36 stats
 37   Using ``stats=global`` enables global binder statistics.
 38   ``stats=global`` is only available for a binderfs instance mounted in the
 39   initial user namespace. An attempt to use the option to mount a binderfs
 40   instance in another user namespace will return a permission error.
 41 
 42 Allocating binder Devices
 43 -------------------------
 44 
 45 .. _ioctl: http://man7.org/linux/man-pages/man2/ioctl.2.html
 46 
 47 To allocate a new binder device in a binderfs instance a request needs to be
 48 sent through the ``binder-control`` device node.  A request is sent in the form
 49 of an `ioctl() <ioctl_>`_.
 50 
 51 What a program needs to do is to open the ``binder-control`` device node and
 52 send a ``BINDER_CTL_ADD`` request to the kernel.  Users of binderfs need to
 53 tell the kernel which name the new binder device should get.  By default a name
 54 can only contain up to ``BINDERFS_MAX_NAME`` chars including the terminating
 55 zero byte.
 56 
 57 Once the request is made via an `ioctl() <ioctl_>`_ passing a ``struct
 58 binder_device`` with the name to the kernel it will allocate a new binder
 59 device and return the major and minor number of the new device in the struct
 60 (This is necessary because binderfs allocates a major device number
 61 dynamically.).  After the `ioctl() <ioctl_>`_ returns there will be a new
 62 binder device located under /dev/binderfs with the chosen name.
 63 
 64 Deleting binder Devices
 65 -----------------------
 66 
 67 .. _unlink: http://man7.org/linux/man-pages/man2/unlink.2.html
 68 .. _rm: http://man7.org/linux/man-pages/man1/rm.1.html
 69 
 70 Binderfs binder devices can be deleted via `unlink() <unlink_>`_.  This means
 71 that the `rm() <rm_>`_ tool can be used to delete them. Note that the
 72 ``binder-control`` device cannot be deleted since this would make the binderfs
 73 instance unusable.  The ``binder-control`` device will be deleted when the
 74 binderfs instance is unmounted and all references to it have been dropped.
 75 
 76 Binder features
 77 ---------------
 78 
 79 Assuming an instance of binderfs has been mounted at ``/dev/binderfs``, the
 80 features supported by the binder driver can be located under
 81 ``/dev/binderfs/features/``. The presence of individual files can be tested
 82 to determine whether a particular feature is supported by the driver.
 83 
 84 Example::
 85 
 86         cat /dev/binderfs/features/oneway_spam_detection
 87         1

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php