adding-syscalls.rst (597473720f4dc69749542bfcfed4a927a43d935e) | adding-syscalls.rst (0c1bc6b84525b96aa9fb8f6fbe8c5cb26a5c0ead) |
---|---|
1 2.. _addsyscalls: 3 4Adding a New System Call 5======================== 6 7This document describes what's involved in adding a new system call to the 8Linux kernel, over and above the normal submission advice in --- 19 unchanged lines hidden (view full) --- 28 descriptor for the relevant object allows userspace to use 29 ``poll``/``select``/``epoll`` to receive that notification. 30 - However, operations that don't map to 31 :manpage:`read(2)`/:manpage:`write(2)`-like operations 32 have to be implemented as :manpage:`ioctl(2)` requests, which can lead 33 to a somewhat opaque API. 34 35 - If you're just exposing runtime system information, a new node in sysfs | 1 2.. _addsyscalls: 3 4Adding a New System Call 5======================== 6 7This document describes what's involved in adding a new system call to the 8Linux kernel, over and above the normal submission advice in --- 19 unchanged lines hidden (view full) --- 28 descriptor for the relevant object allows userspace to use 29 ``poll``/``select``/``epoll`` to receive that notification. 30 - However, operations that don't map to 31 :manpage:`read(2)`/:manpage:`write(2)`-like operations 32 have to be implemented as :manpage:`ioctl(2)` requests, which can lead 33 to a somewhat opaque API. 34 35 - If you're just exposing runtime system information, a new node in sysfs |
36 (see ``Documentation/filesystems/sysfs.txt``) or the ``/proc`` filesystem may | 36 (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may |
37 be more appropriate. However, access to these mechanisms requires that the 38 relevant filesystem is mounted, which might not always be the case (e.g. 39 in a namespaced/sandboxed/chrooted environment). Avoid adding any API to 40 debugfs, as this is not considered a 'production' interface to userspace. 41 - If the operation is specific to a particular file or file descriptor, then 42 an additional :manpage:`fcntl(2)` command option may be more appropriate. However, 43 :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so 44 this option is best for when the new function is closely analogous to --- 533 unchanged lines hidden --- | 37 be more appropriate. However, access to these mechanisms requires that the 38 relevant filesystem is mounted, which might not always be the case (e.g. 39 in a namespaced/sandboxed/chrooted environment). Avoid adding any API to 40 debugfs, as this is not considered a 'production' interface to userspace. 41 - If the operation is specific to a particular file or file descriptor, then 42 an additional :manpage:`fcntl(2)` command option may be more appropriate. However, 43 :manpage:`fcntl(2)` is a multiplexing system call that hides a lot of complexity, so 44 this option is best for when the new function is closely analogous to --- 533 unchanged lines hidden --- |