summaryrefslogtreecommitdiff
path: root/src/libudev
AgeCommit message (Collapse)Author
2013-07-31add various escaping/path handling utility functionsLennart Poettering
A portion of systemd commit 4fe88d28a4cfa504c1f2362d4a7030fae4c4af29 , needed to support changes made by commit 6284c1ca41dca85e968e8d304cdc154c5a46d6d2 Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31Revert "static-nodes: remove creation of static nodes if HAVE_LIBKMOD"Ian Stakenvicius
This reverts commit aa417a4d83999f6d7f092161d5c411b8cbce9977. Preface: The kmod+tmpfiles static dev-node creation requires two commands to be executed at runtime -- it is not something that will automatically occur without a system's setup being explicitly designed or changed so that these commands are executed. Preface2: In order for the kmod+tmpfiles static dev-node creation to work properly, that -must- be executed at startup before {systemd-,}udevd starts. The reason for this is because udevd will only set permissions on those files at startup, and so if udevd starts beforehand then these nodes will exist with permissions that are (probably) too restrictive. The function in udevd which creates static-nodes is non-fatal and only updates mtime on the devnodes if they already exist. As such, if a system is configured to execute kmod+tmpfiles to create static-nodes, because that must occur first, eudev's udevd will not conflict. Also, if a system does not execute kmod+tmpfiles, then eudev will still create the static devnodes, even if kmod-14 or higher is installed. There *may* be a conflict if kmod+tmpfiles is executed after udevd starts, but as per "preface2" this is not a supported configuration. Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-07-31static-nodes: remove creation of static nodes if HAVE_LIBKMODAnthony G. Basile
This address upstream commit edeb68c53f1cdc452016b4c8512586a70b1262e3 and https://bugs.gentoo.org/show_bug.cgi?id=477890. If eudev is configured with --enable-libkmod then we check for kmod >= 14 and ifdef out the code removed in the upstream commit. Otherwise we retain it for modutils. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-10Bring mkdir.c, label.c and util.c in better line with upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-07src/libudev/libudev-private.h: add missing include strxcpyx.hAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-07Add sanity checks to paths in cgroup-util.cAnthony G. Basile
This is part of upstream commit 9444b1f20e311f073864d81e913bd4f32fe95cfd Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-07-07Import strxcpyx from upstreamAnthony G. Basile
This commit imports strxcpyx from upstream. This is upstream commit d5a89d7dc17a5ba5cf4fc71f82963c5c94a31c3d Note: there were also some very minor code cleanups to accelerometer.c: line 187 collect.c: lines 35, 140 libudev-device.c: line 780 libudev-hwdb.c: line 300 These are part of upstream commits: 507f22bd0172bff5e5d98145b1419bd472a2c57f 3cf7b686e6b29f78de0af5929602cae4482f6d49 67410e9f73a6cdd8453c78b966451b5151def14a Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-15src/libudev/log.c: remove uneeded #include <printf.h>Anthony G. Basile
This header is unnecessary and causes a buildtime error on musl. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-06Round 2 of remove unused DECLS from src/libudev/{ioprio,log,macro,set,strv}Anthony G. Basile
Remove the following unused DECLS: IOPRIO_BITS IOPRIO_CLASS_SHIFT IOPRIO_PRIO_MASK IOPRIO_PRIO_CLASS IOPRIO_PRIO_DATA IOPRIO_PRIO_VALUE ioprio_valid IOPRIO_BE_NR IOPRIO_WHO_PROCESS IOPRIO_WHO_PGRP IOPRIO_WHO_USER MESSAGE_ID EXIT_TEST_SKIP XSTRINGIFY STRINGIFY ALIGN_PTR ALIGN4_PTR ALIGN8_PTR MAX MAX3 MIN CLAMP zero CHAR_TO_STR VA_FORMAT_ADVANCE SET_FLAG SET_FOREACH SET_FOREACH_BACKWARDS STRV_FOREACH_BACKWARDS STRV_FOREACH_PAIR _unused_ _destructor_ _deprecated_ _weak_ _hidden_ _weakref_ _introspect_ _alignas_ Remove the following unused static inline functions: static inline int ioprio_set static inline int ioprio_get static inline const char* STRV_IFNOTNULL Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-06Remove unused DECLS from src/libudev/{conf-files,def,exit-status,hashmap,util}.hAnthony G. Basile
The following unused DECLS are removed: DEFAULT_TIMEOUT_USEC DEFAULT_RESTART_USEC DEFAULT_CONFIRM_USEC DEFAULT_EXIT_USEC SIGNALS_CRASH_HANDLER SIGNALS_IGNORE EXIT_INVALIDARGUMENT EXIT_NOTIMPLEMENTED EXIT_NOPERMISSION EXIT_NOTINSTALLED EXIT_NOTCONFIGURED EXIT_NOTRUNNING EXIT_CHDIR EXIT_NICE EXIT_FDS EXIT_EXEC EXIT_MEMORY EXIT_LIMITS EXIT_OOM_ADJUST EXIT_SIGNAL_MASK EXIT_STDIN EXIT_STDOUT EXIT_CHROOT EXIT_IOPRI EXIT_TIMERSLACK EXIT_SECUREBITS EXIT_SETSCHEDULER EXIT_CPUAFFINITY EXIT_GROUP EXIT_USER EXIT_CAPABILITIES EXIT_CGROUP EXIT_SETSID EXIT_CONFIRM EXIT_STDERR EXIT_TCPWRAP EXIT_PAM EXIT_NETWORK EXIT_NAMESPACE EXIT_NO_NEW_PRIVILEGES EXIT_SECCOMP EXIT_STATUS_MINIMAL EXIT_STATUS_SYSTEMD EXIT_STATUS_LSB EXIT_STATUS_FULL HASHMAP_FOREACH_KEY HASHMAP_FOREACH_BACKWARDS FORMAT_TIMESTAMP_MAX FORMAT_TIMESTAMP_PRETTY_MAX FORMAT_TIMESPAN_MAX FORMAT_BYTES_MAX ANSI_HIGHLIGHT_ON ANSI_RED_ON ANSI_HIGHLIGHT_RED_ON dual_timestamp_is_set newa newdup FOREACH_WORD FOREACH_WORD_SEPARATOR NULSTR_FOREACH _cleanup_pclose_ _cleanup_umask_ _cleanup_globfree_ DRAW_TREE_VERT DRAW_TREE_BRANCH DRAW_TREE_RIGHT DRAW_TREE_SPACE DRAW_TRIANGULAR_BULLET _DRAW_SPECIAL_CHAR_MAX FOREACH_LINE procfs_file_alloca The following unused struct defs were removed: struct ExitStatusSet The following unused static inline funcs were remvoed: static inline int safe_atolu static inline int safe_atoli static inline int safe_atolu static inline int safe_atoli static inline int safe_atou32 static inline int safe_atoi32 static inline int safe_atou64 static inline int safe_atoi64 static inline const char* yes_no static inline const char* strempty static inline const char* strnull static inline const char *strna static inline void pclosep static inline void umaskp NOTE: Some unused DECLS were retained if they formed part of a logical series, eg. definition of time units. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-06Round 4 of remove unused functions from src/libudev/{hashmap,log,set,util}.cAnthony G. Basile
We removed the following functions: hashmap_merge path_is_read_only_fs set_free_free set_free_freep readlink_malloc hexchar unhexchar octchar unoctchar format_timespan Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-06Round 3 of remove unused functions from src/libudev/{conf-files,hashmap,util}Anthony G. Basile
The following functions were removed: strv_env_get_n strv_env_get conf_files_list hashmap_remove hashmap_move log_dump_internal parse_uid read_full_file strstrip file_in_same_dir cunescape cunescape_length cunescape_length_with_prefix xescape dirent_is_file close_all_fds read_one_char ask reset_terminal_fd reset_terminal flush_fd loop_read get_ctty_devnr get_ctty rm_rf_children rm_rf_children_dangerous rm_rf status_vprintf fd_columns columns fd_lines lines on_tty ellipsize ellipsize_mem touch unquote resolve_dev_console tty_is_vc vtnr_from_tty terminal_vhangup_fd terminal_vhangup file_is_priv_sticky signal_from_string fd_wait_for_event memdup memdup_multiply Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-05Round 2 of remove unused functions from ↵Anthony G. Basile
src/libudev/{hashmap,log,path-util,set,strv,util} We remove the following functions: cleanup_pool uint64_hash_func hashmap_ensure_allocated hashmap_clear_free_free hashmap_replace hashmap_remove_and_put hashmap_iterate_skip hashmap_first hashmap_first_key hashmap_last hashmap_isempty hashmap_move_one hashmap_copy log_metav_object log_show_color log_show_location path_strv_make_absolute_cwd path_startswith set_remove set_move set_clear strv_find strv_contains strv_merge strv_split strv_split_quoted strv_append strv_extend strv_push strv_split_nulstr str_compare dual_timestamp_get dual_timestamp_from_realtime timespec_store timeval_load timeval_store parse_boolean fchmod_umask parse_env_file get_process_comm get_process_id readlink_and_make_absolute bus_path_unescape format_timestamp acquire_terminal loop_write parse_usec make_stdio random_ull lookup_uid getttyname_malloc status_printf replace_env normalize_env_assignment wait_for_terminate freeze tag_to_udev_node tty_is_vc_resolve nulstr_contains strshorten hostname_valid_char display_is_local get_group_creds in_gid dirent_ensure_type is_locale_utf8 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-05Remove unused functions from src/libudev/util.cAnthony G. Basile
We remove the following unused functions: ascii_strlower block_get_whole_disk bus_path_escape can_sleep can_sleep_disk cescape chars_intersect chvt close_many close_pipe columns_lines_cache_reset copy_file cpu_set_malloc decchar default_signals default_term_for_tty delete_chars dir_is_empty draw_special_char dual_timestamp_deserialize dual_timestamp_serialize execute_directory fchmod_and_fchown fd_cloexec fd_inc_rcvbuf fd_nonblock filename_is_safe first_word fork_agent format_bytes format_timestamp_pretty fstab_node_to_udev_node fstype_is_network getenv_for_pid get_files_in_directory get_home_dir gethostname_malloc getlogname_malloc get_parent_of_pid get_process_cmdline get_process_exe get_process_gid get_process_uid get_starttime_of_pid getttyname_harder get_user_creds getusername_malloc glob_exists hostname_cleanup hostname_is_set hostname_is_valid ignore_signals in_charset in_group in_search_path is_device_path is_kernel_thread is_valid_documentation_url kexec_loaded kill_and_sigcont load_env_file make_console_stdio make_null_stdio parse_bytes parse_nsec parse_pid parse_timestamp pipe_eof plymouth_running prot_from_flags readlink_and_canonicalize release_terminal rename_process replace_env_argv reset_all_signal_handlers rmdir_parents rm_rf_dangerous running_in_chroot setrlimit_closest sigaction_many signal_from_string_try_harder sigset_add_many socket_from_display startswith_no_case status_welcome strdup_or_null string_is_safe strreplace symlink_atomic tty_is_console undecchar vt_disallocate wait_for_terminate_and_warn warn_melody write_env_file write_one_line_file_atomic xopendirat Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-05Remove unused functions from ↵Anthony G. Basile
src/libudev/{conf-files,exit-status,hashmap,log,path-util,set,strv}.c A lot of upstream commits cross many boundaries between systemd code and udev code. The point of intersection is upstreams src/shared folder. The best way we find to track them is to apply their commits to udev and libudev and then just pick remove functions from the shared folder. Its timely but it gives us the best control over what gets in and what doesnt. In this commit we removed the following functions: conf_files_list_nulstr exit_status_to_string is_clean_exit_lsb uint64_hash_func uint64_compare_func hashmap_free_free_free hashmap_update hashmap_get2 hashmap_remove_and_replace hashmap_remove_value hashmap_steal_first_key hashmap_next log_forget_fds log_set_facility log_meta_object log_struct_internal log_set_target_from_string log_set_max_level_from_string log_get_target log_get_max_level log_show_color_from_string log_show_location_from_string log_on_console is_path path_split_and_make_absolute set_ensure_allocated set_replace set_remove_and_put set_size set_isempty set_iterate_skip set_steal_first set_first set_last set_merge set_move_one set_copy set_clear_free set_get_strv strv_find_prefix strv_merge_concat strv_split_newlines strv_join strv_remove_prefix strv_parse_nulstr strv_overlap strv_sort strv_print Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/cgroup-util.{c,h}: bring in line with upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/hashmap.{c,h}: bring in line with upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/conf-files.{c,h}: bring in line with upstreamAnthony G. Basile
2013-06-04src/libudev/log.{c,h}: bring in line with upstreamAnthony G. Basile
2013-06-04src/libudev/strv.{c,h}: bring in line with upstreamAnthony G. Basile
In doing so, we better alined util.{c,h} by movig the definitions of freep, fclosep, closep, closedirp, umaskp from util.c to util.h as static inline. We also add strv_env_get to env-util.{c,h} which we forgot to do earlier. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/strbuf.c: bring in line with upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/{exit-status,macro,missing}.h: bring in line with upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/socket-util.h: slim downAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/util.c: bring in line with upstreamAnthony G. Basile
To bring this in line with upstream, we had to add in env-util.c. The approach we will take is to slim down upstream's "shared" code so that it only contains functions and macros for what we need. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-04src/libudev/path-util.c: bring in line with upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-03src/libudev/libudev-device.c: fix typoAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-02libudev: remove udev_monitor_new_from_socket() symbolMichael Biebl
This function was removed in v183, so drop it from the symbols versioning file.
2013-06-02libudev: Move -lrt to Libs.privateMichael Biebl
It's only needed for static linking. https://bugs.freedesktop.org/show_bug.cgi?id=63309 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-02Correct missing int to size_t changeAnthony G. Basile
This corrects a previously applied commit for upstream's acd42fae59096d84e78f1c17bfcc0d8f96486341 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-02libude: remove special handling of "device" link and legacy respecting codeKay Sievers
Remove special handling of device link by Sievers. Remove legacy respecting code by Basile. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-06-02libudev: implement udev_device_set_attribute_value()Hannes Reinecke
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-05adjust symbol versioning for libudevIan Stakenvicius
Libudev has a symbol version for 199 now, so the libudev_internal version (which is used to essentially hide symbols that are not part of the external API) needs to use 199 as its baseline instead of 196 Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-04-04Add support for legacy behaviour in udev_device_get_sysattr_value()Ian Stakenvicius
Wraps the changes made in systemd commits 5ae18ddc and 53726349 with a #if's on LIBUDEV_LEGACY_VERSION so that old behaviour can be chosen at build-time if users find it necessary to support legacy software dependent on the original behaviour Original Authors: Kay Sievers Signed-off-by: Ian Stakenvicius <axs@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-04Use LN_S instead of directly calling ln -sIan Stakenvicius
configure.ac has AC_PROG_LN_S already so we should use it. upstream did this in commit 783162123dbac43d5b7a3fab9d4f11dcf86d06e1 Signed-off-by: Ian Stakenvicius <axs@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-04-03Respect the MIT licenseklondike
Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-04-03Fix buffer overflowklondike
Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-04-03Clean up the string functionsklondike
Avoid two evaluations of src in util_strpcpy clean the code in the ones where the pointer passed is not modified and merge the main loop of util_strpcpyl and util_strscpyl into util_strpcpyv. Also make strpcpy more compact by removing some unnecessary arithmetic. Cleanup util_strpcpyv by shortcutting size == 0 case Do some style fixups Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-04-02libudev: update to 199Ian Stakenvicius
This updates the library codebase to upstream version 199. (originally merged by Anthony G. Basile <blueness@gentoo.org>) Upstream commits 5ae18ddc0d and 53726349e1 are not applied, code will be excluded via #if...#endif in a future commit Authors: Kay Sievers Thomas Hindoe Paaboel Andersen Hannes Reinecke Jan Engelhardt See http://cgit.freedesktop.org/systemd/systemd/log/src/libudev Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
2013-03-14Fix whitespace in various filesAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-02-07udevadm: support updating hwdb from an offset rootLuca Barbato
Introduce `--root` option to make users run udevadm on rootfs not mounted as / Ease the life of distribution packagers.
2013-01-28Port new net_id capabilities from systemd-udev-197Ian Stakenvicius
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-28Honor DEVUID, DEVGID in addition to DEVMODEIan Stakenvicius
New behaviour in udev-197 systemd commit 1edefa4f1d7bae6cc19aa4a97238400c5a04f7a4 Author: Kay Sievers <kay@vrfy.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-28Fix missing endian wrappersIan Stakenvicius
https://bugs.freedesktop.org/show_bug.cgi?id=58067 systemd commit f4443fa5976eca51661947dd4df60847213f27fa Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-28save a line of codeIan Stakenvicius
This mainly just helps keep diff's between eudev and systemd a little more clean, but it does drop one line of duplicate code. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-28Abort udev_enumerate_new if udev obj is nullIan Stakenvicius
https://bugs.freedesktop.org/show_bug.cgi?id=58289 systemd commit e68893075083a7461b1572233d23fdb23541d630 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-23src/libudev/util.c: fix typo introduce at commit 1ebf647Anthony G. Basile
The first argument of fcntl should be 'fd', the file descriptor. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-21Fall back on POSIX mkstemp() for systems lacking mkostemp()Anthony G. Basile
We add an autotools check to use mkstemp() and fcntl() when mkostemp() is missing. This is not strictly equivalent because we have no way of setting the file access mode O_WRONLY flag, but that should produce no functional difference. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-21Make all udev tools dynamically link to libudev.soIan Stakenvicius
Move libudev.so back to $(rootlibdir) for lvm2 support, and have all udev tools dynamically link to it. The symbol versioning and hidden-visibility on libudev were modified accordingly: we rebase against the public LIBUDEV_196 symbol versioning, and marked all other symbols (which used to be local) as LIBUDEV_internal. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-20Switch to dup2 from dup3Richard Yao
dup3() was being used in a situation where dup2() would suffice. uclibc does not support dup3(), so we switch to dup2(). Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2013-01-07The only functional changes in systemd-udev-196Ian Stakenvicius
As far as I can tell these are the only functional changes between the current eudev codebase and the codebase of systemd-196, in relation to udev hwdb code. There are some code style differences, and a number of error-trap-and-log lines that are not present, but that's about it Signed-off-by: Anthony G. Basile <blueness@gentoo.org>