summaryrefslogtreecommitdiff
path: root/src/basic/parse-util.c
Commit message (Collapse)AuthorAge
* basic: split parsing of the OOM score adjust value into its own function in ↵Lennart Poettering2018-08-24
| | | | | | | | | | parse-util.c And port config_parse_exec_oom_score_adjust() over to use it. While we are at it, let's also fix config_parse_exec_oom_score_adjust() to accept an empty string for turning off OOM score adjustments set earlier.
* parse-util: add explicit parsers for MTU valuesLennart Poettering2018-08-24
| | | | | | | | | We use MTUs all over the place, let's add a unified, strict parser for it, that takes MTU ranges into account. We already have parse_ifindex() close-by, hence this appears to be a natural addition, in particular as the range checking is not entirely trivial to do, as it depends on the protocol used.
* 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.
* parse-util: similar to safe_atou16_full() add safe_atou_full()Lennart Poettering2018-08-24
| | | | | | What's good for uint16_t is also good for unsigned. This is preparation for: #8140
* parse-util: introduce safe_atou16_full()Lennart Poettering2018-08-24
| | | | | | | safe_atou16_full() is like safe_atou16() but also takes a base parameter. safe_atou16() is then implemented as inline function on top of it, passing 0 as base. Similar safe_atoux16() is reworked as inline function too, with 16 as base.
* macro: introduce TAKE_PTR() macroLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This macro will read a pointer of any type, return it, and set the pointer to NULL. This is useful as an explicit concept of passing ownership of a memory area between pointers. This takes inspiration from Rust: https://doc.rust-lang.org/std/option/enum.Option.html#method.take and was suggested by Alan Jenkins (@sourcejedi). It drops ~160 lines of code from our codebase, which makes me like it. Also, I think it clarifies passing of ownership, and thus helps readability a bit (at least for the initiated who know the new macro)
* Prep v238: Uncomment now needed headers and unmask now needed functions in ↵Sven Eden2018-06-05
| | | | src/basic (1/6)
* Fix format-truncation compile failure by typecasting USB IDs (#8250)Patrick Uiterwijk2018-05-30
| | | | | | | | | | | | | | | This patch adds safe_atoux16 for parsing an unsigned hexadecimal 16bit int, and uses that for parsing USB device and vendor IDs. This fixes a compile error with gcc-8 because while we know that USB IDs are 2 bytes, the compiler does not know that. ../src/udev/udev-builtin-hwdb.c:80:38: error: '%04X' directive output may be truncated writing between 4 and 8 bytes into a region of size between 2 and 6 [-Werror=format-truncation=] Signed-off-by: Adam Williamson <awilliam@redhat.com> Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* parse-util: detect overflows in parse_percent_unbounded()Lennart Poettering2018-05-30
| | | | | We shouldn't accept percentages beyon INT32_MAX and consider them valid.
* parse-util: coding style fixLennart Poettering2018-05-30
| | | | Let's not rely on C's downgrade-to-bool feature to check for NUL bytes
* locale-util: add freelocale() cleanup helperLennart Poettering2018-05-30
|
* basic: introduce *_to_string_with_check() functionsYu Watanabe2018-05-30
| | | | They are used in later commits.
* Prep v236 : Add missing SPDX-License-Identifier (2/9) src/basicSven Eden2018-03-26
|
* tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-12-08
|
* Prep v235: Add missing includes and dependencies.Sven Eden2017-08-14
|
* Prep v235: Apply upstream fixes (3/10) [src/basic]Sven Eden2017-08-14
|
* parse-util: introduce parse_dev() helperFranck Bui2017-07-25
|
* fix includesMatija Skala2017-07-25
| | | | | | | linux/sockios.h is needed for the SIOCGSTAMPNS macro xlocale.h is included indirectly in glibc and doesn't even exist in other libcs
* Prep v233.3: Unmask various functions for future coverage tests.Sven Eden2017-07-19
| | | | | These functions, although not used by elogind itself, are mostly tiny and crucial for important tests to work.
* Prep v233.2: Mask unneeded functions and definitions in src/basicSven Eden2017-07-18
|
* core: introduce parse_ip_port (#4825)Susant Sahani2017-07-17
| | | | | | 1. Listed in TODO. 2. Tree wide replace safe_atou16 with parse_ip_port incase it's used for ports.
* Prep v232: Mask new functions that are unneeded by elogindSven Eden2017-07-05
|
* Prep v232: Apply missing updates from upstreamSven Eden2017-07-05
|
* util-lib: add parse_percent_unbounded() for percentages over 100% (#3886)David Michael2017-07-05
| | | | This permits CPUQuota to accept greater values as documented.
* Prep v231.2: Make elogind musl-libc-compatible again.Sven Eden2017-06-19
|
* util-lib: introduce parse_percent() for parsing percent specificationsLennart Poettering2017-06-16
| | | | And port a couple of users over to it.
* Prep v230: Apply missing upstream fixes and updates (2/8) src/basic.Sven Eden2017-06-16
|
* tree-wide: minor formatting inconsistency cleanupsVito Caputo2017-06-16
|
* Prep v229: Some musl-libc compatibility updatesSven Eden2017-05-22
| | | | | | - musl-libc has no <bits/local_lim.h> - musl-libc has no <xlocale.h> - added <missing.h> include to basic/mdkir.c
* Prep v229: Add missing fixes from upstream [1/6] src/basicSven Eden2017-05-17
|
* tree-wide: check if errno is greater than zero (2)Zbigniew Jędrzejewski-Szmek2017-05-17
| | | | | Compare errno with zero in a way that tells gcc that (if the condition is true) errno is positive.
* calendarspec: sub-second support, v3Hristo Venev2017-05-17
|
* Prep v228: Condense elogind source masks (2/5)Sven Eden2017-04-26
|
* Prep v228: Add remaining updates from upstream (1/3)Sven Eden2017-04-26
The util.[hc] files have been stripped of a lot of functions, that got sorted into various new files representing the type of utility. This commit adds the missing files.