androidsplicesendfile

Linux supports splice() and sendfile(), how about Android?


Does Android support splice() and sendfile()?


Solution

  • These are Linux kernel calls, so they do exist on Android.

    The more interesting question is if Bionic libc provides wrappers as it does for most ordinarily used system calls, or if you will have to invoke them directly. Additionally, apart from being included in Bionic there is the question of the functionality being exported for general use in the NDK.

    It appears that sendfile() has been there since the first NDK release.

    splice() has not historically seemed to be part of the NDK (I did not check the latest), though it was added to the AOSP sources of Bionic libc in June 2014.

    Incidentally grep -r on relevant parts of the NDK installation and/or an AOSP Bionic checkout is a quick way to look into things like this.