summaryrefslogtreecommitdiff
path: root/src/libudev
Commit message (Collapse)AuthorAgeFilesLines
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-2/+0
| | | | | | | 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-06-1412-17/+17
| | | | | | 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: drop 'This file is part of systemd' blurbLennart Poettering2018-06-1413-26/+0
| | | | | | | | | | | | | | | | 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-05-221-1/+0
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-0613-169/+0
| | | | | | | | | | 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.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-051-2/+1
|
* macro: introduce TAKE_PTR() macroLennart Poettering2018-03-221-5/+1
| | | | | | | | | | | | | | | | 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)
* Make MANAGER_TEST_RUN_MINIMAL just allocate data structuresZbigniew Jędrzejewski-Szmek2018-03-111-2/+1
| | | | | | | | | When running tests like test-unit-name, there is not point in setting up the cgroup and signals and interacting with the environment. Similarly when running fuzz testing of the parser. Add new MANAGER_TEST_RUN_BASIC which takes the role of MANAGER_TEST_RUN_MINIMAL, and redefine MANAGER_TEST_RUN_MINIMAL to just create the basic data structures.
* coccinelle: add reallocarray() coccinelle scriptLennart Poettering2018-03-021-12/+10
| | | | | Let's systematically make use of reallocarray() whereever we invoke realloc() with a product of two values.
* Merge pull request #8134 from keszybz/unit-load-pathsZbigniew Jędrzejewski-Szmek2018-02-091-2/+2
|\ | | | | Various fixes to unit load paths, and systemd-analyze load-paths verb to list them
| * tree-wide: use "cannot" instead of "can not"Zbigniew Jędrzejewski-Szmek2018-02-081-2/+2
| | | | | | | | This is the usual spelling, and a bit shorter.
* | udev: use "#pragma once"Yu Watanabe2018-02-091-5/+2
|/
* io-util: make flush_fd() return how many bytes where flushedLennart Poettering2018-01-051-1/+9
| | | | | | | | | | | This is useful so that callers know whether anything at all and how much was flushed. This patches through users of this functions to ensure that the return values > 0 which may be returned now are not propagated in public APIs. Also, users that ignore the return value are changed to do so explicitly now.
* meson: rename libudev_internal to libudev_static and link into libudevZbigniew Jędrzejewski-Szmek2018-01-031-15/+2
| | | | | | | | | | | | | This reduces the meson man=false target count to 1281. v2: - link test-engine with libshared instead of libsystemd_static Previous version built fine on F27, but fails on F26 with the following error: /usr/bin/ld: /tmp/ccr8HRGw.ltrans6.ltrans.o: undefined reference to symbol '__start_BUS_ERROR_MAP@@SD_SHARED' /home/zbyszek/fedora/systemd/systemd-9d5aae75c64f5583a110f03b94816aacc03bbf4d/x86_64-redhat-linux-gnu/src/shared/libsystemd-shared-236.so: error adding symbols: DSO missing from command line v3: - add libudev_basic
* meson: rename libsystemd_internal to libsystem_staticZbigniew Jędrzejewski-Szmek2017-12-211-1/+1
| | | | | | | | | We already use the "_static" suffix for libshared_static ("shared" is the name of the library, "static" is the format) and other libs, so let's rename for consistency. Also change libsystemd_static_sources to libsystemd_sources, since the same list is used for both and shorter is better.
* Replace free and return NULL with return mfreeDaniel Lockyer2017-11-244-8/+4
|
* udev: port udev_has_devtmpfs() to use path_get_mnt_id()Lennart Poettering2017-11-211-11/+8
| | | | | This means there's a good chance the code also works on kernels that lack name_to_handle_at().
* mount-util: add name_to_handle_at_loop() wrapper around name_to_handle_at()Lennart Poettering2017-11-211-2/+1
| | | | | | | | | | | | | As it turns out MAX_HANDLE_SZ is a lie, the handle buffer we pass into name_to_handle_at() might need to be larger than MAX_HANDLE_SZ, and we thus need to invoke name_to_handle_at() in a loop, growing the buffer as needed. This adds a new wrapper name_to_handle_at_loop() around name_to_handle_at() that does the necessary looping, and ports over all users. Fixes: #7082
* Add license headers and SPDX identifiers to meson.build filesZbigniew Jędrzejewski-Szmek2017-11-191-0/+17
| | | | | | | So far I avoided adding license headers to meson files, but they are pretty big and important and should carry license headers like everything else. I added my own copyright, even though other people modified those files too. But this is mostly symbolic, so I hope that's OK.
* Add SPDX license headers to various assorted filesZbigniew Jędrzejewski-Szmek2017-11-192-0/+4
|
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-1912-0/+12
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* string-util: add delete_trailing_chars() and skip_leading_chars() helpersLennart Poettering2017-11-132-12/+0
| | | | And let's port over a couple of users to the new APIs.
* meson: move library version defines to the top (#6939)Zbigniew Jędrzejewski-Szmek2017-09-281-1/+1
|
* libudev: add missing errno initialization/error propagation (#6781)Lennart Poettering2017-09-095-16/+63
| | | | | | | | | In libudev (which es much older code than the rest of systemd), we propagate errors in functions not returning an int, via (positive) errno (i.e. libc-style), and as negative Exyz values in those returning an int (much preferred, i.e. Linux kernel style). Let's fix up a few place, where this was incorrectly done, or not done at all. Fixes: #6613
* Merge pull request #6365 from keszybz/fast-testsMartin Pitt2017-07-281-1/+0
|\ | | | | Make tests faster by default
| * libudev: unused variableZbigniew Jędrzejewski-Szmek2017-07-121-1/+0
| |
* | build-sys: drop gitignore patterns for in-tree buildsZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | | | | ... and other autotools-generated files.
* | build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
|/ | | | | v2: - also mention m4
* tree-wide: when %m is used in log_*, always specify errno explicitlyZbigniew Jędrzejewski-Szmek2017-05-191-1/+1
| | | | | | | | All those uses were correct, but I think it's better to be explicit. Using implicit errno is too error prone, and with this change we can require (in the sense of a style guideline) that the code is always specified. Helpful query: git grep -n -P 'log_[^s][a-z]+\(.*%m'
* Rip out setting of the log level from udev_new and put it in a new functionZbigniew Jędrzejewski-Szmek2017-05-071-76/+0
| | | | | | | | This function is internal to systemd code, so external users of libudev will not see those log messages. I think this is better. If we want to allow that, the function could be put in libudev and exported. v2: check that the string is more than one char before stripping quotes
* meson: reindent all files with 8 spacesZbigniew Jędrzejewski-Szmek2017-04-231-28/+26
| | | | | | | The indentation for emacs'es meson-mode is added .dir-locals. All files are reindented automatically, using the lasest meson-mode from git. Indentation should now be fairly consistent.
* meson: eliminate libsystemd_journal_internal and use libsystemd_internal lessZbigniew Jędrzejewski-Szmek2017-04-231-9/+2
| | | | | | | | | This simplifies things and leads to a smaller installation footprint. libsystemd_internal and libsystemd_journal_internal are linked into libystemd-shared and available to all programs linked to libsystemd-shared. libsystemd_journal_internal is not needed anymore, and libsystemd-shared is used everwhere. The few exceptions are: libsystemd.so, test-engine, test-bus-error, and various loadable modules.
* meson: update linking for fixed meson linkingZbigniew Jędrzejewski-Szmek2017-04-231-1/+2
| | | | | | | | With mesonbuid/meson#1545, meson does not propagate deps of a library when linking with that library. That's of course the right thing to do, but it exposes a bunch of missing deps. This compiles with both meson-0.39.1 and meson-git + pr/1545.
* meson: add test-libudev-symZbigniew Jędrzejewski-Szmek2017-04-231-3/+3
| | | | | | This is slightly complicated by the fact that files('libudev.h') cannot be used as an argument in custom_target command (string is required). This restriction should be lifted in future versions of mesons, so this could be simplified.
* meson: include the library symbol version list in link_dependsZbigniew Jędrzejewski-Szmek2017-04-231-2/+4
| | | | | | | | | | | | | This is pretty ugly, because I don't know how to use a single definition for two purposes: - --version-script needs a path relative to the build root - link_depends needs a path relative to source root Also, link_depends does not accept files() output [https://github.com/mesonbuild/meson/issues/1172], and I don't see a way to go from files() output to a string path that can be used to craft the -Wl arg. Ideally, a single files() result could be used in both places. I'm leaving this as a separate commit for now.
* meson: build systemd using mesonZbigniew Jędrzejewski-Szmek2017-04-231-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's crucial that we can build systemd using VS2010! ... er, wait, no, that's not the official reason. We need to shed old systems by requring python 3! Oh, no, it's something else. Maybe we need to throw out 345 years of knowlege accumulated in autotools? Whatever, this new thing is cool and shiny, let's use it. This is not complete, I'm throwing it out here for your amusement and critique. - rules for sd-boot are missing. Those might be quite complicated. - rules for tests are missing too. Those are probably quite simple and repetitive, but there's lots of them. - it's likely that I didn't get all the conditions right, I only tested "full" compilation where most deps are provided and nothing is disabled. - busname.target and all .busname units are skipped on purpose. Otherwise, installation into $DESTDIR has the same list of files and the autoconf install, except for .la files. It'd be great if people had a careful look at all the library linking options. I added stuff until things compiled, and in the end there's much less linking then in the old system. But it seems that there's still a lot of unnecessary deps. meson has a `shared_module` statement, which sounds like something appropriate for our nss and pam modules. Unfortunately, I couldn't get it to work. For the nss modules, we need an .so version of '2', but `shared_module` disallows the version argument. For the pam module, it also didn't work, I forgot the reason. The handling of .m4 and .in and .m4.in files is rather awkward. It's likely that this could be simplified. If make support is ever dropped, I think it'd make sense to switch to a different templating system so that two different languages and not required, which would make everything simpler yet. v2: - use get_pkgconfig_variable - use sh not bash - use add_project_arguments v3: - drop required:true and fix progs/prog typo v4: - use find_library('bz2') - add TTY_GID definition - define __SANE_USERSPACE_TYPES__ - use join_paths(prefix, ...) is used on all paths to make them all absolute v5: - replace all declare_dependency's with [] - add more conf.get guards around optional components v6: - drop -pipe, -Wall which are the default in meson - use compiler.has_function() and compiler.has_header_symbol instead of the hand-rolled checks. - fix duplication in 'liblibsystemd' library name - use the right .sym file for pam_systemd - rename 'compiler' to 'cc': shorter, and more idiomatic. v7: - use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D - rename prefix to prefixdir, rootprefix to rootprefixdir ("prefix" is too common of a name and too easy to overwrite by mistake) - wrap more stuff with conf.get('ENABLE...') == 1 - use rootprefix=='/' and rootbindir as install_dir, to fix paths under split-usr==true. v8: - use .split() also for src/coredump. Now everything is consistent ;) - add rootlibdir option and use it on the libraries that require it v9: - indentation v10: - fix check for qrencode and libaudit v11: - unify handling of executable paths, provide options for all progs This makes the meson build behave slightly differently than the autoconf-based one, because we always first try to find the executable in the filesystem, and fall back to the default. I think different handling of loadkeys, setfont, and telinit was just a historical accident. In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs. In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin), but in Debian, those directories are not included in the path. C.f. https://github.com/mesonbuild/meson/issues/1576. - call all the options 'xxx-path' for clarity. - sort man/rules/meson.build properly so it's stable
* tree-wide: standardize on $(PACKAGE_VERSION) for the version stringZbigniew Jędrzejewski-Szmek2017-04-041-1/+1
| | | | | | We defined both $(VERSION) and $(PACKAGE_VERSION) with the same contents. $(PACKAGE_VERSION) is slightly more descriptive, so settle on that, and drop the other define.
* Revert "udev: Introduce UDEV_PROPAGATE_LOG macro (#5302)"Lennart Poettering2017-02-231-3/+0
| | | | | | | This reverts commit c22569eeeafa94cf510267071f5b75c4ab714e09. Let's revert this for now, since it apparently doesn't fix the problem at hand.
* udev: Introduce UDEV_PROPAGATE_LOG macro (#5302)Susant Sahani2017-02-221-0/+3
| | | | | | | | | | | | | | | As per commit 25e773e "udev: switch to systemd logging functions" Now log_set_max_level() in udev_new() overwites system wide log level. Propagate the udev.conf setting to log_set_max_level() only if udev_new() is called from within udevd or one of its helpers. Introduce a UDEV_PROPAGATE_LOG macro that we set with -D on the gcc command line for all udev binaries we build, but not for any others. The log_set_max_level() call is guarded by an ifdef check for that macro, so that it only effects the various udev binaries. closes: #4525
* udev-event: use in-place whitespace replacementDan Streetman2017-01-271-0/+14
| | | | | | | Instead of using a temp buffer to replace whitespace in variable substitutions, just allow util_replace_whitespace to replace in-place. Add a comment to util_replace_whitespace indicating it is used to replace in-place, to prevent accidental future breakage.
* libudev-util: change util_replace_whitespace to return number of chars in destDan Streetman2017-01-031-1/+1
| | | | | | | | | Instead of returning 0, which is unhelpful, return the number of chars copied into the dest string. This allows callers that care about that to easily use it, instead of having to calculate the strlen. No current users of the function check the return value, so this does not break any existing code; it is used in the following patch.
* libudev: set errno if udev_new() failsLennart Poettering2016-12-071-1/+3
| | | | All other constructors in libudev do that, let's also do this for udev_new().
* Spot inconsistent quoting (just one single quote) (#4732)Tobias Stoeckmann2016-12-011-1/+1
| | | | | | | | It is possible to specify only one quote in udev rules, which is not detected as an invalid quoting (" instead of "" for empty string). Technically this doesn't lead to a bug, because the string ends in two terminating nul characters at this position, but a user should still be reminded that his configuration is invalid.
* Merge pull request #4612 from keszybz/format-stringsZbigniew Jędrzejewski-Szmek2016-11-081-1/+1
|\ | | | | Format string tweaks (and a small fix on 32bit)
| * Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2016-11-071-1/+1
| | | | | | | | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* | Adjust pkgconfig files to point at rootlibdir (#4584)Mike Gilbert2016-11-081-1/+1
|/ | | The .so symlinks got moved to rootlibdir in 082210c7.
* tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek2016-10-162-10/+7
|
* libudev: fix typo in commentPeter Hutterer2016-08-191-1/+1
|
* treewide: fix typos and remove accidental repetition of wordsTorstein Husebø2016-07-111-1/+1
|
* tree-wide: htonl() is weird, let's use htobe32() instead (#3538)Lennart Poettering2016-06-151-7/+7
| | | Super-important change, yeah!