€•Œ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/process/adding-syscalls”Œ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/process/adding-syscalls”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/it_IT/process/adding-syscalls”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/ja_JP/process/adding-syscalls”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/ko_KR/process/adding-syscalls”Œ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/process/adding-syscalls”Œ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/process/adding-syscalls”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒtarget”“”)�”}”(hŒ.. _addsyscalls:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œ addsyscalls”uh1hµh´Khhh²hh³ŒE/var/lib/git/docbuild/linux/Documentation/process/adding-syscalls.rst”ubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒAdding a New System Call”h]”hŒAdding a New System Call”…”�”}”(hhËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhhÆh²hh³hÃh´KubhŒ paragraph”“”)�”}”(hŒÐThis document describes what's involved in adding a new system call to the Linux kernel, over and above the normal submission advice in :ref:`Documentation/process/submitting-patches.rst `.”h]”(hŒŠThis document describes what’s involved in adding a new system call to the Linux kernel, over and above the normal submission advice in ”…”�”}”(hhÛh²hh³Nh´Nubh)�”}”(hŒG:ref:`Documentation/process/submitting-patches.rst `”h]”hŒinline”“”)�”}”(hhåh]”hŒ,Documentation/process/submitting-patches.rst”…”�”}”(hhéh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-ref”eh"]”h$]”h&]”uh1hçhhãubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œprocess/adding-syscalls”Œ refdomain”hôŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆŒ reftarget”Œsubmittingpatches”uh1hh³hÃh´KhhÛubhŒ.”…”�”}”(hhÛh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KhhÆh²hubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒSystem Call Alternatives”h]”hŒSystem Call Alternatives”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjh²hh³hÃh´K ubhÚ)�”}”(hX8The first thing to consider when adding a new system call is whether one of the alternatives might be suitable instead. Although system calls are the most traditional and most obvious interaction points between userspace and the kernel, there are other possibilities -- choose what fits best for your interface.”h]”hX8The first thing to consider when adding a new system call is whether one of the alternatives might be suitable instead. Although system calls are the most traditional and most obvious interaction points between userspace and the kernel, there are other possibilities -- choose what fits best for your interface.”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Khjh²hubhŒ block_quote”“”)�”}”(hX!- If the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel. - If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification. - However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. - If you're just exposing runtime system information, a new node in sysfs (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace. - If the operation is specific to a particular file or file descriptor, then an additional :manpage:`fcntl(2)` command option may be more appropriate. However, :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing :manpage:`fcntl(2)` functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor). - If the operation is specific to a particular task or process, then an additional :manpage:`prctl(2)` command option may be more appropriate. As with :manpage:`fcntl(2)`, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ``prctl()`` commands or getting/setting a simple flag related to a process. ”h]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hX÷If the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel. - If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification. - However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. ”h]”(hÚ)�”}”(hXIf the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel.”h]”hXIf the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel.”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Khj>ubj2)�”}”(hXÍ- If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification. - However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒþIf the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification.”h]”hÚ)�”}”(hŒþIf the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ``poll``/``select``/``epoll`` to receive that notification.”h]”(hŒÃIf the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use ”…”�”}”(hj[h²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``poll``”h]”hŒpoll”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj[ubhŒ/”…”�”}”(hj[h²hh³Nh´Nubjd)�”}”(hŒ ``select``”h]”hŒselect”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj[ubhŒ/”…”�”}”hj[sbjd)�”}”(hŒ ``epoll``”h]”hŒepoll”…”�”}”(hj‰h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj[ubhŒ to receive that notification.”…”�”}”(hj[h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KhjWubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjTubj=)�”}”(hŒ¾However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API. ”h]”hÚ)�”}”(hŒ½However, operations that don't map to :manpage:`read(2)`/:manpage:`write(2)`-like operations have to be implemented as :manpage:`ioctl(2)` requests, which can lead to a somewhat opaque API.”h]”(hŒ(However, operations that don’t map to ”…”�”}”(hj«h²hh³Nh´NubhŒmanpage”“”)�”}”(hŒ:manpage:`read(2)`”h]”hŒread(2)”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”Œ xml:space”Œpreserve”Œpath”Œread(2)”Œpage”Œread”Œsection”Œ2”uh1j³hj«ubhŒ/”…”�”}”(hj«h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`write(2)`”h]”hŒwrite(2)”…”�”}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒwrite(2)”jÇŒwrite”jÉjÊuh1j³hj«ubhŒ+-like operations have to be implemented as ”…”�”}”(hj«h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`ioctl(2)`”h]”hŒioctl(2)”…”�”}”(hjãh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒioctl(2)”jÇŒioctl”jÉjÊuh1j³hj«ubhŒ3 requests, which can lead to a somewhat opaque API.”…”�”}”(hj«h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Khj§ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjTubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j7h³hÃh´KhjPubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Khj>ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j<hj9ubj=)�”}”(hX¾If you're just exposing runtime system information, a new node in sysfs (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace.”h]”hÚ)�”}”(hX¾If you're just exposing runtime system information, a new node in sysfs (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace.”h]”(hŒOIf you’re just exposing runtime system information, a new node in sysfs (see ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ'``Documentation/filesystems/sysfs.rst``”h]”hŒ#Documentation/filesystems/sysfs.rst”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ ) or the ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ ``/proc``”h]”hŒ/proc”…”�”}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhX< filesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a ‘production’ interface to userspace.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K#hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj9ubj=)�”}”(hXØIf the operation is specific to a particular file or file descriptor, then an additional :manpage:`fcntl(2)` command option may be more appropriate. However, :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing :manpage:`fcntl(2)` functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).”h]”hÚ)�”}”(hXØIf the operation is specific to a particular file or file descriptor, then an additional :manpage:`fcntl(2)` command option may be more appropriate. However, :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing :manpage:`fcntl(2)` functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).”h]”(hŒYIf the operation is specific to a particular file or file descriptor, then an additional ”…”�”}”(hjWh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`fcntl(2)`”h]”hŒfcntl(2)”…”�”}”(hj_h²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒfcntl(2)”jÇŒfcntl”jÉjÊuh1j³hjWubhŒ3 command option may be more appropriate. However, ”…”�”}”(hjWh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`fcntl(2)`”h]”hŒfcntl(2)”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒfcntl(2)”jÇŒfcntl”jÉjÊuh1j³hjWubhŒ‘ is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existing ”…”�”}”(hjWh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`fcntl(2)`”h]”hŒfcntl(2)”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒfcntl(2)”jÇŒfcntl”jÉjÊuh1j³hjWubhŒ‚ functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).”…”�”}”(hjWh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K)hjSubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj9ubj=)�”}”(hXWIf the operation is specific to a particular task or process, then an additional :manpage:`prctl(2)` command option may be more appropriate. As with :manpage:`fcntl(2)`, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ``prctl()`` commands or getting/setting a simple flag related to a process. ”h]”hÚ)�”}”(hXUIf the operation is specific to a particular task or process, then an additional :manpage:`prctl(2)` command option may be more appropriate. As with :manpage:`fcntl(2)`, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ``prctl()`` commands or getting/setting a simple flag related to a process.”h]”(hŒQIf the operation is specific to a particular task or process, then an additional ”…”�”}”(hj«h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`prctl(2)`”h]”hŒprctl(2)”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒprctl(2)”jÇŒprctl”jÉjÊuh1j³hj«ubhŒ2 command option may be more appropriate. As with ”…”�”}”(hj«h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`fcntl(2)`”h]”hŒfcntl(2)”…”�”}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒfcntl(2)”jÇŒfcntl”jÉjÊuh1j³hj«ubhŒa, this system call is a complicated multiplexor so is best reserved for near-analogs of existing ”…”�”}”(hj«h²hh³Nh´Nubjd)�”}”(hŒ ``prctl()``”h]”hŒprctl()”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj«ubhŒ@ commands or getting/setting a simple flag related to a process.”…”�”}”(hj«h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K/hj§ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj9ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´Khj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Khjh²hubeh}”(h]”Œsystem-call-alternatives”ah ]”h"]”Œsystem call alternatives”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´K ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ)Designing the API: Planning for Extension”h]”hŒ)Designing the API: Planning for Extension”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj h²hh³hÃh´K7ubhÚ)�”}”(hŒÿA new system call forms part of the API of the kernel, and has to be supported indefinitely. As such, it's a very good idea to explicitly discuss the interface on the kernel mailing list, and it's important to plan for future extensions of the interface.”h]”hXA new system call forms part of the API of the kernel, and has to be supported indefinitely. As such, it’s a very good idea to explicitly discuss the interface on the kernel mailing list, and it’s important to plan for future extensions of the interface.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K9hj h²hubhÚ)�”}”(hX](The syscall table is littered with historical examples where this wasn't done, together with the corresponding follow-up system calls -- ``eventfd``/``eventfd2``, ``dup2``/``dup3``, ``inotify_init``/``inotify_init1``, ``pipe``/``pipe2``, ``renameat``/``renameat2`` -- so learn from the history of the kernel and plan for extensions from the start.)”h]”(hŒŒ(The syscall table is littered with historical examples where this wasn’t done, together with the corresponding follow-up system calls -- ”…”�”}”(hj,h²hh³Nh´Nubjd)�”}”(hŒ ``eventfd``”h]”hŒeventfd”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ/”…”�”}”(hj,h²hh³Nh´Nubjd)�”}”(hŒ ``eventfd2``”h]”hŒeventfd2”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ, ”…”�”}”(hj,h²hh³Nh´Nubjd)�”}”(hŒ``dup2``”h]”hŒdup2”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ/”…”�”}”hj,sbjd)�”}”(hŒ``dup3``”h]”hŒdup3”…”�”}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ, ”…”�”}”hj,sbjd)�”}”(hŒ``inotify_init``”h]”hŒ inotify_init”…”�”}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ/”…”�”}”hj,sbjd)�”}”(hŒ``inotify_init1``”h]”hŒ inotify_init1”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ, ”…”�”}”(hj,h²hh³Nh´Nubjd)�”}”(hŒ``pipe``”h]”hŒpipe”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ/”…”�”}”hj,sbjd)�”}”(hŒ ``pipe2``”h]”hŒpipe2”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ, ”…”�”}”hj,sbjd)�”}”(hŒ ``renameat``”h]”hŒrenameat”…”�”}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒ/”…”�”}”hj,sbjd)�”}”(hŒ ``renameat2``”h]”hŒ renameat2”…”�”}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj,ubhŒT -- so learn from the history of the kernel and plan for extensions from the start.)”…”�”}”(hj,h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K>hj h²hubhÚ)�”}”(hXjFor simpler system calls that only take a couple of arguments, the preferred way to allow for future extensibility is to include a flags argument to the system call. To make sure that userspace programs can safely use flags between kernel versions, check whether the flags value holds any unknown flags, and reject the system call (with ``EINVAL``) if it does::”h]”(hXRFor simpler system calls that only take a couple of arguments, the preferred way to allow for future extensibility is to include a flags argument to the system call. To make sure that userspace programs can safely use flags between kernel versions, check whether the flags value holds any unknown flags, and reject the system call (with ”…”�”}”(hjîh²hh³Nh´Nubjd)�”}”(hŒ ``EINVAL``”h]”hŒEINVAL”…”�”}”(hjöh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjîubhŒ ) if it does:”…”�”}”(hjîh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KDhj h²hubhŒ literal_block”“”)�”}”(hŒKif (flags & ~(THING_FLAG1 | THING_FLAG2 | THING_FLAG3)) return -EINVAL;”h]”hŒKif (flags & ~(THING_FLAG1 | THING_FLAG2 | THING_FLAG3)) return -EINVAL;”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´KJhj h²hubhÚ)�”}”(hŒI(If no flags values are used yet, check that the flags argument is zero.)”h]”hŒI(If no flags values are used yet, check that the flags argument is zero.)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KMhj h²hubhÚ)�”}”(hXFor more sophisticated system calls that involve a larger number of arguments, it's preferred to encapsulate the majority of the arguments into a structure that is passed in by pointer. Such a structure can cope with future extension by including a size argument in the structure::”h]”hXFor more sophisticated system calls that involve a larger number of arguments, it’s preferred to encapsulate the majority of the arguments into a structure that is passed in by pointer. Such a structure can cope with future extension by including a size argument in the structure:”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KOhj h²hubj)�”}”(hŒ”struct xyzzy_params { u32 size; /* userspace sets p->size = sizeof(struct xyzzy_params) */ u32 param_1; u64 param_2; u64 param_3; };”h]”hŒ”struct xyzzy_params { u32 size; /* userspace sets p->size = sizeof(struct xyzzy_params) */ u32 param_1; u64 param_2; u64 param_3; };”…”�”}”hj:sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´KThj h²hubhÚ)�”}”(hŒ®As long as any subsequently added field, say ``param_4``, is designed so that a zero value gives the previous behaviour, then this allows both directions of version mismatch:”h]”(hŒ-As long as any subsequently added field, say ”…”�”}”(hjHh²hh³Nh´Nubjd)�”}”(hŒ ``param_4``”h]”hŒparam_4”…”�”}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjHubhŒv, is designed so that a zero value gives the previous behaviour, then this allows both directions of version mismatch:”…”�”}”(hjHh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K[hj h²hubj2)�”}”(hX‹- To cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ``param_4 == 0``). - To cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ``param_4 = 0``). ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒÓTo cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ``param_4 == 0``).”h]”hÚ)�”}”(hŒÓTo cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ``param_4 == 0``).”h]”(hŒÁTo cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that ”…”�”}”(hjsh²hh³Nh´Nubjd)�”}”(hŒ``param_4 == 0``”h]”hŒ param_4 == 0”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjsubhŒ).”…”�”}”(hjsh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K_hjoubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjlubj=)�”}”(hŒ«To cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ``param_4 = 0``). ”h]”hÚ)�”}”(hŒªTo cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ``param_4 = 0``).”h]”(hŒ™To cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting ”…”�”}”(hj�h²hh³Nh´Nubjd)�”}”(hŒ``param_4 = 0``”h]”hŒ param_4 = 0”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj�ubhŒ).”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kbhj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjlubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´K_hjhubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´K_hj h²hubhÚ)�”}”(hŒ†See :manpage:`perf_event_open(2)` and the ``perf_copy_attr()`` function (in ``kernel/events/core.c``) for an example of this approach.”h]”(hŒSee ”…”�”}”(hjÏh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`perf_event_open(2)`”h]”hŒperf_event_open(2)”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒperf_event_open(2)”jÇŒperf_event_open”jÉjÊuh1j³hjÏubhŒ and the ”…”�”}”(hjÏh²hh³Nh´Nubjd)�”}”(hŒ``perf_copy_attr()``”h]”hŒperf_copy_attr()”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÏubhŒ function (in ”…”�”}”(hjÏh²hh³Nh´Nubjd)�”}”(hŒ``kernel/events/core.c``”h]”hŒkernel/events/core.c”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÏubhŒ") for an example of this approach.”…”�”}”(hjÏh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kfhj h²hubeh}”(h]”Œ(designing-the-api-planning-for-extension”ah ]”h"]”Œ)designing the api: planning for extension”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´K7ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ'Designing the API: Other Considerations”h]”hŒ'Designing the API: Other Considerations”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjh²hh³hÃh´KkubhÚ)�”}”(hXIf your new system call allows userspace to refer to a kernel object, it should use a file descriptor as the handle for that object -- don't invent a new type of userspace object handle when the kernel already has mechanisms and well-defined semantics for using file descriptors.”h]”hXIf your new system call allows userspace to refer to a kernel object, it should use a file descriptor as the handle for that object -- don’t invent a new type of userspace object handle when the kernel already has mechanisms and well-defined semantics for using file descriptors.”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kmhjh²hubhÚ)�”}”(hXdIf your new xyzzy(2) system call does return a new file descriptor, then the flags argument should include a value that is equivalent to setting ``O_CLOEXEC`` on the new FD. This makes it possible for userspace to close the timing window between ``xyzzy()`` and calling ``fcntl(fd, F_SETFD, FD_CLOEXEC)``, where an unexpected ``fork()`` and ``execve()`` in another thread could leak a descriptor to the exec'ed program. (However, resist the temptation to reuse the actual value of the ``O_CLOEXEC`` constant, as it is architecture-specific and is part of a numbering space of ``O_*`` flags that is fairly full.)”h]”(hŒ‘If your new xyzzy(2) system call does return a new file descriptor, then the flags argument should include a value that is equivalent to setting ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ ``O_CLOEXEC``”h]”hŒ O_CLOEXEC”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒY on the new FD. This makes it possible for userspace to close the timing window between ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ ``xyzzy()``”h]”hŒxyzzy()”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒ and calling ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ"``fcntl(fd, F_SETFD, FD_CLOEXEC)``”h]”hŒfcntl(fd, F_SETFD, FD_CLOEXEC)”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒ, where an unexpected ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ ``fork()``”h]”hŒfork()”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒ and ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ ``execve()``”h]”hŒexecve()”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒ† in another thread could leak a descriptor to the exec’ed program. (However, resist the temptation to reuse the actual value of the ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ ``O_CLOEXEC``”h]”hŒ O_CLOEXEC”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒN constant, as it is architecture-specific and is part of a numbering space of ”…”�”}”(hj<h²hh³Nh´Nubjd)�”}”(hŒ``O_*``”h]”hŒO_*”…”�”}”(hj°h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj<ubhŒ flags that is fairly full.)”…”�”}”(hj<h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Krhjh²hubhÚ)�”}”(hXVIf your system call returns a new file descriptor, you should also consider what it means to use the :manpage:`poll(2)` family of system calls on that file descriptor. Making a file descriptor ready for reading or writing is the normal way for the kernel to indicate to userspace that an event has occurred on the corresponding kernel object.”h]”(hŒeIf your system call returns a new file descriptor, you should also consider what it means to use the ”…”�”}”(hjÈh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`poll(2)`”h]”hŒpoll(2)”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒpoll(2)”jÇŒpoll”jÉjÊuh1j³hjÈubhŒß family of system calls on that file descriptor. Making a file descriptor ready for reading or writing is the normal way for the kernel to indicate to userspace that an event has occurred on the corresponding kernel object.”…”�”}”(hjÈh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K|hjh²hubhÚ)�”}”(hŒ?If your new xyzzy(2) system call involves a filename argument::”h]”hŒ>If your new xyzzy(2) system call involves a filename argument:”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K‚hjh²hubj)�”}”(hŒ@int sys_xyzzy(const char __user *path, ..., unsigned int flags);”h]”hŒ@int sys_xyzzy(const char __user *path, ..., unsigned int flags);”…”�”}”hjøsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´K„hjh²hubhÚ)�”}”(hŒLyou should also consider whether an xyzzyat(2) version is more appropriate::”h]”hŒKyou should also consider whether an xyzzyat(2) version is more appropriate:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K†hjh²hubj)�”}”(hŒKint sys_xyzzyat(int dfd, const char __user *path, ..., unsigned int flags);”h]”hŒKint sys_xyzzyat(int dfd, const char __user *path, ..., unsigned int flags);”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´Kˆhjh²hubhÚ)�”}”(hX This allows more flexibility for how userspace specifies the file in question; in particular it allows userspace to request the functionality for an already-opened file descriptor using the ``AT_EMPTY_PATH`` flag, effectively giving an fxyzzy(3) operation for free::”h]”(hŒ¾This allows more flexibility for how userspace specifies the file in question; in particular it allows userspace to request the functionality for an already-opened file descriptor using the ”…”�”}”(hj"h²hh³Nh´Nubjd)�”}”(hŒ``AT_EMPTY_PATH``”h]”hŒ AT_EMPTY_PATH”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj"ubhŒ: flag, effectively giving an fxyzzy(3) operation for free:”…”�”}”(hj"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KŠhjh²hubj)�”}”(hŒ‰- xyzzyat(AT_FDCWD, path, ..., 0) is equivalent to xyzzy(path,...) - xyzzyat(fd, "", ..., AT_EMPTY_PATH) is equivalent to fxyzzy(fd, ...)”h]”hŒ‰- xyzzyat(AT_FDCWD, path, ..., 0) is equivalent to xyzzy(path,...) - xyzzyat(fd, "", ..., AT_EMPTY_PATH) is equivalent to fxyzzy(fd, ...)”…”�”}”hjBsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´K�hjh²hubhÚ)�”}”(hŒ¨(For more details on the rationale of the \*at() calls, see the :manpage:`openat(2)` man page; for an example of AT_EMPTY_PATH, see the :manpage:`fstatat(2)` man page.)”h]”(hŒ@(For more details on the rationale of the *at() calls, see the ”…”�”}”(hjPh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`openat(2)`”h]”hŒ openat(2)”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒ openat(2)”jÇŒopenat”jÉjÊuh1j³hjPubhŒ4 man page; for an example of AT_EMPTY_PATH, see the ”…”�”}”(hjPh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`fstatat(2)`”h]”hŒ fstatat(2)”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒ fstatat(2)”jÇŒfstatat”jÉjÊuh1j³hjPubhŒ man page.)”…”�”}”(hjPh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K’hjh²hubhÚ)�”}”(hŒ¸If your new xyzzy(2) system call involves a parameter describing an offset within a file, make its type ``loff_t`` so that 64-bit offsets can be supported even on 32-bit architectures.”h]”(hŒhIf your new xyzzy(2) system call involves a parameter describing an offset within a file, make its type ”…”�”}”(hj†h²hh³Nh´Nubjd)�”}”(hŒ ``loff_t``”h]”hŒloff_t”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj†ubhŒF so that 64-bit offsets can be supported even on 32-bit architectures.”…”�”}”(hj†h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K–hjh²hubhÚ)�”}”(hX7If your new xyzzy(2) system call involves privileged functionality, it needs to be governed by the appropriate Linux capability bit (checked with a call to ``capable()``), as described in the :manpage:`capabilities(7)` man page. Choose an existing capability bit that governs related functionality, but try to avoid combining lots of only vaguely related functions together under the same bit, as this goes against capabilities' purpose of splitting the power of root. In particular, avoid adding new uses of the already overly-general ``CAP_SYS_ADMIN`` capability.”h]”(hŒœIf your new xyzzy(2) system call involves privileged functionality, it needs to be governed by the appropriate Linux capability bit (checked with a call to ”…”�”}”(hj¦h²hh³Nh´Nubjd)�”}”(hŒ ``capable()``”h]”hŒ capable()”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¦ubhŒ), as described in the ”…”�”}”(hj¦h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`capabilities(7)`”h]”hŒcapabilities(7)”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒcapabilities(7)”jÇŒ capabilities”jÉŒ7”uh1j³hj¦ubhXB man page. Choose an existing capability bit that governs related functionality, but try to avoid combining lots of only vaguely related functions together under the same bit, as this goes against capabilities’ purpose of splitting the power of root. In particular, avoid adding new uses of the already overly-general ”…”�”}”(hj¦h²hh³Nh´Nubjd)�”}”(hŒ``CAP_SYS_ADMIN``”h]”hŒ CAP_SYS_ADMIN”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¦ubhŒ capability.”…”�”}”(hj¦h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kšhjh²hubhÚ)�”}”(hX/If your new xyzzy(2) system call manipulates a process other than the calling process, it should be restricted (using a call to ``ptrace_may_access()``) so that only a calling process with the same permissions as the target process, or with the necessary capabilities, can manipulate the target process.”h]”(hŒ€If your new xyzzy(2) system call manipulates a process other than the calling process, it should be restricted (using a call to ”…”�”}”(hjíh²hh³Nh´Nubjd)�”}”(hŒ``ptrace_may_access()``”h]”hŒptrace_may_access()”…”�”}”(hjõh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjíubhŒ˜) so that only a calling process with the same permissions as the target process, or with the necessary capabilities, can manipulate the target process.”…”�”}”(hjíh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K£hjh²hubhÚ)�”}”(hXNFinally, be aware that some non-x86 architectures have an easier time if system call parameters that are explicitly 64-bit fall on odd-numbered arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit registers. (This concern does not apply if the arguments are part of a structure that's passed in by pointer.)”h]”hXPFinally, be aware that some non-x86 architectures have an easier time if system call parameters that are explicitly 64-bit fall on odd-numbered arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit registers. (This concern does not apply if the arguments are part of a structure that’s passed in by pointer.)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K©hjh²hubeh}”(h]”Œ&designing-the-api-other-considerations”ah ]”h"]”Œ'designing the api: other considerations”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´KkubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒProposing the API”h]”hŒProposing the API”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj#h²hh³hÃh´K±ubhÚ)�”}”(hŒÕTo make new system calls easy to review, it's best to divide up the patchset into separate chunks. These should include at least the following items as distinct commits (each of which is described further below):”h]”hŒ×To make new system calls easy to review, it’s best to divide up the patchset into separate chunks. These should include at least the following items as distinct commits (each of which is described further below):”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K³hj#h²hubj2)�”}”(hX - The core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation. - Wiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32). - A demonstration of the use of the new system call in userspace via a selftest in ``tools/testing/selftests/``. - A draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository. ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒŠThe core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.”h]”hÚ)�”}”(hŒŠThe core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.”h]”hŒŠThe core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K·hjIubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjFubj=)�”}”(hŒxWiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).”h]”hÚ)�”}”(hŒxWiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).”h]”hŒxWiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K¹hjaubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjFubj=)�”}”(hŒnA demonstration of the use of the new system call in userspace via a selftest in ``tools/testing/selftests/``.”h]”hÚ)�”}”(hŒnA demonstration of the use of the new system call in userspace via a selftest in ``tools/testing/selftests/``.”h]”(hŒQA demonstration of the use of the new system call in userspace via a selftest in ”…”�”}”(hj}h²hh³Nh´Nubjd)�”}”(hŒ``tools/testing/selftests/``”h]”hŒtools/testing/selftests/”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj}ubhŒ.”…”�”}”(hj}h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K»hjyubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjFubj=)�”}”(hŒŠA draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository. ”h]”hÚ)�”}”(hŒ‰A draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository.”h]”hŒ‰A draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository.”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K½hj£ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjFubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´K·hjBubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´K·hj#h²hubhÚ)�”}”(hŒtNew system call proposals, like any change to the kernel's API, should always be cc'ed to linux-api@vger.kernel.org.”h]”(hŒ^New system call proposals, like any change to the kernel’s API, should always be cc’ed to ”…”�”}”(hjÇh²hh³Nh´NubhŒ reference”“”)�”}”(hŒlinux-api@vger.kernel.org”h]”hŒlinux-api@vger.kernel.org”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ mailto:linux-api@vger.kernel.org”uh1jÏhjÇubhŒ.”…”�”}”(hjÇh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KÀhj#h²hubeh}”(h]”Œproposing-the-api”ah ]”h"]”Œproposing the api”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´K±ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ"Generic System Call Implementation”h]”hŒ"Generic System Call Implementation”…”�”}”(hjöh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjóh²hh³hÃh´KÅubhÚ)�”}”(hXÊThe main entry point for your new xyzzy(2) system call will be called ``sys_xyzzy()``, but you add this entry point with the appropriate ``SYSCALL_DEFINEn()`` macro rather than explicitly. The 'n' indicates the number of arguments to the system call, and the macro takes the system call name followed by the (type, name) pairs for the parameters as arguments. Using this macro allows metadata about the new system call to be made available for other tools.”h]”(hŒFThe main entry point for your new xyzzy(2) system call will be called ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``sys_xyzzy()``”h]”hŒ sys_xyzzy()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ4, but you add this entry point with the appropriate ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``SYSCALL_DEFINEn()``”h]”hŒSYSCALL_DEFINEn()”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhX0 macro rather than explicitly. The ‘n’ indicates the number of arguments to the system call, and the macro takes the system call name followed by the (type, name) pairs for the parameters as arguments. Using this macro allows metadata about the new system call to be made available for other tools.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KÇhjóh²hubhÚ)�”}”(hŒ©The new entry point also needs a corresponding function prototype, in ``include/linux/syscalls.h``, marked as asmlinkage to match the way that system calls are invoked::”h]”(hŒFThe new entry point also needs a corresponding function prototype, in ”…”�”}”(hj6h²hh³Nh´Nubjd)�”}”(hŒ``include/linux/syscalls.h``”h]”hŒinclude/linux/syscalls.h”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj6ubhŒF, marked as asmlinkage to match the way that system calls are invoked:”…”�”}”(hj6h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KÏhjóh²hubj)�”}”(hŒasmlinkage long sys_xyzzy(...);”h]”hŒasmlinkage long sys_xyzzy(...);”…”�”}”hjVsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´KÓhjóh²hubhÚ)�”}”(hXSome architectures (e.g. x86) have their own architecture-specific syscall tables, but several other architectures share a generic syscall table. Add your new system call to the generic list by adding an entry to the list in ``include/uapi/asm-generic/unistd.h``::”h]”(hŒáSome architectures (e.g. x86) have their own architecture-specific syscall tables, but several other architectures share a generic syscall table. Add your new system call to the generic list by adding an entry to the list in ”…”�”}”(hjdh²hh³Nh´Nubjd)�”}”(hŒ%``include/uapi/asm-generic/unistd.h``”h]”hŒ!include/uapi/asm-generic/unistd.h”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjdubhŒ:”…”�”}”(hjdh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KÕhjóh²hubj)�”}”(hŒ7#define __NR_xyzzy 292 __SYSCALL(__NR_xyzzy, sys_xyzzy)”h]”hŒ7#define __NR_xyzzy 292 __SYSCALL(__NR_xyzzy, sys_xyzzy)”…”�”}”hj„sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´KÚhjóh²hubhÚ)�”}”(hŒØAlso update the __NR_syscalls count to reflect the additional system call, and note that if multiple new system calls are added in the same merge window, your new syscall number may get adjusted to resolve conflicts.”h]”hŒØAlso update the __NR_syscalls count to reflect the additional system call, and note that if multiple new system calls are added in the same merge window, your new syscall number may get adjusted to resolve conflicts.”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KÝhjóh²hubhÚ)�”}”(hŒ•The file ``kernel/sys_ni.c`` provides a fallback stub implementation of each system call, returning ``-ENOSYS``. Add your new system call here too::”h]”(hŒ The file ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ``kernel/sys_ni.c``”h]”hŒkernel/sys_ni.c”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒH provides a fallback stub implementation of each system call, returning ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ ``-ENOSYS``”h]”hŒ-ENOSYS”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒ%. Add your new system call here too:”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Káhjóh²hubj)�”}”(hŒCOND_SYSCALL(xyzzy);”h]”hŒCOND_SYSCALL(xyzzy);”…”�”}”hjÒsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´Kähjóh²hubhÚ)�”}”(hŒÉYour new kernel functionality, and the system call that controls it, should normally be optional, so add a ``CONFIG`` option (typically to ``init/Kconfig``) for it. As usual for new ``CONFIG`` options:”h]”(hŒkYour new kernel functionality, and the system call that controls it, should normally be optional, so add a ”…”�”}”(hjàh²hh³Nh´Nubjd)�”}”(hŒ ``CONFIG``”h]”hŒCONFIG”…”�”}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjàubhŒ option (typically to ”…”�”}”(hjàh²hh³Nh´Nubjd)�”}”(hŒ``init/Kconfig``”h]”hŒ init/Kconfig”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjàubhŒ) for it. As usual for new ”…”�”}”(hjàh²hh³Nh´Nubjd)�”}”(hŒ ``CONFIG``”h]”hŒCONFIG”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjàubhŒ options:”…”�”}”(hjàh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kæhjóh²hubj2)�”}”(hX™- Include a description of the new functionality and system call controlled by the option. - Make the option depend on EXPERT if it should be hidden from normal users. - Make any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``). - Double check that the kernel still builds with the new CONFIG option turned off. ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒXInclude a description of the new functionality and system call controlled by the option.”h]”hÚ)�”}”(hŒXInclude a description of the new functionality and system call controlled by the option.”h]”hŒXInclude a description of the new functionality and system call controlled by the option.”…”�”}”(hj/ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kêhj+ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj( ubj=)�”}”(hŒJMake the option depend on EXPERT if it should be hidden from normal users.”h]”hÚ)�”}”(hjE h]”hŒJMake the option depend on EXPERT if it should be hidden from normal users.”…”�”}”(hjG h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KìhjC ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj( ubj=)�”}”(hŒ•Make any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``).”h]”hÚ)�”}”(hŒ•Make any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``).”h]”(hŒiMake any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g. ”…”�”}”(hj^ h²hh³Nh´Nubjd)�”}”(hŒ*``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``”h]”hŒ&obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o”…”�”}”(hjf h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj^ ubhŒ).”…”�”}”(hj^ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´KíhjZ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj( ubj=)�”}”(hŒQDouble check that the kernel still builds with the new CONFIG option turned off. ”h]”hÚ)�”}”(hŒPDouble check that the kernel still builds with the new CONFIG option turned off.”h]”hŒPDouble check that the kernel still builds with the new CONFIG option turned off.”…”�”}”(hjˆ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kïhj„ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj( ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´Kêhj$ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Kêhjóh²hubhÚ)�”}”(hŒ.To summarize, you need a commit that includes:”h]”hŒ.To summarize, you need a commit that includes:”…”�”}”(hj¨ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kòhjóh²hubj2)�”}”(hX- ``CONFIG`` option for the new function, normally in ``init/Kconfig`` - ``SYSCALL_DEFINEn(xyzzy, ...)`` for the entry point - corresponding prototype in ``include/linux/syscalls.h`` - generic table entry in ``include/uapi/asm-generic/unistd.h`` - fallback stub in ``kernel/sys_ni.c`` ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒD``CONFIG`` option for the new function, normally in ``init/Kconfig``”h]”hÚ)�”}”(hj¿ h]”(jd)�”}”(hŒ ``CONFIG``”h]”hŒCONFIG”…”�”}”(hjÄ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÁ ubhŒ* option for the new function, normally in ”…”�”}”(hjÁ h²hh³Nh´Nubjd)�”}”(hŒ``init/Kconfig``”h]”hŒ init/Kconfig”…”�”}”(hjÖ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÁ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kôhj½ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjº ubj=)�”}”(hŒ3``SYSCALL_DEFINEn(xyzzy, ...)`` for the entry point”h]”hÚ)�”}”(hjò h]”(jd)�”}”(hŒ``SYSCALL_DEFINEn(xyzzy, ...)``”h]”hŒSYSCALL_DEFINEn(xyzzy, ...)”…”�”}”(hj÷ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjô ubhŒ for the entry point”…”�”}”(hjô h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Kõhjð ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjº ubj=)�”}”(hŒ7corresponding prototype in ``include/linux/syscalls.h``”h]”hÚ)�”}”(hj h]”(hŒcorresponding prototype in ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ``include/linux/syscalls.h``”h]”hŒinclude/linux/syscalls.h”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Köhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjº ubj=)�”}”(hŒ h²hh³Nh´Nubjd)�”}”(hŒ%``include/uapi/asm-generic/unistd.h``”h]”hŒ!include/uapi/asm-generic/unistd.h”…”�”}”(hjE h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj> ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´K÷hj: ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjº ubj=)�”}”(hŒ&fallback stub in ``kernel/sys_ni.c`` ”h]”hÚ)�”}”(hŒ$fallback stub in ``kernel/sys_ni.c``”h]”(hŒfallback stub in ”…”�”}”(hjc h²hh³Nh´Nubjd)�”}”(hŒ``kernel/sys_ni.c``”h]”hŒkernel/sys_ni.c”…”�”}”(hjk h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjc ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Køhj_ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjº ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´Kôhj¶ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Kôhjóh²hubh¶)�”}”(hŒ.. _syscall_generic_6_11:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÁŒsyscall-generic-6-11”uh1hµh´Kûhjóh²hh³hÃubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Since 6.11”h]”hŒ Since 6.11”…”�”}”(hjŸ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjœ h²hh³hÃh´KþubhÚ)�”}”(hŒ°Starting with kernel version 6.11, general system call implementation for the following architectures no longer requires modifications to ``include/uapi/asm-generic/unistd.h``:”h]”(hŒŠStarting with kernel version 6.11, general system call implementation for the following architectures no longer requires modifications to ”…”�”}”(hj­ h²hh³Nh´Nubjd)�”}”(hŒ%``include/uapi/asm-generic/unistd.h``”h]”hŒ!include/uapi/asm-generic/unistd.h”…”�”}”(hjµ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj­ ubhŒ:”…”�”}”(hj­ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhjœ h²hubj2)�”}”(hŒF- arc - arm64 - csky - hexagon - loongarch - nios2 - openrisc - riscv ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒarc”h]”hÚ)�”}”(hjÖ h]”hŒarc”…”�”}”(hjØ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MhjÔ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒarm64”h]”hÚ)�”}”(hjí h]”hŒarm64”…”�”}”(hjï h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhjë ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒcsky”h]”hÚ)�”}”(hj h]”hŒcsky”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒhexagon”h]”hÚ)�”}”(hj h]”hŒhexagon”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒ loongarch”h]”hÚ)�”}”(hj2 h]”hŒ loongarch”…”�”}”(hj4 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhj0 ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒnios2”h]”hÚ)�”}”(hjI h]”hŒnios2”…”�”}”(hjK h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M hjG ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒopenrisc”h]”hÚ)�”}”(hj` h]”hŒopenrisc”…”�”}”(hjb h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M hj^ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubj=)�”}”(hŒriscv ”h]”hÚ)�”}”(hŒriscv”h]”hŒriscv”…”�”}”(hjy h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M hju ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÑ ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´MhjÍ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Mhjœ h²hubhÚ)�”}”(hŒsInstead, you need to update ``scripts/syscall.tbl`` and, if applicable, adjust ``arch/*/kernel/Makefile.syscalls``.”h]”(hŒInstead, you need to update ”…”�”}”(hj™ h²hh³Nh´Nubjd)�”}”(hŒ``scripts/syscall.tbl``”h]”hŒscripts/syscall.tbl”…”�”}”(hj¡ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj™ ubhŒ and, if applicable, adjust ”…”�”}”(hj™ h²hh³Nh´Nubjd)�”}”(hŒ#``arch/*/kernel/Makefile.syscalls``”h]”hŒarch/*/kernel/Makefile.syscalls”…”�”}”(hj³ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj™ ubhŒ.”…”�”}”(hj™ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M hjœ h²hubhÚ)�”}”(hŒ‚As ``scripts/syscall.tbl`` serves as a common syscall table across multiple architectures, a new entry is required in this table::”h]”(hŒAs ”…”�”}”(hjË h²hh³Nh´Nubjd)�”}”(hŒ``scripts/syscall.tbl``”h]”hŒscripts/syscall.tbl”…”�”}”(hjÓ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjË ubhŒg serves as a common syscall table across multiple architectures, a new entry is required in this table:”…”�”}”(hjË h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhjœ h²hubj)�”}”(hŒ"468 common xyzzy sys_xyzzy”h]”hŒ"468 common xyzzy sys_xyzzy”…”�”}”hjë sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´Mhjœ h²hubhÚ)�”}”(hŒöNote that adding an entry to ``scripts/syscall.tbl`` with the "common" ABI also affects all architectures that share this table. For more limited or architecture-specific changes, consider using an architecture-specific ABI or defining a new one.”h]”(hŒNote that adding an entry to ”…”�”}”(hjù h²hh³Nh´Nubjd)�”}”(hŒ``scripts/syscall.tbl``”h]”hŒscripts/syscall.tbl”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjù ubhŒÆ with the “commonâ€� ABI also affects all architectures that share this table. For more limited or architecture-specific changes, consider using an architecture-specific ABI or defining a new one.”…”�”}”(hjù h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhjœ h²hubhÚ)�”}”(hŒƒIf a new ABI, say ``xyz``, is introduced, the corresponding updates should be made to ``arch/*/kernel/Makefile.syscalls`` as well::”h]”(hŒIf a new ABI, say ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ``xyz``”h]”hŒxyz”…”�”}”(hj! h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒ=, is introduced, the corresponding updates should be made to ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ#``arch/*/kernel/Makefile.syscalls``”h]”hŒarch/*/kernel/Makefile.syscalls”…”�”}”(hj3 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒ as well:”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhjœ h²hubj)�”}”(hŒ!syscall_abis_{32,64} += xyz (...)”h]”hŒ!syscall_abis_{32,64} += xyz (...)”…”�”}”hjK sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´Mhjœ h²hubhÚ)�”}”(hŒ.To summarize, you need a commit that includes:”h]”hŒ.To summarize, you need a commit that includes:”…”�”}”(hjY h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhjœ h²hubj2)�”}”(hXL- ``CONFIG`` option for the new function, normally in ``init/Kconfig`` - ``SYSCALL_DEFINEn(xyzzy, ...)`` for the entry point - corresponding prototype in ``include/linux/syscalls.h`` - new entry in ``scripts/syscall.tbl`` - (if needed) Makefile updates in ``arch/*/kernel/Makefile.syscalls`` - fallback stub in ``kernel/sys_ni.c`` ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒD``CONFIG`` option for the new function, normally in ``init/Kconfig``”h]”hÚ)�”}”(hjp h]”(jd)�”}”(hŒ ``CONFIG``”h]”hŒCONFIG”…”�”}”(hju h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjr ubhŒ* option for the new function, normally in ”…”�”}”(hjr h²hh³Nh´Nubjd)�”}”(hŒ``init/Kconfig``”h]”hŒ init/Kconfig”…”�”}”(hj‡ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjr ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M!hjn ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjk ubj=)�”}”(hŒ3``SYSCALL_DEFINEn(xyzzy, ...)`` for the entry point”h]”hÚ)�”}”(hj£ h]”(jd)�”}”(hŒ``SYSCALL_DEFINEn(xyzzy, ...)``”h]”hŒSYSCALL_DEFINEn(xyzzy, ...)”…”�”}”(hj¨ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¥ ubhŒ for the entry point”…”�”}”(hj¥ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M"hj¡ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjk ubj=)�”}”(hŒ7corresponding prototype in ``include/linux/syscalls.h``”h]”hÚ)�”}”(hjÈ h]”(hŒcorresponding prototype in ”…”�”}”(hjÊ h²hh³Nh´Nubjd)�”}”(hŒ``include/linux/syscalls.h``”h]”hŒinclude/linux/syscalls.h”…”�”}”(hjÑ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÊ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M#hjÆ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjk ubj=)�”}”(hŒ$new entry in ``scripts/syscall.tbl``”h]”hÚ)�”}”(hjí h]”(hŒ new entry in ”…”�”}”(hjï h²hh³Nh´Nubjd)�”}”(hŒ``scripts/syscall.tbl``”h]”hŒscripts/syscall.tbl”…”�”}”(hjö h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjï ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M$hjë ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjk ubj=)�”}”(hŒC(if needed) Makefile updates in ``arch/*/kernel/Makefile.syscalls``”h]”hÚ)�”}”(hj h]”(hŒ (if needed) Makefile updates in ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ#``arch/*/kernel/Makefile.syscalls``”h]”hŒarch/*/kernel/Makefile.syscalls”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M%hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjk ubj=)�”}”(hŒ&fallback stub in ``kernel/sys_ni.c`` ”h]”hÚ)�”}”(hŒ$fallback stub in ``kernel/sys_ni.c``”h]”(hŒfallback stub in ”…”�”}”(hj9 h²hh³Nh´Nubjd)�”}”(hŒ``kernel/sys_ni.c``”h]”hŒkernel/sys_ni.c”…”�”}”(hjA h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj9 ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M&hj5 ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjk ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´M!hjg ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´M!hjœ h²hubeh}”(h]”(Œ since-6-11”j› eh ]”h"]”Œsyscall_generic_6_11”ah$]”Œ since 6.11”ah&]”uh1hÄhjóh²hh³hÃh´KþŒ referenced”KŒexpect_referenced_by_name”}”jl j‘ sŒexpect_referenced_by_id”}”j› j‘ subeh}”(h]”Œ"generic-system-call-implementation”ah ]”h"]”Œ"generic system call implementation”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´KÅubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒx86 System Call Implementation”h]”hŒx86 System Call Implementation”…”�”}”(hj€ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj} h²hh³hÃh´M*ubhÚ)�”}”(hXTo wire up your new system call for x86 platforms, you need to update the master syscall tables. Assuming your new system call isn't special in some way (see below), this involves a "common" entry (for x86_64 and x32) in arch/x86/entry/syscalls/syscall_64.tbl::”h]”hX To wire up your new system call for x86 platforms, you need to update the master syscall tables. Assuming your new system call isn’t special in some way (see below), this involves a “commonâ€� entry (for x86_64 and x32) in arch/x86/entry/syscalls/syscall_64.tbl:”…”�”}”(hjŽ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M,hj} h²hubj)�”}”(hŒ"333 common xyzzy sys_xyzzy”h]”hŒ"333 common xyzzy sys_xyzzy”…”�”}”hjœ sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M1hj} h²hubhÚ)�”}”(hŒCand an "i386" entry in ``arch/x86/entry/syscalls/syscall_32.tbl``::”h]”(hŒand an “i386â€� entry in ”…”�”}”(hjª h²hh³Nh´Nubjd)�”}”(hŒ*``arch/x86/entry/syscalls/syscall_32.tbl``”h]”hŒ&arch/x86/entry/syscalls/syscall_32.tbl”…”�”}”(hj² h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjª ubhŒ:”…”�”}”(hjª h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M3hj} h²hubj)�”}”(hŒ"380 i386 xyzzy sys_xyzzy”h]”hŒ"380 i386 xyzzy sys_xyzzy”…”�”}”hjÊ sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M5hj} h²hubhÚ)�”}”(hŒbAgain, these numbers are liable to be changed if there are conflicts in the relevant merge window.”h]”hŒbAgain, these numbers are liable to be changed if there are conflicts in the relevant merge window.”…”�”}”(hjØ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M7hj} h²hubeh}”(h]”Œx86-system-call-implementation”ah ]”h"]”Œx86 system call implementation”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M*ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ$Compatibility System Calls (Generic)”h]”hŒ$Compatibility System Calls (Generic)”…”�”}”(hjñ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjî h²hh³hÃh´M<ubhÚ)�”}”(hŒÖFor most system calls the same 64-bit implementation can be invoked even when the userspace program is itself 32-bit; even if the system call's parameters include an explicit pointer, this is handled transparently.”h]”hŒØFor most system calls the same 64-bit implementation can be invoked even when the userspace program is itself 32-bit; even if the system call’s parameters include an explicit pointer, this is handled transparently.”…”�”}”(hjÿ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M>hjî h²hubhÚ)�”}”(hŒˆHowever, there are a couple of situations where a compatibility layer is needed to cope with size differences between 32-bit and 64-bit.”h]”hŒˆHowever, there are a couple of situations where a compatibility layer is needed to cope with size differences between 32-bit and 64-bit.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MBhjî h²hubhÚ)�”}”(hŒðThe first is if the 64-bit kernel also supports 32-bit userspace programs, and so needs to parse areas of (``__user``) memory that could hold either 32-bit or 64-bit values. In particular, this is needed whenever a system call argument is:”h]”(hŒkThe first is if the 64-bit kernel also supports 32-bit userspace programs, and so needs to parse areas of (”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ ``__user``”h]”hŒ__user”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ{) memory that could hold either 32-bit or 64-bit values. In particular, this is needed whenever a system call argument is:”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MEhjî h²hubj2)�”}”(hŒÿ- a pointer to a pointer - a pointer to a struct containing a pointer (e.g. ``struct iovec __user *``) - a pointer to a varying sized integral type (``time_t``, ``off_t``, ``long``, ...) - a pointer to a struct containing a varying sized integral type. ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒa pointer to a pointer”h]”hÚ)�”}”(hjDh]”hŒa pointer to a pointer”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MJhjBubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj?ubj=)�”}”(hŒKa pointer to a struct containing a pointer (e.g. ``struct iovec __user *``)”h]”hÚ)�”}”(hj[h]”(hŒ1a pointer to a struct containing a pointer (e.g. ”…”�”}”(hj]h²hh³Nh´Nubjd)�”}”(hŒ``struct iovec __user *``”h]”hŒstruct iovec __user *”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj]ub•hŒ)”…”�”}”(hj]h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MKhjYubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj?ubj=)�”}”(hŒQa pointer to a varying sized integral type (``time_t``, ``off_t``, ``long``, ...)”h]”hÚ)�”}”(hŒQa pointer to a varying sized integral type (``time_t``, ``off_t``, ``long``, ...)”h]”(hŒ,a pointer to a varying sized integral type (”…”�”}”(hj†h²hh³Nh´Nubjd)�”}”(hŒ ``time_t``”h]”hŒtime_t”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj†ubhŒ, ”…”�”}”(hj†h²hh³Nh´Nubjd)�”}”(hŒ ``off_t``”h]”hŒoff_t”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj†ubhŒ, ”…”�”}”(hj†h²hh³Nh´Nubjd)�”}”(hŒ``long``”h]”hŒlong”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj†ubhŒ, ...)”…”�”}”(hj†h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MLhj‚ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj?ubj=)�”}”(hŒ@a pointer to a struct containing a varying sized integral type. ”h]”hÚ)�”}”(hŒ?a pointer to a struct containing a varying sized integral type.”h]”hŒ?a pointer to a struct containing a varying sized integral type.”…”�”}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MNhjÐubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj?ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´MJhj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´MJhjî h²hubhÚ)�”}”(hX€The second situation that requires a compatibility layer is if one of the system call's arguments has a type that is explicitly 64-bit even on a 32-bit architecture, for example ``loff_t`` or ``__u64``. In this case, a value that arrives at a 64-bit kernel from a 32-bit application will be split into two 32-bit values, which then need to be re-assembled in the compatibility layer.”h]”(hŒ´The second situation that requires a compatibility layer is if one of the system call’s arguments has a type that is explicitly 64-bit even on a 32-bit architecture, for example ”…”�”}”(hjôh²hh³Nh´Nubjd)�”}”(hŒ ``loff_t``”h]”hŒloff_t”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjôubhŒ or ”…”�”}”(hjôh²hh³Nh´Nubjd)�”}”(hŒ ``__u64``”h]”hŒ__u64”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjôubhŒ·. In this case, a value that arrives at a 64-bit kernel from a 32-bit application will be split into two 32-bit values, which then need to be re-assembled in the compatibility layer.”…”�”}”(hjôh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MPhjî h²hubhÚ)�”}”(hŒø(Note that a system call argument that's a pointer to an explicit 64-bit type does **not** need a compatibility layer; for example, :manpage:`splice(2)`'s arguments of type ``loff_t __user *`` do not trigger the need for a ``compat_`` system call.)”h]”(hŒU(Note that a system call argument that’s a pointer to an explicit 64-bit type does ”…”�”}”(hj&h²hh³Nh´NubhŒstrong”“”)�”}”(hŒ**not**”h]”hŒnot”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j.hj&ubhŒ* need a compatibility layer; for example, ”…”�”}”(hj&h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`splice(2)`”h]”hŒ splice(2)”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒ splice(2)”jÇŒsplice”jÉjÊuh1j³hj&ubhŒ’s arguments of type ”…”�”}”(hj&h²hh³Nh´Nubjd)�”}”(hŒ``loff_t __user *``”h]”hŒloff_t __user *”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj&ubhŒ do not trigger the need for a ”…”�”}”(hj&h²hh³Nh´Nubjd)�”}”(hŒ ``compat_``”h]”hŒcompat_”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj&ubhŒ system call.)”…”�”}”(hj&h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MVhjî h²hubhÚ)�”}”(hXThe compatibility version of the system call is called ``compat_sys_xyzzy()``, and is added with the ``COMPAT_SYSCALL_DEFINEn()`` macro, analogously to SYSCALL_DEFINEn. This version of the implementation runs as part of a 64-bit kernel, but expects to receive 32-bit parameter values and does whatever is needed to deal with them. (Typically, the ``compat_sys_`` version converts the values to 64-bit versions and either calls on to the ``sys_`` version, or both of them call a common inner implementation function.)”h]”(hŒ7The compatibility version of the system call is called ”…”�”}”(hj€h²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_xyzzy()``”h]”hŒcompat_sys_xyzzy()”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj€ubhŒ, and is added with the ”…”�”}”(hj€h²hh³Nh´Nubjd)�”}”(hŒ``COMPAT_SYSCALL_DEFINEn()``”h]”hŒCOMPAT_SYSCALL_DEFINEn()”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj€ubhŒÜ macro, analogously to SYSCALL_DEFINEn. This version of the implementation runs as part of a 64-bit kernel, but expects to receive 32-bit parameter values and does whatever is needed to deal with them. (Typically, the ”…”�”}”(hj€h²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_``”h]”hŒ compat_sys_”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj€ubhŒK version converts the values to 64-bit versions and either calls on to the ”…”�”}”(hj€h²hh³Nh´Nubjd)�”}”(hŒ``sys_``”h]”hŒsys_”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj€ubhŒG version, or both of them call a common inner implementation function.)”…”�”}”(hj€h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MZhjî h²hubhÚ)�”}”(hŒªThe compat entry point also needs a corresponding function prototype, in ``include/linux/compat.h``, marked as asmlinkage to match the way that system calls are invoked::”h]”(hŒIThe compat entry point also needs a corresponding function prototype, in ”…”�”}”(hjÖh²hh³Nh´Nubjd)�”}”(hŒ``include/linux/compat.h``”h]”hŒinclude/linux/compat.h”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÖubhŒF, marked as asmlinkage to match the way that system calls are invoked:”…”�”}”(hjÖh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mbhjî h²hubj)�”}”(hŒ&asmlinkage long compat_sys_xyzzy(...);”h]”hŒ&asmlinkage long compat_sys_xyzzy(...);”…”�”}”hjösbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´Mfhjî h²hubhÚ)�”}”(hXöIf the system call involves a structure that is laid out differently on 32-bit and 64-bit systems, say ``struct xyzzy_args``, then the include/linux/compat.h header file should also include a compat version of the structure (``struct compat_xyzzy_args``) where each variable-size field has the appropriate ``compat_`` type that corresponds to the type in ``struct xyzzy_args``. The ``compat_sys_xyzzy()`` routine can then use this ``compat_`` structure to parse the arguments from a 32-bit invocation.”h]”(hŒgIf the system call involves a structure that is laid out differently on 32-bit and 64-bit systems, say ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``struct xyzzy_args``”h]”hŒstruct xyzzy_args”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒe, then the include/linux/compat.h header file should also include a compat version of the structure (”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``struct compat_xyzzy_args``”h]”hŒstruct compat_xyzzy_args”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ5) where each variable-size field has the appropriate ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ ``compat_``”h]”hŒcompat_”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ& type that corresponds to the type in ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``struct xyzzy_args``”h]”hŒstruct xyzzy_args”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ. The ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_xyzzy()``”h]”hŒcompat_sys_xyzzy()”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ routine can then use this ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ ``compat_``”h]”hŒcompat_”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubhŒ; structure to parse the arguments from a 32-bit invocation.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhhjî h²hubhÚ)�”}”(hŒ"For example, if there are fields::”h]”hŒ!For example, if there are fields:”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mphjî h²hubj)�”}”(hŒtstruct xyzzy_args { const char __user *ptr; __kernel_long_t varying_val; u64 fixed_val; /* ... */ };”h]”hŒtstruct xyzzy_args { const char __user *ptr; __kernel_long_t varying_val; u64 fixed_val; /* ... */ };”…”�”}”hjŒsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´Mrhjî h²hubhÚ)�”}”(hŒ@in struct xyzzy_args, then struct compat_xyzzy_args would have::”h]”hŒ?in struct xyzzy_args, then struct compat_xyzzy_args would have:”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Myhjî h²hubj)�”}”(hŒtstruct compat_xyzzy_args { compat_uptr_t ptr; compat_long_t varying_val; u64 fixed_val; /* ... */ };”h]”hŒtstruct compat_xyzzy_args { compat_uptr_t ptr; compat_long_t varying_val; u64 fixed_val; /* ... */ };”…”�”}”hj¨sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M{hjî h²hubhÚ)�”}”(hŒºThe generic system call list also needs adjusting to allow for the compat version; the entry in ``include/uapi/asm-generic/unistd.h`` should use ``__SC_COMP`` rather than ``__SYSCALL``::”h]”(hŒ`The generic system call list also needs adjusting to allow for the compat version; the entry in ”…”�”}”(hj¶h²hh³Nh´Nubjd)�”}”(hŒ%``include/uapi/asm-generic/unistd.h``”h]”hŒ!include/uapi/asm-generic/unistd.h”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¶ubhŒ should use ”…”�”}”(hj¶h²hh³Nh´Nubjd)�”}”(hŒ ``__SC_COMP``”h]”hŒ __SC_COMP”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¶ubhŒ rather than ”…”�”}”(hj¶h²hh³Nh´Nubjd)�”}”(hŒ ``__SYSCALL``”h]”hŒ __SYSCALL”…”�”}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¶ubhŒ:”…”�”}”(hj¶h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M‚hjî h²hubj)�”}”(hŒI#define __NR_xyzzy 292 __SC_COMP(__NR_xyzzy, sys_xyzzy, compat_sys_xyzzy)”h]”hŒI#define __NR_xyzzy 292 __SC_COMP(__NR_xyzzy, sys_xyzzy, compat_sys_xyzzy)”…”�”}”hjúsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M†hjî h²hubhÚ)�”}”(hŒTo summarize, you need:”h]”hŒTo summarize, you need:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M‰hjî h²hubj2)�”}”(hX- a ``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry point - corresponding prototype in ``include/linux/compat.h`` - (if needed) 32-bit mapping struct in ``include/linux/compat.h`` - instance of ``__SC_COMP`` not ``__SYSCALL`` in ``include/uapi/asm-generic/unistd.h`` ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒCa ``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry point”h]”hÚ)�”}”(hjh]”(hŒa ”…”�”}”(hj!h²hh³Nh´Nubjd)�”}”(hŒ&``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)``”h]”hŒ"COMPAT_SYSCALL_DEFINEn(xyzzy, ...)”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj!ubhŒ for the compat entry point”…”�”}”(hj!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M‹hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjubj=)�”}”(hŒ5corresponding prototype in ``include/linux/compat.h``”h]”hÚ)�”}”(hjHh]”(hŒcorresponding prototype in ”…”�”}”(hjJh²hh³Nh´Nubjd)�”}”(hŒ``include/linux/compat.h``”h]”hŒinclude/linux/compat.h”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjJubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MŒhjFubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjubj=)�”}”(hŒ?(if needed) 32-bit mapping struct in ``include/linux/compat.h``”h]”hÚ)�”}”(hjmh]”(hŒ%(if needed) 32-bit mapping struct in ”…”�”}”(hjoh²hh³Nh´Nubjd)�”}”(hŒ``include/linux/compat.h``”h]”hŒinclude/linux/compat.h”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjoubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M�hjkubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjubj=)�”}”(hŒVinstance of ``__SC_COMP`` not ``__SYSCALL`` in ``include/uapi/asm-generic/unistd.h`` ”h]”hÚ)�”}”(hŒTinstance of ``__SC_COMP`` not ``__SYSCALL`` in ``include/uapi/asm-generic/unistd.h``”h]”(hŒ instance of ”…”�”}”(hj”h²hh³Nh´Nubjd)�”}”(hŒ ``__SC_COMP``”h]”hŒ __SC_COMP”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj”ubhŒ not ”…”�”}”(hj”h²hh³Nh´Nubjd)�”}”(hŒ ``__SYSCALL``”h]”hŒ __SYSCALL”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj”ubhŒ in ”…”�”}”(hj”h²hh³Nh´Nubjd)�”}”(hŒ%``include/uapi/asm-generic/unistd.h``”h]”hŒ!include/uapi/asm-generic/unistd.h”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj”ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MŽhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´M‹hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´M‹hjî h²hubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Since 6.11”h]”hŒ Since 6.11”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjæh²hh³hÃh´M“ubhÚ)�”}”(hŒãThis applies to all the architectures listed in :ref:`Since 6.11` under "Generic System Call Implementation", except arm64. See :ref:`Compatibility System Calls (arm64)` for more information.”h]”(hŒ0This applies to all the architectures listed in ”…”�”}”(hj÷h²hh³Nh´Nubh)�”}”(hŒ':ref:`Since 6.11`”h]”hè)�”}”(hjh]”hŒ Since 6.11”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(hóŒstd”Œstd-ref”eh"]”h$]”h&]”uh1hçhjÿubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jŒ refdomain”j Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒsyscall_generic_6_11”uh1hh³hÃh´M•hj÷ubhŒC under “Generic System Call Implementationâ€�, except arm64. See ”…”�”}”(hj÷h²hh³Nh´Nubh)�”}”(hŒ7:ref:`Compatibility System Calls (arm64)`”h]”hè)�”}”(hj%h]”hŒ"Compatibility System Calls (arm64)”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”(hóŒstd”Œstd-ref”eh"]”h$]”h&]”uh1hçhj#ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jŒ refdomain”j1Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆjŒ compat_arm64”uh1hh³hÃh´M•hj÷ubhŒ for more information.”…”�”}”(hj÷h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M•hjæh²hubhÚ)�”}”(hŒ·You need to extend the entry in ``scripts/syscall.tbl`` with an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point::”h]”(hŒ You need to extend the entry in ”…”�”}”(hjMh²hh³Nh´Nubjd)�”}”(hŒ``scripts/syscall.tbl``”h]”hŒscripts/syscall.tbl”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjMubhŒ with an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point:”…”�”}”(hjMh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M™hjæh²hubj)�”}”(hŒ8468 common xyzzy sys_xyzzy compat_sys_xyzzy”h]”hŒ8468 common xyzzy sys_xyzzy compat_sys_xyzzy”…”�”}”hjmsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M�hjæh²hubhÚ)�”}”(hŒTo summarize, you need:”h]”hŒTo summarize, you need:”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MŸhjæh²hubj2)�”}”(hX- ``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry point - corresponding prototype in ``include/linux/compat.h`` - modification of the entry in ``scripts/syscall.tbl`` to include an extra "compat" column - (if needed) 32-bit mapping struct in ``include/linux/compat.h`` ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒA``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)`` for the compat entry point”h]”hÚ)�”}”(hj’h]”(jd)�”}”(hŒ&``COMPAT_SYSCALL_DEFINEn(xyzzy, ...)``”h]”hŒ"COMPAT_SYSCALL_DEFINEn(xyzzy, ...)”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj”ubhŒ for the compat entry point”…”�”}”(hj”h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M¡hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj�ubj=)�”}”(hŒ5corresponding prototype in ``include/linux/compat.h``”h]”hÚ)�”}”(hj·h]”(hŒcorresponding prototype in ”…”�”}”(hj¹h²hh³Nh´Nubjd)�”}”(hŒ``include/linux/compat.h``”h]”hŒinclude/linux/compat.h”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¹ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M¢hjµubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj�ubj=)�”}”(hŒXmodification of the entry in ``scripts/syscall.tbl`` to include an extra "compat" column”h]”hÚ)�”}”(hŒXmodification of the entry in ``scripts/syscall.tbl`` to include an extra "compat" column”h]”(hŒmodification of the entry in ”…”�”}”(hjÞh²hh³Nh´Nubjd)�”}”(hŒ``scripts/syscall.tbl``”h]”hŒscripts/syscall.tbl”…”�”}”(hjæh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÞubhŒ( to include an extra “compatâ€� column”…”�”}”(hjÞh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M£hjÚubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj�ubj=)�”}”(hŒA(if needed) 32-bit mapping struct in ``include/linux/compat.h`` ”h]”hÚ)�”}”(hŒ?(if needed) 32-bit mapping struct in ``include/linux/compat.h``”h]”(hŒ%(if needed) 32-bit mapping struct in ”…”�”}”(hjh²hh³Nh´Nubjd)�”}”(hŒ``include/linux/compat.h``”h]”hŒinclude/linux/compat.h”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M¥hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj�ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´M¡hj‰ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´M¡hjæh²hubh¶)�”}”(hŒ.. _compat_arm64:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÁŒ compat-arm64”uh1hµh´M¨hjæh²hh³hÃubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ"Compatibility System Calls (arm64)”h]”hŒ"Compatibility System Calls (arm64)”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjAh²hh³hÃh´M«ubhÚ)�”}”(hŒëOn arm64, there is a dedicated syscall table for compatibility system calls targeting 32-bit (AArch32) userspace: ``arch/arm64/tools/syscall_32.tbl``. You need to add an additional line to this table specifying the compat entry point::”h]”(hŒrOn arm64, there is a dedicated syscall table for compatibility system calls targeting 32-bit (AArch32) userspace: ”…”�”}”(hjRh²hh³Nh´Nubjd)�”}”(hŒ#``arch/arm64/tools/syscall_32.tbl``”h]”hŒarch/arm64/tools/syscall_32.tbl”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjRubhŒU. You need to add an additional line to this table specifying the compat entry point:”…”�”}”(hjRh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M­hjAh²hubj)�”}”(hŒ8468 common xyzzy sys_xyzzy compat_sys_xyzzy”h]”hŒ8468 common xyzzy sys_xyzzy compat_sys_xyzzy”…”�”}”hjrsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M²hjAh²hubeh}”(h]”(Œ compatibility-system-calls-arm64”j@eh ]”h"]”(Œ"compatibility system calls (arm64)”Œ compat_arm64”eh$]”h&]”uh1hÄhjæh²hh³hÃh´M«jq }”j†j6sjs }”j@j6subeh}”(h]”Œid1”ah ]”h"]”h$]”jn ah&]”uh1hÄhjî h²hh³hÃh´M“jp Kubeh}”(h]”Œ"compatibility-system-calls-generic”ah ]”h"]”Œ$compatibility system calls (generic)”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M<ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Compatibility System Calls (x86)”h]”hŒ Compatibility System Calls (x86)”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjšh²hh³hÃh´M¶ubhÚ)�”}”(hŒ…To wire up the x86 architecture of a system call with a compatibility version, the entries in the syscall tables need to be adjusted.”h]”hŒ…To wire up the x86 architecture of a system call with a compatibility version, the entries in the syscall tables need to be adjusted.”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M¸hjšh²hubhÚ)�”}”(hŒ¾First, the entry in ``arch/x86/entry/syscalls/syscall_32.tbl`` gets an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point::”h]”(hŒFirst, the entry in ”…”�”}”(hj¹h²hh³Nh´Nubjd)�”}”(hŒ*``arch/x86/entry/syscalls/syscall_32.tbl``”h]”hŒ&arch/x86/entry/syscalls/syscall_32.tbl”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj¹ubhŒ gets an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point:”…”�”}”(hj¹h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M»hjšh²hubj)�”}”(hŒ=380 i386 xyzzy sys_xyzzy __ia32_compat_sys_xyzzy”h]”hŒ=380 i386 xyzzy sys_xyzzy __ia32_compat_sys_xyzzy”…”�”}”hjÙsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M¿hjšh²hubhÚ)�”}”(hŒÓSecond, you need to figure out what should happen for the x32 ABI version of the new system call. There's a choice here: the layout of the arguments should either match the 64-bit version or the 32-bit version.”h]”hŒÕSecond, you need to figure out what should happen for the x32 ABI version of the new system call. There’s a choice here: the layout of the arguments should either match the 64-bit version or the 32-bit version.”…”�”}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MÁhjšh²hubhÚ)�”}”(hŒøIf there's a pointer-to-a-pointer involved, the decision is easy: x32 is ILP32, so the layout should match the 32-bit version, and the entry in ``arch/x86/entry/syscalls/syscall_64.tbl`` is split so that x32 programs hit the compatibility wrapper::”h]”(hŒ’If there’s a pointer-to-a-pointer involved, the decision is easy: x32 is ILP32, so the layout should match the 32-bit version, and the entry in ”…”�”}”(hjõh²hh³Nh´Nubjd)�”}”(hŒ*``arch/x86/entry/syscalls/syscall_64.tbl``”h]”hŒ&arch/x86/entry/syscalls/syscall_64.tbl”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjõubhŒ= is split so that x32 programs hit the compatibility wrapper:”…”�”}”(hjõh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MÅhjšh²hubj)�”}”(hŒV333 64 xyzzy sys_xyzzy ... 555 x32 xyzzy __x32_compat_sys_xyzzy”h]”hŒV333 64 xyzzy sys_xyzzy ... 555 x32 xyzzy __x32_compat_sys_xyzzy”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´MÊhjšh²hubhÚ)�”}”(hŒ·If no pointers are involved, then it is preferable to reuse the 64-bit system call for the x32 ABI (and consequently the entry in arch/x86/entry/syscalls/syscall_64.tbl is unchanged).”h]”hŒ·If no pointers are involved, then it is preferable to reuse the 64-bit system call for the x32 ABI (and consequently the entry in arch/x86/entry/syscalls/syscall_64.tbl is unchanged).”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MÎhjšh²hubhÚ)�”}”(hŒ±In either case, you should check that the types involved in your argument layout do indeed map exactly from x32 (-mx32) to either the 32-bit (-m32) or 64-bit (-m64) equivalents.”h]”hŒ±In either case, you should check that the types involved in your argument layout do indeed map exactly from x32 (-mx32) to either the 32-bit (-m32) or 64-bit (-m64) equivalents.”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MÒhjšh²hubeh}”(h]”Œcompatibility-system-calls-x86”ah ]”h"]”Œ compatibility system calls (x86)”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M¶ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ System Calls Returning Elsewhere”h]”hŒ System Calls Returning Elsewhere”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjGh²hh³hÃh´MØubhÚ)�”}”(hXFor most system calls, once the system call is complete the user program continues exactly where it left off -- at the next instruction, with the stack the same and most of the registers the same as before the system call, and with the same virtual memory space.”h]”hXFor most system calls, once the system call is complete the user program continues exactly where it left off -- at the next instruction, with the stack the same and most of the registers the same as before the system call, and with the same virtual memory space.”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MÚhjGh²hubhÚ)�”}”(hŒéHowever, a few system calls do things differently. They might return to a different location (``rt_sigreturn``) or change the memory space (``fork``/``vfork``/``clone``) or even architecture (``execve``/``execveat``) of the program.”h]”(hŒ_However, a few system calls do things differently. They might return to a different location (”…”�”}”(hjfh²hh³Nh´Nubjd)�”}”(hŒ``rt_sigreturn``”h]”hŒ rt_sigreturn”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjfubhŒ) or change the memory space (”…”�”}”(hjfh²hh³Nh´Nubjd)�”}”(hŒ``fork``”h]”hŒfork”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjfubhŒ/”…”�”}”(hjfh²hh³Nh´Nubjd)�”}”(hŒ ``vfork``”h]”hŒvfork”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjfubhŒ/”…”�”}”hjfsbjd)�”}”(hŒ ``clone``”h]”hŒclone”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjfubhŒ) or even architecture (”…”�”}”(hjfh²hh³Nh´Nubjd)�”}”(hŒ ``execve``”h]”hŒexecve”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjfubhŒ/”…”�”}”hjfsbjd)�”}”(hŒ ``execveat``”h]”hŒexecveat”…”�”}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjfubhŒ) of the program.”…”�”}”(hjfh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MßhjGh²hubhÚ)�”}”(hŒÜTo allow for this, the kernel implementation of the system call may need to save and restore additional registers to the kernel stack, allowing complete control of where and how execution continues after the system call.”h]”hŒÜTo allow for this, the kernel implementation of the system call may need to save and restore additional registers to the kernel stack, allowing complete control of where and how execution continues after the system call.”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MähjGh²hubhÚ)�”}”(hŒ This is arch-specific, but typically involves defining assembly entry points that save/restore additional registers and invoke the real system call entry point.”h]”hŒ This is arch-specific, but typically involves defining assembly entry points that save/restore additional registers and invoke the real system call entry point.”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MèhjGh²hubhÚ)�”}”(hŒÈFor x86_64, this is implemented as a ``stub_xyzzy`` entry point in ``arch/x86/entry/entry_64.S``, and the entry in the syscall table (``arch/x86/entry/syscalls/syscall_64.tbl``) is adjusted to match::”h]”(hŒ%For x86_64, this is implemented as a ”…”�”}”(hjüh²hh³Nh´Nubjd)�”}”(hŒ``stub_xyzzy``”h]”hŒ stub_xyzzy”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjüubhŒ entry point in ”…”�”}”(hjüh²hh³Nh´Nubjd)�”}”(hŒ``arch/x86/entry/entry_64.S``”h]”hŒarch/x86/entry/entry_64.S”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjüubhŒ&, and the entry in the syscall table (”…”�”}”(hjüh²hh³Nh´Nubjd)�”}”(hŒ*``arch/x86/entry/syscalls/syscall_64.tbl``”h]”hŒ&arch/x86/entry/syscalls/syscall_64.tbl”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjüubhŒ) is adjusted to match:”…”�”}”(hjüh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MìhjGh²hubj)�”}”(hŒ#333 common xyzzy stub_xyzzy”h]”hŒ#333 common xyzzy stub_xyzzy”…”�”}”hj@sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´MðhjGh²hubhÚ)�”}”(hŒúThe equivalent for 32-bit programs running on a 64-bit kernel is normally called ``stub32_xyzzy`` and implemented in ``arch/x86/entry/entry_64_compat.S``, with the corresponding syscall table adjustment in ``arch/x86/entry/syscalls/syscall_32.tbl``::”h]”(hŒQThe equivalent for 32-bit programs running on a 64-bit kernel is normally called ”…”�”}”(hjNh²hh³Nh´Nubjd)�”}”(hŒ``stub32_xyzzy``”h]”hŒ stub32_xyzzy”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjNubhŒ and implemented in ”…”�”}”(hjNh²hh³Nh´Nubjd)�”}”(hŒ$``arch/x86/entry/entry_64_compat.S``”h]”hŒ arch/x86/entry/entry_64_compat.S”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjNubhŒ5, with the corresponding syscall table adjustment in ”…”�”}”(hjNh²hh³Nh´Nubjd)�”}”(hŒ*``arch/x86/entry/syscalls/syscall_32.tbl``”h]”hŒ&arch/x86/entry/syscalls/syscall_32.tbl”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjNubhŒ:”…”�”}”(hjNh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MòhjGh²hubj)�”}”(hŒ2380 i386 xyzzy sys_xyzzy stub32_xyzzy”h]”hŒ2380 i386 xyzzy sys_xyzzy stub32_xyzzy”…”�”}”hj’sbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´M÷hjGh²hubhÚ)�”}”(hXƒIf the system call needs a compatibility layer (as in the previous section) then the ``stub32_`` version needs to call on to the ``compat_sys_`` version of the system call rather than the native 64-bit version. Also, if the x32 ABI implementation is not common with the x86_64 version, then its syscall table will also need to invoke a stub that calls on to the ``compat_sys_`` version.”h]”(hŒUIf the system call needs a compatibility layer (as in the previous section) then the ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ ``stub32_``”h]”hŒstub32_”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒ! version needs to call on to the ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_``”h]”hŒ compat_sys_”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒÛ version of the system call rather than the native 64-bit version. Also, if the x32 ABI implementation is not common with the x86_64 version, then its syscall table will also need to invoke a stub that calls on to the ”…”�”}”(hj h²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_``”h]”hŒ compat_sys_”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj ubhŒ version.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MùhjGh²hubhÚ)�”}”(hXUFor completeness, it's also nice to set up a mapping so that user-mode Linux still works -- its syscall table will reference stub_xyzzy, but the UML build doesn't include ``arch/x86/entry/entry_64.S`` implementation (because UML simulates registers etc). Fixing this is as simple as adding a #define to ``arch/x86/um/sys_call_table_64.c``::”h]”(hŒ¯For completeness, it’s also nice to set up a mapping so that user-mode Linux still works -- its syscall table will reference stub_xyzzy, but the UML build doesn’t include ”…”�”}”(hjäh²hh³Nh´Nubjd)�”}”(hŒ``arch/x86/entry/entry_64.S``”h]”hŒarch/x86/entry/entry_64.S”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjäubhŒh implementation (because UML simulates registers etc). Fixing this is as simple as adding a #define to ”…”�”}”(hjäh²hh³Nh´Nubjd)�”}”(hŒ#``arch/x86/um/sys_call_table_64.c``”h]”hŒarch/x86/um/sys_call_table_64.c”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjäubhŒ:”…”�”}”(hjäh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MhjGh²hubj)�”}”(hŒ#define stub_xyzzy sys_xyzzy”h]”hŒ#define stub_xyzzy sys_xyzzy”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jÃjÄuh1jh³hÃh´MhjGh²hubeh}”(h]”Œ system-calls-returning-elsewhere”ah ]”h"]”Œ system calls returning elsewhere”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´MØubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Other Details”h]”hŒ Other Details”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj,h²hh³hÃh´M ubhÚ)�”}”(hŒ–Most of the kernel treats system calls in a generic way, but there is the occasional exception that may need updating for your particular system call.”h]”hŒ–Most of the kernel treats system calls in a generic way, but there is the occasional exception that may need updating for your particular system call.”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M hj,h²hubhÚ)�”}”(hXqThe audit subsystem is one such special case; it includes (arch-specific) functions that classify some special types of system call -- specifically file open (``open``/``openat``), program execution (``execve``/``exeveat``) or socket multiplexor (``socketcall``) operations. If your new system call is analogous to one of these, then the audit system should be updated.”h]”(hŒŸThe audit subsystem is one such special case; it includes (arch-specific) functions that classify some special types of system call -- specifically file open (”…”�”}”(hjKh²hh³Nh´Nubjd)�”}”(hŒ``open``”h]”hŒopen”…”�”}”(hjSh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjKubhŒ/”…”�”}”(hjKh²hh³Nh´Nubjd)�”}”(hŒ ``openat``”h]”hŒopenat”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjKubhŒ), program execution (”…”�”}”(hjKh²hh³Nh´Nubjd)�”}”(hŒ ``execve``”h]”hŒexecve”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjKubhŒ/”…”�”}”hjKsbjd)�”}”(hŒ ``exeveat``”h]”hŒexeveat”…”�”}”(hj‰h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjKubhŒ) or socket multiplexor (”…”�”}”(hjKh²hh³Nh´Nubjd)�”}”(hŒ``socketcall``”h]”hŒ socketcall”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjKubhŒl) operations. If your new system call is analogous to one of these, then the audit system should be updated.”…”�”}”(hjKh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhj,h²hubhÚ)�”}”(hŒÊMore generally, if there is an existing system call that is analogous to your new system call, it's worth doing a kernel-wide grep for the existing system call to check there are no other special cases.”h]”hŒÌMore generally, if there is an existing system call that is analogous to your new system call, it’s worth doing a kernel-wide grep for the existing system call to check there are no other special cases.”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhj,h²hubeh}”(h]”Œ other-details”ah ]”h"]”Œ other details”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒTesting”h]”hŒTesting”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjÉh²hh³hÃh´MubhÚ)�”}”(hX A new system call should obviously be tested; it is also useful to provide reviewers with a demonstration of how user space programs will use the system call. A good way to combine these aims is to include a simple self-test program in a new directory under ``tools/testing/selftests/``.”h]”(hXA new system call should obviously be tested; it is also useful to provide reviewers with a demonstration of how user space programs will use the system call. A good way to combine these aims is to include a simple self-test program in a new directory under ”…”�”}”(hjÚh²hh³Nh´Nubjd)�”}”(hŒ``tools/testing/selftests/``”h]”hŒtools/testing/selftests/”…”�”}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjÚubhŒ.”…”�”}”(hjÚh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MhjÉh²hubhÚ)�”}”(hXFor a new system call, there will obviously be no libc wrapper function and so the test will need to invoke it using ``syscall()``; also, if the system call involves a new userspace-visible structure, the corresponding header will need to be installed to compile the test.”h]”(hŒuFor a new system call, there will obviously be no libc wrapper function and so the test will need to invoke it using ”…”�”}”(hjúh²hh³Nh´Nubjd)�”}”(hŒ ``syscall()``”h]”hŒ syscall()”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjúubhŒŽ; also, if the system call involves a new userspace-visible structure, the corresponding header will need to be installed to compile the test.”…”�”}”(hjúh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M"hjÉh²hubhÚ)�”}”(hŒ¸Make sure the selftest runs successfully on all supported architectures. For example, check that it works when compiled as an x86_64 (-m64), x86_32 (-m32) and x32 (-mx32) ABI program.”h]”hŒ¸Make sure the selftest runs successfully on all supported architectures. For example, check that it works when compiled as an x86_64 (-m64), x86_32 (-m32) and x32 (-mx32) ABI program.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M'hjÉh²hubhÚ)�”}”(hŒ¹For more extensive and thorough testing of new functionality, you should also consider adding tests to the Linux Test Project, or to the xfstests project for filesystem-related changes.”h]”hŒ¹For more extensive and thorough testing of new functionality, you should also consider adding tests to the Linux Test Project, or to the xfstests project for filesystem-related changes.”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M+hjÉh²hubj2)�”}”(hŒ`- https://linux-test-project.github.io/ - git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒ%https://linux-test-project.github.io/”h]”hÚ)�”}”(hj?h]”jÐ)�”}”(hj?h]”hŒ%https://linux-test-project.github.io/”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j?uh1jÏhjAubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M/hj=ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj:ubj=)�”}”(hŒ6git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git ”h]”hÚ)�”}”(hŒ4git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git”h]”hŒ4git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M0hj^ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj:ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´M/hj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´M/hjÉh²hubeh}”(h]”Œtesting”ah ]”h"]”Œtesting”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´MubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒMan Page”h]”hŒMan Page”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjŠh²hh³hÃh´M4ubhÚ)�”}”(hX All new system calls should come with a complete man page, ideally using groff markup, but plain text will do. If groff is used, it's helpful to include a pre-rendered ASCII version of the man page in the cover email for the patchset, for the convenience of reviewers.”h]”hXAll new system calls should come with a complete man page, ideally using groff markup, but plain text will do. If groff is used, it’s helpful to include a pre-rendered ASCII version of the man page in the cover email for the patchset, for the convenience of reviewers.”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M6hjŠh²hubhÚ)�”}”(hŒ�The man page should be cc'ed to linux-man@vger.kernel.org For more details, see https://www.kernel.org/doc/man-pages/patches.html”h]”(hŒ"The man page should be cc’ed to ”…”�”}”(hj©h²hh³Nh´NubjÐ)�”}”(hŒlinux-man@vger.kernel.org”h]”hŒlinux-man@vger.kernel.org”…”�”}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ mailto:linux-man@vger.kernel.org”uh1jÏhj©ubhŒ For more details, see ”…”�”}”(hj©h²hh³Nh´NubjÐ)�”}”(hŒ1https://www.kernel.org/doc/man-pages/patches.html”h]”hŒ1https://www.kernel.org/doc/man-pages/patches.html”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jÇuh1jÏhj©ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M;hjŠh²hubeh}”(h]”Œman-page”ah ]”h"]”Œman page”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M4ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ&Do not call System Calls in the Kernel”h]”hŒ&Do not call System Calls in the Kernel”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjâh²hh³hÃh´M@ubhÚ)�”}”(hXËSystem calls are, as stated above, interaction points between userspace and the kernel. Therefore, system call functions such as ``sys_xyzzy()`` or ``compat_sys_xyzzy()`` should only be called from userspace via the syscall table, but not from elsewhere in the kernel. If the syscall functionality is useful to be used within the kernel, needs to be shared between an old and a new syscall, or needs to be shared between a syscall and its compatibility variant, it should be implemented by means of a "helper" function (such as ``ksys_xyzzy()``). This kernel function may then be called within the syscall stub (``sys_xyzzy()``), the compatibility syscall stub (``compat_sys_xyzzy()``), and/or other kernel code.”h]”(hŒ‚System calls are, as stated above, interaction points between userspace and the kernel. Therefore, system call functions such as ”…”�”}”(hjóh²hh³Nh´Nubjd)�”}”(hŒ``sys_xyzzy()``”h]”hŒ sys_xyzzy()”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjóubhŒ or ”…”�”}”(hjóh²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_xyzzy()``”h]”hŒcompat_sys_xyzzy()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjóubhXk should only be called from userspace via the syscall table, but not from elsewhere in the kernel. If the syscall functionality is useful to be used within the kernel, needs to be shared between an old and a new syscall, or needs to be shared between a syscall and its compatibility variant, it should be implemented by means of a “helperâ€� function (such as ”…”�”}”(hjóh²hh³Nh´Nubjd)�”}”(hŒ``ksys_xyzzy()``”h]”hŒ ksys_xyzzy()”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjóubhŒE). This kernel function may then be called within the syscall stub (”…”�”}”(hjóh²hh³Nh´Nubjd)�”}”(hŒ``sys_xyzzy()``”h]”hŒ sys_xyzzy()”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjóubhŒ#), the compatibility syscall stub (”…”�”}”(hjóh²hh³Nh´Nubjd)�”}”(hŒ``compat_sys_xyzzy()``”h]”hŒcompat_sys_xyzzy()”…”�”}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjóubhŒ), and/or other kernel code.”…”�”}”(hjóh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MBhjâh²hubhÚ)�”}”(hX=At least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not call system call functions in the kernel. It uses a different calling convention for system calls where ``struct pt_regs`` is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain).”h]”(hŒ¹At least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not call system call functions in the kernel. It uses a different calling convention for system calls where ”…”�”}”(hj[h²hh³Nh´Nubjd)�”}”(hŒ``struct pt_regs``”h]”hŒstruct pt_regs”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj[ubhXr is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain).”…”�”}”(hj[h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MMhjâh²hubhÚ)�”}”(hŒ¦Moreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling ``sys_xyzzy()`` is generally a bad idea.”h]”(hŒ~Moreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling ”…”�”}”(hj{h²hh³Nh´Nubjd)�”}”(hŒ``sys_xyzzy()``”h]”hŒ sys_xyzzy()”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchj{ubhŒ is generally a bad idea.”…”�”}”(hj{h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MVhjâh²hubhÚ)�”}”(hŒ’Exceptions to this rule are only allowed in architecture-specific overrides, architecture-specific compatibility wrappers, or other code in arch/.”h]”hŒ’Exceptions to this rule are only allowed in architecture-specific overrides, architecture-specific compatibility wrappers, or other code in arch/.”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MZhjâh²hubeh}”(h]”Œ&do-not-call-system-calls-in-the-kernel”ah ]”h"]”Œ&do not call system calls in the kernel”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M@ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒReferences and Sources”h]”hŒReferences and Sources”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj±h²hh³hÃh´M_ubj2)�”}”(hX¡ - LWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/ - LWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/ - LWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/ - Pair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14: - https://lwn.net/Articles/604287/ - https://lwn.net/Articles/604515/ - Architecture-specific requirements for system calls are discussed in the :manpage:`syscall(2)` man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES - Collated emails from Linus Torvalds discussing the problems with ``ioctl()``: https://yarchive.net/comp/linux/ioctl.html - "How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf - LWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/ - Recommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org - Recommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com - Suggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos - Suggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.com - Discussion from Michael Kerrisk of new system call vs. :manpage:`prctl(2)` extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com - Suggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.com - Numbering oddities arising from (re-)use of O_* numbering space flags: - commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check") - commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict") - commit bb458c644a59 ("Safer ABI for O_TMPFILE") - Discussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org - Recommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.com - Recommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com - Patch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org”h]”j8)�”}”(hhh]”(j=)�”}”(hŒkLWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/”h]”hÚ)�”}”(hŒkLWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/”h]”(hŒKLWN article from Michael Kerrisk on use of flags argument in system calls: ”…”�”}”(hjÍh²hh³Nh´NubjÐ)�”}”(hŒ https://lwn.net/Articles/585415/”h]”hŒ https://lwn.net/Articles/585415/”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j×uh1jÏhjÍubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MahjÉubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒrLWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/”h]”hÚ)�”}”(hŒrLWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/”h]”(hŒRLWN article from Michael Kerrisk on how to handle unknown flags in a system call: ”…”�”}”(hjôh²hh³Nh´NubjÐ)�”}”(hŒ https://lwn.net/Articles/588444/”h]”hŒ https://lwn.net/Articles/588444/”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jþuh1jÏhjôubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mchjðubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒsLWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/”h]”hÚ)�”}”(hŒsLWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/”h]”(hŒSLWN article from Jake Edge describing constraints on 64-bit system call arguments: ”…”�”}”(hjh²hh³Nh´NubjÐ)�”}”(hŒ https://lwn.net/Articles/311630/”h]”hŒ https://lwn.net/Articles/311630/”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j%uh1jÏhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mehjubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒºPair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14: - https://lwn.net/Articles/604287/ - https://lwn.net/Articles/604515/ ”h]”(hÚ)�”}”(hŒpPair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14:”h]”hŒpPair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14:”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mghj>ubj2)�”}”(hŒF- https://lwn.net/Articles/604287/ - https://lwn.net/Articles/604515/ ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒ https://lwn.net/Articles/604287/”h]”hÚ)�”}”(hjYh]”jÐ)�”}”(hjYh]”hŒ https://lwn.net/Articles/604287/”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jYuh1jÏhj[ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MjhjWubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjTubj=)�”}”(hŒ!https://lwn.net/Articles/604515/ ”h]”hÚ)�”}”(hŒ https://lwn.net/Articles/604515/”h]”jÐ)�”}”(hj~h]”hŒ https://lwn.net/Articles/604515/”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j~uh1jÏhj|ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mkhjxubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjTubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´MjhjPubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Mjhj>ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ¢Architecture-specific requirements for system calls are discussed in the :manpage:`syscall(2)` man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES”h]”hÚ)�”}”(hŒ¢Architecture-specific requirements for system calls are discussed in the :manpage:`syscall(2)` man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES”h]”(hŒIArchitecture-specific requirements for system calls are discussed in the ”…”�”}”(hj°h²hh³Nh´Nubj´)�”}”(hŒ:manpage:`syscall(2)`”h]”hŒ syscall(2)”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒ syscall(2)”jÇŒsyscall”jÉjÊuh1j³hj°ubhŒ man-page: ”…”�”}”(hj°h²hh³Nh´NubjÐ)�”}”(hŒ9http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES”h]”hŒ9http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jÎuh1jÏhj°ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mmhj¬ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒxCollated emails from Linus Torvalds discussing the problems with ``ioctl()``: https://yarchive.net/comp/linux/ioctl.html”h]”hÚ)�”}”(hŒxCollated emails from Linus Torvalds discussing the problems with ``ioctl()``: https://yarchive.net/comp/linux/ioctl.html”h]”(hŒACollated emails from Linus Torvalds discussing the problems with ”…”�”}”(hjëh²hh³Nh´Nubjd)�”}”(hŒ ``ioctl()``”h]”hŒioctl()”…”�”}”(hjóh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jchjëubhŒ: ”…”�”}”(hjëh²hh³Nh´NubjÐ)�”}”(hŒ*https://yarchive.net/comp/linux/ioctl.html”h]”hŒ*https://yarchive.net/comp/linux/ioctl.html”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jÏhjëubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mphjçubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒu"How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf”h]”hÚ)�”}”(hŒu"How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf”h]”(hŒ:“How to not invent kernel interfacesâ€�, Arnd Bergmann, ”…”�”}”(hj$h²hh³Nh´NubjÐ)�”}”(hŒ?https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf”h]”hŒ?https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j.uh1jÏhj$ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mrhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒhLWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/”h]”hÚ)�”}”(hŒhLWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/”h]”(hŒHLWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: ”…”�”}”(hjKh²hh³Nh´NubjÐ)�”}”(hŒ https://lwn.net/Articles/486306/”h]”hŒ https://lwn.net/Articles/486306/”…”�”}”(hjSh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jUuh1jÏhjKubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MthjGubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒÑRecommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org”h]”hÚ)�”}”(hŒÑRecommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org”h]”(hŒ{Recommendation from Andrew Morton that all related information for a new system call should come in the same email thread: ”…”�”}”(hjrh²hh³Nh´NubjÐ)�”}”(hŒVhttps://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org”h]”hŒVhttps://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j|uh1jÏhjrubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mvhjnubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ´Recommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com”h]”hÚ)�”}”(hŒ´Recommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com”h]”(hŒXRecommendation from Michael Kerrisk that a new system call should come with a man page: ”…”�”}”(hj™h²hh³Nh´NubjÐ)�”}”(hŒ\https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com”h]”hŒ\https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j£uh1jÏhj™ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Myhj•ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ“Suggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos”h]”hÚ)�”}”(hŒ“Suggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos”h]”(hŒQSuggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: ”…”�”}”(hjÀh²hh³Nh´NubjÐ)�”}”(hŒBhttps://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos”h]”hŒBhttps://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos”…”�”}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jÊuh1jÏhjÀubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M{hj¼ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ¥Suggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.com”h]”hÚ)�”}”(hŒ¥Suggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.com”h]”(hŒmSuggestion from Greg Kroah-Hartman that it’s good for new system calls to come with a man-page & selftest: ”…”�”}”(hjçh²hh³Nh´NubjÐ)�”}”(hŒ:https://lore.kernel.org/r/20140320025530.GA25469@kroah.com”h]”hŒ:https://lore.kernel.org/r/20140320025530.GA25469@kroah.com”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jñuh1jÏhjçubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M}hjãubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ²Discussion from Michael Kerrisk of new system call vs. :manpage:`prctl(2)` extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com”h]”hÚ)�”}”(hŒ²Discussion from Michael Kerrisk of new system call vs. :manpage:`prctl(2)` extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com”h]”(hŒ7Discussion from Michael Kerrisk of new system call vs. ”…”�”}”(hjh²hh³Nh´Nubj´)�”}”(hŒ:manpage:`prctl(2)`”h]”hŒprctl(2)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”j³ah"]”h$]”h&]”jÃjÄjÅŒprctl(2)”jÇŒprctl”jÉjÊuh1j³hjubhŒ extension: ”…”�”}”(hjh²hh³Nh´NubjÐ)�”}”(hŒ\https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com”h]”hŒ\https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.com”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j,uh1jÏhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒîSuggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.com”h]”hÚ)�”}”(hŒîSuggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.com”h]”(hŒ´Suggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: ”…”�”}”(hjIh²hh³Nh´NubjÐ)�”}”(hŒ:https://lore.kernel.org/r/20150730083831.GA22182@gmail.com”h]”hŒ:https://lore.kernel.org/r/20150730083831.GA22182@gmail.com”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jSuh1jÏhjIubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M�hjEubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hX(Numbering oddities arising from (re-)use of O_* numbering space flags: - commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check") - commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict") - commit bb458c644a59 ("Safer ABI for O_TMPFILE") ”h]”(hÚ)�”}”(hŒFNumbering oddities arising from (re-)use of O_* numbering space flags:”h]”hŒFNumbering oddities arising from (re-)use of O_* numbering space flags:”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M„hjlubj2)�”}”(hŒÛ- commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check") - commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict") - commit bb458c644a59 ("Safer ABI for O_TMPFILE") ”h]”j8)�”}”(hhh]”(j=)�”}”(hŒPcommit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check")”h]”hÚ)�”}”(hŒPcommit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check")”h]”hŒTcommit 75069f2b5bfb (“vfs: renumber FMODE_NONOTIFY and add to uniqueness checkâ€�)”…”�”}”(hj‰h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M†hj…ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj‚ubj=)�”}”(hŒOcommit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict")”h]”hÚ)�”}”(hŒOcommit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict")”h]”hŒScommit 12ed2e36c98a (“fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflictâ€�)”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´Mˆhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj‚ubj=)�”}”(hŒ0commit bb458c644a59 ("Safer ABI for O_TMPFILE") ”h]”hÚ)�”}”(hŒ/commit bb458c644a59 ("Safer ABI for O_TMPFILE")”h]”hŒ3commit bb458c644a59 (“Safer ABI for O_TMPFILEâ€�)”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MŠhjµubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj‚ubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´M†hj~ubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´M†hjlubeh}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒˆDiscussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org”h]”hÚ)�”}”(hŒˆDiscussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org”h]”(hŒGDiscussion from Matthew Wilcox about restrictions on 64-bit arguments: ”…”�”}”(hjãh²hh³Nh´NubjÐ)�”}”(hŒAhttps://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org”h]”hŒAhttps://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jíuh1jÏhjãubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MŒhjßubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ†Recommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.com”h]”hÚ)�”}”(hŒ†Recommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.com”h]”(hŒMRecommendation from Greg Kroah-Hartman that unknown flags should be policed: ”…”�”}”(hj h²hh³Nh´NubjÐ)�”}”(hŒ9https://lore.kernel.org/r/20140717193330.GB4703@kroah.com”h]”hŒ9https://lore.kernel.org/r/20140717193330.GB4703@kroah.com”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jÏhj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´MŽhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒãRecommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com”h]”hÚ)�”}”(hŒãRecommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com”h]”(hŒ‡Recommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: ”…”�”}”(hj1h²hh³Nh´NubjÐ)�”}”(hŒ\https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com”h]”hŒ\https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com”…”�”}”(hj9h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j;uh1jÏhj1ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M�hj-ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubj=)�”}”(hŒ¶Patch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org”h]”hÚ)�”}”(hŒ¶Patch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org”h]”(hŒqPatch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: ”…”�”}”(hjXh²hh³Nh´NubjÐ)�”}”(hŒEhttps://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org”h]”hŒEhttps://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jbuh1jÏhjXubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÙh³hÃh´M“hjTubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hjÆubeh}”(h]”h ]”h"]”h$]”h&]”j j uh1j7h³hÃh´MahjÂubah}”(h]”h ]”h"]”h$]”h&]”uh1j1h³hÃh´Mahj±h²hubeh}”(h]”Œreferences-and-sources”ah ]”h"]”Œreferences and sources”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M_ubeh}”(h]”(Œadding-a-new-system-call”hÂeh ]”h"]”(Œadding a new system call”Œ addsyscalls”eh$]”h&]”uh1hÄhhh²hh³hÃh´Kjq }”j•h·s•Î js }”hÂh·subeh}”(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”}”(hÂ]”h·aj› ]”j‘ aj@]”j6auŒnameids”}”(j•hÂj”j‘j jjjj jjðjíjz jw jl j› Œ since 6.11”Një jè j—j”j†j@j…j‚jDjAj)j&jÆjÃj‡j„jßjÜj®j«jŒj‰uŒ nametypes”}”(j•ˆj”‰j ‰j‰j ‰jð‰jz ‰jl ˆj‰jë ‰j—‰j†ˆj…‰jD‰j)‰jƉj‡‰j߉j®‰jŒ‰uh}”(hÂhÆj‘hÆjjjj jjjíj#jw jój› jœ ji jœ jè j} j”jî j�jæj@jAj‚jAjAjšj&jGjÃj,j„jÉjÜjŠj«jâj‰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”“”}”jËKs…”R”Œparse_messages”]”hŒsystem_message”“”)�”}”(hhh]”hÚ)�”}”(hŒ-Duplicate implicit target name: "since 6.11".”h]”hŒ1Duplicate implicit target name: “since 6.11â€�.”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhj%ubah}”(h]”h ]”h"]”h$]”h&]”j�aŒlevel”KŒtype”ŒINFO”Œsource”hÃŒline”M“uh1j#hjæh²hh³hÃh´M“ubaŒtransform_messages”]”(j$)�”}”(hhh]”hÚ)�”}”(hhh]”hŒ1Hyperlink target "addsyscalls" is not referenced.”…”�”}”hjFsbah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhjCubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j>Œsource”hÃŒline”Kuh1j#ubj$)�”}”(hhh]”hÚ)�”}”(hhh]”hŒ:Hyperlink target "syscall-generic-6-11" is not referenced.”…”�”}”hj`sbah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhj]ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j>Œsource”hÃŒline”Kûuh1j#ubj$)�”}”(hhh]”hÚ)�”}”(hhh]”hŒ2Hyperlink target "compat-arm64" is not referenced.”…”�”}”hjzsbah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhjwubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”j>Œsource”hÃŒline”M¨uh1j#ubeŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.