summaryrefslogtreecommitdiff
path: root/src/basic/missing_syscall.h
Commit message (Collapse)AuthorAge
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-08-24
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: remove some double newlines in headers, tooLennart Poettering2018-08-24
|
* add __nr_statx defines for extra architectures (#8872)Adam Duskett2018-08-24
| | | | | | | | | | | This includes: - arm - arm64 - alpha - powerpc64 - sparc Taken from kernel 4.16.6
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* add __nr_statx defines for extra architectures (#8872)Adam Duskett2018-06-28
| | | | | | | | | | | | | This includes: - arm - arm64 - alpha - powerpc64 - sparc Taken from kernel 4.16.6 (cherry picked from commit 773c84349d80c7a6f818f5909a160ddb7337987f)
* missing_syscall: add pkey_mprotect for ppc (#8292)Zbigniew Jędrzejewski-Szmek2018-05-30
| | | | Accurate for both ppc and ppc64 according to https://fedora.juszkiewicz.com.pl/syscalls.html.
* missing: always use __NR_ as prefix for syscall numbersLennart Poettering2018-05-30
| | | | | | Apparently, both __NR_ and SYS_ are useful, but we mostly use __NR_ hence use it for these two cases too, so that we settle on __NR_ exclusively.
* missing: Fix statx syscall ifdefferyLennart Poettering2018-05-30
| | | | | | Fix a copy/paste mistake. Fixes: #8238
* missing_syscall: when adding syscall replacements, use different names (#8229)Zbigniew Jędrzejewski-Szmek2018-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In meson.build we check that functions are available using: meson.get_compiler('c').has_function('foo') which checks the following: - if __stub_foo or __stub___foo are defined, return false - if foo is declared (a pointer to the function can be taken), return true - otherwise check for __builtin_memfd_create _stub is documented by glibc as It defines a symbol '__stub_FUNCTION' for each function in the C library which is a stub, meaning it will fail every time called, usually setting errno to ENOSYS. So if __stub is defined, we know we don't want to use the glibc version, but this doesn't tell us if the name itself is defined or not. If it _is_ defined, and we define our replacement as an inline static function, we get an error: In file included from ../src/basic/missing.h:1358:0, from ../src/basic/util.h:47, from ../src/basic/calendarspec.h:29, from ../src/basic/calendarspec.c:34: ../src/basic/missing_syscall.h:65:19: error: static declaration of 'memfd_create' follows non-static declaration static inline int memfd_create(const char *name, unsigned int flags) { ^~~~~~~~~~~~ .../usr/include/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here int memfd_create (const char *__name, unsigned int __flags) __THROW; ^~~~~~~~~~~~ To avoid this problem, call our inline functions different than glibc, and use a #define to map the official name to our replacement. Fixes #8099. v2: - use "missing_" as the prefix instead of "_" v3: - rebase and update for statx() Unfortunately "statx" is also present in "struct statx", so the define causes issues. Work around this by using a typedef. I checked that systemd compiles with current glibc (glibc-devel-2.26-24.fc27.x86_64) if HAVE_MEMFD_CREATE, HAVE_GETTID, HAVE_PIVOT_ROOT, HAVE_SETNS, HAVE_RENAMEAT2, HAVE_KCMP, HAVE_KEYCTL, HAVE_COPY_FILE_RANGE, HAVE_BPF, HAVE_STATX are forced to 0. Setting HAVE_NAME_TO_HANDLE_AT to 0 causes an issue, but it's not because of the define, but because of struct file_handle.
* xattr-util: use crtime/btime if statx() is available for implementation of ↵Lennart Poettering2018-05-30
| | | | | | | | | | | | | | fd_setcrtime() and friends The Linux kernel exposes the birth time now for files through statx() hence make use of it where available. We keep the xattr logic in place for this however, since only a subset of file systems on Linux currently expose the birth time. NFS and tmpfs for example do not support it. OTOH there are other file systems that do support the birth time but might not support xattrs (smb…), hence make the best of the two, in particular in order to deal with journal files copied between file system types and to maintain compatibility with older file systems that are updated to newer version of the file system.
* missing_syscall: when adding syscall replacements, use different names (#8229)Zbigniew Jędrzejewski-Szmek2018-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In meson.build we check that functions are available using: meson.get_compiler('c').has_function('foo') which checks the following: - if __stub_foo or __stub___foo are defined, return false - if foo is declared (a pointer to the function can be taken), return true - otherwise check for __builtin_memfd_create _stub is documented by glibc as It defines a symbol '__stub_FUNCTION' for each function in the C library which is a stub, meaning it will fail every time called, usually setting errno to ENOSYS. So if __stub is defined, we know we don't want to use the glibc version, but this doesn't tell us if the name itself is defined or not. If it _is_ defined, and we define our replacement as an inline static function, we get an error: In file included from ../src/basic/missing.h:1358:0, from ../src/basic/util.h:47, from ../src/basic/calendarspec.h:29, from ../src/basic/calendarspec.c:34: ../src/basic/missing_syscall.h:65:19: error: static declaration of 'memfd_create' follows non-static declaration static inline int memfd_create(const char *name, unsigned int flags) { ^~~~~~~~~~~~ .../usr/include/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here int memfd_create (const char *__name, unsigned int __flags) __THROW; ^~~~~~~~~~~~ To avoid this problem, call our inline functions different than glibc, and use a #define to map the official name to our replacement. Fixes #8099. v2: - use "missing_" as the prefix instead of "_" v3: - rebase and update for statx() Unfortunately "statx" is also present in "struct statx", so the define causes issues. Work around this by using a typedef. I checked that systemd compiles with current glibc (glibc-devel-2.26-24.fc27.x86_64) if HAVE_MEMFD_CREATE, HAVE_GETTID, HAVE_PIVOT_ROOT, HAVE_SETNS, HAVE_RENAMEAT2, HAVE_KCMP, HAVE_KEYCTL, HAVE_COPY_FILE_RANGE, HAVE_BPF, HAVE_STATX are forced to 0. Setting HAVE_NAME_TO_HANDLE_AT to 0 causes an issue, but it's not because of the define, but because of struct file_handle. (cherry picked from commit 5187dd2c403caf92d09f3491e41f1ceb3f10491f)
* missing: add bpf() define for ARM definitionHans-Christian Noren Egtvedt2018-05-30
|
* missing: fix bpf() define for TileraHans-Christian Noren Egtvedt2018-05-30
| | | | __NR_bpf syscall uses the default generic value for Tilera, e.g. 280.
* missing_syscall: when adding syscall replacements, use different names (#8229)Zbigniew Jędrzejewski-Szmek2018-04-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In meson.build we check that functions are available using: meson.get_compiler('c').has_function('foo') which checks the following: - if __stub_foo or __stub___foo are defined, return false - if foo is declared (a pointer to the function can be taken), return true - otherwise check for __builtin_memfd_create _stub is documented by glibc as It defines a symbol '__stub_FUNCTION' for each function in the C library which is a stub, meaning it will fail every time called, usually setting errno to ENOSYS. So if __stub is defined, we know we don't want to use the glibc version, but this doesn't tell us if the name itself is defined or not. If it _is_ defined, and we define our replacement as an inline static function, we get an error: In file included from ../src/basic/missing.h:1358:0, from ../src/basic/util.h:47, from ../src/basic/calendarspec.h:29, from ../src/basic/calendarspec.c:34: ../src/basic/missing_syscall.h:65:19: error: static declaration of 'memfd_create' follows non-static declaration static inline int memfd_create(const char *name, unsigned int flags) { ^~~~~~~~~~~~ .../usr/include/bits/mman-shared.h:46:5: note: previous declaration of 'memfd_create' was here int memfd_create (const char *__name, unsigned int __flags) __THROW; ^~~~~~~~~~~~ To avoid this problem, call our inline functions different than glibc, and use a #define to map the official name to our replacement. Fixes #8099. v2: - use "missing_" as the prefix instead of "_" v3: - rebase and update for statx() Unfortunately "statx" is also present in "struct statx", so the define causes issues. Work around this by using a typedef. I checked that systemd compiles with current glibc (glibc-devel-2.26-24.fc27.x86_64) if HAVE_MEMFD_CREATE, HAVE_GETTID, HAVE_PIVOT_ROOT, HAVE_SETNS, HAVE_RENAMEAT2, HAVE_KCMP, HAVE_KEYCTL, HAVE_COPY_FILE_RANGE, HAVE_BPF, HAVE_STATX are forced to 0. Setting HAVE_NAME_TO_HANDLE_AT to 0 causes an issue, but it's not because of the define, but because of struct file_handle.
* Prep v236 : Add missing SPDX-License-Identifier (2/9) src/basicSven Eden2018-03-26
|
* basic: remove redundant check (#7320)Topi Miettinen2017-11-13
| | | | | The check is redundant as the whole block is only evaluated if __IGNORE_pkey_mprotect is not defined. Change to #else.
* basic/missing: add numbers for pkey_mprotectZbigniew Jędrzejewski-Szmek2017-11-13
| | | | Follow-up for b835eeb4ec1dd122b6feff2b70881265c529fcdd.
* build-sys: change all HAVE_DECL_ macros to HAVE_Zbigniew Jędrzejewski-Szmek2017-11-22
| | | | | | | This is a legacy of autotools, where one detection routine used a different prefix then the others. $ git grep -e HAVE_DECL_ -l|xargs sed -i s/HAVE_DECL_/HAVE_/g
* Add abstraction model for BPF programsDaniel Mack2017-11-20
| | | | | This object takes a number of bpf_insn members and wraps them together with the in-kernel reference id. Will be needed by the firewall code.
* Prep v235: Add missing includes and dependencies.Sven Eden2017-08-14
|
* Copy defines for renameat2 from casync (#6181)Zbigniew Jędrzejewski-Szmek2017-07-25
|
* architecture: add Synopsys DesignWare ARC cores support (#5992)Alexey Brodkin2017-07-25
| | | | | DesignWare ARC Processors are a family of 32-bit CPUs from Synopsys used extensively in SoCs of different vendors.
* Prep v233: Add missing updates from upstream in src/basicSven Eden2017-07-17
|
* Prep v233: Unmask now needed functions in src/basicSven Eden2017-07-17
|
* missing: add renameat2() definition for 64bit arm (#5378)Lennart Poettering2017-07-17
| | | | | | Following a similar commit in casync: https://github.com/elogind/casync/pull/10
* Prep v231: Apply missing fixes from upstream (1/6) src/basicSven Eden2017-06-16
|
* missing_syscall: add __NR_copy_file_range for powerpc architecture (#3772)Alessio Igor Bogani2017-06-16
|
* Prep v230: Apply missing upstream fixes and updates (2/8) src/basic.Sven Eden2017-06-16
|
* basic/missing: move syscall definitions to basic/missing_syscall.hZbigniew Jędrzejewski-Szmek2017-06-16
We have a bunch of syscall wrapper definitions and it's easier to see that they follow the same pattern if they are not interspersed with other defines. Change the wrappers to be uniform: - if __NR_XXX is not defined, do not bother to call the syscall, and return -1/ENOSYS immediately. - do not check __NR_XXX defines if we detect the symbol as defined, since we don't need them anyway - reindent stuff for readability New file basic/missing_syscall.h is included at the end of missing.h because it might make use of some of the definitions in missing.h.