| .. | .. |
|---|
| 1 | + |
|---|
| 2 | +.. _addsyscalls: |
|---|
| 3 | + |
|---|
| 1 | 4 | Adding a New System Call |
|---|
| 2 | 5 | ======================== |
|---|
| 3 | 6 | |
|---|
| .. | .. |
|---|
| 30 | 33 | to a somewhat opaque API. |
|---|
| 31 | 34 | |
|---|
| 32 | 35 | - If you're just exposing runtime system information, a new node in sysfs |
|---|
| 33 | | - (see ``Documentation/filesystems/sysfs.txt``) or the ``/proc`` filesystem may |
|---|
| 36 | + (see ``Documentation/filesystems/sysfs.rst``) or the ``/proc`` filesystem may |
|---|
| 34 | 37 | be more appropriate. However, access to these mechanisms requires that the |
|---|
| 35 | 38 | relevant filesystem is mounted, which might not always be the case (e.g. |
|---|
| 36 | 39 | in a namespaced/sandboxed/chrooted environment). Avoid adding any API to |
|---|
| .. | .. |
|---|
| 232 | 235 | by the option. |
|---|
| 233 | 236 | - Make the option depend on EXPERT if it should be hidden from normal users. |
|---|
| 234 | 237 | - Make any new source files implementing the function dependent on the CONFIG |
|---|
| 235 | | - option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.c``). |
|---|
| 238 | + option in the Makefile (e.g. ``obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o``). |
|---|
| 236 | 239 | - Double check that the kernel still builds with the new CONFIG option turned |
|---|
| 237 | 240 | off. |
|---|
| 238 | 241 | |
|---|
| .. | .. |
|---|
| 538 | 541 | :manpage:`syscall(2)` man-page: |
|---|
| 539 | 542 | http://man7.org/linux/man-pages/man2/syscall.2.html#NOTES |
|---|
| 540 | 543 | - Collated emails from Linus Torvalds discussing the problems with ``ioctl()``: |
|---|
| 541 | | - http://yarchive.net/comp/linux/ioctl.html |
|---|
| 544 | + https://yarchive.net/comp/linux/ioctl.html |
|---|
| 542 | 545 | - "How to not invent kernel interfaces", Arnd Bergmann, |
|---|
| 543 | | - http://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf |
|---|
| 546 | + https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf |
|---|
| 544 | 547 | - LWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: |
|---|
| 545 | 548 | https://lwn.net/Articles/486306/ |
|---|
| 546 | 549 | - Recommendation from Andrew Morton that all related information for a new |
|---|